From 03fed0f42d8eee0820a9aa18ee8c2d9dc727b807 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 2 Oct 2014 14:10:48 -0400 Subject: [PATCH 0001/1883] Some AA updates from PEQ --- utils/sql/git/optional/2014_10_02_AAFixes.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 utils/sql/git/optional/2014_10_02_AAFixes.sql diff --git a/utils/sql/git/optional/2014_10_02_AAFixes.sql b/utils/sql/git/optional/2014_10_02_AAFixes.sql new file mode 100644 index 000000000..1d6242b9f --- /dev/null +++ b/utils/sql/git/optional/2014_10_02_AAFixes.sql @@ -0,0 +1,13 @@ +-- Fix Salvage +UPDATE `aa_effects` SET `effectid` = '331' WHERE `aaid` IN (997, 998, 999); +-- Rapid Strikes missing entries +INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('818', '1', '279', '17', '0'); +INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('819', '1', '279', '19', '0'); +-- Secondary Forte fixes client side display issues +INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('691', '1', '248', '100', '0'); +-- Packrat this is what live uses +UPDATE `aa_effects` SET `base1` = '3' WHERE `aaid` = 678; +UPDATE `aa_effects` SET `base1` = '6' WHERE `aaid` = 679; +UPDATE `aa_effects` SET `base1` = '9' WHERE `aaid` = 680; +UPDATE `aa_effects` SET `base1` = '12' WHERE `aaid` = 681; +UPDATE `aa_effects` SET `base1` = '15' WHERE `aaid` = 682; From 272180ff0f1af852545337fb9a7b23bf22d3bf07 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 2 Oct 2014 20:18:54 -0400 Subject: [PATCH 0002/1883] Detached direct packet routing for some older client opcodes --- changelog.txt | 3 + common/eq_packet_structs.h | 29 ++-- common/patches/client62.cpp | 269 +++++++++++++++++++++++++++-- common/patches/client62_ops.h | 20 +++ common/patches/client62_structs.h | 55 +++--- common/patches/rof.cpp | 5 + common/patches/rof_structs.h | 30 ++-- common/patches/sod.cpp | 1 + common/patches/sod_structs.h | 34 ++-- common/patches/sof.cpp | 1 + common/patches/sof_structs.h | 34 ++-- common/patches/titanium.cpp | 267 ++++++++++++++++++++++++++-- common/patches/titanium_ops.h | 20 +++ common/patches/titanium_structs.h | 55 +++--- common/patches/underfoot.cpp | 1 + common/patches/underfoot_structs.h | 34 ++-- 16 files changed, 713 insertions(+), 145 deletions(-) diff --git a/changelog.txt b/changelog.txt index cdbda16e0..81233fcd7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/02/2014 == +Uleat: First round of Ti/6.2 translators added - needed for re-enumeration + == 10/01/2014 == Kayen: Exported to PERL $client->SendColoredText(color, msg) demonstar55: Exported SendColoredText to lua diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 2e4b29261..47516b24a 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -1449,17 +1449,18 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; }; struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ }; struct MoveItem_Struct @@ -1467,16 +1468,18 @@ struct MoveItem_Struct /*0000*/ uint32 from_slot; /*0004*/ uint32 to_slot; /*0008*/ uint32 number_in_stack; +/*0012*/ }; // both MoveItem_Struct/DeleteItem_Struct server structures will be changing to a structure-based slot format..this will // be used for handling SoF/SoD/etc... time stamps sent using the MoveItem_Struct format. (nothing will be done with this -// info at the moment..but, it forwards it on to the server for handling/future use) +// info at the moment..but, it is forwarded on to the server for handling/future use) struct ClientTimeStamp_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ }; // @@ -3400,7 +3403,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index 65ebe3600..bbc8757d0 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -18,15 +18,15 @@ namespace Client62 static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); + char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth); // server to client inventory location converters - static inline uint32 ServerToClient62Slot(uint32 ServerSlot); - static inline uint32 ServerToClient62CorpseSlot(uint32 ServerCorpse); + static inline int16 ServerToClient62Slot(uint32 ServerSlot); + static inline int16 ServerToClient62CorpseSlot(uint32 ServerCorpse); // client to server inventory location converters - static inline uint32 Client62ToServerSlot(uint32 Client62Slot); - static inline uint32 Client62ToServerCorpseSlot(uint32 Client62Corpse); + static inline uint32 Client62ToServerSlot(int16 Client62Slot); + static inline uint32 Client62ToServerCorpseSlot(int16 Client62Corpse); void Register(EQStreamIdentifier &into) { @@ -131,6 +131,31 @@ namespace Client62 FINISH_ENCODE(); } + ENCODE(OP_AdventureMerchantSell) + { + ENCODE_LENGTH_EXACT(Adventure_Sell_Struct); + SETUP_DIRECT_ENCODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + eq->unknown000 = 1; + OUT(npcid); + eq->slot = ServerToClient62Slot(emu->slot); + OUT(charges); + OUT(sell_price); + + FINISH_ENCODE(); + } + + ENCODE(OP_ApplyPoison) + { + ENCODE_LENGTH_EXACT(ApplyPoison_Struct); + SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + eq->inventorySlot = ServerToClient62Slot(emu->inventorySlot); + OUT(success); + + FINISH_ENCODE(); + } + ENCODE(OP_BazaarSearch) { EQApplicationPacket *in = *p; @@ -234,6 +259,20 @@ namespace Client62 dest->FastQueuePacket(&in, ack_req); } + ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); } + + ENCODE(OP_DeleteItem) + { + ENCODE_LENGTH_EXACT(DeleteItem_Struct); + SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + eq->from_slot = ServerToClient62Slot(emu->from_slot); + eq->to_slot = ServerToClient62Slot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + ENCODE(OP_DeleteSpawn) { SETUP_DIRECT_ENCODE(DeleteSpawn_Struct, structs::DeleteSpawn_Struct); @@ -400,6 +439,31 @@ namespace Client62 FINISH_ENCODE(); } + ENCODE(OP_LootItem) + { + ENCODE_LENGTH_EXACT(LootingItem_Struct); + SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct); + + OUT(lootee); + OUT(looter); + eq->slot_id = emu->slot_id; + OUT(auto_loot); + + FINISH_ENCODE(); + } + + ENCODE(OP_MoveItem) + { + ENCODE_LENGTH_EXACT(MoveItem_Struct); + SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct); + + eq->from_slot = ServerToClient62Slot(emu->from_slot); + eq->to_slot = ServerToClient62Slot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + ENCODE(OP_NewSpawn) { ENCODE_FORWARD(OP_ZoneSpawns); } ENCODE(OP_OnLevelMessage) @@ -616,6 +680,7 @@ namespace Client62 ENCODE(OP_ReadBook) { + // no apparent slot translation needed -U EQApplicationPacket *in = *p; *p = nullptr; @@ -732,6 +797,19 @@ namespace Client62 FINISH_ENCODE(); } + ENCODE(OP_ShopPlayerSell) + { + ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct); + SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + OUT(npcid); + eq->itemslot = ServerToClient62Slot(emu->itemslot); + OUT(quantity); + OUT(price); + + FINISH_ENCODE(); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; @@ -764,6 +842,19 @@ namespace Client62 dest->FastQueuePacket(&in, ack_req); } + ENCODE(OP_TributeItem) + { + ENCODE_LENGTH_EXACT(TributeItem_Struct); + SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct); + + eq->slot = ServerToClient62Slot(emu->slot); + OUT(quantity); + OUT(tribute_master_id); + OUT(tribute_points); + + FINISH_ENCODE(); + } + ENCODE(OP_WearChange) { ENCODE_LENGTH_EXACT(WearChange_Struct); @@ -875,6 +966,59 @@ namespace Client62 } // DECODE methods + DECODE(OP_AdventureMerchantSell) + { + DECODE_LENGTH_EXACT(structs::Adventure_Sell_Struct); + SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + IN(npcid); + emu->slot = Client62ToServerSlot(eq->slot); + IN(charges); + IN(sell_price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ApplyPoison) + { + DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct); + SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + emu->inventorySlot = Client62ToServerSlot(eq->inventorySlot); + IN(success); + + FINISH_DIRECT_DECODE(); + } + +#if 0 + // needs to be tested (and OpCode found) + DECODE(OP_AugmentInfo) { DECODE_FORWARD(OP_ReadBook); } +#endif + + DECODE(OP_AugmentItem) + { + DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); + SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); + + emu->container_slot = Client62ToServerSlot(eq->container_slot); + emu->augment_slot = eq->augment_slot; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_CastSpell) + { + DECODE_LENGTH_EXACT(structs::CastSpell_Struct); + SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); + + IN(slot); + IN(spell_id); + emu->inventoryslot = Client62ToServerSlot(eq->inventoryslot); + IN(target_id); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); @@ -903,6 +1047,30 @@ namespace Client62 FINISH_DIRECT_DECODE(); } + DECODE(OP_Consume) + { + DECODE_LENGTH_EXACT(structs::Consume_Struct); + SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct); + + emu->slot = Client62ToServerSlot(eq->slot); + IN(auto_consumed); + IN(type); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_DeleteItem) + { + DECODE_LENGTH_EXACT(structs::DeleteItem_Struct); + SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + emu->from_slot = Client62ToServerSlot(eq->from_slot); + emu->to_slot = Client62ToServerSlot(eq->to_slot); + IN(number_in_stack); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); @@ -935,8 +1103,36 @@ namespace Client62 FINISH_DIRECT_DECODE(); } + DECODE(OP_LootItem) + { + DECODE_LENGTH_EXACT(structs::LootingItem_Struct); + SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct); + + IN(lootee); + IN(looter); + emu->slot_id = eq->slot_id; + IN(auto_loot); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_MoveItem) + { + DECODE_LENGTH_EXACT(structs::MoveItem_Struct); + SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); + + _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + + emu->from_slot = Client62ToServerSlot(eq->from_slot); + emu->to_slot = Client62ToServerSlot(eq->to_slot); + IN(number_in_stack); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_ReadBook) { + // no apparent slot translation needed -U DECODE_LENGTH_ATLEAST(structs::BookRequest_Struct); SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct); @@ -964,6 +1160,43 @@ namespace Client62 FINISH_DIRECT_DECODE(); } + DECODE(OP_ShopPlayerSell) + { + DECODE_LENGTH_EXACT(structs::Merchant_Purchase_Struct); + SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + IN(npcid); + emu->itemslot = Client62ToServerSlot(eq->itemslot); + IN(quantity); + IN(price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_TradeSkillCombine) + { + DECODE_LENGTH_EXACT(structs::NewCombine_Struct); + SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); + + emu->container_slot = Client62ToServerSlot(eq->container_slot); + IN(guildtribute_slot); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_TributeItem) + { + DECODE_LENGTH_EXACT(structs::TributeItem_Struct); + SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct); + + emu->slot = Client62ToServerSlot(eq->slot); + IN(quantity); + IN(tribute_master_id); + IN(tribute_points); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_WearChange) { DECODE_LENGTH_EXACT(structs::WearChange_Struct); @@ -992,13 +1225,14 @@ namespace Client62 } // file scope helper methods - char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth) + char *SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) { char *serialization = nullptr; char *instance = nullptr; const char *protection = (const char *)"\\\\\\\\\\"; char *sub_items[10] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; bool stackable = inst->IsStackable(); + int16 slot_id = ServerToClient62Slot(slot_id_in); uint32 merchant_slot = inst->GetMerchantSlot(); int16 charges = inst->GetCharges(); const Item_Struct *item = inst->GetItem(); @@ -1009,7 +1243,8 @@ namespace Client62 "%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|", stackable ? charges : 1, 0, - (merchant_slot == 0) ? slot_id : merchant_slot, + //(merchant_slot == 0) ? slot_id : merchant_slot, // change when translator activated + (merchant_slot == 0) ? slot_id_in : merchant_slot, inst->GetPrice(), (merchant_slot == 0) ? 1 : inst->GetMerchantCount(), 0, @@ -1075,22 +1310,30 @@ namespace Client62 return serialization; } - static inline uint32 ServerToClient62Slot(uint32 ServerSlot) + static inline int16 ServerToClient62Slot(uint32 ServerSlot) { - //uint32 Client62Slot; + //int16 Client62Slot; + if (ServerSlot == INVALID_INDEX) + return INVALID_INDEX; + + return ServerSlot; // deprecated } - static inline uint32 ServerToClient62CorpseSlot(uint32 ServerCorpse) + static inline int16 ServerToClient62CorpseSlot(uint32 ServerCorpse) { - //uint32 Client62Corpse; + //int16 Client62Corpse; } - static inline uint32 Client62ToServerSlot(uint32 Client62Slot) + static inline uint32 Client62ToServerSlot(int16 Client62Slot) { //uint32 ServerSlot; + if (Client62Slot == INVALID_INDEX) + return INVALID_INDEX; + + return Client62Slot; // deprecated } - static inline uint32 Client62ToServerCorpseSlot(uint32 Client62Corpse) + static inline uint32 Client62ToServerCorpseSlot(int16 Client62Corpse) { //uint32 ServerCorpse; } diff --git a/common/patches/client62_ops.h b/common/patches/client62_ops.h index 8f544ccfc..0ff0cdaa7 100644 --- a/common/patches/client62_ops.h +++ b/common/patches/client62_ops.h @@ -1,8 +1,12 @@ // out-going packets that require an ENCODE translation: E(OP_Action) +E(OP_AdventureMerchantSell) +E(OP_ApplyPoison) E(OP_BazaarSearch) E(OP_BecomeTrader) E(OP_CharInventory) +E(OP_DeleteCharge) +E(OP_DeleteItem) E(OP_DeleteSpawn) E(OP_GuildMemberLevelUpdate) E(OP_GuildMemberList) @@ -10,6 +14,8 @@ E(OP_Illusion) E(OP_ItemLinkResponse) E(OP_ItemPacket) E(OP_LeadershipExpUpdate) +E(OP_LootItem) +E(OP_MoveItem) E(OP_NewSpawn) E(OP_OnLevelMessage) E(OP_PetBuffWindow) @@ -18,17 +24,31 @@ E(OP_ReadBook) E(OP_RespondAA) E(OP_SendAATable) E(OP_SendCharInfo) +E(OP_ShopPlayerSell) E(OP_Track) +E(OP_TributeItem) E(OP_WearChange) E(OP_ZoneEntry) E(OP_ZoneServerReady) E(OP_ZoneSpawns) // incoming packets that require a DECODE translation: +D(OP_AdventureMerchantSell) +D(OP_ApplyPoison) +//D(OP_AugmentInfo) - needs opcode for conf file update +D(OP_AugmentItem) +D(OP_CastSpell) D(OP_CharacterCreate) +D(OP_Consume) +D(OP_DeleteItem) D(OP_FaceChange) D(OP_ItemLinkClick) +D(OP_LootItem) +D(OP_MoveItem) D(OP_ReadBook) D(OP_SetServerFilter) +D(OP_ShopPlayerSell) +D(OP_TradeSkillCombine) +D(OP_TributeItem) D(OP_WearChange) D(OP_WhoAllRequest) #undef E diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h index 73726e165..70f05859e 100644 --- a/common/patches/client62_structs.h +++ b/common/patches/client62_structs.h @@ -406,7 +406,7 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint8 cs_unknown[4]; }; /* @@ -1148,19 +1148,27 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; }; +struct DeleteItem_Struct +{ +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ +}; struct MoveItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ }; // @@ -1362,12 +1370,6 @@ struct CombatAbility_Struct { uint32 m_skill; }; -struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; -}; - //Instill Doubt struct Instill_Doubt_Struct { uint8 i_id; @@ -1521,6 +1523,14 @@ struct Adventure_Purchase_Struct { /*008*/ uint32 variable; }; +struct Adventure_Sell_Struct { +/*000*/ uint32 unknown000; //0x01 +/*004*/ uint32 npcid; +/*008*/ uint32 slot; +/*012*/ uint32 charges; +/*016*/ uint32 sell_price; +}; + struct AdventurePoints_Update_Struct { /*000*/ uint32 ldon_available_points; // Total available points /*004*/ uint8 unkown_apu004[20]; @@ -2524,10 +2534,10 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { @@ -2563,7 +2573,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; @@ -3076,6 +3086,11 @@ struct AnnoyingZoneUnknown_Struct { uint32 value; //always 4 }; +struct ApplyPoison_Struct { + uint32 inventorySlot; + uint32 success; +}; + struct GuildMemberUpdate_Struct { /*00*/ uint32 guild_id; //not sure /*04*/ char member_name[64]; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 2643b909e..581858381 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4671,6 +4671,7 @@ namespace RoF slot_id = legacy::SLOT_TRADESKILL; // 1000 } emu->container_slot = slot_id; + emu->guildtribute_slot = RoFToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented -U FINISH_DIRECT_DECODE(); } @@ -5498,6 +5499,10 @@ namespace RoF ServerSlot = TempSlot; }*/ + else if (RoFSlot.SlotType == maps::MapGuildTribute) { + ServerSlot = INVALID_INDEX; + } + _log(NET__ERROR, "Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 79b4f21b8..9cec4f5fa 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -1678,7 +1678,7 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*000*/ ItemSlotStruct slot; +/*000*/ ItemSlotStruct slot; /*012*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click /*016*/ uint32 type; // 0x01=Food 0x02=Water /*020*/ uint32 c_unknown1; // Seen 2 @@ -1711,17 +1711,17 @@ struct ItemProperties_Struct { }; struct DeleteItem_Struct { -/*0000*/ ItemSlotStruct from_slot; -/*0004*/ ItemSlotStruct to_slot; -/*0008*/ uint32 number_in_stack; -/*0012*/ +/*0000*/ ItemSlotStruct from_slot; +/*0012*/ ItemSlotStruct to_slot; +/*0024*/ uint32 number_in_stack; +/*0028*/ }; struct MoveItem_Struct { -/*0000*/ ItemSlotStruct from_slot; -/*0004*/ ItemSlotStruct to_slot; -/*0008*/ uint32 number_in_stack; -/*0012*/ +/*0000*/ ItemSlotStruct from_slot; +/*0012*/ ItemSlotStruct to_slot; +/*0024*/ uint32 number_in_stack; +/*0028*/ }; // @@ -2045,7 +2045,7 @@ struct Merchant_Sell_Struct { struct Merchant_Purchase_Struct { /*000*/ uint32 npcid; // Merchant NPC's entity id -/*004*/ MainInvItemSlotStruct itemslot; +/*004*/ MainInvItemSlotStruct itemslot; /*012*/ uint32 quantity; /*016*/ uint32 price; /*020*/ @@ -3488,10 +3488,10 @@ struct TributeInfo_Struct { struct TributeItem_Struct { -/*00*/ ItemSlotStruct slot; -/*12*/ uint32 quantity; -/*16*/ uint32 tribute_master_id; -/*20*/ int32 tribute_points; +/*00*/ ItemSlotStruct slot; +/*12*/ uint32 quantity; +/*16*/ uint32 tribute_master_id; +/*20*/ int32 tribute_points; /*24*/ }; @@ -3527,7 +3527,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ ItemSlotStruct container_slot; -/*12*/ ItemSlotStruct unknown_slot; // Slot type is 8? +/*12*/ ItemSlotStruct guildtribute_slot; // Slot type is 8? (MapGuildTribute = 8 -U) /*24*/ }; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 69ec9f1cb..90c5644fe 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3074,6 +3074,7 @@ namespace SoD SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); emu->container_slot = SoDToServerSlot(eq->container_slot); + IN(guildtribute_slot); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index ffd6e9ecb..ea4726a62 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -519,7 +519,7 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint8 cs_unknown[4]; }; /* @@ -1469,11 +1469,11 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; /*0016*/ }; @@ -1503,17 +1503,17 @@ struct ItemProperties_Struct { }; struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; struct MoveItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; @@ -3090,10 +3090,10 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { @@ -3129,7 +3129,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5e00a2870..861edcb3d 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2398,6 +2398,7 @@ namespace SoF SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); emu->container_slot = SoFToServerSlot(eq->container_slot); + IN(guildtribute_slot); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 7d250a568..0beb17db6 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -497,7 +497,7 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint8 cs_unknown[4]; }; /* @@ -1445,11 +1445,11 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; /*0016*/ }; @@ -1479,17 +1479,17 @@ struct ItemProperties_Struct { }; struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; struct MoveItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; @@ -2953,10 +2953,10 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { @@ -2992,7 +2992,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index eaa7b3b10..92695f7a1 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -18,15 +18,15 @@ namespace Titanium static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); + char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth); // server to client inventory location converters - static inline uint32 ServerToTitaniumSlot(uint32 ServerSlot); - static inline uint32 ServerToTitaniumCorpseSlot(uint32 ServerCorpse); + static inline int16 ServerToTitaniumSlot(uint32 ServerSlot); + static inline int16 ServerToTitaniumCorpseSlot(uint32 ServerCorpse); // client to server inventory location converters - static inline uint32 TitaniumToServerSlot(uint32 TitaniumSlot); - static inline uint32 TitaniumToServerCorpseSlot(uint32 TitaniumCorpse); + static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot); + static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse); void Register(EQStreamIdentifier &into) { @@ -133,6 +133,31 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_AdventureMerchantSell) + { + ENCODE_LENGTH_EXACT(Adventure_Sell_Struct); + SETUP_DIRECT_ENCODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + eq->unknown000 = 1; + OUT(npcid); + eq->slot = ServerToTitaniumSlot(emu->slot); + OUT(charges); + OUT(sell_price); + + FINISH_ENCODE(); + } + + ENCODE(OP_ApplyPoison) + { + ENCODE_LENGTH_EXACT(ApplyPoison_Struct); + SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + eq->inventorySlot = ServerToTitaniumSlot(emu->inventorySlot); + OUT(success); + + FINISH_ENCODE(); + } + ENCODE(OP_BazaarSearch) { if (((*p)->size == sizeof(BazaarReturnDone_Struct)) || ((*p)->size == sizeof(BazaarWelcome_Struct))) { @@ -237,6 +262,20 @@ namespace Titanium dest->FastQueuePacket(&in, ack_req); } + ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); } + + ENCODE(OP_DeleteItem) + { + ENCODE_LENGTH_EXACT(DeleteItem_Struct); + SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + eq->from_slot = ServerToTitaniumSlot(emu->from_slot); + eq->to_slot = ServerToTitaniumSlot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + ENCODE(OP_DeleteSpawn) { SETUP_DIRECT_ENCODE(DeleteSpawn_Struct, structs::DeleteSpawn_Struct); @@ -608,6 +647,31 @@ namespace Titanium delete in; } + ENCODE(OP_LootItem) + { + ENCODE_LENGTH_EXACT(LootingItem_Struct); + SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct); + + OUT(lootee); + OUT(looter); + eq->slot_id = emu->slot_id; + OUT(auto_loot); + + FINISH_ENCODE(); + } + + ENCODE(OP_MoveItem) + { + ENCODE_LENGTH_EXACT(MoveItem_Struct); + SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct); + + eq->from_slot = ServerToTitaniumSlot(emu->from_slot); + eq->to_slot = ServerToTitaniumSlot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + ENCODE(OP_NewSpawn) { ENCODE_FORWARD(OP_ZoneSpawns); } ENCODE(OP_OnLevelMessage) @@ -870,6 +934,7 @@ namespace Titanium ENCODE(OP_ReadBook) { + // no apparent slot translation needed -U EQApplicationPacket *in = *p; *p = nullptr; @@ -992,6 +1057,19 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_ShopPlayerSell) + { + ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct); + SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + OUT(npcid); + eq->itemslot = ServerToTitaniumSlot(emu->itemslot); + OUT(quantity); + OUT(price); + + FINISH_ENCODE(); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; @@ -1052,6 +1130,19 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_TributeItem) + { + ENCODE_LENGTH_EXACT(TributeItem_Struct); + SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct); + + eq->slot = ServerToTitaniumSlot(emu->slot); + OUT(quantity); + OUT(tribute_master_id); + OUT(tribute_points); + + FINISH_ENCODE(); + } + ENCODE(OP_VetRewardsAvaliable) { EQApplicationPacket *inapp = *p; @@ -1232,6 +1323,57 @@ namespace Titanium } // DECODE methods + DECODE(OP_AdventureMerchantSell) + { + DECODE_LENGTH_EXACT(structs::Adventure_Sell_Struct); + SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + IN(npcid); + emu->slot = TitaniumToServerSlot(eq->slot); + IN(charges); + IN(sell_price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ApplyPoison) + { + DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct); + SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + emu->inventorySlot = TitaniumToServerSlot(eq->inventorySlot); + IN(success); + + FINISH_DIRECT_DECODE(); + } + + // needs to be tested + DECODE(OP_AugmentInfo) { DECODE_FORWARD(OP_ReadBook); } + + DECODE(OP_AugmentItem) + { + DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); + SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); + + emu->container_slot = TitaniumToServerSlot(eq->container_slot); + emu->augment_slot = eq->augment_slot; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_CastSpell) + { + DECODE_LENGTH_EXACT(structs::CastSpell_Struct); + SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); + + IN(slot); + IN(spell_id); + emu->inventoryslot = TitaniumToServerSlot(eq->inventoryslot); + IN(target_id); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); @@ -1260,6 +1402,30 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_Consume) + { + DECODE_LENGTH_EXACT(structs::Consume_Struct); + SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct); + + emu->slot = TitaniumToServerSlot(eq->slot); + IN(auto_consumed); + IN(type); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_DeleteItem) + { + DECODE_LENGTH_EXACT(structs::DeleteItem_Struct); + SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + emu->from_slot = TitaniumToServerSlot(eq->from_slot); + emu->to_slot =TitaniumToServerSlot(eq->to_slot); + IN(number_in_stack); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); @@ -1347,8 +1513,36 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_LootItem) + { + DECODE_LENGTH_EXACT(structs::LootingItem_Struct); + SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct); + + IN(lootee); + IN(looter); + emu->slot_id = eq->slot_id; + IN(auto_loot); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_MoveItem) + { + DECODE_LENGTH_EXACT(structs::MoveItem_Struct); + SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); + + _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + + emu->from_slot = TitaniumToServerSlot(eq->from_slot); + emu->to_slot = TitaniumToServerSlot(eq->to_slot); + IN(number_in_stack); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_ReadBook) { + // no apparent slot translation needed -U DECODE_LENGTH_ATLEAST(structs::BookRequest_Struct); SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct); @@ -1372,6 +1566,19 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_ShopPlayerSell) + { + DECODE_LENGTH_EXACT(structs::Merchant_Purchase_Struct); + SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + IN(npcid); + emu->itemslot = TitaniumToServerSlot(eq->itemslot); + IN(quantity); + IN(price); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_TraderBuy) { DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); @@ -1388,6 +1595,30 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_TradeSkillCombine) + { + DECODE_LENGTH_EXACT(structs::NewCombine_Struct); + SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); + + emu->container_slot = TitaniumToServerSlot(eq->container_slot); + IN(guildtribute_slot); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_TributeItem) + { + DECODE_LENGTH_EXACT(structs::TributeItem_Struct); + SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct); + + emu->slot = TitaniumToServerSlot(eq->slot); + IN(quantity); + IN(tribute_master_id); + IN(tribute_points); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_WearChange) { DECODE_LENGTH_EXACT(structs::WearChange_Struct); @@ -1422,13 +1653,14 @@ namespace Titanium } // file scope helper methods - char *SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth) + char *SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) { char *serialization = nullptr; char *instance = nullptr; const char *protection = (const char *)"\\\\\\\\\\"; char *sub_items[10] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; bool stackable = inst->IsStackable(); + int16 slot_id = ServerToTitaniumSlot(slot_id_in); uint32 merchant_slot = inst->GetMerchantSlot(); int16 charges = inst->GetCharges(); const Item_Struct *item = inst->GetItem(); @@ -1439,7 +1671,8 @@ namespace Titanium "%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|", stackable ? charges : 0, 0, - (merchant_slot == 0) ? slot_id : merchant_slot, + //(merchant_slot == 0) ? slot_id : merchant_slot, // change when translator activated + (merchant_slot == 0) ? slot_id_in : merchant_slot, inst->GetPrice(), (merchant_slot == 0) ? 1 : inst->GetMerchantCount(), 0, @@ -1503,22 +1736,30 @@ namespace Titanium return serialization; } - static inline uint32 ServerToTitaniumSlot(uint32 ServerSlot) + static inline int16 ServerToTitaniumSlot(uint32 ServerSlot) { - //uint32 TitaniumSlot; + //int16 TitaniumSlot; + if (ServerSlot == INVALID_INDEX) + return INVALID_INDEX; + + return ServerSlot; // deprecated } - static inline uint32 ServerToTitaniumCorpseSlot(uint32 ServerCorpse) + static inline int16 ServerToTitaniumCorpseSlot(uint32 ServerCorpse) { - //uint32 TitaniumCorpse; + //int16 TitaniumCorpse; } - static inline uint32 TitaniumToServerSlot(uint32 TitaniumSlot) + static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot) { //uint32 ServerSlot; + if (TitaniumSlot == INVALID_INDEX) + return INVALID_INDEX; + + return TitaniumSlot; // deprecated } - static inline uint32 TitaniumToServerCorpseSlot(uint32 TitaniumCorpse) + static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse) { //uint32 ServerCorpse; } diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 40651a652..2aa3d8071 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -1,8 +1,12 @@ // out-going packets that require an ENCODE translation: E(OP_Action) +E(OP_AdventureMerchantSell) +E(OP_ApplyPoison) E(OP_BazaarSearch) E(OP_BecomeTrader) E(OP_CharInventory) +E(OP_DeleteCharge) +E(OP_DeleteItem) E(OP_DeleteSpawn) E(OP_DzCompass) E(OP_DzExpeditionEndsWarning) @@ -20,6 +24,8 @@ E(OP_ItemLinkResponse) E(OP_ItemPacket) E(OP_LeadershipExpUpdate) E(OP_LFGuild) +E(OP_LootItem) +E(OP_MoveItem) E(OP_OnLevelMessage) E(OP_PetBuffWindow) E(OP_PlayerProfile) @@ -28,24 +34,38 @@ E(OP_ReadBook) E(OP_RespondAA) E(OP_SendCharInfo) E(OP_SendAATable) +E(OP_ShopPlayerSell) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) +E(OP_TributeItem) E(OP_VetRewardsAvaliable) E(OP_WearChange) E(OP_ZoneEntry) E(OP_ZoneServerReady) E(OP_ZoneSpawns) // incoming packets that require a DECODE translation: +D(OP_AdventureMerchantSell) +D(OP_ApplyPoison) +D(OP_AugmentInfo) +D(OP_AugmentItem) +D(OP_CastSpell) D(OP_CharacterCreate) +D(OP_Consume) +D(OP_DeleteItem) D(OP_FaceChange) D(OP_InspectAnswer) D(OP_InspectRequest) D(OP_ItemLinkClick) D(OP_LFGuild) +D(OP_LootItem) +D(OP_MoveItem) D(OP_ReadBook) D(OP_SetServerFilter) +D(OP_ShopPlayerSell) D(OP_TraderBuy) +D(OP_TradeSkillCombine) +D(OP_TributeItem) D(OP_WearChange) D(OP_WhoAllRequest) #undef E diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 1fcd31b77..0e74af75e 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -419,7 +419,7 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint8 cs_unknown[4]; }; /* @@ -1217,19 +1217,27 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; }; +struct DeleteItem_Struct +{ +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ +}; struct MoveItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; +/*0012*/ }; // @@ -1431,12 +1439,6 @@ struct CombatAbility_Struct { uint32 m_skill; }; -struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; -}; - //Instill Doubt struct Instill_Doubt_Struct { uint8 i_id; @@ -1590,6 +1592,14 @@ struct Adventure_Purchase_Struct { /*008*/ uint32 variable; }; +struct Adventure_Sell_Struct { +/*000*/ uint32 unknown000; //0x01 +/*004*/ uint32 npcid; +/*008*/ uint32 slot; +/*012*/ uint32 charges; +/*016*/ uint32 sell_price; +}; + struct AdventurePoints_Update_Struct { /*000*/ uint32 ldon_available_points; // Total available points /*004*/ uint8 unkown_apu004[20]; @@ -2583,10 +2593,10 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { @@ -2622,7 +2632,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; @@ -3154,6 +3164,11 @@ struct AnnoyingZoneUnknown_Struct { uint32 value; //always 4 }; +struct ApplyPoison_Struct { + uint32 inventorySlot; + uint32 success; +}; + struct GuildMemberUpdate_Struct { /*000*/ uint32 guild_id; //not sure /*004*/ char member_name[64]; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index a1d16f077..0cec336b2 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3472,6 +3472,7 @@ namespace Underfoot SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); emu->container_slot = UnderfootToServerSlot(eq->container_slot); + IN(guildtribute_slot); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 8226e8fd7..f7716834b 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -519,7 +519,7 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint32 cs_unknown[5]; + uint32 cs_unknown[5]; }; /* @@ -1505,11 +1505,11 @@ struct BulkItemPacket_Struct struct Consume_Struct { -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; +/*0000*/ uint32 slot; +/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*0008*/ uint8 c_unknown1[4]; +/*0012*/ uint8 type; // 0x01=Food 0x02=Water +/*0013*/ uint8 unknown13[3]; /*0016*/ }; @@ -1539,17 +1539,17 @@ struct ItemProperties_Struct { }; struct DeleteItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; struct MoveItem_Struct { -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; +/*0000*/ uint32 from_slot; +/*0004*/ uint32 to_slot; +/*0008*/ uint32 number_in_stack; /*0012*/ }; @@ -3129,10 +3129,10 @@ struct TributeInfo_Struct { }; struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; + uint32 slot; + uint32 quantity; + uint32 tribute_master_id; + int32 tribute_points; }; struct TributePoint_Struct { @@ -3168,7 +3168,7 @@ struct Split_Struct */ struct NewCombine_Struct { /*00*/ int16 container_slot; -/*02*/ char unknown02[2]; +/*02*/ int16 guildtribute_slot; /*04*/ }; From 968127c414e2413dc43b3ca9ec5b26b51a252605 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 2 Oct 2014 22:08:12 -0400 Subject: [PATCH 0003/1883] Exported to PERL $client->SendSpellAnim(targetid, spellid) This function sends the spell graphic of a spell without actually having to cast the spell. --- changelog.txt | 4 ++++ zone/client.h | 1 + zone/perl_client.cpp | 28 ++++++++++++++++++++++++++++ zone/spells.cpp | 16 ++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/changelog.txt b/changelog.txt index 81233fcd7..693393bac 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/02/2014 == +Kayen: Exported to PERL $client->SendSpellAnim(targetid, spellid) +This function sends the spell graphic of a spell without actually having to cast the spell. + == 10/02/2014 == Uleat: First round of Ti/6.2 translators added - needed for re-enumeration diff --git a/zone/client.h b/zone/client.h index 235861396..d600b51c5 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1155,6 +1155,7 @@ public: const char* GetClassPlural(Client* client); void SendWebLink(const char* website); void SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, std::string msg); + void SendSpellAnim(uint16 targetid, uint16 spell_id); void DuplicateLoreMessage(uint32 ItemID); void GarbleMessage(char *, uint8); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 04becfdc8..a33e9a8b9 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -6046,6 +6046,32 @@ XS(XS_Client_SendColoredText) XSRETURN_EMPTY; } +XS(XS_Client_SendSpellAnim); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Client_SendSpellAnim) +{ + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: SendSpellAnim(uint16 spell_id, uint32 seq)"); + { + Client * THIS; + uint16 targetid = (uint16)SvUV(ST(1)); + uint16 spell_id = (uint16)SvUV(ST(2)); + dXSTARG; + + if (sv_derived_from(ST(0), "Client")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Client *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Client"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->SendSpellAnim(targetid,spell_id); + } + XSRETURN_EMPTY; +} + #ifdef __cplusplus extern "C" #endif @@ -6286,6 +6312,8 @@ XS(boot_Client) newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$"); newXSproto(strcpy(buf, "SendMarqueeMessage"), XS_Client_SendMarqueeMessage, file, "$$$$$$$"); newXSproto(strcpy(buf, "SendColoredText"), XS_Client_SendColoredText, file, "$$$"); + newXSproto(strcpy(buf, "SendSpellAnim"), XS_Client_SendSpellAnim, file, "$$$"); + XSRETURN_YES; } diff --git a/zone/spells.cpp b/zone/spells.cpp index fb3cba454..913ea0f26 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5329,3 +5329,19 @@ void NPC::UninitializeBuffSlots() safe_delete_array(buffs); } +void Client::SendSpellAnim(uint16 targetid, uint16 spell_id) +{ + if (!targetid || !IsValidSpell(spell_id)) + return; + + EQApplicationPacket app(OP_Action, sizeof(Action_Struct)); + Action_Struct* a = (Action_Struct*)app.pBuffer; + a->target = targetid; + a->source = this->GetID(); + a->type = 231; + a->spell = spell_id; + a->sequence = 231; + + app.priority = 1; + entity_list.QueueCloseClients(this, &app); +} From b3d8e22539b1a9bc97e9f5bc211a7649d85c8616 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 2 Oct 2014 22:52:25 -0400 Subject: [PATCH 0004/1883] Make ZoneDatabase::FillAAEffects get the data from memory Note: This should probably be moved out of ZoneDatabase --- zone/aa.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 1f933b30e..8af3896d3 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1751,19 +1751,15 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){ if(!aa_struct) return; - std::string query = StringFormat("SELECT effectid, base1, base2, slot from aa_effects where aaid=%i order by slot asc", aa_struct->id); - auto results = QueryDatabase(query); - if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Client::FillAAEffects query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); - return; - } - - int index = 0; - for (auto row = results.begin(); row != results.end(); ++row, ++index) { - aa_struct->abilities[index].skill_id=atoi(row[0]); - aa_struct->abilities[index].base1=atoi(row[1]); - aa_struct->abilities[index].base2=atoi(row[2]); - aa_struct->abilities[index].slot=atoi(row[3]); + auto it = aa_effects.find(aa_struct->id); + if (it != aa_effects.end()) { + for (int slot = 0; slot < aa_struct->total_abilities; slot++) { + // aa_effects is a map of a map, so the slot reference does not start at 0 + aa_struct->abilities[slot].skill_id = it->second[slot + 1].skill_id; + aa_struct->abilities[slot].base1 = it->second[slot + 1].base1; + aa_struct->abilities[slot].base2 = it->second[slot + 1].base2; + aa_struct->abilities[slot].slot = it->second[slot + 1].slot; + } } } From 0438dee22e125d53e0edb2c270151d5f505bf2de Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 3 Oct 2014 01:37:51 -0400 Subject: [PATCH 0005/1883] Rework ZoneDatabase::SavePetInfo -- should be better Worst case before some something like 96 queries. --- zone/zonedb.cpp | 136 ++++++++++++++++++++---------------------------- 1 file changed, 57 insertions(+), 79 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index b49837704..7815b5b96 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2895,96 +2895,74 @@ void ZoneDatabase::LoadBuffs(Client *client) { } } -void ZoneDatabase::SavePetInfo(Client *client) { +void ZoneDatabase::SavePetInfo(Client *client) +{ + PetInfo *petinfo = nullptr; - PetInfo *petinfo = client->GetPetInfo(0); - PetInfo *suspended = client->GetPetInfo(1); - - std::string query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u", client->CharacterID()); - auto results = database.QueryDatabase(query); - if(!results.Success()) + std::string query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u", client->CharacterID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) return; - query = StringFormat("DELETE FROM `character_pet_buffs` WHERE `char_id` = %u", client->CharacterID()); + query = StringFormat("DELETE FROM `character_pet_inventory` WHERE `char_id` = %u", client->CharacterID()); results = database.QueryDatabase(query); - if(!results.Success()) + if (!results.Success()) return; - query = StringFormat("INSERT INTO `character_pet_info` " - "(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) " - "VALUES (%u, 0, '%s', %i, %u, %u, %u, %f) " - "ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, " - "`hp` = %u, `mana` = %u, `size` = %f", - client->CharacterID(), petinfo->Name, petinfo->petpower, petinfo->SpellID, - petinfo->HP, petinfo->Mana, petinfo->size, petinfo->Name, petinfo->petpower, - petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size); - results = database.QueryDatabase(query); - if(!results.Success()) - return; + for (int pet = 0; pet < 2; pet++) { + petinfo = client->GetPetInfo(pet); + if (!petinfo) + continue; - for(int index = 0; index < RuleI(Spells, MaxTotalSlotsPET); index++) { - if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0) - continue; + query = StringFormat("INSERT INTO `character_pet_info` " + "(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) " + "VALUES (%u, %u, '%s', %i, %u, %u, %u, %f) " + "ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, " + "`hp` = %u, `mana` = %u, `size` = %f", + client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID, + petinfo->HP, petinfo->Mana, petinfo->size, // and now the ON DUPLICATE ENTRIES + petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size); + results = database.QueryDatabase(query); + if (!results.Success()) + return; + query.clear(); - query = StringFormat("INSERT INTO `character_pet_buffs` " - "(`char_id`, `pet`, `slot`, `spell_id`, `caster_level`, " - "`ticsremaining`, `counters`) " - "VALUES (%u, 0, %u, %u, %u, %u, %d)", - client->CharacterID(), index, petinfo->Buffs[index].spellid, - petinfo->Buffs[index].level, petinfo->Buffs[index].duration, - petinfo->Buffs[index].counters); - database.QueryDatabase(query); - } + // pet buffs! + for (int index = 0; index < RuleI(Spells, MaxTotalSlotsPET); index++) { + if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0) + continue; + if (query.length() == 0) + query = StringFormat("INSERT INTO `character_pet_buffs` " + "(`char_id`, `pet`, `slot`, `spell_id`, `caster_level`, " + "`ticsremaining`, `counters`) " + "VALUES (%u, %u, %u, %u, %u, %u, %d)", + client->CharacterID(), pet, index, petinfo->Buffs[index].spellid, + petinfo->Buffs[index].level, petinfo->Buffs[index].duration, + petinfo->Buffs[index].counters); + else + query += StringFormat(", (%u, %u, %u, %u, %u, %u, %d)", + client->CharacterID(), pet, index, petinfo->Buffs[index].spellid, + petinfo->Buffs[index].level, petinfo->Buffs[index].duration, + petinfo->Buffs[index].counters); + } + database.QueryDatabase(query); + query.clear(); - for(int index = 0; index < RuleI(Spells, MaxTotalSlotsPET); index++) { - if (petinfo->Buffs[index].spellid == SPELL_UNKNOWN || petinfo->Buffs[index].spellid == 0) - continue; + // pet inventory! + for (int index = EmuConstants::EQUIPMENT_BEGIN; index <= EmuConstants::EQUIPMENT_END; index++) { + if (!petinfo->Items[index]) + continue; - query = StringFormat("INSERT INTO `character_pet_buffs` " - "(`char_id`, `pet`, `slot`, `spell_id`, `caster_level`, " - "`ticsremaining`, `counters`) " - "VALUES (%u, 1, %u, %u, %u, %u, %d)", - client->CharacterID(), index, suspended->Buffs[index].spellid, - suspended->Buffs[index].level, suspended->Buffs[index].duration, - suspended->Buffs[index].counters); - database.QueryDatabase(query); + if (query.length() == 0) + query = StringFormat("INSERT INTO `character_pet_inventory` " + "(`char_id`, `pet`, `slot`, `item_id`) " + "VALUES (%u, %u, %u, %u)", + client->CharacterID(), pet, index, petinfo->Items[index]); + else + query += StringFormat(", (%u, %u, %u, %u)", client->CharacterID(), pet, index, petinfo->Items[index]); + } + database.QueryDatabase(query); } - - for (int index = EmuConstants::EQUIPMENT_BEGIN; index <= EmuConstants::EQUIPMENT_END; index++) { - if(!petinfo->Items[index]) - continue; - - query = StringFormat("INSERT INTO `character_pet_inventory` " - "(`char_id`, `pet`, `slot`, `item_id`) " - "VALUES (%u, 0, %u, %u)", - client->CharacterID(), index, petinfo->Items[index]); - database.QueryDatabase(query); - } - - query = StringFormat("INSERT INTO `character_pet_info` " - "(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) " - "VALUES (%u, 1, '%s', %u, %u, %u, %u, %f) " - "ON DUPLICATE KEY UPDATE " - "`petname`='%s', `petpower`=%i, `spell_id`=%u, `hp`=%u, `mana`=%u, `size`=%f", - client->CharacterID(), suspended->Name, suspended->petpower, suspended->SpellID, - suspended->HP, suspended->Mana, suspended->size, suspended->Name, suspended->petpower, - suspended->SpellID, suspended->HP, suspended->Mana, suspended->size); - results = database.QueryDatabase(query); - if(!results.Success()) - return; - - - for (int index = EmuConstants::EQUIPMENT_BEGIN; index <= EmuConstants::EQUIPMENT_END; index++) { - if(!suspended->Items[index]) - continue; - - query = StringFormat("INSERT INTO `character_pet_inventory` " - "(`char_id`, `pet`, `slot`, `item_id`) " - "VALUES (%u, 1, %u, %u)", - client->CharacterID(), index, suspended->Items[index]); - database.QueryDatabase(query); - } - } void ZoneDatabase::RemoveTempFactions(Client *client) { From bb2bed7b00dc17e55516c9d412a534b5c8861eca Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 3 Oct 2014 02:03:48 -0400 Subject: [PATCH 0006/1883] Fixed OP_AugmentInfo packet processing that I broked'd --- changelog.txt | 3 +++ common/eq_packet_structs.h | 6 +++--- common/patches/client62.cpp | 5 ----- common/patches/client62_ops.h | 1 - common/patches/client62_structs.h | 5 ----- common/patches/rof_structs.h | 6 +++--- common/patches/sod_structs.h | 6 +++--- common/patches/sof_structs.h | 6 +++--- common/patches/titanium.cpp | 3 --- common/patches/titanium_ops.h | 1 - common/patches/underfoot_structs.h | 6 +++--- 11 files changed, 18 insertions(+), 30 deletions(-) diff --git a/changelog.txt b/changelog.txt index 81233fcd7..b31afa449 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/03/2014 == +Uleat: Fixed Ti(6.2) OP_AugmentInfo translation that I broke (does not currently need and I mis-read a process) + == 10/02/2014 == Uleat: First round of Ti/6.2 translators added - needed for re-enumeration diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 47516b24a..8e5588e5c 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -4312,9 +4312,9 @@ struct ControlBoat_Struct { struct AugmentInfo_Struct { -/*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[67]; // total packet length 72, all the rest were always 00 +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint8 window; // window to display the information in +/*005*/ uint8 unknown005[67]; // total packet length 72, all the rest were always 00 /*072*/ }; diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index bbc8757d0..d9def3dbb 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -990,11 +990,6 @@ namespace Client62 FINISH_DIRECT_DECODE(); } -#if 0 - // needs to be tested (and OpCode found) - DECODE(OP_AugmentInfo) { DECODE_FORWARD(OP_ReadBook); } -#endif - DECODE(OP_AugmentItem) { DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); diff --git a/common/patches/client62_ops.h b/common/patches/client62_ops.h index 0ff0cdaa7..eb7ff2205 100644 --- a/common/patches/client62_ops.h +++ b/common/patches/client62_ops.h @@ -34,7 +34,6 @@ E(OP_ZoneSpawns) // incoming packets that require a DECODE translation: D(OP_AdventureMerchantSell) D(OP_ApplyPoison) -//D(OP_AugmentInfo) - needs opcode for conf file update D(OP_AugmentItem) D(OP_CastSpell) D(OP_CharacterCreate) diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h index 70f05859e..24e273682 100644 --- a/common/patches/client62_structs.h +++ b/common/patches/client62_structs.h @@ -3099,11 +3099,6 @@ struct GuildMemberUpdate_Struct { /*72*/ uint32 unknown072; }; - - - - - }; //end namespace structs }; //end namespace Client62 diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 9cec4f5fa..0549b4b58 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4585,9 +4585,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { -/*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint8 window; // window to display the information in +/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 /*076*/ }; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index ea4726a62..64d907c5b 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -4109,9 +4109,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { -/*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint8 window; // window to display the information in +/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 /*076*/ }; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 0beb17db6..5164af3eb 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -3963,9 +3963,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { -/*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint8 window; // window to display the information in +/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 /*076*/ }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 92695f7a1..d0235049d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1347,9 +1347,6 @@ namespace Titanium FINISH_DIRECT_DECODE(); } - // needs to be tested - DECODE(OP_AugmentInfo) { DECODE_FORWARD(OP_ReadBook); } - DECODE(OP_AugmentItem) { DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 2aa3d8071..338558602 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -47,7 +47,6 @@ E(OP_ZoneSpawns) // incoming packets that require a DECODE translation: D(OP_AdventureMerchantSell) D(OP_ApplyPoison) -D(OP_AugmentInfo) D(OP_AugmentItem) D(OP_CastSpell) D(OP_CharacterCreate) diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index f7716834b..ab263d6c4 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4160,9 +4160,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { -/*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint8 window; // window to display the information in +/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 /*076*/ }; From 3a270dd96abbe9fd2ccd3a3e5bdfbcaf0de52712 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 3 Oct 2014 15:05:20 -0400 Subject: [PATCH 0007/1883] Moved OP_LootItem slot translation to external handlers in client patch files --- changelog.txt | 1 + common/patches/client62.cpp | 6 ++++-- common/patches/rof.cpp | 6 ++++-- common/patches/sod.cpp | 6 ++++-- common/patches/sof.cpp | 6 ++++-- common/patches/titanium.cpp | 6 ++++-- common/patches/underfoot.cpp | 6 ++++-- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/changelog.txt b/changelog.txt index b31afa449..6272d4a69 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/03/2014 == Uleat: Fixed Ti(6.2) OP_AugmentInfo translation that I broke (does not currently need and I mis-read a process) +Uleat: Moved client patch OP_LootItem slot translation to external handlers == 10/02/2014 == Uleat: First round of Ti/6.2 translators added - needed for re-enumeration diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index d9def3dbb..2da492145 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -446,7 +446,7 @@ namespace Client62 OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id; + eq->slot_id = ServerToClient62CorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -1105,7 +1105,7 @@ namespace Client62 IN(lootee); IN(looter); - emu->slot_id = eq->slot_id; + emu->slot_id = Client62ToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -1317,6 +1317,7 @@ namespace Client62 static inline int16 ServerToClient62CorpseSlot(uint32 ServerCorpse) { //int16 Client62Corpse; + return ServerCorpse; } static inline uint32 Client62ToServerSlot(int16 Client62Slot) @@ -1331,6 +1332,7 @@ namespace Client62 static inline uint32 Client62ToServerCorpseSlot(int16 Client62Corpse) { //uint32 ServerCorpse; + return Client62Corpse; } } // end namespace Client62 diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 581858381..d6eb858e3 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -1423,7 +1423,7 @@ namespace RoF OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id + 1; + eq->slot_id = ServerToRoFCorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -4405,7 +4405,7 @@ namespace RoF IN(lootee); IN(looter); - emu->slot_id = eq->slot_id - 1; + emu->slot_id = RoFToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -5406,6 +5406,7 @@ namespace RoF static inline uint32 ServerToRoFCorpseSlot(uint32 ServerCorpse) { //uint32 RoFCorpse; + return (ServerCorpse + 1); } static inline uint32 RoFToServerSlot(structs::ItemSlotStruct RoFSlot) @@ -5546,6 +5547,7 @@ namespace RoF static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse) { //uint32 ServerCorpse; + return (RoFCorpse - 1); } } // end namespace RoF diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 90c5644fe..3501e73f0 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -984,7 +984,7 @@ namespace SoD OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id + 1; + eq->slot_id = ServerToSoDCorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -2956,7 +2956,7 @@ namespace SoD IN(lootee); IN(looter); - emu->slot_id = eq->slot_id - 1; + emu->slot_id = SoDToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -3599,6 +3599,7 @@ namespace SoD static inline uint32 ServerToSoDCorpseSlot(uint32 ServerCorpse) { //uint32 SoDCorpse; + return (ServerCorpse + 1); } static inline uint32 SoDToServerSlot(uint32 SoDSlot) @@ -3623,6 +3624,7 @@ namespace SoD static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse) { //uint32 ServerCorpse; + return (SoDCorpse - 1); } } // end namespace SoD diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 861edcb3d..80c0cb7cf 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -783,7 +783,7 @@ namespace SoF OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id + 1; + eq->slot_id = ServerToSoFCorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -2294,7 +2294,7 @@ namespace SoF IN(lootee); IN(looter); - emu->slot_id = eq->slot_id - 1; + emu->slot_id = SoFToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -2920,6 +2920,7 @@ namespace SoF static inline uint32 ServerToSoFCorpseSlot(uint32 ServerCorpse) { //uint32 SoFCorpse; + return (ServerCorpse + 1); } static inline uint32 SoFToServerSlot(uint32 SoFSlot) @@ -2945,6 +2946,7 @@ namespace SoF static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse) { //uint32 ServerCorpse; + return (SoFCorpse - 1); } } // end namespace SoF diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index d0235049d..7c990751d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -654,7 +654,7 @@ namespace Titanium OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id; + eq->slot_id = ServerToTitaniumCorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -1517,7 +1517,7 @@ namespace Titanium IN(lootee); IN(looter); - emu->slot_id = eq->slot_id; + emu->slot_id = TitaniumToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -1745,6 +1745,7 @@ namespace Titanium static inline int16 ServerToTitaniumCorpseSlot(uint32 ServerCorpse) { //int16 TitaniumCorpse; + return ServerCorpse; } static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot) @@ -1759,6 +1760,7 @@ namespace Titanium static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse) { //uint32 ServerCorpse; + return TitaniumCorpse; } } // end namespace Titanium diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 0cec336b2..7c1aa940b 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1234,7 +1234,7 @@ namespace Underfoot OUT(lootee); OUT(looter); - eq->slot_id = emu->slot_id + 1; + eq->slot_id = ServerToUnderFootCorpseSlot(emu->slot_id); OUT(auto_loot); FINISH_ENCODE(); @@ -3294,7 +3294,7 @@ namespace Underfoot IN(lootee); IN(looter); - emu->slot_id = eq->slot_id - 1; + emu->slot_id = UnderfootToServerCorpseSlot(eq->slot_id); IN(auto_loot); FINISH_DIRECT_DECODE(); @@ -4021,6 +4021,7 @@ namespace Underfoot static inline uint32 ServerToUnderFootCorpseSlot(uint32 ServerCorpse) { //uint32 UnderfootCorpse; + return (ServerCorpse + 1); } static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot) @@ -4046,6 +4047,7 @@ namespace Underfoot static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse) { //uint32 ServerCorpse; + return (UnderfootCorpse - 1); } } // end namespace Underfoot From 61545beff243e272cf6c1db5795450c1328ea450 Mon Sep 17 00:00:00 2001 From: KimLS Date: Fri, 3 Oct 2014 13:42:39 -0700 Subject: [PATCH 0008/1883] Hunger and thirst clamping within larger ranges --- zone/client.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 964f228d1..5b7c0d597 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -39,15 +39,10 @@ extern volatile bool RunLoops; #include "../common/features.h" -#include "masterentity.h" -#include "worldserver.h" #include "../common/misc.h" -#include "zonedb.h" #include "../common/spdat.h" -#include "net.h" #include "../common/packet_dump.h" #include "../common/packet_functions.h" -#include "petitions.h" #include "../common/serverinfo.h" #include "../common/zone_numbers.h" #include "../common/moremath.h" @@ -55,6 +50,12 @@ extern volatile bool RunLoops; #include "../common/breakdowns.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "../common/data_verification.h" +#include "net.h" +#include "masterentity.h" +#include "worldserver.h" +#include "zonedb.h" +#include "petitions.h" #include "forage.h" #include "command.h" #include "string_ids.h" @@ -594,19 +595,8 @@ bool Client::Save(uint8 iCommitNow) { database.SaveCharacterTribute(this->CharacterID(), &m_pp); SaveTaskState(); /* Save Character Task */ - if(m_pp.hunger_level < 0) { - m_pp.hunger_level = 0; - } - else if(m_pp.hunger_level > 6000) { - m_pp.hunger_level = 6000; - } - - if(m_pp.thirst_level < 0) { - m_pp.thirst_level = 0; - } - else if(m_pp.thirst_level > 6000) { - m_pp.thirst_level = 6000; - } + m_pp.hunger_level = EQEmu::Clamp(m_pp.hunger_level, 0, 50000); + m_pp.thirst_level = EQEmu::Clamp(m_pp.thirst_level, 0, 50000); database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp, &m_epp); /* Save Character Data */ return true; From e0e305949880536392ecfac7b8c23299ae2a4b75 Mon Sep 17 00:00:00 2001 From: KimLS Date: Fri, 3 Oct 2014 14:57:01 -0700 Subject: [PATCH 0009/1883] Turn off user literal error in clang --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f9c5429b..a975ef533 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,7 +259,10 @@ OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) #C++11 stuff IF(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal") + ENDIF() ENDIF(NOT MSVC) #Various definitions From e753685ceb3ec1b4a24d80ee657cc89ede7729ce Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 4 Oct 2014 03:23:42 -0400 Subject: [PATCH 0010/1883] Implement number of hit indicators for UF and RoF There is a small display bug with the initial cast of the spell, but it updates quickly enough that it shouldn't be too noticeable This still needs to be fixed though Changed SendBuffDurationPacket to take a Buffs_Struct by reference to allow more of the data to be obtained without more params Added Client::SendBuffNumHitPacket(Buffs_Struct &buff, int slot) --- common/eq_packet_structs.h | 4 +- common/patches/rof.cpp | 7 +-- common/patches/rof_structs.h | 26 ++++++++++- common/patches/underfoot.cpp | 5 ++- common/patches/underfoot_structs.h | 21 ++++++++- zone/client.h | 3 +- zone/spell_effects.cpp | 70 +++++++++++++----------------- zone/spells.cpp | 38 ++++++++++++---- 8 files changed, 118 insertions(+), 56 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 8e5588e5c..a022626e1 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -534,7 +534,7 @@ struct SpellBuffFade_Struct { /*007*/ uint8 unknown7; /*008*/ uint32 spellid; /*012*/ uint32 duration; -/*016*/ uint32 unknown016; +/*016*/ uint32 num_hits; /*020*/ uint32 unknown020; //prolly global player ID /*024*/ uint32 slotid; /*028*/ uint32 bufffade; @@ -4602,11 +4602,13 @@ struct BuffIconEntry_Struct uint32 buff_slot; uint32 spell_id; uint32 tics_remaining; + uint32 num_hits; }; struct BuffIcon_Struct { uint32 entity_id; + uint8 all_buffs; uint16 count; BuffIconEntry_Struct entries[0]; }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d6eb858e3..a107a1246 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -376,6 +376,7 @@ namespace RoF OUT(duration); eq->playerId = 0x7cde; OUT(slotid); + OUT(num_hits); if (emu->bufffade == 1) eq->bufffade = 1; else @@ -414,7 +415,7 @@ namespace RoF __packet->WriteUInt32(emu->entity_id); __packet->WriteUInt32(0); // PlayerID ? - __packet->WriteUInt8(1); // 1 indicates all buffs on the player (0 to add or remove a single buff) + __packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff) __packet->WriteUInt16(emu->count); for (uint16 i = 0; i < emu->count; ++i) @@ -429,10 +430,10 @@ namespace RoF __packet->WriteUInt32(buffslot); __packet->WriteUInt32(emu->entries[i].spell_id); __packet->WriteUInt32(emu->entries[i].tics_remaining); - __packet->WriteUInt32(0); // Unknown + __packet->WriteUInt32(emu->entries[i].num_hits); // Unknown __packet->WriteString(""); } - __packet->WriteUInt8(0); // Unknown + __packet->WriteUInt8(!emu->all_buffs); // Unknown FINISH_ENCODE(); } diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 0549b4b58..5f1d2aac4 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -712,7 +712,8 @@ struct SpellBuffFade_Struct_Live { /*012*/ uint32 spellid; /*016*/ uint32 duration; /*020*/ uint32 playerId; // Global player ID? -/*024*/ uint8 unknown0028[68]; +/*024*/ uint32 num_hits; +/*028*/ uint8 unknown0028[64]; /*092*/ uint32 slotid; /*096*/ uint32 bufffade; /*100*/ @@ -726,7 +727,7 @@ struct SpellBuffFade_Struct { /*007*/ uint8 unknown7; /*008*/ uint32 spellid; /*012*/ uint32 duration; -/*016*/ uint32 unknown016; +/*016*/ uint32 num_hits; /*020*/ uint32 unknown020; // Global player ID? /*024*/ uint32 playerId; // Player id who cast the buff /*028*/ uint32 slotid; @@ -741,6 +742,27 @@ struct BuffRemoveRequest_Struct /*08*/ }; +#if 0 +// not in use +struct BuffIconEntry_Struct { +/*000*/ uint32 buff_slot; +/*004*/ uint32 spell_id; +/*008*/ uint32 tics_remaining; +/*012*/ uint32 num_hits; +// char name[0]; caster name is also here sometimes +// uint8 unknownend; 1 when single, 0 when all opposite of all_buffs? +}; + +// not in use +struct BuffIcon_Struct { +/*000*/ uint32 entity_id; +/*004*/ uint32 unknown004; +/*008*/ uint8 all_buffs; // 1 when updating all buffs, 0 when doing one +/*009*/ uint16 count; +/*011*/ BuffIconEntry_Struct entires[0]; +}; +#endif + struct GMTrainee_Struct { /*000*/ uint32 npcid; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 7c1aa940b..6291d3077 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -330,6 +330,7 @@ namespace Underfoot OUT(duration); OUT(slotid); OUT(bufffade); // Live (October 2011) sends a 2 rather than 0 when a buff is created, but it doesn't seem to matter. + OUT(num_hits); eq->unknown008 = 1.0f; FINISH_ENCODE(); @@ -348,7 +349,7 @@ namespace Underfoot *((uint32*)ptr) = emu->entity_id; ptr += sizeof(uint32); ptr += sizeof(uint32); - *((uint8*)ptr) = 1; + *((uint8*)ptr) = emu->all_buffs; ptr += sizeof(uchar); *((uint16*)ptr) = emu->count; ptr += sizeof(uint16); @@ -371,7 +372,9 @@ namespace Underfoot ptr += sizeof(uint32); *((uint32*)ptr) = emu->entries[i].tics_remaining; ptr += sizeof(uint32); + *((uint32*)ptr) = emu->entries[i].num_hits; ptr += sizeof(uint32); + *((uint8*)ptr) = !emu->all_buffs; ptr += 1; } diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index ab263d6c4..89101ca2e 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -564,7 +564,7 @@ struct SpellBuffFade_Struct_Underfoot { /*008*/ float unknown008; /*012*/ uint32 spellid; /*016*/ uint32 duration; -/*020*/ uint32 unknown016; +/*020*/ uint32 num_hits; /*024*/ uint32 playerId; // Global player ID? /*028*/ uint32 unknown020; /*032*/ uint8 unknown0028[48]; @@ -589,6 +589,25 @@ struct SpellBuffFade_Struct { /*036*/ }; +#if 0 +struct BuffIconEntry_Struct { +/*000*/ uint32 buff_slot; +/*004*/ uint32 spell_id; +/*008*/ uint32 tics_remaining; +/*012*/ uint32 num_hits; +// char name[0]; caster name is also here sometimes +// uint8 unknownend; 1 when single, 0 when all opposite of all_buffs? +}; + +struct BuffIcon_Struct { +/*000*/ uint32 entity_id; +/*004*/ uint32 unknown004; +/*008*/ uint8 all_buffs; // 1 when updating all buffs, 0 when doing one +/*009*/ uint16 count; +/*011*/ BuffIconEntry_Struct entires[0]; +}; +#endif + struct BuffRemoveRequest_Struct { /*00*/ uint32 SlotID; diff --git a/zone/client.h b/zone/client.h index 235861396..fe05194bc 100644 --- a/zone/client.h +++ b/zone/client.h @@ -896,7 +896,8 @@ public: //This is used to later set the buff duration of the spell, in slot to duration. //Doesn't appear to work directly after the client recieves an action packet. - void SendBuffDurationPacket(uint16 spell_id, int duration, int inlevel); + void SendBuffDurationPacket(Buffs_Struct &buff); + void SendBuffNumHitPacket(Buffs_Struct &buff, int slot); void ProcessInspectRequest(Client* requestee, Client* requester); bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index add06714b..f86f43bf4 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3395,7 +3395,7 @@ void Mob::BuffProcess() { if(buffs[buffs_i].UpdateClient == true) { - CastToClient()->SendBuffDurationPacket(buffs[buffs_i].spellid, buffs[buffs_i].ticsremaining, buffs[buffs_i].casterlevel); + CastToClient()->SendBuffDurationPacket(buffs[buffs_i]); buffs[buffs_i].UpdateClient = false; } } @@ -5559,64 +5559,56 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) uint32 buff_max = GetMaxTotalSlots(); //Spell specific procs [Type 7,10,11] - if (IsValidSpell(spell_id)){ - - for(uint32 d = 0; d < buff_max; d++) { - - if((buffs[d].spellid == spell_id) && (buffs[d].numhits > 0) && (spells[buffs[d].spellid].numhitstype == type)){ - - if(--buffs[d].numhits == 0) { + if (IsValidSpell(spell_id)) { + for (uint32 d = 0; d < buff_max; d++) { + if (buffs[d].spellid == spell_id && buffs[d].numhits > 0 && + spells[buffs[d].spellid].numhitstype == type) { + if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); - if(!TryFadeEffect(d)) + if (!TryFadeEffect(d)) BuffFadeBySlot(d, true); + } else if (IsClient()) { // still have numhits and client, update + CastToClient()->SendBuffNumHitPacket(buffs[d], d); } } } - } - - else if (type == 7){ - if (buff_slot > 0){ - - if(--buffs[buff_slot].numhits == 0) { + } else if (type == 7) { + if (buff_slot > 0) { + if (--buffs[buff_slot].numhits == 0) { CastOnNumHitFade(buffs[buff_slot].spellid); - if(!TryFadeEffect(buff_slot)) + if (!TryFadeEffect(buff_slot)) BuffFadeBySlot(buff_slot , true); - } + } else if (IsClient()) { // still have numhits and client, update + CastToClient()->SendBuffNumHitPacket(buffs[buff_slot], buff_slot); } - - else { - - for(int d = 0; d < buff_max; d++) { - - if(!m_spellHitsLeft[d]) + } else { + for (int d = 0; d < buff_max; d++) { + if (!m_spellHitsLeft[d]) continue; - if ((IsValidSpell(buffs[d].spellid)) && (m_spellHitsLeft[d] == buffs[d].spellid)) { - if(--buffs[d].numhits == 0) { + if (IsValidSpell(buffs[d].spellid) && m_spellHitsLeft[d] == buffs[d].spellid) { + if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); m_spellHitsLeft[d] = 0; - if(!TryFadeEffect(d)) + if (!TryFadeEffect(d)) BuffFadeBySlot(d, true); + } else if (IsClient()) { // still have numhits and client, update + CastToClient()->SendBuffNumHitPacket(buffs[d], d); } } } } - } - - - else{ - - for(uint32 d = 0; d < buff_max; d++) { - - if((IsValidSpell(buffs[d].spellid)) && (buffs[d].numhits > 0) && (spells[buffs[d].spellid].numhitstype == type)){ - - if(--buffs[d].numhits == 0) { + } else { + for (uint32 d = 0; d < buff_max; d++) { + if (IsValidSpell(buffs[d].spellid) && buffs[d].numhits > 0 && + spells[buffs[d].spellid].numhitstype == type) { + if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); - if(!TryFadeEffect(d)){ + if (!TryFadeEffect(d)) BuffFadeBySlot(d, true); - } + } else if (IsClient()) { // still have numhits and client, update + CastToClient()->SendBuffNumHitPacket(buffs[d], d); } - } } } diff --git a/zone/spells.cpp b/zone/spells.cpp index fb3cba454..310bc35bd 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5164,20 +5164,40 @@ void Mob::_StopSong() //Thus I use this in the buff process to update the correct duration once after casting //this allows AAs and focus effects that increase buff duration to work correctly, but could probably //be used for other things as well -void Client::SendBuffDurationPacket(uint16 spell_id, int duration, int inlevel) +void Client::SendBuffDurationPacket(Buffs_Struct &buff) { EQApplicationPacket* outapp; outapp = new EQApplicationPacket(OP_Buff, sizeof(SpellBuffFade_Struct)); SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*) outapp->pBuffer; sbf->entityid = GetID(); - sbf->slot=2; - sbf->spellid=spell_id; - sbf->slotid=0; - sbf->effect = inlevel > 0 ? inlevel : GetLevel(); - sbf->level = inlevel > 0 ? inlevel : GetLevel(); + sbf->slot = 2; + sbf->spellid = buff.spellid; + sbf->slotid = 0; + sbf->effect = buff.casterlevel > 0 ? buff.casterlevel : GetLevel(); + sbf->level = buff.casterlevel > 0 ? buff.casterlevel : GetLevel(); sbf->bufffade = 0; - sbf->duration = duration; + sbf->duration = buff.ticsremaining; + sbf->num_hits = buff.numhits; + FastQueuePacket(&outapp); +} + +void Client::SendBuffNumHitPacket(Buffs_Struct &buff, int slot) +{ + // UF+ use this packet + if (GetClientVersion() < EQClientUnderfoot) + return; + EQApplicationPacket *outapp; + outapp = new EQApplicationPacket(OP_BuffCreate, sizeof(BuffIcon_Struct) + sizeof(BuffIconEntry_Struct)); + BuffIcon_Struct *bi = (BuffIcon_Struct *)outapp->pBuffer; + bi->entity_id = GetID(); + bi->count = 1; + bi->all_buffs = 0; + + bi->entries[0].buff_slot = slot; + bi->entries[0].spell_id = buff.spellid; + bi->entries[0].tics_remaining = buff.ticsremaining; + bi->entries[0].num_hits = buff.numhits; FastQueuePacket(&outapp); } @@ -5252,6 +5272,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target) BuffIcon_Struct *buff = (BuffIcon_Struct*)outapp->pBuffer; buff->entity_id = GetID(); buff->count = count; + buff->all_buffs = 1; uint32 index = 0; for(unsigned int i = 0; i < buff_count; ++i) @@ -5261,6 +5282,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target) buff->entries[index].buff_slot = i; buff->entries[index].spell_id = buffs[i].spellid; buff->entries[index].tics_remaining = buffs[i].ticsremaining; + buff->entries[index].num_hits = buffs[i].numhits; ++index; } } @@ -5278,7 +5300,7 @@ void Mob::BuffModifyDurationBySpellID(uint16 spell_id, int32 newDuration) buffs[i].ticsremaining = newDuration; if(IsClient()) { - CastToClient()->SendBuffDurationPacket(buffs[i].spellid, buffs[i].ticsremaining, buffs[i].casterlevel); + CastToClient()->SendBuffDurationPacket(buffs[i]); } } } From 4d768474e883cc0fef962bcb4265239b72de6b61 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 09:58:55 -0700 Subject: [PATCH 0011/1883] command_setfaction converted to QueryDatabase --- zone/command.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 2844e9daf..bc2813221 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -588,7 +588,7 @@ int command_realdispatch(Client *c, const char *message) /* QS: Player_Log_Issued_Commands */ if (RuleB(QueryServ, PlayerLogIssuedCommandes)){ std::string event_desc = StringFormat("Issued command :: '%s' in zoneid:%i instid:%i", message, c->GetZoneID(), c->GetInstanceID()); - QServ->PlayerLogEvent(Player_Log_Issued_Commands, c->CharacterID(), event_desc); + QServ->PlayerLogEvent(Player_Log_Issued_Commands, c->CharacterID(), event_desc); } #ifdef COMMANDS_LOGGING @@ -815,17 +815,18 @@ void command_version(Client *c, const Seperator *sep) void command_setfaction(Client *c, const Seperator *sep) { - if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) + if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) { c->Message(0, "Usage: #setfaction [faction number]"); - else - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"Setting NPC %u to faction %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_faction_id=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } + return; + } + + auto npcTypeID = c->GetTarget()->CastToNPC()->GetNPCTypeID(); + c->Message(15,"Setting NPC %u to faction %i", npcTypeID, atoi(sep->argplus[1])); + + std::string query = StringFormat("UPDATE npc_types SET npc_faction_id = %i WHERE id = %i", + atoi(sep->argplus[1]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); } void command_serversidename(Client *c, const Seperator *sep) @@ -2397,8 +2398,8 @@ void command_showskills(Client *c, const Seperator *sep) c->Message(0, "Skills for %s", t->GetName()); for (SkillUseTypes i=Skill1HBlunt; i <= HIGHEST_SKILL; i=(SkillUseTypes)(i+1)) - c->Message(0, "Skill [%d] is at [%d] - %u", i, t->GetSkill(i), t->GetRawSkill(i)); -} + c->Message(0, "Skill [%d] is at [%d] - %u", i, t->GetSkill(i), t->GetRawSkill(i)); +} void command_findspell(Client *c, const Seperator *sep) { From 114d0ae11b8e2a38bde0518de3b7233f5199d02c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:01:59 -0700 Subject: [PATCH 0012/1883] command_viewpetition converted to QueryDatabase --- zone/command.cpp | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index bc2813221..dfb7267b1 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1510,33 +1510,29 @@ void command_movechar(Client *c, const Seperator *sep) void command_viewpetition(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0) + if (sep->arg[1][0] == 0) { c->Message(0, "Usage: #viewpetition (petition number) Type #listpetition for a list"); - else - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - int queryfound = 0; - MYSQL_RES *result; - MYSQL_ROW row; - c->Message(13," ID : Character Name , Petition Text"); - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, petitiontext from petitions order by petid"), errbuf, &result)) - { - while ((row = mysql_fetch_row(result))) - { - if (strcasecmp(row[0],sep->argplus[1])== 0) - { - queryfound=1; - c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]); - } - } - LogFile->write(EQEMuLog::Normal,"View petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); - if (queryfound==0) - c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); - mysql_free_result(result); - } - safe_delete_array(query); - } + return; + } + + c->Message(13," ID : Character Name , Petition Text"); + + std::string query = "SELECT petid, charname, petitiontext FROM petitions ORDER BY petid"; + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + LogFile->write(EQEMuLog::Normal,"View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + + if (results.RowCount() == 0) { + c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) + if (strcasecmp(row[0], sep->argplus[1]) == 0) + c->Message(15, " %s: %s , %s ", row[0], row[1], row[2]); + } void command_petitioninfo(Client *c, const Seperator *sep) From 905a264744c58787611338a82a88d203cc7fcb52 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:03:07 -0700 Subject: [PATCH 0013/1883] command_petitioninfo converted to QueryDatabase --- zone/command.cpp | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index dfb7267b1..294934f46 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1537,31 +1537,27 @@ void command_viewpetition(Client *c, const Seperator *sep) void command_petitioninfo(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0) + if (sep->arg[1][0] == 0) { c->Message(0, "Usage: #petitioninfo (petition number) Type #listpetition for a list"); - else - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - int queryfound = 0; - MYSQL_RES *result; - MYSQL_ROW row; + return; + } + + std::string query = "SELECT petid, charname, accountname, zone, charclass, charrace, charlevel FROM petitions ORDER BY petid"; + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + LogFile->write(EQEMuLog::Normal,"Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + + if (results.RowCount() == 0) { + c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) + if (strcasecmp(row[0],sep->argplus[1])== 0) + c->Message(13," ID : %s Character Name: %s Account Name: %s Zone: %s Character Class: %s Character Race: %s Character Level: %s",row[0],row[1],row[2],row[3],row[4],row[5],row[6]); - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname, zone, charclass, charrace, charlevel from petitions order by petid"), errbuf, &result)) - { - while ((row = mysql_fetch_row(result))) - if (strcasecmp(row[0],sep->argplus[1])== 0) - { - queryfound=1; - c->Message(13," ID : %s Character Name: %s Account Name: %s Zone: %s Character Class: %s Character Race: %s Character Level: %s",row[0],row[1],row[2],row[3],row[4],row[5],row[6]); - } - LogFile->write(EQEMuLog::Normal,"Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); - if (queryfound==0) - c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); - mysql_free_result(result); - } - safe_delete_array(query); - } } void command_delpetition(Client *c, const Seperator *sep) From ca2c2ccfac0b14e9640c5217b14a90e812c64edd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:04:39 -0700 Subject: [PATCH 0014/1883] command_delpetition converted to QueryDatabase --- zone/command.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 294934f46..96daf6fd1 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1562,17 +1562,19 @@ void command_petitioninfo(Client *c, const Seperator *sep) void command_delpetition(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) + if (sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*") == 0) { c->Message(0, "Usage: #delpetition (petition number) Type #listpetition for a list"); - else { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(13,"Attempting to delete petition number: %i",atoi(sep->argplus[1])); - if (database.RunQuery(query, MakeAnyLenString(&query, "DELETE from petitions where petid=%i",atoi(sep->argplus[1])), errbuf)) { - LogFile->write(EQEMuLog::Normal,"Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); - } - safe_delete_array(query); - } + return; + } + + c->Message(13,"Attempting to delete petition number: %i",atoi(sep->argplus[1])); + std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", atoi(sep->argplus[1])); + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + LogFile->write(EQEMuLog::Normal,"Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + } void command_listnpcs(Client *c, const Seperator *sep) From 61cd48ff449e201274c967b10dfa294ea43cb211 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:07:25 -0700 Subject: [PATCH 0015/1883] command_findnpctype converted to QueryDatabase --- zone/command.cpp | 86 +++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 53 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 96daf6fd1..e652f3377 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3096,67 +3096,47 @@ void command_peekinv(Client *c, const Seperator *sep) void command_findnpctype(Client *c, const Seperator *sep) { - if(sep->arg[1][0] == 0) + if(sep->arg[1][0] == 0) { c->Message(0, "Usage: #findnpctype [search criteria]"); - else - { - int id; - int count; - const int maxrows = 20; - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query; - MYSQL_RES *result; - MYSQL_ROW row; + return; + } - query = new char[256]; + std::string query; - // If id evaluates to 0, then search as if user entered a string. - if ((id = atoi((const char *)sep->arg[1])) == 0) - MakeAnyLenString(&query, - "SELECT id,name" - " FROM npc_types WHERE name LIKE '%%%s%%'", - sep->arg[1]); - // Otherwise, look for just that npc id. - else - MakeAnyLenString(&query, - "SELECT id,name FROM npc_types WHERE id=%i", id); + int id = atoi((const char *)sep->arg[1]); + if (id == 0) // If id evaluates to 0, then search as if user entered a string. + query = StringFormat("SELECT id, name FROM npc_types WHERE name LIKE '%%%s%%'", sep->arg[1]); + else // Otherwise, look for just that npc id. + query = StringFormat("SELECT id, name FROM npc_types WHERE id = %i", id); - // If query runs successfully. - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - count = 0; + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message (0, "Error querying database."); + c->Message (0, query.c_str()); + } - // Process each row returned. - while((row = mysql_fetch_row(result))) - { - // Limit to returning maxrows rows. - if (++count > maxrows) - { - c->Message (0, - "%i npc types shown. Too many results.", maxrows); - break; - } - c->Message (0, " %s: %s", row[0], row[1]); - } + if (results.RowCount() == 0) // No matches found. + c->Message (0, "No matches found for %s.", sep->arg[1]); - // If we did not hit the maxrows limit. - if (count <= maxrows) - c->Message (0, "Query complete. %i rows shown.", count); - // No matches found. - else if (count == 0) - c->Message (0, "No matches found for %s.", sep->arg[1]); + // If query runs successfully. + int count = 0; + const int maxrows = 20; - mysql_free_result(result); - } - // If query failed. - else - { - c->Message (0, "Error querying database."); - c->Message (0, query); - } + // Process each row returned. + for (auto row = results.begin(); row != results.end(); ++row) { + // Limit to returning maxrows rows. + if (++count > maxrows) { + c->Message (0, "%i npc types shown. Too many results.", maxrows); + break; + } + + c->Message (0, " %s: %s", row[0], row[1]); + } + + // If we did not hit the maxrows limit. + if (count <= maxrows) + c->Message (0, "Query complete. %i rows shown.", count); - safe_delete_array(query); - } } void command_findzone(Client *c, const Seperator *sep) From 5f5fba1117afae3b4b9e2f82cc051e3c65f9daa4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:09:20 -0700 Subject: [PATCH 0016/1883] command_findzone converted to QueryDatabase --- zone/command.cpp | 83 ++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index e652f3377..8143189d7 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3141,63 +3141,48 @@ void command_findnpctype(Client *c, const Seperator *sep) void command_findzone(Client *c, const Seperator *sep) { - if(sep->arg[1][0] == 0) + if(sep->arg[1][0] == 0) { c->Message(0, "Usage: #findzone [search criteria]"); - else - { - int id; - int count; - const int maxrows = 20; - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query; - MYSQL_RES *result; - MYSQL_ROW row; + return; + } - query = new char[256]; + std::string query; + int id = atoi((const char *)sep->arg[1]); + if (id == 0) { // If id evaluates to 0, then search as if user entered a string. + char *escName = new char[strlen(sep->arg[1]) * 2 + 1]; + database.DoEscapeString(escName, sep->arg[1], strlen(sep->arg[1])); - // If id evaluates to 0, then search as if user entered a string. - if ((id = atoi((const char *)sep->arg[1])) == 0) - { - char *EscName = new char[strlen(sep->arg[1]) * 2 + 1]; - database.DoEscapeString(EscName, sep->arg[1], strlen(sep->arg[1])); + query = StringFormat("SELECT zoneidnumber, short_name, long_name FROM zone " + "WHERE long_name RLIKE '%s' AND version = 0", escName); + safe_delete_array(escName); + } + else // Otherwise, look for just that zoneidnumber. + query = StringFormat("SELECT zoneidnumber, short_name, long_name FROM zone " + "WHERE zoneidnumber = %i AND version = 0", id); - MakeAnyLenString(&query, "SELECT zoneidnumber,short_name,long_name FROM zone WHERE long_name rLIKE '%s' AND version=0", - EscName); - safe_delete_array(EscName); - } - // Otherwise, look for just that zoneidnumber. - else - MakeAnyLenString(&query, "SELECT zoneidnumber,short_name,long_name FROM zone WHERE zoneidnumber=%i AND version=0", id); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message (0, "Error querying database."); + c->Message (0, query.c_str()); + return; + } - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - count = 0; + int count = 0; + const int maxrows = 20; - while((row = mysql_fetch_row(result))) - { - if (++count > maxrows) - { - c->Message (0, "%i zones shown. Too many results.", maxrows); - break; - } - c->Message (0, " %s: %s, %s", row[0], row[1], row[2]); - } + for(auto row = results.begin(); row != results.end(); ++row) { + if (++count > maxrows) { + c->Message (0, "%i zones shown. Too many results.", maxrows); + break; + } - if (count <= maxrows) - c->Message (0, "Query complete. %i rows shown.", count); - else if (count == 0) - c->Message (0, "No matches found for %s.", sep->arg[1]); + c->Message (0, " %s: %s, %s", row[0], row[1], row[2]); + } - mysql_free_result(result); - } - else - { - c->Message (0, "Error querying database."); - c->Message (0, query); - } - - safe_delete_array(query); - } + if (count <= maxrows) + c->Message (0, "Query complete. %i rows shown.", count); + else if (count == 0) + c->Message (0, "No matches found for %s.", sep->arg[1]); } void command_viewnpctype(Client *c, const Seperator *sep) From accedf7184fcfd8ce4e44d2ead019cced53a72eb Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:12:39 -0700 Subject: [PATCH 0017/1883] command_listpetition converted to QueryDatabase --- zone/command.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 8143189d7..b9b70a25e 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3373,23 +3373,20 @@ void command_motd(Client *c, const Seperator *sep) void command_listpetition(Client *c, const Seperator *sep) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - bool header = false; - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT petid, charname, accountname from petitions order by petid"), errbuf, &result)) { - LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName()); - while ((row = mysql_fetch_row(result))) { - if(!header) { - header = true; - c->Message(13," ID : Character Name , Account Name"); - } - c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]); - } - mysql_free_result(result); - } - safe_delete_array(query); + std::string query = "SELECT petid, charname, accountname FROM petitions ORDER BY petid"; + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName()); + + if (results.RowCount() == 0) + return; + + c->Message(13," ID : Character Name , Account Name"); + + for (auto row = results.begin(); row != results.end(); ++row) + c->Message(15, " %s: %s , %s ",row[0],row[1],row[2]); } void command_equipitem(Client *c, const Seperator *sep) From d86fc1c1418855e832eb27061087dfc44749df07 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:16:26 -0700 Subject: [PATCH 0018/1883] command_spawnfix converted to QueryDatabase --- zone/command.cpp | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b9b70a25e..05917fe5a 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4511,33 +4511,31 @@ void command_npcspawn(Client *c, const Seperator *sep) } void command_spawnfix(Client *c, const Seperator *sep) { - Mob *t = c->GetTarget(); - if (!t || !t->IsNPC()) + Mob *targetMob = c->GetTarget(); + if (!targetMob || !targetMob->IsNPC()) { c->Message(0, "Error: #spawnfix: Need an NPC target."); - else { - Spawn2* s2 = t->CastToNPC()->respawn2; - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; + return; + } - if(!s2) { - c->Message(0, "#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Updating coordinates successful."); - t->Depop(false); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } + Spawn2* s2 = targetMob->CastToNPC()->respawn2; + + if(!s2) { + c->Message(0, "#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from."); + return; + } + + std::string query = StringFormat("UPDATE spawn2 SET x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = '%i'", + c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Updating coordinates successful."); + targetMob->Depop(false); } void command_loc(Client *c, const Seperator *sep) From b3789c261b51ae87509e67c48ff96daa44c4113f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:34:44 -0700 Subject: [PATCH 0019/1883] GetStartZone converted to QueryDatabase --- world/worlddb.cpp | 98 +++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 55 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 32c4ada48..cec7536ed 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -35,7 +35,7 @@ extern std::vector character_create_race_class_combos; // solar: the current stuff is at the bottom of this function void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) { Inventory *inv; - uint8 has_home = 0; + uint8 has_home = 0; uint8 has_bind = 0; /* Initialize Variables */ @@ -49,7 +49,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* /* Get Character Info */ std::string cquery = StringFormat( - "SELECT " + "SELECT " "`id`, " // 0 "name, " // 1 "gender, " // 2 @@ -70,8 +70,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* "drakkin_tattoo, " // 17 "drakkin_details, " // 18 "zone_id " // 19 - "FROM " - "character_data " + "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(); ++row) { @@ -108,11 +108,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } /* 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); + 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; 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 (row_b[6] && atoi(row_b[6]) == 0){ has_bind = 1; } } if (has_home == 0 || has_bind == 0){ @@ -121,34 +121,34 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* 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 */ - if (atoi(row_d[1]) != 0) { + if (atoi(row_d[1]) != 0) { pp.binds[4].zoneId = (uint32)atoi(row_d[1]); GetSafePoints(pp.binds[4].zoneId, 0, &pp.binds[4].x, &pp.binds[4].y, &pp.binds[4].z); } /* Otherwise, use the zone and coordinates given */ - else { + else { pp.binds[4].zoneId = (uint32)atoi(row_d[0]); - float x = atof(row_d[2]); - float y = atof(row_d[3]); - float z = atof(row_d[4]); - if (x == 0 && y == 0 && z == 0){ GetSafePoints(pp.binds[4].zoneId, 0, &x, &y, &z); } + float x = atof(row_d[2]); + float y = atof(row_d[3]); + 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){ 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); + " 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); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Home Point", query); } /* If no regular bind set, set it */ 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); + " 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); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Bind Point", query); } } @@ -166,7 +166,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* 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) { - slot = atoi(row_b[0]); + 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]); @@ -187,7 +187,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; } else{ color = item->GetItem()->Color; } - cs->cs_colors[char_num][material].color = color; + cs->cs_colors[char_num][material].color = color; /* Weapons are handled a bit differently */ if ((material == MaterialPrimary) || (material == MaterialSecondary)) { @@ -227,49 +227,28 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row = 0; - int rows; - if(!in_pp || !in_cc) return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; - if(!RunQuery(query, MakeAnyLenString(&query, "SELECT x,y,z,heading,zone_id,bind_id FROM start_zones WHERE player_choice=%i AND player_class=%i " - "AND player_deity=%i AND player_race=%i", - in_cc->start_zone, - in_cc->class_, - in_cc->deity, - in_cc->race), errbuf, &result)) - { - LogFile->write(EQEMuLog::Error, "Start zone query failed: %s : %s\n", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id " + "FROM start_zones WHERE player_choice = % i " + "AND player_class = %i AND player_deity = %i " + "AND player_race = %i", + in_cc->start_zone, in_cc->class_, in_cc->deity, + in_cc->race); + auto results = QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEMuLog::Status, "Start zone query: %s\n", query); - safe_delete_array(query); + LogFile->write(EQEMuLog::Status, "Start zone query: %s\n", query.c_str()); - if((rows = mysql_num_rows(result)) > 0) - row = mysql_fetch_row(result); - - if(row) - { - LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); - in_pp->x = atof(row[0]); - in_pp->y = atof(row[1]); - in_pp->z = atof(row[2]); - in_pp->heading = atof(row[3]); - in_pp->zone_id = atoi(row[4]); - in_pp->binds[0].zoneId = atoi(row[5]); - } - else - { - printf("No start_zones entry in database, using defaults\n"); + if (results.RowCount() == 0) { + printf("No start_zones entry in database, using defaults\n"); switch(in_cc->start_zone) { case 0: @@ -357,6 +336,16 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* break; } } + } + else { + LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); + auto row = results.begin(); + in_pp->x = atof(row[0]); + in_pp->y = atof(row[1]); + in_pp->z = atof(row[2]); + in_pp->heading = atof(row[3]); + in_pp->zone_id = atoi(row[4]); + in_pp->binds[0].zoneId = atoi(row[5]); } if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0) @@ -364,8 +353,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* if(in_pp->binds[0].x == 0 && in_pp->binds[0].y == 0 && in_pp->binds[0].z == 0) database.GetSafePoints(in_pp->binds[0].zoneId, 0, &in_pp->binds[0].x, &in_pp->binds[0].y, &in_pp->binds[0].z); - if(result) - mysql_free_result(result); + return true; } @@ -395,7 +383,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru " FROM start_zones " " WHERE zone_id = %i " " AND player_class = %i " - " AND player_deity = %i" + " AND player_deity = %i" " AND player_race = %i", in_cc->start_zone, in_cc->class_, From 7f5f805c10f07784bef1dc51e49eccd05b0320dd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:36:04 -0700 Subject: [PATCH 0020/1883] GetStartZoneSoF converted to QueryDatabase --- world/worlddb.cpp | 61 ++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index cec7536ed..2e486eb56 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -359,7 +359,6 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) { - // SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead. // // For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity. @@ -367,53 +366,25 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru // For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely // reason for no match being found. // - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row = 0; - int rows; - if(!in_pp || !in_cc) return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; - if(!RunQuery(query, MakeAnyLenString(&query, "SELECT x, y, z, heading, bind_id " - " FROM start_zones " - " WHERE zone_id = %i " - " AND player_class = %i " - " AND player_deity = %i" - " AND player_race = %i", - in_cc->start_zone, - in_cc->class_, - in_cc->deity, - in_cc->race), errbuf, &result)) - { - LogFile->write(EQEMuLog::Status, "SoF Start zone query failed: %s : %s\n", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i " + "AND player_class = %i AND player_deity = %i AND player_race = %i", + in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); + auto results = QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEMuLog::Status, "SoF Start zone query: %s\n", query); - safe_delete_array(query); + LogFile->write(EQEMuLog::Status, "SoF Start zone query: %s\n", query.c_str()); - if((rows = mysql_num_rows(result)) > 0) - row = mysql_fetch_row(result); - - if(row) - { - LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); - in_pp->x = atof(row[0]); - in_pp->y = atof(row[1]); - in_pp->z = atof(row[2]); - in_pp->heading = atof(row[3]); - in_pp->zone_id = in_cc->start_zone; - in_pp->binds[0].zoneId = atoi(row[4]); - } - else - { - printf("No start_zones entry in database, using defaults\n"); + if (results.RowCount() == 0) { + printf("No start_zones entry in database, using defaults\n"); if(in_cc->start_zone == RuleI(World, TutorialZoneID)) in_pp->zone_id = in_cc->start_zone; @@ -423,7 +394,16 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_pp->z = in_pp->binds[0].z = 0.79; in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach. } - + } + else { + LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); + auto row = results.begin(); + in_pp->x = atof(row[0]); + in_pp->y = atof(row[1]); + in_pp->z = atof(row[2]); + in_pp->heading = atof(row[3]); + in_pp->zone_id = in_cc->start_zone; + in_pp->binds[0].zoneId = atoi(row[4]); } if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0) @@ -431,8 +411,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru if(in_pp->binds[0].x == 0 && in_pp->binds[0].y == 0 && in_pp->binds[0].z == 0) database.GetSafePoints(in_pp->binds[0].zoneId, 0, &in_pp->binds[0].x, &in_pp->binds[0].y, &in_pp->binds[0].z); - if(result) - mysql_free_result(result); + return true; } From 28ec84a6c9c658eebd9157c55f3b4a8d6e17512e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:37:19 -0700 Subject: [PATCH 0021/1883] GetLauncherList converted to QueryDatabase --- world/worlddb.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 2e486eb56..cac9fd7e8 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -416,26 +416,18 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } void WorldDatabase::GetLauncherList(std::vector &rl) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - rl.clear(); - if (RunQuery(query, MakeAnyLenString(&query, - "SELECT name FROM launcher" ) - , errbuf, &result)) - { - while ((row = mysql_fetch_row(result))) { - rl.push_back(row[0]); - } - mysql_free_result(result); - } - else { - LogFile->write(EQEMuLog::Error, "WorldDatabase::GetLauncherList: %s", errbuf); - } - safe_delete_array(query); + const std::string query = "SELECT name FROM launcher"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) + rl.push_back(row[0]); + } void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { From 0b352ff0f78986c17e98aa55558311b78f3e981f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:38:14 -0700 Subject: [PATCH 0022/1883] SetMailKey converted to QueryDatabase fix SetMailKey --- world/worlddb.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index cac9fd7e8..d780571d5 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -432,9 +432,6 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - char MailKeyString[17]; if(RuleB(Chat, EnableMailKeyIPVerification) == true) @@ -442,12 +439,11 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { else sprintf(MailKeyString, "%08X", MailKey); - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE `character_data` SET mailkey = '%s' WHERE id='%i'", - MailKeyString, CharID), errbuf)) - - LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, errbuf); - - safe_delete_array(query); + std::string query = StringFormat("UPDATE character_data SET mailkey = '%s' WHERE id = '%i'", + MailKeyString, CharID); + auto results = QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } From 2d8e9bf058fdd9f536587cd5885a0b5b52c457f8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:43:13 -0700 Subject: [PATCH 0023/1883] GetCharacterLevel converted to QueryDatabase --- world/worlddb.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index d780571d5..b42b7dddb 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -449,28 +449,20 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { bool WorldDatabase::GetCharacterLevel(const char *name, int &level) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + return false; + } - if(RunQuery(query, MakeAnyLenString(&query, "SELECT `level` FROM `character_data` WHERE `name` = '%s'", name), errbuf, &result)) - { - if(row = mysql_fetch_row(result)) - { - level = atoi(row[0]); - mysql_free_result(result); - safe_delete_array(query); - return true; - } - mysql_free_result(result); - } - else - { - LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", errbuf); - } - safe_delete_array(query); - return false; + if (results.RowCount() == 0) + return false; + + auto row = results.begin(); + level = atoi(row[0]); + + return true; } bool WorldDatabase::LoadCharacterCreateAllocations() { From c4de954b1538cca3635724cdc0bdb1eecbfbdfb1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:44:29 -0700 Subject: [PATCH 0024/1883] LoadCharacterCreateAllocations converted to QueryDatabase --- world/worlddb.cpp | 56 +++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index b42b7dddb..289a919cd 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -468,37 +468,31 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) bool WorldDatabase::LoadCharacterCreateAllocations() { character_create_allocations.clear(); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM char_create_point_allocations order by id"), errbuf, &result)) { - safe_delete_array(query); - while(row = mysql_fetch_row(result)) { - RaceClassAllocation allocate; - int r = 0; - allocate.Index = atoi(row[r++]); - allocate.BaseStats[0] = atoi(row[r++]); - allocate.BaseStats[3] = atoi(row[r++]); - allocate.BaseStats[1] = atoi(row[r++]); - allocate.BaseStats[2] = atoi(row[r++]); - allocate.BaseStats[4] = atoi(row[r++]); - allocate.BaseStats[5] = atoi(row[r++]); - allocate.BaseStats[6] = atoi(row[r++]); - allocate.DefaultPointAllocation[0] = atoi(row[r++]); - allocate.DefaultPointAllocation[3] = atoi(row[r++]); - allocate.DefaultPointAllocation[1] = atoi(row[r++]); - allocate.DefaultPointAllocation[2] = atoi(row[r++]); - allocate.DefaultPointAllocation[4] = atoi(row[r++]); - allocate.DefaultPointAllocation[5] = atoi(row[r++]); - allocate.DefaultPointAllocation[6] = atoi(row[r++]); - character_create_allocations.push_back(allocate); - } - mysql_free_result(result); - } else { - safe_delete_array(query); - return false; - } + std::string query = "SELECT * FROM char_create_point_allocations ORDER BY id"; + auto results = QueryDatabase(query); + if (!results.Success()) + return false; + + for (auto row = results.begin(); row != results.end(); ++row) { + RaceClassAllocation allocate; + allocate.Index = atoi(row[0]); + allocate.BaseStats[0] = atoi(row[1]); + allocate.BaseStats[3] = atoi(row[2]); + allocate.BaseStats[1] = atoi(row[3]); + allocate.BaseStats[2] = atoi(row[4]); + allocate.BaseStats[4] = atoi(row[5]); + allocate.BaseStats[5] = atoi(row[6]); + allocate.BaseStats[6] = atoi(row[7]); + allocate.DefaultPointAllocation[0] = atoi(row[8]); + allocate.DefaultPointAllocation[3] = atoi(row[9]); + allocate.DefaultPointAllocation[1] = atoi(row[10]); + allocate.DefaultPointAllocation[2] = atoi(row[11]); + allocate.DefaultPointAllocation[4] = atoi(row[12]); + allocate.DefaultPointAllocation[5] = atoi(row[13]); + allocate.DefaultPointAllocation[6] = atoi(row[14]); + + character_create_allocations.push_back(allocate); + } return true; } From eeb9a6ab65668b1b0f65fea3f85c8ad60549fb2a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:45:50 -0700 Subject: [PATCH 0025/1883] LoadCharacterCreateCombos converted to QueryDatabase --- world/worlddb.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 289a919cd..be82130e3 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -500,27 +500,21 @@ bool WorldDatabase::LoadCharacterCreateAllocations() { bool WorldDatabase::LoadCharacterCreateCombos() { character_create_race_class_combos.clear(); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, "select * from char_create_combinations order by race, class, deity, start_zone"), errbuf, &result)) { - safe_delete_array(query); - while(row = mysql_fetch_row(result)) { - RaceClassCombos combo; - int r = 0; - combo.AllocationIndex = atoi(row[r++]); - combo.Race = atoi(row[r++]); - combo.Class = atoi(row[r++]); - combo.Deity = atoi(row[r++]); - combo.Zone = atoi(row[r++]); - combo.ExpansionRequired = atoi(row[r++]); - character_create_race_class_combos.push_back(combo); - } - mysql_free_result(result); - } else { - safe_delete_array(query); - return false; + std::string query = "SELECT * FROM char_create_combinations ORDER BY race, class, deity, start_zone"; + auto results = QueryDatabase(query); + if (!results.Success()) + return false; + + for (auto row = results.begin(); row != results.end(); ++row) { + RaceClassCombos combo; + combo.AllocationIndex = atoi(row[0]); + combo.Race = atoi(row[1]); + combo.Class = atoi(row[2]); + combo.Deity = atoi(row[3]); + combo.Zone = atoi(row[4]); + combo.ExpansionRequired = atoi(row[5]); + + character_create_race_class_combos.push_back(combo); } return true; From b379bdd36e4dde4a84d81dbbc6eed1a747fdf4f2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:23:52 -0700 Subject: [PATCH 0026/1883] SetHideMe converted to QueryDatabase --- common/shareddb.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index aecfa0488..1a2f1d81f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -48,18 +48,14 @@ SharedDatabase::~SharedDatabase() { bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET hideme = %i where id = %i", hideme, account_id), errbuf)) { - std::cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + std::string query = StringFormat("UPDATE account SET hideme = %i WHERE id = %i", hideme, account_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in SetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } - safe_delete_array(query); return true; - } uint8 SharedDatabase::GetGMSpeed(uint32 account_id) @@ -357,13 +353,13 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, " AND (`zoneid` = %i OR `zoneid` = 0)" " AND gm <= %i ORDER BY id", si_race, si_class, si_deity, si_current_zone, admin_level); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - itemid = atoi(row[0]); + itemid = atoi(row[0]); charges = atoi(row[1]); slot = atoi(row[2]); myitem = GetItem(itemid); - if(!myitem) + if(!myitem) continue; ItemInst* myinst = CreateBaseItem(myitem, charges); if(slot < 0) @@ -604,7 +600,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) bool ret = false; // Retrieve character inventory - if (RunQuery(query, MakeAnyLenString(&query, + if (RunQuery(query, MakeAnyLenString(&query, " SELECT `slotid`, `itemid`, `charges`, `color`, `augslot1`, `augslot2`, `augslot3`, `augslot4`, `augslot5`, `instnodrop`, `custom_data`" " FROM `inventory`" " INNER JOIN `character_data` ch ON ch.id = charid" @@ -1688,7 +1684,7 @@ bool SharedDatabase::LoadBaseData() { EQEmu::IPCMutex mutex("base_data"); mutex.Lock(); base_data_mmf = new EQEmu::MemoryMappedFile("shared/base_data"); - + int size = 16 * (GetMaxBaseDataLevel() + 1) * sizeof(BaseDataStruct); if(size == 0) { EQ_EXCEPT("SharedDatabase", "Base Data size is zero"); @@ -1713,9 +1709,9 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const char *query = "SELECT * FROM base_data ORDER BY level, class ASC"; MYSQL_RES *result; MYSQL_ROW row; - + if(RunQuery(query, strlen(query), errbuf, &result)) { - + int lvl = 0; int cl = 0; while (row = mysql_fetch_row(result)) { @@ -1994,10 +1990,10 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return nullptr; } -void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { +void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id); auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::LoadCharacterInspectMessage", query); - auto row = results.begin(); + auto row = results.begin(); memcpy(message, "", sizeof(InspectMessage_Struct)); for (auto row = results.begin(); row != results.end(); ++row) { memcpy(message, row[0], sizeof(InspectMessage_Struct)); @@ -2006,7 +2002,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) { std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str()); - auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query); + auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query); } void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) { From edc2567b1029114a47bfe18a327ded43c00a9230 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:26:45 -0700 Subject: [PATCH 0027/1883] GetGMSpeed converted to QueryDatabase --- common/shareddb.cpp | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 1a2f1d81f..b1527bffe 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -60,37 +60,19 @@ bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme) uint8 SharedDatabase::GetGMSpeed(uint32 account_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT gmspeed FROM account where id='%i'", account_id), errbuf, &result)) { - safe_delete_array(query); - if (mysql_num_rows(result) == 1) - { - row = mysql_fetch_row(result); - uint8 gmspeed = atoi(row[0]); - mysql_free_result(result); - return gmspeed; - } - else - { - mysql_free_result(result); - return 0; - } - mysql_free_result(result); - } - else - { - - std::cerr << "Error in GetGMSpeed query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); - return false; + std::string query = StringFormat("SELECT gmspeed FROM account WHERE id = '%i'", account_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in GetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; + return 0; } - return 0; + if (results.RowCount() != 1) + return 0; + auto row = results.begin(); + return atoi(row[0]); } bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed) From bcf282da913ed4cde6f839f7af6e33637a65f3c5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:27:26 -0700 Subject: [PATCH 0028/1883] SetGMSpeed converted to QueryDatabase --- common/shareddb.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b1527bffe..e1166689c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -77,18 +77,14 @@ uint8 SharedDatabase::GetGMSpeed(uint32 account_id) bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET gmspeed = %i where id = %i", gmspeed, account_id), errbuf)) { - std::cerr << "Error in SetGMSpeed query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + std::string query = StringFormat("UPDATE account SET gmspeed = %i WHERE id = %i", gmspeed, account_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in SetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } - safe_delete_array(query); return true; - } uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { From 95208eb24e53d3d396db84c8b7921fbc76e99be9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:31:06 -0700 Subject: [PATCH 0029/1883] SaveCursor --- common/shareddb.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index e1166689c..0f94dc2b8 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -99,27 +99,26 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end) { - iter_queue it; - int i; - bool ret = true; - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; // Delete cursor items - if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid = %i AND ((slotid >= 8000 AND slotid <= 8999) OR slotid = %i OR (slotid >= %i AND slotid <= %i))", - char_id, MainCursor, EmuConstants::CURSOR_BAG_BEGIN, EmuConstants::CURSOR_BAG_END), errbuf))) { + std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i " + "AND ((slotid >= 8000 AND slotid <= 8999) " + "OR slotid = %i OR (slotid >= %i AND slotid <= %i) )", + char_id, MainCursor, + EmuConstants::CURSOR_BAG_BEGIN, EmuConstants::CURSOR_BAG_END); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cout << "Clearing cursor failed: " << results.ErrorMessage() << std::endl; + return false; + } - for (it = start, i = 8000; it != end; ++it, i++) { - ItemInst *inst = *it; - if (!(ret = SaveInventory(char_id, inst, (i == 8000) ? MainCursor : i))) - break; - } - } - else { - std::cout << "Clearing cursor failed: " << errbuf << std::endl; - } - safe_delete_array(query); + int i = 8000; + for(auto it = start; it != end; ++it, i++) { + ItemInst *inst = *it; + if (!SaveInventory(char_id,inst,(i == 8000) ? MainCursor : i)) + return false; + } - return ret; + return true; } bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst) From 2fbd170188e0ca547a58f7711c6c870ca0b8e0e9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:32:01 -0700 Subject: [PATCH 0030/1883] VerifyInventory converted to QueryDatabase --- common/shareddb.cpp | 51 +++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0f94dc2b8..ee1ee271c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -123,39 +123,36 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iter bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; // Delete cursor items - if (!RunQuery(query, MakeAnyLenString(&query, - "SELECT itemid,charges FROM sharedbank " - "WHERE acctid=%d AND slotid=%d", - account_id, slot_id), errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error runing inventory verification query '%s': %s", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT itemid, charges FROM sharedbank " + "WHERE acctid = %d AND slotid = %d", + account_id, slot_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error - return(true); + return true; } - safe_delete_array(query); - row = mysql_fetch_row(result); - bool found = false; - if(row) { - uint32 id = atoi(row[0]); - uint16 charges = atoi(row[1]); + if (results.RowCount() == 0) + return false; - uint16 expect_charges = 0; - if(inst->GetCharges() >= 0) - expect_charges = inst->GetCharges(); - else - expect_charges = 0x7FFF; + auto row = results.begin(); - if(id == inst->GetItem()->ID && charges == expect_charges) - found = true; - } - mysql_free_result(result); - return(found); + uint32 id = atoi(row[0]); + uint16 charges = atoi(row[1]); + + uint16 expect_charges = 0; + + if(inst->GetCharges() >= 0) + expect_charges = inst->GetCharges(); + else + expect_charges = 0x7FFF; + + if(id != inst->GetItem()->ID || charges != expect_charges) + return false; + + return true; } bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) { From a3347579e6a64fe5a7768264fa1567dcc84f7950 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:45:50 -0700 Subject: [PATCH 0031/1883] SaveInventory converted into 4 methods, converted to QueryDatabase --- common/shareddb.cpp | 234 ++++++++++++++++++++++++++------------------ common/shareddb.h | 4 + 2 files changed, 145 insertions(+), 93 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index ee1ee271c..cfe9e0939 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -156,118 +156,166 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite } bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - bool ret = false; - uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; //never save tribute slots: if(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) - return(true); + return true; - if (inst && inst->IsType(ItemClassCommon)) { + if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { + // Shared bank inventory + if (!inst) + return DeleteSharedBankSlot(char_id, slot_id); + else + return UpdateSharedBankSlot(char_id, inst, slot_id); + } + else if (!inst) // All other inventory + return DeleteInventorySlot(char_id, slot_id); + + return UpdateInventorySlot(char_id, inst, slot_id); +} + +bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { + + uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + if (inst->IsType(ItemClassCommon)) for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { ItemInst *auginst=inst->GetItem(i); augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; } - } - if (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { // Shared bank inventory - if (!inst) { - // Delete item - uint32 account_id = GetAccountIDByChar(char_id); - uint32 len_query = MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", - account_id, slot_id); + uint16 charges = 0; + if(inst->GetCharges() >= 0) + charges = inst->GetCharges(); + else + charges = 0x7FFF; - ret = RunQuery(query, len_query, errbuf); + // Update/Insert item + std::string query = StringFormat("REPLACE INTO inventory " + "(charid, slotid, itemid, charges, instnodrop, custom_data, color, " + "augslot1, augslot2, augslot3, augslot4, augslot5) " + "VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, " + "%lu, %lu, %lu, %lu, %lu)", + (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, + (unsigned long)charges, (unsigned long)(inst->IsInstNoDrop()? 1: 0), + inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(), + (unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2], + (unsigned long)augslot[3],(unsigned long)augslot[4]); + auto results = QueryDatabase(query); - // Delete bag slots, if need be - if (ret && Inventory::SupportsContainers(slot_id)) { - safe_delete_array(query); - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); - ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid>=%i AND slotid<%i", - account_id, base_slot_id, (base_slot_id+10)), errbuf); - } - - // @merth: need to delete augments here - } - else { - // Update/Insert item - uint32 account_id = GetAccountIDByChar(char_id); - uint16 charges = 0; - if(inst->GetCharges() >= 0) - charges = inst->GetCharges(); - else - charges = 0x7FFF; - - uint32 len_query = MakeAnyLenString(&query, - "REPLACE INTO sharedbank " - " (acctid,slotid,itemid,charges,custom_data," - " augslot1,augslot2,augslot3,augslot4,augslot5)" - " VALUES(%lu,%lu,%lu,%lu,'%s'," - " %lu,%lu,%lu,%lu,%lu)", - (unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, - inst->GetCustomDataString().c_str(), - (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]); - - - ret = RunQuery(query, len_query, errbuf); - } - } - else { // All other inventory - if (!inst) { - // Delete item - ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid=%i", - char_id, slot_id), errbuf); - - // Delete bag slots, if need be - if (ret && Inventory::SupportsContainers(slot_id)) { - safe_delete_array(query); - int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); - ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid>=%i AND slotid<%i", - char_id, base_slot_id, (base_slot_id+10)), errbuf); - } - - // @merth: need to delete augments here - } - else { - uint16 charges = 0; - if(inst->GetCharges() >= 0) - charges = inst->GetCharges(); - else - charges = 0x7FFF; - // Update/Insert item - uint32 len_query = MakeAnyLenString(&query, - "REPLACE INTO inventory " - " (charid,slotid,itemid,charges,instnodrop,custom_data,color," - " augslot1,augslot2,augslot3,augslot4,augslot5)" - " VALUES(%lu,%lu,%lu,%lu,%lu,'%s',%lu," - " %lu,%lu,%lu,%lu,%lu)", - (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, - (unsigned long)(inst->IsInstNoDrop() ? 1:0),inst->GetCustomDataString().c_str(),(unsigned long)inst->GetColor(), - (unsigned long)augslot[0],(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4] ); - - ret = RunQuery(query, len_query, errbuf); - } - } - - if (!ret) - LogFile->write(EQEMuLog::Error, "SaveInventory query '%s': %s", query, errbuf); - safe_delete_array(query); - - // Save bag contents, if slot supports bag contents - if (inst && inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { + // Save bag contents, if slot supports bag contents + if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } - } - // @merth: need to save augments here + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } - return ret; + return true; } +bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { + + uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + if (inst->IsType(ItemClassCommon)) + for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + ItemInst *auginst=inst->GetItem(i); + augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; + } + +// Update/Insert item + uint32 account_id = GetAccountIDByChar(char_id); + uint16 charges = 0; + if(inst->GetCharges() >= 0) + charges = inst->GetCharges(); + else + charges = 0x7FFF; + + std::string query = StringFormat("REPLACE INTO sharedbank " + "(acctid, slotid, itemid, charges, custom_data, " + "augslot1, augslot2, augslot3, augslot4, augslot5) " + "VALUES( %lu, %lu, %lu, %lu, '%s', " + "%lu, %lu, %lu, %lu, %lu)", + (unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, + (unsigned long)charges, inst->GetCustomDataString().c_str(), (unsigned long)augslot[0], + (unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]); + auto results = QueryDatabase(query); + + // Save bag contents, if slot supports bag contents + if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) + for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { + const ItemInst* baginst = inst->GetItem(idx); + SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); + } + + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } + + return true; +} + +bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { + + // Delete item + std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } + + // Delete bag slots, if need be + if (!Inventory::SupportsContainers(slot_id)) + return true; + + int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); + query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i", + char_id, base_slot_id, (base_slot_id+10)); + results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } + + // @merth: need to delete augments here + return true; +} + +bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { + + // Delete item + uint32 account_id = GetAccountIDByChar(char_id); + std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } + + // Delete bag slots, if need be + if (!Inventory::SupportsContainers(slot_id)) + return true; + + int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_BEGIN); + query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i " + "AND slotid >= %i AND slotid < %i", + account_id, base_slot_id, (base_slot_id+10)); + results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; + } + + // @merth: need to delete augments here + return true; +} + + int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) { char errbuf[MYSQL_ERRMSG_SIZE]; diff --git a/common/shareddb.h b/common/shareddb.h index eeef6125a..14793f792 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -54,6 +54,10 @@ public: */ bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id); + bool DeleteInventorySlot(uint32 char_id, int16 slot_id); + bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id); bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); int32 GetSharedPlatinum(uint32 account_id); From cbce5e5eb6085845d49038d39983848b8dd36ce9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:50:01 -0700 Subject: [PATCH 0032/1883] GetSharedPlatinum converted to QueryDatabase --- common/shareddb.cpp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index cfe9e0939..a3aa999d5 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -318,34 +318,19 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (RunQuery(query, MakeAnyLenString(&query, "SELECT sharedplat FROM account WHERE id='%i'", account_id), errbuf, &result)) { - safe_delete_array(query); - if (mysql_num_rows(result) == 1) - { - row = mysql_fetch_row(result); - uint32 shared_platinum = atoi(row[0]); - mysql_free_result(result); - return shared_platinum; - } - else - { - mysql_free_result(result); - return 0; - } - mysql_free_result(result); - } - else - { - std::cerr << "Error in GetSharedPlatinum query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + std::string query = StringFormat("SELECT sharedplat FROM account WHERE id = '%i'", account_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in GetSharedPlatinum query '" << query << "' " << results.ErrorMessage().c_str() << std::endl; return false; - } + } - return 0; + if (results.RowCount() != 1) + return 0; + + auto row = results.begin(); + + return atoi(row[0]); } bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { From 211b3a135ef5f3821013bff68011ba1fa946506a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:53:28 -0700 Subject: [PATCH 0033/1883] SetSharedPlatinum converted to QueryDatabase --- common/shareddb.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a3aa999d5..c87efc96e 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -334,16 +334,13 @@ int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) } bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE `account` SET `sharedplat` = `sharedplat` + %i WHERE id = %i", amount_to_add, account_id), errbuf)) { - std::cerr << "Error in SetSharedPlatinum query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + std::string query = StringFormat("UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in SetSharedPlatinum query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } - safe_delete_array(query); return true; } From 4a3f94e68840e8e9cea5f7c2310edd50477d9961 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:54:33 -0700 Subject: [PATCH 0034/1883] SetStartingItems converted to QueryDatabase --- common/shareddb.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c87efc96e..b5a26cf13 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -345,32 +345,37 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { } bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) { + const Item_Struct* myitem; - uint32 itemid = 0; - int32 charges = 0; - int32 slot = 0; - auto query = StringFormat( - "SELECT `itemid`, `item_charges`, `slot` FROM `starting_items`" - " WHERE (`race` = %i OR `race` = 0)" - " AND (`class` = %i OR `class` = 0)" - " AND (`deityid` = %i OR `deityid` = 0)" - " AND (`zoneid` = %i OR `zoneid` = 0)" - " AND gm <= %i ORDER BY id", - si_race, si_class, si_deity, si_current_zone, admin_level); - auto results = QueryDatabase(query); + + std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items " + "WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND " + "(deityid = %i or deityid = 0) AND (zoneid = %i or zoneid = 0) AND " + "gm <= %i ORDER BY id", + si_race, si_class, si_deity, si_current_zone, admin_level); + auto results = QueryDatabase(query); + if (!results.Success()) + return false; + + for (auto row = results.begin(); row != results.end(); ++row) { - itemid = atoi(row[0]); - charges = atoi(row[1]); - slot = atoi(row[2]); + int32 itemid = atoi(row[0]); + int32 charges = atoi(row[1]); + int32 slot = atoi(row[2]); myitem = GetItem(itemid); + if(!myitem) continue; + ItemInst* myinst = CreateBaseItem(myitem, charges); + if(slot < 0) - slot = inv->FindFreeSlot(0,0); + slot = inv->FindFreeSlot(0, 0); + inv->PutItem(slot, *myinst); safe_delete(myinst); } + return true; } From aa780ceb8c8dcb039445d92c9e78563355889ba3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 13:55:43 -0700 Subject: [PATCH 0035/1883] GetSharedBank converted to QueryDatabase --- common/shareddb.cpp | 169 +++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 87 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b5a26cf13..96c947c9b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -382,103 +382,98 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, // Retrieve shared bank inventory based on either account or character bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - uint32 len_query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - bool ret = false; + std::string query; - if (is_charid) { - len_query = MakeAnyLenString(&query, - "SELECT sb.slotid,sb.itemid,sb.charges,sb.augslot1,sb.augslot2,sb.augslot3,sb.augslot4,sb.augslot5,sb.custom_data from sharedbank sb " - "INNER JOIN character_data ch ON ch.account_id=sb.acctid " - "WHERE ch.id=%i", id); - } - else { - len_query = MakeAnyLenString(&query, - "SELECT slotid,itemid,charges,augslot1,augslot2,augslot3,augslot4,augslot5,custom_data from sharedbank WHERE acctid=%i", id); - } + if (is_charid) + query = StringFormat("SELECT sb.slotid, sb.itemid, sb.charges, " + "sb.augslot1, sb.augslot2, sb.augslot3, " + "sb.augslot4, sb.augslot5, sb.custom_data " + "FROM sharedbank sb INNER JOIN character_data ch " + "ON ch.account_id=sb.acctid WHERE ch.id = %i", id); + else + query = StringFormat("SELECT slotid, itemid, charges, " + "augslot1, augslot2, augslot3, " + "augslot4, augslot5, custom_data " + "FROM sharedbank WHERE acctid=%i", id); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + return false; + } - if (RunQuery(query, len_query, errbuf, &result)) { - while ((row = mysql_fetch_row(result))) { - int16 slot_id = (int16)atoi(row[0]); - uint32 item_id = (uint32)atoi(row[1]); - int8 charges = (int8)atoi(row[2]); - uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoi(row[3]); - aug[1] = (uint32)atoi(row[4]); - aug[2] = (uint32)atoi(row[5]); - aug[3] = (uint32)atoi(row[6]); - aug[4] = (uint32)atoi(row[7]); - const Item_Struct* item = GetItem(item_id); + for (auto row = results.begin(); row != results.end(); ++row) { + int16 slot_id = (int16)atoi(row[0]); + uint32 item_id = (uint32)atoi(row[1]); + int8 charges = (int8)atoi(row[2]); - if (item) { - int16 put_slot_id = INVALID_INDEX; + uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; + aug[0] = (uint32)atoi(row[3]); + aug[1] = (uint32)atoi(row[4]); + aug[2] = (uint32)atoi(row[5]); + aug[3] = (uint32)atoi(row[6]); + aug[4] = (uint32)atoi(row[7]); - ItemInst* inst = CreateBaseItem(item, charges); - if (item->ItemClass == ItemClassCommon) { - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (aug[i]) { - inst->PutAugment(this, i, aug[i]); - } - } - } - if(row[8]) { - std::string data_str(row[8]); - std::string id; - std::string value; - bool use_id = true; + const Item_Struct* item = GetItem(item_id); - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } - - put_slot_id = inv->PutItem(slot_id, *inst); - safe_delete(inst); - - // Save ptr to item in inventory - if (put_slot_id == INVALID_INDEX) { - LogFile->write(EQEMuLog::Error, - "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", - ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); - - if (is_charid) - SaveInventory(id, nullptr, slot_id); - } - } - else { - LogFile->write(EQEMuLog::Error, + if (!item) { + LogFile->write(EQEMuLog::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); - } - } + continue; + } - mysql_free_result(result); - ret = true; - } - else { - LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", errbuf); + int16 put_slot_id = INVALID_INDEX; + + ItemInst* inst = CreateBaseItem(item, charges); + if (item->ItemClass == ItemClassCommon) { + for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + if (aug[i]) { + inst->PutAugment(this, i, aug[i]); + } + } + } + + if(!row[8]) + continue; + + std::string data_str(row[8]); + std::string idAsString; + std::string value; + bool use_id = true; + + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(idAsString, value); + idAsString.clear(); + value.clear(); + } + use_id = !use_id; + continue; + } + + char v = data_str[i]; + if(use_id) + idAsString.push_back(v); + else + value.push_back(v); + } + + put_slot_id = inv->PutItem(slot_id, *inst); + safe_delete(inst); + + // Save ptr to item in inventory + if (put_slot_id != INVALID_INDEX) + continue; + + LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); + + if (is_charid) + SaveInventory(id, nullptr, slot_id); } - safe_delete_array(query); - return ret; + return true; } From cb897786bc5b2df6a2b69b9afe45a34b023033fb Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:02:43 -0700 Subject: [PATCH 0036/1883] GetInventory(account_id, name, inv) converted to QueryDatabase --- common/shareddb.cpp | 178 +++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 94 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 96c947c9b..1c835ba33 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -597,104 +597,94 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Overloaded: Retrieve character inventory based on account_id and character name bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES* result; - MYSQL_ROW row; - bool ret = false; - // Retrieve character inventory - if (RunQuery(query, MakeAnyLenString(&query, - " SELECT `slotid`, `itemid`, `charges`, `color`, `augslot1`, `augslot2`, `augslot3`, `augslot4`, `augslot5`, `instnodrop`, `custom_data`" - " FROM `inventory`" - " INNER JOIN `character_data` ch ON ch.id = charid" - " WHERE ch.NAME = '%s'" - " AND ch.account_id = % i" - " ORDER BY `slotid`", - name, account_id), errbuf, &result)) - { - while ((row = mysql_fetch_row(result))) { - int16 slot_id = atoi(row[0]); - uint32 item_id = atoi(row[1]); - int8 charges = atoi(row[2]); - uint32 color = atoul(row[3]); - uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoi(row[4]); - aug[1] = (uint32)atoi(row[5]); - aug[2] = (uint32)atoi(row[6]); - aug[3] = (uint32)atoi(row[7]); - aug[4] = (uint32)atoi(row[8]); - bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; - const Item_Struct* item = GetItem(item_id); - int16 put_slot_id = INVALID_INDEX; - if(!item) - continue; - - ItemInst* inst = CreateBaseItem(item, charges); - inst->SetInstNoDrop(instnodrop); - - if(row[10]) { - std::string data_str(row[10]); - std::string id; - std::string value; - bool use_id = true; - - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } - - if (color > 0) - inst->SetColor(color); - inst->SetCharges(charges); - - if (item->ItemClass == ItemClassCommon) { - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (aug[i]) { - inst->PutAugment(this, i, aug[i]); - } - } - } - if (slot_id >= 8000 && slot_id <= 8999) - put_slot_id = inv->PushCursor(*inst); - else - put_slot_id = inv->PutItem(slot_id, *inst); - safe_delete(inst); - - // Save ptr to item in inventory - if (put_slot_id == INVALID_INDEX) { - LogFile->write(EQEMuLog::Error, - "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", - name, account_id, item_id, slot_id); - } - } - mysql_free_result(result); - - // Retrieve shared inventory - ret = GetSharedBank(account_id, inv, false); - } - else { - LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); + std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data " + "FROM inventory INNER JOIN character_data ch " + "ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid", + name, account_id); + auto results = QueryDatabase(query); + if (!results.Success()){ + LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + return false; } - safe_delete_array(query); - return ret; + + for (auto row = results.begin(); row != results.end(); ++row) { + int16 slot_id = atoi(row[0]); + uint32 item_id = atoi(row[1]); + int8 charges = atoi(row[2]); + uint32 color = atoul(row[3]); + + uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; + aug[0] = (uint32)atoi(row[4]); + aug[1] = (uint32)atoi(row[5]); + aug[2] = (uint32)atoi(row[6]); + aug[3] = (uint32)atoi(row[7]); + aug[4] = (uint32)atoi(row[8]); + + bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; + const Item_Struct* item = GetItem(item_id); + int16 put_slot_id = INVALID_INDEX; + if(!item) + continue; + + ItemInst* inst = CreateBaseItem(item, charges); + inst->SetInstNoDrop(instnodrop); + + if(row[10]) { + std::string data_str(row[10]); + std::string idAsString; + std::string value; + bool use_id = true; + + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(idAsString, value); + idAsString.clear(); + value.clear(); + } + + use_id = !use_id; + continue; + } + + char v = data_str[i]; + if(use_id) + idAsString.push_back(v); + else + value.push_back(v); + + } + } + + if (color > 0) + inst->SetColor(color); + + inst->SetCharges(charges); + + if (item->ItemClass == ItemClassCommon) + for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) + if (aug[i]) + inst->PutAugment(this, i, aug[i]); + + if (slot_id>=8000 && slot_id <= 8999) + put_slot_id = inv->PushCursor(*inst); + else + put_slot_id = inv->PutItem(slot_id, *inst); + + safe_delete(inst); + + // Save ptr to item in inventory + if (put_slot_id == INVALID_INDEX) + LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + + } + + // Retrieve shared inventory + return GetSharedBank(account_id, inv, false); } From 3b75d4fa8f27454c0388dd666c3cfb766aa06b64 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:04:19 -0700 Subject: [PATCH 0037/1883] GetInventory char_id, inv) converted to QueryDatabase --- common/shareddb.cpp | 185 ++++++++++++++++++++------------------------ 1 file changed, 85 insertions(+), 100 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 1c835ba33..372872900 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -479,120 +479,105 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { // Overloaded: Retrieve character inventory based on character id bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES* result; - MYSQL_ROW row; - bool ret = false; - // Retrieve character inventory - if (RunQuery(query, MakeAnyLenString(&query, "SELECT slotid,itemid,charges,color,augslot1,augslot2,augslot3,augslot4,augslot5," - "instnodrop,custom_data FROM inventory WHERE charid=%i ORDER BY slotid", char_id), errbuf, &result)) { + std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data " + "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + return false; + } - while ((row = mysql_fetch_row(result))) { - int16 slot_id = atoi(row[0]); - uint32 item_id = atoi(row[1]); - uint16 charges = atoi(row[2]); - uint32 color = atoul(row[3]); - uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoul(row[4]); - aug[1] = (uint32)atoul(row[5]); - aug[2] = (uint32)atoul(row[6]); - aug[3] = (uint32)atoul(row[7]); - aug[4] = (uint32)atoul(row[8]); - bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; + for (auto row = results.begin(); row != results.end(); ++row) { + int16 slot_id = atoi(row[0]); + uint32 item_id = atoi(row[1]); + uint16 charges = atoi(row[2]); + uint32 color = atoul(row[3]); - const Item_Struct* item = GetItem(item_id); + uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - if (item) { - int16 put_slot_id = INVALID_INDEX; + aug[0] = (uint32)atoul(row[4]); + aug[1] = (uint32)atoul(row[5]); + aug[2] = (uint32)atoul(row[6]); + aug[3] = (uint32)atoul(row[7]); + aug[4] = (uint32)atoul(row[8]); - ItemInst* inst = CreateBaseItem(item, charges); + bool instnodrop = (row[9] && (uint16)atoi(row[9]))? true: false; - if(row[10]) { - std::string data_str(row[10]); - std::string id; - std::string value; - bool use_id = true; + const Item_Struct* item = GetItem(item_id); - for(int i = 0; i < data_str.length(); ++i) { - if(data_str[i] == '^') { - if(!use_id) { - inst->SetCustomData(id, value); - id.clear(); - value.clear(); - } - use_id = !use_id; - } - else { - char v = data_str[i]; - if(use_id) { - id.push_back(v); - } else { - value.push_back(v); - } - } - } - } + if (!item) { + LogFile->write(EQEMuLog::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + continue; + } - if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) - inst->SetInstNoDrop(true); - if (color > 0) - inst->SetColor(color); - if(charges==0x7FFF) - inst->SetCharges(-1); - else - inst->SetCharges(charges); + int16 put_slot_id = INVALID_INDEX; - if (item->ItemClass == ItemClassCommon) { - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (aug[i]) { - inst->PutAugment(this, i, aug[i]); - } - } - } + ItemInst* inst = CreateBaseItem(item, charges); - if (slot_id >= 8000 && slot_id <= 8999) { - put_slot_id = inv->PushCursor(*inst); - } - // Admins: please report any occurrences of this error - else if (slot_id >= 3111 && slot_id <= 3179) { - LogFile->write(EQEMuLog::Error, - "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", - char_id, item_id, slot_id); - put_slot_id = inv->PushCursor(*inst); - } - else { - put_slot_id = inv->PutItem(slot_id, *inst); - } + if(row[10]) { + std::string data_str(row[10]); + std::string idAsString; + std::string value; + bool use_id = true; - safe_delete(inst); + for(int i = 0; i < data_str.length(); ++i) { + if(data_str[i] == '^') { + if(!use_id) { + inst->SetCustomData(idAsString, value); + idAsString.clear(); + value.clear(); + } - // Save ptr to item in inventory - if (put_slot_id == INVALID_INDEX) { - LogFile->write(EQEMuLog::Error, - "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i", - char_id, item_id, slot_id); - } - } - else { - LogFile->write(EQEMuLog::Error, - "Warning: charid %i has an invalid item_id %i in inventory slot %i", - char_id, item_id, slot_id); - } - } - mysql_free_result(result); + use_id = !use_id; + continue; + } - // Retrieve shared inventory - ret = GetSharedBank(char_id, inv, true); - } - else { - LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query, errbuf); - LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); - } + char v = data_str[i]; + if(use_id) + idAsString.push_back(v); + else + value.push_back(v); + } + } - safe_delete_array(query); - return ret; + if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) + inst->SetInstNoDrop(true); + + if (color > 0) + inst->SetColor(color); + + if(charges==0x7FFF) + inst->SetCharges(-1); + else + inst->SetCharges(charges); + + if (item->ItemClass == ItemClassCommon) + for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) + if (aug[i]) + inst->PutAugment(this, i, aug[i]); + + if (slot_id >= 8000 && slot_id <= 8999) + put_slot_id = inv->PushCursor(*inst); + else if (slot_id >= 3111 && slot_id <= 3179) { + // Admins: please report any occurrences of this error + LogFile->write(EQEMuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + put_slot_id = inv->PushCursor(*inst); + } else + put_slot_id = inv->PutItem(slot_id, *inst); + + safe_delete(inst); + + // Save ptr to item in inventory + if (put_slot_id == INVALID_INDEX) { + LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + } + } + + // Retrieve shared inventory + return GetSharedBank(char_id, inv, true); } // Overloaded: Retrieve character inventory based on account_id and character name From 638d121b75ff30182dc057f79c840b7da543960d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:05:07 -0700 Subject: [PATCH 0038/1883] GetItemsCount converted to QueryDatabase --- common/shareddb.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 372872900..62344ff19 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -674,25 +674,26 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; item_count = -1; max_id = 0; - char query[] = "SELECT MAX(id), count(*) FROM items"; - if (RunQuery(query, static_cast(strlen(query)), errbuf, &result)) { - row = mysql_fetch_row(result); - if (row != nullptr && row[1] != 0) { - item_count = atoi(row[1]); - if(row[0]) - max_id = atoi(row[0]); - } - mysql_free_result(result); - } - else { - LogFile->write(EQEMuLog::Error, "Error in GetItemsCount '%s': '%s'", query, errbuf); + const std::string query = "SELECT MAX(id), count(*) FROM items"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + return; } + + if (results.RowCount() == 0) + return; + + auto row = results.begin(); + + if(row[0]) + max_id = atoi(row[0]); + + if (row[1]) + item_count = atoi(row[1]); } bool SharedDatabase::LoadItems() { From 2a73a572d303658befae18d52a91d055e3093531 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:06:37 -0700 Subject: [PATCH 0039/1883] LoadItems converted to QueryDatabase --- common/shareddb.cpp | 428 ++++++++++++++++++++++---------------------- 1 file changed, 217 insertions(+), 211 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 62344ff19..f7895a485 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -729,9 +729,6 @@ bool SharedDatabase::LoadItems() { void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id) { EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, items, max_item_id); - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; char ndbuffer[4]; bool disableNoRent = false; @@ -759,220 +756,229 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } } - char query[] = "select source," + Item_Struct item; + + const std::string query = "SELECT source," #define F(x) "`"#x"`," #include "item_fieldlist.h" #undef F - "updated" - " from items order by id"; - Item_Struct item; - if(RunQuery(query, sizeof(query), errbuf, &result)) { - while((row = mysql_fetch_row(result))) { - memset(&item, 0, sizeof(Item_Struct)); + "updated FROM items ORDER BY id"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); - strcpy(item.Name,row[ItemField::name]); - strcpy(item.Lore,row[ItemField::lore]); - strcpy(item.IDFile,row[ItemField::idfile]); - item.ID = (uint32)atoul(row[ItemField::id]); - item.Weight = (uint8)atoi(row[ItemField::weight]); - item.NoRent = disableNoRent ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::norent]); - item.NoDrop = disableNoDrop ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::nodrop]); - item.Size = (uint8)atoi(row[ItemField::size]); - item.Slots = (uint32)atoul(row[ItemField::slots]); - item.Price = (uint32)atoul(row[ItemField::price]); - item.Icon = (uint32)atoul(row[ItemField::icon]); - item.BenefitFlag = (atoul(row[ItemField::benefitflag]) != 0); - item.Tradeskills = (atoi(row[ItemField::tradeskills])==0) ? false : true; - item.CR = (int8)atoi(row[ItemField::cr]); - item.DR = (int8)atoi(row[ItemField::dr]); - item.PR = (int8)atoi(row[ItemField::pr]); - item.MR = (int8)atoi(row[ItemField::mr]); - item.FR = (int8)atoi(row[ItemField::fr]); - item.AStr = (int8)atoi(row[ItemField::astr]); - item.ASta = (int8)atoi(row[ItemField::asta]); - item.AAgi = (int8)atoi(row[ItemField::aagi]); - item.ADex = (int8)atoi(row[ItemField::adex]); - item.ACha = (int8)atoi(row[ItemField::acha]); - item.AInt = (int8)atoi(row[ItemField::aint]); - item.AWis = (int8)atoi(row[ItemField::awis]); - item.HP = (int32)atoul(row[ItemField::hp]); - item.Mana = (int32)atoul(row[ItemField::mana]); - item.AC = (int32)atoul(row[ItemField::ac]); - item.Deity = (uint32)atoul(row[ItemField::deity]); - item.SkillModValue = (int32)atoul(row[ItemField::skillmodvalue]); - //item.Unk033 = (int32)atoul(row[ItemField::UNK033]); - item.SkillModType = (uint32)atoul(row[ItemField::skillmodtype]); - item.BaneDmgRace = (uint32)atoul(row[ItemField::banedmgrace]); - item.BaneDmgAmt = (int8)atoi(row[ItemField::banedmgamt]); - item.BaneDmgBody = (uint32)atoul(row[ItemField::banedmgbody]); - item.Magic = (atoi(row[ItemField::magic])==0) ? false : true; - item.CastTime_ = (int32)atoul(row[ItemField::casttime_]); - item.ReqLevel = (uint8)atoi(row[ItemField::reqlevel]); - item.BardType = (uint32)atoul(row[ItemField::bardtype]); - item.BardValue = (int32)atoul(row[ItemField::bardvalue]); - item.Light = (int8)atoi(row[ItemField::light]); - item.Delay = (uint8)atoi(row[ItemField::delay]); - item.RecLevel = (uint8)atoi(row[ItemField::reclevel]); - item.RecSkill = (uint8)atoi(row[ItemField::recskill]); - item.ElemDmgType = (uint8)atoi(row[ItemField::elemdmgtype]); - item.ElemDmgAmt = (uint8)atoi(row[ItemField::elemdmgamt]); - item.Range = (uint8)atoi(row[ItemField::range]); - item.Damage = (uint32)atoi(row[ItemField::damage]); - item.Color = (uint32)atoul(row[ItemField::color]); - item.Classes = (uint32)atoul(row[ItemField::classes]); - item.Races = (uint32)atoul(row[ItemField::races]); - //item.Unk054 = (uint32)atoul(row[ItemField::UNK054]); - item.MaxCharges = (int16)atoi(row[ItemField::maxcharges]); - item.ItemType = (uint8)atoi(row[ItemField::itemtype]); - item.Material = (uint8)atoi(row[ItemField::material]); - item.SellRate = (float)atof(row[ItemField::sellrate]); - //item.Unk059 = (uint32)atoul(row[ItemField::UNK059]); - item.CastTime = (uint32)atoul(row[ItemField::casttime]); - item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); - item.ProcRate = (int32)atoi(row[ItemField::procrate]); - item.CombatEffects = (int8)atoi(row[ItemField::combateffects]); - item.Shielding = (int8)atoi(row[ItemField::shielding]); - item.StunResist = (int8)atoi(row[ItemField::stunresist]); - item.StrikeThrough = (int8)atoi(row[ItemField::strikethrough]); - item.ExtraDmgSkill = (uint32)atoul(row[ItemField::extradmgskill]); - item.ExtraDmgAmt = (uint32)atoul(row[ItemField::extradmgamt]); - item.SpellShield = (int8)atoi(row[ItemField::spellshield]); - item.Avoidance = (int8)atoi(row[ItemField::avoidance]); - item.Accuracy = (int8)atoi(row[ItemField::accuracy]); - item.CharmFileID = (uint32)atoul(row[ItemField::charmfileid]); - item.FactionMod1 = (int32)atoul(row[ItemField::factionmod1]); - item.FactionMod2 = (int32)atoul(row[ItemField::factionmod2]); - item.FactionMod3 = (int32)atoul(row[ItemField::factionmod3]); - item.FactionMod4 = (int32)atoul(row[ItemField::factionmod4]); - item.FactionAmt1 = (int32)atoul(row[ItemField::factionamt1]); - item.FactionAmt2 = (int32)atoul(row[ItemField::factionamt2]); - item.FactionAmt3 = (int32)atoul(row[ItemField::factionamt3]); - item.FactionAmt4 = (int32)atoul(row[ItemField::factionamt4]); - strcpy(item.CharmFile,row[ItemField::charmfile]); - item.AugType = (uint32)atoul(row[ItemField::augtype]); - item.AugSlotType[0] = (uint8)atoi(row[ItemField::augslot1type]); - item.AugSlotVisible[0] = (uint8)atoi(row[ItemField::augslot1visible]); - item.AugSlotUnk2[0] = 0; - item.AugSlotType[1] = (uint8)atoi(row[ItemField::augslot2type]); - item.AugSlotVisible[1] = (uint8)atoi(row[ItemField::augslot2visible]); - item.AugSlotUnk2[1] = 0; - item.AugSlotType[2] = (uint8)atoi(row[ItemField::augslot3type]); - item.AugSlotVisible[2] = (uint8)atoi(row[ItemField::augslot3visible]); - item.AugSlotUnk2[2] = 0; - item.AugSlotType[3] = (uint8)atoi(row[ItemField::augslot4type]); - item.AugSlotVisible[3] = (uint8)atoi(row[ItemField::augslot4visible]); - item.AugSlotUnk2[3] = 0; - item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]); - item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]); - item.AugSlotUnk2[4] = 0; - item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]); - item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]); - item.LDoNSold = (uint32)atoul(row[ItemField::ldonsold]); - item.BagType = (uint8)atoi(row[ItemField::bagtype]); - item.BagSlots = (uint8)atoi(row[ItemField::bagslots]); - item.BagSize = (uint8)atoi(row[ItemField::bagsize]); - item.BagWR = (uint8)atoi(row[ItemField::bagwr]); - item.Book = (uint8)atoi(row[ItemField::book]); - item.BookType = (uint32)atoul(row[ItemField::booktype]); - strcpy(item.Filename,row[ItemField::filename]); - item.BaneDmgRaceAmt = (uint32)atoul(row[ItemField::banedmgraceamt]); - item.AugRestrict = (uint32)atoul(row[ItemField::augrestrict]); - item.LoreGroup = disableLoreGroup ? (uint8)atoi("0") : atoi(row[ItemField::loregroup]); - item.LoreFlag = item.LoreGroup!=0; - item.PendingLoreFlag = (atoi(row[ItemField::pendingloreflag])==0) ? false : true; - item.ArtifactFlag = (atoi(row[ItemField::artifactflag])==0) ? false : true; - item.SummonedFlag = (atoi(row[ItemField::summonedflag])==0) ? false : true; - item.Favor = (uint32)atoul(row[ItemField::favor]); - item.FVNoDrop = (atoi(row[ItemField::fvnodrop])==0) ? false : true; - item.Endur = (uint32)atoul(row[ItemField::endur]); - item.DotShielding = (uint32)atoul(row[ItemField::dotshielding]); - item.Attack = (uint32)atoul(row[ItemField::attack]); - item.Regen = (uint32)atoul(row[ItemField::regen]); - item.ManaRegen = (uint32)atoul(row[ItemField::manaregen]); - item.EnduranceRegen = (uint32)atoul(row[ItemField::enduranceregen]); - item.Haste = (uint32)atoul(row[ItemField::haste]); - item.DamageShield = (uint32)atoul(row[ItemField::damageshield]); - item.RecastDelay = (uint32)atoul(row[ItemField::recastdelay]); - item.RecastType = (uint32)atoul(row[ItemField::recasttype]); - item.GuildFavor = (uint32)atoul(row[ItemField::guildfavor]); - item.AugDistiller = (uint32)atoul(row[ItemField::augdistiller]); - item.Attuneable = (atoi(row[ItemField::attuneable])==0) ? false : true; - item.NoPet = (atoi(row[ItemField::nopet])==0) ? false : true; - item.PointType = (uint32)atoul(row[ItemField::pointtype]); - item.PotionBelt = (atoi(row[ItemField::potionbelt])==0) ? false : true; - item.PotionBeltSlots = (atoi(row[ItemField::potionbeltslots])==0) ? false : true; - item.StackSize = (uint16)atoi(row[ItemField::stacksize]); - item.NoTransfer = disableNoTransfer ? false : (atoi(row[ItemField::notransfer])==0) ? false : true; - item.Stackable = (atoi(row[ItemField::stackable])==0) ? false : true; - item.Click.Effect = (uint32)atoul(row[ItemField::clickeffect]); - item.Click.Type = (uint8)atoul(row[ItemField::clicktype]); - item.Click.Level = (uint8)atoul(row[ItemField::clicklevel]); - item.Click.Level2 = (uint8)atoul(row[ItemField::clicklevel2]); - strcpy(item.CharmFile,row[ItemField::charmfile]); - item.Proc.Effect = (uint16)atoul(row[ItemField::proceffect]); - item.Proc.Type = (uint8)atoul(row[ItemField::proctype]); - item.Proc.Level = (uint8)atoul(row[ItemField::proclevel]); - item.Proc.Level2 = (uint8)atoul(row[ItemField::proclevel2]); - item.Worn.Effect = (uint16)atoul(row[ItemField::worneffect]); - item.Worn.Type = (uint8)atoul(row[ItemField::worntype]); - item.Worn.Level = (uint8)atoul(row[ItemField::wornlevel]); - item.Worn.Level2 = (uint8)atoul(row[ItemField::wornlevel2]); - item.Focus.Effect = (uint16)atoul(row[ItemField::focuseffect]); - item.Focus.Type = (uint8)atoul(row[ItemField::focustype]); - item.Focus.Level = (uint8)atoul(row[ItemField::focuslevel]); - item.Focus.Level2 = (uint8)atoul(row[ItemField::focuslevel2]); - item.Scroll.Effect = (uint16)atoul(row[ItemField::scrolleffect]); - item.Scroll.Type = (uint8)atoul(row[ItemField::scrolltype]); - item.Scroll.Level = (uint8)atoul(row[ItemField::scrolllevel]); - item.Scroll.Level2 = (uint8)atoul(row[ItemField::scrolllevel2]); - item.Bard.Effect = (uint16)atoul(row[ItemField::bardeffect]); - item.Bard.Type = (uint8)atoul(row[ItemField::bardtype]); - item.Bard.Level = (uint8)atoul(row[ItemField::bardlevel]); - item.Bard.Level2 = (uint8)atoul(row[ItemField::bardlevel2]); - item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; - item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); - item.Purity = (uint32)atoul(row[ItemField::purity]); - item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); - item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); - item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); - item.HeroicInt = (int32)atoi(row[ItemField::heroic_int]); - item.HeroicWis = (int32)atoi(row[ItemField::heroic_wis]); - item.HeroicAgi = (int32)atoi(row[ItemField::heroic_agi]); - item.HeroicDex = (int32)atoi(row[ItemField::heroic_dex]); - item.HeroicSta = (int32)atoi(row[ItemField::heroic_sta]); - item.HeroicCha = (int32)atoi(row[ItemField::heroic_cha]); - item.HeroicMR = (int32)atoi(row[ItemField::heroic_mr]); - item.HeroicFR = (int32)atoi(row[ItemField::heroic_fr]); - item.HeroicCR = (int32)atoi(row[ItemField::heroic_cr]); - item.HeroicDR = (int32)atoi(row[ItemField::heroic_dr]); - item.HeroicPR = (int32)atoi(row[ItemField::heroic_pr]); - item.HeroicSVCorrup = (int32)atoi(row[ItemField::heroic_svcorrup]); - item.HealAmt = (int32)atoi(row[ItemField::healamt]); - item.SpellDmg = (int32)atoi(row[ItemField::spelldmg]); - item.LDoNSellBackRate = (uint32)atoul(row[ItemField::ldonsellbackrate]); - item.ScriptFileID = (uint32)atoul(row[ItemField::scriptfileid]); - item.ExpendableArrow = (uint16)atoul(row[ItemField::expendablearrow]); - item.Clairvoyance = (uint32)atoul(row[ItemField::clairvoyance]); - strcpy(item.ClickName,row[ItemField::clickname]); - strcpy(item.ProcName,row[ItemField::procname]); - strcpy(item.WornName,row[ItemField::wornname]); - strcpy(item.FocusName,row[ItemField::focusname]); - strcpy(item.ScrollName,row[ItemField::scrollname]); + for(auto row = results.begin(); row != results.end(); ++row) { + memset(&item, 0, sizeof(Item_Struct)); - try { - hash.insert(item.ID, item); - } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); - break; - } - } + item.ItemClass = (uint8)atoi(row[ItemField::itemclass]); + strcpy(item.Name,row[ItemField::name]); + strcpy(item.Lore,row[ItemField::lore]); + strcpy(item.IDFile,row[ItemField::idfile]); + + item.ID = (uint32)atoul(row[ItemField::id]); + item.Weight = (uint8)atoi(row[ItemField::weight]); + item.NoRent = disableNoRent ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::norent]); + item.NoDrop = disableNoDrop ? (uint8)atoi("255") : (uint8)atoi(row[ItemField::nodrop]); + item.Size = (uint8)atoi(row[ItemField::size]); + item.Slots = (uint32)atoul(row[ItemField::slots]); + item.Price = (uint32)atoul(row[ItemField::price]); + item.Icon = (uint32)atoul(row[ItemField::icon]); + item.BenefitFlag = (atoul(row[ItemField::benefitflag]) != 0); + item.Tradeskills = (atoi(row[ItemField::tradeskills])==0) ? false : true; + item.CR = (int8)atoi(row[ItemField::cr]); + item.DR = (int8)atoi(row[ItemField::dr]); + item.PR = (int8)atoi(row[ItemField::pr]); + item.MR = (int8)atoi(row[ItemField::mr]); + item.FR = (int8)atoi(row[ItemField::fr]); + item.AStr = (int8)atoi(row[ItemField::astr]); + item.ASta = (int8)atoi(row[ItemField::asta]); + item.AAgi = (int8)atoi(row[ItemField::aagi]); + item.ADex = (int8)atoi(row[ItemField::adex]); + item.ACha = (int8)atoi(row[ItemField::acha]); + item.AInt = (int8)atoi(row[ItemField::aint]); + item.AWis = (int8)atoi(row[ItemField::awis]); + item.HP = (int32)atoul(row[ItemField::hp]); + item.Mana = (int32)atoul(row[ItemField::mana]); + item.AC = (int32)atoul(row[ItemField::ac]); + item.Deity = (uint32)atoul(row[ItemField::deity]); + item.SkillModValue = (int32)atoul(row[ItemField::skillmodvalue]); + + item.SkillModType = (uint32)atoul(row[ItemField::skillmodtype]); + item.BaneDmgRace = (uint32)atoul(row[ItemField::banedmgrace]); + item.BaneDmgAmt = (int8)atoi(row[ItemField::banedmgamt]); + item.BaneDmgBody = (uint32)atoul(row[ItemField::banedmgbody]); + item.Magic = (atoi(row[ItemField::magic])==0) ? false : true; + item.CastTime_ = (int32)atoul(row[ItemField::casttime_]); + item.ReqLevel = (uint8)atoi(row[ItemField::reqlevel]); + item.BardType = (uint32)atoul(row[ItemField::bardtype]); + item.BardValue = (int32)atoul(row[ItemField::bardvalue]); + item.Light = (int8)atoi(row[ItemField::light]); + item.Delay = (uint8)atoi(row[ItemField::delay]); + item.RecLevel = (uint8)atoi(row[ItemField::reclevel]); + item.RecSkill = (uint8)atoi(row[ItemField::recskill]); + item.ElemDmgType = (uint8)atoi(row[ItemField::elemdmgtype]); + item.ElemDmgAmt = (uint8)atoi(row[ItemField::elemdmgamt]); + item.Range = (uint8)atoi(row[ItemField::range]); + item.Damage = (uint32)atoi(row[ItemField::damage]); + item.Color = (uint32)atoul(row[ItemField::color]); + item.Classes = (uint32)atoul(row[ItemField::classes]); + item.Races = (uint32)atoul(row[ItemField::races]); + + item.MaxCharges = (int16)atoi(row[ItemField::maxcharges]); + item.ItemType = (uint8)atoi(row[ItemField::itemtype]); + item.Material = (uint8)atoi(row[ItemField::material]); + item.SellRate = (float)atof(row[ItemField::sellrate]); + + item.CastTime = (uint32)atoul(row[ItemField::casttime]); + item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); + item.ProcRate = (int32)atoi(row[ItemField::procrate]); + item.CombatEffects = (int8)atoi(row[ItemField::combateffects]); + item.Shielding = (int8)atoi(row[ItemField::shielding]); + item.StunResist = (int8)atoi(row[ItemField::stunresist]); + item.StrikeThrough = (int8)atoi(row[ItemField::strikethrough]); + item.ExtraDmgSkill = (uint32)atoul(row[ItemField::extradmgskill]); + item.ExtraDmgAmt = (uint32)atoul(row[ItemField::extradmgamt]); + item.SpellShield = (int8)atoi(row[ItemField::spellshield]); + item.Avoidance = (int8)atoi(row[ItemField::avoidance]); + item.Accuracy = (int8)atoi(row[ItemField::accuracy]); + item.CharmFileID = (uint32)atoul(row[ItemField::charmfileid]); + item.FactionMod1 = (int32)atoul(row[ItemField::factionmod1]); + item.FactionMod2 = (int32)atoul(row[ItemField::factionmod2]); + item.FactionMod3 = (int32)atoul(row[ItemField::factionmod3]); + item.FactionMod4 = (int32)atoul(row[ItemField::factionmod4]); + item.FactionAmt1 = (int32)atoul(row[ItemField::factionamt1]); + item.FactionAmt2 = (int32)atoul(row[ItemField::factionamt2]); + item.FactionAmt3 = (int32)atoul(row[ItemField::factionamt3]); + item.FactionAmt4 = (int32)atoul(row[ItemField::factionamt4]); + + strcpy(item.CharmFile,row[ItemField::charmfile]); + + item.AugType = (uint32)atoul(row[ItemField::augtype]); + item.AugSlotType[0] = (uint8)atoi(row[ItemField::augslot1type]); + item.AugSlotVisible[0] = (uint8)atoi(row[ItemField::augslot1visible]); + item.AugSlotUnk2[0] = 0; + item.AugSlotType[1] = (uint8)atoi(row[ItemField::augslot2type]); + item.AugSlotVisible[1] = (uint8)atoi(row[ItemField::augslot2visible]); + item.AugSlotUnk2[1] = 0; + item.AugSlotType[2] = (uint8)atoi(row[ItemField::augslot3type]); + item.AugSlotVisible[2] = (uint8)atoi(row[ItemField::augslot3visible]); + item.AugSlotUnk2[2] = 0; + item.AugSlotType[3] = (uint8)atoi(row[ItemField::augslot4type]); + item.AugSlotVisible[3] = (uint8)atoi(row[ItemField::augslot4visible]); + item.AugSlotUnk2[3] = 0; + item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]); + item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]); + item.AugSlotUnk2[4] = 0; + + item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]); + item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]); + item.LDoNSold = (uint32)atoul(row[ItemField::ldonsold]); + item.BagType = (uint8)atoi(row[ItemField::bagtype]); + item.BagSlots = (uint8)atoi(row[ItemField::bagslots]); + item.BagSize = (uint8)atoi(row[ItemField::bagsize]); + item.BagWR = (uint8)atoi(row[ItemField::bagwr]); + item.Book = (uint8)atoi(row[ItemField::book]); + item.BookType = (uint32)atoul(row[ItemField::booktype]); + + strcpy(item.Filename,row[ItemField::filename]); + + item.BaneDmgRaceAmt = (uint32)atoul(row[ItemField::banedmgraceamt]); + item.AugRestrict = (uint32)atoul(row[ItemField::augrestrict]); + item.LoreGroup = disableLoreGroup ? (uint8)atoi("0") : atoi(row[ItemField::loregroup]); + item.LoreFlag = item.LoreGroup!=0; + item.PendingLoreFlag = (atoi(row[ItemField::pendingloreflag])==0) ? false : true; + item.ArtifactFlag = (atoi(row[ItemField::artifactflag])==0) ? false : true; + item.SummonedFlag = (atoi(row[ItemField::summonedflag])==0) ? false : true; + item.Favor = (uint32)atoul(row[ItemField::favor]); + item.FVNoDrop = (atoi(row[ItemField::fvnodrop])==0) ? false : true; + item.Endur = (uint32)atoul(row[ItemField::endur]); + item.DotShielding = (uint32)atoul(row[ItemField::dotshielding]); + item.Attack = (uint32)atoul(row[ItemField::attack]); + item.Regen = (uint32)atoul(row[ItemField::regen]); + item.ManaRegen = (uint32)atoul(row[ItemField::manaregen]); + item.EnduranceRegen = (uint32)atoul(row[ItemField::enduranceregen]); + item.Haste = (uint32)atoul(row[ItemField::haste]); + item.DamageShield = (uint32)atoul(row[ItemField::damageshield]); + item.RecastDelay = (uint32)atoul(row[ItemField::recastdelay]); + item.RecastType = (uint32)atoul(row[ItemField::recasttype]); + item.GuildFavor = (uint32)atoul(row[ItemField::guildfavor]); + item.AugDistiller = (uint32)atoul(row[ItemField::augdistiller]); + item.Attuneable = (atoi(row[ItemField::attuneable])==0) ? false : true; + item.NoPet = (atoi(row[ItemField::nopet])==0) ? false : true; + item.PointType = (uint32)atoul(row[ItemField::pointtype]); + item.PotionBelt = (atoi(row[ItemField::potionbelt])==0) ? false : true; + item.PotionBeltSlots = (atoi(row[ItemField::potionbeltslots])==0) ? false : true; + item.StackSize = (uint16)atoi(row[ItemField::stacksize]); + item.NoTransfer = disableNoTransfer ? false : (atoi(row[ItemField::notransfer])==0) ? false : true; + item.Stackable = (atoi(row[ItemField::stackable])==0) ? false : true; + item.Click.Effect = (uint32)atoul(row[ItemField::clickeffect]); + item.Click.Type = (uint8)atoul(row[ItemField::clicktype]); + item.Click.Level = (uint8)atoul(row[ItemField::clicklevel]); + item.Click.Level2 = (uint8)atoul(row[ItemField::clicklevel2]); + + strcpy(item.CharmFile,row[ItemField::charmfile]); + + item.Proc.Effect = (uint16)atoul(row[ItemField::proceffect]); + item.Proc.Type = (uint8)atoul(row[ItemField::proctype]); + item.Proc.Level = (uint8)atoul(row[ItemField::proclevel]); + item.Proc.Level2 = (uint8)atoul(row[ItemField::proclevel2]); + item.Worn.Effect = (uint16)atoul(row[ItemField::worneffect]); + item.Worn.Type = (uint8)atoul(row[ItemField::worntype]); + item.Worn.Level = (uint8)atoul(row[ItemField::wornlevel]); + item.Worn.Level2 = (uint8)atoul(row[ItemField::wornlevel2]); + item.Focus.Effect = (uint16)atoul(row[ItemField::focuseffect]); + item.Focus.Type = (uint8)atoul(row[ItemField::focustype]); + item.Focus.Level = (uint8)atoul(row[ItemField::focuslevel]); + item.Focus.Level2 = (uint8)atoul(row[ItemField::focuslevel2]); + item.Scroll.Effect = (uint16)atoul(row[ItemField::scrolleffect]); + item.Scroll.Type = (uint8)atoul(row[ItemField::scrolltype]); + item.Scroll.Level = (uint8)atoul(row[ItemField::scrolllevel]); + item.Scroll.Level2 = (uint8)atoul(row[ItemField::scrolllevel2]); + item.Bard.Effect = (uint16)atoul(row[ItemField::bardeffect]); + item.Bard.Type = (uint8)atoul(row[ItemField::bardtype]); + item.Bard.Level = (uint8)atoul(row[ItemField::bardlevel]); + item.Bard.Level2 = (uint8)atoul(row[ItemField::bardlevel2]); + item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; + item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); + item.Purity = (uint32)atoul(row[ItemField::purity]); + item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); + item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); + item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); + item.HeroicInt = (int32)atoi(row[ItemField::heroic_int]); + item.HeroicWis = (int32)atoi(row[ItemField::heroic_wis]); + item.HeroicAgi = (int32)atoi(row[ItemField::heroic_agi]); + item.HeroicDex = (int32)atoi(row[ItemField::heroic_dex]); + item.HeroicSta = (int32)atoi(row[ItemField::heroic_sta]); + item.HeroicCha = (int32)atoi(row[ItemField::heroic_cha]); + item.HeroicMR = (int32)atoi(row[ItemField::heroic_mr]); + item.HeroicFR = (int32)atoi(row[ItemField::heroic_fr]); + item.HeroicCR = (int32)atoi(row[ItemField::heroic_cr]); + item.HeroicDR = (int32)atoi(row[ItemField::heroic_dr]); + item.HeroicPR = (int32)atoi(row[ItemField::heroic_pr]); + item.HeroicSVCorrup = (int32)atoi(row[ItemField::heroic_svcorrup]); + item.HealAmt = (int32)atoi(row[ItemField::healamt]); + item.SpellDmg = (int32)atoi(row[ItemField::spelldmg]); + item.LDoNSellBackRate = (uint32)atoul(row[ItemField::ldonsellbackrate]); + item.ScriptFileID = (uint32)atoul(row[ItemField::scriptfileid]); + item.ExpendableArrow = (uint16)atoul(row[ItemField::expendablearrow]); + item.Clairvoyance = (uint32)atoul(row[ItemField::clairvoyance]); + + strcpy(item.ClickName,row[ItemField::clickname]); + strcpy(item.ProcName,row[ItemField::procname]); + strcpy(item.WornName,row[ItemField::wornname]); + strcpy(item.FocusName,row[ItemField::focusname]); + strcpy(item.ScrollName,row[ItemField::scrollname]); + + try { + hash.insert(item.ID, item); + } catch(std::exception &ex) { + LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); + break; + } + } - mysql_free_result(result); - } - else { - LogFile->write(EQEMuLog::Error, "LoadItems '%s', %s", query, errbuf); - } } const Item_Struct* SharedDatabase::GetItem(uint32 id) { From 0ef428d28688a390ffcf2567daf96dd0925c6e1f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:07:55 -0700 Subject: [PATCH 0040/1883] GetBook converted to QueryDatabase --- common/shareddb.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index f7895a485..38925027e 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1015,35 +1015,28 @@ const Item_Struct* SharedDatabase::IterateItems(uint32* id) { std::string SharedDatabase::GetBook(const char *txtfile) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; char txtfile2[20]; std::string txtout; - strcpy(txtfile2,txtfile); - if (!RunQuery(query, MakeAnyLenString(&query, "SELECT txtfile FROM books where name='%s'", txtfile2), errbuf, &result)) { - std::cerr << "Error in GetBook query '" << query << "' " << errbuf << std::endl; - if (query != 0) - safe_delete_array(query); + strcpy(txtfile2, txtfile); + + std::string query = StringFormat("SELECT txtfile FROM books WHERE name = '%s'", txtfile2); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in GetBook query '" << query << "' " << results.ErrorMessage() << std::endl; txtout.assign(" ",1); return txtout; } - else { - safe_delete_array(query); - if (mysql_num_rows(result) == 0) { - mysql_free_result(result); - LogFile->write(EQEMuLog::Error, "No book to send, (%s)", txtfile); - txtout.assign(" ",1); - return txtout; - } - else { - row = mysql_fetch_row(result); - txtout.assign(row[0],strlen(row[0])); - mysql_free_result(result); - return txtout; - } - } + + if (results.RowCount() == 0) { + LogFile->write(EQEMuLog::Error, "No book to send, (%s)", txtfile); + txtout.assign(" ",1); + return txtout; + } + + auto row = results.begin(); + txtout.assign(row[0],strlen(row[0])); + + return txtout; } void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { From 7d0b316e74194e020a7b18d27f910816d8ee3dd0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:08:53 -0700 Subject: [PATCH 0041/1883] GetFactionListInfo converted to QueryDatabase --- common/shareddb.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 38925027e..6c727ef28 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1042,20 +1042,21 @@ std::string SharedDatabase::GetBook(const char *txtfile) void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { list_count = 0; max_lists = 0; - const char *query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - list_count = static_cast(atoul(row[0])); - max_lists = static_cast(atoul(row[1])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); + const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + return; } + + if (results.RowCount() == 0) + return; + + auto row = results.begin(); + + list_count = static_cast(atoul(row[0])); + max_lists = static_cast(atoul(row[1])); } const NPCFactionList* SharedDatabase::GetNPCFactionEntry(uint32 id) { From e19db3f447a741f1ce337aaff36172711e7d2730 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:10:00 -0700 Subject: [PATCH 0042/1883] LoadNPCFactionLists converted to QueryDatabase --- common/shareddb.cpp | 81 +++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6c727ef28..6441145aa 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1073,57 +1073,52 @@ const NPCFactionList* SharedDatabase::GetNPCFactionEntry(uint32 id) { void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists) { EQEmu::FixedMemoryHashSet hash(reinterpret_cast(data), size, list_count, max_lists); - const char *query = "SELECT npc_faction.id, npc_faction.primaryfaction, npc_faction.ignore_primary_assist, " - "npc_faction_entries.faction_id, npc_faction_entries.value, npc_faction_entries.npc_value, npc_faction_entries.temp " - "FROM npc_faction LEFT JOIN npc_faction_entries ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY " - "npc_faction.id;"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; NPCFactionList faction; - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, faction); - } + const std::string query = "SELECT npc_faction.id, npc_faction.primaryfaction, npc_faction.ignore_primary_assist, " + "npc_faction_entries.faction_id, npc_faction_entries.value, npc_faction_entries.npc_value, " + "npc_faction_entries.temp FROM npc_faction LEFT JOIN npc_faction_entries " + "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - memset(&faction, 0, sizeof(faction)); - current_entry = 0; - current_id = id; - faction.id = id; - faction.primaryfaction = static_cast(atoul(row[1])); - faction.assistprimaryfaction = (atoi(row[2]) == 0); - } + uint32 current_id = 0; + uint32 current_entry = 0; - if(!row[3]) { + for(auto row = results.begin(); row != results.end(); ++row) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) { + hash.insert(current_id, faction); + } + + memset(&faction, 0, sizeof(faction)); + current_entry = 0; + current_id = id; + faction.id = id; + faction.primaryfaction = static_cast(atoul(row[1])); + faction.assistprimaryfaction = (atoi(row[2]) == 0); + } + + if(!row[3]) + continue; + + if(current_entry >= MAX_NPC_FACTIONS) continue; - } - if(current_entry >= MAX_NPC_FACTIONS) { - continue; - } + faction.factionid[current_entry] = static_cast(atoul(row[3])); + faction.factionvalue[current_entry] = static_cast(atoi(row[4])); + faction.factionnpcvalue[current_entry] = static_cast(atoi(row[5])); + faction.factiontemp[current_entry] = static_cast(atoi(row[6])); + ++current_entry; + } - faction.factionid[current_entry] = static_cast(atoul(row[3])); - faction.factionvalue[current_entry] = static_cast(atoi(row[4])); - faction.factionnpcvalue[current_entry] = static_cast(atoi(row[5])); - faction.factiontemp[current_entry] = static_cast(atoi(row[6])); - ++current_entry; - } + if(current_id != 0) + hash.insert(current_id, faction); - if(current_id != 0) { - hash.insert(current_id, faction); - } - - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query, errbuf); -} } bool SharedDatabase::LoadNPCFactionLists() { From e2c84c5f392fdabaf161afad0a3ce018910b7d69 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:10:57 -0700 Subject: [PATCH 0043/1883] DeleteStalePlayerCorpses converted to QueryDatabase --- common/shareddb.cpp | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6441145aa..44e6084e9 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1207,33 +1207,25 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) } int32 SharedDatabase::DeleteStalePlayerCorpses() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - uint32 affected_rows = 0; - if(RuleB(Zone, EnableShadowrest)) { - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried=0 and " - "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", - (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) - { - safe_delete_array(query); + std::string query = StringFormat("UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND " + "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d AND NOT timeofdeath = 0", + (RuleI(Character, CorpseDecayTimeMS) / 1000)); + auto results = QueryDatabase(query); + if (!results.Success()) return -1; - } - } - else - { - if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - " - "UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), - errbuf, 0, &affected_rows)) - { - safe_delete_array(query); - return -1; - } + + return results.RowsAffected(); } - safe_delete_array(query); - return affected_rows; + std::string query = StringFormat("DELETE FROM player_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d " + "AND NOT timeofdeath = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); + auto results = QueryDatabase(query); + if (!results.Success()) + return -1; + + return results.RowsAffected(); } int32 SharedDatabase::DeleteStalePlayerBackups() { From c12805accebf55477d5ba11e731ef044a19f7c0a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:11:40 -0700 Subject: [PATCH 0044/1883] DeleteStalePlayerBackups converted to QueryDatabase --- common/shareddb.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 44e6084e9..ba4d34413 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1229,18 +1229,13 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { } int32 SharedDatabase::DeleteStalePlayerBackups() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - uint32 affected_rows = 0; - // 1209600 seconds = 2 weeks - if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses_backup where (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > 1209600"), errbuf, 0, &affected_rows)) { - safe_delete_array(query); - return -1; - } - safe_delete_array(query); + const std::string query = "DELETE FROM player_corpses_backup WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > 1209600"; + auto results = QueryDatabase(query); + if (!results.Success()) + return -1; - return affected_rows; + return results.RowsAffected(); } bool SharedDatabase::GetCommandSettings(std::map &commands) { From 5cbae2b83336b7824ca4714c11cb4cce558c7f97 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:12:16 -0700 Subject: [PATCH 0045/1883] GetcommandSettings converted to QueryDatabase --- common/shareddb.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index ba4d34413..3a4e59f86 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1239,27 +1239,20 @@ int32 SharedDatabase::DeleteStalePlayerBackups() { } bool SharedDatabase::GetCommandSettings(std::map &commands) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - query = new char[256]; - strcpy(query, "SELECT command,access from commands"); - commands.clear(); - if (RunQuery(query, strlen(query), errbuf, &result)) { - safe_delete_array(query); - while((row = mysql_fetch_row(result))) { - commands[row[0]]=atoi(row[1]); - } - mysql_free_result(result); - return true; - } else { - std::cerr << "Error in GetCommands query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + + const std::string query = "SELECT command, access FROM commands"; + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in GetCommands query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } - return false; + commands.clear(); + + for (auto row = results.begin(); row != results.end(); ++row) + commands[row[0]]=atoi(row[1]); + + return true; } bool SharedDatabase::LoadSkillCaps() { From 13667749312dd2accead8c8e36ff4e04aceee489 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:13:05 -0700 Subject: [PATCH 0046/1883] LoadSkillCaps converted to QueryDatabase --- common/shareddb.cpp | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 3a4e59f86..db9f6a3bf 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1287,31 +1287,25 @@ void SharedDatabase::LoadSkillCaps(void *data) { uint32 level_count = HARD_LEVEL_CAP + 1; uint16 *skill_caps_table = reinterpret_cast(data); - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"), - errbuf, &result)) { - safe_delete_array(query); - - while((row = mysql_fetch_row(result))) { - uint8 skillID = atoi(row[0]); - uint8 class_ = atoi(row[1]) - 1; - uint8 level = atoi(row[2]); - uint16 cap = atoi(row[3]); - if(skillID >= skill_count || class_ >= class_count || level >= level_count) - continue; - - uint32 index = (((class_ * skill_count) + skillID) * level_count) + level; - skill_caps_table[index] = cap; - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error loading skill caps from database: %s", errbuf); - safe_delete_array(query); + const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + return; } + + for(auto row = results.begin(); row != results.end(); ++row) { + uint8 skillID = atoi(row[0]); + uint8 class_ = atoi(row[1]) - 1; + uint8 level = atoi(row[2]); + uint16 cap = atoi(row[3]); + + if(skillID >= skill_count || class_ >= class_count || level >= level_count) + continue; + + uint32 index = (((class_ * skill_count) + skillID) * level_count) + level; + skill_caps_table[index] = cap; + } } uint16 SharedDatabase::GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Level) { From 0622f02470789c659261d8c90f4ee8f47470ac21 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:14:27 -0700 Subject: [PATCH 0047/1883] LoadDamageShieldTypes converted to queryDatabase --- common/shareddb.cpp | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index db9f6a3bf..4408840d5 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1388,32 +1388,20 @@ uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Lev void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) { - const char *DSQuery = "SELECT `spellid`, `type` from `damageshieldtypes` WHERE `spellid` > 0 " - "AND `spellid` <= %i"; + std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 " + "AND `spellid` <= %i", iMaxSpellID); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - const char *ERR_MYSQLERROR = "Error in LoadDamageShieldTypes: %s %s"; + for(auto row = results.begin(); row != results.end(); ++row) { + int spellID = atoi(row[0]); + if((spellID > 0) && (spellID <= iMaxSpellID)) + sp[spellID].DamageShieldType = atoi(row[1]); + } - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - - if(RunQuery(query,MakeAnyLenString(&query,DSQuery,iMaxSpellID),errbuf,&result)) { - - while((row = mysql_fetch_row(result))) { - - int SpellID = atoi(row[0]); - if((SpellID > 0) && (SpellID <= iMaxSpellID)) { - sp[SpellID].DamageShieldType = atoi(row[1]); - } - } - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - safe_delete_array(query); - } } const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) { From 1c04dccf53a1f961f0dae4aad4b4ae97bb69ddc8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:16:00 -0700 Subject: [PATCH 0048/1883] GetMaxSpellID converted to QueryDatabase --- common/shareddb.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 4408840d5..6b4a43a13 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1409,23 +1409,16 @@ const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) { } int SharedDatabase::GetMaxSpellID() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = nullptr; - MYSQL_RES *result; - MYSQL_ROW row; - int32 ret = 0; - if(RunQuery(query, MakeAnyLenString(&query, "SELECT MAX(id) FROM spells_new"), - errbuf, &result)) { - safe_delete_array(query); - row = mysql_fetch_row(result); - ret = atoi(row[0]); - mysql_free_result(result); - } else { - _log(SPELLS__LOAD_ERR, "Error in GetMaxSpellID query '%s' %s", query, errbuf); - safe_delete_array(query); - ret = -1; - } - return ret; + std::string query = "SELECT MAX(id) FROM spells_new"; + auto results = QueryDatabase(query); + if (!results.Success()) { + _log(SPELLS__LOAD_ERR, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + return -1; + } + + auto row = results.begin(); + + return atoi(row[0]); } void SharedDatabase::LoadSpells(void *data, int max_spells) { From 938322a3d14fc607a87fd7434ecac849162673ca Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:16:54 -0700 Subject: [PATCH 0049/1883] LoadSpells converted to QueryDatabase --- common/shareddb.cpp | 269 ++++++++++++++++++++++---------------------- 1 file changed, 133 insertions(+), 136 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6b4a43a13..b90097a1e 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1423,164 +1423,161 @@ int SharedDatabase::GetMaxSpellID() { void SharedDatabase::LoadSpells(void *data, int max_spells) { SPDat_Spell_Struct *sp = reinterpret_cast(data); - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, MakeAnyLenString(&query, - "SELECT * FROM spells_new ORDER BY id ASC"), - errbuf, &result)) { - safe_delete_array(query); + const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; + auto results = QueryDatabase(query); + if (!results.Success()) { + _log(SPELLS__LOAD_ERR, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - int tempid = 0; - int counter = 0; + if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { + _log(SPELLS__LOAD_ERR, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + return; + } - if(result && mysql_field_count(getMySQL()) <= SPELL_LOAD_FIELD_COUNT) { - _log(SPELLS__LOAD_ERR, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); - mysql_free_result(result); - return; - } + int tempid = 0; + int counter = 0; - while (row = mysql_fetch_row(result)) { - tempid = atoi(row[0]); - if(tempid >= max_spells) { - _log(SPELLS__LOAD_ERR, "Non fatal error: spell.id >= max_spells, ignoring."); - continue; - } + for (auto row = results.begin(); row != results.end(); ++row) { + tempid = atoi(row[0]); + if(tempid >= max_spells) { + _log(SPELLS__LOAD_ERR, "Non fatal error: spell.id >= max_spells, ignoring."); + continue; + } - ++counter; - sp[tempid].id = tempid; - strn0cpy(sp[tempid].name, row[1], sizeof(sp[tempid].name)); - strn0cpy(sp[tempid].player_1, row[2], sizeof(sp[tempid].player_1)); - strn0cpy(sp[tempid].teleport_zone, row[3], sizeof(sp[tempid].teleport_zone)); - strn0cpy(sp[tempid].you_cast, row[4], sizeof(sp[tempid].you_cast)); - strn0cpy(sp[tempid].other_casts, row[5], sizeof(sp[tempid].other_casts)); - strn0cpy(sp[tempid].cast_on_you, row[6], sizeof(sp[tempid].cast_on_you)); - strn0cpy(sp[tempid].cast_on_other, row[7], sizeof(sp[tempid].cast_on_other)); - strn0cpy(sp[tempid].spell_fades, row[8], sizeof(sp[tempid].spell_fades)); + ++counter; + sp[tempid].id = tempid; + strn0cpy(sp[tempid].name, row[1], sizeof(sp[tempid].name)); + strn0cpy(sp[tempid].player_1, row[2], sizeof(sp[tempid].player_1)); + strn0cpy(sp[tempid].teleport_zone, row[3], sizeof(sp[tempid].teleport_zone)); + strn0cpy(sp[tempid].you_cast, row[4], sizeof(sp[tempid].you_cast)); + strn0cpy(sp[tempid].other_casts, row[5], sizeof(sp[tempid].other_casts)); + strn0cpy(sp[tempid].cast_on_you, row[6], sizeof(sp[tempid].cast_on_you)); + strn0cpy(sp[tempid].cast_on_other, row[7], sizeof(sp[tempid].cast_on_other)); + strn0cpy(sp[tempid].spell_fades, row[8], sizeof(sp[tempid].spell_fades)); - sp[tempid].range=static_cast(atof(row[9])); - sp[tempid].aoerange=static_cast(atof(row[10])); - sp[tempid].pushback=static_cast(atof(row[11])); - sp[tempid].pushup=static_cast(atof(row[12])); - sp[tempid].cast_time=atoi(row[13]); - sp[tempid].recovery_time=atoi(row[14]); - sp[tempid].recast_time=atoi(row[15]); - sp[tempid].buffdurationformula=atoi(row[16]); - sp[tempid].buffduration=atoi(row[17]); - sp[tempid].AEDuration=atoi(row[18]); - sp[tempid].mana=atoi(row[19]); + sp[tempid].range=static_cast(atof(row[9])); + sp[tempid].aoerange=static_cast(atof(row[10])); + sp[tempid].pushback=static_cast(atof(row[11])); + sp[tempid].pushup=static_cast(atof(row[12])); + sp[tempid].cast_time=atoi(row[13]); + sp[tempid].recovery_time=atoi(row[14]); + sp[tempid].recast_time=atoi(row[15]); + sp[tempid].buffdurationformula=atoi(row[16]); + sp[tempid].buffduration=atoi(row[17]); + sp[tempid].AEDuration=atoi(row[18]); + sp[tempid].mana=atoi(row[19]); - int y=0; - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].base[y]=atoi(row[20+y]); // effect_base_value - for(y=0; y < EFFECT_COUNT; y++) - sp[tempid].base2[y]=atoi(row[32+y]); // effect_limit_value - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].max[y]=atoi(row[44+y]); + int y=0; + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].base[y]=atoi(row[20+y]); // effect_base_value - for(y=0; y< 4;y++) - sp[tempid].components[y]=atoi(row[58+y]); + for(y=0; y < EFFECT_COUNT; y++) + sp[tempid].base2[y]=atoi(row[32+y]); // effect_limit_value - for(y=0; y< 4;y++) - sp[tempid].component_counts[y]=atoi(row[62+y]); + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].max[y]=atoi(row[44+y]); - for(y=0; y< 4;y++) - sp[tempid].NoexpendReagent[y]=atoi(row[66+y]); + for(y=0; y< 4;y++) + sp[tempid].components[y]=atoi(row[58+y]); - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].formula[y]=atoi(row[70+y]); + for(y=0; y< 4;y++) + sp[tempid].component_counts[y]=atoi(row[62+y]); - sp[tempid].goodEffect=atoi(row[83]); - sp[tempid].Activated=atoi(row[84]); - sp[tempid].resisttype=atoi(row[85]); + for(y=0; y< 4;y++) + sp[tempid].NoexpendReagent[y]=atoi(row[66+y]); - for(y=0; y< EFFECT_COUNT;y++) - sp[tempid].effectid[y]=atoi(row[86+y]); + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].formula[y]=atoi(row[70+y]); - sp[tempid].targettype = (SpellTargetType) atoi(row[98]); - sp[tempid].basediff=atoi(row[99]); - int tmp_skill = atoi(row[100]);; - if(tmp_skill < 0 || tmp_skill > HIGHEST_SKILL) - sp[tempid].skill = SkillBegging; /* not much better we can do. */ // can probably be changed to client-based 'SkillNone' once activated - else - sp[tempid].skill = (SkillUseTypes) tmp_skill; - sp[tempid].zonetype=atoi(row[101]); - sp[tempid].EnvironmentType=atoi(row[102]); - sp[tempid].TimeOfDay=atoi(row[103]); + sp[tempid].goodEffect=atoi(row[83]); + sp[tempid].Activated=atoi(row[84]); + sp[tempid].resisttype=atoi(row[85]); - for(y=0; y < PLAYER_CLASS_COUNT;y++) - sp[tempid].classes[y]=atoi(row[104+y]); + for(y=0; y< EFFECT_COUNT;y++) + sp[tempid].effectid[y]=atoi(row[86+y]); - sp[tempid].CastingAnim=atoi(row[120]); - sp[tempid].SpellAffectIndex=atoi(row[123]); - sp[tempid].disallow_sit=atoi(row[124]); + sp[tempid].targettype = (SpellTargetType) atoi(row[98]); + sp[tempid].basediff=atoi(row[99]); - for (y = 0; y < 16; y++) - sp[tempid].deities[y]=atoi(row[126+y]); + int tmp_skill = atoi(row[100]);; - sp[tempid].uninterruptable=atoi(row[146]) != 0; - sp[tempid].ResistDiff=atoi(row[147]); - sp[tempid].dot_stacking_exempt=atoi(row[148]); - sp[tempid].RecourseLink = atoi(row[150]); - sp[tempid].no_partial_resist = atoi(row[151]) != 0; + if(tmp_skill < 0 || tmp_skill > HIGHEST_SKILL) + sp[tempid].skill = SkillBegging; /* not much better we can do. */ // can probably be changed to client-based 'SkillNone' once activated + else + sp[tempid].skill = (SkillUseTypes) tmp_skill; - sp[tempid].short_buff_box = atoi(row[154]); - sp[tempid].descnum = atoi(row[155]); - sp[tempid].effectdescnum = atoi(row[157]); + sp[tempid].zonetype=atoi(row[101]); + sp[tempid].EnvironmentType=atoi(row[102]); + sp[tempid].TimeOfDay=atoi(row[103]); - sp[tempid].npc_no_los = atoi(row[159]) != 0; - sp[tempid].reflectable = atoi(row[161]) != 0; - sp[tempid].bonushate=atoi(row[162]); + for(y=0; y < PLAYER_CLASS_COUNT;y++) + sp[tempid].classes[y]=atoi(row[104+y]); - sp[tempid].EndurCost=atoi(row[166]); - sp[tempid].EndurTimerIndex=atoi(row[167]); - sp[tempid].IsDisciplineBuff = atoi(row[168]) != 0; - sp[tempid].HateAdded=atoi(row[173]); - sp[tempid].EndurUpkeep=atoi(row[174]); - sp[tempid].numhitstype = atoi(row[175]); - sp[tempid].numhits = atoi(row[176]); - sp[tempid].pvpresistbase=atoi(row[177]); - sp[tempid].pvpresistcalc=atoi(row[178]); - sp[tempid].pvpresistcap=atoi(row[179]); - sp[tempid].spell_category=atoi(row[180]); - sp[tempid].can_mgb=atoi(row[185]); - sp[tempid].dispel_flag = atoi(row[186]); - sp[tempid].MinResist = atoi(row[189]); - sp[tempid].MaxResist = atoi(row[190]); - sp[tempid].viral_targets = atoi(row[191]); - sp[tempid].viral_timer = atoi(row[192]); - sp[tempid].NimbusEffect = atoi(row[193]); - sp[tempid].directional_start = static_cast(atoi(row[194])); - sp[tempid].directional_end = static_cast(atoi(row[195])); - sp[tempid].not_extendable = atoi(row[197]) != 0; - sp[tempid].suspendable = atoi(row[200]) != 0; - sp[tempid].viral_range = atoi(row[201]); - sp[tempid].spellgroup=atoi(row[207]); - sp[tempid].rank = atoi(row[208]); - sp[tempid].powerful_flag=atoi(row[209]); - sp[tempid].CastRestriction = atoi(row[211]); - sp[tempid].AllowRest = atoi(row[212]) != 0; - sp[tempid].InCombat = atoi(row[213]) != 0; - sp[tempid].OutofCombat = atoi(row[214]) != 0; - sp[tempid].aemaxtargets = atoi(row[218]); - sp[tempid].maxtargets = atoi(row[219]); - sp[tempid].persistdeath = atoi(row[224]) != 0; - sp[tempid].min_dist = atof(row[227]); - sp[tempid].min_dist_mod = atof(row[228]); - sp[tempid].max_dist = atof(row[229]); - sp[tempid].max_dist_mod = atof(row[230]); - sp[tempid].min_range = static_cast(atoi(row[231])); - sp[tempid].DamageShieldType = 0; - } - mysql_free_result(result); + sp[tempid].CastingAnim=atoi(row[120]); + sp[tempid].SpellAffectIndex=atoi(row[123]); + sp[tempid].disallow_sit=atoi(row[124]); - LoadDamageShieldTypes(sp, max_spells); - } else { - _log(SPELLS__LOAD_ERR, "Error in LoadSpells query '%s' %s", query, errbuf); - safe_delete_array(query); - } + for (y = 0; y < 16; y++) + sp[tempid].deities[y]=atoi(row[126+y]); + + sp[tempid].uninterruptable=atoi(row[146]) != 0; + sp[tempid].ResistDiff=atoi(row[147]); + sp[tempid].dot_stacking_exempt=atoi(row[148]); + sp[tempid].RecourseLink = atoi(row[150]); + sp[tempid].no_partial_resist = atoi(row[151]) != 0; + + sp[tempid].short_buff_box = atoi(row[154]); + sp[tempid].descnum = atoi(row[155]); + sp[tempid].effectdescnum = atoi(row[157]); + + sp[tempid].npc_no_los = atoi(row[159]) != 0; + sp[tempid].reflectable = atoi(row[161]) != 0; + sp[tempid].bonushate=atoi(row[162]); + + sp[tempid].EndurCost=atoi(row[166]); + sp[tempid].EndurTimerIndex=atoi(row[167]); + sp[tempid].IsDisciplineBuff = atoi(row[168]) != 0; + sp[tempid].HateAdded=atoi(row[173]); + sp[tempid].EndurUpkeep=atoi(row[174]); + sp[tempid].numhitstype = atoi(row[175]); + sp[tempid].numhits = atoi(row[176]); + sp[tempid].pvpresistbase=atoi(row[177]); + sp[tempid].pvpresistcalc=atoi(row[178]); + sp[tempid].pvpresistcap=atoi(row[179]); + sp[tempid].spell_category=atoi(row[180]); + sp[tempid].can_mgb=atoi(row[185]); + sp[tempid].dispel_flag = atoi(row[186]); + sp[tempid].MinResist = atoi(row[189]); + sp[tempid].MaxResist = atoi(row[190]); + sp[tempid].viral_targets = atoi(row[191]); + sp[tempid].viral_timer = atoi(row[192]); + sp[tempid].NimbusEffect = atoi(row[193]); + sp[tempid].directional_start = static_cast(atoi(row[194])); + sp[tempid].directional_end = static_cast(atoi(row[195])); + sp[tempid].not_extendable = atoi(row[197]) != 0; + sp[tempid].suspendable = atoi(row[200]) != 0; + sp[tempid].viral_range = atoi(row[201]); + sp[tempid].spellgroup=atoi(row[207]); + sp[tempid].rank = atoi(row[208]); + sp[tempid].powerful_flag=atoi(row[209]); + sp[tempid].CastRestriction = atoi(row[211]); + sp[tempid].AllowRest = atoi(row[212]) != 0; + sp[tempid].InCombat = atoi(row[213]) != 0; + sp[tempid].OutofCombat = atoi(row[214]) != 0; + sp[tempid].aemaxtargets = atoi(row[218]); + sp[tempid].maxtargets = atoi(row[219]); + sp[tempid].persistdeath = atoi(row[224]) != 0; + sp[tempid].min_dist = atof(row[227]); + sp[tempid].min_dist_mod = atof(row[228]); + sp[tempid].max_dist = atof(row[229]); + sp[tempid].max_dist_mod = atof(row[230]); + sp[tempid].min_range = static_cast(atoi(row[231])); + sp[tempid].DamageShieldType = 0; + } + + LoadDamageShieldTypes(sp, max_spells); } int SharedDatabase::GetMaxBaseDataLevel() { From cecd9b89ba9c623a07e6ae7601f7b725f74cc0c2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:18:11 -0700 Subject: [PATCH 0050/1883] GetMaxBaseDataLevel converted to QueryDatabase --- common/shareddb.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b90097a1e..0522d146a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1581,25 +1581,19 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { } int SharedDatabase::GetMaxBaseDataLevel() { - char errbuf[MYSQL_ERRMSG_SIZE]; - const char *query = "SELECT MAX(level) FROM base_data"; - MYSQL_RES *result; - MYSQL_ROW row; - int32 ret = 0; - if(RunQuery(query, strlen(query), errbuf, &result)) { - row = mysql_fetch_row(result); - if(row) { - ret = atoi(row[0]); - mysql_free_result(result); - } else { - ret = -1; - mysql_free_result(result); - } - } else { - LogFile->write(EQEMuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query, errbuf); - ret = -1; + const std::string query = "SELECT MAX(level) FROM base_data"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + return -1; } - return ret; + + if (results.RowCount() == 0) + return -1; + + auto row = results.begin(); + + return atoi(row[0]); } bool SharedDatabase::LoadBaseData() { From 81b9d9a57eefa7fd0fcb5375bd8e3a0052ce6233 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:19:04 -0700 Subject: [PATCH 0051/1883] LoadBaseData converted to QueryDatabase --- common/shareddb.cpp | 89 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0522d146a..2621e61bc 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1626,53 +1626,52 @@ bool SharedDatabase::LoadBaseData() { void SharedDatabase::LoadBaseData(void *data, int max_level) { char *base_ptr = reinterpret_cast(data); - char errbuf[MYSQL_ERRMSG_SIZE]; - const char *query = "SELECT * FROM base_data ORDER BY level, class ASC"; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - - int lvl = 0; - int cl = 0; - while (row = mysql_fetch_row(result)) { - lvl = atoi(row[0]); - cl = atoi(row[1]); - if(lvl <= 0) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level <= 0, ignoring."); - continue; - } - - if(lvl >= max_level) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring."); - continue; - } - - if(cl <= 0) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring."); - continue; - } - - if(cl > 16) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.class > 16, ignoring."); - continue; - } - - BaseDataStruct *bd = reinterpret_cast(base_ptr + (((16 * (lvl - 1)) + (cl - 1)) * sizeof(BaseDataStruct))); - bd->base_hp = atof(row[2]); - bd->base_mana = atof(row[3]); - bd->base_end = atof(row[4]); - bd->unk1 = atof(row[5]); - bd->unk2 = atof(row[6]); - bd->hp_factor = atof(row[7]); - bd->mana_factor = atof(row[8]); - bd->endurance_factor = atof(row[9]); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error in LoadBaseData query '%s' %s", query, errbuf); - safe_delete_array(query); + const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + return; } + + int lvl = 0; + int cl = 0; + + for (auto row = results.begin(); row != results.end(); ++row) { + lvl = atoi(row[0]); + cl = atoi(row[1]); + + if(lvl <= 0) { + LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level <= 0, ignoring."); + continue; + } + + if(lvl >= max_level) { + LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + continue; + } + + if(cl <= 0) { + LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + continue; + } + + if(cl > 16) { + LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.class > 16, ignoring."); + continue; + } + + BaseDataStruct *bd = reinterpret_cast(base_ptr + (((16 * (lvl - 1)) + (cl - 1)) * sizeof(BaseDataStruct))); + bd->base_hp = atof(row[2]); + bd->base_mana = atof(row[3]); + bd->base_end = atof(row[4]); + bd->unk1 = atof(row[5]); + bd->unk2 = atof(row[6]); + bd->hp_factor = atof(row[7]); + bd->mana_factor = atof(row[8]); + bd->endurance_factor = atof(row[9]); + } + } const BaseDataStruct* SharedDatabase::GetBaseData(int lvl, int cl) { From aa9601352dc6386b04421ee2f3cdea7d92763523 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:20:46 -0700 Subject: [PATCH 0052/1883] GetLootDropInfo converted to QueryDatabase --- common/shareddb.cpp | 57 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 2621e61bc..dd71bf11a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1707,42 +1707,43 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot loot_table_count = 0; max_loot_table = 0; loot_table_entries = 0; - const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - loot_table_count = static_cast(atoul(row[0])); - max_loot_table = static_cast(atoul(row[1])); - loot_table_entries = static_cast(atoul(row[2])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } + if (results.RowCount() == 0) + return; + + auto row = results.begin(); + + loot_table_count = static_cast(atoul(row[0])); + max_loot_table = static_cast(atoul(row[1])); + loot_table_entries = static_cast(atoul(row[2])); } void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries) { loot_drop_count = 0; max_loot_drop = 0; loot_drop_entries = 0; - const char *query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - if(RunQuery(query, strlen(query), errbuf, &result)) { - if(row = mysql_fetch_row(result)) { - loot_drop_count = static_cast(atoul(row[0])); - max_loot_drop = static_cast(atoul(row[1])); - loot_drop_entries = static_cast(atoul(row[2])); - } - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } + const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } + + if (results.RowCount() == 0) + return; + + auto row =results.begin(); + + loot_drop_count = static_cast(atoul(row[0])); + max_loot_drop = static_cast(atoul(row[1])); + loot_drop_entries = static_cast(atoul(row[2])); } void SharedDatabase::LoadLootTables(void *data, uint32 size) { From c7faf8a03c2d7efa27a8b5a2e2bee75b631bd510 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:21:25 -0700 Subject: [PATCH 0053/1883] LoadLootTables converted to QueryDatabase --- common/shareddb.cpp | 87 +++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 46 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index dd71bf11a..80d1e4383 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1748,61 +1748,56 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d void SharedDatabase::LoadLootTables(void *data, uint32 size) { EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); - const char *query = "SELECT loottable.id, loottable.mincash, loottable.maxcash, loottable.avgcoin," - " loottable_entries.lootdrop_id, loottable_entries.multiplier, loottable_entries.droplimit, " - "loottable_entries.mindrop, loottable_entries.probability FROM loottable LEFT JOIN loottable_entries" - " ON loottable.id = loottable_entries.loottable_id ORDER BY id"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + uint8 loot_table[sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)]; LootTable_Struct *lt = reinterpret_cast(loot_table); - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + - (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - } + const std::string query = "SELECT loottable.id, loottable.mincash, loottable.maxcash, loottable.avgcoin, " + "loottable_entries.lootdrop_id, loottable_entries.multiplier, loottable_entries.droplimit, " + "loottable_entries.mindrop, loottable_entries.probability FROM loottable LEFT JOIN loottable_entries " + "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + return; + } - memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)); - current_entry = 0; - current_id = id; - lt->mincash = static_cast(atoul(row[1])); - lt->maxcash = static_cast(atoul(row[2])); - lt->avgcoin = static_cast(atoul(row[3])); - } + uint32 current_id = 0; + uint32 current_entry = 0; - if(current_entry > 128) { - continue; - } + for (auto row = results.begin(); row != results.end(); ++row) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - if(!row[4]) { - continue; - } + memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128)); + current_entry = 0; + current_id = id; + lt->mincash = static_cast(atoul(row[1])); + lt->maxcash = static_cast(atoul(row[2])); + lt->avgcoin = static_cast(atoul(row[3])); + } - lt->Entries[current_entry].lootdrop_id = static_cast(atoul(row[4])); - lt->Entries[current_entry].multiplier = static_cast(atoi(row[5])); - lt->Entries[current_entry].droplimit = static_cast(atoi(row[6])); - lt->Entries[current_entry].mindrop = static_cast(atoi(row[7])); - lt->Entries[current_entry].probability = static_cast(atof(row[8])); + if(current_entry > 128) + continue; - ++(lt->NumEntries); - ++current_entry; - } - if(current_id != 0) { - hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + - (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - } + if(!row[4]) + continue; + + lt->Entries[current_entry].lootdrop_id = static_cast(atoul(row[4])); + lt->Entries[current_entry].multiplier = static_cast(atoi(row[5])); + lt->Entries[current_entry].droplimit = static_cast(atoi(row[6])); + lt->Entries[current_entry].mindrop = static_cast(atoi(row[7])); + lt->Entries[current_entry].probability = static_cast(atof(row[8])); + + ++(lt->NumEntries); + ++current_entry; + } + + if(current_id != 0) + hash.insert(current_id, loot_table, (sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * lt->NumEntries))); - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query, errbuf); - } } void SharedDatabase::LoadLootDrops(void *data, uint32 size) { From 74b8f3803022cf823dec2fde7ffd5b6f79465546 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:22:27 -0700 Subject: [PATCH 0054/1883] LoadLootDrops converted to QueryDatabase --- common/shareddb.cpp | 81 +++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 80d1e4383..8e79985db 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1801,57 +1801,52 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { } void SharedDatabase::LoadLootDrops(void *data, uint32 size) { - EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); - const char *query = "SELECT lootdrop.id, lootdrop_entries.item_id, lootdrop_entries.item_charges, " - "lootdrop_entries.equip_item, lootdrop_entries.chance, lootdrop_entries.minlevel, " - "lootdrop_entries.maxlevel, lootdrop_entries.multiplier FROM lootdrop JOIN lootdrop_entries " - "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; + EQEmu::FixedMemoryVariableHashSet hash(reinterpret_cast(data), size); uint8 loot_drop[sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)]; LootDrop_Struct *ld = reinterpret_cast(loot_drop); - if(RunQuery(query, strlen(query), errbuf, &result)) { - uint32 current_id = 0; - uint32 current_entry = 0; - while(row = mysql_fetch_row(result)) { - uint32 id = static_cast(atoul(row[0])); - if(id != current_id) { - if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + - (sizeof(LootDropEntries_Struct) * ld->NumEntries))); - } - memset(loot_drop, 0, sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)); - current_entry = 0; - current_id = id; - } + const std::string query = "SELECT lootdrop.id, lootdrop_entries.item_id, lootdrop_entries.item_charges, " + "lootdrop_entries.equip_item, lootdrop_entries.chance, lootdrop_entries.minlevel, " + "lootdrop_entries.maxlevel, lootdrop_entries.multiplier FROM lootdrop JOIN lootdrop_entries " + "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + } - if(current_entry >= 1260) { - continue; - } + uint32 current_id = 0; + uint32 current_entry = 0; - ld->Entries[current_entry].item_id = static_cast(atoul(row[1])); - ld->Entries[current_entry].item_charges = static_cast(atoi(row[2])); - ld->Entries[current_entry].equip_item = static_cast(atoi(row[3])); - ld->Entries[current_entry].chance = static_cast(atof(row[4])); - ld->Entries[current_entry].minlevel = static_cast(atoi(row[5])); - ld->Entries[current_entry].maxlevel = static_cast(atoi(row[6])); - ld->Entries[current_entry].multiplier = static_cast(atoi(row[7])); + for (auto row = results.begin(); row != results.end(); ++row) { + uint32 id = static_cast(atoul(row[0])); + if(id != current_id) { + if(current_id != 0) + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) +(sizeof(LootDropEntries_Struct) * ld->NumEntries))); - ++(ld->NumEntries); - ++current_entry; - } - if(current_id != 0) { - hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + - (sizeof(LootDropEntries_Struct) * ld->NumEntries))); - } + memset(loot_drop, 0, sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)); + current_entry = 0; + current_id = id; + } + + if(current_entry >= 1260) + continue; + + ld->Entries[current_entry].item_id = static_cast(atoul(row[1])); + ld->Entries[current_entry].item_charges = static_cast(atoi(row[2])); + ld->Entries[current_entry].equip_item = static_cast(atoi(row[3])); + ld->Entries[current_entry].chance = static_cast(atof(row[4])); + ld->Entries[current_entry].minlevel = static_cast(atoi(row[5])); + ld->Entries[current_entry].maxlevel = static_cast(atoi(row[6])); + ld->Entries[current_entry].multiplier = static_cast(atoi(row[7])); + + ++(ld->NumEntries); + ++current_entry; + } + + if(current_id != 0) + hash.insert(current_id, loot_drop, (sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * ld->NumEntries))); - mysql_free_result(result); - } else { - LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query, errbuf); - } } bool SharedDatabase::LoadLoot() { From 64641a339088fca8c2248d1f49004b3b0d713653 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:23:53 -0700 Subject: [PATCH 0055/1883] GetBotInspectMessage converted to QueryDatabase --- common/shareddb.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 8e79985db..6d58f70b9 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1918,25 +1918,19 @@ void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const Insp void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT BotInspectMessage FROM bots WHERE BotID=%i", botid), errbuf, &result)) { - safe_delete_array(query); - - if (mysql_num_rows(result) == 1) { - row = mysql_fetch_row(result); - memcpy(message, row[0], sizeof(InspectMessage_Struct)); - } - - mysql_free_result(result); - } - else { - std::cerr << "Error in GetBotInspectMessage query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); + std::string query = StringFormat("SELECT BotInspectMessage FROM bots WHERE BotID = %i", botid); + auto results = QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in GetBotInspectMessage query '" << query << "' " << results.ErrorMessage() << std::endl; + return; } + + if (results.RowCount() != 1) + return; + + auto row = results.begin(); + memcpy(message, row[0], sizeof(InspectMessage_Struct)); + } void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) { From 528f16bdaf89a56cea3d9b46494fc669ab3dac9c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:24:29 -0700 Subject: [PATCH 0056/1883] SetBotInspectMessage converted to QueryDatabase --- common/shareddb.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6d58f70b9..660b37940 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1935,13 +1935,10 @@ void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* m void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - std::string msg = EscapeString(message->text); - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE bots SET BotInspectMessage='%s' WHERE BotID=%i", msg.c_str(), botid), errbuf)) { - std::cerr << "Error in SetBotInspectMessage query '" << query << "' " << errbuf << std::endl; - } + std::string query = StringFormat("UPDATE bots SET BotInspectMessage = '%s' WHERE BotID = %i", msg.c_str(), botid); + auto results = QueryDatabase(query); + if (!results.Success()) + std::cerr << "Error in SetBotInspectMessage query '" << query << "' " << results.ErrorMessage() << std::endl; - safe_delete_array(query); } From 6d6516d80d233469376da5acde201b1008a10382 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:43:02 -0700 Subject: [PATCH 0057/1883] IsDiscovered converted to QueryDatabase --- zone/client.cpp | 84 ++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 47 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 5b7c0d597..3f2c40b66 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -324,7 +324,7 @@ Client::Client(EQStreamInterface* ieqs) initial_respawn_selection = 0; alternate_currency_loaded = false; - + EngagedRaidTarget = false; SavedRaidRestTimer = 0; } @@ -491,7 +491,7 @@ bool Client::SaveAA(){ } if (points > 0) { SendAA_Struct* curAA = zone->FindAA(aa[a]->AA - aa[a]->value + 1); - if (curAA) { + if (curAA) { for (int rank = 0; rank::iterator RequiredLevel = AARequiredLevelAndCost.find(aa[a]->AA - aa[a]->value + 1 + rank); if (RequiredLevel != AARequiredLevelAndCost.end()) { @@ -519,7 +519,7 @@ bool Client::SaveAA(){ } bool Client::Save(uint8 iCommitNow) { - if(!ClientDataLoaded()) + if(!ClientDataLoaded()) return false; /* Wrote current basics to PP for saves */ @@ -533,7 +533,7 @@ bool Client::Save(uint8 iCommitNow) { if (GetHP() <= 0) { m_pp.cur_hp = GetMaxHP(); } - else { + else { m_pp.cur_hp = GetHP(); } @@ -564,7 +564,7 @@ bool Client::Save(uint8 iCommitNow) { GetMercInfo().MercTimerRemaining = GetMercTimer()->GetRemainingTime(); } - if (!(GetMerc() && !dead)) { + if (!(GetMerc() && !dead)) { memset(&m_mercinfo, 0, sizeof(struct MercInfo)); } @@ -583,9 +583,9 @@ bool Client::Save(uint8 iCommitNow) { } database.SavePetInfo(this); - if(tribute_timer.Enabled()) { + if(tribute_timer.Enabled()) { m_pp.tribute_time_remaining = tribute_timer.GetRemainingTime(); - } + } else { m_pp.tribute_time_remaining = 0xFFFFFFFF; m_pp.tribute_active = 0; } @@ -989,7 +989,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s Message(13, "Command '%s' not recognized.", message); } } else { - if(!RuleB(Chat, SuppressCommandErrors)) + if(!RuleB(Chat, SuppressCommandErrors)) Message(13, "Command '%s' not recognized.", message); } } @@ -1362,14 +1362,14 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme) void Client::SetSkill(SkillUseTypes skillid, uint16 value) { if (skillid > HIGHEST_SKILL) - return; - m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills + return; + m_pp.skills[skillid] = value; // We need to be able to #setskill 254 and 255 to reset skills database.SaveCharacterSkill(this->CharacterID(), skillid, value); EQApplicationPacket* outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; - skill->skillId=skillid; + skill->skillId=skillid; skill->value=value; QueuePacket(outapp); safe_delete(outapp); @@ -1390,7 +1390,7 @@ void Client::IncreaseLanguageSkill(int skill_id, int value) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_SkillUpdate, sizeof(SkillUpdate_Struct)); SkillUpdate_Struct* skill = (SkillUpdate_Struct*)outapp->pBuffer; skill->skillId = 100 + skill_id; - skill->value = m_pp.languages[skill_id]; + skill->value = m_pp.languages[skill_id]; QueuePacket(outapp); safe_delete(outapp); @@ -2141,7 +2141,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ /* Add Amount of Platinum */ tmp2 = tmp/1000; int32 new_val = m_pp.platinum + tmp2; - if(new_val < 0) { m_pp.platinum = 0; } + if(new_val < 0) { m_pp.platinum = 0; } else { m_pp.platinum = m_pp.platinum + tmp2; } tmp-=tmp2*1000; @@ -2151,7 +2151,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ /* Add Amount of Gold */ tmp2 = tmp/100; new_val = m_pp.gold + tmp2; - if(new_val < 0) { m_pp.gold = 0; } + if(new_val < 0) { m_pp.gold = 0; } else { m_pp.gold = m_pp.gold + tmp2; } tmp-=tmp2*100; @@ -4031,28 +4031,18 @@ void Client::KeyRingList() bool Client::IsDiscovered(uint32 itemid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; + std::string query = StringFormat("SELECT count(*) FROM discovered_items WHERE item_id = '%lu'", itemid); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in IsDiscovered query '" << query << "' " << results.ErrorMessage() << std::endl; + return false; + } - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT count(*) FROM discovered_items WHERE item_id = '%lu'", itemid), errbuf, &result)) - { - row = mysql_fetch_row(result); - if (atoi(row[0])) - { - mysql_free_result(result); - safe_delete_array(query); - return true; - } - } - else - { - std::cerr << "Error in IsDiscovered query '" << query << "' " << errbuf << std::endl; - } - mysql_free_result(result); - safe_delete_array(query); - return false; + auto row = results.begin(); + if (!atoi(row[0])) + return false; + + return true; } void Client::DiscoverItem(uint32 itemid) { @@ -4290,15 +4280,15 @@ void Client::IncrementAggroCount() { if(!RuleI(Character, RestRegenPercent)) return; - + // If we already had aggro before this method was called, the combat indicator should already be up for SoF clients, // so we don't need to send it again. // if(AggroCount > 1) return; - + // Pause the rest timer - if (AggroCount == 1) + if (AggroCount == 1) SavedRaidRestTimer = rest_timer.GetRemainingTime(); if(GetClientVersion() >= EQClientSoF) { @@ -4343,9 +4333,9 @@ void Client::DecrementAggroCount() { time_until_rest = RuleI(Character, RestRegenTimeToActivate) * 1000; } } - + rest_timer.Start(time_until_rest); - + if(GetClientVersion() >= EQClientSoF) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5); @@ -4450,7 +4440,7 @@ void Client::SendRespawnBinds() int num_options = respawn_options.size(); uint32 PacketLength = 17 + (26 * num_options); //Header size + per-option invariant size - + std::list::iterator itr; RespawnOption* opt; @@ -7630,7 +7620,7 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui tmpValue = current_value + mod + npc_value[i]; int16 FactionModPct = spellbonuses.FactionModPct + itembonuses.FactionModPct + aabonuses.FactionModPct; - tmpValue += (tmpValue * FactionModPct) / 100; + tmpValue += (tmpValue * FactionModPct) / 100; // Make sure faction hits don't go to GMs... if (m_pp.gm==1 && (tmpValue < current_value)) { @@ -7944,7 +7934,7 @@ void Client::TryItemTimer(int slot) } ++it_iter; } - + if(slot > EmuConstants::EQUIPMENT_END) { return; } @@ -7980,7 +7970,7 @@ void Client::RefundAA() { for(int j = 0; j < cur; j++) { m_pp.aapoints += curaa->cost + (curaa->cost_inc * j); refunded = true; - } + } } else { @@ -8268,12 +8258,12 @@ void Client::ExpeditionSay(const char *str, int ExpID) { while((row = mysql_fetch_row(result))) { const char* CharName = row[0]; if(strcmp(CharName, this->GetCleanName()) != 0) - worldserver.SendEmoteMessage(CharName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str); + worldserver.SendEmoteMessage(CharName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str); // ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3])); - } + } mysql_free_result(result); - + } void Client::ShowNumHits() From c7c92182108869fa2b9ecd54d219871d0ffd569d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:46:19 -0700 Subject: [PATCH 0058/1883] DiscoverItem converted to QueryDatabase --- zone/client.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 3f2c40b66..112afddff 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4047,14 +4047,11 @@ bool Client::IsDiscovered(uint32 itemid) { void Client::DiscoverItem(uint32 itemid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO discovered_items SET item_id=%lu, char_name='%s', discovered_date=UNIX_TIMESTAMP(), account_status=%i", itemid, GetName(), Admin()), errbuf, &result)) - { - mysql_free_result(result); - } - safe_delete_array(query); + std::string query = StringFormat("INSERT INTO discovered_items " + "SET item_id = %lu, char_name = '%s', " + "discovered_date = UNIX_TIMESTAMP(), account_status = %i", + itemid, GetName(), Admin()); + auto results = database.QueryDatabase(query); parse->EventPlayer(EVENT_DISCOVER_ITEM, this, "", itemid); } From fe1c67b8b4442b6b1ac1dfeb7e5d0b88e911cf81 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 14:55:55 -0700 Subject: [PATCH 0059/1883] SendRewards converted to QueryDatabase --- zone/client.cpp | 98 +++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 57 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 112afddff..8b172c461 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5223,67 +5223,51 @@ const bool Client::IsMQExemptedArea(uint32 zoneID, float x, float y, float z) co void Client::SendRewards() { std::vector rewards; - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - - if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT reward_id, amount FROM" - " account_rewards WHERE account_id=%i ORDER by reward_id", AccountID()), - errbuf,&result)) - { - while((row = mysql_fetch_row(result))) - { - ClientReward cr; - cr.id = atoi(row[0]); - cr.amount = atoi(row[1]); - rewards.push_back(cr); - } - mysql_free_result(result); - safe_delete_array(query); - } - else - { - LogFile->write(EQEMuLog::Error, "Error in Client::SendRewards(): %s (%s)", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT reward_id, amount " + "FROM account_rewards " + "WHERE account_id = %i " + "ORDER BY reward_id", AccountID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; - } + } - if(rewards.size() > 0) - { - EQApplicationPacket *vetapp = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(InternalVeteranReward) * rewards.size())); - uchar *data = vetapp->pBuffer; - for(int i = 0; i < rewards.size(); ++i) - { - InternalVeteranReward *ivr = (InternalVeteranReward*)data; - ivr->claim_id = rewards[i].id; - ivr->number_available = rewards[i].amount; - std::list::iterator iter = zone->VeteranRewards.begin(); - while(iter != zone->VeteranRewards.end()) - { - if((*iter).claim_id == rewards[i].id) - { - break; - } - ++iter; - } + for (auto row = results.begin(); row != results.end(); ++row) { + ClientReward cr; + cr.id = atoi(row[0]); + cr.amount = atoi(row[1]); + rewards.push_back(cr); + } - if(iter != zone->VeteranRewards.end()) - { - InternalVeteranReward ivro = (*iter); - ivr->claim_count = ivro.claim_count; - for(int x = 0; x < ivro.claim_count; ++x) - { - ivr->items[x].item_id = ivro.items[x].item_id; - ivr->items[x].charges = ivro.items[x].charges; - strcpy(ivr->items[x].item_name, ivro.items[x].item_name); - } - } + if(rewards.size() == 0) + return; - data += sizeof(InternalVeteranReward); - } - FastQueuePacket(&vetapp); - } + EQApplicationPacket *vetapp = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(InternalVeteranReward) * rewards.size())); + uchar *data = vetapp->pBuffer; + for(int i = 0; i < rewards.size(); ++i) { + InternalVeteranReward *ivr = (InternalVeteranReward*)data; + ivr->claim_id = rewards[i].id; + ivr->number_available = rewards[i].amount; + auto iter = zone->VeteranRewards.begin(); + for (;iter != zone->VeteranRewards.end(); ++iter) + if((*iter).claim_id == rewards[i].id) + break; + + if(iter != zone->VeteranRewards.end()) { + InternalVeteranReward ivro = (*iter); + ivr->claim_count = ivro.claim_count; + for(int x = 0; x < ivro.claim_count; ++x) { + ivr->items[x].item_id = ivro.items[x].item_id; + ivr->items[x].charges = ivro.items[x].charges; + strcpy(ivr->items[x].item_name, ivro.items[x].item_name); + } + } + + data += sizeof(InternalVeteranReward); + } + + FastQueuePacket(&vetapp); } bool Client::TryReward(uint32 claim_id) From 037df28b7c94211cb1bf1033078969f989efd7e5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 15:14:50 -0700 Subject: [PATCH 0060/1883] TryReward converted to QueryDatabase --- zone/client.cpp | 166 ++++++++++++++++-------------------------------- 1 file changed, 56 insertions(+), 110 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 8b172c461..56837805e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5270,8 +5270,7 @@ void Client::SendRewards() FastQueuePacket(&vetapp); } -bool Client::TryReward(uint32 claim_id) -{ +bool Client::TryReward(uint32 claim_id) { //Make sure we have an open spot //Make sure we have it in our acct and count > 0 //Make sure the entry was found @@ -5281,143 +5280,90 @@ bool Client::TryReward(uint32 claim_id) //save uint32 free_slot = 0xFFFFFFFF; - for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; ++i) - { + for(int i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; ++i) { ItemInst *item = GetInv().GetItem(i); - if(!item) - { + if(!item) { free_slot = i; break; } } if(free_slot == 0xFFFFFFFF) - { return false; - } char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 amt = 0; - - if(database.RunQuery(query,MakeAnyLenString(&query,"SELECT amount FROM" - " account_rewards WHERE account_id=%i AND reward_id=%i", AccountID(), claim_id), - errbuf,&result)) - { - row = mysql_fetch_row(result); - if(row) - { - amt = atoi(row[0]); - } - else - { - mysql_free_result(result); - safe_delete_array(query); - return false; - } - mysql_free_result(result); - safe_delete_array(query); - } - else - { - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT amount FROM account_rewards " + "WHERE account_id = %i AND reward_id = %i", + AccountID(), claim_id); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; - } + } + if (results.RowCount() == 0) + return false; + + auto row = results.begin(); + + uint32 amt = atoi(row[0]); if(amt == 0) - { return false; - } std::list::iterator iter = zone->VeteranRewards.begin(); - while(iter != zone->VeteranRewards.end()) - { + for (; iter != zone->VeteranRewards.end(); ++row) if((*iter).claim_id == claim_id) - { break; - } - ++iter; - } if(iter == zone->VeteranRewards.end()) - { return false; - } - if(amt == 1) - { - if(!database.RunQuery(query,MakeAnyLenString(&query,"DELETE FROM" - " account_rewards WHERE account_id=%i AND reward_id=%i", AccountID(), claim_id), - errbuf)) - { - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query, errbuf); - safe_delete_array(query); - } - else - { - safe_delete_array(query); - } + if(amt == 1) { + query = StringFormat("DELETE FROM account_rewards " + "WHERE account_id = %i AND reward_id = %i", + AccountID(), claim_id); + auto results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } - else - { - if(!database.RunQuery(query,MakeAnyLenString(&query,"UPDATE account_rewards SET amount=(amount-1)" - " WHERE account_id=%i AND reward_id=%i", AccountID(), claim_id), - errbuf)) - { - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query, errbuf); - safe_delete_array(query); - } - else - { - safe_delete_array(query); - } + else { + query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " + "WHERE account_id = %i AND reward_id = %i", + AccountID(), claim_id); + auto results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); ItemInst *claim = database.CreateItem(ivr.items[0].item_id, ivr.items[0].charges); - if(claim) - { - bool lore_conflict = false; - if(CheckLoreConflict(claim->GetItem())) - { - lore_conflict = true; - } - - for(int y = 1; y < 8; y++) - { - if(ivr.items[y].item_id) - { - if(claim->GetItem()->ItemClass == 1) - { - ItemInst *item_temp = database.CreateItem(ivr.items[y].item_id, ivr.items[y].charges); - if(item_temp) - { - if(CheckLoreConflict(item_temp->GetItem())) - { - lore_conflict = true; - DuplicateLoreMessage(ivr.items[y].item_id); - } - claim->PutItem(y-1, *item_temp); - } - } - } - } - - if(lore_conflict) - { - safe_delete(claim); - return true; - } - else - { - PutItemInInventory(free_slot, *claim); - SendItemPacket(free_slot, claim, ItemPacketTrade); - } + if(!claim) { + Save(); + return true; } + bool lore_conflict = CheckLoreConflict(claim->GetItem()); + + for(int y = 1; y < 8; y++) + if(ivr.items[y].item_id && claim->GetItem()->ItemClass == 1) { + ItemInst *item_temp = database.CreateItem(ivr.items[y].item_id, ivr.items[y].charges); + if(item_temp) { + if(CheckLoreConflict(item_temp->GetItem())) { + lore_conflict = true; + DuplicateLoreMessage(ivr.items[y].item_id); + } + claim->PutItem(y-1, *item_temp); + } + } + + if(lore_conflict) { + safe_delete(claim); + return true; + } + + PutItemInInventory(free_slot, *claim); + SendItemPacket(free_slot, claim, ItemPacketTrade); + Save(); return true; } From 81a641c96c2791143e2c350cd8b519e82bc2ad7f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 15:21:05 -0700 Subject: [PATCH 0061/1883] LoadAccountFlags converted to QueryDatabase --- zone/client.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 56837805e..b3493f7e4 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7722,28 +7722,19 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalval void Client::LoadAccountFlags() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; accountflags.clear(); - MakeAnyLenString(&query, "SELECT p_flag, p_value FROM account_flags WHERE p_accid = '%d'", account_id); - if(database.RunQuery(query, strlen(query), errbuf, &result)) - { - while(row = mysql_fetch_row(result)) - { - std::string fname(row[0]); - std::string fval(row[1]); - accountflags[fname] = fval; - } - mysql_free_result(result); - } - else - { - std::cerr << "Error in LoadAccountFlags query '" << query << "' " << errbuf << std::endl; - } - safe_delete_array(query); + std::string query = StringFormat("SELECT p_flag, p_value " + "FROM account_flags WHERE p_accid = '%d'", + account_id); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + std::cerr << "Error in LoadAccountFlags query '" << query << "' " << results.ErrorMessage() << std::endl; + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) + accountflags[row[0]] = row[1]; } void Client::SetAccountFlag(std::string flag, std::string val) From 9c3f1937a76420a36ad2533ac9ed51cf3843c541 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 15:24:11 -0700 Subject: [PATCH 0062/1883] SetAccountFlag converted to QueryDatabase --- zone/client.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index b3493f7e4..3dc69d563 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7737,17 +7737,16 @@ void Client::LoadAccountFlags() accountflags[row[0]] = row[1]; } -void Client::SetAccountFlag(std::string flag, std::string val) -{ - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; +void Client::SetAccountFlag(std::string flag, std::string val) { - MakeAnyLenString(&query, "REPLACE INTO account_flags (p_accid, p_flag, p_value) VALUES( '%d', '%s', '%s')", account_id, flag.c_str(), val.c_str()); - if(!database.RunQuery(query, strlen(query), errbuf)) - { - std::cerr << "Error in SetAccountFlags query '" << query << "' " << errbuf << std::endl; + std::string query = StringFormat("REPLACE INTO account_flags (p_accid, p_flag, p_value) " + "VALUES( '%d', '%s', '%s')", + account_id, flag.c_str(), val.c_str()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + std::cerr << "Error in SetAccountFlags query '" << query << "' " << results.ErrorMessage() << std::endl; + return; } - safe_delete_array(query); accountflags[flag] = val; } From 1b1c5b5f9f83d346cef3b5104dbc818590ca2825 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 15:29:02 -0700 Subject: [PATCH 0063/1883] ExpeditionSay converted to QueryDatabase --- zone/client.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 3dc69d563..a277b9858 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8157,29 +8157,25 @@ void Client::PlayMP3(const char* fname) } void Client::ExpeditionSay(const char *str, int ExpID) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `player_name` FROM `cust_inst_players` WHERE `inst_id` = %i", ExpID),errbuf,&result)){ - safe_delete_array(query); + std::string query = StringFormat("SELECT `player_name` FROM `cust_inst_players` " + "WHERE `inst_id` = %i", ExpID); + auto results = database.QueryDatabase(query); + if (!results.Success()) return; - } - safe_delete_array(query); + if(results.RowCount() == 0) { + this->Message(14, "You say to the expedition, '%s'", str); + return; + } - if(result) - this->Message(14, "You say to the expedition, '%s'", str); - - while((row = mysql_fetch_row(result))) { - const char* CharName = row[0]; - if(strcmp(CharName, this->GetCleanName()) != 0) - worldserver.SendEmoteMessage(CharName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str); + for(auto row = results.begin(); row != results.end(); ++row) { + const char* charName = row[0]; + if(strcmp(charName, this->GetCleanName()) != 0) + worldserver.SendEmoteMessage(charName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str); // ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3])); } - mysql_free_result(result); } From ce3532aa197ac22ce64a97a94241cd1ba69534e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:20:33 -0700 Subject: [PATCH 0064/1883] command_suspend converted to QueryDatabase --- zone/command.cpp | 110 +++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 05917fe5a..cd59f4cb6 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6180,76 +6180,76 @@ void command_ban(Client *c, const Seperator *sep) void command_suspend(Client *c, const Seperator *sep) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = nullptr; + if((sep->arg[1][0] == 0) || (sep->arg[2][0] == 0)) { + c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately) "); + return; + } - if((sep->arg[1][0] == 0) || (sep->arg[2][0] == 0)) - c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately) "); - else - { - int Duration = atoi(sep->arg[2]); + int duration = atoi(sep->arg[2]); - if(Duration < 0) - Duration = 0; + if(duration < 0) + duration = 0; - std::string message; - if(Duration > 0) { - int i = 3; - while(1) { - if(sep->arg[i][0] == 0) { - break; - } + std::string message; - if(message.length() > 0) { - message.push_back(' '); - } + if(duration > 0) { + int i = 3; + while(1) { + if(sep->arg[i][0] == 0) { + break; + } - message += sep->arg[i]; - ++i; - } + if(message.length() > 0) { + message.push_back(' '); + } - if(message.length() == 0) { - c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately) "); - return; - } - } + message += sep->arg[i]; + ++i; + } - int AccountID; + if(message.length() == 0) { + c->Message(0, "Usage: #suspend (Specify 0 days to lift the suspension immediately) "); + return; + } + } - if((AccountID = database.GetAccountIDByChar(sep->arg[1])) > 0) - { - database.RunQuery(query, MakeAnyLenString(&query, "UPDATE `account` SET `suspendeduntil` = DATE_ADD(NOW(), INTERVAL %i DAY), " - "suspend_reason = '%s' WHERE `id` = %i", Duration, EscapeString(message).c_str(), AccountID), errbuf, 0); + char *escName = new char[strlen(sep->arg[1]) * 2 + 1]; + database.DoEscapeString(escName, sep->arg[1], strlen(sep->arg[1])); + int accountID = database.GetAccountIDByChar(escName); + safe_delete_array(escName); - if(Duration) - c->Message(13, "Account number %i with the character %s has been temporarily suspended for %i day(s) with the message: \"%s\"", AccountID, sep->arg[1], - Duration, message.c_str()); - else - c->Message(13, "Account number %i with the character %s is no longer suspended.", AccountID, sep->arg[1]); + if (accountID <= 0) { + c->Message(13,"Character does not exist."); + return; + } - safe_delete_array(query); + std::string query = StringFormat("UPDATE `account` SET `suspendeduntil` = DATE_ADD(NOW(), INTERVAL %i DAY), " + "suspend_reason = '%s' WHERE `id` = %i", + duration, EscapeString(message).c_str(), accountID); + auto results = database.QueryDatabase(query); - Client *BannedClient = entity_list.GetClientByName(sep->arg[1]); + if(duration) + c->Message(13,"Account number %i with the character %s has been temporarily suspended for %i day(s).", accountID, sep->arg[1], duration); + else + c->Message(13,"Account number %i with the character %s is no longer suspended.", accountID, sep->arg[1]); - if(BannedClient) - BannedClient->WorldKick(); - else - { - ServerPacket pack(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); - ServerKickPlayer_Struct* sks = (ServerKickPlayer_Struct*)pack.pBuffer; + Client *bannedClient = entity_list.GetClientByName(sep->arg[1]); - strn0cpy(sks->adminname, c->GetName(), sizeof(sks->adminname)); - strn0cpy(sks->name, sep->arg[1], sizeof(sks->name)); - sks->adminrank = c->Admin(); + if(bannedClient) { + bannedClient->WorldKick(); + return; + } - worldserver.SendPacket(&pack); - } + ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + ServerKickPlayer_Struct* sks = (ServerKickPlayer_Struct*) pack->pBuffer; - } - else { - c->Message(13, "Character does not exist."); - } - } + strn0cpy(sks->adminname, c->GetName(), sizeof(sks->adminname)); + strn0cpy(sks->name, sep->arg[1], sizeof(sks->name)); + sks->adminrank = c->Admin(); + + worldserver.SendPacket(pack); + + safe_delete(pack); } void command_ipban(Client *c, const Seperator *sep) From f1039ab0e9fc95138fd33e08ddd8ab012b1f8b4d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:26:19 -0700 Subject: [PATCH 0065/1883] command_revoke converted to QueryDatabase --- zone/command.cpp | 71 +++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index cd59f4cb6..5d95906ab 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6268,50 +6268,41 @@ void command_ipban(Client *c, const Seperator *sep) void command_revoke(Client *c, const Seperator *sep) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) - { + if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) { c->Message(0, "Usage: #revoke [charname] [1/0]"); + return; } - else - { - uint32 tmp = database.GetAccountIDByChar(sep->arg[1]); - if(tmp) - { - int flag = sep->arg[2][0] == '1' ? true : false; - database.RunQuery(query, MakeAnyLenString(&query, "UPDATE account set revoked=%d where id = %i", flag, tmp), errbuf, 0); - c->Message(13,"%s account number %i with the character %s.", flag?"Revoking":"Unrevoking", tmp, sep->arg[1]); - Client* revokee = entity_list.GetClientByAccID(tmp); - if(revokee) - { - c->Message(0, "Found %s in this zone.", revokee->GetName()); - revokee->SetRevoked(flag); - } - else - { + + uint32 characterID = database.GetAccountIDByChar(sep->arg[1]); + if(characterID == 0) { + c->Message(13,"Character does not exist."); + return; + } + + int flag = sep->arg[2][0] == '1' ? true : false; + std::string query = StringFormat("UPDATE account SET revoked = %d WHERE id = %i", flag, characterID); + auto results = database.QueryDatabase(query); + + c->Message(13,"%s account number %i with the character %s.", flag? "Revoking": "Unrevoking", characterID, sep->arg[1]); + + Client* revokee = entity_list.GetClientByAccID(characterID); + if(revokee) { + c->Message(0, "Found %s in this zone.", revokee->GetName()); + revokee->SetRevoked(flag); + return; + } + #if EQDEBUG >= 6 - c->Message(0, "Couldn't find %s in this zone, passing request to worldserver.", sep->arg[1]); + c->Message(0, "Couldn't find %s in this zone, passing request to worldserver.", sep->arg[1]); #endif - ServerPacket * outapp = new ServerPacket (ServerOP_Revoke,sizeof(RevokeStruct)); - RevokeStruct* revoke = (RevokeStruct*)outapp->pBuffer; - strn0cpy(revoke->adminname, c->GetName(), 64); - strn0cpy(revoke->name, sep->arg[1], 64); - revoke->toggle = flag; - worldserver.SendPacket(outapp); - safe_delete(outapp); - } - } - else { - c->Message(13,"Character does not exist."); - } - if(query) - { - safe_delete_array(query); - query=nullptr; - } - } + + ServerPacket * outapp = new ServerPacket (ServerOP_Revoke,sizeof(RevokeStruct)); + RevokeStruct* revoke = (RevokeStruct*)outapp->pBuffer; + strn0cpy(revoke->adminname, c->GetName(), 64); + strn0cpy(revoke->name, sep->arg[1], 64); + revoke->toggle = flag; + worldserver.SendPacket(outapp); + safe_delete(outapp); } void command_oocmute(Client *c, const Seperator *sep) From e2382137e6ea281b6c5c7d14e40dd4c6f2319adc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:28:34 -0700 Subject: [PATCH 0066/1883] command_repop converted to QueryDatabase --- zone/command.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 5d95906ab..639e99c81 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4148,25 +4148,24 @@ void command_repop(Client *c, const Seperator *sep) LinkedListIterator iterator(zone->spawn2_list); iterator.Reset(); - while (iterator.MoreElements()) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM respawn_times WHERE id=%lu" - " AND instance_id=%lu",(unsigned long)iterator.GetData()->GetID(), (unsigned long)zone->GetInstanceID()), errbuf); - safe_delete_array(query); + while (iterator.MoreElements()) { + std::string query = StringFormat("DELETE FROM respawn_times WHERE id = %lu AND instance_id = %lu", + (unsigned long)iterator.GetData()->GetID(), + (unsigned long)zone->GetInstanceID()); + auto results = database.QueryDatabase(query); iterator.Advance(); } c->Message(0, "Zone depop: Force resetting spawn timers."); } - if (sep->IsNumber(timearg)) { - c->Message(0, "Zone depoped. Repop in %i seconds", atoi(sep->arg[timearg])); - zone->Repop(atoi(sep->arg[timearg])*1000); - } - else { - c->Message(0, "Zone depoped. Repoping now."); + + if (!sep->IsNumber(timearg)) { + c->Message(0, "Zone depoped. Repoping now."); zone->Repop(); + return; } + + c->Message(0, "Zone depoped. Repop in %i seconds", atoi(sep->arg[timearg])); + zone->Repop(atoi(sep->arg[timearg])*1000); } void command_spawnstatus(Client *c, const Seperator *sep) From 1d08b1687fe61d59c35c82b43217ab30924e2e27 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 10:50:04 -0700 Subject: [PATCH 0067/1883] command_ban converted to QueryDatabase --- zone/command.cpp | 100 ++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 639e99c81..ac45dd612 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6111,70 +6111,62 @@ void command_stun(Client *c, const Seperator *sep) void command_ban(Client *c, const Seperator *sep) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) - { +if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) { c->Message(0, "Usage: #ban "); + return; } - else - { - auto account_id = database.GetAccountIDByChar(sep->arg[1]); - std::string message; - int i = 2; - while(1) { - if(sep->arg[i][0] == 0) { - break; - } + auto account_id = database.GetAccountIDByChar(sep->arg[1]); - if(message.length() > 0) { - message.push_back(' '); - } + std::string message; + int i = 2; + while(1) { + if(sep->arg[i][0] == 0) { + break; + } - message += sep->arg[i]; - ++i; - } + if(message.length() > 0) { + message.push_back(' '); + } - if(message.length() == 0) { - c->Message(0, "Usage: #ban "); - return; - } + message += sep->arg[i]; + ++i; + } - if(account_id > 0) - { - database.RunQuery(query, MakeAnyLenString(&query, "UPDATE account set status = -2, ban_reason = '%s' where id = %i", EscapeString(message).c_str(), account_id), errbuf, 0); - c->Message(13, "Account number %i with the character %s has been banned with message: \"%s\"", account_id, sep->arg[1], message.c_str()); + if(message.length() == 0) { + c->Message(0, "Usage: #ban "); + return; + } - ServerPacket pack(ServerOP_FlagUpdate, 6); - *((uint32*)&pack.pBuffer[0]) = account_id; - *((int16*)&pack.pBuffer[4]) = -2; - worldserver.SendPacket(&pack); + if(account_id == 0) { + c->Message(13, "Character does not exist."); + return; + } - Client *client = nullptr; - client = entity_list.GetClientByName(sep->arg[1]); - if(client) - { - client->WorldKick(); - } - else - { - ServerPacket pack(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); - ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack.pBuffer; - strcpy(skp->adminname, c->GetName()); - strcpy(skp->name, sep->arg[1]); - skp->adminrank = c->Admin(); - worldserver.SendPacket(&pack); - } - } - else - { - c->Message(13, "Character does not exist."); - } + std::string query = StringFormat("UPDATE account SET status = -2, ban_reason = '%s' " + "WHERE id = %i", EscapeString(message).c_str(), account_id); + auto results = database.QueryDatabase(query); - safe_delete_array(query); - } + c->Message(13, "Account number %i with the character %s has been banned with message: \"%s\"", account_id, sep->arg[1], message.c_str()); + + ServerPacket flagUpdatePack(ServerOP_FlagUpdate, 6); + *((uint32*)&flagUpdatePack.pBuffer[0]) = account_id; + *((int16*)&flagUpdatePack.pBuffer[4]) = -2; + worldserver.SendPacket(&flagUpdatePack); + + Client *client = nullptr; + client = entity_list.GetClientByName(sep->arg[1]); + if(client) { + client->WorldKick(); + return; + } + + ServerPacket kickPlayerPack(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)kickPlayerPack.pBuffer; + strcpy(skp->adminname, c->GetName()); + strcpy(skp->name, sep->arg[1]); + skp->adminrank = c->Admin(); + worldserver.SendPacket(&kickPlayerPack); } void command_suspend(Client *c, const Seperator *sep) From 6be2f6a7e434514ac12265c57942b4d57b6eee61 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 11:52:40 -0700 Subject: [PATCH 0068/1883] command_npcedit converted to QueryDatabase --- zone/command.cpp | 1355 ++++++++++++++++++++++++---------------------- 1 file changed, 711 insertions(+), 644 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index ac45dd612..f3adf5856 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6403,12 +6403,11 @@ void command_npcemote(Client *c, const Seperator *sep) } void command_npcedit(Client *c, const Seperator *sep) -{ - if (!c->GetTarget() || !c->GetTarget()->IsNPC()) - { +{ if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { c->Message(0, "Error: Must have NPC targeted"); return; } + if ( strcasecmp( sep->arg[1], "help" ) == 0 ) { c->Message(0, "Help File for #npcedit. Syntax for commands are:"); @@ -6481,663 +6480,731 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit version - Set an NPC's version"); } - else if ( strcasecmp( sep->arg[1], "name" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has the name %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set name='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); + + uint32 npcTypeID = c->GetTarget()->CastToNPC()->GetNPCTypeID(); + + if ( strcasecmp( sep->arg[1], "name" ) == 0 ) { + c->Message(15,"NPCID %u now has the name %s.",npcTypeID, sep->argplus[2]); + + std::string query = StringFormat("UPDATE npc_types SET name = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; } - else if ( strcasecmp( sep->arg[1], "lastname" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has the lastname %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set lastname='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "race" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has the race %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set race=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "class" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now class %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set class=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "bodytype" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has type %i bodytype.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set bodytype=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "hp" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Hitpoints.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set hp=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "gender" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now gender %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set gender=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "texture" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now uses texture %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set texture=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "helmtexture" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now uses helmtexture %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set helmtexture=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "size" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now size %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set size=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "hpregen" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now regens %i hitpoints per tick.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set hp_regen_rate=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "manaregen" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now regens %i mana per tick.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set mana_regen_rate=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "loottable" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now on loottable_id %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set loottable_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "merchantid" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now merchant_id %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set merchant_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "alt_currency_id" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'alt_currency_id' set to %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set alt_currency_id='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "npc_spells_effects_id" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'npc_spells_effects_id' set to %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_spells_effects_id='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "adventure_template_id" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'adventure_template_id' set to %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set adventure_template_id='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "trap_template" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'trap_template' set to %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set trap_template='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "special_abilities" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'special_abilities' set to %s.",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set special_abilities='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "spell" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now uses spell list %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_spells_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "faction" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now faction %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_faction_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "mindmg" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now hits for a min of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set mindmg=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "maxdmg" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now hits for a max of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set maxdmg=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "aggroradius" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has an aggro radius of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set aggroradius=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "assistradius" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has an assist radius of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set assistradius=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "social" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u social status is now %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set social=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "runspeed" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now runs at %f",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set runspeed=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "AGI" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Agility.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set AGI=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "CHA" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Charisma.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set CHA=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "DEX" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Dexterity.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set DEX=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "INT" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Intelligence.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set _INT=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "STA" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Stamina.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set STA=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "STR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Strength.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set STR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "WIS" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Magic Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set WIS=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "MR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Magic Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set MR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "DR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Disease Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set DR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "CR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Cold Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set CR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "FR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Fire Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set FR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "PR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Poison Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set PR=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "Corrup" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a Corruption Resistance of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set corrup=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "PhR" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u now has a Physical Resistance of %i.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set PhR=%i where id=%i", atoi(sep->argplus[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "seeinvis" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has seeinvis set to %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_invis=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "seeinvisundead" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has seeinvisundead set to %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_invis_undead=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "seehide" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has seehide set to %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_hide=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "seeimprovedhide" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has seeimprovedhide set to %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set see_improved_hide=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "AC" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Armor Class.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set ac=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "ATK" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Attack.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set atk=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "Accuracy" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i Accuracy.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set accuracy=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "level" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now level %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set level=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "maxlevel" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a maximum level of %i.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set maxlevel=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "qglobal" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "Quest globals have been %s for NPCID %u", atoi(sep->arg[2]) == 0 ? "disabled" : "enabled", c->GetTarget()->CastToNPC()->GetNPCTypeID()); - database.RunQuery(query, MakeAnyLenString(&query, "UPDATE npc_types SET qglobal=%i WHERE id=%i", atoi(sep->argplus[2]) == 0 ? 0 : 1, c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "npcaggro" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u will now %s other NPCs with negative faction npc_value",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"not aggro":"aggro"); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_aggro=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "limit" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has a spawn limit of %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set limit=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "Attackspeed" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has attack_speed set to %f",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atof(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set attack_speed=%f where id=%i",atof(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "Attackdelay" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has attack_delay set to %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set attack_delay=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "findable" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u is now %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"not findable":"findable"); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set findable=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "wep1" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u will have item graphic %i set to his primary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture1=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "wep2" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u will have item graphic %i set to his secondary on repop.",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set d_meele_texture2=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "featuresave" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u saved with all current facial feature settings",c->GetTarget()->CastToNPC()->GetNPCTypeID()); + if ( strcasecmp( sep->arg[1], "lastname" ) == 0 ) { + c->Message(15,"NPCID %u now has the lastname %s.",npcTypeID, sep->argplus[2]); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set luclin_haircolor=%i where id=%i",c->GetTarget()->GetHairColor(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set luclin_beardcolor=%i where id=%i",c->GetTarget()->GetBeardColor(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set luclin_hairstyle=%i where id=%i",c->GetTarget()->GetHairStyle(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set luclin_beard=%i where id=%i",c->GetTarget()->GetBeard(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set face=%i where id=%i",c->GetTarget()->GetLuclinFace(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set drakkin_heritage=%i where id=%i",c->GetTarget()->GetDrakkinHeritage(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set drakkin_tattoo=%i where id=%i",c->GetTarget()->GetDrakkinTattoo(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set drakkin_details=%i where id=%i",c->GetTarget()->GetDrakkinDetails(),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); + std::string query = StringFormat("UPDATE npc_types SET lastname = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + if ( strcasecmp( sep->arg[1], "race" ) == 0 ) { + c->Message(15,"NPCID %u now has the race %i.",npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET race = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; } - else if ( strcasecmp( sep->arg[1], "color" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has %i red, %i green, and %i blue tinting on their armor.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set armortint_red=%i, armortint_green=%i, armortint_blue=%i where id=%i", atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); + + if ( strcasecmp( sep->arg[1], "class" ) == 0 ) { + c->Message(15,"NPCID %u is now class %i.",npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET class = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; } - else if ( strcasecmp( sep->arg[1], "armortint_id" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15,"NPCID %u now has field 'armortint_id' set to %s",c->GetTarget()->CastToNPC()->GetNPCTypeID(), (sep->argplus[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set armortint_id='%s' where id=%i",(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); + + if ( strcasecmp( sep->arg[1], "bodytype" ) == 0 ) { + c->Message(15,"NPCID %u now has type %i bodytype.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET bodytype = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; } - else if ( strcasecmp( sep->arg[1], "setanimation" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - int Animation = 0; - if(sep->arg[2] && atoi(sep->arg[2]) <= 4){ - if((strcasecmp( sep->arg[2], "stand" ) == 0) || atoi(sep->arg[2]) == 0){ - Animation = 0; //Stand - } - if((strcasecmp( sep->arg[2], "sit" ) == 0) || atoi(sep->arg[2]) == 1){ - Animation = 1; //Sit - } - if((strcasecmp( sep->arg[2], "crouch" ) == 0) || atoi(sep->arg[2]) == 2){ - Animation = 2; //Crouch - } - if((strcasecmp( sep->arg[2], "dead" ) == 0) || atoi(sep->arg[2]) == 3){ - Animation = 3; //Dead - } - if((strcasecmp( sep->arg[2], "loot" ) == 0) || atoi(sep->arg[2]) == 4){ - Animation = 4; //Looting Animation - } + + if ( strcasecmp( sep->arg[1], "hp" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Hitpoints.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET hp = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "gender" ) == 0 ) { + c->Message(15,"NPCID %u is now gender %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET gender = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "texture" ) == 0 ) { + c->Message(15,"NPCID %u now uses texture %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET texture = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "helmtexture" ) == 0 ) { + c->Message(15,"NPCID %u now uses helmtexture %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET helmtexture = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "size" ) == 0 ) { + c->Message(15,"NPCID %u is now size %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET size = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "hpregen" ) == 0 ) { + c->Message(15,"NPCID %u now regens %i hitpoints per tick.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET hp_regen_rate = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "manaregen" ) == 0 ) { + c->Message(15,"NPCID %u now regens %i mana per tick.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET mana_regen_rate = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "loottable" ) == 0 ) { + c->Message(15,"NPCID %u is now on loottable_id %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET loottable_id = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "merchantid" ) == 0 ) { + c->Message(15,"NPCID %u is now merchant_id %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET merchant_id = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "alt_currency_id" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'alt_currency_id' set to %s.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET alt_currency_id = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "npc_spells_effects_id" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'npc_spells_effects_id' set to %s.", npcTypeID, sep->argplus[2]); + + std::string query = StringFormat("UPDATE npc_types SET npc_spells_effects_id = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "adventure_template_id" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'adventure_template_id' set to %s.", npcTypeID, sep->argplus[2]); + + std::string query = StringFormat("UPDATE npc_types SET adventure_template_id = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "trap_template" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'trap_template' set to %s.", npcTypeID, sep->argplus[2]); + + std::string query = StringFormat("UPDATE npc_types SET trap_template = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "special_abilities" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'special_abilities' set to %s.", npcTypeID, sep->argplus[2]); + + std::string query = StringFormat("UPDATE npc_types SET special_abilities = '%s' WHERE id = %i", + sep->argplus[2],npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "spell" ) == 0 ) { + c->Message(15,"NPCID %u now uses spell list %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET npc_spells_id = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "faction" ) == 0 ) { + c->Message(15,"NPCID %u is now faction %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET npc_faction_id = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "mindmg" ) == 0 ) { + c->Message(15,"NPCID %u now hits for a min of %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET mindmg = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "maxdmg" ) == 0 ) { + c->Message(15,"NPCID %u now hits for a max of %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET maxdmg = %i WHERE id = %i", + atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "aggroradius" ) == 0 ) { + c->Message(15,"NPCID %u now has an aggro radius of %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET aggroradius = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "assistradius" ) == 0 ) { + c->Message(15,"NPCID %u now has an assist radius of %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET assistradius = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "social" ) == 0 ) { + c->Message(15,"NPCID %u social status is now %i", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET social = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "runspeed" ) == 0 ) { + c->Message(15,"NPCID %u now runs at %f", npcTypeID, atof(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET runspeed = %f WHERE id = %i", + atof(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "AGI" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Agility.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET AGI = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "CHA" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Charisma.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET CHA = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "DEX" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Dexterity.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET DEX = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "INT" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Intelligence.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET _INT = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "STA" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Stamina.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET STA = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "STR" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Strength.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET STR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "WIS" ) == 0 ) { + c->Message(15,"NPCID %u now has a Magic Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET WIS = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "MR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Magic Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET MR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "DR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Disease Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET DR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "CR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Cold Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET CR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "FR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Fire Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET FR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "PR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Poison Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET PR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "Corrup" ) == 0 ) { + c->Message(15,"NPCID %u now has a Corruption Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET corrup = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "PhR" ) == 0 ) { + c->Message(15,"NPCID %u now has a Physical Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET PhR = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "seeinvis" ) == 0 ) { + c->Message(15,"NPCID %u now has seeinvis set to %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET see_invis = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "seeinvisundead" ) == 0 ) { + c->Message(15,"NPCID %u now has seeinvisundead set to %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET see_invis_undead = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "seehide" ) == 0 ) { + c->Message(15,"NPCID %u now has seehide set to %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET see_hide = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "seeimprovedhide" ) == 0 ) { + c->Message(15,"NPCID %u now has seeimprovedhide set to %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET see_improved_hide = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "AC" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Armor Class.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET ac = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "ATK" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Attack.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET atk = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "Accuracy" ) == 0 ) { + c->Message(15,"NPCID %u now has %i Accuracy.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET accuracy = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "level" ) == 0 ) { + c->Message(15,"NPCID %u is now level %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET level = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "maxlevel" ) == 0 ) { + c->Message(15,"NPCID %u now has a maximum level of %i.", npcTypeID, atoi(sep->argplus[2])); + + std::string query = StringFormat("UPDATE npc_types SET maxlevel = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "qglobal" ) == 0 ) { + c->Message(15,"Quest globals have been %s for NPCID %u", + atoi(sep->arg[2]) == 0 ? "disabled" : "enabled", npcTypeID); + + std::string query = StringFormat("UPDATE npc_types SET qglobal = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "npcaggro" ) == 0 ) { + c->Message(15,"NPCID %u will now %s other NPCs with negative faction npc_value", + npcTypeID, atoi(sep->arg[2]) == 0? "not aggro": "aggro"); + + std::string query = StringFormat("UPDATE npc_types SET npc_aggro = %i WHERE id = %i", + atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "limit" ) == 0 ) { + c->Message(15,"NPCID %u now has a spawn limit of %i", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET limit = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "Attackspeed" ) == 0 ) { + c->Message(15,"NPCID %u now has attack_speed set to %f", + npcTypeID, atof(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET attack_speed = %f WHERE id = %i", + atof(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "Attackdelay" ) == 0 ) { + c->Message(15,"NPCID %u now has attack_delay set to %i",npcTypeID,atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET attack_delay = %i WHERE id = %i",atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "findable" ) == 0 ) { + c->Message(15,"NPCID %u is now %s", npcTypeID, atoi(sep->arg[2]) == 0? "not findable": "findable"); + + std::string query = StringFormat("UPDATE npc_types SET findable = %i WHERE id = %i", + atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "wep1" ) == 0 ) { + c->Message(15,"NPCID %u will have item graphic %i set to his primary on repop.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET d_meele_texture1 = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "wep2" ) == 0 ) { + c->Message(15,"NPCID %u will have item graphic %i set to his secondary on repop.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET d_meele_texture2 = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "featuresave" ) == 0 ) { + c->Message(15,"NPCID %u saved with all current facial feature settings", + npcTypeID); + + Mob* target = c->GetTarget(); + + std::string query = StringFormat("UPDATE npc_types " + "SET luclin_haircolor = %i, luclin_beardcolor = %i, " + "luclin_hairstyle = %i, luclin_beard = %i, " + "face = %i, drakkin_heritage = %i, " + "drakkin_tattoo = %i, drakkin_details = %i, " + "WHERE id = %i", + target->GetHairColor(), target->GetBeardColor(), + target->GetHairStyle(), target->GetBeard(), + target->GetLuclinFace(), target->GetDrakkinHeritage(), + target->GetDrakkinTattoo(), target->GetDrakkinDetails(), + npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "color" ) == 0 ) { + c->Message(15,"NPCID %u now has %i red, %i green, and %i blue tinting on their armor.", + npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); + + std::string query = StringFormat("UPDATE npc_types " + "SET armortint_red = %i, armortint_green = %i, armortint_blue = %i " + "WHERE id = %i", + atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "armortint_id" ) == 0 ) { + c->Message(15,"NPCID %u now has field 'armortint_id' set to %s", + npcTypeID, sep->arg[2]); + + std::string query = StringFormat("UPDATE npc_types SET armortint_id = '%s' WHERE id = %i", + sep->argplus[2], npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "setanimation" ) == 0 ) { + int animation = 0; + if(sep->arg[2] && atoi(sep->arg[2]) <= 4) { + if((strcasecmp( sep->arg[2], "stand" ) == 0) || atoi(sep->arg[2]) == 0) + animation = 0; //Stand + if((strcasecmp( sep->arg[2], "sit" ) == 0) || atoi(sep->arg[2]) == 1) + animation = 1; //Sit + if((strcasecmp( sep->arg[2], "crouch" ) == 0) || atoi(sep->arg[2]) == 2) + animation = 2; //Crouch + if((strcasecmp( sep->arg[2], "dead" ) == 0) || atoi(sep->arg[2]) == 3) + animation = 3; //Dead + if((strcasecmp( sep->arg[2], "loot" ) == 0) || atoi(sep->arg[2]) == 4) + animation = 4; //Looting Animation } - else{ + else { c->Message(0, "You must specifiy an animation stand, sit, crouch, dead, loot (0-4)"); c->Message(0, "Example: #npcedit setanimation sit"); c->Message(0, "Example: #npcedit setanimation 0"); return; } - c->Message(15,"NPCID %u now has the animation set to %i on spawn with spawngroup %i", c->GetTarget()->CastToNPC()->GetNPCTypeID(), Animation, c->GetTarget()->CastToNPC()->GetSp2() ); - database.RunQuery(query, MakeAnyLenString(&query, "update spawn2 set animation = %i where spawngroupID=%i", Animation, c->GetTarget()->CastToNPC()->GetSp2()), errbuf); - c->GetTarget()->SetAppearance(EmuAppearance(Animation)); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "scalerate" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u now has a scaling rate of %i.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set scalerate=%i where id=%i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "healscale" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u now has a heal scaling rate of %i.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set healscale=%i where id=%i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "spellscale" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u now has a spell scaling rate of %i.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set spellscale=%i where id=%i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "no_target" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u is now %s.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2]) == 0 ? "targetable" : "untargetable"); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set no_target_hotkey=%i where id=%i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); - } - else if ( strcasecmp( sep->arg[1], "version" ) == 0 ) - { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - c->Message(15, "NPCID %u is now version %i.", c->GetTarget()->CastToNPC()->GetNPCTypeID(), atoi(sep->arg[2])); - database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set version=%i where id=%i", atoi(sep->arg[2]), c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf); - c->LogSQL(query); - safe_delete_array(query); + + c->Message(15,"NPCID %u now has the animation set to %i on spawn with spawngroup %i", npcTypeID, animation, c->GetTarget()->CastToNPC()->GetSp2() ); + + std::string query = StringFormat("UPDATE spawn2 SET animation = %i " + "WHERE spawngroupID = %i", + animation, c->GetTarget()->CastToNPC()->GetSp2()); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + + c->GetTarget()->SetAppearance(EmuAppearance(animation)); + return; } - else if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) - { - c->Message(0, "Type #npcedit help for more info"); + if ( strcasecmp( sep->arg[1], "scalerate" ) == 0 ) { + c->Message(15,"NPCID %u now has a scaling rate of %i.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET scalerate = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; } + + if ( strcasecmp( sep->arg[1], "healscale" ) == 0 ) { + c->Message(15, "NPCID %u now has a heal scaling rate of %i.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET healscale = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "spellscale" ) == 0 ) { + c->Message(15, "NPCID %u now has a spell scaling rate of %i.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET spellscale = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "no_target" ) == 0 ) { + c->Message(15, "NPCID %u is now %s.", + npcTypeID, atoi(sep->arg[2]) == 0? "targetable": "untargetable"); + + std::string query = StringFormat("UPDATE npc_types SET no_target_hotkey = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if ( strcasecmp( sep->arg[1], "version" ) == 0 ) { + c->Message(15, "NPCID %u is now version %i.", + npcTypeID, atoi(sep->arg[2])); + + std::string query = StringFormat("UPDATE npc_types SET version = %i WHERE id = %i", + atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) + c->Message(0, "Type #npcedit help for more info"); + } #ifdef PACKET_PROFILER From a61b930bd9a0769f05d541726f508df4814aa8c8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 11:58:24 -0700 Subject: [PATCH 0069/1883] command_qglobal converted to QueryDatabase --- zone/command.cpp | 68 +++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index f3adf5856..cfb10c564 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7309,56 +7309,58 @@ void command_nologs(Client *c, const Seperator *sep) void command_qglobal(Client *c, const Seperator *sep) { //In-game switch for qglobal column - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; if(sep->arg[1][0] == 0) { c->Message(0, "Syntax: #qglobal [on/off/view]. Requires NPC target."); return; } - Mob *t = c->GetTarget(); - if(!t || !t->IsNPC()) { + + Mob *target = c->GetTarget(); + + if(!target || !target->IsNPC()) { c->Message(13, "NPC Target Required!"); return; } - if(!strcasecmp(sep->arg[1], "on")) - { - if(!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE npc_types SET qglobal=1 WHERE id='%i'", t->GetNPCTypeID()), errbuf, 0)) - { + + if(!strcasecmp(sep->arg[1], "on")) { + std::string query = StringFormat("UPDATE npc_types SET qglobal = 1 WHERE id = '%i'", + target->GetNPCTypeID()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { c->Message(15, "Could not update database."); + return; } - else - { - c->LogSQL(query); - c->Message(15, "Success! Changes take effect on zone reboot."); - } - safe_delete(query); + + c->LogSQL(query.c_str()); + c->Message(15, "Success! Changes take effect on zone reboot."); + return; } - else if(!strcasecmp(sep->arg[1], "off")) - { - if(!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE npc_types SET qglobal=0 WHERE id='%i'", t->GetNPCTypeID()), errbuf, 0)) - { + + if(!strcasecmp(sep->arg[1], "off")) { + std::string query = StringFormat("UPDATE npc_types SET qglobal = 0 WHERE id = '%i'", + target->GetNPCTypeID()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { c->Message(15, "Could not update database."); + return; } - else - { - c->LogSQL(query); - c->Message(15, "Success! Changes take effect on zone reboot."); - } - safe_delete(query); + + c->LogSQL(query.c_str()); + c->Message(15, "Success! Changes take effect on zone reboot."); + return; } - else if(!strcasecmp(sep->arg[1], "view")) - { - const NPCType *type = database.GetNPCType(t->GetNPCTypeID()); - if(!type) { + + if(!strcasecmp(sep->arg[1], "view")) { + const NPCType *type = database.GetNPCType(target->GetNPCTypeID()); + if(!type) c->Message(15, "Invalid NPC type."); - } else if(type->qglobal) { + else if(type->qglobal) c->Message(15, "This NPC has quest globals active."); - } else { + else c->Message(15, "This NPC has quest globals disabled."); - } - } else { - c->Message(15, "Invalid action specified."); + return; } + + c->Message(15, "Invalid action specified."); } void command_path(Client *c, const Seperator *sep) From 6a078279eb5e5ed3a26894106a5c3932288693f7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:01:30 -0700 Subject: [PATCH 0070/1883] command_flagedit converted to QueryDatabase --- zone/command.cpp | 94 ++++++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index cfb10c564..4c617a572 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7867,8 +7867,6 @@ void command_flags(Client *c, const Seperator *sep) { void command_flagedit(Client *c, const Seperator *sep) { //super-command for editing zone flags - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { c->Message(0, "Syntax: #flagedit [lockzone|unlockzone|listzones|give|take]."); c->Message(0, "...lockzone [zone id/short] [flag name] - Set the specified flag name on the zone, locking the zone"); @@ -7901,17 +7899,21 @@ void command_flagedit(Client *c, const Seperator *sep) { database.DoEscapeString(flag_name, sep->argplus[3], 64); flag_name[127] = '\0'; - if(!database.RunQuery(query, MakeAnyLenString(&query, - "UPDATE zone SET flag_needed='%s' WHERE zoneidnumber=%d AND version=%d", - flag_name, zoneid, zone->GetInstanceVersion()), errbuf)) - { - c->Message(13, "Error updating zone: %s", errbuf); - } else { - c->LogSQL(query); - c->Message(15, "Success! Zone %s now requires a flag, named %s", database.GetZoneName(zoneid), flag_name); + std::string query = StringFormat("UPDATE zone SET flag_needed = '%s' " + "WHERE zoneidnumber = %d AND version = %d", + flag_name, zoneid, zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + c->Message(13, "Error updating zone: %s", results.ErrorMessage().c_str()); + return; } - safe_delete(query); - } else if(!strcasecmp(sep->arg[1], "unlockzone")) { + + c->LogSQL(query.c_str()); + c->Message(15, "Success! Zone %s now requires a flag, named %s", database.GetZoneName(zoneid), flag_name); + return; + } + + if(!strcasecmp(sep->arg[1], "unlockzone")) { uint32 zoneid = 0; if(sep->arg[2][0] != '\0') { zoneid = atoi(sep->arg[2]); @@ -7919,39 +7921,43 @@ void command_flagedit(Client *c, const Seperator *sep) { zoneid = database.GetZoneID(sep->arg[2]); } } + if(zoneid < 1) { c->Message(13, "zone required. see help."); return; } - if(!database.RunQuery(query, MakeAnyLenString(&query, - "UPDATE zone SET flag_needed='' WHERE zoneidnumber=%d AND version=%d", - zoneid, zone->GetInstanceVersion()), errbuf)) - { - c->Message(15, "Error updating zone: %s", errbuf); - } else { - c->LogSQL(query); - c->Message(15, "Success! Zone %s no longer requires a flag.", database.GetZoneName(zoneid)); + std::string query = StringFormat("UPDATE zone SET flag_needed = '' " + "WHERE zoneidnumber = %d AND version = %d", + zoneid, zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + c->Message(15, "Error updating zone: %s", results.ErrorMessage().c_str()); + return; } - safe_delete(query); - } else if(!strcasecmp(sep->arg[1], "listzones")) { - MYSQL_RES *result; - MYSQL_ROW row; - if (database.RunQuery(query, MakeAnyLenString(&query, - "SELECT zoneidnumber,short_name,long_name,version,flag_needed FROM zone WHERE flag_needed != ''" - ), errbuf, &result)) - { - c->Message(0, "Zones which require flags:"); - while ((row = mysql_fetch_row(result))) - { - c->Message(0, "Zone %s (%s,%s) version %s requires key %s", row[2], row[0], row[1], row[3], row[4]); - } - mysql_free_result(result); - } else { - c->Message(13, "Unable to query zone flags: %s", errbuf); - } - safe_delete_array(query); - } else if(!strcasecmp(sep->arg[1], "give")) { + + c->LogSQL(query.c_str()); + c->Message(15, "Success! Zone %s no longer requires a flag.", database.GetZoneName(zoneid)); + return; + } + + if(!strcasecmp(sep->arg[1], "listzones")) { + std::string query = "SELECT zoneidnumber, short_name, long_name, version, flag_needed " + "FROM zone WHERE flag_needed != ''"; + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(13, "Unable to query zone flags: %s", results.ErrorMessage().c_str()); + return; + } + + c->Message(0, "Zones which require flags:"); + for (auto row = results.begin(); row != results.end(); ++row) + c->Message(0, "Zone %s (%s,%s) version %s requires key %s", row[2], row[0], row[1], row[3], row[4]); + + return; + } + + if(!strcasecmp(sep->arg[1], "give")) { uint32 zoneid = 0; if(sep->arg[2][0] != '\0') { zoneid = atoi(sep->arg[2]); @@ -7971,7 +7977,10 @@ void command_flagedit(Client *c, const Seperator *sep) { } t->CastToClient()->SetZoneFlag(zoneid); - } else if(!strcasecmp(sep->arg[1], "give")) { + return; + } + + if(!strcasecmp(sep->arg[1], "give")) { uint32 zoneid = 0; if(sep->arg[2][0] != '\0') { zoneid = atoi(sep->arg[2]); @@ -7991,9 +8000,10 @@ void command_flagedit(Client *c, const Seperator *sep) { } t->CastToClient()->ClearZoneFlag(zoneid); - } else { - c->Message(15, "Invalid action specified. use '#flagedit help' for help"); + return; } + + c->Message(15, "Invalid action specified. use '#flagedit help' for help"); } void command_mlog(Client *c, const Seperator *sep) { From d5f5b38d26ea1162def7224a7c866c507edf5df9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:03:25 -0700 Subject: [PATCH 0071/1883] command_advnpcspawn converted to QueryDatabase --- zone/command.cpp | 470 +++++++++++++++++++++++++---------------------- 1 file changed, 249 insertions(+), 221 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 4c617a572..727696486 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -8752,233 +8752,261 @@ void command_refreshgroup(Client *c, const Seperator *sep) void command_advnpcspawn(Client *c, const Seperator *sep) { Mob *target=c->GetTarget(); - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - uint32 last_insert_id = 0; - if (strcasecmp(sep->arg[1], "maketype") == 0){ - if(target && target->IsNPC()) - { - database.NPCSpawnDB(6, zone->GetShortName(), zone->GetInstanceVersion(), c, target->CastToNPC()); - } - else - c->Message(0, "Target Required!"); - } - else if (strcasecmp(sep->arg[1], "makegroup") == 0) { - if(sep->arg[2]) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawngroup (name,spawn_limit,dist,max_x,min_x,max_y,min_y,delay) VALUES (\"%s\",%i,%f,%f,%f,%f,%f,%i)", sep->arg[2], (sep->arg[3]?atoi(sep->arg[3]):0), (sep->arg[4]?atof(sep->arg[4]):0), (sep->arg[5]?atof(sep->arg[5]):0), (sep->arg[6]?atof(sep->arg[6]):0), (sep->arg[7]?atof(sep->arg[7]):0), (sep->arg[8]?atof(sep->arg[8]):0), (sep->arg[9]?atoi(sep->arg[9]):0)), errbuf, 0, 0, &last_insert_id)) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn makegroup [spawn limit] [dist] [max x] [min x] [max y] [min y] [delay]"); - } - } - else if (strcasecmp(sep->arg[1], "addgroupentry") == 0) { - if(atoi(sep->arg[2]) && atoi(sep->arg[3]) && atoi(sep->arg[4])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO spawnentry (spawngroupID,npcID,chance) VALUES (%i,%i,%i)", atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), errbuf, 0, 0, &last_insert_id))) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "NPC %i added to group %i with %i chance!", atoi(sep->arg[3]), atoi(sep->arg[2]), atoi(sep->arg[4]) ); - } - safe_delete(query); - } - else - { - c->Message(0, "Format: #advnpdspawn addgroupentry "); - } - } - else if (strcasecmp(sep->arg[1], "editgroupbox") == 0) { - if(atof(sep->arg[2]) && atof(sep->arg[3]) && atof(sep->arg[4]) && atof(sep->arg[5]) && atof(sep->arg[6]) && atof(sep->arg[7]) && atof(sep->arg[8])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='%f',max_x='%f',min_x='%f',max_y='%f',min_y='%f',delay='%i' WHERE id='%i'", atof(sep->arg[3]),atof(sep->arg[4]),atof(sep->arg[5]),atof(sep->arg[6]),atof(sep->arg[7]),atoi(sep->arg[8]),atoi(sep->arg[2]), errbuf, 0, 0, &last_insert_id))) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn editgroupbox "); - } - } - else if (strcasecmp(sep->arg[1], "cleargroupbox") == 0) { - if(atoi(sep->arg[2])) - { - if (!database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawngroup SET dist='0',max_x='0',min_x='0',max_y='0',min_y='0',delay='0' WHERE id='%i'",atoi(sep->arg[2])), errbuf, 0, 0, &last_insert_id)) - { - c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); - c->Message(13, errbuf); - } - else - { - c->LogSQL(query); - c->Message(0, "Group ID %i created successfully!", last_insert_id); - } - safe_delete_array(query); - } - else - { - c->Message(0, "Format: #advnpdspawn cleargroupbox "); - } - } - else if (strcasecmp(sep->arg[1], "addgroupspawn") == 0 && atoi(sep->arg[2])!=0) { - database.NPCSpawnDB(5, zone->GetShortName(), zone->GetInstanceVersion(), c, 0, atoi(sep->arg[2])); - c->Message(0, "Mob of group %i added successfully!", atoi(sep->arg[2])); - } - else if (strcasecmp(sep->arg[1], "removegroupspawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + if (strcasecmp(sep->arg[1], "maketype") == 0) { + if(!target || !target->IsNPC()) { + c->Message(0, "Target Required!"); + return; + } - if(!s2) { - c->Message(0, "removegroupspawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM spawn2 WHERE id='%i'",s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Spawnpoint Removed successfully."); - target->Depop(false); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } - else if (strcasecmp(sep->arg[1], "movespawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + database.NPCSpawnDB(6, zone->GetShortName(), zone->GetInstanceVersion(), c, target->CastToNPC()); + return; + } - if(!s2) { - c->Message(0, "movespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Updating coordinates successful."); - target->CastToNPC()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading()); - target->CastToNPC()->SaveGuardSpot(true); - target->SendPosition(); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } - else if (strcasecmp(sep->arg[1], "editrespawn") == 0) { - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - Spawn2* s2 = target->CastToNPC()->respawn2; + if (strcasecmp(sep->arg[1], "makegroup") == 0) { + if(!sep->arg[2]) { + c->Message(0, "Format: #advnpdspawn makegroup [spawn limit] [dist] [max x] [min x] [max y] [min y] [delay]"); + return; + } - uint32 new_rs = 0; - uint32 new_var = s2->GetVariance(); - if(!sep->IsNumber(2)) - { - c->Message(0, "editrespawn FAILED -- cannot set respawn to be 0"); - return; - } - else - { - new_rs = atoi(sep->arg[2]); - } + std::string query = StringFormat("INSERT INTO spawngroup " + "(name, spawn_limit, dist, max_x, min_x, max_y, min_y, delay) " + "VALUES (\"%s\", %i, %f, %f, %f, %f, %f, %i)", + sep->arg[2], + (sep->arg[3]? atoi(sep->arg[3]): 0), + (sep->arg[4]? atof(sep->arg[4]): 0), + (sep->arg[5]? atof(sep->arg[5]): 0), + (sep->arg[6]? atof(sep->arg[6]): 0), + (sep->arg[7]? atof(sep->arg[7]): 0), + (sep->arg[8]? atof(sep->arg[8]): 0), + (sep->arg[9]? atoi(sep->arg[9]): 0)); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } - if(sep->IsNumber(3)) - { - new_var = atoi(sep->arg[3]); - } + c->LogSQL(query.c_str()); + c->Message(0, "Group ID %i created successfully!", results.LastInsertedID()); + return; + } - if(!s2) { - c->Message(0, "editrespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); - } - else - { - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET respawntime=%u, variance=%u WHERE id='%i'", new_rs, new_var, s2->GetID()), errbuf)) - { - c->LogSQL(query); - c->Message(0, "Updating respawn timer successful."); - s2->SetRespawnTimer(new_rs); - s2->SetVariance(new_var); - } - else - { - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - } - } - else if (strcasecmp(sep->arg[1], "setversion") == 0) { - int16 Version = 0; - if (!target || !target->IsNPC()) - c->Message(0, "Error: Need an NPC target."); - else { - if(sep->IsNumber(2)){ - Version = atoi(sep->arg[2]); - if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET version=%i WHERE spawngroupID='%i'", Version, c->GetTarget()->CastToNPC()->GetSp2()), errbuf)){ - c->LogSQL(query); - c->Message(0, "Version change to %i was successful from SpawnGroupID %i", Version, c->GetTarget()->CastToNPC()->GetSp2()); - c->GetTarget()->Depop(false); - } - else{ - c->Message(13, "Update failed! MySQL gave the following error:"); - c->Message(13, errbuf); - } - safe_delete_array(query); - } - else{ - c->Message(0, "setversion FAILED -- You must set a version number"); - return; - } - } - } - else if (strcasecmp(sep->arg[1], "testload") == 0 && atoi(sep->arg[2])!=0) { - database.LoadSpawnGroupsByID(atoi(sep->arg[2]),&zone->spawn_group_list); - c->Message(0, "Group %i loaded successfully!", atoi(sep->arg[2])); - } - else { - c->Message(0, "Error: #advnpcspawn: Invalid command."); - c->Message(0, "Usage: #advnpcspawn [maketype|makegroup|addgroupentry|addgroupspawn|setversion]"); - c->Message(0, "Usage: #advnpcspawn [removegroupspawn|movespawn|editrespawn|editgroupbox|cleargroupbox]"); - } + if (strcasecmp(sep->arg[1], "addgroupentry") == 0) { + if(!atoi(sep->arg[2]) || !atoi(sep->arg[3]) || !atoi(sep->arg[4])) { + c->Message(0, "Format: #advnpdspawn addgroupentry "); + return; + } + + std::string query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) " + "VALUES (%i, %i, %i)", + atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "NPC %i added to group %i with %i chance!", atoi(sep->arg[3]), atoi(sep->arg[2]), atoi(sep->arg[4]) ); + + return; + } + + if (strcasecmp(sep->arg[1], "editgroupbox") == 0) { + if(!atof(sep->arg[2]) || !atof(sep->arg[3]) || !atof(sep->arg[4]) || !atof(sep->arg[5]) || !atof(sep->arg[6]) || !atof(sep->arg[7]) || !atof(sep->arg[8])) { + c->Message(0, "Format: #advnpdspawn editgroupbox "); + return; + } + + std::string query = StringFormat("UPDATE spawngroup SET dist = '%f', max_x = '%f', min_x = '%f', " + "max_y = '%f', min_y = '%f', delay = '%i' WHERE id = '%i'", + atof(sep->arg[3]), atof(sep->arg[4]), atof(sep->arg[5]), + atof(sep->arg[6]), atof(sep->arg[7]), atoi(sep->arg[8]), + atoi(sep->arg[2])); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Group ID %i created successfully!", results.LastInsertedID()); + + return; + } + + if (strcasecmp(sep->arg[1], "cleargroupbox") == 0) { + if(!atoi(sep->arg[2])) { + c->Message(0, "Format: #advnpdspawn cleargroupbox "); + return; + } + + std::string query = StringFormat("UPDATE spawngroup " + "SET dist = '0', max_x = '0', min_x = '0', " + "max_y = '0', min_y = '0', delay = '0' " + "WHERE id = '%i' ", atoi(sep->arg[2])); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Invalid Arguments -- MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Group ID %i created successfully!", results.LastInsertedID()); + + return; + } + + if (strcasecmp(sep->arg[1], "addgroupspawn") == 0 && atoi(sep->arg[2])!=0) { + database.NPCSpawnDB(5, zone->GetShortName(), zone->GetInstanceVersion(), c, 0, atoi(sep->arg[2])); + c->Message(0, "Mob of group %i added successfully!", atoi(sep->arg[2])); + return; + } + + if (strcasecmp(sep->arg[1], "removegroupspawn") == 0) { + if (!target || !target->IsNPC()) { + c->Message(0, "Error: Need an NPC target."); + return; + } + + Spawn2* s2 = target->CastToNPC()->respawn2; + + if(!s2) { + c->Message(0, "removegroupspawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + return; + } + + std::string query = StringFormat("DELETE FROM spawn2 WHERE id = '%i'", s2->GetID()); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Spawnpoint Removed successfully."); + target->Depop(false); + + return; + } + + if (strcasecmp(sep->arg[1], "movespawn") == 0) { + if (!target || !target->IsNPC()) { + c->Message(0, "Error: Need an NPC target."); + return; + } + + Spawn2* s2 = target->CastToNPC()->respawn2; + + if(!s2) { + c->Message(0, "movespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + return; + } + + std::string query = StringFormat("UPDATE spawn2 SET x = '%f', y = '%f', z = '%f', heading = '%f' " + "WHERE id = '%i'", + c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Updating coordinates successful."); + target->CastToNPC()->GMMove(c->GetX(), c->GetY(), c->GetZ(), c->GetHeading()); + target->CastToNPC()->SaveGuardSpot(true); + target->SendPosition(); + + return; + } + + if (strcasecmp(sep->arg[1], "editrespawn") == 0) { + if (!target || !target->IsNPC()) { + c->Message(0, "Error: Need an NPC target."); + return; + } + + Spawn2* s2 = target->CastToNPC()->respawn2; + + uint32 new_rs = 0; + uint32 new_var = s2->GetVariance(); + if(!sep->IsNumber(2)) { + c->Message(0, "editrespawn FAILED -- cannot set respawn to be 0"); + return; + } + + new_rs = atoi(sep->arg[2]); + + if(sep->IsNumber(3)) + new_var = atoi(sep->arg[3]); + + if(!s2) { + c->Message(0, "editrespawn FAILED -- cannot determine which spawn entry in the database this mob came from."); + return; + } + + std::string query = StringFormat("UPDATE spawn2 SET respawntime = %u, variance = %u " + "WHERE id = '%i'", new_rs, new_var, s2->GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Updating respawn timer successful."); + s2->SetRespawnTimer(new_rs); + s2->SetVariance(new_var); + + return; + } + + if (strcasecmp(sep->arg[1], "setversion") == 0) { + if (!target || !target->IsNPC()) { + c->Message(0, "Error: Need an NPC target."); + return; + } + + if(!sep->IsNumber(2)) { + c->Message(0, "setversion FAILED -- You must set a version number"); + return; + } + + int16 version = atoi(sep->arg[2]); + std::string query = StringFormat("UPDATE spawn2 SET version = %i " + "WHERE spawngroupID = '%i'", + version, c->GetTarget()->CastToNPC()->GetSp2()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(13, "Update failed! MySQL gave the following error:"); + c->Message(13, results.ErrorMessage().c_str()); + return; + } + + c->LogSQL(query.c_str()); + c->Message(0, "Version change to %i was successful from SpawnGroupID %i", version, c->GetTarget()->CastToNPC()->GetSp2()); + c->GetTarget()->Depop(false); + + return; + } + + if (strcasecmp(sep->arg[1], "testload") == 0 && atoi(sep->arg[2])!=0) { + database.LoadSpawnGroupsByID(atoi(sep->arg[2]),&zone->spawn_group_list); + c->Message(0, "Group %i loaded successfully!", atoi(sep->arg[2])); + return; + } + + c->Message(0, "Error: #advnpcspawn: Invalid command."); + c->Message(0, "Usage: #advnpcspawn [maketype|makegroup|addgroupentry|addgroupspawn|setversion]"); + c->Message(0, "Usage: #advnpcspawn [removegroupspawn|movespawn|editrespawn|editgroupbox|cleargroupbox]"); } void command_aggrozone(Client *c, const Seperator *sep) { From bf6b9aaef8af9ffa697a6d55961562d349901bc2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:07:33 -0700 Subject: [PATCH 0072/1883] command_object converted to QueryDatabase --- zone/command.cpp | 2391 ++++++++++++++++++++-------------------------- 1 file changed, 1031 insertions(+), 1360 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 727696486..b03cb3d93 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -9287,28 +9287,15 @@ void command_netstats(Client *c, const Seperator *sep) void command_object(Client *c, const Seperator *sep) { if (!c) - { return; // Crash Suppressant: No client. How did we get here? - } // Save it here. We sometimes have need to refer to it in multiple places. const char* usage_string = "Usage: #object List|Add|Edit|Move|Rotate|Save|Copy|Delete|Undo"; - if ((!sep) || (sep->argnum == 0)) - { - // Crash Suppressant: Shouldn't be able to get here, either, but fail gracefully if we do. + if ((!sep) || (sep->argnum == 0)) { c->Message(0, usage_string); - return; - } - - char errbuf[MYSQL_ERRMSG_SIZE]; - char query[512]; - uint32 col; - MYSQL_RES *result; - MYSQL_ROW row; - int iObjectsFound = 0; - int len; + } Object* o = nullptr; Object_Struct od; @@ -9325,1361 +9312,1045 @@ void command_object(Client *c, const Seperator *sep) bool bNewObject = false; - errbuf[0] = '\0'; - float x2; float y2; // Temporary object type for static objects to allow manipulation // NOTE: Zone::LoadZoneObjects() currently loads this as an uint8, so max value is 255! - static const uint32 TempStaticType = 255; + static const uint32 staticType = 255; // Case insensitive commands (List == list == LIST) strlwr(sep->arg[1]); - // Protip: We only really care about the first letter. You can abbreviate Delete to just D if desired. - switch (sep->arg[1][0]) - { - case 'l': // List Objects - // Insufficient or invalid args - if ((sep->argnum < 2) || (sep->arg[2][0] < '0') || ((sep->arg[2][0] > '9') && ((sep->arg[2][0] & 0xDF) != 'A'))) - { - c->Message(0, "Usage: #object List All|(radius)"); - - return; - } - - if ((sep->arg[2][0] & 0xDF) == 'A') - { - radius = 0; // List All - } - else if ((radius = atoi(sep->arg[2])) <= 0) - { - radius = 500; // Invalid radius. Default to 500 units. - } - - if (radius == 0) - { - c->Message(0, "Objects within this zone:"); - } - else - { - c->Message(0, "Objects within %u units of your current location:", radius); - } - - if (radius) - { - len = snprintf(query, sizeof(query), - "SELECT id, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20" - " FROM object" - " WHERE (zoneid=%u)" - " AND (version=%u)" - " AND (xpos BETWEEN %.1f AND %.1f)" - " AND (ypos BETWEEN %.1f AND %.1f)" - " AND (zpos BETWEEN %.1f AND %.1f)" - " ORDER BY id", - zone->GetZoneID(), - zone->GetInstanceVersion(), - c->GetX() - radius, // Yes, we're actually using a bounding box instead of a radius. - c->GetX() + radius, // Much less processing power used this way. - c->GetY() - radius, - c->GetY() + radius, - c->GetZ() - radius, - c->GetZ() + radius); - } - else - { - len = snprintf(query, sizeof(query), - "SELECT id, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20" - " FROM object" - " WHERE (zoneid=%u)" - " AND (version=%u)" - " ORDER BY id", - zone->GetZoneID(), - zone->GetInstanceVersion()); - } - - if (database.RunQuery(query, len, errbuf, &result)) - { - while ((row = mysql_fetch_row(result))) - { - col = 0; - id = atoi(row[col++]); - od.x = atof(row[col++]); - od.y = atof(row[col++]); - od.z = atof(row[col++]); - od.heading = atof(row[col++]); - itemid = atoi(row[col++]); - strn0cpy(od.object_name, row[col++], sizeof(od.object_name)); - od.object_name[sizeof(od.object_name) - 1] = '\0'; // Required if strlen(row[col++]) exactly == sizeof(object_name) - - od.object_type = atoi(row[col++]); - icon = atoi(row[col++]); - od.unknown008 = atoi(row[col++]); - od.unknown010 = atoi(row[col++]); - od.unknown020 = atoi(row[col++]); - - switch (od.object_type) - { - case 0: // Static Object - case TempStaticType: // Static Object unlocked for changes - if (od.unknown008 == 0) // Unknown08 field is optional Size parameter for static objects - { - od.unknown008 = 100; // Static object default Size is 100% - } - - c->Message(0, - "- STATIC Object (%s): id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, size %u, solidtype %u, incline %u", - (od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008, od.unknown010, od.unknown020); - break; - case OT_DROPPEDITEM: // Ground Spawn - c->Message(0, - "- TEMPORARY Object: id %u, x %.1f, y %.1f, z %.1f, h %.1f, itemid %u, model %s, icon %u", - id, od.x, od.y, od.z, od.heading, itemid, od.object_name, icon); - break; - default: // All others == Tradeskill Objects - c->Message(0, - "- TRADESKILL Object: id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, type %u, icon %u", - id, od.x, od.y, od.z, od.heading, od.object_name, od.object_type, icon); - break; - } - - iObjectsFound++; - } - - mysql_free_result(result); - } - - c->Message(0, "%u object%s found", iObjectsFound, (iObjectsFound == 1) ? "" : "s"); - break; - case 'a': // Add Object - // Insufficient or invalid arguments - if ((sep->argnum < 3) || ((sep->arg[3][0] == '\0') && (sep->arg[4][0] < '0') && (sep->arg[4][0] > '9'))) - { - c->Message(0, "Usage: (Static Object): #object Add [ObjectID] 0 Model [SizePercent] [SolidType] [Incline]"); - c->Message(0, "Usage: (Tradeskill Object): #object Add [ObjectID] TypeNum Model Icon"); - c->Message(0, "- Notes: Model must start with a letter, max length 16. SolidTypes = 0 (Solid), 1 (Sometimes Non-Solid)"); - - return; - } - - if (sep->argnum > 3) - { - // Model name in arg3? - if ((sep->arg[3][0] <= '9') && (sep->arg[3][0] >= '0')) - { - // Nope, user must have specified ObjectID. Extract it. - id = atoi(sep->arg[2]); - - col = 1; // Bump all other arguments one to the right. Model is in arg4. - } - else - { - // Yep, arg3 is non-numeric, ObjectID must be omitted and model must be arg3 - id = 0; - col = 0; - } - } - else - { - // Nope, only 3 args. Object ID must be omitted and arg3 must be model. - id = 0; - col = 0; - } - - memset(&od, 0, sizeof(od)); - - od.object_type = atoi(sep->arg[2 + col]); - - switch (od.object_type) - { - case 0: // Static Object - if ((sep->argnum - col) > 3) - { - od.unknown008 = atoi(sep->arg[4 + col]); // Size specified - - if ((sep->argnum - col) > 4) - { - od.unknown010 = atoi(sep->arg[5 + col]); // SolidType specified - - if ((sep->argnum - col) > 5) - { - od.unknown020 = atoi(sep->arg[6 + col]); // Incline specified - } - } - } - break; - case 1: // Ground Spawn - c->Message(0, "ERROR: Object Type 1 is used for temporarily spawned ground spawns and dropped items, which are not supported with #object. See the 'ground_spawns' table in the database."); - - return; - break; - default: // Everything else == Tradeskill Object - icon = ((sep->argnum - col) > 3) ? atoi(sep->arg[4 + col]) : 0; - - if (icon == 0) - { - c->Message(0, "ERROR: Required property 'Icon' not specified for Tradeskill Object"); - - return; - } - break; - } - - od.x = c->GetX(); - od.y = c->GetY(); - od.z = c->GetZ() - (c->GetSize() * 0.625f); - od.heading = c->GetHeading() * 2.0f; // GetHeading() is half of actual. Compensate by doubling. - - if (id) - { - // ID specified. Verify that it doesn't already exist. - - len = snprintf(query, sizeof(query), "SELECT COUNT(*) FROM object WHERE ID=%u", id); - - // Already in database? - if (database.RunQuery(query, len, errbuf, &result)) - { - if ((row = mysql_fetch_row(result)) != nullptr) - { - if (atoi(row[0]) > 0) - { - // Yep, in database already. - - id = 0; - } - } - - mysql_free_result(result); - } - - if (id) - { - // Not in database. Already spawned, just not saved? - if (entity_list.FindObject(id)) - { - // Yep, already spawned. - - id = 0; - } - } - - if (id == 0) - { - c->Message(0, "ERROR: An object already exists with the id %u", atoi(sep->arg[2])); - - return; - } - } - - // Verify no other objects already in this spot (accidental double-click of Hotkey?) - len = snprintf(query, sizeof(query), - "SELECT COUNT(*) FROM object " - "WHERE (zoneid=%u) " - "AND (version=%u) " - "AND (posx BETWEEN %.1f AND %.1f) " - "AND (posy BETWEEN %.1f AND %.1f) " - "AND (posz BETWEEN %.1f AND %.1f)", - zone->GetZoneID(), - zone->GetInstanceVersion(), - od.x - 0.2f, od.x + 0.2f, // Yes, we're actually using a bounding box instead of a radius. - od.y - 0.2f, od.y + 0.2f, // Much less processing power used this way. - od.z - 0.2f, od.z + 0.2f); // It's pretty forgiving, though, allowing for close-proximity objects - - iObjectsFound = 0; - if (database.RunQuery(query, len, errbuf, &result)) - { - if ((row = mysql_fetch_row(result)) != nullptr) - { - iObjectsFound = atoi(row[0]); // Number of nearby objects from database - } - - mysql_free_result(result); - } - - if (iObjectsFound == 0) - { - // No objects found in database too close. How about spawned but not yet saved? - if (entity_list.FindNearbyObject(od.x, od.y, od.z, 0.2f)) - { - iObjectsFound++; - } - } - - if (iObjectsFound) - { - c->Message(0, "ERROR: Object already at this location."); - - return; - } - - // Strip any single quotes from objectname (SQL injection FTL!) - strn0cpy(od.object_name, sep->arg[3 + col], sizeof(od.object_name)); - - len = strlen(od.object_name); - for (col = 0; col < (uint32)len; col++) - { - if (od.object_name[col] == '\'') - { - // Uh oh, 1337 h4x0r monkeying around! Strip that apostrophe! - memcpy(&od.object_name[col], &od.object_name[col + 1], len - col); - - len--; - col--; - } - } - - strupr(od.object_name); // Model names are always upper-case. - - if ((od.object_name[0] < 'A') || (od.object_name[0] > 'Z')) - { - c->Message(0, "ERROR: Model name must start with a letter."); - - return; - } - - if (id == 0) - { - // No ID specified. Get a best-guess next number from the database - - // If there's a problem retrieving an ID from the database, it'll end up being object # 1. No biggie. - - strn0cpy(query, "SELECT MAX(id) FROM object", sizeof(query)); - - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - if (row = mysql_fetch_row(result)) - { - id = atoi(row[0]); - } - - mysql_free_result(result); - } - - id++; - } - - // Make sure not to overwrite already-spawned objects that haven't been saved yet. - while (o = entity_list.FindObject(id)) - { - id++; - } - - if (od.object_type == 0) // Static object - { - od.object_type = TempStaticType; // Temporary. We'll make it 0 when we Save - } - - od.zone_id = zone->GetZoneID(); - od.zone_instance = zone->GetInstanceVersion(); - - o = new Object(id, od.object_type, icon, od, nullptr); - - // Add to our zone entity list and spawn immediately for all clients - entity_list.AddObject(o, true); - - // Bump player back to avoid getting stuck inside new object - - // GetHeading() returns half of the actual heading, for some reason, so we'll double it here for computation - x2 = 10.0f * sin(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); - y2 = 10.0f * cos(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); - c->MovePC(c->GetX() - x2, c->GetY() - y2, c->GetZ(), c->GetHeading() * 2); - - c->Message(0, "Spawning object with tentative id %u at location (%.1f, %.1f, %.1f heading %.1f). Use '#object Save' to save to database when satisfied with placement.", id, od.x, od.y, od.z, od.heading); - - if (od.object_type == TempStaticType) // Temporary Static Object - { - c->Message(0, "- Note: Static Object will act like a tradeskill container and will not reflect size, solidtype, or incline values until you commit with '#object Save', after which it will be unchangeable until you use '#object Edit' and zone back in."); - } - break; - case 'e': // Edit - // Insufficient or invalid arguments - if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) < 1)) - { - c->Message(0, "Usage: #object Edit (ObjectID) [PropertyName] [NewValue]"); - c->Message(0, "- Static Object (Type 0) Properties: model, type, size, solidtype, incline"); - c->Message(0, "- Tradeskill Object (Type 2+) Properties: model, type, icon"); - - return; - } - - o = entity_list.FindObject(id); - - // Object already available in-zone? - if (o) - { - // Yep, looks like we can make real-time changes. - if (sep->argnum < 4) - { - // Or not. '#object Edit (ObjectID)' called without PropertyName and NewValue - - c->Message(0, "Note: Object %u already unlocked and ready for changes", id); - - return; - } - } - else - { - // Object not found in-zone in a modifiable form. Check for valid matching circumstances. - - len = snprintf(query, sizeof(query), "SELECT zoneid, version, type FROM object WHERE id=%u", id); - - iObjectsFound = 0; - if (database.RunQuery(query, len, errbuf, &result)) - { - if (row = mysql_fetch_row(result)) - { - od.zone_id = atoi(row[0]); - od.zone_instance = atoi(row[1]); - od.object_type = atoi(row[2]); - - iObjectsFound++; - } - - mysql_free_result(result); - } - - // Object ID not found? - if (iObjectsFound == 0) - { - c->Message(0, "ERROR: Object %u not found", id); - - return; - } - - // Object not in this zone? - if (od.zone_id != zone->GetZoneID()) - { - c->Message(0, "ERROR: Object %u not in this zone.", id); - - return; - } - - // Object not in this instance? - if (od.zone_instance != zone->GetInstanceVersion()) - { - c->Message(0, "ERROR: Object %u not part of this instance version.", id); - - return; - } - - switch (od.object_type) - { - case 0: // Static object needing unlocking + if (strcasecmp(sep->arg[1], "list") == 0) { + // Insufficient or invalid args + if ((sep->argnum < 2) || (sep->arg[2][0] < '0') || ((sep->arg[2][0] > '9') && ((sep->arg[2][0] & 0xDF) != 'A'))) { + c->Message(0, "Usage: #object List All|(radius)"); + return; + } + + if ((sep->arg[2][0] & 0xDF) == 'A') + radius = 0; // List All + else if ((radius = atoi(sep->arg[2])) <= 0) + radius = 500; // Invalid radius. Default to 500 units. + + if (radius == 0) + c->Message(0, "Objects within this zone:"); + else + c->Message(0, "Objects within %u units of your current location:", radius); + + std::string query; + if (radius) + query = StringFormat("SELECT id, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20 " + "FROM object WHERE zoneid = %u AND version = %u " + "AND (xpos BETWEEN %.1f AND %.1f) " + "AND (ypos BETWEEN %.1f AND %.1f) " + "AND (zpos BETWEEN %.1f AND %.1f) " + "ORDER BY id", + zone->GetZoneID(), zone->GetInstanceVersion(), + c->GetX() - radius, // Yes, we're actually using a bounding box instead of a radius. + c->GetX() + radius, // Much less processing power used this way. + c->GetY() - radius, + c->GetY() + radius, + c->GetZ() - radius, + c->GetZ() + radius); + else + query = StringFormat("SELECT id, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20 " + "FROM object WHERE zoneid = %u AND version = %u " + "ORDER BY id", + zone->GetZoneID(), zone->GetInstanceVersion()); + + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Error in objects query"); + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) { + id = atoi(row[0]); + od.x = atof(row[1]); + od.y = atof(row[2]); + od.z = atof(row[3]); + od.heading = atof(row[4]); + itemid = atoi(row[5]); + strn0cpy(od.object_name, row[6], sizeof(od.object_name)); + od.object_name[sizeof(od.object_name) - 1] = '\0'; // Required if strlen(row[col++]) exactly == sizeof(object_name) + + od.object_type = atoi(row[7]); + icon = atoi(row[8]); + od.unknown008 = atoi(row[9]); + od.unknown010 = atoi(row[10]); + od.unknown020 = atoi(row[11]); + + switch (od.object_type) + { + case 0: // Static Object + case staticType: // Static Object unlocked for changes + if (od.unknown008 == 0) // Unknown08 field is optional Size parameter for static objects + od.unknown008 = 100; // Static object default Size is 100% + + c->Message(0,"- STATIC Object (%s): id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, size %u, solidtype %u, incline %u", (od.object_type == 0) ? "locked" : "unlocked", id, od.x, od.y, od.z, od.heading, od.object_name, od.unknown008, od.unknown010, od.unknown020); + break; + + case OT_DROPPEDITEM: // Ground Spawn + c->Message(0,"- TEMPORARY Object: id %u, x %.1f, y %.1f, z %.1f, h %.1f, itemid %u, model %s, icon %u",id, od.x, od.y, od.z, od.heading, itemid, od.object_name, icon); + break; + + default: // All others == Tradeskill Objects + c->Message(0, "- TRADESKILL Object: id %u, x %.1f, y %.1f, z %.1f, h %.1f, model %s, type %u, icon %u",id, od.x, od.y, od.z, od.heading, od.object_name, od.object_type, icon); + break; + } + } + + c->Message(0, "%u object%s found", results.RowCount(), (results.RowCount() == 1)? "": "s"); + return; + } + + if (strcasecmp(sep->arg[1], "add") == 0) { + // Insufficient or invalid arguments + if ((sep->argnum < 3) || ((sep->arg[3][0] == '\0') && (sep->arg[4][0] < '0') && (sep->arg[4][0] > '9'))) { + c->Message(0, "Usage: (Static Object): #object Add [ObjectID] 0 Model [SizePercent] [SolidType] [Incline]"); + c->Message(0, "Usage: (Tradeskill Object): #object Add [ObjectID] TypeNum Model Icon"); + c->Message(0, "- Notes: Model must start with a letter, max length 16. SolidTypes = 0 (Solid), 1 (Sometimes Non-Solid)"); + return; + } + + int col; + + if (sep->argnum > 3) { // Model name in arg3? + if ((sep->arg[3][0] <= '9') && (sep->arg[3][0] >= '0')) { + // Nope, user must have specified ObjectID. Extract it. + id = atoi(sep->arg[2]); + col = 1; // Bump all other arguments one to the right. Model is in arg4. + } + else { + // Yep, arg3 is non-numeric, ObjectID must be omitted and model must be arg3 + id = 0; + col = 0; + } + } + else { + // Nope, only 3 args. Object ID must be omitted and arg3 must be model. + id = 0; + col = 0; + } + + memset(&od, 0, sizeof(od)); + + od.object_type = atoi(sep->arg[2 + col]); + + switch (od.object_type) { + case 0: // Static Object + if ((sep->argnum - col) > 3) { + od.unknown008 = atoi(sep->arg[4 + col]); // Size specified + + if ((sep->argnum - col) > 4) { + od.unknown010 = atoi(sep->arg[5 + col]); // SolidType specified + + if ((sep->argnum - col) > 5) + od.unknown020 = atoi(sep->arg[6 + col]); // Incline specified + } + } + break; + + case 1: // Ground Spawn + c->Message(0, "ERROR: Object Type 1 is used for temporarily spawned ground spawns and dropped items, which are not supported with #object. See the 'ground_spawns' table in the database."); + return; + + default: // Everything else == Tradeskill Object + icon = ((sep->argnum - col) > 3) ? atoi(sep->arg[4 + col]) : 0; + + if (icon == 0) { + c->Message(0, "ERROR: Required property 'Icon' not specified for Tradeskill Object"); + return; + } + + break; + } + + od.x = c->GetX(); + od.y = c->GetY(); + od.z = c->GetZ() - (c->GetSize() * 0.625f); + od.heading = c->GetHeading() * 2.0f; // GetHeading() is half of actual. Compensate by doubling. + + std::string query; + if (id) { + // ID specified. Verify that it doesn't already exist. + query = StringFormat("SELECT COUNT(*) FROM object WHERE ID = %u", id); + auto results = database.QueryDatabase(query); + if (results.Success() && results.RowCount() != 0) { + auto row = results.begin(); + if (atoi(row[0]) > 0) // Yep, in database already. + id = 0; + } + + // Not in database. Already spawned, just not saved? + // Yep, already spawned. + if (id && entity_list.FindObject(id)) + id = 0; + + if (id == 0) { + c->Message(0, "ERROR: An object already exists with the id %u", atoi(sep->arg[2])); + return; + } + } + + int objectsFound = 0; + // Verify no other objects already in this spot (accidental double-click of Hotkey?) + query = StringFormat("SELECT COUNT(*) FROM object WHERE zoneid = %u " + "AND version=%u AND (posx BETWEEN %.1f AND %.1f) " + "AND (posy BETWEEN %.1f AND %.1f) " + "AND (posz BETWEEN %.1f AND %.1f)", + zone->GetZoneID(), zone->GetInstanceVersion(), + od.x - 0.2f, od.x + 0.2f, // Yes, we're actually using a bounding box instead of a radius. + od.y - 0.2f, od.y + 0.2f, // Much less processing power used this way. + od.z - 0.2f, od.z + 0.2f); // It's pretty forgiving, though, allowing for close-proximity objects + + auto results = database.QueryDatabase(query); + if (results.Success() && results.RowCount() != 0) { + auto row = results.begin(); + objectsFound = atoi(row[0]); // Number of nearby objects from database + } + + // No objects found in database too close. How about spawned but not yet saved? + if (objectsFound == 0 && entity_list.FindNearbyObject(od.x, od.y, od.z, 0.2f)) + objectsFound = 1; + + if (objectsFound) { + c->Message(0, "ERROR: Object already at this location."); + return; + } + + // Strip any single quotes from objectname (SQL injection FTL!) + strn0cpy(od.object_name, sep->arg[3 + col], sizeof(od.object_name)); + + uint32 len = strlen(od.object_name); + for (col = 0; col < (uint32)len; col++) { + if (od.object_name[col] != '\'') + continue; + + // Uh oh, 1337 h4x0r monkeying around! Strip that apostrophe! + memcpy(&od.object_name[col], &od.object_name[col + 1], len - col); + len--; + col--; + } + + strupr(od.object_name); // Model names are always upper-case. + + if ((od.object_name[0] < 'A') || (od.object_name[0] > 'Z')) { + c->Message(0, "ERROR: Model name must start with a letter."); + return; + } + + if (id == 0) { + // No ID specified. Get a best-guess next number from the database + // If there's a problem retrieving an ID from the database, it'll end up being object # 1. No biggie. + + query = "SELECT MAX(id) FROM object"; + results = database.QueryDatabase(query); + if (results.Success() && results.RowCount() != 0) { + auto row = results.begin(); + id = atoi(row[0]); + } + + id++; + } + + // Make sure not to overwrite already-spawned objects that haven't been saved yet. + while (o = entity_list.FindObject(id)) + id++; + + // Static object + if (od.object_type == 0) + od.object_type = staticType; // Temporary. We'll make it 0 when we Save + + od.zone_id = zone->GetZoneID(); + od.zone_instance = zone->GetInstanceVersion(); + + o = new Object(id, od.object_type, icon, od, nullptr); + + // Add to our zone entity list and spawn immediately for all clients + entity_list.AddObject(o, true); + + // Bump player back to avoid getting stuck inside new object + + // GetHeading() returns half of the actual heading, for some reason, so we'll double it here for computation + x2 = 10.0f * sin(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); + y2 = 10.0f * cos(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); + c->MovePC(c->GetX() - x2, c->GetY() - y2, c->GetZ(), c->GetHeading() * 2); + + c->Message(0, "Spawning object with tentative id %u at location (%.1f, %.1f, %.1f heading %.1f). Use '#object Save' to save to database when satisfied with placement.", id, od.x, od.y, od.z, od.heading); + + // Temporary Static Object + if (od.object_type == staticType) + c->Message(0, "- Note: Static Object will act like a tradeskill container and will not reflect size, solidtype, or incline values until you commit with '#object Save', after which it will be unchangeable until you use '#object Edit' and zone back in."); + + return; + } + + if (strcasecmp(sep->arg[1], "edit") == 0) { + + if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) < 1)) { + c->Message(0, "Usage: #object Edit (ObjectID) [PropertyName] [NewValue]"); + c->Message(0, "- Static Object (Type 0) Properties: model, type, size, solidtype, incline"); + c->Message(0, "- Tradeskill Object (Type 2+) Properties: model, type, icon"); + + return; + } + + o = entity_list.FindObject(id); + + // Object already available in-zone? + if (o) { + // Yep, looks like we can make real-time changes. + if (sep->argnum < 4) { + // Or not. '#object Edit (ObjectID)' called without PropertyName and NewValue + c->Message(0, "Note: Object %u already unlocked and ready for changes", id); + return; + } + } + else { + // Object not found in-zone in a modifiable form. Check for valid matching circumstances. + std::string query = StringFormat("SELECT zoneid, version, type FROM object WHERE id = %u", id); + auto results = database.QueryDatabase(query); + if (!results.Success() || results.RowCount() == 0) { + c->Message(0, "ERROR: Object %u not found", id); + return; + } + + auto row = results.begin(); + od.zone_id = atoi(row[0]); + od.zone_instance = atoi(row[1]); + od.object_type = atoi(row[2]); + uint32 objectsFound = 1; + + // Object not in this zone? + if (od.zone_id != zone->GetZoneID()) { + c->Message(0, "ERROR: Object %u not in this zone.", id); + return; + } + + // Object not in this instance? + if (od.zone_instance != zone->GetInstanceVersion()) { + c->Message(0, "ERROR: Object %u not part of this instance version.", id); + return; + } + + switch (od.object_type) + { + case 0: // Static object needing unlocking // Convert to tradeskill object temporarily for changes - - len = snprintf(query, sizeof(query), "UPDATE object SET type=%u WHERE id=%u", TempStaticType, id); - - database.RunQuery(query, len); - - c->Message(0, "Static Object %u unlocked for editing. You must zone out and back in to make your changes, then commit them with '#object Save'.", id); - - if (sep->argnum >= 4) - { - c->Message(0, "NOTE: The change you specified has not been applied, since the static object had not been unlocked for editing yet."); - } - - return; - break; - case OT_DROPPEDITEM: - c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); - - return; - break; - case TempStaticType: - c->Message(0, "ERROR: Object %u has been unlocked for editing, but you must zone out and back in for your client to refresh its object table before you can make changes to it.", id); - - return; - break; - default: - // Unknown error preventing us from seeing the object in the zone. - - c->Message(0, "ERROR: Unknown problem attempting to manipulate object %u", id); - - return; - break; - } - } - - // If we're here, we have a manipulable object ready for changes. - - strlwr(sep->arg[3]); // Case insensitive PropertyName - strupr(sep->arg[4]); // In case it's model name, which should always be upper-case - - // Read current object info for reference - icon = o->GetIcon(); - o->GetObjectData(&od); - - // We'll be a little more picky with property names, to prevent errors. Check against the whole word. - switch (sep->arg[3][0]) - { - case 'm': - if (strcmp(sep->arg[3], "model") == 0) - { - if ((sep->arg[4][0] < 'A') || (sep->arg[4][0] > 'Z')) - { - c->Message(0, "ERROR: Model names must begin with a letter."); - - return; - } - - strn0cpy(od.object_name, sep->arg[4], sizeof(od.object_name)); - - o->SetObjectData(&od); - - c->Message(0, "Object %u now being rendered with model '%s'", id, od.object_name); - } - else - { - id = 0; // Setting ID to 0 will signify invalid input - } - break; - case 't': - if (strcmp(sep->arg[3], "type") == 0) - { - if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) - { - c->Message(0, "ERROR: Invalid type number"); - - return; - } - - od.object_type = atoi(sep->arg[4]); - - switch (od.object_type) - { - case 0: - // Convert Static Object to temporary changeable type - od.object_type = TempStaticType; - c->Message(0, "Note: Static Object will still act like tradeskill object and will not reflect size, solidtype, or incline settings until committed to the database with '#object Save', after which it will be unchangeable until it is unlocked again with '#object Edit'."); - break; - case OT_DROPPEDITEM: - c->Message(0, "ERROR: Object Type 1 is used for temporarily spawned ground spawns and dropped items, which are not supported with #object. See the 'ground_spawns' table in the database."); - - return; - break; - default: - c->Message(0, "Object %u changed to Tradeskill Object Type %u", id, od.object_type); - break; - } - - o->SetType(od.object_type); - } - else - { - id = 0; // Setting ID to 0 will signify invalid input - } - break; - case 's': - if (strcmp(sep->arg[3], "size") == 0) - { - if (od.object_type != TempStaticType) - { - c->Message(0, "ERROR: Object %u is not a Static Object and does not support the Size property", id); - - return; - } - - if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) - { - c->Message(0, "ERROR: Invalid size specified. Please enter a number."); - - return; - } - - od.unknown008 = atoi(sep->arg[4]); - o->SetObjectData(&od); - - if (od.unknown008 == 0) // 0 == unspecified == 100% - { - od.unknown008 = 100; - } - - c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008); - } - else if (strcmp(sep->arg[3], "solidtype") == 0) - { - if (od.object_type != TempStaticType) - { - c->Message(0, "ERROR: Object %u is not a Static Object and does not support the SolidType property", id); - - return; - } - - if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) - { - c->Message(0, "ERROR: Invalid solidtype specified. Please enter a number."); - - return; - } - - od.unknown010 = atoi(sep->arg[4]); - o->SetObjectData(&od); - - c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown010); - } - else - { - id = 0; // Setting ID to 0 will signify invalid input - } - break; - case 'i': - if (strcmp(sep->arg[3], "icon") == 0) - { - if ((od.object_type < 2) || (od.object_type == TempStaticType)) - { - c->Message(0, "ERROR: Object %u is not a Tradeskill Object and does not support the Icon property", id); - - return; - } - - if ((icon = atoi(sep->arg[4])) == 0) - { - c->Message(0, "ERROR: Invalid Icon specified. Please enter an icon number."); - - return; - } - - o->SetIcon(icon); - - c->Message(0, "Tradeskill Object %u icon set to %u", id, icon); - } - else if (strcmp(sep->arg[3], "incline") == 0) - { - if (od.object_type != TempStaticType) - { - c->Message(0, "ERROR: Object %u is not a Static Object and does not support the Incline property", id); - - return; - } - - if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) - { - c->Message(0, "ERROR: Invalid Incline specified. Please enter a number. Normal range is 0-512."); - - return; - } - - od.unknown020 = atoi(sep->arg[4]); - o->SetObjectData(&od); - - c->Message(0, "Static Object %u set to %u incline. Incline will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown020); - } - else - { - id = 0; // Setting ID to 0 will signify invalid input - } - break; - default: - id = 0; // Setting ID to 0 will signify invalid input - break; - } - - if (id == 0) - { - c->Message(0, "ERROR: Unrecognized property name: %s", sep->arg[3]); - - return; - } - - // Repop object to have it reflect the change. - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - - app = new EQApplicationPacket(); - o->CreateSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - break; - case 'm': // Move - if ((sep->argnum < 2) || // Not enough arguments - ((id = atoi(sep->arg[2])) == 0) || // ID not specified - (((sep->arg[3][0] < '0') || (sep->arg[3][0] > '9')) && - ((sep->arg[3][0] & 0xDF) != 'T') && - (sep->arg[3][0] != '-') && (sep->arg[3][0] != '.'))) // Location argument not specified correctly - { - c->Message(0, "Usage: #object Move (ObjectID) ToMe|(x y z [h])"); - - return; - } - - if (!(o = entity_list.FindObject(id))) - { - len = snprintf(query, sizeof(query), "SELECT zoneid, version, type FROM object WHERE id=%u", id); - - if ((!database.RunQuery(query, len, errbuf, &result)) || ((row = mysql_fetch_row(result)) == 0)) - { - if (result) - { - mysql_free_result(result); - } - - c->Message(0, "ERROR: Object %u not found", id); - - return; - } - - od.zone_id = atoi(row[0]); - od.zone_instance = atoi(row[1]); - od.object_type = atoi(row[2]); - - mysql_free_result(result); - - if (od.zone_id != zone->GetZoneID()) - { - c->Message(0, "ERROR: Object %u is not in this zone", id); - - return; - } - - if (od.zone_instance != zone->GetInstanceVersion()) - { - c->Message(0, "ERROR: Object %u is not in this instance version", id); - - return; - } - - switch (od.object_type) - { - case 0: - c->Message(0, "ERROR: Object %u is not yet unlocked for editing. Use '#object Edit' then zone out and back in to move it.", id); - - return; - break; - case TempStaticType: - c->Message(0, "ERROR: Object %u has been unlocked for editing, but you must zone out and back in before your client sees the change and will allow you to move it.", id); - - return; - break; - case 1: - c->Message(0, "ERROR: Object %u is a temporary spawned object and cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); - - return; - break; - default: - c->Message(0, "ERROR: Object %u not located in zone.", id); - - return; - break; - } - } - - if ((sep->arg[3][0] & 0xDF) == 'T') // Move To Me - { - od.x = c->GetX(); - od.y = c->GetY(); - od.z = c->GetZ() - (c->GetSize() * 0.625f); // Compensate for #loc bumping up Z coordinate by 62.5% of character's size. - - o->SetHeading(c->GetHeading() * 2.0f); // Compensate for GetHeading() returning half of actual - - // Bump player back to avoid getting stuck inside object - - // GetHeading() returns half of the actual heading, for some reason - x2 = 10.0f * sin(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); - y2 = 10.0f * cos(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); - c->MovePC(c->GetX() - x2, c->GetY() - y2, c->GetZ(), c->GetHeading() * 2.0f); - } - else // Move to x, y, z [h] - { - od.x = atof(sep->arg[3]); - if (sep->argnum > 3) - { - od.y = atof(sep->arg[4]); - } - else - { - o->GetLocation(nullptr, &od.y, nullptr); - } - - if (sep->argnum > 4) - { - od.z = atof(sep->arg[5]); - } - else - { - o->GetLocation(nullptr, nullptr, &od.z); - } - - if (sep->argnum > 5) - { - o->SetHeading(atof(sep->arg[6])); - } - } - - o->SetLocation(od.x, od.y, od.z); - - // Despawn and respawn object to reflect change - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - - app = new EQApplicationPacket(); - o->CreateSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - break; - case 'r': // Rotate - // Insufficient or invalid arguments - if ((sep->argnum < 3) || ((id = atoi(sep->arg[2])) == 0)) - { - c->Message(0, "Usage: #object Rotate (ObjectID) (Heading, 0-512)"); - - return; - } - - if ((o = entity_list.FindObject(id)) == nullptr) - { - c->Message(0, "ERROR: Object %u not found in zone, or is a static object not yet unlocked with '#object Edit' for editing.", id); - - return; - } - - o->SetHeading(atof(sep->arg[3])); - - // Despawn and respawn object to reflect change - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - - app = new EQApplicationPacket(); - o->CreateSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - break; - case 's': // Save - // Insufficient or invalid arguments - if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) - { - c->Message(0, "Usage: #object Save (ObjectID)"); - - return; - } - - o = entity_list.FindObject(id); - - sprintf(query, "SELECT zoneid, version, type FROM object WHERE id=%u", id); - - od.zone_id = 0; - od.zone_instance = 0; - od.object_type = 0; - - // If this ID isn't in the database yet, it's a new object - bNewObject = true; - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - if (row = mysql_fetch_row(result)) - { - od.zone_id = atoi(row[0]); - od.zone_instance = atoi(row[1]); - od.object_type = atoi(row[2]); - - // ID already in database. Not a new object. - bNewObject = false; - } - - mysql_free_result(result); - } - - if (!o) - { - // Object not found in zone. Can't save an object we can't see. - - if (bNewObject) - { - c->Message(0, "ERROR: Object %u not found", id); - - return; - } - - if (od.zone_id != zone->GetZoneID()) - { - c->Message(0, "ERROR: Wrong Object ID. %u is not part of this zone.", id); - - return; - } - - if (od.zone_instance != zone->GetInstanceVersion()) - { - c->Message(0, "ERROR: Wrong Object ID. %u is not part of this instance version.", id); - - return; - } - - if (od.object_type == 0) - { - c->Message(0, "ERROR: Static Object %u has already been committed. Use '#object Edit %u' and zone out and back in to make changes.", id, id); - - return; - } - - if (od.object_type == 1) - { - c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which is not supported with #object. See the 'ground_spawns' table in the database.", id); - - return; - } - - c->Message(0, "ERROR: Object %u not found.", id); - - return; - } - - if ((od.zone_id > 0) && (od.zone_id != zone->GetZoneID())) - { - // Oops! Another GM already saved an object with our id from another zone. - // We'll have to get a new one. - - id = 0; - } - - if ((id > 0) && (od.zone_instance != zone->GetInstanceVersion())) - { - // Oops! Another GM already saved an object with our id from another instance. - // We'll have to get a new one. - - id = 0; - } - - // If we're asking for a new ID, it's a new object. - bNewObject |= (id == 0); - - o->GetObjectData(&od); - od.object_type = o->GetType(); - icon = o->GetIcon(); - - // We're committing to the database now. Return temporary object type to actual. - if (od.object_type == TempStaticType) - { - od.object_type = 0; - } - - if (bNewObject) - { - if (id == 0) - { - len = snprintf(query, sizeof(query), - "INSERT INTO object (zoneid, version, xpos, ypos, zpos, heading, objectname, type, icon, unknown08, unknown10, unknown20)" - " VALUES (%u, %u, %.1f, %.1f, %.1f, %.1f, '%s', %u, %u, %u, %u, %u)", - zone->GetZoneID(), zone->GetInstanceVersion(), - od.x, od.y, od.z, od.heading, - od.object_name, od.object_type, icon, - od.unknown008, od.unknown010, od.unknown020); - } - else - { - len = snprintf(query, sizeof(query), - "INSERT INTO object (id, zoneid, version, xpos, ypos, zpos, heading, objectname, type, icon, unknown08, unknown10, unknown20)" - " VALUES (%u, %u, %u, %.1f, %.1f, %.1f, %.1f, '%s', %u, %u, %u, %u, %u)", - id, zone->GetZoneID(), zone->GetInstanceVersion(), - od.x, od.y, od.z, od.heading, - od.object_name, od.object_type, icon, - od.unknown008, od.unknown010, od.unknown020); - } - } - else - { - len = snprintf(query, sizeof(query), - "UPDATE object SET " - " zoneid=%u, version=%u," - " xpos=%.1f, ypos=%.1f, zpos=%.1f, heading=%.1f," - " objectname='%s', type=%u, icon=%u," - " unknown08=%u, unknown10=%u, unknown20=%u" - " WHERE ID=%u", - zone->GetZoneID(), zone->GetInstanceVersion(), - od.x, od.y, od.z, od.heading, - od.object_name, od.object_type, icon, - od.unknown008, od.unknown010, od.unknown020, - id); - } - - if (!database.RunQuery(query, len, errbuf, 0, &col, &newid)) - { - col = 0; - } - - if (col == 0) - { - if (errbuf[0] == '\0') - { - // No change made, but no error message given - c->Message(0, "Database Error: Could not save change to Object %u", id); - } - else - { - c->Message(0, "Database Error: %s", errbuf); - } - - return; - } - else - { - if (bNewObject) - { - if (newid == id) - { - c->Message(0, "Saved new Object %u to database", id); - } - else - { - c->Message(0, "Saved Object. NOTE: Database returned a new ID number for object: %u", newid); - id = newid; - } - } - else - { - c->Message(0, "Saved changes to Object %u", id); - - newid = id; - } - } - - if (od.object_type == 0) - { - // Static Object - Respawn as nonfunctional door - - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(0, app); - safe_delete(app); - - entity_list.RemoveObject(o->GetID()); - - memset(&door, 0, sizeof(door)); - - strn0cpy(door.zone_name, zone->GetShortName(), sizeof(door.zone_name)); - - door.db_id = 1000000000 + id; // Out of range of normal use for doors.id - door.door_id = -1; // Client doesn't care if these are all the same door_id - door.pos_x = od.x; // xpos - door.pos_y = od.y; // ypos - door.pos_z = od.z; // zpos - door.heading = od.heading; // heading - - strn0cpy(door.door_name, od.object_name, sizeof(door.door_name)); // objectname - - // Strip trailing "_ACTORDEF" if present. Client won't accept it for doors. - len = strlen(door.door_name); - if ((len > 9) && (memcmp(&door.door_name[len - 9], "_ACTORDEF", 10) == 0)) - { - door.door_name[len - 9] = '\0'; - } - - memcpy(door.dest_zone, "NONE", 5); - - if ((door.size = od.unknown008) == 0) // unknown08 = optional size percentage - { - door.size = 100; - } - - switch (door.opentype = od.unknown010) // unknown10 = optional request_nonsolid (0 or 1 or experimental number) - { - case 0: - door.opentype = 31; - break; - case 1: - door.opentype = 9; - break; - } - - door.incline = od.unknown020; // unknown20 = optional incline value - door.client_version_mask = 0xFFFFFFFF; - - doors = new Doors(&door); - entity_list.AddDoor(doors); - - app = new EQApplicationPacket(OP_SpawnDoor, sizeof(Door_Struct)); - ds = (Door_Struct*)app->pBuffer; - - memset(ds, 0, sizeof(Door_Struct)); - memcpy(ds->name, door.door_name, 32); - ds->xPos = door.pos_x; - ds->yPos = door.pos_y; - ds->zPos = door.pos_z; - ds->heading = door.heading; - ds->incline = door.incline; - ds->size = door.size; - ds->doorId = door.door_id; - ds->opentype = door.opentype; - ds->unknown0052[9] = 1; // *ptr-1 and *ptr-3 from EntityList::MakeDoorSpawnPacket() - ds->unknown0052[11] = 1; - - entity_list.QueueClients(0, app); - safe_delete(app); - - c->Message(0, "NOTE: Object %u is now a static object, and is unchangeable. To make future changes, use '#object Edit' to convert it to a changeable form, then zone out and back in.", id); - } - break; - case 'c': // Copy - // Insufficient or invalid arguments - if ((sep->argnum < 3) || (((sep->arg[2][0] & 0xDF) != 'A') && ((sep->arg[2][0] < '0') || (sep->arg[2][0] > '9')))) - { - c->Message(0, "Usage: #object Copy All|(ObjectID) (InstanceVersion)"); - c->Message(0, "- Note: Only objects saved in the database can be copied to another instance."); - - return; - } - - od.zone_instance = atoi(sep->arg[3]); - - if (od.zone_instance == zone->GetInstanceVersion()) - { - c->Message(0, "ERROR: Source and destination instance versions are the same."); - - return; - } - - if ((sep->arg[2][0] & 0xDF) == 'A') - { - // Copy All - - len = snprintf(query, sizeof(query), - "INSERT INTO object (zoneid, version, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20)" - " SELECT zoneid, %u, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20" - " FROM object" - " WHERE (zoneid=%u) AND (version=%u)", - od.zone_instance, zone->GetZoneID(), zone->GetInstanceVersion()); - - if (database.RunQuery(query, len, errbuf, 0, &col)) - { - c->Message(0, "Copied %u object%s into instance version %u", col, (col == 1) ? "" : "s", od.zone_instance); - } - else - { - if (errbuf[0] == '\0') - { - c->Message(0, "Database Error: No objects were copied into instance version %u", od.zone_instance); - } - else - { - c->Message(0, "Database Error: %s", errbuf); - } - } - } - else - { - // Copy ObjectID - id = atoi(sep->arg[2]); - - len = snprintf(query, sizeof(query), - "INSERT INTO object (zoneid, version, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20)" - " SELECT zoneid, %u, xpos, ypos, zpos, heading, itemid, objectname, type, icon, unknown08, unknown10, unknown20" - " FROM object" - " WHERE (id=%u) AND (zoneid=%u) AND (version=%u)", - od.zone_instance, id, zone->GetZoneID(), zone->GetInstanceVersion()); - - if ((database.RunQuery(query, len, errbuf, 0, &col)) && (col > 0)) - { - c->Message(0, "Copied Object %u into instance version %u", id, od.zone_instance); - } - else - { - // Couldn't copy the object. - - if (errbuf[0] == '\0') - { - // No database error returned. See if we can figure out why. - - len = snprintf(query, sizeof(query), "SELECT zoneid, version FROM object WHERE id=%u", id); - - if (database.RunQuery(query, len, errbuf, &result)) - { - if (row = mysql_fetch_row(result)) - { - // Wrong ZoneID? - if (atoi(row[0]) != zone->GetZoneID()) - { - mysql_free_result(result); - - c->Message(0, "ERROR: Object %u is not part of this zone.", id); - - return; - } - - // Wrong Instance Version? - if (atoi(row[1]) != zone->GetInstanceVersion()) - { - mysql_free_result(result); - - c->Message(0, "ERROR: Object %u is not part of this instance version.", id); - - return; - } - - // Well, NO clue at this point. Just let 'em know something screwed up. - mysql_free_result(result); - - c->Message(0, "ERROR: Unknown database error copying Object %u to instance version %u", id, od.zone_instance); - - return; - } - - mysql_free_result(result); - } - - // Typo? - c->Message(0, "ERROR: Object %u not found", id); - } - else - { - c->Message(0, "Database Error: %s", errbuf); - } - } - } - break; - case 'd': // Delete - if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) <= 0)) - { - c->Message(0, "Usage: #object Delete (ObjectID) -- NOTE: Object deletions are permanent and cannot be undone!"); - - return; - } - - o = entity_list.FindObject(id); - - if (o) - { - // Object found in zone. - - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(nullptr, app); - - entity_list.RemoveObject(o->GetID()); - - // Verifying ZoneID and Version in case someone else ended up adding an object with our ID - // from a different zone/version. Don't want to delete someone else's work. - sprintf(query, "DELETE FROM object WHERE (id=%u) AND (zoneid=%u) AND (version=%u) LIMIT 1", id, zone->GetZoneID(), zone->GetInstanceVersion()); - database.RunQuery(query, strlen(query)); - - c->Message(0, "Object %u deleted", id); - } - else - { - // Object not found in zone. - - sprintf(query, "SELECT type FROM object WHERE (id=%u) AND (zoneid=%u) AND (version=%u) LIMIT 1", id, zone->GetZoneID(), zone->GetInstanceVersion()); - - if (database.RunQuery(query, strlen(query), errbuf, &result)) - { - if (row = mysql_fetch_row(result)) - { - switch (atoi(row[0])) - { - case 0: // Static Object - mysql_free_result(result); - - sprintf(query, "DELETE FROM object WHERE (id=%u) AND (zoneid=%u) AND (version=%u) LIMIT 1", id, zone->GetZoneID(), zone->GetInstanceVersion()); - database.RunQuery(query, strlen(query)); - - c->Message(0, "Object %u deleted. NOTE: This static object will remain for anyone currently in the zone until they next zone out and in.", id); - - mysql_free_result(result); - - return; - break; - case 1: // Temporary Spawn - c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which is not supported with #object. See the 'ground_spawns' table in the database.", id); - - mysql_free_result(result); - - return; - break; - } - } - - mysql_free_result(result); - } - - c->Message(0, "ERROR: Object %u not found in this zone or instance!", id); - } - break; - case 'u': // Undo - Reload object from database to undo changes - // Insufficient or invalid arguments - if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) - { - c->Message(0, "Usage: #object Undo (ObjectID) -- Reload object from database, undoing any changes you have made"); - - return; - } - - o = entity_list.FindObject(id); - - if (!o) - { - c->Message(0, "ERROR: Object %u not found in zone in a manipulable form. No changes to undo.", id); - - return; - } - - if (o->GetType() == OT_DROPPEDITEM) - { - c->Message(0, "ERROR: Object %u is a temporary spawned item and cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); - - return; - } - - // Despawn current item for reloading from database - app = new EQApplicationPacket(); - o->CreateDeSpawnPacket(app); - entity_list.QueueClients(0, app); - entity_list.RemoveObject(o->GetID()); - safe_delete(app); - - len = snprintf(query, sizeof(query), - "SELECT xpos, ypos, zpos, heading, objectname, type, icon, unknown08, unknown10, unknown20" - " FROM object WHERE id=%u", id); - - if ((!database.RunQuery(query, len, errbuf, &result)) || ((row = mysql_fetch_row(result)) == 0)) - { - if (result) - { - mysql_free_result(result); - } - - if (errbuf[0] == '\0') - { - c->Message(0, "Database Error: Could not retrieve Object %u from object table.", id); - - return; - } - - c->Message(0, "Database Error: %s", errbuf); - - return; - } - - memset(&od, 0, sizeof(od)); - - col = 0; - od.x = atof(row[col++]); - od.y = atof(row[col++]); - od.z = atof(row[col++]); - od.heading = atof(row[col++]); - strn0cpy(od.object_name, row[col++], sizeof(od.object_name)); - od.object_type = atoi(row[col++]); - icon = atoi(row[col++]); - od.unknown008 = atoi(row[col++]); - od.unknown010 = atoi(row[col++]); - od.unknown020 = atoi(row[col++]); - - if (od.object_type == 0) - { - od.object_type = TempStaticType; - } - - o = new Object(id, od.object_type, icon, od, nullptr); - entity_list.AddObject(o, true); - - c->Message(0, "Object %u reloaded from database.", id); - break; - default: // Unrecognized command - c->Message(0, usage_string); - break; - } + query = StringFormat("UPDATE object SET type = %u WHERE id = %u", staticType, id); + + database.QueryDatabase(query); + + c->Message(0, "Static Object %u unlocked for editing. You must zone out and back in to make your changes, then commit them with '#object Save'.", id); + if (sep->argnum >= 4) + c->Message(0, "NOTE: The change you specified has not been applied, since the static object had not been unlocked for editing yet."); + return; + + case OT_DROPPEDITEM: + c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); + return; + + case staticType: + c->Message(0, "ERROR: Object %u has been unlocked for editing, but you must zone out and back in for your client to refresh its object table before you can make changes to it.", id); + return; + + default: + // Unknown error preventing us from seeing the object in the zone. + c->Message(0, "ERROR: Unknown problem attempting to manipulate object %u", id); + return; + } + } + + // If we're here, we have a manipulable object ready for changes. + strlwr(sep->arg[3]); // Case insensitive PropertyName + strupr(sep->arg[4]); // In case it's model name, which should always be upper-case + + // Read current object info for reference + icon = o->GetIcon(); + o->GetObjectData(&od); + + // We'll be a little more picky with property names, to prevent errors. Check against the whole word. + if (strcmp(sep->arg[3], "model") == 0) { + + if ((sep->arg[4][0] < 'A') || (sep->arg[4][0] > 'Z')) { + c->Message(0, "ERROR: Model names must begin with a letter."); + return; + } + + strn0cpy(od.object_name, sep->arg[4], sizeof(od.object_name)); + + o->SetObjectData(&od); + + c->Message(0, "Object %u now being rendered with model '%s'", id, od.object_name); + } + else if (strcmp(sep->arg[3], "type") == 0) { + if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) { + c->Message(0, "ERROR: Invalid type number"); + return; + } + + od.object_type = atoi(sep->arg[4]); + + switch (od.object_type) { + case 0: + // Convert Static Object to temporary changeable type + od.object_type = staticType; + c->Message(0, "Note: Static Object will still act like tradeskill object and will not reflect size, solidtype, or incline settings until committed to the database with '#object Save', after which it will be unchangeable until it is unlocked again with '#object Edit'."); + break; + + case OT_DROPPEDITEM: + c->Message(0, "ERROR: Object Type 1 is used for temporarily spawned ground spawns and dropped items, which are not supported with #object. See the 'ground_spawns' table in the database."); + return; + + default: + c->Message(0, "Object %u changed to Tradeskill Object Type %u", id, od.object_type); + break; + } + + o->SetType(od.object_type); + } + else if (strcmp(sep->arg[3], "size") == 0) { + if (od.object_type != staticType) { + c->Message(0, "ERROR: Object %u is not a Static Object and does not support the Size property", id); + return; + } + + if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) { + c->Message(0, "ERROR: Invalid size specified. Please enter a number."); + return; + } + + od.unknown008 = atoi(sep->arg[4]); + o->SetObjectData(&od); + + if (od.unknown008 == 0) // 0 == unspecified == 100% + od.unknown008 = 100; + + c->Message(0, "Static Object %u set to %u%% size. Size will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown008); + } + else if (strcmp(sep->arg[3], "solidtype") == 0) { + + if (od.object_type != staticType) { + c->Message(0, "ERROR: Object %u is not a Static Object and does not support the SolidType property", id); + return; + } + + if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) { + c->Message(0, "ERROR: Invalid solidtype specified. Please enter a number."); + return; + } + + od.unknown010 = atoi(sep->arg[4]); + o->SetObjectData(&od); + + c->Message(0, "Static Object %u set to SolidType %u. Change will take effect when you commit to the database with '#object Save'. Support for this property is on a per-model basis, mostly seen in smaller objects such as chests and tables.", id, od.unknown010); + } + else if (strcmp(sep->arg[3], "icon") == 0) { + + if ((od.object_type < 2) || (od.object_type == staticType)) { + c->Message(0, "ERROR: Object %u is not a Tradeskill Object and does not support the Icon property", id); + return; + } + + if ((icon = atoi(sep->arg[4])) == 0) { + c->Message(0, "ERROR: Invalid Icon specified. Please enter an icon number."); + return; + } + + o->SetIcon(icon); + c->Message(0, "Tradeskill Object %u icon set to %u", id, icon); + } + else if (strcmp(sep->arg[3], "incline") == 0) { + if (od.object_type != staticType) { + c->Message(0, "ERROR: Object %u is not a Static Object and does not support the Incline property", id); + return; + } + + if ((sep->arg[4][0] < '0') || (sep->arg[4][0] > '9')) { + c->Message(0, "ERROR: Invalid Incline specified. Please enter a number. Normal range is 0-512."); + return; + } + + od.unknown020 = atoi(sep->arg[4]); + o->SetObjectData(&od); + + c->Message(0, "Static Object %u set to %u incline. Incline will take effect when you commit to the database with '#object Save', after which the object will be unchangeable until you unlock it again with '#object Edit' and zone out and back in.", id, od.unknown020); + } + else { + c->Message(0, "ERROR: Unrecognized property name: %s", sep->arg[3]); + return; + } + + // Repop object to have it reflect the change. + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + + app = new EQApplicationPacket(); + o->CreateSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + return; + } + + if (strcasecmp(sep->arg[1], "move") == 0) { + + if ((sep->argnum < 2) || // Not enough arguments + ((id = atoi(sep->arg[2])) == 0) || // ID not specified + (((sep->arg[3][0] < '0') || (sep->arg[3][0] > '9')) && + ((sep->arg[3][0] & 0xDF) != 'T') && + (sep->arg[3][0] != '-') && (sep->arg[3][0] != '.'))) { // Location argument not specified correctly + c->Message(0, "Usage: #object Move (ObjectID) ToMe|(x y z [h])"); + return; + } + + if (!(o = entity_list.FindObject(id))) { + std::string query = StringFormat("SELECT zoneid, version, type FROM object WHERE id = %u", id); + auto results = database.QueryDatabase(query); + if (!results.Success() || results.RowCount() == 0) { + c->Message(0, "ERROR: Object %u not found", id); + return; + } + + auto row = results.begin(); + od.zone_id = atoi(row[0]); + od.zone_instance = atoi(row[1]); + od.object_type = atoi(row[2]); + + + if (od.zone_id != zone->GetZoneID()) { + c->Message(0, "ERROR: Object %u is not in this zone", id); + return; + } + + if (od.zone_instance != zone->GetInstanceVersion()) { + c->Message(0, "ERROR: Object %u is not in this instance version", id); + return; + } + + switch (od.object_type) { + case 0: + c->Message(0, "ERROR: Object %u is not yet unlocked for editing. Use '#object Edit' then zone out and back in to move it.", id); + return; + + case staticType: + c->Message(0, "ERROR: Object %u has been unlocked for editing, but you must zone out and back in before your client sees the change and will allow you to move it.", id); + return; + + case 1: + c->Message(0, "ERROR: Object %u is a temporary spawned object and cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); + return; + + default: + c->Message(0, "ERROR: Object %u not located in zone.", id); + return; + } + } + + // Move To Me + if ((sep->arg[3][0] & 0xDF) == 'T') { + od.x = c->GetX(); + od.y = c->GetY(); + od.z = c->GetZ() - (c->GetSize() * 0.625f); // Compensate for #loc bumping up Z coordinate by 62.5% of character's size. + + o->SetHeading(c->GetHeading() * 2.0f); // Compensate for GetHeading() returning half of actual + + // Bump player back to avoid getting stuck inside object + + // GetHeading() returns half of the actual heading, for some reason + x2 = 10.0f * sin(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); + y2 = 10.0f * cos(c->GetHeading() * 2.0f / 256.0f * 3.14159265f); + c->MovePC(c->GetX() - x2, c->GetY() - y2, c->GetZ(), c->GetHeading() * 2.0f); + } // Move to x, y, z [h] + else { + od.x = atof(sep->arg[3]); + if (sep->argnum > 3) + od.y = atof(sep->arg[4]); + else + o->GetLocation(nullptr, &od.y, nullptr); + + if (sep->argnum > 4) + od.z = atof(sep->arg[5]); + else + o->GetLocation(nullptr, nullptr, &od.z); + + if (sep->argnum > 5) + o->SetHeading(atof(sep->arg[6])); + } + + o->SetLocation(od.x, od.y, od.z); + + // Despawn and respawn object to reflect change + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + + app = new EQApplicationPacket(); + o->CreateSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + return; + } + + if (strcasecmp(sep->arg[1], "rotate") == 0) { + // Insufficient or invalid arguments + if ((sep->argnum < 3) || ((id = atoi(sep->arg[2])) == 0)) { + c->Message(0, "Usage: #object Rotate (ObjectID) (Heading, 0-512)"); + return; + } + + if ((o = entity_list.FindObject(id)) == nullptr) { + c->Message(0, "ERROR: Object %u not found in zone, or is a static object not yet unlocked with '#object Edit' for editing.", id); + return; + } + + o->SetHeading(atof(sep->arg[3])); + + // Despawn and respawn object to reflect change + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + + app = new EQApplicationPacket(); + o->CreateSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + return; + } + + if (strcasecmp(sep->arg[1], "save") == 0) { + // Insufficient or invalid arguments + if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) { + c->Message(0, "Usage: #object Save (ObjectID)"); + return; + } + + o = entity_list.FindObject(id); + + od.zone_id = 0; + od.zone_instance = 0; + od.object_type = 0; + + // If this ID isn't in the database yet, it's a new object + bNewObject = true; + std::string query = StringFormat("SELECT zoneid, version, type FROM object WHERE id = %u", id); + auto results = database.QueryDatabase(query); + if (results.Success() && results.RowCount() != 0) { + auto row = results.begin(); + od.zone_id = atoi(row[0]); + od.zone_instance = atoi(row[1]); + od.object_type = atoi(row[2]); + + // ID already in database. Not a new object. + bNewObject = false; + } + + if (!o) { + // Object not found in zone. Can't save an object we can't see. + + if (bNewObject) { + c->Message(0, "ERROR: Object %u not found", id); + return; + } + + if (od.zone_id != zone->GetZoneID()) { + c->Message(0, "ERROR: Wrong Object ID. %u is not part of this zone.", id); + return; + } + + if (od.zone_instance != zone->GetInstanceVersion()) { + c->Message(0, "ERROR: Wrong Object ID. %u is not part of this instance version.", id); + return; + } + + if (od.object_type == 0) { + c->Message(0, "ERROR: Static Object %u has already been committed. Use '#object Edit %u' and zone out and back in to make changes.", id, id); + return; + } + + if (od.object_type == 1) { + c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which is not supported with #object. See the 'ground_spawns' table in the database.", id); + return; + } + + c->Message(0, "ERROR: Object %u not found.", id); + return; + } + + // Oops! Another GM already saved an object with our id from another zone. + // We'll have to get a new one. + if ((od.zone_id > 0) && (od.zone_id != zone->GetZoneID())) + id = 0; + + // Oops! Another GM already saved an object with our id from another instance. + // We'll have to get a new one. + if ((id > 0) && (od.zone_instance != zone->GetInstanceVersion())) + id = 0; + + // If we're asking for a new ID, it's a new object. + bNewObject |= (id == 0); + + o->GetObjectData(&od); + od.object_type = o->GetType(); + icon = o->GetIcon(); + + // We're committing to the database now. Return temporary object type to actual. + if (od.object_type == staticType) + od.object_type = 0; + + if (!bNewObject) + query = StringFormat("UPDATE object SET zoneid = %u, version = %u, " + "xpos = %.1f, ypos=%.1f, zpos=%.1f, heading=%.1f, " + "objectname = '%s', type = %u, icon = %u, " + "unknown08 = %u, unknown10 = %u, unknown20 = %u " + "WHERE ID = %u", + zone->GetZoneID(), zone->GetInstanceVersion(), + od.x, od.y, od.z, od.heading, + od.object_name, od.object_type, icon, + od.unknown008, od.unknown010, od.unknown020, id); + else if (id == 0) + query = StringFormat("INSERT INTO object " + "(zoneid, version, xpos, ypos, zpos, heading, objectname, " + "type, icon, unknown08, unknown10, unknown20) " + "VALUES (%u, %u, %.1f, %.1f, %.1f, %.1f, '%s', %u, %u, %u, %u, %u)", + zone->GetZoneID(), zone->GetInstanceVersion(), + od.x, od.y, od.z, od.heading, + od.object_name, od.object_type, icon, + od.unknown008, od.unknown010, od.unknown020); + else + query = StringFormat("INSERT INTO object " + "(id, zoneid, version, xpos, ypos, zpos, heading, objectname, " + "type, icon, unknown08, unknown10, unknown20) " + "VALUES (%u, %u, %u, %.1f, %.1f, %.1f, %.1f, '%s', %u, %u, %u, %u, %u)", + id, zone->GetZoneID(), zone->GetInstanceVersion(), + od.x, od.y, od.z, od.heading, + od.object_name, od.object_type, icon, + od.unknown008, od.unknown010, od.unknown020); + + results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Database Error: %s", results.ErrorMessage().c_str()); + return; + } + + if (results.RowsAffected() == 0) { + // No change made, but no error message given + c->Message(0, "Database Error: Could not save change to Object %u", id); + return; + } + + if (bNewObject) { + if (newid == results.LastInsertedID()) { + c->Message(0, "Saved new Object %u to database", id); + return; + } + + c->Message(0, "Saved Object. NOTE: Database returned a new ID number for object: %u", newid); + id = newid; + return; + } + + c->Message(0, "Saved changes to Object %u", id); + newid = id; + + if (od.object_type == 0) { + // Static Object - Respawn as nonfunctional door + + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(0, app); + safe_delete(app); + + entity_list.RemoveObject(o->GetID()); + + memset(&door, 0, sizeof(door)); + + strn0cpy(door.zone_name, zone->GetShortName(), sizeof(door.zone_name)); + + door.db_id = 1000000000 + id; // Out of range of normal use for doors.id + door.door_id = -1; // Client doesn't care if these are all the same door_id + door.pos_x = od.x; // xpos + door.pos_y = od.y; // ypos + door.pos_z = od.z; // zpos + door.heading = od.heading; // heading + + strn0cpy(door.door_name, od.object_name, sizeof(door.door_name)); // objectname + + // Strip trailing "_ACTORDEF" if present. Client won't accept it for doors. + uint32 len = strlen(door.door_name); + if ((len > 9) && (memcmp(&door.door_name[len - 9], "_ACTORDEF", 10) == 0)) + door.door_name[len - 9] = '\0'; + + memcpy(door.dest_zone, "NONE", 5); + + if ((door.size = od.unknown008) == 0) // unknown08 = optional size percentage + door.size = 100; + + switch (door.opentype = od.unknown010) // unknown10 = optional request_nonsolid (0 or 1 or experimental number) + { + case 0: + door.opentype = 31; + break; + + case 1: + door.opentype = 9; + break; + + } + + door.incline = od.unknown020; // unknown20 = optional incline value + door.client_version_mask = 0xFFFFFFFF; + + doors = new Doors(&door); + entity_list.AddDoor(doors); + + app = new EQApplicationPacket(OP_SpawnDoor, sizeof(Door_Struct)); + ds = (Door_Struct*)app->pBuffer; + + memset(ds, 0, sizeof(Door_Struct)); + memcpy(ds->name, door.door_name, 32); + ds->xPos = door.pos_x; + ds->yPos = door.pos_y; + ds->zPos = door.pos_z; + ds->heading = door.heading; + ds->incline = door.incline; + ds->size = door.size; + ds->doorId = door.door_id; + ds->opentype = door.opentype; + ds->unknown0052[9] = 1; // *ptr-1 and *ptr-3 from EntityList::MakeDoorSpawnPacket() + ds->unknown0052[11] = 1; + + entity_list.QueueClients(0, app); + safe_delete(app); + + c->Message(0, "NOTE: Object %u is now a static object, and is unchangeable. To make future changes, use '#object Edit' to convert it to a changeable form, then zone out and back in.", id); + } + return; + } + + if (strcasecmp(sep->arg[1], "copy") == 0) { + // Insufficient or invalid arguments + if ((sep->argnum < 3) || (((sep->arg[2][0] & 0xDF) != 'A') && ((sep->arg[2][0] < '0') || (sep->arg[2][0] > '9')))) { + c->Message(0, "Usage: #object Copy All|(ObjectID) (InstanceVersion)"); + c->Message(0, "- Note: Only objects saved in the database can be copied to another instance."); + return; + } + + od.zone_instance = atoi(sep->arg[3]); + + if (od.zone_instance == zone->GetInstanceVersion()) { + c->Message(0, "ERROR: Source and destination instance versions are the same."); + return; + } + + if ((sep->arg[2][0] & 0xDF) == 'A') { + // Copy All + + std::string query = StringFormat("INSERT INTO object " + "(zoneid, version, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20) " + "SELECT zoneid, %u, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20 " + "FROM object WHERE zoneid = %u) AND version = %u", + od.zone_instance, zone->GetZoneID(), zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Database Error: %s", results.ErrorMessage().c_str()); + return; + } + + c->Message(0, "Copied %u object%s into instance version %u", results.RowCount(), (results.RowCount() == 1) ? "" : "s", od.zone_instance); + return; + } + + id = atoi(sep->arg[2]); + + std::string query = StringFormat("INSERT INTO object " + "(zoneid, version, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20) " + "SELECT zoneid, %u, xpos, ypos, zpos, heading, itemid, " + "objectname, type, icon, unknown08, unknown10, unknown20 " + "FROM object WHERE id = %u AND zoneid = %u AND version = %u", + od.zone_instance, id, zone->GetZoneID(), zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + if (results.Success() && results.RowsAffected() > 0) { + c->Message(0, "Copied Object %u into instance version %u", id, od.zone_instance); + return; + } + + // Couldn't copy the object. + + if (results.ErrorMessage().c_str() != '\0') { + c->Message(0, "Database Error: %s", results.ErrorMessage().c_str()); + return; + } + + // No database error returned. See if we can figure out why. + + query = StringFormat("SELECT zoneid, version FROM object WHERE id = %u", id); + results = database.QueryDatabase(query); + if (!results.Success()) + return; + + if (results.RowCount() == 0) { + c->Message(0, "ERROR: Object %u not found", id); + return; + } + + auto row = results.begin(); + // Wrong ZoneID? + if (atoi(row[0]) != zone->GetZoneID()) { + c->Message(0, "ERROR: Object %u is not part of this zone.", id); + return; + } + + // Wrong Instance Version? + if (atoi(row[1]) != zone->GetInstanceVersion()) { + c->Message(0, "ERROR: Object %u is not part of this instance version.", id); + return; + } + + // Well, NO clue at this point. Just let 'em know something screwed up. + c->Message(0, "ERROR: Unknown database error copying Object %u to instance version %u", id, od.zone_instance); + return; + } + + if (strcasecmp(sep->arg[1], "delete") == 0) { + + if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) <= 0)) { + c->Message(0, "Usage: #object Delete (ObjectID) -- NOTE: Object deletions are permanent and cannot be undone!"); + return; + } + + o = entity_list.FindObject(id); + + if (o) { + // Object found in zone. + + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(nullptr, app); + + entity_list.RemoveObject(o->GetID()); + + // Verifying ZoneID and Version in case someone else ended up adding an object with our ID + // from a different zone/version. Don't want to delete someone else's work. + std::string query = StringFormat("DELETE FROM object " + "WHERE id = %u AND zoneid = %u " + "AND version = %u LIMIT 1", + id, zone->GetZoneID(), zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + + c->Message(0, "Object %u deleted", id); + return; + } + + + // Object not found in zone. + std::string query = StringFormat("SELECT type FROM object " + "WHERE id = %u AND zoneid = %u " + "AND version = %u LIMIT 1", + id, zone->GetZoneID(), zone->GetInstanceVersion()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + if (results.RowCount() == 0) { + c->Message(0, "ERROR: Object %u not found in this zone or instance!", id); + return; + } + + auto row = results.begin(); + + switch (atoi(row[0])) { + case 0: // Static Object + query = StringFormat("DELETE FROM object WHERE id = %u " + "AND zoneid = %u AND version = %u LIMIT 1", + id, zone->GetZoneID(), zone->GetInstanceVersion()); + results = database.QueryDatabase(query); + + c->Message(0, "Object %u deleted. NOTE: This static object will remain for anyone currently in the zone until they next zone out and in.", id); + return; + + case 1: // Temporary Spawn + c->Message(0, "ERROR: Object %u is a temporarily spawned ground spawn or dropped item, which is not supported with #object. See the 'ground_spawns' table in the database.", id); + return; + + } + + return; + } + + if (strcasecmp(sep->arg[1], "undo") == 0) { + // Insufficient or invalid arguments + if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) { + c->Message(0, "Usage: #object Undo (ObjectID) -- Reload object from database, undoing any changes you have made"); + return; + } + + o = entity_list.FindObject(id); + + if (!o) { + c->Message(0, "ERROR: Object %u not found in zone in a manipulable form. No changes to undo.", id); + return; + } + + if (o->GetType() == OT_DROPPEDITEM) { + c->Message(0, "ERROR: Object %u is a temporary spawned item and cannot be manipulated with #object. See the 'ground_spawns' table in the database.", id); + return; + } + + // Despawn current item for reloading from database + app = new EQApplicationPacket(); + o->CreateDeSpawnPacket(app); + entity_list.QueueClients(0, app); + entity_list.RemoveObject(o->GetID()); + safe_delete(app); + + std::string query = StringFormat("SELECT xpos, ypos, zpos, " + "heading, objectname, type, icon, " + "unknown08, unknown10, unknown20 " + "FROM object WHERE id = %u", id); + auto results = database.QueryDatabase(query); + if (!results.Success() || results.RowCount() == 0) { + c->Message(0, "Database Error: %s", results.ErrorMessage().c_str()); + return; + } + + memset(&od, 0, sizeof(od)); + + auto row = results.begin(); + + od.x = atof(row[0]); + od.y = atof(row[1]); + od.z = atof(row[2]); + od.heading = atof(row[3]); + strn0cpy(od.object_name, row[4], sizeof(od.object_name)); + od.object_type = atoi(row[5]); + icon = atoi(row[6]); + od.unknown008 = atoi(row[7]); + od.unknown010 = atoi(row[8]); + od.unknown020 = atoi(row[9]); + + if (od.object_type == 0) + od.object_type = staticType; + + o = new Object(id, od.object_type, icon, od, nullptr); + entity_list.AddObject(o, true); + + c->Message(0, "Object %u reloaded from database.", id); + return; + } + + c->Message(0, usage_string); } void command_showspellslist(Client *c, const Seperator *sep) From f4203d06212abd9451cf8e2a339f1ab1521c8353 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 4 Oct 2014 12:08:50 -0700 Subject: [PATCH 0073/1883] command_mysql converted to QueryDatabase --- zone/command.cpp | 113 ++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b03cb3d93..937174d1a 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10838,7 +10838,9 @@ void command_mysql(Client *c, const Seperator *sep) { if(!sep->arg[1][0] || !sep->arg[2][0]) { c->Message(0, "Usage: #mysql query \"Query here\""); + return; } + if ( strcasecmp( sep->arg[1], "help" ) == 0 ) { c->Message(0, "MYSQL In-Game CLI Interface:"); c->Message(0, "Example: #mysql query \"Query goes here quoted\" -s -h"); @@ -10846,81 +10848,70 @@ void command_mysql(Client *c, const Seperator *sep) c->Message(0, "Example: #mysql query \"select * from table where name like \"#something#\""); c->Message(0, "-s - Spaces select entries apart"); c->Message(0, "-h - Colors every other select result"); + return; } + if ( strcasecmp( sep->arg[1], "query" ) == 0 ) { ///Parse switches here - int argnum = 3; bool Options = false, Optionh = false; bool Fail = false; + int argnum = 3; + bool optionS = false; + bool optionH = false; while(sep->arg[argnum] && strlen(sep->arg[argnum]) > 1){ switch(sep->arg[argnum][1]){ - case 's': Options = true; break; - case 'h': Optionh = true; break; - default: c->Message(15, "%s, there is no option '%c'", c->GetName(), sep->arg[argnum][1]); Fail = true; + case 's': optionS = true; break; + case 'h': optionH = true; break; + default: + c->Message(15, "%s, there is no option '%c'", c->GetName(), sep->arg[argnum][1]); + return; } ++argnum; } - if(!Fail) { - char errbuf[MYSQL_ERRMSG_SIZE]; - int HText = 0; - MYSQL_RES *result; - std::stringstream MsgText; - std::string QueryText(sep->arg[2]); - //swap # for % so like queries can work - std::replace(QueryText.begin(), QueryText.end(), '#', '%'); + int highlightTextIndex = 0; + std::string query(sep->arg[2]); + //swap # for % so like queries can work + std::replace(query.begin(), query.end(), '#', '%'); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + c->Message(0, "Invalid query: '%s', '%s'", sep->arg[2], results.ErrorMessage().c_str()); + return; + } - if (database.RunQuery(QueryText.c_str(), QueryText.length(), errbuf, &result)) { - //Using sep->arg[2] again, replace # with %% so it doesn't screw up when sent through vsnprintf in Message - QueryText = sep->arg[2]; - int pos = QueryText.find('#'); - while(pos != std::string::npos) - { - QueryText.erase(pos,1); - QueryText.insert(pos, "%%"); - pos = QueryText.find('#'); - } + //Using sep->arg[2] again, replace # with %% so it doesn't screw up when sent through vsnprintf in Message + query = sep->arg[2]; + int pos = query.find('#'); + while(pos != std::string::npos) { + query.erase(pos,1); + query.insert(pos, "%%"); + pos = query.find('#'); + } + c->Message(15, "---Running query: '%s'", query.c_str()); - MsgText << "---Running query: '" << QueryText << "'"; - c->Message (15, MsgText.str().c_str()); - MsgText.str(""); + for (auto row = results.begin(); row != results.end(); ++row) { + std::stringstream lineText; + std::vector lineVec; + for(int i = 0; i < results.RowCount(); i++) { + //split lines that could overflow the buffer in Client::Message and get cut off + //This will crash MQ2 @ 4000 since their internal buffer is only 2048. + //Reducing it to 2000 fixes that but splits more results from tables with a lot of columns. + if(lineText.str().length() > 4000) { + lineVec.push_back(lineText.str()); + lineText.str(""); + } + lineText << results.FieldName(i) << ":" << "[" << (row[i] ? row[i] : "nullptr") << "] "; + } - MYSQL_ROW row; - while ((row = mysql_fetch_row(result))) { + lineVec.push_back(lineText.str()); - MYSQL_FIELD *fields = mysql_fetch_fields(result); - unsigned int num_fields = mysql_num_fields(result); - std::stringstream LineText; - std::vector LineVec; - for(int i = 0; i < num_fields; i++) { - //split lines that could overflow the buffer in Client::Message and get cut off - //This will crash MQ2 @ 4000 since their internal buffer is only 2048. - //Reducing it to 2000 fixes that but splits more results from tables with a lot of columns. - if(LineText.str().length() > 4000) { - LineVec.push_back(LineText.str()); - LineText.str(""); - } - LineText << fields[i].name << ":" << "[" << (row[i] ? row[i] : "nullptr") << "] "; - } - LineVec.push_back(LineText.str()); + if(optionS) //This provides spacing for the space switch + c->Message(0, " "); + if(optionH) //This option will highlight every other row + highlightTextIndex = 1 - highlightTextIndex; - if(Options) { //This provides spacing for the space switch - c->Message(0, " "); - } - if(Optionh) { //This option will highlight every other row - HText = 1 - HText; - } - for(int lineNum = 0; lineNum < LineVec.size(); ++lineNum) - { - c->Message(HText, LineVec[lineNum].c_str()); - } - } - } - else { - MsgText << "Invalid query: ' " << sep->arg[2] << " ', ' " << errbuf << " '"; - c->Message(0, MsgText.str().c_str()); - MsgText.str(""); - } - } - } + for(int lineNum = 0; lineNum < lineVec.size(); ++lineNum) + c->Message(highlightTextIndex, lineVec[lineNum].c_str()); + } + } } void command_xtargets(Client *c, const Seperator *sep) From 806a9fbb99cafeddeaffc58f758067d65d8c8d27 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 4 Oct 2014 23:38:20 -0400 Subject: [PATCH 0074/1883] Identified recast timer field in Ti item packet header --- common/patches/client62.cpp | 1 + common/patches/titanium.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index 2da492145..5afd76bcd 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -1234,6 +1234,7 @@ namespace Client62 int i; uint32 sub_length; + // not sure if 6.2 has a recast timer timestamp field..but, something seems amiss between this and Ti's ordering MakeAnyLenString(&instance, "%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|", stackable ? charges : 1, diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 7c990751d..6c2591efe 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1675,7 +1675,7 @@ namespace Titanium 0, //merchant_slot, //instance ID, bullshit for now (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, - 0, + 0, // item recast timer timestamp field (aka..last_cast_time field in SoF+ clients) (stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges), inst->IsInstNoDrop() ? 1 : 0, 0 From 7dc1da21f0a892dcdddb2880e425a4bba7657ec9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 02:18:30 -0400 Subject: [PATCH 0075/1883] Move OP_ItemRecastDelay to after cast I originally assumed it needed to be sent "while casting" but it looks like right at the end (where we set the reuse timer) also works. --- zone/spells.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 310bc35bd..9ca3965cc 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -484,19 +484,6 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, return false; } - // This needs a bit more work for saving timer to PP for zoning etc - if (IsClient() && item_slot != INVALID_INDEX && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT))) { - ItemInst *itm = CastToClient()->GetInv().GetItem(item_slot); - if (itm && itm->GetItem()->RecastDelay) { - outapp = new EQApplicationPacket(OP_ItemRecastDelay, sizeof(ItemRecastDelay_Struct)); - ItemRecastDelay_Struct *ird = (ItemRecastDelay_Struct *)outapp->pBuffer; - ird->recast_delay = itm->GetItem()->RecastDelay; - ird->recast_type = itm->GetItem()->RecastType; - CastToClient()->QueuePacket(outapp); - safe_delete(outapp); - } - } - return(true); } @@ -2228,6 +2215,12 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot); if(itm && itm->GetItem()->RecastDelay > 0){ CastToClient()->GetPTimers().Start((pTimerItemStart + itm->GetItem()->RecastType), itm->GetItem()->RecastDelay); + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ItemRecastDelay, sizeof(ItemRecastDelay_Struct)); + ItemRecastDelay_Struct *ird = (ItemRecastDelay_Struct *)outapp->pBuffer; + ird->recast_delay = itm->GetItem()->RecastDelay; + ird->recast_type = itm->GetItem()->RecastType; + CastToClient()->QueuePacket(outapp); + safe_delete(outapp); } } From 4f2dbb37d26f9b4ab418e63cd65381095cac928d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 02:28:17 -0400 Subject: [PATCH 0076/1883] Confirmed OP_ItemRecastDelay for SoF --- utils/patches/patch_SoF.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 5bffdfc93..2e039b404 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -615,6 +615,8 @@ OP_RAWOutOfSession=0x0000 # OP_Some3ByteHPUpdate=0x0000 #initial HP update for mobs OP_InitialHPUpdate=0x0000 # +OP_ItemRecastDelay=0x0ada + # Opcodes from the client that are currently Unknowns: # 0x3E85 - Sent when Guild Management window is opened From fa1fe55e01c68688785e9be9cbbc307400fd7d9f Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 5 Oct 2014 06:12:33 -0400 Subject: [PATCH 0077/1883] Added corpse encode and decode translators --- changelog.txt | 3 ++ common/shareddb.cpp | 7 +++ zone/corpse.cpp | 113 +++++++++++++++++++++++++++++++++++++++++--- zone/corpse.h | 4 +- 4 files changed, 118 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6272d4a69..2d82f375e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/05/2014 == +Uleat: Added Server<->Corpse slot translators needed for re-enumeration (inactive until phased in) + == 10/03/2014 == Uleat: Fixed Ti(6.2) OP_AugmentInfo translation that I broke (does not currently need and I mis-read a process) Uleat: Moved client patch OP_LootItem slot translation to external handlers diff --git a/common/shareddb.cpp b/common/shareddb.cpp index aecfa0488..702861f06 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -191,6 +191,13 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s bool ret = false; uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + // If we never save tribute slots..how are we to ever benefit from them!!? The client + // object is destroyed upon zoning - including its inventory object..and if tributes + // don't exist in the database, then they will never be loaded when the new client + // object is created in the new zone object... Something to consider... -U + // + // (we could add them to the 'NoRent' checks and dispose of after 30 minutes offline) + //never save tribute slots: if(slot_id >= EmuConstants::TRIBUTE_BEGIN && slot_id <= EmuConstants::TRIBUTE_END) return(true); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 6b3b4ac82..5f1345541 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -97,6 +97,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna for (unsigned int i=0; i < dbpcs->itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &dbpcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); + tmp->lootslot = CorpseToServerSlot(tmp->lootslot); // temp hack until corpse blobs are removed itemlist.push_back(tmp); } @@ -147,6 +148,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna for (unsigned int i=0; i < dbpc->itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &dbpc->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); + tmp->lootslot = CorpseToServerSlot(tmp->lootslot); // temp hack until corpse blobs are removed itemlist.push_back(tmp); } @@ -600,6 +602,7 @@ bool Corpse::Save() { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; + item->lootslot = ServerToCorpseSlot(item->lootslot); // temp hack until corpse blobs are removed memcpy((char*) &dbpc->items[x++], (char*) item, sizeof(player_lootitem::ServerLootItem_Struct)); } @@ -2055,15 +2058,111 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){ } /* -uint32 Corpse::ServerToCorpseSlot(int16 server_slot) { - // reserved -} +** Corpse slot translations are needed until corpse database blobs are converted +** +** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into +** the contiguous possessions slot enumeration, the following designations will be used: +** +** Designatiom Server Corpse Offset +** -------------------------------------------------- +** MainCharm 0 0 0 +** ... ... ... 0 +** MainWaist 20 20 0 +** MainPowerSource 21 9999 +9978 +** MainAmmo 22 21 -1 +** +** MainGeneral1 23 22 -1 +** ... ... ... -1 +** MainGeneral8 30 29 -1 +** MainGeneral9 31 9997 +9966 +** MainGeneral10 32 9998 +9966 +** +** MainCursor 33 30 -3 +** +** MainGeneral1_1 251 251 0 +** ... ... ... 0 +** MainGeneral8_10 330 330 0 +** MainGeneral9_1 331 341 +10 +** ... ... ... +10 +** MainGeneral10_10 350 360 +10 +** +** MainCursor_1 351 331 -20 +** ... ... ... -20 +** MainCursor_10 360 340 -20 +** +** (Not all slot designations are valid to all clients..see ##_constants.h files for valid slot enumerations) */ -/* -int16 Corpse::CorpseToServerSlot(uint32 corpse_slot) { - // reserved +uint16 Corpse::ServerToCorpseSlot(uint16 server_slot) +{ + return server_slot; // temporary return + + /* + switch (server_slot) + { + case MainPowerSource: + return 9999; + case MainGeneral9: + return 9997; + case MainGeneral10: + return 9998; + case MainCursor: + return 30; + case MainAmmo: + case MainGeneral1: + case MainGeneral2: + case MainGeneral3: + case MainGeneral4: + case MainGeneral5: + case MainGeneral6: + case MainGeneral7: + case MainGeneral8: + return server_slot - 1; + default: + if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) + return server_slot - 20; + else if (server_slot >= EmuConstants::GENERAL_BAGS_END - 19 && server_slot <= EmuConstants::GENERAL_BAGS_END) + return server_slot + 10; + else + return server_slot; + } + */ +} + +uint16 Corpse::CorpseToServerSlot(uint16 corpse_slot) +{ + return corpse_slot; // temporary return + + /* + switch (corpse_slot) + { + case 9999: + return MainPowerSource; + case 9997: + return MainGeneral9; + case 9998: + return MainGeneral10; + case 30: + return MainCursor; + case 21: // old SLOT_AMMO + case 22: // old PERSONAL_BEGIN + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: // old PERSONAL_END + return corpse_slot + 1; + default: + if (corpse_slot >= 331 && corpse_slot <= 340) + return corpse_slot + 20; + else if (corpse_slot >= 341 && corpse_slot <= 360) + return corpse_slot - 10; + else + return corpse_slot; + } + */ } -*/ /* void Corpse::CastRezz(uint16 spellid, Mob* Caster){ diff --git a/zone/corpse.h b/zone/corpse.h index e76b3b4ce..773ca3782 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -112,8 +112,8 @@ public: inline int GetRezzExp() { return rezzexp; } // these are a temporary work-around until corpse inventory is removed from the database blob - //static uint32 ServerToCorpseSlot(int16 server_slot); // encode - //static int16 CorpseToServerSlot(uint32 corpse_slot); // decode + static uint16 ServerToCorpseSlot(uint16 server_slot); // encode + static uint16 CorpseToServerSlot(uint16 corpse_slot); // decode protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); From 8ff4e59d205c33e32c821fb95495d2f580d17de2 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 5 Oct 2014 07:51:20 -0400 Subject: [PATCH 0078/1883] Fix to allow regular runes to absorn spell damage (except dots). --- zone/attack.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index feb10369f..a7a50a6cd 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3315,7 +3315,10 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(damage < 1) return 0; - + + //Regular runes absorb spell damage (except dots) - Confirmed on live. + if (spellbonuses.MeleeRune[0] && spellbonuses.MeleeRune[1] >= 0) + damage = RuneAbsorb(damage, SE_Rune); if (spellbonuses.AbsorbMagicAtt[0] && spellbonuses.AbsorbMagicAtt[1] >= 0) damage = RuneAbsorb(damage, SE_AbsorbMagicAtt); From 3ad7ab625d21de81cc1c7aa3d51b6646f99e2860 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 14:45:26 -0400 Subject: [PATCH 0079/1883] Add temp hack for num hits and UF Not sure what I screwed up, could of sworn it was working right before, but that was also 3 AM or something Rewrote UF's OP_BuffCreate to use the Write* functions which are a bit more straight forward --- common/patches/underfoot.cpp | 28 ++++++++++------------------ zone/spell_effects.cpp | 3 +++ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 6291d3077..34ef61f6e 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -345,14 +345,10 @@ namespace Underfoot __packet->pBuffer = new unsigned char[sz]; memset(__packet->pBuffer, 0, sz); - uchar *ptr = __packet->pBuffer; - *((uint32*)ptr) = emu->entity_id; - ptr += sizeof(uint32); - ptr += sizeof(uint32); - *((uint8*)ptr) = emu->all_buffs; - ptr += sizeof(uchar); - *((uint16*)ptr) = emu->count; - ptr += sizeof(uint16); + __packet->WriteUInt32(emu->entity_id); + __packet->WriteUInt32(0); + __packet->WriteUInt8(emu->all_buffs); // 1 = all buffs, 0 = 1 buff + __packet->WriteUInt16(emu->count); for (uint16 i = 0; i < emu->count; ++i) { @@ -366,17 +362,13 @@ namespace Underfoot buffslot += 14; } - *((uint32*)ptr) = buffslot; - ptr += sizeof(uint32); - *((uint32*)ptr) = emu->entries[i].spell_id; - ptr += sizeof(uint32); - *((uint32*)ptr) = emu->entries[i].tics_remaining; - ptr += sizeof(uint32); - *((uint32*)ptr) = emu->entries[i].num_hits; - ptr += sizeof(uint32); - *((uint8*)ptr) = !emu->all_buffs; - ptr += 1; + __packet->WriteUInt32(buffslot); + __packet->WriteUInt32(emu->entries[i].spell_id); + __packet->WriteUInt32(emu->entries[i].tics_remaining); + __packet->WriteUInt32(emu->entries[i].num_hits); + __packet->WriteString(""); } + __packet->WriteUInt8(!emu->all_buffs); FINISH_ENCODE(); /* diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index f86f43bf4..0ce0c8834 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3396,6 +3396,9 @@ void Mob::BuffProcess() if(buffs[buffs_i].UpdateClient == true) { CastToClient()->SendBuffDurationPacket(buffs[buffs_i]); + // Hack to get UF to play nicer, RoF seems fine without it + if (CastToClient()->GetClientVersion() == EQClientUnderfoot) + CastToClient()->SendBuffNumHitPacket(buffs[buffs_i], buffs_i); buffs[buffs_i].UpdateClient = false; } } From 5be8e710a91f0f4cb80f9c1851b1a7813b5985d2 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 15:15:17 -0400 Subject: [PATCH 0080/1883] More restrictive on the temp hack for UF (only spells with numhits) --- zone/spell_effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 0ce0c8834..b634ca4a3 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3397,7 +3397,7 @@ void Mob::BuffProcess() { CastToClient()->SendBuffDurationPacket(buffs[buffs_i]); // Hack to get UF to play nicer, RoF seems fine without it - if (CastToClient()->GetClientVersion() == EQClientUnderfoot) + if (CastToClient()->GetClientVersion() == EQClientUnderfoot && buffs[buffs_i].numhits > 0) CastToClient()->SendBuffNumHitPacket(buffs[buffs_i], buffs_i); buffs[buffs_i].UpdateClient = false; } From 1261c228a32e1fe888da4f3c9d8885039b5dd31f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 16:13:13 -0400 Subject: [PATCH 0081/1883] Call CalcBonuses for RoF+ augments --- zone/client_packet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2ef62c3d3..7edd9202b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3111,6 +3111,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) DeleteItemInInventory(MainCursor, 0, true); if (PutItemInInventory(slot_id, *itemOneToPush, true)) { + CalcBonuses(); //Message(13, "Sucessfully added an augment to your item!"); return; } @@ -3185,6 +3186,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) if (PutItemInInventory(MainCursor, *itemTwoToPush, true)) { + CalcBonuses(); //Message(15, "Successfully removed an augmentation!"); } } From 66448feece908edc040ffc5e07f720761eaacdaa Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 5 Oct 2014 21:42:33 -0400 Subject: [PATCH 0082/1883] Some updates to #command information. --- zone/command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 2844e9daf..2d7a13943 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -370,7 +370,7 @@ int command_init(void) { command_add("opcode","- opcode management",250,command_opcode) || command_add("logs","[status|normal|error|debug|quest|all] - Subscribe to a log type",250,command_logs) || command_add("nologs","[status|normal|error|debug|quest|all] - Unsubscribe to a log type",250,command_nologs) || - command_add("ban","[name] - Ban by character name",150,command_ban) || + command_add("ban","[name] [reason]- Ban by character name",150,command_ban) || command_add("suspend","[name][days] - Suspend by character name and for specificed number of days",150,command_suspend) || command_add("ipban","[IP address] - Ban IP by character name",200,command_ipban) || command_add("oocmute","[1/0] - Mutes OOC chat",200,command_oocmute) || @@ -382,7 +382,7 @@ int command_init(void) { command_add("npcshout","[message] - Make your NPC target shout a message.",150,command_npcshout) || command_add("timers","- Display persistent timers for target",200,command_timers) || command_add("hp","- Refresh your HP bar from the server.",0,command_hp) || - command_add("pf","- ",0,command_pf) || + command_add("pf","- Display additional mob coordinate and wandering data",0,command_pf) || command_add("logsql","- enable SQL logging",200,command_logsql) || command_add("bestz","- Ask map for a good Z coord for your x,y coords.",0,command_bestz) || command_add("ginfo","- get group info on target.",20,command_ginfo) || From cab41487d533e64d52b76a72158460c69fb87b67 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Oct 2014 22:47:57 -0400 Subject: [PATCH 0083/1883] Stop the book showing up while inspecting charms with RoF Stat display still broken sadly --- common/patches/rof.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index a107a1246..5fb0f9eed 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2628,7 +2628,7 @@ namespace RoF else eq->window = emu->window; OUT(type); - eq->invslot = 0; // Set to hard 0 since it's not required for the structure to work + OUT(invslot); strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile)); FINISH_ENCODE(); @@ -4497,7 +4497,7 @@ namespace RoF SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct); IN(type); - emu->invslot = 0; // Set to hard 0 since it's not required for the structure to work + IN(invslot); emu->window = (uint8)eq->window; strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile)); From 2bee9067845c3245692bbf86f3f17efd0cebcc8c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 6 Oct 2014 01:30:01 -0400 Subject: [PATCH 0084/1883] Slay Undead to String IDs (and better filtering) --- zone/attack.cpp | 24 +++++++++++++----------- zone/string_ids.h | 2 ++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index a7a50a6cd..0b8cf07f1 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4203,24 +4203,26 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack } #endif //BOTS - float critChance = 0.0f; bool IsBerskerSPA = false; //1: Try Slay Undead - if(defender && defender->GetBodyType() == BT_Undead || defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire){ - + if (defender && (defender->GetBodyType() == BT_Undead || + defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire)) { int16 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0]; - if (SlayRateBonus) { - - critChance += (float(SlayRateBonus)/100.0f); - critChance /= 100.0f; - - if(MakeRandomFloat(0, 1) < critChance){ + float slayChance = static_cast(SlayRateBonus) / 10000.0f; + if (MakeRandomFloat(0, 1) < slayChance) { int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; - damage = (damage*SlayDmgBonus*2.25)/100; - entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s cleanses %s target!(%d)", GetCleanName(), this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its", damage); + damage = (damage * SlayDmgBonus * 2.25) / 100; + if (GetGender() == 1) // female + entity_list.FilteredMessageClose_StringID(this, false, 200, + MT_CritMelee, FilterMeleeCrits, FEMALE_SLAYUNDEAD, + GetCleanName(), itoa(damage)); + else // males and neuter I guess + entity_list.FilteredMessageClose_StringID(this, false, 200, + MT_CritMelee, FilterMeleeCrits, MALE_SLAYUNDEAD, + GetCleanName(), itoa(damage)); return; } } diff --git a/zone/string_ids.h b/zone/string_ids.h index 56e1c4043..41e0960b0 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -163,6 +163,8 @@ #define CANNOT_WAKE 555 //%1 tells you, 'I am unable to wake %2, master.' #define GUILD_NAME_IN_USE 711 //You cannot create a guild with that name, that guild already exists on this server. #define GM_GAINXP 1002 //[GM] You have gained %1 AXP and %2 EXP (%3). +#define MALE_SLAYUNDEAD 1007 //%1's holy blade cleanses his target!(%2) +#define FEMALE_SLAYUNDEAD 1008 //%1's holy blade cleanses her target!(%2) #define FINISHING_BLOW 1009 //%1 scores a Finishing Blow!! #define ASSASSINATES 1016 //%1 ASSASSINATES their victim!! #define CRIPPLING_BLOW 1021 //%1 lands a Crippling Blow!(%2) From 0438042844709c429a50c0c69e3cce1cb9c035e4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 09:02:13 -0700 Subject: [PATCH 0085/1883] GeneralQueryReceive converted to QueryDatabase --- queryserv/database.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/queryserv/database.cpp b/queryserv/database.cpp index f2dfebb56..4f7fdf10f 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -349,17 +349,16 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { /* These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again */ - char *Query = nullptr; - Query = new char[pack->ReadUInt32() + 1]; - pack->ReadString(Query); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - uint32 lastid = 0; - if (!RunQuery(query, MakeAnyLenString(&query, Query), errbuf, 0, 0, &lastid)) { - _log(QUERYSERV__ERROR, "Failed Delete Log Record Insert: %s", errbuf); - _log(QUERYSERV__ERROR, "%s", query); + char *queryBuffer = new char[pack->ReadUInt32() + 1]; + pack->ReadString(queryBuffer); + + std::string query(queryBuffer); + auto results = QueryDatabase(query); + if (!results.Success()) { + _log(QUERYSERV__ERROR, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + _log(QUERYSERV__ERROR, "%s", query.c_str()); } - safe_delete_array(query); + safe_delete(pack); - safe_delete(Query); + safe_delete(queryBuffer); } From 787008171649a3f4ed3538d1d42cbcb9de467a9a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 09:21:39 -0700 Subject: [PATCH 0086/1883] SaveGroupLeaderAA converted to QueryDatabase --- zone/groups.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 6c0200250..f0cdb71de 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -561,6 +561,18 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) } } + /* This may seem pointless but the case above does not cover the following situation: + * Group has Leader a, member b, member c + * b and c are out of zone + * a disconnects/quits + * b or c zone back in and disconnects/quits + * a is still "leader" from GetLeader()'s perspective and will crash the zone when we DelMember(b) + * Ultimately we should think up a better solution to this. + */ + if(oldmember == GetLeader()) { + SetLeader(nullptr); + } + ServerPacket* pack = new ServerPacket(ServerOP_GroupLeave, sizeof(ServerGroupLeave_Struct)); ServerGroupLeave_Struct* gl = (ServerGroupLeave_Struct*)pack->pBuffer; gl->gid = GetID(); @@ -1880,22 +1892,17 @@ void Group::SaveGroupLeaderAA() { // Stores the Group Leaders Leadership AA data from the Player Profile as a blob in the group_leaders table. // This is done so that group members not in the same zone as the Leader still have access to this information. + char *queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; + database.DoEscapeString(queryBuffer, (char*)&LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); - char *Query = new char[200 + sizeof(GroupLeadershipAA_Struct)*2]; + std::string query = "UPDATE group_leaders SET leadershipaa = '"; + query += queryBuffer; + query += StringFormat("' WHERE gid = %i LIMIT 1", GetID()); + safe_delete_array(queryBuffer); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); - char *End = Query; - - End += sprintf(End, "UPDATE group_leaders SET leadershipaa='"); - - End += database.DoEscapeString(End, (char*)&LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); - - End += sprintf(End,"' WHERE gid=%i LIMIT 1", GetID()); - - char errbuff[MYSQL_ERRMSG_SIZE]; - if (!database.RunQuery(Query, End - Query, errbuff)) - LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", errbuff); - - safe_delete_array(Query); } void Group::UnMarkNPC(uint16 ID) From 9183541825200061d1d0dd2d19b67d192049d881 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 09:58:21 -0700 Subject: [PATCH 0087/1883] AddMember converted to QueryDatabase --- zone/raids.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 84ebcee7d..84b6bba12 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -74,14 +74,14 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo if(!c) return; - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_members SET raidid=%lu, charid=%lu, groupid=%lu, _class=%d, level=%d, name='%s', isgroupleader=%d, israidleader=%d, islooter=%d", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter ),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("INSERT INTO raid_members SET raidid = %lu, charid = %lu, " + "groupid = %lu, _class = %d, level = %d, name = '%s', " + "isgroupleader = %d, israidleader = %d, islooter = %d", + (unsigned long)GetID(), (unsigned long)c->CharacterID(), + (unsigned long)group, c->GetClass(), c->GetLevel(), + c->GetName(), groupleader, rleader, looter); + auto results = database.QueryDatabase(query); - safe_delete_array(query); LearnMembers(); VerifyRaid(); if(group < 12) @@ -514,7 +514,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 int dmgtaken = 0, numMem = 0, dmgtaken_tmp = 0; int gi = 0; - + float distance; float range2 = range*range; @@ -567,7 +567,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, int32 range, Mob* caster, int3 if (!range) range = 200; - + float distance; float range2 = range*range; From 5781821ab341185c4b5ab598a46cce062da42e7b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 10:12:00 -0700 Subject: [PATCH 0088/1883] RemoveMember converted to QueryDatabase --- zone/raids.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 84b6bba12..d9dd20e96 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -100,32 +100,26 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo safe_delete(pack); } -void Raid::RemoveMember(const char *c) +void Raid::RemoveMember(const char *characterName) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members where name='%s'", c ),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("DELETE FROM raid_members where name='%s'", characterName); + auto results = database.QueryDatabase(query); - Client *m = entity_list.GetClientByName(c); - safe_delete_array(query); + Client *client = entity_list.GetClientByName(characterName); disbandCheck = true; - SendRaidRemoveAll(c); - SendRaidDisband(m); + SendRaidRemoveAll(characterName); + SendRaidDisband(client); LearnMembers(); VerifyRaid(); - if(m){ - m->SetRaidGrouped(false); - } + if(client) + client->SetRaidGrouped(false); ServerPacket *pack = new ServerPacket(ServerOP_RaidRemove, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); rga->instance_id = zone->GetInstanceID(); - strn0cpy(rga->playername, c, 64); + strn0cpy(rga->playername, characterName, 64); rga->zoneid = zone->GetZoneID(); worldserver.SendPacket(pack); safe_delete(pack); From 73b29877001d93e823846ba463e339f437d3f74f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 10:47:16 -0700 Subject: [PATCH 0089/1883] DisbandRaid converted to QueryDatabase --- zone/raids.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index d9dd20e96..4d421f6b9 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -127,14 +127,9 @@ void Raid::RemoveMember(const char *characterName) void Raid::DisbandRaid() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "DELETE FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("DELETE FROM raid_members WHERE raidid = %lu", (unsigned long)GetID()); + auto results = database.QueryDatabase(query); - safe_delete_array(query); LearnMembers(); VerifyRaid(); SendRaidDisbandAll(); From dfcddac2ef3e553174dcff82e112fc34c2f7f067 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 10:53:20 -0700 Subject: [PATCH 0090/1883] MoveMember converted to QueryDatabase --- zone/raids.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 4d421f6b9..4dee9d094 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -148,14 +148,10 @@ void Raid::DisbandRaid() void Raid::MoveMember(const char *name, uint32 newGroup) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET groupid=%lu WHERE name='%s'", (unsigned long)newGroup, name),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("UPDATE raid_members SET groupid = %lu WHERE name = '%s'", + (unsigned long)newGroup, name); + auto results = database.QueryDatabase(query); - safe_delete_array(query); LearnMembers(); VerifyRaid(); SendRaidMoveAll(name); From 11e08c9b67f199868ddc47cbd967057fc63e98ad Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 10:55:04 -0700 Subject: [PATCH 0091/1883] SetGroupleader converted to QueryDatabase --- zone/raids.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 4dee9d094..9298f9b0b 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -168,21 +168,13 @@ void Raid::MoveMember(const char *name, uint32 newGroup) void Raid::SetGroupLeader(const char *who, bool glFlag) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET isgroupleader=%lu WHERE name='%s'", (unsigned long)glFlag, who),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("UPDATE raid_members SET isgroupleader = %lu WHERE name = '%s'", + (unsigned long)glFlag, who); + auto results = database.QueryDatabase(query); - safe_delete_array(query); LearnMembers(); VerifyRaid(); - //if(glFlag == true){ //we're setting the flag - //this->SendMakeGroupLeaderPacket(who); - //} - ServerPacket *pack = new ServerPacket(ServerOP_RaidGroupLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); From 7a3f7602a58a0048b8d3dfb7d3e7bb0abd181fdb Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 10:59:59 -0700 Subject: [PATCH 0092/1883] SetRaidLeader converted to QueryDatabase --- zone/raids.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 9298f9b0b..f29010642 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -187,25 +187,15 @@ void Raid::SetGroupLeader(const char *who, bool glFlag) void Raid::SetRaidLeader(const char *wasLead, const char *name) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET israidleader=0 WHERE name='%s'", wasLead),errbuf,&result)){ - printf("Set Raid Leader error: %s\n", errbuf); - } - else - mysql_free_result(result); + std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); + auto results = database.QueryDatabase(query); + if (!results.Success()) + printf("Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); - safe_delete_array(query); - query = 0; - - if (!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET israidleader=1 WHERE name='%s'", name),errbuf,&result)){ - printf("Set Raid Leader error: %s\n", errbuf); - } - else - mysql_free_result(result); - - safe_delete_array(query); + query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); + results = database.QueryDatabase(query); + if (!results.Success()) + printf("Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); From 8553278759a56633485a47a59130a0492be98ca7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:02:17 -0700 Subject: [PATCH 0093/1883] UpdateLevel converted to QueryDatabase --- zone/raids.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index f29010642..33c1f1a06 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -231,14 +231,10 @@ bool Raid::IsGroupLeader(const char *who) void Raid::UpdateLevel(const char *name, int newLevel) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET level=%lu WHERE name='%s'", (unsigned long)newLevel, name),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("UPDATE raid_members SET level = %lu WHERE name = '%s'", + (unsigned long)newLevel, name); + auto results = database.QueryDatabase(query); - safe_delete_array(query); LearnMembers(); VerifyRaid(); } From b0d358cda81b050d37678ca71b09619f05798c88 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:06:43 -0700 Subject: [PATCH 0094/1883] AddRaidLooter converted to QueryDatabase --- zone/raids.cpp | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 33c1f1a06..c9d3fbb3c 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -738,27 +738,16 @@ void Raid::TeleportRaid(Mob* sender, uint32 zoneID, uint16 instance_id, float x, void Raid::ChangeLootType(uint32 type) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET loottype=%lu WHERE raidid=%lu", (unsigned long)type, (unsigned long)GetID()),errbuf,&result)){ - mysql_free_result(result); - } - - safe_delete_array(query); + std::string query = StringFormat("UPDATE raid_details SET loottype = %lu WHERE raidid = %lu", + (unsigned long)type, (unsigned long)GetID()); + auto results = database.QueryDatabase(query); LootType = type; } void Raid::AddRaidLooter(const char* looter) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET islooter=1 WHERE name='%s'", looter),errbuf,&result)){ - mysql_free_result(result); - } - - safe_delete_array(query); + std::string query = StringFormat("UPDATE raid_members SET islooter = 1 WHERE name = '%s'", looter); + auto results = database.QueryDatabase(query); for(int x = 0; x < MAX_RAID_MEMBERS; x++) { @@ -775,15 +764,6 @@ void Raid::AddRaidLooter(const char* looter) rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); - - /* For reference only at this time. This code adds a looter to the Raid Options Window. - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rgs = (RaidGeneral_Struct*)outapp->pBuffer; - rgs->action = 33; - strcpy(rgs->leader_name, looter); - QueuePacket(outapp); - safe_delete(outapp); */ } void Raid::RemoveRaidLooter(const char* looter) From b66b7a5fd26608245e0c3895d0faf433beec12ec Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:10:27 -0700 Subject: [PATCH 0095/1883] RemoveTaidLooter converted to QueryDatabase --- zone/raids.cpp | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index c9d3fbb3c..3790898f8 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -768,23 +768,15 @@ void Raid::AddRaidLooter(const char* looter) void Raid::RemoveRaidLooter(const char* looter) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET islooter=0 WHERE name='%s'", looter),errbuf,&result)){ - mysql_free_result(result); - } - - safe_delete_array(query); + std::string query = StringFormat("UPDATE raid_members SET islooter = 0 WHERE name = '%s'", looter); + auto results = database.QueryDatabase(query); for(int x = 0; x < MAX_RAID_MEMBERS; x++) - { - if(strcmp(looter, members[x].membername) == 0) - { + if(strcmp(looter, members[x].membername) == 0) { members[x].IsLooter = 0; break; } - } + ServerPacket *pack = new ServerPacket(ServerOP_DetailsChange, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); @@ -792,15 +784,6 @@ void Raid::RemoveRaidLooter(const char* looter) rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); - - /* For reference only at this time. This code removes a looter from the Raid Options Window. - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rgs = (RaidGeneral_Struct*)outapp->pBuffer; - rgs->action = 34; - strcpy(rgs->leader_name, looter); - QueuePacket(outapp); - safe_delete(outapp); */ } bool Raid::IsRaidMember(const char *name){ From 67c8949cd48db95287194dc4afd713d04cf122bf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:14:02 -0700 Subject: [PATCH 0096/1883] LockRaid converted to QueryDatabase --- zone/raids.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 3790898f8..648b6b418 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1207,14 +1207,10 @@ void Raid::SendRaidGroupRemove(const char *who, uint32 gid) void Raid::LockRaid(bool lockFlag) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_details SET locked=%d WHERE raidid=%lu", lockFlag, (unsigned long)GetID()),errbuf,&result)){ - mysql_free_result(result); - } + std::string query = StringFormat("UPDATE raid_details SET locked = %d WHERE raidid = %lu", + lockFlag, (unsigned long)GetID()); + auto results = database.QueryDatabase(query); - safe_delete_array(query); locked = lockFlag; if(lockFlag) SendRaidLock(); From 77cfd116e0bf12ccdf2bfccd999e94b06e7b3723 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:15:45 -0700 Subject: [PATCH 0097/1883] SetRaidDetails converted to QueryDatabase --- zone/raids.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 648b6b418..35829cdf8 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1229,14 +1229,9 @@ void Raid::LockRaid(bool lockFlag) void Raid::SetRaidDetails() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - if (database.RunQuery(query,MakeAnyLenString(&query, "INSERT INTO raid_details SET raidid=%lu, loottype=4, locked=0", (unsigned long)GetID()),errbuf,&result)){ - mysql_free_result(result); - } - - safe_delete_array(query); + std::string query = StringFormat("INSERT INTO raid_details SET raidid = %lu, loottype = 4, locked = 0", + (unsigned long)GetID()); + auto results = database.QueryDatabase(query); } void Raid::GetRaidDetails() From 4b1d3592d489b39e7d6a7b0cc5c1899a4e4d47b7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:21:20 -0700 Subject: [PATCH 0098/1883] GetRaidDetails converted to QueryDatabase --- zone/raids.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 35829cdf8..49e529ebe 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1236,24 +1236,21 @@ void Raid::SetRaidDetails() void Raid::GetRaidDetails() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT locked, loottype FROM raid_details WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ - safe_delete_array(query); - if(mysql_num_rows(result) < 1) { - mysql_free_result(result); - LogFile->write(EQEMuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), errbuf); - return; - } - row = mysql_fetch_row(result); - if(row){ - locked = atoi(row[0]); - LootType = atoi(row[1]); - } - mysql_free_result(result); - } + std::string query = StringFormat("SELECT locked, loottype FROM raid_details WHERE raidid = %lu", + (unsigned long)GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + return; + + if (results.RowCount() == 0) { + LogFile->write(EQEMuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + return; + } + + auto row = results.begin(); + + locked = atoi(row[0]); + LootType = atoi(row[1]); } bool Raid::LearnMembers() From a90babbae1be3abb21f9fc00a96fa98a58fd1956 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:26:03 -0700 Subject: [PATCH 0099/1883] LearnMembers converted to QueryDatabase --- zone/raids.cpp | 70 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 49e529ebe..1e8e23f8d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1256,39 +1256,43 @@ void Raid::GetRaidDetails() bool Raid::LearnMembers() { memset(members, 0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT name, groupid, _class, level, isgroupleader, israidleader, islooter FROM raid_members WHERE raidid=%lu", (unsigned long)GetID()),errbuf,&result)){ - safe_delete_array(query); - if(mysql_num_rows(result) < 1) { - mysql_free_result(result); - LogFile->write(EQEMuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), errbuf); - disbandCheck = true; - return(false); - } - int i = 0; - while((row = mysql_fetch_row(result))) { - if(!row[0]) - continue; - members[i].member = nullptr; - strn0cpy(members[i].membername, row[0], 64); - int GroupNum = atoi(row[1]); - if(GroupNum > 11) - members[i].GroupNumber = 0xFFFFFFFF; - else - members[i].GroupNumber = GroupNum; - members[i]._class = atoi(row[2]); - members[i].level = atoi(row[3]); - members[i].IsGroupLeader = atoi(row[4]); - members[i].IsRaidLeader = atoi(row[5]); - members[i].IsLooter = atoi(row[6]); - i++; - } - mysql_free_result(result); - } - return(true); + + std::string query = StringFormat("SELECT name, groupid, _class, level, " + "isgroupleader, israidleader, islooter " + "FROM raid_members WHERE raidid = %lu", + (unsigned long)GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + return false; + + if(results.RowCount() == 0) { + LogFile->write(EQEMuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + disbandCheck = true; + return false; + } + + int index = 0; + for(auto row = results.begin(); row != results.end(); ++row) { + if(!row[0]) + continue; + + members[index].member = nullptr; + strn0cpy(members[index].membername, row[0], 64); + int groupNum = atoi(row[1]); + if(groupNum > 11) + members[index].GroupNumber = 0xFFFFFFFF; + else + members[index].GroupNumber = groupNum; + + members[index]._class = atoi(row[2]); + members[index].level = atoi(row[3]); + members[index].IsGroupLeader = atoi(row[4]); + members[index].IsRaidLeader = atoi(row[5]); + members[index].IsLooter = atoi(row[6]); + ++index; + } + + return true; } void Raid::VerifyRaid() From be7d2e9457ec56f999faa6c7259b4828cbd7328f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:36:42 -0700 Subject: [PATCH 0100/1883] LoadTaskSets converted to QueryDatabase --- zone/tasks.cpp | 57 +++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 3da32c03c..ea7febd0b 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -60,41 +60,32 @@ TaskManager::~TaskManager() { } bool TaskManager::LoadTaskSets() { - const char *TaskSetQuery = "SELECT `id`, `taskid` from `tasksets` WHERE `id` > 0 AND `id` < %i " - "AND `taskid` >= 0 AND `taskid` < %i ORDER BY `id`, `taskid` ASC"; - const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::LoadTaskSets: %s"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; // Clear all task sets in memory. Done so we can reload them on the fly if required by just calling // this method again. - for(int i=0; iwrite(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT `id`, `taskid` from `tasksets` " + "WHERE `id` > 0 AND `id` < %i " + "AND `taskid` >= 0 AND `taskid` < %i " + "ORDER BY `id`, `taskid` ASC", + MAXTASKSETS, MAXTASKS); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; - } + } + + for (auto row = results.begin(); row != results.end(); ++row) { + int taskSet = atoi(row[0]); + int taskID = atoi(row[1]); + + TaskSets[taskSet].push_back(taskID); + _log(TASKS__GLOBALLOAD, "Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + } return true; - } bool TaskManager::LoadSingleTask(int TaskID) { @@ -1152,7 +1143,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task if(Tasks[TaskList[i]] != nullptr) break; } - // FIXME: The 10 and 5 values in this calculation are to account for the string "ABCD" we are putting in 3 times. + // FIXME: The 10 and 5 values in this calculation are to account for the string "ABCD" we are putting in 3 times. // // Calculate how big the packet needs to be pased on the number of tasks and the // size of the variable length strings. @@ -1230,9 +1221,9 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task // FIXME: In live packets, these two strings appear to be the same as the Text1 and Text2 // strings from the first activity in the task, however the task chooser/selector // does not appear to make use of them. - sprintf(Ptr, "ABCD"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; - sprintf(Ptr, "ABCD"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; AvailableTaskTrailer = (AvailableTaskTrailer_Struct*)Ptr; @@ -1247,7 +1238,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task // In some packets, this next string looks like a short task summary, however it doesn't // appear anywhere in the client window. - sprintf(Ptr, "ABCD"); + sprintf(Ptr, "ABCD"); Ptr = Ptr + strlen(Ptr) + 1; } @@ -1979,7 +1970,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T taskmanager->SendSingleActiveTaskToClient(c, TaskIndex, TaskComplete, false); // Inform the client the task has been updated, both by a chat message c->Message(0, "Your task '%s' has been updated.", Task->Title); - + if(Task->Activity[ActivityID].GoalMethod != METHODQUEST) { char buf[24]; snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID); @@ -1992,7 +1983,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T QServ->PlayerLogEvent(Player_Log_Task_Updates, c->CharacterID(), event_desc); } } - + // If this task is now complete, the Completed tasks will have been // updated in UnlockActivities. Send the completed task list to the // client. This is the same sequence the packets are sent on live. From 48299b6024901c43a32f3c492922938aaa14fbc5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 7 Oct 2014 11:56:38 -0700 Subject: [PATCH 0101/1883] LoadTasks converted to QueryDatabase --- zone/tasks.cpp | 330 +++++++++++++++++++++++-------------------------- 1 file changed, 152 insertions(+), 178 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index ea7febd0b..00749a454 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -117,203 +117,177 @@ void TaskManager::ReloadGoalLists() { _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadLists failed"); } -bool TaskManager::LoadTasks(int SingleTask) { +bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - - const char *AllTaskQuery = "SELECT `id`, `duration`, `title`, `description`, `reward`, `rewardid`," - "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " - "from `tasks` WHERE `id` < %i"; - - const char *SingleTaskQuery = "SELECT `id`, `duration`, `title`, `description`, `reward`, `rewardid`," - "`cashreward`, `xpreward`, `rewardmethod`, `startzone`, `minlevel`, `maxlevel`, `repeatable` " - "from `tasks` WHERE `id` = %i"; - - const char *AllActivityQuery = "SELECT `taskid`, `step`, `activityid`, `activitytype`, `text1`, `text2`," - "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " - "`zoneid`, `optional` from `activities` WHERE " - "`taskid` < %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; - - const char *SingleTaskActivityQuery = "SELECT `taskid`, `step`, `activityid`, `activitytype`, `text1`, `text2`," - "`text3`, `goalid`, `goalmethod`, `goalcount`, `delivertonpc`, " - "`zoneid`, `optional` from `activities` WHERE " - "`taskid` = %i AND `activityid` < %i ORDER BY taskid, activityid ASC"; - - const char *ERR_TASK_OOR = "[TASKS]Task ID %i out of range while loading tasks from database"; - - const char *ERR_TASK_OR_ACTIVITY_OOR = "[TASKS]Task or Activity ID (%i, %i) out of range while loading" - "activities from database"; - - const char *ERR_NOTASK = "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database"; - - const char *ERR_SEQERR = "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task."; - - const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::LoadTasks: %s"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - int QueryLength = 0; - MYSQL_RES *result; - MYSQL_ROW row; - _log(TASKS__GLOBALLOAD, "TaskManager::LoadTasks Called"); - if(SingleTask == 0) { + std::string query; + if(singleTask == 0) { if(!GoalListManager.LoadLists()) _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadTaskSets failed"); - QueryLength = MakeAnyLenString(&query,AllTaskQuery,MAXTASKS); + query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " + "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " + "`startzone`, `minlevel`, `maxlevel`, `repeatable` " + "FROM `tasks` WHERE `id` < %i", MAXTASKS); } else - QueryLength = MakeAnyLenString(&query,SingleTaskQuery,SingleTask); + query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " + "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " + "`startzone`, `minlevel`, `maxlevel`, `repeatable` " + "FROM `tasks` WHERE `id` = %i",singleTask); - if(database.RunQuery(query,QueryLength,errbuf,&result)) { + const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::LoadTasks: %s"; - while((row = mysql_fetch_row(result))) { - int TaskID = atoi(row[0]); - if((TaskID <= 0) || (TaskID >= MAXTASKS)) { - // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEMuLog::Error, ERR_TASK_OOR, TaskID); - continue; - } - Tasks[TaskID] = new TaskInformation; - Tasks[TaskID]->Duration = atoi(row[1]); - Tasks[TaskID]->Title = new char[strlen(row[2]) + 1]; - strcpy(Tasks[TaskID]->Title, row[2]); - Tasks[TaskID]->Description = new char[strlen(row[3]) + 1]; - strcpy(Tasks[TaskID]->Description, row[3]); - Tasks[TaskID]->Reward = new char[strlen(row[4]) + 1]; - strcpy(Tasks[TaskID]->Reward, row[4]); - Tasks[TaskID]->RewardID = atoi(row[5]); - Tasks[TaskID]->CashReward = atoi(row[6]); - Tasks[TaskID]->XPReward = atoi(row[7]); - Tasks[TaskID]->RewardMethod = (TaskMethodType)atoi(row[8]); - Tasks[TaskID]->StartZone = atoi(row[9]); - Tasks[TaskID]->MinLevel = atoi(row[10]); - Tasks[TaskID]->MaxLevel = atoi(row[11]); - Tasks[TaskID]->Repeatable = atoi(row[12]); - Tasks[TaskID]->ActivityCount = 0; - Tasks[TaskID]->SequenceMode = ActivitiesSequential; - Tasks[TaskID]->LastStep = 0; - - _log(TASKS__GLOBALLOAD,"TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", - TaskID, Tasks[TaskID]->Duration, Tasks[TaskID]->StartZone, Tasks[TaskID]->Reward, - Tasks[TaskID]->MinLevel, Tasks[TaskID]->MaxLevel, - Tasks[TaskID]->Repeatable ? "Yes" : "No"); - _log(TASKS__GLOBALLOAD,"Title: %s ", Tasks[TaskID]->Title); - //_log(TASKS__GLOBALLOAD,"Description: %s ", Tasks[TaskID]->Description); - - } - mysql_free_result(result); - safe_delete_array(query); - - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - safe_delete_array(query); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; - } + } - if(SingleTask==0) - QueryLength = MakeAnyLenString(&query,AllActivityQuery,MAXTASKS, MAXACTIVITIESPERTASK); + for(auto row = results.begin(); row != results.end(); ++row) { + int taskID = atoi(row[0]); + + if((taskID <= 0) || (taskID >= MAXTASKS)) { + // This shouldn't happen, as the SELECT is bounded by MAXTASKS + LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + continue; + } + + Tasks[taskID] = new TaskInformation; + Tasks[taskID]->Duration = atoi(row[1]); + Tasks[taskID]->Title = new char[strlen(row[2]) + 1]; + strcpy(Tasks[taskID]->Title, row[2]); + Tasks[taskID]->Description = new char[strlen(row[3]) + 1]; + strcpy(Tasks[taskID]->Description, row[3]); + Tasks[taskID]->Reward = new char[strlen(row[4]) + 1]; + strcpy(Tasks[taskID]->Reward, row[4]); + Tasks[taskID]->RewardID = atoi(row[5]); + Tasks[taskID]->CashReward = atoi(row[6]); + Tasks[taskID]->XPReward = atoi(row[7]); + Tasks[taskID]->RewardMethod = (TaskMethodType)atoi(row[8]); + Tasks[taskID]->StartZone = atoi(row[9]); + Tasks[taskID]->MinLevel = atoi(row[10]); + Tasks[taskID]->MaxLevel = atoi(row[11]); + Tasks[taskID]->Repeatable = atoi(row[12]); + Tasks[taskID]->ActivityCount = 0; + Tasks[taskID]->SequenceMode = ActivitiesSequential; + Tasks[taskID]->LastStep = 0; + + _log(TASKS__GLOBALLOAD,"TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, + Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, + Tasks[taskID]->Repeatable ? "Yes" : "No"); + _log(TASKS__GLOBALLOAD,"Title: %s ", Tasks[taskID]->Title); + } + + + if(singleTask==0) + query = StringFormat("SELECT `taskid`, `step`, `activityid`, `activitytype`, " + "`text1`, `text2`, `text3`, `goalid`, `goalmethod`, " + "`goalcount`, `delivertonpc`, `zoneid`, `optional` " + "FROM `activities` " + "WHERE `taskid` < %i AND `activityid` < %i " + "ORDER BY taskid, activityid ASC", MAXTASKS, MAXACTIVITIESPERTASK); else - QueryLength = MakeAnyLenString(&query,SingleTaskActivityQuery, SingleTask, MAXACTIVITIESPERTASK); - - if(database.RunQuery(query,QueryLength, errbuf, &result)) { - - while((row = mysql_fetch_row(result))) { - int TaskID = atoi(row[0]); - int Step = atoi(row[1]); - - int ActivityID = atoi(row[2]); - - if((TaskID <= 0) || (TaskID >= MAXTASKS) || (ActivityID < 0) || (ActivityID >= MAXACTIVITIESPERTASK)) { - // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEMuLog::Error, ERR_TASK_OR_ACTIVITY_OOR, TaskID, ActivityID); - continue; - } - if(Tasks[TaskID]==nullptr) { - LogFile->write(EQEMuLog::Error, ERR_NOTASK, TaskID, ActivityID); - continue; - } - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].StepNumber = Step; - - if(Step != 0) - Tasks[TaskID]->SequenceMode = ActivitiesStepped; - - if(Step >Tasks[TaskID]->LastStep) Tasks[TaskID]->LastStep = Step; - - // Task Activities MUST be numbered sequentially from 0. If not, log an error - // and set the task to nullptr. Subsequent activities for this task will raise - // ERR_NOTASK errors. - // Change to (ActivityID != (Tasks[TaskID]->ActivityCount + 1)) to index from 1 - if(ActivityID != Tasks[TaskID]->ActivityCount) { - LogFile->write(EQEMuLog::Error, ERR_SEQERR, TaskID, ActivityID); - Tasks[TaskID] = nullptr; - continue; - } - - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Type = atoi(row[3]); - - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1 = new char[strlen(row[4]) + 1]; - - if(strlen(row[4])>0) - strcpy(Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1, row[4]); - else - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1[0]=0; - - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2 = new char[strlen(row[5]) + 1]; - - if(strlen(row[5])>0) - strcpy(Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2, row[5]); - else - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2[0]=0; - - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3 = new char[strlen(row[6]) + 1]; - - if(strlen(row[6])>0) - strcpy(Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3, row[6]); - else - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3[0]=0; - - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalID = atoi(row[7]); - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalMethod = (TaskMethodType)atoi(row[8]); - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalCount = atoi(row[9]); - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].DeliverToNPC = atoi(row[10]); - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].ZoneID = atoi(row[11]); - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Optional = atoi(row[12]); - - _log(TASKS__GLOBALLOAD, "Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " - "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", - Tasks[TaskID]->ActivityCount, ActivityID, TaskID, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Type, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalID, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalMethod, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].GoalCount, - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].ZoneID); - - _log(TASKS__GLOBALLOAD, " Text1: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text1); - _log(TASKS__GLOBALLOAD, " Text2: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text2); - _log(TASKS__GLOBALLOAD, " Text3: %s", - Tasks[TaskID]->Activity[Tasks[TaskID]->ActivityCount].Text3); - - Tasks[TaskID]->ActivityCount++; - - } - mysql_free_result(result); - safe_delete_array(query); - - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - safe_delete_array(query); + query = StringFormat("SELECT `taskid`, `step`, `activityid`, `activitytype`, " + "`text1`, `text2`, `text3`, `goalid`, `goalmethod`, " + "`goalcount`, `delivertonpc`, `zoneid`, `optional` " + "FROM `activities` " + "WHERE `taskid` = %i AND `activityid` < %i " + "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); + results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; + } + + for(auto row = results.begin(); row != results.end(); ++row) { + int taskID = atoi(row[0]); + int step = atoi(row[1]); + + int activityID = atoi(row[2]); + + if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { + // This shouldn't happen, as the SELECT is bounded by MAXTASKS + LogFile->write(EQEMuLog::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + "activities from database", taskID, activityID); + continue; + } + + if(Tasks[taskID]==nullptr) { + LogFile->write(EQEMuLog::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + continue; + } + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].StepNumber = step; + + if(step != 0) + Tasks[taskID]->SequenceMode = ActivitiesStepped; + + if(step >Tasks[taskID]->LastStep) + Tasks[taskID]->LastStep = step; + + // Task Activities MUST be numbered sequentially from 0. If not, log an error + // and set the task to nullptr. Subsequent activities for this task will raise + // ERR_NOTASK errors. + // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 + if(activityID != Tasks[taskID]->ActivityCount) { + LogFile->write(EQEMuLog::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Tasks[taskID] = nullptr; + continue; + } + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type = atoi(row[3]); + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1 = new char[strlen(row[4]) + 1]; + + if(strlen(row[4])>0) + strcpy(Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1, row[4]); + else + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1[0]=0; + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2 = new char[strlen(row[5]) + 1]; + + if(strlen(row[5])>0) + strcpy(Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2, row[5]); + else + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2[0]=0; + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3 = new char[strlen(row[6]) + 1]; + + if(strlen(row[6])>0) + strcpy(Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3, row[6]); + else + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3[0]=0; + + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalID = atoi(row[7]); + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalMethod = (TaskMethodType)atoi(row[8]); + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount = atoi(row[9]); + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].DeliverToNPC = atoi(row[10]); + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); + + _log(TASKS__GLOBALLOAD, "Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", + Tasks[taskID]->ActivityCount, activityID, taskID, + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalID, + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalMethod, + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, + Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); + + _log(TASKS__GLOBALLOAD, " Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + _log(TASKS__GLOBALLOAD, " Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + _log(TASKS__GLOBALLOAD, " Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + + Tasks[taskID]->ActivityCount++; } + return true; } From 45ef740244093b9682496b058d12080351a70fa1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 7 Oct 2014 19:02:07 -0400 Subject: [PATCH 0102/1883] Fix issue with Return Home button always being available --- world/worlddb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 32c4ada48..97b2a74d5 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -103,7 +103,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (RuleB(World, EnableReturnHomeButton)) { int now = time(nullptr); - if ((now - atoi(row[8])) >= RuleI(World, MinOfflineTimeToReturnHome)) + if ((now - atoi(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome)) cs->gohome[char_num] = 1; } From 6474e1353f9e7ae12dfe3a80a36c91c530d65a4a Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 7 Oct 2014 22:54:12 -0400 Subject: [PATCH 0103/1883] Fix for a few spell triggers using correct resist dif --- zone/mob.cpp | 4 ++-- zone/spell_effects.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 2441ca0bc..8d53d50ef 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3064,7 +3064,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { // If we trigger an effect then its over. if (IsValidSpell(spells[spell_id].base2[i])){ - SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); return true; } } @@ -3083,7 +3083,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) if(MakeRandomInt(0, 100) <= spells[spell_id].base[effect]) { if (IsValidSpell(spells[spell_id].base2[effect])){ - SpellFinished(spells[spell_id].base2[effect], target, 10, 0, -1, spells[spell_id].ResistDiff); + SpellFinished(spells[spell_id].base2[effect], target, 10, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff); return true; //Only trigger once of these per spell effect. } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b634ca4a3..7496a07a5 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2738,7 +2738,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (caster && IsValidSpell(spells[spell_id].base2[i])){ if(MakeRandomInt(0, 100) <= spells[spell_id].base[i]) - caster->SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spell_id].ResistDiff); + caster->SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); } break; } From 2dacb523fc29fec587865cb4aa4a6ed2c7928b70 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 7 Oct 2014 23:40:13 -0400 Subject: [PATCH 0104/1883] Rework OPCharCreate logic with tutorial flag Hopefully resolves issues with toons on Titanium spawning out of bounds when starting in tutorial. Resolves setting home bind to tutorial and being out of bounds. --- changelog.txt | 3 ++ common/eq_packet_structs.h | 2 +- common/patches/client62.cpp | 1 + common/patches/client62_structs.h | 2 +- common/patches/rof.cpp | 9 ++--- common/patches/sod.cpp | 8 ++--- common/patches/sof.cpp | 8 ++--- common/patches/titanium.cpp | 1 + common/patches/titanium_structs.h | 2 +- common/patches/underfoot.cpp | 8 ++--- world/client.cpp | 55 +++++++++++++++++++------------ 11 files changed, 50 insertions(+), 49 deletions(-) diff --git a/changelog.txt b/changelog.txt index ed32c03cd..d00864914 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/07/2014 == +demonstar55: Identified tutorial flag in all charcreate packets, reworked logic to correctly set homes binds + == 10/05/2014 == Uleat: Added Server<->Corpse slot translators needed for re-enumeration (inactive until phased in) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a022626e1..f49c0106c 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -689,7 +689,7 @@ struct CharCreate_Struct /*0076*/ uint32 drakkin_heritage; // added for SoF /*0080*/ uint32 drakkin_tattoo; // added for SoF /*0084*/ uint32 drakkin_details; // added for SoF -/*0088*/ +/*0088*/ uint32 tutorial; }; /* diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index 5afd76bcd..d734a29ec 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -1038,6 +1038,7 @@ namespace Client62 IN(face); IN(eyecolor1); IN(eyecolor2); + IN(tutorial); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h index 24e273682..8c80e34a5 100644 --- a/common/patches/client62_structs.h +++ b/common/patches/client62_structs.h @@ -558,7 +558,7 @@ struct CharCreate_Struct /*0128*/ uint32 face; /*0132*/ uint32 eyecolor1; //its possiable we could have these switched /*0136*/ uint32 eyecolor2; //since setting one sets the other we really can't check -/*0140*/ uint32 unknown140; +/*0140*/ uint32 tutorial; //assumptions are bad! But guessed }; /* diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 5fb0f9eed..db1c5487e 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4036,12 +4036,7 @@ namespace RoF IN(race); IN(class_); IN(deity); - - if (RuleB(World, EnableTutorialButton) && eq->tutorial) - emu->start_zone = RuleI(World, TutorialZoneID); - else - emu->start_zone = eq->start_zone; - + IN(start_zone); IN(haircolor); IN(beard); IN(beardcolor); @@ -4059,7 +4054,7 @@ namespace RoF IN(WIS); IN(INT); IN(CHA); - //IN(tutorial); + IN(tutorial); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 3501e73f0..8c64c479f 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2705,12 +2705,7 @@ namespace SoD IN(hairstyle); IN(gender); IN(race); - - if (RuleB(World, EnableTutorialButton) && eq->tutorial) - emu->start_zone = RuleI(World, TutorialZoneID); - else - emu->start_zone = eq->start_zone; - + IN(start_zone); IN(haircolor); IN(deity); IN(STR); @@ -2723,6 +2718,7 @@ namespace SoD IN(face); IN(eyecolor1); IN(eyecolor2); + IN(tutorial); IN(drakkin_heritage); IN(drakkin_tattoo); IN(drakkin_details); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 80c0cb7cf..5a1d69bf4 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2105,12 +2105,7 @@ namespace SoF IN(hairstyle); IN(gender); IN(race); - - if (RuleB(World, EnableTutorialButton) && eq->tutorial) - emu->start_zone = RuleI(World, TutorialZoneID); - else - emu->start_zone = eq->start_zone; - + IN(start_zone); IN(haircolor); IN(deity); IN(STR); @@ -2123,6 +2118,7 @@ namespace SoF IN(face); IN(eyecolor1); IN(eyecolor2); + IN(tutorial); IN(drakkin_heritage); IN(drakkin_tattoo); IN(drakkin_details); diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 6c2591efe..0366e73d8 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1395,6 +1395,7 @@ namespace Titanium IN(face); IN(eyecolor1); IN(eyecolor2); + IN(tutorial); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 0e74af75e..17beb6479 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -565,7 +565,7 @@ struct CharCreate_Struct /*0064*/ uint32 face; // Could be unknown0076 /*0068*/ uint32 eyecolor1; //its possiable we could have these switched /*0073*/ uint32 eyecolor2; //since setting one sets the other we really can't check -/*0076*/ uint32 unknown0076; // Could be face +/*0076*/ uint32 tutorial; /*0080*/ }; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 34ef61f6e..1caf65bf3 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3007,12 +3007,7 @@ namespace Underfoot IN(hairstyle); IN(gender); IN(race); - - if (RuleB(World, EnableTutorialButton) && eq->tutorial) - emu->start_zone = RuleI(World, TutorialZoneID); - else - emu->start_zone = eq->start_zone; - + IN(start_zone); IN(haircolor); IN(deity); IN(STR); @@ -3025,6 +3020,7 @@ namespace Underfoot IN(face); IN(eyecolor1); IN(eyecolor2); + IN(tutorial); IN(drakkin_heritage); IN(drakkin_tattoo); IN(drakkin_details); diff --git a/world/client.cpp b/world/client.cpp index a373004e1..a8f269be1 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1345,22 +1345,23 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { char startzone[50]={0}; uint32 i; struct in_addr in; - + int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA; in.s_addr = GetIP(); - clog(WORLD__CLIENT,"Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - clog(WORLD__CLIENT,"Name: %s", name); - clog(WORLD__CLIENT,"Race: %d Class: %d Gender: %d Deity: %d Start zone: %d", + clog(WORLD__CLIENT, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + clog(WORLD__CLIENT, "Name: %s", name); + clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone); - clog(WORLD__CLIENT,"STR STA AGI DEX WIS INT CHA Total"); - clog(WORLD__CLIENT,"%3d %3d %3d %3d %3d %3d %3d %3d", + clog(WORLD__CLIENT, "STR STA AGI DEX WIS INT CHA Total"); + clog(WORLD__CLIENT, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - clog(WORLD__CLIENT,"Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - clog(WORLD__CLIENT,"Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - clog(WORLD__CLIENT,"Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + clog(WORLD__CLIENT, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + clog(WORLD__CLIENT, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + clog(WORLD__CLIENT, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + clog(WORLD__CLIENT, "Home: %d Tutorial: %d", cc->start_zone, cc->tutorial); /* Validate the char creation struct */ if(ClientVersionBit & BIT_SoFAndLater) { @@ -1475,22 +1476,34 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { pp.x = pp.y = pp.z = -1; } - if(!pp.binds[0].zoneId) { - pp.binds[0].zoneId = pp.zone_id; - pp.binds[0].x = pp.x; - pp.binds[0].y = pp.y; - pp.binds[0].z = pp.z; - pp.binds[0].heading = pp.heading; + /* Set Home Binds */ + if(!pp.binds[4].zoneId) { + pp.binds[4].zoneId = pp.zone_id; + pp.binds[4].x = pp.x; + pp.binds[4].y = pp.y; + pp.binds[4].z = pp.z; + pp.binds[4].heading = pp.heading; } - /* Set Starting city */ - pp.binds[4] = pp.binds[0]; + /* Overrides if we have the tutorial flag set! */ + if (cc->tutorial && RuleB(World, EnableTutorialButton)) { + pp.zone_id = RuleI(World, TutorialZoneID); + database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); + } + /* Will either be the same as home or tutorial */ + pp.binds[0].zoneId = pp.zone_id; + pp.binds[0].x = pp.x; + pp.binds[0].y = pp.y; + pp.binds[0].z = pp.z; + pp.binds[0].heading = pp.heading; - clog(WORLD__CLIENT,"Current location: %s %0.2f, %0.2f, %0.2f, %0.2f", - database.GetZoneName(pp.zone_id), pp.x, pp.y, pp.z, pp.heading); - clog(WORLD__CLIENT,"Bind location: %s %0.2f, %0.2f, %0.2f", - database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); + clog(WORLD__CLIENT,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); + clog(WORLD__CLIENT,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); + clog(WORLD__CLIENT,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ database.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin()); From 69336d1e530c52be8586bf215f5bfe4a6d8a874d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 8 Oct 2014 01:18:38 -0400 Subject: [PATCH 0105/1883] Minor clean ups to Client::OPCharCreate --- world/client.cpp | 80 ++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index a8f269be1..61b0cf4d4 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1337,14 +1337,15 @@ void Client::SendApproveWorld() safe_delete(outapp); } -bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { +bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) +{ PlayerProfile_Struct pp; ExtendedProfile_Struct ext; Inventory inv; time_t bday = time(nullptr); char startzone[50]={0}; uint32 i; - struct in_addr in; + struct in_addr in; int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA; @@ -1352,8 +1353,8 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { clog(WORLD__CLIENT, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); clog(WORLD__CLIENT, "Name: %s", name); - clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d", - cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone); + clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); clog(WORLD__CLIENT, "STR STA AGI DEX WIS INT CHA Total"); clog(WORLD__CLIENT, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, @@ -1361,16 +1362,15 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { clog(WORLD__CLIENT, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); clog(WORLD__CLIENT, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); clog(WORLD__CLIENT, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); - clog(WORLD__CLIENT, "Home: %d Tutorial: %d", cc->start_zone, cc->tutorial); /* Validate the char creation struct */ - if(ClientVersionBit & BIT_SoFAndLater) { - if(!CheckCharCreateInfoSoF(cc)) { + if (ClientVersionBit & BIT_SoFAndLater) { + if (!CheckCharCreateInfoSoF(cc)) { clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { - if(!CheckCharCreateInfoTitanium(cc)) { + if (!CheckCharCreateInfoTitanium(cc)) { clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } @@ -1406,18 +1406,16 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { pp.lastlogin = bday; pp.level = 1; pp.points = 5; - pp.cur_hp = 1000; // 1k hp during dev only + pp.cur_hp = 1000; // 1k hp during dev only pp.hunger_level = 6000; pp.thirst_level = 6000; - /* Racial Languages */ - SetRacialLanguages( &pp ); - SetRaceStartingSkills( &pp ); - SetClassStartingSkills( &pp ); + /* Set Racial and Class specific language and skills */ + SetRacialLanguages(&pp); + SetRaceStartingSkills(&pp); + SetClassStartingSkills(&pp); SetClassLanguages(&pp); pp.skills[SkillSenseHeading] = 200; - // Some one fucking fix this to use a field name. -Doodman - //pp.unknown3596[28] = 15; // @bp: This is to enable disc usage // strcpy(pp.servername, WorldConfig::get()->ShortName.c_str()); @@ -1430,60 +1428,50 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { for(i = 0; i < BUFF_COUNT; i++) pp.buffs[i].spellid = 0xFFFF; - /* - Was memset(pp.unknown3704, 0xffffffff, 8); - but I dont think thats what you really wanted to do... - memset is byte based - */ - /* If server is PVP by default, make all character set to it. */ 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) && (RuleI(World, SoFStartZoneID) > 0)) { - clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", (RuleI(World, SoFStartZoneID))); - pp.zone_id = (RuleI(World, SoFStartZoneID)); - if(pp.zone_id) + if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { + clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + pp.zone_id = RuleI(World, SoFStartZoneID); + if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - clog(WORLD__CLIENT_ERR,"Error getting zone id for Zone ID %i", (RuleI(World, SoFStartZoneID))); - } - else { + clog(WORLD__CLIENT_ERR,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + } else { /* if there's a startzone variable put them in there */ - if(database.GetVariable("startzone", startzone, 50)) { + if (database.GetVariable("startzone", startzone, 50)) { clog(WORLD__CLIENT,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); - if(pp.zone_id) + if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else clog(WORLD__CLIENT_ERR,"Error getting zone id for '%s'", startzone); - } - else{ /* otherwise use normal starting zone logic */ + } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; - - if(ClientVersionBit & BIT_TitaniumAndEarlier) + if (ClientVersionBit & BIT_TitaniumAndEarlier) ValidStartZone = database.GetStartZone(&pp, cc); else ValidStartZone = database.GetStartZoneSoF(&pp, cc); - if(!ValidStartZone) + if (!ValidStartZone) return false; } } - if(!pp.zone_id) { + /* just in case */ + if (!pp.zone_id) { pp.zone_id = 1; // qeynos pp.x = pp.y = pp.z = -1; } /* Set Home Binds */ - if(!pp.binds[4].zoneId) { - pp.binds[4].zoneId = pp.zone_id; - pp.binds[4].x = pp.x; - pp.binds[4].y = pp.y; - pp.binds[4].z = pp.z; - pp.binds[4].heading = pp.heading; - } + pp.binds[4].zoneId = pp.zone_id; + pp.binds[4].x = pp.x; + pp.binds[4].y = pp.y; + pp.binds[4].z = pp.z; + pp.binds[4].heading = pp.heading; /* Overrides if we have the tutorial flag set! */ if (cc->tutorial && RuleB(World, EnableTutorialButton)) { @@ -1514,10 +1502,8 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) { clog(WORLD__CLIENT_ERR,"Character creation failed: %s", pp.name); return false; } - else { - clog(WORLD__CLIENT,"Character creation successful: %s", pp.name); - return true; - } + clog(WORLD__CLIENT,"Character creation successful: %s", pp.name); + return true; } // returns true if the request is ok, false if there's an error From b6294a28cbb56484188a5aa15e770bb0b5e6cb8b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 8 Oct 2014 01:28:03 -0400 Subject: [PATCH 0106/1883] Minor clean ups to CheckCharCreateInfo --- world/client.cpp | 89 ++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index 61b0cf4d4..f3f1a78c8 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1507,33 +1507,28 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) } // returns true if the request is ok, false if there's an error -bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) { - if(!cc) return false; +bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) +{ + if (!cc) + return false; _log(WORLD__CLIENT, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; int combos = character_create_race_class_combos.size(); - for(int i = 0; i < combos; ++i) { - if(character_create_race_class_combos[i].Class == cc->class_ && - character_create_race_class_combos[i].Race == cc->race && - character_create_race_class_combos[i].Deity == cc->deity) { - if(RuleB(World, EnableTutorialButton) && - (RuleI(World, TutorialZoneID) == cc->start_zone || - (character_create_race_class_combos[i].Zone == cc->start_zone))) { - class_combo = character_create_race_class_combos[i]; - found = true; - break; - } else if(character_create_race_class_combos[i].Zone == cc->start_zone) { - class_combo = character_create_race_class_combos[i]; - found = true; - break; - } + for (int i = 0; i < combos; ++i) { + if (character_create_race_class_combos[i].Class == cc->class_ && + character_create_race_class_combos[i].Race == cc->race && + character_create_race_class_combos[i].Deity == cc->deity && + character_create_race_class_combos[i].Zone == cc->start_zone) { + class_combo = character_create_race_class_combos[i]; + found = true; + break; } } - if(!found) { + if (!found) { _log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1542,15 +1537,15 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) { uint32 allocs = character_create_allocations.size(); RaceClassAllocation allocation = {0}; found = false; - for(int i = 0; i < combos; ++i) { - if(character_create_allocations[i].Index == class_combo.AllocationIndex) { + for (int i = 0; i < allocs; ++i) { + if (character_create_allocations[i].Index == class_combo.AllocationIndex) { allocation = character_create_allocations[i]; found = true; break; } } - if(!found) { + if (!found) { _log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1563,37 +1558,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) { allocation.DefaultPointAllocation[5] + allocation.DefaultPointAllocation[6]; - if(cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { + if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { _log(WORLD__CLIENT_ERR, "Strength out of range"); return false; } - if(cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { + if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { _log(WORLD__CLIENT_ERR, "Dexterity out of range"); return false; } - if(cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { + if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { _log(WORLD__CLIENT_ERR, "Agility out of range"); return false; } - if(cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { + if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { _log(WORLD__CLIENT_ERR, "Stamina out of range"); return false; } - if(cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { + if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { _log(WORLD__CLIENT_ERR, "Intelligence out of range"); return false; } - if(cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { + if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { _log(WORLD__CLIENT_ERR, "Wisdom out of range"); return false; } - if(cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { + if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { _log(WORLD__CLIENT_ERR, "Charisma out of range"); return false; } @@ -1606,7 +1601,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) { current_stats += cc->INT - allocation.BaseStats[4]; current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; - if(current_stats > max_stats) { + if (current_stats > max_stats) { _log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats"); return false; } @@ -1685,7 +1680,8 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) { /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false} };//Initial table by kathgar, editted by Wiz for accuracy, solar too - if(!cc) return false; + if (!cc) + return false; _log(WORLD__CLIENT,"Validating char creation info..."); @@ -1699,19 +1695,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these - if(classtemp >= PLAYER_CLASS_COUNT) - { + if (classtemp >= PLAYER_CLASS_COUNT) { _log(WORLD__CLIENT_ERR," class is out of range"); return false; } - if(racetemp >= _TABLE_RACES) - { + if (racetemp >= _TABLE_RACES) { _log(WORLD__CLIENT_ERR," race is out of range"); return false; } - if(!ClassRaceLookupTable[classtemp][racetemp]) //Lookup table better than a bunch of ifs? - { + if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? _log(WORLD__CLIENT_ERR," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats @@ -1739,44 +1732,36 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // NOTE: these could just be else if, but i want to see all the stats // that are messed up not just the first hit - if(bTOTAL + stat_points != cTOTAL) - { + if (bTOTAL + stat_points != cTOTAL) { _log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } - if(cc->STR > bSTR + stat_points || cc->STR < bSTR) - { + if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { _log(WORLD__CLIENT_ERR," stat STR is out of range"); Charerrors++; } - if(cc->STA > bSTA + stat_points || cc->STA < bSTA) - { + if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { _log(WORLD__CLIENT_ERR," stat STA is out of range"); Charerrors++; } - if(cc->AGI > bAGI + stat_points || cc->AGI < bAGI) - { + if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { _log(WORLD__CLIENT_ERR," stat AGI is out of range"); Charerrors++; } - if(cc->DEX > bDEX + stat_points || cc->DEX < bDEX) - { + if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { _log(WORLD__CLIENT_ERR," stat DEX is out of range"); Charerrors++; } - if(cc->WIS > bWIS + stat_points || cc->WIS < bWIS) - { + if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { _log(WORLD__CLIENT_ERR," stat WIS is out of range"); Charerrors++; } - if(cc->INT > bINT + stat_points || cc->INT < bINT) - { + if (cc->INT > bINT + stat_points || cc->INT < bINT) { _log(WORLD__CLIENT_ERR," stat INT is out of range"); Charerrors++; } - if(cc->CHA > bCHA + stat_points || cc->CHA < bCHA) - { + if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { _log(WORLD__CLIENT_ERR," stat CHA is out of range"); Charerrors++; } From a325380884d6d8956608de1c4c44d22d1f4a140c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 8 Oct 2014 03:36:31 -0400 Subject: [PATCH 0107/1883] Implement mana/hp/end replenishments if logged off for long enough Default set to on with a default time of 6 hours (21600 seconds) --- common/ruletypes.h | 2 ++ .../optional/2014_10_08_LoggedOffReplenishments.sql | 2 ++ zone/client_packet.cpp | 10 ++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 utils/sql/git/optional/2014_10_08_LoggedOffReplenishments.sql diff --git a/common/ruletypes.h b/common/ruletypes.h index c5004ffd1..528770ecb 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -201,6 +201,8 @@ RULE_INT ( Zone, EbonCrystalItemID, 40902) RULE_INT ( Zone, RadiantCrystalItemID, 40903) RULE_BOOL ( Zone, LevelBasedEXPMods, false) // Allows you to use the level_exp_mods table in consideration to your players EXP hits RULE_INT ( Zone, WeatherTimer, 600) // Weather timer when no duration is available +RULE_BOOL ( Zone, EnableLoggedOffReplenishments, true) +RULE_INT ( Zone, MinOfflineTimeToReplenishments, 21600) // 21600 seconds is 6 Hours RULE_CATEGORY_END() RULE_CATEGORY( Map ) diff --git a/utils/sql/git/optional/2014_10_08_LoggedOffReplenishments.sql b/utils/sql/git/optional/2014_10_08_LoggedOffReplenishments.sql new file mode 100644 index 000000000..cd553784c --- /dev/null +++ b/utils/sql/git/optional/2014_10_08_LoggedOffReplenishments.sql @@ -0,0 +1,2 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Zone:EnableLoggedOffReplenishments', 'true', 'Replenish mana/hp/end if logged off for MinOfflineTimeToReplenishments'); +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Zone:MinOfflineTimeToReplenishments', '21600', 'Minimum logged off time to trigger replenish mana/hp/end'); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7edd9202b..988a6d5f5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1375,7 +1375,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) query = StringFormat("SELECT `lfp`, `lfg`, `xtargets`, `firstlogon`, `guild_id`, `rank` FROM `character_data` LEFT JOIN `guild_members` ON `id` = `char_id` WHERE `id` = %i", cid); results = database.QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - m_pp.lastlogin = time(nullptr); if (row[4] && atoi(row[4]) > 0){ guild_id = atoi(row[4]); if (row[5] != nullptr){ guildrank = atoi(row[5]); } @@ -1661,11 +1660,18 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) #endif CalcBonuses(); + if (RuleB(Zone, EnableLoggedOffReplenishments) && + time(nullptr) - m_pp.lastlogin >= RuleI(Zone, MinOfflineTimeToReplenishments)) { + m_pp.cur_hp = GetMaxHP(); + m_pp.mana = GetMaxMana(); + m_pp.endurance = GetMaxEndurance(); + } + if (m_pp.cur_hp <= 0) m_pp.cur_hp = GetMaxHP(); SetHP(m_pp.cur_hp); - Mob::SetMana(m_pp.mana); + Mob::SetMana(m_pp.mana); // mob function doesn't send the packet SetEndurance(m_pp.endurance); /* Update LFP in case any (or all) of our group disbanded while we were zoning. */ From e2d52ec3e557d42e69d942803effb2a7d72989ac Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 8 Oct 2014 13:43:32 -0400 Subject: [PATCH 0108/1883] Allow /setstartcity to work if home is set to tutorialb --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 988a6d5f5..74399274a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11832,7 +11832,7 @@ void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) { // if the character has a start city, don't let them use the command - if (m_pp.binds[4].zoneId != 0) { + if (m_pp.binds[4].zoneId != 0 && m_pp.binds[4].zoneId != 189) { Message(15, "Your home city has already been set.", m_pp.binds[4].zoneId, database.GetZoneName(m_pp.binds[4].zoneId)); return; } From e3e2b266f20670f1c3d41d769136bf3dfce05213 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 11:11:33 -0700 Subject: [PATCH 0109/1883] SaveClientState converted to QueryDatabase --- zone/tasks.cpp | 211 ++++++++++++++++++++++--------------------------- 1 file changed, 96 insertions(+), 115 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 00749a454..f8470b824 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -298,146 +298,127 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { // in that slot had more activities than the one now occupying it. Hopefully retaining the slot number for the // duration of a session will overcome this. // - const char *TaskQuery="REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " - "VALUES (%i, %i, %i, %i)"; - - const char *ActivityQuery="REPLACE INTO character_activities (charid, taskid, activityid, donecount, completed) " - "VALUES "; - - const char *CompletedTaskQuery="REPLACE INTO completed_tasks (charid, completedtime, taskid, activityid) " - "VALUES (%i, %i, %i, %i)"; + if(!c || !state) + return false; const char *ERR_MYSQLERROR = "[TASKS]Error in TaskManager::SaveClientState %s"; - if(!c || !state) return false; + int characterID = c->CharacterID(); - int CharacterID = c->CharacterID(); - - _log(TASKS__CLIENTSAVE,"TaskManager::SaveClientState for character ID %d", CharacterID); - - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + _log(TASKS__CLIENTSAVE,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { - for(int Task=0; TaskActiveTasks[Task].TaskID; - if(TaskID==TASKSLOTEMPTY) continue; - if(state->ActiveTasks[Task].Updated) { + for(int task=0; taskActiveTasks[task].TaskID; + if(taskID==TASKSLOTEMPTY) + continue; - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", - CharacterID, Task, TaskID); + if(state->ActiveTasks[task].Updated) { - if(!database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, - CharacterID, - TaskID, - Task, - state->ActiveTasks[Task].AcceptedTime), errbuf)) { + _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - } + std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " + "VALUES (%i, %i, %i, %i)", + characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); + auto results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else - state->ActiveTasks[Task].Updated = false; + state->ActiveTasks[task].Updated = false; - safe_delete_array(query); } - int UpdatedActivityCount = 0; - std::string UpdateActivityQuery = ActivityQuery; - char *buf = 0; + std::string query = "REPLACE INTO character_activities (charid, taskid, activityid, donecount, completed) " + "VALUES "; - for(int Activity=0; ActivityActivityCount; Activity++) { + int updatedActivityCount = 0; + for(int activityIndex = 0; activityIndexActivityCount; ++activityIndex) { - if(state->ActiveTasks[Task].Activity[Activity].Updated) { + if(!state->ActiveTasks[task].Activity[activityIndex].Updated) + continue; - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientSate for character ID %d, " - "Updating Activity %i, %i", - CharacterID, Task, Activity); + _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + characterID, task, activityIndex); - if(UpdatedActivityCount==0) { - MakeAnyLenString(&buf, "(%i, %i, %i, %i, %i)", CharacterID, TaskID, - Activity, - state->ActiveTasks[Task].Activity[Activity].DoneCount, - state->ActiveTasks[Task].Activity[Activity].State == - ActivityCompleted); - } - else { - MakeAnyLenString(&buf, ", (%i, %i, %i, %i, %i)", CharacterID, TaskID, - Activity, - state->ActiveTasks[Task].Activity[Activity].DoneCount, - state->ActiveTasks[Task].Activity[Activity].State == - ActivityCompleted); - } - UpdateActivityQuery = UpdateActivityQuery + buf; - safe_delete_array(buf); - UpdatedActivityCount++; - } + if(updatedActivityCount==0) + query += StringFormat("(%i, %i, %i, %i, %i)", + characterID, taskID, activityIndex, + state->ActiveTasks[task].Activity[activityIndex].DoneCount, + state->ActiveTasks[task].Activity[activityIndex].State == ActivityCompleted); + else + query += StringFormat(", (%i, %i, %i, %i, %i)", + characterID, taskID, activityIndex, + state->ActiveTasks[task].Activity[activityIndex].DoneCount, + state->ActiveTasks[task].Activity[activityIndex].State == ActivityCompleted); + + updatedActivityCount++; } - if(UpdatedActivityCount > 0) { - _log(TASKS__CLIENTSAVE, "Executing query %s", UpdateActivityQuery.c_str()); - if(!database.RunQuery(query,MakeAnyLenString(&query, UpdateActivityQuery.c_str()), - errbuf)) { + if(updatedActivityCount == 0) + continue; - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - } - else { - state->ActiveTasks[Task].Updated=false; - for(int Activity=0; ActivityActivityCount; Activity++) - state->ActiveTasks[Task].Activity[Activity].Updated=false; + _log(TASKS__CLIENTSAVE, "Executing query %s", query.c_str()); + auto results = database.QueryDatabase(query); - } + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + continue; + } + + state->ActiveTasks[task].Updated=false; + for(int activityIndex=0; activityIndexActivityCount; ++activityIndex) + state->ActiveTasks[task].Activity[activityIndex].Updated=false; - safe_delete_array(query); - } } - - } - if(RuleB(TaskSystem, RecordCompletedTasks) && - (state->CompletedTasks.size() > (unsigned int)state->LastCompletedTaskLoaded)) { - - for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState Saving Completed Task at slot %i", i); - int TaskID = state->CompletedTasks[i].TaskID; - if((TaskID<=0) || (TaskID>=MAXTASKS) || (Tasks[TaskID]==nullptr)) continue; - - // First we save a record with an ActivityID of -1. - // This indicates this task was completed at the given time. We infer that all - // none optional activities were completed. - // - if(!database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID, - state->CompletedTasks[i].CompletedTime, - TaskID, -1), errbuf)) { - - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - continue; - } - safe_delete_array(query); - - // If the Rule to record non-optional task completion is not enabled, don't save it - if(!RuleB(TaskSystem, RecordCompletedOptionalActivities)) continue; - - // Insert one record for each completed optional task. - - for(int j=0; jActivityCount; j++) { - if(Tasks[TaskID]->Activity[j].Optional && state->CompletedTasks[i].ActivityDone[j]) { - - if(!database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID, - state->CompletedTasks[i].CompletedTime, - TaskID, j), errbuf)) { - - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, errbuf); - } - safe_delete_array(query); - } - } - } - state->LastCompletedTaskLoaded = state->CompletedTasks.size(); } + if(!RuleB(TaskSystem, RecordCompletedTasks) || (state->CompletedTasks.size() <= (unsigned int)state->LastCompletedTaskLoaded)) { + state->LastCompletedTaskLoaded = state->CompletedTasks.size(); + return true; + } + + const char* completedTaskQuery = "REPLACE INTO completed_tasks (charid, completedtime, taskid, activityid) " + "VALUES (%i, %i, %i, %i)"; + + for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { + + _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState Saving Completed Task at slot %i", i); + int taskID = state->CompletedTasks[i].TaskID; + + if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) + continue; + + // First we save a record with an ActivityID of -1. + // This indicates this task was completed at the given time. We infer that all + // none optional activities were completed. + // + std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + continue; + } + + // If the Rule to record non-optional task completion is not enabled, don't save it + if(!RuleB(TaskSystem, RecordCompletedOptionalActivities)) + continue; + + // Insert one record for each completed optional task. + + for(int j=0; jActivityCount; j++) { + if(!Tasks[taskID]->Activity[j].Optional || !state->CompletedTasks[i].ActivityDone[j]) + continue; + + query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); + results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + + } + + } + + state->LastCompletedTaskLoaded = state->CompletedTasks.size(); return true; } From ad921d01d83e3529e61b637ccb0bdee5d6a9b677 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 12:30:08 -0700 Subject: [PATCH 0110/1883] LoadClientState converted to QueryDatabase --- zone/tasks.cpp | 425 +++++++++++++++++++++---------------------------- 1 file changed, 178 insertions(+), 247 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index f8470b824..89c34b477 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -451,300 +451,231 @@ void Client::RemoveClientTaskState() { bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { - const char *TaskQuery = "SELECT `taskid`, `slot`, `acceptedtime` from `character_tasks` " - "WHERE `charid` = %i ORDER BY acceptedtime"; + if(!c || !state) + return false; - const char *ERR_TASK_OOR1 = "[TASKS]Task ID %i out of range while loading character tasks from database"; - - const char *ERR_SLOT_OOR = "[TASKS] Slot %i out of range while loading character tasks from database"; - - const char *ERR_DUP_SLOT = "[TASKS] Slot %i for Task %is is already occupied."; - - const char *ERR_MYSQLERROR1 = "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - - if(!c || !state) return false; - - int CharacterID = c->CharacterID(); + int characterID = c->CharacterID(); state->ActiveTaskCount = 0; - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientSate for character ID %d", CharacterID); + _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState for character ID %d", characterID); - if(database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, CharacterID), errbuf, &result)) { - - while((row = mysql_fetch_row(result))) { - - int TaskID = atoi(row[0]); - int Slot = atoi(row[1]); - - if((TaskID<0) || (TaskID>=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, ERR_TASK_OOR1, TaskID); - continue; - } - - if((Slot<0) || (Slot>=MAXACTIVETASKS)) { - LogFile->write(EQEMuLog::Error, ERR_SLOT_OOR, Slot); - continue; - } - - if(state->ActiveTasks[Slot].TaskID != TASKSLOTEMPTY) { - LogFile->write(EQEMuLog::Error, ERR_DUP_SLOT, Slot, TaskID); - continue; - } - - int acceptedtime = atoi(row[2]); - - state->ActiveTasks[Slot].TaskID = TaskID; - - state->ActiveTasks[Slot].CurrentStep = -1; - - state->ActiveTasks[Slot].AcceptedTime = acceptedtime; - - state->ActiveTasks[Slot].Updated = false; - - for(int i=0; iActiveTasks[Slot].Activity[i].ActivityID = -1; - } - - //LoadClientActivitiesForTask(CharacterID, &state->ActiveTasks[state->ActiveTaskCount]); - // Calculate which activities are active based on those completed. - //state->UnlockActivities(state->ActiveTaskCount); - - state->ActiveTaskCount++; - - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, " - "Accepted Time: %8X", - CharacterID, TaskID,acceptedtime); - } - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR1, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " + "FROM `character_tasks` " + "WHERE `charid` = %i ORDER BY acceptedtime", characterID); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; + } + + for(auto row = results.begin(); row != results.end(); ++row) { + int taskID = atoi(row[0]); + int slot = atoi(row[1]); + + if((taskID<0) || (taskID>=MAXTASKS)) { + LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + continue; + } + + if((slot<0) || (slot>=MAXACTIVETASKS)) { + LogFile->write(EQEMuLog::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + continue; + } + + if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { + LogFile->write(EQEMuLog::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + continue; + } + + int acceptedtime = atoi(row[2]); + + state->ActiveTasks[slot].TaskID = taskID; + state->ActiveTasks[slot].CurrentStep = -1; + state->ActiveTasks[slot].AcceptedTime = acceptedtime; + state->ActiveTasks[slot].Updated = false; + + for(int i=0; iActiveTasks[slot].Activity[i].ActivityID = -1; + + ++state->ActiveTaskCount; + + _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities + _log(TASKS__CLIENTLOAD, "LoadClientState. Loading activities for character ID %d", characterID); - const char *ActivityQuery = "SELECT `taskid`, `activityid`, `donecount`, `completed` " - " from `character_activities` WHERE `charid` = %i " - "ORDER BY `taskid` ASC, `activityid` ASC"; - - const char *ERR_TASK_OOR2 = "[TASKS]Task ID %i out of range while loading character activities from database"; - - const char *ERR_ACTIVITY_OOR = "[TASKS]Activity ID %i out of range while loading character activities from database"; - - const char *ERR_NOTASK = "[TASKS]Activity %i found for task %i which client does not have."; - - const char *ERR_MYSQLERROR2 = "[TASKS]Error in TaskManager::LoadClientState load Activities: %s"; - - _log(TASKS__CLIENTLOAD, "LoadClientState. Loading activities for character ID %d", CharacterID); - - - - if(database.RunQuery(query,MakeAnyLenString(&query, ActivityQuery, - CharacterID), errbuf, &result)) { - - - while((row = mysql_fetch_row(result))) { - int TaskID = atoi(row[0]); - if((TaskID<0) || (TaskID>=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, ERR_TASK_OOR2, TaskID); - continue; - } - int ActivityID = atoi(row[1]); - if((ActivityID<0) || (ActivityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEMuLog::Error, ERR_ACTIVITY_OOR, ActivityID); - continue; - } - - // Find Active Task Slot - int ActiveTaskIndex = -1; - - for(int i=0; iActiveTasks[i].TaskID == TaskID) { - ActiveTaskIndex = i; - break; - } - } - - if(ActiveTaskIndex == -1) { - LogFile->write(EQEMuLog::Error, ERR_NOTASK, ActivityID, TaskID); - continue; - } - - int DoneCount = atoi(row[2]); - bool Completed = atoi(row[3]); - state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].ActivityID = ActivityID; - state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = DoneCount; - if(Completed) state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State = ActivityCompleted; - else - state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State = ActivityHidden; - - state->ActiveTasks[ActiveTaskIndex].Activity[ActivityID].Updated = false; - - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, " - "DoneCount: %i, Completed: %i", - CharacterID, TaskID, ActivityID, DoneCount, Completed); - - } - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR2, errbuf); - safe_delete_array(query); + query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " + "FROM `character_activities` " + "WHERE `charid` = %i " + "ORDER BY `taskid` ASC, `activityid` ASC", characterID); + results = database.QueryDatabase(query); + if (!results.Success()){ + LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } - const char *CompletedTaskQuery = "SELECT `taskid`, `activityid`, `completedtime` from `completed_tasks` " - "WHERE `charid` = %i ORDER BY completedtime, taskid, activityid"; + for (auto row = results.begin(); row != results.end(); ++row) { + int taskID = atoi(row[0]); + if((taskID<0) || (taskID>=MAXTASKS)) { + LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + continue; + } - const char *ERR_TASK_OOR3 = "[TASKS]Task ID %i out of range while loading completed tasks from database"; + int activityID = atoi(row[1]); + if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { + LogFile->write(EQEMuLog::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + continue; + } - const char *ERR_ACTIVITY_OOR2 = "[TASKS]Activity ID %i out of range while loading completed tasks from database"; + // Find Active Task Slot + int activeTaskIndex = -1; - const char *ERR_MYSQLERROR3 = "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s"; + for(int i=0; iActiveTasks[i].TaskID == taskID) { + activeTaskIndex = i; + break; + } + if(activeTaskIndex == -1) { + LogFile->write(EQEMuLog::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + continue; + } + int doneCount = atoi(row[2]); + bool completed = atoi(row[3]); + state->ActiveTasks[activeTaskIndex].Activity[activityID].ActivityID = activityID; + state->ActiveTasks[activeTaskIndex].Activity[activityID].DoneCount = doneCount; + if(completed) + state->ActiveTasks[activeTaskIndex].Activity[activityID].State = ActivityCompleted; + else + state->ActiveTasks[activeTaskIndex].Activity[activityID].State = ActivityHidden; + + state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; + + _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + + } if(RuleB(TaskSystem, RecordCompletedTasks)) { - if(database.RunQuery(query,MakeAnyLenString(&query, CompletedTaskQuery, - CharacterID), errbuf, &result)) { - - CompletedTaskInformation cti; - - for(int i=0; i=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, ERR_TASK_OOR3, TaskID); - continue; - } - int ActivityID = atoi(row[1]); - - // An ActivityID of -1 means mark all the none optional activities in the - // task as complete. If the Rule to record optional activities is enabled, - // subsequent records for this task will flag any optional tasks that were - // completed. - if((ActivityID<-1) || (ActivityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEMuLog::Error, ERR_ACTIVITY_OOR2, ActivityID); - continue; - } - int CompletedTime = atoi(row[2]); - - if((PreviousTaskID != -1) && ((TaskID != PreviousTaskID) || - (CompletedTime != PreviousCompletedTime))) { - - state->CompletedTasks.push_back(cti); - for(int i=0; iActivityCount; i++) - if(!Task->Activity[i].Optional) - cti.ActivityDone[i] = true; - } - else - cti.ActivityDone[ActivityID] = true; - - } - if(PreviousTaskID != -1) - state->CompletedTasks.push_back(cti); - - state->LastCompletedTaskLoaded = state->CompletedTasks.size(); - - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR3, errbuf); - safe_delete_array(query); + query = StringFormat("SELECT `taskid`, `activityid`, `completedtime` " + "FROM `completed_tasks` " + "WHERE `charid` = %i ORDER BY completedtime, taskid, activityid", + characterID); + results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; + } + + CompletedTaskInformation cti; + + for(int i=0; i=MAXTASKS)) { + LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + continue; + } + + // An ActivityID of -1 means mark all the none optional activities in the + // task as complete. If the Rule to record optional activities is enabled, + // subsequent records for this task will flag any optional tasks that were + // completed. + int activityID = atoi(row[1]); + if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { + LogFile->write(EQEMuLog::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + continue; + } + + int completedTime = atoi(row[2]); + if((previousTaskID != -1) && ((taskID != previousTaskID) || (completedTime != previousCompletedTime))) { + state->CompletedTasks.push_back(cti); + for(int i=0; iActivityCount; i++) + if(!task->Activity[i].Optional) + cti.ActivityDone[i] = true; + } + else + cti.ActivityDone[activityID] = true; + + } + + if(previousTaskID != -1) + state->CompletedTasks.push_back(cti); + + state->LastCompletedTaskLoaded = state->CompletedTasks.size(); + + } + + query = StringFormat("SELECT `taskid` FROM character_enabledtasks " + "WHERE `charid` = %i AND `taskid` >0 AND `taskid` < %i " + "ORDER BY `taskid` ASC", + characterID, MAXTASKS); + results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + else + for (auto row = results.begin(); row != results.end(); ++row) { + int taskID = atoi(row[0]); + state->EnabledTasks.push_back(taskID); + _log(TASKS__CLIENTLOAD, "Adding TaskID %i to enabled tasks", taskID); } - } - - const char *EnabledTaskQuery = "SELECT `taskid` FROM character_enabledtasks WHERE `charid` = %i " - "AND `taskid` >0 AND `taskid` < %i ORDER BY `taskid` ASC"; - - const char *ERR_MYSQLERROR4 = "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s"; - - if(database.RunQuery(query,MakeAnyLenString(&query, EnabledTaskQuery, - CharacterID, MAXTASKS), errbuf, &result)) { - - while((row = mysql_fetch_row(result))) { - int TaskID = atoi(row[0]); - state->EnabledTasks.push_back(TaskID); - _log(TASKS__CLIENTLOAD, "Adding TaskID %i to enabled tasks", TaskID); - } - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR4, errbuf); - safe_delete_array(query); - } // Check that there is an entry in the client task state for every activity in each task // This should only break if a ServerOP adds or deletes activites for a task that players already // have active, or due to a bug. - - - const char *ERR_NOTASK2 = "[TASKS]Character %i has task %i which does not exist."; - - const char *ERR_INCONSISTENT = "[TASKS]Fatal error in character %i task state. Activity %i for " - "Task %i either missing from client state or from task."; - for(int i=0; iActiveTasks[i].TaskID; - if(TaskID==TASKSLOTEMPTY) continue; - if(!Tasks[TaskID]) { + int taskID = state->ActiveTasks[i].TaskID; + if(taskID==TASKSLOTEMPTY) continue; + if(!Tasks[taskID]) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " - "Removing from memory. Contact a GM to resolve this.",i, TaskID); + "Removing from memory. Contact a GM to resolve this.",i, taskID); - LogFile->write(EQEMuLog::Error, ERR_NOTASK2, CharacterID, TaskID); + LogFile->write(EQEMuLog::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; } - for(int j=0; jActivityCount; j++) { + for(int j=0; jActivityCount; j++) { if(state->ActiveTasks[i].Activity[j].ActivityID != j) { c->Message(13, "Active Task %i, %s. Activity count does not match expected value." "Removing from memory. Contact a GM to resolve this.", - TaskID, Tasks[TaskID]->Title); + taskID, Tasks[taskID]->Title); - LogFile->write(EQEMuLog::Error, ERR_INCONSISTENT, CharacterID, j, TaskID); + LogFile->write(EQEMuLog::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; } } } - for(int i=0; iActiveTasks[i].TaskID != TASKSLOTEMPTY) - state->UnlockActivities(CharacterID, i); + state->UnlockActivities(characterID, i); - _log(TASKS__CLIENTLOAD, "LoadClientState for Character ID %d DONE!", CharacterID); + _log(TASKS__CLIENTLOAD, "LoadClientState for Character ID %d DONE!", characterID); return true; } From 2c275f603aa8418bd8e21408bcb95d29b0484d78 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 13:07:03 -0700 Subject: [PATCH 0111/1883] EnableTask converted to QueryDatabase --- zone/tasks.cpp | 65 +++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 89c34b477..d9890045a 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -679,32 +679,33 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { return true; } -void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) { +void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { // Check if the Task is already enabled for this client // - std::vector TasksEnabled; - std::vector::iterator Iterator; + std::vector tasksEnabled; - for(int i=0; i TaskList[i]) break; - ++Iterator; + if((*iterator) > tasks[i]) + break; + ++iterator; } - if(AddTask) { - EnabledTasks.insert(Iterator, TaskList[i]); + + if(addTask) { + EnabledTasks.insert(iterator, tasks[i]); // Make a note of the task we enabled, for later SQL generation - TasksEnabled.push_back(TaskList[i]); + tasksEnabled.push_back(tasks[i]); } } @@ -712,35 +713,19 @@ void ClientTaskState::EnableTask(int CharID, int TaskCount, int *TaskList) { for(unsigned int i=0; iwrite(EQEMuLog::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - - char *buf = 0; - - for(unsigned int i=0; iwrite(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - } - - safe_delete_array(query); } void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) { From 5f11e91da2cb636b72a0879fa74482b257768452 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 13:17:03 -0700 Subject: [PATCH 0112/1883] DisableTask converted to QueryDatabase --- zone/tasks.cpp | 73 +++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 45 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index d9890045a..881e34d80 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -728,28 +728,31 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } -void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) { +void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { // Check if the Task is enabled for this client // - std::vector TasksDisabled; - std::vector::iterator Iterator; + std::vector tasksDisabled; - for(int i=0; i TaskList[i]) break; - ++Iterator; + + if((*iterator) > taskList[i]) + break; + + ++iterator; } - if(RemoveTask) { - EnabledTasks.erase(Iterator); - TasksDisabled.push_back(TaskList[i]); + + if(removeTask) { + EnabledTasks.erase(iterator); + tasksDisabled.push_back(taskList[i]); } } @@ -757,40 +760,20 @@ void ClientTaskState::DisableTask(int CharID, int TaskCount, int *TaskList) { for(unsigned int i=0; iwrite(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - } - - safe_delete_array(query); + queryStream << ")"; + std::string query = queryStream.str(); + _log(TASKS__UPDATE, "Executing query %s", query.c_str()); + auto results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { From fca359bf51b60d4d899b0002b06004efad666fe8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 13:22:10 -0700 Subject: [PATCH 0113/1883] DeleteCompletedTaskFromDatabase --- zone/tasks.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 881e34d80..538080b28 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1272,24 +1272,18 @@ int ClientTaskState::GetActiveTaskID(int index) { return ActiveTasks[index].TaskID; } -static void DeleteCompletedTaskFromDatabase(int CharID, int TaskID) { +static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; + _log(TASKS__UPDATE, "DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); - const char *TaskQuery="DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i"; - - _log(TASKS__UPDATE, "DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", - CharID, TaskID); - - if(!database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, CharID, TaskID), errbuf)) { - - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query, errbuf); - safe_delete_array(query); + const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } - _log(TASKS__UPDATE, "Delete query %s", query); - safe_delete_array(query); + + _log(TASKS__UPDATE, "Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { From 1a4b794ce4e86df19501aa4fd71894f02b3afa7a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 13:33:22 -0700 Subject: [PATCH 0114/1883] RemoveTask converted to QueryDatabase --- zone/tasks.cpp | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 538080b28..76a789c92 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2981,40 +2981,29 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD RemoveTask(c, SequenceNumber); } -void ClientTaskState::RemoveTask(Client *c, int SequenceNumber) { +void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { - int CharacterID = c->CharacterID(); + int characterID = c->CharacterID(); + _log(TASKS__UPDATE, "ClientTaskState Cancel Task %i ", sequenceNumber); - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - - const char *TaskQuery="DELETE FROM character_tasks WHERE charid=%i AND taskid = %i"; - - const char *ActivityQuery="DELETE FROM character_activities WHERE charid=%i AND taskid = %i"; - - _log(TASKS__UPDATE, "ClientTaskState Cancel Task %i ", SequenceNumber); - - if(!database.RunQuery(query,MakeAnyLenString(&query, ActivityQuery, - CharacterID, - ActiveTasks[SequenceNumber].TaskID), errbuf)) { - - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf); - safe_delete_array(query); + std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", + characterID, ActiveTasks[sequenceNumber].TaskID); + auto results = database.QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - _log(TASKS__UPDATE, "CancelTask: %s", query); - safe_delete_array(query); - if(!database.RunQuery(query,MakeAnyLenString(&query, TaskQuery, - CharacterID, - ActiveTasks[SequenceNumber].TaskID), errbuf)) { + _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", errbuf); - } + query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", + characterID, ActiveTasks[sequenceNumber].TaskID); + results = database.QueryDatabase(query); + if(!results.Success()) + LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - _log(TASKS__UPDATE, "CancelTask: %s", query); - safe_delete_array(query); + _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); - ActiveTasks[SequenceNumber].TaskID = TASKSLOTEMPTY; + ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; } From 0d8cbca016f3795a92bc014073a9c4339e235247 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 14:11:35 -0700 Subject: [PATCH 0115/1883] LoadLists converted to QueryDatabase --- zone/tasks.cpp | 149 ++++++++++++++++++++++--------------------------- 1 file changed, 67 insertions(+), 82 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 76a789c92..a815c541f 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3125,98 +3125,83 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - - const char *CountQuery = "SELECT `listid`, COUNT(`entry`) FROM `goallists` GROUP by `listid` " - "ORDER BY `listid`"; - - const char *ListQuery = "SELECT `entry` from `goallists` WHERE `listid`=%i " - "ORDER BY `entry` ASC LIMIT %i"; - - const char *ERR_MYSQLERROR = "Error in TaskGoalListManager::LoadLists: %s %s"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - _log(TASKS__GLOBALLOAD, "TaskGoalListManager::LoadLists Called"); - for(int i=0; i< NumberOfLists; i++) { - + for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); - - } safe_delete_array(TaskGoalLists); + const char *ERR_MYSQLERROR = "Error in TaskGoalListManager::LoadLists: %s %s"; + NumberOfLists = 0; - if(database.RunQuery(query,MakeAnyLenString(&query,CountQuery),errbuf,&result)) { - - NumberOfLists = mysql_num_rows(result); - _log(TASKS__GLOBALLOAD, "Database returned a count of %i lists", NumberOfLists); - - TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; - - int ListIndex = 0; - - while((row = mysql_fetch_row(result))) { - int ListID = atoi(row[0]); - int ListSize = atoi(row[1]); - - TaskGoalLists[ListIndex].ListID = ListID; - TaskGoalLists[ListIndex].Size = ListSize; - TaskGoalLists[ListIndex].Min = 0; - TaskGoalLists[ListIndex].Max = 0; - TaskGoalLists[ListIndex].GoalItemEntries = new int[ListSize]; - - ListIndex++; - } - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - safe_delete_array(query); + std::string query = "SELECT `listid`, COUNT(`entry`) " + "FROM `goallists` GROUP by `listid` " + "ORDER BY `listid`"; + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; + } + + NumberOfLists = results.RowCount(); + _log(TASKS__GLOBALLOAD, "Database returned a count of %i lists", NumberOfLists); + + TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; + + int listIndex = 0; + + for(auto row = results.begin(); row != results.end(); ++row) { + int listID = atoi(row[0]); + int listSize = atoi(row[1]); + + TaskGoalLists[listIndex].ListID = listID; + TaskGoalLists[listIndex].Size = listSize; + TaskGoalLists[listIndex].Min = 0; + TaskGoalLists[listIndex].Max = 0; + TaskGoalLists[listIndex].GoalItemEntries = new int[listSize]; + + listIndex++; + } + + for(int listIndex = 0; listIndex < NumberOfLists; listIndex++) { + + int listID = TaskGoalLists[listIndex].ListID; + unsigned int size = TaskGoalLists[listIndex].Size; + query = StringFormat("SELECT `entry` from `goallists` " + "WHERE `listid` = %i " + "ORDER BY `entry` ASC LIMIT %i", + listID, size); + results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + TaskGoalLists[listIndex].Size = 0; + continue; + } + + // This should only happen if a row is deleted in between us retrieving the counts + // at the start of this method and getting to here. It should not be possible for + // an INSERT to cause a problem, as the SELECT is used with a LIMIT + if(results.RowCount() < size) + TaskGoalLists[listIndex].Size = results.RowCount(); + + int entryIndex = 0; + for (auto row = results.begin(); row != results.end(); ++row, ++entryIndex) { + + int entry = atoi(row[0]); + + if(entry < TaskGoalLists[listIndex].Min) + TaskGoalLists[listIndex].Min = entry; + + if(entry > TaskGoalLists[listIndex].Max) + TaskGoalLists[listIndex].Max = entry; + + TaskGoalLists[listIndex].GoalItemEntries[entryIndex] = entry; + + } + } - for(int ListIndex = 0; ListIndex < NumberOfLists; ListIndex++) { - - int ListID = TaskGoalLists[ListIndex].ListID; - unsigned int Size = TaskGoalLists[ListIndex].Size; - - if(database.RunQuery(query,MakeAnyLenString(&query,ListQuery,ListID,Size),errbuf,&result)) { - // This should only happen if a row is deleted in between us retrieving the counts - // at the start of this method and getting to here. It should not be possible for - // an INSERT to cause a problem, as the SELECT is used with a LIMIT - if(mysql_num_rows(result) < Size) - TaskGoalLists[ListIndex].Size = mysql_num_rows(result); - - int EntryIndex = 0; - - while((row = mysql_fetch_row(result))) { - - int Entry = atoi(row[0]); - - if(Entry < TaskGoalLists[ListIndex].Min) - TaskGoalLists[ListIndex].Min = Entry; - - if(Entry > TaskGoalLists[ListIndex].Max) - TaskGoalLists[ListIndex].Max = Entry; - - TaskGoalLists[ListIndex].GoalItemEntries[EntryIndex++] = Entry; - - } - - mysql_free_result(result); - safe_delete_array(query); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - TaskGoalLists[ListIndex].Size = 0; - safe_delete_array(query); - } - } return true; } From 1da70ee6ed9ab95ea19948e17ab40199ca50bb34 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 14:15:43 -0700 Subject: [PATCH 0116/1883] LoadProximities converted to QueryDatabase --- zone/tasks.cpp | 60 +++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index a815c541f..924d3770b 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3299,47 +3299,33 @@ TaskProximityManager::~TaskProximityManager() { } -bool TaskProximityManager::LoadProximities(int ZoneID) { +bool TaskProximityManager::LoadProximities(int zoneID) { + TaskProximity proximity; - const char *ProximityQuery = "SELECT `exploreid`, `minx`, `maxx`, `miny`, `maxy`, " - "`minz`, `maxz` from `proximities` WHERE `zoneid`=%i " - "ORDER BY `zoneid` ASC"; - - const char *ERR_MYSQLERROR = "Error in TaskProximityManager::LoadProximities %s %s"; - - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - - - TaskProximity Proximity; - - _log(TASKS__GLOBALLOAD, "TaskProximityManager::LoadProximities Called for zone %i", ZoneID); + _log(TASKS__GLOBALLOAD, "TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); - if(database.RunQuery(query,MakeAnyLenString(&query,ProximityQuery, ZoneID),errbuf,&result)) { - - while((row = mysql_fetch_row(result))) { - Proximity.ExploreID = atoi(row[0]); - Proximity.MinX = atof(row[1]); - Proximity.MaxX = atof(row[2]); - Proximity.MinY = atof(row[3]); - Proximity.MaxY = atof(row[4]); - Proximity.MinZ = atof(row[5]); - Proximity.MaxZ = atof(row[6]); - - TaskProximities.push_back(Proximity); - - } - mysql_free_result(result); - } - else { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " + "`miny`, `maxy`, `minz`, `maxz` " + "FROM `proximities` WHERE `zoneid` = %i " + "ORDER BY `zoneid` ASC", zoneID); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; - } - safe_delete_array(query); + } + + for( auto row = results.begin(); row != results.end(); ++row) { + proximity.ExploreID = atoi(row[0]); + proximity.MinX = atof(row[1]); + proximity.MaxX = atof(row[2]); + proximity.MinY = atof(row[3]); + proximity.MaxY = atof(row[4]); + proximity.MinZ = atof(row[5]); + proximity.MaxZ = atof(row[6]); + + TaskProximities.push_back(proximity); + } return true; From e2333e671be37e02c87c91452206fe2608116882 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 14:28:40 -0700 Subject: [PATCH 0117/1883] HandleautoCombine converted to QueryDatabase --- zone/tradeskills.cpp | 60 ++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 91cb458a0..348d0cfe7 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -142,7 +142,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme // Adding augment if (in_augment->augment_slot == -1) { - if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) && + if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) && (tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots))) { tobe_auged->PutAugment(slot, *auged_with); @@ -424,38 +424,28 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac return; } - - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; - - uint32 qlen = 0; - uint8 qcount = 0; - - //pull the list of components - qlen = MakeAnyLenString(&query, "SELECT tre.item_id,tre.componentcount " - " FROM tradeskill_recipe_entries AS tre " - " WHERE tre.componentcount > 0 AND tre.recipe_id=%u", rac->recipe_id); - - if (!database.RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine query '%s': %s", query, errbuf); - safe_delete_array(query); + //pull the list of components + std::string query = StringFormat("SELECT tre.item_id,tre.componentcount " + "FROM tradeskill_recipe_entries AS tre " + "WHERE tre.componentcount > 0 AND tre.recipe_id = %u", + rac->recipe_id); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } - safe_delete_array(query); - qcount = mysql_num_rows(result); - if(qcount < 1) { + if(results.RowCount() < 1) { LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } - if(qcount > 10) { - LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine: too many components returned (%u)", qcount); + + if(results.RowCount() > 10) { + LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -466,17 +456,15 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac uint8 counts[10]; memset(counts, 0, sizeof(counts)); - //search for all the items in their inventory Inventory& user_inv = user->GetInv(); uint8 count = 0; uint8 needcount = 0; - uint8 r,k; std::list MissingItems; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + uint8 needItemIndex = 0; + for (auto row = results.begin(); row != results.end(); ++row, ++needItemIndex) { uint32 item = (uint32)atoi(row[0]); uint8 num = (uint8) atoi(row[1]); @@ -491,10 +479,9 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac MissingItems.push_back(item); //dont start deleting anything until we have found it all. - items[r] = item; - counts[r] = num; + items[needItemIndex] = item; + counts[needItemIndex] = num; } - mysql_free_result(result); //make sure we found it all... if(count != needcount) @@ -520,12 +507,12 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //remove all the items from the players inventory, with updates... int16 slot; - for(r = 0; r < qcount; r++) { + for(uint8 r = 0; r < results.RowCount(); r++) { if(items[r] == 0 || counts[r] == 0) continue; //skip empties, could prolly break here //we have to loop here to delete 1 at a time in case its in multiple stacks. - for(k = 0; k < counts[r]; k++) { + for(uint8 k = 0; k < counts[r]; k++) { slot = user_inv.HasItem(items[r], 1, invWherePersonal); if (slot == INVALID_INDEX) { //WTF... I just checked this above, but just to be sure... @@ -539,19 +526,14 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac const ItemInst* inst = user_inv.GetItem(slot); if (inst && !inst->IsStackable()) - { user->DeleteItemInInventory(slot, 0, true); - } else - { user->DeleteItemInInventory(slot, 1, true); - } } } //otherwise, we found it all... outp->reply_code = 0x00000000; //success for finding it... - user->QueuePacket(outapp); safe_delete(outapp); @@ -1094,7 +1076,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { ++itr; } return(true); - } + } /* Tradeskill Fail */ else { success_modifier = 2; // Halves the chance @@ -1172,7 +1154,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float chance_stage2 = 12.5 - (.08 * (current_raw_skill - 175)); } } - + chance_stage2 = mod_tradeskill_skillup(chance_stage2); if (chance_stage2 > MakeRandomFloat(0, 99)) { From d5955da08c3697fef6d456359353f8390880e466 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 14:38:38 -0700 Subject: [PATCH 0118/1883] TradeskillSearchResults converted to QueryDatabase --- zone/tradeskills.cpp | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 348d0cfe7..18de50283 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -425,7 +425,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } //pull the list of components - std::string query = StringFormat("SELECT tre.item_id,tre.componentcount " + std::string query = StringFormat("SELECT tre.item_id, tre.componentcount " "FROM tradeskill_recipe_entries AS tre " "WHERE tre.componentcount > 0 AND tre.recipe_id = %u", rac->recipe_id); @@ -638,32 +638,25 @@ SkillUseTypes Object::TypeToSkill(uint32 type) void Client::TradeskillSearchResults(const char *query, unsigned long qlen, unsigned long objtype, unsigned long someid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - - if (!database.RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query, errbuf); + std::string internalQuery(query); + auto results = database.QueryDatabase(internalQuery); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", internalQuery.c_str(), results.ErrorMessage().c_str()); return; } - uint8 qcount = 0; + if(results.RowCount() < 1) + return; //search gave no results... not an error - qcount = mysql_num_rows(result); - if(qcount < 1) { - //search gave no results... not an error - return; - } - if(mysql_num_fields(result) != 6) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query); + if(results.ColumnCount() != 6) { + LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", internalQuery.c_str()); return; } - uint8 r; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + for(auto row = results.begin(); row != results.end(); ++row) { if(row == nullptr || row[0] == nullptr || row[1] == nullptr || row[2] == nullptr || row[3] == nullptr || row[5] == nullptr) continue; + uint32 recipe = (uint32)atoi(row[0]); const char *name = row[1]; uint32 trivial = (uint32) atoi(row[2]); @@ -673,14 +666,10 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen, unsi // Skip the recipes that exceed the threshold in skill difference // Recipes that have either been made before or were // explicitly learned are excempt from that limit - if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff)) { - if (((int32)trivial - (int32)GetSkill((SkillUseTypes)tradeskill)) > RuleI(Skills, MaxTradeskillSearchSkillDiff) - && row[4] == nullptr) - { + if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff) + && ((int32)trivial - (int32)GetSkill((SkillUseTypes)tradeskill)) > RuleI(Skills, MaxTradeskillSearchSkillDiff) + && row[4] == nullptr) continue; - } - } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct)); RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer; @@ -693,7 +682,7 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen, unsi strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name)); FastQueuePacket(&outapp); } - mysql_free_result(result); + } void Client::SendTradeskillDetails(uint32 recipe_id) { From 0fde0fbd23eb29ef4483769165ac11de40a4dc5e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 14:41:34 -0700 Subject: [PATCH 0119/1883] removed unneeded querylength parameter from TradeskillSearchResults --- zone/client.h | 8 ++++---- zone/client_packet.cpp | 42 +++++++++++++++++++++--------------------- zone/tradeskills.cpp | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/zone/client.h b/zone/client.h index 03748849d..0fc5a3d1d 100644 --- a/zone/client.h +++ b/zone/client.h @@ -314,7 +314,7 @@ public: /* New PP Save Functions */ bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); } bool SaveAA(); - + inline bool ClientDataLoaded() const { return client_data_loaded; } inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } @@ -664,7 +664,7 @@ public: void IncreaseLanguageSkill(int skill_id, int value = 1); virtual uint16 GetSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return((itembonuses.skillmod[skill_id] > 0) ? m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100 : m_pp.skills[skill_id]); } return 0; } uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } - bool HasSkill(SkillUseTypes skill_id) const; + bool HasSkill(SkillUseTypes skill_id) const; bool CanHaveSkill(SkillUseTypes skill_id) const; void SetSkill(SkillUseTypes skill_num, uint16 value); void AddSkill(SkillUseTypes skillid, uint16 value); @@ -681,7 +681,7 @@ public: inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); - void TradeskillSearchResults(const char *query, unsigned long qlen, unsigned long objtype, unsigned long someid); + void TradeskillSearchResults(const char *query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); bool TradeskillExecute(DBTradeskillRecipe_Struct *spec); void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); @@ -1452,7 +1452,7 @@ private: unsigned int RestRegenHP; unsigned int RestRegenMana; unsigned int RestRegenEndurance; - + bool EngagedRaidTarget; uint32 SavedRaidRestTimer; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 74399274a..1202c2453 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -523,7 +523,7 @@ void Client::CompleteConnect() switch (rank) { case 0: { rank = 5; break; } // GUILD_MEMBER 0 case 1: { rank = 3; break; } // GUILD_OFFICER 1 - case 2: { rank = 1; break; } // GUILD_LEADER 2 + case 2: { rank = 1; break; } // GUILD_LEADER 2 default: { break; } // GUILD_NONE } } @@ -848,7 +848,7 @@ void Client::CompleteConnect() void Client::CheatDetected(CheatTypes CheatType, float x, float y, float z) { //ToDo: Break warp down for special zones. Some zones have special teleportation pads or bad .map files which can trigger the detector without a legit zone request. - + switch (CheatType) { case MQWarp: //Some zones may still have issues. Database updates will eliminate most if not all problems. @@ -1304,7 +1304,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if(strlen(cze->char_name) > 63) return; - conn_state = ReceivedZoneEntry; + conn_state = ReceivedZoneEntry; ClientVersion = Connection()->ClientVersion(); if (ClientVersion != EQClientUnknown) @@ -1329,7 +1329,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) client_state = CLIENT_KICKED; return; } - + strcpy(name, cze->char_name); /* Check for Client Spoofing */ if (client != 0) { @@ -1342,7 +1342,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) client->Disconnect(); } - uint32 pplen = 0; + uint32 pplen = 0; EQApplicationPacket* outapp = 0; MYSQL_RES* result = 0; bool loaditems = 0; @@ -1366,8 +1366,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (lsaccountid && atoi(row[2]) > 0){ lsaccountid = atoi(row[2]); } else{ lsaccountid = 0; } gmspeed = atoi(row[3]); - revoked = atoi(row[4]); - gmhideme = atoi(row[5]); + revoked = atoi(row[4]); + gmhideme = atoi(row[5]); if (account_creation){ account_creation = atoul(row[6]); } } @@ -1375,17 +1375,17 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) query = StringFormat("SELECT `lfp`, `lfg`, `xtargets`, `firstlogon`, `guild_id`, `rank` FROM `character_data` LEFT JOIN `guild_members` ON `id` = `char_id` WHERE `id` = %i", cid); results = database.QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - if (row[4] && atoi(row[4]) > 0){ - guild_id = atoi(row[4]); + if (row[4] && atoi(row[4]) > 0){ + guild_id = atoi(row[4]); if (row[5] != nullptr){ guildrank = atoi(row[5]); } else{ guildrank = GUILD_RANK_NONE; } } - + if (LFP){ LFP = atoi(row[0]); } if (LFG){ LFG = atoi(row[1]); } if (firstlogon){ firstlogon = atoi(row[3]); } } - + if (RuleB(Character, SharedBankPlat)) m_pp.platinum_shared = database.GetSharedPlatinum(this->AccountID()); @@ -1417,7 +1417,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Set Con State for Reporting */ conn_state = PlayerProfileLoaded; - m_pp.zone_id = zone->GetZoneID(); + m_pp.zone_id = zone->GetZoneID(); m_pp.zoneInstance = zone->GetInstanceID(); /* Set Total Seconds Played */ @@ -1426,7 +1426,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) max_AAXP = RuleI(AA, ExpPerPoint); /* If we can maintain intoxication across zones, check for it */ if (!RuleB(Character, MaintainIntoxicationAcrossZones)) - m_pp.intoxication = 0; + m_pp.intoxication = 0; strcpy(name, m_pp.name); strcpy(lastname, m_pp.last_name); @@ -1435,14 +1435,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) m_pp.x = zone->safe_x(); m_pp.y = zone->safe_y(); m_pp.z = zone->safe_z(); - } + } /* If too far below ground, then fix */ // float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z); // if (m_pp.z < (ground_z - 500)) // m_pp.z = ground_z; /* Set Mob variables for spawn */ - class_ = m_pp.class_; + class_ = m_pp.class_; level = m_pp.level; x_pos = m_pp.x; y_pos = m_pp.y; @@ -1471,7 +1471,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Load Guild */ if (!IsInAGuild()) { m_pp.guild_id = GUILD_NONE; } else { - m_pp.guild_id = GuildID(); + m_pp.guild_id = GuildID(); if (zone->GetZoneID() == RuleI(World, GuildBankZoneID)) GuildBanker = (guild_mgr.IsGuildLeader(GuildID(), CharacterID()) || guild_mgr.GetBankerFlag(CharacterID())); } @@ -1711,12 +1711,12 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) #endif /* Reset to max so they dont drown on zone in if its underwater */ - m_pp.air_remaining = 60; + m_pp.air_remaining = 60; /* Check for PVP Zone status*/ if (zone->IsPVPZone()) m_pp.pvp = 1; /* Time entitled on Account: Move to account */ - m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440; + m_pp.timeentitledonaccount = database.GetTotalTimeEntitledOnAccount(AccountID()) / 1440; /* Reset rest timer if the durations have been lowered in the database */ if ((m_pp.RestTimer > RuleI(Character, RestRegenTimeToActivate)) && (m_pp.RestTimer > RuleI(Character, RestRegenRaidTimeToActivate))) m_pp.RestTimer = 0; @@ -1836,7 +1836,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) QueuePacket(outapp); safe_delete(outapp); - SetAttackTimer(); + SetAttackTimer(); conn_state = ZoneInfoSent; return; @@ -11358,7 +11358,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " " LIMIT 100 ", CharacterID(), buf, containers); - TradeskillSearchResults(query, qlen, tsf->object_type, tsf->some_id); + TradeskillSearchResults(query, tsf->object_type, tsf->some_id); safe_delete_array(query); return; @@ -11416,7 +11416,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) " LIMIT 200 " , CharacterID(), searchclause, rss->mintrivial, rss->maxtrivial, containers); - TradeskillSearchResults(query, qlen, rss->object_type, rss->some_id); + TradeskillSearchResults(query, rss->object_type, rss->some_id); safe_delete_array(query); return; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 18de50283..70e687be6 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -636,7 +636,7 @@ SkillUseTypes Object::TypeToSkill(uint32 type) return TradeskillUnknown; } -void Client::TradeskillSearchResults(const char *query, unsigned long qlen, unsigned long objtype, unsigned long someid) { +void Client::TradeskillSearchResults(const char *query, unsigned long objtype, unsigned long someid) { std::string internalQuery(query); auto results = database.QueryDatabase(internalQuery); From 7656b9b928ae30cf31686d9eb0698aa5d1835757 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 15:00:34 -0700 Subject: [PATCH 0120/1883] TradeskillSearchResults converted to const std::string query instead of const *char query --- zone/client.h | 2 +- zone/client_packet.cpp | 99 ++++++++++++++++++------------------------ zone/tradeskills.cpp | 9 ++-- 3 files changed, 48 insertions(+), 62 deletions(-) diff --git a/zone/client.h b/zone/client.h index 0fc5a3d1d..3375d7066 100644 --- a/zone/client.h +++ b/zone/client.h @@ -681,7 +681,7 @@ public: inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); - void TradeskillSearchResults(const char *query, unsigned long objtype, unsigned long someid); + void TradeskillSearchResults(const std::string query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); bool TradeskillExecute(DBTradeskillRecipe_Struct *spec); void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1202c2453..6da4a265f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11311,56 +11311,46 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) // some_id = 0 if world combiner, item number otherwise // make where clause segment for container(s) - char containers[30]; - if (tsf->some_id == 0) { - // world combiner so no item number - snprintf(containers, 29, "= %u", tsf->object_type); - } - else { - // container in inventory - snprintf(containers, 29, "in (%u,%u)", tsf->object_type, tsf->some_id); - } - - char *query = 0; - char buf[5500]; //gotta be big enough for 500 IDs + std::string containers; + if (tsf->some_id == 0) + containers += StringFormat(" = %u ", tsf->object_type); // world combiner so no item number + else + containers += StringFormat(" in (%u, %u) ", tsf->object_type, tsf->some_id); // container in inventory + std::string favoriteIDs; //gotta be big enough for 500 IDs bool first = true; - uint16 r; - char *pos = buf; - //Assumes item IDs are <10 characters long - for (r = 0; r < 500; r++) { - if (tsf->favorite_recipes[r] == 0) + for (uint16 favoriteIndex = 0; favoriteIndex < 500; ++favoriteIndex) { + if (tsf->favorite_recipes[favoriteIndex] == 0) continue; if (first) { - pos += snprintf(pos, 10, "%u", tsf->favorite_recipes[r]); + favoriteIDs += StringFormat("%u", tsf->favorite_recipes[favoriteIndex]); first = false; } - else { - pos += snprintf(pos, 10, ",%u", tsf->favorite_recipes[r]); - } + else + favoriteIDs += StringFormat(",%u", tsf->favorite_recipes[favoriteIndex]); } if (first) //no favorites.... return; - //To be a good kid, I should move this SQL somewhere else... - //but im lazy right now, so it stays here - uint32 qlen = 0; - qlen = MakeAnyLenString(&query, "SELECT tr.id,tr.name,tr.trivial,SUM(tre.componentcount),crl.madecount,tr.tradeskill " - " FROM tradeskill_recipe AS tr " - " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " - " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " - " WHERE tr.enabled <> 0 AND tr.id IN (%s) " - " AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " - " GROUP BY tr.id " - " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " - " LIMIT 100 ", CharacterID(), buf, containers); + const std::string query = StringFormat("SELECT tr.id, tr.name, tr.trivial, " + "SUM(tre.componentcount), crl.madecount,tr.tradeskill " + "FROM tradeskill_recipe AS tr " + "LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " + "LEFT JOIN (SELECT recipe_id, madecount " + "FROM char_recipe_list " + "WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " + "WHERE tr.enabled <> 0 AND tr.id IN (%s) " + "AND tr.must_learn & 0x20 <> 0x20 AND " + "((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) " + "OR (tr.must_learn & 0x3 = 0)) " + "GROUP BY tr.id " + "HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " + "LIMIT 100 ", CharacterID(), favoriteIDs.c_str(), containers.c_str()); TradeskillSearchResults(query, tsf->object_type, tsf->some_id); - - safe_delete_array(query); return; } @@ -11389,36 +11379,33 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) snprintf(containers, 29, "in (%u,%u)", rss->object_type, rss->some_id); } - char *query = 0; - char searchclause[140]; //2X rss->query + SQL crap + std::string searchClause; //omit the rlike clause if query is empty if (rss->query[0] != 0) { char buf[120]; //larger than 2X rss->query database.DoEscapeString(buf, rss->query, strlen(rss->query)); - - snprintf(searchclause, 139, "name rlike '%s' AND", buf); + searchClause = StringFormat("name rlike '%s' AND", buf); } - else { - searchclause[0] = '\0'; - } - uint32 qlen = 0; //arbitrary limit of 200 recipes, makes sense to me. - qlen = MakeAnyLenString(&query, "SELECT tr.id,tr.name,tr.trivial,SUM(tre.componentcount),crl.madecount,tr.tradeskill " - " FROM tradeskill_recipe AS tr " - " LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id " - " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " - " WHERE %s tr.trivial >= %u AND tr.trivial <= %u AND tr.enabled <> 0 " - " AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) " - " GROUP BY tr.id " - " HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " - " LIMIT 200 " - , CharacterID(), searchclause, rss->mintrivial, rss->maxtrivial, containers); - + const std::string query = StringFormat("SELECT tr.id, tr.name, tr.trivial, " + "SUM(tre.componentcount), crl.madecount,tr.tradeskill " + "FROM tradeskill_recipe AS tr " + "LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id = tre.recipe_id " + "LEFT JOIN (SELECT recipe_id, madecount " + "FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id " + "WHERE %s tr.trivial >= %u AND tr.trivial <= %u AND tr.enabled <> 0 " + "AND tr.must_learn & 0x20 <> 0x20 " + "AND ((tr.must_learn & 0x3 <> 0 " + "AND crl.madecount IS NOT NULL) " + "OR (tr.must_learn & 0x3 = 0)) " + "GROUP BY tr.id " + "HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 " + "LIMIT 200 ", + CharacterID(), searchClause.c_str(), + rss->mintrivial, rss->maxtrivial, containers); TradeskillSearchResults(query, rss->object_type, rss->some_id); - - safe_delete_array(query); return; } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 70e687be6..82b56dc18 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -636,12 +636,11 @@ SkillUseTypes Object::TypeToSkill(uint32 type) return TradeskillUnknown; } -void Client::TradeskillSearchResults(const char *query, unsigned long objtype, unsigned long someid) { +void Client::TradeskillSearchResults(const std::string query, unsigned long objtype, unsigned long someid) { - std::string internalQuery(query); - auto results = database.QueryDatabase(internalQuery); + auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", internalQuery.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -649,7 +648,7 @@ void Client::TradeskillSearchResults(const char *query, unsigned long objtype, u return; //search gave no results... not an error if(results.ColumnCount() != 6) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", internalQuery.c_str()); + LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } From e2894ef2aaf0b7492efaca9ff94eb5233bdaa97d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 15:05:24 -0700 Subject: [PATCH 0121/1883] SendTradeskillDetails converted to QueryDatabase --- zone/tradeskills.cpp | 46 ++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 82b56dc18..004de366a 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -686,34 +686,25 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt void Client::SendTradeskillDetails(uint32 recipe_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; - - uint32 qlen = 0; - uint8 qcount = 0; - - //pull the list of components - qlen = MakeAnyLenString(&query, "SELECT tre.item_id,tre.componentcount,i.icon,i.Name " - " FROM tradeskill_recipe_entries AS tre " - " LEFT JOIN items AS i ON tre.item_id = i.id " - " WHERE tre.componentcount > 0 AND tre.recipe_id=%u", recipe_id); - - if (!database.RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query, errbuf); - safe_delete_array(query); + //pull the list of components + std::string query = StringFormat("SELECT tre.item_id,tre.componentcount,i.icon,i.Name " + "FROM tradeskill_recipe_entries AS tre " + "LEFT JOIN items AS i ON tre.item_id = i.id " + "WHERE tre.componentcount > 0 AND tre.recipe_id = %u", + recipe_id); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } - safe_delete_array(query); - qcount = mysql_num_rows(result); - if(qcount < 1) { + if(results.RowCount() < 1) { LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails: no components returned"); return; } - if(qcount > 10) { - LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails: too many components returned (%u)", qcount); + + if(results.RowCount() > 10) { + LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -743,20 +734,18 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { uint32 len; uint32 datalen = 0; uint8 count = 0; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + + for(auto row = results.begin(); row != results.end(); ++row) { //watch for references to items which are not in the //items table, which the left join will make nullptr... - if(row[2] == nullptr || row[3] == nullptr) { + if(row[2] == nullptr || row[3] == nullptr) continue; - } uint32 item = (uint32)atoi(row[0]); uint8 num = (uint8) atoi(row[1]); - - uint32 icon = (uint32) atoi(row[2]); + const char *name = row[3]; len = strlen(name); if(len > 63) @@ -786,7 +775,6 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { } } - mysql_free_result(result); //now move the item data over top of the FFFFs uint8 dist = sizeof(uint32) * (10 - count); From 21d6865e8c714ff749054aa5657d1332c127ab3d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 15:43:50 -0700 Subject: [PATCH 0122/1883] GetTradeRecipe converted to QueryDatabase --- zone/tradeskills.cpp | 285 ++++++++++++++++++++----------------------- 1 file changed, 129 insertions(+), 156 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 004de366a..6e06800da 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1149,194 +1149,167 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec) { - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; - char buf2[4096]; - uint32 sum = 0; - uint32 count = 0; - uint32 qcount = 0; - uint32 qlen = 0; - - // make where clause segment for container(s) - char containers[30]; - if (some_id == 0) { - // world combiner so no item number - snprintf(containers,29, "= %u", c_type); - } else { - // container in inventory - snprintf(containers,29, "in (%u,%u)", c_type, some_id); - } - - buf2[0] = '\0'; + std::string containers;// make where clause segment for container(s) + if (some_id == 0) + containers = StringFormat("= %u", c_type); // world combiner so no item number + else + containers = StringFormat("IN (%u,%u)", c_type, some_id); // container in inventory //Could prolly watch for stacks in this loop and handle them properly... //just increment sum and count accordingly bool first = true; - uint8 i; - char *pos = buf2; - for (i = 0; i < 10; i++) { // TODO: need to determine if this is bound to world/item container size + std::string buf2; + uint32 count = 0; + uint32 sum = 0; + for (uint8 i = 0; i < 10; i++) { // TODO: need to determine if this is bound to world/item container size const ItemInst* inst = container->GetItem(i); - if (inst) { - const Item_Struct* item = GetItem(inst->GetItem()->ID); - if (item) { - if(first) { - pos += snprintf(pos, 19, "%d", item->ID); - first = false; - } else { - pos += snprintf(pos, 19, ",%d", item->ID); - } - sum += item->ID; - count++; - } - } - } - *pos = '\0'; + if (!inst) + continue; - if(count < 1) { - return(false); //no items == no recipe + const Item_Struct* item = GetItem(inst->GetItem()->ID); + if (!item) + continue; + + if(first) { + buf2 += StringFormat("%d", item->ID); + first = false; + } else + buf2 += StringFormat(",%d", item->ID); + + sum += item->ID; + count++; } - qlen = MakeAnyLenString(&query, "SELECT tre.recipe_id " - " FROM tradeskill_recipe_entries AS tre" - " INNER JOIN tradeskill_recipe AS tr ON (tre.recipe_id = tr.id) " - " WHERE tr.enabled AND (( tre.item_id IN(%s) AND tre.componentcount>0 )" - " OR ( tre.item_id %s AND tre.iscontainer=1 ))" - " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" - " AND sum(tre.item_id * tre.componentcount) = %u", buf2, containers, count, sum); + if(count == 0) + return false; //no items == no recipe - if (!RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, query: %s", query); - safe_delete_array(query); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, error: %s", errbuf); - return(false); - } - safe_delete_array(query); - - qcount = mysql_num_rows(result); - if(qcount > 1) { - //multiple recipes, partial match... do an extra query to get it exact. - //this happens when combining components for a smaller recipe - //which is completely contained within another recipe - - first = true; - pos = buf2; - for (i = 0; i < qcount; i++) { - row = mysql_fetch_row(result); - uint32 recipeid = (uint32)atoi(row[0]); - if(first) { - pos += snprintf(pos, 19, "%u", recipeid); - first = false; - } else { - pos += snprintf(pos, 19, ",%u", recipeid); - } - //length limit on buf2 - if(i == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - LogFile->write(EQEMuLog::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", i + 1, qcount); - break; - } - } - - qlen = MakeAnyLenString(&query, "SELECT tre.recipe_id" - " FROM tradeskill_recipe_entries AS tre" - " WHERE tre.recipe_id IN (%s)" - " GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u" - " AND sum(tre.item_id * tre.componentcount) = %u", buf2, count, sum); - - if (!RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query); - safe_delete_array(query); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf); - return(false); - } - safe_delete_array(query); - - qcount = mysql_num_rows(result); + std::string query = StringFormat("SELECT tre.recipe_id " + "FROM tradeskill_recipe_entries AS tre " + "INNER JOIN tradeskill_recipe AS tr ON (tre.recipe_id = tr.id) " + "WHERE tr.enabled AND (( tre.item_id IN(%s) AND tre.componentcount > 0) " + "OR ( tre.item_id %s AND tre.iscontainer=1 ))" + "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " + "AND sum(tre.item_id * tre.componentcount) = %u", + buf2.c_str(), containers.c_str(), count, sum); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + return false; } - if(qcount < 1) - return(false); + if (results.RowCount() > 1) { + //multiple recipes, partial match... do an extra query to get it exact. + //this happens when combining components for a smaller recipe + //which is completely contained within another recipe + first = true; + uint32 index = 0; + buf2 = ""; + for (auto row = results.begin(); row != results.end(); ++row, ++index) { + uint32 recipeid = (uint32)atoi(row[0]); + if(first) { + buf2 += StringFormat("%u", recipeid); + first = false; + } else + buf2 += StringFormat(",%u", recipeid); - if(qcount > 1) - { + //length limit on buf2 + if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) + LogFile->write(EQEMuLog::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + break; + } + } + + query = StringFormat("SELECT tre.recipe_id " + "FROM tradeskill_recipe_entries AS tre " + "WHERE tre.recipe_id IN (%s) " + "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " + "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + return false; + } + } + + if (results.RowCount() < 1) + return false; + + if(results.RowCount() > 1) { //The recipe is not unique, so we need to compare the container were using. - uint32 containerId = 0; - if(some_id) { //Standard container + if(some_id) //Standard container containerId = some_id; - } - else if(c_type) { //World container + else if(c_type)//World container containerId = c_type; - } - else { //Invalid container - return(false); + else //Invalid container + return false; + + query = StringFormat("SELECT tre.recipe_id " + "FROM tradeskill_recipe_entries AS tre " + "WHERE tre.recipe_id IN (%s) " + "AND tre.item_id = %u;", buf2.c_str(), containerId); + results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + return false; } - qlen = MakeAnyLenString(&query,"SELECT tre.recipe_id FROM tradeskill_recipe_entries as tre WHERE tre.recipe_id IN (%s)" - " AND tre.item_id = %u;",buf2,containerId); - - if (!RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query); - safe_delete_array(query); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf); - return(false); - } - safe_delete_array(query); - - uint32 resultRowTotal = mysql_num_rows(result); - - if(resultRowTotal == 0) { //Recipe contents matched more than 1 recipe, but not in this container + if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container LogFile->write(EQEMuLog::Error, "Combine error: Incorrect container is being used!"); - return(false); - } - if(resultRowTotal > 1) { //Recipe contents matched more than 1 recipe in this container - LogFile->write(EQEMuLog::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", resultRowTotal, containerId); + return false; } + + if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container + LogFile->write(EQEMuLog::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + } - row = mysql_fetch_row(result); + auto row = results.begin(); uint32 recipe_id = (uint32)atoi(row[0]); - mysql_free_result(result); //Right here we verify that we actually have ALL of the tradeskill components.. //instead of part which is possible with experimentation. //This is here because something's up with the query above.. it needs to be rethought out bool has_components = true; - char TSerrbuf[MYSQL_ERRMSG_SIZE]; - char *TSquery = 0; - MYSQL_RES *TSresult; - MYSQL_ROW TSrow; - if (RunQuery(TSquery, MakeAnyLenString(&TSquery, "SELECT item_id, componentcount from tradeskill_recipe_entries where recipe_id=%i AND componentcount > 0", recipe_id), TSerrbuf, &TSresult)) { - while((TSrow = mysql_fetch_row(TSresult))!=nullptr) { - int ccnt = 0; - for(int x = MAIN_BEGIN; x < EmuConstants::MAP_WORLD_SIZE; x++) { - const ItemInst* inst = container->GetItem(x); - if(inst){ - const Item_Struct* item = GetItem(inst->GetItem()->ID); - if (item) { - if(item->ID == atoi(TSrow[0])){ - ccnt++; - } - } - } - } - if(ccnt != atoi(TSrow[1])) - has_components = false; - } - mysql_free_result(TSresult); - } else { - LogFile->write(EQEMuLog::Error, "Error in tradeskill verify query: '%s': %s", TSquery, TSerrbuf); - } - safe_delete_array(TSquery); - if(has_components == false){ + query = StringFormat("SELECT item_id, componentcount " + "FROM tradeskill_recipe_entries " + "WHERE recipe_id = %i AND componentcount > 0", + recipe_id); + results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); + } - return false; - } + if (results.RowCount() == 0) + return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); - return(GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec)); + for (auto row = results.begin(); row != results.end(); ++row) { + int ccnt = 0; + + for(int x = MAIN_BEGIN; x < EmuConstants::MAP_WORLD_SIZE; x++) { + const ItemInst* inst = container->GetItem(x); + if(!inst) + continue; + + const Item_Struct* item = GetItem(inst->GetItem()->ID); + if (!item) + continue; + + if(item->ID == atoi(row[0])) + ccnt++; + } + + if(ccnt != atoi(row[1])) + return false; + } + + return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, From 97c1c479f9ab41cda290a45a818385bb18032ad6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 15:55:12 -0700 Subject: [PATCH 0123/1883] GetTradeRecipe converted to QueryDatabase --- zone/tradeskills.cpp | 143 ++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 83 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 6e06800da..78b42fa73 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1315,56 +1315,46 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec) { - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - char *query = 0; - - uint32 qcount = 0; - uint32 qlen; // make where clause segment for container(s) - char containers[30]; - if (some_id == 0) { - // world combiner so no item number - snprintf(containers,29, "= %u", c_type); - } else { - // container in inventory - snprintf(containers,29, "in (%u,%u)", c_type, some_id); + std::string containers; + if (some_id == 0) + containers = StringFormat("= %u", c_type); // world combiner so no item number + else + containers = StringFormat("IN (%u,%u)", c_type, some_id); // container in inventory + + std::string query = StringFormat("SELECT tr.id, tr.tradeskill, tr.skillneeded, " + "tr.trivial, tr.nofail, tr.replace_container, " + "tr.name, tr.must_learn, tr.quest, crl.madecount " + "FROM tradeskill_recipe AS tr " + "INNER JOIN tradeskill_recipe_entries AS tre " + "ON tr.id = tre.recipe_id " + "LEFT JOIN (SELECT recipe_id, madecount " + "FROM char_recipe_list WHERE char_id = %u) AS crl " + "ON tr.id = crl.recipe_id " + "WHERE tr.id = %lu AND tre.item_id %s AND tr.enabled " + "GROUP BY tr.id", + char_id, (unsigned long)recipe_id, containers.c_str()); + auto results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + return false; } - qlen = MakeAnyLenString(&query, "SELECT tr.id, tr.tradeskill, tr.skillneeded," - " tr.trivial, tr.nofail, tr.replace_container, tr.name, tr.must_learn, tr.quest, crl.madecount" - " FROM tradeskill_recipe AS tr inner join tradeskill_recipe_entries as tre" - " ON tr.id = tre.recipe_id" - " LEFT JOIN (SELECT recipe_id, madecount from char_recipe_list WHERE char_id = %u) AS crl " - " ON tr.id = crl.recipe_id " - " WHERE tr.id = %lu AND tre.item_id %s AND tr.enabled " - " GROUP BY tr.id", char_id, (unsigned long)recipe_id, containers); + if(results.RowCount() != 1) + return false;//just not found i guess.. - if (!RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, query: %s", query); - safe_delete_array(query); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", errbuf); - return(false); - } - safe_delete_array(query); - - qcount = mysql_num_rows(result); - if(qcount != 1) { - //just not found i guess.. - return(false); - } - - row = mysql_fetch_row(result); - spec->tradeskill = (SkillUseTypes)atoi(row[1]); - spec->skill_needed = (int16)atoi(row[2]); - spec->trivial = (uint16)atoi(row[3]); - spec->nofail = atoi(row[4]) ? true : false; + auto row = results.begin(); + spec->tradeskill = (SkillUseTypes)atoi(row[1]); + spec->skill_needed = (int16)atoi(row[2]); + spec->trivial = (uint16)atoi(row[3]); + spec->nofail = atoi(row[4]) ? true : false; spec->replace_container = atoi(row[5]) ? true : false; spec->name = row[6]; spec->must_learn = (uint8)atoi(row[7]); spec->quest = atoi(row[8]) ? true : false; + if (row[9] == nullptr) { spec->has_learnt = false; spec->madecount = 0; @@ -1373,72 +1363,59 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id spec->madecount = (uint32)atoul(row[9]); } spec->recipe_id = recipe_id; - mysql_free_result(result); //Pull the on-success items... - qlen = MakeAnyLenString(&query, "SELECT item_id,successcount FROM tradeskill_recipe_entries" - " WHERE successcount>0 AND recipe_id=%u", recipe_id); - - if (!RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success query '%s': %s", query, errbuf); - safe_delete_array(query); - return(false); + query = StringFormat("SELECT item_id,successcount FROM tradeskill_recipe_entries " + "WHERE successcount > 0 AND recipe_id = %u", recipe_id); + results = QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + return false; } - safe_delete_array(query); - qcount = mysql_num_rows(result); - if(qcount < 1) { + if(results.RowCount() < 1) { LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success: no success items returned"); - return(false); + return false; } - uint8 r; + spec->onsuccess.clear(); - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + for(auto row = results.begin(); row != results.end(); ++row) { uint32 item = (uint32)atoi(row[0]); uint8 num = (uint8) atoi(row[1]); spec->onsuccess.push_back(std::pair(item, num)); } - mysql_free_result(result); + spec->onfail.clear(); //Pull the on-fail items... - qlen = MakeAnyLenString(&query, "SELECT item_id,failcount FROM tradeskill_recipe_entries" - " WHERE failcount>0 AND recipe_id=%u", recipe_id); - - spec->onfail.clear(); - if (RunQuery(query, qlen, errbuf, &result)) { - - qcount = mysql_num_rows(result); - uint8 r; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + query = StringFormat("SELECT item_id, failcount FROM tradeskill_recipe_entries " + "WHERE failcount > 0 AND recipe_id = %u", recipe_id); + results = QueryDatabase(query); + if (results.Success()) + for(auto row = results.begin(); row != results.end(); ++row) { uint32 item = (uint32)atoi(row[0]); uint8 num = (uint8) atoi(row[1]); spec->onfail.push_back(std::pair(item, num)); } - mysql_free_result(result); - } + + spec->salvage.clear(); + + // Don't bother with the query if TS is nofail + if (spec->nofail) + return true; // Pull the salvage list - qlen = MakeAnyLenString(&query, "SELECT item_id,salvagecount FROM tradeskill_recipe_entries WHERE salvagecount>0 AND recipe_id=%u", recipe_id); - - spec->salvage.clear(); - // Don't bother with the query if TS is nofail - if (!spec->nofail && RunQuery(query, qlen, errbuf, &result)) { - qcount = mysql_num_rows(result); - uint8 r; - for(r = 0; r < qcount; r++) { - row = mysql_fetch_row(result); + query = StringFormat("SELECT item_id, salvagecount " + "FROM tradeskill_recipe_entries " + "WHERE salvagecount > 0 AND recipe_id = %u", recipe_id); + results = QueryDatabase(query); + if (results.Success()) + for(auto row = results.begin(); row != results.begin(); ++row) { uint32 item = (uint32)atoi(row[0]); uint8 num = (uint8)atoi(row[1]); spec->salvage.push_back(std::pair(item, num)); } - mysql_free_result(result); - } - safe_delete_array(query); - - return(true); + return true; } void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madecount) From 5dac9a944b4ddb65e1f4ee901bc70f4d69ddd3e1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 16:02:30 -0700 Subject: [PATCH 0124/1883] LearnRecipe converted to QueryDatabase --- zone/tradeskills.cpp | 87 +++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 53 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 78b42fa73..09cf70fc3 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1418,73 +1418,54 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id return true; } -void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madecount) +void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madeCount) { - char *query = 0; - uint32 qlen; - char errbuf[MYSQL_ERRMSG_SIZE]; - - qlen = MakeAnyLenString(&query, "INSERT INTO char_recipe_list " - " SET recipe_id = %u, char_id = %u, madecount = %u " - " ON DUPLICATE KEY UPDATE madecount = %u;" - , recipe_id, char_id, madecount, madecount); - - if (!RunQuery(query, qlen, errbuf)) { - LogFile->write(EQEMuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query, errbuf); - } - safe_delete_array(query); + std::string query = StringFormat("INSERT INTO char_recipe_list " + "SET recipe_id = %u, char_id = %u, madecount = %u " + "ON DUPLICATE KEY UPDATE madecount = %u;", + recipe_id, char_id, madeCount, madeCount); + auto results = QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) { - char *query = 0; - uint32 qlen; - uint32 qcount = 0; - char errbuf[MYSQL_ERRMSG_SIZE]; - MYSQL_RES *result; - MYSQL_ROW row; - - qlen = MakeAnyLenString(&query, "SELECT tr.name, crl.madecount " - " FROM tradeskill_recipe as tr " - " LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl " - " ON tr.id = crl.recipe_id " - " WHERE tr.id = %u ;", CharacterID(), recipeID); - - if (!database.RunQuery(query, qlen, errbuf, &result)) { - LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query, errbuf); - safe_delete_array(query); + std::string query = StringFormat("SELECT tr.name, crl.madecount " + "FROM tradeskill_recipe AS tr " + "LEFT JOIN (SELECT recipe_id, madecount " + "FROM char_recipe_list WHERE char_id = %u) AS crl " + "ON tr.id = crl.recipe_id " + "WHERE tr.id = %u ;", CharacterID(), recipeID); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } - qcount = mysql_num_rows(result); - if (qcount != 1) { - LogFile->write(EQEMuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, qcount); - mysql_free_result(result); - safe_delete_array(query); + if (results.RowCount() != 1) { + LogFile->write(EQEMuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } - safe_delete_array(query); - row = mysql_fetch_row(result); + auto row = results.begin(); - if (row != nullptr && row[0] != nullptr) { - // Only give Learn message if character doesn't know the recipe - if (row[1] == nullptr) { - Message_StringID(4, TRADESKILL_LEARN_RECIPE, row[0]); - // Actually learn the recipe now - qlen = MakeAnyLenString(&query, "INSERT INTO char_recipe_list " - " SET recipe_id = %u, char_id = %u, madecount = 0 " - " ON DUPLICATE KEY UPDATE madecount = madecount;" - , recipeID, CharacterID()); + if (row[0] == nullptr) + return; - if (!database.RunQuery(query, qlen, errbuf)) { - LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query, errbuf); - } - safe_delete_array(query); - } - } + // Only give Learn message if character doesn't know the recipe + if (row[1] != nullptr) + return; - mysql_free_result(result); + Message_StringID(4, TRADESKILL_LEARN_RECIPE, row[0]); + // Actually learn the recipe now + query = StringFormat("INSERT INTO char_recipe_list " + "SET recipe_id = %u, char_id = %u, madecount = 0 " + "ON DUPLICATE KEY UPDATE madecount = madecount;", + recipeID, CharacterID()); + results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } From 6221c1f8ab39f712b67c40254ebb8c6a5ce8bbad Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 16:04:19 -0700 Subject: [PATCH 0125/1883] EnableRecipe converted to QueryDatabase --- zone/tradeskills.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 09cf70fc3..78480a7c1 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1511,19 +1511,13 @@ bool Client::CanIncreaseTradeskill(SkillUseTypes tradeskill) { bool ZoneDatabase::EnableRecipe(uint32 recipe_id) { - char *query = 0; - uint32 qlen; - char errbuf[MYSQL_ERRMSG_SIZE]; - uint32 affected_rows = 0; + std::string query = StringFormat("UPDATE tradeskill_recipe SET enabled = 1 " + "WHERE id = %u;", recipe_id); + auto results = QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); - qlen = MakeAnyLenString(&query, "UPDATE tradeskill_recipe SET enabled = 1 WHERE id = %u;", recipe_id); - - if (!RunQuery(query, qlen, errbuf, 0, &affected_rows)) { - LogFile->write(EQEMuLog::Error, "Error in EnableRecipe query '%s': %s", query, errbuf); - } - safe_delete_array(query); - - return (affected_rows > 0); + return results.RowsAffected() > 0; } bool ZoneDatabase::DisableRecipe(uint32 recipe_id) From e338f801eaf7b12e966eede7f286361a0b911e84 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 8 Oct 2014 16:05:52 -0700 Subject: [PATCH 0126/1883] DisableRecipe converted to QueryDatabase --- zone/tradeskills.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 78480a7c1..0fd130f89 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1522,16 +1522,11 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) bool ZoneDatabase::DisableRecipe(uint32 recipe_id) { - char *query = 0; - uint32 qlen; - char errbuf[MYSQL_ERRMSG_SIZE]; - uint32 affected_rows = 0; + std::string query = StringFormat("UPDATE tradeskill_recipe SET enabled = 0 " + "WHERE id = %u;", recipe_id); + auto results = QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); - qlen = MakeAnyLenString(&query, "UPDATE tradeskill_recipe SET enabled = 0 WHERE id = %u;", recipe_id); - - if (!RunQuery(query, qlen, errbuf, 0, &affected_rows)) { - LogFile->write(EQEMuLog::Error, "Error in DisableRecipe query '%s': %s", query, errbuf); - } - safe_delete_array(query); - return (affected_rows > 0); + return results.RowsAffected() > 0; } From 28ac586ed8e9e0ef1cd789ff5a3d678c2e8850d5 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 9 Oct 2014 00:23:54 -0400 Subject: [PATCH 0127/1883] Update info for #suspend --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 2d7a13943..aa632be82 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -371,7 +371,7 @@ int command_init(void) { command_add("logs","[status|normal|error|debug|quest|all] - Subscribe to a log type",250,command_logs) || command_add("nologs","[status|normal|error|debug|quest|all] - Unsubscribe to a log type",250,command_nologs) || command_add("ban","[name] [reason]- Ban by character name",150,command_ban) || - command_add("suspend","[name][days] - Suspend by character name and for specificed number of days",150,command_suspend) || + command_add("suspend","[name] [days] [reason] - Suspend by character name and for specificed number of days",150,command_suspend) || command_add("ipban","[IP address] - Ban IP by character name",200,command_ipban) || command_add("oocmute","[1/0] - Mutes OOC chat",200,command_oocmute) || command_add("revoke","[charname] [1/0] - Makes charname unable to talk on OOC",200,command_revoke) || From c3288296109762807dffa766e1a4c0bfa5a210cb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 9 Oct 2014 22:55:28 -0400 Subject: [PATCH 0128/1883] Fix out of bounds error in SaveCharacterLeadershipAAs --- zone/zonedb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7815b5b96..1ba36c5fd 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1295,7 +1295,7 @@ bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, bool ZoneDatabase::SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp){ uint8 first_entry = 0; std::string query = ""; - for (int i = 0; i <= MAX_LEADERSHIP_AA_ARRAY; i++){ + for (int i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){ if (pp->leader_abilities.ranks[i] > 0){ if (first_entry != 1){ query = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); From ea4c23efcf378b00909b70a7352167dc01624f46 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 9 Oct 2014 23:11:18 -0400 Subject: [PATCH 0129/1883] Establish default order for merchantlist items. Allow merchants to use 80th slot. --- zone/client_process.cpp | 91 +++++++++++++++++++++-------------------- zone/zone.cpp | 56 +++++++++++++------------ 2 files changed, 77 insertions(+), 70 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 544200910..d9b2d9030 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -967,93 +967,96 @@ 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. + uint32 numItemSlots = 80; //The max number of items passed in the transaction. const Item_Struct *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; Mob* merch = entity_list.GetMobByNpcTypeID(npcid); - if(merlist.size()==0){ //Attempt to load the data, it might have been missed if someone spawned the merchant after the zone was loaded + if (merlist.size() == 0) { //Attempt to load the data, it might have been missed if someone spawned the merchant after the zone was loaded zone->LoadNewMerchantData(merchant_id); merlist = zone->merchanttable[merchant_id]; - if(merlist.size()==0) + if (merlist.size() == 0) return; } std::list tmp_merlist = zone->tmpmerchanttable[npcid]; std::list::iterator tmp_itr; - uint32 i=1; + uint32 i = 1; uint8 handychance = 0; - for (itr = merlist.begin(); itr != merlist.end() && i < numItemSlots; ++itr) { + for (itr = merlist.begin(); itr != merlist.end() && i <= numItemSlots; ++itr) { MerchantList ml = *itr; if (merch->CastToNPC()->GetMerchantProbability() > ml.probability) continue; - - if(GetLevel() < ml.level_required) + + if (GetLevel() < ml.level_required) continue; if (!(ml.classes_required & (1 << (GetClass() - 1)))) continue; int32 fac = merch ? merch->GetPrimaryFaction() : 0; - if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) + if (fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) continue; - handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1 ); + handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1); item = database.GetItem(ml.item); - if(item) { - if(handychance==0) - handyitem=item; + if (item) { + if (handychance == 0) + handyitem = item; else handychance--; - int charges=1; - if(item->ItemClass==ItemClassCommon) - charges=item->MaxCharges; + int charges = 1; + if (item->ItemClass == ItemClassCommon) + charges = item->MaxCharges; ItemInst* inst = database.CreateItem(item, charges); if (inst) { - if (RuleB(Merchant, UsePriceMod)){ - inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false))); + if (RuleB(Merchant, UsePriceMod)) { + inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); } else - inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate)); + inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate)); inst->SetMerchantSlot(ml.slot); inst->SetMerchantCount(-1); //unlimited - if(charges > 0) + if (charges > 0) inst->SetCharges(charges); else inst->SetCharges(1); - SendItemPacket(ml.slot-1, inst, ItemPacketMerchant); + SendItemPacket(ml.slot - 1, inst, ItemPacketMerchant); safe_delete(inst); } } // Account for merchant lists with gaps. - if(ml.slot >= i) + if (ml.slot >= i) { + if (ml.slot > i) + LogFile->write(EQEMuLog::Debug, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; + } } std::list origtmp_merlist = zone->tmpmerchanttable[npcid]; tmp_merlist.clear(); - for(tmp_itr = origtmp_merlist.begin();tmp_itr != origtmp_merlist.end() && iItemClass==ItemClassCommon && (int16)ml.charges <= item->MaxCharges) // charges=ml.charges; //else charges = item->MaxCharges; ItemInst* inst = database.CreateItem(item, charges); if (inst) { - if (RuleB(Merchant, UsePriceMod)){ - inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(merch,false))); + if (RuleB(Merchant, UsePriceMod)) { + inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate * Client::CalcPriceMod(merch, false))); } else - inst->SetPrice((item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate)); + inst->SetPrice((item->Price * (RuleR(Merchant, SellCostMod)) * item->SellRate)); inst->SetMerchantSlot(ml.slot); inst->SetMerchantCount(ml.charges); if(charges > 0) @@ -1069,32 +1072,32 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { } //this resets the slot zone->tmpmerchanttable[npcid] = tmp_merlist; - if(merch != nullptr && handyitem){ - char handy_id[8]={0}; - int greeting=MakeRandomInt(0, 4); - int greet_id=0; - switch(greeting){ + if (merch != nullptr && handyitem) { + char handy_id[8] = { 0 }; + int greeting = MakeRandomInt(0, 4); + int greet_id = 0; + switch (greeting) { case 1: - greet_id=MERCHANT_GREETING; + greet_id = MERCHANT_GREETING; break; case 2: - greet_id=MERCHANT_HANDY_ITEM1; + greet_id = MERCHANT_HANDY_ITEM1; break; case 3: - greet_id=MERCHANT_HANDY_ITEM2; + greet_id = MERCHANT_HANDY_ITEM2; break; case 4: - greet_id=MERCHANT_HANDY_ITEM3; + greet_id = MERCHANT_HANDY_ITEM3; break; default: - greet_id=MERCHANT_HANDY_ITEM4; + greet_id = MERCHANT_HANDY_ITEM4; } - sprintf(handy_id,"%i",greet_id); + sprintf(handy_id, "%i", greet_id); - if(greet_id!=MERCHANT_GREETING) - Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName(),handyitem->Name); + if (greet_id != MERCHANT_GREETING) + Message_StringID(10, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName(), handyitem->Name); else - Message_StringID(10,GENERIC_STRINGID_SAY,merch->GetCleanName(),handy_id,this->GetName()); + Message_StringID(10, GENERIC_STRINGID_SAY, merch->GetCleanName(), handy_id, this->GetName()); merch->CastToNPC()->FaceTarget(this->CastToMob()); } diff --git a/zone/zone.cpp b/zone/zone.cpp index 446110a4a..23aa95f2c 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -307,41 +307,40 @@ bool Zone::LoadGroundSpawns() { return(true); } -int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold){ +int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold) { int freeslot = 0; std::list merlist = merchanttable[merchantid]; std::list::const_iterator itr; uint32 i = 1; for (itr = merlist.begin(); itr != merlist.end(); ++itr) { MerchantList ml = *itr; - if(ml.item == item) + if (ml.item == item) return 0; // Account for merchant lists with gaps in them. - if(ml.slot >= i) + if (ml.slot >= i) i = ml.slot + 1; - } std::list tmp_merlist = tmpmerchanttable[npcid]; std::list::const_iterator tmp_itr; bool update_charges = false; TempMerchantList ml; - while(freeslot == 0 && !update_charges){ + while (freeslot == 0 && !update_charges) { freeslot = i; for (tmp_itr = tmp_merlist.begin(); tmp_itr != tmp_merlist.end(); ++tmp_itr) { ml = *tmp_itr; - if(ml.item == item){ + if (ml.item == item) { update_charges = true; freeslot = 0; break; } - if((ml.slot == i) || (ml.origslot==i)) { - freeslot=0; + if ((ml.slot == i) || (ml.origslot == i)) { + freeslot = 0; } } i++; } - if(update_charges){ + if (update_charges) { tmp_merlist.clear(); std::list oldtmp_merlist = tmpmerchanttable[npcid]; for (tmp_itr = oldtmp_merlist.begin(); tmp_itr != oldtmp_merlist.end(); ++tmp_itr) { @@ -349,27 +348,27 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg if(ml2.item != item) tmp_merlist.push_back(ml2); } - if(sold) + if (sold) ml.charges = ml.charges + charges; else ml.charges = charges; - if(!ml.origslot) + if (!ml.origslot) ml.origslot = ml.slot; - if(charges>0){ + if (charges > 0) { database.SaveMerchantTemp(npcid, ml.origslot, item, ml.charges); tmp_merlist.push_back(ml); } - else{ - database.DeleteMerchantTemp(npcid,ml.origslot); + else { + database.DeleteMerchantTemp(npcid, ml.origslot); } tmpmerchanttable[npcid] = tmp_merlist; - if(sold) + if (sold) return ml.slot; } - if(freeslot){ - if(charges<0) //sanity check only, shouldnt happen + if (freeslot) { + if (charges < 0) //sanity check only, shouldnt happen charges = 0x7FFF; database.SaveMerchantTemp(npcid, freeslot, item, charges); tmp_merlist = tmpmerchanttable[npcid]; @@ -391,13 +390,13 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { std::list::const_iterator Iterator; for (Iterator = TmpMerchantList.begin(); Iterator != TmpMerchantList.end(); ++Iterator) - if((*Iterator).slot == Slot) + if ((*Iterator).slot == Slot) return (*Iterator).charges; return 0; } -void Zone::LoadTempMerchantData(){ +void Zone::LoadTempMerchantData() { LogFile->write(EQEMuLog::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " @@ -412,7 +411,8 @@ void Zone::LoadTempMerchantData(){ "WHERE " "ml.npcid = se.npcid " "AND se.spawngroupid = s2.spawngroupid " - "AND s2.zone = '%s' AND s2.version = %i", GetShortName(), GetInstanceVersion()); + "AND s2.zone = '%s' AND s2.version = %i" + "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); @@ -441,11 +441,11 @@ void Zone::LoadTempMerchantData(){ pQueuedMerchantsWorkID = 0; } -void Zone::LoadNewMerchantData(uint32 merchantid){ +void Zone::LoadNewMerchantData(uint32 merchantid) { std::list merlist; std::string query = StringFormat("SELECT item, slot, faction_required, level_required, alt_currency_cost, " - "classes_required FROM merchantlist WHERE merchantid=%d", merchantid); + "classes_required FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); @@ -467,7 +467,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){ merchanttable[merchantid] = merlist; } -void Zone::GetMerchantDataForZoneLoad(){ +void Zone::GetMerchantDataForZoneLoad() { LogFile->write(EQEMuLog::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " @@ -485,15 +485,19 @@ void Zone::GetMerchantDataForZoneLoad(){ "spawnentry AS se, " "spawn2 AS s2 " "WHERE nt.merchant_id = ml.merchantid AND nt.id = se.npcid " - "AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i ", GetShortName(), GetInstanceVersion()); + "AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i " + "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); std::map >::iterator cur; uint32 npcid = 0; - if (results.RowCount() == 0){ LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone"); return; } + if (results.RowCount() == 0) { + LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone"); + return; + } for (auto row = results.begin(); row != results.end(); ++row) { MerchantList ml; ml.id = atoul(row[0]); - if (npcid != ml.id){ + if (npcid != ml.id) { cur = merchanttable.find(ml.id); if (cur == merchanttable.end()) { std::list empty; From 3e1c917f1176a684cee33d6426303303a77ec138 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 9 Oct 2014 23:30:08 -0400 Subject: [PATCH 0130/1883] Fix issues with purchasing raid AAs --- zone/client_packet.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6da4a265f..2eb67ced4 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -10565,8 +10565,9 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) //sell them the ability. m_pp.raid_leadership_points -= cost; m_pp.leader_abilities.ranks[aaid]++; - } - else { + + database.SaveCharacterLeadershipAA(this->CharacterID(), &m_pp); + } else { //it is a group ability. if (cost > m_pp.group_leadership_points) { Message(13, "You do not have enough points to purchase this ability."); @@ -10585,7 +10586,10 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) UpdateLeadershipAA_Struct *u = (UpdateLeadershipAA_Struct *)outapp->pBuffer; u->ability_id = aaid; u->new_rank = m_pp.leader_abilities.ranks[aaid]; - u->pointsleft = m_pp.group_leadership_points; // FIXME: Take into account raid abilities + if (aaid >= raidAAMarkNPC) // raid AA + u->pointsleft = m_pp.raid_leadership_points; + else // group AA + u->pointsleft = m_pp.group_leadership_points; FastQueuePacket(&outapp); Group *g = GetGroup(); From 66cfb2e32bcd30e372d568bb7f54c307f25b2534 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 9 Oct 2014 23:54:48 -0400 Subject: [PATCH 0131/1883] Added a 'BOTS' converter to supplement Akkadius's recent 'PP' blob converter - updates views/function to reference the proper tables and columns. --- changelog.txt | 9 +++ common/database.cpp | 166 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) diff --git a/changelog.txt b/changelog.txt index d00864914..76bef57e4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,14 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/09/2014 == +Uleat: Added 'BOTS' conversion code to supplement the database 'PlayerProfile' blob conversion that Akkadius recently implemented. +Note: This automatic conversion uses the view `vwbotcharactermobs` as an update vector. If you need/would like for the converter to run on +previously and/or manually changed code, or just have a need for it to re-run, change the following in the database view and save: + "c.`last_login`," to "c.`timelaston`," + "c.`zone_id`" to "c.`zoneid`" + "FROM `character_data` AS c" to "FROM `character_old` AS c" +** This will only work if you haven't deleted your `character_old` table ** + == 10/07/2014 == demonstar55: Identified tutorial flag in all charcreate packets, reworked logic to correctly set homes binds diff --git a/common/database.cpp b/common/database.cpp index 1af4d05a0..dedc00ff1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1915,6 +1915,172 @@ bool Database::CheckDatabaseConversions() { printf("\n\nCharacter blob conversion complete, continuing world bootup...\n"); } + +#ifdef BOTS + + int runbotsconvert = 0; + + /* Check For Legacy Bot References */ + rquery = StringFormat("SHOW CREATE VIEW `vwbotcharactermobs`"); + results = QueryDatabase(rquery); + if (results.RowCount() == 1){ + auto row = results.begin(); + std::string table_check = row[1]; + + if (table_check.find("character_data") == -1){ + runbotsconvert = 1; + printf("\n\n::: Legacy Bot Views and Function Detected... \n"); + printf("----------------------------------------------------------\n\n"); + printf(" Database currently has bot view/function linkage to obselete \n"); + printf(" table references and will now be converted...\n\n"); + printf("----------------------------------------------------------\n\n"); + std::cout << "Press ENTER to continue....." << std::endl << std::endl; + std::cin.ignore(1); + } + } + else{ + ThrowDBError(results.ErrorMessage(), "Bot View Discovery", rquery); + } + + if (runbotsconvert == 1){ + + /* Update view `vwbotcharactermobs` */ + rquery = StringFormat("DROP VIEW `vwbotcharactermobs`;"); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwbotcharactermobs`", rquery); + + rquery = StringFormat( + "CREATE VIEW `vwbotcharactermobs` AS\n" + "SELECT _utf8'C' AS mobtype,\n" // Natedog: '_utf8' + "c.`id`,\n" + "c.`name`,\n" + "c.`class`,\n" + "c.`level`,\n" + "c.`last_login`,\n" + "c.`zone_id`\n" + "FROM `character_data` AS c\n" + "UNION ALL\n" + "SELECT _utf8'B' AS mobtype,\n" // Natedog: '_utf8' + "b.`BotID` AS id,\n" + "b.`Name` AS name,\n" + "b.`Class` AS class,\n" + "b.`BotLevel` AS level,\n" + "0 AS timelaston,\n" + "0 AS zoneid\n" + "FROM bots AS b;" + ); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwbotcharactermobs`", rquery); + + + /* Update function `GetMobType` */ + rquery = StringFormat("DROP FUNCTION IF EXISTS `GetMobType`;"); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Drop Function `GetMobType`", rquery); + + rquery = StringFormat( + "CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)\n" + "BEGIN\n" + " DECLARE Result CHAR(1);\n" + "\n" + " SET Result = NULL;\n" + "\n" + " IF (SELECT COUNT(*) FROM `character_data` WHERE `name` = mobname) > 0 THEN\n" + " SET Result = 'C';\n" + " ELSEIF (SELECT COUNT(*) FROM `bots` WHERE `Name` = mobname) > 0 THEN\n" + " SET Result = 'B';\n" + " END IF;\n " + "\n" + " RETURN Result;\n" + "END" + ); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Create Function `GetMobType`", rquery); + + + /* Update view `vwgroups` */ + rquery = StringFormat("DROP VIEW IF EXISTS `vwgroups`;"); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwgroups`", rquery); + + rquery = StringFormat( + "CREATE VIEW `vwgroups` AS\n" + "SELECT g.`groupid` AS groupid,\n" + "GetMobType(g.`name`) AS mobtype,\n" + "g.`name` AS name,\n" + "g.`charid` AS mobid,\n" + "IFNULL(c.`level`, b.`BotLevel`) AS level\n" + "FROM `group_id` AS g\n" + "LEFT JOIN `character_data` AS c ON g.`name` = c.`name`\n" + "LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;" + ); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwgroups`", rquery); + + + /* Update view `vwbotgroups` */ + rquery = StringFormat("DROP VIEW IF EXISTS `vwbotgroups`;"); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwbotgroups`", rquery); + + rquery = StringFormat( + "CREATE VIEW `vwbotgroups` AS\n" + "SELECT g.`BotGroupId`,\n" + "g.`BotGroupName`,\n" + "g.`BotGroupLeaderBotId`,\n" + "b.`Name` AS BotGroupLeaderName,\n" + "b.`BotOwnerCharacterId`,\n" + "c.`name` AS BotOwnerCharacterName\n" + "FROM `botgroup` AS g\n" + "JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID`\n" + "JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id`\n" + "ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;" + ); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwbotgroups`", rquery); + + + /* Update view `vwguildmembers` */ + rquery = StringFormat("DROP VIEW IF EXISTS `vwguildmembers`;"); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwguildmembers`", rquery); + + rquery = StringFormat( + "CREATE VIEW `vwguildmembers` AS\n" + "SELECT 'C' AS mobtype,\n" + "cm.`char_id`,\n" + "cm.`guild_id`,\n" + "cm.`rank`,\n" + "cm.`tribute_enable`,\n" + "cm.`total_tribute`,\n" + "cm.`last_tribute`,\n" + "cm.`banker`,\n" + "cm.`public_note`,\n" + "cm.`alt`\n" + "FROM `guild_members` AS cm\n" + "UNION ALL\n" + "SELECT 'B' AS mobtype,\n" + "bm.`char_id`,\n" + "bm.`guild_id`,\n" + "bm.`rank`,\n" + "bm.`tribute_enable`,\n" + "bm.`total_tribute`,\n" + "bm.`last_tribute`,\n" + "bm.`banker`,\n" + "bm.`public_note`,\n" + "bm.`alt`\n" + "FROM `botguildmembers` AS bm;" + ); + results = QueryDatabase(rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwguildmembers`", rquery); + } + + if (runbotsconvert == 1){ + printf("\n\nBot views/function conversion complete, continuing world bootup...\n"); + } + +#endif + return true; } From 35049d530e6fccdd5a0b5993cf90359a346b09db Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 11 Oct 2014 01:14:11 -0400 Subject: [PATCH 0132/1883] Implement Raid MOTD for UF Don't forget to source 2014_10_11_RaidMOTD.sql SoD and RoF implementations still to come --- changelog.txt | 4 ++ common/eq_packet_structs.h | 4 ++ common/patches/underfoot.cpp | 51 +++++++++++++++--- common/patches/underfoot_structs.h | 5 ++ common/servertalk.h | 6 +++ .../sql/git/required/2014_10_11_RaidMOTD.sql | 1 + world/zoneserver.cpp | 8 +++ zone/client_packet.cpp | 18 ++++++- zone/raids.cpp | 52 ++++++++++++++++++- zone/raids.h | 9 +++- zone/worldserver.cpp | 12 +++++ 11 files changed, 158 insertions(+), 12 deletions(-) create mode 100644 utils/sql/git/required/2014_10_11_RaidMOTD.sql diff --git a/changelog.txt b/changelog.txt index 76bef57e4..2461b4a36 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/11/2014 == +demonstar55: Implement Raid MOTD for UF + Don't forget 2014_10_11_RaidMOTD.sql! + == 10/09/2014 == Uleat: Added 'BOTS' conversion code to supplement the database 'PlayerProfile' blob conversion that Akkadius recently implemented. Note: This automatic conversion uses the view `vwbotcharactermobs` as an update vector. If you need/would like for the converter to run on diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index f49c0106c..eda2a5ce8 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -3929,6 +3929,10 @@ struct RaidAddMember_Struct { /*139*/ uint8 flags[5]; //no idea if these are needed... }; +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*136*/ char motd[0]; // max size is 1024, but reply is variable +}; struct RaidAdd_Struct { /*000*/ uint32 action; //=0 diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 1caf65bf3..03ef16a2a 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1929,6 +1929,17 @@ namespace Underfoot add_member->flags[4] = in_add_member->flags[4]; dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 35) + { + RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; + + outmotd->general.action = inmotd->general.action; + strn0cpy(outmotd->general.player_name, inmotd->general.player_name, 64); + strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; @@ -3367,15 +3378,41 @@ namespace Underfoot DECODE(OP_RaidInvite) { - DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); - SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); - strn0cpy(emu->leader_name, eq->leader_name, 64); - strn0cpy(emu->player_name, eq->player_name, 64); - IN(action); - IN(parameter); + // This is a switch on the RaidGeneral action + switch (*(uint32 *)__packet->pBuffer) { + case 35: { // raidMOTD + // we don't have a nice macro for this + structs::RaidMOTD_Struct *__eq_buffer = (structs::RaidMOTD_Struct *)__packet->pBuffer; + __eq_buffer->motd[1023] = '\0'; + size_t motd_size = strlen(__eq_buffer->motd) + 1; + __packet->size = sizeof(RaidMOTD_Struct) + motd_size; + __packet->pBuffer = new unsigned char[__packet->size]; + RaidMOTD_Struct *emu = (RaidMOTD_Struct *)__packet->pBuffer; + structs::RaidMOTD_Struct *eq = (structs::RaidMOTD_Struct *)__eq_buffer; + strn0cpy(emu->general.player_name, eq->general.player_name, 64); + strn0cpy(emu->motd, eq->motd, motd_size); + IN(general.action); + IN(general.parameter); + FINISH_DIRECT_DECODE(); + break; + } + case 36: { // raidPlayerNote unhandled + break; + } + default: { + DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); + SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + strn0cpy(emu->leader_name, eq->leader_name, 64); + strn0cpy(emu->player_name, eq->player_name, 64); + IN(action); + IN(parameter); + FINISH_DIRECT_DECODE(); + break; + } + } - FINISH_DIRECT_DECODE(); } DECODE(OP_ReadBook) diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 89101ca2e..f331d5dbc 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -3623,6 +3623,11 @@ struct RaidAddMember_Struct { /*139*/ uint8 flags[5]; //no idea if these are needed... }; +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*140*/ char motd[0]; // max size 1024, but reply is variable +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name diff --git a/common/servertalk.h b/common/servertalk.h index 8c30715d9..f458c758e 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -104,6 +104,7 @@ #define ServerOP_GroupFollow 0x0110 #define ServerOP_GroupFollowAck 0x0111 #define ServerOP_GroupCancelInvite 0x0112 +#define ServerOP_RaidMOTD 0x0113 #define ServerOP_InstanceUpdateTime 0x014F #define ServerOP_AdventureRequest 0x0150 @@ -854,6 +855,11 @@ struct ServerRaidMessage_Struct { char message[0]; }; +struct ServerRaidMOTD_Struct { + uint32 rid; + char motd[0]; +}; + struct ServerLFGMatchesRequest_Struct { uint32 FromID; uint8 QuerierLevel; diff --git a/utils/sql/git/required/2014_10_11_RaidMOTD.sql b/utils/sql/git/required/2014_10_11_RaidMOTD.sql new file mode 100644 index 000000000..39fccd311 --- /dev/null +++ b/utils/sql/git/required/2014_10_11_RaidMOTD.sql @@ -0,0 +1 @@ +ALTER TABLE `raid_details` ADD `motd` varchar(1024); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 1023dbe69..b94bda20a 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -409,6 +409,14 @@ bool ZoneServer::Process() { break; } + case ServerOP_RaidMOTD: { + if (pack->size < sizeof(ServerRaidMOTD_Struct)) + break; + + zoneserver_list.SendPacket(pack); + break; + } + case ServerOP_SpawnCondition: { if(pack->size != sizeof(ServerSpawnCondition_Struct)) break; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2eb67ced4..03d44c903 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -565,6 +565,7 @@ void Client::CompleteConnect() raid->SendRaidAdd(GetName(), this); raid->SendBulkRaid(this); raid->SendGroupUpdate(this); + raid->SendRaidMOTD(this); uint32 grpID = raid->GetGroup(GetName()); if (grpID < 12){ raid->SendRaidGroupRemove(GetName(), grpID); @@ -10656,8 +10657,8 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { - if (app->size != sizeof(RaidGeneral_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_RaidCommand, size=%i, expected %i", app->size, sizeof(RaidGeneral_Struct)); + if (app->size < sizeof(RaidGeneral_Struct)) { + LogFile->write(EQEMuLog::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11219,6 +11220,19 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) break; } + case RaidCommandSetMotd: + { + Raid *r = entity_list.GetRaidByClient(this); + if (!r) + break; + // we don't use the RaidGeneral here! + RaidMOTD_Struct *motd = (RaidMOTD_Struct *)app->pBuffer; + r->SetRaidMOTD(std::string(motd->motd)); + r->SaveRaidMOTD(); + r->SendRaidMOTDToWorld(); + break; + } + default: { Message(13, "Raid command (%d) NYI", ri->action); break; diff --git a/zone/raids.cpp b/zone/raids.cpp index 1e8e23f8d..f22267a2f 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -89,6 +89,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo SendRaidAddAll(c->GetName()); c->SetRaidGrouped(true); + SendRaidMOTD(c); ServerPacket *pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; @@ -1205,6 +1206,44 @@ void Raid::SendRaidGroupRemove(const char *who, uint32 gid) safe_delete(pack); } +void Raid::SendRaidMOTD(Client *c) +{ + if (!c || motd.empty()) + return; + + size_t size = motd.size() + 1; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidMOTD_Struct) + size); + RaidMOTD_Struct *rmotd = (RaidMOTD_Struct *)outapp->pBuffer; + rmotd->general.action = raidSetMotd; + strn0cpy(rmotd->general.player_name, c->GetName(), 64); + strn0cpy(rmotd->motd, motd.c_str(), size); + c->FastQueuePacket(&outapp); +} + +void Raid::SendRaidMOTD() +{ + if (motd.empty()) + return; + + for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) + if (members[i].member) + SendRaidMOTD(members[i].member); +} + +void Raid::SendRaidMOTDToWorld() +{ + if (motd.empty()) + return; + + size_t size = motd.size() + 1; + ServerPacket *pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size); + ServerRaidMOTD_Struct *smotd = (ServerRaidMOTD_Struct *)pack->pBuffer; + smotd->rid = GetID(); + strn0cpy(smotd->motd, motd.c_str(), size); + worldserver.SendPacket(pack); + safe_delete(pack); +} + void Raid::LockRaid(bool lockFlag) { std::string query = StringFormat("UPDATE raid_details SET locked = %d WHERE raidid = %lu", @@ -1229,14 +1268,14 @@ void Raid::LockRaid(bool lockFlag) void Raid::SetRaidDetails() { - std::string query = StringFormat("INSERT INTO raid_details SET raidid = %lu, loottype = 4, locked = 0", + std::string query = StringFormat("INSERT INTO raid_details SET raidid = %lu, loottype = 4, locked = 0, motd = ''", (unsigned long)GetID()); auto results = database.QueryDatabase(query); } void Raid::GetRaidDetails() { - std::string query = StringFormat("SELECT locked, loottype FROM raid_details WHERE raidid = %lu", + std::string query = StringFormat("SELECT locked, loottype, motd FROM raid_details WHERE raidid = %lu", (unsigned long)GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) @@ -1251,6 +1290,15 @@ void Raid::GetRaidDetails() locked = atoi(row[0]); LootType = atoi(row[1]); + motd = std::string(row[2]); +} + +void Raid::SaveRaidMOTD() +{ + std::string query = StringFormat("UPDATE raid_details SET motd = '%s' WHERE raidid = %lu", + EscapeString(motd).c_str(), (unsigned long)GetID()); + + auto results = database.QueryDatabase(query); } bool Raid::LearnMembers() diff --git a/zone/raids.h b/zone/raids.h index be12788e6..44952e5da 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -38,7 +38,7 @@ enum { //raid packet types: raidMembers = 6, //len 395+, details + members list raidNoAssignLeadership = 7, raidCreate = 8, //len 72 - raidUnknown = 9, + raidUnknown = 9, // unused? raidNoRaid = 10, //parameter=0 raidChangeLootType = 11, raidStringID = 12, @@ -130,6 +130,8 @@ public: void AddRaidLooter(const char* looter); void RemoveRaidLooter(const char* looter); + inline void SetRaidMOTD(std::string in_motd) { motd = in_motd; }; + //util func //keeps me from having to keep iterating through the list //when I want lots of data from the same entry @@ -160,6 +162,7 @@ public: //also learns raid structure based on db. void SetRaidDetails(); void GetRaidDetails(); + void SaveRaidMOTD(); bool LearnMembers(); void VerifyRaid(); void MemberZoned(Client *c); @@ -194,6 +197,9 @@ public: void SendMakeGroupLeaderPacketAll(); void SendMakeGroupLeaderPacket(const char *who); //13 void SendMakeGroupLeaderPacketTo(const char *who, Client *to); + void SendRaidMOTD(Client *c); + void SendRaidMOTD(); + void SendRaidMOTDToWorld(); void QueuePacket(const EQApplicationPacket *app, bool ack_req = true); @@ -206,6 +212,7 @@ protected: uint32 LootType; bool disbandCheck; bool forceDisband; + std::string motd; }; diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index a1100b7cb..1ff42cd02 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1372,6 +1372,18 @@ void WorldServer::Process() { break; } + case ServerOP_RaidMOTD: { + ServerRaidMOTD_Struct *rmotd = (ServerRaidMOTD_Struct *)pack->pBuffer; + if (!zone) + break; + Raid *r = entity_list.GetRaidByID(rmotd->rid); + if (!r) + break; + r->SetRaidMOTD(std::string(rmotd->motd)); + r->SendRaidMOTD(); + break; + } + case ServerOP_SpawnPlayerCorpse: { SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer; Corpse* NewCorpse = database.LoadPlayerCorpse(s->player_corpse_id); From f097eaf3cd5a750a0c37ccbfde22812c3c4ab5dd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 11 Oct 2014 01:54:32 -0400 Subject: [PATCH 0133/1883] Raid MOTD for RoF --- common/patches/rof.cpp | 52 ++++++++++++++++++++++++++++++------ common/patches/rof_structs.h | 5 ++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index db1c5487e..49f6c51f1 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2602,6 +2602,17 @@ namespace RoF add_member->flags[4] = in_add_member->flags[4]; dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 35) + { + RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; + + outmotd->general.action = inmotd->general.action; + strn0cpy(outmotd->general.player_name, inmotd->general.player_name, 64); + strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; @@ -4475,15 +4486,40 @@ namespace RoF DECODE(OP_RaidInvite) { - DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); - SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); - strn0cpy(emu->leader_name, eq->leader_name, 64); - strn0cpy(emu->player_name, eq->player_name, 64); - IN(action); - IN(parameter); - - FINISH_DIRECT_DECODE(); + // This is a switch on the RaidGeneral action + switch (*(uint32 *)__packet->pBuffer) { + case 35: { // raidMOTD + // we don't have a nice macro for this + structs::RaidMOTD_Struct *__eq_buffer = (structs::RaidMOTD_Struct *)__packet->pBuffer; + __eq_buffer->motd[1023] = '\0'; + size_t motd_size = strlen(__eq_buffer->motd) + 1; + __packet->size = sizeof(RaidMOTD_Struct) + motd_size; + __packet->pBuffer = new unsigned char[__packet->size]; + RaidMOTD_Struct *emu = (RaidMOTD_Struct *)__packet->pBuffer; + structs::RaidMOTD_Struct *eq = (structs::RaidMOTD_Struct *)__eq_buffer; + strn0cpy(emu->general.player_name, eq->general.player_name, 64); + strn0cpy(emu->motd, eq->motd, motd_size); + IN(general.action); + IN(general.parameter); + FINISH_DIRECT_DECODE(); + break; + } + case 36: { // raidPlayerNote unhandled + break; + } + default: { + DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); + SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + strn0cpy(emu->leader_name, eq->leader_name, 64); + strn0cpy(emu->player_name, eq->player_name, 64); + IN(action); + IN(parameter); + FINISH_DIRECT_DECODE(); + break; + } + } } DECODE(OP_ReadBook) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 5f1d2aac4..99dff46cc 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -3994,6 +3994,11 @@ struct RaidAddMember_Struct { /*139*/ uint8 flags[5]; //no idea if these are needed... }; +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*140*/ char motd[0]; // max size 1024, but reply is variable +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From e5f3f4c5523c5eb92c869351887a380f106a02b0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 11 Oct 2014 02:03:49 -0400 Subject: [PATCH 0134/1883] Raid MOTD for SoD --- common/patches/sod.cpp | 52 ++++++++++++++++++++++++++++++------ common/patches/sod_structs.h | 5 ++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 8c64c479f..edfddabca 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1657,6 +1657,17 @@ namespace SoD add_member->flags[4] = in_add_member->flags[4]; dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 35) + { + RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; + + outmotd->general.action = inmotd->general.action; + strn0cpy(outmotd->general.player_name, inmotd->general.player_name, 64); + strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; @@ -2974,15 +2985,40 @@ namespace SoD DECODE(OP_RaidInvite) { - DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); - SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); - strn0cpy(emu->leader_name, eq->leader_name, 64); - strn0cpy(emu->player_name, eq->player_name, 64); - IN(action); - IN(parameter); - - FINISH_DIRECT_DECODE(); + // This is a switch on the RaidGeneral action + switch (*(uint32 *)__packet->pBuffer) { + case 35: { // raidMOTD + // we don't have a nice macro for this + structs::RaidMOTD_Struct *__eq_buffer = (structs::RaidMOTD_Struct *)__packet->pBuffer; + __eq_buffer->motd[1023] = '\0'; + size_t motd_size = strlen(__eq_buffer->motd) + 1; + __packet->size = sizeof(RaidMOTD_Struct) + motd_size; + __packet->pBuffer = new unsigned char[__packet->size]; + RaidMOTD_Struct *emu = (RaidMOTD_Struct *)__packet->pBuffer; + structs::RaidMOTD_Struct *eq = (structs::RaidMOTD_Struct *)__eq_buffer; + strn0cpy(emu->general.player_name, eq->general.player_name, 64); + strn0cpy(emu->motd, eq->motd, motd_size); + IN(general.action); + IN(general.parameter); + FINISH_DIRECT_DECODE(); + break; + } + case 36: { // raidPlayerNote unhandled + break; + } + default: { + DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); + SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + strn0cpy(emu->leader_name, eq->leader_name, 64); + strn0cpy(emu->player_name, eq->player_name, 64); + IN(action); + IN(parameter); + FINISH_DIRECT_DECODE(); + break; + } + } } DECODE(OP_ReadBook) diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 64d907c5b..53cc148b9 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -3562,6 +3562,11 @@ struct RaidAddMember_Struct { /*139*/ uint8 flags[5]; //no idea if these are needed... }; +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*140*/ char motd[0]; // max size 1024, but reply is variable +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From 6c5b569c29f7addc2e80bdb1408dd0d502cbe355 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 11 Oct 2014 02:07:49 -0400 Subject: [PATCH 0135/1883] Raid MOTD for SoF --- common/patches/sof.cpp | 52 ++++++++++++++++++++++++++++++------ common/patches/sof_structs.h | 5 ++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5a1d69bf4..bf5046c91 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1315,6 +1315,17 @@ namespace SoF add_member->flags[4] = in_add_member->flags[4]; dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 35) + { + RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; + + outmotd->general.action = inmotd->general.action; + strn0cpy(outmotd->general.player_name, inmotd->general.player_name, 64); + strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; @@ -2312,15 +2323,40 @@ namespace SoF DECODE(OP_RaidInvite) { - DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); - SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); - strn0cpy(emu->leader_name, eq->leader_name, 64); - strn0cpy(emu->player_name, eq->player_name, 64); - IN(action); - IN(parameter); - - FINISH_DIRECT_DECODE(); + // This is a switch on the RaidGeneral action + switch (*(uint32 *)__packet->pBuffer) { + case 35: { // raidMOTD + // we don't have a nice macro for this + structs::RaidMOTD_Struct *__eq_buffer = (structs::RaidMOTD_Struct *)__packet->pBuffer; + __eq_buffer->motd[1023] = '\0'; + size_t motd_size = strlen(__eq_buffer->motd) + 1; + __packet->size = sizeof(RaidMOTD_Struct) + motd_size; + __packet->pBuffer = new unsigned char[__packet->size]; + RaidMOTD_Struct *emu = (RaidMOTD_Struct *)__packet->pBuffer; + structs::RaidMOTD_Struct *eq = (structs::RaidMOTD_Struct *)__eq_buffer; + strn0cpy(emu->general.player_name, eq->general.player_name, 64); + strn0cpy(emu->motd, eq->motd, motd_size); + IN(general.action); + IN(general.parameter); + FINISH_DIRECT_DECODE(); + break; + } + case 36: { // raidPlayerNote unhandled + break; + } + default: { + DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); + SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + strn0cpy(emu->leader_name, eq->leader_name, 64); + strn0cpy(emu->player_name, eq->player_name, 64); + IN(action); + IN(parameter); + FINISH_DIRECT_DECODE(); + break; + } + } } DECODE(OP_ReadBook) diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 5164af3eb..c943b5108 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -3425,6 +3425,11 @@ struct RaidAddMember_Struct { /*139*/ uint8 flags[5]; //no idea if these are needed... }; +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*140*/ char motd[0]; // max size 1024, but reply is variable +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From ea734c90b5de9bbda696a9f88ce6031243e89531 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 12 Oct 2014 22:57:49 -0500 Subject: [PATCH 0136/1883] Fix for LDON Character Stat load --- changelog.txt | 3 +++ world/adventure.cpp | 1 + zone/client_packet.cpp | 1 + zone/zonedb.cpp | 28 ++++++++++++++++++++++++++++ zone/zonedb.h | 1 + 5 files changed, 34 insertions(+) diff --git a/changelog.txt b/changelog.txt index 2461b4a36..18e1a738b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/12/2014 == +Akkadius: Fix for LDON Character Stat load + == 10/11/2014 == demonstar55: Implement Raid MOTD for UF Don't forget 2014_10_11_RaidMOTD.sql! diff --git a/world/adventure.cpp b/world/adventure.cpp index 45dd206e5..5f61aa5e9 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -358,6 +358,7 @@ void Adventure::Finished(AdventureWinStatus ws) afe.points = 0; } adventure_manager.AddFinishedEvent(afe); + database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false); } ++iter; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 03d44c903..f7864df02 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1405,6 +1405,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */ database.LoadCharacterLeadershipAA(cid, &m_pp); /* Load Character Leadership AA's */ database.LoadCharacterTribute(cid, &m_pp); /* Load CharacterTribute */ + database.LoadCharacterLDONStats(cid, &m_pp); /* Load Character LDON Stats */ /* Set item material tint */ for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 1ba36c5fd..ca6576ef9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1028,6 +1028,34 @@ bool ZoneDatabase::LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_ return true; } +bool ZoneDatabase::LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp) { + std::string query = StringFormat("SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, `guk_losses`, " + "`mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", character_id); + + auto results = QueryDatabase(query); + + if (!results.Success()) + return false; + + if (results.RowCount() == 0) + return false; + + auto row = results.begin(); + + pp->ldon_wins_guk = atoi(row[0]); + pp->ldon_wins_mir = atoi(row[1]); + pp->ldon_wins_mmc = atoi(row[2]); + pp->ldon_wins_ruj = atoi(row[3]); + pp->ldon_wins_tak = atoi(row[4]); + pp->ldon_losses_guk = atoi(row[5]); + pp->ldon_losses_mir = atoi(row[6]); + pp->ldon_losses_mmc = atoi(row[7]); + pp->ldon_losses_ruj = atoi(row[8]); + pp->ldon_losses_tak = atoi(row[9]); + + return true; +} + bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat( "SELECT " diff --git a/zone/zonedb.h b/zone/zonedb.h index 30721de9a..d13e86c30 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -264,6 +264,7 @@ public: bool LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp); + bool LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp); /* Character Data Saves */ bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home); From 15cec40ed586d05c7c35ffe5d584533230e4aac3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 13 Oct 2014 15:59:11 -0700 Subject: [PATCH 0137/1883] Fix for issue #270, fix for temp merchant lists not loading correctly, fix for ah redundant getadventurestats code. --- common/database.cpp | 42 ++++++++++++++++++++++++++---------------- common/database.h | 3 +-- zone/client.cpp | 3 ++- zone/client_packet.cpp | 22 +++++++++++++++++----- zone/zone.cpp | 2 +- zone/zonedb.cpp | 28 ---------------------------- zone/zonedb.h | 1 - 7 files changed, 47 insertions(+), 54 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index dedc00ff1..76231c92a 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2949,11 +2949,20 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf){ } void Database::SetGroupLeaderName(uint32 gid, const char* name) { - std::string query = StringFormat("REPLACE INTO `group_leaders` SET `gid` = %lu, `leadername` = '%s'",(unsigned long)gid,name); - auto results = QueryDatabase(query); + std::string query = StringFormat("UPDATE group_leaders SET leadername = '%s' WHERE gid = %u", EscapeString(name).c_str(), gid); + auto result = QueryDatabase(query); - if (!results.Success()) - std::cout << "Unable to set group leader: " << results.ErrorMessage() << std::endl; + if(result.RowsAffected() != 0) { + return; + } + + query = StringFormat("INSERT INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller) VALUES(%u, '%s', '', '', '', '', '')", + gid, EscapeString(name).c_str()); + result = QueryDatabase(query); + + if(!result.Success()) { + LogFile->write(EQEMuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + } } char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank, char* assist, char* puller, char *marknpc, GroupLeadershipAA_Struct* GLAA){ @@ -3696,8 +3705,7 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win) QueryDatabase(query); } -bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, - uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l) +bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as) { std::string query = StringFormat("SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, `guk_losses`, " @@ -3712,16 +3720,18 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u auto row = results.begin(); - guk_w = atoi(row[0]); - mir_w = atoi(row[1]); - mmc_w = atoi(row[2]); - ruj_w = atoi(row[3]); - tak_w = atoi(row[4]); - guk_l = atoi(row[5]); - mir_l = atoi(row[6]); - mmc_l = atoi(row[7]); - ruj_l = atoi(row[8]); - tak_l = atoi(row[9]); + as->success.guk = atoi(row[0]); + as->success.mir = atoi(row[1]); + as->success.mmc = atoi(row[2]); + as->success.ruj = atoi(row[3]); + as->success.tak = atoi(row[4]); + as->failure.guk = atoi(row[5]); + as->failure.mir = atoi(row[6]); + as->failure.mmc = atoi(row[7]); + as->failure.ruj = atoi(row[8]); + as->failure.tak = atoi(row[9]); + as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak; + as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak; return true; } diff --git a/common/database.h b/common/database.h index a24198ca4..68ccf003a 100644 --- a/common/database.h +++ b/common/database.h @@ -174,8 +174,7 @@ public: * Adventure related. */ void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win); - bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w, - uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l); + bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as); /* * Account Related diff --git a/zone/client.cpp b/zone/client.cpp index a277b9858..ade40b860 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1287,7 +1287,7 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme) m_pp.ldon_points_ruj += rujpts; m_pp.ldon_points_tak += takpts; points-=splitpts; - // if anything left, recursively loop thru again + // if anything left, recursively loop thru again if (splitpts !=0) UpdateLDoNPoints(splitpts,0); break; @@ -1344,6 +1344,7 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme) } } m_pp.ldon_points_available += points; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventurePointsUpdate, sizeof(AdventurePoints_Update_Struct)); AdventurePoints_Update_Struct* apus = (AdventurePoints_Update_Struct*)outapp->pBuffer; apus->ldon_available_points = m_pp.ldon_points_available; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f7864df02..e0f2b3f01 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1405,7 +1405,22 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */ database.LoadCharacterLeadershipAA(cid, &m_pp); /* Load Character Leadership AA's */ database.LoadCharacterTribute(cid, &m_pp); /* Load CharacterTribute */ - database.LoadCharacterLDONStats(cid, &m_pp); /* Load Character LDON Stats */ + + /* Load AdventureStats */ + AdventureStats_Struct as; + if(database.GetAdventureStats(cid, &as)) + { + m_pp.ldon_wins_guk = as.success.guk; + m_pp.ldon_wins_mir = as.success.mir; + m_pp.ldon_wins_mmc = as.success.mmc; + m_pp.ldon_wins_ruj = as.success.ruj; + m_pp.ldon_wins_tak = as.success.tak; + m_pp.ldon_losses_guk = as.failure.guk; + m_pp.ldon_losses_mir = as.failure.mir; + m_pp.ldon_losses_mmc = as.failure.mmc; + m_pp.ldon_losses_ruj = as.failure.ruj; + m_pp.ldon_losses_tak = as.failure.tak; + } /* Set item material tint */ for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) @@ -2489,11 +2504,8 @@ void Client::Handle_OP_AdventureStatsRequest(const EQApplicationPacket *app) EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureStatsReply, sizeof(AdventureStats_Struct)); AdventureStats_Struct *as = (AdventureStats_Struct*)outapp->pBuffer; - if (database.GetAdventureStats(CharacterID(), as->success.guk, as->success.mir, as->success.mmc, as->success.ruj, - as->success.tak, as->failure.guk, as->failure.mir, as->failure.mmc, as->failure.ruj, as->failure.tak)) + if (database.GetAdventureStats(CharacterID(), as)) { - as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak; - as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak; m_pp.ldon_wins_guk = as->success.guk; m_pp.ldon_wins_mir = as->success.mir; m_pp.ldon_wins_mmc = as->success.mmc; diff --git a/zone/zone.cpp b/zone/zone.cpp index 23aa95f2c..0207b28d4 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -411,7 +411,7 @@ void Zone::LoadTempMerchantData() { "WHERE " "ml.npcid = se.npcid " "AND se.spawngroupid = s2.spawngroupid " - "AND s2.zone = '%s' AND s2.version = %i" + "AND s2.zone = '%s' AND s2.version = %i " "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ca6576ef9..1ba36c5fd 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1028,34 +1028,6 @@ bool ZoneDatabase::LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_ return true; } -bool ZoneDatabase::LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp) { - std::string query = StringFormat("SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, `guk_losses`, " - "`mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", character_id); - - auto results = QueryDatabase(query); - - if (!results.Success()) - return false; - - if (results.RowCount() == 0) - return false; - - auto row = results.begin(); - - pp->ldon_wins_guk = atoi(row[0]); - pp->ldon_wins_mir = atoi(row[1]); - pp->ldon_wins_mmc = atoi(row[2]); - pp->ldon_wins_ruj = atoi(row[3]); - pp->ldon_wins_tak = atoi(row[4]); - pp->ldon_losses_guk = atoi(row[5]); - pp->ldon_losses_mir = atoi(row[6]); - pp->ldon_losses_mmc = atoi(row[7]); - pp->ldon_losses_ruj = atoi(row[8]); - pp->ldon_losses_tak = atoi(row[9]); - - return true; -} - bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat( "SELECT " diff --git a/zone/zonedb.h b/zone/zonedb.h index d13e86c30..30721de9a 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -264,7 +264,6 @@ public: bool LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp); - bool LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp); /* Character Data Saves */ bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home); From be0621de42574fe3ee208b98af12c39eeb0d3f8c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Oct 2014 21:36:59 -0400 Subject: [PATCH 0138/1883] Partial implementation of leadership in raids Currently working: stat bonuses and client side only effects Currently not working: Mark NPC and others that need more server side work Currently only tested on UF, Ti and 62 may work, but not tested SoF, SoD, and RoF need packet translators, which are most likely the same as UF --- changelog.txt | 6 + common/database.cpp | 136 ++++++++++++++++ common/database.h | 7 + common/eq_packet_structs.h | 67 +++++++- common/patches/client62_structs.h | 58 ++++++- common/patches/rof_structs.h | 58 ++++++- common/patches/sod_structs.h | 58 ++++++- common/patches/sof_structs.h | 58 ++++++- common/patches/titanium_structs.h | 58 ++++++- common/patches/underfoot.cpp | 12 ++ common/patches/underfoot_structs.h | 68 +++++++- .../required/2014_10_13_RaidLeadership.sql | 9 ++ world/net.cpp | 1 + zone/aa.cpp | 152 ++++++++++++++++++ zone/client.cpp | 6 +- zone/client.h | 4 + zone/client_packet.cpp | 31 +++- zone/raids.cpp | 120 +++++++++++++- zone/raids.h | 24 ++- 19 files changed, 891 insertions(+), 42 deletions(-) create mode 100644 utils/sql/git/required/2014_10_13_RaidLeadership.sql diff --git a/changelog.txt b/changelog.txt index 18e1a738b..efa724859 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/13/2014 == +demonstar55: Partially implement leadership and raids + Currently working: client side only effects and stat bonuses. + Not working: Mark NPC, and other stuff that need extra server side support + Currently only UF tested (Tit and 62 may just work, others need packet work) + == 10/12/2014 == Akkadius: Fix for LDON Character Stat load diff --git a/common/database.cpp b/common/database.cpp index 76231c92a..5ed156ae5 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3169,6 +3169,142 @@ const char* Database::GetRaidLeaderName(uint32 rid) return name; } +// maintank, assist, puller, marknpc currently unused +void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank, + char *assist, char *puller, char *marknpc, GroupLeadershipAA_Struct *GLAA) +{ + std::string query = StringFormat( + "SELECT maintank, assist, puller, marknpc, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu", + (unsigned long)gid, (unsigned long)rid); + auto results = QueryDatabase(query); + + if (!results.Success() || results.RowCount() == 0) { + if (maintank) + maintank[0] = '\0'; + + if (assist) + assist[0] = '\0'; + + if (puller) + puller[0] = '\0'; + + if (marknpc) + marknpc[0] = '\0'; + + return; + } + + auto row = results.begin(); + + if (maintank) + strcpy(maintank, row[0]); + + if (assist) + strcpy(assist, row[1]); + + if (puller) + strcpy(puller, row[2]); + + if (marknpc) + strcpy(marknpc, row[3]); + + if (GLAA && results.LengthOfColumn(4) == sizeof(GroupLeadershipAA_Struct)) + memcpy(GLAA, row[4], sizeof(GroupLeadershipAA_Struct)); + + return; +} + +// maintank, assist, puller, marknpc currently unused +void Database::GetRaidLeadershipInfo(uint32 rid, char *maintank, + char *assist, char *puller, char *marknpc, RaidLeadershipAA_Struct *RLAA) +{ + std::string query = StringFormat( + "SELECT maintank, assist, puller, marknpc, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu", + (unsigned long)0xFFFFFFFF, (unsigned long)rid); + auto results = QueryDatabase(query); + + if (!results.Success() || results.RowCount() == 0) { + if (maintank) + maintank[0] = '\0'; + + if (assist) + assist[0] = '\0'; + + if (puller) + puller[0] = '\0'; + + if (marknpc) + marknpc[0] = '\0'; + + return; + } + + auto row = results.begin(); + + if (maintank) + strcpy(maintank, row[0]); + + if (assist) + strcpy(assist, row[1]); + + if (puller) + strcpy(puller, row[2]); + + if (marknpc) + strcpy(marknpc, row[3]); + + if (RLAA && results.LengthOfColumn(4) == sizeof(RaidLeadershipAA_Struct)) + memcpy(RLAA, row[4], sizeof(RaidLeadershipAA_Struct)); + + return; +} + +void Database::SetRaidGroupLeaderInfo(uint32 gid, uint32 rid) +{ + std::string query = StringFormat("UPDATE raid_leaders SET leadershipaa = '', WHERE gid = %lu AND rid = %lu", + (unsigned long)gid, (unsigned long)rid); + auto results = QueryDatabase(query); + + if (results.RowsAffected() != 0) + return; + + query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller) VALUES(%lu, %lu, '', '', '', '', '')", + (unsigned long)gid, (unsigned long)rid); + results = QueryDatabase(query); + + if (!results.Success()) + std::cout << "Unable to set raid/group leader: " << results.ErrorMessage() << std::endl; + + return; +} + +// Clearing all raid leaders +void Database::ClearAllRaidLeaders(void) +{ + std::string query("DELETE from raid_leaders"); + auto results = QueryDatabase(query); + + if (!results.Success()) + std::cout << "Unable to clear raid leaders: " << results.ErrorMessage() << std::endl; + + return; +} + +void Database::ClearRaidLeader(uint32 gid, uint32 rid) +{ + if (rid == 0) { + ClearAllRaidLeaders(); + return; + } + + std::string query = StringFormat("DELETE from raid_leaders where gid = %lu and rid = %lu", + (unsigned long)gid, (unsigned long)rid); + auto results = QueryDatabase(query); + + if (!results.Success()) + std::cout << "Unable to clear raid leader: " << results.ErrorMessage() << std::endl; +} + bool Database::VerifyInstanceAlive(uint16 instance_id, uint32 char_id) { //we are not saved to this instance so set our instance to 0 diff --git a/common/database.h b/common/database.h index 68ccf003a..6fa9ef60a 100644 --- a/common/database.h +++ b/common/database.h @@ -214,6 +214,12 @@ public: void ClearRaidDetails(uint32 rid = 0); uint32 GetRaidID(const char* name); const char *GetRaidLeaderName(uint32 rid); + void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, + GroupLeadershipAA_Struct* GLAA = nullptr); + void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, + RaidLeadershipAA_Struct* RLAA = nullptr); + void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid); + void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0); bool CheckDatabaseConversions(); @@ -273,6 +279,7 @@ private: */ void ClearAllRaids(); void ClearAllRaidDetails(); + void ClearAllRaidLeaders(); }; #endif diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index eda2a5ce8..a78b2afa1 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -759,14 +759,62 @@ struct MovePotionToBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** @@ -3934,6 +3982,15 @@ struct RaidMOTD_Struct { /*136*/ char motd[0]; // max size is 1024, but reply is variable }; +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ char leader_name[64]; +/*132*/ GroupLeadershipAA_Struct group; //unneeded +/*196*/ RaidLeadershipAA_Struct raid; +/*260*/ char Unknown260[128]; //unverified +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h index 8c80e34a5..aae4c7919 100644 --- a/common/patches/client62_structs.h +++ b/common/patches/client62_structs.h @@ -611,14 +611,62 @@ struct PotionBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /* diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 99dff46cc..da07840c6 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -915,14 +915,62 @@ struct PotionBelt_Struct { BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; }; -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 53cc148b9..c32359f76 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -711,14 +711,62 @@ struct PotionBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index c943b5108..32a1e9d10 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -689,14 +689,62 @@ struct PotionBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 17beb6479..e8e5a9f23 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -619,14 +619,62 @@ struct PotionBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 03ef16a2a..dd31d749d 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1940,6 +1940,18 @@ namespace Underfoot strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 14) + { + RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; + + outlaa->action = inlaa->action; + strn0cpy(outlaa->player_name, inlaa->player_name, 64); + strn0cpy(outlaa->leader_name, inlaa->leader_name, 64); + memcpy(&outlaa->raid, &inlaa->raid, sizeof(RaidLeadershipAA_Struct)); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index f331d5dbc..2b7163bcf 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -754,14 +754,62 @@ struct PotionBelt_Struct { 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); -struct LeadershipAA_Struct { - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; -}; struct GroupLeadershipAA_Struct { - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; + struct RaidLeadershipAA_Struct { - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; }; /** @@ -3628,6 +3676,16 @@ struct RaidMOTD_Struct { /*140*/ char motd[0]; // max size 1024, but reply is variable }; +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ uint32 Unknown068; +/*072*/ char leader_name[64]; +/*136*/ GroupLeadershipAA_Struct group; //unneeded +/*200*/ RaidLeadershipAA_Struct raid; +/*264*/ char Unknown264[128]; +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name diff --git a/utils/sql/git/required/2014_10_13_RaidLeadership.sql b/utils/sql/git/required/2014_10_13_RaidLeadership.sql new file mode 100644 index 000000000..972e09ed5 --- /dev/null +++ b/utils/sql/git/required/2014_10_13_RaidLeadership.sql @@ -0,0 +1,9 @@ +CREATE TABLE `raid_leaders` ( + `gid` int(4) unsigned NOT NULL, + `rid` int(4) unsigned NOT NULL, + `marknpc` varchar(64) NOT NULL, + `maintank` varchar(64) NOT NULL, + `assist` varchar(64) NOT NULL, + `puller` varchar(64) NOT NULL, + `leadershipaa` tinyblob NOT NULL +); diff --git a/world/net.cpp b/world/net.cpp index c7340333e..7973b5872 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -283,6 +283,7 @@ int main(int argc, char** argv) { _log(WORLD__INIT, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); + database.ClearRaidLeader(); _log(WORLD__INIT, "Loading items.."); if (!database.LoadItems()) _log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring"); diff --git a/zone/aa.cpp b/zone/aa.cpp index 8af3896d3..d07ed72cf 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1550,6 +1550,41 @@ void Client::ResetAA(){ int Client::GroupLeadershipAAHealthEnhancement() { + if (IsRaidGrouped()) { + int bonus = 0; + Raid *raid = GetRaid(); + if (!raid) + return 0; + uint32 group_id = raid->GetGroup(this); + if (group_id < 12 && raid->GroupCount(group_id) >= 3) { + switch (raid->GetLeadershipAA(groupAAHealthEnhancement, group_id)) { + case 1: + bonus = 30; + break; + case 2: + bonus = 60; + break; + case 3: + bonus = 100; + break; + } + } + if (raid->RaidCount() >= 18) { + switch (raid->GetLeadershipAA(raidAAHealthEnhancement)) { + case 1: + bonus += 30; + break; + case 2: + bonus += 60; + break; + case 3: + bonus += 100; + break; + } + } + return bonus; + } + Group *g = GetGroup(); if(!g || (g->GroupCount() < 3)) @@ -1572,6 +1607,41 @@ int Client::GroupLeadershipAAHealthEnhancement() int Client::GroupLeadershipAAManaEnhancement() { + if (IsRaidGrouped()) { + int bonus = 0; + Raid *raid = GetRaid(); + if (!raid) + return 0; + uint32 group_id = raid->GetGroup(this); + if (group_id < 12 && raid->GroupCount(group_id) >= 3) { + switch (raid->GetLeadershipAA(groupAAManaEnhancement, group_id)) { + case 1: + bonus = 30; + break; + case 2: + bonus = 60; + break; + case 3: + bonus = 100; + break; + } + } + if (raid->RaidCount() >= 18) { + switch (raid->GetLeadershipAA(raidAAManaEnhancement)) { + case 1: + bonus += 30; + break; + case 2: + bonus += 60; + break; + case 3: + bonus += 100; + break; + } + } + return bonus; + } + Group *g = GetGroup(); if(!g || (g->GroupCount() < 3)) @@ -1594,6 +1664,41 @@ int Client::GroupLeadershipAAManaEnhancement() int Client::GroupLeadershipAAHealthRegeneration() { + if (IsRaidGrouped()) { + int bonus = 0; + Raid *raid = GetRaid(); + if (!raid) + return 0; + uint32 group_id = raid->GetGroup(this); + if (group_id < 12 && raid->GroupCount(group_id) >= 3) { + switch (raid->GetLeadershipAA(groupAAHealthRegeneration, group_id)) { + case 1: + bonus = 4; + break; + case 2: + bonus = 6; + break; + case 3: + bonus = 8; + break; + } + } + if (raid->RaidCount() >= 18) { + switch (raid->GetLeadershipAA(raidAAHealthRegeneration)) { + case 1: + bonus += 4; + break; + case 2: + bonus += 6; + break; + case 3: + bonus += 8; + break; + } + } + return bonus; + } + Group *g = GetGroup(); if(!g || (g->GroupCount() < 3)) @@ -1616,6 +1721,53 @@ int Client::GroupLeadershipAAHealthRegeneration() int Client::GroupLeadershipAAOffenseEnhancement() { + if (IsRaidGrouped()) { + int bonus = 0; + Raid *raid = GetRaid(); + if (!raid) + return 0; + uint32 group_id = raid->GetGroup(this); + if (group_id < 12 && raid->GroupCount(group_id) >= 3) { + switch (raid->GetLeadershipAA(groupAAOffenseEnhancement, group_id)) { + case 1: + bonus = 10; + break; + case 2: + bonus = 19; + break; + case 3: + bonus = 28; + break; + case 4: + bonus = 34; + break; + case 5: + bonus = 40; + break; + } + } + if (raid->RaidCount() >= 18) { + switch (raid->GetLeadershipAA(raidAAOffenseEnhancement)) { + case 1: + bonus += 10; + break; + case 2: + bonus += 19; + break; + case 3: + bonus += 28; + break; + case 4: + bonus += 34; + break; + case 5: + bonus += 40; + break; + } + } + return bonus; + } + Group *g = GetGroup(); if(!g || (g->GroupCount() < 3)) diff --git a/zone/client.cpp b/zone/client.cpp index ade40b860..3b95c8d77 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3670,7 +3670,11 @@ void Client::LogSQL(const char *fmt, ...) { } void Client::GetGroupAAs(GroupLeadershipAA_Struct *into) const { - memcpy(into, &m_pp.leader_abilities, sizeof(GroupLeadershipAA_Struct)); + memcpy(into, &m_pp.leader_abilities.group, sizeof(GroupLeadershipAA_Struct)); +} + +void Client::GetRaidAAs(RaidLeadershipAA_Struct *into) const { + memcpy(into, &m_pp.leader_abilities.raid, sizeof(RaidLeadershipAA_Struct)); } void Client::EnteringMessages(Client* client) diff --git a/zone/client.h b/zone/client.h index 3375d7066..e31c15598 100644 --- a/zone/client.h +++ b/zone/client.h @@ -559,6 +559,9 @@ public: void SendLeadershipEXPUpdate(); bool IsLeadershipEXPOn(); inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } + inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } + inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } + inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } int GroupLeadershipAAHealthEnhancement(); int GroupLeadershipAAManaEnhancement(); int GroupLeadershipAAHealthRegeneration(); @@ -585,6 +588,7 @@ public: bool CheckLoreConflict(const Item_Struct* item); void ChangeLastName(const char* in_lastname); void GetGroupAAs(GroupLeadershipAA_Struct *into) const; + void GetRaidAAs(RaidLeadershipAA_Struct *into) const; void ClearGroupAAs(); void UpdateGroupAAs(int32 points, uint32 type); void SacrificeConfirm(Client* caster); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e0f2b3f01..e74651300 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -546,6 +546,7 @@ void Client::CompleteConnect() raid = new Raid(raidid); if (raid->GetID() != 0){ entity_list.AddRaid(raid, raidid); + raid->LoadLeadership(); // Recreating raid in new zone, get leadership from DB } else raid = nullptr; @@ -566,11 +567,20 @@ void Client::CompleteConnect() raid->SendBulkRaid(this); raid->SendGroupUpdate(this); raid->SendRaidMOTD(this); + if (raid->IsLeader(this)) { // We're a raid leader, lets update just in case! + raid->UpdateRaidAAs(); + raid->SendAllRaidLeadershipAA(); + } uint32 grpID = raid->GetGroup(GetName()); if (grpID < 12){ raid->SendRaidGroupRemove(GetName(), grpID); raid->SendRaidGroupAdd(GetName(), grpID); + if (raid->IsGroupLeader(GetName())) { // group leader same thing! + raid->UpdateGroupAAs(raid->GetGroup(this)); + raid->GroupUpdate(grpID, false); + } } + raid->SendGroupLeadershipAA(this, grpID); // this may get sent an extra time ... if (raid->IsLocked()) raid->SendRaidLockTo(this); } @@ -10606,10 +10616,23 @@ void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) u->pointsleft = m_pp.group_leadership_points; FastQueuePacket(&outapp); - Group *g = GetGroup(); - // Update all group members with the new AA the leader has purchased. - if (g) { + if (IsRaidGrouped()) { + Raid *r = GetRaid(); + if (!r) + return; + if (aaid >= raidAAMarkNPC) { + r->UpdateRaidAAs(); + r->SendAllRaidLeadershipAA(); + } else { + uint32 gid = r->GetGroup(this); + r->UpdateGroupAAs(gid); + r->GroupUpdate(gid, false); + } + } else if (IsGrouped()) { + Group *g = GetGroup(); + if (!g) + return; g->UpdateGroupAAs(); g->SendLeadershipAAUpdate(); } @@ -11228,6 +11251,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (strcmp(r->leadername, GetName()) == 0){ r->SetRaidLeader(GetName(), ri->leader_name); + r->UpdateRaidAAs(); + r->SendAllRaidLeadershipAA(); } } break; diff --git a/zone/raids.cpp b/zone/raids.cpp index f22267a2f..0adbcdef1 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -29,6 +29,8 @@ Raid::Raid(uint32 raidID) : GroupIDConsumer(raidID) { memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); + memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct)); + memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS); leader = nullptr; memset(leadername, 0, 64); locked = false; @@ -39,6 +41,8 @@ Raid::Raid(Client* nLeader) : GroupIDConsumer() { memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); + memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct)); + memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS); leader = nLeader; memset(leadername, 0, 64); strn0cpy(leadername, nLeader->GetName(), 64); @@ -84,8 +88,18 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo LearnMembers(); VerifyRaid(); + if (rleader) { + database.SetRaidGroupLeaderInfo(RAID_GROUPLESS, GetID()); + UpdateRaidAAs(); + } + if (group != RAID_GROUPLESS && groupleader) { + database.SetRaidGroupLeaderInfo(group, GetID()); + UpdateGroupAAs(group); + } if(group < 12) GroupUpdate(group); + else // get raid AAs, GroupUpdate will handles it otherwise + SendGroupLeadershipAA(c, RAID_GROUPLESS); SendRaidAddAll(c->GetName()); c->SetRaidGrouped(true); @@ -186,6 +200,18 @@ void Raid::SetGroupLeader(const char *who, bool glFlag) safe_delete(pack); } +Client *Raid::GetGroupLeader(uint32 group_id) +{ + if (group_id == RAID_GROUPLESS) + return nullptr; + + for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) + if (members[i].member && members[i].IsGroupLeader && members[i].GroupNumber == group_id) + return members[i].member; + + return nullptr; +} + void Raid::SetRaidLeader(const char *wasLead, const char *name) { std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); @@ -218,6 +244,59 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) safe_delete(pack); } +void Raid::SaveGroupLeaderAA(uint32 gid) +{ + char *queryBuffer = new char[sizeof(GroupLeadershipAA_Struct) * 2 + 1]; + database.DoEscapeString(queryBuffer, (char*)&group_aa[gid], sizeof(GroupLeadershipAA_Struct)); + + std::string query = "UPDATE raid_leaders SET leadershipaa = '"; + query += queryBuffer; + query += StringFormat("' WHERE gid = %lu AND rid = %lu LIMIT 1", gid, GetID()); + safe_delete_array(queryBuffer); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); +} + +void Raid::SaveRaidLeaderAA() +{ + char *queryBuffer = new char[sizeof(RaidLeadershipAA_Struct) * 2 + 1]; + database.DoEscapeString(queryBuffer, (char*)&raid_aa, sizeof(RaidLeadershipAA_Struct)); + _hex(NET__ERROR, queryBuffer, sizeof(RaidLeadershipAA_Struct)); + + std::string query = "UPDATE raid_leaders SET leadershipaa = '"; + query += queryBuffer; + query += StringFormat("' WHERE gid = %lu AND rid = %lu LIMIT 1", RAID_GROUPLESS, GetID()); + safe_delete_array(queryBuffer); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); +} + +void Raid::UpdateGroupAAs(uint32 gid) +{ + Client *gl = GetGroupLeader(gid); + + if (gl) + gl->GetGroupAAs(&group_aa[gid]); + else + memset(&group_aa[gid], 0, sizeof(GroupLeadershipAA_Struct)); + + SaveGroupLeaderAA(gid); +} + +void Raid::UpdateRaidAAs() +{ + Client *rl = GetLeader(); + + if (rl) + rl->GetRaidAAs(&raid_aa); + else + memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct)); + + SaveRaidLeaderAA(); +} + bool Raid::IsGroupLeader(const char *who) { for(int x = 0; x < MAX_RAID_MEMBERS; x++) @@ -1094,6 +1173,7 @@ void Raid::SendGroupUpdate(Client *to) strn0cpy(gu->leadersname, to->GetName(), 64); } strn0cpy(gu->yourname, to->GetName(), 64); + memcpy(&gu->leader_aas, &group_aa[grp], sizeof(GroupLeadershipAA_Struct)); to->FastQueuePacket(&outapp); } @@ -1106,8 +1186,10 @@ void Raid::GroupUpdate(uint32 gid, bool initial) { if(strlen(members[x].membername) > 0){ if(members[x].GroupNumber == gid){ - if(members[x].member) + if(members[x].member) { SendGroupUpdate(members[x].member); + SendGroupLeadershipAA(members[x].member, gid); + } } } } @@ -1244,6 +1326,34 @@ void Raid::SendRaidMOTDToWorld() safe_delete(pack); } +void Raid::SendGroupLeadershipAA(Client *c, uint32 gid) +{ + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + RaidLeadershipUpdate_Struct *rlaa = (RaidLeadershipUpdate_Struct *)outapp->pBuffer; + rlaa->action = raidSetLeaderAbilities; + strn0cpy(rlaa->leader_name, c->GetName(), 64); + strn0cpy(rlaa->player_name, c->GetName(), 64); + if (gid != RAID_GROUPLESS) + memcpy(&rlaa->group, &group_aa[gid], sizeof(GroupLeadershipAA_Struct)); + memcpy(&rlaa->raid, &raid_aa, sizeof(RaidLeadershipAA_Struct)); + c->QueuePacket(outapp); + safe_delete(outapp); +} + +void Raid::SendGroupLeadershipAA(uint32 gid) +{ + for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) + if (members[i].member && members[i].GroupNumber == gid) + SendGroupLeadershipAA(members[i].member, gid); +} + +void Raid::SendAllRaidLeadershipAA() +{ + for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) + if (members[i].member) + SendGroupLeadershipAA(members[i].member, members[i].GroupNumber); +} + void Raid::LockRaid(bool lockFlag) { std::string query = StringFormat("UPDATE raid_details SET locked = %d WHERE raidid = %lu", @@ -1484,3 +1594,11 @@ void Raid::RaidMessage_StringID(Mob* sender, uint32 type, uint32 string_id, cons } } +void Raid::LoadLeadership() +{ + database.GetRaidLeadershipInfo(GetID(), nullptr, nullptr, nullptr, nullptr, &raid_aa); + + for (uint32 group_id = 0; group_id < MAX_RAID_GROUPS; group_id++) + database.GetGroupLeadershipInfo(group_id, GetID(), nullptr, nullptr, nullptr, nullptr, &group_aa[group_id]); +} + diff --git a/zone/raids.h b/zone/raids.h index 44952e5da..6e2579367 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -43,8 +43,8 @@ enum { //raid packet types: raidChangeLootType = 11, raidStringID = 12, raidChangeGroupLeader = 13, //136 raid leader, new group leader, group_id? - raidBecomeGroupLeader = 14, //472 - raidUnknown2 = 15, + raidSetLeaderAbilities = 14, //472 + raidSetLeaderData = 15, // 14,15 SoE names, not sure on difference, 14 packet has 0x100 bytes 15 0x214 in addition to raid general raidChangeGroup = 16, //?? len 136 old leader, new leader, 0 (preceeded with a remove2) raidLock = 17, //len 136 leader?, leader, 0 raidUnlock = 18, //len 136 leader?, leader, 0 @@ -79,6 +79,7 @@ enum { //raid command types #define MAX_RAID_GROUPS 12 #define MAX_RAID_MEMBERS 72 +const uint32 RAID_GROUPLESS = 0xFFFFFFFF; struct RaidMember{ char membername[64]; @@ -111,6 +112,7 @@ public: void DisbandRaid(); void MoveMember(const char *name, uint32 newGroup); void SetGroupLeader(const char *who, bool glFlag = true); + Client *GetGroupLeader(uint32 group_id); void RemoveGroupLeader(const char *who); bool IsGroupLeader(const char *who); bool IsRaidMember(const char *name); @@ -203,6 +205,22 @@ public: void QueuePacket(const EQApplicationPacket *app, bool ack_req = true); + // Leadership + void UpdateGroupAAs(uint32 gid); + void SaveGroupLeaderAA(uint32 gid); + void UpdateRaidAAs(); + void SaveRaidLeaderAA(); + void SendGroupLeadershipAA(Client *c, uint32 gid); + void SendGroupLeadershipAA(uint32 gid); + void SendAllRaidLeadershipAA(); + void LoadLeadership(); + inline int GetLeadershipAA(int AAID, uint32 gid = 0) + { if (AAID >= 16) return raid_aa.ranks[AAID - 16]; else return group_aa[gid].ranks[AAID]; } + inline void SetGroupAAs(uint32 gid, GroupLeadershipAA_Struct *glaa) + { memcpy(&group_aa[gid], glaa, sizeof(GroupLeadershipAA_Struct)); } + inline void SetRaidAAs(RaidLeadershipAA_Struct *rlaa) + { memcpy(&raid_aa, rlaa, sizeof(RaidLeadershipAA_Struct)); } + RaidMember members[MAX_RAID_MEMBERS]; char leadername[64]; protected: @@ -213,6 +231,8 @@ protected: bool disbandCheck; bool forceDisband; std::string motd; + RaidLeadershipAA_Struct raid_aa; + GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS]; }; From d1561c28d9eabbe5162a5e9cc7a6bac3bbefc7a0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Oct 2014 22:53:41 -0400 Subject: [PATCH 0139/1883] Raid Leadership SoF --- common/patches/sof.cpp | 12 ++++++++++++ common/patches/sof_structs.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index bf5046c91..2b4640f29 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1326,6 +1326,18 @@ namespace SoF strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 14) + { + RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; + + outlaa->action = inlaa->action; + strn0cpy(outlaa->player_name, inlaa->player_name, 64); + strn0cpy(outlaa->leader_name, inlaa->leader_name, 64); + memcpy(&outlaa->raid, &inlaa->raid, sizeof(RaidLeadershipAA_Struct)); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 32a1e9d10..a101d3cba 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -3478,6 +3478,16 @@ struct RaidMOTD_Struct { /*140*/ char motd[0]; // max size 1024, but reply is variable }; +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ uint32 Unknown068; +/*072*/ char leader_name[64]; +/*136*/ GroupLeadershipAA_Struct group; //unneeded +/*200*/ RaidLeadershipAA_Struct raid; +/*264*/ char Unknown264[128]; +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From 41938fbe723bd7b15e7c8ddbbe4748c7e7f91b29 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Oct 2014 22:54:57 -0400 Subject: [PATCH 0140/1883] Raid leadership SoD --- common/patches/sod.cpp | 12 ++++++++++++ common/patches/sod_structs.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index edfddabca..134be8008 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1668,6 +1668,18 @@ namespace SoD strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 14) + { + RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; + + outlaa->action = inlaa->action; + strn0cpy(outlaa->player_name, inlaa->player_name, 64); + strn0cpy(outlaa->leader_name, inlaa->leader_name, 64); + memcpy(&outlaa->raid, &inlaa->raid, sizeof(RaidLeadershipAA_Struct)); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index c32359f76..88c0ed91a 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -3615,6 +3615,16 @@ struct RaidMOTD_Struct { /*140*/ char motd[0]; // max size 1024, but reply is variable }; +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ uint32 Unknown068; +/*072*/ char leader_name[64]; +/*136*/ GroupLeadershipAA_Struct group; //unneeded +/*200*/ RaidLeadershipAA_Struct raid; +/*264*/ char Unknown264[128]; +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From 6f00a69850db017853ae0c2cfa825942bbe8e3bd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Oct 2014 22:55:57 -0400 Subject: [PATCH 0141/1883] Raid Leadership RoF --- common/patches/rof.cpp | 12 ++++++++++++ common/patches/rof_structs.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 49f6c51f1..96ebcaf63 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2613,6 +2613,18 @@ namespace RoF strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } + else if (raid_gen->action == 14) + { + RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; + + outlaa->action = inlaa->action; + strn0cpy(outlaa->player_name, inlaa->player_name, 64); + strn0cpy(outlaa->leader_name, inlaa->leader_name, 64); + memcpy(&outlaa->raid, &inlaa->raid, sizeof(RaidLeadershipAA_Struct)); + dest->FastQueuePacket(&outapp); + } else { RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index da07840c6..e65f2b74d 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4047,6 +4047,16 @@ struct RaidMOTD_Struct { /*140*/ char motd[0]; // max size 1024, but reply is variable }; +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ uint32 Unknown068; +/*072*/ char leader_name[64]; +/*136*/ GroupLeadershipAA_Struct group; //unneeded +/*200*/ RaidLeadershipAA_Struct raid; +/*264*/ char Unknown264[128]; +}; + struct RaidAdd_Struct { /*000*/ uint32 action; //=0 /*004*/ char player_name[64]; //should both be the player's name From ef5e93b71ba9e17fd847c1fe3340509dcb0a9be9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 13 Oct 2014 23:24:25 -0400 Subject: [PATCH 0142/1883] Add debug log to Client::Handle_OP_DoGroupLeadershipAbility --- zone/client_packet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e74651300..fdc5e5021 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5345,6 +5345,8 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: + LogFile->write(EQEMuLog::Debug, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + dglas->Ability, dglas->Parameter); break; } } From e53a91f5c3e18dbc29c76b91ce07c0e6a598dbb1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Oct 2014 00:01:51 -0400 Subject: [PATCH 0143/1883] Added some previous unidentified (still unhandled) UF opcodes Didn't want them to get lost ;) --- utils/patches/patch_Underfoot.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 1b65a6481..e62b24b67 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -656,3 +656,7 @@ OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs OP_InitialHPUpdate=0x0000 # OP_ItemRecastDelay=0x82d7 + +# unhandled +OP_ClearRaidNPCMarks=0x2af4 +OP_ShieldGroup=0x23a1 From c002f834d47ce459dcdcbfe044c939f7da61f8ac Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Oct 2014 17:20:19 -0400 Subject: [PATCH 0144/1883] Correct misidentified OP_MarkNPC (RoF,SoD,SoF,UF) [skip ci] --- utils/patches/patch_RoF.conf | 4 +++- utils/patches/patch_SoD.conf | 4 +++- utils/patches/patch_SoF.conf | 4 +++- utils/patches/patch_Underfoot.conf | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 16197c0da..e4eb9ba14 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -289,8 +289,10 @@ OP_LeadershipExpToggle=0x3ea6 OP_LeadershipExpUpdate=0x6922 OP_PurchaseLeadershipAA=0x1962 OP_UpdateLeadershipAA=0x56aa -OP_MarkNPC=0x2d9f +OP_MarkNPC=0x1a6c +OP_MarkRaidNPC=0x2d9f #unimplemented OP_ClearNPCMarks=0x0d2d +OP_ClearRaidNPCMarks=0x433a #unimplemented OP_DelegateAbility=0x7820 OP_SetGroupTarget=0x118a OP_Charm=0x7118 diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index f0d223edb..472d60e7a 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -288,8 +288,10 @@ OP_LeadershipExpToggle=0x34c5 # C OP_LeadershipExpUpdate=0x69d0 # C OP_PurchaseLeadershipAA=0x07b3 # C OP_UpdateLeadershipAA=0x6948 # C -OP_MarkNPC=0x0d4b # C +OP_MarkNPC=0x695c # C +OP_MarkRaidNPC=0x0d4b # C OP_ClearNPCMarks=0x5033 # C +OP_ClearRaidNPCMarks=0x5f55 # C OP_DoGroupLeadershipAbility=0x540b # C OP_GroupLeadershipAAUpdate=0x0c33 OP_DelegateAbility=0x0322 # C diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 2e039b404..a50c1faf6 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -281,8 +281,10 @@ OP_LeadershipExpToggle=0x24D4 #Xinu 02/20/09 OP_LeadershipExpUpdate=0x58b6 #Derision 2009 OP_PurchaseLeadershipAA=0x1408 #Derision 2009 OP_UpdateLeadershipAA=0x7abf #Derision 2009 -OP_MarkNPC=0x00c6 #Derision 2009 +OP_MarkNPC=0x4697 #Derision 2009 +OP_MarkRaidNPC=0x00c6 OP_ClearNPCMarks=0x2ff2 # +OP_ClearRaidNPCMarks=0x56a9 # OP_DoGroupLeadershipAbility=0x5a64 #Derision 2009 OP_DelegateAbility=0x57e3 #Derision 2009 OP_SetGroupTarget=0x1651 #Derision 2009 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index e62b24b67..b7bdbc7e0 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -292,8 +292,10 @@ OP_LeadershipExpToggle=0x5033 # C OP_LeadershipExpUpdate=0x074f # C OP_PurchaseLeadershipAA=0x5f55 # C OP_UpdateLeadershipAA=0x77ed # C -OP_MarkNPC=0x3ec7 # C +OP_MarkNPC=0x66bf +OP_MarkRaidNPC=0x3ec7 # C OP_ClearNPCMarks=0x5c29 # C +OP_ClearRaidNPCMarks=0x2af4 OP_DoGroupLeadershipAbility=0x0068 # C OP_GroupLeadershipAAUpdate=0x167b # C OP_DelegateAbility=0x6e58 # C @@ -658,5 +660,4 @@ OP_InitialHPUpdate=0x0000 # OP_ItemRecastDelay=0x82d7 # unhandled -OP_ClearRaidNPCMarks=0x2af4 OP_ShieldGroup=0x23a1 From e38abaa32ac36f99ffe85cd059827acd059c9e71 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 14 Oct 2014 22:50:09 -0400 Subject: [PATCH 0145/1883] Optimize EntityList::UnMarkNPC Going over the group_list is much better than hitting the same group up to 5 unnecessary times --- zone/entity.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index fd031d618..4a8329639 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4120,15 +4120,10 @@ void EntityList::UnMarkNPC(uint16 ID) // each group to remove the dead mobs entity ID from the groups list of NPCs marked via the // Group Leadership AA Mark NPC ability. // - auto it = client_list.begin(); - while (it != client_list.end()) { - if (it->second) { - Group *g = nullptr; - g = it->second->GetGroup(); - - if (g) - g->UnMarkNPC(ID); - } + auto it = group_list.begin(); + while (it != group_list.end()) { + if (*it) + (*it)->UnMarkNPC(ID); ++it; } } From 69c0405004a62701f48b981081570d3f2a28a5e8 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 15 Oct 2014 07:49:39 -0400 Subject: [PATCH 0146/1883] Updated both load and drop sqls for bots..added a 'deprecated' load for pre-pp blob conversion databases..the auto-conversion code will catch this if the server is updated to a newer version. (Had a really nice load script coded..but, the supported version of MySQL doesn't support 'TEMPORARY' procedures, nor commit commands from 'PREPARE(d)' statements... :( ) --- changelog.txt | 6 + common/database.cpp | 3 + .../sql/git/bots/deprecated/load_bots_old.sql | 280 +++++++++ utils/sql/git/bots/drop_bots.sql | 46 +- utils/sql/git/bots/load_bots.sql | 535 +++++++++--------- 5 files changed, 574 insertions(+), 296 deletions(-) create mode 100644 utils/sql/git/bots/deprecated/load_bots_old.sql diff --git a/changelog.txt b/changelog.txt index 2461b4a36..6971c932d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/15/2014 == +Uleat: Cleaned up load/drop bots sqls, added '../utils/sql/git/bots/deprecated' and '../deprecated/load_bots_old.sql' (use this file on pre-player blob conversion databases.) +Notes: I modifed the behavior of both load and drop bots to fail on the first operation if their modifications have been performed already. + 'load_bots.sql' will explicitly add bot schema, while 'drop_bots.sql' will explicitly drop it. I also added a few lines to change + a few altered tables back to their original state - as of the date in the file. + == 10/11/2014 == demonstar55: Implement Raid MOTD for UF Don't forget 2014_10_11_RaidMOTD.sql! diff --git a/common/database.cpp b/common/database.cpp index dedc00ff1..b6453d3cb 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1933,6 +1933,8 @@ bool Database::CheckDatabaseConversions() { printf("----------------------------------------------------------\n\n"); printf(" Database currently has bot view/function linkage to obselete \n"); printf(" table references and will now be converted...\n\n"); + printf(" It is recommended that you backup your database \n"); + printf(" before continuing the automatic conversion process...\n\n"); printf("----------------------------------------------------------\n\n"); std::cout << "Press ENTER to continue....." << std::endl << std::endl; std::cin.ignore(1); @@ -1943,6 +1945,7 @@ bool Database::CheckDatabaseConversions() { } if (runbotsconvert == 1){ + printf("Running bot views/function database conversion... \n"); /* Update view `vwbotcharactermobs` */ rquery = StringFormat("DROP VIEW `vwbotcharactermobs`;"); diff --git a/utils/sql/git/bots/deprecated/load_bots_old.sql b/utils/sql/git/bots/deprecated/load_bots_old.sql new file mode 100644 index 000000000..9f57191ab --- /dev/null +++ b/utils/sql/git/bots/deprecated/load_bots_old.sql @@ -0,0 +1,280 @@ +-- 'load_bots_old' sql script file +-- current as of 10/15/2014 +-- +-- Use this file on databases where the player profile blob has not been converted +-- +-- Note: This file assumes a database free of bot remnants. If you have a prior +-- bot installation and wish to reload the default schema and entries, then +-- source 'drop_bots.sql' before sourcing this file. + + +ALTER TABLE `guild_members` DROP PRIMARY KEY; +ALTER TABLE `group_id` DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`); + +UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298); + +-- old command kept for reference (`commands` now only has 2 columns - `command` and `access`) +-- INSERT INTO `commands` VALUES ('bot', '0', 'Type \"#bot help\" to the see the list of available commands for bots.'); +INSERT INTO `commands` VALUES ('bot', '0'); + +INSERT INTO `rule_values` VALUES + ('1', 'Bots:BotAAExpansion', '8', 'The expansion through which bots will obtain AAs'), + ('1', 'Bots:BotFinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.'), + ('1', 'Bots:BotGroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.'), + ('1', 'Bots:BotManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.'), + ('1', 'Bots:BotQuest', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl'), + ('1', 'Bots:BotSpellQuest', 'false', 'Anita Thrall\'s (Anita_Thrall.pl) Bot Spell Scriber quests.'), + ('1', 'Bots:CreateBotCount', '150', 'Number of bots that each account can create'), + ('1', 'Bots:SpawnBotCount', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid'); + +CREATE TABLE `bots` ( + `BotID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotOwnerCharacterID` INT(10) UNSIGNED NOT NULL, + `BotSpellsID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Name` VARCHAR(64) NOT NULL, + `LastName` VARCHAR(32) DEFAULT NULL, + `BotLevel` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', + `Race` SMALLINT(5) NOT NULL DEFAULT '0', + `Class` TINYINT(2) NOT NULL DEFAULT '0', + `Gender` TINYINT(2) NOT NULL DEFAULT '0', + `Size` FLOAT NOT NULL DEFAULT '0', + `Face` INT(10) NOT NULL DEFAULT '1', + `LuclinHairStyle` INT(10) NOT NULL DEFAULT '1', + `LuclinHairColor` INT(10) NOT NULL DEFAULT '1', + `LuclinEyeColor` INT(10) NOT NULL DEFAULT '1', + `LuclinEyeColor2` INT(10) NOT NULL DEFAULT '1', + `LuclinBeardColor` INT(10) NOT NULL DEFAULT '1', + `LuclinBeard` INT(10) NOT NULL DEFAULT '0', + `DrakkinHeritage` INT(10) NOT NULL DEFAULT '0', + `DrakkinTattoo` INT(10) NOT NULL DEFAULT '0', + `DrakkinDetails` INT(10) NOT NULL DEFAULT '0', + `HP` INTEGER NOT NULL DEFAULT '0', + `Mana` INTEGER NOT NULL DEFAULT '0', + `MR` SMALLINT(5) NOT NULL DEFAULT '0', + `CR` SMALLINT(5) NOT NULL DEFAULT '0', + `DR` SMALLINT(5) NOT NULL DEFAULT '0', + `FR` SMALLINT(5) NOT NULL DEFAULT '0', + `PR` SMALLINT(5) NOT NULL DEFAULT '0', + `Corrup` SMALLINT(5) NOT NULL DEFAULT '0', + `AC` SMALLINT(5) NOT NULL DEFAULT '0', + `STR` MEDIUMINT(8) NOT NULL DEFAULT '75', + `STA` MEDIUMINT(8) NOT NULL DEFAULT '75', + `DEX` MEDIUMINT(8) NOT NULL DEFAULT '75', + `AGI` MEDIUMINT(8) NOT NULL DEFAULT '75', + `_INT` MEDIUMINT(8) NOT NULL DEFAULT '80', + `WIS` MEDIUMINT(8) NOT NULL DEFAULT '75', + `CHA` MEDIUMINT(8) NOT NULL DEFAULT '75', + `ATK` MEDIUMINT(9) NOT NULL DEFAULT '0', + `BotCreateDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `LastSpawnDate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `TotalPlayTime` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `LastZoneId` SMALLINT(6) NOT NULL DEFAULT '0', + `BotInspectMessage` VARCHAR(256) NOT NULL DEFAULT '', + PRIMARY KEY (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botstances` ( + `BotID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `StanceID` TINYINT UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotID`), + CONSTRAINT `FK_botstances_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) +); + +CREATE TABLE `bottimers` ( + `BotID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `TimerID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Value` INT(10) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotID`), + CONSTRAINT `FK_bottimers_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) +); + +CREATE TABLE `botbuffs` ( + `BotBuffId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `SpellId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterLevel` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `DurationFormula` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `TicsRemaining` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `PoisonCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `DiseaseCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `CurseCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `CorruptionCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `HitCount` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `MeleeRune` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `MagicRune` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `DeathSaveSuccessChance` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterAARank` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Persistent` TINYINT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`BotBuffId`), + KEY `FK_botbuff_1` (`BotId`), + CONSTRAINT `FK_botbuff_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botinventory` ( + `BotInventoryID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotID` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `SlotID` INTEGER SIGNED NOT NULL DEFAULT '0', + `ItemID` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `charges` TINYINT(3) UNSIGNED DEFAULT 0, + `color` INTEGER UNSIGNED NOT NULL DEFAULT 0, + `augslot1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot5` MEDIUMINT(7) UNSIGNED DEFAULT 0, + `instnodrop` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + PRIMARY KEY (`BotInventoryID`), + KEY `FK_botinventory_1` (`BotID`), + CONSTRAINT `FK_botinventory_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botpets` ( + `BotPetsId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `PetId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `Name` VARCHAR(64) NULL, + `Mana` INTEGER NOT NULL DEFAULT '0', + `HitPoints` INTEGER NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetsId`), + KEY `FK_botpets_1` (`BotId`), + CONSTRAINT `FK_botpets_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`), + CONSTRAINT `U_botpets_1` UNIQUE (`BotId`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botpetbuffs` ( + `BotPetBuffId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotPetsId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `SpellId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterLevel` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Duration` INT(11) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetBuffId`), + KEY `FK_botpetbuffs_1` (`BotPetsId`), + CONSTRAINT `FK_botpetbuffs_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botpetinventory` ( + `BotPetInventoryId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotPetsId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `ItemId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetInventoryId`), + KEY `FK_botpetinventory_1` (`BotPetsId`), + CONSTRAINT `FK_botpetinventory_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botgroup` ( + `BotGroupId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotGroupLeaderBotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotGroupName` VARCHAR(64) NOT NULL, + PRIMARY KEY (`BotGroupId`), + KEY `FK_botgroup_1` (`BotGroupLeaderBotId`), + CONSTRAINT `FK_botgroup_1` FOREIGN KEY (`BotGroupLeaderBotId`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botgroupmembers` ( + `BotGroupMemberId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotGroupId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotGroupMemberId`), + KEY `FK_botgroupmembers_1` (`BotGroupId`), + CONSTRAINT `FK_botgroupmembers_1` FOREIGN KEY (`BotGroupId`) REFERENCES `botgroup` (`BotGroupId`), + KEY `FK_botgroupmembers_2` (`BotId`), + CONSTRAINT `FK_botgroupmembers_2` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botguildmembers` ( + `char_id` INT(11) NOT NULL DEFAULT '0', + `guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `public_note` TEXT NULL, + `alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`) +) ENGINE=InnoDB; + +DELIMITER // + +CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1) +BEGIN + DECLARE Result CHAR(1); + + SET Result = NULL; + + IF (SELECT COUNT(*) FROM `character_` WHERE `name` = mobname) > 0 THEN + SET Result = 'C'; + ELSEIF (SELECT COUNT(*) FROM `bots` WHERE `Name` = mobname) > 0 THEN + SET Result = 'B'; + END IF; + +RETURN Result; +END// + +DELIMITER ; + +CREATE VIEW `vwbotcharactermobs` AS +SELECT _utf8'C' AS mobtype, +c.`id`, +c.`name`, +c.`class`, +c.`level`, +c.`timelaston`, +c.`zoneid` +FROM `character_` AS c +UNION ALL +SELECT _utf8'B' AS mobtype, +b.`BotID` AS id, +b.`Name` AS name, +b.`Class` AS class, +b.`BotLevel` AS level, +0 AS timelaston, +0 AS zoneid +FROM bots AS b; + +CREATE VIEW `vwgroups` AS +SELECT g.`groupid` AS groupid, +GetMobType(g.`name`) AS mobtype, +g.`name` AS name, +g.`charid` AS mobid, +IFNULL(c.`level`, b.`BotLevel`) AS level +FROM `group_id` AS g +LEFT JOIN `character_` AS c ON g.`name` = c.`name` +LEFT JOIN `bots` AS b ON g.`name` = b.`Name`; + +CREATE VIEW `vwbotgroups` AS +SELECT g.`BotGroupId`, +g.`BotGroupName`, +g.`BotGroupLeaderBotId`, +b.`Name` AS BotGroupLeaderName, +b.`BotOwnerCharacterId`, +c.`name` AS BotOwnerCharacterName +FROM `botgroup` AS g +JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID` +JOIN `character_` AS c ON b.`BotOwnerCharacterID` = c.`id` +ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`; + +CREATE VIEW `vwguildmembers` AS +SELECT 'C' AS mobtype, +cm.`char_id`, +cm.`guild_id`, +cm.`rank`, +cm.`tribute_enable`, +cm.`total_tribute`, +cm.`last_tribute`, +cm.`banker`, +cm.`public_note`, +cm.`alt` +FROM `guild_members` AS cm +UNION ALL +SELECT 'B' AS mobtype, +bm.`char_id`, +bm.`guild_id`, +bm.`rank`, +bm.`tribute_enable`, +bm.`total_tribute`, +bm.`last_tribute`, +bm.`banker`, +bm.`public_note`, +bm.`alt` +FROM `botguildmembers` AS bm; diff --git a/utils/sql/git/bots/drop_bots.sql b/utils/sql/git/bots/drop_bots.sql index d02425d73..63ecc7b91 100644 --- a/utils/sql/git/bots/drop_bots.sql +++ b/utils/sql/git/bots/drop_bots.sql @@ -1,21 +1,37 @@ -DROP TABLE IF EXISTS `botbuffs`; +-- 'drop_bots' sql script file +-- current as of 10/15/2014 +-- +-- Note: This file will revert all changes made by either 'load_bots' sql file. +-- There may still be remnants of bot activity in tables `guild_members` and +-- `group_id`. If these entries are causing issues, you may need to manually +-- remove them. + + +ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`); +ALTER TABLE `group_id` DROP PRIMARY KEY, ADD PRIMARY KEY (`groupid`, `charid`, `ismerc`); + +UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298); + +DELETE FROM `commands` WHERE `command` = 'bot'; +DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots%'; + +DROP VIEW IF EXISTS `vwbotcharactermobs`; +DROP VIEW IF EXISTS `vwbotgroups`; +DROP VIEW IF EXISTS `vwgroups`; +DROP VIEW IF EXISTS `vwguildmembers`; + +DROP FUNCTION IF EXISTS `GetMobType`; + +DROP TABLE IF EXISTS `botguildmembers`; +DROP TABLE IF EXISTS `botgroupmembers`; +-- this table is not a part of 'load_bots.sql' +DROP TABLE IF EXISTS `botgroups`; +DROP TABLE IF EXISTS `botgroup`; DROP TABLE IF EXISTS `botpetinventory`; DROP TABLE IF EXISTS `botpetbuffs`; DROP TABLE IF EXISTS `botpets`; -DROP TABLE IF EXISTS `botgroupmembers`; -DROP TABLE IF EXISTS `botgroup`; -DROP TABLE IF EXISTS `botgroups`; DROP TABLE IF EXISTS `botinventory`; -DROP TABLE IF EXISTS `botguildmembers`; -DROP TABLE IF EXISTS `botstances`; +DROP TABLE IF EXISTS `botbuffs`; DROP TABLE IF EXISTS `bottimers`; +DROP TABLE IF EXISTS `botstances`; DROP TABLE IF EXISTS `bots`; -DROP VIEW IF EXISTS `vwGuildMembers`; -DROP VIEW IF EXISTS `vwBotCharacterMobs`; -DROP VIEW IF EXISTS `vwBotGroups`; - -delete from rule_values where rule_name like 'Bots%' and ruleset_id = 1; - -delete from commands where command = 'bot'; - -update spawn2 set enabled = 0 where id in (59297,59298); \ No newline at end of file diff --git a/utils/sql/git/bots/load_bots.sql b/utils/sql/git/bots/load_bots.sql index d5a358d69..7fe35041e 100644 --- a/utils/sql/git/bots/load_bots.sql +++ b/utils/sql/git/bots/load_bots.sql @@ -1,307 +1,280 @@ --- This is pretty much a straight copy of the original files with fixes applied. --- HeidiSQL does not like sub-directory references, so this should now run from there. --- The 'headers' are left in place for reference only. +-- 'load_bots' sql script file +-- current as of 10/15/2014 +-- +-- Use this file on databases where the player profile blob has been converted. +-- +-- Note: This file assumes a database free of bot remnants. If you have a prior +-- bot installation and wish to reload the default schema and entries, then +-- source 'drop_bots.sql' before sourcing this file. --- FILE: --- source player_tables/botguildmembers.sql; -CREATE TABLE IF NOT EXISTS `botguildmembers` ( - `char_id` int(11) NOT NULL default '0', - `guild_id` mediumint(8) unsigned NOT NULL default '0', - `rank` tinyint(3) unsigned NOT NULL default '0', - `tribute_enable` tinyint(3) unsigned NOT NULL default '0', - `total_tribute` int(10) unsigned NOT NULL default '0', - `last_tribute` int(10) unsigned NOT NULL default '0', - `banker` tinyint(3) unsigned NOT NULL default '0', - `public_note` text NULL, - `alt` tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (`char_id`) -) ENGINE=InnoDB; --- FILE: --- source player_tables/bots.sql; -update spawn2 set enabled = 1 where id in (59297,59298); +ALTER TABLE `guild_members` DROP PRIMARY KEY; +ALTER TABLE `group_id` DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`, `ismerc`); -INSERT INTO rule_values VALUES ('1', 'Bots:BotManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.'); -INSERT INTO rule_values VALUES ('1', 'Bots:BotFinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.'); -INSERT INTO rule_values VALUES ('1', 'Bots:CreateBotCount', '150', 'Number of bots that each account can create'); -INSERT INTO rule_values VALUES ('1', 'Bots:SpawnBotCount', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid'); -INSERT INTO rule_values VALUES ('1', 'Bots:BotQuest', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl'); -INSERT INTO rule_values VALUES ('1', 'Bots:BotGroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.'); -INSERT INTO rule_values VALUES ('1', 'Bots:BotSpellQuest', 'false', 'Anita Thrall\'s (Anita_Thrall.pl) Bot Spell Scriber quests.'); +UPDATE `spawn2` SET `enabled` = 1 WHERE `id` IN (59297,59298); --- this is a hack fix to maintain the original file process -delete from rule_values where rule_name like 'Bots%' and ruleset_id = 1; -INSERT INTO rule_values VALUES ('1', 'Bots:BotAAExpansion', '8', 'The expansion through which bots will obtain AAs'); - --- field count has changed +-- old command kept for reference (`commands` now only has 2 columns - `command` and `access`) -- INSERT INTO `commands` VALUES ('bot', '0', 'Type \"#bot help\" to the see the list of available commands for bots.'); INSERT INTO `commands` VALUES ('bot', '0'); -CREATE TABLE bots ( - `BotID` int(10) unsigned NOT NULL AUTO_INCREMENT, - `BotOwnerCharacterID` int(10) unsigned NOT NULL, - `BotSpellsID` int(10) unsigned NOT NULL DEFAULT '0', - `Name` varchar(64) NOT NULL, - `LastName` varchar(32) DEFAULT NULL, - `BotLevel` tinyint(2) unsigned NOT NULL DEFAULT '0', - `Race` smallint(5) NOT NULL DEFAULT '0', - `Class` tinyint(2) NOT NULL DEFAULT '0', - `Gender` tinyint(2) NOT NULL DEFAULT '0', - `Size` float NOT NULL DEFAULT '0', - `Face` int(10) NOT NULL DEFAULT '1', - `LuclinHairStyle` int(10) NOT NULL DEFAULT '1', - `LuclinHairColor` int(10) NOT NULL DEFAULT '1', - `LuclinEyeColor` int(10) NOT NULL DEFAULT '1', - `LuclinEyeColor2` int(10) NOT NULL DEFAULT '1', - `LuclinBeardColor` int(10) NOT NULL DEFAULT '1', - `LuclinBeard` int(10) NOT NULL DEFAULT '0', - `DrakkinHeritage` int(10) NOT NULL DEFAULT '0', - `DrakkinTattoo` int(10) NOT NULL DEFAULT '0', - `DrakkinDetails` int(10) NOT NULL DEFAULT '0', - `HP` INTEGER NOT NULL DEFAULT '0', - `Mana` INTEGER NOT NULL DEFAULT '0', - `MR` smallint(5) NOT NULL DEFAULT '0', - `CR` smallint(5) NOT NULL DEFAULT '0', - `DR` smallint(5) NOT NULL DEFAULT '0', - `FR` smallint(5) NOT NULL DEFAULT '0', - `PR` smallint(5) NOT NULL DEFAULT '0', - `Corrup` SMALLINT(5) NOT NULL DEFAULT '0', - `AC` smallint(5) NOT NULL DEFAULT '0', - `STR` mediumint(8) NOT NULL DEFAULT '75', - `STA` mediumint(8) NOT NULL DEFAULT '75', - `DEX` mediumint(8) NOT NULL DEFAULT '75', - `AGI` mediumint(8) NOT NULL DEFAULT '75', - `_INT` mediumint(8) NOT NULL DEFAULT '80', - `WIS` mediumint(8) NOT NULL DEFAULT '75', - `CHA` mediumint(8) NOT NULL DEFAULT '75', - `ATK` mediumint(9) NOT NULL DEFAULT '0', - `BotCreateDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `LastSpawnDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `TotalPlayTime` int(10) unsigned NOT NULL DEFAULT '0', - `LastZoneId` smallint(6) NOT NULL DEFAULT '0', - `BotInspectMessage` VARCHAR(256) NOT NULL DEFAULT '', - PRIMARY KEY (`BotID`) +INSERT INTO `rule_values` VALUES + ('1', 'Bots:BotAAExpansion', '8', 'The expansion through which bots will obtain AAs'), + ('1', 'Bots:BotFinishBuffing', 'false', 'Allow for buffs to complete even if the bot caster is out of mana. Only affects buffing out of combat.'), + ('1', 'Bots:BotGroupBuffing', 'false', 'Bots will cast single target buffs as group buffs, default is false for single. Does not make single target buffs work for MGB.'), + ('1', 'Bots:BotManaRegen', '3.0', 'Adjust mana regen for bots, 1 is fast and higher numbers slow it down 3 is about the same as players.'), + ('1', 'Bots:BotQuest', 'false', 'Optional quest method to manage bot spawn limits using the quest_globals name bot_spawn_limit, see: /bazaar/Aediles_Thrall.pl'), + ('1', 'Bots:BotSpellQuest', 'false', 'Anita Thrall\'s (Anita_Thrall.pl) Bot Spell Scriber quests.'), + ('1', 'Bots:CreateBotCount', '150', 'Number of bots that each account can create'), + ('1', 'Bots:SpawnBotCount', '71', 'Number of bots a character can have spawned at one time, You + 71 bots is a 12 group raid'); + +CREATE TABLE `bots` ( + `BotID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotOwnerCharacterID` INT(10) UNSIGNED NOT NULL, + `BotSpellsID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Name` VARCHAR(64) NOT NULL, + `LastName` VARCHAR(32) DEFAULT NULL, + `BotLevel` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', + `Race` SMALLINT(5) NOT NULL DEFAULT '0', + `Class` TINYINT(2) NOT NULL DEFAULT '0', + `Gender` TINYINT(2) NOT NULL DEFAULT '0', + `Size` FLOAT NOT NULL DEFAULT '0', + `Face` INT(10) NOT NULL DEFAULT '1', + `LuclinHairStyle` INT(10) NOT NULL DEFAULT '1', + `LuclinHairColor` INT(10) NOT NULL DEFAULT '1', + `LuclinEyeColor` INT(10) NOT NULL DEFAULT '1', + `LuclinEyeColor2` INT(10) NOT NULL DEFAULT '1', + `LuclinBeardColor` INT(10) NOT NULL DEFAULT '1', + `LuclinBeard` INT(10) NOT NULL DEFAULT '0', + `DrakkinHeritage` INT(10) NOT NULL DEFAULT '0', + `DrakkinTattoo` INT(10) NOT NULL DEFAULT '0', + `DrakkinDetails` INT(10) NOT NULL DEFAULT '0', + `HP` INTEGER NOT NULL DEFAULT '0', + `Mana` INTEGER NOT NULL DEFAULT '0', + `MR` SMALLINT(5) NOT NULL DEFAULT '0', + `CR` SMALLINT(5) NOT NULL DEFAULT '0', + `DR` SMALLINT(5) NOT NULL DEFAULT '0', + `FR` SMALLINT(5) NOT NULL DEFAULT '0', + `PR` SMALLINT(5) NOT NULL DEFAULT '0', + `Corrup` SMALLINT(5) NOT NULL DEFAULT '0', + `AC` SMALLINT(5) NOT NULL DEFAULT '0', + `STR` MEDIUMINT(8) NOT NULL DEFAULT '75', + `STA` MEDIUMINT(8) NOT NULL DEFAULT '75', + `DEX` MEDIUMINT(8) NOT NULL DEFAULT '75', + `AGI` MEDIUMINT(8) NOT NULL DEFAULT '75', + `_INT` MEDIUMINT(8) NOT NULL DEFAULT '80', + `WIS` MEDIUMINT(8) NOT NULL DEFAULT '75', + `CHA` MEDIUMINT(8) NOT NULL DEFAULT '75', + `ATK` MEDIUMINT(9) NOT NULL DEFAULT '0', + `BotCreateDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `LastSpawnDate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `TotalPlayTime` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `LastZoneId` SMALLINT(6) NOT NULL DEFAULT '0', + `BotInspectMessage` VARCHAR(256) NOT NULL DEFAULT '', + PRIMARY KEY (`BotID`) ) ENGINE=InnoDB; -ALTER TABLE `group_id` DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(`groupid`, `charid`, `name`); -ALTER TABLE `guild_members` DROP PRIMARY KEY; +CREATE TABLE `botstances` ( + `BotID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `StanceID` TINYINT UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotID`), + CONSTRAINT `FK_botstances_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) +); -DROP VIEW IF EXISTS `vwGuildMembers`; -CREATE VIEW `vwGuildMembers` AS - select 'C' as mobtype, -cm.char_id, -cm.guild_id, -cm.rank, -cm.tribute_enable, -cm.total_tribute, -cm.last_tribute, -cm.banker, -cm.public_note, -cm.alt -from guild_members as cm -union all -select 'B' as mobtype, -bm.char_id, -bm.guild_id, -bm.rank, -bm.tribute_enable, -bm.total_tribute, -bm.last_tribute, -bm.banker, -bm.public_note, -bm.alt -from botguildmembers as bm; +CREATE TABLE `bottimers` ( + `BotID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `TimerID` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Value` INT(10) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotID`), + CONSTRAINT `FK_bottimers_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) +); -DROP VIEW IF EXISTS `vwBotCharacterMobs`; -CREATE VIEW `vwBotCharacterMobs` AS - select 'C' as mobtype, -c.id, -c.name, -c.class, -c.level, -c.timelaston, -c.zoneid -from character_ as c -union all -select 'B' as mobtype, -b.BotID as id, -b.Name as name, -b.Class as class, -b.BotLevel as level, -0 as timelaston, -0 as zoneid -from bots as b; - --- FILE: --- source player_tables/botpetstatepersists.sql; -DROP TABLE IF EXISTS `botpetinventory`; -DROP TABLE IF EXISTS `botpetbuffs`; -DROP TABLE IF EXISTS `botpets`; - -CREATE TABLE IF NOT EXISTS `botpets` ( - `BotPetsId` integer unsigned NOT NULL AUTO_INCREMENT, - `PetId` integer unsigned NOT NULL DEFAULT '0', - `BotId` integer unsigned NOT NULL DEFAULT '0', - `Name` varchar(64) NULL, - `Mana` integer NOT NULL DEFAULT '0', - `HitPoints` integer NOT NULL DEFAULT '0', - PRIMARY KEY (`BotPetsId`), - KEY `FK_botpets_1` (`BotId`), - CONSTRAINT `FK_botpets_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`), - CONSTRAINT `U_botpets_1` UNIQUE (`BotId`) +CREATE TABLE `botbuffs` ( + `BotBuffId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `SpellId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterLevel` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `DurationFormula` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `TicsRemaining` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `PoisonCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `DiseaseCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `CurseCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `CorruptionCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `HitCount` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `MeleeRune` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `MagicRune` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `DeathSaveSuccessChance` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterAARank` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Persistent` TINYINT(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`BotBuffId`), + KEY `FK_botbuff_1` (`BotId`), + CONSTRAINT `FK_botbuff_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; -CREATE TABLE IF NOT EXISTS `botpetbuffs` ( - `BotPetBuffId` int(10) unsigned NOT NULL AUTO_INCREMENT, - `BotPetsId` int(10) unsigned NOT NULL DEFAULT '0', - `SpellId` int(10) unsigned NOT NULL DEFAULT '0', - `CasterLevel` int(10) unsigned NOT NULL DEFAULT '0', - `Duration` int(11) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`BotPetBuffId`), - KEY `FK_botpetbuffs_1` (`BotPetsId`), - CONSTRAINT `FK_botpetbuffs_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) -) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; - -CREATE TABLE IF NOT EXISTS `botpetinventory` ( - `BotPetInventoryId` integer unsigned NOT NULL AUTO_INCREMENT, - `BotPetsId` integer unsigned NOT NULL DEFAULT '0', - `ItemId` integer unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`BotPetInventoryId`), - KEY `FK_botpetinventory_1` (`BotPetsId`), - CONSTRAINT `FK_botpetinventory_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) -) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; - --- FILE: --- source player_tables/botinventory.sql; -CREATE TABLE IF NOT EXISTS botinventory ( - BotInventoryID integer unsigned NOT NULL auto_increment, - BotID integer unsigned NOT NULL DEFAULT '0', - SlotID integer signed NOT NULL DEFAULT '0', - ItemID integer unsigned NOT NULL DEFAULT '0', - charges tinyint(3) unsigned DEFAULT 0, - color integer unsigned NOT NULL DEFAULT 0, - augslot1 mediumint(7) unsigned NOT NULL DEFAULT 0, - augslot2 mediumint(7) unsigned NOT NULL DEFAULT 0, - augslot3 mediumint(7) unsigned NOT NULL DEFAULT 0, - augslot4 mediumint(7) unsigned NOT NULL DEFAULT 0, - augslot5 mediumint(7) unsigned DEFAULT 0, - instnodrop tinyint(1) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (BotInventoryID), - KEY FK_botinventory_1 (BotID), - CONSTRAINT FK_botinventory_1 FOREIGN KEY (BotID) REFERENCES bots (BotID) +CREATE TABLE `botinventory` ( + `BotInventoryID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotID` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `SlotID` INTEGER SIGNED NOT NULL DEFAULT '0', + `ItemID` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `charges` TINYINT(3) UNSIGNED DEFAULT 0, + `color` INTEGER UNSIGNED NOT NULL DEFAULT 0, + `augslot1` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot2` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot3` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot4` MEDIUMINT(7) UNSIGNED NOT NULL DEFAULT 0, + `augslot5` MEDIUMINT(7) UNSIGNED DEFAULT 0, + `instnodrop` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + PRIMARY KEY (`BotInventoryID`), + KEY `FK_botinventory_1` (`BotID`), + CONSTRAINT `FK_botinventory_1` FOREIGN KEY (`BotID`) REFERENCES `bots` (`BotID`) ) ENGINE=InnoDB; --- FILE: --- source player_tables/botbuffs.sql; -DROP TABLE IF EXISTS `botbuffs`; -CREATE TABLE `botbuffs` ( - `BotBuffId` int(10) unsigned NOT NULL AUTO_INCREMENT, - `BotId` int(10) unsigned NOT NULL DEFAULT '0', - `SpellId` int(10) unsigned NOT NULL DEFAULT '0', - `CasterLevel` int(10) unsigned NOT NULL DEFAULT '0', - `DurationFormula` int(10) unsigned NOT NULL DEFAULT '0', - `TicsRemaining` int(11) unsigned NOT NULL DEFAULT '0', - `PoisonCounters` int(11) unsigned NOT NULL DEFAULT '0', - `DiseaseCounters` int(11) unsigned NOT NULL DEFAULT '0', - `CurseCounters` int(11) unsigned NOT NULL DEFAULT '0', - `CorruptionCounters` INT(11) UNSIGNED NOT NULL DEFAULT '0', - `HitCount` int(10) unsigned NOT NULL DEFAULT '0', - `MeleeRune` int(10) unsigned NOT NULL DEFAULT '0', - `MagicRune` int(10) unsigned NOT NULL DEFAULT '0', - `DeathSaveSuccessChance` int(10) unsigned NOT NULL DEFAULT '0', - `CasterAARank` int(10) unsigned NOT NULL DEFAULT '0', - `Persistent` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`BotBuffId`), - KEY `FK_botbuff_1` (`BotId`), - CONSTRAINT `FK_botbuff_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`) +CREATE TABLE `botpets` ( + `BotPetsId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `PetId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `Name` VARCHAR(64) NULL, + `Mana` INTEGER NOT NULL DEFAULT '0', + `HitPoints` INTEGER NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetsId`), + KEY `FK_botpets_1` (`BotId`), + CONSTRAINT `FK_botpets_1` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`), + CONSTRAINT `U_botpets_1` UNIQUE (`BotId`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; --- FILE: --- source player_tables/botadventuring.sql; -DELIMITER $$ +CREATE TABLE `botpetbuffs` ( + `BotPetBuffId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `BotPetsId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `SpellId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `CasterLevel` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `Duration` INT(11) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetBuffId`), + KEY `FK_botpetbuffs_1` (`BotPetsId`), + CONSTRAINT `FK_botpetbuffs_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botpetinventory` ( + `BotPetInventoryId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotPetsId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `ItemId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotPetInventoryId`), + KEY `FK_botpetinventory_1` (`BotPetsId`), + CONSTRAINT `FK_botpetinventory_1` FOREIGN KEY (`BotPetsId`) REFERENCES `botpets` (`BotPetsID`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + +CREATE TABLE `botgroup` ( + `BotGroupId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotGroupLeaderBotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotGroupName` VARCHAR(64) NOT NULL, + PRIMARY KEY (`BotGroupId`), + KEY `FK_botgroup_1` (`BotGroupLeaderBotId`), + CONSTRAINT `FK_botgroup_1` FOREIGN KEY (`BotGroupLeaderBotId`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botgroupmembers` ( + `BotGroupMemberId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + `BotGroupId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + `BotId` INTEGER UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`BotGroupMemberId`), + KEY `FK_botgroupmembers_1` (`BotGroupId`), + CONSTRAINT `FK_botgroupmembers_1` FOREIGN KEY (`BotGroupId`) REFERENCES `botgroup` (`BotGroupId`), + KEY `FK_botgroupmembers_2` (`BotId`), + CONSTRAINT `FK_botgroupmembers_2` FOREIGN KEY (`BotId`) REFERENCES `bots` (`BotID`) +) ENGINE=InnoDB; + +CREATE TABLE `botguildmembers` ( + `char_id` INT(11) NOT NULL DEFAULT '0', + `guild_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `rank` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `tribute_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `total_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `last_tribute` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `banker` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `public_note` TEXT NULL, + `alt` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`char_id`) +) ENGINE=InnoDB; + +DELIMITER \\ -DROP FUNCTION IF EXISTS `GetMobType` $$ CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1) BEGIN - DECLARE Result CHAR(1); - - SET Result = NULL; - - IF (select count(*) from character_ where name = mobname) > 0 THEN - SET Result = 'C'; - ELSEIF (select count(*) from bots where Name = mobname) > 0 THEN - SET Result = 'B'; - END IF; - - RETURN Result; -END $$ + DECLARE Result CHAR(1); + + SET Result = NULL; + + IF (SELECT COUNT(*) FROM `character_data` WHERE `name` = mobname) > 0 THEN + SET Result = 'C'; + ELSEIF (SELECT COUNT(*) FROM `bots` WHERE `Name` = mobname) > 0 THEN + SET Result = 'B'; + END IF; + + RETURN Result; +END\\ DELIMITER ; -DROP VIEW IF EXISTS `vwGroups`; -CREATE VIEW `vwGroups` AS - select g.groupid as groupid, -GetMobType(g.name) as mobtype, -g.name as name, -g.charid as mobid, -ifnull(c.level, b.BotLevel) as level -from group_id as g -left join character_ as c on g.name = c.name -left join bots as b on g.name = b.Name; +CREATE VIEW `vwbotcharactermobs` AS +SELECT _utf8'C' AS mobtype, +c.`id`, +c.`name`, +c.`class`, +c.`level`, +c.`last_login`, +c.`zone_id` +FROM `character_data` AS c +UNION ALL +SELECT _utf8'B' AS mobtype, +b.`BotID` AS id, +b.`Name` AS name, +b.`Class` AS class, +b.`BotLevel` AS level, +0 AS timelaston, +0 AS zoneid +FROM bots AS b; --- FILE: --- source player_tables/botgroups.sql; -DROP TABLE IF EXISTS `botgroupmembers`; -DROP TABLE IF EXISTS `botgroup`; +CREATE VIEW `vwgroups` AS +SELECT g.`groupid` AS groupid, +GetMobType(g.`name`) AS mobtype, +g.`name` AS name, +g.`charid` AS mobid, +IFNULL(c.`level`, b.`BotLevel`) AS level +FROM `group_id` AS g +LEFT JOIN `character_data` AS c ON g.`name` = c.`name` +LEFT JOIN `bots` AS b ON g.`name` = b.`Name`; -CREATE TABLE IF NOT EXISTS `botgroup` ( - `BotGroupId` integer unsigned NOT NULL AUTO_INCREMENT, - `BotGroupLeaderBotId` integer unsigned NOT NULL DEFAULT '0', - `BotGroupName` varchar(64) NOT NULL, - PRIMARY KEY (`BotGroupId`), - KEY FK_botgroup_1 (BotGroupLeaderBotId), - CONSTRAINT FK_botgroup_1 FOREIGN KEY (BotGroupLeaderBotId) REFERENCES bots (BotID) -) ENGINE=InnoDB; +CREATE VIEW `vwbotgroups` AS +SELECT g.`BotGroupId`, +g.`BotGroupName`, +g.`BotGroupLeaderBotId`, +b.`Name` AS BotGroupLeaderName, +b.`BotOwnerCharacterId`, +c.`name` AS BotOwnerCharacterName +FROM `botgroup` AS g +JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID` +JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id` +ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`; -CREATE TABLE IF NOT EXISTS `botgroupmembers` ( - `BotGroupMemberId` integer unsigned NOT NULL AUTO_INCREMENT, - `BotGroupId` integer unsigned NOT NULL DEFAULT '0', - `BotId` integer unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`BotGroupMemberId`), - KEY FK_botgroupmembers_1 (BotGroupId), - CONSTRAINT FK_botgroupmembers_1 FOREIGN KEY (BotGroupId) REFERENCES botgroup (BotGroupId), - KEY FK_botgroupmembers_2 (BotId), - CONSTRAINT FK_botgroupmembers_2 FOREIGN KEY (BotId) REFERENCES bots (BotID) -) ENGINE=InnoDB; - -DROP VIEW IF EXISTS `vwBotGroups`; -CREATE VIEW `vwBotGroups` AS -select g.BotGroupId, -g.BotGroupName, -g.BotGroupLeaderBotId, -b.Name as BotGroupLeaderName, -b.BotOwnerCharacterId, -c.name as BotOwnerCharacterName -from botgroup as g -join bots as b on g.BotGroupLeaderBotId = b.BotID -join character_ as c on b.BotOwnerCharacterID = c.id -order by b.BotOwnerCharacterId, g.BotGroupName; - --- FILE: --- source player_tables/botstances.sql; -CREATE TABLE botstances ( - BotID int(10) unsigned NOT NULL default '0', - StanceID tinyint unsigned NOT NULL default '0', - PRIMARY KEY (BotID), - CONSTRAINT FK_botstances_1 FOREIGN KEY (BotID) REFERENCES bots (BotID) -); - --- FILE: --- source player_tables/bottimers.sql; -CREATE TABLE bottimers ( -BotID int(10) unsigned NOT NULL default '0', -TimerID int(10) unsigned NOT NULL default '0', -Value int(10) unsigned NOT NULL default '0', -PRIMARY KEY (BotID), -CONSTRAINT FK_bottimers_1 FOREIGN KEY (BotID) REFERENCES bots (BotID) -) +CREATE VIEW `vwguildmembers` AS +SELECT 'C' AS mobtype, +cm.`char_id`, +cm.`guild_id`, +cm.`rank`, +cm.`tribute_enable`, +cm.`total_tribute`, +cm.`last_tribute`, +cm.`banker`, +cm.`public_note`, +cm.`alt` +FROM `guild_members` AS cm +UNION ALL +SELECT 'B' AS mobtype, +bm.`char_id`, +bm.`guild_id`, +bm.`rank`, +bm.`tribute_enable`, +bm.`total_tribute`, +bm.`last_tribute`, +bm.`banker`, +bm.`public_note`, +bm.`alt` +FROM `botguildmembers` AS bm; From 594657f2c738b188a226b8698bbff81f14651a59 Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 15 Oct 2014 22:08:27 -0400 Subject: [PATCH 0147/1883] Manual merge for 0c3e51963b5803d66443e71554d3e06a296805b3 in pull request #269. --- common/database.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 91a659d5b..f4a22d823 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2931,22 +2931,26 @@ uint32 Database::GetGroupID(const char* name){ } /* Is this really getting used properly... A half implementation ? Akkadius */ -char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf){ - leaderbuf = ""; +char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf) { + strcpy(leaderbuf, ""); + uint32 group_id = 0; + std::string query = StringFormat("SELECT `groupid` FROM `group_id` WHERE `name = '%s'", name); auto results = QueryDatabase(query); - auto row = results.begin(); uint32 group_id = 0; - for (auto row = results.begin(); row != results.end(); ++row) { - if (row[0]){ group_id = atoi(row[0]); } - } - if (group_id > 0){ - query = StringFormat("SELECT `leadername` FROM `group_leader` WHERE `gid` = '%u' AND `groupid` = %u LIMIT 1", group_id); - results = QueryDatabase(query); - for (auto row = results.begin(); row != results.end(); ++row) { - if (row[0]){ strcpy(leaderbuf, row[0]); } - } - } + for (auto row = results.begin(); row != results.end(); ++row) + if (row[0]) + group_id = atoi(row[0]); + + if (group_id == 0) + return leaderbuf; + + query = StringFormat("SELECT `leadername` FROM `group_leader` WHERE `gid` = '%u' AND `groupid` = %u LIMIT 1", group_id); + results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) + if (row[0]) + strcpy(leaderbuf, row[0]); return leaderbuf; } From fc8cb2b5b724eb5179d19c92fac21b8e7c695b23 Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 15 Oct 2014 22:12:57 -0400 Subject: [PATCH 0148/1883] Manual merge of 4e3826228d43321abec7805f65b6d43d0f04ab06 in #269. --- common/database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index f4a22d823..24f171cc9 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -943,7 +943,7 @@ bool Database::CheckDatabaseConversions() { // printppdebug = 1; if (runconvert == 1){ - printf("Running character binary blob to database conversion... \n", number_of_characters); + printf("Running character binary blob to database conversion... \n"); /* Get the number of characters */ rquery = StringFormat("SELECT COUNT(`id`) FROM `character_`"); results = QueryDatabase(rquery); From 6028dbb4e52f8b51ab32075091502578620ae45f Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 15 Oct 2014 22:31:44 -0400 Subject: [PATCH 0149/1883] hateborne: grid assign match fix. --- zone/waypoints.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index a36bcec8b..cfefe73f3 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1084,14 +1084,14 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) // how much it's allowed to be off by #define _GASSIGN_TOLERANCE 1.0 - if(results.RowCount() == 0) // try a fuzzy match if that didn't find it + if (results.RowCount() == 0) // try a fuzzy match if that didn't find it { query = StringFormat("SELECT id,x,y FROM spawn2 WHERE zone='%s' AND " "ABS( ABS(x) - ABS(%f) ) < %f AND " "ABS( ABS(y) - ABS(%f) ) < %f", zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); - if(!results.Success()) { + if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1100,12 +1100,13 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) matches = results.RowCount(); } - if (matches == 0) { + if (matches == 0) + { client->Message(0, "ERROR: Unable to assign grid - can't find it in spawn2"); return; } - if(matches == 1) + if(matches > 1) { client->Message(0, "ERROR: Unable to assign grid - multiple spawn2 rows match"); return; @@ -1125,7 +1126,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) return; } - if (results.RowsAffected() != 1) { + if (results.RowsAffected() != 1) + { client->Message(0, "ERROR: found spawn2 id %d but the update query failed", spawn2id); return; } @@ -1133,7 +1135,8 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) if(client) client->LogSQL(query.c_str()); - if(!fuzzy) { + if (!fuzzy) + { client->Message(0, "Grid assign: spawn2 id = %d updated - exact match", spawn2id); return; } From 0f9cfc06150af1aa7b87c84077e48d05dc54c956 Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 15 Oct 2014 22:15:24 -0700 Subject: [PATCH 0150/1883] Very new versions of gcc appear to have now cleaned up yet another header leaking out --- luabind/luabind/detail/object_rep.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/luabind/luabind/detail/object_rep.hpp b/luabind/luabind/detail/object_rep.hpp index dafa6532a..93b3e39d6 100644 --- a/luabind/luabind/detail/object_rep.hpp +++ b/luabind/luabind/detail/object_rep.hpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace luabind { namespace detail { From 9c6ab056596e5ea79b0e073f883b2d24d3c47c57 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 16 Oct 2014 01:05:43 -0700 Subject: [PATCH 0151/1883] Removed PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP ifdef, we dont use it anyway and it was failing on FreeBSD gcc49 --- common/unix.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/common/unix.h b/common/unix.h index c78d05cb2..d4155f946 100644 --- a/common/unix.h +++ b/common/unix.h @@ -18,9 +18,6 @@ #ifndef _WINDOWS #ifndef __UNIX_H__ #define __UNIX_H__ - #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __LOCK_INITIALIZER} - #endif #include typedef int SOCKET; From 4cf845e6fff3c748505a48e3673e6997afe2ddb6 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 16 Oct 2014 01:16:38 -0700 Subject: [PATCH 0152/1883] Workaround for FreeBSD not having std::to_string --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a975ef533..4e2f5f9e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,7 @@ ENDIF(MSVC) IF(UNIX) IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ADD_DEFINITIONS(-DFREEBSD) + ADD_DEFINITIONS(-D_GLIBCXX_USE_C99) SET(FREEBSD TRUE) ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") From 7ca23d14c7f1ecd9a8ac53d33d478f9874c50619 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 16 Oct 2014 17:01:06 -0400 Subject: [PATCH 0153/1883] Remove debug statement --- zone/raids.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 0adbcdef1..c0879eca6 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -262,7 +262,6 @@ void Raid::SaveRaidLeaderAA() { char *queryBuffer = new char[sizeof(RaidLeadershipAA_Struct) * 2 + 1]; database.DoEscapeString(queryBuffer, (char*)&raid_aa, sizeof(RaidLeadershipAA_Struct)); - _hex(NET__ERROR, queryBuffer, sizeof(RaidLeadershipAA_Struct)); std::string query = "UPDATE raid_leaders SET leadershipaa = '"; query += queryBuffer; From 2267881d52645f329893efe2a2112dc5529b8079 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 16 Oct 2014 19:16:52 -0400 Subject: [PATCH 0154/1883] Fixed BOTS auto-convert code and load/drop scripts. Added a sql for fixing an existing database that was auto-converted incorrectly (located in ../bots/deprecated) --- changelog.txt | 4 + common/database.cpp | 34 ++++----- .../2014_10_16_Lower_Case_View_Fix.sql | 74 +++++++++++++++++++ .../sql/git/bots/deprecated/load_bots_old.sql | 8 +- utils/sql/git/bots/drop_bots.sql | 8 +- utils/sql/git/bots/load_bots.sql | 8 +- 6 files changed, 107 insertions(+), 29 deletions(-) create mode 100644 utils/sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql diff --git a/changelog.txt b/changelog.txt index ecdc1c62d..c1b68b304 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/16/2014 == +Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted. +Fix SQL: ../sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql + == 10/15/2014 == Uleat: Cleaned up load/drop bots sqls, added '../utils/sql/git/bots/deprecated' and '../deprecated/load_bots_old.sql' (use this file on pre-player blob conversion databases.) Notes: I modifed the behavior of both load and drop bots to fail on the first operation if their modifications have been performed already. diff --git a/common/database.cpp b/common/database.cpp index 24f171cc9..f08cf06b4 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1921,7 +1921,7 @@ bool Database::CheckDatabaseConversions() { int runbotsconvert = 0; /* Check For Legacy Bot References */ - rquery = StringFormat("SHOW CREATE VIEW `vwbotcharactermobs`"); + rquery = StringFormat("SHOW CREATE VIEW `vwBotCharacterMobs`"); results = QueryDatabase(rquery); if (results.RowCount() == 1){ auto row = results.begin(); @@ -1948,12 +1948,12 @@ bool Database::CheckDatabaseConversions() { printf("Running bot views/function database conversion... \n"); /* Update view `vwbotcharactermobs` */ - rquery = StringFormat("DROP VIEW `vwbotcharactermobs`;"); + rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwbotcharactermobs`", rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwBotCharacterMobs`", rquery); rquery = StringFormat( - "CREATE VIEW `vwbotcharactermobs` AS\n" + "CREATE VIEW `vwBotCharacterMobs` AS\n" "SELECT _utf8'C' AS mobtype,\n" // Natedog: '_utf8' "c.`id`,\n" "c.`name`,\n" @@ -1973,7 +1973,7 @@ bool Database::CheckDatabaseConversions() { "FROM bots AS b;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwbotcharactermobs`", rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwBotCharacterMobs`", rquery); /* Update function `GetMobType` */ @@ -2002,12 +2002,12 @@ bool Database::CheckDatabaseConversions() { /* Update view `vwgroups` */ - rquery = StringFormat("DROP VIEW IF EXISTS `vwgroups`;"); + rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwgroups`", rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwGroups`", rquery); rquery = StringFormat( - "CREATE VIEW `vwgroups` AS\n" + "CREATE VIEW `vwGroups` AS\n" "SELECT g.`groupid` AS groupid,\n" "GetMobType(g.`name`) AS mobtype,\n" "g.`name` AS name,\n" @@ -2018,16 +2018,16 @@ bool Database::CheckDatabaseConversions() { "LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwgroups`", rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwGroups`", rquery); /* Update view `vwbotgroups` */ - rquery = StringFormat("DROP VIEW IF EXISTS `vwbotgroups`;"); + rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwbotgroups`", rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwBotGroups`", rquery); rquery = StringFormat( - "CREATE VIEW `vwbotgroups` AS\n" + "CREATE VIEW `vwBotGroups` AS\n" "SELECT g.`BotGroupId`,\n" "g.`BotGroupName`,\n" "g.`BotGroupLeaderBotId`,\n" @@ -2040,16 +2040,16 @@ bool Database::CheckDatabaseConversions() { "ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwbotgroups`", rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwBotGroups`", rquery); /* Update view `vwguildmembers` */ - rquery = StringFormat("DROP VIEW IF EXISTS `vwguildmembers`;"); + rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwguildmembers`", rquery); + ThrowDBError(results.ErrorMessage(), "Drop View `vwGuildMembers`", rquery); rquery = StringFormat( - "CREATE VIEW `vwguildmembers` AS\n" + "CREATE VIEW `vwGuildMembers` AS\n" "SELECT 'C' AS mobtype,\n" "cm.`char_id`,\n" "cm.`guild_id`,\n" @@ -2075,7 +2075,7 @@ bool Database::CheckDatabaseConversions() { "FROM `botguildmembers` AS bm;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwguildmembers`", rquery); + ThrowDBError(results.ErrorMessage(), "Create View `vwGuildMembers`", rquery); } if (runbotsconvert == 1){ diff --git a/utils/sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql b/utils/sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql new file mode 100644 index 000000000..eb53c9ade --- /dev/null +++ b/utils/sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql @@ -0,0 +1,74 @@ +-- A fix for the auto-conversion view renaming issue + + +DROP VIEW IF EXISTS `vwbotcharactermobs`; +DROP VIEW IF EXISTS `vwbotgroups`; +DROP VIEW IF EXISTS `vwgroups`; +DROP VIEW IF EXISTS `vwguildmembers`; + + +CREATE VIEW `vwBotCharacterMobs` AS +SELECT _utf8'C' AS mobtype, +c.`id`, +c.`name`, +c.`class`, +c.`level`, +c.`last_login`, +c.`zone_id` +FROM `character_data` AS c +UNION ALL +SELECT _utf8'B' AS mobtype, +b.`BotID` AS id, +b.`Name` AS name, +b.`Class` AS class, +b.`BotLevel` AS level, +0 AS timelaston, +0 AS zoneid +FROM bots AS b; + +CREATE VIEW `vwGroups` AS +SELECT g.`groupid` AS groupid, +GetMobType(g.`name`) AS mobtype, +g.`name` AS name, +g.`charid` AS mobid, +IFNULL(c.`level`, b.`BotLevel`) AS level +FROM `group_id` AS g +LEFT JOIN `character_data` AS c ON g.`name` = c.`name` +LEFT JOIN `bots` AS b ON g.`name` = b.`Name`; + +CREATE VIEW `vwBotGroups` AS +SELECT g.`BotGroupId`, +g.`BotGroupName`, +g.`BotGroupLeaderBotId`, +b.`Name` AS BotGroupLeaderName, +b.`BotOwnerCharacterId`, +c.`name` AS BotOwnerCharacterName +FROM `botgroup` AS g +JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID` +JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id` +ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`; + +CREATE VIEW `vwGuildMembers` AS +SELECT 'C' AS mobtype, +cm.`char_id`, +cm.`guild_id`, +cm.`rank`, +cm.`tribute_enable`, +cm.`total_tribute`, +cm.`last_tribute`, +cm.`banker`, +cm.`public_note`, +cm.`alt` +FROM `guild_members` AS cm +UNION ALL +SELECT 'B' AS mobtype, +bm.`char_id`, +bm.`guild_id`, +bm.`rank`, +bm.`tribute_enable`, +bm.`total_tribute`, +bm.`last_tribute`, +bm.`banker`, +bm.`public_note`, +bm.`alt` +FROM `botguildmembers` AS bm; diff --git a/utils/sql/git/bots/deprecated/load_bots_old.sql b/utils/sql/git/bots/deprecated/load_bots_old.sql index 9f57191ab..44d1c1b90 100644 --- a/utils/sql/git/bots/deprecated/load_bots_old.sql +++ b/utils/sql/git/bots/deprecated/load_bots_old.sql @@ -213,7 +213,7 @@ END// DELIMITER ; -CREATE VIEW `vwbotcharactermobs` AS +CREATE VIEW `vwBotCharacterMobs` AS SELECT _utf8'C' AS mobtype, c.`id`, c.`name`, @@ -232,7 +232,7 @@ b.`BotLevel` AS level, 0 AS zoneid FROM bots AS b; -CREATE VIEW `vwgroups` AS +CREATE VIEW `vwGroups` AS SELECT g.`groupid` AS groupid, GetMobType(g.`name`) AS mobtype, g.`name` AS name, @@ -242,7 +242,7 @@ FROM `group_id` AS g LEFT JOIN `character_` AS c ON g.`name` = c.`name` LEFT JOIN `bots` AS b ON g.`name` = b.`Name`; -CREATE VIEW `vwbotgroups` AS +CREATE VIEW `vwBotGroups` AS SELECT g.`BotGroupId`, g.`BotGroupName`, g.`BotGroupLeaderBotId`, @@ -254,7 +254,7 @@ JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID` JOIN `character_` AS c ON b.`BotOwnerCharacterID` = c.`id` ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`; -CREATE VIEW `vwguildmembers` AS +CREATE VIEW `vwGuildMembers` AS SELECT 'C' AS mobtype, cm.`char_id`, cm.`guild_id`, diff --git a/utils/sql/git/bots/drop_bots.sql b/utils/sql/git/bots/drop_bots.sql index 63ecc7b91..326194ad6 100644 --- a/utils/sql/git/bots/drop_bots.sql +++ b/utils/sql/git/bots/drop_bots.sql @@ -15,10 +15,10 @@ UPDATE `spawn2` SET `enabled` = 0 WHERE `id` IN (59297,59298); DELETE FROM `commands` WHERE `command` = 'bot'; DELETE FROM `rule_values` WHERE `rule_name` LIKE 'Bots%'; -DROP VIEW IF EXISTS `vwbotcharactermobs`; -DROP VIEW IF EXISTS `vwbotgroups`; -DROP VIEW IF EXISTS `vwgroups`; -DROP VIEW IF EXISTS `vwguildmembers`; +DROP VIEW IF EXISTS `vwBotCharacterMobs`; +DROP VIEW IF EXISTS `vwBotGroups`; +DROP VIEW IF EXISTS `vwGroups`; +DROP VIEW IF EXISTS `vwGuildMembers`; DROP FUNCTION IF EXISTS `GetMobType`; diff --git a/utils/sql/git/bots/load_bots.sql b/utils/sql/git/bots/load_bots.sql index 7fe35041e..9957b882a 100644 --- a/utils/sql/git/bots/load_bots.sql +++ b/utils/sql/git/bots/load_bots.sql @@ -213,7 +213,7 @@ END\\ DELIMITER ; -CREATE VIEW `vwbotcharactermobs` AS +CREATE VIEW `vwBotCharacterMobs` AS SELECT _utf8'C' AS mobtype, c.`id`, c.`name`, @@ -232,7 +232,7 @@ b.`BotLevel` AS level, 0 AS zoneid FROM bots AS b; -CREATE VIEW `vwgroups` AS +CREATE VIEW `vwGroups` AS SELECT g.`groupid` AS groupid, GetMobType(g.`name`) AS mobtype, g.`name` AS name, @@ -242,7 +242,7 @@ FROM `group_id` AS g LEFT JOIN `character_data` AS c ON g.`name` = c.`name` LEFT JOIN `bots` AS b ON g.`name` = b.`Name`; -CREATE VIEW `vwbotgroups` AS +CREATE VIEW `vwBotGroups` AS SELECT g.`BotGroupId`, g.`BotGroupName`, g.`BotGroupLeaderBotId`, @@ -254,7 +254,7 @@ JOIN `bots` AS b ON g.`BotGroupLeaderBotId` = b.`BotID` JOIN `character_data` AS c ON b.`BotOwnerCharacterID` = c.`id` ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`; -CREATE VIEW `vwguildmembers` AS +CREATE VIEW `vwGuildMembers` AS SELECT 'C' AS mobtype, cm.`char_id`, cm.`guild_id`, From 9c725332645d8f4b832abf7c4715cbeae1073cd1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 16 Oct 2014 19:20:53 -0400 Subject: [PATCH 0155/1883] Fix issue with raidMakeLeader packets --- common/patches/rof.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/underfoot.cpp | 2 +- zone/raids.cpp | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 96ebcaf63..1fcb74078 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2613,7 +2613,7 @@ namespace RoF strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } - else if (raid_gen->action == 14) + else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 134be8008..8a023ce42 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1668,7 +1668,7 @@ namespace SoD strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } - else if (raid_gen->action == 14) + else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 2b4640f29..2075fd142 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1326,7 +1326,7 @@ namespace SoF strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } - else if (raid_gen->action == 14) + else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index dd31d749d..aa342a412 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1940,7 +1940,7 @@ namespace Underfoot strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); dest->FastQueuePacket(&outapp); } - else if (raid_gen->action == 14) + else if (raid_gen->action == 14 || raid_gen->action == 30) { RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); diff --git a/zone/raids.cpp b/zone/raids.cpp index c0879eca6..e456d0beb 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1094,12 +1094,12 @@ void Raid::QueuePacket(const EQApplicationPacket *app, bool ack_req) void Raid::SendMakeLeaderPacket(const char *who) //30 { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; rg->action = raidMakeLeader; strn0cpy(rg->leader_name, who, 64); strn0cpy(rg->player_name, who, 64); - rg->parameter = 0; + memcpy(&rg->raid, &raid_aa, sizeof(RaidLeadershipAA_Struct)); QueuePacket(outapp); safe_delete(outapp); } @@ -1109,12 +1109,12 @@ void Raid::SendMakeLeaderPacketTo(const char *who, Client *to) if(!to) return; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); + RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; rg->action = raidMakeLeader; strn0cpy(rg->leader_name, who, 64); strn0cpy(rg->player_name, who, 64); - rg->parameter = 0; + memcpy(&rg->raid, &raid_aa, sizeof(RaidLeadershipAA_Struct)); to->QueuePacket(outapp); safe_delete(outapp); } From b10062452acac1dbf2abdf4e18ab53834cae4967 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 17 Oct 2014 01:06:27 -0400 Subject: [PATCH 0156/1883] Fix issue with moving a group leader in a raid Moving a group leader to the ungrouped section was not correctly finding an appropriate new group leader. --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fdc5e5021..f1d534d71 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11137,7 +11137,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) r->SetGroupLeader(ri->leader_name, false); for (int x = 0; x < MAX_RAID_MEMBERS; x++) { - if (strlen(r->members[x].membername) > 0 && strcmp(r->members[x].membername, ri->leader_name) != 0) + if (r->members[x].GroupNumber == oldgrp && strlen(r->members[x].membername) > 0 && strcmp(r->members[x].membername, ri->leader_name) != 0) { r->SetGroupLeader(r->members[x].membername); Client *cgl = entity_list.GetClientByName(r->members[x].membername); From 6d95fc2547561d25f909c63504364529e820fd17 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 17 Oct 2014 15:05:47 -0400 Subject: [PATCH 0157/1883] Handle Leadership with leader change in RaidCommandDisband --- zone/client_packet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f1d534d71..a7f839d65 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11010,6 +11010,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) if (r->members[x].GroupNumber == grp){ r->SetGroupLeader(ri->leader_name, false); r->SetGroupLeader(r->members[x].membername); + r->UpdateGroupAAs(grp); break; } } @@ -11021,6 +11022,8 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) if (strlen(r->members[x].membername) > 0 && strcmp(r->members[x].membername, r->members[i].membername) != 0) { r->SetRaidLeader(r->members[i].membername, r->members[x].membername); + r->UpdateRaidAAs(); + r->SendAllRaidLeadershipAA(); break; } } From 2db5dc2ed708eee6db5ab5cbcd00e5c3ce84923d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 17 Oct 2014 15:10:43 -0400 Subject: [PATCH 0158/1883] ndle Leadership with leader change in RaidCommandMoveGroup --- zone/client_packet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a7f839d65..2d7df70ce 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11077,6 +11077,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) if (strcmp(ri->leader_name, r->members[x].membername) != 0 && strlen(ri->leader_name) > 0) { r->SetGroupLeader(r->members[x].membername); + r->UpdateGroupAAs(oldgrp); Client *cgl = entity_list.GetClientByName(r->members[x].membername); if (cgl){ r->SendRaidRemove(r->members[x].membername, cgl); @@ -11104,8 +11105,10 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) } } } - if (grpcount == 0) + if (grpcount == 0) { r->SetGroupLeader(ri->leader_name); + r->UpdateGroupAAs(ri->parameter); + } r->MoveMember(ri->leader_name, ri->parameter); if (c){ @@ -11143,6 +11146,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) if (r->members[x].GroupNumber == oldgrp && strlen(r->members[x].membername) > 0 && strcmp(r->members[x].membername, ri->leader_name) != 0) { r->SetGroupLeader(r->members[x].membername); + r->UpdateGroupAAs(oldgrp); Client *cgl = entity_list.GetClientByName(r->members[x].membername); if (cgl){ r->SendRaidRemove(r->members[x].membername, cgl); From 223d06645d111955164f77cdd6d34f0671a0040e Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 17 Oct 2014 21:04:29 -0400 Subject: [PATCH 0159/1883] Added clarification to 'drop_bots.sql' notes for cases of failed script --- utils/sql/git/bots/drop_bots.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/sql/git/bots/drop_bots.sql b/utils/sql/git/bots/drop_bots.sql index 326194ad6..df8ca4fa8 100644 --- a/utils/sql/git/bots/drop_bots.sql +++ b/utils/sql/git/bots/drop_bots.sql @@ -5,6 +5,10 @@ -- There may still be remnants of bot activity in tables `guild_members` and -- `group_id`. If these entries are causing issues, you may need to manually -- remove them. +-- +-- If this script fails due to a 'SQL Error (1068): Multiple primary key defined' +-- error, run this query: ALTER TABLE `guild_members` DROP PRIMARY KEY; +-- and it should remove the key so this script will process in its entirety. ALTER TABLE `guild_members` ADD PRIMARY KEY (`char_id`); From e8eb774458780019f59df34aa2ae8076c797d9d0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 18 Oct 2014 00:17:46 -0400 Subject: [PATCH 0160/1883] Implement group mentor, leadership exp sharing (SoF+ only) Currently only works in normal groups Some decisions: the EXP will be rounded in the favor of the group leader No idea how live actually handles it. --- changelog.txt | 3 ++ common/database.cpp | 23 ++++++++--- common/database.h | 2 +- common/emu_oplist.h | 1 + common/eq_packet_structs.h | 6 +++ utils/patches/patch_RoF.conf | 1 + utils/patches/patch_SoD.conf | 1 + utils/patches/patch_SoF.conf | 1 + utils/patches/patch_Underfoot.conf | 1 + .../git/required/2014_10_18_group_mentor.sql | 2 + zone/client_packet.cpp | 32 +++++++++++++-- zone/client_packet.h | 1 + zone/exp.cpp | 17 ++++++-- zone/groups.cpp | 40 +++++++++++++++++++ zone/groups.h | 8 ++++ zone/worldserver.cpp | 5 ++- zone/zonedb.cpp | 2 +- 17 files changed, 131 insertions(+), 15 deletions(-) create mode 100644 utils/sql/git/required/2014_10_18_group_mentor.sql diff --git a/changelog.txt b/changelog.txt index c1b68b304..df7f664f4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/18/2014== +demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) + == 10/16/2014 == Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted. Fix SQL: ../sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql diff --git a/common/database.cpp b/common/database.cpp index f08cf06b4..f36ab1713 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2963,7 +2963,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { return; } - query = StringFormat("INSERT INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller) VALUES(%u, '%s', '', '', '', '', '')", + query = StringFormat("INSERT INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%u, '%s', '', '', '', '', '', '', '0')", gid, EscapeString(name).c_str()); result = QueryDatabase(query); @@ -2972,8 +2972,9 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { } } -char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank, char* assist, char* puller, char *marknpc, GroupLeadershipAA_Struct* GLAA){ - std::string query = StringFormat("SELECT `leadername`, `maintank`, `assist`, `puller`, `marknpc`, `leadershipaa` FROM `group_leaders` WHERE `gid` = %lu",(unsigned long)gid); +char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank, char* assist, char* puller, char *marknpc, char *mentoree, int *mentor_percent, GroupLeadershipAA_Struct* GLAA) +{ + std::string query = StringFormat("SELECT `leadername`, `maintank`, `assist`, `puller`, `marknpc`, `mentoree`, `mentor_percent`, `leadershipaa` FROM `group_leaders` WHERE `gid` = %lu",(unsigned long)gid); auto results = QueryDatabase(query); if (!results.Success() || results.RowCount() == 0) { @@ -2992,6 +2993,12 @@ char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* mainta if(marknpc) marknpc[0] = '\0'; + if (mentoree) + mentoree[0] = '\0'; + + if (mentor_percent) + *mentor_percent = 0; + return leaderbuf; } @@ -3012,8 +3019,14 @@ char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* mainta if(marknpc) strcpy(marknpc, row[4]); - if(GLAA && results.LengthOfColumn(5) == sizeof(GroupLeadershipAA_Struct)) - memcpy(GLAA, row[5], sizeof(GroupLeadershipAA_Struct)); + if (mentoree) + strcpy(mentoree, row[5]); + + if (mentor_percent) + *mentor_percent = atoi(row[6]); + + if(GLAA && results.LengthOfColumn(7) == sizeof(GroupLeadershipAA_Struct)) + memcpy(GLAA, row[7], sizeof(GroupLeadershipAA_Struct)); return leaderbuf; } diff --git a/common/database.h b/common/database.h index 6fa9ef60a..71a6de9fb 100644 --- a/common/database.h +++ b/common/database.h @@ -203,7 +203,7 @@ public: void SetGroupLeaderName(uint32 gid, const char* name); char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, - GroupLeadershipAA_Struct* GLAA = nullptr); + char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr); void ClearGroupLeader(uint32 gid = 0); diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 6ddd59123..c0ca0ca4e 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -207,6 +207,7 @@ N(OP_GroupInvite2), N(OP_GroupLeaderChange), N(OP_GroupLeadershipAAUpdate), N(OP_GroupMakeLeader), +N(OP_GroupMentor), N(OP_GroupRoles), N(OP_GroupUpdate), N(OP_GroupUpdateB), diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a78b2afa1..d0792fd37 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2231,6 +2231,12 @@ struct GroupLeaderChange_Struct /*128*/ char Unknown128[20]; }; +struct GroupMentor_Struct { +/*000*/ int percent; +/*004*/ char name[64]; +/*068*/ +}; + struct FaceChange_Struct { /*000*/ uint8 haircolor; /*001*/ uint8 beardcolor; diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index e4eb9ba14..6bd486bfa 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -500,6 +500,7 @@ OP_GroupRoles=0x047c OP_GroupMakeLeader=0x4129 OP_DoGroupLeadershipAbility=0x17d7 OP_GroupLeadershipAAUpdate=0x6567 +OP_GroupMentor=0x56DB # LFG/LFP Opcodes OP_LFGCommand=0x4463 diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index 472d60e7a..0effd1b3c 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -486,6 +486,7 @@ OP_GroupDisbandOther=0x162d OP_GroupLeaderChange=0x7545 OP_GroupRoles=0x6b67 OP_GroupMakeLeader=0x6087 +OP_GroupMentor=0x1224 # LFG/LFP Opcodes OP_LFGCommand=0x3288 # C OP_LFGGetMatchesRequest=0x5613 # C diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index a50c1faf6..0b53daefd 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -452,6 +452,7 @@ OP_GroupDelete=0x0000 # OP_CancelInvite=0x596C #Trevius 03/02/09 OP_GroupFollow2=0x59D4 #Xinu 02/20/09 OP_GroupInvite2=0x07F6 #Xinu 02/20/09 +OP_GroupMentor=0x9EF3 #LFG/LFP Opcodes OP_LFGCommand=0x5D81 #Trevius 01/16/09 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index b7bdbc7e0..01cc1ad47 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -489,6 +489,7 @@ OP_GroupDisbandOther=0x49f6 # C OP_GroupLeaderChange=0x0c33 # C OP_GroupRoles=0x116d # C OP_GroupMakeLeader=0x5851 +OP_GroupMentor=0x292f # LFG/LFP Opcodes OP_LFGCommand=0x2c38 # C diff --git a/utils/sql/git/required/2014_10_18_group_mentor.sql b/utils/sql/git/required/2014_10_18_group_mentor.sql new file mode 100644 index 000000000..bd139f076 --- /dev/null +++ b/utils/sql/git/required/2014_10_18_group_mentor.sql @@ -0,0 +1,2 @@ +ALTER TABLE `group_leaders` ADD `mentoree` VARCHAR(64) NOT NULL; +ALTER TABLE `group_leaders` ADD `mentor_percent` INT(4) DEFAULT 0 NOT NULL; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2d7df70ce..f759c9321 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -234,6 +234,7 @@ void MapOpcodes() ConnectedOpcodes[OP_GroupInvite] = &Client::Handle_OP_GroupInvite; ConnectedOpcodes[OP_GroupInvite2] = &Client::Handle_OP_GroupInvite2; ConnectedOpcodes[OP_GroupMakeLeader] = &Client::Handle_OP_GroupMakeLeader; + ConnectedOpcodes[OP_GroupMentor] = &Client::Handle_OP_GroupMentor; ConnectedOpcodes[OP_GroupRoles] = &Client::Handle_OP_GroupRoles; ConnectedOpcodes[OP_GroupUpdate] = &Client::Handle_OP_GroupUpdate; ConnectedOpcodes[OP_GuildBank] = &Client::Handle_OP_GuildBank; @@ -1635,9 +1636,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) } } //else, somebody from our group is already here... - if (group) - group->UpdatePlayer(this); - else + if (!group) database.SetGroupID(GetName(), 0, CharacterID()); //cannot re-establish group, kill it } @@ -1656,9 +1655,11 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) char AssistName[64]; char PullerName[64]; char NPCMarkerName[64]; + char mentoree_name[64]; + int mentor_percent; GroupLeadershipAA_Struct GLAA; memset(ln, 0, 64); - strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, &GLAA)); + strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, mentoree_name, &mentor_percent, &GLAA)); Client *c = entity_list.GetClientByName(ln); if (c) group->SetLeader(c); @@ -1668,6 +1669,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) group->SetPuller(PullerName); group->SetNPCMarker(NPCMarkerName); group->SetGroupAAs(&GLAA); + group->SetGroupMentor(mentor_percent, mentoree_name); //group->NotifyMainTank(this, 1); //group->NotifyMainAssist(this, 1); @@ -1679,6 +1681,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) group->SendLeadershipAAUpdate(); } + group->UpdatePlayer(this); LFG = false; } @@ -6858,6 +6861,27 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) } } +void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) +{ + if (app->size != sizeof(GroupMentor_Struct)) { + LogFile->write(EQEMuLog::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + DumpPacket(app); + return; + } + GroupMentor_Struct *gms = (GroupMentor_Struct *)app->pBuffer; + Group *group = GetGroup(); + if (!group) + return; + gms->name[63] = '\0'; + + if (strlen(gms->name)) + group->SetGroupMentor(gms->percent, gms->name); + else + group->ClearGroupMentor(); + + return; +} + void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { diff --git a/zone/client_packet.h b/zone/client_packet.h index 7cf7ce06b..0868b93ba 100644 --- a/zone/client_packet.h +++ b/zone/client_packet.h @@ -138,6 +138,7 @@ void Handle_OP_GroupInvite(const EQApplicationPacket *app); void Handle_OP_GroupInvite2(const EQApplicationPacket *app); void Handle_OP_GroupMakeLeader(const EQApplicationPacket *app); + void Handle_OP_GroupMentor(const EQApplicationPacket *app); void Handle_OP_GroupRoles(const EQApplicationPacket *app); void Handle_OP_GroupUpdate(const EQApplicationPacket *app); void Handle_OP_GuildBank(const EQApplicationPacket *app); diff --git a/zone/exp.cpp b/zone/exp.cpp index a82aa25d9..c5c5cf69d 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -133,7 +133,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } } - if(IsLeadershipEXPOn() && ((conlevel == CON_BLUE) || (conlevel == CON_WHITE) || (conlevel == CON_YELLOW) || (conlevel == CON_RED))) { + if(IsLeadershipEXPOn() && (conlevel == CON_BLUE || conlevel == CON_WHITE || conlevel == CON_YELLOW || conlevel == CON_RED)) { add_exp = static_cast(static_cast(add_exp) * 0.8f); if(GetGroup()) @@ -141,8 +141,19 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { if((m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())) && (RuleI(Character, KillsPerGroupLeadershipAA) > 0)) { - AddLeadershipEXP(GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA), 0); - Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + uint32 exp = GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA); + Client *mentoree = GetGroup()->GetMentoree(); + if (GetGroup()->GetMentorPercent() && mentoree && + mentoree->GetGroupPoints() < MaxBankedGroupLeadershipPoints(mentoree->GetLevel())) { + uint32 mentor_exp = exp * (GetGroup()->GetMentorPercent() / 100.0f); + exp -= mentor_exp; + mentoree->AddLeadershipEXP(mentor_exp, 0); // ends up rounded down + mentoree->Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } + if (exp > 0) { // possible if you mentor 100% to the other client + AddLeadershipEXP(exp, 0); // ends up rounded up if mentored, no idea how live actually does it + Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } } else Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); diff --git a/zone/groups.cpp b/zone/groups.cpp index f0cdb71de..b9eda9836 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -46,6 +46,7 @@ Group::Group(uint32 gid) : GroupIDConsumer(gid) { leader = nullptr; + mentoree = nullptr; memset(members,0,sizeof(Mob*) * MAX_GROUP_MEMBERS); AssistTargetID = 0; TankTargetID = 0; @@ -81,6 +82,7 @@ Group::Group(Mob* leader) TankTargetID = 0; PullerTargetID = 0; memset(&LeaderAbilities, 0, sizeof(GroupLeadershipAA_Struct)); + mentoree = nullptr; uint32 i; for(i=0;iIsClient() && !mentoree && mentoree_name.length() && !mentoree_name.compare(update->GetName())) + mentoree = update->CastToClient(); + return false; } @@ -500,6 +507,9 @@ void Group::MemberZoned(Mob* removemob) { if(removemob->IsClient() && HasRole(removemob, RolePuller)) SetGroupPullerTarget(0); + + if (removemob->IsClient() && removemob == mentoree) + mentoree = nullptr; } bool Group::DelMemberOOZ(const char *Name) { @@ -528,6 +538,8 @@ bool Group::DelMemberOOZ(const char *Name) { } ClearAllNPCMarks(); } + if (Name == mentoree_name) + ClearGroupMentor(); return true; } } @@ -642,6 +654,9 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) UnDelegatePuller(oldmember->GetName()); } + if (oldmember->GetName() == mentoree_name) + ClearGroupMentor(); + if(oldmember->IsClient()) SendMarkedNPCsToMember(oldmember->CastToClient(), true); @@ -1736,6 +1751,31 @@ void Group::SetGroupPullerTarget(Mob *m) } } +void Group::SetGroupMentor(int percent, char *name) +{ + mentoree_name = name; + mentor_percent = percent; + Client *client = entity_list.GetClientByName(name); + + mentoree = client ? client : nullptr; + std::string query = StringFormat("UPDATE group_leaders SET mentoree = '%s', mentor_percent = %i WHERE gid = %i LIMIT 1", + mentoree_name.c_str(), mentor_percent, GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); +} + +void Group::ClearGroupMentor() +{ + mentoree_name.clear(); + mentor_percent = 0; + mentoree = nullptr; + std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); +} + void Group::NotifyAssistTarget(Client *c) { // Send a packet to the specified client notifying them of the group target selected by the Main Assist. diff --git a/zone/groups.h b/zone/groups.h index fe21ff3a4..250b86946 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -132,6 +132,11 @@ public: const char *GetClientNameByIndex(uint8 index); void UpdateXTargetMarkedNPC(uint32 Number, Mob *m); + void SetGroupMentor(int percent, char *name); + void ClearGroupMentor(); + inline int GetMentorPercent() { return mentor_percent; } + inline Client *GetMentoree() { return mentoree; } + Mob* members[MAX_GROUP_MEMBERS]; char membername[MAX_GROUP_MEMBERS][64]; uint8 MemberRoles[MAX_GROUP_MEMBERS]; @@ -151,6 +156,9 @@ private: uint16 PullerTargetID; uint16 MarkedNPCs[MAX_MARKED_NPCS]; + std::string mentoree_name; + Client *mentoree; + int mentor_percent; }; #endif diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 1ff42cd02..be0a1a193 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1001,9 +1001,11 @@ void WorldServer::Process() { char AssistName[64]; char PullerName[64]; char NPCMarkerName[64]; + char mentoree_name[64]; + int mentor_percent; GroupLeadershipAA_Struct GLAA; memset(ln, 0, 64); - strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, &GLAA)); + strcpy(ln, database.GetGroupLeadershipInfo(group->GetID(), ln, MainTankName, AssistName, PullerName, NPCMarkerName, mentoree_name, &mentor_percent, &GLAA)); Client *lc = entity_list.GetClientByName(ln); if(lc) group->SetLeader(lc); @@ -1013,6 +1015,7 @@ void WorldServer::Process() { group->SetPuller(PullerName); group->SetNPCMarker(NPCMarkerName); group->SetGroupAAs(&GLAA); + group->SetGroupMentor(mentor_percent, mentoree_name); } } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 1ba36c5fd..e83edf2b9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2534,7 +2534,7 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){ gu->action = groupActUpdate; strcpy(gu->yourname, client->GetName()); - GetGroupLeadershipInfo(group->GetID(), gu->leadersname, nullptr, nullptr, nullptr, nullptr, &gu->leader_aas); + GetGroupLeadershipInfo(group->GetID(), gu->leadersname, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &gu->leader_aas); gu->NPCMarkerID = group->GetNPCMarkerID(); int index = 0; From 3f056462d6562bb3b76b0ea6618c1e3dfa60ee11 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 18 Oct 2014 13:27:33 -0400 Subject: [PATCH 0161/1883] Enable gaining of group leadership while in raids Note: raid leaders can only gain raid leadership, so they won't ever gain group leadership while leading a raid, even if they don't end up gaining group due to the restrictions. From what I can tell, this should be in line with live --- changelog.txt | 1 + zone/client.cpp | 20 ++++++++++++++++++-- zone/exp.cpp | 44 ++++++++++++++++++++++++++------------------ 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/changelog.txt b/changelog.txt index df7f664f4..1b3a75404 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/18/2014== demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) +demonstar55: Add gaining of group leadership while in raids == 10/16/2014 == Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted. diff --git a/zone/client.cpp b/zone/client.cpp index 3b95c8d77..b8527204f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4256,12 +4256,28 @@ bool Client::IsLeadershipEXPOn() { Group *g = GetGroup(); - if(g && g->IsLeader(this) && (g->GroupCount() > 2)) + if (g && g->IsLeader(this) && g->GroupCount() > 2) return true; Raid *r = GetRaid(); - if(r && r->IsLeader(this) && (r->RaidCount() > 17)) + if (!r) + return false; + + // raid leaders can only gain raid AA XP + if (r->IsLeader(this)) { + if (r->RaidCount() > 17) + return true; + else + return false; + } + + uint32 gid = r->GetGroup(this); + + if (gid > 11) // not in a group + return false; + + if (r->IsGroupLeader(GetName()) && r->GroupCount(gid) > 2) return true; return false; diff --git a/zone/exp.cpp b/zone/exp.cpp index c5c5cf69d..a06fdc017 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -133,14 +133,12 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } } - if(IsLeadershipEXPOn() && (conlevel == CON_BLUE || conlevel == CON_WHITE || conlevel == CON_YELLOW || conlevel == CON_RED)) { + if (IsLeadershipEXPOn() && (conlevel == CON_BLUE || conlevel == CON_WHITE || conlevel == CON_YELLOW || conlevel == CON_RED)) { add_exp = static_cast(static_cast(add_exp) * 0.8f); - if(GetGroup()) - { - if((m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerGroupLeadershipAA) > 0)) - { + if (GetGroup()) { + if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerGroupLeadershipAA) > 0) { uint32 exp = GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA); Client *mentoree = GetGroup()->GetMentoree(); if (GetGroup()->GetMentorPercent() && mentoree && @@ -154,20 +152,30 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { AddLeadershipEXP(exp, 0); // ends up rounded up if mentored, no idea how live actually does it Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); } - } - else + } else { Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); - } - else - { - if((m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerRaidLeadershipAA) > 0)) - { - AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA)); - Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP); } - else - Message_StringID(MT_Leadership, MAX_RAID_LEADERSHIP_POINTS); + } else { + Raid *raid = GetRaid(); + // Raid leaders CAN NOT gain group AA XP, other group leaders can though! + if (raid->IsLeader(this)) { + if (m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerRaidLeadershipAA) > 0) { + AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA)); + Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP); + } else { + Message_StringID(MT_Leadership, MAX_RAID_LEADERSHIP_POINTS); + } + } else { + if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerGroupLeadershipAA) > 0) { + // mentoring stuff needs to be added here when raids are have support for it + AddLeadershipEXP(0, GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA)); + Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } else { + Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); + } + } } } From 69a124e11f56460a06e633d16c1a83eb0ab64ae4 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 19 Oct 2014 11:39:35 -0400 Subject: [PATCH 0162/1883] Updated #peekinv to display item links properly in RoF clients --- changelog.txt | 3 + zone/command.cpp | 266 +++++++++++++---------------------------------- 2 files changed, 75 insertions(+), 194 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1b3a75404..1a1c7397a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/19/2014 == +Uleat: Updated command #peekinv to display item links properly in RoF clients + == 10/18/2014== demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) demonstar55: Add gaining of group leadership while in raids diff --git a/zone/command.cpp b/zone/command.cpp index 7a1c7fafa..93c718bce 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2780,6 +2780,21 @@ void command_peekinv(Client *c, const Seperator *sep) return; } + // linkcore_# indicates the number of consecutive 0's..not the actual length + const std::string linkcore_49 = "%c%06X0000000000000000000000000000000000000000000000000%s%c"; // RoF+ + const std::string linkcore_44 = "%c%06X00000000000000000000000000000000000000000000%s%c"; // SoF->UF + const std::string linkcore_39 = "%c%06X000000000000000000000000000000000000000%s%c"; // 6.2->Ti + const char* linkcore = nullptr; + std::string linkbase = ""; + + // consider pushing 'linkcores' to EQLimits + if (c->GetClientVersion() >= EQClientRoF) + linkcore = linkcore_49.c_str(); + else if (c->GetClientVersion() >= EQClientSoF) + linkcore = linkcore_44.c_str(); + else + linkcore = linkcore_39.c_str(); + bool bAll = (strcasecmp(sep->arg[1], "all") == 0); bool bFound = false; Client* client = c->GetTarget()->CastToClient(); @@ -2792,64 +2807,32 @@ void command_peekinv(Client *c, const Seperator *sep) for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - // this kind of stuff needs to be pushed to the client translators - c->Message((item==0), "WornSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "WornSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } + if (bAll || (strcasecmp(sep->arg[1], "inv")==0)) { // Personal inventory items bFound = true; for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer)) { for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { const ItemInst* instbag = client->GetInv().GetItem(i, j); item = (instbag) ? instbag->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:instbag->GetCharges())); - } - else - { - c->Message((item==0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:instbag->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } @@ -2857,10 +2840,10 @@ void command_peekinv(Client *c, const Seperator *sep) { const ItemInst* inst = client->GetInv().GetItem(MainPowerSource); item = (inst) ? inst->GetItem() : nullptr; - c->Message((item==0), "InvSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", MainPowerSource, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", + MainPowerSource, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } @@ -2870,59 +2853,30 @@ void command_peekinv(Client *c, const Seperator *sep) // Personal inventory items bFound = true; iter_queue it; - int i=0; + int i = 0; if(client->GetInv().CursorEmpty()) { // Display 'front' cursor slot even if 'empty' (item(30[0]) == null) - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", MainCursor, i, - 0, 0x12, 0, "null", 0x12, 0); - } - else - { - c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", MainCursor, i, - 0, 0x12, 0, "null", 0x12, 0); - } + linkbase = StringFormat(linkcore, 0x12, 0, "null", 0x12); + c->Message((item == 0), "CursorSlot: %i, Item: %i (%s), Charges: %i", + MainCursor, 0, linkbase.c_str(), 0); } else { for(it=client->GetInv().cursor_begin();it!=client->GetInv().cursor_end();++it,i++) { const ItemInst* inst = *it; item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", MainCursor, i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", MainCursor, i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", + MainPowerSource, i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer) && i==0) { // 'CSD 1' - only display contents of slot 30[0] container..higher ones don't exist for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { const ItemInst* instbag = client->GetInv().GetItem(MainCursor, j); item = (instbag) ? instbag->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(MainCursor, j), - MainCursor, j, ((item == 0) ? 0 : item->ID), 0x12, ((item == 0) ? 0 : item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:instbag->GetCharges())); - } - else - { - c->Message((item==0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(MainCursor, j), - MainCursor, j, ((item == 0) ? 0 : item->ID), 0x12, ((item == 0) ? 0 : item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:instbag->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } @@ -2935,20 +2889,10 @@ void command_peekinv(Client *c, const Seperator *sep) for (int16 i = EmuConstants::TRIBUTE_BEGIN; i <= EmuConstants::TRIBUTE_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), "TributeSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "TributeSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } @@ -2959,128 +2903,62 @@ void command_peekinv(Client *c, const Seperator *sep) for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), "BankSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "BankSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer)) { for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { const ItemInst* instbag = client->GetInv().GetItem(i, j); item = (instbag) ? instbag->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), "ShBankSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "ShBankSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer)) { for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { const ItemInst* instbag = client->GetInv().GetItem(i, j); item = (instbag) ? instbag->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), " ShBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), " ShBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } } + if (bAll || (strcasecmp(sep->arg[1], "trade")==0)) { // Items in trade window (current trader only, not the other trader) bFound = true; for (int16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) { const ItemInst* inst = client->GetInv().GetItem(i); item = (inst) ? inst->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), "TradeSlot: %i, Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), "TradeSlot: %i, Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", i, - ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", + i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer)) { for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { const ItemInst* instbag = client->GetInv().GetItem(i, j); item = (instbag) ? instbag->GetItem() : nullptr; - if (c->GetClientVersion() >= EQClientSoF) - { - c->Message((item==0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X00000000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } - else - { - c->Message((item==0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%c%06X000000000000000000000000000000000000000%s%c), Charges: %i", - Inventory::CalcSlotId(i, j), - i, j, ((item==0)?0:item->ID),0x12, ((item==0)?0:item->ID), - ((item==0)?"null":item->Name), 0x12, - ((item==0)?0:inst->GetCharges())); - } + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } From cef2aa64d923b7b25d48cf28a10b9ac8375cf9ed Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 19 Oct 2014 15:03:11 -0400 Subject: [PATCH 0163/1883] Fixed server<->corpse translators to reflect what actually needs to be translated (should not have affected anything in the old configuration) --- zone/corpse.cpp | 10 +++++----- zone/corpse.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 5f1345541..c72f96372 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -97,7 +97,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna for (unsigned int i=0; i < dbpcs->itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &dbpcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->lootslot = CorpseToServerSlot(tmp->lootslot); // temp hack until corpse blobs are removed + tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); // temp hack until corpse blobs are removed itemlist.push_back(tmp); } @@ -148,7 +148,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna for (unsigned int i=0; i < dbpc->itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &dbpc->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->lootslot = CorpseToServerSlot(tmp->lootslot); // temp hack until corpse blobs are removed + tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); // temp hack until corpse blobs are removed itemlist.push_back(tmp); } @@ -602,7 +602,7 @@ bool Corpse::Save() { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - item->lootslot = ServerToCorpseSlot(item->lootslot); // temp hack until corpse blobs are removed + item->equipSlot = ServerToCorpseSlot(item->equipSlot); // temp hack until corpse blobs are removed memcpy((char*) &dbpc->items[x++], (char*) item, sizeof(player_lootitem::ServerLootItem_Struct)); } @@ -2092,7 +2092,7 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){ ** ** (Not all slot designations are valid to all clients..see ##_constants.h files for valid slot enumerations) */ -uint16 Corpse::ServerToCorpseSlot(uint16 server_slot) +int16 Corpse::ServerToCorpseSlot(int16 server_slot) { return server_slot; // temporary return @@ -2128,7 +2128,7 @@ uint16 Corpse::ServerToCorpseSlot(uint16 server_slot) */ } -uint16 Corpse::CorpseToServerSlot(uint16 corpse_slot) +int16 Corpse::CorpseToServerSlot(int16 corpse_slot) { return corpse_slot; // temporary return diff --git a/zone/corpse.h b/zone/corpse.h index 773ca3782..2d1eecc98 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -112,8 +112,8 @@ public: inline int GetRezzExp() { return rezzexp; } // these are a temporary work-around until corpse inventory is removed from the database blob - static uint16 ServerToCorpseSlot(uint16 server_slot); // encode - static uint16 CorpseToServerSlot(uint16 corpse_slot); // decode + static int16 ServerToCorpseSlot(int16 server_slot); // encode + static int16 CorpseToServerSlot(int16 corpse_slot); // decode protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); From a327c91bacd2add6a5c2e3dda71d62733692366a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 19 Oct 2014 17:20:07 -0400 Subject: [PATCH 0164/1883] Implement group mentoring while in raids (SoF+ only) Note: This does not allow the raid leader to share raid leader XP and since the raid leader doesn't gain group leadership, they can't share that either. --- common/database.cpp | 22 ++++-- common/database.h | 2 +- .../required/2014_10_19_raid_group_mentor.sql | 2 + zone/client_packet.cpp | 18 ++++- zone/exp.cpp | 17 ++++- zone/raids.cpp | 67 ++++++++++++++++++- zone/raids.h | 14 ++++ 7 files changed, 130 insertions(+), 12 deletions(-) create mode 100644 utils/sql/git/required/2014_10_19_raid_group_mentor.sql diff --git a/common/database.cpp b/common/database.cpp index f36ab1713..599d615a7 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3191,10 +3191,10 @@ const char* Database::GetRaidLeaderName(uint32 rid) // maintank, assist, puller, marknpc currently unused void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank, - char *assist, char *puller, char *marknpc, GroupLeadershipAA_Struct *GLAA) + char *assist, char *puller, char *marknpc, char *mentoree, int *mentor_percent, GroupLeadershipAA_Struct *GLAA) { std::string query = StringFormat( - "SELECT maintank, assist, puller, marknpc, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu", + "SELECT maintank, assist, puller, marknpc, mentoree, mentor_percent, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu", (unsigned long)gid, (unsigned long)rid); auto results = QueryDatabase(query); @@ -3211,6 +3211,12 @@ void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank, if (marknpc) marknpc[0] = '\0'; + if (mentoree) + mentoree[0] = '\0'; + + if (mentor_percent) + *mentor_percent = 0; + return; } @@ -3228,8 +3234,14 @@ void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank, if (marknpc) strcpy(marknpc, row[3]); - if (GLAA && results.LengthOfColumn(4) == sizeof(GroupLeadershipAA_Struct)) - memcpy(GLAA, row[4], sizeof(GroupLeadershipAA_Struct)); + if (mentoree) + strcpy(mentoree, row[4]); + + if (mentor_percent) + *mentor_percent = atoi(row[5]); + + if (GLAA && results.LengthOfColumn(6) == sizeof(GroupLeadershipAA_Struct)) + memcpy(GLAA, row[6], sizeof(GroupLeadershipAA_Struct)); return; } @@ -3288,7 +3300,7 @@ void Database::SetRaidGroupLeaderInfo(uint32 gid, uint32 rid) if (results.RowsAffected() != 0) return; - query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller) VALUES(%lu, %lu, '', '', '', '', '')", + query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%lu, %lu, '', '', '', '', '', '', 0)", (unsigned long)gid, (unsigned long)rid); results = QueryDatabase(query); diff --git a/common/database.h b/common/database.h index 71a6de9fb..9b388c84a 100644 --- a/common/database.h +++ b/common/database.h @@ -215,7 +215,7 @@ public: uint32 GetRaidID(const char* name); const char *GetRaidLeaderName(uint32 rid); void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, - GroupLeadershipAA_Struct* GLAA = nullptr); + char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr); void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, RaidLeadershipAA_Struct* RLAA = nullptr); void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid); diff --git a/utils/sql/git/required/2014_10_19_raid_group_mentor.sql b/utils/sql/git/required/2014_10_19_raid_group_mentor.sql new file mode 100644 index 000000000..4cb8d5613 --- /dev/null +++ b/utils/sql/git/required/2014_10_19_raid_group_mentor.sql @@ -0,0 +1,2 @@ +ALTER TABLE `raid_leaders` ADD `mentoree` VARCHAR(64) NOT NULL; +ALTER TABLE `raid_leaders` ADD `mentor_percent` INT(4) DEFAULT 0 NOT NULL; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f759c9321..0ec740507 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -576,6 +576,7 @@ void Client::CompleteConnect() if (grpID < 12){ raid->SendRaidGroupRemove(GetName(), grpID); raid->SendRaidGroupAdd(GetName(), grpID); + raid->CheckGroupMentor(grpID, this); if (raid->IsGroupLeader(GetName())) { // group leader same thing! raid->UpdateGroupAAs(raid->GetGroup(this)); raid->GroupUpdate(grpID, false); @@ -6869,10 +6870,25 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) return; } GroupMentor_Struct *gms = (GroupMentor_Struct *)app->pBuffer; + gms->name[63] = '\0'; + + if (IsRaidGrouped()) { + Raid *raid = GetRaid(); + if (!raid) + return; + uint32 group_id = raid->GetGroup(this); + if (group_id > 11) + return; + if (strlen(gms->name)) + raid->SetGroupMentor(group_id, gms->percent, gms->name); + else + raid->ClearGroupMentor(group_id); + return; + } + Group *group = GetGroup(); if (!group) return; - gms->name[63] = '\0'; if (strlen(gms->name)) group->SetGroupMentor(gms->percent, gms->name); diff --git a/zone/exp.cpp b/zone/exp.cpp index a06fdc017..0e01a4c0e 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -169,9 +169,20 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } else { if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()) && RuleI(Character, KillsPerGroupLeadershipAA) > 0) { - // mentoring stuff needs to be added here when raids are have support for it - AddLeadershipEXP(0, GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA)); - Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + uint32 group_id = raid->GetGroup(this); + uint32 exp = GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA); + Client *mentoree = raid->GetMentoree(group_id); + if (raid->GetMentorPercent(group_id) && mentoree && + mentoree->GetGroupPoints() < MaxBankedGroupLeadershipPoints(mentoree->GetLevel())) { + uint32 mentor_exp = exp * (raid->GetMentorPercent(group_id) / 100.0f); + exp -= mentor_exp; + mentoree->AddLeadershipEXP(mentor_exp, 0); + mentoree->Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } + if (exp > 0) { + AddLeadershipEXP(exp, 0); + Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } } else { Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); } diff --git a/zone/raids.cpp b/zone/raids.cpp index e456d0beb..699bc6b1d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -31,6 +31,10 @@ Raid::Raid(uint32 raidID) memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct)); memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS); + for (int i = 0; i < MAX_RAID_GROUPS; i++) { + group_mentor[i].mentor_percent = 0; + group_mentor[i].mentoree = nullptr; + } leader = nullptr; memset(leadername, 0, 64); locked = false; @@ -43,6 +47,10 @@ Raid::Raid(Client* nLeader) memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct)); memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS); + for (int i = 0; i < MAX_RAID_GROUPS; i++) { + group_mentor[i].mentor_percent = 0; + group_mentor[i].mentoree = nullptr; + } leader = nLeader; memset(leadername, 0, 64); strn0cpy(leadername, nLeader->GetName(), 64); @@ -1482,13 +1490,19 @@ void Raid::MemberZoned(Client *c) if(!c) return; + // Raid::GetGroup() goes over the members as well, this way we go over once + uint32 gid = RAID_GROUPLESS; for(int x = 0; x < MAX_RAID_MEMBERS; x++) { if(members[x].member == c) { members[x].member = nullptr; + gid = members[x].GroupNumber; } } + + if (gid < 12 && group_mentor[gid].mentoree == c) + group_mentor[gid].mentoree = nullptr; } void Raid::SendHPPacketsTo(Client *c) @@ -1597,7 +1611,56 @@ void Raid::LoadLeadership() { database.GetRaidLeadershipInfo(GetID(), nullptr, nullptr, nullptr, nullptr, &raid_aa); - for (uint32 group_id = 0; group_id < MAX_RAID_GROUPS; group_id++) - database.GetGroupLeadershipInfo(group_id, GetID(), nullptr, nullptr, nullptr, nullptr, &group_aa[group_id]); + char mentor_name[64]; + for (uint32 group_id = 0; group_id < MAX_RAID_GROUPS; group_id++) { + database.GetGroupLeadershipInfo(group_id, GetID(), nullptr, nullptr, nullptr, nullptr, + mentor_name, &group_mentor[group_id].mentor_percent, &group_aa[group_id]); + if (strlen(mentor_name)) { + group_mentor[group_id].name = mentor_name; + mentor_name[0] = '\0'; + } + } +} + +void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) +{ + if (group_id > 11) + return; + group_mentor[group_id].name = name; + group_mentor[group_id].mentor_percent = percent; + Client *client = entity_list.GetClientByName(name); + group_mentor[group_id].mentoree = client ? client : nullptr; + + std::string query = StringFormat("UPDATE raid_leaders SET mentoree = '%s', mentor_percent = %i WHERE gid = %i AND rid = %i LIMIT 1", + name, percent, group_id, GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); +} + +void Raid::ClearGroupMentor(uint32 group_id) +{ + if (group_id > 11) + return; + group_mentor[group_id].name.clear(); + group_mentor[group_id].mentor_percent = 0; + group_mentor[group_id].mentoree = nullptr; + + std::string query = StringFormat("UPDATE raid_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i AND rid = %i LIMIT 1", + group_id, GetID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + LogFile->write(EQEMuLog::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); +} + +// there isn't a nice place to add this in another function, unlike groups +// so we do it here instead +void Raid::CheckGroupMentor(uint32 group_id, Client *c) +{ + if (!c || group_id > 11) + return; + + if (group_mentor[group_id].name == c->GetName()) + group_mentor[group_id].mentoree = c; } diff --git a/zone/raids.h b/zone/raids.h index 6e2579367..eb963ad32 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -92,6 +92,12 @@ struct RaidMember{ bool IsLooter; }; +struct GroupMentor { + std::string name; + Client *mentoree; + int mentor_percent; +}; + class Raid : public GroupIDConsumer { public: Raid(Client *nLeader); @@ -221,6 +227,12 @@ public: inline void SetRaidAAs(RaidLeadershipAA_Struct *rlaa) { memcpy(&raid_aa, rlaa, sizeof(RaidLeadershipAA_Struct)); } + void SetGroupMentor(uint32 group_id, int percent, char *name); + void ClearGroupMentor(uint32 group_id); + void CheckGroupMentor(uint32 group_id, Client *c); // this just checks if we should be fixing the pointer in group mentor struct on zone + inline int GetMentorPercent(uint32 group_id) { return group_mentor[group_id].mentor_percent; } + inline Client *GetMentoree(uint32 group_id) { return group_mentor[group_id].mentoree; } + RaidMember members[MAX_RAID_MEMBERS]; char leadername[64]; protected: @@ -233,6 +245,8 @@ protected: std::string motd; RaidLeadershipAA_Struct raid_aa; GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS]; + + GroupMentor group_mentor[MAX_RAID_GROUPS]; }; From 466eecacc4b97474a21197927ca96715d986bea7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 19 Oct 2014 18:34:43 -0400 Subject: [PATCH 0165/1883] Implement Group Inspect Buffs for raids --- changelog.txt | 2 ++ zone/client_packet.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/changelog.txt b/changelog.txt index 1a1c7397a..b6f5f2ad6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/19/2014 == Uleat: Updated command #peekinv to display item links properly in RoF clients +demonstar55: Group Mentoring in raids +demonstar55: Inspect Buffs (text only version) works in raid groups == 10/18/2014== demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0ec740507..6d9291685 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5338,6 +5338,17 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (!Target || !Target->IsClient()) return; + if (IsRaidGrouped()) { + Raid *raid = GetRaid(); + if (!raid) + return; + uint32 group_id = raid->GetGroup(this); + if (group_id > 11 || raid->GroupCount(group_id) < 3) + return; + Target->CastToClient()->InspectBuffs(this, raid->GetLeadershipAA(groupAAInspectBuffs, group_id)); + return; + } + Group *g = GetGroup(); if (!g || (g->GroupCount() < 3)) From a6ae2ca635508fd40af053d9f957a89fcbec3ec0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 19 Oct 2014 22:30:11 -0400 Subject: [PATCH 0166/1883] Switch Inspect Buffs to use the OP code Client 6.2 is SOL until someone find the op for that client --- changelog.txt | 1 + common/emu_oplist.h | 1 + common/eq_packet_structs.h | 5 ++++ common/patches/rof.cpp | 14 +++++++++++ common/patches/rof_ops.h | 1 + common/patches/rof_structs.h | 5 ++++ common/patches/underfoot.cpp | 14 +++++++++++ common/patches/underfoot_ops.h | 1 + common/patches/underfoot_structs.h | 8 +++++++ utils/patches/patch_RoF.conf | 1 + utils/patches/patch_SoD.conf | 1 + utils/patches/patch_SoF.conf | 1 + utils/patches/patch_Titanium.conf | 2 ++ utils/patches/patch_Underfoot.conf | 1 + zone/aa.cpp | 37 ++++++++++++++---------------- 15 files changed, 73 insertions(+), 20 deletions(-) diff --git a/changelog.txt b/changelog.txt index b6f5f2ad6..ed10c7173 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Uleat: Updated command #peekinv to display item links properly in RoF clients demonstar55: Group Mentoring in raids demonstar55: Inspect Buffs (text only version) works in raid groups +demonstar55: Make use of the Inspect Buffs op/packet. 62 SOL until someone finds its op == 10/18/2014== demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) diff --git a/common/emu_oplist.h b/common/emu_oplist.h index c0ca0ca4e..e8ce3b986 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -245,6 +245,7 @@ N(OP_IncreaseStats), N(OP_InitialHPUpdate), N(OP_InitialMobHealth), N(OP_InspectAnswer), +N(OP_InspectBuffs), N(OP_InspectMessageUpdate), N(OP_InspectRequest), N(OP_InstillDoubt), diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index d0792fd37..a5e22e44e 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -3968,6 +3968,11 @@ struct MarkNPC_Struct /*08**/ char Name[64]; }; +struct InspectBuffs_Struct { +/*000*/ uint32 spell_id[BUFF_COUNT]; +/*100*/ uint32 tics_remaining[BUFF_COUNT]; +}; + struct RaidGeneral_Struct { /*00*/ uint32 action; //=10 /*04*/ char player_name[64]; //should both be the player's name diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 1fcb74078..3a03b3a62 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -1309,6 +1309,20 @@ namespace RoF FINISH_ENCODE(); }*/ + ENCODE(OP_InspectBuffs) + { + ENCODE_LENGTH_EXACT(InspectBuffs_Struct); + SETUP_DIRECT_ENCODE(InspectBuffs_Struct, structs::InspectBuffs_Struct); + + // we go over the internal 25 instead of the packet's since no entry is 0, which it will be already + for (int i = 0; i < BUFF_COUNT; i++) { + OUT(spell_id[i]); + OUT(tics_remaining[i]); + } + + FINISH_ENCODE(); + } + ENCODE(OP_InspectRequest) { ENCODE_LENGTH_EXACT(Inspect_Struct); diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index 030c331d6..57ff1f91d 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -44,6 +44,7 @@ E(OP_GuildMemberUpdate) E(OP_GuildsList) E(OP_HPUpdate) E(OP_Illusion) +E(OP_InspectBuffs) E(OP_InspectRequest) E(OP_InterruptCast) E(OP_ItemLinkResponse) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index e65f2b74d..1393b026e 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -2473,6 +2473,11 @@ struct GroupFollow_Struct { // Live Follow Struct /*0152*/ }; +struct InspectBuffs_Struct { +/*000*/ uint32 spell_id[BUFF_COUNT]; +/*168*/ uint32 tics_remaining[BUFF_COUNT]; +}; + struct LFG_Struct { /*000*/ uint32 unknown000; /*004*/ uint32 value; // 0x00 = off 0x01 = on diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index aa342a412..ad850be36 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1125,6 +1125,20 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_InspectBuffs) + { + ENCODE_LENGTH_EXACT(InspectBuffs_Struct); + SETUP_DIRECT_ENCODE(InspectBuffs_Struct, structs::InspectBuffs_Struct); + + // we go over the internal 25 instead of the packet's since no entry is 0, which it will be already + for (int i = 0; i < BUFF_COUNT; i++) { + OUT(spell_id[i]); + OUT(tics_remaining[i]); + } + + FINISH_ENCODE(); + } + ENCODE(OP_InspectRequest) { ENCODE_LENGTH_EXACT(Inspect_Struct); diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 28864301d..38cfb79e3 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -34,6 +34,7 @@ E(OP_GroupUpdate) E(OP_GuildMemberList) E(OP_GuildsList) E(OP_Illusion) +E(OP_InspectBuffs) E(OP_InspectRequest) E(OP_ItemLinkResponse) E(OP_ItemPacket) diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 2b7163bcf..eec3270f5 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -2166,6 +2166,14 @@ struct GroupFollow_Struct { // Underfoot Follow Struct /*0152*/ }; +struct InspectBuffs_Struct { +/*000*/ uint32 spell_id[BUFF_COUNT]; +/*100*/ uint32 filler100[5]; // BUFF_COUNT is really 30... +/*120*/ uint32 tics_remaining[BUFF_COUNT]; +/*220*/ uint32 filler220[5]; // BUFF_COUNT is really 30... +}; + + struct LFG_Struct { /*000*/ uint32 unknown000; /*004*/ uint32 value; // 0x00 = off 0x01 = on diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 6bd486bfa..97098946d 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -501,6 +501,7 @@ OP_GroupMakeLeader=0x4129 OP_DoGroupLeadershipAbility=0x17d7 OP_GroupLeadershipAAUpdate=0x6567 OP_GroupMentor=0x56DB +OP_InspectBuffs=0x01f3 # LFG/LFP Opcodes OP_LFGCommand=0x4463 diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index 0effd1b3c..338ee82e7 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -487,6 +487,7 @@ OP_GroupLeaderChange=0x7545 OP_GroupRoles=0x6b67 OP_GroupMakeLeader=0x6087 OP_GroupMentor=0x1224 +OP_InspectBuffs=0x66bf # LFG/LFP Opcodes OP_LFGCommand=0x3288 # C OP_LFGGetMatchesRequest=0x5613 # C diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 0b53daefd..fc0c716e1 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -453,6 +453,7 @@ OP_CancelInvite=0x596C #Trevius 03/02/09 OP_GroupFollow2=0x59D4 #Xinu 02/20/09 OP_GroupInvite2=0x07F6 #Xinu 02/20/09 OP_GroupMentor=0x9EF3 +OP_InspectBuffs=0x3547 #LFG/LFP Opcodes OP_LFGCommand=0x5D81 #Trevius 01/16/09 diff --git a/utils/patches/patch_Titanium.conf b/utils/patches/patch_Titanium.conf index 50e426874..841f77bf5 100644 --- a/utils/patches/patch_Titanium.conf +++ b/utils/patches/patch_Titanium.conf @@ -420,6 +420,8 @@ OP_RaidJoin=0x1f21 # ShowEQ 10/27/05 OP_RaidInvite=0x5891 # ShowEQ 10/27/05 OP_RaidUpdate=0x1f21 # EQEmu 06/29/05 +OP_InspectBuffs=0x4FB6 + OP_ZoneComplete=0x0000 OP_ItemLinkText=0x0000 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 01cc1ad47..56838da65 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -490,6 +490,7 @@ OP_GroupLeaderChange=0x0c33 # C OP_GroupRoles=0x116d # C OP_GroupMakeLeader=0x5851 OP_GroupMentor=0x292f +OP_InspectBuffs=0x105b # LFG/LFP Opcodes OP_LFGCommand=0x2c38 # C diff --git a/zone/aa.cpp b/zone/aa.cpp index d07ed72cf..83a6b7967 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1793,29 +1793,26 @@ int Client::GroupLeadershipAAOffenseEnhancement() void Client::InspectBuffs(Client* Inspector, int Rank) { - if(!Inspector || (Rank == 0)) return; + // At some point the removed the restriction of being a group member for this to work + // not sure when, but the way it's coded now, it wouldn't work with mobs. + if (!Inspector || Rank == 0) + return; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_InspectBuffs, sizeof(InspectBuffs_Struct)); + InspectBuffs_Struct *ib = (InspectBuffs_Struct *)outapp->pBuffer; - Inspector->Message_StringID(0, CURRENT_SPELL_EFFECTS, GetName()); uint32 buff_count = GetMaxTotalSlots(); - for (uint32 i = 0; i < buff_count; ++i) - { - if (buffs[i].spellid != SPELL_UNKNOWN) - { - if(Rank == 1) - Inspector->Message(0, "%s", spells[buffs[i].spellid].name); - else - { - if (spells[buffs[i].spellid].buffdurationformula == DF_Permanent) - Inspector->Message(0, "%s (Permanent)", spells[buffs[i].spellid].name); - else { - char *TempString = nullptr; - MakeAnyLenString(&TempString, "%.1f", static_cast(buffs[i].ticsremaining) / 10.0f); - Inspector->Message_StringID(0, BUFF_MINUTES_REMAINING, spells[buffs[i].spellid].name, TempString); - safe_delete_array(TempString); - } - } - } + uint32 packet_index = 0; + for (uint32 i = 0; i < buff_count; i++) { + if (buffs[i].spellid == SPELL_UNKNOWN) + continue; + ib->spell_id[packet_index] = buffs[i].spellid; + if (Rank > 1) + ib->tics_remaining[packet_index] = spells[buffs[i].spellid].buffdurationformula == DF_Permanent ? 0xFFFFFFFF : buffs[i].ticsremaining; + packet_index++; } + + Inspector->FastQueuePacket(&outapp); } //this really need to be renamed to LoadAAActions() From 3db23328218969fdb10fae5eaf2ed3166aae6fa4 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 19 Oct 2014 22:30:45 -0400 Subject: [PATCH 0167/1883] Missed one! --- zone/command.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 93c718bce..33f7c2068 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2812,6 +2812,16 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } + if (c->GetClientVersion() >= EQClientSoF) + { + const ItemInst* inst = client->GetInv().GetItem(MainPowerSource); + item = (inst) ? inst->GetItem() : nullptr; + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", + MainPowerSource, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); + } + } if (bAll || (strcasecmp(sep->arg[1], "inv")==0)) { @@ -2836,15 +2846,6 @@ void command_peekinv(Client *c, const Seperator *sep) } } } - if(c->GetClientVersion() >= EQClientSoF) - { - const ItemInst* inst = client->GetInv().GetItem(MainPowerSource); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", - MainPowerSource, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } } // Changed to show 'empty' cursors and not to show bag slots on 'queued' cursor slots (cursor bag slots 331 to 340 are not arrayed...) @@ -2867,7 +2868,7 @@ void command_peekinv(Client *c, const Seperator *sep) linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", - MainPowerSource, i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); + MainCursor, i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); if (inst && inst->IsType(ItemClassContainer) && i==0) { // 'CSD 1' - only display contents of slot 30[0] container..higher ones don't exist for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { @@ -2876,7 +2877,7 @@ void command_peekinv(Client *c, const Seperator *sep) linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); c->Message((item == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); + Inventory::CalcSlotId(MainCursor, j), MainCursor, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); } } } From bb91265b2be1d8fff20ccd562343586456b4bf18 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 20 Oct 2014 00:36:13 -0400 Subject: [PATCH 0168/1883] Allow npc_types field 'special_abilities' to be set as null in database. Changed due to issues when trying to copy npcs or remove abilities from the field directly in the dataabase. --- .../required/2014_10_16_special_abilities_null.sql | 6 ++++++ zone/zonedb.cpp | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 utils/sql/git/required/2014_10_16_special_abilities_null.sql diff --git a/utils/sql/git/required/2014_10_16_special_abilities_null.sql b/utils/sql/git/required/2014_10_16_special_abilities_null.sql new file mode 100644 index 000000000..c01bd725b --- /dev/null +++ b/utils/sql/git/required/2014_10_16_special_abilities_null.sql @@ -0,0 +1,6 @@ +ALTER TABLE `merc_stats` +MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `attack_speed`; + +ALTER TABLE `npc_types` +MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `npcspecialattks`; + diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index e83edf2b9..77b179a68 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1816,7 +1816,12 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->min_dmg = atoi(row[31]); tmpNPCType->max_dmg = atoi(row[32]); tmpNPCType->attack_count = atoi(row[33]); - strn0cpy(tmpNPCType->special_abilities, row[34], 512); + + if (row[34] != nullptr) + strn0cpy(tmpNPCType->special_abilities, row[34], 512); + else + strn0cpy(tmpNPCType->special_abilities,"\0", 512); + tmpNPCType->npc_spells_id = atoi(row[35]); tmpNPCType->npc_spells_effects_id = atoi(row[36]); tmpNPCType->d_meele_texture1 = atoi(row[37]); @@ -2018,7 +2023,11 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->min_dmg = atoi(row[24]); tmpNPCType->max_dmg = atoi(row[25]); tmpNPCType->attack_count = atoi(row[26]); - strn0cpy(tmpNPCType->special_abilities, row[27], 512); + + if (row[27] != nullptr) + strn0cpy(tmpNPCType->special_abilities, row[27], 512); + else + strn0cpy(tmpNPCType->special_abilities,"\0", 512); tmpNPCType->d_meele_texture1 = atoi(row[28]); tmpNPCType->d_meele_texture2 = atoi(row[29]); From c81491f97ebebf988b5ee96a9c505d690bc59870 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 20 Oct 2014 01:05:08 -0400 Subject: [PATCH 0169/1883] Inspect buffs rank 1 will now show NPC buffs in target window (SoD+) --- changelog.txt | 3 +++ zone/client_packet.cpp | 22 +++++++++++++++++++--- zone/entity.cpp | 32 +++++++++++++++++++++++++------- zone/entity.h | 2 +- zone/spell_effects.cpp | 6 ++++++ zone/spells.cpp | 6 ++++++ 6 files changed, 60 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index ed10c7173..915f7a812 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/20/2014 == +demonstar55: Inspect Buffs rank 1 will now show NPC buffs in target window (SoD+) + == 10/19/2014 == Uleat: Updated command #peekinv to display item links properly in RoF clients demonstar55: Group Mentoring in raids diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6d9291685..efc8a5d8a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12951,9 +12951,25 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) if (nt) { SetTarget(nt); - if ((nt->IsClient() && !nt->CastToClient()->GetPVP()) || - (nt->IsPet() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) || - (nt->IsMerc() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP())) + bool inspect_buffs = false; + // rank 1 gives you ability to see NPC buffs in target window (SoD+) + if (nt->IsNPC()) { + if (IsRaidGrouped()) { + Raid *raid = GetRaid(); + if (raid) { + uint32 gid = raid->GetGroup(this); + if (gid < 12 && raid->GroupCount(gid) > 2) + inspect_buffs = raid->GetLeadershipAA(groupAAInspectBuffs, gid); + } + } else { + Group *group = GetGroup(); + if (group && group->GroupCount() > 2) + inspect_buffs = group->GetLeadershipAA(groupAAInspectBuffs); + } + } + if (nt == this || inspect_buffs || (nt->IsClient() && !nt->CastToClient()->GetPVP()) || + (nt->IsPet() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP()) || + (nt->IsMerc() && nt->GetOwner() && nt->GetOwner()->IsClient() && !nt->GetOwner()->CastToClient()->GetPVP())) nt->SendBuffsToClient(this); } else diff --git a/zone/entity.cpp b/zone/entity.cpp index 4a8329639..0ce530419 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1351,7 +1351,7 @@ void EntityList::RefreshClientXTargets(Client *c) } void EntityList::QueueClientsByTarget(Mob *sender, const EQApplicationPacket *app, - bool iSendToSender, Mob *SkipThisMob, bool ackreq, bool HoTT, uint32 ClientVersionBits) + bool iSendToSender, Mob *SkipThisMob, bool ackreq, bool HoTT, uint32 ClientVersionBits, bool inspect_buffs) { auto it = client_list.begin(); while (it != client_list.end()) { @@ -1365,8 +1365,7 @@ void EntityList::QueueClientsByTarget(Mob *sender, const EQApplicationPacket *ap Mob *TargetsTarget = nullptr; - if (Target) - TargetsTarget = Target->GetTarget(); + TargetsTarget = Target->GetTarget(); bool Send = false; @@ -1378,11 +1377,30 @@ void EntityList::QueueClientsByTarget(Mob *sender, const EQApplicationPacket *ap Send = true; if (c != sender) { - if (Target == sender) - Send = true; - else if (HoTT) - if (TargetsTarget == sender) + if (Target == sender) { + if (inspect_buffs) { // if inspect_buffs is true we're sending a mob's buffs to those with the LAA + if (c->IsRaidGrouped()) { + Raid *raid = c->GetRaid(); + if (!raid) + continue; + uint32 gid = raid->GetGroup(c); + if (gid > 11 || raid->GroupCount(gid) < 3) + continue; + if (raid->GetLeadershipAA(groupAAInspectBuffs, gid)) + Send = true; + } else { + Group *group = c->GetGroup(); + if (!group || group->GroupCount() < 3) + continue; + if (group->GetLeadershipAA(groupAAInspectBuffs)) + Send = true; + } + } else { Send = true; + } + } else if (HoTT && TargetsTarget == sender) { + Send = true; + } } if (Send && (c->GetClientVersionBit() & ClientVersionBits)) diff --git a/zone/entity.h b/zone/entity.h index 9599aa7fc..5776ed936 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -297,7 +297,7 @@ public: void QueueClientsGuild(Mob* sender, const EQApplicationPacket* app, bool ignore_sender = false, uint32 guildeqid = 0); void QueueClientsGuildBankItemUpdate(const GuildBankItemUpdate_Struct *gbius, uint32 GuildID); void QueueClientsByTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true, Mob* SkipThisMob = 0, bool ackreq = true, - bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF); + bool HoTT = true, uint32 ClientVersionBits = 0xFFFFFFFF, bool inspect_buffs = false); void QueueClientsByXTarget(Mob* sender, const EQApplicationPacket* app, bool iSendToSender = true); void QueueToGroupsForNPCHealthAA(Mob* sender, const EQApplicationPacket* app); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 7496a07a5..41e8f1e50 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -4168,6 +4168,12 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) safe_delete(outapp); } + if (IsNPC()) { + EQApplicationPacket *outapp = MakeBuffsPacket(); + entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater, true); + safe_delete(outapp); + } + if(IsClient() && CastToClient()->GetClientVersionBit() & BIT_UnderfootAndLater) { EQApplicationPacket *outapp = MakeBuffsPacket(false); diff --git a/zone/spells.cpp b/zone/spells.cpp index c6fb43b24..50eb9479f 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3128,6 +3128,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid safe_delete(outapp); } + if (IsNPC()) { + EQApplicationPacket *outapp = MakeBuffsPacket(); + entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater, true); + safe_delete(outapp); + } + // recalculate bonuses since we stripped/added buffs CalcBonuses(); From 193f7b0fe3336a44e757c574b2474155de9e68c5 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 20 Oct 2014 01:16:08 -0400 Subject: [PATCH 0170/1883] Fix so NPC don't ghost when casting spells from scripts while moving. --- zone/spells.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index c6fb43b24..8edb7b448 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -307,6 +307,10 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, sprintf(temp, "%d", spell_id); parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, temp, 0); } + + //To prevent NPC ghosting when spells are cast from scripts + if (IsNPC() && IsMoving() && cast_time > 0) + SendPosition(); if(resist_adjust) { From f0f920d0e8426df2470640ba923932d039f36b5e Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 21 Oct 2014 14:14:35 -0400 Subject: [PATCH 0171/1883] Fix for bug with Discipline recast timers preventing them from working properly if you used a focus effect to reduce recast time to zero. (Specifically the recast timer failed to reset in the situation where you had already used the disc WIHTOUT the focus applied, then applied the focus and tried to have it reduced). --- zone/effects.cpp | 11 ++++++++++- zone/spells.cpp | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 7822d2e5e..e74e8399e 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -683,8 +683,17 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { { uint32 reduced_recast = spell.recast_time / 1000; reduced_recast -= CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id); - if(reduced_recast < 0) + if(reduced_recast <= 0){ reduced_recast = 0; + CastToClient()->GetPTimers().Clear(&database, (uint32)DiscTimer); + } + + if (reduced_recast > 0) + CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); + else{ + CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT); + return true; + } CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS) diff --git a/zone/spells.cpp b/zone/spells.cpp index 8edb7b448..c616f794d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2195,7 +2195,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); mlog(SPELLS__CASTING, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } - else if(spells[spell_id].recast_time > 1000) { + else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; if (spell_id == SPELL_LAY_ON_HANDS) //lay on hands { From 22170527c4a61d685bae1dd0dfe9315fcae07a63 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 21 Oct 2014 14:24:25 -0400 Subject: [PATCH 0172/1883] Small update to prior commit. --- zone/effects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index e74e8399e..3d8138100 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -685,7 +685,8 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { reduced_recast -= CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id); if(reduced_recast <= 0){ reduced_recast = 0; - CastToClient()->GetPTimers().Clear(&database, (uint32)DiscTimer); + if (GetPTimers().Enabled((uint32)DiscTimer)) + GetPTimers().Clear(&database, (uint32)DiscTimer); } if (reduced_recast > 0) From 0a27273d6414e6d97b622ff59cc38d27d3db8188 Mon Sep 17 00:00:00 2001 From: RicardoCampos Date: Tue, 21 Oct 2014 22:48:42 +0100 Subject: [PATCH 0173/1883] Bugfix: Corpse stays locked when looting fails If looting fails either because of cooldown or there are items on your cursor, the client is sent an end loot packet- the client releases the corpse but no one else can loot. This simply resets BeingLootedBy in this instance. --- zone/corpse.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index da9ffab17..7300db608 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1069,6 +1069,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) if(!loot_cooldown_timer.Check()) { SendEndLootErrorPacket(client); + //unlock corpse for others + if (this->BeingLootedBy = client->GetID()) { + BeingLootedBy = 0xFFFFFFFF; + } return; } @@ -1077,6 +1081,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { client->Message(13, "You may not loot an item while you have an item on your cursor."); SendEndLootErrorPacket(client); + //unlock corpse for others + if (this->BeingLootedBy = client->GetID()) { + BeingLootedBy = 0xFFFFFFFF; + } return; } From a062c27e1a845fe8276d507096f711b018888e01 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 22 Oct 2014 22:27:51 -0400 Subject: [PATCH 0174/1883] Take into account endurance bonuses from AAs --- zone/client_mods.cpp | 2 +- zone/merc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 2fb7ad9ca..1540b2a5f 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1907,7 +1907,7 @@ uint16 Mob::GetInstrumentMod(uint16 spell_id) const void Client::CalcMaxEndurance() { - max_end = CalcBaseEndurance() + spellbonuses.Endurance + itembonuses.Endurance; + max_end = CalcBaseEndurance() + spellbonuses.Endurance + itembonuses.Endurance + aabonuses.Endurance; if (max_end < 0) { max_end = 0; diff --git a/zone/merc.cpp b/zone/merc.cpp index 6f500b12e..0fac55de2 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1044,7 +1044,7 @@ int32 Merc::CalcManaRegenCap() void Merc::CalcMaxEndurance() { - max_end = CalcBaseEndurance() + spellbonuses.Endurance + itembonuses.Endurance; + max_end = CalcBaseEndurance() + spellbonuses.Endurance + itembonuses.Endurance + aabonuses.Endurance; if (max_end < 0) { max_end = 0; From c95b18da858570fe35f3e7c3964b21e7eeeae262 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 22 Oct 2014 22:57:20 -0400 Subject: [PATCH 0175/1883] Fixed stacking issue in world tradeskill containers. (Added #peekinv world) --- changelog.txt | 3 +++ zone/command.cpp | 37 ++++++++++++++++++++++++++++++++++++- zone/inventory.cpp | 1 + zone/object.cpp | 8 ++++++++ zone/object.h | 1 + 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 915f7a812..c13ee4b05 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/22/2014 == +Uleat: Fix for stacking items in a world object..added a new command option: #peekinv world - will show world container contents, if one is in use by target. + == 10/20/2014 == demonstar55: Inspect Buffs rank 1 will now show NPC buffs in target window (SoD+) diff --git a/zone/command.cpp b/zone/command.cpp index 33f7c2068..c1121932c 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -258,7 +258,7 @@ int command_init(void) { command_add("heal","- Completely heal your target",10,command_heal) || command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) || command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) || - command_add("peekinv","[worn/cursor/inv/bank/trade/trib/all] - Print out contents of your player target's inventory",100,command_peekinv) || + command_add("peekinv","[worn/inv/cursor/trib/bank/trade/world/all] - Print out contents of your player target's inventory",100,command_peekinv) || command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) || command_add("findzone","[search criteria] - Search database zones",100,command_findzone) || command_add("fz",nullptr,100, command_findzone) || @@ -2965,6 +2965,41 @@ void command_peekinv(Client *c, const Seperator *sep) } } + if (bAll || (strcasecmp(sep->arg[1], "world") == 0)) { + // Items in world container (if present) + bFound = true; + + Object* tsobject = c->GetTradeskillObject(); + + if (tsobject == nullptr) { + c->Message(1, "No world tradeskill object selected..."); + } + else { + c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", tsobject->GetDBID(), tsobject->GetID()); + + for (int16 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; ++i) { + const ItemInst* inst = tsobject->GetItem(i); + item = (inst) ? inst->GetItem() : nullptr; + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", + (EmuConstants::WORLD_BEGIN + i), ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); + + // this should never happen ('WorldBagSlot' as -1 indicates an error state in this implementation) + if (inst && inst->IsType(ItemClassContainer)) { + for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; ++j) { + const ItemInst* instbag = inst->GetItem(j); + item = (instbag) ? instbag->GetItem() : nullptr; + + linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); + c->Message((item == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + -1, i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); + } + } + } + } + } + if (!bFound) { c->Message(0, "Usage: #peekinv [worn|cursor|inv|bank|trade|trib|all]"); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 76841c86d..6a80aefe1 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1480,6 +1480,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } world_inst->SetCharges(world_charges); + m_tradeskill_object->PutItem(world_idx, world_inst); m_tradeskill_object->Save(); if (src_charges == 0) { diff --git a/zone/object.cpp b/zone/object.cpp index c560191f1..51d0e924a 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -318,6 +318,14 @@ void Object::Delete(bool reset_state) } } +const ItemInst* Object::GetItem(uint8 index) { + if (index < EmuConstants::MAP_WORLD_SIZE) { + return m_inst->GetItem(index); + } + + return nullptr; +} + // Add item to object (only logical for world tradeskill containers void Object::PutItem(uint8 index, const ItemInst* inst) { diff --git a/zone/object.h b/zone/object.h index 226b02ec5..da41d9815 100644 --- a/zone/object.h +++ b/zone/object.h @@ -121,6 +121,7 @@ public: void StartDecay() {decay_timer.Start();} // Container functions + const ItemInst* GetItem(uint8 index); void PutItem(uint8 index, const ItemInst* inst); void DeleteItem(uint8 index); // Item inside container ItemInst* PopItem(uint8 index); // Pop item out of container From 7f85d8c8a2bbc40b08fec8150b1466d2e72dac89 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 24 Oct 2014 01:05:22 -0400 Subject: [PATCH 0176/1883] Optional SQL to add AA Quick Draw --- utils/sql/git/optional/2014_10_24_Quick_Draw.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 utils/sql/git/optional/2014_10_24_Quick_Draw.sql diff --git a/utils/sql/git/optional/2014_10_24_Quick_Draw.sql b/utils/sql/git/optional/2014_10_24_Quick_Draw.sql new file mode 100644 index 000000000..1dafd19a3 --- /dev/null +++ b/utils/sql/git/optional/2014_10_24_Quick_Draw.sql @@ -0,0 +1,4 @@ +INSERT INTO altadv_vars SET skill_id="4698", name="Quick Draw", cost="5", max_level="1", hotkey_sid="4294967295", hotkey_sid2="4294967295", title_sid="4698", desc_sid="4698", type="1", spellid="4294967295", prereq_skill="0", prereq_minpoints="0", spell_type="0", spell_refresh="0", class_type="51", cost_inc="0", aa_expansion="12", special_category="4294967295", sof_type="1", sof_cost_inc="0", sof_max_level="2", sof_next_skill="4698", clientver="4", account_time_required="0", sof_current_level="0", sof_next_id="6545", level_inc="0", classes="65534", berserker="1"; +INSERT INTO aa_effects SET aaid=4698, slot=1, effectid=362, base1=1, base2=0; +INSERT INTO altadv_vars SET skill_id="6545", name="Quick Draw II", cost="5", max_level="1", hotkey_sid="4294967295", hotkey_sid2="4294967295", title_sid="4698", desc_sid="4698", type="1", spellid="4294967295", prereq_skill="4698", prereq_minpoints="1", spell_type="0", spell_refresh="0", class_type="56", cost_inc="0", aa_expansion="14", special_category="4294967295", sof_type="1", sof_cost_inc="0", sof_max_level="2", sof_next_skill="4698", clientver="5", account_time_required="0", sof_current_level="1", sof_next_id="0", level_inc="0", classes="65534", berserker="1"; +INSERT INTO aa_effects SET aaid=6545, slot=1, effectid=362, base1=1, base2=0; From b54411e53316d7d91e55611b50340e75c0396bc4 Mon Sep 17 00:00:00 2001 From: KimLS Date: Fri, 24 Oct 2014 19:05:04 -0700 Subject: [PATCH 0177/1883] Fix for not loading some account data on character load --- zone/client_packet.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index efc8a5d8a..d929118b0 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1374,10 +1374,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) query = StringFormat("SELECT `status`, `name`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme` FROM `account` WHERE `id` = %u", this->AccountID()); auto results = database.QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - if (admin){ admin = atoi(row[0]); } - if (account_name){ strcpy(account_name, row[1]); } - if (lsaccountid && atoi(row[2]) > 0){ lsaccountid = atoi(row[2]); } - else{ lsaccountid = 0; } + admin = atoi(row[0]); + strncpy(account_name, row[1], 30); + lsaccountid = atoi(row[2]); gmspeed = atoi(row[3]); revoked = atoi(row[4]); gmhideme = atoi(row[5]); From 5afd6b8628111c5496f6c1500447ef64b223413f Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 24 Oct 2014 23:36:02 -0400 Subject: [PATCH 0178/1883] Added 'hit chance' extra attack option can be applied to future special attacks ect. --- zone/attack.cpp | 11 +++++++++-- zone/common.h | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 0b8cf07f1..3d05bad70 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1288,15 +1288,18 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b mlog(COMBAT__DAMAGE, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); + int hit_chance_bonus = 0; + if(opts) { damage *= opts->damage_percent; damage += opts->damage_flat; hate *= opts->hate_percent; hate += opts->hate_flat; + hit_chance_bonus += opts->hate_flat; } //check to see if we hit.. - if(!other->CheckHitChance(this, skillinuse, Hand)) { + if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { mlog(COMBAT__ATTACKS, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it @@ -1890,14 +1893,18 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool other->AddToHateList(this, hate); } else { + + int hit_chance_bonus = 0; + if(opts) { damage *= opts->damage_percent; damage += opts->damage_flat; hate *= opts->hate_percent; hate += opts->hate_flat; + hit_chance_bonus += opts->hit_chance; } - if(!other->CheckHitChance(this, skillinuse, Hand)) { + if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { damage = 0; //miss } else { //hit, check for damage avoidance other->AvoidDamage(this, damage); diff --git a/zone/common.h b/zone/common.h index fb56b3f01..c5a55d670 100644 --- a/zone/common.h +++ b/zone/common.h @@ -563,7 +563,7 @@ struct ExtraAttackOptions { : damage_percent(1.0f), damage_flat(0), armor_pen_percent(0.0f), armor_pen_flat(0), crit_percent(1.0f), crit_flat(0.0f), - hate_percent(1.0f), hate_flat(0) + hate_percent(1.0f), hate_flat(0), hit_chance(0) { } float damage_percent; @@ -574,6 +574,7 @@ struct ExtraAttackOptions { float crit_flat; float hate_percent; int hate_flat; + int hit_chance; }; #endif From adb817565445e1a3d5bb30fe4edec02f7524830e Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 26 Oct 2014 02:05:36 -0400 Subject: [PATCH 0179/1883] Support for spells_new field 'viral_range' --- zone/entity.cpp | 7 +++++-- zone/entity.h | 2 +- zone/mob.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 0ce530419..fbccd1baa 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4612,9 +4612,12 @@ Client *EntityList::FindCorpseDragger(uint16 CorpseID) return nullptr; } -Mob *EntityList::GetTargetForVirus(Mob *spreader) +Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) { - int max_spread_range = RuleI(Spells, VirusSpreadDistance); + int max_spread_range = RuleI(Spells, VirusSpreadDistance); + + if (range) + max_spread_range = range; std::vector TargetsInRange; diff --git a/zone/entity.h b/zone/entity.h index 5776ed936..ad5de09bf 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -134,7 +134,7 @@ public: Mob *GetMob(const char* name); Mob *GetMobByNpcTypeID(uint32 get_id); bool IsMobSpawnedByNpcTypeID(uint32 get_id); - Mob *GetTargetForVirus(Mob* spreader); + Mob *GetTargetForVirus(Mob* spreader, int range); inline NPC *GetNPCByID(uint16 id) { return npc_list.count(id) ? npc_list.at(id) : nullptr; } NPC *GetNPCByNPCTypeID(uint32 npc_id); diff --git a/zone/mob.cpp b/zone/mob.cpp index 8d53d50ef..9fb113392 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -4349,7 +4349,7 @@ void Mob::SpreadVirus(uint16 spell_id, uint16 casterID) // Only spread in zones without perm buffs if(!zone->BuffTimersSuspended()) { for(int i = 0; i < num_targs; i++) { - target = entity_list.GetTargetForVirus(this); + target = entity_list.GetTargetForVirus(this, spells[spell_id].viral_range); if(target) { // Only spreads to the uninfected if(!target->FindBuff(spell_id)) { From 3247137ef2ef090621bc487636693a958bf8c24a Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 27 Oct 2014 02:20:25 -0400 Subject: [PATCH 0180/1883] Added swarm pet checks to viral spreading function. --- zone/entity.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index fbccd1baa..d5354386f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4614,8 +4614,8 @@ Client *EntityList::FindCorpseDragger(uint16 CorpseID) Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) { - int max_spread_range = RuleI(Spells, VirusSpreadDistance); - + int max_spread_range = RuleI(Spells, VirusSpreadDistance); + if (range) max_spread_range = range; @@ -4623,34 +4623,38 @@ Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) auto it = mob_list.begin(); while (it != mob_list.end()) { + Mob *cur = it->second; // Make sure the target is in range, has los and is not the mob doing the spreading - if ((it->second->GetID() != spreader->GetID()) && - (it->second->CalculateDistance(spreader->GetX(), spreader->GetY(), + if ((cur->GetID() != spreader->GetID()) && + (cur->CalculateDistance(spreader->GetX(), spreader->GetY(), spreader->GetZ()) <= max_spread_range) && - (spreader->CheckLosFN(it->second))) { + (spreader->CheckLosFN(cur))) { // If the spreader is an npc it can only spread to other npc controlled mobs - if (spreader->IsNPC() && !spreader->IsPet() && it->second->IsNPC()) { - TargetsInRange.push_back(it->second); + if (spreader->IsNPC() && !spreader->IsPet() && !spreader->CastToNPC()->GetSwarmOwner() && cur->IsNPC()) { + TargetsInRange.push_back(cur); } // If the spreader is an npc controlled pet it can spread to any other npc or an npc controlled pet else if (spreader->IsNPC() && spreader->IsPet() && spreader->GetOwner()->IsNPC()) { - if (it->second->IsNPC() && !it->second->IsPet()) { - TargetsInRange.push_back(it->second); - } else if (it->second->IsNPC() && it->second->IsPet() && it->second->GetOwner()->IsNPC()) { - TargetsInRange.push_back(it->second); + if (cur->IsNPC() && !cur->IsPet()) { + TargetsInRange.push_back(cur); + } else if (cur->IsNPC() && cur->IsPet() && cur->GetOwner()->IsNPC()) { + TargetsInRange.push_back(cur); + } + else if (cur->IsNPC() && cur->CastToNPC()->GetSwarmOwner() && cur->GetOwner()->IsNPC()) { + TargetsInRange.push_back(cur); } } // if the spreader is anything else(bot, pet, etc) then it should spread to everything but non client controlled npcs - else if (!spreader->IsNPC() && !it->second->IsNPC()) { - TargetsInRange.push_back(it->second); + else if (!spreader->IsNPC() && !cur->IsNPC()) { + TargetsInRange.push_back(cur); } // if its a pet we need to determine appropriate targets(pet to client, pet to pet, pet to bot, etc) - else if (spreader->IsNPC() && spreader->IsPet() && !spreader->GetOwner()->IsNPC()) { - if (!it->second->IsNPC()) { - TargetsInRange.push_back(it->second); + else if (spreader->IsNPC() && (spreader->IsPet() || spreader->CastToNPC()->GetSwarmOwner()) && !spreader->GetOwner()->IsNPC()) { + if (!cur->IsNPC()) { + TargetsInRange.push_back(cur); } - else if (it->second->IsNPC() && it->second->IsPet() && !it->second->GetOwner()->IsNPC()) { - TargetsInRange.push_back(it->second); + else if (cur->IsNPC() && (cur->IsPet() || cur->CastToNPC()->GetSwarmOwner()) && !cur->GetOwner()->IsNPC()) { + TargetsInRange.push_back(cur); } } } From 65cb049a386063a8d832715c81673d6108cd7209 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 28 Oct 2014 11:35:26 -0400 Subject: [PATCH 0181/1883] Added Client::InterrogateInventory() and command #interrogateinv to manually invoke it. (GM's - use #interrogateinv help) --- changelog.txt | 3 + common/features.h | 3 +- zone/client.cpp | 2 + zone/client.h | 10 ++ zone/client_packet.cpp | 9 +- zone/command.cpp | 71 +++++++++++++- zone/command.h | 1 + zone/inventory.cpp | 205 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 301 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index c13ee4b05..0242a6d1d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/28/2014 == +Uleat: Added Client::InterrogateInventory(). Can be invoked by #interrogateinv and is also called when Handle_OP_MoveItem() calls for SwapItemResync() + == 10/22/2014 == Uleat: Fix for stacking items in a world object..added a new command option: #peekinv world - will show world container contents, if one is in use by target. diff --git a/common/features.h b/common/features.h index 3047475e1..237a78290 100644 --- a/common/features.h +++ b/common/features.h @@ -261,7 +261,8 @@ enum { commandChangeFlags = 200, //ability to set/refresh flags commandBanPlayers = 100, //can set bans on players commandChangeDatarate = 201, //edit client's data rate - commandZoneToCoords = 0 //can #zone with coords + commandZoneToCoords = 0, //can #zone with coords + commandInterrogateInv = 100 //below this == only log on error state and self-only target dump }; //default states for logging flag on NPCs and clients (having NPCs on by default is prolly a bad idea) diff --git a/zone/client.cpp b/zone/client.cpp index b8527204f..f1fef3b23 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -327,6 +327,8 @@ Client::Client(EQStreamInterface* ieqs) EngagedRaidTarget = false; SavedRaidRestTimer = 0; + + interrogateinv_flag = false; } Client::~Client() { diff --git a/zone/client.h b/zone/client.h index e31c15598..598fc8bce 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1212,6 +1212,11 @@ public: void ShowNumHits(); // work around function for numhits not showing on buffs + void TripInterrogateInvState() { interrogateinv_flag = true; } + bool GetInterrogateInvState() { return interrogateinv_flag; } + + bool InterrogateInventory(Client* requester, bool log, bool silent, bool allowtrip, bool& error, bool autolog = true); + protected: friend class Mob; void CalcItemBonuses(StatBonuses* newbon); @@ -1524,6 +1529,11 @@ private: std::map accountflags; uint8 initial_respawn_selection; + + bool interrogateinv_flag; // used to minimize log spamming by players + + void InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth); + bool InterrogateInventory_error(int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, int depth); }; #endif diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d929118b0..db6edf703 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9915,7 +9915,14 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) if (mi_hack) { Message(15, "Caution: Illegal use of inaccessable bag slots!"); } - if (!SwapItem(mi) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { SwapItemResync(mi); } + if (!SwapItem(mi) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { + SwapItemResync(mi); + + bool error = false; + InterrogateInventory(this, false, true, false, error, false); + if (error) + InterrogateInventory(this, true, false, true, error); + } return; } diff --git a/zone/command.cpp b/zone/command.cpp index c1121932c..f7225e2ee 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -259,6 +259,7 @@ int command_init(void) { command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) || command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) || command_add("peekinv","[worn/inv/cursor/trib/bank/trade/world/all] - Print out contents of your player target's inventory",100,command_peekinv) || + command_add("interrogateinv","- use [help] argument for available options",0,command_interrogateinv) || command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) || command_add("findzone","[search criteria] - Search database zones",100,command_findzone) || command_add("fz",nullptr,100, command_findzone) || @@ -3002,12 +3003,80 @@ void command_peekinv(Client *c, const Seperator *sep) if (!bFound) { - c->Message(0, "Usage: #peekinv [worn|cursor|inv|bank|trade|trib|all]"); + c->Message(0, "Usage: #peekinv [worn|inv|cursor|trib|bank|trade|world|all]"); c->Message(0, " Displays a portion of the targeted user's inventory"); c->Message(0, " Caution: 'all' is a lot of information!"); } } +void command_interrogateinv(Client *c, const Seperator *sep) +{ + // 'command_interrogateinv' is an in-memory inventory interrogation tool only. + // + // it does not verify against actual database entries..but, the output can be + // used to verify that something has been corrupted in a player's inventory. + // any error condition should be assumed that the item in question will be + // lost when the player logs out or zones (or incurrs any action that will + // consume the Client-Inventory object instance in question.) + // + // any item instances located at a greater depth than a reported error should + // be treated as an error themselves regardless of whether they report as the + // same or not. + + if (strcasecmp(sep->arg[1], "help") == 0) { + if (c->Admin() < commandInterrogateInv) { + c->Message(0, "Usage: #interrogateinv"); + c->Message(0, " Displays your inventory's current in-memory nested storage references"); + } + else { + c->Message(0, "Usage: #interrogateinv [log] [silent]"); + c->Message(0, " Displays your or your Player target inventory's current in-memory nested storage references"); + c->Message(0, " [log] - Logs interrogation to file"); + c->Message(0, " [silent] - Omits the in-game message portion of the interrogation"); + } + return; + } + + Client* target = nullptr; + std::map instmap; + bool log = false; + bool silent = false; + bool error = false; + bool allowtrip = false; + + if (c->Admin() < commandInterrogateInv) { + if (c->GetInterrogateInvState()) { + c->Message(13, "The last use of #interrogateinv on this inventory instance discovered an error..."); + c->Message(13, "Logging out, zoning or re-arranging items at this point will result in item loss!"); + return; + } + target = c; + allowtrip = true; + } + else { + if (c->GetTarget() == nullptr) { + target = c; + } + else if (c->GetTarget()->IsClient()) { + target = c->GetTarget()->CastToClient(); + } + else { + c->Message(1, "Use of this command is limited to Client entities"); + return; + } + + if (strcasecmp(sep->arg[1], "log") == 0) + log = true; + if (strcasecmp(sep->arg[2], "silent") == 0) + silent = true; + } + + bool success = target->InterrogateInventory(c, log, silent, allowtrip, error); + + if (!success) + c->Message(13, "An unknown error occurred while processing Client::InterrogateInventory()"); +} + void command_findnpctype(Client *c, const Seperator *sep) { if(sep->arg[1][0] == 0) { diff --git a/zone/command.h b/zone/command.h index c02c127dc..db069b57c 100644 --- a/zone/command.h +++ b/zone/command.h @@ -152,6 +152,7 @@ void command_heal(Client *c, const Seperator *sep); void command_appearance(Client *c, const Seperator *sep); void command_nukeitem(Client *c, const Seperator *sep); void command_peekinv(Client *c, const Seperator *sep); +void command_interrogateinv(Client *c, const Seperator *sep); void command_findnpctype(Client *c, const Seperator *sep); void command_findzone(Client *c, const Seperator *sep); void command_viewnpctype(Client *c, const Seperator *sep); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 6a80aefe1..8cc9e4cff 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2732,6 +2732,211 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { return true; } +bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool allowtrip, bool& error, bool autolog) +{ + if (!requester) + return false; + + std::map instmap; + + // build reference map + for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_POSSESSIONS_SIZE; ++index) + if (m_inv[index]) + instmap[index] = m_inv[index]; + for (int16 index = EmuConstants::TRIBUTE_BEGIN; index <= EmuConstants::TRIBUTE_END; ++index) + if (m_inv[index]) + instmap[index] = m_inv[index]; + for (int16 index = EmuConstants::BANK_BEGIN; index <= EmuConstants::BANK_END; ++index) + if (m_inv[index]) + instmap[index] = m_inv[index]; + for (int16 index = EmuConstants::SHARED_BANK_BEGIN; index <= EmuConstants::SHARED_BANK_END; ++index) + if (m_inv[index]) + instmap[index] = m_inv[index]; + for (int16 index = EmuConstants::TRADE_BEGIN; index <= EmuConstants::TRADE_END; ++index) + if (m_inv[index]) + instmap[index] = m_inv[index]; + + if (Object* tsobject = GetTradeskillObject()) + for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_WORLD_SIZE; ++index) + if (tsobject->GetItem(index)) + instmap[EmuConstants::WORLD_BEGIN + index] = tsobject->GetItem(index); + + int limbo = 0; + for (iter_queue cursor_itr = m_inv.cursor_begin(); cursor_itr != m_inv.cursor_end(); ++cursor_itr, ++limbo) { + if (cursor_itr == m_inv.cursor_begin()) // m_inv.cursor_begin() is referenced as MainCursor in MapPossessions above + continue; + + instmap[8000 + limbo] = *cursor_itr; + } + + if (m_inv[MainPowerSource]) + instmap[MainPowerSource] = m_inv[MainPowerSource]; + + // call InterrogateInventory_ for error check + for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) + InterrogateInventory_(true, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); + + if (autolog && error && (!log)) + log = true; + + if (log) + _log(INVENTORY__ERROR, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); + if (!silent) + requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); + + // call InterrogateInventory_ for report + for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()); ++instmap_itr) + InterrogateInventory_(false, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); + + if (error) { + Message(13, "An error has been discovered in your inventory!"); + Message(13, "Do not log out, zone or re-arrange items until this"); + Message(13, "issue has been resolved or item loss may occur!"); + + if (allowtrip) + TripInterrogateInvState(); + } + + if (log) { + _log(INVENTORY__ERROR, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + _log(INVENTORY__ERROR, "Client::InterrogateInventory() -- End"); + } + if (!silent) { + requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + requester->Message(1, "--- End of Interrogation Report ---"); + } + + instmap.clear(); + + return true; +} + +void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) +{ + if (depth >= 10) { + _log(INVENTORY__ERROR, "Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + return; + } + + if (errorcheck) { + if (InterrogateInventory_error(head, index, inst, parent, depth)) { + error = true; + } + else { + if (inst) + for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE) && (!error); ++sub) // treat any ItemInst as having the max internal slots available + if (inst->GetItem(sub)) + InterrogateInventory_(true, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); + } + } + else { + bool localerror = InterrogateInventory_error(head, index, inst, parent, depth); + std::string i; + std::string p; + std::string e; + + if (inst) { i = StringFormat("%s (class: %u | augtype: %u)", inst->GetItem()->Name, inst->GetItem()->ItemClass, inst->GetItem()->AugType); } + else { i = "NONE"; } + if (parent) { p = StringFormat("%s (class: %u | augtype: %u), index: %i", parent->GetItem()->Name, parent->GetItem()->ItemClass, parent->GetItem()->AugType, index); } + else { p = "NONE"; } + if (localerror) { e = " [ERROR]"; } + else { e = ""; } + + if (log) + _log(INVENTORY__ERROR, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + head, depth, i.c_str(), p.c_str(), e.c_str()); + if (!silent) + requester->Message(1, "%i:%i - inst: %s - parent: %s%s", + head, depth, i.c_str(), p.c_str(), e.c_str()); + + if (inst) + for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE); ++sub) + if (inst->GetItem(sub)) + InterrogateInventory_(false, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); + } + + return; +} + +bool Client::InterrogateInventory_error(int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, int depth) +{ + // very basic error checking - can be elaborated upon if more in-depth testing is needed... + + if ( + (head >= EmuConstants::EQUIPMENT_BEGIN && head <= EmuConstants::EQUIPMENT_END) || + (head >= EmuConstants::TRIBUTE_BEGIN && head <= EmuConstants::TRIBUTE_END) || + (head >= EmuConstants::WORLD_BEGIN && head <= EmuConstants::WORLD_END) || + (head >= 8000 && head <= 8101) || + (head == MainPowerSource)) { + switch (depth) + { + case 0: // requirement: inst is extant + if (!inst) + return true; + break; + case 1: // requirement: parent is common and inst is augment + if ((!parent) || (!inst)) + return true; + if (!parent->IsType(ItemClassCommon)) + return true; + if (index >= EmuConstants::ITEM_COMMON_SIZE) + return true; + break; + default: // requirement: none (something bad happened...) + return true; + } + } + else if ( + (head >= EmuConstants::GENERAL_BEGIN && head <= EmuConstants::GENERAL_END) || + (head == MainCursor) || + (head >= EmuConstants::BANK_BEGIN && head <= EmuConstants::BANK_END) || + (head >= EmuConstants::SHARED_BANK_BEGIN && head <= EmuConstants::SHARED_BANK_END) || + (head >= EmuConstants::TRADE_BEGIN && head <= EmuConstants::TRADE_END)) { + switch (depth) + { + case 0: // requirement: inst is extant + if (!inst) + return true; + break; + case 1: // requirement: parent is common and inst is augment ..or.. parent is container and inst is extant + if ((!parent) || (!inst)) + return true; + if (parent->IsType(ItemClassContainer)) + break; + if (parent->IsType(ItemClassBook)) + return true; + if (parent->IsType(ItemClassCommon)) { + if (!(inst->GetItem()->AugType > 0)) + return true; + if (index >= EmuConstants::ITEM_COMMON_SIZE) + return true; + } + break; + case 2: // requirement: parent is common and inst is augment + if ((!parent) || (!inst)) + return true; + if (parent->IsType(ItemClassContainer)) + return true; + if (parent->IsType(ItemClassBook)) + return true; + if (parent->IsType(ItemClassCommon)) { + if (!(inst->GetItem()->AugType > 0)) + return true; + if (index >= EmuConstants::ITEM_COMMON_SIZE) + return true; + } + break; + default: // requirement: none (something bad happened again...) + return true; + } + } + else { + return true; + } + + return false; +} + void Inventory::SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value) { ItemInst *inst = GetItem(slot_id); if(inst) { From 57f8f610943d254d25497030778fecf2165f4835 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 30 Oct 2014 21:22:53 -0400 Subject: [PATCH 0182/1883] code optimization --- .../sql/git/required/2014_10_16_special_abilities_null.sql | 6 ++---- zone/zonedb.cpp | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/utils/sql/git/required/2014_10_16_special_abilities_null.sql b/utils/sql/git/required/2014_10_16_special_abilities_null.sql index c01bd725b..8f92a114c 100644 --- a/utils/sql/git/required/2014_10_16_special_abilities_null.sql +++ b/utils/sql/git/required/2014_10_16_special_abilities_null.sql @@ -1,6 +1,4 @@ -ALTER TABLE `merc_stats` -MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `attack_speed`; +ALTER TABLE `merc_stats` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `attack_speed`; -ALTER TABLE `npc_types` -MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `npcspecialattks`; +ALTER TABLE `npc_types` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `npcspecialattks`; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 77b179a68..870e5bc62 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1820,7 +1820,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { if (row[34] != nullptr) strn0cpy(tmpNPCType->special_abilities, row[34], 512); else - strn0cpy(tmpNPCType->special_abilities,"\0", 512); + tmpNPCTYpe->special_abilities[0] = '\0'; tmpNPCType->npc_spells_id = atoi(row[35]); tmpNPCType->npc_spells_effects_id = atoi(row[36]); @@ -2027,7 +2027,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client if (row[27] != nullptr) strn0cpy(tmpNPCType->special_abilities, row[27], 512); else - strn0cpy(tmpNPCType->special_abilities,"\0", 512); + tmpNPCTYpe->special_abilities[0] = '\0'; tmpNPCType->d_meele_texture1 = atoi(row[28]); tmpNPCType->d_meele_texture2 = atoi(row[29]); From f84130fc7c4f644922faad1e31c72639aa742a63 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 30 Oct 2014 21:40:46 -0400 Subject: [PATCH 0183/1883] fix --- zone/zonedb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 870e5bc62..2fb79029b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1820,7 +1820,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { if (row[34] != nullptr) strn0cpy(tmpNPCType->special_abilities, row[34], 512); else - tmpNPCTYpe->special_abilities[0] = '\0'; + tmpNPCType->special_abilities[0] = '\0'; tmpNPCType->npc_spells_id = atoi(row[35]); tmpNPCType->npc_spells_effects_id = atoi(row[36]); @@ -2027,7 +2027,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client if (row[27] != nullptr) strn0cpy(tmpNPCType->special_abilities, row[27], 512); else - tmpNPCTYpe->special_abilities[0] = '\0'; + tmpNPCType->special_abilities[0] = '\0'; tmpNPCType->d_meele_texture1 = atoi(row[28]); tmpNPCType->d_meele_texture2 = atoi(row[29]); From d3fbd026b4be39e14b49c632c80ec6edb82d77e9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 30 Oct 2014 22:08:45 -0400 Subject: [PATCH 0184/1883] Fix error with commit --- zone/attack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 3d05bad70..5e2baa117 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1295,7 +1295,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage += opts->damage_flat; hate *= opts->hate_percent; hate += opts->hate_flat; - hit_chance_bonus += opts->hate_flat; + hit_chance_bonus += opts->hit_chance; } //check to see if we hit.. From 481492cb599113cfc636c065f3812286fdfd2b5d Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 30 Oct 2014 19:38:13 -0700 Subject: [PATCH 0185/1883] Fixed SQL to be current date, also it will no longer rely on a field that we removed from the db [skip ci] --- utils/sql/git/required/2014_10_16_special_abilities_null.sql | 4 ---- utils/sql/git/required/2014_10_30_special_abilities_null.sql | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 utils/sql/git/required/2014_10_16_special_abilities_null.sql create mode 100644 utils/sql/git/required/2014_10_30_special_abilities_null.sql diff --git a/utils/sql/git/required/2014_10_16_special_abilities_null.sql b/utils/sql/git/required/2014_10_16_special_abilities_null.sql deleted file mode 100644 index 8f92a114c..000000000 --- a/utils/sql/git/required/2014_10_16_special_abilities_null.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE `merc_stats` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `attack_speed`; - -ALTER TABLE `npc_types` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL AFTER `npcspecialattks`; - diff --git a/utils/sql/git/required/2014_10_30_special_abilities_null.sql b/utils/sql/git/required/2014_10_30_special_abilities_null.sql new file mode 100644 index 000000000..c9e52011d --- /dev/null +++ b/utils/sql/git/required/2014_10_30_special_abilities_null.sql @@ -0,0 +1,4 @@ +ALTER TABLE `merc_stats` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; + +ALTER TABLE `npc_types` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; + From b417e23d977285610664d43bd696d53a3cbf35eb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 31 Oct 2014 00:02:05 -0400 Subject: [PATCH 0186/1883] Allow to set/del qglobals in encounters scripts --- zone/questmgr.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 90f0d370d..7757d0a70 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1290,9 +1290,9 @@ void QuestManager::signal(int npc_id, int wait_ms) { void QuestManager::setglobal(const char *varname, const char *newvalue, int options, const char *duration) { QuestManagerCurrentQuestVars(); - int qgZoneid=zone->GetZoneID(); - int qgCharid=0; - int qgNpcid = owner->GetNPCTypeID(); + int qgZoneid = zone->GetZoneID(); + int qgCharid = 0; + int qgNpcid = owner ? owner->GetNPCTypeID() : 0; // encounter scripts don't have an owner /* options value determines the availability of global variables to NPCs when a quest begins ------------------------------------------------------------------ @@ -1410,9 +1410,9 @@ void QuestManager::targlobal(const char *varname, const char *value, const char void QuestManager::delglobal(const char *varname) { QuestManagerCurrentQuestVars(); - int qgZoneid=zone->GetZoneID(); - int qgCharid=0; - int qgNpcid=owner->GetNPCTypeID(); + int qgZoneid = zone->GetZoneID(); + int qgCharid = 0; + int qgNpcid = owner ? owner->GetNPCTypeID() : 0; // encounter scripts don't have an owner if (initiator && initiator->IsClient()) // some events like waypoint and spawn don't have a player involved qgCharid=initiator->CharacterID(); From 306c641c72aed324bc92381b5bca9d79a11dee08 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 31 Oct 2014 21:47:07 -0400 Subject: [PATCH 0187/1883] merge --- zone/attack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 3d05bad70..5e2baa117 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1295,7 +1295,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage += opts->damage_flat; hate *= opts->hate_percent; hate += opts->hate_flat; - hit_chance_bonus += opts->hate_flat; + hit_chance_bonus += opts->hit_chance; } //check to see if we hit.. From 7b0045290dfe4ff4a8514a4e24f66beeeb33d5fe Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 31 Oct 2014 22:40:49 -0400 Subject: [PATCH 0188/1883] Fixed most of the compiler warnings and cleaned up some code in spells_effects.cpp --- zone/groups.cpp | 6 +-- zone/groups.h | 6 +-- zone/mob.h | 2 +- zone/raids.cpp | 6 +-- zone/raids.h | 6 +-- zone/spell_effects.cpp | 108 ++++++++++++++++++++--------------------- 6 files changed, 67 insertions(+), 67 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index b9eda9836..e80650f08 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1082,7 +1082,7 @@ void Client::LeaveGroup() { isgrouped = false; } -void Group::HealGroup(uint32 heal_amt, Mob* caster, int32 range) +void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) { if (!caster) return; @@ -1120,7 +1120,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, int32 range) } -void Group::BalanceHP(int32 penalty, int32 range, Mob* caster, int32 limit) +void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) { if (!caster) return; @@ -1170,7 +1170,7 @@ void Group::BalanceHP(int32 penalty, int32 range, Mob* caster, int32 limit) } } -void Group::BalanceMana(int32 penalty, int32 range, Mob* caster, int32 limit) +void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) { if (!caster) return; diff --git a/zone/groups.h b/zone/groups.h index 250b86946..951d8881a 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -86,9 +86,9 @@ public: uint16 GetAvgLevel(); bool LearnMembers(); void VerifyGroup(); - void BalanceHP(int32 penalty, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void BalanceMana(int32 penalty, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void HealGroup(uint32 heal_amt, Mob* caster, int32 range = 0); + void BalanceHP(int32 penalty, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void BalanceMana(int32 penalty, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void HealGroup(uint32 heal_amt, Mob* caster, float range = 0); inline void SetGroupAAs(GroupLeadershipAA_Struct *From) { memcpy(&LeaderAbilities, From, sizeof(GroupLeadershipAA_Struct)); } inline void GetGroupAAs(GroupLeadershipAA_Struct *Into) { memcpy(Into, &LeaderAbilities, sizeof(GroupLeadershipAA_Struct)); } void UpdateGroupAAs(); diff --git a/zone/mob.h b/zone/mob.h index 352a610eb..dc43f8349 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1054,7 +1054,7 @@ protected: Timer ranged_timer; float attack_speed; //% increase/decrease in attack speed (not haste) int8 attack_delay; //delay between attacks in 10ths of seconds - float slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%) + int16 slow_mitigation; // Allows for a slow mitigation (100 = 100%, 50% = 50%) Timer tic_timer; Timer mana_timer; diff --git a/zone/raids.cpp b/zone/raids.cpp index 699bc6b1d..d377d4174 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -511,7 +511,7 @@ uint32 Raid::GetTotalRaidDamage(Mob* other) return total; } -void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range) +void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) { if (!caster) return; @@ -554,7 +554,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range) } -void Raid::BalanceHP(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 limit) +void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 limit) { if (!caster) return; @@ -610,7 +610,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 } } -void Raid::BalanceMana(int32 penalty, uint32 gid, int32 range, Mob* caster, int32 limit) +void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int32 limit) { if (!caster) return; diff --git a/zone/raids.h b/zone/raids.h index eb963ad32..7c3561cd2 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -157,9 +157,9 @@ public: void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid); void SplitExp(uint32 exp, Mob* other); uint32 GetTotalRaidDamage(Mob* other); - void BalanceHP(int32 penalty, uint32 gid, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void BalanceMana(int32 penalty, uint32 gid, int32 range = 0, Mob* caster = nullptr, int32 limit = 0); - void HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, int32 range = 0); + void BalanceHP(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void BalanceMana(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0); + void HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range = 0); void SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter = nullptr); void GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 41e8f1e50..05bda2a82 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -336,7 +336,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int i; bool inuse = false; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid == spell_id && i != buffslot) { Message(0, "You must wait before you can be affected by this spell again."); @@ -428,10 +428,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) float x, y, z, heading; const char *target_zone; - x = spell.base[1]; - y = spell.base[0]; - z = spell.base[2]; - heading = spell.base[3]; + x = static_cast(spell.base[1]); + y = static_cast(spell.base[0]); + z = static_cast(spell.base[2]); + heading = static_cast(spell.base[3]); if(!strcmp(spell.teleport_zone, "same")) { @@ -500,10 +500,10 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) float x, y, z, heading; const char *target_zone; - x = spell.base[1]; - y = spell.base[0]; - z = spell.base[2]; - heading = spell.base[3]; + x = static_cast(spell.base[1]); + y = static_cast(spell.base[0]); + z = static_cast(spell.base[2]); + heading = static_cast(spell.base[3]); if(!strcmp(spell.teleport_zone, "same")) { @@ -801,7 +801,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (!bBreak) { - int resistMod = partial + (GetCHA()/25); + int resistMod = static_cast(partial) + (GetCHA()/25); resistMod = resistMod > 100 ? 100 : resistMod; buffs[buffslot].ticsremaining = resistMod * buffs[buffslot].ticsremaining / 100; } @@ -877,7 +877,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsClient()) { AI_Start(); - animation = GetRunspeed() * 21; //set our animation to match our speed about + animation = static_cast(GetRunspeed() * 21.0f); //set our animation to match our speed about } CalculateNewFearpoint(); @@ -911,7 +911,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -960,7 +960,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -996,7 +996,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) action->source = caster ? caster->GetID() : GetID(); action->level = 65; action->instrument_mod = 10; - action->sequence = (GetHeading() * 12345 / 2); + action->sequence = static_cast((GetHeading() * 12345 / 2)); action->type = 231; action->spell = spell_id; action->buff_unknown = 4; @@ -1050,7 +1050,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if( buffs[slot].spellid != SPELL_UNKNOWN && spells[buffs[slot].spellid].dispel_flag == 0 && @@ -1075,7 +1075,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid) && @@ -1100,7 +1100,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) break; } - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsBeneficialSpell(buffs[slot].spellid) && @@ -1118,7 +1118,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_Purify: { //Attempt to remove all Deterimental buffs. - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int slot = 0; slot < buff_count; slot++) { if (buffs[slot].spellid != SPELL_UNKNOWN && IsDetrimentalSpell(buffs[slot].spellid)) @@ -1460,7 +1460,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) caster->GetTarget()->GetGender(), caster->GetTarget()->GetTexture() ); - caster->SendAppearancePacket(AT_Size, caster->GetTarget()->GetSize()); + caster->SendAppearancePacket(AT_Size, static_cast(caster->GetTarget()->GetSize())); for(int x = EmuConstants::MATERIAL_BEGIN; x <= EmuConstants::MATERIAL_TINT_END; x++) caster->SendWearChange(x); @@ -1662,7 +1662,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Model Size: %d%%", effect_value); #endif - ChangeSize(GetSize() * (effect_value / 100.0)); + ChangeSize(GetSize() * (static_cast(effect_value) / 100.0f)); break; } @@ -1881,13 +1881,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculatePoisonCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -1913,13 +1913,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateDiseaseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1948,13 +1948,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = 0 - effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateCurseCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); @@ -1983,13 +1983,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (effect_value < 0) { effect_value = -effect_value; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j=0; j < buff_count; j++) { - if (buffs[j].spellid >= (uint16)SPDAT_RECORDS) + if (!IsValidSpell(buffs[j].spellid)) continue; if (CalculateCorruptionCounters(buffs[j].spellid) == 0) continue; - if (effect_value >= buffs[j].counters) { + if (effect_value >= static_cast(buffs[j].counters)) { if (caster) caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); @@ -2032,7 +2032,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsNPC()) { - Stun(toss_amt); + Stun(static_cast(toss_amt)); } toss_amt = sqrt(toss_amt)-2.0; @@ -2261,15 +2261,15 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) switch(spells[spell_id].skill) { case SkillThrowing: - caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); + caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i], focus, ReuseTime); break; case SkillArchery: - caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus,ReuseTime); + caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base[i],spells[spell_id].base2[i],focus, ReuseTime); break; default: - caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, ReuseTime); + caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base[i], spells[spell_id].skill, spells[spell_id].base2[i], focus, false, ReuseTime); break; } break; @@ -2485,7 +2485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!caster->IsClient()) break; - uint32 max_mana = spell.base[i]; + int32 max_mana = spell.base[i]; int ratio = spell.base2[i]; uint32 heal_amt = 0; @@ -2617,7 +2617,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_ManaBurn: { - uint32 max_mana = spell.base[i]; + int32 max_mana = spell.base[i]; int ratio = spell.base2[i]; int32 dmg = 0; @@ -3257,7 +3257,7 @@ snare has both of them negative, yet their range should work the same: break; case 137: // used in berserker AA desperation - result = ubase - (ubase * (GetHPRatio() / 100.0f)); + result = ubase - static_cast((ubase * (GetHPRatio() / 100.0f))); break; case 138: { // unused on live? @@ -3347,7 +3347,7 @@ snare has both of them negative, yet their range should work the same: void Mob::BuffProcess() { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int buffs_i = 0; buffs_i < buff_count; ++buffs_i) { @@ -4343,12 +4343,12 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) break; case SE_LimitCastTimeMin: - if (spell.cast_time < base1) + if (static_cast(spell.cast_time) < base1) LimitFailure = true; break; case SE_LimitCastTimeMax: - if (spell.cast_time > base1) + if (static_cast(spell.cast_time) > base1) LimitFailure = true; break; @@ -4447,24 +4447,24 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) case SE_LimitSpellClass: if(base1 < 0) { //Exclude - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)); + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)) return(0); } else { LimitInclude[12] = true; - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)); //Include + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellClass)) //Include LimitInclude[13] = true; } break; case SE_LimitSpellSubclass: if(base1 < 0) { //Exclude - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)); + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)) return(0); } else { LimitInclude[14] = true; - if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)); //Include + if (CheckSpellCategory(spell_id, base1, SE_LimitSpellSubclass)) //Include LimitInclude[15] = true; } break; @@ -5248,7 +5248,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (spellbonuses.FocusEffects[type]){ int buff_slot = 0; uint16 focusspellid = 0; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { if (SympatheticProcList.size() > MAX_SYMPATHETIC) @@ -5466,7 +5466,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { int buff_slot = 0; uint16 focusspellid = 0; uint16 focusspell_tracker = 0; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; if (focusspellid == 0 || focusspellid >= SPDAT_RECORDS) @@ -5565,11 +5565,11 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) return; bool bDepleted = false; - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); //Spell specific procs [Type 7,10,11] if (IsValidSpell(spell_id)) { - for (uint32 d = 0; d < buff_max; d++) { + for (int d = 0; d < buff_max; d++) { if (buffs[d].spellid == spell_id && buffs[d].numhits > 0 && spells[buffs[d].spellid].numhitstype == type) { if (--buffs[d].numhits == 0) { @@ -5608,7 +5608,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) } } } else { - for (uint32 d = 0; d < buff_max; d++) { + for (int d = 0; d < buff_max; d++) { if (IsValidSpell(buffs[d].spellid) && buffs[d].numhits > 0 && spells[buffs[d].spellid].numhitstype == type) { if (--buffs[d].numhits == 0) { @@ -5708,7 +5708,7 @@ bool Mob::TryDeathSave() { int SuccessChance = 0; int buffSlot = spellbonuses.DeathSave[1]; int16 UD_HealMod = 0; - uint32 HealAmt = 300; //Death Pact max Heal + int HealAmt = 300; //Death Pact max Heal if(buffSlot >= 0){ @@ -5813,7 +5813,7 @@ float Mob::GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 I if (total_cast_time > 0 && total_cast_time <= 2500) cast_time_mod = 0.25f; else if (total_cast_time > 2500 && total_cast_time < 7000) - cast_time_mod = 0.167*((static_cast(total_cast_time) - 1000.0f)/1000.0f); + cast_time_mod = 0.167f*((static_cast(total_cast_time) - 1000.0f)/1000.0f); else cast_time_mod = static_cast(total_cast_time) / 7000.0f; @@ -5848,7 +5848,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, return 0; if (spellbonuses.FocusEffects[focusFcDamageAmtIncoming]){ - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int i = 0; i < buff_count; i++){ if( (IsValidSpell(buffs[i].spellid) && (IsEffectInSpell(buffs[i].spellid, SE_FcDamageAmtIncoming))) ){ From 1619324d0647e55ea6bc8101117690e0c58fae7a Mon Sep 17 00:00:00 2001 From: KimLS Date: Fri, 31 Oct 2014 22:09:09 -0700 Subject: [PATCH 0189/1883] Small bug fixes with encounters, also added eq.load_encounter_with_data(encounter_name, data_string) and unload as well. Allows you to send a message via the encounter system load --- zone/lua_general.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++-- zone/lua_parser.cpp | 8 +++++- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index ccb35f479..686466b1f 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -39,10 +39,63 @@ void load_encounter(std::string name) { parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, 0); } +void load_encounter_with_data(std::string name, std::string info_str) { + std::vector info_ptrs; + info_ptrs.push_back(&info_str); + parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, 0, &info_ptrs); +} + void unload_encounter(std::string name) { + auto liter = lua_encounter_events_registered.begin(); + while(liter != lua_encounter_events_registered.end()) { + std::list &elist = liter->second; + auto iter = elist.begin(); + while(iter != elist.end()) { + if((*iter).encounter_name.compare(name) == 0) { + iter = elist.erase(iter); + } else { + ++iter; + } + } + + if(elist.size() == 0) { + lua_encounter_events_registered.erase(liter++); + } else { + ++liter; + } + } + parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, 0); } +void unload_encounter_with_data(std::string name, std::string info_str) { + + auto liter = lua_encounter_events_registered.begin(); + while(liter != lua_encounter_events_registered.end()) { + std::list &elist = liter->second; + auto iter = elist.begin(); + while(iter != elist.end()) { + if((*iter).encounter_name.compare(name) == 0) { + iter = elist.erase(iter); + } + else { + ++iter; + } + } + + if(elist.size() == 0) { + lua_encounter_events_registered.erase(liter++); + } + else { + ++liter; + } + } + + std::vector info_ptrs; + info_ptrs.push_back(&info_str); + parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, 0, &info_ptrs); +} + void register_event(std::string package_name, std::string name, int evt, luabind::adl::object func) { lua_registered_event e; e.encounter_name = name; @@ -55,7 +108,7 @@ void register_event(std::string package_name, std::string name, int evt, luabind elist.push_back(e); lua_encounter_events_registered[package_name] = elist; } else { - std::list elist = liter->second; + std::list &elist = liter->second; auto iter = elist.begin(); while(iter != elist.end()) { if(iter->event_id == evt && iter->encounter_name.compare(name) == 0) { @@ -66,7 +119,6 @@ void register_event(std::string package_name, std::string name, int evt, luabind } elist.push_back(e); - lua_encounter_events_registered[package_name] = elist; } } @@ -1141,6 +1193,8 @@ luabind::scope lua_register_general() { [ luabind::def("load_encounter", &load_encounter), luabind::def("unload_encounter", &unload_encounter), + luabind::def("load_encounter_with_data", &load_encounter_with_data), + luabind::def("unload_encounter_with_data", &unload_encounter_with_data), luabind::def("register_npc_event", ®ister_npc_event), luabind::def("unregister_npc_event", &unregister_npc_event), luabind::def("register_player_event", ®ister_player_event), diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 1de119afa..6f44d4fb8 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -601,6 +601,12 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std:: lua_pushstring(L, encounter_name.c_str()); lua_setfield(L, -2, "name"); + if(extra_pointers) { + std::string *str = EQEmu::any_cast(extra_pointers->at(0)); + lua_pushstring(L, str->c_str()); + lua_setfield(L, -2, "data"); + } + quest_manager.StartQuest(nullptr, nullptr, nullptr); if(lua_pcall(L, 1, 1, 0)) { std::string error = lua_tostring(L, -1); @@ -839,7 +845,7 @@ void LuaParser::ReloadQuests() { if(f) { fclose(f); - if(luaL_dofile(L, "quests/global/script_init.lua")) { + if(luaL_dofile(L, path.c_str())) { std::string error = lua_tostring(L, -1); AddError(error); } From 45ff2cddb7bba6db377eb89777d21d2f18b5ac17 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 1 Nov 2014 11:50:55 -0500 Subject: [PATCH 0190/1883] Fixed potential crash related to Pets/Mercs buffs when targeting themselves. --- changelog.txt | 3 +++ zone/spell_effects.cpp | 2 +- zone/spells.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0242a6d1d..b02d48bb8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/01/2014 == +Trevius: Fixed potential crash related to Pets/Mercs buffs when targeting themselves. + == 10/28/2014 == Uleat: Added Client::InterrogateInventory(). Can be invoked by #interrogateinv and is also called when Handle_OP_MoveItem() calls for SwapItemResync() diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 41e8f1e50..55a0a9c96 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -4161,7 +4161,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) EQApplicationPacket *outapp = MakeBuffsPacket(); entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater); - if(GetTarget() == this) { + if(IsClient() && GetTarget() == this) { CastToClient()->QueuePacket(outapp); } diff --git a/zone/spells.cpp b/zone/spells.cpp index 544da35a0..95cb76627 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3126,7 +3126,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid entity_list.QueueClientsByTarget(this, outapp, false, nullptr, true, false, BIT_SoDAndLater); - if(GetTarget() == this) + if(IsClient() && GetTarget() == this) CastToClient()->QueuePacket(outapp); safe_delete(outapp); From acab4dd44335cf98a0cd47e8007181d7f39cc773 Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 1 Nov 2014 13:37:06 -0400 Subject: [PATCH 0191/1883] Fix for duplicate merchant items when same merchant types are in same spawngroup. --- zone/zone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 0207b28d4..476a61f2a 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -471,7 +471,7 @@ void Zone::GetMerchantDataForZoneLoad() { LogFile->write(EQEMuLog::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " - "ml.merchantid, " + "DISTINCT ml.merchantid, " "ml.slot, " "ml.item, " "ml.faction_required, " From 39bb2aa811c6cb863101076239e80737de8340d9 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 1 Nov 2014 20:57:26 -0400 Subject: [PATCH 0192/1883] minor clear up of 2handstaff block effect code. --- zone/attack.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 5e2baa117..92c1e6556 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -451,19 +451,16 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) && (other->InFrontMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) { float bonusShieldBlock = 0.0f; - bonusShieldBlock = aabonuses.ShieldBlock + spellbonuses.ShieldBlock + itembonuses.ShieldBlock; + bonusShieldBlock = static_cast(aabonuses.ShieldBlock + spellbonuses.ShieldBlock + itembonuses.ShieldBlock); RollTable[1] += bonusShieldBlock; } - if(damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock) + if(IsClient() && damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock) && (other->InFrontMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) { - bool equiped2 = CastToClient()->m_inv.GetItem(MainPrimary); - if(equiped2) { - uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(MainPrimary)->GetItem()->ItemType; + if(CastToClient()->m_inv.GetItem(MainPrimary)) { float bonusStaffBlock = 0.0f; - if(TwoHandBlunt == ItemType2HBlunt) { - - bonusStaffBlock = aabonuses.TwoHandBluntBlock + spellbonuses.TwoHandBluntBlock + itembonuses.TwoHandBluntBlock; + if (CastToClient()->m_inv.GetItem(MainPrimary)->GetItem()->ItemType == ItemType2HBlunt){ + bonusStaffBlock = static_cast(aabonuses.TwoHandBluntBlock + spellbonuses.TwoHandBluntBlock + itembonuses.TwoHandBluntBlock); RollTable[1] += bonusStaffBlock; } } @@ -4717,7 +4714,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) if (type == SE_Rune){ for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.MeleeRune[1] && spellbonuses.MeleeRune[0] && buffs[slot].melee_rune && IsValidSpell(buffs[slot].spellid)){ - uint32 melee_rune_left = buffs[slot].melee_rune; + int melee_rune_left = buffs[slot].melee_rune; if(melee_rune_left > damage) { @@ -4742,7 +4739,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) else{ for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.AbsorbMagicAtt[1] && spellbonuses.AbsorbMagicAtt[0] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)){ - uint32 magic_rune_left = buffs[slot].magic_rune; + int magic_rune_left = buffs[slot].magic_rune; if(magic_rune_left > damage) { magic_rune_left -= damage; From 43e906e3c8517582f0d1032667529decf9124c33 Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 1 Nov 2014 23:27:23 -0400 Subject: [PATCH 0193/1883] Manual merge of new faction system (#256). Clean up some personal signatures. --- changelog.txt | 1 + common/faction.cpp | 6 +- common/features.h | 10 ++-- zone/attack.cpp | 4 +- zone/bonuses.cpp | 2 +- zone/client.cpp | 130 +++++++++++++++++------------------------ zone/client_packet.cpp | 2 +- zone/hate_list.cpp | 4 +- zone/mob_ai.cpp | 4 +- zone/spell_effects.cpp | 4 +- zone/zonedb.cpp | 6 +- zone/zonedb.h | 8 +-- 12 files changed, 80 insertions(+), 101 deletions(-) diff --git a/changelog.txt b/changelog.txt index b02d48bb8..54cf452d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/01/2014 == Trevius: Fixed potential crash related to Pets/Mercs buffs when targeting themselves. +JJ: (noudess) Revamped faction system. See https://github.com/EQEmu/Server/pull/256 == 10/28/2014 == Uleat: Added Client::InterrogateInventory(). Can be invoked by #interrogateinv and is also called when Handle_OP_MoveItem() calls for SwapItemResync() diff --git a/common/faction.cpp b/common/faction.cpp index 7016f6547..576971ec5 100644 --- a/common/faction.cpp +++ b/common/faction.cpp @@ -47,7 +47,7 @@ const char *FactionValueToString(FACTION_VALUE fv) { //o-------------------------------------------------------------- -//| Name: CalculateFaction; rembrant, Dec. 16, 2001 +//| Name: CalculateFaction; Dec. 16, 2001 //o-------------------------------------------------------------- //| Notes: Returns the faction message value. //| Modify these values to taste. @@ -69,7 +69,7 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value) return FACTION_INDIFFERENT; } -// neotokyo: this function should check if some races have more than one race define +// this function should check if some races have more than one race define bool IsOfEqualRace(int r1, int r2) { if (r1 == r2) @@ -88,7 +88,7 @@ bool IsOfEqualRace(int r1, int r2) return false; } -// neotokyo: trolls endure ogres, dark elves, ... +// trolls endure ogres, dark elves, ... bool IsOfIndiffRace(int r1, int r2) { if (r1 == r2) diff --git a/common/features.h b/common/features.h index 237a78290..0860788e1 100644 --- a/common/features.h +++ b/common/features.h @@ -163,7 +163,7 @@ enum { //timer settings, all in milliseconds CombatEventTimer_expire = 12000, Tribute_duration = 600000, ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds) - FeignMemoryDuration = 120000, // EverHood - Duration player must feign death to clear zonewide agro. + FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro. EnragedTimer = 360000, EnragedDurationTimer = 10000 }; @@ -208,12 +208,12 @@ enum { //some random constants //chance ratio that a #define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly -// max factions per npc faction list +//max factions per npc faction list #define MAX_NPC_FACTIONS 20 -//value caps -#define MAX_FACTION 1500 -#define MIN_FACTION -1500 +//individual faction pool +#define MAX_PERSONAL_FACTION 1200 +#define MIN_PERSONAL_FACTION -3000 //The Level Cap: //#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127 diff --git a/zone/attack.cpp b/zone/attack.cpp index 5e2baa117..e24b982ab 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1408,7 +1408,7 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att } // cut all PVP spell damage to 2/3 -solar - // EverHood - Blasting ourselfs is considered PvP + // Blasting ourselfs is considered PvP //Don't do PvP mitigation if the caster is damaging himself if(other && other->IsClient() && (other != this) && damage > 0) { int PvPMitigation = 100; @@ -3777,7 +3777,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons safe_delete(outapp); } else { //else, it is a buff tic... - // Everhood - So we can see our dot dmg like live shows it. + // So we can see our dot dmg like live shows it. if(spell_id != SPELL_UNKNOWN && damage > 0 && attacker && attacker != this && attacker->IsClient()) { //might filter on (attack_skill>200 && attack_skill<250), but I dont think we need it attacker->FilteredMessage_StringID(attacker, MT_DoTDamage, FilterDOT, diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 89af2a244..a3e9c5190 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1484,7 +1484,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_Harmony: { - // neotokyo: Harmony effect as buff - kinda tricky + // Harmony effect as buff - kinda tricky // harmony could stack with a lull spell, which has better aggro range // take the one with less range in any case if(newbon->AssistRange == -1 || effect_value < newbon->AssistRange) diff --git a/zone/client.cpp b/zone/client.cpp index f1fef3b23..13ac70be8 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7460,7 +7460,7 @@ FACTION_VALUE Client::GetReverseFactionCon(Mob* iOther) { } //o-------------------------------------------------------------- -//| Name: GetFactionLevel; rembrant, Dec. 16, 2001 +//| Name: GetFactionLevel; Dec. 16, 2001 //o-------------------------------------------------------------- //| Notes: Gets the characters faction standing with the specified NPC. //| Will return Indifferent on failure. @@ -7473,7 +7473,7 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra int32 tmpFactionValue; FactionMods fmods; - // neotokyo: few optimizations + // few optimizations if (GetFeigned()) return FACTION_INDIFFERENT; if (invisible_undead && tnpc && !tnpc->SeeInvisibleUndead()) @@ -7496,7 +7496,7 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra { //Get the players current faction with pFaction tmpFactionValue = GetCharacterFactionLevel(pFaction); - // Everhood - tack on any bonuses from Alliance type spell effects + //Tack on any bonuses from Alliance type spell effects tmpFactionValue += GetFactionBonus(pFaction); tmpFactionValue += GetItemFactionBonus(pFaction); //Return the faction to the client @@ -7518,97 +7518,77 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra return fac; } -//o-------------------------------------------------------------- -//| Name: SetFactionLevel; rembrant, Dec. 20, 2001 -//o-------------------------------------------------------------- -//| Notes: Sets the characters faction standing with the specified NPC. -//o-------------------------------------------------------------- +//Sets the characters faction standing with the specified NPC. void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity) { - int32 faction_id[MAX_NPC_FACTIONS]={ 0,0,0,0,0,0,0,0,0,0 }; - int32 npc_value[MAX_NPC_FACTIONS]={ 0,0,0,0,0,0,0,0,0,0 }; - uint8 temp[MAX_NPC_FACTIONS]={ 0,0,0,0,0,0,0,0,0,0 }; + int32 faction_id[MAX_NPC_FACTIONS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int32 npc_value[MAX_NPC_FACTIONS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8 temp[MAX_NPC_FACTIONS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int32 mod; - int32 t; int32 tmpValue; int32 current_value; FactionMods fm; + bool change = false; + bool repair = false; + // Get the npc faction list - if(!database.GetNPCFactionList(npc_id, faction_id, npc_value, temp)) + if (!database.GetNPCFactionList(npc_id, faction_id, npc_value, temp)) return; - for(int i = 0;iitembonuses.HeroicCHA) { + if (this->itembonuses.HeroicCHA) + { int faction_mod = itembonuses.HeroicCHA / 5; // If our result isn't truncated, then just do that - if(npc_value[i] * faction_mod / 100 != 0) + if (npc_value[i] * faction_mod / 100 != 0) npc_value[i] += npc_value[i] * faction_mod / 100; // If our result is truncated, then double a mob's value every once and a while to equal what they would have got - else { - if(MakeRandomInt(0, 100) < faction_mod) + else + { + if (MakeRandomInt(0, 100) < faction_mod) npc_value[i] *= 2; } } - //figure out their modifier - mod = fm.base + fm.class_mod + fm.race_mod + fm.deity_mod; - if(mod > MAX_FACTION) - mod = MAX_FACTION; - else if(mod < MIN_FACTION) - mod = MIN_FACTION; + // Set flag when to update db + if (current_value > MAX_PERSONAL_FACTION) + { + current_value = MAX_PERSONAL_FACTION; + repair = true; + } + else if (current_value < MIN_PERSONAL_FACTION) + { + current_value = MIN_PERSONAL_FACTION; + repair = true; + } + else if ((m_pp.gm != 1) && (npc_value[i] != 0) && ((current_value != MAX_PERSONAL_FACTION) || (current_value != MIN_PERSONAL_FACTION))) + change = true; - // Calculate the faction - if(npc_value[i] != 0) { - tmpValue = current_value + mod + npc_value[i]; + current_value += npc_value[i]; - int16 FactionModPct = spellbonuses.FactionModPct + itembonuses.FactionModPct + aabonuses.FactionModPct; - tmpValue += (tmpValue * FactionModPct) / 100; + if (current_value > MAX_PERSONAL_FACTION) + current_value = MAX_PERSONAL_FACTION; + else if (current_value < MIN_PERSONAL_FACTION) + current_value = MIN_PERSONAL_FACTION; - // Make sure faction hits don't go to GMs... - if (m_pp.gm==1 && (tmpValue < current_value)) { - tmpValue = current_value; - } + if (change || repair) + { + database.SetCharacterFactionLevel(char_id, faction_id[i], current_value, temp[i], factionvalues); - // Make sure we dont go over the min/max faction limits - if(tmpValue >= MAX_FACTION) + if (change) { - t = MAX_FACTION - mod; - if(current_value == t) { - //do nothing, it is already maxed out - } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) - { - return; - } + mod = fm.base + fm.class_mod + fm.race_mod + fm.deity_mod; + tmpValue = current_value + mod + npc_value[i]; + SendFactionMessage(npc_value[i], faction_id[i], tmpValue, temp[i]); } - else if(tmpValue <= MIN_FACTION) - { - t = MIN_FACTION - mod; - if(current_value == t) { - //do nothing, it is already maxed out - } else if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], t, temp[i], factionvalues))) - { - return; - } - } - else - { - if(!(database.SetCharacterFactionLevel(char_id, faction_id[i], current_value + npc_value[i], temp[i], factionvalues))) - { - return; - } - } - if(tmpValue <= MIN_FACTION) - tmpValue = MIN_FACTION; - - SendFactionMessage(npc_value[i], faction_id[i], tmpValue, temp[i]); } } } @@ -7636,19 +7616,17 @@ int32 Client::GetCharacterFactionLevel(int32 faction_id) return 0; faction_map::iterator res; res = factionvalues.find(faction_id); - if(res == factionvalues.end()) - return(0); - return(res->second); + if (res == factionvalues.end()) + return 0; + return res->second; } // returns the character's faction level, adjusted for racial, class, and deity modifiers int32 Client::GetModCharacterFactionLevel(int32 faction_id) { int32 Modded = GetCharacterFactionLevel(faction_id); FactionMods fm; - if(database.GetFactionData(&fm,GetClass(),GetRace(),GetDeity(),faction_id)) + if (database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(), faction_id)) Modded += fm.base + fm.class_mod + fm.race_mod + fm.deity_mod; - if (Modded > MAX_FACTION) - Modded = MAX_FACTION; return Modded; } @@ -7727,17 +7705,17 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalval // default to Faction# if we couldn't get the name from the ID if (database.GetFactionName(faction_id, name, sizeof(name)) == false) - snprintf(name, sizeof(name),"Faction%i",faction_id); + snprintf(name, sizeof(name), "Faction%i", faction_id); if (tmpvalue == 0 || temp == 1 || temp == 2) return; - else if (totalvalue >= MAX_FACTION) + else if (totalvalue >= MAX_PERSONAL_FACTION) Message_StringID(0, FACTION_BEST, name); - else if (tmpvalue > 0 && totalvalue < MAX_FACTION) + else if (tmpvalue > 0 && totalvalue < MAX_PERSONAL_FACTION) Message_StringID(0, FACTION_BETTER, name); - else if (tmpvalue < 0 && totalvalue > MIN_FACTION) + else if (tmpvalue < 0 && totalvalue > MIN_PERSONAL_FACTION) Message_StringID(0, FACTION_WORSE, name); - else if (totalvalue <= MIN_FACTION) + else if (totalvalue <= MIN_PERSONAL_FACTION) Message_StringID(0, FACTION_WORST, name); return; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index db6edf703..207468825 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4732,7 +4732,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) con->playerid = GetID(); con->targetid = conin->targetid; if (tmob->IsNPC()) - con->faction = GetFactionLevel(character_id, tmob->GetNPCTypeID(), race, class_, deity, (tmob->IsNPC()) ? tmob->CastToNPC()->GetPrimaryFaction() : 0, tmob); // rembrant, Dec. 20, 2001; TODO: Send the players proper deity + con->faction = GetFactionLevel(character_id, tmob->GetNPCTypeID(), race, class_, deity, (tmob->IsNPC()) ? tmob->CastToNPC()->GetPrimaryFaction() : 0, tmob); // Dec. 20, 2001; TODO: Send the players proper deity else con->faction = 1; con->level = GetLevelCon(tmob->GetLevel()); diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index f26615877..e9117db98 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -40,7 +40,7 @@ HateList::~HateList() { } -// neotokyo: added for frenzy support +// added for frenzy support // checks if target still is in frenzy mode void HateList::CheckFrenzyHate() { @@ -170,7 +170,7 @@ Mob* HateList::GetClosest(Mob *hater) { } -// neotokyo: a few comments added, rearranged code for readability +// a few comments added, rearranged code for readability void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist) { if(!ent) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 5f8ea2c11..ff7caceaf 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1438,7 +1438,7 @@ void Mob::AI_Process() { else { if(AIfeignremember_timer->Check()) { - // EverHood - 6/14/06 + // 6/14/06 // Improved Feign Death Memory // check to see if any of our previous feigned targets have gotten up. std::set::iterator RememberedCharID; @@ -1881,7 +1881,7 @@ void Mob::AI_Event_NoLongerEngaged() { pLastFightingDelayMoving += minLastFightingDelayMoving; else pLastFightingDelayMoving += MakeRandomInt(minLastFightingDelayMoving, maxLastFightingDelayMoving); - // EverHood - So mobs don't keep running as a ghost until AIwalking_timer fires + // So mobs don't keep running as a ghost until AIwalking_timer fires // if they were moving prior to losing all hate if(IsMoving()){ SetRunAnimSpeed(0); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 55a0a9c96..d4ae9f642 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2160,7 +2160,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_TemporaryPets: //Dook- swarms and wards: { - // EverHood - this makes necro epic 1.5/2.0 proc work properly + // this makes necro epic 1.5/2.0 proc work properly if((spell_id != 6882) && (spell_id != 6884)) // Chaotic Jester/Steadfast Servant { char pet_name[64]; @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int Mob::CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining) { /* -neotokyo: i need those formulas checked!!!! +i need those formulas checked!!!! 0 = base 1 - 99 = base + level * formulaID diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 2fb79029b..11d13b992 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3146,7 +3146,7 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race } //o-------------------------------------------------------------- -//| Name: GetFactionName; rembrant, Dec. 16 +//| Name: GetFactionName; Dec. 16 //o-------------------------------------------------------------- //| Notes: Retrieves the name of the specified faction .Returns false on failure. //o-------------------------------------------------------------- @@ -3162,7 +3162,7 @@ bool ZoneDatabase::GetFactionName(int32 faction_id, char* name, uint32 buflen) { } //o-------------------------------------------------------------- -//| Name: GetNPCFactionList; rembrant, Dec. 16, 2001 +//| Name: GetNPCFactionList; Dec. 16, 2001 //o-------------------------------------------------------------- //| Purpose: Gets a list of faction_id's and values bound to the npc_id. Returns false on failure. //o-------------------------------------------------------------- @@ -3186,7 +3186,7 @@ bool ZoneDatabase::GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, in } //o-------------------------------------------------------------- -//| Name: SetCharacterFactionLevel; rembrant, Dec. 20, 2001 +//| Name: SetCharacterFactionLevel; Dec. 20, 2001 //o-------------------------------------------------------------- //| Purpose: Update characters faction level with specified faction_id to specified value. Returns false on failure. //o-------------------------------------------------------------- diff --git a/zone/zonedb.h b/zone/zonedb.h index 30721de9a..db796e481 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -321,10 +321,10 @@ public: /* Faction */ bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0); - bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //rembrant, needed for factions Dec, 16 2001 - bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // rembrant, needed for factions Dec, 16 2001 - bool GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction = 0); // neotokyo: improve faction handling - bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // rembrant, needed for factions Dec, 16 2001 + bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001 + bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001 + bool GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction = 0); // improve faction handling + bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001 bool LoadFactionData(); /* AAs */ From 5decde0af95b565ea2a8853940eb8d0c5dc9b97e Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 2 Nov 2014 00:10:19 -0400 Subject: [PATCH 0194/1883] (RicardoCampos) End looting before zoning. --- zone/client_packet.cpp | 5 ++--- zone/mob.cpp | 2 +- zone/mob.h | 6 +++--- zone/zoning.cpp | 30 ++++++++++++++++++++++++++++-- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 207468825..7a1d36a4e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5501,7 +5501,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app) return; } - SetLooting(false); + SetLooting(0); Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer)); if (entity == 0) { @@ -9343,8 +9343,6 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) return; } - SetLooting(true); - Entity* ent = entity_list.GetID(*((uint32*)app->pBuffer)); if (ent == 0) { Message(13, "Error: OP_LootRequest: Corpse not found (ent = 0)"); @@ -9353,6 +9351,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) } if (ent->IsCorpse()) { + SetLooting(ent->GetID()); //store the entity we are looting Corpse *ent_corpse = ent->CastToCorpse(); if (DistNoRootNoZ(ent_corpse->GetX(), ent_corpse->GetY()) > 625) { diff --git a/zone/mob.cpp b/zone/mob.cpp index 9fb113392..a56a29c05 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -264,7 +264,7 @@ Mob::Mob(const char* in_name, logging_enabled = false; isgrouped = false; israidgrouped = false; - islooting = false; + entity_id_being_looted = 0; _appearance = eaStanding; pRunAnimSpeed = 0; diff --git a/zone/mob.h b/zone/mob.h index dc43f8349..61e51a0a9 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -801,8 +801,8 @@ public: void SetGrouped(bool v); inline bool IsRaidGrouped() const { return israidgrouped; } void SetRaidGrouped(bool v); - inline bool IsLooting() const { return islooting; } - void SetLooting(bool val) { islooting = val; } + inline bool IsLooting() const { return entity_id_being_looted; } + void SetLooting(uint16 val) { entity_id_being_looted = val; } bool CheckWillAggro(Mob *mob); @@ -927,7 +927,7 @@ protected: bool isgrouped; bool israidgrouped; bool pendinggroup; - bool islooting; + uint16 entity_id_being_looted; //the id of the entity being looted, 0 if not looting. uint8 texture; uint8 helmtexture; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 6a8abb6d4..42d07810a 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -549,9 +549,35 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z break; } - if(ReadyToZone) { + if (ReadyToZone) + { + //if client is looting, we need to send an end loot + if (IsLooting()) + { + Entity* entity = entity_list.GetID(entity_id_being_looted); + if (entity == 0) + { + Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)"); + if (GetClientVersion() >= EQClientSoD) + Corpse::SendEndLootErrorPacket(this); + else + Corpse::SendLootReqErrorPacket(this); + } + else if (!entity->IsCorpse()) + { + Message(13, "Error: OP_EndLootRequest: Corpse not found (!entity->IsCorpse())"); + Corpse::SendLootReqErrorPacket(this); + } + else + { + Corpse::SendEndLootErrorPacket(this); + entity->CastToCorpse()->EndLoot(this, nullptr); + } + SetLooting(0); + } + zone_mode = zm; - if(zm == ZoneToBindPoint) { + if (zm == ZoneToBindPoint) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + iZoneNameLength); ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; From 51a3302288cfa1c67ac96ea3b85adf6d4c53e1f9 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 2 Nov 2014 00:43:01 -0400 Subject: [PATCH 0195/1883] Few more minor compilier warnings and code clean up. --- zone/mob.cpp | 44 ++++++++++++++++++++-------------------- zone/mob_ai.cpp | 2 +- zone/npc.h | 2 +- zone/special_attacks.cpp | 12 +++++------ zone/spells.cpp | 30 +++++++++++++-------------- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 9fb113392..15372c60e 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -608,7 +608,7 @@ int32 Mob::CalcMaxMana() { int32 Mob::CalcMaxHP() { max_hp = (base_hp + itembonuses.HP + spellbonuses.HP); - max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f); + max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000); return max_hp; } @@ -3392,7 +3392,7 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier) int32 stat = 0; std::string id = identifier; - for(int i = 0; i < id.length(); ++i) + for(uint32 i = 0; i < id.length(); ++i) { id[i] = tolower(id[i]); } @@ -4223,10 +4223,10 @@ void Mob::SpellProjectileEffect() float dist = 0; if (target) - dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]); + dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]); int increment_end = 0; - increment_end = (dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms + increment_end = static_cast(dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms if (increment_end <= projectile_increment[i]){ @@ -4829,7 +4829,7 @@ bool Mob::HasSpellEffect(int effectid) { int i; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid == SPELL_UNKNOWN) { continue; } @@ -4960,7 +4960,7 @@ bool Mob::IsFacingMob(Mob *other) return false; float angle = HeadingAngleToMob(other); // what the client uses appears to be 2x our internal heading - float heading = GetHeading() * 2.0; + float heading = GetHeading() * 2.0f; if (angle > 472.0 && heading < 40.0) angle = heading; @@ -4986,20 +4986,20 @@ float Mob::HeadingAngleToMob(Mob *other) if (y_diff < 0.0000009999999974752427) y_diff = 0.0000009999999974752427; - float angle = atan2(x_diff, y_diff) * 180.0 * 0.3183099014828645; // angle, nice "pi" + float angle = atan2(x_diff, y_diff) * 180.0f * 0.3183099014828645f; // angle, nice "pi" // return the right thing based on relative quadrant // I'm sure this could be improved for readability, but whatever if (this_y >= mob_y) { if (mob_x >= this_x) - return (90.0 - angle + 90.0) * 511.5 * 0.0027777778; + return (90.0f - angle + 90.0f) * 511.5f * 0.0027777778f; if (mob_x <= this_x) - return (angle + 180.0) * 511.5 * 0.0027777778; + return (angle + 180.0f) * 511.5f * 0.0027777778f; } if (this_y > mob_y || mob_x > this_x) - return angle * 511.5 * 0.0027777778; + return angle * 511.5f * 0.0027777778f; else - return (90.0 - angle + 270.0) * 511.5 * 0.0027777778; + return (90.0f - angle + 270.0f) * 511.5f * 0.0027777778f; } int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) @@ -5016,7 +5016,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) slot = slot - 1; std::string id = identifier; - for(int i = 0; i < id.length(); ++i) + for(uint32 i = 0; i < id.length(); ++i) { id[i] = tolower(id[i]); } @@ -5040,10 +5040,10 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];} } - if (id == "range") {stat = spells[spell_id].range; } - else if (id == "aoerange") {stat = spells[spell_id].aoerange;} - else if (id == "pushback") {stat = spells[spell_id].pushback;} - else if (id == "pushup") {stat = spells[spell_id].pushup;} + if (id == "range") {stat = static_cast(spells[spell_id].range); } + else if (id == "aoerange") {stat = static_cast(spells[spell_id].aoerange);} + else if (id == "pushback") {stat = static_cast(spells[spell_id].pushback);} + else if (id == "pushup") {stat = static_cast(spells[spell_id].pushup);} else if (id == "cast_time") {stat = spells[spell_id].cast_time;} else if (id == "recovery_time") {stat = spells[spell_id].recovery_time;} else if (id == "recast_time") {stat = spells[spell_id].recast_time;} @@ -5094,8 +5094,8 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "viral_targets") {stat = spells[spell_id].viral_targets; } else if (id == "viral_timer") {stat = spells[spell_id].viral_timer; } else if (id == "NimbusEffect") {stat = spells[spell_id].NimbusEffect; } - else if (id == "directional_start") {stat = spells[spell_id].directional_start; } - else if (id == "directional_end") {stat = spells[spell_id].directional_end; } + else if (id == "directional_start") {stat = static_cast(spells[spell_id].directional_start); } + else if (id == "directional_end") {stat = static_cast(spells[spell_id].directional_end); } else if (id == "not_extendable") {stat = spells[spell_id].not_extendable; } else if (id == "suspendable") {stat = spells[spell_id].suspendable; } else if (id == "viral_range") {stat = spells[spell_id].viral_range; } @@ -5109,10 +5109,10 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "aemaxtargets") {stat = spells[spell_id].aemaxtargets; } else if (id == "maxtargets") {stat = spells[spell_id].maxtargets; } else if (id == "persistdeath") {stat = spells[spell_id].persistdeath; } - else if (id == "min_dist") {stat = spells[spell_id].min_dist; } - else if (id == "min_dist_mod") {stat = spells[spell_id].min_dist_mod; } - else if (id == "max_dist") {stat = spells[spell_id].max_dist; } - else if (id == "min_range") {stat = spells[spell_id].min_range; } + else if (id == "min_dist") {stat = static_cast(spells[spell_id].min_dist); } + else if (id == "min_dist_mod") {stat = static_cast(spells[spell_id].min_dist_mod); } + else if (id == "max_dist") {stat = static_cast(spells[spell_id].max_dist); } + else if (id == "min_range") {stat = static_cast(spells[spell_id].min_range); } else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; } return stat; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index ff7caceaf..614ba984d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1907,7 +1907,7 @@ void Mob::AI_Event_NoLongerEngaged() { } //this gets called from InterruptSpell() for failure or SpellFinished() for success -void NPC::AI_Event_SpellCastFinished(bool iCastSucceeded, uint8 slot) { +void NPC::AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot) { if (slot == 1) { uint32 recovery_time = 0; if (iCastSucceeded) { diff --git a/zone/npc.h b/zone/npc.h index f1e4c790c..c24c97200 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -127,7 +127,7 @@ public: virtual bool AI_PursueCastCheck(); virtual bool AI_IdleCastCheck(); - virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint8 slot); + virtual void AI_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot); void LevelScale(); void CalcNPCResists(); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index f3527b997..963bf51a8 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -766,7 +766,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } } - float range = RangeItem->Range + AmmoItem->Range + 5; //Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0 + float range = RangeItem->Range + AmmoItem->Range + 5.0f; //Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0 mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; if(DistNoRootNoZ(*GetTarget()) > range) { @@ -876,8 +876,8 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item if(dobonus) { - MaxDmg *= (float)2; - hate *= (float)2; + MaxDmg *= 2; + hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); @@ -1802,7 +1802,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) { Mob *hate_top = who->GetHateMost(); - float level_difference = GetLevel() - who->GetLevel(); + int level_difference = GetLevel() - who->GetLevel(); bool Success = false; //Support for how taunt worked pre 2000 on LIVE - Can not taunt NPC over your level. @@ -1823,13 +1823,13 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) { else { if (level_difference < 0){ - tauntchance += level_difference*3; + tauntchance += static_cast(level_difference)*3.0f; if (tauntchance < 20) tauntchance = 20.0f; } else { - tauntchance += level_difference*5; + tauntchance += static_cast(level_difference)*5.0f; if (tauntchance > 65) tauntchance = 65.0f; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 95cb76627..8ede6aa66 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -708,7 +708,7 @@ bool Client::CheckFizzle(uint16 spell_id) break; } if(((specialize/6.0f) + 15.0f) < MakeRandomFloat(0, 100)) { - specialize *= SPECIALIZE_FIZZLE / 200; + specialize *= SPECIALIZE_FIZZLE / 200.0f; } else { specialize = 0.0f; } @@ -718,7 +718,7 @@ bool Client::CheckFizzle(uint16 spell_id) // > 0 --> skill is lower, higher chance of fizzle // < 0 --> skill is better, lower chance of fizzle // the max that diff can be is +- 235 - float diff = par_skill + spells[spell_id].basediff - act_skill; + float diff = par_skill + static_cast(spells[spell_id].basediff) - act_skill; // if you have high int/wis you fizzle less, you fizzle more if you are stupid if(GetClass() == BARD) @@ -2396,7 +2396,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { void Mob::BardPulse(uint16 spell_id, Mob *caster) { int buffs_i; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (buffs_i = 0; buffs_i < buff_count; buffs_i++) { if(buffs[buffs_i].spellid != spell_id) continue; @@ -3001,7 +3001,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid // it would overwrite, and then hitting a buff we can't stack with. // we also check if overwriting will occur. this is so after this loop // we can determine if there will be room for this buff - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); uint32 start_slot = 0; uint32 end_slot = 0; if (IsDisciplineBuff(spell_id)) { @@ -3155,7 +3155,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) mlog(AI__BUFFS, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) { const Buffs_Struct &curbuf = buffs[i]; @@ -3503,7 +3503,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } // Block next spell effect should be used up first(since its blocking the next spell) if(CanBlockSpell()) { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); int focus = 0; for (int b=0; b < buff_count; b++) { if(IsEffectInSpell(buffs[b].spellid, SE_BlockNextSpellFocus)) { @@ -3819,7 +3819,7 @@ bool Mob::FindBuff(uint16 spellid) // removes all buffs void Mob::BuffFadeAll() { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) { if(buffs[j].spellid != SPELL_UNKNOWN) BuffFadeBySlot(j, false); @@ -3830,7 +3830,7 @@ void Mob::BuffFadeAll() void Mob::BuffFadeNonPersistDeath() { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) { if (buffs[j].spellid != SPELL_UNKNOWN && !IsPersistDeathSpell(buffs[j].spellid)) BuffFadeBySlot(j, false); @@ -3840,7 +3840,7 @@ void Mob::BuffFadeNonPersistDeath() } void Mob::BuffFadeDetrimental() { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) { if(buffs[j].spellid != SPELL_UNKNOWN) { if(IsDetrimentalSpell(buffs[j].spellid)) @@ -3854,7 +3854,7 @@ void Mob::BuffFadeDetrimentalByCaster(Mob *caster) if(!caster) return; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) { if(buffs[j].spellid != SPELL_UNKNOWN) { if(IsDetrimentalSpell(buffs[j].spellid)) @@ -3894,7 +3894,7 @@ void Mob::BuffFadeBySitModifier() // removes the buff matching spell_id void Mob::BuffFadeBySpellID(uint16 spell_id) { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int j = 0; j < buff_count; j++) { if (buffs[j].spellid == spell_id) @@ -3910,7 +3910,7 @@ void Mob::BuffFadeByEffect(int effectid, int skipslot) { int i; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid == SPELL_UNKNOWN) @@ -4541,7 +4541,7 @@ float Mob::GetAOERange(uint16 spell_id) { if(IsBardSong(spell_id) && IsBeneficialSpell(spell_id)) { //Live AA - Extended Notes, SionachiesCrescendo - float song_bonus = aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange; + float song_bonus = static_cast(aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange); range += range*song_bonus /100.0f; } @@ -4963,7 +4963,7 @@ uint16 Mob::GetSpellIDFromSlot(uint8 slot) } bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for (int i = 0; i < buff_count; i++) { if (buffs[i].spellid != SPELL_UNKNOWN) { @@ -5295,7 +5295,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target) void Mob::BuffModifyDurationBySpellID(uint16 spell_id, int32 newDuration) { - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(int i = 0; i < buff_count; ++i) { if (buffs[i].spellid == spell_id) From 728399e3727109937fff58cb3fda6c989c273fa4 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 2 Nov 2014 05:35:09 -0500 Subject: [PATCH 0196/1883] Make sure virus is an actual buff before starting timer --- zone/spell_effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index fb50f1203..b9d1885aa 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -158,7 +158,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } } - if(spells[spell_id].viral_targets > 0) { + if(buffslot >= 0 && spells[spell_id].viral_targets > 0) { if(!viral_timer.Enabled()) viral_timer.Start(1000); From c9073b10a1a193d9e32fa06314032f9cf390f322 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 2 Nov 2014 18:34:22 -0500 Subject: [PATCH 0197/1883] Revert for checking buffs if virus, a couple of spells don't require a buff. --- zone/spell_effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b9d1885aa..fb50f1203 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -158,7 +158,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } } - if(buffslot >= 0 && spells[spell_id].viral_targets > 0) { + if(spells[spell_id].viral_targets > 0) { if(!viral_timer.Enabled()) viral_timer.Start(1000); From b4576435e3ca9dfd757db2c246d678f0c5380554 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 2 Nov 2014 18:50:02 -0500 Subject: [PATCH 0198/1883] Size check on ServerOP_ChannelMessage --- world/zoneserver.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index b94bda20a..d61d6e65b 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -434,6 +434,8 @@ bool ZoneServer::Process() { break; } case ServerOP_ChannelMessage: { + if (pack->size < sizeof(ServerChannelMessage_Struct)) + break; ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer; if(scm->chan_num == 20) { From d754e24a02946f6d6700145debaa04e7b1629009 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 2 Nov 2014 20:14:44 -0500 Subject: [PATCH 0199/1883] Minor code and compiler warning fixes. --- zone/aa.cpp | 2 +- zone/aggro.cpp | 2 +- zone/bonuses.cpp | 56 ++++++++++++++++++++++++++++++++---------------- zone/effects.cpp | 8 +++---- zone/mob.h | 2 +- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 83a6b7967..321439aa2 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1902,7 +1902,7 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){ auto it = aa_effects.find(aa_struct->id); if (it != aa_effects.end()) { - for (int slot = 0; slot < aa_struct->total_abilities; slot++) { + for (uint32 slot = 0; slot < aa_struct->total_abilities; slot++) { // aa_effects is a map of a map, so the slot reference does not start at 0 aa_struct->abilities[slot].skill_id = it->second[slot + 1].skill_id; aa_struct->abilities[slot].base1 = it->second[slot + 1].base1; diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 30ef4087d..8f5da2eaa 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -881,7 +881,7 @@ bool Mob::CombatRange(Mob* other) float max_dist = static_cast(GetSpecialAbilityParam(NPC_CHASE_DISTANCE, 0)); float min_dist = static_cast(GetSpecialAbilityParam(NPC_CHASE_DISTANCE, 1)); - if (GetSpecialAbilityParam(NPC_CHASE_DISTANCE, 2)); + if (GetSpecialAbilityParam(NPC_CHASE_DISTANCE, 2)) DoLoSCheck = false; //Ignore line of sight check if (max_dist == 1) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a3e9c5190..cc6e3415b 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1392,7 +1392,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon) newbon->AggroRange = -1; newbon->AssistRange = -1; - uint32 buff_count = GetMaxTotalSlots(); + int buff_count = GetMaxTotalSlots(); for(i = 0; i < buff_count; i++) { if(buffs[i].spellid != SPELL_UNKNOWN){ ApplySpellsBonuses(buffs[i].spellid, buffs[i].casterlevel, newbon, buffs[i].casterid, false, buffs[i].ticsremaining,i); @@ -1477,7 +1477,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne // redundant to have level check here if(newbon->AggroRange == -1 || effect_value < newbon->AggroRange) { - newbon->AggroRange = effect_value; + newbon->AggroRange = static_cast(effect_value); } break; } @@ -1489,7 +1489,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne // take the one with less range in any case if(newbon->AssistRange == -1 || effect_value < newbon->AssistRange) { - newbon->AssistRange = effect_value; + newbon->AssistRange = static_cast(effect_value); } break; } @@ -2808,7 +2808,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne || ((effect_value < 0) && (newbon->AlterNPCLevel > effect_value)) || ((effect_value > 0) && (newbon->AlterNPCLevel < effect_value))) { - int16 tmp_lv = GetOrigLevel() + effect_value; + int tmp_lv = GetOrigLevel() + effect_value; if (tmp_lv < 1) tmp_lv = 1; else if (tmp_lv > 255) @@ -3092,7 +3092,7 @@ void Client::CalcItemScale() { bool Client::CalcItemScale(uint32 slot_x, uint32 slot_y) { // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1 bool changed = false; - int i; + uint32 i; for (i = slot_x; i <= slot_y; i++) { if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; @@ -3186,7 +3186,7 @@ void Client::DoItemEnterZone() { bool Client::DoItemEnterZone(uint32 slot_x, uint32 slot_y) { // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1 bool changed = false; - for(int i = slot_x; i <= slot_y; i++) { + for(uint32 i = slot_x; i <= slot_y; i++) { if (i == MainAmmo) // moved here from calling procedure to facilitate future range changes where MainAmmo may not be the last slot continue; @@ -3380,15 +3380,15 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) break; case SE_ChangeFrenzyRad: - spellbonuses.AggroRange = effect_value; - aabonuses.AggroRange = effect_value; - itembonuses.AggroRange = effect_value; + spellbonuses.AggroRange = static_cast(effect_value); + aabonuses.AggroRange = static_cast(effect_value); + itembonuses.AggroRange = static_cast(effect_value); break; case SE_Harmony: - spellbonuses.AssistRange = effect_value; - aabonuses.AssistRange = effect_value; - itembonuses.AssistRange = effect_value; + spellbonuses.AssistRange = static_cast(effect_value); + aabonuses.AssistRange = static_cast(effect_value); + itembonuses.AssistRange = static_cast(effect_value); break; case SE_AttackSpeed: @@ -4347,11 +4347,11 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) break; case SE_TriggerMeleeThreshold: - spellbonuses.TriggerMeleeThreshold = effect_value; + spellbonuses.TriggerMeleeThreshold = false; break; case SE_TriggerSpellThreshold: - spellbonuses.TriggerSpellThreshold = effect_value; + spellbonuses.TriggerSpellThreshold = false; break; case SE_DivineAura: @@ -4377,7 +4377,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) break; case SE_DistanceRemoval: - spellbonuses.DistanceRemoval = effect_value; + spellbonuses.DistanceRemoval = false; break; case SE_ImprovedTaunt: @@ -4480,7 +4480,7 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) break; case SE_Sanctuary: - spellbonuses.Sanctuary = effect_value; + spellbonuses.Sanctuary = false; break; case SE_FactionModPct: @@ -4496,10 +4496,28 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) break; case SE_IllusionPersistence: - spellbonuses.IllusionPersistence = effect_value; - itembonuses.IllusionPersistence = effect_value; - aabonuses.IllusionPersistence = effect_value; + spellbonuses.IllusionPersistence = false; + itembonuses.IllusionPersistence = false; + aabonuses.IllusionPersistence = false; break; + + case SE_SkillProcSuccess:{ + for(int e = 0; e < MAX_SKILL_PROCS; e++) + { + spellbonuses.SkillProcSuccess[e] = effect_value; + itembonuses.SkillProcSuccess[e] = effect_value; + aabonuses.SkillProcSuccess[e] = effect_value; + } + } + + case SE_SkillProc:{ + for(int e = 0; e < MAX_SKILL_PROCS; e++) + { + spellbonuses.SkillProc[e] = effect_value; + itembonuses.SkillProc[e] = effect_value; + aabonuses.SkillProc[e] = effect_value; + } + } } } } diff --git a/zone/effects.cpp b/zone/effects.cpp index 3d8138100..90b9c0c4c 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -260,7 +260,7 @@ int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_s if (total_cast_time > 0 && total_cast_time <= 2500) extra_spell_amt = extra_spell_amt*25/100; else if (total_cast_time > 2500 && total_cast_time < 7000) - extra_spell_amt = extra_spell_amt*(0.167*((total_cast_time - 1000)/1000)); + extra_spell_amt = extra_spell_amt*(167*((total_cast_time - 1000)/1000)) / 1000; else extra_spell_amt = extra_spell_amt * total_cast_time / 7000; @@ -408,11 +408,11 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) break; } - bonus += 0.05 * GetAA(aaAdvancedSpellCastingMastery); + bonus += 0.05f * GetAA(aaAdvancedSpellCastingMastery); if(SuccessChance <= (SpecializeSkill * 0.3 * bonus)) { - PercentManaReduction = 1 + 0.05 * SpecializeSkill; + PercentManaReduction = 1 + 0.05f * SpecializeSkill; switch(GetAA(aaSpellCastingMastery)) { case 1: @@ -451,7 +451,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) // Gift of Mana - reduces spell cost to 1 mana if(focus_redux >= 100) { - uint32 buff_max = GetMaxTotalSlots(); + int buff_max = GetMaxTotalSlots(); for (int buffSlot = 0; buffSlot < buff_max; buffSlot++) { if (buffs[buffSlot].spellid == 0 || buffs[buffSlot].spellid >= SPDAT_RECORDS) continue; diff --git a/zone/mob.h b/zone/mob.h index 61e51a0a9..636d6b26c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -801,7 +801,7 @@ public: void SetGrouped(bool v); inline bool IsRaidGrouped() const { return israidgrouped; } void SetRaidGrouped(bool v); - inline bool IsLooting() const { return entity_id_being_looted; } + inline uint16 IsLooting() const { return entity_id_being_looted; } void SetLooting(uint16 val) { entity_id_being_looted = val; } bool CheckWillAggro(Mob *mob); From 4bd41b367861c95543a37487f0a8968f23b522df Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 2 Nov 2014 20:43:47 -0500 Subject: [PATCH 0200/1883] Export of additional instance functions to perl as per #128. Change QuestManager RemoveAllFromInstance function to use existing function to remove all clients from instance. --- zone/client.cpp | 5 +++ zone/client.h | 1 + zone/embparser_api.cpp | 80 +++++++++++++++++++++++++++++++++++++----- zone/perl_client.cpp | 24 +++++++++++++ zone/questmgr.cpp | 42 +++++++++------------- 5 files changed, 118 insertions(+), 34 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 13ac70be8..4ba0cf9f1 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6270,6 +6270,11 @@ void Client::AssignToInstance(uint16 instance_id) database.AddClientToInstance(instance_id, CharacterID()); } +void Client::RemoveFromInstance(uint16 instance_id) +{ + database.RemoveClientFromInstance(instance_id, CharacterID()); +} + void Client::SendStatsWindow(Client* client, bool use_window) { // Define the types of page breaks we need diff --git a/zone/client.h b/zone/client.h index 598fc8bce..7dfaee9e8 100644 --- a/zone/client.h +++ b/zone/client.h @@ -584,6 +584,7 @@ public: void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); void AssignToInstance(uint16 instance_id); + void RemoveFromInstance(uint16 instance_id); void WhoAll(); bool CheckLoreConflict(const Item_Struct* item); void ChangeLastName(const char* in_lastname); diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 6e337cc03..cdd5eb6c9 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2859,14 +2859,49 @@ XS(XS__GetInstanceID) { XSRETURN_UV(id); } +XS(XS__GetCharactersInInstance); +XS(XS__GetCharactersInInstance) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: GetCharactersInInstance(instance_id)"); + dXSTARG; + + Const_char * RETVAL; + uint16 instance_id = (int)SvUV(ST(0)); + std::list charid_list; + std::string charid_string; + + database.GetCharactersInInstance(instance_id, charid_list); + + if (charid_list.size() > 0) + { + charid_string = itoa(charid_list.size()); + charid_string += " player(s) in instance. CharID list: "; + auto iter = charid_list.begin(); + while (iter != charid_list.end()) + { + charid_string += itoa(*iter); + ++iter; + if (iter != charid_list.end()) + charid_string += ", "; + } + RETVAL = charid_string.c_str(); + } + else + RETVAL = "No players in that instance."; + + sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; + XSRETURN(1); +} + XS(XS__AssignToInstance); XS(XS__AssignToInstance) { dXSARGS; if (items != 1) - Perl_croak(aTHX_ "Usage: AssignToInstance(id)"); + Perl_croak(aTHX_ "Usage: AssignToInstance(instance_id)"); - uint16 id = (int)SvUV(ST(0)); - quest_manager.AssignToInstance(id); + uint16 instance_id = (int)SvUV(ST(0)); + quest_manager.AssignToInstance(instance_id); XSRETURN_EMPTY; } @@ -2875,10 +2910,10 @@ XS(XS__AssignGroupToInstance); XS(XS__AssignGroupToInstance) { dXSARGS; if (items != 1) - Perl_croak(aTHX_ "Usage: AssignGroupToInstance(id)"); + Perl_croak(aTHX_ "Usage: AssignGroupToInstance(instance_id)"); - uint16 id = (int)SvUV(ST(0)); - quest_manager.AssignGroupToInstance(id); + uint16 instance_id = (int)SvUV(ST(0)); + quest_manager.AssignGroupToInstance(instance_id); XSRETURN_EMPTY; } @@ -2887,10 +2922,34 @@ XS(XS__AssignRaidToInstance); XS(XS__AssignRaidToInstance) { dXSARGS; if (items != 1) - Perl_croak(aTHX_ "Usage: AssignRaidToInstance(id)"); + Perl_croak(aTHX_ "Usage: AssignRaidToInstance(instance_id)"); - uint16 id = (int)SvUV(ST(0)); - quest_manager.AssignRaidToInstance(id); + uint16 instance_id = (int)SvUV(ST(0)); + quest_manager.AssignRaidToInstance(instance_id); + + XSRETURN_EMPTY; +} + +XS(XS__RemoveFromInstance); +XS(XS__RemoveFromInstance) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: RemoveFromInstance(instance_id)"); + + uint16 instance_id = (int)SvUV(ST(0)); + quest_manager.RemoveFromInstance(instance_id); + + XSRETURN_EMPTY; +} + +XS(XS__RemoveAllFromInstance); +XS(XS__RemoveAllFromInstance) { + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: RemoveAllFromInstance(instance_id)"); + + uint16 instance_id = (int)SvUV(ST(0)); + quest_manager.RemoveAllFromInstance(instance_id); XSRETURN_EMPTY; } @@ -3628,9 +3687,12 @@ EXTERN_C XS(boot_quest) newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file); + newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file); newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file); newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file); newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file); + newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file); + newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file); newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file); newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file); newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index a33e9a8b9..aaaa5899f 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5337,6 +5337,30 @@ XS(XS_Client_AssignToInstance) XSRETURN_EMPTY; } +XS(XS_Client_RemoveFromInstance); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Client_RemoveFromInstance) +{ + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Client::RemoveFromInstance(THIS, instance_id)"); + { + Client * THIS; + uint16 instance_id = (uint16)SvUV(ST(1)); + + if (sv_derived_from(ST(0), "Client")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Client *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Client"); + if (THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->RemoveFromInstance(instance_id); + } + XSRETURN_EMPTY; +} + XS(XS_Client_Freeze); XS(XS_Client_Freeze) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 7757d0a70..4de816067 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2545,7 +2545,7 @@ void QuestManager::DestroyInstance(uint16 instance_id) uint16 QuestManager::GetInstanceID(const char *zone, int16 version) { QuestManagerCurrentQuestVars(); - if(initiator) + if (initiator) { return database.GetInstanceID(zone, initiator->CharacterID(), version); } @@ -2555,7 +2555,7 @@ uint16 QuestManager::GetInstanceID(const char *zone, int16 version) void QuestManager::AssignToInstance(uint16 instance_id) { QuestManagerCurrentQuestVars(); - if(initiator) + if (initiator) { database.AddClientToInstance(instance_id, initiator->CharacterID()); } @@ -2564,10 +2564,10 @@ void QuestManager::AssignToInstance(uint16 instance_id) void QuestManager::AssignGroupToInstance(uint16 instance_id) { QuestManagerCurrentQuestVars(); - if(initiator) + if (initiator) { Group *g = initiator->GetGroup(); - if(g) + if (g) { uint32 gid = g->GetID(); database.AssignGroupToInstance(gid, instance_id); @@ -2578,7 +2578,7 @@ void QuestManager::AssignGroupToInstance(uint16 instance_id) void QuestManager::AssignRaidToInstance(uint16 instance_id) { QuestManagerCurrentQuestVars(); - if(initiator) + if (initiator) { Raid *r = initiator->GetRaid(); if(r) @@ -2592,36 +2592,28 @@ void QuestManager::AssignRaidToInstance(uint16 instance_id) void QuestManager::RemoveFromInstance(uint16 instance_id) { QuestManagerCurrentQuestVars(); - if(initiator) { - if(database.RemoveClientFromInstance(instance_id, initiator->CharacterID())) { + if (initiator) + { + if (database.RemoveClientFromInstance(instance_id, initiator->CharacterID())) initiator->Message(MT_Say, "Removed client from instance."); - } else { + else initiator->Message(MT_Say, "Failed to remove client from instance."); - } } } void QuestManager::RemoveAllFromInstance(uint16 instance_id) { QuestManagerCurrentQuestVars(); - if(initiator) { + if (initiator) + { std::list charid_list; - bool removed_all = true; - uint16 fail_count = 0; - database.GetCharactersInInstance(instance_id,charid_list); - auto iter = charid_list.begin(); - while(iter != charid_list.end()) { - if(!database.RemoveClientFromInstance(instance_id, *iter)) { - removed_all = false; - ++fail_count; - } - ++iter; - } - if (removed_all) { + + if (database.RemoveClientsFromInstance(instance_id)) initiator->Message(MT_Say, "Removed all players from instance."); - } else { - // once the expedition system is in, this message it not relevant - initiator->Message(MT_Say, "Failed to remove %i player(s) from instance.", fail_count); + else + { + database.GetCharactersInInstance(instance_id, charid_list); + initiator->Message(MT_Say, "Failed to remove %i player(s) from instance.", charid_list.size()); // once the expedition system is in, this message it not relevant } } } From 771279128dab1bc7c283355babcd3bc874f9da2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 2 Nov 2014 21:16:04 -0600 Subject: [PATCH 0201/1883] Added out of range checking for Spell Save/Loads --- changelog.txt | 3 +++ zone/zonedb.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 54cf452d8..c6d5ba2b2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/02/2014 == +Akkadius: Added out of range checking for Spell Save/Loads + == 11/01/2014 == Trevius: Fixed potential crash related to Pets/Mercs buffs when targeting themselves. JJ: (noudess) Revamped faction system. See https://github.com/EQEmu/Server/pull/256 diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 11d13b992..afa43f6e8 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1655,12 +1655,14 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur } bool ZoneDatabase::SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ + if (spell_id == 65535 || spell_id == 4294967295){ return false; } std::string query = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); QueryDatabase(query); return true; } bool ZoneDatabase::SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ + if (spell_id == 65535 || spell_id == 4294967295){ return false; } std::string query = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); QueryDatabase(query); return true; @@ -1675,7 +1677,7 @@ bool ZoneDatabase::DeleteCharacterSpell(uint32 character_id, uint32 spell_id, ui bool ZoneDatabase::DeleteCharacterDisc(uint32 character_id, uint32 slot_id){ std::string query = StringFormat("DELETE FROM `character_disciplines` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); QueryDatabase(query); - return true; + return true; } bool ZoneDatabase::DeleteCharacterBandolier(uint32 character_id, uint32 band_id){ From 51958b991c29e6b04ba796e1983bee4261a6e95b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 2 Nov 2014 22:30:29 -0600 Subject: [PATCH 0202/1883] Cleaner way to handle out of range and swaps --- common/eq_constants.h | 2 ++ zone/client_packet.cpp | 9 +++++++-- zone/zonedb.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/common/eq_constants.h b/common/eq_constants.h index 1868d6c3e..426d4a9e5 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -968,4 +968,6 @@ namespace legacy { } InventorySlot; } +static const uint32 MAX_SPELL_DB_ID_VAL = 65535; + #endif diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7a1d36a4e..75605a486 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12928,8 +12928,13 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) m_pp.spell_book[swapspell->from_slot] = m_pp.spell_book[swapspell->to_slot]; m_pp.spell_book[swapspell->to_slot] = swapspelltemp; - database.SaveCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); - database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot); + /* Save Spell Swaps */ + if (!database.SaveCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot)){ + database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); + } + if (!database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot)){ + database.DeleteCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot); + } QueuePacket(app); return; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index afa43f6e8..e18a208ae 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -966,7 +966,7 @@ bool ZoneDatabase::LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_ } for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - if (i < MAX_PP_MEMSPELL){ + if (i < MAX_PP_MEMSPELL && atoi(row[1]) <= SPDAT_RECORDS){ pp->mem_spells[i] = atoi(row[1]); } } @@ -989,7 +989,7 @@ bool ZoneDatabase::LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Str } for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); - if (i < MAX_PP_SPELLBOOK){ + if (i < MAX_PP_SPELLBOOK && atoi(row[1]) <= SPDAT_RECORDS){ pp->spell_book[i] = atoi(row[1]); } } @@ -1655,14 +1655,14 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur } bool ZoneDatabase::SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ - if (spell_id == 65535 || spell_id == 4294967295){ return false; } + if (spell_id > SPDAT_RECORDS){ return false; } std::string query = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); QueryDatabase(query); return true; } bool ZoneDatabase::SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ - if (spell_id == 65535 || spell_id == 4294967295){ return false; } + if (spell_id > SPDAT_RECORDS){ return false; } std::string query = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); QueryDatabase(query); return true; From 29a36008d1bb0a11c414fe321d50413cf873d42c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 2 Nov 2014 22:37:16 -0600 Subject: [PATCH 0203/1883] Tell queue sanity checks --- world/zoneserver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index d61d6e65b..96a78b1dd 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -455,7 +455,7 @@ bool ZoneServer::Process() { (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) { if (!scm->noreply) { ClientListEntry* sender = client_list.FindCharacter(scm->from); - if (!sender) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 3; // offline @@ -467,7 +467,7 @@ bool ZoneServer::Process() { if (!scm->noreply) { ClientListEntry* sender = client_list.FindCharacter(scm->from); if (cle->TellQueueFull()) { - if (!sender) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 2; // queue full @@ -481,7 +481,7 @@ bool ZoneServer::Process() { temp->noreply = true; cle->PushToTellQueue(temp); // deallocation is handled in processing or deconstructor - if (!sender) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 1; // queued From cff9e05626761a15fac6d54b18b5c396deef89b0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 2 Nov 2014 22:43:08 -0600 Subject: [PATCH 0204/1883] Weird text characters making it into commit --- world/zoneserver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 96a78b1dd..aeb0709eb 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -455,7 +455,7 @@ bool ZoneServer::Process() { (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) { if (!scm->noreply) { ClientListEntry* sender = client_list.FindCharacter(scm->from); - if (!sender || !sender->Server()) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 3; // offline @@ -467,7 +467,7 @@ bool ZoneServer::Process() { if (!scm->noreply) { ClientListEntry* sender = client_list.FindCharacter(scm->from); if (cle->TellQueueFull()) { - if (!sender || !sender->Server()) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 2; // queue full @@ -481,7 +481,7 @@ bool ZoneServer::Process() { temp->noreply = true; cle->PushToTellQueue(temp); // deallocation is handled in processing or deconstructor - if (!sender || !sender->Server()) + if (!sender || !sender->Server()) break; scm->noreply = true; scm->queued = 1; // queued From 38f1e8847cb309a4b35cbdd864ded967d3ccb1a0 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 3 Nov 2014 12:35:07 -0500 Subject: [PATCH 0205/1883] Make output of GetCharactersInInstance for perl more user-friendly. --- zone/embparser_api.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index cdd5eb6c9..0e8b10a8e 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2876,11 +2876,16 @@ XS(XS__GetCharactersInInstance) { if (charid_list.size() > 0) { charid_string = itoa(charid_list.size()); - charid_string += " player(s) in instance. CharID list: "; + charid_string += " player(s) in instance: "; auto iter = charid_list.begin(); while (iter != charid_list.end()) { + char char_name[64]; + database.GetCharName(*iter, char_name); + charid_string += char_name; + charid_string += "("; charid_string += itoa(*iter); + charid_string += ")"; ++iter; if (iter != charid_list.end()) charid_string += ", "; From 3ac0f1506cc9ae17a148c1d4bf8f2e07c1a5cfcd Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 16:45:36 -0500 Subject: [PATCH 0206/1883] Fixed melee lifetap overflows - Because being healed for uint16s is not cool. --- zone/common.h | 4 ++-- zone/mob.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/common.h b/zone/common.h index c5a55d670..e5628c756 100644 --- a/zone/common.h +++ b/zone/common.h @@ -312,8 +312,8 @@ struct StatBonuses { int16 FlurryChance; int16 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) int16 HundredHands; //extra haste, stacks with all other haste i - int16 MeleeLifetap; //i - int16 Vampirism; //i + int32 MeleeLifetap; //i + int32 Vampirism; //i int16 HealRate; // Spell effect that influences effectiveness of heals int32 MaxHPChange; // Spell Effect int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1 diff --git a/zone/mob.cpp b/zone/mob.cpp index d33e7e433..513057fed 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -4179,7 +4179,7 @@ int16 Mob::GetSkillDmgAmt(uint16 skill) void Mob::MeleeLifeTap(int32 damage) { - int16 lifetap_amt = 0; + int32 lifetap_amt = 0; lifetap_amt = spellbonuses.MeleeLifetap + itembonuses.MeleeLifetap + aabonuses.MeleeLifetap + spellbonuses.Vampirism + itembonuses.Vampirism + aabonuses.Vampirism; From 29079a7ec2311adbf8d4d99b794e19feb345096d Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 16:47:26 -0500 Subject: [PATCH 0207/1883] changelog.txt --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index c6d5ba2b2..6933c973b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/03/2014 == +Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) + == 11/02/2014 == Akkadius: Added out of range checking for Spell Save/Loads From 8efc652c1013dbba8ed52d74f8130b41f2436214 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 19:14:58 -0500 Subject: [PATCH 0208/1883] Fixed overflow on AC and ATK values that can go out of range. --- changelog.txt | 1 + zone/attack.cpp | 4 ++-- zone/client.h | 6 +++--- zone/mob.h | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6933c973b..8eba54bed 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/03/2014 == Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) +Secrets: Fixed overflow on AC and ATK values that can go out of range. == 11/02/2014 == Akkadius: Added out of range checking for Spell Save/Loads diff --git a/zone/attack.cpp b/zone/attack.cpp index eac3b0aa2..d13dafb2a 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -665,7 +665,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac //////////////////////////////////////////////////////// // Scorpious2k: Include AC in the calculation // use serverop variables to set values - int myac = GetAC(); + int32 myac = GetAC(); if(opts) { myac *= (1.0f - opts->armor_pen_percent); myac -= opts->armor_pen_flat; @@ -696,7 +696,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac } if (acreduction>0) { - damage -= (int) (GetAC() * acreduction/100.0f); + damage -= (int32) (GetAC() * acreduction/100.0f); } if (acrandom>0) { damage -= (myac * MakeRandomInt(0, acrandom) / 10000); diff --git a/zone/client.h b/zone/client.h index 7dfaee9e8..da3d8c1ea 100644 --- a/zone/client.h +++ b/zone/client.h @@ -403,9 +403,9 @@ public: virtual void CalcBonuses(); //these are all precalculated now - inline virtual int16 GetAC() const { return AC; } - inline virtual int16 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } - inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } + inline virtual int32 GetAC() const { return AC; } + inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } + inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; diff --git a/zone/mob.h b/zone/mob.h index 636d6b26c..f0f5a1691 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -340,9 +340,9 @@ public: inline Mob* GetTarget() const { return target; } virtual void SetTarget(Mob* mob); virtual inline float GetHPRatio() const { return max_hp == 0 ? 0 : ((float)cur_hp/max_hp*100); } - inline virtual int16 GetAC() const { return AC + itembonuses.AC + spellbonuses.AC; } - inline virtual int16 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK; } - inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } + inline virtual int32 GetAC() const { return AC + itembonuses.AC + spellbonuses.AC; } + inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK; } + inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } inline virtual int16 GetSTR() const { return STR + itembonuses.STR + spellbonuses.STR; } inline virtual int16 GetSTA() const { return STA + itembonuses.STA + spellbonuses.STA; } inline virtual int16 GetDEX() const { return DEX + itembonuses.DEX + spellbonuses.DEX; } From 29ec6db3458f963d232117d69c2fc1811d2f339b Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 19:30:11 -0500 Subject: [PATCH 0209/1883] because fuck you mercs and bots --- zone/bot.h | 6 +++--- zone/merc.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/bot.h b/zone/bot.h index 7601dd00c..42f347997 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -172,8 +172,8 @@ public: virtual int GetMonkHandToHandDamage(void); virtual bool TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse); virtual void DoRiposte(Mob* defender); - inline virtual int16 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } - inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } + inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } + inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } uint16 GetTotalATK(); uint16 GetATKRating(); uint16 GetPrimarySkillValue(); @@ -465,7 +465,7 @@ public: uint32 GetHealRotationNextHealTime() { return _healRotationNextHeal; } uint32 GetHealRotationTimer () { return _healRotationTimer; } bool GetBardUseOutOfCombatSongs() { return _bardUseOutOfCombatSongs;} - inline virtual int16 GetAC() const { return AC; } + inline virtual int32 GetAC() const { return AC; } inline virtual int16 GetSTR() const { return STR; } inline virtual int16 GetSTA() const { return STA; } inline virtual int16 GetDEX() const { return DEX; } diff --git a/zone/merc.h b/zone/merc.h index dabf68789..5061d315c 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -178,9 +178,9 @@ public: // stat functions virtual void CalcBonuses(); int32 GetEndurance() const {return cur_end;} //This gets our current endurance - inline virtual int16 GetAC() const { return AC; } - inline virtual int16 GetATK() const { return ATK; } - inline virtual int16 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } + inline virtual int32 GetAC() const { return AC; } + inline virtual int32 GetATK() const { return ATK; } + inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } int GetRawACNoShield(int &shield_ac) const; inline virtual int16 GetSTR() const { return STR; } From beff1caf4f9bb7e8f90aae67abb495ad25e4d806 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 19:30:41 -0500 Subject: [PATCH 0210/1883] Merc/bot fix changelog.txt --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 8eba54bed..ad08265c0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 11/03/2014 == Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) Secrets: Fixed overflow on AC and ATK values that can go out of range. +Secrets: Merc/Bot fixes. == 11/02/2014 == Akkadius: Added out of range checking for Spell Save/Loads From 29d614421f1fb55928fd74c79e7287e7bd8ec4a8 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 22:43:00 -0500 Subject: [PATCH 0211/1883] int16/32 mismatch fixes. see changelog.txt --- changelog.txt | 3 +- zone/attack.cpp | 48 +++---- zone/bonuses.cpp | 2 +- zone/bot.cpp | 212 ++++++++++++++-------------- zone/bot.h | 198 +++++++++++++------------- zone/client.cpp | 18 +-- zone/client.h | 180 ++++++++++++------------ zone/client_mods.cpp | 126 ++++++++--------- zone/common.h | 324 +++++++++++++++++++++---------------------- zone/merc.cpp | 60 ++++---- zone/merc.h | 160 ++++++++++----------- zone/mob.h | 88 ++++++------ zone/npc.cpp | 2 +- zone/perl_mob.cpp | 48 +++---- zone/zonedump.h | 32 ++--- 15 files changed, 751 insertions(+), 750 deletions(-) diff --git a/changelog.txt b/changelog.txt index ad08265c0..b93bb91af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,7 +3,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 11/03/2014 == Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) Secrets: Fixed overflow on AC and ATK values that can go out of range. -Secrets: Merc/Bot fixes. +Secrets: Merc/Bot fixes for previous updates. +Secrets: Changed a lot of int16s for stat-related functions to int32 because they were causing combat formula overflows (int16/int32 mismatch). == 11/02/2014 == Akkadius: Added out of range checking for Spell Save/Loads diff --git a/zone/attack.cpp b/zone/attack.cpp index d13dafb2a..44bffce62 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1316,7 +1316,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (Hand == MainSecondary) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations //Live AA - SlipperyAttacks //This spell effect most likely directly modifies the actual riposte chance when using offhand attack. - int16 OffhandRiposteFail = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; + int32 OffhandRiposteFail = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; OffhandRiposteFail *= -1; //Live uses a negative value for this. if (OffhandRiposteFail && @@ -1334,7 +1334,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b } if (((damage < 0) || slippery_attack) && !bRiposte && !IsStrikethrough) { // Hack to still allow Strikethrough chance w/ Slippery Attacks AA - int16 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; + int32 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; if(bonusStrikeThrough && (MakeRandomInt(0, 100) < bonusStrikeThrough)) { Message_StringID(MT_StrikeThrough, STRIKETHROUGH_STRING); // You strike through your opponents defenses! @@ -1821,7 +1821,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //ele and bane dmg too //NPCs add this differently than PCs //if NPCs can't inheriently hit the target we don't add bane/magic dmg which isn't exactly the same as PCs - uint16 eleBane = 0; + uint32 eleBane = 0; if(weapon){ if(weapon->BaneDmgBody == other->GetBodyType()){ eleBane += weapon->BaneDmgAmt; @@ -2413,7 +2413,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, AddRampage(other); int hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod; - int16 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod; + int32 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod; if (shieldhatemod && other->HasShieldEquiped()) hatemod += shieldhatemod; @@ -2589,7 +2589,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { //Spell data for damage shield mitigation shows a negative value for spells for clients and positive //value for spells that effect pets. Unclear as to why. For now will convert all positive to be consistent. if (attacker->IsOffHandAtk()){ - int16 mitigation = attacker->itembonuses.DSMitigationOffHand + + int32 mitigation = attacker->itembonuses.DSMitigationOffHand + attacker->spellbonuses.DSMitigationOffHand + attacker->aabonuses.DSMitigationOffHand; DS -= DS*mitigation/100; @@ -3398,7 +3398,7 @@ bool Mob::HasRangedProcs() const bool Client::CheckDoubleAttack(bool tripleAttack) { //Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA) - uint16 bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; + uint32 bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; if(!HasSkill(SkillDoubleAttack) && !bonusGiveDA) return false; @@ -3407,7 +3407,7 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { uint16 skill = GetSkill(SkillDoubleAttack); - int16 bonusDA = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance; + int32 bonusDA = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance; //Use skill calculations otherwise, if you only have AA applied GiveDoubleAttack chance then use that value as the base. if (skill) @@ -3421,7 +3421,7 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { //Kayen: Need to decide if we can implement triple attack skill before working in over the cap effect. if(tripleAttack) { // Only some Double Attack classes get Triple Attack [This is already checked in client_processes.cpp] - int16 triple_bonus = spellbonuses.TripleAttackChance + itembonuses.TripleAttackChance; + int32 triple_bonus = spellbonuses.TripleAttackChance + itembonuses.TripleAttackChance; chance *= 0.2f; //Baseline chance is 20% of your double attack chance. chance *= float(100.0f+triple_bonus)/100.0f; //Apply modifiers. } @@ -3434,7 +3434,7 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { bool Client::CheckDoubleRangedAttack() { - int16 chance = spellbonuses.DoubleRangedAttack + itembonuses.DoubleRangedAttack + aabonuses.DoubleRangedAttack; + int32 chance = spellbonuses.DoubleRangedAttack + itembonuses.DoubleRangedAttack + aabonuses.DoubleRangedAttack; if(chance && (MakeRandomInt(0, 100) < chance)) return true; @@ -3866,7 +3866,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) int mydex = GetDEX(); float ProcChance = 0.0f; - uint16 weapon_speed = GetWeaponSpeedbyHand(hand); + uint32 weapon_speed = GetWeaponSpeedbyHand(hand); if (RuleB(Combat, AdjustProcPerMinute)) { ProcChance = (static_cast(weapon_speed) * @@ -3892,7 +3892,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus = 0; ProcChance = 0; - uint16 weapon_speed = GetWeaponSpeedbyHand(hand); + uint32 weapon_speed = GetWeaponSpeedbyHand(hand); ProcChance = (static_cast(weapon_speed) * RuleR(Combat, AvgDefProcsPerMinute) / 60000.0f); // compensate for weapon_speed being in ms ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; @@ -4147,7 +4147,7 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage) Mob *owner = nullptr; float critChance = 0.0f; critChance += RuleI(Combat, MeleeBaseCritChance); - uint16 critMod = 163; + uint32 critMod = 163; if (damage < 1) //We can't critical hit if we don't hit. return; @@ -4162,8 +4162,8 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage) if (!owner) return; - int16 CritPetChance = owner->aabonuses.PetCriticalHit + owner->itembonuses.PetCriticalHit + owner->spellbonuses.PetCriticalHit; - int16 CritChanceBonus = GetCriticalChanceBonus(skill); + int32 CritPetChance = owner->aabonuses.PetCriticalHit + owner->itembonuses.PetCriticalHit + owner->spellbonuses.PetCriticalHit; + int32 CritChanceBonus = GetCriticalChanceBonus(skill); if (CritPetChance || critChance) { @@ -4213,11 +4213,11 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack //1: Try Slay Undead if (defender && (defender->GetBodyType() == BT_Undead || defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire)) { - int16 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0]; + int32 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0]; if (SlayRateBonus) { float slayChance = static_cast(SlayRateBonus) / 10000.0f; if (MakeRandomFloat(0, 1) < slayChance) { - int16 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; + int32 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; damage = (damage * SlayDmgBonus * 2.25) / 100; if (GetGender() == 1) // female entity_list.FilteredMessageClose_StringID(this, false, 200, @@ -4289,9 +4289,9 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack if(MakeRandomFloat(0, 1) < critChance) { - uint16 critMod = 200; + uint32 critMod = 200; bool crip_success = false; - int16 CripplingBlowChance = GetCrippBlowChance(); + int32 CripplingBlowChance = GetCrippBlowChance(); //Crippling Blow Chance: The percent value of the effect is applied //to the your Chance to Critical. (ie You have 10% chance to critical and you @@ -4347,7 +4347,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint32 FB_Dmg = aabonuses.FinishingBlow[1] + spellbonuses.FinishingBlow[1] + itembonuses.FinishingBlow[1]; - uint16 FB_Level = 0; + uint32 FB_Level = 0; FB_Level = aabonuses.FinishingBlowLvl[0]; if (FB_Level < spellbonuses.FinishingBlowLvl[0]) FB_Level = spellbonuses.FinishingBlowLvl[0]; @@ -4375,7 +4375,7 @@ void Mob::DoRiposte(Mob* defender) { defender->Attack(this, MainPrimary, true); if (HasDied()) return; - int16 DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[0] + + int32 DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[0] + defender->spellbonuses.GiveDoubleRiposte[0] + defender->itembonuses.GiveDoubleRiposte[0]; @@ -4423,7 +4423,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ bool Mob::HasDied() { bool Result = false; - int16 hp_below = 0; + int32 hp_below = 0; hp_below = (GetDelayDeath() * -1); @@ -4437,7 +4437,7 @@ uint16 Mob::GetDamageTable(SkillUseTypes skillinuse) { if(GetLevel() <= 51) { - uint16 ret_table = 0; + uint32 ret_table = 0; int str_over_75 = 0; if(GetSTR() > 75) str_over_75 = GetSTR() - 75; @@ -4460,7 +4460,7 @@ uint16 Mob::GetDamageTable(SkillUseTypes skillinuse) } else { - uint16 dmg_table[] = { + uint32 dmg_table[] = { 275, 275, 275, 275, 275, 280, 280, 280, 280, 285, 285, 285, 290, 290, 295, @@ -4637,7 +4637,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) { - uint16 weapon_speed; + uint32 weapon_speed; float ProcChance = 0; if (!ReuseTime && hand) { diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index cc6e3415b..7944c8ba6 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -306,7 +306,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu } //FatherNitwit: New style haste, shields, and regens - if(newbon->haste < (int16)item->Haste) { + if(newbon->haste < (int32)item->Haste) { newbon->haste = item->Haste; } if(item->Regen > 0) diff --git a/zone/bot.cpp b/zone/bot.cpp index 2453a308a..a68273fae 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -338,7 +338,7 @@ bool Bot::IsStanding() { return result; } -NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender, float size, uint32 face, uint32 hairStyle, uint32 hairColor, uint32 eyeColor, uint32 eyeColor2, uint32 beardColor, uint32 beard, uint32 drakkinHeritage, uint32 drakkinTattoo, uint32 drakkinDetails, int32 hp, int32 mana, int16 mr, int16 cr, int16 dr, int16 fr, int16 pr, int16 corrup, int16 ac, uint16 str, uint16 sta, uint16 dex, uint16 agi, uint16 _int, uint16 wis, uint16 cha, uint16 attack) { +NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender, float size, uint32 face, uint32 hairStyle, uint32 hairColor, uint32 eyeColor, uint32 eyeColor2, uint32 beardColor, uint32 beard, uint32 drakkinHeritage, uint32 drakkinTattoo, uint32 drakkinDetails, int32 hp, int32 mana, int32 mr, int32 cr, int32 dr, int32 fr, int32 pr, int32 corrup, int32 ac, uint32 str, uint32 sta, uint32 dex, uint32 agi, uint32 _int, uint32 wis, uint32 cha, uint32 attack) { NPCType BotNPCType; int CopyLength = 0; @@ -459,20 +459,20 @@ void Bot::GenerateBaseStats() { int BotSpellID = 0; // base stats - uint16 Strength = _baseSTR; - uint16 Stamina = _baseSTA; - uint16 Dexterity = _baseDEX; - uint16 Agility = _baseAGI; - uint16 Wisdom = _baseWIS; - uint16 Intelligence = _baseINT; - uint16 Charisma = _baseCHA; - uint16 Attack = _baseATK; - int16 MagicResist = _baseMR; - int16 FireResist = _baseFR; - int16 DiseaseResist = _baseDR; - int16 PoisonResist = _basePR; - int16 ColdResist = _baseCR; - int16 CorruptionResist = _baseCorrup; + uint32 Strength = _baseSTR; + uint32 Stamina = _baseSTA; + uint32 Dexterity = _baseDEX; + uint32 Agility = _baseAGI; + uint32 Wisdom = _baseWIS; + uint32 Intelligence = _baseINT; + uint32 Charisma = _baseCHA; + uint32 Attack = _baseATK; + int32 MagicResist = _baseMR; + int32 FireResist = _baseFR; + int32 DiseaseResist = _baseDR; + int32 PoisonResist = _basePR; + int32 ColdResist = _baseCR; + int32 CorruptionResist = _baseCorrup; switch(this->GetClass()) { case 1: // Warrior (why not just use 'case WARRIOR:'?) @@ -845,7 +845,7 @@ void Bot::GenerateAppearance() { } -int16 Bot::acmod() +int32 Bot::acmod() { int agility = GetAGI(); int level = GetLevel(); @@ -1352,10 +1352,10 @@ uint16 Bot::MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const { return(database.GetSkillCap(class_, skillid, level)); } -uint16 Bot::GetTotalATK() +uint32 Bot::GetTotalATK() { - uint16 AttackRating = 0; - uint16 WornCap = itembonuses.ATK; + uint32 AttackRating = 0; + uint32 WornCap = itembonuses.ATK; if(IsBot()) { AttackRating = ((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); @@ -1372,9 +1372,9 @@ uint16 Bot::GetTotalATK() return AttackRating; } -uint16 Bot::GetATKRating() +uint32 Bot::GetATKRating() { - uint16 AttackRating = 0; + uint32 AttackRating = 0; if(IsBot()) { AttackRating = (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); @@ -1388,9 +1388,9 @@ int32 Bot::GenerateBaseHitPoints() { // Calc Base Hit Points int new_base_hp = 0; - uint16 lm = GetClassLevelFactor(); - uint16 Post255; - uint16 NormalSTA = GetSTA(); + uint32 lm = GetClassLevelFactor(); + uint32 Post255; + uint32 NormalSTA = GetSTA(); if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { @@ -2566,8 +2566,8 @@ void Bot::LoadPet() { if(PetSaveId > 0 && !GetPet() && PetSaveId <= SPDAT_RECORDS) { std::string petName; - uint16 petMana = 0; - uint16 petHitPoints = 0; + uint32 petMana = 0; + uint32 petHitPoints = 0; uint32 botPetId = 0; LoadPetStats(&petName, &petMana, &petHitPoints, &botPetId, PetSaveId); @@ -2593,7 +2593,7 @@ void Bot::LoadPet() { } } -void Bot::LoadPetStats(std::string* petName, uint16* petMana, uint16* petHitPoints, uint32* botPetId, uint32 botPetSaveId) { +void Bot::LoadPetStats(std::string* petName, uint32* petMana, uint32* petHitPoints, uint32* botPetId, uint32 botPetSaveId) { if(botPetSaveId == 0) return; @@ -2706,7 +2706,7 @@ void Bot::SavePet() { } } -uint32 Bot::SavePetStats(std::string petName, uint16 petMana, uint16 petHitPoints, uint32 botPetId) { +uint32 Bot::SavePetStats(std::string petName, uint32 petMana, uint32 petHitPoints, uint32 botPetId) { std::string query = StringFormat("REPLACE INTO botpets SET PetId = %u, BotId = %u, Name = '%s', " "Mana = %u, HitPoints = %u;", botPetId, GetBotID(), petName.c_str(), @@ -3068,7 +3068,7 @@ void Bot::BotRangedAttack(Mob* other) { bool Bot::CheckBotDoubleAttack(bool tripleAttack) { //Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA) - uint16 bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; + uint32 bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack; // If you don't have the double attack skill, return if(!GetSkill(SkillDoubleAttack) && !(GetClass() == BARD || GetClass() == BEASTLORD)) @@ -3079,7 +3079,7 @@ bool Bot::CheckBotDoubleAttack(bool tripleAttack) { uint16 skill = GetSkill(SkillDoubleAttack); - int16 bonusDA = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance; + int32 bonusDA = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance; //Use skill calculations otherwise, if you only have AA applied GiveDoubleAttack chance then use that value as the base. if (skill) @@ -3093,7 +3093,7 @@ bool Bot::CheckBotDoubleAttack(bool tripleAttack) { //Kayen: Need to decide if we can implement triple attack skill before working in over the cap effect. if(tripleAttack) { // Only some Double Attack classes get Triple Attack [This is already checked in client_processes.cpp] - int16 triple_bonus = spellbonuses.TripleAttackChance + itembonuses.TripleAttackChance; + int32 triple_bonus = spellbonuses.TripleAttackChance + itembonuses.TripleAttackChance; chance *= 0.2f; //Baseline chance is 20% of your double attack chance. chance *= float(100.0f+triple_bonus)/100.0f; //Apply modifiers. } @@ -3612,7 +3612,7 @@ void Bot::AI_Process() { } //Live AA - Flurry, Rapid Strikes ect (Flurry does not require Triple Attack). - int16 flurrychance = aabonuses.FlurryChance + spellbonuses.FlurryChance + itembonuses.FlurryChance; + int32 flurrychance = aabonuses.FlurryChance + spellbonuses.FlurryChance + itembonuses.FlurryChance; if (GetTarget() && flurrychance) { @@ -3624,7 +3624,7 @@ void Bot::AI_Process() { } } - int16 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance; + int32 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance; if (GetTarget() && ExtraAttackChanceBonus) { ItemInst *wpn = GetBotItem(MainPrimary); @@ -3673,9 +3673,9 @@ void Bot::AI_Process() { if(bIsFist || ((weapontype != ItemType2HSlash) && (weapontype != ItemType2HPiercing) && (weapontype != ItemType2HBlunt))) { float DualWieldProbability = 0.0f; - int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; + int32 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max - int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; + int32 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; float random = MakeRandomFloat(0, 1); @@ -6254,7 +6254,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if (Hand == MainSecondary) {// Do we even have it & was attack with mainhand? If not, don't bother with other calculations //Live AA - SlipperyAttacks //This spell effect most likely directly modifies the actual riposte chance when using offhand attack. - int16 OffhandRiposteFail = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; + int32 OffhandRiposteFail = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail; OffhandRiposteFail *= -1; //Live uses a negative value for this. if (OffhandRiposteFail && @@ -6272,7 +6272,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b } if (((damage < 0) || slippery_attack) && !FromRiposte && !IsStrikethrough) { // Hack to still allow Strikethrough chance w/ Slippery Attacks AA - int16 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; + int32 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; if(bonusStrikeThrough && (MakeRandomInt(0, 100) < bonusStrikeThrough)) { Message_StringID(MT_StrikeThrough, STRIKETHROUGH_STRING); // You strike through your opponents defenses! @@ -6347,11 +6347,11 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b return false; } -int16 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) +int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) { const SPDat_Spell_Struct &spell = spells[spell_id]; - int16 value = 0; + int32 value = 0; int lvlModifier = 100; int spell_level = 0; int lvldiff = 0; @@ -6765,13 +6765,13 @@ int16 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) return(value*lvlModifier/100); } -int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { +int32 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { if (IsBardSong(spell_id) && bottype != BotfocusFcBaseEffects) return 0; - int16 realTotal = 0; - int16 realTotal2 = 0; - int16 realTotal3 = 0; + int32 realTotal = 0; + int32 realTotal2 = 0; + int32 realTotal3 = 0; bool rand_effectiveness = false; //Improved Healing, Damage & Mana Reduction are handled differently in that some are random percentages @@ -6789,9 +6789,9 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { const Item_Struct* UsedItem = 0; const ItemInst* TempInst = 0; uint16 UsedFocusID = 0; - int16 Total = 0; - int16 focus_max = 0; - int16 focus_max_real = 0; + int32 Total = 0; + int32 focus_max = 0; + int32 focus_max_real = 0; //item focus for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++) @@ -6873,14 +6873,14 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { if (spellbonuses.FocusEffects[bottype]){ //Spell Focus - int16 Total2 = 0; - int16 focus_max2 = 0; - int16 focus_max_real2 = 0; + int32 Total2 = 0; + int32 focus_max2 = 0; + int32 focus_max_real2 = 0; int buff_tracker = -1; int buff_slot = 0; - uint16 focusspellid = 0; - uint16 focusspell_tracker = 0; + uint32 focusspellid = 0; + uint32 focusspell_tracker = 0; uint32 buff_max = GetMaxTotalSlots(); for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { focusspellid = buffs[buff_slot].spellid; @@ -6926,7 +6926,7 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { if (aabonuses.FocusEffects[bottype]){ int totalAAs = database.CountAAs(); - int16 Total3 = 0; + int32 Total3 = 0; uint32 slots = 0; uint32 aa_AA = 0; uint32 aa_value = 0; @@ -6962,14 +6962,14 @@ int16 Bot::GetBotFocusEffect(BotfocusType bottype, uint16 spell_id) { return realTotal + realTotal2; } -int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus) { +int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus) { if(!IsValidSpell(focus_id) || !IsValidSpell(spell_id)) return 0; const SPDat_Spell_Struct &focus_spell = spells[focus_id]; const SPDat_Spell_Struct &spell = spells[spell_id]; - int16 value = 0; + int32 value = 0; int lvlModifier = 100; int spell_level = 0; int lvldiff = 0; @@ -7025,7 +7025,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel break; case SE_LimitCastTimeMin: - if (spells[spell_id].cast_time < (uint16)focus_spell.base[i]) + if (spells[spell_id].cast_time < (uint32)focus_spell.base[i]) return(0); break; @@ -7403,7 +7403,7 @@ int16 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel float Bot::GetProcChances(float ProcBonus, uint16 hand) { int mydex = GetDEX(); float ProcChance = 0.0f; - uint16 weapon_speed = 0; + uint32 weapon_speed = 0; switch (hand) { case MainPrimary: weapon_speed = attack_timer.GetDuration(); @@ -7686,7 +7686,7 @@ void Bot::DoRiposte(Mob* defender) { defender->Attack(this, MainPrimary, true); //double riposte - int16 DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[0] + + int32 DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[0] + defender->GetSpellBonuses().GiveDoubleRiposte[0] + defender->GetItemBonuses().GiveDoubleRiposte[0]; @@ -8214,7 +8214,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { MonkSpecialAttack(target, skill_to_use); //Live AA - Technique of Master Wu - uint16 bDoubleSpecialAttack = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; + uint32 bDoubleSpecialAttack = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; if( bDoubleSpecialAttack && (bDoubleSpecialAttack >= 100 || bDoubleSpecialAttack > MakeRandomInt(0,100))) { int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; @@ -8800,7 +8800,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { target = this; int32 value_BaseEffect = 0; - int16 chance = 0; + int32 chance = 0; int8 modifier = 1; bool Critical = false; @@ -8950,7 +8950,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { - int16 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100; + int32 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100; // Doesnt generate mana, so best case is a free spell if(mana_back > cost) mana_back = cost; @@ -9011,7 +9011,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { } } - int16 focus_redux = GetBotFocusEffect(BotfocusManaCost, spell_id); + int32 focus_redux = GetBotFocusEffect(BotfocusManaCost, spell_id); if(focus_redux > 0) { @@ -9659,9 +9659,9 @@ int32 Bot::CalcManaRegenCap(){ } // Return max stat value for level -int16 Bot::GetMaxStat() { +int32 Bot::GetMaxStat() { int level = GetLevel(); - int16 base = 0; + int32 base = 0; if (level < 61) { base = 255; @@ -9679,10 +9679,10 @@ int16 Bot::GetMaxStat() { return(base); } -int16 Bot::GetMaxResist() { +int32 Bot::GetMaxResist() { int level = GetLevel(); - int16 base = 500; + int32 base = 500; if(level > 60) base += ((level - 60) * 5); @@ -9690,89 +9690,89 @@ int16 Bot::GetMaxResist() { return base; } -int16 Bot::GetMaxSTR() { +int32 Bot::GetMaxSTR() { return GetMaxStat() + itembonuses.STRCapMod + spellbonuses.STRCapMod + aabonuses.STRCapMod; } -int16 Bot::GetMaxSTA() { +int32 Bot::GetMaxSTA() { return GetMaxStat() + itembonuses.STACapMod + spellbonuses.STACapMod + aabonuses.STACapMod; } -int16 Bot::GetMaxDEX() { +int32 Bot::GetMaxDEX() { return GetMaxStat() + itembonuses.DEXCapMod + spellbonuses.DEXCapMod + aabonuses.DEXCapMod; } -int16 Bot::GetMaxAGI() { +int32 Bot::GetMaxAGI() { return GetMaxStat() + itembonuses.AGICapMod + spellbonuses.AGICapMod + aabonuses.AGICapMod; } -int16 Bot::GetMaxINT() { +int32 Bot::GetMaxINT() { return GetMaxStat() + itembonuses.INTCapMod + spellbonuses.INTCapMod + aabonuses.INTCapMod; } -int16 Bot::GetMaxWIS() { +int32 Bot::GetMaxWIS() { return GetMaxStat() + itembonuses.WISCapMod + spellbonuses.WISCapMod + aabonuses.WISCapMod; } -int16 Bot::GetMaxCHA() { +int32 Bot::GetMaxCHA() { return GetMaxStat() + itembonuses.CHACapMod + spellbonuses.CHACapMod + aabonuses.CHACapMod; } -int16 Bot::GetMaxMR() { +int32 Bot::GetMaxMR() { return GetMaxResist() + itembonuses.MRCapMod + spellbonuses.MRCapMod + aabonuses.MRCapMod; } -int16 Bot::GetMaxPR() { +int32 Bot::GetMaxPR() { return GetMaxResist() + itembonuses.PRCapMod + spellbonuses.PRCapMod + aabonuses.PRCapMod; } -int16 Bot::GetMaxDR() { +int32 Bot::GetMaxDR() { return GetMaxResist() + itembonuses.DRCapMod + spellbonuses.DRCapMod + aabonuses.DRCapMod; } -int16 Bot::GetMaxCR() { +int32 Bot::GetMaxCR() { return GetMaxResist() + itembonuses.CRCapMod + spellbonuses.CRCapMod + aabonuses.CRCapMod; } -int16 Bot::GetMaxFR() { +int32 Bot::GetMaxFR() { return GetMaxResist() + itembonuses.FRCapMod + spellbonuses.FRCapMod + aabonuses.FRCapMod; } -int16 Bot::GetMaxCorrup() { +int32 Bot::GetMaxCorrup() { return GetMaxResist() + itembonuses.CorrupCapMod + spellbonuses.CorrupCapMod + aabonuses.CorrupCapMod; } -int16 Bot::CalcSTR() { - int16 val = STR + itembonuses.STR + spellbonuses.STR; +int32 Bot::CalcSTR() { + int32 val = STR + itembonuses.STR + spellbonuses.STR; - int16 mod = aabonuses.STR; + int32 mod = aabonuses.STR; if(val>255 && GetLevel() <= 60) val = 255; @@ -9788,10 +9788,10 @@ int16 Bot::CalcSTR() { return(STR); } -int16 Bot::CalcSTA() { - int16 val = STA + itembonuses.STA + spellbonuses.STA; +int32 Bot::CalcSTA() { + int32 val = STA + itembonuses.STA + spellbonuses.STA; - int16 mod = aabonuses.STA; + int32 mod = aabonuses.STA; if(val>255 && GetLevel() <= 60) val = 255; @@ -9807,9 +9807,9 @@ int16 Bot::CalcSTA() { return(STA); } -int16 Bot::CalcAGI() { - int16 val = AGI + itembonuses.AGI + spellbonuses.AGI; - int16 mod = aabonuses.AGI; +int32 Bot::CalcAGI() { + int32 val = AGI + itembonuses.AGI + spellbonuses.AGI; + int32 mod = aabonuses.AGI; if(val>255 && GetLevel() <= 60) val = 255; @@ -9826,10 +9826,10 @@ int16 Bot::CalcAGI() { return(AGI); } -int16 Bot::CalcDEX() { - int16 val = DEX + itembonuses.DEX + spellbonuses.DEX; +int32 Bot::CalcDEX() { + int32 val = DEX + itembonuses.DEX + spellbonuses.DEX; - int16 mod = aabonuses.DEX; + int32 mod = aabonuses.DEX; if(val>255 && GetLevel() <= 60) val = 255; @@ -9845,10 +9845,10 @@ int16 Bot::CalcDEX() { return(DEX); } -int16 Bot::CalcINT() { - int16 val = INT + itembonuses.INT + spellbonuses.INT; +int32 Bot::CalcINT() { + int32 val = INT + itembonuses.INT + spellbonuses.INT; - int16 mod = aabonuses.INT; + int32 mod = aabonuses.INT; if(val>255 && GetLevel() <= 60) val = 255; @@ -9863,10 +9863,10 @@ int16 Bot::CalcINT() { return(INT); } -int16 Bot::CalcWIS() { - int16 val = WIS + itembonuses.WIS + spellbonuses.WIS; +int32 Bot::CalcWIS() { + int32 val = WIS + itembonuses.WIS + spellbonuses.WIS; - int16 mod = aabonuses.WIS; + int32 mod = aabonuses.WIS; if(val>255 && GetLevel() <= 60) val = 255; @@ -9882,10 +9882,10 @@ int16 Bot::CalcWIS() { return(WIS); } -int16 Bot::CalcCHA() { - int16 val = CHA + itembonuses.CHA + spellbonuses.CHA; +int32 Bot::CalcCHA() { + int32 val = CHA + itembonuses.CHA + spellbonuses.CHA; - int16 mod = aabonuses.CHA; + int32 mod = aabonuses.CHA; if(val>255 && GetLevel() <= 60) val = 255; @@ -9904,7 +9904,7 @@ int16 Bot::CalcCHA() { //The AA multipliers are set to be 5, but were 2 on WR //The resistant discipline which I think should be here is implemented //in Mob::ResistSpell -int16 Bot::CalcMR() +int32 Bot::CalcMR() { MR += itembonuses.MR + spellbonuses.MR + aabonuses.MR; @@ -9920,7 +9920,7 @@ int16 Bot::CalcMR() return(MR); } -int16 Bot::CalcFR() +int32 Bot::CalcFR() { int c = GetClass(); if(c == RANGER) { @@ -9942,7 +9942,7 @@ int16 Bot::CalcFR() return(FR); } -int16 Bot::CalcDR() +int32 Bot::CalcDR() { int c = GetClass(); if(c == PALADIN) { @@ -9971,7 +9971,7 @@ int16 Bot::CalcDR() return(DR); } -int16 Bot::CalcPR() +int32 Bot::CalcPR() { int c = GetClass(); if(c == ROGUE) { @@ -10000,7 +10000,7 @@ int16 Bot::CalcPR() return(PR); } -int16 Bot::CalcCR() +int32 Bot::CalcCR() { int c = GetClass(); if(c == RANGER) { @@ -10022,7 +10022,7 @@ int16 Bot::CalcCR() return(CR); } -int16 Bot::CalcCorrup() +int32 Bot::CalcCorrup() { Corrup = Corrup + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup; @@ -10032,7 +10032,7 @@ int16 Bot::CalcCorrup() return(Corrup); } -int16 Bot::CalcATK() { +int32 Bot::CalcATK() { ATK = itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); return(ATK); } diff --git a/zone/bot.h b/zone/bot.h index 42f347997..6e7b452af 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -174,8 +174,8 @@ public: virtual void DoRiposte(Mob* defender); inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - uint16 GetTotalATK(); - uint16 GetATKRating(); + uint32 GetTotalATK(); + uint32 GetATKRating(); uint16 GetPrimarySkillValue(); uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } @@ -238,35 +238,35 @@ public: void ClearHealRotationLeader() { _healRotationLeader = 0; } void ClearHealRotationMembers(); void ClearHealRotationTargets(); - inline virtual int16 GetMaxStat(); - inline virtual int16 GetMaxResist(); - inline virtual int16 GetMaxSTR(); - inline virtual int16 GetMaxSTA(); - inline virtual int16 GetMaxDEX(); - inline virtual int16 GetMaxAGI(); - inline virtual int16 GetMaxINT(); - inline virtual int16 GetMaxWIS(); - inline virtual int16 GetMaxCHA(); - inline virtual int16 GetMaxMR(); - inline virtual int16 GetMaxPR(); - inline virtual int16 GetMaxDR(); - inline virtual int16 GetMaxCR(); - inline virtual int16 GetMaxFR(); - inline virtual int16 GetMaxCorrup(); - int16 CalcATK(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); - int16 CalcMR(); - int16 CalcFR(); - int16 CalcDR(); - int16 CalcPR(); - int16 CalcCR(); - int16 CalcCorrup(); + inline virtual int32 GetMaxStat(); + inline virtual int32 GetMaxResist(); + inline virtual int32 GetMaxSTR(); + inline virtual int32 GetMaxSTA(); + inline virtual int32 GetMaxDEX(); + inline virtual int32 GetMaxAGI(); + inline virtual int32 GetMaxINT(); + inline virtual int32 GetMaxWIS(); + inline virtual int32 GetMaxCHA(); + inline virtual int32 GetMaxMR(); + inline virtual int32 GetMaxPR(); + inline virtual int32 GetMaxDR(); + inline virtual int32 GetMaxCR(); + inline virtual int32 GetMaxFR(); + inline virtual int32 GetMaxCorrup(); + int32 CalcATK(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); int32 CalcHPRegenCap(); int32 CalcManaRegenCap(); int32 LevelRegen(); @@ -466,56 +466,56 @@ public: uint32 GetHealRotationTimer () { return _healRotationTimer; } bool GetBardUseOutOfCombatSongs() { return _bardUseOutOfCombatSongs;} inline virtual int32 GetAC() const { return AC; } - inline virtual int16 GetSTR() const { return STR; } - inline virtual int16 GetSTA() const { return STA; } - inline virtual int16 GetDEX() const { return DEX; } - inline virtual int16 GetAGI() const { return AGI; } - inline virtual int16 GetINT() const { return INT; } - inline virtual int16 GetWIS() const { return WIS; } - inline virtual int16 GetCHA() const { return CHA; } - inline virtual int16 GetMR() const { return MR; } - inline virtual int16 GetFR() const { return FR; } - inline virtual int16 GetDR() const { return DR; } - inline virtual int16 GetPR() const { return PR; } - inline virtual int16 GetCR() const { return CR; } - inline virtual int16 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } //Heroic - inline virtual int16 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int16 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int16 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int16 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int16 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int16 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int16 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int16 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int16 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int16 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int16 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int16 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int16 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int16 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int16 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int16 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int16 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int16 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int16 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int16 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int16 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int16 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int16 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int16 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int16 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int16 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int16 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int16 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int16 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int16 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int16 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath; } inline InspectMessage_Struct& GetInspectMessage() { return _botInspectMessage; } inline const InspectMessage_Struct& GetInspectMessage() const { return _botInspectMessage; } @@ -556,13 +556,13 @@ public: protected: virtual void PetAIProcess(); - static NPCType FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender, float size, uint32 face, uint32 hairStyle, uint32 hairColor, uint32 eyeColor, uint32 eyeColor2, uint32 beardColor, uint32 beard, uint32 drakkinHeritage, uint32 drakkinTattoo, uint32 drakkinDetails, int32 hp, int32 mana, int16 mr, int16 cr, int16 dr, int16 fr, int16 pr, int16 corrup, int16 ac, uint16 str, uint16 sta, uint16 dex, uint16 agi, uint16 _int, uint16 wis, uint16 cha, uint16 attack); + static NPCType FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::string botLastName, uint8 botLevel, uint16 botRace, uint8 botClass, uint8 gender, float size, uint32 face, uint32 hairStyle, uint32 hairColor, uint32 eyeColor, uint32 eyeColor2, uint32 beardColor, uint32 beard, uint32 drakkinHeritage, uint32 drakkinTattoo, uint32 drakkinDetails, int32 hp, int32 mana, int32 mr, int32 cr, int32 dr, int32 fr, int32 pr, int32 corrup, int32 ac, uint32 str, uint32 sta, uint32 dex, uint32 agi, uint32 _int, uint32 wis, uint32 cha, uint32 attack); virtual void BotMeditate(bool isSitting); virtual void BotRangedAttack(Mob* other); virtual bool CheckBotDoubleAttack(bool Triple = false); - virtual int16 GetBotFocusEffect(BotfocusType bottype, uint16 spell_id); - virtual int16 CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus=false); - virtual int16 CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id); + virtual int32 GetBotFocusEffect(BotfocusType bottype, uint16 spell_id); + virtual int32 CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus=false); + virtual int32 CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id); virtual void PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* client); virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0); virtual float GetMaxMeleeRangeToTarget(Mob* target); @@ -601,7 +601,7 @@ private: int32 base_end; int32 cur_end; int32 max_end; - int16 end_regen; + int32 end_regen; uint32 timers[MaxTimer]; bool _hasBeenSummoned; float _preSummonX; @@ -626,26 +626,26 @@ private: bool _bardUseOutOfCombatSongs; // Private "base stats" Members - int16 _baseMR; - int16 _baseCR; - int16 _baseDR; - int16 _baseFR; - int16 _basePR; - int16 _baseCorrup; - int _baseAC; - int16 _baseSTR; - int16 _baseSTA; - int16 _baseDEX; - int16 _baseAGI; - int16 _baseINT; - int16 _baseWIS; - int16 _baseCHA; - int16 _baseATK; + int32 _baseMR; + int32 _baseCR; + int32 _baseDR; + int32 _baseFR; + int32 _basePR; + int32 _baseCorrup; + int32 _baseAC; + int32 _baseSTR; + int32 _baseSTA; + int32 _baseDEX; + int32 _baseAGI; + int32 _baseINT; + int32 _baseWIS; + int32 _baseCHA; + int32 _baseATK; uint16 _baseRace; // Necessary to preserve the race otherwise bots get their race updated in the db when they get an illusion. uint8 _baseGender; // Bots gender. Necessary to preserve the original value otherwise it can be changed by illusions. // Class Methods - int16 acmod(); + int32 acmod(); void GenerateBaseStats(); void GenerateAppearance(); void GenerateArmorClass(); @@ -670,8 +670,8 @@ private: void SavePetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId); void LoadPetItems(uint32* petItems, uint32 botPetSaveId); void SavePetItems(uint32* petItems, uint32 botPetSaveId); - void LoadPetStats(std::string* petName, uint16* petMana, uint16* petHitPoints, uint32* botPetId, uint32 botPetSaveId); - uint32 SavePetStats(std::string petName, uint16 petMana, uint16 petHitPoints, uint32 botPetId); + void LoadPetStats(std::string* petName, uint32* petMana, uint32* petHitPoints, uint32* botPetId, uint32 botPetSaveId); + uint32 SavePetStats(std::string petName, uint32 petMana, uint32 petHitPoints, uint32 botPetId); void LoadPet(); // Load and spawn bot pet if there is one void SavePet(); // Save and depop bot pet if there is one uint32 GetPetSaveId(); diff --git a/zone/client.cpp b/zone/client.cpp index 4ba0cf9f1..b45223263 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2312,7 +2312,7 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if (skillval < maxskill) { // the higher your current skill level, the harder it is - int16 Chance = 10 + chancemodi + ((252 - skillval) / 20); + int32 Chance = 10 + chancemodi + ((252 - skillval) / 20); Chance = (Chance * RuleI(Character, SkillUpModifier) / 100); @@ -2346,7 +2346,7 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { int LangSkill = m_pp.languages[langid]; // get current language skill if (LangSkill < 100) { // if the language isn't already maxed - int16 Chance = 5 + ((TeacherSkill - LangSkill)/10); // greater chance to learn if teacher's skill is much higher than yours + int32 Chance = 5 + ((TeacherSkill - LangSkill)/10); // greater chance to learn if teacher's skill is much higher than yours Chance = (Chance * RuleI(Character, SkillUpModifier)/100); if(MakeRandomFloat(0,100) < Chance) { // if they make the roll @@ -4163,10 +4163,10 @@ uint16 Client::GetPrimarySkillValue() return GetSkill(skill); } -uint16 Client::GetTotalATK() +uint32 Client::GetTotalATK() { - uint16 AttackRating = 0; - uint16 WornCap = itembonuses.ATK; + uint32 AttackRating = 0; + uint32 WornCap = itembonuses.ATK; if(IsClient()) { AttackRating = ((WornCap * 1.342) + (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69)); @@ -4183,9 +4183,9 @@ uint16 Client::GetTotalATK() return AttackRating; } -uint16 Client::GetATKRating() +uint32 Client::GetATKRating() { - uint16 AttackRating = 0; + uint32 AttackRating = 0; if(IsClient()) { AttackRating = (GetSkill(SkillOffense) * 1.345) + ((GetSTR() - 66) * 0.9) + (GetPrimarySkillValue() * 2.69); @@ -8087,9 +8087,9 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ { if(!item) { return; } - uint16 cons_mod = 180; + uint32 cons_mod = 180; - int16 metabolism_bonus = spellbonuses.Metabolism + itembonuses.Metabolism + aabonuses.Metabolism; + int32 metabolism_bonus = spellbonuses.Metabolism + itembonuses.Metabolism + aabonuses.Metabolism; if (metabolism_bonus) cons_mod = cons_mod * metabolism_bonus * RuleI(Character, ConsumptionMultiplier) / 10000; diff --git a/zone/client.h b/zone/client.h index da3d8c1ea..16e7b82dd 100644 --- a/zone/client.h +++ b/zone/client.h @@ -409,35 +409,35 @@ public: inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; - inline virtual int16 GetSTR() const { return STR; } - inline virtual int16 GetSTA() const { return STA; } - inline virtual int16 GetDEX() const { return DEX; } - inline virtual int16 GetAGI() const { return AGI; } - inline virtual int16 GetINT() const { return INT; } - inline virtual int16 GetWIS() const { return WIS; } - inline virtual int16 GetCHA() const { return CHA; } - inline virtual int16 GetMR() const { return MR; } - inline virtual int16 GetFR() const { return FR; } - inline virtual int16 GetDR() const { return DR; } - inline virtual int16 GetPR() const { return PR; } - inline virtual int16 GetCR() const { return CR; } - inline virtual int16 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - int16 GetMaxStat() const; - int16 GetMaxResist() const; - int16 GetMaxSTR() const; - int16 GetMaxSTA() const; - int16 GetMaxDEX() const; - int16 GetMaxAGI() const; - int16 GetMaxINT() const; - int16 GetMaxWIS() const; - int16 GetMaxCHA() const; - int16 GetMaxMR() const; - int16 GetMaxPR() const; - int16 GetMaxDR() const; - int16 GetMaxCR() const; - int16 GetMaxFR() const; - int16 GetMaxCorrup() const; + int32 GetMaxStat() const; + int32 GetMaxResist() const; + int32 GetMaxSTR() const; + int32 GetMaxSTA() const; + int32 GetMaxDEX() const; + int32 GetMaxAGI() const; + int32 GetMaxINT() const; + int32 GetMaxWIS() const; + int32 GetMaxCHA() const; + int32 GetMaxMR() const; + int32 GetMaxPR() const; + int32 GetMaxDR() const; + int32 GetMaxCR() const; + int32 GetMaxFR() const; + int32 GetMaxCorrup() const; inline uint8 GetBaseSTR() const { return m_pp.STR; } inline uint8 GetBaseSTA() const { return m_pp.STA; } inline uint8 GetBaseCHA() const { return m_pp.CHA; } @@ -447,42 +447,42 @@ public: inline uint8 GetBaseWIS() const { return m_pp.WIS; } inline uint8 GetBaseCorrup() const { return 15; } // Same for all - inline virtual int16 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int16 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int16 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int16 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int16 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int16 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int16 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int16 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int16 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int16 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int16 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int16 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int16 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int16 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int16 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int16 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int16 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int16 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int16 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int16 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int16 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int16 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int16 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int16 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int16 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int16 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int16 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int16 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int16 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int16 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int16 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); @@ -529,8 +529,8 @@ public: void DoEnduranceUpkeep(); //does the endurance upkeep //This calculates total Attack Rating to match very close to what the client should show - uint16 GetTotalATK(); - uint16 GetATKRating(); + uint32 GetTotalATK(); + uint32 GetATKRating(); //This gets the skill value of the item type equiped in the Primary Slot uint16 GetPrimarySkillValue(); @@ -606,7 +606,7 @@ public: void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); - int16 GetRawItemAC(); + int32 GetRawItemAC(); uint16 GetCombinedAC_TEST(); inline uint32 LSAccountID() const { return lsaccountid; } @@ -787,7 +787,7 @@ public: int32 GetAAEffectid(uint32 aa_ID, uint32 slot_id) { return GetAAEffectDataBySlot(aa_ID, slot_id, true, false,false); } int32 GetAABase1(uint32 aa_ID, uint32 slot_id) { return GetAAEffectDataBySlot(aa_ID, slot_id, false, true,false); } int32 GetAABase2(uint32 aa_ID, uint32 slot_id) { return GetAAEffectDataBySlot(aa_ID, slot_id, false, false,true); } - int16 acmod(); + int32 acmod(); // Item methods void EVENT_ITEM_ScriptStopReturn(); @@ -1172,13 +1172,13 @@ public: void TryItemTimer(int slot); void SendItemScale(ItemInst *inst); - int16 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); } - int16 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); } - int16 GetActDEX() { return( std::min(GetMaxDEX(), GetDEX()) ); } - int16 GetActAGI() { return( std::min(GetMaxAGI(), GetAGI()) ); } - int16 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); } - int16 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); } - int16 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } + int32 GetActSTR() { return( std::min(GetMaxSTR(), GetSTR()) ); } + int32 GetActSTA() { return( std::min(GetMaxSTA(), GetSTA()) ); } + int32 GetActDEX() { return( std::min(GetMaxDEX(), GetDEX()) ); } + int32 GetActAGI() { return( std::min(GetMaxAGI(), GetAGI()) ); } + int32 GetActINT() { return( std::min(GetMaxINT(), GetINT()) ); } + int32 GetActWIS() { return( std::min(GetMaxWIS(), GetWIS()) ); } + int32 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } void LoadAccountFlags(); void SetAccountFlag(std::string flag, std::string val); std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); @@ -1276,27 +1276,27 @@ private: void HandleTraderPriceUpdate(const EQApplicationPacket *app); - int16 CalcAC(); - int16 GetACMit(); - int16 GetACAvoid(); - int16 CalcATK(); - int CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 CalcATK(); + int32 CalcHaste(); - int16 CalcAlcoholPhysicalEffect(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); + int32 CalcAlcoholPhysicalEffect(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int16 CalcMR(); - int16 CalcFR(); - int16 CalcDR(); - int16 CalcPR(); - int16 CalcCR(); - int16 CalcCorrup(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); int32 CalcMaxHP(); int32 CalcBaseHP(); int32 CalcHPRegen(); diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 1540b2a5f..5431b2dfe 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -35,14 +35,14 @@ // Return max stat value for level -int16 Client::GetMaxStat() const { +int32 Client::GetMaxStat() const { if((RuleI(Character, StatCap)) > 0) return (RuleI(Character, StatCap)); int level = GetLevel(); - int16 base = 0; + int32 base = 0; if (level < 61) { base = 255; @@ -60,11 +60,11 @@ int16 Client::GetMaxStat() const { return(base); } -int16 Client::GetMaxResist() const +int32 Client::GetMaxResist() const { int level = GetLevel(); - int16 base = 500; + int32 base = 500; if(level > 60) base += ((level - 60) * 5); @@ -72,79 +72,79 @@ int16 Client::GetMaxResist() const return base; } -int16 Client::GetMaxSTR() const { +int32 Client::GetMaxSTR() const { return GetMaxStat() + itembonuses.STRCapMod + spellbonuses.STRCapMod + aabonuses.STRCapMod; } -int16 Client::GetMaxSTA() const { +int32 Client::GetMaxSTA() const { return GetMaxStat() + itembonuses.STACapMod + spellbonuses.STACapMod + aabonuses.STACapMod; } -int16 Client::GetMaxDEX() const { +int32 Client::GetMaxDEX() const { return GetMaxStat() + itembonuses.DEXCapMod + spellbonuses.DEXCapMod + aabonuses.DEXCapMod; } -int16 Client::GetMaxAGI() const { +int32 Client::GetMaxAGI() const { return GetMaxStat() + itembonuses.AGICapMod + spellbonuses.AGICapMod + aabonuses.AGICapMod; } -int16 Client::GetMaxINT() const { +int32 Client::GetMaxINT() const { return GetMaxStat() + itembonuses.INTCapMod + spellbonuses.INTCapMod + aabonuses.INTCapMod; } -int16 Client::GetMaxWIS() const { +int32 Client::GetMaxWIS() const { return GetMaxStat() + itembonuses.WISCapMod + spellbonuses.WISCapMod + aabonuses.WISCapMod; } -int16 Client::GetMaxCHA() const { +int32 Client::GetMaxCHA() const { return GetMaxStat() + itembonuses.CHACapMod + spellbonuses.CHACapMod + aabonuses.CHACapMod; } -int16 Client::GetMaxMR() const { +int32 Client::GetMaxMR() const { return GetMaxResist() + itembonuses.MRCapMod + spellbonuses.MRCapMod + aabonuses.MRCapMod; } -int16 Client::GetMaxPR() const { +int32 Client::GetMaxPR() const { return GetMaxResist() + itembonuses.PRCapMod + spellbonuses.PRCapMod + aabonuses.PRCapMod; } -int16 Client::GetMaxDR() const { +int32 Client::GetMaxDR() const { return GetMaxResist() + itembonuses.DRCapMod + spellbonuses.DRCapMod + aabonuses.DRCapMod; } -int16 Client::GetMaxCR() const { +int32 Client::GetMaxCR() const { return GetMaxResist() + itembonuses.CRCapMod + spellbonuses.CRCapMod + aabonuses.CRCapMod; } -int16 Client::GetMaxFR() const { +int32 Client::GetMaxFR() const { return GetMaxResist() + itembonuses.FRCapMod + spellbonuses.FRCapMod + aabonuses.FRCapMod; } -int16 Client::GetMaxCorrup() const { +int32 Client::GetMaxCorrup() const { return GetMaxResist() + itembonuses.CorrupCapMod + spellbonuses.CorrupCapMod @@ -265,8 +265,8 @@ int32 Client::CalcMaxHP() { return max_hp; } -uint16 Mob::GetClassLevelFactor(){ - uint16 multiplier = 0; +uint32 Mob::GetClassLevelFactor(){ + uint32 multiplier = 0; uint8 mlevel=GetLevel(); switch(GetClass()) { @@ -386,8 +386,8 @@ int32 Client::CalcBaseHP() } } else { - uint16 Post255; - uint16 lm=GetClassLevelFactor(); + uint32 Post255; + uint32 lm=GetClassLevelFactor(); if((GetSTA()-255)/2 > 0) Post255 = (GetSTA()-255)/2; else @@ -446,8 +446,8 @@ uint32 Client::GetClassHPFactor() { } // This should return the combined AC of all the items the player is wearing. -int16 Client::GetRawItemAC() { - int16 Total = 0; +int32 Client::GetRawItemAC() { + int32 Total = 0; // this skips MainAmmo..add an '=' conditional if that slot is required (original behavior) for (int16 slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id < EmuConstants::EQUIPMENT_END; slot_id++) { @@ -460,7 +460,7 @@ int16 Client::GetRawItemAC() { return Total; } -int16 Client::acmod() { +int32 Client::acmod() { int agility = GetAGI(); int level = GetLevel(); if(agility < 1 || level < 1) @@ -838,7 +838,7 @@ int16 Client::acmod() { // ac1 and ac2 are probably the damage migitation and damage avoidance numbers, not sure which is which. // I forgot to include the iksar defense bonus and i cant find my notes now... // AC from spells are not included (cant even cast spells yet..) -int16 Client::CalcAC() { +int32 Client::CalcAC() { // new formula int avoidance = (acmod() + ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10)*16)/9); @@ -889,7 +889,7 @@ int16 Client::CalcAC() { return(AC); } -int16 Client::GetACMit() { +int32 Client::GetACMit() { int mitigation = 0; if (m_pp.class_ == WIZARD || m_pp.class_ == MAGICIAN || m_pp.class_ == NECROMANCER || m_pp.class_ == ENCHANTER) { @@ -915,9 +915,9 @@ int16 Client::GetACMit() { return(mitigation*1000/847); } -int16 Client::GetACAvoid() { +int32 Client::GetACAvoid() { - int avoidance = (acmod() + ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10)*16)/9); + int32 avoidance = (acmod() + ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10)*16)/9); if (avoidance < 0) avoidance = 0; @@ -1186,7 +1186,7 @@ uint32 Client::CalcCurrentWeight() { return Total; } -int16 Client::CalcAlcoholPhysicalEffect() +int32 Client::CalcAlcoholPhysicalEffect() { if(m_pp.intoxication <= 55) return 0; @@ -1194,10 +1194,10 @@ int16 Client::CalcAlcoholPhysicalEffect() return (m_pp.intoxication - 40) / 16; } -int16 Client::CalcSTR() { - int16 val = m_pp.STR + itembonuses.STR + spellbonuses.STR + CalcAlcoholPhysicalEffect(); +int32 Client::CalcSTR() { + int32 val = m_pp.STR + itembonuses.STR + spellbonuses.STR + CalcAlcoholPhysicalEffect(); - int16 mod = aabonuses.STR; + int32 mod = aabonuses.STR; STR = val + mod; @@ -1211,10 +1211,10 @@ int16 Client::CalcSTR() { return(STR); } -int16 Client::CalcSTA() { - int16 val = m_pp.STA + itembonuses.STA + spellbonuses.STA + CalcAlcoholPhysicalEffect();; +int32 Client::CalcSTA() { + int32 val = m_pp.STA + itembonuses.STA + spellbonuses.STA + CalcAlcoholPhysicalEffect();; - int16 mod = aabonuses.STA; + int32 mod = aabonuses.STA; STA = val + mod; @@ -1228,18 +1228,18 @@ int16 Client::CalcSTA() { return(STA); } -int16 Client::CalcAGI() { - int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();; - int16 mod = aabonuses.AGI; +int32 Client::CalcAGI() { + int32 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();; + int32 mod = aabonuses.AGI; - int16 str = GetSTR(); + int32 str = GetSTR(); //Encumbered penalty if(weight > (str * 10)) { //AGI is halved when we double our weight, zeroed (defaults to 1) when we triple it. this includes AGI from AAs float total_agi = float(val + mod); float str_float = float(str); - AGI = (int16)(((-total_agi) / (str_float * 2)) * (((float)weight / 10) - str_float) + total_agi); //casting to an int assumes this will be floor'd. without using floats & casting to int16, the calculation doesn't work right + AGI = (int32)(((-total_agi) / (str_float * 2)) * (((float)weight / 10) - str_float) + total_agi); //casting to an int assumes this will be floor'd. without using floats & casting to int16, the calculation doesn't work right } else AGI = val + mod; @@ -1253,10 +1253,10 @@ int16 Client::CalcAGI() { return(AGI); } -int16 Client::CalcDEX() { - int16 val = m_pp.DEX + itembonuses.DEX + spellbonuses.DEX - CalcAlcoholPhysicalEffect();; +int32 Client::CalcDEX() { + int32 val = m_pp.DEX + itembonuses.DEX + spellbonuses.DEX - CalcAlcoholPhysicalEffect();; - int16 mod = aabonuses.DEX; + int32 mod = aabonuses.DEX; DEX = val + mod; @@ -1270,16 +1270,16 @@ int16 Client::CalcDEX() { return(DEX); } -int16 Client::CalcINT() { - int16 val = m_pp.INT + itembonuses.INT + spellbonuses.INT; +int32 Client::CalcINT() { + int32 val = m_pp.INT + itembonuses.INT + spellbonuses.INT; - int16 mod = aabonuses.INT; + int32 mod = aabonuses.INT; INT = val + mod; if(m_pp.intoxication) { - int16 AlcINT = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1; + int32 AlcINT = INT - (int32)((float)m_pp.intoxication / 200.0f * (float)INT) - 1; if((AlcINT < (int)(0.2 * INT))) INT = (int)(0.2f * (float)INT); @@ -1297,16 +1297,16 @@ int16 Client::CalcINT() { return(INT); } -int16 Client::CalcWIS() { - int16 val = m_pp.WIS + itembonuses.WIS + spellbonuses.WIS; +int32 Client::CalcWIS() { + int32 val = m_pp.WIS + itembonuses.WIS + spellbonuses.WIS; - int16 mod = aabonuses.WIS; + int32 mod = aabonuses.WIS; WIS = val + mod; if(m_pp.intoxication) { - int16 AlcWIS = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1; + int32 AlcWIS = WIS - (int32)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1; if((AlcWIS < (int)(0.2 * WIS))) WIS = (int)(0.2f * (float)WIS); @@ -1324,10 +1324,10 @@ int16 Client::CalcWIS() { return(WIS); } -int16 Client::CalcCHA() { - int16 val = m_pp.CHA + itembonuses.CHA + spellbonuses.CHA; +int32 Client::CalcCHA() { + int32 val = m_pp.CHA + itembonuses.CHA + spellbonuses.CHA; - int16 mod = aabonuses.CHA; + int32 mod = aabonuses.CHA; CHA = val + mod; @@ -1416,7 +1416,7 @@ int Client::CalcHaste() //The AA multipliers are set to be 5, but were 2 on WR //The resistant discipline which I think should be here is implemented //in Mob::ResistSpell -int16 Client::CalcMR() +int32 Client::CalcMR() { //racial bases switch(GetBaseRace()) { @@ -1486,7 +1486,7 @@ int16 Client::CalcMR() return(MR); } -int16 Client::CalcFR() +int32 Client::CalcFR() { //racial bases switch(GetBaseRace()) { @@ -1562,7 +1562,7 @@ int16 Client::CalcFR() return(FR); } -int16 Client::CalcDR() +int32 Client::CalcDR() { //racial bases switch(GetBaseRace()) { @@ -1645,7 +1645,7 @@ int16 Client::CalcDR() return(DR); } -int16 Client::CalcPR() +int32 Client::CalcPR() { //racial bases switch(GetBaseRace()) { @@ -1728,7 +1728,7 @@ int16 Client::CalcPR() return(PR); } -int16 Client::CalcCR() +int32 Client::CalcCR() { //racial bases switch(GetBaseRace()) { @@ -1804,7 +1804,7 @@ int16 Client::CalcCR() return(CR); } -int16 Client::CalcCorrup() +int32 Client::CalcCorrup() { Corrup = GetBaseCorrup() + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup; @@ -1814,17 +1814,17 @@ int16 Client::CalcCorrup() return(Corrup); } -int16 Client::CalcATK() { +int32 Client::CalcATK() { ATK = itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); return(ATK); } -uint16 Mob::GetInstrumentMod(uint16 spell_id) const +uint32 Mob::GetInstrumentMod(uint16 spell_id) const { if (GetClass() != BARD) return 10; - uint16 effectmod = 10; + uint32 effectmod = 10; int effectmodcap = RuleI(Character, BaseInstrumentSoftCap); //this should never use spell modifiers... diff --git a/zone/common.h b/zone/common.h index e5628c756..436cd6699 100644 --- a/zone/common.h +++ b/zone/common.h @@ -192,7 +192,7 @@ struct Buffs_Struct { }; struct StatBonuses { - int16 AC; + int32 AC; int32 HP; int32 HPRegen; int32 MaxHP; @@ -200,47 +200,47 @@ struct StatBonuses { int32 EnduranceRegen; int32 Mana; int32 Endurance; - int16 ATK; + int32 ATK; //would it be worth it to create a Stat_Struct? - int16 STR; - int16 STRCapMod; - int16 HeroicSTR; - int16 STA; - int16 STACapMod; - int16 HeroicSTA; - int16 DEX; - int16 DEXCapMod; - int16 HeroicDEX; - int16 AGI; - int16 AGICapMod; - int16 HeroicAGI; - int16 INT; - int16 INTCapMod; - int16 HeroicINT; - int16 WIS; - int16 WISCapMod; - int16 HeroicWIS; - int16 CHA; - int16 CHACapMod; - int16 HeroicCHA; - int16 MR; - int16 MRCapMod; - int16 HeroicMR; - int16 FR; - int16 FRCapMod; - int16 HeroicFR; - int16 CR; - int16 CRCapMod; - int16 HeroicCR; - int16 PR; - int16 PRCapMod; - int16 HeroicPR; - int16 DR; - int16 DRCapMod; - int16 HeroicDR; - int16 Corrup; - int16 CorrupCapMod; - int16 HeroicCorrup; + int32 STR; + int32 STRCapMod; + int32 HeroicSTR; + int32 STA; + int32 STACapMod; + int32 HeroicSTA; + int32 DEX; + int32 DEXCapMod; + int32 HeroicDEX; + int32 AGI; + int32 AGICapMod; + int32 HeroicAGI; + int32 INT; + int32 INTCapMod; + int32 HeroicINT; + int32 WIS; + int32 WISCapMod; + int32 HeroicWIS; + int32 CHA; + int32 CHACapMod; + int32 HeroicCHA; + int32 MR; + int32 MRCapMod; + int32 HeroicMR; + int32 FR; + int32 FRCapMod; + int32 HeroicFR; + int32 CR; + int32 CRCapMod; + int32 HeroicCR; + int32 PR; + int32 PRCapMod; + int32 HeroicPR; + int32 DR; + int32 DRCapMod; + int32 HeroicDR; + int32 Corrup; + int32 CorrupCapMod; + int32 HeroicCorrup; uint16 DamageShieldSpellID; int DamageShield; // this is damage done to mobs that attack this DmgShieldType DamageShieldType; @@ -250,91 +250,91 @@ struct StatBonuses { uint16 ReverseDamageShieldSpellID; DmgShieldType ReverseDamageShieldType; int movementspeed; - int16 haste; - int16 hastetype2; - int16 hastetype3; - int16 inhibitmelee; + int32 haste; + int32 hastetype2; + int32 hastetype3; + int32 inhibitmelee; float AggroRange; // when calculate just replace original value with this float AssistRange; - int16 skillmod[HIGHEST_SKILL+1]; + int32 skillmod[HIGHEST_SKILL+1]; int effective_casting_level; int reflect_chance; // chance to reflect incoming spell - uint16 singingMod; - uint16 Amplification; // stacks with singingMod - uint16 brassMod; - uint16 percussionMod; - uint16 windMod; - uint16 stringedMod; - uint16 songModCap; + uint32 singingMod; + uint32 Amplification; // stacks with singingMod + uint32 brassMod; + uint32 percussionMod; + uint32 windMod; + uint32 stringedMod; + uint32 songModCap; int8 hatemod; int32 EnduranceReduction; - int16 StrikeThrough; // PoP: Strike Through % - int16 MeleeMitigation; //i = Shielding - int16 MeleeMitigationEffect; //i = Spell Effect Melee Mitigation - int16 CriticalHitChance[HIGHEST_SKILL+2]; //i - int16 CriticalSpellChance; //i - int16 SpellCritDmgIncrease; //i - int16 SpellCritDmgIncNoStack; // increase - int16 DotCritDmgIncrease; //i - int16 CriticalHealChance; //i - int16 CriticalHealOverTime; //i - int16 CriticalDoTChance; //i - int16 CrippBlowChance; // - int16 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance (item mod) - int16 AvoidMeleeChanceEffect; //AvoidMeleeChance Spell Effect - int16 RiposteChance; //i - int16 DodgeChance; //i - int16 ParryChance; //i - int16 DualWieldChance; //i - int16 DoubleAttackChance; //i - int16 TripleAttackChance; //i - int16 DoubleRangedAttack; //i - int16 ResistSpellChance; //i - int16 ResistFearChance; //i + int32 StrikeThrough; // PoP: Strike Through % + int32 MeleeMitigation; //i = Shielding + int32 MeleeMitigationEffect; //i = Spell Effect Melee Mitigation + int32 CriticalHitChance[HIGHEST_SKILL+2]; //i + int32 CriticalSpellChance; //i + int32 SpellCritDmgIncrease; //i + int32 SpellCritDmgIncNoStack; // increase + int32 DotCritDmgIncrease; //i + int32 CriticalHealChance; //i + int32 CriticalHealOverTime; //i + int32 CriticalDoTChance; //i + int32 CrippBlowChance; // + int32 AvoidMeleeChance; //AvoidMeleeChance/10 == % chance i = Avoidance (item mod) + int32 AvoidMeleeChanceEffect; //AvoidMeleeChance Spell Effect + int32 RiposteChance; //i + int32 DodgeChance; //i + int32 ParryChance; //i + int32 DualWieldChance; //i + int32 DoubleAttackChance; //i + int32 TripleAttackChance; //i + int32 DoubleRangedAttack; //i + int32 ResistSpellChance; //i + int32 ResistFearChance; //i bool Fearless; //i bool IsFeared; //i bool IsBlind; //i - int16 StunResist; //i - int16 MeleeSkillCheck; //i + int32 StunResist; //i + int32 MeleeSkillCheck; //i uint8 MeleeSkillCheckSkill; - int16 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy) - int16 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase - int16 DamageModifier[HIGHEST_SKILL+2]; //i - int16 DamageModifier2[HIGHEST_SKILL+2]; //i - int16 MinDamageModifier[HIGHEST_SKILL+2]; //i - int16 ProcChance; // ProcChance/10 == % increase i = CombatEffects - int16 ProcChanceSPA; // ProcChance from spell effects - int16 ExtraAttackChance; - int16 DoTShielding; - int16 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger) - uint16 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt - int16 FlurryChance; - int16 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) - int16 HundredHands; //extra haste, stacks with all other haste i + int32 HitChance; //HitChance/15 == % increase i = Accuracy (Item: Accuracy) + int32 HitChanceEffect[HIGHEST_SKILL+2]; //Spell effect Chance to Hit, straight percent increase + int32 DamageModifier[HIGHEST_SKILL+2]; //i + int32 DamageModifier2[HIGHEST_SKILL+2]; //i + int32 MinDamageModifier[HIGHEST_SKILL+2]; //i + int32 ProcChance; // ProcChance/10 == % increase i = CombatEffects + int32 ProcChanceSPA; // ProcChance from spell effects + int32 ExtraAttackChance; + int32 DoTShielding; + int32 DivineSaveChance[2]; // Second Chance (base1 = chance, base2 = spell on trigger) + uint32 DeathSave[4]; // Death Pact [0](value = 1 partial 2 = full) [1]=slot [2]=LvLimit [3]=HealAmt + int32 FlurryChance; + int32 Accuracy[HIGHEST_SKILL+2]; //Accuracy/15 == % increase [Spell Effect: Accuracy) + int32 HundredHands; //extra haste, stacks with all other haste i int32 MeleeLifetap; //i int32 Vampirism; //i - int16 HealRate; // Spell effect that influences effectiveness of heals + int32 HealRate; // Spell effect that influences effectiveness of heals int32 MaxHPChange; // Spell Effect int16 SkillDmgTaken[HIGHEST_SKILL+2]; // All Skills + -1 int32 HealAmt; // Item Effect int32 SpellDmg; // Item Effect int32 Clairvoyance; // Item Effect - int16 DSMitigation; // Item Effect - int16 DSMitigationOffHand; // Lowers damage shield from off hand attacks. + int32 DSMitigation; // Item Effect + int32 DSMitigationOffHand; // Lowers damage shield from off hand attacks. uint32 SpellTriggers[MAX_SPELL_TRIGGER]; // Innate/Spell/Item Spells that trigger when you cast uint32 SpellOnKill[MAX_SPELL_TRIGGER*3]; // Chance to proc after killing a mob uint32 SpellOnDeath[MAX_SPELL_TRIGGER*2]; // Chance to have effect cast when you die - int16 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1 - int16 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers - int16 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1 - int16 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon - uint16 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect) - int16 GravityEffect; // Indictor of spell effect + int32 CritDmgMob[HIGHEST_SKILL+2]; // All Skills + -1 + int32 SkillReuseTime[HIGHEST_SKILL+1]; // Reduces skill timers + int32 SkillDamageAmount[HIGHEST_SKILL+2]; // All Skills + -1 + int32 TwoHandBluntBlock; // chance to block when wielding two hand blunt weapon + uint32 ItemManaRegenCap; // Increases the amount of mana you have can over the cap(aa effect) + int32 GravityEffect; // Indictor of spell effect bool AntiGate; // spell effect that prevents gating bool MagicWeapon; // spell effect that makes weapon magical - int16 IncreaseBlockChance; // overall block chance modifier - uint16 PersistantCasting; // chance to continue casting through a stun + int32 IncreaseBlockChance; // overall block chance modifier + uint32 PersistantCasting; // chance to continue casting through a stun int XPRateMod; //i int HPPercCap[2]; //Spell effect that limits you to being healed/regening beyond a % of your max int ManaPercCap[2]; // ^^ 0 = % Cap 1 = Flat Amount Cap @@ -342,64 +342,64 @@ struct StatBonuses { bool BlockNextSpell; // Indicates whether the client can block a spell or not //uint16 BlockSpellEffect[EFFECT_COUNT]; // Prevents spells with certain effects from landing on you *no longer used bool ImmuneToFlee; // Bypass the fleeing flag - uint16 VoiceGraft; // Stores the ID of the mob with which to talk through - int16 SpellProcChance; // chance to proc from sympathetic spell effects - int16 CharmBreakChance; // chance to break charm - int16 SongRange; // increases range of beneficial bard songs - uint16 HPToManaConvert; // Uses HP to cast spells at specific conversion - uint16 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. + uint32 VoiceGraft; // Stores the ID of the mob with which to talk through + int32 SpellProcChance; // chance to proc from sympathetic spell effects + int32 CharmBreakChance; // chance to break charm + int32 SongRange; // increases range of beneficial bard songs + uint32 HPToManaConvert; // Uses HP to cast spells at specific conversion + uint32 FocusEffects[HIGHEST_FOCUS+1]; // Stores the focus effectid for each focustype you have. bool NegateEffects; // Check if you contain a buff with negate effect. (only spellbonuses) - int16 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage - uint16 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit - uint16 MitigateMeleeRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per hit 3 = Rune Amt - uint16 MeleeThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. - uint16 SpellThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. - uint16 MitigateSpellRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per spell 3 = Rune Amt - uint16 MitigateDotRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per tick 3 = Rune Amt + int32 SkillDamageAmount2[HIGHEST_SKILL+2]; // Adds skill specific damage + uint32 NegateAttacks[3]; // 0 = bool HasEffect 1 = Buff Slot 2 = Max damage absorbed per hit + uint32 MitigateMeleeRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per hit 3 = Rune Amt + uint32 MeleeThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. + uint32 SpellThresholdGuard[3]; // 0 = Mitigation value 1 = Buff Slot 2 = Min damage to trigger. + uint32 MitigateSpellRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per spell 3 = Rune Amt + uint32 MitigateDotRune[4]; // 0 = Mitigation value 1 = Buff Slot 2 = Max mitigation per tick 3 = Rune Amt bool TriggerMeleeThreshold; // Has Melee Threshhold bool TriggerSpellThreshold; // Has Spell Threshhold - uint16 ManaAbsorbPercentDamage[2]; // 0 = Mitigation value 1 = Buff Slot - int16 ShieldBlock; // Chance to Shield Block - int16 BlockBehind; // Chance to Block Behind (with our without shield) + uint32 ManaAbsorbPercentDamage[2]; // 0 = Mitigation value 1 = Buff Slot + int32 ShieldBlock; // Chance to Shield Block + int32 BlockBehind; // Chance to Block Behind (with our without shield) bool CriticalRegenDecay; // increase critical regen chance, decays based on spell level cast bool CriticalHealDecay; // increase critical heal chance, decays based on spell level cast bool CriticalDotDecay; // increase critical dot chance, decays based on spell level cast bool DivineAura; // invulnerability bool DistanceRemoval; // Check if Cancle if Moved effect is present - int16 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buffid + int32 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buffid int8 Root[2]; // The lowest buff slot a root can be found. [0] = Bool if has root [1] = buff slot - int16 FrenziedDevastation; // base1= AArank(used) base2= chance increase spell criticals + all DD spells 2x mana. - uint16 AbsorbMagicAtt[2]; // 0 = magic rune value 1 = buff slot - uint16 MeleeRune[2]; // 0 = rune value 1 = buff slot + int32 FrenziedDevastation; // base1= AArank(used) base2= chance increase spell criticals + all DD spells 2x mana. + uint32 AbsorbMagicAtt[2]; // 0 = magic rune value 1 = buff slot + uint32 MeleeRune[2]; // 0 = rune value 1 = buff slot bool NegateIfCombat; // Bool Drop buff if cast or melee int8 Screech; // -1 = Will be blocked if another Screech is +(1) - int16 AlterNPCLevel; // amount of lvls +/- - int16 AStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value - int16 BStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value - int16 CStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value - int16 DStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value + int32 AlterNPCLevel; // amount of lvls +/- + int32 AStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value + int32 BStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value + int32 CStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value + int32 DStacker[2]; // For buff stack blocking 0=Exists 1=Effect_value bool BerserkSPA; // berserk effect - int16 Metabolism; // Food/drink consumption rates. + int32 Metabolism; // Food/drink consumption rates. bool Sanctuary; // Sanctuary effect, lowers place on hate list until cast on others. - int16 FactionModPct; // Modifies amount of faction gained. - int16 MeleeVulnerability; // Weakness/mitigation to melee damage + int32 FactionModPct; // Modifies amount of faction gained. + int32 MeleeVulnerability; // Weakness/mitigation to melee damage bool LimitToSkill[HIGHEST_SKILL+2]; // Determines if we need to search for a skill proc. - uint16 SkillProc[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs. - uint16 SkillProcSuccess[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs_success. + uint32 SkillProc[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs. + uint32 SkillProcSuccess[MAX_SKILL_PROCS]; // Max number of spells containing skill_procs_success. // AAs int8 Packrat; //weight reduction for items, 1 point = 10% uint8 BuffSlotIncrease; // Increases number of available buff slots - uint16 DelayDeath; // how far below 0 hp you can go + uint32 DelayDeath; // how far below 0 hp you can go int8 BaseMovementSpeed; // Adjust base run speed, does not stack with other movement bonuses. uint8 IncreaseRunSpeedCap; // Increase max run speed above cap. - int16 DoubleSpecialAttack; // Chance to to perform a double special attack (ie flying kick 2x) - int16 SpecialAttackKBProc[2]; // Chance to to do a knockback from special attacks. (0 = chance 1 = Skill) + int32 DoubleSpecialAttack; // Chance to to perform a double special attack (ie flying kick 2x) + int32 SpecialAttackKBProc[2]; // Chance to to do a knockback from special attacks. (0 = chance 1 = Skill) uint8 FrontalStunResist; // Chance to resist a frontal stun - int16 BindWound; // Increase amount of HP by percent. - int16 MaxBindWound; // Increase max amount of HP you can bind wound. - int16 ChannelChanceSpells; // Modify chance to channel a spell. - int16 ChannelChanceItems; // Modify chance to channel a items. + int32 BindWound; // Increase amount of HP by percent. + int32 MaxBindWound; // Increase max amount of HP you can bind wound. + int32 ChannelChanceSpells; // Modify chance to channel a spell. + int32 ChannelChanceItems; // Modify chance to channel a items. uint8 SeeInvis; // See Invs. uint8 TripleBackstab; // Chance to triple backstab bool FrontalBackstabMinDmg; // Allow frontal backstabs for min damage @@ -407,36 +407,36 @@ struct StatBonuses { uint8 ConsumeProjectile; // Chance to not consume arrow. uint8 ForageAdditionalItems; // Chance to forage another item. uint8 SalvageChance; // Chance to salvage a tradeskill components on fail. - uint16 ArcheryDamageModifier; // Increase Archery Damage by percent + uint32 ArcheryDamageModifier; // Increase Archery Damage by percent bool SecondaryDmgInc; // Allow off hand weapon to recieve damage bonus. - uint16 GiveDoubleAttack; // Allow classes to double attack with a specified chance. - int16 SlayUndead[2]; // Allow classes to do extra damage verse undead.(base1 = rate, base2 = damage mod) - int16 PetCriticalHit; // Allow pets to critical hit with % value. - int16 PetAvoidance; // Pet avoidance chance. - int16 CombatStability; // Melee damage mitigation. - int16 DoubleRiposte; // Chance to double riposte - int16 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill - uint16 RaiseSkillCap[2]; // Raise a specific skill cap (1 = value, 2=skill) - int16 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'. - int16 PetMaxHP; // Increase the max hp of your pet. - int16 PetFlurry; // Chance for pet to flurry. + uint32 GiveDoubleAttack; // Allow classes to double attack with a specified chance. + int32 SlayUndead[2]; // Allow classes to do extra damage verse undead.(base1 = rate, base2 = damage mod) + int32 PetCriticalHit; // Allow pets to critical hit with % value. + int32 PetAvoidance; // Pet avoidance chance. + int32 CombatStability; // Melee damage mitigation. + int32 DoubleRiposte; // Chance to double riposte + int32 GiveDoubleRiposte[3]; // 0=Regular Chance, 1=Skill Attack Chance, 2=Skill + uint32 RaiseSkillCap[2]; // Raise a specific skill cap (1 = value, 2=skill) + int32 Ambidexterity; // Increase chance to duel wield by adding bonus 'skill'. + int32 PetMaxHP; // Increase the max hp of your pet. + int32 PetFlurry; // Chance for pet to flurry. uint8 MasteryofPast; // Can not fizzle spells below this level specified in value. bool GivePetGroupTarget; // All pets to recieve group buffs. (Pet Affinity) - int16 RootBreakChance; // Chance root will break; - int16 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal. - int16 ItemHPRegenCap; // Increase item regen cap. - int16 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects. - int16 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack. - int16 ItemATKCap; // Raise item attack cap + int32 RootBreakChance; // Chance root will break; + int32 UnfailingDivinity; // Improves chance that DI will fire + increase partial heal. + int32 ItemHPRegenCap; // Increase item regen cap. + int32 SEResist[MAX_RESISTABLE_EFFECTS*2]; // Resist chance by specific spell effects. + int32 OffhandRiposteFail; // chance for opponent to fail riposte with offhand attack. + int32 ItemATKCap; // Raise item attack cap int32 FinishingBlow[2]; // Chance to do a finishing blow for specified damage amount. - uint16 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???) - int16 ShieldEquipHateMod; // Hate mod when shield equiped. - int16 ShieldEquipDmgMod[2]; // Damage mod when shield equiped. 0 = damage modifier 1 = Unknown + uint32 FinishingBlowLvl[2]; // Sets max level an NPC can be affected by FB. (base1 = lv, base2= ???) + int32 ShieldEquipHateMod; // Hate mod when shield equiped. + int32 ShieldEquipDmgMod[2]; // Damage mod when shield equiped. 0 = damage modifier 1 = Unknown bool TriggerOnValueAmount; // Triggers off various different conditions, bool to check if client has effect. int8 StunBashChance; // chance to stun with bash. int8 IncreaseChanceMemwipe; // increases chance to memory wipe int8 CriticalMend; // chance critical monk mend - int16 ImprovedReclaimEnergy; // Modifies amount of mana returned from reclaim energy + int32 ImprovedReclaimEnergy; // Modifies amount of mana returned from reclaim energy uint32 HeadShot[2]; // Headshot AA (Massive dmg vs humaniod w/ archery) 0= ? 1= Dmg uint8 HSLevel; // Max Level Headshot will be effective at. uint32 Assassinate[2]; // Assassinate AA (Massive dmg vs humaniod w/ assassinate) 0= ? 1= Dmg diff --git a/zone/merc.cpp b/zone/merc.cpp index 0fac55de2..8e73b3358 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -717,10 +717,10 @@ int Merc::GroupLeadershipAAOffenseEnhancement() return 0; } -int16 Merc::CalcSTR() { - int16 val = _baseSTR + itembonuses.STR + spellbonuses.STR; +int32 Merc::CalcSTR() { + int32 val = _baseSTR + itembonuses.STR + spellbonuses.STR; - int16 mod = aabonuses.STR; + int32 mod = aabonuses.STR; STR = val + mod; @@ -730,10 +730,10 @@ int16 Merc::CalcSTR() { return(STR); } -int16 Merc::CalcSTA() { - int16 val = _baseSTA + itembonuses.STA + spellbonuses.STA; +int32 Merc::CalcSTA() { + int32 val = _baseSTA + itembonuses.STA + spellbonuses.STA; - int16 mod = aabonuses.STA; + int32 mod = aabonuses.STA; STA = val + mod; @@ -743,11 +743,11 @@ int16 Merc::CalcSTA() { return(STA); } -int16 Merc::CalcAGI() { - int16 val = _baseAGI + itembonuses.AGI + spellbonuses.AGI; - int16 mod = aabonuses.AGI; +int32 Merc::CalcAGI() { + int32 val = _baseAGI + itembonuses.AGI + spellbonuses.AGI; + int32 mod = aabonuses.AGI; - int16 str = GetSTR(); + int32 str = GetSTR(); AGI = val + mod; @@ -757,10 +757,10 @@ int16 Merc::CalcAGI() { return(AGI); } -int16 Merc::CalcDEX() { - int16 val = _baseDEX + itembonuses.DEX + spellbonuses.DEX; +int32 Merc::CalcDEX() { + int32 val = _baseDEX + itembonuses.DEX + spellbonuses.DEX; - int16 mod = aabonuses.DEX; + int32 mod = aabonuses.DEX; DEX = val + mod; @@ -770,10 +770,10 @@ int16 Merc::CalcDEX() { return(DEX); } -int16 Merc::CalcINT() { - int16 val = _baseINT + itembonuses.INT + spellbonuses.INT; +int32 Merc::CalcINT() { + int32 val = _baseINT + itembonuses.INT + spellbonuses.INT; - int16 mod = aabonuses.INT; + int32 mod = aabonuses.INT; INT = val + mod; @@ -783,10 +783,10 @@ int16 Merc::CalcINT() { return(INT); } -int16 Merc::CalcWIS() { - int16 val = _baseWIS + itembonuses.WIS + spellbonuses.WIS; +int32 Merc::CalcWIS() { + int32 val = _baseWIS + itembonuses.WIS + spellbonuses.WIS; - int16 mod = aabonuses.WIS; + int32 mod = aabonuses.WIS; WIS = val + mod; @@ -796,10 +796,10 @@ int16 Merc::CalcWIS() { return(WIS); } -int16 Merc::CalcCHA() { - int16 val = _baseCHA + itembonuses.CHA + spellbonuses.CHA; +int32 Merc::CalcCHA() { + int32 val = _baseCHA + itembonuses.CHA + spellbonuses.CHA; - int16 mod = aabonuses.CHA; + int32 mod = aabonuses.CHA; CHA = val + mod; @@ -812,7 +812,7 @@ int16 Merc::CalcCHA() { //The AA multipliers are set to be 5, but were 2 on WR //The resistant discipline which I think should be here is implemented //in Mob::ResistSpell -int16 Merc::CalcMR() +int32 Merc::CalcMR() { MR = _baseMR + itembonuses.MR + spellbonuses.MR + aabonuses.MR; @@ -822,7 +822,7 @@ int16 Merc::CalcMR() return(MR); } -int16 Merc::CalcFR() +int32 Merc::CalcFR() { FR = _baseFR + itembonuses.FR + spellbonuses.FR + aabonuses.FR; @@ -832,7 +832,7 @@ int16 Merc::CalcFR() return(FR); } -int16 Merc::CalcDR() +int32 Merc::CalcDR() { DR = _baseDR + itembonuses.DR + spellbonuses.DR + aabonuses.DR; @@ -842,7 +842,7 @@ int16 Merc::CalcDR() return(DR); } -int16 Merc::CalcPR() +int32 Merc::CalcPR() { PR = _basePR + itembonuses.PR + spellbonuses.PR + aabonuses.PR; @@ -852,7 +852,7 @@ int16 Merc::CalcPR() return(PR); } -int16 Merc::CalcCR() +int32 Merc::CalcCR() { CR = _baseCR + itembonuses.CR + spellbonuses.CR + aabonuses.CR; @@ -862,19 +862,19 @@ int16 Merc::CalcCR() return(CR); } -int16 Merc::CalcCorrup() +int32 Merc::CalcCorrup() { Corrup = _baseCorrup + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup; return(Corrup); } -int16 Merc::CalcATK() { +int32 Merc::CalcATK() { ATK = _baseATK + itembonuses.ATK + spellbonuses.ATK + aabonuses.ATK + GroupLeadershipAAOffenseEnhancement(); return(ATK); } -int16 Merc::CalcAC() { +int32 Merc::CalcAC() { //spell AC bonuses are added directly to natural total AC = _baseAC + spellbonuses.AC; return(AC); diff --git a/zone/merc.h b/zone/merc.h index 5061d315c..838789f49 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -181,58 +181,58 @@ public: inline virtual int32 GetAC() const { return AC; } inline virtual int32 GetATK() const { return ATK; } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - int GetRawACNoShield(int &shield_ac) const; + int32 GetRawACNoShield(int &shield_ac) const; - inline virtual int16 GetSTR() const { return STR; } - inline virtual int16 GetSTA() const { return STA; } - inline virtual int16 GetDEX() const { return DEX; } - inline virtual int16 GetAGI() const { return AGI; } - inline virtual int16 GetINT() const { return INT; } - inline virtual int16 GetWIS() const { return WIS; } - inline virtual int16 GetCHA() const { return CHA; } - inline virtual int16 GetMR() const { return MR; } - inline virtual int16 GetFR() const { return FR; } - inline virtual int16 GetDR() const { return DR; } - inline virtual int16 GetPR() const { return PR; } - inline virtual int16 GetCR() const { return CR; } - inline virtual int16 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - inline virtual int16 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int16 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int16 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int16 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int16 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int16 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int16 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int16 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int16 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int16 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int16 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int16 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int16 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int16 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int16 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int16 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int16 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int16 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int16 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int16 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int16 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int16 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int16 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int16 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int16 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int16 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int16 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int16 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int16 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int16 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int16 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int16 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } // "SET" Class Methods void SetMercData (uint32 templateID ); @@ -281,27 +281,27 @@ protected: private: - int16 CalcAC(); - int16 GetACMit(); - int16 GetACAvoid(); - int16 acmod(); - int16 CalcATK(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 acmod(); + int32 CalcATK(); //int CalcHaste(); - int16 CalcSTR(); - int16 CalcSTA(); - int16 CalcDEX(); - int16 CalcAGI(); - int16 CalcINT(); - int16 CalcWIS(); - int16 CalcCHA(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int16 CalcMR(); - int16 CalcFR(); - int16 CalcDR(); - int16 CalcPR(); - int16 CalcCR(); - int16 CalcCorrup(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); int32 CalcMaxHP(); int32 CalcBaseHP(); int32 GetClassHPFactor(); @@ -335,23 +335,23 @@ private: // Private "base stats" Members int32 base_mana; - int _baseAC; - uint16 _baseSTR; - uint16 _baseSTA; - uint16 _baseDEX; - uint16 _baseAGI; - uint16 _baseINT; - uint16 _baseWIS; - uint16 _baseCHA; - uint16 _baseATK; - uint16 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. + int32 _baseAC; + uint32 _baseSTR; + uint32 _baseSTA; + uint32 _baseDEX; + uint32 _baseAGI; + uint32 _baseINT; + uint32 _baseWIS; + uint32 _baseCHA; + uint32 _baseATK; + uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. - uint16 _baseMR; - uint16 _baseCR; - uint16 _baseDR; - uint16 _baseFR; - uint16 _basePR; - uint16 _baseCorrup; + uint32 _baseMR; + uint32 _baseCR; + uint32 _baseDR; + uint32 _baseFR; + uint32 _basePR; + uint32 _baseCorrup; uint32 RestRegenHP; uint32 RestRegenMana; uint32 RestRegenEndurance; diff --git a/zone/mob.h b/zone/mob.h index f0f5a1691..ec25aff20 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -343,36 +343,36 @@ public: inline virtual int32 GetAC() const { return AC + itembonuses.AC + spellbonuses.AC; } inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK; } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - inline virtual int16 GetSTR() const { return STR + itembonuses.STR + spellbonuses.STR; } - inline virtual int16 GetSTA() const { return STA + itembonuses.STA + spellbonuses.STA; } - inline virtual int16 GetDEX() const { return DEX + itembonuses.DEX + spellbonuses.DEX; } - inline virtual int16 GetAGI() const { return AGI + itembonuses.AGI + spellbonuses.AGI; } - inline virtual int16 GetINT() const { return INT + itembonuses.INT + spellbonuses.INT; } - inline virtual int16 GetWIS() const { return WIS + itembonuses.WIS + spellbonuses.WIS; } - inline virtual int16 GetCHA() const { return CHA + itembonuses.CHA + spellbonuses.CHA; } - inline virtual int16 GetMR() const { return MR + itembonuses.MR + spellbonuses.MR; } - inline virtual int16 GetFR() const { return FR + itembonuses.FR + spellbonuses.FR; } - inline virtual int16 GetDR() const { return DR + itembonuses.DR + spellbonuses.DR; } - inline virtual int16 GetPR() const { return PR + itembonuses.PR + spellbonuses.PR; } - inline virtual int16 GetCR() const { return CR + itembonuses.CR + spellbonuses.CR; } - inline virtual int16 GetCorrup() const { return Corrup + itembonuses.Corrup + spellbonuses.Corrup; } - inline virtual int16 GetPhR() const { return PhR; } + inline virtual int32 GetSTR() const { return STR + itembonuses.STR + spellbonuses.STR; } + inline virtual int32 GetSTA() const { return STA + itembonuses.STA + spellbonuses.STA; } + inline virtual int32 GetDEX() const { return DEX + itembonuses.DEX + spellbonuses.DEX; } + inline virtual int32 GetAGI() const { return AGI + itembonuses.AGI + spellbonuses.AGI; } + inline virtual int32 GetINT() const { return INT + itembonuses.INT + spellbonuses.INT; } + inline virtual int32 GetWIS() const { return WIS + itembonuses.WIS + spellbonuses.WIS; } + inline virtual int32 GetCHA() const { return CHA + itembonuses.CHA + spellbonuses.CHA; } + inline virtual int32 GetMR() const { return MR + itembonuses.MR + spellbonuses.MR; } + inline virtual int32 GetFR() const { return FR + itembonuses.FR + spellbonuses.FR; } + inline virtual int32 GetDR() const { return DR + itembonuses.DR + spellbonuses.DR; } + inline virtual int32 GetPR() const { return PR + itembonuses.PR + spellbonuses.PR; } + inline virtual int32 GetCR() const { return CR + itembonuses.CR + spellbonuses.CR; } + inline virtual int32 GetCorrup() const { return Corrup + itembonuses.Corrup + spellbonuses.Corrup; } + inline virtual int32 GetPhR() const { return PhR; } inline StatBonuses GetItemBonuses() const { return itembonuses; } inline StatBonuses GetSpellBonuses() const { return spellbonuses; } inline StatBonuses GetAABonuses() const { return aabonuses; } - inline virtual int16 GetMaxSTR() const { return GetSTR(); } - inline virtual int16 GetMaxSTA() const { return GetSTA(); } - inline virtual int16 GetMaxDEX() const { return GetDEX(); } - inline virtual int16 GetMaxAGI() const { return GetAGI(); } - inline virtual int16 GetMaxINT() const { return GetINT(); } - inline virtual int16 GetMaxWIS() const { return GetWIS(); } - inline virtual int16 GetMaxCHA() const { return GetCHA(); } - inline virtual int16 GetMaxMR() const { return 255; } - inline virtual int16 GetMaxPR() const { return 255; } - inline virtual int16 GetMaxDR() const { return 255; } - inline virtual int16 GetMaxCR() const { return 255; } - inline virtual int16 GetMaxFR() const { return 255; } - inline virtual int16 GetDelayDeath() const { return 0; } + inline virtual int32 GetMaxSTR() const { return GetSTR(); } + inline virtual int32 GetMaxSTA() const { return GetSTA(); } + inline virtual int32 GetMaxDEX() const { return GetDEX(); } + inline virtual int32 GetMaxAGI() const { return GetAGI(); } + inline virtual int32 GetMaxINT() const { return GetINT(); } + inline virtual int32 GetMaxWIS() const { return GetWIS(); } + inline virtual int32 GetMaxCHA() const { return GetCHA(); } + inline virtual int32 GetMaxMR() const { return 255; } + inline virtual int32 GetMaxPR() const { return 255; } + inline virtual int32 GetMaxDR() const { return 255; } + inline virtual int32 GetMaxCR() const { return 255; } + inline virtual int32 GetMaxFR() const { return 255; } + inline virtual int32 GetDelayDeath() const { return 0; } inline int32 GetHP() const { return cur_hp; } inline int32 GetMaxHP() const { return max_hp; } virtual int32 CalcMaxHP(); @@ -697,7 +697,7 @@ public: bool CanThisClassBlock(void) const; int GetMonkHandToHandDelay(void); - uint16 GetClassLevelFactor(); + uint32 GetClassLevelFactor(); void Mesmerize(); inline bool IsMezzed() const { return mezzed; } inline bool IsStunned() const { return stunned; } @@ -818,7 +818,7 @@ public: virtual int32 CheckHealAggroAmount(uint16 spell_id, uint32 heal_possible = 0); virtual uint32 GetAA(uint32 aa_id) const { return(0); } - uint16 GetInstrumentMod(uint16 spell_id) const; + uint32 GetInstrumentMod(uint16 spell_id) const; int CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level = 1, Mob *caster = nullptr, int ticsremaining = 0); int CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining = 0); virtual int CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int caster_level2, Mob* caster1 = nullptr, Mob* caster2 = nullptr, int buffslot = -1); @@ -932,21 +932,21 @@ protected: uint8 helmtexture; int AC; - int16 ATK; - int16 STR; - int16 STA; - int16 DEX; - int16 AGI; - int16 INT; - int16 WIS; - int16 CHA; - int16 MR; - int16 CR; - int16 FR; - int16 DR; - int16 PR; - int16 Corrup; - int16 PhR; + int32 ATK; + int32 STR; + int32 STA; + int32 DEX; + int32 AGI; + int32 INT; + int32 WIS; + int32 CHA; + int32 MR; + int32 CR; + int32 FR; + int32 DR; + int32 PR; + int32 Corrup; + int32 PhR; bool moving; int targeted; bool findable; diff --git a/zone/npc.cpp b/zone/npc.cpp index b4c726acb..c9d3e1879 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2098,7 +2098,7 @@ void NPC::CalcNPCDamage() { max_dmg = (GetLevel()*2)*AC_adjust/10; } - int clfact = GetClassLevelFactor(); + int32 clfact = GetClassLevelFactor(); min_dmg = (min_dmg * clfact) / 220; max_dmg = (max_dmg * clfact) / 220; diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 762246519..b34cbb6c3 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -2536,7 +2536,7 @@ XS(XS_Mob_GetAC) Perl_croak(aTHX_ "Usage: Mob::GetAC(THIS)"); { Mob * THIS; - uint16 RETVAL; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2562,7 +2562,7 @@ XS(XS_Mob_GetATK) Perl_croak(aTHX_ "Usage: Mob::GetATK(THIS)"); { Mob * THIS; - uint16 RETVAL; + uint32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2588,7 +2588,7 @@ XS(XS_Mob_GetSTR) Perl_croak(aTHX_ "Usage: Mob::GetSTR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2614,7 +2614,7 @@ XS(XS_Mob_GetSTA) Perl_croak(aTHX_ "Usage: Mob::GetSTA(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2640,7 +2640,7 @@ XS(XS_Mob_GetDEX) Perl_croak(aTHX_ "Usage: Mob::GetDEX(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2666,7 +2666,7 @@ XS(XS_Mob_GetAGI) Perl_croak(aTHX_ "Usage: Mob::GetAGI(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2692,7 +2692,7 @@ XS(XS_Mob_GetINT) Perl_croak(aTHX_ "Usage: Mob::GetINT(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2718,7 +2718,7 @@ XS(XS_Mob_GetWIS) Perl_croak(aTHX_ "Usage: Mob::GetWIS(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2744,7 +2744,7 @@ XS(XS_Mob_GetCHA) Perl_croak(aTHX_ "Usage: Mob::GetCHA(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2770,7 +2770,7 @@ XS(XS_Mob_GetMR) Perl_croak(aTHX_ "Usage: Mob::GetMR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2796,7 +2796,7 @@ XS(XS_Mob_GetFR) Perl_croak(aTHX_ "Usage: Mob::GetFR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2822,7 +2822,7 @@ XS(XS_Mob_GetDR) Perl_croak(aTHX_ "Usage: Mob::GetDR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2848,7 +2848,7 @@ XS(XS_Mob_GetPR) Perl_croak(aTHX_ "Usage: Mob::GetPR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2874,7 +2874,7 @@ XS(XS_Mob_GetCR) Perl_croak(aTHX_ "Usage: Mob::GetCR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2900,7 +2900,7 @@ XS(XS_Mob_GetCorruption) Perl_croak(aTHX_ "Usage: Mob::GetCorruption(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2926,7 +2926,7 @@ XS(XS_Mob_GetMaxSTR) Perl_croak(aTHX_ "Usage: Mob::GetMaxSTR(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2952,7 +2952,7 @@ XS(XS_Mob_GetMaxSTA) Perl_croak(aTHX_ "Usage: Mob::GetMaxSTA(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -2978,7 +2978,7 @@ XS(XS_Mob_GetMaxDEX) Perl_croak(aTHX_ "Usage: Mob::GetMaxDEX(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -3004,7 +3004,7 @@ XS(XS_Mob_GetMaxAGI) Perl_croak(aTHX_ "Usage: Mob::GetMaxAGI(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -3030,7 +3030,7 @@ XS(XS_Mob_GetMaxINT) Perl_croak(aTHX_ "Usage: Mob::GetMaxINT(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -3056,7 +3056,7 @@ XS(XS_Mob_GetMaxWIS) Perl_croak(aTHX_ "Usage: Mob::GetMaxWIS(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -3082,7 +3082,7 @@ XS(XS_Mob_GetMaxCHA) Perl_croak(aTHX_ "Usage: Mob::GetMaxCHA(THIS)"); { Mob * THIS; - int16 RETVAL; + int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "Mob")) { @@ -6259,7 +6259,7 @@ XS(XS_Mob_CheckAggroAmount) Perl_croak(aTHX_ "Usage: Mob::CheckAggroAmount(THIS, spellid)"); { Mob * THIS; - uint16 RETVAL; + uint32 RETVAL; dXSTARG; uint16 spellid = (uint16)SvUV(ST(1)); @@ -6286,7 +6286,7 @@ XS(XS_Mob_CheckHealAggroAmount) Perl_croak(aTHX_ "Usage: Mob::CheckHealAggroAmount(THIS, spellid, possible_heal_amt)"); { Mob * THIS; - uint16 RETVAL; + uint32 RETVAL; dXSTARG; uint16 spellid = (uint16)SvUV(ST(1)); uint32 possible = 0; diff --git a/zone/zonedump.h b/zone/zonedump.h index a96d276cd..fc9b7b152 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -60,23 +60,23 @@ struct NPCType uint32 adventure_template; uint32 trap_template; uint8 light; //not loaded from DB - uint16 AC; + uint32 AC; uint32 Mana; //not loaded from DB - uint16 ATK; //not loaded from DB - uint16 STR; - uint16 STA; - uint16 DEX; - uint16 AGI; - uint16 INT; - uint16 WIS; - uint16 CHA; - int16 MR; - int16 FR; - int16 CR; - int16 PR; - int16 DR; - int16 Corrup; - int16 PhR; + uint32 ATK; //not loaded from DB + uint32 STR; + uint32 STA; + uint32 DEX; + uint32 AGI; + uint32 INT; + uint32 WIS; + uint32 CHA; + int32 MR; + int32 FR; + int32 CR; + int32 PR; + int32 DR; + int32 Corrup; + int32 PhR; uint8 haircolor; uint8 beardcolor; uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye? From d4139b98e3de294225d38467b69d7177bd0cb925 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 3 Nov 2014 23:01:55 -0500 Subject: [PATCH 0212/1883] Linux fix. --- changelog.txt | 1 + zone/spell_effects.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index b93bb91af..380793866 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) Secrets: Fixed overflow on AC and ATK values that can go out of range. Secrets: Merc/Bot fixes for previous updates. Secrets: Changed a lot of int16s for stat-related functions to int32 because they were causing combat formula overflows (int16/int32 mismatch). +Secrets: Linux fix? == 11/02/2014 == Akkadius: Added out of range checking for Spell Save/Loads diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index fb50f1203..b97ca0244 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5664,7 +5664,7 @@ bool Mob::TryDivineSave() { SetHP(1); - int16 EffectsToTry[] = + int32 EffectsToTry[] = { aabonuses.DivineSaveChance[1], itembonuses.DivineSaveChance[1], @@ -5707,7 +5707,7 @@ bool Mob::TryDeathSave() { int SuccessChance = 0; int buffSlot = spellbonuses.DeathSave[1]; - int16 UD_HealMod = 0; + int32 UD_HealMod = 0; int HealAmt = 300; //Death Pact max Heal if(buffSlot >= 0){ From 957f05860bfa44a5c99ae0a493aebe1ba33d5af3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 4 Nov 2014 21:01:20 -0800 Subject: [PATCH 0213/1883] Small changes to encounter stuff --- zone/lua_general.cpp | 103 ++++++++++++++++++++++++++++++++++++------- zone/lua_parser.cpp | 4 +- zone/questmgr.cpp | 14 +++++- zone/questmgr.h | 4 +- 4 files changed, 105 insertions(+), 20 deletions(-) diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 686466b1f..f0d374870 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -32,20 +32,34 @@ struct lua_registered_event { }; extern std::map> lua_encounter_events_registered; +extern std::map lua_encounters_loaded; extern void MapOpcodes(); extern void ClearMappedOpcode(EmuOpcode op); +void unregister_event(std::string package_name, std::string name, int evt); + void load_encounter(std::string name) { + if(lua_encounters_loaded.count(name) > 0) + return; + + lua_encounters_loaded[name] = true; parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, 0); } void load_encounter_with_data(std::string name, std::string info_str) { + if(lua_encounters_loaded.count(name) > 0) + return; + + lua_encounters_loaded[name] = true; std::vector info_ptrs; info_ptrs.push_back(&info_str); parse->EventEncounter(EVENT_ENCOUNTER_LOAD, name, 0, &info_ptrs); } void unload_encounter(std::string name) { + if(lua_encounters_loaded.count(name) == 0) + return; + auto liter = lua_encounter_events_registered.begin(); while(liter != lua_encounter_events_registered.end()) { std::list &elist = liter->second; @@ -65,10 +79,13 @@ void unload_encounter(std::string name) { } } + lua_encounters_loaded.erase(name); parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, 0); } void unload_encounter_with_data(std::string name, std::string info_str) { + if(lua_encounters_loaded.count(name) == 0) + return; auto liter = lua_encounter_events_registered.begin(); while(liter != lua_encounter_events_registered.end()) { @@ -91,12 +108,18 @@ void unload_encounter_with_data(std::string name, std::string info_str) { } } + lua_encounters_loaded.erase(name); std::vector info_ptrs; info_ptrs.push_back(&info_str); parse->EventEncounter(EVENT_ENCOUNTER_UNLOAD, name, 0, &info_ptrs); } void register_event(std::string package_name, std::string name, int evt, luabind::adl::object func) { + if(lua_encounters_loaded.count(name) == 0) + return; + + unregister_event(package_name, name, evt); + lua_registered_event e; e.encounter_name = name; e.lua_reference = func; @@ -109,15 +132,6 @@ void register_event(std::string package_name, std::string name, int evt, luabind lua_encounter_events_registered[package_name] = elist; } else { std::list &elist = liter->second; - auto iter = elist.begin(); - while(iter != elist.end()) { - if(iter->event_id == evt && iter->encounter_name.compare(name) == 0) { - //already registered this event for this encounter - return; - } - ++iter; - } - elist.push_back(e); } } @@ -130,6 +144,7 @@ void unregister_event(std::string package_name, std::string name, int evt) { while(iter != elist.end()) { if(iter->event_id == evt && iter->encounter_name.compare(name) == 0) { iter = elist.erase(iter); + break; } } lua_encounter_events_registered[package_name] = elist; @@ -145,6 +160,11 @@ void register_npc_event(std::string name, int evt, int npc_id, luabind::adl::obj } } +void register_npc_event(int evt, int npc_id, luabind::adl::object func) { + std::string name = quest_manager.GetEncounter(); + register_npc_event(name, evt, npc_id, func); +} + void unregister_npc_event(std::string name, int evt, int npc_id) { std::stringstream package_name; package_name << "npc_" << npc_id; @@ -152,16 +172,31 @@ void unregister_npc_event(std::string name, int evt, int npc_id) { unregister_event(package_name.str(), name, evt); } +void unregister_npc_event(int evt, int npc_id) { + std::string name = quest_manager.GetEncounter(); + unregister_npc_event(name, evt, npc_id); +} + void register_player_event(std::string name, int evt, luabind::adl::object func) { if(luabind::type(func) == LUA_TFUNCTION) { register_event("player", name, evt, func); } } +void register_player_event(int evt, luabind::adl::object func) { + std::string name = quest_manager.GetEncounter(); + register_player_event(name, evt, func); +} + void unregister_player_event(std::string name, int evt) { unregister_event("player", name, evt); } +void unregister_player_event(int evt) { + std::string name = quest_manager.GetEncounter(); + unregister_player_event(name, evt); +} + void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) { std::string package_name = "item_"; package_name += std::to_string(static_cast(item_id)); @@ -171,6 +206,11 @@ void register_item_event(std::string name, int evt, int item_id, luabind::adl::o } } +void register_item_event(int evt, int item_id, luabind::adl::object func) { + std::string name = quest_manager.GetEncounter(); + register_item_event(name, evt, item_id, func); +} + void unregister_item_event(std::string name, int evt, int item_id) { std::string package_name = "item_"; package_name += std::to_string(static_cast(item_id)); @@ -178,6 +218,11 @@ void unregister_item_event(std::string name, int evt, int item_id) { unregister_event(package_name, name, evt); } +void unregister_item_event(int evt, int item_id) { + std::string name = quest_manager.GetEncounter(); + unregister_item_event(name, evt, item_id); +} + void register_spell_event(std::string name, int evt, int spell_id, luabind::adl::object func) { if(luabind::type(func) == LUA_TFUNCTION) { std::stringstream package_name; @@ -187,6 +232,11 @@ void register_spell_event(std::string name, int evt, int spell_id, luabind::adl: } } +void register_spell_event(int evt, int spell_id, luabind::adl::object func) { + std::string name = quest_manager.GetEncounter(); + register_spell_event(name, evt, spell_id, func); +} + void unregister_spell_event(std::string name, int evt, int spell_id) { std::stringstream package_name; package_name << "spell_" << spell_id; @@ -194,6 +244,11 @@ void unregister_spell_event(std::string name, int evt, int spell_id) { unregister_event(package_name.str(), name, evt); } +void unregister_spell_event(int evt, int spell_id) { + std::string name = quest_manager.GetEncounter(); + unregister_spell_event(name, evt, spell_id); +} + Lua_Mob lua_spawn2(int npc_type, int grid, int unused, double x, double y, double z, double heading) { return Lua_Mob(quest_manager.spawn2(npc_type, grid, unused, static_cast(x), static_cast(y), static_cast(z), static_cast(heading))); @@ -1161,6 +1216,11 @@ Lua_ItemInst lua_get_quest_item() { return quest_manager.GetQuestItem(); } +std::string lua_get_encounter() { + return quest_manager.GetEncounter(); +} + + void lua_map_opcodes() { MapOpcodes(); } @@ -1195,14 +1255,22 @@ luabind::scope lua_register_general() { luabind::def("unload_encounter", &unload_encounter), luabind::def("load_encounter_with_data", &load_encounter_with_data), luabind::def("unload_encounter_with_data", &unload_encounter_with_data), - luabind::def("register_npc_event", ®ister_npc_event), - luabind::def("unregister_npc_event", &unregister_npc_event), - luabind::def("register_player_event", ®ister_player_event), - luabind::def("unregister_player_event", &unregister_player_event), - luabind::def("register_item_event", ®ister_item_event), - luabind::def("unregister_item_event", &unregister_item_event), - luabind::def("register_spell_event", ®ister_spell_event), - luabind::def("unregister_spell_event", &unregister_spell_event), + luabind::def("register_npc_event", (void(*)(std::string, int, int, luabind::adl::object))®ister_npc_event), + luabind::def("register_npc_event", (void(*)(int, int, luabind::adl::object))®ister_npc_event), + luabind::def("unregister_npc_event", (void(*)(std::string, int, int))&unregister_npc_event), + luabind::def("unregister_npc_event", (void(*)(int, int))&unregister_npc_event), + luabind::def("register_player_event", (void(*)(std::string, int, luabind::adl::object))®ister_player_event), + luabind::def("register_player_event", (void(*)(int, luabind::adl::object))®ister_player_event), + luabind::def("unregister_player_event", (void(*)(std::string, int))&unregister_player_event), + luabind::def("unregister_player_event", (void(*)(int))&unregister_player_event), + luabind::def("register_item_event", (void(*)(std::string, int, int, luabind::adl::object))®ister_item_event), + luabind::def("register_item_event", (void(*)(int, int, luabind::adl::object))®ister_item_event), + luabind::def("unregister_item_event", (void(*)(std::string, int, int))&unregister_item_event), + luabind::def("unregister_item_event", (void(*)(int, int))&unregister_item_event), + luabind::def("register_spell_event", (void(*)(std::string, int, int, luabind::adl::object func))®ister_spell_event), + luabind::def("register_spell_event", (void(*)(int, int, luabind::adl::object func))®ister_spell_event), + luabind::def("unregister_spell_event", (void(*)(std::string, int, int))&unregister_spell_event), + luabind::def("unregister_spell_event", (void(*)(int, int))&unregister_spell_event), luabind::def("spawn2", (Lua_Mob(*)(int,int,int,double,double,double,double))&lua_spawn2), luabind::def("unique_spawn", (Lua_Mob(*)(int,int,int,double,double,double))&lua_unique_spawn), luabind::def("unique_spawn", (Lua_Mob(*)(int,int,int,double,double,double,double))&lua_unique_spawn), @@ -1360,6 +1428,7 @@ luabind::scope lua_register_general() { luabind::def("get_initiator", &lua_get_initiator), luabind::def("get_owner", &lua_get_owner), luabind::def("get_quest_item", &lua_get_quest_item), + luabind::def("get_encounter", &lua_get_encounter), luabind::def("map_opcodes", &lua_map_opcodes), luabind::def("clear_opcode", &lua_clear_opcode), luabind::def("enable_recipe", &lua_enable_recipe), diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 6f44d4fb8..dce88d5e6 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -126,6 +126,7 @@ struct lua_registered_event { }; std::map> lua_encounter_events_registered; +std::map lua_encounters_loaded; LuaParser::LuaParser() { for(int i = 0; i < _LargestEventID; ++i) { @@ -607,7 +608,7 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std:: lua_setfield(L, -2, "data"); } - quest_manager.StartQuest(nullptr, nullptr, nullptr); + quest_manager.StartQuest(nullptr, nullptr, nullptr, encounter_name); if(lua_pcall(L, 1, 1, 0)) { std::string error = lua_tostring(L, -1); AddError(error); @@ -776,6 +777,7 @@ void LuaParser::ReloadQuests() { loaded_.clear(); errors_.clear(); lua_encounter_events_registered.clear(); + lua_encounters_loaded.clear(); if(L) { lua_close(L); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 7757d0a70..259630c48 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -95,6 +95,7 @@ QuestManager quest_manager; Client *initiator = nullptr; \ ItemInst* questitem = nullptr; \ bool depop_npc = false; \ + std::string encounter; \ do { \ if(!quests_running_.empty()) { \ running_quest e = quests_running_.top(); \ @@ -102,6 +103,7 @@ QuestManager quest_manager; initiator = e.initiator; \ questitem = e.questitem; \ depop_npc = e.depop_npc; \ + encounter = e.encounter; \ } \ } while(0) @@ -151,12 +153,13 @@ void QuestManager::Process() { } } -void QuestManager::StartQuest(Mob *_owner, Client *_initiator, ItemInst* _questitem) { +void QuestManager::StartQuest(Mob *_owner, Client *_initiator, ItemInst* _questitem, std::string encounter) { running_quest run; run.owner = _owner; run.initiator = _initiator; run.questitem = _questitem; run.depop_npc = false; + run.encounter = encounter; quests_running_.push(run); } @@ -3014,3 +3017,12 @@ ItemInst *QuestManager::GetQuestItem() const { return nullptr; } + +std::string QuestManager::GetEncounter() const { + if(!quests_running_.empty()) { + running_quest e = quests_running_.top(); + return e.encounter; + } + + return ""; +} diff --git a/zone/questmgr.h b/zone/questmgr.h index 2d1184942..6b47bab04 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -34,12 +34,13 @@ class QuestManager { Client *initiator; ItemInst* questitem; bool depop_npc; + std::string encounter; }; public: QuestManager(); virtual ~QuestManager(); - void StartQuest(Mob *_owner, Client *_initiator = nullptr, ItemInst* _questitem = nullptr); + void StartQuest(Mob *_owner, Client *_initiator = nullptr, ItemInst* _questitem = nullptr, std::string encounter = ""); void EndQuest(); bool QuestsRunning() { return !quests_running_.empty(); } @@ -252,6 +253,7 @@ public: NPC *GetNPC() const; Mob *GetOwner() const; ItemInst *GetQuestItem() const; + std::string GetEncounter() const; inline bool ProximitySayInUse() { return HaveProximitySays; } #ifdef BOTS From b4286b87db4c8d0d7034c37ca4c062849090edc6 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 6 Nov 2014 01:30:05 -0500 Subject: [PATCH 0214/1883] Fix to SE_PercentHeal to allow it to work if no max value set. --- zone/spell_effects.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b97ca0244..8a1285b1e 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -299,7 +299,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) //This effect can also do damage by percent. if (val < 0) { - if (-val > spell.max[i]) + if (spell.max[i] && -val > spell.max[i]) val = -spell.max[i]; if (caster) @@ -309,7 +309,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) else { - if (val > spell.max[i]) + if (spell.max[i] && val > spell.max[i]) val = spell.max[i]; if(caster) @@ -2647,7 +2647,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) case SE_Taunt: { if (IsNPC()){ - caster->Taunt(this->CastToNPC(), false, spell.base[i]); + caster->Taunt(this->CastToNPC(), false, static_cast(spell.base[i])); if (spell.base2[i] > 0) CastToNPC()->SetHate(caster, (CastToNPC()->GetHateAmount(caster) + spell.base2[i])); From 0c4a32246befdbfe5efa0609cbe2e8a8fc3f9a64 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 6 Nov 2014 21:00:03 -0500 Subject: [PATCH 0215/1883] Fix for CalcMaxHP --- zone/mob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 513057fed..e945d0fef 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -608,7 +608,7 @@ int32 Mob::CalcMaxMana() { int32 Mob::CalcMaxHP() { max_hp = (base_hp + itembonuses.HP + spellbonuses.HP); - max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000); + max_hp += max_hp * (aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000; return max_hp; } From 7476ae2a82755a86c77a7ea1d912eff79d027316 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 6 Nov 2014 21:48:07 -0500 Subject: [PATCH 0216/1883] Tracking default order should now be correct Reworked the tracking packet creation, should be better --- changelog.txt | 3 ++ zone/entity.cpp | 81 +++++++++++++++++++++---------------------------- zone/entity.h | 2 ++ 3 files changed, 40 insertions(+), 46 deletions(-) diff --git a/changelog.txt b/changelog.txt index 380793866..8d2670b3c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/06/2014 == +demonstar55: Tracking default sort will now be correct order + == 11/03/2014 == Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) Secrets: Fixed overflow on AC and ATK values that can go out of range. diff --git a/zone/entity.cpp b/zone/entity.cpp index d5354386f..76b9eb8d4 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -63,6 +63,7 @@ extern uint16 adverrornum; Entity::Entity() { id = 0; + spawn_timestamp = time(nullptr); } Entity::~Entity() @@ -2934,8 +2935,14 @@ void EntityList::SignalMobsByNPCID(uint32 snpc, int signal_id) } } +bool tracking_compare(const std::pair &a, const std::pair &b) +{ + return a.first->GetSpawnTimeStamp() > b.first->GetSpawnTimeStamp(); +} + bool EntityList::MakeTrackPacket(Client *client) { + std::list > tracking_list; uint32 distance = 0; float MobDistance; @@ -2950,60 +2957,42 @@ bool EntityList::MakeTrackPacket(Client *client) if (distance < 300) distance = 300; - uint32 spe= 0; - bool ret = false; - - spe = mob_list.size() + 50; - - uchar *buffer1 = new uchar[sizeof(Track_Struct)]; - Track_Struct *track_ent = (Track_Struct*) buffer1; - - uchar *buffer2 = new uchar[sizeof(Track_Struct)*spe]; - Tracking_Struct *track_array = (Tracking_Struct*) buffer2; - memset(track_array, 0, sizeof(Track_Struct)*spe); - - uint32 array_counter = 0; - Group *g = client->GetGroup(); - auto it = mob_list.begin(); - while (it != mob_list.end()) { - if (it->second && ((MobDistance = it->second->DistNoZ(*client)) <= distance)) { - if ((it->second != client) && it->second->IsTrackable()) { - memset(track_ent, 0, sizeof(Track_Struct)); - Mob *cur_entity = it->second; - track_ent->entityid = cur_entity->GetID(); - track_ent->distance = MobDistance; - track_ent->level = cur_entity->GetLevel(); - track_ent->NPC = !cur_entity->IsClient(); - if (g && cur_entity->IsClient() && g->IsGroupMember(cur_entity->CastToMob())) - track_ent->GroupMember = 1; - else - track_ent->GroupMember = 0; - strn0cpy(track_ent->name, cur_entity->GetName(), sizeof(track_ent->name)); - memcpy(&track_array->Entrys[array_counter], track_ent, sizeof(Track_Struct)); - array_counter++; - } - } + for (auto it = mob_list.cbegin(); it != mob_list.cend(); ++it) { + if (!it->second || it->second == client || !it->second->IsTrackable()) + continue; - ++it; + MobDistance = it->second->DistNoZ(*client); + if (MobDistance > distance) + continue; + + tracking_list.push_back(std::make_pair(it->second, MobDistance)); } - if (array_counter <= spe) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Track,sizeof(Track_Struct)*(array_counter)); - memcpy(outapp->pBuffer, track_array,sizeof(Track_Struct)*(array_counter)); - outapp->priority = 6; - client->QueuePacket(outapp); - safe_delete(outapp); - ret = true; - } else { - LogFile->write(EQEMuLog::Status, "ERROR: Unable to transmit a Tracking_Struct packet. Mobs in zone = %i. Mobs in packet = %i", array_counter, spe); + tracking_list.sort(tracking_compare); + EQApplicationPacket *outapp = new EQApplicationPacket(OP_Track, sizeof(Track_Struct) * tracking_list.size()); + Tracking_Struct *outtrack = (Tracking_Struct *)outapp->pBuffer; + outapp->priority = 6; + + int index = 0; + for (auto it = tracking_list.cbegin(); it != tracking_list.cend(); ++it, ++index) { + Mob *cur_entity = it->first; + outtrack->Entrys[index].entityid = cur_entity->GetID(); + outtrack->Entrys[index].distance = it->second; + outtrack->Entrys[index].level = cur_entity->GetLevel(); + outtrack->Entrys[index].NPC = !cur_entity->IsClient(); + if (g && cur_entity->IsClient() && g->IsGroupMember(cur_entity->CastToMob())) + outtrack->Entrys[index].GroupMember = 1; + else + outtrack->Entrys[index].GroupMember = 0; + strn0cpy(outtrack->Entrys[index].name, cur_entity->GetName(), sizeof(outtrack->Entrys[index].name)); } - safe_delete_array(buffer1); - safe_delete_array(buffer2); + client->QueuePacket(outapp); + safe_delete(outapp); - return ret; + return true; } void EntityList::MessageGroup(Mob *sender, bool skipclose, uint32 type, const char *message, ...) diff --git a/zone/entity.h b/zone/entity.h index ad5de09bf..2e6990231 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -97,6 +97,7 @@ public: const Beacon *CastToBeacon() const; inline const uint16& GetID() const { return id; } + inline const time_t& GetSpawnTimeStamp() const { return spawn_timestamp; } virtual const char* GetName() { return ""; } bool CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float trg_x, float trg_y, float trg_z, float perwalk=1); @@ -112,6 +113,7 @@ protected: uint32 pDBAsyncWorkID; private: uint16 id; + time_t spawn_timestamp; }; class EntityList From b4e4d94061f051ded35a19649daaca12d06b8523 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 6 Nov 2014 21:41:51 -0600 Subject: [PATCH 0217/1883] Fixed dynamic merchant list loading. Allows any merchant to be used in any zone. --- changelog.txt | 1 + zone/zone.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8d2670b3c..f5b75ff98 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/06/2014 == demonstar55: Tracking default sort will now be correct order +Trevius: Fixed dynamic merchant list loading. Allows any merchant to be used in any zone. == 11/03/2014 == Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32) diff --git a/zone/zone.cpp b/zone/zone.cpp index 476a61f2a..add9e7c6e 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -445,7 +445,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { std::list merlist; std::string query = StringFormat("SELECT item, slot, faction_required, level_required, alt_currency_cost, " - "classes_required FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); + "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); @@ -459,8 +459,9 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { ml.slot = atoul(row[1]); ml.faction_required = atoul(row[2]); ml.level_required = atoul(row[3]); - ml.alt_currency_cost = atoul(row[3]); - ml.classes_required = atoul(row[4]); + ml.alt_currency_cost = atoul(row[4]); + ml.classes_required = atoul(row[5]); + ml.probability = atoul(row[6]); merlist.push_back(ml); } From 4446a1ed08f17a075cdb75d2a08de98414257c8d Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 8 Nov 2014 02:07:05 -0500 Subject: [PATCH 0218/1883] Mez spells will no longer attempt memblur each tic, just on initial cast. reverted change to calcmaxhp due to potential overflow issues. --- zone/mob.cpp | 2 +- zone/spell_effects.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index e945d0fef..5a56a2180 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -608,7 +608,7 @@ int32 Mob::CalcMaxMana() { int32 Mob::CalcMaxHP() { max_hp = (base_hp + itembonuses.HP + spellbonuses.HP); - max_hp += max_hp * (aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000; + max_hp += max_hp * ((aabonuses.MaxHPChange + spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000.0f); return max_hp; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 8a1285b1e..924af5555 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3558,6 +3558,8 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste case SE_WipeHateList: { + if (IsMezSpell(spell_id)) + break; int wipechance = spells[spell_id].base[i]; int bonus = 0; From d987ccf28969b70629e37ebe9c3537005a527775 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 8 Nov 2014 15:22:03 -0800 Subject: [PATCH 0219/1883] Added transactions for corpse creation, added sql to fix a bug in raid member saving in some situations, fixed a bug in encounters --- common/dbcore.cpp | 12 ++++++++++++ common/dbcore.h | 3 +++ zone/corpse.cpp | 7 +++++++ zone/lua_general.cpp | 1 + zone/raids.cpp | 8 ++++++-- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 21168efa0..fb038db2e 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -234,6 +234,18 @@ bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RE return ret; } +void DBcore::TransactionBegin() { + QueryDatabase("START TRANSACTION"); +} + +void DBcore::TransactionCommit() { + QueryDatabase("COMMIT"); +} + +void DBcore::TransactionRollback() { + QueryDatabase("ROLLBACK"); +} + uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) { // No good reason to lock the DB, we only need it in the first place to check char encoding. // LockMutex lock(&MDatabase); diff --git a/common/dbcore.h b/common/dbcore.h index 56f326467..9dd5aef5e 100644 --- a/common/dbcore.h +++ b/common/dbcore.h @@ -26,6 +26,9 @@ public: bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true); MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true); + void TransactionBegin(); + void TransactionCommit(); + void TransactionRollback(); uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen); void ping(); MYSQL* getMySQL(){ return &mysql; } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index f028b4555..8df695a84 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -402,6 +402,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) } } + database.TransactionBegin(); if(removed_list.size() != 0) { std::stringstream ss(""); ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID(); @@ -433,6 +434,12 @@ Corpse::Corpse(Client* client, int32 in_rezexp) client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead client->Save(); + + Rezzed(false); + Save(); + database.TransactionCommit(); + + return; } //end "not leaving naked corpses" Rezzed(false); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index f0d374870..d58ea21bc 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -146,6 +146,7 @@ void unregister_event(std::string package_name, std::string name, int evt) { iter = elist.erase(iter); break; } + ++iter; } lua_encounter_events_registered[package_name] = elist; } diff --git a/zone/raids.cpp b/zone/raids.cpp index d377d4174..041b92ad4 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -94,6 +94,10 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo c->GetName(), groupleader, rleader, looter); auto results = database.QueryDatabase(query); + if(!results.Success()) { + LogFile->write(EQEMuLog::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + } + LearnMembers(); VerifyRaid(); if (rleader) { @@ -225,12 +229,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - printf("Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - printf("Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); From 275e1144ad908053b641785299b2228b9ccd5535 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 8 Nov 2014 15:22:54 -0800 Subject: [PATCH 0220/1883] Missed the actual sql --- utils/sql/git/required/2014_11_08_RaidMembers.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/required/2014_11_08_RaidMembers.sql diff --git a/utils/sql/git/required/2014_11_08_RaidMembers.sql b/utils/sql/git/required/2014_11_08_RaidMembers.sql new file mode 100644 index 000000000..79e1bb17a --- /dev/null +++ b/utils/sql/git/required/2014_11_08_RaidMembers.sql @@ -0,0 +1 @@ +ALTER TABLE `raid_members` CHANGE COLUMN `groupid` `groupid` INT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `charid`; \ No newline at end of file From efdc177b78c94a03540aaf7637f5c1e7823f3fa2 Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Sat, 8 Nov 2014 21:11:21 -0800 Subject: [PATCH 0221/1883] Implement RoF + UF ornament augmentation.. thanks for the help Drajor! --- common/item.cpp | 15 +++++++ common/item.h | 3 +- common/item_fieldlist.h | 1 + common/item_struct.h | 1 + common/patches/rof.cpp | 57 ++++++++++++++++++++------ common/patches/rof_structs.h | 20 ++++++++- common/patches/underfoot.cpp | 40 +++++++++++++++--- common/patches/underfoot_structs.h | 55 ++++++++++++++++--------- common/ruletypes.h | 1 + common/shareddb.cpp | 1 + world/worlddb.cpp | 10 ++++- zone/client.cpp | 65 ++++++++++++++++++++++++------ zone/client_packet.cpp | 14 +++++-- zone/mob.cpp | 26 +++++++++--- 14 files changed, 247 insertions(+), 62 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index cfa52e0c4..e59edebe3 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1774,6 +1774,21 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const return nullptr; } +ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const +{ + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { + const char *item_IDFile = GetAugment(i)->GetItem()->IDFile; + if (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0) + continue; + + return this->GetAugment(i); + } + } + + return nullptr; +} + uint32 ItemInst::GetAugmentItemID(uint8 slot) const { uint32 id = NO_ITEM; diff --git a/common/item.h b/common/item.h index 9be660117..2542276de 100644 --- a/common/item.h +++ b/common/item.h @@ -329,7 +329,8 @@ public: void DeleteAugment(uint8 slot); ItemInst* RemoveAugment(uint8 index); bool IsAugmented(); - + ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const; + // Has attack/delay? bool IsWeapon() const; bool IsAmmo() const; diff --git a/common/item_fieldlist.h b/common/item_fieldlist.h index c4d54d70f..fb3e4b41e 100644 --- a/common/item_fieldlist.h +++ b/common/item_fieldlist.h @@ -169,6 +169,7 @@ F(bardlevel) F(questitemflag) F(svcorruption) F(purity) +F(evolvinglevel) F(backstabdmg) F(dsmitigation) F(heroic_str) diff --git a/common/item_struct.h b/common/item_struct.h index c91634a6e..26d3623bd 100644 --- a/common/item_struct.h +++ b/common/item_struct.h @@ -217,6 +217,7 @@ struct Item_Struct { // Begin SoF Fields int32 SVCorruption; uint32 Purity; + uint8 EvolvingLevel; uint32 BackstabDmg; uint32 DSMitigation; int32 HeroicStr; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 3a03b3a62..3f39b7187 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4807,6 +4807,7 @@ namespace RoF char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) { + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); uint8 null_term = 0; bool stackable = inst->IsStackable(); uint32 merchant_slot = inst->GetMerchantSlot(); @@ -4847,20 +4848,52 @@ namespace RoF hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; - hdr.unknown056 = 0; - hdr.unknown060 = 0; - hdr.unknown061 = 0; - hdr.unknown062 = 0; - hdr.unknowna1 = 0xffffffff; - hdr.unknowna2 = 0; - hdr.unknown063 = 0; - hdr.unknowna3 = 0; - hdr.unknowna4 = 0xffffffff; - hdr.unknowna5 = 0; - hdr.ItemClass = item->ItemClass; - + hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; ss.write((const char*)&hdr, sizeof(RoF::structs::ItemSerializationHeader)); + if (item->EvolvingLevel > 0) { + RoF::structs::EvolvingItem evotop; + evotop.unknown001 = 0; + evotop.unknown002 = 0; + evotop.unknown003 = 0; + evotop.unknown004 = 0; + evotop.evoLevel = item->EvolvingLevel; + evotop.progress = 95.512; + evotop.Activated = 1; + evotop.evomaxlevel = 7; + ss.write((const char*)&evotop, sizeof(RoF::structs::EvolvingItem)); + } + //ORNAMENT IDFILE / ICON + uint16 ornaIcon = 0; + if (inst->GetOrnamentationAug(ornamentationAugtype)) { + const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + //Mainhand + ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Offhand + ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Icon + ornaIcon = aug_weap->Icon; + } + else { + ss.write((const char*)&null_term, sizeof(uint8)); //no mh + ss.write((const char*)&null_term, sizeof(uint8));//no of + } + + RoF::structs::ItemSerializationHeaderFinish hdrf; + hdrf.ornamentIcon = ornaIcon; + hdrf.unknown061 = 0; + hdrf.unknown062 = 0; + hdrf.unknowna1 = 0xffffffff; + hdrf.unknowna2 = 0; + hdrf.unknown063 = 0; + hdrf.unknowna3 = 0; + hdrf.unknowna4 = 0xffffffff; + hdrf.unknowna5 = 0; + hdrf.ItemClass = item->ItemClass; + ss.write((const char*)&hdrf, sizeof(RoF::structs::ItemSerializationHeaderFinish)); + if (strlen(item->Name) > 0) { ss.write(item->Name, strlen(item->Name)); diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 1393b026e..54d72ec2b 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4405,8 +4405,24 @@ struct ItemSerializationHeader /*064*/ uint32 unknown044; // 0 /*068*/ uint32 unknown048; // 0 /*072*/ uint32 unknown052; // 0 -/*076*/ uint32 unknown056; // 0 -/*080*/ uint8 unknown060; // 0 + uint8 isEvolving; +}; + +struct EvolvingItem { + uint8 unknown001; + uint8 unknown002; + uint8 unknown003; + uint8 unknown004; + int32 evoLevel; + double progress; + uint8 Activated; + int32 evomaxlevel; + uint8 unknown005[4]; +}; + +struct ItemSerializationHeaderFinish +{ + uint16 ornamentIcon; /*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? /*082*/ uint8 unknown062; // 0 /*083*/ uint32 unknowna1; // 0xffffffff diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index ad850be36..f5049d77f 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3594,6 +3594,7 @@ namespace Underfoot char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) { + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); uint8 null_term = 0; bool stackable = inst->IsStackable(); uint32 merchant_slot = inst->GetMerchantSlot(); @@ -3623,13 +3624,40 @@ namespace Underfoot hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; - hdr.unknown056 = 0; - hdr.unknown060 = 0; - hdr.unknown061 = 0; - hdr.unknown062 = 0; - hdr.ItemClass = item->ItemClass; - + hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; ss.write((const char*)&hdr, sizeof(Underfoot::structs::ItemSerializationHeader)); + + if (item->EvolvingLevel > 0) { + Underfoot::structs::EvolvingItem evotop; + evotop.unknown001 = 0; + evotop.unknown002 = 0; + evotop.unknown003 = 0; + evotop.unknown004 = 0; + evotop.evoLevel = item->EvolvingLevel; + evotop.progress = 95.512; + evotop.Activated = 1; + evotop.evomaxlevel = 7; + ss.write((const char*)&evotop, sizeof(Underfoot::structs::EvolvingItem)); + } + //ORNAMENT IDFILE / ICON - + uint16 ornaIcon = 0; + if (inst->GetOrnamentationAug(ornamentationAugtype)) { + const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + ornaIcon = aug_weap->Icon; + } + else { + ss.write((const char*)&null_term, sizeof(uint8)); //no idfile + } + + Underfoot::structs::ItemSerializationHeaderFinish hdrf; + hdrf.ornamentIcon = ornaIcon; + hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit.. + hdrf.unknown061 = 0; //possibly ornament / special ornament + hdrf.isCopied = 0; //Flag for item to be 'Copied' + hdrf.ItemClass = item->ItemClass; + ss.write((const char*)&hdrf, sizeof(Underfoot::structs::ItemSerializationHeaderFinish)); if (strlen(item->Name) > 0) { diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index eec3270f5..0b17412f6 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4001,25 +4001,42 @@ struct ItemVerifyReply_Struct { struct ItemSerializationHeader { -/*000*/ uint32 stacksize; -/*004*/ uint32 unknown004; -/*008*/ uint32 slot; -/*012*/ uint32 price; -/*016*/ uint32 merchant_slot; //1 if not a merchant item -/*020*/ uint32 unknown020; //0 -/*024*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot -/*028*/ uint32 unknown028; //0 -/*032*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 -/*036*/ uint32 charges; //Total Charges an item has (-1 for unlimited) -/*040*/ uint32 inst_nodrop; // 1 if the item is no drop (attuned items) -/*044*/ uint32 unknown044; //0 -/*048*/ uint32 unknown048; //0 -/*052*/ uint32 unknown052; //0 -/*056*/ uint32 unknown056; //0 -/*060*/ uint8 unknown060; //0 -/*061*/ uint8 unknown061; //0 - Add Evolving Item struct if this isn't set to 0? -/*062*/ uint8 unknown062; // New to Underfoot -/*063*/ uint8 ItemClass; //0, 1, or 2 + /*000*/ uint32 stacksize; + /*004*/ uint32 unknown004; + /*008*/ uint32 slot; + /*012*/ uint32 price; + /*016*/ uint32 merchant_slot; //1 if not a merchant item + /*020*/ uint32 unknown020; //0 + /*024*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot + /*028*/ uint32 unknown028; //0 + /*032*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 + /*036*/ uint32 charges; //Total Charges an item has (-1 for unlimited) + /*040*/ uint32 inst_nodrop; // 1 if the item is no drop (attuned items) + /*044*/ uint32 unknown044; //0 + /*048*/ uint32 unknown048; //0 + /*052*/ uint32 unknown052; //0 + /*056*/ uint8 isEvolving; //0 // If 1 Add evolving item data in between Header and HeaderFinish +}; + +struct EvolvingItem { + uint8 unknown001; + uint8 unknown002; + uint8 unknown003; + uint8 unknown004; + int32 evoLevel; + double progress; + uint8 Activated; + int32 evomaxlevel; + uint8 unknown02[4]; +}; + +struct ItemSerializationHeaderFinish +{ + uint16 ornamentIcon; + /*060*/ uint8 unknown060; //0 + /*061*/ uint8 unknown061; //0 - + /*062*/ uint8 isCopied; // New to Underfoot // Copied flag on item + /*063*/ uint8 ItemClass; //0, 1, or 2 }; struct ItemBodyStruct diff --git a/common/ruletypes.h b/common/ruletypes.h index 528770ecb..1fdf95ddb 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -100,6 +100,7 @@ RULE_BOOL ( Character, KeepLevelOverMax, false) // Don't delevel a character tha RULE_INT ( Character, FoodLossPerUpdate, 35) // How much food/water you lose per stamina update RULE_INT ( Character, BaseInstrumentSoftCap, 36) // Softcap for instrument mods, 36 commonly referred to as "3.6" as well. RULE_INT ( Character, BaseRunSpeedCap, 158) // Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225. +RULE_INT ( Character, OrnamentationAugmentType, 20) //Ornamentation Augment Type RULE_CATEGORY_END() RULE_CATEGORY( Mercs ) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index abb1124d5..b37947684 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -950,6 +950,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); item.Purity = (uint32)atoul(row[ItemField::purity]); + item.EvolvingLevel = (uint8)atoul(row[ItemField::evolvinglevel]); item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); diff --git a/world/worlddb.cpp b/world/worlddb.cpp index c82a728eb..3c9e3f128 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -192,7 +192,15 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* /* Weapons are handled a bit differently */ if ((material == MaterialPrimary) || (material == MaterialSecondary)) { if (strlen(item->GetItem()->IDFile) > 2) { - uint32 idfile = atoi(&item->GetItem()->IDFile[2]); + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); + uint32 idfile; + if (item->GetOrnamentationAug(ornamentationAugtype)) { + idfile = atoi(&item->GetOrnamentationAug(ornamentationAugtype)->GetItem()->IDFile[2]); + } + else { + idfile = atoi(&item->GetItem()->IDFile[2]); + } + if (material == MaterialPrimary) cs->primary[char_num] = idfile; else diff --git a/zone/client.cpp b/zone/client.cpp index b45223263..6d491fae0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1882,15 +1882,30 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.equipment[MaterialFeet] = item->Material; ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet); } + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + if (inst->GetOrnamentationAug(ornamentationAugtype)) { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + if (strlen(item->IDFile) > 2) + ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + } + else { + item = inst->GetItem(); + if (strlen(item->IDFile) > 2) + ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + } } if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + if (inst->GetOrnamentationAug(ornamentationAugtype)) { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + if (strlen(item->IDFile) > 2) + ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + } + else { + item = inst->GetItem(); + if (strlen(item->IDFile) > 2) + ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + } } //these two may be related to ns->spawn.texture @@ -2761,6 +2776,7 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){ void Client::SetMaterial(int16 in_slot, uint32 item_id) { const Item_Struct* item = database.GetItem(item_id); + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); if (item && (item->ItemClass==ItemClassCommon)) { if (in_slot==MainHead) m_pp.item_material[MaterialHead] = item->Material; @@ -2776,10 +2792,26 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { m_pp.item_material[MaterialLegs] = item->Material; else if (in_slot==MainFeet) m_pp.item_material[MaterialFeet] = item->Material; - else if (in_slot==MainPrimary) - m_pp.item_material[MaterialPrimary] = atoi(item->IDFile+2); - else if (in_slot==MainSecondary) - m_pp.item_material[MaterialSecondary] = atoi(item->IDFile+2); + else if (in_slot == MainPrimary) { + const ItemInst* inst = m_inv[MainPrimary]; + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); + } + else { + m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); + } + } + else if (in_slot == MainSecondary) { + const ItemInst* inst = m_inv[MainSecondary]; + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); + } + else { + m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); + } + } } } @@ -5629,15 +5661,22 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { const Item_Struct* item = nullptr; const ItemInst* inst = nullptr; - + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for(int16 L = 0; L <= 20; L++) { inst = requestee->GetInv().GetItem(L); if(inst) { item = inst->GetItem(); if(item) { - strcpy(insr->itemnames[L], item->Name); - insr->itemicons[L] = item->Icon; + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { + const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = aug_weap->Icon; + } + else { + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = item->Icon; + } } else insr->itemicons[L] = 0xFFFFFFFF; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 75605a486..29b2b91be 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8174,14 +8174,22 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; Mob* tmp = entity_list.GetMob(insr->TargetID); const Item_Struct* item = nullptr; - + + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) { const ItemInst* inst = GetInv().GetItem(L); item = inst ? inst->GetItem() : nullptr; if (item) { - strcpy(insr->itemnames[L], item->Name); - insr->itemicons[L] = item->Icon; + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { + const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = aug_weap->Icon; + } + else { + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = item->Icon; + } } else { insr->itemicons[L] = 0xFFFFFFFF; } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 513057fed..cb5d9631d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2430,7 +2430,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color) int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { const Item_Struct *item; - + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); item = database.GetItem(GetEquipment(material_slot)); if(item != 0) { @@ -2440,10 +2440,26 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const material_slot == MaterialSecondary ) { - if(strlen(item->IDFile) > 2) - return atoi(&item->IDFile[2]); - else //may as well try this, since were going to 0 anyways - return item->Material; + if (this->IsClient()){ + int currMatslot = MaterialPrimary == material_slot ? MainPrimary : MainSecondary; + const ItemInst* inst = CastToClient()->m_inv[currMatslot]; + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + return atoi(&item->IDFile[2]); + } + else { + if (strlen(item->IDFile) > 2) + return atoi(&item->IDFile[2]); + else //may as well try this, since were going to 0 anyways + return item->Material; + } + } + else { + if (strlen(item->IDFile) > 2) + return atoi(&item->IDFile[2]); + else //may as well try this, since were going to 0 anyways + return item->Material; + } } else { From 587ddc0fddff5611195d1135de9db78e12a12672 Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Sat, 8 Nov 2014 21:29:14 -0800 Subject: [PATCH 0222/1883] fix for copy paste error that linux didnt like --- common/item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/item.h b/common/item.h index 2542276de..e6d1e8bee 100644 --- a/common/item.h +++ b/common/item.h @@ -329,7 +329,7 @@ public: void DeleteAugment(uint8 slot); ItemInst* RemoveAugment(uint8 index); bool IsAugmented(); - ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const; + ItemInst* GetOrnamentationAug(int ornamentationAugtype) const; // Has attack/delay? bool IsWeapon() const; From 77f0e7919e801936d214cd3c1d131d42ba27d171 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Sun, 9 Nov 2014 03:40:33 -0500 Subject: [PATCH 0223/1883] Indentation fix. Ornamentation Augments are integrated now. --- common/shareddb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b37947684..c679cd19c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -950,7 +950,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ item.QuestItemFlag = (atoi(row[ItemField::questitemflag])==0) ? false : true; item.SVCorruption = (int32)atoi(row[ItemField::svcorruption]); item.Purity = (uint32)atoul(row[ItemField::purity]); - item.EvolvingLevel = (uint8)atoul(row[ItemField::evolvinglevel]); + item.EvolvingLevel = (uint8)atoul(row[ItemField::evolvinglevel]); item.BackstabDmg = (uint32)atoul(row[ItemField::backstabdmg]); item.DSMitigation = (uint32)atoul(row[ItemField::dsmitigation]); item.HeroicStr = (int32)atoi(row[ItemField::heroic_str]); From 0ed1e539aebf1587971e0fb3df6f46f51b97a152 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 9 Nov 2014 15:12:31 -0800 Subject: [PATCH 0224/1883] Removed two unused functions --- common/classes.cpp | 47 ---------------------------------------------- common/classes.h | 2 -- 2 files changed, 49 deletions(-) diff --git a/common/classes.cpp b/common/classes.cpp index a1a3bf05a..f33d0354a 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -290,50 +290,3 @@ const char* GetEQClassName(uint8 class_, uint8 level) { } } -uint32 GetArrayEQClass(uint8 eqclass) { - switch (eqclass) { - case WARRIOR: - return WARRIOR; - case CLERIC: - return CLERIC; - case PALADIN: - return PALADIN; - case RANGER: - return RANGER; - case SHADOWKNIGHT: - return SHADOWKNIGHT; - case DRUID: - return DRUID; - case MONK: - return MONK; - case BARD: - return BARD; - case ROGUE: - return ROGUE; - case SHAMAN: - return SHAMAN; - case NECROMANCER: - return NECROMANCER; - case WIZARD: - return WIZARD; - case MAGICIAN: - return MAGICIAN; - case ENCHANTER: - return ENCHANTER; - case BEASTLORD: - return BEASTLORD; - case BERSERKER: - return BERSERKER; - default: - return 0; - } -} - -uint8 GetEQArrayEQClass(uint8 eqclass) { - if (eqclass >= WARRIOR && eqclass <= BERSERKER) - return eqclass - WARRIOR; - if (eqclass >= WARRIORGM && eqclass <= BERSERKERGM) - return eqclass - WARRIORGM; - return WARRIOR; -} - diff --git a/common/classes.h b/common/classes.h index b70609379..c2f0c8acf 100644 --- a/common/classes.h +++ b/common/classes.h @@ -86,7 +86,5 @@ #define call_1 65536 const char* GetEQClassName(uint8 class_, uint8 level = 0); -uint32 GetArrayEQClass(uint8 eqclass); -uint8 GetEQArrayEQClass(uint8 eqclass); #endif From d656db843ac71b495efd0385c31af1bd8277eb8e Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 9 Nov 2014 22:37:12 -0500 Subject: [PATCH 0225/1883] Implemented spell Target Type (45) 'Target Rings' on Underfoot. Thanks to Lecht for figuring out op code side of it. --- changelog.txt | 5 +++++ common/eq_packet_structs.h | 6 +++++- common/patches/underfoot.cpp | 5 +++++ common/patches/underfoot_structs.h | 6 +++++- common/spdat.h | 2 +- zone/client_packet.cpp | 4 ++++ zone/common.h | 1 + zone/effects.cpp | 14 +++++++++++--- zone/mob.cpp | 4 ++++ zone/mob.h | 7 +++++++ zone/spells.cpp | 14 ++++++++++++++ 11 files changed, 62 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index f5b75ff98..058e05542 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- + +== 11/09/2014 == +Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions) +Thanks to Lecht for figuring out the op_code side. + == 11/06/2014 == demonstar55: Tracking default sort will now be correct order Trevius: Fixed dynamic merchant list loading. Allows any merchant to be used in any zone. diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a5e22e44e..0630ce293 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -478,7 +478,11 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint32 cs_unknown1; + uint32 cs_unknown2; + float y_pos; + float x_pos; + float z_pos; }; struct SpellEffect_Struct diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index f5049d77f..78bdb5f2e 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2994,6 +2994,11 @@ namespace Underfoot IN(spell_id); emu->inventoryslot = UnderfootToServerSlot(eq->inventoryslot); IN(target_id); + IN(cs_unknown1); + IN(cs_unknown2); + IN(y_pos); + IN(x_pos); + IN(z_pos); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 0b17412f6..ebad98678 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -519,7 +519,11 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint32 cs_unknown[5]; + uint32 cs_unknown1; + uint32 cs_unknown2; + float y_pos; + float x_pos; + float z_pos; }; /* diff --git a/common/spdat.h b/common/spdat.h index 2dfc016b4..feaddaf84 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -132,7 +132,7 @@ typedef enum { /* 42 */ ST_Directional = 0x2a, //ae around this target between two angles /* 43 */ ST_GroupClientAndPet = 0x2b, /* 44 */ //ST_Beam = 0x2c, //like directional but facing in front of you always -/* 45 */ //ST_Ring = 0x2d, // Like a mix of PB ae + rain spell(has ae duration) +/* 45 */ ST_Ring = 0x2d, /* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target /* 47 */ ST_PetMaster = 0x2f, // uses the master as target } SpellTargetType; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 29b2b91be..73a5c79c9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4034,6 +4034,10 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) return; } + targetring_x = castspell->x_pos; + targetring_y = castspell->y_pos; + targetring_z = castspell->z_pos; + CastSpell(spell_to_cast, castspell->target_id, castspell->slot); } /* Spell Slot or Potion Belt Slot */ diff --git a/zone/common.h b/zone/common.h index 436cd6699..8b6464268 100644 --- a/zone/common.h +++ b/zone/common.h @@ -494,6 +494,7 @@ typedef enum { GroupSpell, // causes effect to caster + target's group CAHateList, // causes effect to all people on caster's hate list within some range DirectionalAE, + TargetRing, CastActUnknown } CastAction_type; diff --git a/zone/effects.cpp b/zone/effects.cpp index 90b9c0c4c..e5c631aaa 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -764,8 +764,14 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (curmob == caster && !affect_caster) //watch for caster too continue; - - dist_targ = center->DistNoRoot(*curmob); + + if (spells[spell_id].targettype == ST_Ring){ + dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(),caster->GetTargetRingZ()); + } + else if (center){ + dist_targ = center->DistNoRoot(*curmob); + } + if (dist_targ > dist2) //make sure they are in range continue; if (dist_targ < min_range2) //make sure they are in range @@ -787,7 +793,9 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ if (bad) { if (!caster->IsAttackAllowed(curmob, true)) continue; - if (!center->CheckLosFN(curmob)) + if (center && !center->CheckLosFN(curmob)) + continue; + if (!center && !caster->CheckLosFN(caster->GetTargetRingX(), caster->GetTargetRingY(),caster->GetTargetRingZ(), curmob->GetSize())) continue; } else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies... // This does not check faction for beneficial AE buffs..only agro and attackable. diff --git a/zone/mob.cpp b/zone/mob.cpp index 7e277d438..d0f973a5a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -369,6 +369,10 @@ Mob::Mob(const char* in_name, nimbus_effect3 = 0; m_targetable = true; + targetring_x = 0.0f; + targetring_y = 0.0f; + targetring_z = 0.0f; + flymode = FlyMode3; // Pathing PathingLOSState = UnknownLOS; diff --git a/zone/mob.h b/zone/mob.h index ec25aff20..6e11c8cfb 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -287,6 +287,9 @@ public: inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } void RemoveNimbusEffect(int effectid); + inline float GetTargetRingX() const { return targetring_x; } + inline float GetTargetRingY() const { return targetring_y; } + inline float GetTargetRingZ() const { return targetring_z; } //Basic Stats/Inventory virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; } @@ -1231,6 +1234,10 @@ protected: float tar_vz; float test_vector; + float targetring_x; + float targetring_y; + float targetring_z; + uint32 m_spellHitsLeft[38]; // Used to track which spells will have their numhits incremented when spell finishes casting, 38 Buffslots int flymode; bool m_targetable; diff --git a/zone/spells.cpp b/zone/spells.cpp index 8ede6aa66..4a4429194 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -368,6 +368,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if((IsGroupSpell(spell_id) || spell.targettype == ST_Self || spell.targettype == ST_AECaster || + spell.targettype == ST_Ring || spell.targettype == ST_TargetOptional) && target_id == 0) { mlog(SPELLS__CASTING, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); @@ -1802,6 +1803,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce break; } + case ST_Ring: + { + CastAction = TargetRing; + spell_target = nullptr; + ae_center = nullptr; + break; + } + default: { mlog(SPELLS__CASTING_ERR, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); @@ -2165,6 +2174,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } break; } + + case TargetRing:{ + entity_list.AESpell(this, nullptr, spell_id, false, resist_adjust); + break; + } } DoAnim(spells[spell_id].CastingAnim, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); From d23608964e1e4daa1be029b6282518a2f9e768bd Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 9 Nov 2014 23:54:01 -0500 Subject: [PATCH 0226/1883] Implement new Live-like faction adjustment message through optional rule. --- changelog.txt | 4 ++++ common/ruletypes.h | 8 ++++---- .../git/optional/2014_11_09_LiveFactionMessages.sql | 1 + zone/client.cpp | 10 ++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql diff --git a/changelog.txt b/changelog.txt index f5b75ff98..95a07644e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/09/2014 == +Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage. +Optional SQL: utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql + == 11/06/2014 == demonstar55: Tracking default sort will now be correct order Trevius: Fixed dynamic merchant list loading. Allows any merchant to be used in any zone. diff --git a/common/ruletypes.h b/common/ruletypes.h index 1fdf95ddb..129e0ed61 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -124,7 +124,6 @@ RULE_INT ( Guild, PlayerCreationLimit, 1) // Only allow use of the UF+ window i RULE_INT ( Guild, PlayerCreationRequiredStatus, 0) // Required admin status. RULE_INT ( Guild, PlayerCreationRequiredLevel, 0) // Required Level of the player attempting to create the guild. RULE_INT ( Guild, PlayerCreationRequiredTime, 0) // Required Time Entitled On Account (in Minutes) to create the guild. - RULE_CATEGORY_END() RULE_CATEGORY( Skills ) @@ -248,7 +247,6 @@ RULE_INT ( Pathing, CullNodesFromStart, 1) // Checks LOS from Start point to se RULE_INT ( Pathing, CullNodesFromEnd, 1) // Checks LOS from End point to second to last node for this many nodes and removes last node if there is LOS RULE_REAL ( Pathing, CandidateNodeRangeXY, 400) // When searching for path start/end nodes, only nodes within this range will be considered. RULE_REAL ( Pathing, CandidateNodeRangeZ, 10) // When searching for path start/end nodes, only nodes within this range will be considered. - RULE_CATEGORY_END() RULE_CATEGORY( Watermap ) @@ -326,7 +324,6 @@ RULE_INT ( Spells, AI_IdleNoSpellMaxRecast, 2000) // AI spell recast time(MS) ch RULE_INT ( Spells, AI_IdleBeneficialChance, 100) // Chance while idle to do a beneficial spell on self or others. RULE_BOOL ( Spells, SHDProcIDOffByOne, true) // pre June 2009 SHD spell procs were off by 1, they stopped doing this in June 2009 (so UF+ spell files need this false) RULE_BOOL ( Spells, Jun182014HundredHandsRevamp, false) // this should be true for if you import a spell file newer than June 18, 2014 - RULE_CATEGORY_END() RULE_CATEGORY( Combat ) @@ -506,7 +503,6 @@ RULE_INT ( Merchant, PricePenaltyPct, 4) // Determines maximum price penalty fro RULE_REAL( Merchant, ChaBonusMod, 3.45) // Determines CHA cap, from 104 CHA. 3.45 is 132 CHA at apprehensive. 0.34 is 400 CHA at apprehensive. RULE_REAL ( Merchant, ChaPenaltyMod, 1.52) // Determines CHA bottom, up to 102 CHA. 1.52 is 37 CHA at apprehensive. 0.98 is 0 CHA at apprehensive. RULE_BOOL ( Merchant, EnableAltCurrencySell, true) // Enables the ability to resell items to alternate currency merchants - RULE_CATEGORY_END() RULE_CATEGORY ( Bazaar ) @@ -590,6 +586,10 @@ RULE_BOOL ( Inventory, EnforceAugmentUsability, true) // Forces augmented item u RULE_BOOL ( Inventory, EnforceAugmentWear, true) // Forces augment wear slot validation RULE_CATEGORY_END() +RULE_CATEGORY( Client ) +RULE_BOOL( Client, UseLiveFactionMessage, false) // Allows players to see faction adjustments like Live +RULE_CATEGORY_END() + #undef RULE_CATEGORY #undef RULE_INT #undef RULE_REAL diff --git a/utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql b/utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql new file mode 100644 index 000000000..de407d283 --- /dev/null +++ b/utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Client:UseLiveFactionMessage', 'false', 'Allow players to see faction adjustments like Live.'); diff --git a/zone/client.cpp b/zone/client.cpp index 6d491fae0..52f046dfd 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7755,12 +7755,14 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalval return; else if (totalvalue >= MAX_PERSONAL_FACTION) Message_StringID(0, FACTION_BEST, name); - else if (tmpvalue > 0 && totalvalue < MAX_PERSONAL_FACTION) - Message_StringID(0, FACTION_BETTER, name); - else if (tmpvalue < 0 && totalvalue > MIN_PERSONAL_FACTION) - Message_StringID(0, FACTION_WORSE, name); else if (totalvalue <= MIN_PERSONAL_FACTION) Message_StringID(0, FACTION_WORST, name); + else if (tmpvalue > 0 && totalvalue < MAX_PERSONAL_FACTION && !RuleB(Client, UseLiveFactionMessage)) + Message_StringID(0, FACTION_BETTER, name); + else if (tmpvalue < 0 && totalvalue > MIN_PERSONAL_FACTION && !RuleB(Client, UseLiveFactionMessage)) + Message_StringID(0, FACTION_WORSE, name); + else if (RuleB(Client, UseLiveFactionMessage)) + Message(0, "Your faction standing with %s has been adjusted by %i.", name, tmpvalue); //New Live faction message (14261) return; } From d5efa0f23c1f5b3600b07f13d3afc9d1bd3cfccf Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 10 Nov 2014 10:00:53 -0500 Subject: [PATCH 0227/1883] Manual merge of TargetRing pull request #286. --- changelog.txt | 3 ++- common/eq_packet_structs.h | 6 +++++- common/patches/underfoot.cpp | 5 +++++ common/patches/underfoot_structs.h | 6 +++++- common/spdat.h | 2 +- zone/client_packet.cpp | 4 ++++ zone/common.h | 1 + zone/effects.cpp | 12 ++++++++++-- zone/mob.cpp | 4 ++++ zone/mob.h | 7 +++++++ zone/spells.cpp | 15 +++++++++++++++ 11 files changed, 59 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 95a07644e..fb47deba4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/09/2014 == -Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage. +Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side. +JJ: Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage. Optional SQL: utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql == 11/06/2014 == diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a5e22e44e..20bd7603e 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -478,7 +478,11 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint8 cs_unknown[4]; + uint32 cs_unknown1; + uint32 cs_unknown2; + float y_pos; + float x_pos; + float z_pos; }; struct SpellEffect_Struct diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index f5049d77f..78bdb5f2e 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2994,6 +2994,11 @@ namespace Underfoot IN(spell_id); emu->inventoryslot = UnderfootToServerSlot(eq->inventoryslot); IN(target_id); + IN(cs_unknown1); + IN(cs_unknown2); + IN(y_pos); + IN(x_pos); + IN(z_pos); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 0b17412f6..6620f6a0a 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -519,7 +519,11 @@ struct CastSpell_Struct uint32 spell_id; uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast uint32 target_id; - uint32 cs_unknown[5]; + uint32 cs_unknown1; + uint32 cs_unknown2; + float y_pos; + float x_pos; + float z_pos; }; /* diff --git a/common/spdat.h b/common/spdat.h index 2dfc016b4..4668cabde 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -132,7 +132,7 @@ typedef enum { /* 42 */ ST_Directional = 0x2a, //ae around this target between two angles /* 43 */ ST_GroupClientAndPet = 0x2b, /* 44 */ //ST_Beam = 0x2c, //like directional but facing in front of you always -/* 45 */ //ST_Ring = 0x2d, // Like a mix of PB ae + rain spell(has ae duration) +/* 45 */ ST_Ring = 0x2d, /* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target /* 47 */ ST_PetMaster = 0x2f, // uses the master as target } SpellTargetType; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 29b2b91be..73a5c79c9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4034,6 +4034,10 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) return; } + targetring_x = castspell->x_pos; + targetring_y = castspell->y_pos; + targetring_z = castspell->z_pos; + CastSpell(spell_to_cast, castspell->target_id, castspell->slot); } /* Spell Slot or Potion Belt Slot */ diff --git a/zone/common.h b/zone/common.h index 436cd6699..8b6464268 100644 --- a/zone/common.h +++ b/zone/common.h @@ -494,6 +494,7 @@ typedef enum { GroupSpell, // causes effect to caster + target's group CAHateList, // causes effect to all people on caster's hate list within some range DirectionalAE, + TargetRing, CastActUnknown } CastAction_type; diff --git a/zone/effects.cpp b/zone/effects.cpp index 90b9c0c4c..4aa972480 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -765,7 +765,13 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ if (curmob == caster && !affect_caster) //watch for caster too continue; - dist_targ = center->DistNoRoot(*curmob); + if (spells[spell_id].targettype == ST_Ring) { + dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ()); + } + else if (center) { + dist_targ = center->DistNoRoot(*curmob); + } + if (dist_targ > dist2) //make sure they are in range continue; if (dist_targ < min_range2) //make sure they are in range @@ -787,7 +793,9 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ if (bad) { if (!caster->IsAttackAllowed(curmob, true)) continue; - if (!center->CheckLosFN(curmob)) + if (center && !center->CheckLosFN(curmob)) + continue; + if (!center && !caster->CheckLosFN(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ(), curmob->GetSize())) continue; } else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies... // This does not check faction for beneficial AE buffs..only agro and attackable. diff --git a/zone/mob.cpp b/zone/mob.cpp index 7e277d438..0c561acc5 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -369,6 +369,10 @@ Mob::Mob(const char* in_name, nimbus_effect3 = 0; m_targetable = true; + targetring_x = 0.0f; + targetring_y = 0.0f; + targetring_z = 0.0f; + flymode = FlyMode3; // Pathing PathingLOSState = UnknownLOS; diff --git a/zone/mob.h b/zone/mob.h index ec25aff20..6e11c8cfb 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -287,6 +287,9 @@ public: inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } void RemoveNimbusEffect(int effectid); + inline float GetTargetRingX() const { return targetring_x; } + inline float GetTargetRingY() const { return targetring_y; } + inline float GetTargetRingZ() const { return targetring_z; } //Basic Stats/Inventory virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; } @@ -1231,6 +1234,10 @@ protected: float tar_vz; float test_vector; + float targetring_x; + float targetring_y; + float targetring_z; + uint32 m_spellHitsLeft[38]; // Used to track which spells will have their numhits incremented when spell finishes casting, 38 Buffslots int flymode; bool m_targetable; diff --git a/zone/spells.cpp b/zone/spells.cpp index 8ede6aa66..ab3d06510 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -368,6 +368,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if((IsGroupSpell(spell_id) || spell.targettype == ST_Self || spell.targettype == ST_AECaster || + spell.targettype == ST_Ring || spell.targettype == ST_TargetOptional) && target_id == 0) { mlog(SPELLS__CASTING, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); @@ -1802,6 +1803,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce break; } + case ST_Ring: + { + CastAction = TargetRing; + spell_target = nullptr; + ae_center = nullptr; + break; + } + default: { mlog(SPELLS__CASTING_ERR, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); @@ -2165,6 +2174,12 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } break; } + + case TargetRing: + { + entity_list.AESpell(this, nullptr, spell_id, false, resist_adjust); + break; + } } DoAnim(spells[spell_id].CastingAnim, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); From 3d44050959e9a56fc6f404d6eedb82428386fcb4 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 10 Nov 2014 10:11:29 -0500 Subject: [PATCH 0228/1883] Implemented support for using target rings from item clicks. (Thanks again to Lecht for the help) --- zone/client_packet.cpp | 13 +++++++------ zone/common.h | 1 + zone/spells.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 73a5c79c9..a5fdd3c92 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4004,6 +4004,10 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) CastSpell_Struct* castspell = (CastSpell_Struct*)app->pBuffer; + targetring_x = castspell->x_pos; + targetring_y = castspell->y_pos; + targetring_z = castspell->z_pos; + #ifdef _EQDEBUG LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); @@ -4034,14 +4038,10 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) return; } - targetring_x = castspell->x_pos; - targetring_y = castspell->y_pos; - targetring_z = castspell->z_pos; - CastSpell(spell_to_cast, castspell->target_id, castspell->slot); } /* Spell Slot or Potion Belt Slot */ - else if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // ITEM or POTION cast + else if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)|| (castspell->slot == TARGET_RING_SPELL_SLOT)) // ITEM or POTION cast { //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { @@ -4051,7 +4051,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) } return; } - else if (m_inv.SupportsClickCasting(castspell->inventoryslot) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // sanity check + else if (m_inv.SupportsClickCasting(castspell->inventoryslot) || (castspell->slot == POTION_BELT_SPELL_SLOT) || (castspell->slot == TARGET_RING_SPELL_SLOT)) // sanity check { // packet field types will be reviewed as packet transistions occur -U const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field @@ -8646,6 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) IsFeared() || IsMezzed() || DivineAura() || + (spells[spell_id].targettype == ST_Ring) || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id)) || (IsDetrimentalSpell(spell_id) && !zone->CanDoCombat()) diff --git a/zone/common.h b/zone/common.h index 8b6464268..fb89dfe77 100644 --- a/zone/common.h +++ b/zone/common.h @@ -19,6 +19,7 @@ #define USE_ITEM_SPELL_SLOT 10 #define POTION_BELT_SPELL_SLOT 11 +#define TARGET_RING_SPELL_SLOT 12 #define DISCIPLINE_SPELL_SLOT 10 #define ABILITY_SPELL_SLOT 9 diff --git a/zone/spells.cpp b/zone/spells.cpp index 4a4429194..af06f26ae 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -254,7 +254,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } //Added to prevent MQ2 exploitation of equipping normally-unequippable/clickable items with effects and clicking them for benefits. - if(item_slot && IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT))) + if(item_slot && IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT))) { ItemInst *itm = CastToClient()->GetInv().GetItem(item_slot); int bitmask = 1; @@ -885,7 +885,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { bool IsFromItem = false; - if(IsClient() && slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && spells[spell_id].recast_time > 1000) { // 10 is item + if(IsClient() && slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && spells[spell_id].recast_time > 1000) { // 10 is item if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); @@ -895,7 +895,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT))) + if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT))) { IsFromItem = true; ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot); @@ -1191,7 +1191,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, int16 DeleteChargeFromSlot = -1; - if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT)) + if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT)) && inventory_slot != 0xFFFFFFFF) // 10 is an item { bool fromaug = false; @@ -2193,7 +2193,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // if this was a spell slot or an ability use up the mana for it // CastSpell already reduced the cost for it if we're a client with focus - if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && mana_used > 0) + if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { mlog(SPELLS__CASTING, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) @@ -2228,7 +2228,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } - if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT))) + if(IsClient() && ((slot == USE_ITEM_SPELL_SLOT) || (slot == POTION_BELT_SPELL_SLOT) || (slot == TARGET_RING_SPELL_SLOT))) { ItemInst *itm = CastToClient()->GetInv().GetItem(inventory_slot); if(itm && itm->GetItem()->RecastDelay > 0){ From 037015617976804dcee2cc15d30b9782ec8a26be Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 10 Nov 2014 10:52:17 -0500 Subject: [PATCH 0229/1883] Fix changelog. [skip ci] --- changelog.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 03aa3bc32..933106dc0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,9 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/09/2014 == -Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions) -Thanks to Lecht for figuring out the op_code side. -Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage. +Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side. JJ: Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage. Optional SQL: utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql From bb5ae7447d2bf5f0854a8c7cd2a6e98ae37d5717 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 10 Nov 2014 21:41:39 -0500 Subject: [PATCH 0230/1883] Fix for GM Trainer crashing server (undefined behavior on enum cast) --- changelog.txt | 2 ++ common/skills.h | 1 + 2 files changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index 933106dc0..215ef1c09 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/10/2014 == +Uleat: Fix for GM Trainer crashing server == 11/09/2014 == Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side. diff --git a/common/skills.h b/common/skills.h index b4064ab3f..d570c565e 100644 --- a/common/skills.h +++ b/common/skills.h @@ -108,6 +108,7 @@ enum SkillUseTypes : uint32 /*13869*/ SkillBerserking, /*13902*/ SkillTaunt, /*05837*/ SkillFrenzy, // This appears to be the only listed one not grouped with the others +/*00000*/ _SkillCount, // SoF+ specific skills // /*03670*/ SkillRemoveTraps, From 793487b825d6bd1027701461437f5b66b914a137 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 10 Nov 2014 22:11:23 -0500 Subject: [PATCH 0231/1883] Yellow faction messages. --- changelog.txt | 1 + zone/client.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 215ef1c09..d6b359099 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/10/2014 == Uleat: Fix for GM Trainer crashing server +JJ: Yellow faction messages. == 11/09/2014 == Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side. diff --git a/zone/client.cpp b/zone/client.cpp index 52f046dfd..a8a3f6f8d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7754,15 +7754,15 @@ void Client::SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalval if (tmpvalue == 0 || temp == 1 || temp == 2) return; else if (totalvalue >= MAX_PERSONAL_FACTION) - Message_StringID(0, FACTION_BEST, name); + Message_StringID(15, FACTION_BEST, name); else if (totalvalue <= MIN_PERSONAL_FACTION) - Message_StringID(0, FACTION_WORST, name); + Message_StringID(15, FACTION_WORST, name); else if (tmpvalue > 0 && totalvalue < MAX_PERSONAL_FACTION && !RuleB(Client, UseLiveFactionMessage)) - Message_StringID(0, FACTION_BETTER, name); + Message_StringID(15, FACTION_BETTER, name); else if (tmpvalue < 0 && totalvalue > MIN_PERSONAL_FACTION && !RuleB(Client, UseLiveFactionMessage)) - Message_StringID(0, FACTION_WORSE, name); + Message_StringID(15, FACTION_WORSE, name); else if (RuleB(Client, UseLiveFactionMessage)) - Message(0, "Your faction standing with %s has been adjusted by %i.", name, tmpvalue); //New Live faction message (14261) + Message(15, "Your faction standing with %s has been adjusted by %i.", name, tmpvalue); //New Live faction message (14261) return; } From 8ae234aedf6bdf5ae5927405adf45b85cf74f6fe Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 11 Nov 2014 00:11:44 -0500 Subject: [PATCH 0232/1883] Real fix for GM trainer crash..evidently the problem went deeper than an undefined condition... --- changelog.txt | 2 +- zone/client_process.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 215ef1c09..4c90cd163 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/10/2014 == -Uleat: Fix for GM Trainer crashing server +Uleat: Fix for GM Trainer crashing server (really!) == 11/09/2014 == Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side. diff --git a/zone/client_process.cpp b/zone/client_process.cpp index d9b2d9030..197562889 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1611,12 +1611,11 @@ void Client::OPGMTraining(const EQApplicationPacket *app) if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) return; - SkillUseTypes sk; - for (sk = Skill1HBlunt; sk <= HIGHEST_SKILL; sk = (SkillUseTypes)(sk+1)) { + for (int sk = Skill1HBlunt; sk <= HIGHEST_SKILL; ++sk) { if(sk == SkillTinkering && GetRace() != GNOME) { gmtrain->skills[sk] = 0; //Non gnomes can't tinker! } else { - gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules(sk, MaxSkill(sk, GetClass(), RuleI(Character, MaxLevel))); + gmtrain->skills[sk] = GetMaxSkillAfterSpecializationRules((SkillUseTypes)sk, MaxSkill((SkillUseTypes)sk, GetClass(), RuleI(Character, MaxLevel))); //this is the highest level that the trainer can train you to, this is enforced clientside so we can't just //Set it to 1 with CanHaveSkill or you wont be able to train past 1. } From 22cc86e6a02d43ea0970474aacfd5bb77bc73d68 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 11 Nov 2014 18:01:21 -0500 Subject: [PATCH 0233/1883] Removed type qualifier for SkillUseTypes enum --- changelog.txt | 3 +++ common/skills.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index a6a01f28a..26c98586a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/11/2014 == +Uleat: Third attempt at a fix for GM trainer zone crashes... (this is starting to look like a KLS fix...) + == 11/10/2014 == Uleat: Fix for GM Trainer crashing server (really!) JJ: Yellow faction messages. diff --git a/common/skills.h b/common/skills.h index d570c565e..23c3b0708 100644 --- a/common/skills.h +++ b/common/skills.h @@ -30,7 +30,7 @@ ** ** (ref: eqstr_us.txt [05-10-2013]) */ -enum SkillUseTypes : uint32 +enum SkillUseTypes { /*13855*/ Skill1HBlunt = 0, /*13856*/ Skill1HSlashing, From 59bcd031c8bf7bd21d7063f74cceac92e83c1dda Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 12 Nov 2014 01:54:21 -0500 Subject: [PATCH 0234/1883] Added a simple check to prevent DoEnduranceUpkeep (1 sec persistent timer) from constantly checking when client has no endurance drain effects. This was running 24/7 for all classes. --- zone/client_process.cpp | 13 ++++++++++--- zone/merc.cpp | 9 ++++++++- zone/mob.cpp | 1 + zone/mob.h | 3 +++ zone/spell_effects.cpp | 3 +++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 197562889..b6889b6ae 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1928,10 +1928,14 @@ void Client::DoEnduranceRegen() } void Client::DoEnduranceUpkeep() { + + if (!HasEndurUpkeep()) + return; + int upkeep_sum = 0; - - int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction; - + int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction; + + bool has_effect = false; uint32 buffs_i; uint32 buff_count = GetMaxTotalSlots(); for (buffs_i = 0; buffs_i < buff_count; buffs_i++) { @@ -1957,6 +1961,9 @@ void Client::DoEnduranceUpkeep() { SetEndurance(GetEndurance() - upkeep_sum); TryTriggerOnValueAmount(false, false, true); } + + if (!has_effect) + SetEndurUpkeep(false); } void Client::CalcRestState() { diff --git a/zone/merc.cpp b/zone/merc.cpp index 8e73b3358..6583cd629 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1160,10 +1160,14 @@ void Merc::SetEndurance(int32 newEnd) } void Merc::DoEnduranceUpkeep() { - int upkeep_sum = 0; + if (!HasEndurUpkeep()) + return; + + int upkeep_sum = 0; int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction; + bool has_effect = false; uint32 buffs_i; uint32 buff_count = GetMaxTotalSlots(); for (buffs_i = 0; buffs_i < buff_count; buffs_i++) { @@ -1187,6 +1191,9 @@ void Merc::DoEnduranceUpkeep() { if(upkeep_sum != 0) SetEndurance(GetEndurance() - upkeep_sum); + + if (!has_effect) + SetEndurUpkeep(false); } void Merc::CalcRestState() { diff --git a/zone/mob.cpp b/zone/mob.cpp index d0f973a5a..0b028dd75 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -391,6 +391,7 @@ Mob::Mob(const char* in_name, for (int i = 0; i < HIGHEST_RESIST+2; i++) { Vulnerability_Mod[i] = 0; } emoteid = 0; + endur_upkeep = false; } Mob::~Mob() diff --git a/zone/mob.h b/zone/mob.h index 6e11c8cfb..94b8ed930 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -290,6 +290,8 @@ public: inline float GetTargetRingX() const { return targetring_x; } inline float GetTargetRingY() const { return targetring_y; } inline float GetTargetRingZ() const { return targetring_z; } + inline bool HasEndurUpkeep() const { return endur_upkeep; } + inline void SetEndurUpkeep(bool val) { endur_upkeep = val; } //Basic Stats/Inventory virtual void SetLevel(uint8 in_level, bool command = false) { level = in_level; } @@ -1130,6 +1132,7 @@ protected: int16 SpellPowerDistanceMod; bool last_los_check; bool pseudo_rooted; + bool endur_upkeep; // Bind wound Timer bindwound_timer; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 924af5555..447d34efd 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -130,6 +130,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) buffs[buffslot].magic_rune = 0; buffs[buffslot].numhits = 0; + if (spells[spell_id].EndurUpkeep > 0) + SetEndurUpkeep(true); + if(IsClient() && CastToClient()->GetClientVersionBit() & BIT_UnderfootAndLater) { EQApplicationPacket *outapp = MakeBuffsPacket(false); From 7943a73cfb8424aff7618885b66159a4c60f187a Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 12 Nov 2014 02:03:24 -0500 Subject: [PATCH 0235/1883] code fix --- zone/client_process.cpp | 1 + zone/merc.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index b6889b6ae..a4c608df4 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1942,6 +1942,7 @@ void Client::DoEnduranceUpkeep() { if (buffs[buffs_i].spellid != SPELL_UNKNOWN) { int upkeep = spells[buffs[buffs_i].spellid].EndurUpkeep; if(upkeep > 0) { + has_effect = true; if(cost_redux > 0) { if(upkeep <= cost_redux) continue; //reduced to 0 diff --git a/zone/merc.cpp b/zone/merc.cpp index 6583cd629..e8c2b7ed9 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1174,6 +1174,7 @@ void Merc::DoEnduranceUpkeep() { if (buffs[buffs_i].spellid != SPELL_UNKNOWN) { int upkeep = spells[buffs[buffs_i].spellid].EndurUpkeep; if(upkeep > 0) { + has_effect = true; if(cost_redux > 0) { if(upkeep <= cost_redux) continue; //reduced to 0 From 85941484969c70fa3ba6e3de80f4f993d5c5568c Mon Sep 17 00:00:00 2001 From: cavedude00 Date: Wed, 12 Nov 2014 11:29:10 -0800 Subject: [PATCH 0236/1883] Fixed npc_types_tint not being loaded properly. --- zone/zonedb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index e18a208ae..a1cf4ecfb 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1892,7 +1892,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { if (!armortint_results.Success() || armortint_results.RowCount() == 0) armor_tint_id = 0; else { - auto armorTint_row = results.begin(); + auto armorTint_row = armortint_results.begin(); for (int index = EmuConstants::MATERIAL_BEGIN; index <= EmuConstants::MATERIAL_END; index++) { tmpNPCType->armor_tint[index] = atoi(armorTint_row[index * 3]) << 16; From f0f5262e3e556b94dd69812d668075aa30e83b09 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 12 Nov 2014 18:17:03 -0500 Subject: [PATCH 0237/1883] Updated 'GMTrainee' structs to reflect the proper size of skills (100) --- changelog.txt | 3 +++ common/eq_packet_structs.h | 6 +++--- common/patches/client62_structs.h | 6 +++--- common/patches/rof_structs.h | 6 +++--- common/patches/sod_structs.h | 6 +++--- common/patches/sof_structs.h | 6 +++--- common/patches/titanium_structs.h | 6 +++--- common/patches/underfoot_structs.h | 6 +++--- common/skills.h | 9 ++++++--- 9 files changed, 30 insertions(+), 24 deletions(-) diff --git a/changelog.txt b/changelog.txt index 26c98586a..b10dfbec7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/12/2014 == +Uleat: Changed 'GMTrainee' struct to reflect the actual client hard-coded max skill count (100) - applies to all currently supported clients (6.2->RoF) + == 11/11/2014 == Uleat: Third attempt at a fix for GM trainer zone crashes... (this is starting to look like a KLS fix...) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 0630ce293..8e72ccaa8 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -601,8 +601,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -858,7 +858,7 @@ static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions ca static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 240; static const uint32 MAX_GROUP_MEMBERS = 6; static const uint32 MAX_RECAST_TYPES = 20; diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h index aae4c7919..691eeba21 100644 --- a/common/patches/client62_structs.h +++ b/common/patches/client62_structs.h @@ -472,8 +472,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -678,7 +678,7 @@ struct LeadershipAA_Struct { static const uint32 MAX_PP_LANGUAGE = 28; static const uint32 MAX_PP_SPELLBOOK = 400; static const uint32 MAX_PP_MEMSPELL = 9; -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 240; static const uint32 MAX_GROUP_MEMBERS = 6; struct PlayerProfile_Struct diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 54d72ec2b..604da1bd7 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -112,7 +112,7 @@ static const uint32 MAX_NUMBER_GUILDS = 1500; static const uint32 MAX_PP_LANGUAGE = 32; // was 25 static const uint32 MAX_PP_SPELLBOOK = 720; // was 480 static const uint32 MAX_PP_MEMSPELL = 16; // was 12 -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 300; static const uint32 MAX_PP_DISCIPLINES = 200; // was 100 static const uint32 MAX_GROUP_MEMBERS = 6; @@ -767,8 +767,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 88c0ed91a..71760514b 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -576,8 +576,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -792,7 +792,7 @@ struct BindStruct { static const uint32 MAX_PP_LANGUAGE = 25; // static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 static const uint32 MAX_GROUP_MEMBERS = 6; static const uint32 MAX_RECAST_TYPES = 20; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index a101d3cba..502763d90 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -554,8 +554,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -770,7 +770,7 @@ struct BindStruct { static const uint32 MAX_PP_LANGUAGE = 25; // static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 static const uint32 MAX_GROUP_MEMBERS = 6; static const uint32 MAX_RECAST_TYPES = 20; diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index e8e5a9f23..b9d299ab9 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -485,8 +485,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -700,7 +700,7 @@ struct BindStruct { static const uint32 MAX_PP_LANGUAGE = 28; static const uint32 MAX_PP_SPELLBOOK = 400; static const uint32 MAX_PP_MEMSPELL = 9; -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 240; static const uint32 MAX_GROUP_MEMBERS = 6; static const uint32 MAX_RECAST_TYPES = 20; diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index ebad98678..bdd1b3a99 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -623,8 +623,8 @@ struct GMTrainee_Struct { /*000*/ uint32 npcid; /*004*/ uint32 playerid; - /*008*/ uint32 skills[73]; - /*300*/ uint8 unknown300[148]; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; /*448*/ }; @@ -839,7 +839,7 @@ struct BindStruct { static const uint32 MAX_PP_LANGUAGE = 25; // static const uint32 MAX_PP_SPELLBOOK = 720; // Confirmed 60 pages on Underfoot now static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Underfoot -static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size static const uint32 MAX_PP_AA_ARRAY = 300; //was 299 static const uint32 MAX_GROUP_MEMBERS = 6; static const uint32 MAX_RECAST_TYPES = 20; diff --git a/common/skills.h b/common/skills.h index 23c3b0708..a589129ed 100644 --- a/common/skills.h +++ b/common/skills.h @@ -108,7 +108,7 @@ enum SkillUseTypes /*13869*/ SkillBerserking, /*13902*/ SkillTaunt, /*05837*/ SkillFrenzy, // This appears to be the only listed one not grouped with the others -/*00000*/ _SkillCount, +/*00000*/ _EmuSkillCount // move to last position of active enumeration labels // SoF+ specific skills // /*03670*/ SkillRemoveTraps, @@ -125,7 +125,6 @@ enum SkillUseTypes // Support values // /*-----*/ _SkillServerArraySize = _SkillCount_RoF2, // Should reflect last client '_SkillCount' -/*-----*/ _SkillPacketArraySize = 100, // Currently supported clients appear to iterate full 100 dword buffer range // Superfluous additions to SkillUseTypes..server-use only // /*-----*/ ExtSkillGenericTradeskill = 100 @@ -153,7 +152,7 @@ enum SkillUseTypes NOTE: Disregard this until it is sorted out I changed (tradeskill==75) to ExtSkillGenericTradeskill in tradeskills.cpp for both instances. If it's a pseudo-enumeration of - an AA ability, then use the 'ExtSkill' ('ExtentedSkill') prefix with a value >= 100. (current implementation) + an AA ability, then use the 'ExtSkill' ('ExtendedSkill') prefix with a value >= 100. (current implementation) We probably need to recode ALL of the skill checks to use the new Skill2HPiercing and ensure that the animation value is properly changed in the patch files. As far as earlier clients using this new skill, it can be done, but we just need to ensure @@ -164,6 +163,7 @@ enum SkillUseTypes In addition to the above re-coding, we're probably going to need to rework the database pp blob to reserve space for the current 100-dword buffer allocation. This way, we can just add new ones without having to rework it each time. + (Wasn't done for this in particular..but, thanks Akkadius!) -U */ @@ -172,6 +172,9 @@ enum SkillUseTypes // temporary until it can be sorted out... #define HIGHEST_SKILL SkillFrenzy +// server profile does not reflect this yet..so, prefixed with 'PACKET_' +#define PACKET_SKILL_ARRAY_SIZE 100 + // TODO: add string return for skill names /* From 9c22de9eb225666e7f67eaddfdd4d09a628577cd Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 12 Nov 2014 19:50:53 -0500 Subject: [PATCH 0238/1883] Not an error if there isn't merchant data to load... --- zone/zone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index add9e7c6e..62f3c1e8a 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -492,7 +492,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone"); + LogFile->write(EQEMuLog::Debug, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { From 16f72be8982f7f4150467c613de2fc294919d23c Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 12 Nov 2014 23:41:38 -0500 Subject: [PATCH 0239/1883] Added remarked #pragma comments around the OPGMTraining problem code (more for a reminder..but, can be enabled if you are having crash issues involving the for-loop) --- zone/client_process.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index a4c608df4..c6265accf 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1611,6 +1611,9 @@ void Client::OPGMTraining(const EQApplicationPacket *app) if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) return; + // if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas +//#pragma GCC push_options +//#pragma GCC optimize ("O0") for (int sk = Skill1HBlunt; sk <= HIGHEST_SKILL; ++sk) { if(sk == SkillTinkering && GetRace() != GNOME) { gmtrain->skills[sk] = 0; //Non gnomes can't tinker! @@ -1620,6 +1623,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app) //Set it to 1 with CanHaveSkill or you wont be able to train past 1. } } +//#pragma GCC pop_options uchar ending[]={0x34,0x87,0x8a,0x3F,0x01 ,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9,0xC9 From fabe93e548a24cbb03eefbfc0bb91465608fab34 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 13 Nov 2014 02:25:18 -0500 Subject: [PATCH 0240/1883] Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). Clean up of target type direction code, implemented use of aemaxtargets field for it. --- changelog.txt | 3 + common/spdat.h | 2 +- zone/common.h | 1 + zone/mob.cpp | 2 + zone/mob.h | 10 ++- zone/npc.cpp | 13 +++- zone/spells.cpp | 198 +++++++++++++++++++++++++++++++++++++----------- 7 files changed, 178 insertions(+), 51 deletions(-) diff --git a/changelog.txt b/changelog.txt index b10dfbec7..b80128505 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/13/2014 == +Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). + == 11/12/2014 == Uleat: Changed 'GMTrainee' struct to reflect the actual client hard-coded max skill count (100) - applies to all currently supported clients (6.2->RoF) diff --git a/common/spdat.h b/common/spdat.h index feaddaf84..83af3cd73 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -131,7 +131,7 @@ typedef enum { /* 41 */ ST_Group = 0x29, /* 42 */ ST_Directional = 0x2a, //ae around this target between two angles /* 43 */ ST_GroupClientAndPet = 0x2b, -/* 44 */ //ST_Beam = 0x2c, //like directional but facing in front of you always +/* 44 */ ST_Beam = 0x2c, /* 45 */ ST_Ring = 0x2d, /* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target /* 47 */ ST_PetMaster = 0x2f, // uses the master as target diff --git a/zone/common.h b/zone/common.h index fb89dfe77..64b6e38af 100644 --- a/zone/common.h +++ b/zone/common.h @@ -495,6 +495,7 @@ typedef enum { GroupSpell, // causes effect to caster + target's group CAHateList, // causes effect to all people on caster's hate list within some range DirectionalAE, + Beam, TargetRing, CastActUnknown } CastAction_type; diff --git a/zone/mob.cpp b/zone/mob.cpp index 0b028dd75..b0dac9dff 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -300,6 +300,8 @@ Mob::Mob(const char* in_name, held = false; nocast = false; focused = false; + _IsTempPet = false; + pet_owner_client = false; attacked_count = 0; mezzed = false; diff --git a/zone/mob.h b/zone/mob.h index 94b8ed930..7bd873d98 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -235,7 +235,9 @@ public: void ResourceTap(int32 damage, uint16 spell_id); void TryTriggerThreshHold(int32 damage, int effect_id, Mob* attacker); bool CheckSpellCategory(uint16 spell_id, int category_id, int effect_id); - + void CalcDestFromHeading(float heading, float distance, float MaxZDiff, float StartX, float StartY, float &dX, float &dY, float &dZ); + void BeamDirectional(uint16 spell_id, int16 resist_adjust); + void ConeDirectional(uint16 spell_id, int16 resist_adjust); //Buff void BuffProcess(); @@ -674,6 +676,10 @@ public: bool HadTempPets() const { return(hasTempPet); } void TempPets(bool i) { hasTempPet = i; } bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } + inline bool IsPetOwnerClient() const { return pet_owner_client; } + inline void SetPetOwnerClient(bool value) { pet_owner_client = value; } + inline bool IsTempPet() const { return _IsTempPet; } + inline void SetTempPet(bool value) { _IsTempPet = value; } inline const bodyType GetBodyType() const { return bodytype; } inline const bodyType GetOrigBodyType() const { return orig_bodytype; } @@ -1225,6 +1231,8 @@ protected: //temppet bool hasTempPet; + bool _IsTempPet; + bool pet_owner_client; //Flags regular and pets as belonging to a client EGNode *_egnode; //the EG node we are in float tarx; diff --git a/zone/npc.cpp b/zone/npc.cpp index c9d3e1879..699f81384 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1847,6 +1847,7 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) Client *c = entity_list.GetClientByID(GetSwarmOwner()); if(c) { SetAllowBeneficial(1); //Allow client cast swarm pets to be heal/buffed. + SetPetOwnerClient(true); //This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'! if (RuleB(Pets, SwarmPetNotTargetableWithHotKey)) ns->spawn.IsMercenary = 1; @@ -1862,16 +1863,20 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.is_pet = 1; if (!IsCharmed() && GetOwnerID()) { Client *c = entity_list.GetClientByID(GetOwnerID()); - if(c) + if(c){ + SetPetOwnerClient(true); sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); + } } else if (GetSwarmOwner()) { ns->spawn.bodytype = 11; if(!IsCharmed()) { Client *c = entity_list.GetClientByID(GetSwarmOwner()); - if(c) + if(c){ + SetPetOwnerClient(true); sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); + } } } } @@ -1880,8 +1885,10 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.is_pet = 1; if (!IsCharmed() && GetOwnerID()) { Client *c = entity_list.GetClientByID(GetOwnerID()); - if(c) + if(c){ + SetPetOwnerClient(true); sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); + } } } else ns->spawn.is_pet = 0; diff --git a/zone/spells.cpp b/zone/spells.cpp index 2e5e16f46..e5178faa3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -369,6 +369,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Self || spell.targettype == ST_AECaster || spell.targettype == ST_Ring || + spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { mlog(SPELLS__CASTING, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); @@ -1803,6 +1804,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce break; } + case ST_Beam: + { + CastAction = Beam; + spell_target = nullptr; + ae_center = nullptr; + break; + } + case ST_Ring: { CastAction = TargetRing; @@ -2126,54 +2135,15 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 case DirectionalAE: { - float angle_start = spells[spell_id].directional_start + (GetHeading() * 360.0f / 256.0f); - float angle_end = spells[spell_id].directional_end + (GetHeading() * 360.0f / 256.0f); - - while(angle_start > 360.0f) - angle_start -= 360.0f; - - while(angle_end > 360.0f) - angle_end -= 360.0f; - - std::list targets_in_range; - std::list::iterator iter; - - entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range); - iter = targets_in_range.begin(); - while(iter != targets_in_range.end()) - { - float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); - while(heading_to_target < 0.0f) - heading_to_target += 360.0f; - - while(heading_to_target > 360.0f) - heading_to_target -= 360.0f; - - if(angle_start > angle_end) - { - if((heading_to_target >= angle_start && heading_to_target <= 360.0f) || - (heading_to_target >= 0.0f && heading_to_target <= angle_end)) - { - if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los){ - (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); - SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); - } - } - } - else - { - if(heading_to_target >= angle_start && heading_to_target <= angle_end) - { - if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los){ - (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); - SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); - } - } - } - ++iter; - } + ConeDirectional(spell_id, resist_adjust); break; } + + case Beam: + { + BeamDirectional(spell_id, resist_adjust); + break; + } case TargetRing: { @@ -5385,3 +5355,139 @@ void Client::SendSpellAnim(uint16 targetid, uint16 spell_id) app.priority = 1; entity_list.QueueCloseClients(this, &app); } + +void Mob::CalcDestFromHeading(float heading, float distance, float MaxZDiff, float StartX, float StartY, float &dX, float &dY, float &dZ) +{ + if (!distance) { return; } + if (!MaxZDiff) { MaxZDiff = 5; } + + float ReverseHeading = 256 - heading; + float ConvertAngle = ReverseHeading * 1.40625f; + if (ConvertAngle <= 270) + ConvertAngle = ConvertAngle + 90; + else + ConvertAngle = ConvertAngle - 270; + + float Radian = ConvertAngle * (3.1415927f / 180.0f); + + float CircleX = distance * cos(Radian); + float CircleY = distance * sin(Radian); + dX = CircleX + StartX; + dY = CircleY + StartY; + dZ = FindGroundZ(dX, dY, MaxZDiff); +} + +void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) +{ + int maxtarget_count = 0; + bool beneficial_targets = false; + + if (IsBeneficialSpell(spell_id) && IsClient()) + beneficial_targets = true; + + std::list targets_in_range; + std::list::iterator iter; + + entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, spells[spell_id].range / 2, targets_in_range); + iter = targets_in_range.begin(); + + float dX = 0; + float dY = 0; + float dZ = 0; + + CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ); + dZ = GetZ(); + + //FIND SLOPE: Put it into the form y = mx + b + float m = (dY - GetY()) / (dX - GetX()); + float b = (GetY() * dX - dY * GetX()) / (dX - GetX()); + + while(iter != targets_in_range.end()) + { + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) + || (*iter)->BehindMob(this, (*iter)->GetX(),(*iter)->GetY())){ + ++iter; + continue; + } + + //# shortest distance from line to target point + float d = abs( (*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); + + if (d <= spells[spell_id].aoerange) + { + if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { + (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); + SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); + maxtarget_count++; + } + + if (maxtarget_count >= spells[spell_id].aemaxtargets) + return; + } + ++iter; + } +} + +void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) +{ + int maxtarget_count = 0; + bool beneficial_targets = false; + + if (IsBeneficialSpell(spell_id) && IsClient()) + beneficial_targets = true; + + float angle_start = spells[spell_id].directional_start + (GetHeading() * 360.0f / 256.0f); + float angle_end = spells[spell_id].directional_end + (GetHeading() * 360.0f / 256.0f); + + while(angle_start > 360.0f) + angle_start -= 360.0f; + + while(angle_end > 360.0f) + angle_end -= 360.0f; + + std::list targets_in_range; + std::list::iterator iter; + + entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range); + iter = targets_in_range.begin(); + + while(iter != targets_in_range.end()){ + + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient()))){ + ++iter; + continue; + } + + float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); + + while(heading_to_target < 0.0f) + heading_to_target += 360.0f; + + while(heading_to_target > 360.0f) + heading_to_target -= 360.0f; + + if(angle_start > angle_end){ + if((heading_to_target >= angle_start && heading_to_target <= 360.0f) || (heading_to_target >= 0.0f && heading_to_target <= angle_end)){ + if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los){ + (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); + SpellOnTarget(spell_id,(*iter), false, true, resist_adjust); + maxtarget_count++; + } + } + } + else{ + if(heading_to_target >= angle_start && heading_to_target <= angle_end){ + if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { + (*iter)->CalcSpellPowerDistanceMod(spell_id, 0, this); + SpellOnTarget(spell_id, (*iter), false, true, resist_adjust); + maxtarget_count++; + } + } + } + + if (maxtarget_count >= spells[spell_id].aemaxtargets) + return; + + ++iter; + } +} \ No newline at end of file From 738fa380471eda76788aafc4aa958dada53ddee4 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 13 Nov 2014 02:46:22 -0500 Subject: [PATCH 0241/1883] Implemented target type (50) which excludes players pets from target AE's. --- common/spdat.h | 3 +++ zone/effects.cpp | 2 ++ zone/spells.cpp | 1 + 3 files changed, 6 insertions(+) diff --git a/common/spdat.h b/common/spdat.h index 83af3cd73..b71b3c2ad 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -135,6 +135,9 @@ typedef enum { /* 45 */ ST_Ring = 0x2d, /* 46 */ ST_TargetsTarget = 0x2e, // uses the target of your target /* 47 */ ST_PetMaster = 0x2f, // uses the master as target +/* 48 */ // UNKNOWN +/* 49 */ // NOT USED +/* 50 */ ST_TargetAENoPlayersPets = 0x32, } SpellTargetType; typedef enum { diff --git a/zone/effects.cpp b/zone/effects.cpp index 02060c10b..9888258d9 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -764,6 +764,8 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (curmob == caster && !affect_caster) //watch for caster too continue; + if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && curmob->IsPetOwnerClient()) + continue; if (spells[spell_id].targettype == ST_Ring) { dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ()); diff --git a/zone/spells.cpp b/zone/spells.cpp index e5178faa3..e6cab8422 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1614,6 +1614,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce case ST_UndeadAE: //should only affect undead... case ST_TargetAETap: case ST_AETarget: + case ST_TargetAENoPlayersPets: { if(!spell_target) { From 352d6fd83c436b467d2cf555fbe8173fed6922ee Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 13 Nov 2014 05:19:01 -0500 Subject: [PATCH 0242/1883] Support for all remaining known spell target types. Implemented target type (32) AE Target HateList Implemented target type (36) Area Client Only Implemented target type (37) Area PC Only Implemented target type (39) Group No Pet --- changelog.txt | 4 +++ common/spdat.h | 2 +- zone/effects.cpp | 4 +++ zone/groups.cpp | 4 +-- zone/hate_list.cpp | 11 +++++--- zone/hate_list.h | 2 +- zone/raids.cpp | 4 +-- zone/spells.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++---- 8 files changed, 78 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index b80128505..d72b4ca23 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). +Kayen: Implemented target type (32) AE Target HateList +Kayen: Implemented target type (36) Area Client Only +Kayen: Implemented target type (37) Area PC Only +Kayen: Implemented target type (39) Group No Pet == 11/12/2014 == Uleat: Changed 'GMTrainee' struct to reflect the actual client hard-coded max skill count (100) - applies to all currently supported clients (6.2->RoF) diff --git a/common/spdat.h b/common/spdat.h index b71b3c2ad..da2e4486c 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -119,7 +119,7 @@ typedef enum { /* 29 */ // NOT USED /* 30 */ // NOT USED /* 31 */ // NOT USED -/* 32 */ ST_AECaster2 = 0x20, //ae caster hatelist maybe? +/* 32 */ ST_AETargetHateList = 0x20, /* 33 */ ST_HateList = 0x21, /* 34 */ ST_LDoNChest_Cursed = 0x22, /* 35 */ ST_Muramite = 0x23, //only works on special muramites diff --git a/zone/effects.cpp b/zone/effects.cpp index 9888258d9..16024c169 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -766,6 +766,10 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && curmob->IsPetOwnerClient()) continue; + if (spells[spell_id].targettype == ST_AreaClientOnly && !curmob->IsClient()) + continue; + if (spells[spell_id].targettype == ST_AreaNPCOnly && !curmob->IsNPC()) + continue; if (spells[spell_id].targettype == ST_Ring) { dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ()); diff --git a/zone/groups.cpp b/zone/groups.cpp index e80650f08..ae51f51c9 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -693,7 +693,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { if(members[z] == caster) { caster->SpellOnTarget(spell_id, caster); #ifdef GROUP_BUFF_PETS - if(caster->GetPet() && caster->HasPetAffinity() && !caster->GetPet()->IsCharmed()) + if(spells[spell_id].targettype != ST_GroupNoPets && caster->GetPet() && caster->HasPetAffinity() && !caster->GetPet()->IsCharmed()) caster->SpellOnTarget(spell_id, caster->GetPet()); #endif } @@ -704,7 +704,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { members[z]->CalcSpellPowerDistanceMod(spell_id, distance); caster->SpellOnTarget(spell_id, members[z]); #ifdef GROUP_BUFF_PETS - if(members[z]->GetPet() && members[z]->HasPetAffinity() && !members[z]->GetPet()->IsCharmed()) + if(spells[spell_id].targettype != ST_GroupNoPets && members[z]->GetPet() && members[z]->HasPetAffinity() && !members[z]->GetPet()->IsCharmed()) caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index e9117db98..2ee904453 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -557,12 +557,15 @@ int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOption return ret; } -void HateList::SpellCast(Mob *caster, uint32 spell_id, float range) +void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_center) { if(!caster) - { return; - } + + Mob* center = caster; + + if (ae_center) + center = ae_center; //this is slower than just iterating through the list but avoids //crashes when people kick the bucket in the middle of this call @@ -578,7 +581,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range) tHateEntry *h = (*iterator); if(range > 0) { - dist_targ = caster->DistNoRoot(*h->ent); + dist_targ = center->DistNoRoot(*h->ent); if(dist_targ <= range && dist_targ >= min_range2) { id_list.push_back(h->ent->GetID()); diff --git a/zone/hate_list.h b/zone/hate_list.h index a3e6c6a88..4ea8d0bd6 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -63,7 +63,7 @@ public: int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); - void SpellCast(Mob *caster, uint32 spell_id, float range); + void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); bool IsEmpty(); void PrintToClient(Client *c); diff --git a/zone/raids.cpp b/zone/raids.cpp index 041b92ad4..d1e8db464 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -478,7 +478,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) if(members[x].member == caster) { caster->SpellOnTarget(spellid, caster); #ifdef GROUP_BUFF_PETS - if(caster->GetPet() && caster->HasPetAffinity() && !caster->GetPet()->IsCharmed()) + if(spells[spellid].targettype != ST_GroupNoPets && caster->GetPet() && caster->HasPetAffinity() && !caster->GetPet()->IsCharmed()) caster->SpellOnTarget(spellid, caster->GetPet()); #endif } @@ -489,7 +489,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) if(distance <= range2){ caster->SpellOnTarget(spellid, members[x].member); #ifdef GROUP_BUFF_PETS - if(members[x].member->GetPet() && members[x].member->HasPetAffinity() && !members[x].member->GetPet()->IsCharmed()) + if(spells[spellid].targettype != ST_GroupNoPets && members[x].member->GetPet() && members[x].member->HasPetAffinity() && !members[x].member->GetPet()->IsCharmed()) caster->SpellOnTarget(spellid, members[x].member->GetPet()); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index e6cab8422..5b8bfef39 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1611,7 +1611,45 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce break; } + case ST_AETargetHateList: + { + if (spells[spell_id].range > 0) + { + if(!spell_target) + return false; + + ae_center = spell_target; + CastAction = AETarget; + } + else { + spell_target = nullptr; + ae_center = this; + CastAction = CAHateList; + } + break; + } + + case ST_AreaClientOnly: + case ST_AreaNPCOnly: + { + if (spells[spell_id].range > 0) + { + if(!spell_target) + return false; + + ae_center = spell_target; + CastAction = AETarget; + } + else { + spell_target = nullptr; + ae_center = this; + CastAction = AECaster; + } + break; + } + case ST_UndeadAE: //should only affect undead... + case ST_SummonedAE: case ST_TargetAETap: case ST_AETarget: case ST_TargetAENoPlayersPets: @@ -1630,6 +1668,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce // Group spells case ST_GroupTeleport: case ST_Group: + case ST_GroupNoPets: { if(IsClient() && CastToClient()->TGB() && IsTGBCompatibleSpell(spell_id)) { if( (!target) || @@ -2043,15 +2082,28 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } else { // regular PB AE or targeted AE spell - spell_target is null if PB if(spell_target) // this must be an AETarget spell - { + { + bool cast_on_target = true; + if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && spell_target->IsPetOwnerClient()) + cast_on_target = false; + if (spells[spell_id].targettype == ST_AreaClientOnly && !spell_target->IsClient()) + cast_on_target = false; + if (spells[spell_id].targettype == ST_AreaNPCOnly && !spell_target->IsNPC()) + cast_on_target = false; + // affect the target too - SpellOnTarget(spell_id, spell_target, false, true, resist_adjust); + if (cast_on_target) + SpellOnTarget(spell_id, spell_target, false, true, resist_adjust); } if(ae_center && ae_center == this && IsBeneficialSpell(spell_id)) SpellOnTarget(spell_id, this); bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster - entity_list.AESpell(this, ae_center, spell_id, affect_caster, resist_adjust); + + if (spells[spell_id].targettype == ST_AETargetHateList) + hate_list.SpellCast(this, spell_id, spells[spell_id].aoerange, ae_center); + else + entity_list.AESpell(this, ae_center, spell_id, affect_caster, resist_adjust); } break; } @@ -2109,7 +2161,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 SpellOnTarget(spell_id, this); #ifdef GROUP_BUFF_PETS //pet too - if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) + if (spells[spell_id].targettype != ST_GroupNoPets && GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) SpellOnTarget(spell_id, GetPet()); #endif } @@ -2117,7 +2169,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 SpellOnTarget(spell_id, spell_target); #ifdef GROUP_BUFF_PETS //pet too - if (spell_target->GetPet() && HasPetAffinity() && !spell_target->GetPet()->IsCharmed()) + if (spells[spell_id].targettype != ST_GroupNoPets && spell_target->GetPet() && HasPetAffinity() && !spell_target->GetPet()->IsCharmed()) SpellOnTarget(spell_id, spell_target->GetPet()); #endif } From b32f59a40db33a6d8396dcdd474bca4a74ce7f8f Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 13 Nov 2014 06:00:01 -0500 Subject: [PATCH 0243/1883] Further support for spell field 'aemaxtargets' --- zone/effects.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 16024c169..7506f99cf 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -752,7 +752,11 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ bool bad = IsDetrimentalSpell(spell_id); bool isnpc = caster->IsNPC(); - const int MAX_TARGETS_ALLOWED = 4; + int MAX_TARGETS_ALLOWED = 4; + + if (spells[spell_id].aemaxtargets) + MAX_TARGETS_ALLOWED = spells[spell_id].aemaxtargets; + int iCounter = 0; for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { @@ -821,10 +825,13 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust); } } else { - caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust); + if (spells[spell_id].aemaxtargets && iCounter < spells[spell_id].aemaxtargets) + caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust); + if (!spells[spell_id].aemaxtargets) + caster->SpellOnTarget(spell_id, curmob, false, true, resist_adjust); } - if (!isnpc) //npcs are not target limited... + if (!isnpc || spells[spell_id].aemaxtargets) //npcs are not target limited (unless casting a spell with a target limit)... iCounter++; } } From 741eca17f4b8ae857c8425914780faf2fece3751 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 13 Nov 2014 13:17:29 -0500 Subject: [PATCH 0244/1883] Added exclusion check for PlayerLogMerchantTransactions partial stack purchase logging --- changelog.txt | 3 +++ zone/client_packet.cpp | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index b10dfbec7..d93a000ca 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/13/2014 == +Uleat: PlayerLogMerchantTransactions does not support partial stack purchase logging at this time + == 11/12/2014 == Uleat: Changed 'GMTrainee' struct to reflect the actual client hard-coded max skill count (100) - applies to all currently supported clients (6.2->RoF) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7bc91f0f5..474e66031 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12245,7 +12245,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) mpo->npcid = mp->npcid; mpo->itemslot = mp->itemslot; - int16 freeslotid = 0; + int16 freeslotid = INVALID_INDEX; int16 charges = 0; if (item->Stackable || item->MaxCharges > 1) charges = mp->quantity; @@ -12271,6 +12271,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) return; } + // this area needs some work..two inventory insertion check failure points + // below do not return player's money..is this the intended behavior? + if (!TakeMoneyFromPP(mpo->price)) { char *hacker_str = nullptr; @@ -12288,6 +12291,8 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) if (!stacked) freeslotid = m_inv.FindFreeSlot(false, true, item->Size); + // shouldn't we be reimbursing if these two fail? + //make sure we are not completely full... if (freeslotid == MainCursor) { if (m_inv.GetItem(MainCursor) != nullptr) { @@ -12342,7 +12347,8 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) safe_delete(outapp); // start QS code - if (RuleB(QueryServ, PlayerLogMerchantTransactions)) { + // stacking purchases not supported at this time - entire process will need some work to catch them properly + if (RuleB(QueryServ, PlayerLogMerchantTransactions) && (!stacked) && m_inv[freeslotid]) { ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, sizeof(QSMerchantLogTransaction_Struct)+sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; @@ -12363,11 +12369,11 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) qsaudit->items[0].char_slot = freeslotid; qsaudit->items[0].item_id = m_inv[freeslotid]->GetID(); qsaudit->items[0].charges = mpo->quantity; - qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(1); - qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(2); - qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(3); - qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(4); - qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(5); + qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(0); + qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(1); + qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(2); + qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(3); + qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(4); qspack->Deflate(); if (worldserver.Connected()) { worldserver.SendPacket(qspack); } From 563a39c2d904a08942148ec9425cd6727acd2eb0 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 13 Nov 2014 21:45:19 -0500 Subject: [PATCH 0245/1883] Spell field defined that determines if must be sneaking to use this ability. This is handled by client under normal conditions, however if you force cast this effect in situations like 'procs' you can cause zone crashes, therefore a failsafe check is added in 'SpellOnTarget' --- changelog.txt | 2 +- common/shareddb.cpp | 1 + common/spdat.h | 2 +- zone/spells.cpp | 7 ++++++- zone/string_ids.h | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index d72b4ca23..52e445090 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,6 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 11/13/2014 == +== 11/14/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). Kayen: Implemented target type (32) AE Target HateList Kayen: Implemented target type (36) Area Client Only diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c679cd19c..1f30a3481 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1564,6 +1564,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].NimbusEffect = atoi(row[193]); sp[tempid].directional_start = static_cast(atoi(row[194])); sp[tempid].directional_end = static_cast(atoi(row[195])); + sp[tempid].sneak = atoi(row[196]) != 0; sp[tempid].not_extendable = atoi(row[197]) != 0; sp[tempid].suspendable = atoi(row[200]) != 0; sp[tempid].viral_range = atoi(row[201]); diff --git a/common/spdat.h b/common/spdat.h index da2e4486c..410269813 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -722,7 +722,7 @@ struct SPDat_Spell_Struct /* 193 */ int NimbusEffect; /* 194 */ float directional_start; //Cone Start Angle: /* 195 */ float directional_end; // Cone End Angle: -/* 196 */ +/* 196 */ bool sneak; // effect can only be used if sneaking (rogue 'Daggerfall' ect) /* 197 */ bool not_extendable; /* 198- 199 */ /* 200 */ bool suspendable; // buff is suspended in suspended buff zones diff --git a/zone/spells.cpp b/zone/spells.cpp index 5b8bfef39..6c6119831 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3262,6 +3262,11 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsClient() && spelltar->CastToClient()->IsHoveringForRespawn()) return false; + if (spells[spell_id].sneak && IsClient() && !CastToClient()->sneaking){ + Message_StringID(13, SNEAK_RESTRICT); + return false;//Fail Safe, this can cause a zone crash certain situations if you try to apply sneak effects when not sneaking. + } + if(IsDetrimentalSpell(spell_id) && !IsAttackAllowed(spelltar) && !IsResurrectionEffects(spell_id)) { if(!IsClient() || !CastToClient()->GetGM()) { Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); @@ -4711,7 +4716,7 @@ void NPC::Stun(int duration) { void NPC::UnStun() { Mob::UnStun(); - SetRunAnimSpeed(this->GetRunspeed()); + SetRunAnimSpeed(static_cast(GetRunspeed())); SendPosition(); } diff --git a/zone/string_ids.h b/zone/string_ids.h index 41e0960b0..a12b8640e 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -338,6 +338,7 @@ #define STRIKETHROUGH_STRING 9078 //You strike through your opponent's defenses! #define SPELL_REFLECT 9082 //%1's spell has been reflected by %2. #define NEW_SPELLS_AVAIL 9149 //You have new spells available to you. Check the merchants near your guild master. +#define SNEAK_RESTRICT 9240 //You can not use this ability because you have not been hidden for long enough. #define PET_NOW_FOCUSING 9254 //Focusing on one target, Master. #define PET_NOT_FOCUSING 9263 //No longer focusing on one target, Master. #define PET_NOT_CASTING 9264 //Not casting spells, Master. From 6c7a4edae366b179e4d4d462cd2f080fce192a27 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 14 Nov 2014 00:23:26 -0500 Subject: [PATCH 0246/1883] Support for spell field to determine if a spell can be blocked or not. Numerous other spell fields defined. Required sql added for updating spells_new field definations. --- common/shareddb.cpp | 3 +++ common/spdat.h | 10 +++++++--- .../sql/git/required/2014_11_13_spells_new_updates.sql | 9 +++++++++ zone/client_packet.cpp | 4 ++-- zone/string_ids.h | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 utils/sql/git/required/2014_11_13_spells_new_updates.sql diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 1f30a3481..b0f29c74b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1526,6 +1526,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].CastingAnim=atoi(row[120]); sp[tempid].SpellAffectIndex=atoi(row[123]); sp[tempid].disallow_sit=atoi(row[124]); + sp[tempid].diety_agnostic=atoi(row[125]); for (y = 0; y < 16; y++) sp[tempid].deities[y]=atoi(row[126+y]); @@ -1544,6 +1545,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].reflectable = atoi(row[161]) != 0; sp[tempid].bonushate=atoi(row[162]); + sp[tempid].ldon_trap = atoi(row[165]) != 0; sp[tempid].EndurCost=atoi(row[166]); sp[tempid].EndurTimerIndex=atoi(row[167]); sp[tempid].IsDisciplineBuff = atoi(row[168]) != 0; @@ -1568,6 +1570,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[tempid].not_extendable = atoi(row[197]) != 0; sp[tempid].suspendable = atoi(row[200]) != 0; sp[tempid].viral_range = atoi(row[201]); + sp[tempid].no_block = atoi(row[205]); sp[tempid].spellgroup=atoi(row[207]); sp[tempid].rank = atoi(row[208]); sp[tempid].powerful_flag=atoi(row[209]); diff --git a/common/spdat.h b/common/spdat.h index 410269813..19f2394c9 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -676,7 +676,7 @@ struct SPDat_Spell_Struct /* 122 */ //uint32 TravelType; /* 123 */ uint16 SpellAffectIndex; /* 124 */ int8 disallow_sit; // 124: high-end Yaulp spells (V, VI, VII, VIII [Rk 1, 2, & 3], & Gallenite's Bark of Fury -/* 125 */ // 125: Words of the Skeptic +/* 125 */ int8 diety_agnostic;// 125: Words of the Skeptic /* 126 */ int8 deities[16]; // Deity check. 201 - 216 per http://www.eqemulator.net/wiki/wikka.php?wakka=DeityList // -1: Restrict to Deity; 1: Restrict to Deity, but only used on non-Live (Test Server "Blessing of ...") spells; 0: Don't restrict /* 142 */ // 142: between 0 & 100 @@ -700,6 +700,7 @@ struct SPDat_Spell_Struct /* 162 */ int bonushate; /* 163 */ /* 164 */ // for most spells this appears to mimic ResistDiff +/* 165 */ bool ldon_trap; //Flag found on all LDON trap / chest related spells. /* 166 */ int EndurCost; /* 167 */ int8 EndurTimerIndex; /* 168 */ bool IsDisciplineBuff; //Will goto the combat window when cast @@ -712,7 +713,8 @@ struct SPDat_Spell_Struct /* 178 */ int pvpresistcalc; /* 179 */ int pvpresistcap; /* 180 */ int spell_category; -/* 181 */ +/* 181 */ //unknown - likely buff duration related +/* 182 */ //unknown - likely buff duration related /* 185 */ int8 can_mgb; // 0=no, -1 or 1 = yes /* 186 */ int dispel_flag; /* 189 */ int MinResist; @@ -729,7 +731,9 @@ struct SPDat_Spell_Struct /* 201 */ int viral_range; /* 202 */ /* 203 */ //int songcap; // individual song cap (how live currently does it, not implemented) -/* 204 - 206 */ +/* 204 */ +/* 205 */ bool no_block; +/* 206 */ /* 207 */ int spellgroup; /* 208 */ int rank; //increments AA effects with same name /* 209 */ int powerful_flag; // Need more investigation to figure out what to call this, for now we know -1 makes charm spells not break before their duration is complete, it does alot more though diff --git a/utils/sql/git/required/2014_11_13_spells_new_updates.sql b/utils/sql/git/required/2014_11_13_spells_new_updates.sql new file mode 100644 index 000000000..310a3de15 --- /dev/null +++ b/utils/sql/git/required/2014_11_13_spells_new_updates.sql @@ -0,0 +1,9 @@ +-- spells new table update +ALTER TABLE `spells_new` CHANGE `field124` `disallow_sit` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field124` `deities0` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field196` `sneaking` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field158` `effectdescnum2` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field165` `ldon_trap` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field205` `no_block` INT(11) NOT NULL DEFAULT '0'; + + diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 474e66031..63e507162 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3770,7 +3770,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) for (unsigned int i = 0; i < BLOCKED_BUFF_COUNT; ++i) { - if ((bbs->SpellID[i] > 0) && IsBeneficialSpell(bbs->SpellID[i])) + if ((IsValidSpell(bbs->SpellID[i])) && IsBeneficialSpell(bbs->SpellID[i]) && !spells[bbs->SpellID[i]].no_block) { if (BlockedBuffs->find(bbs->SpellID[i]) == BlockedBuffs->end()) BlockedBuffs->insert(bbs->SpellID[i]); @@ -3818,7 +3818,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) for (unsigned int i = 0; i < BLOCKED_BUFF_COUNT; ++i) { - if (!IsBeneficialSpell(bbs->SpellID[i])) + if (!IsValidSpell(bbs->SpellID[i]) || !IsBeneficialSpell(bbs->SpellID[i]) || spells[bbs->SpellID[i]].no_block) continue; if ((BlockedBuffs->size() < BLOCKED_BUFF_COUNT) && (BlockedBuffs->find(bbs->SpellID[i]) == BlockedBuffs->end())) diff --git a/zone/string_ids.h b/zone/string_ids.h index a12b8640e..57711a40d 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -299,6 +299,7 @@ #define SENTINEL_TRIG_YOU 6724 //You have triggered your sentinel. #define SENTINEL_TRIG_OTHER 6725 //%1 has triggered your sentinel. #define IDENTIFY_SPELL 6765 //Item Lore: %1. +#define BUFF_NOT_BLOCKABLE 7608 //You cannot block this effect. #define LDON_DONT_KNOW_TRAPPED 7552 //You do not know if this object is trapped. #define LDON_HAVE_DISARMED 7553 //You have disarmed %1! #define LDON_ACCIDENT_SETOFF 7554 //You accidentally set off the trap! From 4a26466b2baf622b3187b0ab1efbc54f176f676b Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 14 Nov 2014 00:26:14 -0500 Subject: [PATCH 0247/1883] add --- common/spdat.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/spdat.h b/common/spdat.h index 19f2394c9..ed8a86e20 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -715,8 +715,12 @@ struct SPDat_Spell_Struct /* 180 */ int spell_category; /* 181 */ //unknown - likely buff duration related /* 182 */ //unknown - likely buff duration related +/* 183 */ +/* 184 */ /* 185 */ int8 can_mgb; // 0=no, -1 or 1 = yes /* 186 */ int dispel_flag; +/* 187 */ //int npc_category; +/* 188 */ //int npc_usefulness; /* 189 */ int MinResist; /* 190 */ int MaxResist; /* 191 */ uint8 viral_targets; From cbc8e652b9fbfda38fcbc38fee12e0975f24ab00 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 14 Nov 2014 00:34:17 -0500 Subject: [PATCH 0248/1883] fix --- utils/sql/git/required/2014_11_13_spells_new_updates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/sql/git/required/2014_11_13_spells_new_updates.sql b/utils/sql/git/required/2014_11_13_spells_new_updates.sql index 310a3de15..a3863cbd8 100644 --- a/utils/sql/git/required/2014_11_13_spells_new_updates.sql +++ b/utils/sql/git/required/2014_11_13_spells_new_updates.sql @@ -1,6 +1,6 @@ -- spells new table update ALTER TABLE `spells_new` CHANGE `field124` `disallow_sit` INT(11) NOT NULL DEFAULT '0'; -ALTER TABLE `spells_new` CHANGE `field124` `deities0` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `spells_new` CHANGE `field125` `deities0` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `spells_new` CHANGE `field196` `sneaking` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `spells_new` CHANGE `field158` `effectdescnum2` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `spells_new` CHANGE `field165` `ldon_trap` INT(11) NOT NULL DEFAULT '0'; From 8e20f3e7dcb15e3fe92fd4f17ebb703137221018 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 14 Nov 2014 17:57:55 -0500 Subject: [PATCH 0249/1883] Updated #peekinv to use MakeItemLink (per Natedog's suggestion) --- zone/command.cpp | 518 +++++++++++++++++++++++++++-------------------- 1 file changed, 297 insertions(+), 221 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index f7225e2ee..daa5f18d8 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2775,237 +2775,313 @@ void command_nukeitem(Client *c, const Seperator *sep) void command_peekinv(Client *c, const Seperator *sep) { - // Displays what the server thinks the user has in inventory + static enum { + peekWorn = 0x01, + peekInv = 0x02, + peekCursor = 0x04, + peekTrib = 0x08, + peekBank = 0x10, + peekTrade = 0x20, + peekWorld = 0x40 + }; + if (!c->GetTarget() || !c->GetTarget()->IsClient()) { c->Message(0, "You must have a PC target selected for this command"); return; } - // linkcore_# indicates the number of consecutive 0's..not the actual length - const std::string linkcore_49 = "%c%06X0000000000000000000000000000000000000000000000000%s%c"; // RoF+ - const std::string linkcore_44 = "%c%06X00000000000000000000000000000000000000000000%s%c"; // SoF->UF - const std::string linkcore_39 = "%c%06X000000000000000000000000000000000000000%s%c"; // 6.2->Ti - const char* linkcore = nullptr; - std::string linkbase = ""; + int scopeWhere = 0; - // consider pushing 'linkcores' to EQLimits - if (c->GetClientVersion() >= EQClientRoF) - linkcore = linkcore_49.c_str(); - else if (c->GetClientVersion() >= EQClientSoF) - linkcore = linkcore_44.c_str(); - else - linkcore = linkcore_39.c_str(); + if (strcasecmp(sep->arg[1], "all") == 0) { scopeWhere = ~0; } + else if (strcasecmp(sep->arg[1], "worn") == 0) { scopeWhere |= peekWorn; } + else if (strcasecmp(sep->arg[1], "inv") == 0) { scopeWhere |= peekInv; } + else if (strcasecmp(sep->arg[1], "cursor") == 0) { scopeWhere |= peekCursor; } + else if (strcasecmp(sep->arg[1], "trib") == 0) { scopeWhere |= peekTrib; } + else if (strcasecmp(sep->arg[1], "bank") == 0) { scopeWhere |= peekBank; } + else if (strcasecmp(sep->arg[1], "trade") == 0) { scopeWhere |= peekTrade; } + else if (strcasecmp(sep->arg[1], "world") == 0) { scopeWhere |= peekWorld; } - bool bAll = (strcasecmp(sep->arg[1], "all") == 0); - bool bFound = false; - Client* client = c->GetTarget()->CastToClient(); - const Item_Struct* item = nullptr; - c->Message(0, "Displaying inventory for %s...", client->GetName()); - - if (bAll || (strcasecmp(sep->arg[1], "worn")==0)) { - // Worn items - bFound = true; - for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - if (c->GetClientVersion() >= EQClientSoF) - { - const ItemInst* inst = client->GetInv().GetItem(MainPowerSource); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", - MainPowerSource, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - - } - - if (bAll || (strcasecmp(sep->arg[1], "inv")==0)) { - // Personal inventory items - bFound = true; - for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - if (inst && inst->IsType(ItemClassContainer)) { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - const ItemInst* instbag = client->GetInv().GetItem(i, j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - } - - // Changed to show 'empty' cursors and not to show bag slots on 'queued' cursor slots (cursor bag slots 331 to 340 are not arrayed...) - // - was pointless to show bags on anything after slot 30[0], because it only repeated the 30[0] bag items. - if (bAll || (strcasecmp(sep->arg[1], "cursor")==0)) { - // Personal inventory items - bFound = true; - iter_queue it; - int i = 0; - - if(client->GetInv().CursorEmpty()) { // Display 'front' cursor slot even if 'empty' (item(30[0]) == null) - linkbase = StringFormat(linkcore, 0x12, 0, "null", 0x12); - c->Message((item == 0), "CursorSlot: %i, Item: %i (%s), Charges: %i", - MainCursor, 0, linkbase.c_str(), 0); - } - else { - for(it=client->GetInv().cursor_begin();it!=client->GetInv().cursor_end();++it,i++) { - const ItemInst* inst = *it; - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", - MainCursor, i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - if (inst && inst->IsType(ItemClassContainer) && i==0) { // 'CSD 1' - only display contents of slot 30[0] container..higher ones don't exist - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - const ItemInst* instbag = client->GetInv().GetItem(MainCursor, j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(MainCursor, j), MainCursor, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - } - } - - if (bAll || (strcasecmp(sep->arg[1], "trib")==0)) { - // Active tribute effect items - bFound = true; - for (int16 i = EmuConstants::TRIBUTE_BEGIN; i <= EmuConstants::TRIBUTE_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - - if (bAll || (strcasecmp(sep->arg[1], "bank")==0)) { - // Bank and shared bank items - bFound = true; - int16 i = 0; - for (i = EmuConstants::BANK_BEGIN; i <= EmuConstants::BANK_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - if (inst && inst->IsType(ItemClassContainer)) { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - const ItemInst* instbag = client->GetInv().GetItem(i, j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - for (i = EmuConstants::SHARED_BANK_BEGIN; i <= EmuConstants::SHARED_BANK_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - if (inst && inst->IsType(ItemClassContainer)) { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - const ItemInst* instbag = client->GetInv().GetItem(i, j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - } - - if (bAll || (strcasecmp(sep->arg[1], "trade")==0)) { - // Items in trade window (current trader only, not the other trader) - bFound = true; - for (int16 i = EmuConstants::TRADE_BEGIN; i <= EmuConstants::TRADE_END; i++) { - const ItemInst* inst = client->GetInv().GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", - i, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - if (inst && inst->IsType(ItemClassContainer)) { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { - const ItemInst* instbag = client->GetInv().GetItem(i, j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(i, j), i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - } - - if (bAll || (strcasecmp(sep->arg[1], "world") == 0)) { - // Items in world container (if present) - bFound = true; - - Object* tsobject = c->GetTradeskillObject(); - - if (tsobject == nullptr) { - c->Message(1, "No world tradeskill object selected..."); - } - else { - c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", tsobject->GetDBID(), tsobject->GetID()); - - for (int16 i = MAIN_BEGIN; i < EmuConstants::MAP_WORLD_SIZE; ++i) { - const ItemInst* inst = tsobject->GetItem(i); - item = (inst) ? inst->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", - (EmuConstants::WORLD_BEGIN + i), ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - - // this should never happen ('WorldBagSlot' as -1 indicates an error state in this implementation) - if (inst && inst->IsType(ItemClassContainer)) { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; ++j) { - const ItemInst* instbag = inst->GetItem(j); - item = (instbag) ? instbag->GetItem() : nullptr; - - linkbase = StringFormat(linkcore, 0x12, ((item == 0) ? 0 : item->ID), ((item == 0) ? "null" : item->Name), 0x12); - c->Message((item == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - -1, i, j, ((item == 0) ? 0 : item->ID), linkbase.c_str(), ((item == 0) ? 0 : inst->GetCharges())); - } - } - } - } - } - - if (!bFound) - { + if (scopeWhere == 0) { c->Message(0, "Usage: #peekinv [worn|inv|cursor|trib|bank|trade|world|all]"); c->Message(0, " Displays a portion of the targeted user's inventory"); c->Message(0, " Caution: 'all' is a lot of information!"); + return; + } + + Client* targetClient = c->GetTarget()->CastToClient(); + const ItemInst* instMain = nullptr; + const ItemInst* instSub = nullptr; + const Item_Struct* itemData = nullptr; + char* itemLinkCore = nullptr; + std::string itemLink; + + c->Message(0, "Displaying inventory for %s...", targetClient->GetName()); + + // worn + for (int16 indexMain = EmuConstants::EQUIPMENT_BEGIN; (scopeWhere & peekWorn) && (indexMain <= EmuConstants::EQUIPMENT_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + } + + if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= EQClientSoF)) { + instMain = targetClient->GetInv().GetItem(MainPowerSource); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", + MainPowerSource, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + } + + // inv + for (int16 indexMain = EmuConstants::GENERAL_BEGIN; (scopeWhere & peekInv) && (indexMain <= EmuConstants::GENERAL_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + + // cursor + if (scopeWhere & peekCursor) { + if (targetClient->GetInv().CursorEmpty()) { + c->Message(1, "CursorSlot: %i, Item: %i (%s), Charges: %i", + MainCursor, 0, "null", 0); + } + else { + int cursorDepth = 0; + for (iter_queue it = targetClient->GetInv().cursor_begin(); (it != targetClient->GetInv().cursor_end()); ++it, ++cursorDepth) { + instMain = *it; + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", + MainCursor, cursorDepth, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; (cursorDepth == 0) && instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + } + } + + // trib + for (int16 indexMain = EmuConstants::TRIBUTE_BEGIN; (scopeWhere & peekTrib) && (indexMain <= EmuConstants::TRIBUTE_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + } + + // bank + for (int16 indexMain = EmuConstants::BANK_BEGIN; (scopeWhere & peekBank) && (indexMain <= EmuConstants::BANK_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null" ); + + c->Message((itemData == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + + for (int16 indexMain = EmuConstants::SHARED_BANK_BEGIN; (scopeWhere & peekBank) && (indexMain <= EmuConstants::SHARED_BANK_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + + // trade + for (int16 indexMain = EmuConstants::TRADE_BEGIN; (scopeWhere & peekTrade) && (indexMain <= EmuConstants::TRADE_END); ++indexMain) { + instMain = targetClient->GetInv().GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + + // world + if (scopeWhere & peekWorld) { + Object* objectTradeskill = targetClient->GetTradeskillObject(); + + if (objectTradeskill == nullptr) { + c->Message(1, "No world tradeskill object selected..."); + } + else { + c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", objectTradeskill->GetDBID(), objectTradeskill->GetID()); + + for (int16 indexMain = MAIN_BEGIN; indexMain < EmuConstants::MAP_WORLD_SIZE; ++indexMain) { + instMain = objectTradeskill->GetItem(indexMain); + itemData = (instMain ? instMain->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instMain); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", + (EmuConstants::WORLD_BEGIN + indexMain), ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + + safe_delete_array(itemLinkCore); + + for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + instSub = instMain->GetItem(indexSub); + itemData = (instSub ? instSub->GetItem() : nullptr); + itemLinkCore = nullptr; + + if (itemData) + c->MakeItemLink(itemLinkCore, instSub); + + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); + + c->Message((itemData == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + INVALID_INDEX, indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + + safe_delete_array(itemLinkCore); + } + } + } } } From 51b6db977f704787f7dc714c6a00d53d98eb5ef5 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Fri, 14 Nov 2014 18:22:06 -0500 Subject: [PATCH 0250/1883] Identified object size and solidtype as flags. Exported them as functions to Perl. --- changelog.txt | 3 ++ zone/object.cpp | 36 +++++++++++++++ zone/object.h | 4 ++ zone/perl_object.cpp | 105 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+) diff --git a/changelog.txt b/changelog.txt index aac15127e..eac7536d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/14/2014 == +Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. + == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). Kayen: Implemented target type (32) AE Target HateList diff --git a/zone/object.cpp b/zone/object.cpp index 51d0e924a..0201434c0 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -798,6 +798,42 @@ void Object::SetModelName(const char* modelname) safe_delete(app2); } +void Object::SetSize(uint16 size) +{ + m_data.unknown008 = size; + EQApplicationPacket* app = new EQApplicationPacket(); + EQApplicationPacket* app2 = new EQApplicationPacket(); + this->CreateDeSpawnPacket(app); + this->CreateSpawnPacket(app2); + entity_list.QueueClients(0, app); + entity_list.QueueClients(0, app2); + safe_delete(app); + safe_delete(app2); +} + +void Object::SetSolidType(uint16 solidtype) +{ + m_data.unknown010 = solidtype; + EQApplicationPacket* app = new EQApplicationPacket(); + EQApplicationPacket* app2 = new EQApplicationPacket(); + this->CreateDeSpawnPacket(app); + this->CreateSpawnPacket(app2); + entity_list.QueueClients(0, app); + entity_list.QueueClients(0, app2); + safe_delete(app); + safe_delete(app2); +} + +uint16 Object::GetSize() +{ + return m_data.unknown008; +} + +uint16 Object::GetSolidType() +{ + return m_data.unknown010; +} + const char* Object::GetModelName() { return this->m_data.object_name; diff --git a/zone/object.h b/zone/object.h index da41d9815..9f5cb8cb3 100644 --- a/zone/object.h +++ b/zone/object.h @@ -157,6 +157,10 @@ public: void SetZ(float pos); void SetModelName(const char* modelname); const char* GetModelName(); + uint16 GetSize(); + void SetSize(uint16 size); + uint16 GetSolidType(); + void SetSolidType(uint16 size); const char* GetEntityVariable(const char *id); void SetEntityVariable(const char *id, const char *m_var); diff --git a/zone/perl_object.cpp b/zone/perl_object.cpp index 9c71ec6ed..036d555a1 100644 --- a/zone/perl_object.cpp +++ b/zone/perl_object.cpp @@ -909,6 +909,107 @@ XS(XS_Object_SetEntityVariable) XSRETURN_EMPTY; } +XS(XS_Object_GetSolidType); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Object_GetSolidType) +{ + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: Object::GetSolidType(THIS)"); + { + Object * THIS; + uint16 RETVAL; + dXSTARG; + + if (sv_derived_from(ST(0), "Object")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Object *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Object"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSolidType(); + XSprePUSH; PUSHu((UV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_Object_SetSolidType); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Object_SetSolidType) +{ + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Object::SetSolidType(THIS, type)"); + { + Object * THIS; + uint16 type = (uint16)SvUV(ST(1)); + + if (sv_derived_from(ST(0), "Object")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Object *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Object"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSolidType(type); + } + XSRETURN_EMPTY; +} + +XS(XS_Object_GetSize); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Object_GetSize) +{ + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: Object::GetSize(THIS)"); + { + Object * THIS; + uint16 RETVAL; + dXSTARG; + + if (sv_derived_from(ST(0), "Object")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Object *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Object"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSize(); + XSprePUSH; PUSHu((UV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_Object_SetSize); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Object_SetSize) +{ + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Object::SetSize(THIS, type)"); + { + Object * THIS; + uint16 size = (uint16)SvUV(ST(1)); + + if (sv_derived_from(ST(0), "Object")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Object *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Object"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSize(size); + } + XSRETURN_EMPTY; +} #ifdef __cplusplus extern "C" @@ -961,6 +1062,10 @@ XS(boot_Object) newXSproto(strcpy(buf, "GetEntityVariable"), XS_Object_GetEntityVariable, file, "$$"); newXSproto(strcpy(buf, "SetEntityVariable"), XS_Object_SetEntityVariable, file, "$$$"); newXSproto(strcpy(buf, "EntityVariableExists"), XS_Object_EntityVariableExists, file, "$$"); + newXSproto(strcpy(buf, "SetSolidType"),XS_Object_SetSolidType, file, "$$"); + newXSproto(strcpy(buf, "GetSolidType"),XS_Object_GetSolidType, file, "$"); + newXSproto(strcpy(buf, "SetSize"),XS_Object_SetSize, file, "$$"); + newXSproto(strcpy(buf, "GetSize"),XS_Object_GetSize, file, "$"); XSRETURN_YES; } #endif //EMBPERL_XS_CLASSES From d33b320436493cabbe613eafaf43587f663578a3 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Fri, 14 Nov 2014 18:29:30 -0500 Subject: [PATCH 0251/1883] I accidentally the whole Uleat --- zone/command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index daa5f18d8..31c679288 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2775,7 +2775,7 @@ void command_nukeitem(Client *c, const Seperator *sep) void command_peekinv(Client *c, const Seperator *sep) { - static enum { + enum { peekWorn = 0x01, peekInv = 0x02, peekCursor = 0x04, @@ -2783,7 +2783,7 @@ void command_peekinv(Client *c, const Seperator *sep) peekBank = 0x10, peekTrade = 0x20, peekWorld = 0x40 - }; + } ; if (!c->GetTarget() || !c->GetTarget()->IsClient()) { c->Message(0, "You must have a PC target selected for this command"); From 44bfdfebc201c61c5a030f92fe7eca20412305db Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 14 Nov 2014 23:45:56 -0500 Subject: [PATCH 0252/1883] Correct charm scaling for RoF Other clients should actually work the same as well --- changelog.txt | 1 + common/patches/rof.cpp | 5 +++-- common/patches/rof_structs.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index eac7536d8..1f9930ffa 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 11/14/2014 == Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. +demonstar55: Don't use the hack for charms that doesn't work on RoF == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 3f39b7187..95e0047e8 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4817,7 +4817,7 @@ namespace RoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); RoF::structs::ItemSerializationHeader hdr; @@ -4839,7 +4839,7 @@ namespace RoF hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); //hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff; - hdr.unknown020 = 0; + hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); @@ -5009,6 +5009,7 @@ namespace RoF ibs.SpellShield = item->SpellShield; ibs.Avoidance = item->Avoidance; ibs.Accuracy = item->Accuracy; + ibs.CharmFileID = item->CharmFileID; ibs.FactionAmt1 = item->FactionAmt1; ibs.FactionMod1 = item->FactionMod1; ibs.FactionAmt2 = item->FactionAmt2; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 604da1bd7..f3a6209b8 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4396,7 +4396,7 @@ struct ItemSerializationHeader /*030*/ uint16 unknown013; // 0xffff /*032*/ uint32 price; /*036*/ uint32 merchant_slot; //1 if not a merchant item -/*040*/ uint32 unknown020; //0 +/*040*/ uint32 scaled_value; //0 /*044*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot /*048*/ uint32 unknown028; //0 /*052*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 From 5dc3a5ab2072ef28853250ba44163e9c0610630a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 15 Nov 2014 00:08:16 -0500 Subject: [PATCH 0253/1883] Also stop using hack on UF --- changelog.txt | 1 + common/patches/underfoot.cpp | 9 +++++---- common/patches/underfoot_structs.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1f9930ffa..ed7e134cf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 11/14/2014 == Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. demonstar55: Don't use the hack for charms that doesn't work on RoF +demonstar55: UF too == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 78bdb5f2e..a0cd76114 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3609,7 +3609,7 @@ namespace Underfoot std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); Underfoot::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; @@ -3620,7 +3620,7 @@ namespace Underfoot hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); - hdr.unknown020 = 0; + hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); @@ -3631,7 +3631,7 @@ namespace Underfoot hdr.unknown052 = 0; hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; ss.write((const char*)&hdr, sizeof(Underfoot::structs::ItemSerializationHeader)); - + if (item->EvolvingLevel > 0) { Underfoot::structs::EvolvingItem evotop; evotop.unknown001 = 0; @@ -3655,7 +3655,7 @@ namespace Underfoot else { ss.write((const char*)&null_term, sizeof(uint8)); //no idfile } - + Underfoot::structs::ItemSerializationHeaderFinish hdrf; hdrf.ornamentIcon = ornaIcon; hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit.. @@ -3770,6 +3770,7 @@ namespace Underfoot ibs.SpellShield = item->SpellShield; ibs.Avoidance = item->Avoidance; ibs.Accuracy = item->Accuracy; + ibs.CharmFileID = item->CharmFileID; ibs.FactionAmt1 = item->FactionAmt1; ibs.FactionMod1 = item->FactionMod1; ibs.FactionAmt2 = item->FactionAmt2; diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index bdd1b3a99..86f712d24 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4010,7 +4010,7 @@ struct ItemSerializationHeader /*008*/ uint32 slot; /*012*/ uint32 price; /*016*/ uint32 merchant_slot; //1 if not a merchant item - /*020*/ uint32 unknown020; //0 + /*020*/ uint32 scaled_value; //0 /*024*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot /*028*/ uint32 unknown028; //0 /*032*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 From 96242f6c5e0debcb12e468a3421088f76efcaa45 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 15 Nov 2014 00:29:56 -0500 Subject: [PATCH 0254/1883] Remove scaling hack for Titanium --- changelog.txt | 1 + common/patches/titanium.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index ed7e134cf..b0866ec17 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. demonstar55: Don't use the hack for charms that doesn't work on RoF demonstar55: UF too +demonstar55: Tit == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 0366e73d8..4d400c9b7 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1661,7 +1661,7 @@ namespace Titanium int16 slot_id = ServerToTitaniumSlot(slot_id_in); uint32 merchant_slot = inst->GetMerchantSlot(); int16 charges = inst->GetCharges(); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); int i; uint32 sub_length; @@ -1673,7 +1673,7 @@ namespace Titanium (merchant_slot == 0) ? slot_id_in : merchant_slot, inst->GetPrice(), (merchant_slot == 0) ? 1 : inst->GetMerchantCount(), - 0, + inst->IsScaling() ? inst->GetExp() / 100 : 0, //merchant_slot, //instance ID, bullshit for now (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, 0, // item recast timer timestamp field (aka..last_cast_time field in SoF+ clients) From 10ae97e42f991d3f4ece222de7bd089c1d586e78 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 15 Nov 2014 00:54:21 -0500 Subject: [PATCH 0255/1883] Remove scaling hack for SoF --- changelog.txt | 1 + common/patches/sof.cpp | 5 +++-- common/patches/sof_structs.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index b0866ec17..00d72188b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ Secrets: Identified object size and solidtype as flags. Exported them as functio demonstar55: Don't use the hack for charms that doesn't work on RoF demonstar55: UF too demonstar55: Tit +demonstar55: SoF == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 2075fd142..a9b8d6e26 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2519,7 +2519,7 @@ namespace SoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); SoF::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; @@ -2530,7 +2530,7 @@ namespace SoF hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); - hdr.unknown020 = 0; + hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); @@ -2652,6 +2652,7 @@ namespace SoF ibs.SpellShield = item->SpellShield; ibs.Avoidance = item->Avoidance; ibs.Accuracy = item->Accuracy; + ibs.CharmFileID = item->CharmFileID; ibs.FactionAmt1 = item->FactionAmt1; ibs.FactionMod1 = item->FactionMod1; ibs.FactionAmt2 = item->FactionAmt2; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 502763d90..a49dc6f25 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -3789,7 +3789,7 @@ struct ItemSerializationHeader uint32 slot; uint32 price; uint32 merchant_slot; //1 if not a merchant item - uint32 unknown020; //0 + uint32 scaled_value; //0 uint32 instance_id; //unique instance id if not merchant item, else is merchant slot uint32 unknown028; //0 uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 From 73e398b0f43b401c9a6ef3a00baf79885182590b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 15 Nov 2014 01:00:38 -0500 Subject: [PATCH 0256/1883] Remove scaling hack for SoD --- changelog.txt | 1 + common/patches/sod.cpp | 5 +++-- common/patches/sod_structs.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 00d72188b..92c4164dc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ demonstar55: Don't use the hack for charms that doesn't work on RoF demonstar55: UF too demonstar55: Tit demonstar55: SoF +demonstar55: SoD == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 8a023ce42..1d93ad721 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3195,7 +3195,7 @@ namespace SoD std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); //_log(NET__ERROR, "Serialize called for: %s", item->Name); SoD::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; @@ -3206,7 +3206,7 @@ namespace SoD hdr.slot = (merchant_slot == 0) ? slot_id : merchant_slot; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); - hdr.unknown020 = 0; + hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); @@ -3329,6 +3329,7 @@ namespace SoD ibs.SpellShield = item->SpellShield; ibs.Avoidance = item->Avoidance; ibs.Accuracy = item->Accuracy; + ibs.CharmFileID = item->CharmFileID; ibs.FactionAmt1 = item->FactionAmt1; ibs.FactionMod1 = item->FactionMod1; ibs.FactionAmt2 = item->FactionAmt2; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 71760514b..15e0d5307 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -3931,7 +3931,7 @@ struct ItemSerializationHeader /*008*/ uint32 slot; /*012*/ uint32 price; /*016*/ uint32 merchant_slot; //1 if not a merchant item -/*020*/ uint32 unknown020; //0 +/*020*/ uint32 scaled_value; //0 /*024*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot /*028*/ uint32 unknown028; //0 /*032*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 From 30922afd0801fa5aefa28b42122e2d8b340c4967 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 15 Nov 2014 01:01:57 -0500 Subject: [PATCH 0257/1883] Remove scaling hack for client 62 (untested) --- changelog.txt | 1 + common/patches/client62.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 92c4164dc..506c4d2ff 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,6 +8,7 @@ demonstar55: UF too demonstar55: Tit demonstar55: SoF demonstar55: SoD +demonstar55: 62 (untested) == 11/13/2014 == Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width). diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index d734a29ec..c291d2bc4 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -1231,7 +1231,7 @@ namespace Client62 int16 slot_id = ServerToClient62Slot(slot_id_in); uint32 merchant_slot = inst->GetMerchantSlot(); int16 charges = inst->GetCharges(); - const Item_Struct *item = inst->GetItem(); + const Item_Struct *item = inst->GetUnscaledItem(); int i; uint32 sub_length; @@ -1244,7 +1244,7 @@ namespace Client62 (merchant_slot == 0) ? slot_id_in : merchant_slot, inst->GetPrice(), (merchant_slot == 0) ? 1 : inst->GetMerchantCount(), - 0, + inst->IsScaling() ? inst->GetExp() / 100 : 0, //merchant_slot, //instance ID, bullshit for now // The 'Merchant Slot' needs to be some unique id for bazaar to work properly (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, From fe364a0798d9f51caa5773a614c7dbcd054eb5b5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 15 Nov 2014 21:53:33 -0600 Subject: [PATCH 0258/1883] Initial upload of db_update_manifest.txt --- utils/sql/db_update_manifest.txt | 316 +++++++++++++++++++++++++++++++ 1 file changed, 316 insertions(+) create mode 100644 utils/sql/db_update_manifest.txt diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt new file mode 100644 index 000000000..3eb185476 --- /dev/null +++ b/utils/sql/db_update_manifest.txt @@ -0,0 +1,316 @@ +5001, 1_task_system.sql +5002, 2_optional_maxclients.sql +5003, 14_optional_merchantlist.sql +5004, 35_task_stepped.sql +5005, 42_task_min_maxlevel.sql +5006, 55_zone_shutdowndeleay.sql +5007, 68_optional_character_maxexplevel.sql +5008, 103_optional_chat_rules.sql +5009, 104_traps.sql +5010, 106_optional_proc_rules.sql +5011, 120_damageshieldtypes.sql +5012, 125_aggrozone.sql +5013, 127_optional_spell_rules.sql +5014, 129_optional_shared_plat_rule.sql +5015, 131_optional_combat_rules.sql +5016, 133_task_repeatable.sql +5017, 142_deathpeace_and_lifetap_aas.sql +5018, 158_optional_death_exp_loss.sql +5019, 176_melody.sql +5020, 189_character_.sql +5021, 196_trader.sql +5022, 210_undyeme.sql +5023, 222_buyer.sql +5024, 226_account_limiting.sql +5025, 230_spells_table.sql +5026, 235_horses_table.sql +5027, 243_spawn_timers.sql +5028, 247_mail.sql +5029, 249_chatchannels.sql +5030, 250_bot_spell_update.sql +5031, 250_optional_bot_spell_update.sql +5032, 285_optional_bot_spell_update.sql +5033, 292_augslots.sql +5034, 294_merchant_logging.sql +5035, 304_faction_list.sql +5036, 326_aas.sql +5037, 328_bot_management.sql +5038, 328_optional_bot_management.sql +5039, 340_gm_ips.sql +5040, 356_combat.sql +5041, 360_peqzone.sql +5042, 364_ranged_dist_rule.sql +5043, 386_bot_save_raid.sql +5044, 434_optional_rest_state_rules.sql +5045, 447_sof_startzone_rule.sql +5046, 463_altadv_vars.sql +5047, 475_aa_actions.sql +5048, 500_spawn2_optimization.sql +5049, 503_bugs.sql +5050, 518_drakkin_npc_type_features.sql +5051, 524_rule_values_notes.sql +5052, 527_npc_armor_tint.sql +5053, 553_saylink_table.sql +5054, 564_nokeyring.sql +5055, 600_group_leadership.sql +5056, 612_instance_changes.sql +5057, 615_adventure_assassination.sql +5058, 619_Adventure_Recruiter_Flavor.sql +5059, 621_LDoNTraps.sql +5060, 633_ucs.sql +5061, 634_TrapTemplateDefaultValue.sql +5062, 643_BotsTable.sql +5063, 646_archery_penalty_rule.sql +5064, 665_heroic_resists.sql +5065, 667_titles.sql +5066, 687_aa_table_changes.sql +5067, 699_peqzone_rule.sql +5068, 702_aashieldblock_tint_table.sql +5069, 703_peqzone_rule.sql +5070, 704_rules.sql +5071, 710_tint_set_naming.sql +5072, 721_pathing_rules.sql +5073, 730_smart_delay_moving.sql +5074, 731_rule_assist_notarget_self.sql +5075, 732_sacrifice_rules.sql +5076, 745_slow_mitigation.sql +5077, 754_archery_base_damage_rule.sql +5078, 755_sof_altadv_vars_updates.sql +5079, 773_monk_rules.sql +5080, 853_optional_rule_aaexp.sql +5081, 858_optional_rule_ip_limit_by_status.sql +5082, 892_optional_bots_table_mod.sql +5083, 893_optional_bots_table_mod.sql +5084, 898_npc_maxlevel_scalerate.sql +5085, 902_optional_rule_snareflee.sql +5086, 923_spawn2_enabled.sql +5087, 962_hot_zone.sql +5088, 964_reports.sql +5089, 971_veteran_rewards.sql +5090, 977_raid_npc_private_corpses.sql +5091, 979_unique_spawn_by_name.sql +5092, 980_account_ip.sql +5093, 1022_botadventuring.sql +5094, 1027_botactives.sql +5095, 1030_botzoningsupport.sql +5096, 1036_botbuffs.sql +5097, 1038_botpetstatepersists.sql +5098, 1038_grouptablesuniquecolumndefinitions.sql +5099, 1039_botguilds.sql +5100, 1040_DeprecatedBotRaidsSystems.sql +5101, 1057_titles.sql +5102, 1077_botgroups.sql +5103, 1136_spell_globals.sql +5104, 1144_optional_rule_return_nodrop.sql +5105, 1195_account_suspendeduntil.sql +5106, 1259_npc_skill_types.sql +5107, 1280_bot_augs.sql +5108, 1290_optional_exp_loss_rule.sql +5109, 1293_guild_bank.sql +5110, 1379_loginserver_trusted_server.sql +5111, 1392_recipe_learning.sql +5112, 1394_optional_rule_sod_hp_mana_end.sql +5113, 1404_faction_list.sql +5114, 1410_optional_sod_aas_ht_and_loh.sql +5115, 1436_login_server_table_fix.sql +5116, 1446_allowrest_optional.sql +5117, 1446_allowrest_required.sql +5118, 1450_cvs.sql +5119, 1451_guilds.sql +5120, 1498_instance_adventure.sql +5121, 1510_global_instances.sql +5122, 1511_map_path_loading.sql +5123, 1513_zone_points.sql +5124, 1519_zone_primary_key_id.sql +5125, 1542_items_table_cleanup.sql +5126, 1548_nimbuseffect_required.sql +5127, 1562_instanced_spawnconditions.sql +5128, 1586_waypoints_optional.sql +5129, 1610_tradeskill_required.sql +5130, 1618_zone.sql +5131, 1625_optional_rule_class_race_exp_bonus.sql +5132, 1672_optional_rules_respawn_window.sql +5133, 1679_optional_rules_blocked_buffs.sql +5134, 1696_modify_zone_and_object_tables.sql +5135, 1711_account_restricted_aa.sql +5136, 1717_optional_rule_bash_stun_chance.sql +5137, 1718_optional_rules_mod3s.sql +5138, 1719_optional_triggerOnCastAAs.sql +5139, 1720_optional_sql_AAs.sql +5140, 1720_required_sql_AA_effects_update.sql +5141, 1721_optional_sql_drakkin_breath_update.sql +5142, 1721_required_sql_altadv_vars_update.sql +5143, 1723_optional_sql_new_stats_window_rule.sql +5144, 1723_required_sql_corruption.sql +5145, 1736_optional_sql_feral_swipe.sql +5146, 1737_required_sql_rule_and_aa_update.sql +5147, 1746_optional_sql_bot_manaregen.sql +5148, 1747_optional_HoT_zone_and_zonepoints.sql +5149, 1750_optional_sql_reflect_rule.sql +5150, 1753_optional_haste_cap_rule.sql +5151, 1753_required_sql_healing_adept_aa.sql +5152, 1754_required_sql_healing_adept_aa_fix.sql +5153, 1755_required_sql_fear_resist_aas.sql +5154, 1784_optional_corpsedrag_rules.sql +5155, 1786_required_update_to_aas.sql +5156, 1790_required_aa_required_level_cost.sql +5157, 1793_resist_adjust.sql +5158, 1799_optional_rest_regen_endurance_rule.sql +5159, 1802_required_doppelganger.sql +5160, 1803_required_tasks_xpreward_signed.sql +5161, 1804_required_ae_melee_updates.sql +5162, 1809_optional_rules.sql +5163, 1813_required_doppelganger_npcid_change.sql +5164, 1817_optional_npc_archery_bonus_rule.sql +5165, 1823_optional_delay_death.sql +5166, 1847_required_doors_dest_zone_size_32.sql +5167, 1859_optional_item_casts_use_focus_rule.sql +5168, 1884_optional_bot_spells_update.sql +5169, 1885_optional_rules_fv_pvp_expansions.sql +5170, 1889_optional_skill_cap_rule.sql +5171, 1908_required_npc_types_definitions.sql +5172, 1926_optional_stat_cap.sql +5173, 1944_spawn2.sql +5174, 1946_doors.sql +5175, 1960_optional_console_timeout_rule.sql +5176, 1962_optional_guild_creation_window_rules.sql +5177, 1963_optional_rule_live_like_focuses.sql +5178, 1968_optional_enrage_rules.sql +5179, 1972_optional_extradmg_item_cap.sql +5180, 1974_required_bot_spells_update.sql +5181, 1977_underwater.sql +5182, 1998_optional_intoxication_and_looting_rules.sql +5183, 2004_charges_alt_currency.sql +5184, 2015_optional_specialization_training_rule.sql +5185, 2016_optional_rule_bot_aa_expansion.sql +5186, 2023_optional_mysqlcli.sql +5187, 2024_optional_update_crystals.sql +5188, 2024_required_update.sql +5189, 2057_required_discovered_items.sql +5190, 2058_optional_rule_discovered_items.sql +5191, 2062_required_version_changes.sql +5192, 2069_required_pets.sql +5193, 2079_player_speech.sql +5194, 2087_required_bots_hp_and_mana_and_spell_updates.sql +5195, 2098_required_zonepoint_version_changes.sql +5196, 2099_required_discovered_items_account_status.sql +5197, 2104_required_group_roles.sql +5198, 2107_required_bot_stances.sql +5199, 2129_required_lfguild.sql +5200, 2133_required_faction_loot_despawn.sql +5201, 2136_extended_targets.sql +5202, 2142_emotes.sql +5203, 2154_optional_rule_spell_procs_resists_falloff.sql +5204, 2156_optional_charm_break_rule.sql +5205, 2159_optional_defensiveproc_rules.sql +5206, 2164_require_bots_bottimers.sql +5207, 2171_optional_SpecialAttackACBonus_rule.sql +5208, 2176_optional_aa_expansion_SOF_fix.sql +5209, 2176_optional_FrenzyBonus_rule.sql +5210, 2176_required_aa_updates.sql +5211, 2178_required_aa_updates.sql +5212, 2183_optional_bot_xp_rule.sql +5213, 2185_optional_NPCFlurryChacne_rule +5214, 2185_optional_NPCFlurryChacne_rule.sql +5215, 2185_optional_NPCFlurryChance_rule.sql +5216, 2185_required_aa_updates +5217, 2185_required_aa_updates.sql +5218, 2188_optional_miscspelleffect_rules +5219, 2188_optional_miscspelleffect_rules.sql +5220, 2188_required_aa_updates +5221, 2188_required_aa_updates.sql +5222, 2189_optional_taunt_rules +5223, 2189_optional_taunt_rules.sql +5224, 2195_required_sharedplatupdates.sql +5225, 2208_optional_aa_stacking_rule.sql +5226, 2208_optional_EnableSoulAbrasionAA.sql +5227, 2208_required_aa_updates.sql +5228, 2209_optional_additive_bonus_rule.sql +5229, 2213_loot_changes.sql +5230, 2214_faction_list_mod.sql +5231, 2215_required_aa_updates.sql +5232, 2243_optional_char_max_level_rule.sql +5233, 2260_probability.sql +5234, 2262_required_pet_discipline_update.sql +5235, 2264_required_aa_updates.sql +5236, 2268_QueryServ.sql +5237, 2268_required_updates.sql +5238, 2274_optional_rule_iplimitdisconnectall.sql +5239, 2278_optional_rule_targetableswarmpet.sql +5240, 2280_optional_rule_targetableswarmpet-rename.sql +5241, 2283_required_npc_changes.sql +5242, 2299_required_inspectmessage_fields.sql +5243, 2300_optional_loot_changes.sql +5244, 2304_QueryServ.sql +5245, 2340_required_maxbuffslotspet.sql +5246, 2361_QueryServ.sql +5247, 2361_required_qs_rule_values.sql +5248, 2370_required_aa_updates.sql +5249, 2376_required_aa_updates.sql +5250, 2380_optional_merc_data.sql +5251, 2380_optional_merc_merchant_npctypes_update.sql +5252, 2380_optional_merc_rules.sql +5253, 2383_required_group_ismerc.sql +5254, 2428_optional_levelbasedexpmods.sql +5255, 2448_optional_stun_proc_aggro_rule.sql +5256, 2471_required_aa_updates.sql +5257, 2482_required_start_zones.sql +5258, 2504_required_aa_updates.sql +9000, 2013_02_18_Merc_Rules_and_Tables.sql +9001, 2013_02_25_Impr_HT_LT.sql +9002, 2013_03_1_Merc_Rules_and_Equipment.sql +9003, 2013_03_23_Escape_FadingMemories.sql +9004, 2013_04_04_NaturesBounty.sql +9005, 2013_04_08_Salvage.sql +9006, 2013_05_05_Account_Flags.sql +9007, 2013_05_05_Item_Tick.sql +9008, 2013_07_11_NPC_Special_Abilities.sql +9009, 2013_10_12_Merc_Special_Abilities.sql +9010, 2013_10_12_Merc_vwMercNpcTypes.sql +9011, 2013_10_31_Recipe_disabling.sql +9012, 2013_11_07_BaseData.sql +9013, 2013_11_13_Instrument_Singing_Mastery.sql +9014, 2013_11_18_AssistRadius.sql +9015, 2013_12_26_MerchantList_Class_Required.sql +9016, 2014_01_04_SongModCapAAs.sql +9017, 2014_01_08_SpellsNewAdditions.sql +9018, 2014_01_09_PreservePetSize.sql +9019, 2014_01_20_MezMastery.sql +9020, 2014_01_20_Not_Extendable.sql +9021, 2014_01_20_SpellCastingReinforcement.sql +9022, 2014_01_20_Weather.sql +9023, 2014_01_27_CritcalMendAA.sql +9024, 2014_02_02_SpellCriticalsAA.sql +9025, 2014_02_13_Rename_instance_lockout_tables.sql +9026, 2014_02_13_spells_new_update.sql +9027, 2014_02_20_buff_update.sql +9028, 2014_02_26_roambox_update.sql +9029, 2014_02_26_virulentvenomAA.sql +9030, 2014_04_04_PhysicalResist.sql +9031, 2014_04_10_No_Target_With_Hotkey.sql +9032, 2014_04_12_SlowMitigation.sql +9033, 2014_04_18_Suppress_Command_Error.sql +9034, 2014_04_25_spawn_events.sql +9035, 2014_04_27_AISpellEffects.sql +9036, 2014_05_04_SlowMitigationFix.sql +9037, 2014_06_25_AA_Updates..sql +9038, 2014_06_25_AA_Updates.sql +9039, 2014_07_04_AA_Updates.sql +9040, 2014_07_10_npc_spells.sql +9041, 2014_08_02_spells_new.sql +9042, 2014_08_12_NPC_raid_targets.sql +9043, 2014_08_18_spells_new_update.sql +9044, 2014_08_20_merchantlist_probability.sql +9045, 2014_08_23_Complete_QueryServ_Table_Structures.sql +9046, 2014_08_23_player_events_and_player_aa_rate_hourly.sql +9047, 2014_08_24_character_lookup.sql +9048, 2014_09_09_attack_delay.sql +9049, 2014_09_18_tellqueuesclean.sql +9050, 2014_09_20_ban_messages.sql +9051, 2014_10_11_RaidMOTD.sql +9052, 2014_10_13_RaidLeadership.sql +9053, 2014_10_18_group_mentor.sql +9054, 2014_10_19_raid_group_mentor.sql +9055, 2014_10_30_special_abilities_null.sql +9056, 2014_11_08_RaidMembers.sql +9057, 2014_11_13_spells_new_updates.sql \ No newline at end of file From 94231b62a3a05e723f1b222b4d73cea66d1403e2 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 15 Nov 2014 23:01:26 -0500 Subject: [PATCH 0259/1883] Updated swarm pet AI to be consistent with live. *OLD AI: Swarm pet would lock on to target until target died, then depop as soon as target died. *NEW AI: Swarm pet will attack cast on target, NOT perma locked it can change targets if attacked by something else that generate more hate. When target dies swarm pet will follow owner, if owner is attacked by something else the swarm pet will attack it (until duration timer despawns the pet). Updated perl quest function: MakeTempPet(Tspell_id, name=nullptr, duration=0, target=nullptr, sticktarg=0) Implemented perl quest function: Mob::TypesTempPet(npctypesid, name=nullptr, duration=0, follow=0, target=nullptr, sticktarg=0) Note: 'sticktarg' field will cause the swarm pet to use the OLD AI Rule to use OLD AI only - default is disabled. Optional SQL: utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql --- changelog.txt | 16 +++ common/ruletypes.h | 1 + .../2014_11_15_SwarmPetTargetLock.sql | 1 + zone/aa.cpp | 30 ++--- zone/attack.cpp | 11 ++ zone/client.cpp | 1 - zone/entity.cpp | 36 ++++++ zone/entity.h | 2 + zone/mob.cpp | 5 +- zone/mob.h | 11 +- zone/npc.cpp | 114 ++++++++++-------- zone/npc.h | 2 + zone/perl_mob.cpp | 42 +++++-- zone/spells.cpp | 12 +- 14 files changed, 192 insertions(+), 92 deletions(-) create mode 100644 utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql diff --git a/changelog.txt b/changelog.txt index 506c4d2ff..566cb393b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,22 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/15/2014 == +Kayen: Updated swarm pet AI to be consistent with live. + +*OLD AI: Swarm pet would lock on to target until target died, then depop as soon as target died. + +*NEW AI: Swarm pet will attack cast on target, NOT perma locked it can change targets if attacked +by something else that generate more hate. When target dies swarm pet will follow owner, if owner is +attacked by something else the swarm pet will attack it (until duration timer despawns the pet). + +Kayen: Updated perl quest function: MakeTempPet(Tspell_id, name=nullptr, duration=0, target=nullptr, sticktarg=0) +Kayen: Implemented perl quest function: Mob::TypesTempPet(npctypesid, name=nullptr, duration=0, follow=0, target=nullptr, sticktarg=0) +Note: 'sticktarg' field will cause the swarm pet to use the OLD AI + +Rule to use OLD AI only - default is disabled. +Optional SQL: utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql + == 11/14/2014 == Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. demonstar55: Don't use the hack for charms that doesn't work on RoF diff --git a/common/ruletypes.h b/common/ruletypes.h index 129e0ed61..1d266a269 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -324,6 +324,7 @@ RULE_INT ( Spells, AI_IdleNoSpellMaxRecast, 2000) // AI spell recast time(MS) ch RULE_INT ( Spells, AI_IdleBeneficialChance, 100) // Chance while idle to do a beneficial spell on self or others. RULE_BOOL ( Spells, SHDProcIDOffByOne, true) // pre June 2009 SHD spell procs were off by 1, they stopped doing this in June 2009 (so UF+ spell files need this false) RULE_BOOL ( Spells, Jun182014HundredHandsRevamp, false) // this should be true for if you import a spell file newer than June 18, 2014 +RULE_BOOL ( Spells, SwarmPetTargetLock, false) // Use old method of swarm pets target locking till target dies then despawning. RULE_CATEGORY_END() RULE_CATEGORY( Combat ) diff --git a/utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql b/utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql new file mode 100644 index 000000000..f2c11ae45 --- /dev/null +++ b/utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:SwarmPetTargetLock', 'false', 'Use old method of swarm pet AI, where they lock onto a set target then depop when target is dead.'); diff --git a/zone/aa.cpp b/zone/aa.cpp index 321439aa2..3a3101746 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -542,10 +542,7 @@ void Client::HandleAAAction(aaID activate) { } } - -//Originally written by Branks -//functionality rewritten by Father Nitwit -void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, uint32 duration_override) { +void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, uint32 duration_override, bool followme, bool sticktarg) { //It might not be a bad idea to put these into the database, eventually.. @@ -563,7 +560,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u pet.count = 1; pet.duration = 1; - for(int x = 0; x < 12; x++) + for(int x = 0; x < MAX_SWARM_PETS; x++) { if(spells[spell_id].effectid[x] == SE_TemporaryPets) { @@ -607,8 +604,6 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; - TempPets(true); - while(summon_count > 0) { int pet_duration = pet.duration; if(duration_override > 0) @@ -628,7 +623,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u GetX()+swarm_pet_x[summon_count], GetY()+swarm_pet_y[summon_count], GetZ(), GetHeading(), FlyMode3); - if((spell_id == 6882) || (spell_id == 6884)) + if (followme) npca->SetFollowID(GetID()); if(!npca->GetSwarmInfo()){ @@ -646,7 +641,10 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u //give the pets somebody to "love" if(targ != nullptr){ npca->AddToHateList(targ, 1000, 1000); - npca->GetSwarmInfo()->target = targ->GetID(); + if (RuleB(Spells, SwarmPetTargetLock) || sticktarg) + npca->GetSwarmInfo()->target = targ->GetID(); + else + npca->GetSwarmInfo()->target = 0; } //we allocated a new NPC type object, give the NPC ownership of that memory @@ -662,7 +660,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u targ->AddToHateList(this, 1, 0); } -void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_override, uint32 duration_override, bool followme) { +void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_override, uint32 duration_override, bool followme, bool sticktarg) { AA_SwarmPet pet; pet.count = 1; @@ -700,7 +698,6 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; - TempPets(true); while(summon_count > 0) { int pet_duration = pet.duration; @@ -721,6 +718,9 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid GetX()+swarm_pet_x[summon_count], GetY()+swarm_pet_y[summon_count], GetZ(), GetHeading(), FlyMode3); + if (followme) + npca->SetFollowID(GetID()); + if(!npca->GetSwarmInfo()){ AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; npca->SetSwarmInfo(nSI); @@ -736,7 +736,11 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid //give the pets somebody to "love" if(targ != nullptr){ npca->AddToHateList(targ, 1000, 1000); - npca->GetSwarmInfo()->target = targ->GetID(); + + if (RuleB(Spells, SwarmPetTargetLock) || sticktarg) + npca->GetSwarmInfo()->target = targ->GetID(); + else + npca->GetSwarmInfo()->target = 0; } //we allocated a new NPC type object, give the NPC ownership of that memory @@ -895,8 +899,6 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) make_npc->d_meele_texture1 = 0; make_npc->d_meele_texture2 = 0; - TempPets(true); - NPC* npca = new NPC(make_npc, 0, GetX(), GetY(), GetZ(), GetHeading(), FlyMode3); if(!npca->GetSwarmInfo()){ diff --git a/zone/attack.cpp b/zone/attack.cpp index 44bffce62..569466f68 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2062,6 +2062,13 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } SetHP(0); SetPet(0); + + if (GetSwarmOwner()){ + Mob* owner = entity_list.GetMobID(GetSwarmOwner()); + if (owner) + owner->SetTempPetCount(owner->GetTempPetCount() - 1); + } + Mob* killer = GetHateDamageTop(this); entity_list.RemoveFromTargets(this, p_depop); @@ -2535,6 +2542,10 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if (myowner->IsAIControlled() && !myowner->GetSpecialAbility(IMMUNE_AGGRO)) myowner->hate_list.Add(other, 0, 0, bFrenzy); } + + if (other->GetTempPetCount()) + entity_list.AddTempPetsToHateList(other, this, bFrenzy); + if (!wasengaged) { if(IsNPC() && other->IsClient() && other->CastToClient()) parse->EventNPC(EVENT_AGGRO, this->CastToNPC(), other, "", 0); diff --git a/zone/client.cpp b/zone/client.cpp index a8a3f6f8d..cfc686707 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6264,7 +6264,6 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; - TempPets(true); while(summon_count > 0) { NPCType *npc_dup = nullptr; diff --git a/zone/entity.cpp b/zone/entity.cpp index 76b9eb8d4..eeebfa88d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3622,6 +3622,42 @@ void EntityList::DestroyTempPets(Mob *owner) } } +int16 EntityList::CountTempPets(Mob *owner) +{ + int16 count = 0; + auto it = npc_list.begin(); + while (it != npc_list.end()) { + NPC* n = it->second; + if (n->GetSwarmInfo()) { + if (n->GetSwarmInfo()->owner_id == owner->GetID()) { + count++; + } + } + ++it; + } + + owner->SetTempPetCount(count); + + return count; +} + +void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy) +{ + if (!other || !owner) + return; + + auto it = npc_list.begin(); + while (it != npc_list.end()) { + NPC* n = it->second; + if (n->GetSwarmInfo()) { + if (n->GetSwarmInfo()->owner_id == owner->GetID()) { + n->CastToNPC()->hate_list.Add(other, 0, 0, bFrenzy); + } + } + ++it; + } +} + bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float trg_x, float trg_y, float trg_z, float perwalk) { diff --git a/zone/entity.h b/zone/entity.h index 2e6990231..486f1d49f 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -251,6 +251,8 @@ public: void RemoveAllLocalities(); void RemoveAllRaids(); void DestroyTempPets(Mob *owner); + int16 CountTempPets(Mob *owner); + void AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy = false); Entity *GetEntityMob(uint16 id); Entity *GetEntityMerc(uint16 id); Entity *GetEntityDoor(uint16 id); diff --git a/zone/mob.cpp b/zone/mob.cpp index b0dac9dff..a7d141b30 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -362,7 +362,8 @@ Mob::Mob(const char* in_name, nexthpevent = -1; nextinchpevent = -1; - TempPets(false); + hasTempPet = false; + count_TempPet = 0; m_is_running = false; @@ -423,7 +424,7 @@ Mob::~Mob() delete trade; } - if(HadTempPets()){ + if(HasTempPetsActive()){ entity_list.DestroyTempPets(this); } entity_list.UnMarkNPC(GetID()); diff --git a/zone/mob.h b/zone/mob.h index 7bd873d98..a4dd2d665 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -575,8 +575,8 @@ public: virtual void UnStun(); inline void Silence(bool newval) { silenced = newval; } inline void Amnesia(bool newval) { amnesiad = newval; } - void TemporaryPets(uint16 spell_id, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0); - void TypesTemporaryPets(uint32 typesid, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0, bool followme = false); + void TemporaryPets(uint16 spell_id, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0, bool followme=true, bool sticktarg=false); + void TypesTemporaryPets(uint32 typesid, Mob *target, const char *name_override = nullptr, uint32 duration_override = 0, bool followme=true, bool sticktarg=false); void WakeTheDead(uint16 spell_id, Mob *target, uint32 duration); void Spin(); void Kill(); @@ -673,8 +673,10 @@ public: inline virtual bool HasOwner() { if(GetOwnerID()==0){return false;} return( entity_list.GetMob(GetOwnerID()) != 0); } inline virtual bool IsPet() { return(HasOwner() && !IsMerc()); } inline bool HasPet() const { if(GetPetID()==0){return false;} return (entity_list.GetMob(GetPetID()) != 0);} - bool HadTempPets() const { return(hasTempPet); } - void TempPets(bool i) { hasTempPet = i; } + inline bool HasTempPetsActive() const { return(hasTempPet); } + inline void SetTempPetsActive(bool i) { hasTempPet = i; } + inline int16 GetTempPetCount() const { return count_TempPet; } + inline void SetTempPetCount(int16 i) { count_TempPet = i; } bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } inline bool IsPetOwnerClient() const { return pet_owner_client; } inline void SetPetOwnerClient(bool value) { pet_owner_client = value; } @@ -1232,6 +1234,7 @@ protected: //temppet bool hasTempPet; bool _IsTempPet; + int16 count_TempPet; bool pet_owner_client; //Flags regular and pets as belonging to a client EGNode *_egnode; //the EG node we are in diff --git a/zone/npc.cpp b/zone/npc.cpp index 699f81384..d1bdee979 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -405,8 +405,8 @@ void NPC::SetTarget(Mob* mob) { if(mob == GetTarget()) //dont bother if they are allready our target return; - //our target is already set, do not turn from the course, unless our current target is dead. - if(GetSwarmInfo() && GetTarget() && (GetTarget()->GetHP() > 0)) { + //This is not the default behavior for swarm pets, must be specified from quest functions or rules value. + if(GetSwarmInfo() && GetSwarmInfo()->target && GetTarget() && (GetTarget()->GetHP() > 0)) { Mob *targ = entity_list.GetMob(GetSwarmInfo()->target); if(targ != mob){ return; @@ -1841,60 +1841,53 @@ bool Mob::HasNPCSpecialAtk(const char* parse) { void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { Mob::FillSpawnStruct(ns, ForWho); + PetOnSpawn(ns); + ns->spawn.is_npc = 1; +} +void NPC::PetOnSpawn(NewSpawn_Struct* ns) +{ //Basic settings to make sure swarm pets work properly. if (GetSwarmOwner()) { - Client *c = entity_list.GetClientByID(GetSwarmOwner()); - if(c) { - SetAllowBeneficial(1); //Allow client cast swarm pets to be heal/buffed. - SetPetOwnerClient(true); - //This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'! - if (RuleB(Pets, SwarmPetNotTargetableWithHotKey)) - ns->spawn.IsMercenary = 1; + + Mob *m = entity_list.GetMobID(GetSwarmOwner()); + + if(m->IsClient()) { + SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client + SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client. + //This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'! + if (RuleB(Pets, SwarmPetNotTargetableWithHotKey)) + ns->spawn.IsMercenary = 1; } //NPC cast swarm pets should still be targetable with F8. - else - ns->spawn.IsMercenary = 0; - } + else + ns->spawn.IsMercenary = 0; - //Not recommended if using above (However, this will work better on older clients). - if (RuleB(Pets, UnTargetableSwarmPet)) { - if(GetOwnerID() || GetSwarmOwner()) { - ns->spawn.is_pet = 1; - if (!IsCharmed() && GetOwnerID()) { - Client *c = entity_list.GetClientByID(GetOwnerID()); - if(c){ - SetPetOwnerClient(true); - sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); - } - } - else if (GetSwarmOwner()) { - ns->spawn.bodytype = 11; - if(!IsCharmed()) - { - Client *c = entity_list.GetClientByID(GetSwarmOwner()); - if(c){ - SetPetOwnerClient(true); - sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); - } - } + SetTempPet(true); //Simple mob flag for checking if temp pet + m->SetTempPetsActive(true); //Neccessary fail safe flag set if mob ever had a swarm pet to ensure they are removed. + m->SetTempPetCount(m->GetTempPetCount() + 1); + + //Not recommended if using above (However, this will work better on older clients). + if (RuleB(Pets, UnTargetableSwarmPet)) { + ns->spawn.bodytype = 11; + if(!IsCharmed() && m->IsClient()) + sprintf(ns->spawn.lastName, "%s's Pet", m->GetName()); + } + } + + else if(GetOwnerID()) { + ns->spawn.is_pet = 1; + if (!IsCharmed() && GetOwnerID()) { + Client *c = entity_list.GetClientByID(GetOwnerID()); + if(c){ + SetPetOwnerClient(true); + sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); } } - } else { - if(GetOwnerID()) { - ns->spawn.is_pet = 1; - if (!IsCharmed() && GetOwnerID()) { - Client *c = entity_list.GetClientByID(GetOwnerID()); - if(c){ - SetPetOwnerClient(true); - sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); - } - } - } else - ns->spawn.is_pet = 0; - } + } - ns->spawn.is_npc = 1; + else + ns->spawn.is_pet = 0; } void NPC::SetLevel(uint8 in_level, bool command) @@ -2417,3 +2410,30 @@ void NPC::DoQuestPause(Mob *other) { } } + +void NPC::DepopSwarmPets() +{ + if (GetSwarmInfo()) { + if (GetSwarmInfo()->duration->Check(false)){ + Mob* owner = entity_list.GetMobID(GetSwarmInfo()->owner_id); + if (owner) + owner->SetTempPetCount(owner->GetTempPetCount() - 1); + + Depop(); + return; + } + + //This is only used for optional quest or rule derived behavior now if you force a temp pet on a specific target. + if (GetSwarmInfo()->target) { + Mob *targMob = entity_list.GetMob(GetSwarmInfo()->target); + if(!targMob || (targMob && targMob->IsCorpse())){ + Mob* owner = entity_list.GetMobID(GetSwarmInfo()->owner_id); + if (owner) + owner->SetTempPetCount(owner->GetTempPetCount() - 1); + + Depop(); + return; + } + } + } +} \ No newline at end of file diff --git a/zone/npc.h b/zone/npc.h index c24c97200..71e6596ad 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -243,6 +243,8 @@ public: uint32 GetSwarmOwner(); uint32 GetSwarmTarget(); void SetSwarmTarget(int target_id = 0); + void DepopSwarmPets(); + void PetOnSpawn(NewSpawn_Struct* ns); void SignalNPC(int _signal_id); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index b34cbb6c3..10e94f47e 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -1517,14 +1517,15 @@ XS(XS_Mob_MakeTempPet); /* prototype to pass -Wmissing-prototypes */ XS(XS_Mob_MakeTempPet) { dXSARGS; - if (items < 2 || items > 5) - Perl_croak(aTHX_ "Usage: Mob::MakeTempPet(THIS, spell_id, name=nullptr, duration=0, target=nullptr)"); + if (items < 2 || items > 6) + Perl_croak(aTHX_ "Usage: Mob::MakeTempPet(THIS, spell_id, name=nullptr, duration=0, target=nullptr, sticktarg=0)"); { Mob * THIS; uint16 spell_id = (uint16)SvUV(ST(1)); char * name; uint32 duration; Mob * target; + bool sticktarg; if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -1554,7 +1555,13 @@ XS(XS_Mob_MakeTempPet) else Perl_croak(aTHX_ "owner is not of type Mob"); - THIS->TemporaryPets(spell_id, target, name, duration); + if (items < 6) + sticktarg = false; + else { + sticktarg = (bool)SvTRUE(ST(5)); + } + + THIS->TemporaryPets(spell_id, target, name, duration, true, sticktarg); } XSRETURN_EMPTY; } @@ -1563,15 +1570,16 @@ XS(XS_Mob_TypesTempPet); /* prototype to pass -Wmissing-prototypes */ XS(XS_Mob_TypesTempPet) { dXSARGS; - if (items < 2 || items > 6) - Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, typesid, name=nullptr, duration=0, target=nullptr, follow=0)"); + if (items < 2 || items > 7) + Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, typesid, name=nullptr, duration=0, follow=0, sticktarg=0, target=nullptr)"); { Mob * THIS; uint32 typesid = (uint32)SvUV(ST(1)); char * name; uint32 duration; - Mob * target; bool follow; + Mob * target; + bool sticktarg; if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -1593,21 +1601,28 @@ XS(XS_Mob_TypesTempPet) duration = (uint32)SvUV(ST(3)); if (items < 5) + follow = true; + else { + follow = (bool)SvTRUE(ST(4)); + } + + if (items < 6) target = nullptr; - else if (sv_derived_from(ST(4), "Mob")) { - IV tmp = SvIV((SV*)SvRV(ST(4))); + else if (sv_derived_from(ST(5), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(5))); target = INT2PTR(Mob *,tmp); } else Perl_croak(aTHX_ "target is not of type Mob"); - if (items < 6) - follow = false; + + if (items < 7) + sticktarg = false; else { - follow = (bool)SvTRUE(ST(5)); + sticktarg = (bool)SvTRUE(ST(6)); } - THIS->TypesTemporaryPets(typesid, target, name, duration, follow); + THIS->TypesTemporaryPets(typesid, target, name, duration, follow, sticktarg); } XSRETURN_EMPTY; } @@ -8433,7 +8448,8 @@ XS(boot_Mob) newXSproto(strcpy(buf, "SetRace"), XS_Mob_SetRace, file, "$$"); newXSproto(strcpy(buf, "SetGender"), XS_Mob_SetGender, file, "$$"); newXSproto(strcpy(buf, "SendIllusion"), XS_Mob_SendIllusion, file, "$$;$$$$$$$$$$$$"); - newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$"); + newXSproto(strcpy(buf, "MakeTempPet"), XS_Mob_MakeTempPet, file, "$$;$$$$"); + newXSproto(strcpy(buf, "TypesTempPet"), XS_Mob_TypesTempPet, file, "$$;$$$$$"); newXSproto(strcpy(buf, "QuestReward"), XS_Mob_QuestReward, file, "$$;$$$"); newXSproto(strcpy(buf, "CameraEffect"), XS_Mob_CameraEffect, file, "$$;$$$"); newXSproto(strcpy(buf, "SpellEffect"), XS_Mob_SpellEffect, file, "$$;$$$$$$"); diff --git a/zone/spells.cpp b/zone/spells.cpp index 6c6119831..52fabb6ff 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -122,17 +122,7 @@ void Mob::SpellProcess() void NPC::SpellProcess() { Mob::SpellProcess(); - - if (GetSwarmInfo()) { - if (GetSwarmInfo()->duration->Check(false)) - Depop(); - - Mob *targMob = entity_list.GetMob(GetSwarmInfo()->target); - if (GetSwarmInfo()->target != 0) { - if(!targMob || (targMob && targMob->IsCorpse())) - Depop(); - } - } + DepopSwarmPets(); } /////////////////////////////////////////////////////////////////////////////// From 0355af310d474cf686deed2b48d83e28077aff2c Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 15 Nov 2014 23:16:24 -0500 Subject: [PATCH 0260/1883] Non-buggy fix for OP_ShopPlayerBuy (thanks Natedog!) --- changelog.txt | 2 ++ zone/client_packet.cpp | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index 506c4d2ff..bc14b4af4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/15/2014 == +Uleat(Natedog): A better fix for OP_ShopPlayerBuy - doesn't cause the issues that I introduced == 11/14/2014 == Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl. diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 63e507162..3cd0bb157 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12303,7 +12303,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) } } - if (freeslotid == INVALID_INDEX) + if (!stacked && freeslotid == INVALID_INDEX) { Message(13, "You do not have room for any more items."); safe_delete(outapp); @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) // start QS code // stacking purchases not supported at this time - entire process will need some work to catch them properly - if (RuleB(QueryServ, PlayerLogMerchantTransactions) && (!stacked) && m_inv[freeslotid]) { + if (RuleB(QueryServ, PlayerLogMerchantTransactions)) { ServerPacket* qspack = new ServerPacket(ServerOP_QSPlayerLogMerchantTransactions, sizeof(QSMerchantLogTransaction_Struct)+sizeof(QSTransactionItems_Struct)); QSMerchantLogTransaction_Struct* qsaudit = (QSMerchantLogTransaction_Struct*)qspack->pBuffer; @@ -12366,14 +12366,24 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) qsaudit->char_money.copper = mpo->price % 10; qsaudit->char_count = 0; - qsaudit->items[0].char_slot = freeslotid; - qsaudit->items[0].item_id = m_inv[freeslotid]->GetID(); + qsaudit->items[0].char_slot = freeslotid == INVALID_INDEX ? 0 : freeslotid; + qsaudit->items[0].item_id = item->ID; qsaudit->items[0].charges = mpo->quantity; - qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(0); - qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(1); - qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(2); - qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(3); - qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(4); + + if (freeslotid == INVALID_INDEX) { + qsaudit->items[0].aug_1 = 0; + qsaudit->items[0].aug_2 = 0; + qsaudit->items[0].aug_3 = 0; + qsaudit->items[0].aug_4 = 0; + qsaudit->items[0].aug_5 = 0; + } + else { + qsaudit->items[0].aug_1 = m_inv[freeslotid]->GetAugmentItemID(0); + qsaudit->items[0].aug_2 = m_inv[freeslotid]->GetAugmentItemID(1); + qsaudit->items[0].aug_3 = m_inv[freeslotid]->GetAugmentItemID(2); + qsaudit->items[0].aug_4 = m_inv[freeslotid]->GetAugmentItemID(3); + qsaudit->items[0].aug_5 = m_inv[freeslotid]->GetAugmentItemID(4); + } qspack->Deflate(); if (worldserver.Connected()) { worldserver.SendPacket(qspack); } @@ -12394,7 +12404,6 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) std::cout << "At 1: " << t1.getDuration() << std::endl; return; } - void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { From 01c580224d8f71c801007a4943236c3fc460a020 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 15 Nov 2014 23:40:13 -0500 Subject: [PATCH 0261/1883] Implemented NPC Special Ability 41 'Allow To Tank', gives NPC opportunity to take aggro over a client in melee range. --- changelog.txt | 3 ++- zone/common.h | 3 ++- zone/hate_list.cpp | 7 +++++++ zone/perl_mob.cpp | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 566cb393b..64dd57286 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 11/15/2014 == +== 11/16/2014 == +Kayen: Implemented NPC Special Ability 41 'Allow To Tank', gives NPC opportunity to take aggro over a client in melee range. Kayen: Updated swarm pet AI to be consistent with live. *OLD AI: Swarm pet would lock on to target until target died, then depop as soon as target died. diff --git a/zone/common.h b/zone/common.h index 64b6e38af..ea299ab11 100644 --- a/zone/common.h +++ b/zone/common.h @@ -133,7 +133,8 @@ enum { ALLOW_BENEFICIAL = 38, DISABLE_MELEE = 39, NPC_CHASE_DISTANCE = 40, - MAX_SPECIAL_ATTACK = 41 + ALLOW_TO_TANK = 41, + MAX_SPECIAL_ATTACK = 42 }; diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 2ee904453..4c4290232 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -403,6 +403,13 @@ Mob *HateList::GetTop(Mob *center) } } + if (!isTopClientType) { + if (top->GetSpecialAbility(ALLOW_TO_TANK)){ + isTopClientType = true; + topClientTypeInRange = top; + } + } + if(!isTopClientType) return topClientTypeInRange ? topClientTypeInRange : nullptr; diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 10e94f47e..17ac9c3ac 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -1571,7 +1571,7 @@ XS(XS_Mob_TypesTempPet) { dXSARGS; if (items < 2 || items > 7) - Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, typesid, name=nullptr, duration=0, follow=0, sticktarg=0, target=nullptr)"); + Perl_croak(aTHX_ "Usage: Mob::TypesTempPet(THIS, typesid, name=nullptr, duration=0, follow=0, target=nullptr, sticktarg=0,)"); { Mob * THIS; uint32 typesid = (uint32)SvUV(ST(1)); From 41cbe5fb014af6d3cf371b45907f020c7fc64b53 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 15 Nov 2014 23:42:10 -0500 Subject: [PATCH 0262/1883] i hate the change log --- changelog.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 25dc35e7b..3abcbf9bf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,8 +2,6 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/15/2014 == Uleat(Natedog): A better fix for OP_ShopPlayerBuy - doesn't cause the issues that I introduced - -== 11/16/2014 == Kayen: Implemented NPC Special Ability 41 'Allow To Tank', gives NPC opportunity to take aggro over a client in melee range. Kayen: Updated swarm pet AI to be consistent with live. From 959319f91f72e7c088b783cbc6fee2a4c15b362b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 15 Nov 2014 23:29:37 -0600 Subject: [PATCH 0263/1883] Uploading utility script db_dumper.pl - Cross platform database dumper utility that supports compression ############################################################ #::: Script: DB_Dumper.pl #::: Purpose: Utility to easily manage database backups and compress. #::: Export Individual DB Tables... #::: Export specific databases... #::: Built for both Windows and Linux #::: Windows uses WinRar or 7-Zip for compression #::: Linux uses tar for compression #::: Author: Akkadius ############################################################ --- utils/scripts/db_dumper.pl | 214 +++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 utils/scripts/db_dumper.pl diff --git a/utils/scripts/db_dumper.pl b/utils/scripts/db_dumper.pl new file mode 100644 index 000000000..f94248375 --- /dev/null +++ b/utils/scripts/db_dumper.pl @@ -0,0 +1,214 @@ +#!/usr/bin/perl + +############################################################ +#::: Script: DB_Dumper.pl +#::: Purpose: Utility to easily manage database backups and compress. +#::: Export Individual DB Tables... +#::: Export specific databases... +#::: Built for both Windows and Linux +#::: Windows uses WinRar or 7-Zip for compression +#::: Linux uses tar for compression +#::: Author: Akkadius +############################################################ + +$localdrive = "C:"; #::: Where Windows and all Install Programs are... +$linesep = "---------------------------------------"; + +use POSIX qw(strftime); +my $date = strftime "%m-%d-%Y", localtime; +print "\nTodays Date: " . $date . "\n"; + +use Config; +print "Operating System is: $Config{osname}\n"; +if($Config{osname}=~/linux/i){ $OS = "Linux"; } +if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } + +if(!$ARGV[0]){ + print "\nERROR! Need arguments\n\n"; + print "#::: Help :::#\n"; + print "######################################################\n\n"; + print "Arguments\n"; + print " loc=\"C:\\File Location\" - File path location to backup...\n"; + print " database=\"dbname\" - Manually specify databasename, default is database in eqemu_config.xml\n"; + print " tables=\"table1,table2,table3\" - Manually specify tables, default is to dump all tables from database\n"; + print " compress - Compress Database with 7-ZIP, will fallback to WinRAR depending on what is installed (Must be installed to default program dir)...\n"; + print ' Example: perl DB_Dumper.pl Loc="E:\Backups"' . "\n\n"; + print "######################################################\n"; + exit; +} + +#::: CONFIG VARIABLES - Parsed from eqemu_config.xml + +my $confile = "eqemu_config.xml"; #default +open(F, "<$confile") or die "Unable to open config: $confile - This must be in your EQEmu Server Folder with your XML config\n"; +my $indb = 0; + +while() { + s/\r//g; + if(//i) { $indb = 1; } + next unless($indb == 1); + if(/<\/database>/i) { $indb = 0; last; } + if(/(.*)<\/host>/i) { $host = $1; } + elsif(/(.*)<\/username>/i) { $user = $1; } + elsif(/(.*)<\/password>/i) { $pass = $1; } + elsif(/(.*)<\/db>/i) { $db = $1; } +} + +$Debug = 0; +print "Arguments\n" if $Debug; +$n = 0; +while($ARGV[$n]){ + print $n . ': ' . $ARGV[$n] . "\n" if $Debug; + if($ARGV[$n]=~/compress/i){ + print "Compression SET\n"; + $Compress = 1; + } + if($ARGV[$n]=~/database=/i){ + @DB_NAME = split('=', $ARGV[$n]); + print "Database is " . $DB_NAME[1] . "\n"; + $db = $DB_NAME[1]; + } + if($ARGV[$n]=~/loc=/i){ + @B_LOC = split('=', $ARGV[$n]); + print "Backup Directory: " . $B_LOC[1] . "\n"; + } + if($ARGV[$n]=~/tables=/i){ + @Tables = split('=', $ARGV[$n]); @TList = split(',', $Tables[1]); + foreach my $tables (@TList){ + $t_tables .= $tables . " "; + $t_tables_l .= $tables . "_"; + $t_tables_p .= $tables . "\n"; + } + print "Backing up tables: \n\n############################\n" . $t_tables_p . "############################\n\n"; + } + $n++; +} + +#::: Check for Backup Directory existence, if doesn't exist then create... +if (-d $B_LOC[1]) { + print "Directory currently exists... Adding files to it...\n\n"; +} +elsif($B_LOC[1] ne ""){ + print "Directory does NOT exist! Creating...\n\n"; + mkdir($B_LOC[1]) or die 'Failed to create folder, maybe created the folder manually at "' . $B_LOC[1]. '" ?'; +} +else{ + print "No save location specified... Saving to folder script is running in...\n"; +} +if($B_LOC[1] ne ""){ + if($OS eq "Windows"){ $file_app = "\\"; } + if($OS eq "Linux"){ $file_app = "/"; } +} +else { + $file_app = ""; +} + +if($t_tables ne ""){ + $tables_f_l = substr($t_tables_l, 0, 20) . '...'; + $target_file = '' . $tables_f_l . ' ' . $date . ''; + print "Performing table based backup...\n"; + #::: Backup Database... + print "Backing up Database " . $db . "... \n\n"; + $cmd = 'mysqldump -u' . $user . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' ' . $t_tables . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"'; + printcmd($cmd); + system($cmd); +} +else{ #::: Entire DB Backup + $target_file = '' . $db . ' ' . $date . ''; + #::: Backup Database... + print "Backing up Database " . $db . "... \n\n"; + $cmd = 'mysqldump -u' . $user . ' --max_allowed_packet=512M --password="' . $pass . '" ' . $db . ' > "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql"'; + printcmd($cmd); + system($cmd); +} + +#::: Get File Size +$fileloc = '' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql'; +$filesize = -s $fileloc; +if($filesize < 1000){ print "\n" . 'Error occurred... exiting...' . "\n\n"; exit; } +print "Backup DONE... DB Backup File Size '" . $filesize . "' (" . get_filesize_str($fileloc) . ")\n\n"; + +#::: WinRar Get, check compression flag +if($Compress == 1){ + if($OS eq "Windows"){ + if(-d $localdrive . "\\Program Files\\7-Zip"){ + print " ::: You have 7-Zip installed as 64 Bit...\n\n"; + $S_ZIP = $localdrive . "\\Program Files\\7-Zip"; + } + elsif(-d $localdrive . "\\Program Files (x86)\\7-Zip"){ + print " ::: You have 7-Zip installed as 32 Bit...\n\n"; + $S_ZIP = $localdrive . "\\Program Files (x86)\\7-Zip"; + } + elsif(-d $localdrive . "\\Program Files (x86)\\WinRAR"){ + print " ::: You have WinRAR installed as 32 Bit...\n\n"; + $WinRar = $localdrive . "\\Program Files (x86)\\WinRAR"; + } + elsif(-d $localdrive . "\\Program Files\\WinRAR"){ + print " ::: You have WinRAR installed as 64 Bit...\n\n"; + $WinRar = $localdrive . "\\Program Files\\WinRAR"; + } + else{ + print "No WinRAR installed... Will not compress...\n"; + } + if($S_ZIP ne ""){ + print "Compressing Database with 7-ZIP... \n\n"; + $cmd = '"' . $S_ZIP . '\\7z" a -t7z -m0=lzma -mx=9 "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.7z" "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + print "\nDeleting RAW .sql Dump... \n\n"; + $cmd = 'del "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + $final_file = $target_file . ".7z"; + } + elsif($WinRar ne ""){ + print "Compressing Database with WinRAR... \n"; + $cmd = '"' . $WinRar . '\\rar" a "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.rar" "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + print "\nDeleting RAW .sql Dump... \n\n"; + $cmd = 'del "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + $final_file = $target_file . ".rar"; + } + } + if($OS eq "Linux"){ + print "Compressing Database with Tarball... \n"; + $cmd = 'tar -zcvf "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.tar.gz" "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + print "\nDeleting RAW .sql Dump... \n\n"; + $cmd = 'rm "' . $B_LOC[1] . '' . $file_app . '' . $target_file . '.sql" '; + printcmd($cmd); + system($cmd); + $final_file = $target_file . ".tar.gz"; + } +} + +#::: Get Final File Location for display +if($B_LOC[1] ne ""){ $final_loc = $B_LOC[1] . '' . $file_app . ""; } +else{ + if($OS eq "Windows"){ + $final_loc = `echo %cd%`; + } + elsif($OS eq "Linux"){ + $final_loc = `pwd`; + } +} + +print "Final file located: " . $final_loc . "" . $final_file . "\n\n"; + +sub printcmd{ + print "--- CMD --- \n" . $_[0] . "\n" . $linesep . "\n\n"; +} + +sub get_filesize_str{ + my $file = shift(); + my $size = (stat($file))[7] || die "stat($file): $!\n"; + if ($size > 1099511627776) { return sprintf("%.2f TiB", $size / 1099511627776); } + elsif ($size > 1073741824) { return sprintf("%.2f GiB", $size / 1073741824); } + elsif ($size > 1048576) { return sprintf("%.2f MiB", $size / 1048576); } + elsif ($size > 1024) { return sprintf("%.2f KiB", $size / 1024); } + else { return "$size byte" . ($size == 1 ? "" : "s"); } +} From 0017951a74f0d8bfeb11186bae380666afed58b6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 00:10:09 -0600 Subject: [PATCH 0264/1883] Manifest update, removal of duplicate AA SQL update file --- utils/scripts/db_dumper.pl | 2 +- utils/sql/db_update_manifest.txt | 1 - .../git/required/2014_06_25_AA_Updates..sql | 34 ------------------- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 utils/sql/git/required/2014_06_25_AA_Updates..sql diff --git a/utils/scripts/db_dumper.pl b/utils/scripts/db_dumper.pl index f94248375..cce98fdff 100644 --- a/utils/scripts/db_dumper.pl +++ b/utils/scripts/db_dumper.pl @@ -9,7 +9,7 @@ #::: Windows uses WinRar or 7-Zip for compression #::: Linux uses tar for compression #::: Author: Akkadius -############################################################ +############################################################ $localdrive = "C:"; #::: Where Windows and all Install Programs are... $linesep = "---------------------------------------"; diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 3eb185476..4918151b7 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -293,7 +293,6 @@ 9034, 2014_04_25_spawn_events.sql 9035, 2014_04_27_AISpellEffects.sql 9036, 2014_05_04_SlowMitigationFix.sql -9037, 2014_06_25_AA_Updates..sql 9038, 2014_06_25_AA_Updates.sql 9039, 2014_07_04_AA_Updates.sql 9040, 2014_07_10_npc_spells.sql diff --git a/utils/sql/git/required/2014_06_25_AA_Updates..sql b/utils/sql/git/required/2014_06_25_AA_Updates..sql deleted file mode 100644 index 3d7a048b6..000000000 --- a/utils/sql/git/required/2014_06_25_AA_Updates..sql +++ /dev/null @@ -1,34 +0,0 @@ --- AA MGB update -UPDATE altadv_vars SET spellid = 5228 WHERE skill_id = 128; -UPDATE aa_actions SET spell_id = 5228, nonspell_action = 0 WHERE aaid = 128; - --- AA Project Illusion update -UPDATE altadv_vars SET spellid = 5227 WHERE skill_id = 643; -UPDATE aa_actions SET spell_id = 5227, nonspell_action = 0 WHERE aaid = 643; - --- AA Improved Reclaim Energy -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('180', '1', '241', '95', '0'); - --- AA Headshot -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('644', '1', '217', '0', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('644', '2', '346', '46', '0'); - --- AA Anatomy (Rogue Assassinate) -INSERT INTO `altadv_vars` (`skill_id`, `name`, `cost`, `max_level`, `hotkey_sid`, `hotkey_sid2`, `title_sid`, `desc_sid`, `type`, `spellid`, `prereq_skill`, `prereq_minpoints`, `spell_type`, `spell_refresh`, `classes`, `berserker`, `class_type`, `cost_inc`, `aa_expansion`, `special_category`, `sof_type`, `sof_cost_inc`, `sof_max_level`, `sof_next_skill`, `clientver`, `account_time_required`, `sof_current_level`,`sof_next_id`,`level_inc`) VALUES ('1604', 'Anatomy', '5', '3', '4294967295', '4294967295', '1604', '1604', '1', '4294967295', '0', '0', '0', '0', '512', '0', '60', '1', '10', '4294967295', '3', '0', '3', '1604', '1', '0', '0', '0', '0'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1604', '1', '439', '0', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1604', '2', '345', '48', '0'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1605', '1', '439', '0', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1605', '2', '345', '51', '0'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1606', '1', '439', '0', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('1606', '2', '345', '53', '0'); - --- AA Finishing Blow Fix -DELETE FROM aa_effects WHERE aaid = 199 AND slot = 2; -DELETE FROM aa_effects WHERE aaid = 200 AND slot = 2; -DELETE FROM aa_effects WHERE aaid = 201 AND slot = 2; -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('119', '1', '278', '500', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('119', '2', '440', '50', '200'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('120', '1', '278', '500', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('120', '2', '440', '52', '200'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('121', '1', '278', '500', '32000'); -INSERT INTO `aa_effects` (`aaid`, `slot`, `effectid`, `base1`, `base2`) VALUES ('121', '2', '440', '54', '200'); \ No newline at end of file From fc48a109fd271331d25edc9c54bdb64ca0551e32 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 16 Nov 2014 05:46:46 -0500 Subject: [PATCH 0265/1883] SUB EVENT CAST ON will now be parsed in player.pl (note: exports $spell_id) --- zone/spells.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index 52fabb6ff..315fe8712 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3339,6 +3339,12 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r sprintf(temp1, "%d", spell_id); parse->EventNPC(EVENT_CAST_ON, spelltar->CastToNPC(), this, temp1, 0); } + else if (spelltar->IsClient()) + { + char temp1[100]; + sprintf(temp1, "%d", spell_id); + parse->EventPlayer(EVENT_CAST_ON, spelltar->CastToClient(),temp1, 0); + } mod_spell_cast(spell_id, spelltar, reflect, use_resist_adjust, resist_adjust, isproc); From 9ac79f1071a12cd8e752ac98f63407b75e3ffaff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 05:09:58 -0600 Subject: [PATCH 0266/1883] Manifest changes, initial db_update script upload. Source changes on its way. --- utils/scripts/db_update.pl | 354 +++++++++++++++++ utils/sql/db_update_manifest.txt | 646 ++++++++++++++++--------------- 2 files changed, 685 insertions(+), 315 deletions(-) create mode 100644 utils/scripts/db_update.pl diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl new file mode 100644 index 000000000..e1c03f871 --- /dev/null +++ b/utils/scripts/db_update.pl @@ -0,0 +1,354 @@ +#!/usr/bin/perl + +########################################################### +#::: Automatic Database Upgrade Script +#::: Author: Akkadius +#::: Purpose: To upgrade databases with ease and maintain versioning +########################################################### + +my $confile = "eqemu_config.xml"; #default +open(F, "<$confile") or die "Unable to open config: $confile\n"; +my $indb = 0; +while() { + s/\r//g; + if(//i) { $indb = 1; } + next unless($indb == 1); + if(/<\/database>/i) { $indb = 0; last; } + if(/(.*)<\/host>/i) { $host = $1; } + elsif(/(.*)<\/username>/i) { $user = $1; } + elsif(/(.*)<\/password>/i) { $pass = $1; } + elsif(/(.*)<\/db>/i) { $db = $1; } +} + +print " +============================================================ +# EQEmu: Automatic Database Upgrade Check # +============================================================ +"; + +use Config; +print " Operating System is: $Config{osname}\n"; +if($Config{osname}=~/linux/i){ $OS = "Linux"; } +if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } + +if($OS eq "Windows"){ + $has_mysql_path = `echo %PATH%`; + if($has_mysql_path=~/MySQL|MariaDB/i){ + @mysql = split(';', $has_mysql_path); + foreach my $v (@mysql){ + if($v=~/MySQL|MariaDB/i){ + $path = $v . "/mysql"; + last; + } + } + print " (Windows) MySQL is in system path \n"; + print " Path = " . $path . "\n"; + print "============================================================\n"; + } +} + +#::: Linux Check +if($OS eq "Linux"){ + $has_mysql_path = `whereis mysql`; + if($has_mysql_path=~/MySQL|MariaDB/i){ + @mysql = split(' ', $has_mysql_path); + foreach my $v (@mysql){ + if($v=~/MySQL|MariaDB/i){ + $path = $v; + last; + } + } + print " (Linux) MySQL is in system path \n"; + print " Path = " . $path . "\n"; + print "============================================================\n"; + } +} + +#::: Path not found, error and exit +if($path eq ""){ + print "MySQL path not found, please add the path for automatic database upgrading to continue... \n\n"; + print "Exiting...\n"; + exit; +} + +#::: Create db_update working directory if not created +mkdir('db_update'); + +# print `"$path" --user $user --password="$pass" $db < db_update/db_update_run_file.txt`; + +#::: Check if db_version table exists... +if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){ + print GetMySQLResult(" + CREATE TABLE `db_version` ( + `version` int(11) DEFAULT '0' + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + INSERT INTO `db_version` (`version`) VALUES ('1000');"); + print "Table 'db_version' does not exists.... Creating...\n\n"; +} + +@db_version = split(': ', `world db_version`); +$bin_db_ver = trim($db_version[1]); +$local_db_ver = trim(GetMySQLResult("SELECT `version` FROM `db_version` LIMIT 1")); +print "Binary Database Version is: (" . $bin_db_ver . ")\n"; +print "Local Database Version is: (" . $local_db_ver . ")\n\n"; + +#::: If World ran this script, and our version is up to date, continue... +if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ exit; } + +print "Retrieving latest database manifest...\n"; +GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); +# GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); + +if($local_db_ver < $bin_db_ver){ + print "You have missing database updates, type 1 or 2 to backup your database before running them as recommended...\n\n"; + #::: Display Menu + ShowMenuPrompt(); +} + +sub ShowMenuPrompt { + my %dispatch = ( + 1 => \&database_dump, + 2 => \&database_dump_compress, + 3 => \&Run_Database_Check, + 0 => \&Exit, + ); + + while (1) { + { + local $| = 1; + print MenuOptions(), '> '; + } + + my $choice = <>; + + $choice =~ s/\A\s+//; + $choice =~ s/\s+\z//; + + if (defined(my $handler = $dispatch{$choice})) { + my $result = $handler->(); + unless (defined $result) { + exit 0; + } + } + else { + if($ARGV[0] ne "ran_from_world"){ + warn "\n\nInvalid selection\n\n"; + } + } + } +} + +sub MenuOptions { + if(defined(@total_updates)){ + $option[3] = "Run pending updates... (" . scalar (@total_updates) . ")"; + } + else{ + $option[3] = "Check for pending Database updates - Stages updates for automatic upgrade..."; + } + +return <new; + $ua->timeout(10); + $ua->env_proxy; + my $response = $ua->get($URL); + + if ($response->is_success){ + open (FILE, '> ' . $Dest_File . ''); + print FILE $response->decoded_content; + close (FILE); + print " URL: " . $URL . "\n"; + print " Saved: " . $Dest_File . " \n"; + } + else { + print "Error, no connection to the internet...\n\n"; + die $response->status_line; + } + } + if($OS eq "Linux"){ + #::: wget -O db_update/db_update_manifest.txt https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt + $wget = `wget -O $Dest_File $URL`; + print " URL: " . $URL . "\n"; + print " Saved: " . $Dest_File . " \n"; + if($wget=~/unable to resolve/i){ + print "Error, no connection to the internet...\n\n"; + die; + } + } +} + +#::: Trim Whitespaces +sub trim { + my $string = $_[0]; + $string =~ s/^\s+//; + $string =~ s/\s+$//; + return $string; +} + +#::: Responsible for Database Upgrade Routines +sub Run_Database_Check{ + #::: Run 2 - Running pending updates... + if(defined(@total_updates)){ + @total_updates = sort @total_updates; + foreach my $val (@total_updates){ + $file_name = trim($m_d{$val}[1]); + print "Running Update: " . $val . " - " . $file_name . "\n"; + print GetMySQLResultFromFile("db_update/$file_name"); + } + return; + } + + #::: Run 1 - Initial checking of needed updates... + print "Reading manifest...\n\n"; + use Data::Dumper; + open (FILE, "db_update/db_update_manifest.txt"); + while () { + chomp; + $o = $_; + if($o=~/#/i){ next; } + #print $o . "\n"; + @manifest = split('\|', $o); + $m_d{$manifest[0]} = [@manifest]; + } + + @total_updates = (); + + #::: Iterate through Manifest backwards from binary version down to local version... + for($i = $bin_db_ver; $i > $local_db_ver; $i--){ + if(!defined($m_d{$i}[0])){ next; } + + $file_name = trim($m_d{$i}[1]); + $query_check = trim($m_d{$i}[2]); + $match_type = trim($m_d{$i}[3]); + $match_text = trim($m_d{$i}[4]); + + #::: Match type update + if($match_type eq "contains"){ + if(trim(GetMySQLResult($query_check))=~/$match_text/i){ + print "Missing DB Update " . $i . " '" . $file_name . "' \n"; + FetchMissingUpdate($i, $file_name); + push(@total_updates, $i); + } + else{ + print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + } + print_match_debug(); + print_break(); + } + if($match_type eq "missing"){ + if(GetMySQLResult($query_check)=~/$match_text/i){ + print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + next; + } + else{ + print "Missing DB Update " . $i . " '" . $file_name . "' \n"; + FetchMissingUpdate($i, $file_name); + push(@total_updates, $i); + } + print_match_debug(); + print_break(); + } + if($match_type eq "empty"){ + if(GetMySQLResult($query_check) eq ""){ + print "Missing DB Update " . $i . " '" . $file_name . "' \n"; + FetchMissingUpdate($i, $file_name); + push(@total_updates, $i); + } + else{ + print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + } + print_match_debug(); + print_break(); + } + if($match_type eq "not_empty"){ + if(GetMySQLResult($query_check) ne ""){ + print "Missing DB Update " . $i . " '" . $file_name . "' \n"; + FetchMissingUpdate($i, $file_name); + push(@total_updates, $i); + } + else{ + print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + } + print_match_debug(); + print_break(); + } + } + print "\n\n"; +} + +sub FetchMissingUpdate{ + $db_update = $_[0]; + $update_file = $_[1]; + if($db_update >= 9000){ + GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/git/required/" . $update_file, "db_update/" . $update_file . ""); + } + elsif($db_update >= 5000 && $db_update <= 9000){ + GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/svn/" . $update_file, "db_update/" . $update_file . ""); + } +} + +sub print_match_debug{ + if(!$debug){ return; } + print " Match Type: '" . $match_type . "'\n"; + print " Match Text: '" . $match_text . "'\n"; + print " Query Check: '" . $query_check . "'\n"; + print " Result: '" . trim(GetMySQLResult($query_check)) . "'\n"; +} +sub print_break{ + if(!$debug){ return; } + print "\n==============================================\n"; +} \ No newline at end of file diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 4918151b7..405394a39 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -1,315 +1,331 @@ -5001, 1_task_system.sql -5002, 2_optional_maxclients.sql -5003, 14_optional_merchantlist.sql -5004, 35_task_stepped.sql -5005, 42_task_min_maxlevel.sql -5006, 55_zone_shutdowndeleay.sql -5007, 68_optional_character_maxexplevel.sql -5008, 103_optional_chat_rules.sql -5009, 104_traps.sql -5010, 106_optional_proc_rules.sql -5011, 120_damageshieldtypes.sql -5012, 125_aggrozone.sql -5013, 127_optional_spell_rules.sql -5014, 129_optional_shared_plat_rule.sql -5015, 131_optional_combat_rules.sql -5016, 133_task_repeatable.sql -5017, 142_deathpeace_and_lifetap_aas.sql -5018, 158_optional_death_exp_loss.sql -5019, 176_melody.sql -5020, 189_character_.sql -5021, 196_trader.sql -5022, 210_undyeme.sql -5023, 222_buyer.sql -5024, 226_account_limiting.sql -5025, 230_spells_table.sql -5026, 235_horses_table.sql -5027, 243_spawn_timers.sql -5028, 247_mail.sql -5029, 249_chatchannels.sql -5030, 250_bot_spell_update.sql -5031, 250_optional_bot_spell_update.sql -5032, 285_optional_bot_spell_update.sql -5033, 292_augslots.sql -5034, 294_merchant_logging.sql -5035, 304_faction_list.sql -5036, 326_aas.sql -5037, 328_bot_management.sql -5038, 328_optional_bot_management.sql -5039, 340_gm_ips.sql -5040, 356_combat.sql -5041, 360_peqzone.sql -5042, 364_ranged_dist_rule.sql -5043, 386_bot_save_raid.sql -5044, 434_optional_rest_state_rules.sql -5045, 447_sof_startzone_rule.sql -5046, 463_altadv_vars.sql -5047, 475_aa_actions.sql -5048, 500_spawn2_optimization.sql -5049, 503_bugs.sql -5050, 518_drakkin_npc_type_features.sql -5051, 524_rule_values_notes.sql -5052, 527_npc_armor_tint.sql -5053, 553_saylink_table.sql -5054, 564_nokeyring.sql -5055, 600_group_leadership.sql -5056, 612_instance_changes.sql -5057, 615_adventure_assassination.sql -5058, 619_Adventure_Recruiter_Flavor.sql -5059, 621_LDoNTraps.sql -5060, 633_ucs.sql -5061, 634_TrapTemplateDefaultValue.sql -5062, 643_BotsTable.sql -5063, 646_archery_penalty_rule.sql -5064, 665_heroic_resists.sql -5065, 667_titles.sql -5066, 687_aa_table_changes.sql -5067, 699_peqzone_rule.sql -5068, 702_aashieldblock_tint_table.sql -5069, 703_peqzone_rule.sql -5070, 704_rules.sql -5071, 710_tint_set_naming.sql -5072, 721_pathing_rules.sql -5073, 730_smart_delay_moving.sql -5074, 731_rule_assist_notarget_self.sql -5075, 732_sacrifice_rules.sql -5076, 745_slow_mitigation.sql -5077, 754_archery_base_damage_rule.sql -5078, 755_sof_altadv_vars_updates.sql -5079, 773_monk_rules.sql -5080, 853_optional_rule_aaexp.sql -5081, 858_optional_rule_ip_limit_by_status.sql -5082, 892_optional_bots_table_mod.sql -5083, 893_optional_bots_table_mod.sql -5084, 898_npc_maxlevel_scalerate.sql -5085, 902_optional_rule_snareflee.sql -5086, 923_spawn2_enabled.sql -5087, 962_hot_zone.sql -5088, 964_reports.sql -5089, 971_veteran_rewards.sql -5090, 977_raid_npc_private_corpses.sql -5091, 979_unique_spawn_by_name.sql -5092, 980_account_ip.sql -5093, 1022_botadventuring.sql -5094, 1027_botactives.sql -5095, 1030_botzoningsupport.sql -5096, 1036_botbuffs.sql -5097, 1038_botpetstatepersists.sql -5098, 1038_grouptablesuniquecolumndefinitions.sql -5099, 1039_botguilds.sql -5100, 1040_DeprecatedBotRaidsSystems.sql -5101, 1057_titles.sql -5102, 1077_botgroups.sql -5103, 1136_spell_globals.sql -5104, 1144_optional_rule_return_nodrop.sql -5105, 1195_account_suspendeduntil.sql -5106, 1259_npc_skill_types.sql -5107, 1280_bot_augs.sql -5108, 1290_optional_exp_loss_rule.sql -5109, 1293_guild_bank.sql -5110, 1379_loginserver_trusted_server.sql -5111, 1392_recipe_learning.sql -5112, 1394_optional_rule_sod_hp_mana_end.sql -5113, 1404_faction_list.sql -5114, 1410_optional_sod_aas_ht_and_loh.sql -5115, 1436_login_server_table_fix.sql -5116, 1446_allowrest_optional.sql -5117, 1446_allowrest_required.sql -5118, 1450_cvs.sql -5119, 1451_guilds.sql -5120, 1498_instance_adventure.sql -5121, 1510_global_instances.sql -5122, 1511_map_path_loading.sql -5123, 1513_zone_points.sql -5124, 1519_zone_primary_key_id.sql -5125, 1542_items_table_cleanup.sql -5126, 1548_nimbuseffect_required.sql -5127, 1562_instanced_spawnconditions.sql -5128, 1586_waypoints_optional.sql -5129, 1610_tradeskill_required.sql -5130, 1618_zone.sql -5131, 1625_optional_rule_class_race_exp_bonus.sql -5132, 1672_optional_rules_respawn_window.sql -5133, 1679_optional_rules_blocked_buffs.sql -5134, 1696_modify_zone_and_object_tables.sql -5135, 1711_account_restricted_aa.sql -5136, 1717_optional_rule_bash_stun_chance.sql -5137, 1718_optional_rules_mod3s.sql -5138, 1719_optional_triggerOnCastAAs.sql -5139, 1720_optional_sql_AAs.sql -5140, 1720_required_sql_AA_effects_update.sql -5141, 1721_optional_sql_drakkin_breath_update.sql -5142, 1721_required_sql_altadv_vars_update.sql -5143, 1723_optional_sql_new_stats_window_rule.sql -5144, 1723_required_sql_corruption.sql -5145, 1736_optional_sql_feral_swipe.sql -5146, 1737_required_sql_rule_and_aa_update.sql -5147, 1746_optional_sql_bot_manaregen.sql -5148, 1747_optional_HoT_zone_and_zonepoints.sql -5149, 1750_optional_sql_reflect_rule.sql -5150, 1753_optional_haste_cap_rule.sql -5151, 1753_required_sql_healing_adept_aa.sql -5152, 1754_required_sql_healing_adept_aa_fix.sql -5153, 1755_required_sql_fear_resist_aas.sql -5154, 1784_optional_corpsedrag_rules.sql -5155, 1786_required_update_to_aas.sql -5156, 1790_required_aa_required_level_cost.sql -5157, 1793_resist_adjust.sql -5158, 1799_optional_rest_regen_endurance_rule.sql -5159, 1802_required_doppelganger.sql -5160, 1803_required_tasks_xpreward_signed.sql -5161, 1804_required_ae_melee_updates.sql -5162, 1809_optional_rules.sql -5163, 1813_required_doppelganger_npcid_change.sql -5164, 1817_optional_npc_archery_bonus_rule.sql -5165, 1823_optional_delay_death.sql -5166, 1847_required_doors_dest_zone_size_32.sql -5167, 1859_optional_item_casts_use_focus_rule.sql -5168, 1884_optional_bot_spells_update.sql -5169, 1885_optional_rules_fv_pvp_expansions.sql -5170, 1889_optional_skill_cap_rule.sql -5171, 1908_required_npc_types_definitions.sql -5172, 1926_optional_stat_cap.sql -5173, 1944_spawn2.sql -5174, 1946_doors.sql -5175, 1960_optional_console_timeout_rule.sql -5176, 1962_optional_guild_creation_window_rules.sql -5177, 1963_optional_rule_live_like_focuses.sql -5178, 1968_optional_enrage_rules.sql -5179, 1972_optional_extradmg_item_cap.sql -5180, 1974_required_bot_spells_update.sql -5181, 1977_underwater.sql -5182, 1998_optional_intoxication_and_looting_rules.sql -5183, 2004_charges_alt_currency.sql -5184, 2015_optional_specialization_training_rule.sql -5185, 2016_optional_rule_bot_aa_expansion.sql -5186, 2023_optional_mysqlcli.sql -5187, 2024_optional_update_crystals.sql -5188, 2024_required_update.sql -5189, 2057_required_discovered_items.sql -5190, 2058_optional_rule_discovered_items.sql -5191, 2062_required_version_changes.sql -5192, 2069_required_pets.sql -5193, 2079_player_speech.sql -5194, 2087_required_bots_hp_and_mana_and_spell_updates.sql -5195, 2098_required_zonepoint_version_changes.sql -5196, 2099_required_discovered_items_account_status.sql -5197, 2104_required_group_roles.sql -5198, 2107_required_bot_stances.sql -5199, 2129_required_lfguild.sql -5200, 2133_required_faction_loot_despawn.sql -5201, 2136_extended_targets.sql -5202, 2142_emotes.sql -5203, 2154_optional_rule_spell_procs_resists_falloff.sql -5204, 2156_optional_charm_break_rule.sql -5205, 2159_optional_defensiveproc_rules.sql -5206, 2164_require_bots_bottimers.sql -5207, 2171_optional_SpecialAttackACBonus_rule.sql -5208, 2176_optional_aa_expansion_SOF_fix.sql -5209, 2176_optional_FrenzyBonus_rule.sql -5210, 2176_required_aa_updates.sql -5211, 2178_required_aa_updates.sql -5212, 2183_optional_bot_xp_rule.sql -5213, 2185_optional_NPCFlurryChacne_rule -5214, 2185_optional_NPCFlurryChacne_rule.sql -5215, 2185_optional_NPCFlurryChance_rule.sql -5216, 2185_required_aa_updates -5217, 2185_required_aa_updates.sql -5218, 2188_optional_miscspelleffect_rules -5219, 2188_optional_miscspelleffect_rules.sql -5220, 2188_required_aa_updates -5221, 2188_required_aa_updates.sql -5222, 2189_optional_taunt_rules -5223, 2189_optional_taunt_rules.sql -5224, 2195_required_sharedplatupdates.sql -5225, 2208_optional_aa_stacking_rule.sql -5226, 2208_optional_EnableSoulAbrasionAA.sql -5227, 2208_required_aa_updates.sql -5228, 2209_optional_additive_bonus_rule.sql -5229, 2213_loot_changes.sql -5230, 2214_faction_list_mod.sql -5231, 2215_required_aa_updates.sql -5232, 2243_optional_char_max_level_rule.sql -5233, 2260_probability.sql -5234, 2262_required_pet_discipline_update.sql -5235, 2264_required_aa_updates.sql -5236, 2268_QueryServ.sql -5237, 2268_required_updates.sql -5238, 2274_optional_rule_iplimitdisconnectall.sql -5239, 2278_optional_rule_targetableswarmpet.sql -5240, 2280_optional_rule_targetableswarmpet-rename.sql -5241, 2283_required_npc_changes.sql -5242, 2299_required_inspectmessage_fields.sql -5243, 2300_optional_loot_changes.sql -5244, 2304_QueryServ.sql -5245, 2340_required_maxbuffslotspet.sql -5246, 2361_QueryServ.sql -5247, 2361_required_qs_rule_values.sql -5248, 2370_required_aa_updates.sql -5249, 2376_required_aa_updates.sql -5250, 2380_optional_merc_data.sql -5251, 2380_optional_merc_merchant_npctypes_update.sql -5252, 2380_optional_merc_rules.sql -5253, 2383_required_group_ismerc.sql -5254, 2428_optional_levelbasedexpmods.sql -5255, 2448_optional_stun_proc_aggro_rule.sql -5256, 2471_required_aa_updates.sql -5257, 2482_required_start_zones.sql -5258, 2504_required_aa_updates.sql -9000, 2013_02_18_Merc_Rules_and_Tables.sql -9001, 2013_02_25_Impr_HT_LT.sql -9002, 2013_03_1_Merc_Rules_and_Equipment.sql -9003, 2013_03_23_Escape_FadingMemories.sql -9004, 2013_04_04_NaturesBounty.sql -9005, 2013_04_08_Salvage.sql -9006, 2013_05_05_Account_Flags.sql -9007, 2013_05_05_Item_Tick.sql -9008, 2013_07_11_NPC_Special_Abilities.sql -9009, 2013_10_12_Merc_Special_Abilities.sql -9010, 2013_10_12_Merc_vwMercNpcTypes.sql -9011, 2013_10_31_Recipe_disabling.sql -9012, 2013_11_07_BaseData.sql -9013, 2013_11_13_Instrument_Singing_Mastery.sql -9014, 2013_11_18_AssistRadius.sql -9015, 2013_12_26_MerchantList_Class_Required.sql -9016, 2014_01_04_SongModCapAAs.sql -9017, 2014_01_08_SpellsNewAdditions.sql -9018, 2014_01_09_PreservePetSize.sql -9019, 2014_01_20_MezMastery.sql -9020, 2014_01_20_Not_Extendable.sql -9021, 2014_01_20_SpellCastingReinforcement.sql -9022, 2014_01_20_Weather.sql -9023, 2014_01_27_CritcalMendAA.sql -9024, 2014_02_02_SpellCriticalsAA.sql -9025, 2014_02_13_Rename_instance_lockout_tables.sql -9026, 2014_02_13_spells_new_update.sql -9027, 2014_02_20_buff_update.sql -9028, 2014_02_26_roambox_update.sql -9029, 2014_02_26_virulentvenomAA.sql -9030, 2014_04_04_PhysicalResist.sql -9031, 2014_04_10_No_Target_With_Hotkey.sql -9032, 2014_04_12_SlowMitigation.sql -9033, 2014_04_18_Suppress_Command_Error.sql -9034, 2014_04_25_spawn_events.sql -9035, 2014_04_27_AISpellEffects.sql -9036, 2014_05_04_SlowMitigationFix.sql -9038, 2014_06_25_AA_Updates.sql -9039, 2014_07_04_AA_Updates.sql -9040, 2014_07_10_npc_spells.sql -9041, 2014_08_02_spells_new.sql -9042, 2014_08_12_NPC_raid_targets.sql -9043, 2014_08_18_spells_new_update.sql -9044, 2014_08_20_merchantlist_probability.sql -9045, 2014_08_23_Complete_QueryServ_Table_Structures.sql -9046, 2014_08_23_player_events_and_player_aa_rate_hourly.sql -9047, 2014_08_24_character_lookup.sql -9048, 2014_09_09_attack_delay.sql -9049, 2014_09_18_tellqueuesclean.sql -9050, 2014_09_20_ban_messages.sql -9051, 2014_10_11_RaidMOTD.sql -9052, 2014_10_13_RaidLeadership.sql -9053, 2014_10_18_group_mentor.sql -9054, 2014_10_19_raid_group_mentor.sql -9055, 2014_10_30_special_abilities_null.sql -9056, 2014_11_08_RaidMembers.sql -9057, 2014_11_13_spells_new_updates.sql \ No newline at end of file +5001|1_task_system.sql +5002|2_optional_maxclients.sql +5003|14_optional_merchantlist.sql +5004|35_task_stepped.sql +5005|42_task_min_maxlevel.sql +5006|55_zone_shutdowndeleay.sql +5007|68_optional_character_maxexplevel.sql +5008|103_optional_chat_rules.sql +5009|104_traps.sql +5010|106_optional_proc_rules.sql +5011|120_damageshieldtypes.sql +5012|125_aggrozone.sql +5013|127_optional_spell_rules.sql +5014|129_optional_shared_plat_rule.sql +5015|131_optional_combat_rules.sql +5016|133_task_repeatable.sql +5017|142_deathpeace_and_lifetap_aas.sql +5018|158_optional_death_exp_loss.sql +5019|176_melody.sql +5020|189_character_.sql +5021|196_trader.sql +5022|210_undyeme.sql +5023|222_buyer.sql +5024|226_account_limiting.sql +5025|230_spells_table.sql +5026|235_horses_table.sql +5027|243_spawn_timers.sql +5028|247_mail.sql +5029|249_chatchannels.sql +5030|250_bot_spell_update.sql +5031|250_optional_bot_spell_update.sql +5032|285_optional_bot_spell_update.sql +5033|292_augslots.sql +5034|294_merchant_logging.sql +5035|304_faction_list.sql +5036|326_aas.sql +5037|328_bot_management.sql +5038|328_optional_bot_management.sql +5039|340_gm_ips.sql +5040|356_combat.sql +5041|360_peqzone.sql +5042|364_ranged_dist_rule.sql +5043|386_bot_save_raid.sql +5044|434_optional_rest_state_rules.sql +5045|447_sof_startzone_rule.sql +5046|463_altadv_vars.sql +5047|475_aa_actions.sql +5048|500_spawn2_optimization.sql +5049|503_bugs.sql +5050|518_drakkin_npc_type_features.sql +5051|524_rule_values_notes.sql +5052|527_npc_armor_tint.sql +5053|553_saylink_table.sql +5054|564_nokeyring.sql +5055|600_group_leadership.sql +5056|612_instance_changes.sql +5057|615_adventure_assassination.sql +5058|619_Adventure_Recruiter_Flavor.sql +5059|621_LDoNTraps.sql +5060|633_ucs.sql +5061|634_TrapTemplateDefaultValue.sql +5062|643_BotsTable.sql +5063|646_archery_penalty_rule.sql +5064|665_heroic_resists.sql +5065|667_titles.sql +5066|687_aa_table_changes.sql +5067|699_peqzone_rule.sql +5068|702_aashieldblock_tint_table.sql +5069|703_peqzone_rule.sql +5070|704_rules.sql +5071|710_tint_set_naming.sql +5072|721_pathing_rules.sql +5073|730_smart_delay_moving.sql +5074|731_rule_assist_notarget_self.sql +5075|732_sacrifice_rules.sql +5076|745_slow_mitigation.sql +5077|754_archery_base_damage_rule.sql +5078|755_sof_altadv_vars_updates.sql +5079|773_monk_rules.sql +5080|853_optional_rule_aaexp.sql +5081|858_optional_rule_ip_limit_by_status.sql +5082|892_optional_bots_table_mod.sql +5083|893_optional_bots_table_mod.sql +5084|898_npc_maxlevel_scalerate.sql +5085|902_optional_rule_snareflee.sql +5086|923_spawn2_enabled.sql +5087|962_hot_zone.sql +5088|964_reports.sql +5089|971_veteran_rewards.sql +5090|977_raid_npc_private_corpses.sql +5091|979_unique_spawn_by_name.sql +5092|980_account_ip.sql +5093|1022_botadventuring.sql +5094|1027_botactives.sql +5095|1030_botzoningsupport.sql +5096|1036_botbuffs.sql +5097|1038_botpetstatepersists.sql +5098|1038_grouptablesuniquecolumndefinitions.sql +5099|1039_botguilds.sql +5100|1040_DeprecatedBotRaidsSystems.sql +5101|1057_titles.sql +5102|1077_botgroups.sql +5103|1136_spell_globals.sql +5104|1144_optional_rule_return_nodrop.sql +5105|1195_account_suspendeduntil.sql +5106|1259_npc_skill_types.sql +5107|1280_bot_augs.sql +5108|1290_optional_exp_loss_rule.sql +5109|1293_guild_bank.sql +5110|1379_loginserver_trusted_server.sql +5111|1392_recipe_learning.sql +5112|1394_optional_rule_sod_hp_mana_end.sql +5113|1404_faction_list.sql +5114|1410_optional_sod_aas_ht_and_loh.sql +5115|1436_login_server_table_fix.sql +5116|1446_allowrest_optional.sql +5117|1446_allowrest_required.sql +5118|1450_cvs.sql +5119|1451_guilds.sql +5120|1498_instance_adventure.sql +5121|1510_global_instances.sql +5122|1511_map_path_loading.sql +5123|1513_zone_points.sql +5124|1519_zone_primary_key_id.sql +5125|1542_items_table_cleanup.sql +5126|1548_nimbuseffect_required.sql +5127|1562_instanced_spawnconditions.sql +5128|1586_waypoints_optional.sql +5129|1610_tradeskill_required.sql +5130|1618_zone.sql +5131|1625_optional_rule_class_race_exp_bonus.sql +5132|1672_optional_rules_respawn_window.sql +5133|1679_optional_rules_blocked_buffs.sql +5134|1696_modify_zone_and_object_tables.sql +5135|1711_account_restricted_aa.sql +5136|1717_optional_rule_bash_stun_chance.sql +5137|1718_optional_rules_mod3s.sql +5138|1719_optional_triggerOnCastAAs.sql +5139|1720_optional_sql_AAs.sql +5140|1720_required_sql_AA_effects_update.sql +5141|1721_optional_sql_drakkin_breath_update.sql +5142|1721_required_sql_altadv_vars_update.sql +5143|1723_optional_sql_new_stats_window_rule.sql +5144|1723_required_sql_corruption.sql +5145|1736_optional_sql_feral_swipe.sql +5146|1737_required_sql_rule_and_aa_update.sql +5147|1746_optional_sql_bot_manaregen.sql +5148|1747_optional_HoT_zone_and_zonepoints.sql +5149|1750_optional_sql_reflect_rule.sql +5150|1753_optional_haste_cap_rule.sql +5151|1753_required_sql_healing_adept_aa.sql +5152|1754_required_sql_healing_adept_aa_fix.sql +5153|1755_required_sql_fear_resist_aas.sql +5154|1784_optional_corpsedrag_rules.sql +5155|1786_required_update_to_aas.sql +5156|1790_required_aa_required_level_cost.sql +5157|1793_resist_adjust.sql +5158|1799_optional_rest_regen_endurance_rule.sql +5159|1802_required_doppelganger.sql +5160|1803_required_tasks_xpreward_signed.sql +5161|1804_required_ae_melee_updates.sql +5162|1809_optional_rules.sql +5163|1813_required_doppelganger_npcid_change.sql +5164|1817_optional_npc_archery_bonus_rule.sql +5165|1823_optional_delay_death.sql +5166|1847_required_doors_dest_zone_size_32.sql +5167|1859_optional_item_casts_use_focus_rule.sql +5168|1884_optional_bot_spells_update.sql +5169|1885_optional_rules_fv_pvp_expansions.sql +5170|1889_optional_skill_cap_rule.sql +5171|1908_required_npc_types_definitions.sql +5172|1926_optional_stat_cap.sql +5173|1944_spawn2.sql +5174|1946_doors.sql +5175|1960_optional_console_timeout_rule.sql +5176|1962_optional_guild_creation_window_rules.sql +5177|1963_optional_rule_live_like_focuses.sql +5178|1968_optional_enrage_rules.sql +5179|1972_optional_extradmg_item_cap.sql +5180|1974_required_bot_spells_update.sql +5181|1977_underwater.sql +5182|1998_optional_intoxication_and_looting_rules.sql +5183|2004_charges_alt_currency.sql +5184|2015_optional_specialization_training_rule.sql +5185|2016_optional_rule_bot_aa_expansion.sql +5186|2023_optional_mysqlcli.sql +5187|2024_optional_update_crystals.sql +5188|2024_required_update.sql +5189|2057_required_discovered_items.sql +5190|2058_optional_rule_discovered_items.sql +5191|2062_required_version_changes.sql +5192|2069_required_pets.sql +5193|2079_player_speech.sql +5194|2087_required_bots_hp_and_mana_and_spell_updates.sql +5195|2098_required_zonepoint_version_changes.sql +5196|2099_required_discovered_items_account_status.sql +5197|2104_required_group_roles.sql +5198|2107_required_bot_stances.sql +5199|2129_required_lfguild.sql +5200|2133_required_faction_loot_despawn.sql +5201|2136_extended_targets.sql +5202|2142_emotes.sql +5203|2154_optional_rule_spell_procs_resists_falloff.sql +5204|2156_optional_charm_break_rule.sql +5205|2159_optional_defensiveproc_rules.sql +5206|2164_require_bots_bottimers.sql +5207|2171_optional_SpecialAttackACBonus_rule.sql +5208|2176_optional_aa_expansion_SOF_fix.sql +5209|2176_optional_FrenzyBonus_rule.sql +5210|2176_required_aa_updates.sql +5211|2178_required_aa_updates.sql +5212|2183_optional_bot_xp_rule.sql +5213|2185_optional_NPCFlurryChacne_rule +5214|2185_optional_NPCFlurryChacne_rule.sql +5215|2185_optional_NPCFlurryChance_rule.sql +5216|2185_required_aa_updates +5217|2185_required_aa_updates.sql +5218|2188_optional_miscspelleffect_rules +5219|2188_optional_miscspelleffect_rules.sql +5220|2188_required_aa_updates +5221|2188_required_aa_updates.sql +5222|2189_optional_taunt_rules +5223|2189_optional_taunt_rules.sql +5224|2195_required_sharedplatupdates.sql +5225|2208_optional_aa_stacking_rule.sql +5226|2208_optional_EnableSoulAbrasionAA.sql +5227|2208_required_aa_updates.sql +5228|2209_optional_additive_bonus_rule.sql +5229|2213_loot_changes.sql +5230|2214_faction_list_mod.sql +5231|2215_required_aa_updates.sql +5232|2243_optional_char_max_level_rule.sql +5233|2260_probability.sql +5234|2262_required_pet_discipline_update.sql +5235|2264_required_aa_updates.sql +5236|2268_QueryServ.sql +5237|2268_required_updates.sql +5238|2274_optional_rule_iplimitdisconnectall.sql +5239|2278_optional_rule_targetableswarmpet.sql +5240|2280_optional_rule_targetableswarmpet-rename.sql +5241|2283_required_npc_changes.sql +5242|2299_required_inspectmessage_fields.sql +5243|2300_optional_loot_changes.sql +5244|2304_QueryServ.sql +5245|2340_required_maxbuffslotspet.sql +5246|2361_QueryServ.sql +5247|2361_required_qs_rule_values.sql +5248|2370_required_aa_updates.sql +5249|2376_required_aa_updates.sql +5250|2380_optional_merc_data.sql +5251|2380_optional_merc_merchant_npctypes_update.sql +5252|2380_optional_merc_rules.sql +5253|2383_required_group_ismerc.sql +5254|2428_optional_levelbasedexpmods.sql +5255|2448_optional_stun_proc_aggro_rule.sql +5256|2471_required_aa_updates.sql +5257|2482_required_start_zones.sql +5258|2504_required_aa_updates.sql +9000|2013_02_18_Merc_Rules_and_Tables.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE '%Mercs:ResurrectRadius%'|empty| +9001|2013_02_25_Impr_HT_LT.sql|SHOW TABLES LIKE 'merc_inventory'|empty| +9002|2013_03_1_Merc_Rules_and_Equipment.sql|SHOW TABLES LIKE 'merc_inventory'|empty| +# 9003|2013_03_23_Escape_FadingMemories.sql +9004|2013_04_04_NaturesBounty.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '1230' AND `slot` = '1' AND `effectid` = '313' AND `base1` = '15' AND `base2` = '0'|empty| +9005|2013_04_08_Salvage.sql|SHOW COLUMNS FROM `tradeskill_recipe_entries` LIKE 'salvagecount'|empty| +9006|2013_05_05_Account_Flags.sql|SHOW TABLES LIKE 'account_flags'|empty| +9007|2013_05_05_Item_Tick.sql|SHOW TABLES LIKE 'item_tick'|empty| +9008|2013_07_11_NPC_Special_Abilities.sql|SHOW COLUMNS FROM `npc_types` LIKE 'special_abilities'|empty| +9009|2013_10_12_Merc_Special_Abilities.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'special_abilities'|empty| +# 9010|2013_10_12_Merc_vwMercNpcTypes.sql +9011|2013_10_31_Recipe_disabling.sql|SHOW COLUMNS FROM `tradeskill_recipe` LIKE 'enabled'|empty| +9012|2013_11_07_BaseData.sql|SHOW TABLES LIKE 'base_data'|empty| +9013|2013_11_13_Instrument_Singing_Mastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '213' AND `slot` = '1' AND `effectid` = '260' AND `base1` = '2' AND `base2` = '23'|empty| +9014|2013_11_18_AssistRadius.sql|SHOW COLUMNS FROM `npc_types` LIKE 'assistradius'|empty| +9015|2013_12_26_MerchantList_Class_Required.sql|SHOW COLUMNS FROM `merchantlist` LIKE 'classes_required'|empty| +9016|2014_01_04_SongModCapAAs.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '571' AND `slot` = '1' AND `effectid` = '261'|empty| +9017|2014_01_08_SpellsNewAdditions.sql|SHOW COLUMNS FROM `spells_new` LIKE 'persistdeath'|empty| +9018|2014_01_09_PreservePetSize.sql|SHOW COLUMNS FROM `character_pet_info` LIKE 'size'|empty| +9019|2014_01_20_MezMastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '781' AND `slot` = '1' AND `effectid` = '287'|empty| +9020|2014_01_20_Not_Extendable.sql|SHOW COLUMNS FROM `spells_new` LIKE 'not_extendable'|empty| +9021|2014_01_20_SpellCastingReinforcement.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '86' AND `slot` = '1' AND `effectid` = '128'|empty| +9022|2014_01_20_Weather.sql|SHOW COLUMNS FROM `zone` LIKE 'rain_chance1'|empty| +9023|2014_01_27_CritcalMendAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '230' AND `slot` = '1' AND `effectid` = '275'|empty +9024|2014_02_02_SpellCriticalsAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '4755' AND `slot` = '1' AND `effectid` = '294'|empty +9025|2014_02_13_Rename_instance_lockout_tables.sql|SHOW TABLES LIKE 'instance_list'|empty| +9026|2014_02_13_spells_new_update.sql|SHOW COLUMNS FROM `spells_new` LIKE 'ConeStartAngle'|empty| +9027|2014_02_20_buff_update.sql|SHOW COLUMNS FROM `character_buffs` LIKE 'caston_y'|empty| +9028|2014_02_26_roambox_update.sql|SHOW COLUMNS FROM `spawngroup` LIKE 'mindelay'|empty| +9029|2014_02_26_virulentvenomAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '888' AND `slot` = '1' AND `effectid` = '250'|empty| +9030|2014_04_04_PhysicalResist.sql|SHOW COLUMNS FROM `npc_types` LIKE 'PhR'|empty| +9031|2014_04_10_No_Target_With_Hotkey.sql|SHOW COLUMNS FROM `npc_types` LIKE 'no_target_hotkey'|empty| +9032|2014_04_12_SlowMitigation.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float +9034|2014_04_25_spawn_events.sql|SHOW COLUMNS FROM `spawn_events` LIKE 'strict'|empty| +9035|2014_04_27_AISpellEffects.sql|SHOW COLUMNS FROM `npc_types` LIKE 'npc_spells_effects_id'|empty| +9036|2014_05_04_SlowMitigationFix.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|empty| +9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty +9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty +9040|2014_07_10_npc_spells.sql|SHOW COLUMNS FROM `npc_spells` LIKE 'engaged_no_sp_recast_min'|empty| +9041|2014_08_02_spells_new.sql|SHOW COLUMNS FROM `spells_new` LIKE 'viral_range'|empty| +9042|2014_08_12_NPC_raid_targets.sql|SHOW COLUMNS FROM `npc_types` LIKE 'raid_target'|empty| +9043|2014_08_18_spells_new_update.sql|SHOW COLUMNS FROM `spells_new` LIKE 'viral_targets'|empty| +9044|2014_08_20_merchantlist_probability.sql|SHOW COLUMNS FROM `merchantlist` LIKE 'probability'|empty| +9045|2014_08_23_Complete_QueryServ_Table_Structures.sql|SHOW TABLES LIKE 'qs_player_aa_rate_hourly'|empty| +9046|2014_08_23_player_events_and_player_aa_rate_hourly.sql|SHOW TABLES LIKE 'qs_player_events'|empty| +9048|2014_09_09_attack_delay.sql|SHOW COLUMNS FROM `npc_types` LIKE 'attack_delay'|empty| +9050|2014_09_20_ban_messages.sql|SHOW COLUMNS FROM `account` LIKE 'ban_reason'|empty| +9051|2014_10_11_RaidMOTD.sql|SHOW COLUMNS FROM `raid_details` LIKE 'motd'|empty| +9052|2014_10_13_RaidLeadership.sql|SHOW TABLES LIKE 'raid_leaders'|empty| +9053|2014_10_18_group_mentor.sql|SHOW COLUMNS FROM `group_leaders` LIKE 'mentoree'|empty| +9054|2014_10_19_raid_group_mentor.sql|SHOW COLUMNS FROM `raid_leaders` LIKE 'mentoree'|empty| +9055|2014_10_30_special_abilities_null.sql|SHOW COLUMNS FROM `npc_types` LIKE 'special_abilities'|contains|NO +9056|2014_11_08_RaidMembers.sql|SHOW COLUMNS FROM `raid_members` LIKE 'groupid'|missing|unsigned +9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| + +# Upgrade conditions: +# This won't be needed after this system is implemented, but it is used database that are not +# yet using the versioning system to figure out where the database is schema wise to determine +# which updates are necessary to run +# +# Example: Version|Filename.sql|Query_to_Check_Condition_For_Needed_Update|match type|text to match +# 0 = Database Version +# 1 = Filename.sql +# 2 = Query_to_Check_Condition_For_Needed_Update +# 3 = Match Type - If condition from match type to Value 4 is true, update will flag for needing to be ran +# contains = If query results contains text from 4th value +# match = If query results matches text from 4th value +# missing = If query result is missing text from 4th value +# empty = If the query results in no results +# not_empty = If the query is not empty +# 4 = Text to match +# +# \ No newline at end of file From bd48efcdd50a698ad540368491c05d4a951879cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 05:31:19 -0600 Subject: [PATCH 0267/1883] db_update.pl changes --- utils/scripts/db_update.pl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index e1c03f871..33a493cd1 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -20,9 +20,9 @@ while() { elsif(/(.*)<\/db>/i) { $db = $1; } } -print " -============================================================ -# EQEmu: Automatic Database Upgrade Check # +print +"============================================================ + EQEmu: Automatic Database Upgrade Check ============================================================ "; @@ -89,15 +89,19 @@ if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){ @db_version = split(': ', `world db_version`); $bin_db_ver = trim($db_version[1]); $local_db_ver = trim(GetMySQLResult("SELECT `version` FROM `db_version` LIMIT 1")); -print "Binary Database Version is: (" . $bin_db_ver . ")\n"; -print "Local Database Version is: (" . $local_db_ver . ")\n\n"; +print " Binary Database Version: (" . $bin_db_ver . ")\n"; +print " Local Database Version: (" . $local_db_ver . ")\n\n"; #::: If World ran this script, and our version is up to date, continue... -if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ exit; } +if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ + print " Database up to Date: Continuing World Bootup...\n"; + print "============================================================\n"; + exit; +} print "Retrieving latest database manifest...\n"; -GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); -# GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); +#GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); +GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); if($local_db_ver < $bin_db_ver){ print "You have missing database updates, type 1 or 2 to backup your database before running them as recommended...\n\n"; @@ -248,6 +252,7 @@ sub Run_Database_Check{ $file_name = trim($m_d{$val}[1]); print "Running Update: " . $val . " - " . $file_name . "\n"; print GetMySQLResultFromFile("db_update/$file_name"); + print GetMySQLResult("UPDATE `db_version` SET `version` = $val"); } return; } @@ -351,4 +356,6 @@ sub print_match_debug{ sub print_break{ if(!$debug){ return; } print "\n==============================================\n"; -} \ No newline at end of file +} + +if($ARGV[0] eq "ran_from_world"){ print "Continuing World Bootup...\n"; } \ No newline at end of file From 650aa566b08812ef4ce4ee0ae85344a6e35097b6 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 16 Nov 2014 09:37:26 -0500 Subject: [PATCH 0268/1883] Fix for perl CastSpell function so it will use a spells innate resist diff settings if no override value is put in the function. Due to recent changes in how we defined that variable it would set it to 0 resist diff by default when called from perl. --- zone/perl_mob.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 17ac9c3ac..af63066ff 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -3971,7 +3971,10 @@ XS(XS_Mob_CastSpell) resist_adjust = (int16)SvIV(ST(6)); } - THIS->CastSpell(spell_id, target_id, slot, casttime, mana_cost, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, &resist_adjust); + if (resist_adjust == 0)//If you do not pass resist adjust as nullptr it will ignore the spells default resist adjust + THIS->CastSpell(spell_id, target_id, slot, casttime, mana_cost, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0); + else + THIS->CastSpell(spell_id, target_id, slot, casttime, mana_cost, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0, &resist_adjust); } XSRETURN_EMPTY; } From e11fa4a27852aae67ec71f536e91ea75e8f9c07a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 16 Nov 2014 17:42:15 -0500 Subject: [PATCH 0269/1883] Fix issue with ControlBoat_Struct and OP_BoardBoat --- changelog.txt | 3 +++ common/eq_packet_structs.h | 2 +- zone/client_packet.cpp | 22 +++++++++++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index bc14b4af4..dbfc0c0cc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/16/2014 == +demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat + == 11/15/2014 == Uleat(Natedog): A better fix for OP_ShopPlayerBuy - doesn't cause the issues that I introduced diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 8e72ccaa8..c49283f18 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -4383,7 +4383,7 @@ typedef struct { struct ControlBoat_Struct { /*000*/ uint32 boatId; // entitylist id of the boat /*004*/ bool TakeControl; // 01 if taking control, 00 if releasing it -/*007*/ // no idea what these last three bytes represent +/*007*/ char unknown[3]; // no idea what these last three bytes represent }; struct AugmentInfo_Struct diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3cd0bb157..0e35db1fa 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3842,19 +3842,23 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) { - - if (app->size <= 5) + // this sends unclean mob name, so capped at 64 + // a_boat006 + if (app->size <= 5 || app->size > 64) { + LogFile->write(EQEMuLog::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + DumpPacket(app); return; + } - char *boatname; - boatname = new char[app->size - 3]; - memset(boatname, 0, app->size - 3); - memcpy(boatname, app->pBuffer, app->size - 4); + char boatname[64]; + memcpy(boatname, app->pBuffer, app->size); + boatname[63] = '\0'; Mob* boat = entity_list.GetMob(boatname); - if (boat) - this->BoatID = boat->GetID(); // set the client's BoatID to show that it's on this boat - safe_delete_array(boatname); + if (!boat || (boat->GetRace() != CONTROLLED_BOAT && boat->GetRace() != 502)) + return; + BoatID = boat->GetID(); // set the client's BoatID to show that it's on this boat + return; } From eee65b8c22d7db144f1943f624af699ed0c32819 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 17:48:50 -0600 Subject: [PATCH 0270/1883] Special Abilities column fix for older updates and newer database engines for the automatic database updater. db_update.pl changes Manifest update --- utils/scripts/db_update.pl | 10 +++++++--- utils/sql/db_update_manifest.txt | 2 +- .../git/required/2013_07_11_NPC_Special_Abilities.sql | 1 + .../git/required/2013_10_12_Merc_Special_Abilities.sql | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 33a493cd1..5b8b44712 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -77,6 +77,11 @@ mkdir('db_update'); # print `"$path" --user $user --password="$pass" $db < db_update/db_update_run_file.txt`; #::: Check if db_version table exists... +if(trim(GetMySQLResult("SHOW COLUMNS FROM `db_version` LIKE 'Revision'")) ne ""){ + print GetMySQLResult("DROP TABLE db_version"); + print "Old `db_version` table present, dropping...\n\n"; +} + if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){ print GetMySQLResult(" CREATE TABLE `db_version` ( @@ -253,7 +258,8 @@ sub Run_Database_Check{ print "Running Update: " . $val . " - " . $file_name . "\n"; print GetMySQLResultFromFile("db_update/$file_name"); print GetMySQLResult("UPDATE `db_version` SET `version` = $val"); - } + } + print "Continuing World Bootup...\n"; return; } @@ -357,5 +363,3 @@ sub print_break{ if(!$debug){ return; } print "\n==============================================\n"; } - -if($ARGV[0] eq "ran_from_world"){ print "Continuing World Bootup...\n"; } \ No newline at end of file diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 405394a39..1310e0753 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -291,7 +291,7 @@ 9032|2014_04_12_SlowMitigation.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float 9034|2014_04_25_spawn_events.sql|SHOW COLUMNS FROM `spawn_events` LIKE 'strict'|empty| 9035|2014_04_27_AISpellEffects.sql|SHOW COLUMNS FROM `npc_types` LIKE 'npc_spells_effects_id'|empty| -9036|2014_05_04_SlowMitigationFix.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|empty| +9036|2014_05_04_SlowMitigationFix.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float 9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty 9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty 9040|2014_07_10_npc_spells.sql|SHOW COLUMNS FROM `npc_spells` LIKE 'engaged_no_sp_recast_min'|empty| diff --git a/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql b/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql index dfcdfd552..79e322401 100644 --- a/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql +++ b/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql @@ -1,4 +1,5 @@ ALTER TABLE `npc_types` ADD COLUMN `special_abilities` TEXT NOT NULL DEFAULT '' AFTER `npcspecialattks`; +ALTER TABLE `npc_types` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; UPDATE npc_types SET special_abilities = CONCAT(special_abilities, "1,1^") WHERE npcspecialattks LIKE BINARY '%S%'; UPDATE npc_types SET special_abilities = CONCAT(special_abilities, "2,1^") WHERE npcspecialattks LIKE BINARY '%E%'; diff --git a/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql b/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql index 740bf7517..46fbb1012 100644 --- a/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql +++ b/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql @@ -1,4 +1,5 @@ ALTER TABLE `merc_stats` ADD COLUMN `special_abilities` TEXT NOT NULL DEFAULT '' AFTER `specialattks`; +ALTER TABLE `merc_stats` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; UPDATE merc_stats SET special_abilities = CONCAT(special_abilities, "1,1^") WHERE specialattks LIKE BINARY '%S%'; UPDATE merc_stats SET special_abilities = CONCAT(special_abilities, "2,1^") WHERE specialattks LIKE BINARY '%E%'; From 2e8d7b09afda81e150dd6d1325c6d185936ced61 Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 16 Nov 2014 19:04:15 -0500 Subject: [PATCH 0271/1883] Temp merchant items could duplicate slots also... --- zone/zone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 62f3c1e8a..7a4ad8bac 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -400,7 +400,7 @@ void Zone::LoadTempMerchantData() { LogFile->write(EQEMuLog::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " - "ml.npcid, " + "DISTINCT ml.npcid, " "ml.slot, " "ml.charges, " "ml.itemid " From 071367b6a9ba5b75a958a897c7bdd3e3e24da7d8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 18:17:04 -0600 Subject: [PATCH 0272/1883] db_update.pl update db_update_manifest.txt update 2014_09_20_ban_messages.sql fix for non PEQ account tables missing expansion column --- utils/scripts/db_update.pl | 2 +- utils/sql/db_update_manifest.txt | 1 + utils/sql/git/required/2014_09_20_ban_messages.sql | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 5b8b44712..d2462530a 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -257,7 +257,7 @@ sub Run_Database_Check{ $file_name = trim($m_d{$val}[1]); print "Running Update: " . $val . " - " . $file_name . "\n"; print GetMySQLResultFromFile("db_update/$file_name"); - print GetMySQLResult("UPDATE `db_version` SET `version` = $val"); + print GetMySQLResult("UPDATE `db_version` SET `version` = $val WHERE `version` < $val"); } print "Continuing World Bootup...\n"; return; diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 1310e0753..44983d532 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -256,6 +256,7 @@ 5256|2471_required_aa_updates.sql 5257|2482_required_start_zones.sql 5258|2504_required_aa_updates.sql +8000|mercs.sql|SHOW TABLES LIKE 'merc_stats'|empty| 9000|2013_02_18_Merc_Rules_and_Tables.sql|SELECT * FROM `rule_values` WHERE `rule_name` LIKE '%Mercs:ResurrectRadius%'|empty| 9001|2013_02_25_Impr_HT_LT.sql|SHOW TABLES LIKE 'merc_inventory'|empty| 9002|2013_03_1_Merc_Rules_and_Equipment.sql|SHOW TABLES LIKE 'merc_inventory'|empty| diff --git a/utils/sql/git/required/2014_09_20_ban_messages.sql b/utils/sql/git/required/2014_09_20_ban_messages.sql index 4612f9962..229f08776 100644 --- a/utils/sql/git/required/2014_09_20_ban_messages.sql +++ b/utils/sql/git/required/2014_09_20_ban_messages.sql @@ -1 +1 @@ -ALTER TABLE `account` ADD COLUMN `ban_reason` TEXT NULL DEFAULT NULL AFTER `expansion`, ADD COLUMN `suspend_reason` TEXT NULL DEFAULT NULL AFTER `ban_reason`; +ALTER TABLE `account` ADD COLUMN `ban_reason` TEXT NULL DEFAULT NULL, ADD COLUMN `suspend_reason` TEXT NULL DEFAULT NULL AFTER `ban_reason`; From e3e63efd6853ec7ae8d12692118a0642c401fef0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 18:32:13 -0600 Subject: [PATCH 0273/1883] SQL Source update fixes for newer DB versions --- utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql | 2 +- utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql b/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql index 79e322401..e93989777 100644 --- a/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql +++ b/utils/sql/git/required/2013_07_11_NPC_Special_Abilities.sql @@ -1,4 +1,4 @@ -ALTER TABLE `npc_types` ADD COLUMN `special_abilities` TEXT NOT NULL DEFAULT '' AFTER `npcspecialattks`; +ALTER TABLE `npc_types` ADD COLUMN `special_abilities` TEXT NULL AFTER `npcspecialattks`; ALTER TABLE `npc_types` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; UPDATE npc_types SET special_abilities = CONCAT(special_abilities, "1,1^") WHERE npcspecialattks LIKE BINARY '%S%'; diff --git a/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql b/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql index 46fbb1012..cf63625da 100644 --- a/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql +++ b/utils/sql/git/required/2013_10_12_Merc_Special_Abilities.sql @@ -1,6 +1,6 @@ -ALTER TABLE `merc_stats` ADD COLUMN `special_abilities` TEXT NOT NULL DEFAULT '' AFTER `specialattks`; +ALTER TABLE `merc_stats` ADD COLUMN `special_abilities` TEXT NULL AFTER `specialattks`; ALTER TABLE `merc_stats` MODIFY COLUMN `special_abilities` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL; - + UPDATE merc_stats SET special_abilities = CONCAT(special_abilities, "1,1^") WHERE specialattks LIKE BINARY '%S%'; UPDATE merc_stats SET special_abilities = CONCAT(special_abilities, "2,1^") WHERE specialattks LIKE BINARY '%E%'; UPDATE merc_stats SET special_abilities = CONCAT(special_abilities, "3,1^") WHERE specialattks LIKE BINARY '%R%'; From 9324bdf10767c4a530fcc4b441efbd93f17d6c83 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 19:04:33 -0600 Subject: [PATCH 0274/1883] db_update.pl update --- utils/scripts/db_update.pl | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index d2462530a..37798e1eb 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -108,11 +108,17 @@ print "Retrieving latest database manifest...\n"; #GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); -if($local_db_ver < $bin_db_ver){ +if($local_db_ver < $bin_db_ver && $ARGV[0] eq "ran_from_world"){ print "You have missing database updates, type 1 or 2 to backup your database before running them as recommended...\n\n"; #::: Display Menu ShowMenuPrompt(); } +else{ + #::: Most likely ran standalone + print "\n"; + ShowMenuPrompt(); +} + sub ShowMenuPrompt { my %dispatch = ( @@ -152,14 +158,16 @@ sub MenuOptions { $option[3] = "Run pending updates... (" . scalar (@total_updates) . ")"; } else{ - $option[3] = "Check for pending Database updates - Stages updates for automatic upgrade..."; + $option[3] = "Check for pending Database updates + Stages updates for automatic upgrade..."; } return < $local_db_ver; $i--){ + for($i = $bin_db_ver; $i > 1000; $i--){ if(!defined($m_d{$i}[0])){ next; } $file_name = trim($m_d{$i}[1]); From 251d4fa3e397dd8faf491a94e7aaa32fb1f7a5ef Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 19:26:59 -0600 Subject: [PATCH 0275/1883] Implemented Automatic Database update and versioning system Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057 - This revision define will need to be incremented each time a database update is made - Along with a revision define increment, you will need to update the db_update manifest located in: - https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt - An entry needs to be made at the bottom of the manifest, the entry is quite simple - Example: 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| - This latest example is checking to see if the spells_new table contains the column 'disallow_sit', if its empty, the update needs to be ran - More examples of match types below: # Example: Version|Filename.sql|Query_to_Check_Condition_For_Needed_Update|match type|text to match # 0 = Database Version # 1 = Filename.sql # 2 = Query_to_Check_Condition_For_Needed_Update # 3 = Match Type - If condition from match type to Value 4 is true, update will flag for needing to be ran # contains = If query results contains text from 4th value # match = If query results matches text from 4th value # missing = If query result is missing text from 4th value # empty = If the query results in no results # not_empty = If the query is not empty # 4 = Text to match - The manifest contains all database updates 'Required' to be made to the schema, and it will contain a working backport all the way back to SVN - currently it is tested and backported through the beginning of our Github repo - On world bootup or standalone run of db_update.pl, users will be prompted with a simple menu that we will expand upon later: ============================================================ EQEmu: Automatic Database Upgrade Check ============================================================ Operating System is: MSWin32 (Windows) MySQL is in system path Path = C:\Program Files\MariaDB 10.0\bin/mysql ============================================================ Binary Database Version: (9057) Local Database Version: (9057) Database up to Date: Continuing World Bootup... ============================================================ Retrieving latest database manifest... URL: https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt Saved: db_update/db_update_manifest.txt Database Management Menu (Please Select): 1) Backup Database - (Saves to Backups folder) Ideal to perform before performing updates 2) Backup Database Compressed - (Saves to Backups folder) Ideal to perform before performing updates 3) Check for pending Database updates Stages updates for automatic upgrade... 0) Exit Created db_update.pl, placed in utils/scripts folder, used for the automatic database update routine (Linux/Windows) - db_update.pl script created db_version table if not created, if old one is present it will remove it Created db_dumper.pl, placed in utils/scripts folder, used for the automatic database update routine backups and standalone backups (Linux/Windows) World will now check the db_update.pl script on bootup, if the db_update.pl script is not present, it will fetch it remotely before running - when db_update.pl is done running, world will continue with bootup world.exe db_version - will report database binary version --- changelog.txt | 54 ++++++++++ common/database.cpp | 12 +++ common/version.h | 8 ++ utils/scripts/db_update.pl | 4 +- utils/sql/db_update_manifest.txt | 168 +++++++++++++++---------------- world/net.cpp | 9 ++ 6 files changed, 169 insertions(+), 86 deletions(-) diff --git a/changelog.txt b/changelog.txt index dbfc0c0cc..da9906984 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,60 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/16/2014 == demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat +Akkadius: Implemented Automatic Database update and versioning system +Akkadius: Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057 + - This revision define will need to be incremented each time a database update is made + - Along with a revision define increment, you will need to update the db_update manifest located in: + - https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt + - An entry needs to be made at the bottom of the manifest, the entry is quite simple + - Example: 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| + - This latest example is checking to see if the spells_new table contains the column 'disallow_sit', if its empty, the update needs to be ran + - More examples of match types below: + # Example: Version|Filename.sql|Query_to_Check_Condition_For_Needed_Update|match type|text to match + # 0 = Database Version + # 1 = Filename.sql + # 2 = Query_to_Check_Condition_For_Needed_Update + # 3 = Match Type - If condition from match type to Value 4 is true, update will flag for needing to be ran + # contains = If query results contains text from 4th value + # match = If query results matches text from 4th value + # missing = If query result is missing text from 4th value + # empty = If the query results in no results + # not_empty = If the query is not empty + # 4 = Text to match + - The manifest contains all database updates 'Required' to be made to the schema, and it will contain a working backport all the way back to SVN - + currently it is tested and backported through the beginning of our Github repo + - On world bootup or standalone run of db_update.pl, users will be prompted with a simple menu that we will expand upon later: + + ============================================================ + EQEmu: Automatic Database Upgrade Check + ============================================================ + Operating System is: MSWin32 + (Windows) MySQL is in system path + Path = C:\Program Files\MariaDB 10.0\bin/mysql + ============================================================ + Binary Database Version: (9057) + Local Database Version: (9057) + + Database up to Date: Continuing World Bootup... + ============================================================ + Retrieving latest database manifest... + URL: https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt + Saved: db_update/db_update_manifest.txt + +Database Management Menu (Please Select): + 1) Backup Database - (Saves to Backups folder) + Ideal to perform before performing updates + 2) Backup Database Compressed - (Saves to Backups folder) + Ideal to perform before performing updates + 3) Check for pending Database updates + Stages updates for automatic upgrade... + 0) Exit + +Akkadius: Created db_update.pl, placed in utils/scripts folder, used for the automatic database update routine (Linux/Windows) + - db_update.pl script created db_version table if not created, if old one is present it will remove it +Akkadius: Created db_dumper.pl, placed in utils/scripts folder, used for the automatic database update routine backups and standalone backups (Linux/Windows) +Akkadius: World will now check the db_update.pl script on bootup, if the db_update.pl script is not present, it will fetch it remotely before running - + when db_update.pl is done running, world will continue with bootup == 11/15/2014 == Uleat(Natedog): A better fix for OP_ShopPlayerBuy - doesn't cause the issues that I introduced diff --git a/common/database.cpp b/common/database.cpp index 599d615a7..b5d3b1138 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2084,6 +2084,18 @@ bool Database::CheckDatabaseConversions() { #endif + /* Fetch Automatic Database Upgrade Script */ + if (!std::ifstream("db_update.pl")){ + std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; +#ifdef _WIN32 + system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); +#else + system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); +#endif + } + /* Run Automatic Database Upgrade Script */ + system("perl db_update.pl ran_from_world"); + return true; } diff --git a/common/version.h b/common/version.h index 432d8157f..caff584d8 100644 --- a/common/version.h +++ b/common/version.h @@ -23,6 +23,14 @@ #define EQEMU_PROTOCOL_VERSION "0.3.10" #define CURRENT_VERSION "1.0.0" + +/* + Everytime a Database SQL is added to Github, + increment CURRENT_BINARY_DATABASE_VERSION number and make sure you update the manifest + Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt +*/ + +#define CURRENT_BINARY_DATABASE_VERSION 9057 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 37798e1eb..34f9dc0bb 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -105,8 +105,8 @@ if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ } print "Retrieving latest database manifest...\n"; -#GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); -GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); +GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); +# GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); if($local_db_ver < $bin_db_ver && $ARGV[0] eq "ran_from_world"){ print "You have missing database updates, type 1 or 2 to backup your database before running them as recommended...\n\n"; diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 44983d532..4f1de43df 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -1,21 +1,21 @@ 5001|1_task_system.sql -5002|2_optional_maxclients.sql -5003|14_optional_merchantlist.sql +# 5002|2_optional_maxclients.sql +# 5003|14_optional_merchantlist.sql 5004|35_task_stepped.sql 5005|42_task_min_maxlevel.sql 5006|55_zone_shutdowndeleay.sql -5007|68_optional_character_maxexplevel.sql -5008|103_optional_chat_rules.sql +# 5007|68_optional_character_maxexplevel.sql +# 5008|103_optional_chat_rules.sql 5009|104_traps.sql -5010|106_optional_proc_rules.sql +# 5010|106_optional_proc_rules.sql 5011|120_damageshieldtypes.sql 5012|125_aggrozone.sql -5013|127_optional_spell_rules.sql -5014|129_optional_shared_plat_rule.sql -5015|131_optional_combat_rules.sql +# 5013|127_optional_spell_rules.sql +# 5014|129_optional_shared_plat_rule.sql +# 5015|131_optional_combat_rules.sql 5016|133_task_repeatable.sql 5017|142_deathpeace_and_lifetap_aas.sql -5018|158_optional_death_exp_loss.sql +# 5018|158_optional_death_exp_loss.sql 5019|176_melody.sql 5020|189_character_.sql 5021|196_trader.sql @@ -28,20 +28,20 @@ 5028|247_mail.sql 5029|249_chatchannels.sql 5030|250_bot_spell_update.sql -5031|250_optional_bot_spell_update.sql -5032|285_optional_bot_spell_update.sql +# 5031|250_optional_bot_spell_update.sql +# 5032|285_optional_bot_spell_update.sql 5033|292_augslots.sql 5034|294_merchant_logging.sql 5035|304_faction_list.sql 5036|326_aas.sql 5037|328_bot_management.sql -5038|328_optional_bot_management.sql +# 5038|328_optional_bot_management.sql 5039|340_gm_ips.sql 5040|356_combat.sql 5041|360_peqzone.sql 5042|364_ranged_dist_rule.sql 5043|386_bot_save_raid.sql -5044|434_optional_rest_state_rules.sql +# 5044|434_optional_rest_state_rules.sql 5045|447_sof_startzone_rule.sql 5046|463_altadv_vars.sql 5047|475_aa_actions.sql @@ -77,12 +77,12 @@ 5077|754_archery_base_damage_rule.sql 5078|755_sof_altadv_vars_updates.sql 5079|773_monk_rules.sql -5080|853_optional_rule_aaexp.sql -5081|858_optional_rule_ip_limit_by_status.sql -5082|892_optional_bots_table_mod.sql -5083|893_optional_bots_table_mod.sql +# 5080|853_optional_rule_aaexp.sql +# 5081|858_optional_rule_ip_limit_by_status.sql +# 5082|892_optional_bots_table_mod.sql +# 5083|893_optional_bots_table_mod.sql 5084|898_npc_maxlevel_scalerate.sql -5085|902_optional_rule_snareflee.sql +# 5085|902_optional_rule_snareflee.sql 5086|923_spawn2_enabled.sql 5087|962_hot_zone.sql 5088|964_reports.sql @@ -101,17 +101,17 @@ 5101|1057_titles.sql 5102|1077_botgroups.sql 5103|1136_spell_globals.sql -5104|1144_optional_rule_return_nodrop.sql +# 5104|1144_optional_rule_return_nodrop.sql 5105|1195_account_suspendeduntil.sql 5106|1259_npc_skill_types.sql 5107|1280_bot_augs.sql -5108|1290_optional_exp_loss_rule.sql +# 5108|1290_optional_exp_loss_rule.sql 5109|1293_guild_bank.sql 5110|1379_loginserver_trusted_server.sql 5111|1392_recipe_learning.sql -5112|1394_optional_rule_sod_hp_mana_end.sql +# 5112|1394_optional_rule_sod_hp_mana_end.sql 5113|1404_faction_list.sql -5114|1410_optional_sod_aas_ht_and_loh.sql +# 5114|1410_optional_sod_aas_ht_and_loh.sql 5115|1436_login_server_table_fix.sql 5116|1446_allowrest_optional.sql 5117|1446_allowrest_required.sql @@ -128,66 +128,66 @@ 5128|1586_waypoints_optional.sql 5129|1610_tradeskill_required.sql 5130|1618_zone.sql -5131|1625_optional_rule_class_race_exp_bonus.sql -5132|1672_optional_rules_respawn_window.sql -5133|1679_optional_rules_blocked_buffs.sql +# 5131|1625_optional_rule_class_race_exp_bonus.sql +# 5132|1672_optional_rules_respawn_window.sql +# 5133|1679_optional_rules_blocked_buffs.sql 5134|1696_modify_zone_and_object_tables.sql 5135|1711_account_restricted_aa.sql -5136|1717_optional_rule_bash_stun_chance.sql -5137|1718_optional_rules_mod3s.sql -5138|1719_optional_triggerOnCastAAs.sql -5139|1720_optional_sql_AAs.sql +# 5136|1717_optional_rule_bash_stun_chance.sql +# 5137|1718_optional_rules_mod3s.sql +# 5138|1719_optional_triggerOnCastAAs.sql +# 5139|1720_optional_sql_AAs.sql 5140|1720_required_sql_AA_effects_update.sql -5141|1721_optional_sql_drakkin_breath_update.sql +# 5141|1721_optional_sql_drakkin_breath_update.sql 5142|1721_required_sql_altadv_vars_update.sql -5143|1723_optional_sql_new_stats_window_rule.sql +# 5143|1723_optional_sql_new_stats_window_rule.sql 5144|1723_required_sql_corruption.sql -5145|1736_optional_sql_feral_swipe.sql +# 5145|1736_optional_sql_feral_swipe.sql 5146|1737_required_sql_rule_and_aa_update.sql -5147|1746_optional_sql_bot_manaregen.sql -5148|1747_optional_HoT_zone_and_zonepoints.sql -5149|1750_optional_sql_reflect_rule.sql -5150|1753_optional_haste_cap_rule.sql +# 5147|1746_optional_sql_bot_manaregen.sql +# 5148|1747_optional_HoT_zone_and_zonepoints.sql +# 5149|1750_optional_sql_reflect_rule.sql +# 5150|1753_optional_haste_cap_rule.sql 5151|1753_required_sql_healing_adept_aa.sql 5152|1754_required_sql_healing_adept_aa_fix.sql 5153|1755_required_sql_fear_resist_aas.sql -5154|1784_optional_corpsedrag_rules.sql +# 5154|1784_optional_corpsedrag_rules.sql 5155|1786_required_update_to_aas.sql 5156|1790_required_aa_required_level_cost.sql 5157|1793_resist_adjust.sql -5158|1799_optional_rest_regen_endurance_rule.sql +# 5158|1799_optional_rest_regen_endurance_rule.sql 5159|1802_required_doppelganger.sql 5160|1803_required_tasks_xpreward_signed.sql 5161|1804_required_ae_melee_updates.sql -5162|1809_optional_rules.sql +# 5162|1809_optional_rules.sql 5163|1813_required_doppelganger_npcid_change.sql -5164|1817_optional_npc_archery_bonus_rule.sql -5165|1823_optional_delay_death.sql +# 5164|1817_optional_npc_archery_bonus_rule.sql +# 5165|1823_optional_delay_death.sql 5166|1847_required_doors_dest_zone_size_32.sql -5167|1859_optional_item_casts_use_focus_rule.sql -5168|1884_optional_bot_spells_update.sql -5169|1885_optional_rules_fv_pvp_expansions.sql -5170|1889_optional_skill_cap_rule.sql +# 5167|1859_optional_item_casts_use_focus_rule.sql +# 5168|1884_optional_bot_spells_update.sql +# 5169|1885_optional_rules_fv_pvp_expansions.sql +# 5170|1889_optional_skill_cap_rule.sql 5171|1908_required_npc_types_definitions.sql -5172|1926_optional_stat_cap.sql +# 5172|1926_optional_stat_cap.sql 5173|1944_spawn2.sql 5174|1946_doors.sql -5175|1960_optional_console_timeout_rule.sql -5176|1962_optional_guild_creation_window_rules.sql -5177|1963_optional_rule_live_like_focuses.sql -5178|1968_optional_enrage_rules.sql -5179|1972_optional_extradmg_item_cap.sql +# 5175|1960_optional_console_timeout_rule.sql +# 5176|1962_optional_guild_creation_window_rules.sql +# 5177|1963_optional_rule_live_like_focuses.sql +# 5178|1968_optional_enrage_rules.sql +# 5179|1972_optional_extradmg_item_cap.sql 5180|1974_required_bot_spells_update.sql 5181|1977_underwater.sql -5182|1998_optional_intoxication_and_looting_rules.sql +# 5182|1998_optional_intoxication_and_looting_rules.sql 5183|2004_charges_alt_currency.sql -5184|2015_optional_specialization_training_rule.sql -5185|2016_optional_rule_bot_aa_expansion.sql -5186|2023_optional_mysqlcli.sql -5187|2024_optional_update_crystals.sql +# 5184|2015_optional_specialization_training_rule.sql +# 5185|2016_optional_rule_bot_aa_expansion.sql +# 5186|2023_optional_mysqlcli.sql +# 5187|2024_optional_update_crystals.sql 5188|2024_required_update.sql 5189|2057_required_discovered_items.sql -5190|2058_optional_rule_discovered_items.sql +# 5190|2058_optional_rule_discovered_items.sql 5191|2062_required_version_changes.sql 5192|2069_required_pets.sql 5193|2079_player_speech.sql @@ -200,59 +200,59 @@ 5200|2133_required_faction_loot_despawn.sql 5201|2136_extended_targets.sql 5202|2142_emotes.sql -5203|2154_optional_rule_spell_procs_resists_falloff.sql -5204|2156_optional_charm_break_rule.sql -5205|2159_optional_defensiveproc_rules.sql +# 5203|2154_optional_rule_spell_procs_resists_falloff.sql +# 5204|2156_optional_charm_break_rule.sql +# 5205|2159_optional_defensiveproc_rules.sql 5206|2164_require_bots_bottimers.sql -5207|2171_optional_SpecialAttackACBonus_rule.sql -5208|2176_optional_aa_expansion_SOF_fix.sql -5209|2176_optional_FrenzyBonus_rule.sql +# 5207|2171_optional_SpecialAttackACBonus_rule.sql +# 5208|2176_optional_aa_expansion_SOF_fix.sql +# 5209|2176_optional_FrenzyBonus_rule.sql 5210|2176_required_aa_updates.sql 5211|2178_required_aa_updates.sql -5212|2183_optional_bot_xp_rule.sql -5213|2185_optional_NPCFlurryChacne_rule -5214|2185_optional_NPCFlurryChacne_rule.sql -5215|2185_optional_NPCFlurryChance_rule.sql +# 5212|2183_optional_bot_xp_rule.sql +# 5213|2185_optional_NPCFlurryChacne_rule +# 5214|2185_optional_NPCFlurryChacne_rule.sql +# 5215|2185_optional_NPCFlurryChance_rule.sql 5216|2185_required_aa_updates 5217|2185_required_aa_updates.sql -5218|2188_optional_miscspelleffect_rules -5219|2188_optional_miscspelleffect_rules.sql +# 5218|2188_optional_miscspelleffect_rules +# 5219|2188_optional_miscspelleffect_rules.sql 5220|2188_required_aa_updates 5221|2188_required_aa_updates.sql -5222|2189_optional_taunt_rules -5223|2189_optional_taunt_rules.sql +# 5222|2189_optional_taunt_rules +# 5223|2189_optional_taunt_rules.sql 5224|2195_required_sharedplatupdates.sql -5225|2208_optional_aa_stacking_rule.sql -5226|2208_optional_EnableSoulAbrasionAA.sql +# 5225|2208_optional_aa_stacking_rule.sql +# 5226|2208_optional_EnableSoulAbrasionAA.sql 5227|2208_required_aa_updates.sql -5228|2209_optional_additive_bonus_rule.sql +# 5228|2209_optional_additive_bonus_rule.sql 5229|2213_loot_changes.sql 5230|2214_faction_list_mod.sql 5231|2215_required_aa_updates.sql -5232|2243_optional_char_max_level_rule.sql +# 5232|2243_optional_char_max_level_rule.sql 5233|2260_probability.sql 5234|2262_required_pet_discipline_update.sql 5235|2264_required_aa_updates.sql 5236|2268_QueryServ.sql 5237|2268_required_updates.sql -5238|2274_optional_rule_iplimitdisconnectall.sql -5239|2278_optional_rule_targetableswarmpet.sql -5240|2280_optional_rule_targetableswarmpet-rename.sql +# 5238|2274_optional_rule_iplimitdisconnectall.sql +# 5239|2278_optional_rule_targetableswarmpet.sql +# 5240|2280_optional_rule_targetableswarmpet-rename.sql 5241|2283_required_npc_changes.sql 5242|2299_required_inspectmessage_fields.sql -5243|2300_optional_loot_changes.sql +# 5243|2300_optional_loot_changes.sql 5244|2304_QueryServ.sql 5245|2340_required_maxbuffslotspet.sql 5246|2361_QueryServ.sql 5247|2361_required_qs_rule_values.sql 5248|2370_required_aa_updates.sql 5249|2376_required_aa_updates.sql -5250|2380_optional_merc_data.sql -5251|2380_optional_merc_merchant_npctypes_update.sql -5252|2380_optional_merc_rules.sql +# 5250|2380_optional_merc_data.sql +# 5251|2380_optional_merc_merchant_npctypes_update.sql +# 5252|2380_optional_merc_rules.sql 5253|2383_required_group_ismerc.sql -5254|2428_optional_levelbasedexpmods.sql -5255|2448_optional_stun_proc_aggro_rule.sql +# 5254|2428_optional_levelbasedexpmods.sql +# 5255|2448_optional_stun_proc_aggro_rule.sql 5256|2471_required_aa_updates.sql 5257|2482_required_start_zones.sql 5258|2504_required_aa_updates.sql diff --git a/world/net.cpp b/world/net.cpp index 7973b5872..eb2721c92 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -111,6 +111,15 @@ int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); set_exception_handler(); + /* Database Version Check */ + uint32 Database_Version = CURRENT_BINARY_DATABASE_VERSION; + if (argc >= 2) { + if (strcasecmp(argv[1], "db_version") == 0) { + std::cout << "Binary Database Version: " << Database_Version << std::endl; + return 0; + } + } + // Load server configuration _log(WORLD__INIT, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { From de16db5a2f13a696e25279ca1ec84e5f89a78a6d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 21:00:19 -0600 Subject: [PATCH 0276/1883] db_update.pl DB upgrade script - Linux Fixes --- utils/scripts/db_update.pl | 61 +++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 34f9dc0bb..4c8f5da57 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -6,6 +6,11 @@ #::: Purpose: To upgrade databases with ease and maintain versioning ########################################################### +$perl_version = $^V; +$perl_version =~s/v//g; +print "Perl Version is " . $perl_version . "\n"; +if($perl_version > 5.12){ no warnings 'uninitialized'; } + my $confile = "eqemu_config.xml"; #default open(F, "<$confile") or die "Unable to open config: $confile\n"; my $indb = 0; @@ -49,19 +54,15 @@ if($OS eq "Windows"){ #::: Linux Check if($OS eq "Linux"){ - $has_mysql_path = `whereis mysql`; - if($has_mysql_path=~/MySQL|MariaDB/i){ - @mysql = split(' ', $has_mysql_path); - foreach my $v (@mysql){ - if($v=~/MySQL|MariaDB/i){ - $path = $v; - last; - } - } - print " (Linux) MySQL is in system path \n"; - print " Path = " . $path . "\n"; - print "============================================================\n"; + $path = `which mysql`; + if ($path eq "") { + $path = `which mariadb`; } + $path =~s/\n//g; + + print " (Linux) MySQL is in system path \n"; + print " Path = " . $path . "\n"; + print "============================================================\n"; } #::: Path not found, error and exit @@ -74,26 +75,26 @@ if($path eq ""){ #::: Create db_update working directory if not created mkdir('db_update'); -# print `"$path" --user $user --password="$pass" $db < db_update/db_update_run_file.txt`; - #::: Check if db_version table exists... -if(trim(GetMySQLResult("SHOW COLUMNS FROM `db_version` LIKE 'Revision'")) ne ""){ +if(trim(GetMySQLResult("SHOW COLUMNS FROM db_version LIKE 'Revision'")) ne ""){ print GetMySQLResult("DROP TABLE db_version"); - print "Old `db_version` table present, dropping...\n\n"; + print "Old db_version table present, dropping...\n\n"; } if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){ print GetMySQLResult(" - CREATE TABLE `db_version` ( - `version` int(11) DEFAULT '0' + CREATE TABLE db_version ( + version int(11) DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; - INSERT INTO `db_version` (`version`) VALUES ('1000');"); + INSERT INTO db_version (version) VALUES ('1000');"); print "Table 'db_version' does not exists.... Creating...\n\n"; } -@db_version = split(': ', `world db_version`); +if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); } +if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); } + $bin_db_ver = trim($db_version[1]); -$local_db_ver = trim(GetMySQLResult("SELECT `version` FROM `db_version` LIMIT 1")); +$local_db_ver = trim(GetMySQLResult("SELECT version FROM db_version LIMIT 1")); print " Binary Database Version: (" . $bin_db_ver . ")\n"; print " Local Database Version: (" . $local_db_ver . ")\n\n"; @@ -104,6 +105,8 @@ if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ exit; } +if(!$bin_db_ver){ $bin_db_ver = 9100; } + print "Retrieving latest database manifest...\n"; GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); # GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); @@ -198,17 +201,22 @@ sub database_dump_compress { print "Performing database backup....\n"; print `perl db_dumper.pl database="$db" loc="backups" compress`; } -sub Exit{} +sub Exit{ } #::: Returns Tab Delimited MySQL Result from Command Line sub GetMySQLResult{ my $run_query = $_[0]; - return `"$path" --user $user --password="$pass" $db -N -B -e "$run_query"`; + if($OS eq "Windows"){ return `"$path" --user $user --password="$pass" $db -N -B -e "$run_query"`; } + if($OS eq "Linux"){ + $run_query =~s/`//g; + return `$path --user="$user" --password="$pass" $db -N -B -e "$run_query"`; + } } sub GetMySQLResultFromFile{ my $update_file = $_[0]; - return `"$path" --user $user --password="$pass" --force $db < $update_file`; + if($OS eq "Windows"){ return `"$path" --user $user --password="$pass" --force $db < $update_file`; } + if($OS eq "Linux"){ return `"$path" --user $user --password="$pass" --force $db < $update_file`; } } #::: Gets Remote File based on URL (1st Arg), and saves to destination file (2nd Arg) @@ -238,7 +246,7 @@ sub GetRemoteFile{ } if($OS eq "Linux"){ #::: wget -O db_update/db_update_manifest.txt https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt - $wget = `wget -O $Dest_File $URL`; + $wget = `wget --quiet -O $Dest_File $URL`; print " URL: " . $URL . "\n"; print " Saved: " . $Dest_File . " \n"; if($wget=~/unable to resolve/i){ @@ -265,7 +273,7 @@ sub Run_Database_Check{ $file_name = trim($m_d{$val}[1]); print "Running Update: " . $val . " - " . $file_name . "\n"; print GetMySQLResultFromFile("db_update/$file_name"); - print GetMySQLResult("UPDATE `db_version` SET `version` = $val WHERE `version` < $val"); + print GetMySQLResult("UPDATE db_version SET version = $val WHERE version < $val"); } } @@ -277,7 +285,6 @@ sub Run_Database_Check{ chomp; $o = $_; if($o=~/#/i){ next; } - #print $o . "\n"; @manifest = split('\|', $o); $m_d{$manifest[0]} = [@manifest]; } From 9d6248886c675f76fa302c45cdacc40b5b9b2c2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 21:22:09 -0600 Subject: [PATCH 0277/1883] Turn off potential warning garbage for different versions of perl --- common/database.cpp | 1 + utils/scripts/db_update.pl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index b5d3b1138..12ef93223 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2094,6 +2094,7 @@ bool Database::CheckDatabaseConversions() { #endif } /* Run Automatic Database Upgrade Script */ + system("perl db_update.pl ran_from_world"); return true; diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 4c8f5da57..ba00bb5b3 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -10,6 +10,7 @@ $perl_version = $^V; $perl_version =~s/v//g; print "Perl Version is " . $perl_version . "\n"; if($perl_version > 5.12){ no warnings 'uninitialized'; } +no warnings; my $confile = "eqemu_config.xml"; #default open(F, "<$confile") or die "Unable to open config: $confile\n"; @@ -157,7 +158,7 @@ sub ShowMenuPrompt { } sub MenuOptions { - if(defined(@total_updates)){ + if(@total_updates){ $option[3] = "Run pending updates... (" . scalar (@total_updates) . ")"; } else{ From c749155ad291aa6887e408776ad4d424b1fe116a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 16 Nov 2014 21:37:47 -0600 Subject: [PATCH 0278/1883] Fix for invalid input error when script is ran from world during bootup. --- utils/scripts/db_update.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index ba00bb5b3..12e5aeab2 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -135,6 +135,10 @@ sub ShowMenuPrompt { while (1) { { local $| = 1; + if(!$menu_show && $ARGV[0] eq "ran_from_world"){ + $menu_show++; + next; + } print MenuOptions(), '> '; } @@ -151,7 +155,7 @@ sub ShowMenuPrompt { } else { if($ARGV[0] ne "ran_from_world"){ - warn "\n\nInvalid selection\n\n"; + # warn "\n\nInvalid selection\n\n"; } } } From 0b44f5851862697d3d7208567af5fbd5e7994067 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 17 Nov 2014 16:41:37 -0500 Subject: [PATCH 0279/1883] Correct OP_AugmentInfo reply This fixes the display issue for RoF SoF/SoD/UF still won't show the charm info on Adventurer's Stone, probably a client bug. --- changelog.txt | 4 ++++ common/eq_packet_structs.h | 4 ++-- common/patches/rof.cpp | 12 ++++++++++ common/patches/rof_ops.h | 1 + common/patches/rof_structs.h | 6 ++--- common/patches/sod.cpp | 12 ++++++++++ common/patches/sod_ops.h | 1 + common/patches/sod_structs.h | 6 ++--- common/patches/sof.cpp | 12 ++++++++++ common/patches/sof_ops.h | 1 + common/patches/sof_structs.h | 6 ++--- common/patches/underfoot.cpp | 12 ++++++++++ common/patches/underfoot_ops.h | 1 + common/patches/underfoot_structs.h | 6 ++--- zone/client_packet.cpp | 38 ++++++------------------------ 15 files changed, 77 insertions(+), 45 deletions(-) diff --git a/changelog.txt b/changelog.txt index da9906984..8bfd1e103 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/16/2014 == +demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone + Still issues with UF/SoF/SoD though. + == 11/16/2014 == demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat Akkadius: Implemented Automatic Database update and versioning system diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index c49283f18..7c663f18e 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -4389,8 +4389,8 @@ struct ControlBoat_Struct { struct AugmentInfo_Struct { /*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[67]; // total packet length 72, all the rest were always 00 +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // the reply has the text here /*072*/ }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 95e0047e8..092101d7d 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -235,6 +235,18 @@ namespace RoF FINISH_ENCODE(); } + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + ENCODE(OP_Barter) { EQApplicationPacket *in = *p; diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index 57ff1f91d..878870a81 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -5,6 +5,7 @@ E(OP_AltCurrency) E(OP_AltCurrencySell) E(OP_Animation) E(OP_ApplyPoison) +E(OP_AugmentInfo) E(OP_Barter) E(OP_BazaarSearch) E(OP_BeginCast) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index f3a6209b8..0a62a90bf 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4692,9 +4692,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { /*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 -/*076*/ +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // total packet length 76, all the rest were always 00 +/*072*/ uint32 unknown072; }; struct VeteranRewardItem diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 1d93ad721..54dd33841 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -174,6 +174,18 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + ENCODE(OP_Barter) { EQApplicationPacket *in = *p; diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 792c9e5d3..038b42e08 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -3,6 +3,7 @@ E(OP_Action) E(OP_AdventureMerchantSell) E(OP_AltCurrencySell) E(OP_ApplyPoison) +E(OP_AugmentInfo) E(OP_Barter) E(OP_BazaarSearch) E(OP_Buff) diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 15e0d5307..47b228cb7 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -4173,9 +4173,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { /*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 -/*076*/ +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // total packet length 76, all the rest were always 00 +/*072*/ uint32 unknown072; }; struct VeteranRewardItem diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index a9b8d6e26..629395cd1 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -174,6 +174,18 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + ENCODE(OP_BazaarSearch) { if (((*p)->size == sizeof(BazaarReturnDone_Struct)) || ((*p)->size == sizeof(BazaarWelcome_Struct))) { diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index f039c2189..132e3dc77 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -3,6 +3,7 @@ E(OP_Action) E(OP_AdventureMerchantSell) E(OP_AltCurrencySell) E(OP_ApplyPoison) +E(OP_AugmentInfo) E(OP_BazaarSearch) E(OP_BecomeTrader) E(OP_Buff) diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index a49dc6f25..9c3238f73 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -4027,9 +4027,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { /*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 -/*076*/ +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // total packet length 76, all the rest were always 00 +/*072*/ uint32 unknown072; }; struct VeteranRewardItem diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index a0cd76114..adc4ed6e3 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -226,6 +226,18 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + ENCODE(OP_Barter) { EQApplicationPacket *in = *p; diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 38cfb79e3..cfb4d4fe9 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -4,6 +4,7 @@ E(OP_AdventureMerchantSell) E(OP_AltCurrency) E(OP_AltCurrencySell) E(OP_ApplyPoison) +E(OP_AugmentInfo) E(OP_Barter) E(OP_BazaarSearch) E(OP_Buff) diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 86f712d24..45c47875d 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4272,9 +4272,9 @@ struct ItemQuaternaryBodyStruct struct AugmentInfo_Struct { /*000*/ uint32 itemid; // id of the solvent needed -/*004*/ uint8 window; // window to display the information in -/*005*/ uint8 unknown005[71]; // total packet length 76, all the rest were always 00 -/*076*/ +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // total packet length 76, all the rest were always 00 +/*072*/ uint32 unknown072; }; struct VeteranRewardItem diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0e35db1fa..51affb7dd 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3034,47 +3034,23 @@ void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) { - // This packet is sent by the client when an Augment item information window is opened. - // We respond with an OP_ReadBook containing the type of distiller required to remove the augment. - // The OP_Augment packet includes a window parameter to determine which Item window in the UI the - // text is to be displayed in. out->type = 2 indicates the BookText_Struct contains item information. - // + // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) - if (app->size != sizeof(AugmentInfo_Struct)) - { + if (app->size != sizeof(AugmentInfo_Struct)) { LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); - DumpPacket(app); - return; } + AugmentInfo_Struct* AugInfo = (AugmentInfo_Struct*)app->pBuffer; - - char *outstring = nullptr; - const Item_Struct * item = database.GetItem(AugInfo->itemid); - if (item) - { - MakeAnyLenString(&outstring, "You must use the solvent %s to remove this augment safely.", item->Name); - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, strlen(outstring) + sizeof(BookText_Struct)); - - BookText_Struct *out = (BookText_Struct *)outapp->pBuffer; - - out->window = AugInfo->window; - - out->type = 2; - - out->invslot = 0; - - strcpy(out->booktext, outstring); - - safe_delete_array(outstring); - - FastQueuePacket(&outapp); + if (item) { + strn0cpy(AugInfo->augment_info, item->Name, 64); + AugInfo->itemid = 0; + QueuePacket(app); } } From a6b9e6cb3c69699c3dbab23c65955e43e6372254 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 18 Nov 2014 01:02:11 -0600 Subject: [PATCH 0280/1883] Trevius: Mercenaries can now zone once again. --- changelog.txt | 9 +- zone/client.cpp | 86 +- zone/client.h | 1322 ++++++++--------- zone/client_packet.cpp | 25 +- zone/client_process.cpp | 69 +- zone/groups.cpp | 19 +- zone/merc.cpp | 3003 +++++++++++++++++++++------------------ zone/merc.h | 289 ++-- zone/zonedb.cpp | 146 +- 9 files changed, 2575 insertions(+), 2393 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8bfd1e103..4ea1af27b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,11 +1,14 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 11/16/2014 == -demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone - Still issues with UF/SoF/SoD though. +== 11/18/2014 == +Trevius: Mercenaries can now zone once again. + +== 11/17/2014 == +demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone. Still issues with UF/SoF/SoD though. == 11/16/2014 == demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat + Akkadius: Implemented Automatic Database update and versioning system Akkadius: Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057 - This revision define will need to be incremented each time a database update is made diff --git a/zone/client.cpp b/zone/client.cpp index a8a3f6f8d..4325f82d6 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7297,26 +7297,24 @@ void Client::SendMercPersonalInfo() { uint32 mercTypeCount = 1; uint32 mercCount = 1; //TODO: Un-hardcode this and support multiple mercs like in later clients than SoD. - //uint32 packetSize = 0; - uint32 i=0; + uint32 i = 0; uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs! - if (GetClientVersion() >= EQClientRoF) + MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; + + int stancecount = 0; + stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); + if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) { - MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; + SendMercMerchantResponsePacket(0); + return; + } - if (mercData) + if(mercData) + { + if (GetClientVersion() >= EQClientRoF) { - int i = 0; - int stancecount = 0; - stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); - - if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) - { - SendMercMerchantResponsePacket(0); - return; - } - if (mercCount > 0 && mercCount) + if (mercCount > 0) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, sizeof(MercenaryDataUpdate_Struct)); MercenaryDataUpdate_Struct* mdus = (MercenaryDataUpdate_Struct*)outapp->pBuffer; @@ -7354,40 +7352,19 @@ void Client::SendMercPersonalInfo() mdus->MercData[i].MercUnk05 = 1; FastQueuePacket(&outapp); + safe_delete(outapp); return; } } - } - else - { - int stancecount = 0; - stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); - - if(mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) + else { - if (GetClientVersion() == EQClientSoD) + if(mercTypeCount > 0 && mercCount > 0) { - SendMercMerchantResponsePacket(0); - } - return; - } - - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct)); - MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer; - MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; - - - if(mercData) - { - if(mercTypeCount > 0) - { - mml->MercTypeCount = mercTypeCount; //We only should have one merc entry. + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, sizeof(MercenaryMerchantList_Struct)); + MercenaryMerchantList_Struct* mml = (MercenaryMerchantList_Struct*)outapp->pBuffer; + mml->MercTypeCount = mercTypeCount; //We should only have one merc entry. mml->MercGrades[i] = 1; - } - mml->MercCount = mercCount; - if(mercCount > 0) - { - + mml->MercCount = mercCount; mml->Mercs[i].MercID = mercData->MercTemplateID; mml->Mercs[i].MercType = mercData->MercType; mml->Mercs[i].MercSubType = mercData->MercSubType; @@ -7404,7 +7381,7 @@ void Client::SendMercPersonalInfo() mml->Mercs[i].StanceCount = zone->merc_stance_list[mercData->MercTemplateID].size(); mml->Mercs[i].MercUnk03 = 0; mml->Mercs[i].MercUnk04 = 1; - //mml->Mercs[i].MercName; + strn0cpy(mml->Mercs[i].MercName, GetMercInfo().merc_name , sizeof(mml->Mercs[i].MercName)); int stanceindex = 0; if(mml->Mercs[i].StanceCount != 0) { @@ -7418,31 +7395,12 @@ void Client::SendMercPersonalInfo() } } FastQueuePacket(&outapp); - } - else - { safe_delete(outapp); - if (GetClientVersion() == EQClientSoD) - { - SendMercMerchantResponsePacket(0); - } return; } - if (GetClientVersion() == EQClientSoD) - { - SendMercMerchantResponsePacket(0); - } - } - else - { - safe_delete(outapp); - if (GetClientVersion() == EQClientSoD) - { - SendMercMerchantResponsePacket(0); - } - return; } } + SendMercMerchantResponsePacket(0); } void Client::SendClearMercInfo() diff --git a/zone/client.h b/zone/client.h index 16e7b82dd..8407ff221 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org) This program is free software; you can redistribute it and/or modify @@ -61,10 +61,10 @@ class Client; #include -#define CLIENT_TIMEOUT 90000 -#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing -#define TARGETING_RANGE 200 // range for /assist and /target -#define XTARGET_HARDCAP 20 +#define CLIENT_TIMEOUT 90000 +#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing +#define TARGETING_RANGE 200 // range for /assist and /target +#define XTARGET_HARDCAP 20 extern Zone* zone; extern TaskManager *taskmanager; @@ -78,25 +78,25 @@ public: bool ack_req; }; -enum { //Type arguments to the Message* routines. +enum { //Type arguments to the Message* routines. //all not explicitly listed are the same grey color clientMessageWhite0 = 0, - clientMessageLoot = 2, //dark green - clientMessageTradeskill = 4, //light blue - clientMessageTell = 5, //magenta + clientMessageLoot = 2, //dark green + clientMessageTradeskill = 4, //light blue + clientMessageTell = 5, //magenta clientMessageWhite = 7, clientMessageWhite2 = 10, clientMessageLightGrey = 12, - clientMessageError = 13, //red + clientMessageError = 13, //red clientMessageGreen = 14, clientMessageYellow = 15, clientMessageBlue = 16, - clientMessageGroup = 18, //cyan + clientMessageGroup = 18, //cyan clientMessageWhite3 = 20, }; #define SPELLBAR_UNLOCK 0x2bc -enum { //scribing argument to MemorizeSpell +enum { //scribing argument to MemorizeSpell memSpellScribing = 0, memSpellMemorize = 1, memSpellForget = 2, @@ -105,14 +105,14 @@ enum { //scribing argument to MemorizeSpell //Modes for the zoning state of the client. typedef enum { - ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac - GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon - ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only - ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data + ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac + GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon + ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only + ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data ZoneUnsolicited, - GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell - SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons - Rewind, // Summon to /rewind location. + GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell + SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons + Rewind, // Summon to /rewind location. EvacToSafeCoords } ZoneMode; @@ -211,7 +211,7 @@ public: virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, - ExtraAttackOptions *opts = nullptr); + ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return (GetRaid() ? true : false); } virtual bool HasGroup() { return (GetGroup() ? true : false); } virtual Raid* GetRaid() { return entity_list.GetRaidByClient(this); } @@ -221,176 +221,176 @@ public: virtual void SetAttackTimer(); float GetQuiverHaste(); - void AI_Init(); - void AI_Start(uint32 iMoveDelay = 0); - void AI_Stop(); - void AI_Process(); - void AI_SpellCast(); - void Trader_ShowItems(); - void Trader_CustomerBrowsing(Client *Customer); - void Trader_EndTrader(); - void Trader_StartTrader(); - uint8 WithCustomer(uint16 NewCustomer); - void KeyRingLoad(); - void KeyRingAdd(uint32 item_id); - bool KeyRingCheck(uint32 item_id); - void KeyRingList(); + void AI_Init(); + void AI_Start(uint32 iMoveDelay = 0); + void AI_Stop(); + void AI_Process(); + void AI_SpellCast(); + void Trader_ShowItems(); + void Trader_CustomerBrowsing(Client *Customer); + void Trader_EndTrader(); + void Trader_StartTrader(); + uint8 WithCustomer(uint16 NewCustomer); + void KeyRingLoad(); + void KeyRingAdd(uint32 item_id); + bool KeyRingCheck(uint32 item_id); + void KeyRingList(); virtual bool IsClient() const { return true; } - void CompleteConnect(); - bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); - void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); - void SendBuyerPacket(Client* Buyer); + void CompleteConnect(); + bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); + void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); + void SendBuyerPacket(Client* Buyer); GetItems_Struct* GetTraderItems(); - void SendBazaarWelcome(); - void DyeArmor(DyeStruct* dye); - uint8 SlotConvert(uint8 slot,bool bracer=false); - void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); - void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); - bool FilteredMessageCheck(Mob *sender, eqFilterType filter); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, - uint32 string_id, const char *message1, const char *message2 = nullptr, - const char *message3 = nullptr, const char *message4 = nullptr, - const char *message5 = nullptr, const char *message6 = nullptr, - const char *message7 = nullptr, const char *message8 = nullptr, - const char *message9 = nullptr); - void Tell_StringID(uint32 string_id, const char *who, const char *message); - void SendColoredText(uint32 color, std::string message); - void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); - void SendTraderItem(uint32 item_id,uint16 quantity); - uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); + void SendBazaarWelcome(); + void DyeArmor(DyeStruct* dye); + uint8 SlotConvert(uint8 slot,bool bracer=false); + void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); + void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); + bool FilteredMessageCheck(Mob *sender, eqFilterType filter); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, + uint32 string_id, const char *message1, const char *message2 = nullptr, + const char *message3 = nullptr, const char *message4 = nullptr, + const char *message5 = nullptr, const char *message6 = nullptr, + const char *message7 = nullptr, const char *message8 = nullptr, + const char *message9 = nullptr); + void Tell_StringID(uint32 string_id, const char *who, const char *message); + void SendColoredText(uint32 color, std::string message); + void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); + void SendTraderItem(uint32 item_id,uint16 quantity); + uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber); - void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); - void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); - void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); - void TradeRequestFailed(const EQApplicationPacket* app); - void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); - void TraderUpdate(uint16 slot_id,uint32 trader_id); - void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); - void SendZonePoints(); + void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); + void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); + void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); + void TradeRequestFailed(const EQApplicationPacket* app); + void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); + void TraderUpdate(uint16 slot_id,uint32 trader_id); + void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); + void SendZonePoints(); - void SendBuyerResults(char *SearchQuery, uint32 SearchID); - void ShowBuyLines(const EQApplicationPacket *app); - void SellToBuyer(const EQApplicationPacket *app); - void ToggleBuyerMode(bool TurnOn); - void UpdateBuyLine(const EQApplicationPacket *app); - void BuyerItemSearch(const EQApplicationPacket *app); - void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } - const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } + void SendBuyerResults(char *SearchQuery, uint32 SearchID); + void ShowBuyLines(const EQApplicationPacket *app); + void SellToBuyer(const EQApplicationPacket *app); + void ToggleBuyerMode(bool TurnOn); + void UpdateBuyLine(const EQApplicationPacket *app); + void BuyerItemSearch(const EQApplicationPacket *app); + void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } + const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } - void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); + void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); - void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); - void SendPacketQueue(bool Block = true); - void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); - void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); - void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); - void Message(uint32 type, const char* message, ...); - void QuestJournalledMessage(const char *npcname, const char* message); - void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); - void SendSound(); - void LearnRecipe(uint32 recipeID); - bool CanIncreaseTradeskill(SkillUseTypes tradeskill); + void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); + void SendPacketQueue(bool Block = true); + void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); + void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); + void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); + void Message(uint32 type, const char* message, ...); + void QuestJournalledMessage(const char *npcname, const char* message); + void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); + void SendSound(); + void LearnRecipe(uint32 recipeID); + bool CanIncreaseTradeskill(SkillUseTypes tradeskill); - EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool GetRevoked() const { return revoked; } - void SetRevoked(bool rev) { revoked = rev; } - inline uint32 GetIP() const { return ip; } - inline bool GetHideMe() const { return gmhideme; } - void SetHideMe(bool hm); - inline uint16 GetPort() const { return port; } - bool IsDead() const { return(dead); } - bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } - inline bool IsLFP() { return LFP; } - void UpdateLFP(); + bool GetRevoked() const { return revoked; } + void SetRevoked(bool rev) { revoked = rev; } + inline uint32 GetIP() const { return ip; } + inline bool GetHideMe() const { return gmhideme; } + void SetHideMe(bool hm); + inline uint16 GetPort() const { return port; } + bool IsDead() const { return(dead); } + bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } + inline bool IsLFP() { return LFP; } + void UpdateLFP(); - virtual bool Save() { return Save(0); } - bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now - void SaveBackup(); + virtual bool Save() { return Save(0); } + bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now + void SaveBackup(); /* New PP Save Functions */ bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); } bool SaveAA(); inline bool ClientDataLoaded() const { return client_data_loaded; } - inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } - inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } - inline void Kick() { client_state = CLIENT_KICKED; } - inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } - inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } - void WorldKick(); - inline uint8 GetAnon() const { return m_pp.anon; } - inline PlayerProfile_Struct& GetPP() { return m_pp; } - inline ExtendedProfile_Struct& GetEPP() { return m_epp; } - inline Inventory& GetInv() { return m_inv; } - inline const Inventory& GetInv() const { return m_inv; } - inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } + inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } + inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } + inline void Kick() { client_state = CLIENT_KICKED; } + inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } + inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } + void WorldKick(); + inline uint8 GetAnon() const { return m_pp.anon; } + inline PlayerProfile_Struct& GetPP() { return m_pp; } + inline ExtendedProfile_Struct& GetEPP() { return m_epp; } + inline Inventory& GetInv() { return m_inv; } + inline const Inventory& GetInv() const { return m_inv; } + inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } - bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); + bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); - void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); - void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); - bool AutoAttackEnabled() const { return auto_attack; } - bool AutoFireEnabled() const { return auto_fire; } - void MakeCorpse(uint32 exploss); + void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); + void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); + bool AutoAttackEnabled() const { return auto_attack; } + bool AutoFireEnabled() const { return auto_fire; } + void MakeCorpse(uint32 exploss); - bool ChangeFirstName(const char* in_firstname,const char* gmname); + bool ChangeFirstName(const char* in_firstname,const char* gmname); - void Duck(); - void Stand(); + void Duck(); + void Stand(); - virtual void SetMaxHP(); - int32 LevelRegen(); - void HPTick(); - void SetGM(bool toggle); - void SetPVP(bool toggle); + virtual void SetMaxHP(); + int32 LevelRegen(); + void HPTick(); + void SetGM(bool toggle); + void SetPVP(bool toggle); - inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } - inline bool GetGM() const { return m_pp.gm != 0; } + inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } + inline bool GetGM() const { return m_pp.gm != 0; } - inline void SetBaseClass(uint32 i) { m_pp.class_=i; } - inline void SetBaseRace(uint32 i) { m_pp.race=i; } - inline void SetBaseGender(uint32 i) { m_pp.gender=i; } + inline void SetBaseClass(uint32 i) { m_pp.class_=i; } + inline void SetBaseRace(uint32 i) { m_pp.race=i; } + inline void SetBaseGender(uint32 i) { m_pp.gender=i; } inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;} - inline uint8 GetLevel2() const { return m_pp.level2; } - inline uint16 GetBaseRace() const { return m_pp.race; } - inline uint16 GetBaseClass() const { return m_pp.class_; } - inline uint8 GetBaseGender() const { return m_pp.gender; } - inline uint8 GetBaseFace() const { return m_pp.face; } - inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } - inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } - inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } - inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } - inline uint8 GetBaseBeard() const { return m_pp.beard; } - inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } - inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } - inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } - inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } - inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } - inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } - inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } - inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } - int32 CalcMaxMana(); - int32 CalcBaseMana(); - const int32& SetMana(int32 amount); - int32 CalcManaRegenCap(); + inline uint8 GetLevel2() const { return m_pp.level2; } + inline uint16 GetBaseRace() const { return m_pp.race; } + inline uint16 GetBaseClass() const { return m_pp.class_; } + inline uint8 GetBaseGender() const { return m_pp.gender; } + inline uint8 GetBaseFace() const { return m_pp.face; } + inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } + inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } + inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } + inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } + inline uint8 GetBaseBeard() const { return m_pp.beard; } + inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } + inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } + inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } + inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } + inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } + inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } + inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } + inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } + int32 CalcMaxMana(); + int32 CalcBaseMana(); + const int32& SetMana(int32 amount); + int32 CalcManaRegenCap(); - void ServerFilter(SetServerFilter_Struct* filter); - void BulkSendTraderInventory(uint32 char_id); - void SendSingleTraderItem(uint32 char_id, int uniqueid); - void BulkSendMerchantInventory(int merchant_id, int npcid); + void ServerFilter(SetServerFilter_Struct* filter); + void BulkSendTraderInventory(uint32 char_id); + void SendSingleTraderItem(uint32 char_id, int uniqueid); + void BulkSendMerchantInventory(int merchant_id, int npcid); - inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } + inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } - void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); + void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); - inline const char* GetLastName() const { return lastname; } + inline const char* GetLastName() const { return lastname; } inline float ProximityX() const { return(proximity_x); } inline float ProximityY() const { return(proximity_y); } @@ -398,91 +398,91 @@ public: inline void ClearAllProximities() { entity_list.ProcessMove(this, FLT_MAX, FLT_MAX, FLT_MAX); proximity_x = FLT_MAX; proximity_y = FLT_MAX; proximity_z = FLT_MAX; } /* - Begin client modifiers + Begin client modifiers */ virtual void CalcBonuses(); //these are all precalculated now - inline virtual int32 GetAC() const { return AC; } + inline virtual int32 GetAC() const { return AC; } inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - inline virtual int GetHaste() const { return Haste; } + inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - int32 GetMaxStat() const; - int32 GetMaxResist() const; - int32 GetMaxSTR() const; - int32 GetMaxSTA() const; - int32 GetMaxDEX() const; - int32 GetMaxAGI() const; - int32 GetMaxINT() const; - int32 GetMaxWIS() const; - int32 GetMaxCHA() const; - int32 GetMaxMR() const; - int32 GetMaxPR() const; - int32 GetMaxDR() const; - int32 GetMaxCR() const; - int32 GetMaxFR() const; - int32 GetMaxCorrup() const; - inline uint8 GetBaseSTR() const { return m_pp.STR; } - inline uint8 GetBaseSTA() const { return m_pp.STA; } - inline uint8 GetBaseCHA() const { return m_pp.CHA; } - inline uint8 GetBaseDEX() const { return m_pp.DEX; } - inline uint8 GetBaseINT() const { return m_pp.INT; } - inline uint8 GetBaseAGI() const { return m_pp.AGI; } - inline uint8 GetBaseWIS() const { return m_pp.WIS; } - inline uint8 GetBaseCorrup() const { return 15; } // Same for all + int32 GetMaxStat() const; + int32 GetMaxResist() const; + int32 GetMaxSTR() const; + int32 GetMaxSTA() const; + int32 GetMaxDEX() const; + int32 GetMaxAGI() const; + int32 GetMaxINT() const; + int32 GetMaxWIS() const; + int32 GetMaxCHA() const; + int32 GetMaxMR() const; + int32 GetMaxPR() const; + int32 GetMaxDR() const; + int32 GetMaxCR() const; + int32 GetMaxFR() const; + int32 GetMaxCorrup() const; + inline uint8 GetBaseSTR() const { return m_pp.STR; } + inline uint8 GetBaseSTA() const { return m_pp.STA; } + inline uint8 GetBaseCHA() const { return m_pp.CHA; } + inline uint8 GetBaseDEX() const { return m_pp.DEX; } + inline uint8 GetBaseINT() const { return m_pp.INT; } + inline uint8 GetBaseAGI() const { return m_pp.AGI; } + inline uint8 GetBaseWIS() const { return m_pp.WIS; } + inline uint8 GetBaseCorrup() const { return 15; } // Same for all - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); @@ -504,29 +504,29 @@ public: virtual void InitializeBuffSlots(); virtual void UninitializeBuffSlots(); - inline const int32 GetBaseHP() const { return base_hp; } + inline const int32 GetBaseHP() const { return base_hp; } uint32 GetWeight() const { return(weight); } inline void RecalcWeight() { weight = CalcCurrentWeight(); } uint32 CalcCurrentWeight(); - inline uint32 GetCopper() const { return m_pp.copper; } - inline uint32 GetSilver() const { return m_pp.silver; } - inline uint32 GetGold() const { return m_pp.gold; } - inline uint32 GetPlatinum() const { return m_pp.platinum; } + inline uint32 GetCopper() const { return m_pp.copper; } + inline uint32 GetSilver() const { return m_pp.silver; } + inline uint32 GetGold() const { return m_pp.gold; } + inline uint32 GetPlatinum() const { return m_pp.platinum; } /*Endurance and such*/ - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 GetEndurance() const {return cur_end;} //This gets our current endurance - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegenCap(); - int32 CalcHPRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 GetEndurance() const {return cur_end;} //This gets our current endurance + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegenCap(); + int32 CalcHPRegenCap(); inline uint8 GetEndurancePercent() { return (uint8)((float)cur_end / (float)max_end * 100.0f); } - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceRegen(); //This Regenerates endurance - void DoEnduranceUpkeep(); //does the endurance upkeep + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceRegen(); //This Regenerates endurance + void DoEnduranceUpkeep(); //does the endurance upkeep //This calculates total Attack Rating to match very close to what the client should show uint32 GetTotalATK(); @@ -538,153 +538,153 @@ public: bool Rampage(); void DurationRampage(uint32 duration); - inline uint32 GetEXP() const { return m_pp.exp; } + inline uint32 GetEXP() const { return m_pp.exp; } - bool UpdateLDoNPoints(int32 points, uint32 theme); - void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } - uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } - void AddPVPPoints(uint32 Points); - uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } - void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } - uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } - void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } - void AddCrystals(uint32 Radiant, uint32 Ebon); - void SendCrystalCounts(); + bool UpdateLDoNPoints(int32 points, uint32 theme); + void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } + uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } + void AddPVPPoints(uint32 Points); + uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } + void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } + uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } + void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } + void AddCrystals(uint32 Radiant, uint32 Ebon); + void SendCrystalCounts(); - void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); - void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); - void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); - void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void SendLeadershipEXPUpdate(); - bool IsLeadershipEXPOn(); - inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } - inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } - inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } - inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); - int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); - void InspectBuffs(Client* Inspector, int Rank); - uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } - uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } - uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } - uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } - uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } + void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); + void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); + void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); + void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void SendLeadershipEXPUpdate(); + bool IsLeadershipEXPOn(); + inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } + inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } + inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } + inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthRegeneration(); + int GroupLeadershipAAOffenseEnhancement(); + void InspectBuffs(Client* Inspector, int Rank); + uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } + uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } + uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } + uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } + uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } virtual void SetLevel(uint8 set_level, bool command = false); - void GoToBind(uint8 bindnum = 0); - void GoToSafeCoords(uint16 zone_id, uint16 instance_id); - void Gate(); - void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); - void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); - uint32 GetStartZone(void); - void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void AssignToInstance(uint16 instance_id); - void RemoveFromInstance(uint16 instance_id); - void WhoAll(); - bool CheckLoreConflict(const Item_Struct* item); - void ChangeLastName(const char* in_lastname); - void GetGroupAAs(GroupLeadershipAA_Struct *into) const; - void GetRaidAAs(RaidLeadershipAA_Struct *into) const; - void ClearGroupAAs(); - void UpdateGroupAAs(int32 points, uint32 type); - void SacrificeConfirm(Client* caster); - void Sacrifice(Client* caster); - void GoToDeath(); - inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } + void GoToBind(uint8 bindnum = 0); + void GoToSafeCoords(uint16 zone_id, uint16 instance_id); + void Gate(); + void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); + void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); + uint32 GetStartZone(void); + void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void AssignToInstance(uint16 instance_id); + void RemoveFromInstance(uint16 instance_id); + void WhoAll(); + bool CheckLoreConflict(const Item_Struct* item); + void ChangeLastName(const char* in_lastname); + void GetGroupAAs(GroupLeadershipAA_Struct *into) const; + void GetRaidAAs(RaidLeadershipAA_Struct *into) const; + void ClearGroupAAs(); + void UpdateGroupAAs(int32 points, uint32 type); + void SacrificeConfirm(Client* caster); + void Sacrifice(Client* caster); + void GoToDeath(); + inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } - FACTION_VALUE GetReverseFactionCon(Mob* iOther); - FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); - int32 GetCharacterFactionLevel(int32 faction_id); - int32 GetModCharacterFactionLevel(int32 faction_id); - void MerchantRejectMessage(Mob *merchant, int primaryfaction); - void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); + FACTION_VALUE GetReverseFactionCon(Mob* iOther); + FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); + int32 GetCharacterFactionLevel(int32 faction_id); + int32 GetModCharacterFactionLevel(int32 faction_id); + void MerchantRejectMessage(Mob *merchant, int primaryfaction); + void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); - void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); - void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); - int32 GetRawItemAC(); - uint16 GetCombinedAC_TEST(); + void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); + void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); + int32 GetRawItemAC(); + uint16 GetCombinedAC_TEST(); - inline uint32 LSAccountID() const { return lsaccountid; } - inline uint32 GetWID() const { return WID; } - inline void SetWID(uint32 iWID) { WID = iWID; } - inline uint32 AccountID() const { return account_id; } + inline uint32 LSAccountID() const { return lsaccountid; } + inline uint32 GetWID() const { return WID; } + inline void SetWID(uint32 iWID) { WID = iWID; } + inline uint32 AccountID() const { return account_id; } inline const char* AccountName()const { return account_name; } - inline int16 Admin() const { return admin; } - inline uint32 CharacterID() const { return character_id; } - void UpdateAdmin(bool iFromDB = true); - void UpdateWho(uint8 remove = 0); - bool GMHideMe(Client* client = 0); + inline int16 Admin() const { return admin; } + inline uint32 CharacterID() const { return character_id; } + void UpdateAdmin(bool iFromDB = true); + void UpdateWho(uint8 remove = 0); + bool GMHideMe(Client* client = 0); inline bool IsInAGuild() const { return(guild_id != GUILD_NONE && guild_id != 0); } inline bool IsInGuild(uint32 in_gid) const { return(in_gid == guild_id && IsInAGuild()); } - inline uint32 GuildID() const { return guild_id; } - inline uint8 GuildRank() const { return guildrank; } - void SendGuildMOTD(bool GetGuildMOTDReply = false); - void SendGuildURL(); - void SendGuildChannel(); - void SendGuildSpawnAppearance(); - void SendGuildRanks(); - void SendGuildMembers(); - void SendGuildList(); - void SendGuildJoin(GuildJoin_Struct* gj); - void RefreshGuildInfo(); + inline uint32 GuildID() const { return guild_id; } + inline uint8 GuildRank() const { return guildrank; } + void SendGuildMOTD(bool GetGuildMOTDReply = false); + void SendGuildURL(); + void SendGuildChannel(); + void SendGuildSpawnAppearance(); + void SendGuildRanks(); + void SendGuildMembers(); + void SendGuildList(); + void SendGuildJoin(GuildJoin_Struct* gj); + void RefreshGuildInfo(); - void SendManaUpdatePacket(); - void SendManaUpdate(); - void SendEnduranceUpdate(); - uint8 GetFace() const { return m_pp.face; } - void WhoAll(Who_All_Struct* whom); - void FriendsWho(char *FriendsString); + void SendManaUpdatePacket(); + void SendManaUpdate(); + void SendEnduranceUpdate(); + uint8 GetFace() const { return m_pp.face; } + void WhoAll(Who_All_Struct* whom); + void FriendsWho(char *FriendsString); - void Stun(int duration); - void UnStun(); - void ReadBook(BookRequest_Struct *book); - void QuestReadBook(const char* text, uint8 type); - void SendClientMoneyUpdate(uint8 type,uint32 amount); - void SendMoneyUpdate(); - bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); - void AddMoneyToPP(uint64 copper,bool updateclient); - void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); - bool HasMoney(uint64 copper); - uint64 GetCarriedMoney(); - uint64 GetAllMoney(); + void Stun(int duration); + void UnStun(); + void ReadBook(BookRequest_Struct *book); + void QuestReadBook(const char* text, uint8 type); + void SendClientMoneyUpdate(uint8 type,uint32 amount); + void SendMoneyUpdate(); + bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); + void AddMoneyToPP(uint64 copper,bool updateclient); + void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); + bool HasMoney(uint64 copper); + uint64 GetCarriedMoney(); + uint64 GetAllMoney(); - bool IsDiscovered(uint32 itemid); - void DiscoverItem(uint32 itemid); + bool IsDiscovered(uint32 itemid); + void DiscoverItem(uint32 itemid); - bool TGB() const { return tgb; } + bool TGB() const { return tgb; } - void OnDisconnect(bool hard_disconnect); + void OnDisconnect(bool hard_disconnect); - uint16 GetSkillPoints() { return m_pp.points;} - void SetSkillPoints(int inp) { m_pp.points = inp;} + uint16 GetSkillPoints() { return m_pp.points;} + void SetSkillPoints(int inp) { m_pp.points = inp;} - void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } - void IncreaseLanguageSkill(int skill_id, int value = 1); + void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } + void IncreaseLanguageSkill(int skill_id, int value = 1); virtual uint16 GetSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return((itembonuses.skillmod[skill_id] > 0) ? m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100 : m_pp.skills[skill_id]); } return 0; } - uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - void SetSkill(SkillUseTypes skill_num, uint16 value); - void AddSkill(SkillUseTypes skillid, uint16 value); - void CheckSpecializeIncrease(uint16 spell_id); - void CheckSongSkillIncrease(uint16 spell_id); - bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); - void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); - void SetLanguageSkill(int langid, int value); - void SetHoTT(uint32 mobid); - void ShowSkillsWindow(); - void SendStatsWindow(Client* client, bool use_window); + uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + void SetSkill(SkillUseTypes skill_num, uint16 value); + void AddSkill(SkillUseTypes skillid, uint16 value); + void CheckSpecializeIncrease(uint16 spell_id); + void CheckSongSkillIncrease(uint16 spell_id); + bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); + void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); + void SetLanguageSkill(int langid, int value); + void SetHoTT(uint32 mobid); + void ShowSkillsWindow(); + void SendStatsWindow(Client* client, bool use_window); - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } - uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); void TradeskillSearchResults(const std::string query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); @@ -692,11 +692,11 @@ public: void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); void GMKill(); - inline bool IsMedding() const {return medding;} + inline bool IsMedding() const {return medding;} inline uint16 GetDuelTarget() const { return duel_target; } - inline bool IsDueling() const { return duelaccepted; } - inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } - inline void SetDueling(bool duel) { duelaccepted = duel; } + inline bool IsDueling() const { return duelaccepted; } + inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } + inline void SetDueling(bool duel) { duelaccepted = duel; } // use this one instead void MemSpell(uint16 spell_id, int slot, bool update_client = true); void UnmemSpell(int slot, bool update_client = true); @@ -709,11 +709,11 @@ public: bool SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID); uint32 GetCharMaxLevelFromQGlobal(); - inline bool IsSitting() const {return (playeraction == 1);} - inline bool IsBecomeNPC() const { return npcflag; } - inline uint8 GetBecomeNPCLevel() const { return npclevel; } - inline void SetBecomeNPC(bool flag) { npcflag = flag; } - inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } + inline bool IsSitting() const {return (playeraction == 1);} + inline bool IsBecomeNPC() const { return npcflag; } + inline uint8 GetBecomeNPCLevel() const { return npclevel; } + inline void SetBecomeNPC(bool flag) { npcflag = flag; } + inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } void SetFeigned(bool in_feigned); /// this cures timing issues cuz dead animation isn't done but server side feigning is? inline bool GetFeigned() const { return(feigned); } @@ -721,7 +721,7 @@ public: #ifdef PACKET_PROFILER void DumpPacketProfile() { if(eqs) eqs->DumpPacketProfile(); } #endif - uint32 GetEquipment(uint8 material_slot) const; // returns item id + uint32 GetEquipment(uint8 material_slot) const; // returns item id uint32 GetEquipmentColor(uint8 material_slot) const; inline bool AutoSplitEnabled() { return m_pp.autosplit != 0; } @@ -735,17 +735,17 @@ public: bool BindWound(Mob* bindmob, bool start, bool fail = false); void SetTradeskillObject(Object* object) { m_tradeskill_object = object; } Object* GetTradeskillObject() { return m_tradeskill_object; } - void SendTributes(); - void SendGuildTributes(); - void DoTributeUpdate(); - void SendTributeDetails(uint32 client_id, uint32 tribute_id); - int32 TributeItem(uint32 slot, uint32 quantity); - int32 TributeMoney(uint32 platinum); - void AddTributePoints(int32 ammount); - void ChangeTributeSettings(TributeInfo_Struct *t); - void SendTributeTimer(); - void ToggleTribute(bool enabled); - void SendPathPacket(std::vector &path); + void SendTributes(); + void SendGuildTributes(); + void DoTributeUpdate(); + void SendTributeDetails(uint32 client_id, uint32 tribute_id); + int32 TributeItem(uint32 slot, uint32 quantity); + int32 TributeMoney(uint32 platinum); + void AddTributePoints(int32 ammount); + void ChangeTributeSettings(TributeInfo_Struct *t); + void SendTributeTimer(); + void ToggleTribute(bool enabled); + void SendPathPacket(std::vector &path); inline PTimerList &GetPTimers() { return(p_timers); } @@ -757,9 +757,9 @@ public: void BuyAA(AA_Action* action); //this function is used by some AA stuff void MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing); - void SetAATitle(const char *Title); - void SetTitleSuffix(const char *txt); - inline uint32 GetMaxAAXP(void) const { return max_AAXP; } + void SetAATitle(const char *Title); + void SetTitleSuffix(const char *txt); + inline uint32 GetMaxAAXP(void) const { return max_AAXP; } inline uint32 GetAAXP() const { return m_pp.expAA; } void SendAAStats(); void SendAATable(); @@ -791,93 +791,93 @@ public: // Item methods void EVENT_ITEM_ScriptStopReturn(); - uint32 NukeItem(uint32 itemnum, uint8 where_to_check = - (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); - void SetTint(int16 slot_id, uint32 color); - void SetTint(int16 slot_id, Color_Struct& color); - void SetMaterial(int16 slot_id, uint32 item_id); - void Undye(); - int32 GetItemIDAt(int16 slot_id); - int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); - bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); - bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); - void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); - bool SwapItem(MoveItem_Struct* move_in); - void SwapItemResync(MoveItem_Struct* move_slots); - void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); - void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); - bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); - void SetStats(uint8 type,int16 set_val); - void IncStats(uint8 type,int16 increase_val); - void DropItem(int16 slot_id); - bool MakeItemLink(char* &ret_link, const ItemInst* inst); - int GetItemLinkHash(const ItemInst* inst); - void SendItemLink(const ItemInst* inst, bool sendtoall=false); - void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); - void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool IsValidSlot(uint32 slot); - bool IsBankSlot(uint32 slot); + uint32 NukeItem(uint32 itemnum, uint8 where_to_check = + (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); + void SetTint(int16 slot_id, uint32 color); + void SetTint(int16 slot_id, Color_Struct& color); + void SetMaterial(int16 slot_id, uint32 item_id); + void Undye(); + int32 GetItemIDAt(int16 slot_id); + int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); + bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); + bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); + void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); + bool SwapItem(MoveItem_Struct* move_in); + void SwapItemResync(MoveItem_Struct* move_slots); + void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); + void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); + bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); + void SetStats(uint8 type,int16 set_val); + void IncStats(uint8 type,int16 increase_val); + void DropItem(int16 slot_id); + bool MakeItemLink(char* &ret_link, const ItemInst* inst); + int GetItemLinkHash(const ItemInst* inst); + void SendItemLink(const ItemInst* inst, bool sendtoall=false); + void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); + void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + bool IsValidSlot(uint32 slot); + bool IsBankSlot(uint32 slot); - inline bool IsTrader() const { return(Trader); } - inline bool IsBuyer() const { return(Buyer); } - eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } - void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } + inline bool IsTrader() const { return(Trader); } + inline bool IsBuyer() const { return(Buyer); } + eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } + void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } - void BreakInvis(); - void LeaveGroup(); + void BreakInvis(); + void LeaveGroup(); - bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} - bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} - int32 GetHunger() const { return m_pp.hunger_level; } - int32 GetThirst() const { return m_pp.thirst_level; } - void SetHunger(int32 in_hunger); - void SetThirst(int32 in_thirst); - void SetConsumption(int32 in_hunger, int32 in_thirst); + bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} + bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} +int32 GetHunger() const { return m_pp.hunger_level; } +int32 GetThirst() const { return m_pp.thirst_level; } +void SetHunger(int32 in_hunger); +void SetThirst(int32 in_thirst); +void SetConsumption(int32 in_hunger, int32 in_thirst); - bool CheckTradeLoreConflict(Client* other); - void LinkDead(); - void Insight(uint32 t_id); - bool CheckDoubleAttack(bool tripleAttack = false); - bool CheckDoubleRangedAttack(); + bool CheckTradeLoreConflict(Client* other); + void LinkDead(); + void Insight(uint32 t_id); + bool CheckDoubleAttack(bool tripleAttack = false); + bool CheckDoubleRangedAttack(); //remove charges/multiple objects from inventory: - //bool DecreaseByType(uint32 type, uint8 amt); - bool DecreaseByID(uint32 type, uint8 amt); - uint8 SlotConvert2(uint8 slot); //Maybe not needed. - void Escape(); //AA Escape - void RemoveNoRent(bool client_update = true); - void RemoveDuplicateLore(bool client_update = true); - void MoveSlotNotAllowed(bool client_update = true); - virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); - virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); - void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); + //bool DecreaseByType(uint32 type, uint8 amt); + bool DecreaseByID(uint32 type, uint8 amt); + uint8 SlotConvert2(uint8 slot); //Maybe not needed. + void Escape(); //AA Escape + void RemoveNoRent(bool client_update = true); + void RemoveDuplicateLore(bool client_update = true); + void MoveSlotNotAllowed(bool client_update = true); + virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); + virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); + void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); - void SetZoneFlag(uint32 zone_id); - void ClearZoneFlag(uint32 zone_id); - bool HasZoneFlag(uint32 zone_id) const; - void SendZoneFlagInfo(Client *to) const; - void LoadZoneFlags(); + void SetZoneFlag(uint32 zone_id); + void ClearZoneFlag(uint32 zone_id); + bool HasZoneFlag(uint32 zone_id) const; + void SendZoneFlagInfo(Client *to) const; + void LoadZoneFlags(); - void ChangeSQLLog(const char *file); - void LogSQL(const char *fmt, ...); - bool CanFish(); - void GoFish(); - void ForageItem(bool guarantee = false); + void ChangeSQLLog(const char *file); + void LogSQL(const char *fmt, ...); + bool CanFish(); + void GoFish(); + void ForageItem(bool guarantee = false); //Calculate vendor price modifier based on CHA: (reverse==selling) - float CalcPriceMod(Mob* other = 0, bool reverse = false); - void ResetTrade(); - void DropInst(const ItemInst* inst); - bool TrainDiscipline(uint32 itemid); - void SendDisciplineUpdate(); - bool UseDiscipline(uint32 spell_id, uint32 target); + float CalcPriceMod(Mob* other = 0, bool reverse = false); + void ResetTrade(); + void DropInst(const ItemInst* inst); + bool TrainDiscipline(uint32 itemid); + void SendDisciplineUpdate(); + bool UseDiscipline(uint32 spell_id, uint32 target); - bool CheckTitle(int titleset); - void EnableTitle(int titleset); - void RemoveTitle(int titleset); + bool CheckTitle(int titleset); + void EnableTitle(int titleset); + void RemoveTitle(int titleset); - void EnteringMessages(Client* client); - void SendRules(Client* client); + void EnteringMessages(Client* client); + void SendRules(Client* client); std::list consent_list; //Anti-Cheat Stuff @@ -904,28 +904,28 @@ public: void SendBuffDurationPacket(Buffs_Struct &buff); void SendBuffNumHitPacket(Buffs_Struct &buff, int slot); - void ProcessInspectRequest(Client* requestee, Client* requester); - bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } - int FindSpellBookSlotBySpellID(uint16 spellid); - int GetNextAvailableSpellBookSlot(int starting_slot = 0); + void ProcessInspectRequest(Client* requestee, Client* requester); + bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } + int FindSpellBookSlotBySpellID(uint16 spellid); + int GetNextAvailableSpellBookSlot(int starting_slot = 0); inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; } inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); } - uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); - void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); - void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); - bool PendingTranslocate; - time_t TranslocateTime; - bool PendingSacrifice; - std::string SacrificeCaster; - struct Translocate_Struct PendingTranslocateData; - void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); + uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); + void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); + void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); + bool PendingTranslocate; + time_t TranslocateTime; + bool PendingSacrifice; + std::string SacrificeCaster; + struct Translocate_Struct PendingTranslocateData; + void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); // Task System Methods - void LoadClientTaskState(); - void RemoveClientTaskState(); - void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); - void SendTaskFailed(int TaskID, int TaskIndex); - void SendTaskComplete(int TaskIndex); + void LoadClientTaskState(); + void RemoveClientTaskState(); + void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); + void SendTaskFailed(int TaskID, int TaskIndex); + void SendTaskComplete(int TaskIndex); inline void CancelTask(int TaskIndex) { if(taskstate) taskstate->CancelTask(this, TaskIndex); } @@ -1047,7 +1047,7 @@ public: void HandleLDoNSenseTraps(NPC *target, uint16 skill, uint8 type); void HandleLDoNDisarm(NPC *target, uint16 skill, uint8 type); void HandleLDoNPickLock(NPC *target, uint16 skill, uint8 type); - int LDoNChest_SkillCheck(NPC *target, int skill); + int LDoNChest_SkillCheck(NPC *target, int skill); void MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 count=1); @@ -1087,7 +1087,7 @@ public: inline bool GetPendingGuildInvitation() { return PendingGuildInvitation; } void LocateCorpse(); void SendTargetCommand(uint32 EntityID); - bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); + bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); void HandleRespawnFromHover(uint32 Option); bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); } std::list respawn_options; @@ -1129,12 +1129,13 @@ public: void RemoveAutoXTargets(); void ShowXTargets(Client *c); void InitializeMercInfo(); + bool CheckCanSpawnMerc(uint32 template_id); bool CheckCanHireMerc(Mob* merchant, uint32 template_id); bool CheckCanRetainMerc(uint32 upkeep); bool CheckCanUnsuspendMerc(); bool CheckCanDismissMerc(); - inline uint32 GetMercID() const { return mercid; } - inline uint8 GetMercSlot() const { return mercSlot; } + inline uint32 GetMercID() const { return mercid; } + inline uint8 GetMercSlot() const { return mercSlot; } void SetMercID( uint32 newmercid) { mercid = newmercid; } void SetMercSlot( uint8 newmercslot) { mercSlot = newmercslot; } Merc* GetMerc(); @@ -1142,9 +1143,11 @@ public: MercInfo& GetMercInfo() { return m_mercinfo[mercSlot]; } uint8 GetNumMercs(); void SetMerc(Merc* newmerc); + void SendMercResponsePackets(uint32 ResponseType); void SendMercMerchantResponsePacket(int32 response_type); void SendMercenaryUnknownPacket(uint8 type); void SendMercenaryUnsuspendPacket(uint8 type); + void SendMercTimer(Merc* merc = nullptr); void SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspended_time, int32 update_interval = 900000, int32 unk01 = 180000); void SendMercSuspendResponsePacket(uint32 suspended_time); void SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02); @@ -1229,10 +1232,10 @@ protected: void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true); bool client_data_loaded; - int16 GetFocusEffect(focusType type, uint16 spell_id); - int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); + int16 GetFocusEffect(focusType type, uint16 spell_id); + int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); - Mob* bind_sight_target; + Mob* bind_sight_target; Map::Vertex aa_los_me; Map::Vertex aa_los_them; @@ -1257,52 +1260,52 @@ protected: private: eqFilterMode ClientFilters[_FilterCount]; - int32 HandlePacket(const EQApplicationPacket *app); - void OPTGB(const EQApplicationPacket *app); - void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); - void OPMemorizeSpell(const EQApplicationPacket *app); - void OPMoveCoin(const EQApplicationPacket* app); - void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); - void OPGMTraining(const EQApplicationPacket *app); - void OPGMEndTraining(const EQApplicationPacket *app); - void OPGMTrainSkill(const EQApplicationPacket *app); - void OPGMSummon(const EQApplicationPacket *app); - void OPCombatAbility(const EQApplicationPacket *app); + int32 HandlePacket(const EQApplicationPacket *app); + void OPTGB(const EQApplicationPacket *app); + void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); + void OPMemorizeSpell(const EQApplicationPacket *app); + void OPMoveCoin(const EQApplicationPacket* app); + void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); + void OPGMTraining(const EQApplicationPacket *app); + void OPGMEndTraining(const EQApplicationPacket *app); + void OPGMTrainSkill(const EQApplicationPacket *app); + void OPGMSummon(const EQApplicationPacket *app); + void OPCombatAbility(const EQApplicationPacket *app); // Bandolier Methods - void CreateBandolier(const EQApplicationPacket *app); - void RemoveBandolier(const EQApplicationPacket *app); - void SetBandolier(const EQApplicationPacket *app); + void CreateBandolier(const EQApplicationPacket *app); + void RemoveBandolier(const EQApplicationPacket *app); + void SetBandolier(const EQApplicationPacket *app); - void HandleTraderPriceUpdate(const EQApplicationPacket *app); + void HandleTraderPriceUpdate(const EQApplicationPacket *app); - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 CalcATK(); - int32 CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 CalcATK(); + int32 CalcHaste(); - int32 CalcAlcoholPhysicalEffect(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcAlcoholPhysicalEffect(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 CalcHPRegen(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - uint32 GetClassHPFactor(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 CalcHPRegen(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + uint32 GetClassHPFactor(); void DoHPRegen(); void DoManaRegen(); void DoStaminaUpdate(); @@ -1314,75 +1317,75 @@ private: EQStreamInterface* eqs; - uint32 ip; - uint16 port; - CLIENT_CONN_STATUS client_state; - uint32 character_id; - uint32 WID; - uint32 account_id; - char account_name[30]; - uint32 lsaccountid; - char lskey[30]; - int16 admin; - uint32 guild_id; - uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK - bool GuildBanker; - uint16 duel_target; - bool duelaccepted; + uint32 ip; + uint16 port; + CLIENT_CONN_STATUS client_state; + uint32 character_id; + uint32 WID; + uint32 account_id; + char account_name[30]; + uint32 lsaccountid; + char lskey[30]; + int16 admin; + uint32 guild_id; + uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK + bool GuildBanker; + uint16 duel_target; + bool duelaccepted; std::list keyring; - bool tellsoff; // GM /toggle - bool gmhideme; - bool LFG; - bool LFP; - uint8 LFGFromLevel; - uint8 LFGToLevel; - bool LFGMatchFilter; - char LFGComments[64]; - bool AFK; - bool auto_attack; - bool auto_fire; - uint8 gmspeed; - bool medding; - uint16 horseId; - bool revoked; - uint32 pQueuedSaveWorkID; - uint16 pClientSideTarget; - uint32 weight; - bool berserk; - bool dead; - uint16 BoatID; - uint16 TrackingID; - uint16 CustomerID; - uint32 account_creation; - uint8 firstlogon; - uint32 mercid; // current merc - uint8 mercSlot; // selected merc slot - bool Trader; - bool Buyer; - std::string BuyerWelcomeMessage; - bool AbilityTimer; + bool tellsoff; // GM /toggle + bool gmhideme; + bool LFG; + bool LFP; + uint8 LFGFromLevel; + uint8 LFGToLevel; + bool LFGMatchFilter; + char LFGComments[64]; + bool AFK; + bool auto_attack; + bool auto_fire; + uint8 gmspeed; + bool medding; + uint16 horseId; + bool revoked; + uint32 pQueuedSaveWorkID; + uint16 pClientSideTarget; + uint32 weight; + bool berserk; + bool dead; + uint16 BoatID; + uint16 TrackingID; + uint16 CustomerID; + uint32 account_creation; + uint8 firstlogon; + uint32 mercid; // current merc + uint8 mercSlot; // selected merc slot + bool Trader; + bool Buyer; + std::string BuyerWelcomeMessage; + bool AbilityTimer; int Haste; //precalced value - int32 max_end; - int32 cur_end; + int32 max_end; + int32 cur_end; - PlayerProfile_Struct m_pp; - ExtendedProfile_Struct m_epp; - Inventory m_inv; - Object* m_tradeskill_object; - PetInfo m_petinfo; // current pet data, used while loading from and saving to DB - PetInfo m_suspendedminion; // pet data for our suspended minion. - MercInfo m_mercinfo[MAXMERCS]; // current mercenary - InspectMessage_Struct m_inspect_message; + PlayerProfile_Struct m_pp; + ExtendedProfile_Struct m_epp; + Inventory m_inv; + Object* m_tradeskill_object; + PetInfo m_petinfo; // current pet data, used while loading from and saving to DB + PetInfo m_suspendedminion; // pet data for our suspended minion. + MercInfo m_mercinfo[MAXMERCS]; // current mercenary + InspectMessage_Struct m_inspect_message; void NPCSpawn(const Seperator* sep); uint32 GetEXPForLevel(uint16 level); - bool CanBeInZone(); - void SendLogoutPackets(); - bool AddPacket(const EQApplicationPacket *, bool); - bool AddPacket(EQApplicationPacket**, bool); - bool SendAllPackets(); + bool CanBeInZone(); + void SendLogoutPackets(); + bool AddPacket(const EQApplicationPacket *, bool); + bool AddPacket(EQApplicationPacket**, bool); + bool SendAllPackets(); LinkedList clientpackets; //Zoning related stuff @@ -1391,62 +1394,62 @@ private: void DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r); void ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm); void ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - float zonesummon_x; - float zonesummon_y; - float zonesummon_z; - uint16 zonesummon_id; - uint8 zonesummon_ignorerestrictions; + float zonesummon_x; + float zonesummon_y; + float zonesummon_z; + uint16 zonesummon_id; + uint8 zonesummon_ignorerestrictions; ZoneMode zone_mode; - Timer position_timer; - uint8 position_timer_counter; + Timer position_timer; + uint8 position_timer_counter; - PTimerList p_timers; //persistent timers - Timer hpupdate_timer; - Timer camp_timer; - Timer process_timer; - Timer stamina_timer; - Timer zoneinpacket_timer; - Timer linkdead_timer; - Timer dead_timer; - Timer global_channel_timer; - Timer shield_timer; - Timer fishing_timer; - Timer endupkeep_timer; - Timer forget_timer; // our 2 min everybody forgets you timer - Timer autosave_timer; + PTimerList p_timers; //persistent timers + Timer hpupdate_timer; + Timer camp_timer; + Timer process_timer; + Timer stamina_timer; + Timer zoneinpacket_timer; + Timer linkdead_timer; + Timer dead_timer; + Timer global_channel_timer; + Timer shield_timer; + Timer fishing_timer; + Timer endupkeep_timer; + Timer forget_timer; // our 2 min everybody forgets you timer + Timer autosave_timer; #ifdef REVERSE_AGGRO - Timer scanarea_timer; + Timer scanarea_timer; #endif - Timer tribute_timer; + Timer tribute_timer; - Timer proximity_timer; - Timer TaskPeriodic_Timer; - Timer charm_update_timer; - Timer rest_timer; - Timer charm_class_attacks_timer; - Timer charm_cast_timer; - Timer qglobal_purge_timer; - Timer TrackingTimer; - Timer RespawnFromHoverTimer; - Timer merc_timer; + Timer proximity_timer; + Timer TaskPeriodic_Timer; + Timer charm_update_timer; + Timer rest_timer; + Timer charm_class_attacks_timer; + Timer charm_cast_timer; + Timer qglobal_purge_timer; + Timer TrackingTimer; + Timer RespawnFromHoverTimer; + Timer merc_timer; - float proximity_x; - float proximity_y; - float proximity_z; + float proximity_x; + float proximity_y; + float proximity_z; - void BulkSendInventoryItems(); + void BulkSendInventoryItems(); faction_map factionvalues; uint32 tribute_master_id; FILE *SQL_log; - uint32 max_AAXP; - uint32 staminacount; - AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile + uint32 max_AAXP; + uint32 staminacount; + AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile std::map aa_points; bool npcflag; uint8 npclevel; @@ -1454,14 +1457,14 @@ private: bool zoning; bool tgb; bool instalog; - int32 last_reported_mana; - int32 last_reported_endur; + int32 last_reported_mana; + int32 last_reported_endur; unsigned int AggroCount; // How many mobs are aggro on us. - unsigned int RestRegenHP; - unsigned int RestRegenMana; - unsigned int RestRegenEndurance; + unsigned int RestRegenHP; + unsigned int RestRegenMana; + unsigned int RestRegenEndurance; bool EngagedRaidTarget; uint32 SavedRaidRestTimer; @@ -1479,7 +1482,7 @@ private: uint32 AttemptedMessages; EQClientVersion ClientVersion; - uint32 ClientVersionBit; + uint32 ClientVersionBit; int XPRate; @@ -1494,18 +1497,18 @@ private: //Connecting debug code. enum { //connecting states, used for debugging only - NoPacketsReceived, //havent gotten anything - //this is the point where the client changes to the loading screen - ReceivedZoneEntry, //got the first packet, loading up PP - PlayerProfileLoaded, //our DB work is done, sending it - ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather - //this is the point where the client shows a status bar zoning in - NewZoneRequested, //received and sent new zone request - ClientSpawnRequested, //client sent ReqClientSpawn - ZoneContentsSent, //objects, doors, zone points - ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc - //this is the point where the client releases the mouse - ClientConnectFinished //client finally moved to finished state, were done here + NoPacketsReceived, //havent gotten anything + //this is the point where the client changes to the loading screen + ReceivedZoneEntry, //got the first packet, loading up PP + PlayerProfileLoaded, //our DB work is done, sending it + ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather + //this is the point where the client shows a status bar zoning in + NewZoneRequested, //received and sent new zone request + ClientSpawnRequested, //client sent ReqClientSpawn + ZoneContentsSent, //objects, doors, zone points + ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc + //this is the point where the client releases the mouse + ClientConnectFinished //client finally moved to finished state, were done here } conn_state; void ReportConnectingState(); @@ -1513,8 +1516,8 @@ private: bool PendingGuildInvitation; int PendingRezzXP; uint32 PendingRezzDBID; - uint16 PendingRezzSpellID; // Only used for resurrect while hovering. - std::string PendingRezzCorpseName; // Only used for resurrect while hovering. + uint16 PendingRezzSpellID; // Only used for resurrect while hovering. + std::string PendingRezzCorpseName; // Only used for resurrect while hovering. std::set PlayerBlockedBuffs; std::set PetBlockedBuffs; @@ -1538,4 +1541,3 @@ private: }; #endif - diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 51affb7dd..15c4f3497 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9699,17 +9699,13 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); // Handle the dismiss here... - if (GetMercID()) { - Merc* merc = GetMerc(); - - if (merc) { - if (CheckCanDismissMerc()) { - merc->Dismiss(); - } + Merc* merc = GetMerc(); + if (merc) { + if (CheckCanDismissMerc()) { + merc->Dismiss(); } } - //SendMercMerchantResponsePacket(10); } void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) @@ -9749,21 +9745,22 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) return; } - if (RuleB(Mercs, ChargeMercPurchaseCost)) { - uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold - TakeMoneyFromPP(cost, true); - } - // Set time remaining to max on Hire GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS); // Get merc, assign it to client & spawn Merc* merc = Merc::LoadMerc(this, merc_template, merchant_id, false); - if (merc) { + if (merc) + { SpawnMerc(merc, true); merc->Save(); + if (RuleB(Mercs, ChargeMercPurchaseCost)) { + uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold + TakeMoneyFromPP(cost, true); + } + // 0 is approved hire request SendMercMerchantResponsePacket(0); } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c6265accf..e26dcd2e3 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -78,7 +78,8 @@ bool Client::Process() { if(Connected() || IsLD()) { // try to send all packets that weren't sent before - if(!IsLD() && zoneinpacket_timer.Check()){ + if(!IsLD() && zoneinpacket_timer.Check()) + { SendAllPackets(); } @@ -145,7 +146,9 @@ bool Client::Process() { if(mana_timer.Check()) SendManaUpdatePacket(); - if(dead && dead_timer.Check()) { + + if(dead && dead_timer.Check()) + { database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId)); m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zoneInstance = 0; @@ -176,14 +179,16 @@ bool Client::Process() { if(TaskPeriodic_Timer.Check() && taskstate) taskstate->TaskPeriodicChecks(this); - if(linkdead_timer.Check()){ + if(linkdead_timer.Check()) + { + LeaveGroup(); Save(); if (GetMerc()) { GetMerc()->Save(); GetMerc()->Depop(); } - LeaveGroup(); + Raid *myraid = entity_list.GetRaidByClient(this); if (myraid) { @@ -192,7 +197,8 @@ bool Client::Process() { return false; //delete client } - if (camp_timer.Check()) { + if (camp_timer.Check()) + { LeaveGroup(); Save(); if (GetMerc()) @@ -228,20 +234,22 @@ bool Client::Process() { } else { if(!ApplyNextBardPulse(bardsong, song_target, bardsong_slot)) InterruptSpell(SONG_ENDS_ABRUPTLY, 0x121, bardsong); -// SpellFinished(bardsong, bardsong_target, bardsong_slot, spells[bardsong].mana); + //SpellFinished(bardsong, bardsong_target, bardsong_slot, spells[bardsong].mana); } } if(GetMerc()) { - UpdateMercTimer(); + UpdateMercTimer(); } if(GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended) { - if(p_timers.Expired(&database, pTimerMercSuspend, false)) { - CheckMercSuspendTimer(); - } + //CheckMercSuspendTimer(); + if(p_timers.Expired(&database, pTimerMercSuspend, false)) + { + CheckMercSuspendTimer(); + } } if(IsAIControlled()) @@ -715,16 +723,13 @@ bool Client::Process() { } #endif - if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED))) { + if (client_state != CLIENT_LINKDEAD && (client_state == CLIENT_ERROR || client_state == DISCONNECTED || client_state == CLIENT_KICKED || !eqs->CheckState(ESTABLISHED))) + { //client logged out or errored out //ResetTrade(); if (client_state != CLIENT_KICKED) { Save(); } - if (GetMerc()) - { - GetMerc()->Depop(); - } client_state = CLIENT_LINKDEAD; if (zoning || instalog || GetGM()) @@ -732,23 +737,32 @@ bool Client::Process() { Group *mygroup = GetGroup(); if (mygroup) { - if (!zoning) { + if (!zoning) + { entity_list.MessageGroup(this, true, 15, "%s logged out.", GetName()); - mygroup->DelMember(this); - } else { + LeaveGroup(); + } + else + { entity_list.MessageGroup(this, true, 15, "%s left the zone.", GetName()); mygroup->MemberZoned(this); + if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == mygroup) + { + mygroup->DelMember(GetMerc()); + } } } Raid *myraid = entity_list.GetRaidByClient(this); if (myraid) { - if (!zoning) { + if (!zoning) + { //entity_list.MessageGroup(this,true,15,"%s logged out.",GetName()); - //mygroup->DelMember(this); myraid->MemberZoned(this); - } else { + } + else + { //entity_list.MessageGroup(this,true,15,"%s left the zone.",GetName()); myraid->MemberZoned(this); } @@ -774,8 +788,14 @@ bool Client::Process() { /* Just a set of actions preformed all over in Client::Process */ void Client::OnDisconnect(bool hard_disconnect) { - if(hard_disconnect) { - LeaveGroup(); + if(hard_disconnect) + { + LeaveGroup(); + if (GetMerc()) + { + GetMerc()->Save(); + GetMerc()->Depop(); + } Raid *MyRaid = entity_list.GetRaidByClient(this); if (MyRaid) @@ -791,7 +811,8 @@ void Client::OnDisconnect(bool hard_disconnect) { } Mob *Other = trade->With(); - if(Other) { + if(Other) + { mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); FinishTrade(this); diff --git a/zone/groups.cpp b/zone/groups.cpp index ae51f51c9..fb1f4204e 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1069,14 +1069,29 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co void Client::LeaveGroup() { Group *g = GetGroup(); - if(g) { + if(g) + { if(g->GroupCount() < 3) + { g->DisbandGroup(); + } else + { g->DelMember(this); - } else { + if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g) + { + g->DelMember(GetMerc()); + } + } + } + else + { //force things a little database.SetGroupID(GetName(), 0, CharacterID()); + if (GetMerc()) + { + database.SetGroupID(GetMerc()->GetName(), 0, CharacterID()); + } } isgrouped = false; diff --git a/zone/merc.cpp b/zone/merc.cpp index e8c2b7ed9..4984fcca6 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -17,7 +17,7 @@ extern volatile bool ZoneLoaded; Merc::Merc(const NPCType* d, float x, float y, float z, float heading) - : NPC(d, 0, x, y, z, heading, 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000) +: NPC(d, 0, x, y, z, heading, 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000) { base_hp = d->max_hp; base_mana = d->Mana; @@ -75,7 +75,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) Merc::~Merc() { AI_Stop(); - entity_list.RemoveMerc(this->GetID()); + //entity_list.RemoveMerc(this->GetID()); UninitializeBuffSlots(); } @@ -117,50 +117,50 @@ void Merc::GetMercSize() { float MercSize = GetSize(); switch(this->GetRace()) { - case 1: // Humans have no race bonus - break; - case 2: // Barbarian - MercSize = 7.0; - break; - case 3: // Erudite - break; - case 4: // Wood Elf - MercSize = 5.0; - break; - case 5: // High Elf - break; - case 6: // Dark Elf - MercSize = 5.0; - break; - case 7: // Half Elf - MercSize = 5.5; - break; - case 8: // Dwarf - MercSize = 4.0; - break; - case 9: // Troll - MercSize = 8.0; - break; - case 10: // Ogre - MercSize = 9.0; - break; - case 11: // Halfling - MercSize = 3.5; - break; - case 12: // Gnome - MercSize = 3.0; - break; - case 128: // Iksar - break; - case 130: // Vah Shir - MercSize = 7.0; - break; - case 330: // Froglok - MercSize = 5.0; - break; - case 522: // Drakkin - MercSize = 5.0; - break; + case 1: // Humans have no race bonus + break; + case 2: // Barbarian + MercSize = 7.0; + break; + case 3: // Erudite + break; + case 4: // Wood Elf + MercSize = 5.0; + break; + case 5: // High Elf + break; + case 6: // Dark Elf + MercSize = 5.0; + break; + case 7: // Half Elf + MercSize = 5.5; + break; + case 8: // Dwarf + MercSize = 4.0; + break; + case 9: // Troll + MercSize = 8.0; + break; + case 10: // Ogre + MercSize = 9.0; + break; + case 11: // Halfling + MercSize = 3.5; + break; + case 12: // Gnome + MercSize = 3.0; + break; + case 128: // Iksar + break; + case 130: // Vah Shir + MercSize = 7.0; + break; + case 330: // Froglok + MercSize = 5.0; + break; + case 522: // Drakkin + MercSize = 5.0; + break; } this->size = MercSize; @@ -277,9 +277,9 @@ void Merc::CalcItemBonuses(StatBonuses* newbon) { //Power Source Slot /*if (GetClientVersion() >= EQClientSoF) { - const ItemInst* inst = m_inv[MainPowerSource]; - if(inst) - AddItemBonuses(inst, newbon); + const ItemInst* inst = m_inv[MainPowerSource]; + if(inst) + AddItemBonuses(inst, newbon); }*/ // Caps @@ -635,14 +635,14 @@ int Merc::GroupLeadershipAAHealthEnhancement() switch(g->GetLeadershipAA(groupAAHealthEnhancement)) { - case 0: - return 0; - case 1: - return 30; - case 2: - return 60; - case 3: - return 100; + case 0: + return 0; + case 1: + return 30; + case 2: + return 60; + case 3: + return 100; } return 0; @@ -657,14 +657,14 @@ int Merc::GroupLeadershipAAManaEnhancement() switch(g->GetLeadershipAA(groupAAManaEnhancement)) { - case 0: - return 0; - case 1: - return 30; - case 2: - return 60; - case 3: - return 100; + case 0: + return 0; + case 1: + return 30; + case 2: + return 60; + case 3: + return 100; } return 0; @@ -679,14 +679,14 @@ int Merc::GroupLeadershipAAHealthRegeneration() switch(g->GetLeadershipAA(groupAAHealthRegeneration)) { - case 0: - return 0; - case 1: - return 4; - case 2: - return 6; - case 3: - return 8; + case 0: + return 0; + case 1: + return 4; + case 2: + return 6; + case 3: + return 8; } return 0; @@ -701,18 +701,18 @@ int Merc::GroupLeadershipAAOffenseEnhancement() switch(g->GetLeadershipAA(groupAAOffenseEnhancement)) { - case 0: - return 0; - case 1: - return 10; - case 2: - return 19; - case 3: - return 28; - case 4: - return 34; - case 5: - return 40; + case 0: + return 0; + case 1: + return 10; + case 2: + return 19; + case 3: + return 28; + case 4: + return 34; + case 5: + return 40; } return 0; } @@ -812,7 +812,7 @@ int32 Merc::CalcCHA() { //The AA multipliers are set to be 5, but were 2 on WR //The resistant discipline which I think should be here is implemented //in Mob::ResistSpell -int32 Merc::CalcMR() +int32 Merc::CalcMR() { MR = _baseMR + itembonuses.MR + spellbonuses.MR + aabonuses.MR; @@ -822,7 +822,7 @@ int32 Merc::CalcMR() return(MR); } -int32 Merc::CalcFR() +int32 Merc::CalcFR() { FR = _baseFR + itembonuses.FR + spellbonuses.FR + aabonuses.FR; @@ -832,7 +832,7 @@ int32 Merc::CalcFR() return(FR); } -int32 Merc::CalcDR() +int32 Merc::CalcDR() { DR = _baseDR + itembonuses.DR + spellbonuses.DR + aabonuses.DR; @@ -842,7 +842,7 @@ int32 Merc::CalcDR() return(DR); } -int32 Merc::CalcPR() +int32 Merc::CalcPR() { PR = _basePR + itembonuses.PR + spellbonuses.PR + aabonuses.PR; @@ -852,7 +852,7 @@ int32 Merc::CalcPR() return(PR); } -int32 Merc::CalcCR() +int32 Merc::CalcCR() { CR = _baseCR + itembonuses.CR + spellbonuses.CR + aabonuses.CR; @@ -862,7 +862,7 @@ int32 Merc::CalcCR() return(CR); } -int32 Merc::CalcCorrup() +int32 Merc::CalcCorrup() { Corrup = _baseCorrup + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup; @@ -905,7 +905,7 @@ int32 Merc::CalcMaxHP() { //but the actual effect sent on live causes the client //to apply it to (basehp + itemhp).. I will oblige to the client's whims over //the aa description - nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability + nd += aabonuses.MaxHP; //Natural Durability, Physical Enhancement, Planar Durability max_hp = (float)max_hp * (float)nd / (float)10000; //this is to fix the HP-above-495k issue max_hp += spellbonuses.HP + aabonuses.HP; @@ -936,20 +936,20 @@ int32 Merc::CalcMaxMana() { switch(GetCasterClass()) { - case 'I': - case 'W': { - max_mana = (CalcBaseMana() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement()); - break; - } - case 'N': { - max_mana = 0; - break; - } - default: { - LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); - max_mana = 0; - break; - } + case 'I': + case 'W': { + max_mana = (CalcBaseMana() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement()); + break; + } + case 'N': { + max_mana = 0; + break; + } + default: { + LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + max_mana = 0; + break; + } } if (max_mana < 0) { max_mana = 0; @@ -1031,12 +1031,12 @@ int32 Merc::CalcManaRegenCap() int32 cap = RuleI(Character, ItemManaRegenCap) + aabonuses.ItemManaRegenCap; switch(GetCasterClass()) { - case 'I': - cap += (itembonuses.HeroicINT / 25); - break; - case 'W': - cap += (itembonuses.HeroicWIS / 25); - break; + case 'I': + cap += (itembonuses.HeroicINT / 25); + break; + case 'W': + cap += (itembonuses.HeroicWIS / 25); + break; } return (cap * RuleI(Character, ManaRegenMultiplier) / 100); @@ -1177,7 +1177,7 @@ void Merc::DoEnduranceUpkeep() { has_effect = true; if(cost_redux > 0) { if(upkeep <= cost_redux) - continue; //reduced to 0 + continue; //reduced to 0 upkeep -= cost_redux; } if((upkeep+upkeep_sum) > GetEndurance()) { @@ -1252,112 +1252,28 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.lfg = 0; ns->spawn.anon = 0; ns->spawn.gm = 0; - ns->spawn.guildID = 0xFFFFFFFF; // 0xFFFFFFFF = NO GUILD, 0 = Unknown Guild - ns->spawn.is_npc = 1; // 0=no, 1=yes + ns->spawn.guildID = 0xFFFFFFFF; // 0xFFFFFFFF = NO GUILD, 0 = Unknown Guild + ns->spawn.is_npc = 1; // 0=no, 1=yes ns->spawn.is_pet = 0; ns->spawn.guildrank = 0; ns->spawn.showhelm = 1; ns->spawn.flymode = 0; ns->spawn.size = 0; - ns->spawn.NPC = 1; // 0=player,1=npc,2=pc corpse,3=npc corpse + ns->spawn.NPC = 1; // 0=player,1=npc,2=pc corpse,3=npc corpse ns->spawn.IsMercenary = 1; - /*const Item_Struct* item = 0; - const ItemInst* inst = 0; - uint32 spawnedmercid = 0; - spawnedmercid = this->GetID(); - - inst = GetBotItem(SLOT_HANDS); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_HANDS] = item->Material; - ns->spawn.colors[MATERIAL_HANDS].color = GetEquipmentColor(MATERIAL_HANDS); + unsigned int i; + //should not include 21 (SLOT_AMMO) + for (i = 0; i < MainAmmo; i++) { + if(equipment[i] == 0) + continue; + const Item_Struct* item = database.GetItem(equipment[i]); + if(item) + { + ns->spawn.equipment[i] = item->Material; + ns->spawn.colors[i].color = item->Color; } } - - inst = GetBotItem(SLOT_HEAD); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_HEAD] = item->Material; - ns->spawn.colors[MATERIAL_HEAD].color = GetEquipmentColor(MATERIAL_HEAD); - } - } - - inst = GetBotItem(SLOT_ARMS); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_ARMS] = item->Material; - ns->spawn.colors[MATERIAL_ARMS].color = GetEquipmentColor(MATERIAL_ARMS); - } - } - - inst = GetBotItem(SLOT_BRACER01); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_BRACER] = item->Material; - ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER); - } - } - - inst = GetBotItem(SLOT_BRACER02); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_BRACER] = item->Material; - ns->spawn.colors[MATERIAL_BRACER].color = GetEquipmentColor(MATERIAL_BRACER); - } - } - - inst = GetBotItem(SLOT_CHEST); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_CHEST] = item->Material; - ns->spawn.colors[MATERIAL_CHEST].color = GetEquipmentColor(MATERIAL_CHEST); - } - } - - inst = GetBotItem(SLOT_LEGS); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_LEGS] = item->Material; - ns->spawn.colors[MATERIAL_LEGS].color = GetEquipmentColor(MATERIAL_LEGS); - } - } - - inst = GetBotItem(SLOT_FEET); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MATERIAL_FEET] = item->Material; - ns->spawn.colors[MATERIAL_FEET].color = GetEquipmentColor(MATERIAL_FEET); - } - } - - inst = GetBotItem(SLOT_PRIMARY); - if(inst) { - item = inst->GetItem(); - if(item) { - if(strlen(item->IDFile) > 2) - ns->spawn.equipment[MATERIAL_PRIMARY] = atoi(&item->IDFile[2]); - ns->spawn.colors[MATERIAL_PRIMARY].color = GetEquipmentColor(MATERIAL_PRIMARY); - } - } - - inst = GetBotItem(SLOT_SECONDARY); - if(inst) { - item = inst->GetItem(); - if(item) { - if(strlen(item->IDFile) > 2) - ns->spawn.equipment[MATERIAL_SECONDARY] = atoi(&item->IDFile[2]); - ns->spawn.colors[MATERIAL_SECONDARY].color = GetEquipmentColor(MATERIAL_SECONDARY); - } - }*/ } } @@ -1371,25 +1287,24 @@ bool Merc::Process() if (GetDepop()) { - SetMercCharacterID(0); - SetOwnerID(0); + //SetMercCharacterID(0); + //SetOwnerID(0); return false; } if(!GetMercOwner()) { - //p_depop = true; //this was causing a crash - removed merc from entity list, but not group - //return false; //merc can live after client dies, not sure how long + //p_depop = true; //this was causing a crash - removed merc from entity list, but not group + //return false; //merc can live after client dies, not sure how long } if(IsSuspended()) { - //return false; + return false; } - if (HasGroup() && GetFollowID() == 0) { + if (HasGroup() && GetMercOwner() && GetFollowID() == 0) { SetFollowID(GetMercOwner()->GetID()); } - SpellProcess(); if(tic_timer.Check()) @@ -1448,7 +1363,7 @@ bool Merc::IsMercCasterCombatRange(Mob *target) { range *= range; - // half the max so the bot doesn't always stop at max range to allow combat movement + // half the max so the merc doesn't always stop at max range to allow combat movement range *= .5; float targetDistance = DistNoRootNoZ(*target); @@ -1470,19 +1385,30 @@ void Merc::AI_Process() { return; // A bot wont start its AI if not grouped - if(!GetOwner() || !HasGroup()) { + if(!HasGroup()) { return; } - if(GetAppearance() == eaDead) - return; - Mob* MercOwner = GetOwner(); - // The bots need an owner - if(!MercOwner) + if(GetAppearance() == eaDead) + { + if(!MercOwner) + { + Depop(); + } return; + } + // The merc needs an owner + if(!MercOwner) { + //SetTarget(0); + //SetOwnerID(0); + // TODO: Need to wait and try casting rez if merc is a healer with a dead owner + return; + } + + /* try { if(MercOwner->CastToClient()->IsDead()) { SetTarget(0); @@ -1495,6 +1421,7 @@ void Merc::AI_Process() { SetOwnerID(0); return; } + */ if(check_target_timer.Check()) { CheckHateList(); @@ -1605,8 +1532,10 @@ void Merc::AI_Process() { atCombatRange = true; } - if(atCombatRange) { - if(IsMoving()) { + if(atCombatRange) + { + if(IsMoving()) + { SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY())); SetRunAnimSpeed(0); @@ -1617,25 +1546,30 @@ void Merc::AI_Process() { } } - if(AImovement_timer->Check()) { - if(!IsMoving() && GetClass() == ROGUE && !BehindMob(GetTarget(), GetX(), GetY())) { + if(AImovement_timer->Check()) + { + if(!IsMoving() && GetClass() == ROGUE && !BehindMob(GetTarget(), GetX(), GetY())) + { // Move the rogue to behind the mob float newX = 0; float newY = 0; float newZ = 0; - if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ)) { + if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ)) + { CalculateNewPosition2(newX, newY, newZ, GetRunspeed()); return; } } - else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) { + else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) + { // If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up float newX = 0; float newY = 0; float newZ = 0; - if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ, false) && GetArchetype() != ARCHETYPE_CASTER) { + if(PlotPositionAroundTarget(GetTarget(), newX, newY, newZ, false) && GetArchetype() != ARCHETYPE_CASTER) + { CalculateNewPosition2(newX, newY, newZ, GetRunspeed()); return; } @@ -1647,26 +1581,28 @@ void Merc::AI_Process() { SendPosition(); } - if(!IsMercCaster() && GetTarget() && !IsStunned() && !IsMezzed() && (GetAppearance() != eaDead)) { + if(!IsMercCaster() && GetTarget() && !IsStunned() && !IsMezzed() && (GetAppearance() != eaDead)) + { // we can't fight if we don't have a target, are stun/mezzed or dead.. // Stop attacking if the target is enraged if(IsEngaged() && !BehindMob(GetTarget(), GetX(), GetY()) && GetTarget()->IsEnraged()) return; //TODO: Implement Stances. /*if(GetBotStance() == BotStancePassive) - return;*/ + return;*/ // First, special attack per class (kick, backstab etc..) DoClassAttacks(GetTarget()); //try main hand first - if(attack_timer.Check()) { + if(attack_timer.Check()) + { Attack(GetTarget(), MainPrimary); bool tripleSuccess = false; - if(GetOwner() && GetTarget() && CanThisClassDoubleAttack()) { - + if(GetOwner() && GetTarget() && CanThisClassDoubleAttack()) + { if(GetOwner()) { Attack(GetTarget(), MainPrimary, true); } @@ -1698,90 +1634,95 @@ void Merc::AI_Process() { int16 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance; if (GetTarget() && ExtraAttackChanceBonus) { - if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) - { - Attack(GetTarget(), MainPrimary, false); - } - } + if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) + { + Attack(GetTarget(), MainPrimary, false); + } + } } // TODO: Do mercs berserk? Find this out on live... //if (GetClass() == WARRIOR || GetClass() == BERSERKER) { - // if(GetHP() > 0 && !berserk && this->GetHPRatio() < 30) { - // entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName()); - // this->berserk = true; - // } - // if (berserk && this->GetHPRatio() > 30) { - // entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName()); - // this->berserk = false; - // } + // if(GetHP() > 0 && !berserk && this->GetHPRatio() < 30) { + // entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_START, GetName()); + // this->berserk = true; + // } + // if (berserk && this->GetHPRatio() > 30) { + // entity_list.MessageClose_StringID(this, false, 200, 0, BERSERK_END, GetName()); + // this->berserk = false; + // } //} //now off hand - if(GetTarget() && attack_dw_timer.Check() && CanThisClassDualWield()) { + if(GetTarget() && attack_dw_timer.Check() && CanThisClassDualWield()) + { + int weapontype = 0; // No weapon type + bool bIsFist = true; - int weapontype = 0; // No weapon type - bool bIsFist = true; + if(bIsFist || ((weapontype != ItemType2HSlash) && (weapontype != ItemType2HPiercing) && (weapontype != ItemType2HBlunt))) + { + float DualWieldProbability = 0.0f; - if(bIsFist || ((weapontype != ItemType2HSlash) && (weapontype != ItemType2HPiercing) && (weapontype != ItemType2HBlunt))) { - float DualWieldProbability = 0.0f; + int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; + DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max + int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; + DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; - DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max - int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; - DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; + float random = MakeRandomFloat(0, 1); - float random = MakeRandomFloat(0, 1); + // Max 78% of DW + if (random < DualWieldProbability) + { + Attack(GetTarget(), MainSecondary); // Single attack with offhand - if (random < DualWieldProbability){ // Max 78% of DW - - Attack(GetTarget(), MainSecondary); // Single attack with offhand - - if( CanThisClassDoubleAttack()) { - if(GetTarget() && GetTarget()->GetHP() > -10) - Attack(GetTarget(), MainSecondary); // Single attack with offhand - } + if(CanThisClassDoubleAttack()) { + if(GetTarget() && GetTarget()->GetHP() > -10) + Attack(GetTarget(), MainSecondary); // Single attack with offhand } } } } - }// end in combat range - else { - if(GetTarget()->IsFeared() && !spellend_timer.Enabled()){ - // This is a mob that is fleeing either because it has been feared or is low on hitpoints - //TODO: Implement Stances. - //if(GetStance() != MercStancePassive) - AI_PursueCastCheck(); - } - - if (AImovement_timer->Check()) { - if(!IsRooted()) { - mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); - CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); - return; - } - - if(IsMoving()) - SendPosUpdate(); - else - SendPosition(); - } - } // end not in combat range - - if(!IsMoving() && !spellend_timer.Enabled()) { - - //TODO: Implement Stances. - //if(GetStance() == MercStancePassive) - // return; - - if(AI_EngagedCastCheck()) { - MercMeditate(false); - } - else if(GetArchetype() == ARCHETYPE_CASTER) - MercMeditate(true); } - } // end IsEngaged() - else { + } + else + { + if(GetTarget()->IsFeared() && !spellend_timer.Enabled()) { + // This is a mob that is fleeing either because it has been feared or is low on hitpoints + //TODO: Implement Stances. + //if(GetStance() != MercStancePassive) + AI_PursueCastCheck(); + } + + if (AImovement_timer->Check()) + { + if(!IsRooted()) { + mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); + return; + } + + if(IsMoving()) + SendPosUpdate(); + else + SendPosition(); + } + } // end not in combat range + + if(!IsMoving() && !spellend_timer.Enabled()) + { + //TODO: Implement Stances. + //if(GetStance() == MercStancePassive) + // return; + + if(AI_EngagedCastCheck()) { + MercMeditate(false); + } + else if(GetArchetype() == ARCHETYPE_CASTER) + MercMeditate(true); + } + } + else + { // Not engaged in combat SetTarget(0); SetHatedCount(0); @@ -1791,8 +1732,8 @@ void Merc::AI_Process() { if(!check_target_timer.Enabled()) check_target_timer.Start(2000, false); - if(!IsMoving() && AIthink_timer->Check() && !spellend_timer.Enabled()) { - + if(!IsMoving() && AIthink_timer->Check() && !spellend_timer.Enabled()) + { //TODO: Implement passive stances. //if(GetStance() != MercStancePassive) { if(!AI_IdleCastCheck() && !IsCasting()) { @@ -1802,11 +1743,14 @@ void Merc::AI_Process() { } } - if(AImovement_timer->Check()) { - if(GetFollowID()) { + if(AImovement_timer->Check()) + { + if(GetFollowID()) + { Mob* follow = entity_list.GetMob(GetFollowID()); - if(follow) { + if(follow) + { float dist = DistNoRoot(*follow); float speed = GetRunspeed(); @@ -1867,9 +1811,9 @@ bool Merc::AI_EngagedCastCheck() { bool result = false; bool failedToCast = false; - if (GetTarget() && AIautocastspell_timer->Check(false)) { - - AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. + if (GetTarget() && AIautocastspell_timer->Check(false)) + { + AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. mlog(AI__SPELLS, "Engaged autocast check triggered (MERCS)."); @@ -1877,36 +1821,36 @@ bool Merc::AI_EngagedCastCheck() { switch(mercClass) { - case TANK: + case TANK: + if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Nuke), SpellType_Nuke)) { + if (!AICastSpell(GetChanceToCastBySpellType(SpellType_InCombatBuff), SpellType_InCombatBuff)) { + failedToCast = true; + } + } + break; + case HEALER: + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, GetChanceToCastBySpellType(SpellType_Heal), MercAISpellRange, SpellType_Heal)) { + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, GetChanceToCastBySpellType(SpellType_Buff), MercAISpellRange, SpellType_Buff)) { + failedToCast = true; + } + } + break; + case MELEEDPS: + if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Nuke), SpellType_Nuke)) { if (!AICastSpell(GetChanceToCastBySpellType(SpellType_InCombatBuff), SpellType_InCombatBuff)) { failedToCast = true; } } - break; - case HEALER: - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, GetChanceToCastBySpellType(SpellType_Heal), MercAISpellRange, SpellType_Heal)) { - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, GetChanceToCastBySpellType(SpellType_Buff), MercAISpellRange, SpellType_Buff)) { - failedToCast = true; - } + } + break; + case CASTERDPS: + if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { + if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Nuke), SpellType_Nuke)) { + failedToCast = true; } - break; - case MELEEDPS: - if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { - if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Nuke), SpellType_Nuke)) { - if (!AICastSpell(GetChanceToCastBySpellType(SpellType_InCombatBuff), SpellType_InCombatBuff)) { - failedToCast = true; - } - } - } - break; - case CASTERDPS: - if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { - if (!AICastSpell(GetChanceToCastBySpellType(SpellType_Nuke), SpellType_Nuke)) { - failedToCast = true; - } - } - break; + } + break; } if(!AIautocastspell_timer->Enabled()) { @@ -1928,36 +1872,36 @@ bool Merc::AI_IdleCastCheck() { #if MobAI_DEBUG_Spells >= 25 std::cout << "Non-Engaged autocast check triggered: " << this->GetCleanName() << std::endl; #endif - AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. + AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. //Ok, IdleCastCheck depends of class. int8 mercClass = GetClass(); switch(mercClass) { - case TANK: - failedToCast = true; + case TANK: + failedToCast = true; break; - case HEALER: - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Cure)) { - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Heal)) { - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Resurrect)) { - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { - failedToCast = true; - } + case HEALER: + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Cure)) { + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Heal)) { + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Resurrect)) { + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { + failedToCast = true; } } } - result = true; - break; - case MELEEDPS: - if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { - failedToCast = true; - } - break; - case CASTERDPS: + } + result = true; + break; + case MELEEDPS: + if(!entity_list.Merc_AICheckCloseBeneficialSpells(this, 100, MercAISpellRange, SpellType_Buff)) { failedToCast = true; - break; + } + break; + case CASTERDPS: + failedToCast = true; + break; } if(!AIautocastspell_timer->Enabled()) @@ -1998,17 +1942,17 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, if(caster->HasGroup()) { if( mercCasterClass == HEALER) { - if( iSpellTypes == SpellType_Heal ) { + if( iSpellTypes == SpellType_Heal ) { if(caster->AICastSpell(100, SpellType_Heal)) return true; } - if( iSpellTypes == SpellType_Cure ) { + if( iSpellTypes == SpellType_Cure ) { if(caster->AICastSpell(100, SpellType_Cure)) return true; } - if( iSpellTypes == SpellType_Resurrect ) { + if( iSpellTypes == SpellType_Resurrect ) { if(caster->AICastSpell(100, SpellType_Resurrect)) return true; } @@ -2047,11 +1991,11 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon dist2 = DistNoRoot(*tar); if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal) - || spells[spellid].targettype==ST_AECaster - || spells[spellid].targettype==ST_Group - || spells[spellid].targettype==ST_AEBard) - && dist2 <= spells[spellid].aoerange*spells[spellid].aoerange) - || dist2 <= GetActSpellRange(spellid, spells[spellid].range)*GetActSpellRange(spellid, spells[spellid].range)) && (mana_cost <= GetMana() || GetMana() == GetMaxMana())) + || spells[spellid].targettype==ST_AECaster + || spells[spellid].targettype==ST_Group + || spells[spellid].targettype==ST_AEBard) + && dist2 <= spells[spellid].aoerange*spells[spellid].aoerange) + || dist2 <= GetActSpellRange(spellid, spells[spellid].range)*GetActSpellRange(spellid, spells[spellid].range)) && (mana_cost <= GetMana() || GetMana() == GetMaxMana())) { SetRunAnimSpeed(0); SendPosition(); @@ -2093,7 +2037,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { int8 mercClass = GetClass(); uint8 mercLevel = GetLevel(); - bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once. + bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once. bool castedSpell = false; bool isDiscipline = false; @@ -2111,417 +2055,417 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { switch(mercClass) { - case TANK: - case MELEEDPS: - isDiscipline = true; + case TANK: + case MELEEDPS: + isDiscipline = true; break; - default: - isDiscipline = false; + default: + isDiscipline = false; break; } switch (iSpellTypes) { - case SpellType_Heal: { - Mob* tar = nullptr; - int8 numToHeal = g->GetNumberNeedingHealedInGroup(IsEngaged() ? 75 : 95, true); - int8 checkHPR = IsEngaged() ? 95 : 99; - int8 checkPetHPR = IsEngaged() ? 95 : 99; + case SpellType_Heal: { + Mob* tar = nullptr; + int8 numToHeal = g->GetNumberNeedingHealedInGroup(IsEngaged() ? 75 : 95, true); + int8 checkHPR = IsEngaged() ? 95 : 99; + int8 checkPetHPR = IsEngaged() ? 95 : 99; - //todo: check stance to determine healing spell selection + //todo: check stance to determine healing spell selection - for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { - if(g->members[i] && !g->members[i]->qglobal) { - int8 hpr = (int8)g->members[i]->GetHPRatio(); + for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { + if(g->members[i] && !g->members[i]->qglobal) { + int8 hpr = (int8)g->members[i]->GetHPRatio(); - if(g->members[i]->HasPet() && g->members[i]->GetPet()->GetHPRatio() < checkHPR) { - if(!tar || ((g->members[i]->GetPet()->GetHPRatio() + 25) < tar->GetHPRatio())) { - tar = g->members[i]->GetPet(); - checkPetHPR = g->members[i]->GetPet()->GetHPRatio() + 25; - } - } + if(g->members[i]->HasPet() && g->members[i]->GetPet()->GetHPRatio() < checkHPR) { + if(!tar || ((g->members[i]->GetPet()->GetHPRatio() + 25) < tar->GetHPRatio())) { + tar = g->members[i]->GetPet(); + checkPetHPR = g->members[i]->GetPet()->GetHPRatio() + 25; + } + } - if(hpr > checkHPR) { - continue; - } + if(hpr > checkHPR) { + continue; + } - if(IsEngaged() && (g->members[i]->GetClass() == NECROMANCER && hpr >= 50) - || (g->members[i]->GetClass() == SHAMAN && hpr >= 80)) { - //allow necros to lifetap & shaman to canni without wasting mana - continue; - } + if(IsEngaged() && (g->members[i]->GetClass() == NECROMANCER && hpr >= 50) + || (g->members[i]->GetClass() == SHAMAN && hpr >= 80)) { + //allow necros to lifetap & shaman to canni without wasting mana + continue; + } - if(hpr < checkHPR && g->members[i] == GetMercOwner()) { - if(!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR))) - tar = g->members[i]; //check owner first - } - else if(hpr < checkHPR && g->HasRole(g->members[i], RoleTank)){ - if(!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR))) - tar = g->members[i]; - } - else if( hpr < checkHPR && (!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR)))) { - tar = g->members[i]; - } - } - } - - if(numToHeal > 2) { - selectedMercSpell = GetBestMercSpellForGroupHeal(this); - } - - if(tar && selectedMercSpell.spellid == 0) { - if(tar->GetHPRatio() < 15) { - //check for very fast heals first (casting time < 1 s) - selectedMercSpell = GetBestMercSpellForVeryFastHeal(this); - - //check for fast heals next (casting time < 2 s) - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForFastHeal(this); - } - - //get regular heal - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); - } - } - else if (tar->GetHPRatio() < 35) { - //check for fast heals next (casting time < 2 s) - selectedMercSpell = GetBestMercSpellForFastHeal(this); - - //get regular heal - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); - } - } - else if (tar->GetHPRatio() < 80) { - selectedMercSpell = GetBestMercSpellForPercentageHeal(this); - - //get regular heal - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); - } - } - else { - //check for heal over time. if not present, try it first - if(!tar->FindType(SE_HealOverTime)) { - selectedMercSpell = GetBestMercSpellForHealOverTime(this); - - //get regular heal - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); - } - } - } - } - - if(selectedMercSpell.spellid > 0) { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); - } - - if(castedSpell) { - char* gmsg = 0; - - if(tar != this) { - //we don't need spam of bots healing themselves - MakeAnyLenString(&gmsg, "Casting %s on %s.", spells[selectedMercSpell.spellid].name, tar->GetCleanName()); - if(gmsg) - { - MercGroupSay(this, gmsg); - safe_delete_array(gmsg); - } - } - } - - break; - } - case SpellType_Root: { - break; - } - case SpellType_Buff: { - - if(GetClass() == HEALER && GetManaRatio() < 50) { - return false; //mercs buff when Mana > 50% - } - - std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_Buff); - - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { - MercSpell selectedMercSpell = *itr; - - if(!((spells[selectedMercSpell.spellid].targettype == ST_Target || spells[selectedMercSpell.spellid].targettype == ST_Pet || - spells[selectedMercSpell.spellid].targettype == ST_Group || spells[selectedMercSpell.spellid].targettype == ST_GroupTeleport || - spells[selectedMercSpell.spellid].targettype == ST_Self))) { - continue; - } - - if(spells[selectedMercSpell.spellid].targettype == ST_Self) { - if( !this->IsImmuneToSpell(selectedMercSpell.spellid, this) - && (this->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { - - if( this->GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) { - continue; + if(hpr < checkHPR && g->members[i] == GetMercOwner()) { + if(!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR))) + tar = g->members[i]; //check owner first + } + else if(hpr < checkHPR && g->HasRole(g->members[i], RoleTank)){ + if(!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR))) + tar = g->members[i]; + } + else if( hpr < checkHPR && (!tar || (hpr < tar->GetHPRatio() || (tar->IsPet() && hpr < checkPetHPR)))) { + tar = g->members[i]; + } + } } - uint32 TempDontBuffMeBeforeTime = this->DontBuffMeBefore(); + if(numToHeal > 2) { + selectedMercSpell = GetBestMercSpellForGroupHeal(this); + } + + if(tar && selectedMercSpell.spellid == 0) { + if(tar->GetHPRatio() < 15) { + //check for very fast heals first (casting time < 1 s) + selectedMercSpell = GetBestMercSpellForVeryFastHeal(this); + + //check for fast heals next (casting time < 2 s) + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForFastHeal(this); + } + + //get regular heal + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); + } + } + else if (tar->GetHPRatio() < 35) { + //check for fast heals next (casting time < 2 s) + selectedMercSpell = GetBestMercSpellForFastHeal(this); + + //get regular heal + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); + } + } + else if (tar->GetHPRatio() < 80) { + selectedMercSpell = GetBestMercSpellForPercentageHeal(this); + + //get regular heal + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); + } + } + else { + //check for heal over time. if not present, try it first + if(!tar->FindType(SE_HealOverTime)) { + selectedMercSpell = GetBestMercSpellForHealOverTime(this); + + //get regular heal + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForRegularSingleTargetHeal(this); + } + } + } + } + + if(selectedMercSpell.spellid > 0) { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); + } + + if(castedSpell) { + char* gmsg = 0; + + if(tar != this) { + //we don't need spam of bots healing themselves + MakeAnyLenString(&gmsg, "Casting %s on %s.", spells[selectedMercSpell.spellid].name, tar->GetCleanName()); + if(gmsg) + { + MercGroupSay(this, gmsg); + safe_delete_array(gmsg); + } + } + } + + break; + } + case SpellType_Root: { + break; + } + case SpellType_Buff: { + + if(GetClass() == HEALER && GetManaRatio() < 50) { + return false; //mercs buff when Mana > 50% + } + + std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_Buff); + + for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { + MercSpell selectedMercSpell = *itr; + + if(!((spells[selectedMercSpell.spellid].targettype == ST_Target || spells[selectedMercSpell.spellid].targettype == ST_Pet || + spells[selectedMercSpell.spellid].targettype == ST_Group || spells[selectedMercSpell.spellid].targettype == ST_GroupTeleport || + spells[selectedMercSpell.spellid].targettype == ST_Self))) { + continue; + } + + if(spells[selectedMercSpell.spellid].targettype == ST_Self) { + if( !this->IsImmuneToSpell(selectedMercSpell.spellid, this) + && (this->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { + + if( this->GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) { + continue; + } + + uint32 TempDontBuffMeBeforeTime = this->DontBuffMeBefore(); + + if(selectedMercSpell.spellid > 0) { + if(isDiscipline) { + castedSpell = UseDiscipline(selectedMercSpell.spellid, GetID()); + } + else { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1, &TempDontBuffMeBeforeTime); + + if(TempDontBuffMeBeforeTime != this->DontBuffMeBefore()) + this->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); + } + } + } + } + else { + for( int i = 0; i < MAX_GROUP_MEMBERS; i++) { + if(g->members[i]) { + Mob* tar = g->members[i]; + + if( !tar->IsImmuneToSpell(selectedMercSpell.spellid, this) + && (tar->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { + + if( tar->GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) { + continue; + } + + uint32 TempDontBuffMeBeforeTime = tar->DontBuffMeBefore(); + + if(selectedMercSpell.spellid > 0) { + if(isDiscipline) { + castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); + } + else { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1, &TempDontBuffMeBeforeTime); + + if(TempDontBuffMeBeforeTime != tar->DontBuffMeBefore()) + tar->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); + } + } + } + + if(!castedSpell && tar->GetPet()) { + + //don't cast group spells on pets + if(IsGroupSpell(selectedMercSpell.spellid) + || spells[selectedMercSpell.spellid].targettype == ST_Group + || spells[selectedMercSpell.spellid].targettype == ST_GroupTeleport ) { + continue; + } + + if(!tar->GetPet()->IsImmuneToSpell(selectedMercSpell.spellid, this) + && (tar->GetPet()->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { + + uint32 TempDontBuffMeBeforeTime = tar->DontBuffMeBefore(); + + if(selectedMercSpell.spellid > 0) { + if(isDiscipline) { + castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetPet()->GetID()); + } + else { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar->GetPet(), -1, &TempDontBuffMeBeforeTime); + + if(TempDontBuffMeBeforeTime != tar->GetPet()->DontBuffMeBefore()) + tar->GetPet()->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); + } + } + } + } + } + } + } + } + break; + } + case SpellType_Nuke: { + switch(mercClass) + { + case TANK: + //check for taunt + if(CheckAETaunt()) { + if(MERC_DEBUG > 0) + GetOwner()->Message(7, "AE Taunting"); + //get AE taunt + selectedMercSpell = GetBestMercSpellForAETaunt(this); + } + + if(selectedMercSpell.spellid == 0 && CheckTaunt()) { + //get taunt + selectedMercSpell = GetBestMercSpellForTaunt(this); + } + + //get hate disc + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForHate(this); + } + + break; + case HEALER: + break; + case MELEEDPS: + break; + case CASTERDPS: + Mob* tar = GetTarget(); + + selectedMercSpell = GetBestMercSpellForAENuke(this, tar); + + if(selectedMercSpell.spellid == 0 && !tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned()) { + uint8 stunChance = 15; + if(MakeRandomInt(1, 100) <= stunChance) { + selectedMercSpell = GetBestMercSpellForStun(this); + } + } + + if(selectedMercSpell.spellid == 0) { + uint8 lureChance = 25; + if(MakeRandomInt(1, 100) <= lureChance) { + selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar); + } + } + + if(selectedMercSpell.spellid == 0) { + selectedMercSpell = GetBestMercSpellForNuke(this); + } + + break; + } if(selectedMercSpell.spellid > 0) { if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, GetID()); + castedSpell = UseDiscipline(selectedMercSpell.spellid, GetTarget()->GetID()); } else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1, &TempDontBuffMeBeforeTime); - - if(TempDontBuffMeBeforeTime != this->DontBuffMeBefore()) - this->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, GetTarget(), -1); } } - } - } - else { - for( int i = 0; i < MAX_GROUP_MEMBERS; i++) { - if(g->members[i]) { - Mob* tar = g->members[i]; + + break; + } + case SpellType_InCombatBuff: { + std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_InCombatBuff); + Mob* tar = this; + + for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { + MercSpell selectedMercSpell = *itr; + + if(!(spells[selectedMercSpell.spellid].targettype == ST_Self)) { + continue; + } + + if(spells[selectedMercSpell.spellid].skill == SkillBackstab && spells[selectedMercSpell.spellid].targettype == ST_Self) { + if(!hidden) { + continue; + } + } if( !tar->IsImmuneToSpell(selectedMercSpell.spellid, this) && (tar->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { - if( tar->GetArchetype() == ARCHETYPE_MELEE && IsEffectInSpell(selectedMercSpell.spellid, SE_IncreaseSpellHaste)) { - continue; - } - - uint32 TempDontBuffMeBeforeTime = tar->DontBuffMeBefore(); - - if(selectedMercSpell.spellid > 0) { - if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); - } - else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1, &TempDontBuffMeBeforeTime); - - if(TempDontBuffMeBeforeTime != tar->DontBuffMeBefore()) - tar->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); - } - } - } - - if(!castedSpell && tar->GetPet()) { - - //don't cast group spells on pets - if(IsGroupSpell(selectedMercSpell.spellid) - || spells[selectedMercSpell.spellid].targettype == ST_Group - || spells[selectedMercSpell.spellid].targettype == ST_GroupTeleport ) { - continue; - } - - if(!tar->GetPet()->IsImmuneToSpell(selectedMercSpell.spellid, this) - && (tar->GetPet()->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { - uint32 TempDontBuffMeBeforeTime = tar->DontBuffMeBefore(); if(selectedMercSpell.spellid > 0) { if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetPet()->GetID()); + castedSpell = UseDiscipline(selectedMercSpell.spellid, GetID()); } else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar->GetPet(), -1, &TempDontBuffMeBeforeTime); + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1); + } + } + } + } + break; + } + case SpellType_Cure: { + Mob* tar = nullptr; + for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { + if(g->members[i] && !g->members[i]->qglobal) { + if(GetNeedsCured(g->members[i]) && (g->members[i]->DontCureMeBefore() < Timer::GetCurrentTime())) { + tar = g->members[i]; + } + } + } - if(TempDontBuffMeBeforeTime != tar->GetPet()->DontBuffMeBefore()) - tar->GetPet()->SetDontBuffMeBefore(TempDontBuffMeBeforeTime); + if(tar && !(g->GetNumberNeedingHealedInGroup(IsEngaged() ? 25 : 40, false) > 0) && !(g->GetNumberNeedingHealedInGroup(IsEngaged() ? 40 : 60, false) > 2)) + { + selectedMercSpell = GetBestMercSpellForCure(this, tar); + + if(selectedMercSpell.spellid == 0) + break; + + uint32 TempDontCureMeBeforeTime = tar->DontCureMeBefore(); + + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, spells[selectedMercSpell.spellid].mana, &TempDontCureMeBeforeTime); + + if(castedSpell) { + if(IsGroupSpell(selectedMercSpell.spellid)){ + + if(this->HasGroup()) { + Group *g = this->GetGroup(); + + if(g) { + for( int i = 0; imembers[i] && !g->members[i]->qglobal) { + if(TempDontCureMeBeforeTime != tar->DontCureMeBefore()) + g->members[i]->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000); + } + } } } } - } - } - } - } - } - break; - } - case SpellType_Nuke: { - switch(mercClass) - { - case TANK: - //check for taunt - if(CheckAETaunt()) { - if(MERC_DEBUG > 0) - GetOwner()->Message(7, "AE Taunting"); - //get AE taunt - selectedMercSpell = GetBestMercSpellForAETaunt(this); - } - - if(selectedMercSpell.spellid == 0 && CheckTaunt()) { - //get taunt - selectedMercSpell = GetBestMercSpellForTaunt(this); - } - - //get hate disc - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForHate(this); - } - - break; - case HEALER: - break; - case MELEEDPS: - break; - case CASTERDPS: - Mob* tar = GetTarget(); - - selectedMercSpell = GetBestMercSpellForAENuke(this, tar); - - if(selectedMercSpell.spellid == 0 && !tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned()) { - uint8 stunChance = 15; - if(MakeRandomInt(1, 100) <= stunChance) { - selectedMercSpell = GetBestMercSpellForStun(this); - } - } - - if(selectedMercSpell.spellid == 0) { - uint8 lureChance = 25; - if(MakeRandomInt(1, 100) <= lureChance) { - selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar); - } - } - - if(selectedMercSpell.spellid == 0) { - selectedMercSpell = GetBestMercSpellForNuke(this); - } - - break; - } - - if(selectedMercSpell.spellid > 0) { - if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, GetTarget()->GetID()); - } - else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, GetTarget(), -1); - } - } - - break; - } - case SpellType_InCombatBuff: { - std::list buffSpellList = GetMercSpellsBySpellType(this, SpellType_InCombatBuff); - Mob* tar = this; - - for(std::list::iterator itr = buffSpellList.begin(); itr != buffSpellList.end(); ++itr) { - MercSpell selectedMercSpell = *itr; - - if(!(spells[selectedMercSpell.spellid].targettype == ST_Self)) { - continue; - } - - if(spells[selectedMercSpell.spellid].skill == SkillBackstab && spells[selectedMercSpell.spellid].targettype == ST_Self) { - if(!hidden) { - continue; - } - } - - if( !tar->IsImmuneToSpell(selectedMercSpell.spellid, this) - && (tar->CanBuffStack(selectedMercSpell.spellid, mercLevel, true) >= 0)) { - - uint32 TempDontBuffMeBeforeTime = tar->DontBuffMeBefore(); - - if(selectedMercSpell.spellid > 0) { - if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, GetID()); - } - else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, this, -1); - } - } - } - } - break; - } - case SpellType_Cure: { - Mob* tar = nullptr; - for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { - if(g->members[i] && !g->members[i]->qglobal) { - if(GetNeedsCured(g->members[i]) && (g->members[i]->DontCureMeBefore() < Timer::GetCurrentTime())) { - tar = g->members[i]; - } - } - } - - if(tar && !(g->GetNumberNeedingHealedInGroup(IsEngaged() ? 25 : 40, false) > 0) && !(g->GetNumberNeedingHealedInGroup(IsEngaged() ? 40 : 60, false) > 2)) - { - selectedMercSpell = GetBestMercSpellForCure(this, tar); - - if(selectedMercSpell.spellid == 0) - break; - - uint32 TempDontCureMeBeforeTime = tar->DontCureMeBefore(); - - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, spells[selectedMercSpell.spellid].mana, &TempDontCureMeBeforeTime); - - if(castedSpell) { - if(IsGroupSpell(selectedMercSpell.spellid)){ - - if(this->HasGroup()) { - Group *g = this->GetGroup(); - - if(g) { - for( int i = 0; imembers[i] && !g->members[i]->qglobal) { - if(TempDontCureMeBeforeTime != tar->DontCureMeBefore()) - g->members[i]->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000); - } + else { + if(TempDontCureMeBeforeTime != tar->DontCureMeBefore()) + tar->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000); } } } - } - else { - if(TempDontCureMeBeforeTime != tar->DontCureMeBefore()) - tar->SetDontCureMeBefore(Timer::GetCurrentTime() + 4000); - } - } - } - break; - } - case SpellType_Resurrect: { - Corpse *corpse = GetGroupMemberCorpse(); - - if(corpse) { - selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Resurrect); - - if(selectedMercSpell.spellid == 0) - break; - - uint32 TempDontRootMeBeforeTime = corpse->DontRootMeBefore(); - - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, corpse, spells[selectedMercSpell.spellid].mana, &TempDontRootMeBeforeTime); - - //CastSpell(selectedMercSpell.spellid, corpse->GetID(), 1, -1, -1, &TempDontRootMeBeforeTime); - corpse->SetDontRootMeBefore(TempDontRootMeBeforeTime); - } - - break; - } - case SpellType_Escape: { - Mob* tar = GetTarget(); - uint8 hpr = (uint8)GetHPRatio(); - bool mayGetAggro = false; - - if(tar && (mercClass == CASTERDPS) || (mercClass == MELEEDPS)) { - mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells - - if (mayGetAggro) { - selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Escape); - - if(selectedMercSpell.spellid == 0) break; + } + case SpellType_Resurrect: { + Corpse *corpse = GetGroupMemberCorpse(); - if(isDiscipline) { - castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); - } - else { - castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); - } - } - } - break; - } + if(corpse) { + selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Resurrect); + + if(selectedMercSpell.spellid == 0) + break; + + uint32 TempDontRootMeBeforeTime = corpse->DontRootMeBefore(); + + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, corpse, spells[selectedMercSpell.spellid].mana, &TempDontRootMeBeforeTime); + + //CastSpell(selectedMercSpell.spellid, corpse->GetID(), 1, -1, -1, &TempDontRootMeBeforeTime); + corpse->SetDontRootMeBefore(TempDontRootMeBeforeTime); + } + + break; + } + case SpellType_Escape: { + Mob* tar = GetTarget(); + uint8 hpr = (uint8)GetHPRatio(); + bool mayGetAggro = false; + + if(tar && (mercClass == CASTERDPS) || (mercClass == MELEEDPS)) { + mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells + + if (mayGetAggro) { + selectedMercSpell = GetFirstMercSpellBySpellType(this, SpellType_Escape); + + if(selectedMercSpell.spellid == 0) + break; + + if(isDiscipline) { + castedSpell = UseDiscipline(selectedMercSpell.spellid, tar->GetID()); + } + else { + castedSpell = AIDoSpellCast(selectedMercSpell.spellid, tar, -1); + } + } + } + break; + } } } } @@ -2539,11 +2483,11 @@ void Merc::CheckHateList() { if(g) { Mob* MercOwner = GetOwner(); if(MercOwner && MercOwner->GetTarget() && MercOwner->GetTarget()->IsNPC() && (MercOwner->GetTarget()->GetHateAmount(MercOwner) || MercOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(MercOwner->GetTarget())) { - float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); - range = range * range; - if(MercOwner->GetTarget()->DistNoRootNoZ(*this) < range) { - AddToHateList(MercOwner->GetTarget(), 1); - } + float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); + range = range * range; + if(MercOwner->GetTarget()->DistNoRootNoZ(*this) < range) { + AddToHateList(MercOwner->GetTarget(), 1); + } } else { std::list npc_list; @@ -2746,26 +2690,26 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { // AA Focus /*if (aabonuses.FocusEffects[type]){ - int16 Total3 = 0; - uint32 slots = 0; - uint32 aa_AA = 0; - uint32 aa_value = 0; + int16 Total3 = 0; + uint32 slots = 0; + uint32 aa_AA = 0; + uint32 aa_value = 0; - for (int i = 0; i < MAX_PP_AA_ARRAY; i++) - { - aa_AA = this->aa[i]->AA; - aa_value = this->aa[i]->value; - if (aa_AA < 1 || aa_value < 1) - continue; + for (int i = 0; i < MAX_PP_AA_ARRAY; i++) + { + aa_AA = this->aa[i]->AA; + aa_value = this->aa[i]->value; + if (aa_AA < 1 || aa_value < 1) + continue; - Total3 = CalcAAFocus(type, aa_AA, spell_id); - if (Total3 > 0 && realTotal3 >= 0 && Total3 > realTotal3) { - realTotal3 = Total3; - } - else if (Total3 < 0 && Total3 < realTotal3) { - realTotal3 = Total3; - } - } + Total3 = CalcAAFocus(type, aa_AA, spell_id); + if (Total3 > 0 && realTotal3 >= 0 && Total3 > realTotal3) { + realTotal3 = Total3; + } + else if (Total3 < 0 && Total3 < realTotal3) { + realTotal3 = Total3; + } + } }*/ if(type == focusReagentCost && IsSummonPetSpell(spell_id) && GetAA(aaElementalPact)) @@ -2791,13 +2735,13 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); int chance = RuleI(Spells, BaseCritChance); - chance += itembonuses.CriticalSpellChance + spellbonuses.CriticalSpellChance + aabonuses.CriticalSpellChance; + chance += itembonuses.CriticalSpellChance + spellbonuses.CriticalSpellChance + aabonuses.CriticalSpellChance; if (chance > 0){ - int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals. + int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals. - if (MakeRandomInt(1,100) <= chance){ + if (MakeRandomInt(1,100) <= chance){ Critical = true; ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; @@ -2833,34 +2777,34 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { value = (value * GetSpellScale() / 100); entity_list.MessageClose_StringID(this, false, 100, MT_SpellCrits, - OTHER_CRIT_BLAST, GetName(), itoa(-value)); + OTHER_CRIT_BLAST, GetName(), itoa(-value)); return value; } } - value = value_BaseEffect; + value = value_BaseEffect; - value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; + value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; - value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; + value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; - if (target) { + if (target) { value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; value -= target->GetFcDamageAmtIncoming(this, spell_id); - } + } - value -= GetFocusEffect(focusFcDamageAmtCrit, spell_id); + value -= GetFocusEffect(focusFcDamageAmtCrit, spell_id); - value -= GetFocusEffect(focusFcDamageAmt, spell_id); + value -= GetFocusEffect(focusFcDamageAmt, spell_id); if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) - value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); + value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); value = (value * GetSpellScale() / 100); return value; - } +} int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { @@ -2992,126 +2936,126 @@ int8 Merc::GetChanceToCastBySpellType(int16 spellType) { int8 chance = 0; switch (spellType) { - case SpellType_Nuke: { - switch(mercClass) - { + case SpellType_Nuke: { + switch(mercClass) + { case TANK: { chance = 100; break; - } + } case HEALER:{ break; - } + } case MELEEDPS:{ chance = 100; break; - } + } case CASTERDPS:{ chance = 100; break; + } } - } - break; - } - case SpellType_Heal: { - switch(mercClass) - { + break; + } + case SpellType_Heal: { + switch(mercClass) + { case TANK: { break; - } + } case HEALER:{ chance = 100; break; - } + } case MELEEDPS:{ break; - } + } case CASTERDPS:{ break; + } } - } - break; - } - case SpellType_Root: { - switch(mercClass) - { + break; + } + case SpellType_Root: { + switch(mercClass) + { case TANK: { break; - } + } case HEALER:{ break; - } + } case MELEEDPS:{ break; - } + } case CASTERDPS:{ break; + } } - } - break; - } - case SpellType_Buff: { - switch(mercClass) - { + break; + } + case SpellType_Buff: { + switch(mercClass) + { case TANK: { break; - } + } case HEALER:{ chance = IsEngaged() ? 0 : 100; break; - } + } case MELEEDPS:{ break; - } + } case CASTERDPS:{ break; + } } - } - break; - } - case SpellType_InCombatBuff: { - switch(mercClass) - { + break; + } + case SpellType_InCombatBuff: { + switch(mercClass) + { case TANK: { chance = 50; break; - } + } case HEALER:{ break; - } + } case MELEEDPS:{ chance = 50; break; - } + } case CASTERDPS:{ break; + } } - } - break; - } - case SpellType_Escape: { - switch(mercClass) - { + break; + } + case SpellType_Escape: { + switch(mercClass) + { case TANK: { break; - } + } case HEALER:{ break; - } + } case MELEEDPS:{ chance = 100; break; - } + } case CASTERDPS:{ chance = 100; break; + } } - } - break; - } - default: - chance = 0; - break; + break; + } + default: + chance = 0; + break; } return chance; @@ -3124,7 +3068,7 @@ bool Merc::CheckStance(int16 stance) { if(stance == 0 || (stance > 0 && stance == GetStance()) || (stance < 0 && abs(stance) != GetStance())) { - return true; + return true; } return false; @@ -3183,14 +3127,14 @@ MercSpell Merc::GetFirstMercSpellBySpellType(Merc* caster, int spellType) { if((mercSpellList[i].type & spellType) && caster->CheckStance(mercSpellList[i].stance) && CheckSpellRecastTimers(caster, mercSpellList[i].spellid)) { - result.spellid = mercSpellList[i].spellid; - result.stance = mercSpellList[i].stance; - result.type = mercSpellList[i].type; - result.slot = mercSpellList[i].slot; - result.proc_chance = mercSpellList[i].proc_chance; - result.time_cancast = mercSpellList[i].time_cancast; + result.spellid = mercSpellList[i].spellid; + result.stance = mercSpellList[i].stance; + result.type = mercSpellList[i].type; + result.slot = mercSpellList[i].slot; + result.proc_chance = mercSpellList[i].proc_chance; + result.time_cancast = mercSpellList[i].time_cancast; - break; + break; } } } @@ -3220,14 +3164,14 @@ MercSpell Merc::GetMercSpellBySpellID(Merc* caster, uint16 spellid) { if((mercSpellList[i].spellid == spellid) && caster->CheckStance(mercSpellList[i].stance)) { - result.spellid = mercSpellList[i].spellid; - result.stance = mercSpellList[i].stance; - result.type = mercSpellList[i].type; - result.slot = mercSpellList[i].slot; - result.proc_chance = mercSpellList[i].proc_chance; - result.time_cancast = mercSpellList[i].time_cancast; + result.spellid = mercSpellList[i].spellid; + result.stance = mercSpellList[i].stance; + result.type = mercSpellList[i].type; + result.slot = mercSpellList[i].slot; + result.proc_chance = mercSpellList[i].proc_chance; + result.time_cancast = mercSpellList[i].time_cancast; - break; + break; } } } @@ -3314,14 +3258,14 @@ MercSpell Merc::GetBestMercSpellForVeryFastHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsVeryFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3346,14 +3290,14 @@ MercSpell Merc::GetBestMercSpellForFastHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsFastHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3418,14 +3362,14 @@ MercSpell Merc::GetBestMercSpellForPercentageHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3450,14 +3394,14 @@ MercSpell Merc::GetBestMercSpellForRegularSingleTargetHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3483,14 +3427,14 @@ MercSpell Merc::GetFirstMercSpellForSingleTargetHeal(Merc* caster) { if((IsRegularSingleTargetHealSpell(mercSpellListItr->spellid) || IsFastHealSpell(mercSpellListItr->spellid)) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3515,14 +3459,14 @@ MercSpell Merc::GetBestMercSpellForGroupHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsRegularGroupHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3587,14 +3531,14 @@ MercSpell Merc::GetBestMercSpellForGroupCompleteHeal(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsGroupCompleteHealSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3621,14 +3565,14 @@ MercSpell Merc::GetBestMercSpellForAETaunt(Merc* caster) { || spells[mercSpellListItr->spellid].targettype == ST_AETarget || spells[mercSpellListItr->spellid].targettype == ST_UndeadAE) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3653,14 +3597,14 @@ MercSpell Merc::GetBestMercSpellForTaunt(Merc* caster) { // Assuming all the spells have been loaded into this list by level and in descending order if((spells[mercSpellListItr->spellid].targettype == ST_Target) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -3868,15 +3812,15 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) { switch(caster->GetStance()) { - case MercStanceBurnAE: - initialCastChance = 50; - break; - case MercStanceBalanced: - initialCastChance = 25; - break; - case MercStanceBurn: - initialCastChance = 0; - break; + case MercStanceBurnAE: + initialCastChance = 50; + break; + case MercStanceBalanced: + initialCastChance = 25; + break; + case MercStanceBurn: + initialCastChance = 0; + break; } //check of we even want to cast an AE nuke @@ -3903,8 +3847,8 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) { MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { MercSpell result; - int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) - int numTargetsCheck = 1; //used to check for min number of targets to use AE + int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) + int numTargetsCheck = 1; //used to check for min number of targets to use AE bool spellSelected = false; result.spellid = 0; @@ -3916,13 +3860,13 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { switch(caster->GetStance()) { - case MercStanceBurnAE: - numTargetsCheck = 1; - break; - case MercStanceBalanced: - case MercStanceBurn: - numTargetsCheck = 2; - break; + case MercStanceBurnAE: + numTargetsCheck = 1; + break; + case MercStanceBalanced: + case MercStanceBurn: + numTargetsCheck = 2; + break; } if(caster) { @@ -3932,19 +3876,19 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsAENukeSpell(mercSpellListItr->spellid) && !IsAERainNukeSpell(mercSpellListItr->spellid) && !IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - uint8 numTargets = 0; - if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) { - if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + uint8 numTargets = 0; + if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) { + if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) { + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; + } } - } - break; + break; } } } @@ -3954,8 +3898,8 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { MercSpell result; - int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) - int numTargetsCheck = 1; //used to check for min number of targets to use AE + int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) + int numTargetsCheck = 1; //used to check for min number of targets to use AE bool spellSelected = false; result.spellid = 0; @@ -3967,13 +3911,13 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { switch(caster->GetStance()) { - case MercStanceBurnAE: - numTargetsCheck = 2; - break; - case MercStanceBalanced: - case MercStanceBurn: - numTargetsCheck = 3; - break; + case MercStanceBurnAE: + numTargetsCheck = 2; + break; + case MercStanceBalanced: + case MercStanceBurn: + numTargetsCheck = 3; + break; } if(caster) { @@ -4004,8 +3948,8 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { MercSpell result; - int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) - int numTargetsCheck = 1; //used to check for min number of targets to use AE + int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) + int numTargetsCheck = 1; //used to check for min number of targets to use AE bool spellSelected = false; result.spellid = 0; @@ -4017,13 +3961,13 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { switch(caster->GetStance()) { - case MercStanceBurnAE: - numTargetsCheck = 1; - break; - case MercStanceBalanced: - case MercStanceBurn: - numTargetsCheck = 2; - break; + case MercStanceBurnAE: + numTargetsCheck = 1; + break; + case MercStanceBalanced: + case MercStanceBurn: + numTargetsCheck = 2; + break; } if(caster) { @@ -4054,7 +3998,7 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) { MercSpell result; - int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) + int castChance = 50; //used to cycle through multiple spells (first has 50% overall chance, 2nd has 25%, etc.) bool spellSelected = false; result.spellid = 0; @@ -4070,15 +4014,15 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) { for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) - && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { - result.spellid = mercSpellListItr->spellid; - result.stance = mercSpellListItr->stance; - result.type = mercSpellListItr->type; - result.slot = mercSpellListItr->slot; - result.proc_chance = mercSpellListItr->proc_chance; - result.time_cancast = mercSpellListItr->time_cancast; + && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { + result.spellid = mercSpellListItr->spellid; + result.stance = mercSpellListItr->stance; + result.type = mercSpellListItr->type; + result.slot = mercSpellListItr->slot; + result.proc_chance = mercSpellListItr->proc_chance; + result.time_cancast = mercSpellListItr->time_cancast; - break; + break; } } } @@ -4459,40 +4403,40 @@ bool Merc::CheckConfidence() { CurrentCon = this->GetLevelCon(mob->GetLevel()); switch(CurrentCon) { - case CON_GREEN: { - ConRating = 0; - break; - } + case CON_GREEN: { + ConRating = 0; + break; + } - case CON_LIGHTBLUE: { - ConRating = 0.2; - break; - } + case CON_LIGHTBLUE: { + ConRating = 0.2; + break; + } - case CON_BLUE: { - ConRating = 0.6; - break; - } + case CON_BLUE: { + ConRating = 0.6; + break; + } - case CON_WHITE: { - ConRating = 1.0; - break; - } + case CON_WHITE: { + ConRating = 1.0; + break; + } - case CON_YELLOW: { - ConRating = 1.2; - break; - } + case CON_YELLOW: { + ConRating = 1.2; + break; + } - case CON_RED: { - ConRating = 1.5; - break; - } + case CON_RED: { + ConRating = 1.5; + break; + } - default: { - ConRating = 0; - break; - } + default: { + ConRating = 0; + break; + } } ConfidenceCheck += ConRating; @@ -4510,8 +4454,13 @@ bool Merc::CheckConfidence() { } void Merc::MercMeditate(bool isSitting) { + // Don't try to meditate if engaged or dead + if (IsEngaged() || GetAppearance() == eaDead) + { + return; + } if(isSitting) { - // If the bot is a caster has less than 99% mana while its not engaged, he needs to sit to meditate + // If the merc is a caster and has less than 99% mana while its not engaged, he needs to sit to meditate if(GetManaRatio() < 99.0f) { if(!IsSitting()) @@ -4616,7 +4565,7 @@ float Merc::GetMaxMeleeRangeToTarget(Mob* target) { void Merc::DoClassAttacks(Mob *target) { if(target == nullptr) - return; //gotta have a target for all these + return; //gotta have a target for all these bool ca_time = classattack_timer.Check(false); @@ -4630,65 +4579,65 @@ void Merc::DoClassAttacks(Mob *target) { float HasteModifier = GetHaste() * 0.01f; int level = GetLevel(); - int reuse = TauntReuseTime * 1000; //make this very long since if they dont use it once, they prolly never will + int reuse = TauntReuseTime * 1000; //make this very long since if they dont use it once, they prolly never will bool did_attack = false; //class specific stuff... switch(GetClass()) { - case MELEEDPS: - if(level >= 10) { - reuse = BackstabReuseTime * 1000; - TryBackstab(target, reuse); - did_attack = true; - } - break; - case TANK:{ - if(level >= RuleI(Combat, NPCBashKickLevel)){ - if(MakeRandomInt(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. - { - DoAnim(animKick); - int32 dmg = 0; - - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ - dmg = -5; - } - else{ - if(target->CheckHitChance(this, SkillKick, 0)) { - if(RuleB(Combat, UseIntervalAC)) - dmg = GetKickDamage(); - else - dmg = MakeRandomInt(1, GetKickDamage()); - - } - } - - reuse = KickReuseTime * 1000; - DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + case MELEEDPS: + if(level >= 10) { + reuse = BackstabReuseTime * 1000; + TryBackstab(target, reuse); did_attack = true; } - else - { - DoAnim(animTailRake); - int32 dmg = 0; + break; + case TANK:{ + if(level >= RuleI(Combat, NPCBashKickLevel)){ + if(MakeRandomInt(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. + { + DoAnim(animKick); + int32 dmg = 0; - if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ - dmg = -5; - } - else{ - if(target->CheckHitChance(this, SkillBash, 0)) { - if(RuleB(Combat, UseIntervalAC)) - dmg = GetBashDamage(); - else - dmg = MakeRandomInt(1, GetBashDamage()); + if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + dmg = -5; } - } + else{ + if(target->CheckHitChance(this, SkillKick, 0)) { + if(RuleB(Combat, UseIntervalAC)) + dmg = GetKickDamage(); + else + dmg = MakeRandomInt(1, GetKickDamage()); - reuse = BashReuseTime * 1000; - DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1, reuse); - did_attack = true; + } + } + + reuse = KickReuseTime * 1000; + DoSpecialAttackDamage(target, SkillKick, dmg, 1, -1, reuse); + did_attack = true; + } + else + { + DoAnim(animTailRake); + int32 dmg = 0; + + if(GetWeaponDamage(target, (const Item_Struct*)nullptr) <= 0){ + dmg = -5; + } + else{ + if(target->CheckHitChance(this, SkillBash, 0)) { + if(RuleB(Combat, UseIntervalAC)) + dmg = GetBashDamage(); + else + dmg = MakeRandomInt(1, GetBashDamage()); + } + } + + reuse = BashReuseTime * 1000; + DoSpecialAttackDamage(target, SkillBash, dmg, 1, -1, reuse); + did_attack = true; + } } - } - break; - } + break; + } } classattack_timer.Start(reuse / HasteModifier); @@ -4749,21 +4698,23 @@ Mob* Merc::GetOwnerOrSelf() { bool Merc::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { if(!NPC::Death(killerMob, damage, spell, attack_skill)) + { return false; + } Save(); - Mob *give_exp = hate_list.GetDamageTop(this); - Client *give_exp_client = nullptr; + //no corpse, no exp if we're a merc. + //We'll suspend instead, since that's what live does. + //Not actually sure live supports 'depopping' merc corpses. + //if(entity_list.GetCorpseByID(GetID())) + // entity_list.GetCorpseByID(GetID())->Depop(); - if(give_exp && give_exp->IsClient()) - give_exp_client = give_exp->CastToClient(); - - bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); - - //no corpse, no exp if we're a merc. We'll suspend instead, since that's what live does. I'm not actually sure live supports 'depopping' merc corpses. - if(entity_list.GetCorpseByID(GetID())) - entity_list.GetCorpseByID(GetID())->Depop(); + // If client is in zone, suspend merc, else depop it. + if (!Suspend()) + { + Depop(); + } return true; } @@ -4809,8 +4760,8 @@ const char* Merc::GetRandomName(){ bool vwl=false; bool dbl=false; if (rndnum>63) - { // rndnum is 0 - 75 where 64-75 is cons pair, 17-63 is cons, 0-16 is vowel - rndnum=(rndnum-61)*2; // name can't start with "ng" "nd" or "rk" + { // rndnum is 0 - 75 where 64-75 is cons pair, 17-63 is cons, 0-16 is vowel + rndnum=(rndnum-61)*2; // name can't start with "ng" "nd" or "rk" rndname[0]=paircons[rndnum]; rndname[1]=paircons[rndnum+1]; n=2; @@ -4829,37 +4780,37 @@ const char* Merc::GetRandomName(){ for (int i=n;i46) - { // pick a cons pair - if (i>namlen-3) // last 2 chars in name? - { // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng" + { // pick a cons pair + if (i>namlen-3) // last 2 chars in name? + { // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng" rndnum=MakeRandomInt(0, 7)*2; } else - { // pick any from the set + { // pick any from the set rndnum=(rndnum-47)*2; } rndname[i]=paircons[rndnum]; rndname[i+1]=paircons[rndnum+1]; - dlc=true; // flag keeps second letter from being doubled below + dlc=true; // flag keeps second letter from being doubled below i+=1; } else - { // select a single cons + { // select a single cons rndname[i]=cons[rndnum]; } } else - { // select a vowel + { // select a vowel rndname[i]=vowels[MakeRandomInt(0, 16)]; } vwl=!vwl; if (!dbl && !dlc) - { // one chance at double letters in name - if (!MakeRandomInt(0, i+9)) // chances decrease towards end of name + { // one chance at double letters in name + if (!MakeRandomInt(0, i+9)) // chances decrease towards end of name { rndname[i+1]=rndname[i]; dbl=true; @@ -4890,7 +4841,6 @@ const char* Merc::GetRandomName(){ return name; } - bool Compare_Merc_Spells(MercSpell i, MercSpell j); bool Compare_Merc_Spells(MercSpell i, MercSpell j) @@ -4944,7 +4894,7 @@ bool Merc::LoadMercSpells() { GetMercOwner()->Message(7, "Mercenary Debug: Spell list for merc."); for (int i = merc_spells.size() - 1; i >= 0; i--) { - GetMercOwner()->Message(7, "%i] Slot: %i, SpellID: %i, Type: %i, Stance: %i, Proc Chance: %i", i, merc_spells[i].slot, merc_spells[i].spellid, merc_spells[i].type, merc_spells[i].stance, merc_spells[i].proc_chance); + GetMercOwner()->Message(7, "%i] Slot: %i, SpellID: %i, Type: %i, Stance: %i, Proc Chance: %i", i, merc_spells[i].slot, merc_spells[i].spellid, merc_spells[i].type, merc_spells[i].stance, merc_spells[i].proc_chance); }*/ } @@ -4952,28 +4902,33 @@ bool Merc::LoadMercSpells() { } bool Merc::Save() { - bool Result = false; + if(database.SaveMerc(this)){ - Result = true; + return true; } - return Result; + return false; } Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, bool updateFromDB) { - if(c) { - if(c->GetMercID()) { + if(c) + { + if(c->GetMercID()) + { merc_template = zone->GetMercTemplate(c->GetMercInfo().MercTemplateID); } } //get mercenary data - if(merc_template) { - const NPCType* npc_type_to_copy = database.GetMercType(merc_template->MercNPCID, merc_template->RaceID, c->GetLevel()); //TODO: Maybe add a way of updating client merc stats in a seperate function? like, for example, on leveling up. + if(merc_template) + { + //TODO: Maybe add a way of updating client merc stats in a seperate function? like, for example, on leveling up. + const NPCType* npc_type_to_copy = database.GetMercType(merc_template->MercNPCID, merc_template->RaceID, c->GetLevel()); if(npc_type_to_copy != nullptr) { - NPCType* npc_type = new NPCType; //This is actually a very terrible method of assigning stats, and should be changed at some point. See the comment in merc's deconstructor. + //This is actually a very terrible method of assigning stats, and should be changed at some point. See the comment in merc's deconstructor. + NPCType* npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); memcpy(npc_type, npc_type_to_copy, sizeof(NPCType)); if(c && !updateFromDB) @@ -4982,7 +4937,6 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, { snprintf(c->GetMercInfo().merc_name, 64, "%s", GetRandomName()); //sanity check. } - snprintf(c->GetEPP().merc_name, 64, "%s", c->GetMercInfo().merc_name); snprintf(npc_type->name, 64, "%s", c->GetMercInfo().merc_name); } uint8 gender = 0; @@ -5006,17 +4960,18 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, Merc* merc = new Merc(npc_type, c->GetX(), c->GetY(), c->GetZ(), 0); - if(merc) { + if(merc) + { merc->SetMercData( merc_template->MercTemplateID ); database.LoadMercEquipment(merc); merc->UpdateMercStats(c); - if(updateFromDB) { + if(updateFromDB) + { database.LoadCurrentMerc(c); merc->SetMercID(c->GetMercInfo().mercid); snprintf(merc->name, 64, "%s", c->GetMercInfo().merc_name); - snprintf(c->GetEPP().merc_name, 64, "%s", c->GetMercInfo().merc_name); merc->SetSuspended(c->GetMercInfo().IsSuspended); merc->gender = c->GetMercInfo().Gender; merc->SetHP(c->GetMercInfo().hp <= 0 ? merc->GetMaxHP() : c->GetMercInfo().hp); @@ -5112,7 +5067,18 @@ void Merc::UpdateMercStats(Client *c) { } } -void Merc::UpdateMercAppearance(Client *c) { +void Merc::UpdateMercAppearance() { + // Copied from Bot Code: + uint32 itemID = NO_ITEM; + uint8 materialFromSlot = _MaterialInvalid; + for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { + itemID = equipment[i]; + if(itemID != NO_ITEM) { + materialFromSlot = Inventory::CalcMaterialFromSlot(i); + if(materialFromSlot != _MaterialInvalid) + this->SendWearChange(materialFromSlot); + } + } } void Merc::AddItem(uint8 slot, uint32 item_id) { @@ -5120,8 +5086,6 @@ void Merc::AddItem(uint8 slot, uint32 item_id) { } bool Merc::Spawn(Client *owner) { - if(!RuleB(Mercs, AllowMercs)) - return false; if(!owner) return false; @@ -5135,25 +5099,153 @@ bool Merc::Spawn(Client *owner) { SendPosition(); + //UpdateMercAppearance(); + //printf("Spawned Merc with ID %i\n", npc->GetID()); fflush(stdout); - /* - uint32 itemID = NO_ITEM; - uint8 materialFromSlot = _MaterialInvalid; - for(int i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::EQUIPMENT_END; ++i) { - itemID = GetMercItemBySlot(i); - if(itemID != NO_ITEM) { - materialFromSlot = Inventory::CalcMaterialFromSlot(i); - if(materialFromSlot != _MaterialInvalid) { - this->SendWearChange(materialFromSlot); - } - } - } - */ - return true; } +void Client::SendMercResponsePackets(uint32 ResponseType) +{ + switch (ResponseType) + { + case 0: // Mercenary Spawned Successfully? + SendMercMerchantResponsePacket(0); + break; + case 1: //You do not have enough funds to make that purchase! + SendMercMerchantResponsePacket(1); + break; + case 2: //Mercenary does not exist! + SendMercMerchantResponsePacket(2); + break; + case 3: //Mercenary failed to spawn! + SendMercMerchantResponsePacket(3); + break; + case 4: //Mercenaries are not allowed in raids! + SendMercMerchantResponsePacket(4); + break; + case 5: //You already have a pending mercenary purchase! + SendMercMerchantResponsePacket(5); + break; + case 6: //You have the maximum number of mercenaries. You must dismiss one before purchasing a new one! + SendMercMerchantResponsePacket(6); + break; + case 7: //You must dismiss your suspended mercenary before purchasing a new one! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(7); + else + //You have the maximum number of mercenaries. You must dismiss one before purchasing a new one! + SendMercMerchantResponsePacket(6); + break; + case 8: //You can not purchase a mercenary because your group is full! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(8); + else + SendMercMerchantResponsePacket(7); + break; + case 9: //You can not purchase a mercenary because you are in combat! + if (GetClientVersion() < EQClientRoF) + //Mercenary failed to spawn! + SendMercMerchantResponsePacket(3); + else + SendMercMerchantResponsePacket(8); + break; + case 10: //You have recently dismissed a mercenary and must wait a few more seconds before you can purchase a new one! + if (GetClientVersion() < EQClientRoF) + //Mercenary failed to spawn! + SendMercMerchantResponsePacket(3); + else + SendMercMerchantResponsePacket(9); + break; + case 11: //An error occurred created your mercenary! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(9); + else + SendMercMerchantResponsePacket(10); + break; + case 12: //Upkeep Charge Message + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(10); + else + SendMercMerchantResponsePacket(11); + break; + case 13: // ??? + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(11); + else + SendMercMerchantResponsePacket(12); + break; + case 14: //You ran out of funds to pay for your mercenary! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(12); + else + SendMercMerchantResponsePacket(13); + break; + case 15: // ??? + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(13); + else + SendMercMerchantResponsePacket(14); + break; + case 16: //Your mercenary is about to be suspended due to insufficient funds! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(14); + else + SendMercMerchantResponsePacket(15); + break; + case 17: //There is no mercenary liaison nearby! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(15); + else + SendMercMerchantResponsePacket(16); + break; + case 18: //You are too far from the liaison! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(16); + else + SendMercMerchantResponsePacket(17); + break; + case 19: //You do not meet the requirements for that mercenary! + if (GetClientVersion() < EQClientRoF) + SendMercMerchantResponsePacket(17); + else + SendMercMerchantResponsePacket(18); + break; + case 20: //You are unable to interact with the liaison! + if (GetClientVersion() < EQClientRoF) + //You are too far from the liaison! + SendMercMerchantResponsePacket(16); + else + SendMercMerchantResponsePacket(19); + break; + case 21: //You do not have a high enough membership level to purchase this mercenary! + if (GetClientVersion() < EQClientRoF) + //You do not meet the requirements for that mercenary! + SendMercMerchantResponsePacket(17); + else + SendMercMerchantResponsePacket(20); + break; + case 22: //Your purchase has failed because this mercenary requires a Gold membership! + if (GetClientVersion() < EQClientRoF) + //You do not meet the requirements for that mercenary! + SendMercMerchantResponsePacket(17); + else + SendMercMerchantResponsePacket(21); + break; + case 23: //Your purchase has failed because this mercenary requires at least a Silver membership! + if (GetClientVersion() < EQClientRoF) + //You do not meet the requirements for that mercenary! + SendMercMerchantResponsePacket(17); + else + SendMercMerchantResponsePacket(22); + break; + default: //Mercenary failed to spawn! + SendMercMerchantResponsePacket(3); + break; + } +} + void Client::UpdateMercTimer() { Merc *merc = GetMerc(); @@ -5162,135 +5254,87 @@ void Client::UpdateMercTimer() { if(GetMercTimer()->Check()) { - uint32 upkeep = Merc::CalcUpkeepCost(merc->GetMercTemplateID(), GetLevel()); + uint32 upkeep = merc->CalcUpkeepCost(merc->GetMercTemplateID(), GetLevel()); - if(CheckCanRetainMerc(upkeep)) { - if(RuleB(Mercs, ChargeMercUpkeepCost)) { + if(CheckCanRetainMerc(upkeep)) + { + if(RuleB(Mercs, ChargeMercUpkeepCost)) + { TakeMoneyFromPP((upkeep * 100), true); } } - else { + else + { merc->Suspend(); return; } + // Reset the upkeep timer GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS); - SendMercTimerPacket(GetMercID(), 5, 0, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + SendMercTimer(merc); GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS)); GetMercTimer()->SetTimer(GetMercInfo().MercTimerRemaining); - // Send upkeep charge message and reset the upkeep timer - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(10); - else - SendMercMerchantResponsePacket(11); + // Send upkeep charge message + SendMercResponsePackets(12); - /* - uint32 upkeep_plat = 0; - uint32 upkeep_gold = 0; - - if (upkeep >= 10) - upkeep_plat = (int)(upkeep / 10); - - if (upkeep - (upkeep_plat * 10) >= 1) - upkeep_gold = (int)((upkeep - (upkeep_plat * 10)) / 100); - */ + // Warn that mercenary is about to be suspended due to insufficient funds (on next upkeep) + if (RuleB(Mercs, ChargeMercUpkeepCost) && upkeep > 0 && !HasMoney(upkeep * 100)) + { + SendMercResponsePackets(16); + } // Normal upkeep charge message //Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60)); // Message below given when too low level to be charged - // Temporarily enabled for all upkeep costs until mercenary stuff is completed //Message(7, "Your mercenary waived an upkeep cost of %i plat, and %i gold or %i %s and your mercenary upkeep cost timer has been reset to %i minutes", upkeep_plat, upkeep_gold, 1, "Bayle Marks", (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60)); } } } bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { + + if (!CheckCanSpawnMerc(template_id)) + { + return false; + } + MercTemplate* mercTemplate = zone->GetMercTemplate(template_id); - //invalid merc data - if(!mercTemplate) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(9); - else - SendMercMerchantResponsePacket(10); + //check for suspended merc + if(GetMercInfo().mercid != 0 && GetMercInfo().IsSuspended) { + SendMercResponsePackets(6); return false; } - //check client version - if(GetClientVersion() < mercTemplate->ClientVersion) { - SendMercMerchantResponsePacket(3); + // Check if max number of mercs is already reached + if(GetNumMercs() >= MAXMERCS) { + SendMercResponsePackets(6); return false; } - if(GetClientVersion() >= EQClientRoF && GetNumMercs() >= MAXMERCS) { - SendMercMerchantResponsePacket(6); - return false; - } - else if(GetMerc()) { //check for current merc - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(6); - else - SendMercMerchantResponsePacket(6); - return false; - } - else if(GetMercInfo().mercid != 0 && GetMercInfo().IsSuspended) { //has suspended merc - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(7); - else - SendMercMerchantResponsePacket(6); - return false; - } - - //check for sufficient funds - if(RuleB(Mercs, ChargeMercPurchaseCost)) { - uint32 cost = Merc::CalcPurchaseCost(template_id, GetLevel()) * 100; // Cost is in gold - if(cost > 0 && !HasMoney(cost)) { - SendMercMerchantResponsePacket(1); - return false; - } - } - - //check for raid - if(HasRaid()) { - SendMercMerchantResponsePacket(4); - return false; - } - - //check group size - if(HasGroup() && GetGroup()->GroupCount() >= MAX_GROUP_MEMBERS) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(8); - else - SendMercMerchantResponsePacket(7); - return false; - } - - //check in combat - if(GetClientVersion() >= EQClientRoF && GetAggroCount() > 0) { - SendMercMerchantResponsePacket(8); - return false; - } - - //check for valid merchant - can check near area for any merchants + //check for valid merchant if(!merchant) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(14); - else - SendMercMerchantResponsePacket(16); + SendMercResponsePackets(17); return false; } //check for merchant too far away if(DistNoRoot(*merchant) > USE_NPC_RANGE2) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(15); - else - SendMercMerchantResponsePacket(17); + SendMercResponsePackets(18); return false; } + //check for sufficient funds and remove them last + if(RuleB(Mercs, ChargeMercPurchaseCost)) { + uint32 cost = Merc::CalcPurchaseCost(template_id, GetLevel()) * 100; // Cost is in gold + if(cost > 0 && !HasMoney(cost)) { + SendMercResponsePackets(1); + return false; + } + } + return true; } @@ -5301,7 +5345,7 @@ bool Client::CheckCanRetainMerc(uint32 upkeep) { if(RuleB(Mercs, ChargeMercPurchaseCost)) { if(merc) { if(upkeep > 0 && !HasMoney(upkeep * 100)) { - SendMercMerchantResponsePacket(1); + SendMercResponsePackets(14); return false; } } @@ -5310,116 +5354,127 @@ bool Client::CheckCanRetainMerc(uint32 upkeep) { return true; } -bool Client::CheckCanUnsuspendMerc() { - MercTemplate* mercTemplate = zone->GetMercTemplate(GetMercInfo().MercTemplateID); +bool Client::CheckCanSpawnMerc(uint32 template_id) { - //invalid merc data - if(!mercTemplate) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(9); - else - SendMercMerchantResponsePacket(10); + // Check if mercs are enabled globally + if(!RuleB(Mercs, AllowMercs)) { return false; } - //check client version - if(GetClientVersion() < mercTemplate->ClientVersion) { - SendMercMerchantResponsePacket(3); - return false; - } - - //check for raid - if(HasRaid()) { - SendMercMerchantResponsePacket(4); - return false; - } - - //check group size - if(HasGroup() && GetGroup()->GroupCount() >= MAX_GROUP_MEMBERS) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(8); - else - SendMercMerchantResponsePacket(7); - return false; - } - - //check if zone allows mercs + // Check if zone allows mercs if(!zone->AllowMercs()) { - if (GetClientVersion() < EQClientRoF) - SendMercMerchantResponsePacket(4); // ?? - else - SendMercMerchantResponsePacket(4); // ?? + SendMercResponsePackets(3); return false; } - //check in combat - if(GetClientVersion() >= EQClientRoF && GetAggroCount() > 0) { - SendMercMerchantResponsePacket(8); + MercTemplate* mercTemplate = zone->GetMercTemplate(template_id); + + // Invalid merc data + if(!mercTemplate) { + SendMercResponsePackets(11); return false; } + // Check client version + if(GetClientVersion() < mercTemplate->ClientVersion) { + SendMercResponsePackets(3); + return false; + } + + // Check for raid + if(HasRaid()) { + SendMercResponsePackets(4); + return false; + } + + // Check group size + if(HasGroup() && GetGroup()->GroupCount() >= MAX_GROUP_MEMBERS) { + SendMercResponsePackets(8); + return false; + } + + // Check in combat + if(GetAggroCount() > 0) { + SendMercResponsePackets(9); + return false; + } + + return true; +} + +bool Client::CheckCanUnsuspendMerc() { + + if (!CheckCanSpawnMerc(GetMercInfo().MercTemplateID)) + { + return false; + } + + MercTemplate* mercTemplate = zone->GetMercTemplate(GetMercInfo().MercTemplateID); + if(!GetPTimers().Expired(&database, pTimerMercSuspend, false)) { - SendMercMerchantResponsePacket(16); - Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend)); //todo: find this packet response and tell them properly. + SendMercResponsePackets(10); + //TODO: find this packet response and tell them properly. + Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend)); return false; } + return true; } bool Client::CheckCanDismissMerc() { - if(!GetMerc()) { - Message(7, "You have no mercenary to dismiss."); - return false; - } - if(GetMerc()->IsCasting()) { - Message(7, "Unable to dismiss mercenary."); + if(!GetMercID()) + { + Message(7, "You have no mercenary to dismiss."); return false; } return true; } -void Client::CheckMercSuspendTimer() -{ - if(GetMercInfo().SuspendedTime != 0) { - if(time(nullptr) >= GetMercInfo().SuspendedTime){ - SendMercSuspendResponsePacket(0); +void Client::CheckMercSuspendTimer() { + + if(GetMercInfo().SuspendedTime != 0) + { + if(time(nullptr) >= GetMercInfo().SuspendedTime) + { + GetMercInfo().SuspendedTime = 0; + SendMercResponsePackets(0); } } } -void Client::SuspendMercCommand() -{ +void Client::SuspendMercCommand() { + bool ExistsMerc = GetMercInfo().MercTemplateID != 0; if(ExistsMerc == true) { - if(GetMercInfo().IsSuspended) { - //p_timers.Enable(pTimerMercReuse); - - // Set time remaining to max on unsuspend - there is a charge for unsuspending as well - // GetEPP().mercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS); - if(!CheckCanUnsuspendMerc()){ + if(GetMercInfo().IsSuspended) + { + if(!CheckCanUnsuspendMerc()) + { return; } // Get merc, assign it to client & spawn Merc* merc = Merc::LoadMerc(this, &zone->merc_templates[GetMercInfo().MercTemplateID], 0, true); - if(merc) { + if(merc) + { SpawnMerc(merc, true); } - else { + else + { //merc failed to spawn - SendMercMerchantResponsePacket(3); + SendMercResponsePackets(3); } } else { Merc* CurrentMerc = GetMerc(); - if(CurrentMerc && GetMercID()) { - //CurrentMerc->Save(); + if(CurrentMerc && GetMercID()) + { CurrentMerc->Suspend(); } } @@ -5429,68 +5484,89 @@ void Client::SuspendMercCommand() // Handles all client zone change event void Merc::ProcessClientZoneChange(Client* mercOwner) { - if(mercOwner) { + + if(mercOwner) + { Zone(); } } -void Client::SpawnMercOnZone() -{ +void Client::SpawnMercOnZone() { + if(!RuleB(Mercs, AllowMercs)) return; if (GetMerc()) return; - bool ExistsMerc = GetEPP().merc_name[0] != 0; - if(ExistsMerc == true) + if(database.LoadMercInfo(this)) { - if(!GetMercInfo().IsSuspended) { + if(!GetMercInfo().IsSuspended) + { GetMercInfo().SuspendedTime = 0; // Get merc, assign it to client & spawn - if(database.LoadMercInfo(this)) { - if(!CheckCanUnsuspendMerc()){ - return; - } - Merc* merc = Merc::LoadMerc(this, &zone->merc_templates[GetMercInfo().MercTemplateID], 0, true); - if(merc) { - SpawnMerc(merc, false); - SendMercTimerPacket(merc->GetID(), 5, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); - } + Merc* merc = Merc::LoadMerc(this, &zone->merc_templates[GetMercInfo().MercTemplateID], 0, true); + if(merc) + { + SpawnMerc(merc, false); } } else { // Send Mercenary Status/Timer packet - SendMercTimerPacket(0, 1, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + SendMercTimer(GetMerc()); SendMercPersonalInfo(); - if(GetMercInfo().SuspendedTime != 0) { - if(time(nullptr) >= GetMercInfo().SuspendedTime){ - GetMercInfo().SuspendedTime = 0; - } - } + CheckMercSuspendTimer(); SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime); } } } -void Client::SpawnMerc(Merc* merc, bool setMaxStats) -{ - if(!RuleB(Mercs, AllowMercs)) - return; +void Client::SendMercTimer(Merc* merc) { - if(merc) { - merc->Spawn(this); - merc->SetSuspended(false); - SetMerc(merc); - merc->Unsuspend(setMaxStats); - merc->SetStance(GetMercInfo().Stance); + if (GetMercInfo().mercid == 0) + { + //return; + } + + if (!merc) + { + SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + } + else if (merc->IsSuspended()) + { + SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + } + else + { + SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); } } +void Client::SpawnMerc(Merc* merc, bool setMaxStats) { + + if (!merc || !CheckCanSpawnMerc(merc->GetMercTemplateID())) + { + return; + } + + merc->Spawn(this); + merc->SetSuspended(false); + SetMerc(merc); + merc->Unsuspend(setMaxStats); + merc->SetStance(GetMercInfo().Stance); + GetMercInfo().SuspendedTime = 0; + + SendMercTimer(merc); + + return; + +} + bool Merc::Suspend() { + Client* mercOwner = GetMercOwner(); if(!mercOwner) @@ -5507,13 +5583,18 @@ bool Merc::Suspend() { mercOwner->SendMercSuspendResponsePacket(mercOwner->GetMercInfo().SuspendedTime); + mercOwner->SendMercTimer(this); + Depop(); - mercOwner->SendMercTimerPacket(0, 1, mercOwner->GetMercInfo().SuspendedTime, mercOwner->GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + // Start the timer to send the packet that refreshes the Unsuspend Button + mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS)); + return true; } bool Merc::Unsuspend(bool setMaxStats) { + Client* mercOwner = nullptr; bool loaded = false; @@ -5524,10 +5605,9 @@ bool Merc::Unsuspend(bool setMaxStats) { if(!mercOwner) return false; - if(GetID()) { - uint32 mercState = 5; - uint32 suspendedTime = 0; - + if(GetID()) + { + // Set time remaining to max on unsuspend - there is a charge for unsuspending as well SetSuspended(false); mercOwner->GetMercInfo().mercid = GetMercID(); @@ -5538,14 +5618,16 @@ bool Merc::Unsuspend(bool setMaxStats) { mercOwner->GetMercInfo().SuspendedTime = 0; mercOwner->GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS)); mercOwner->GetMercTimer()->SetTimer(mercOwner->GetMercInfo().MercTimerRemaining); - mercOwner->SendMercTimerPacket(GetID(), mercState, suspendedTime, mercOwner->GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + mercOwner->SendMercTimer(this); if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false)) mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend); mercOwner->SendMercPersonalInfo(); Group* g = entity_list.GetGroupByClient(mercOwner); - if(!g) { //nobody from our group is here... start a new group + //nobody from our group is here... start a new group + if(!g) + { g = new Group(mercOwner); if(!g) { @@ -5562,7 +5644,8 @@ bool Merc::Unsuspend(bool setMaxStats) { return false; } - if(AddMercToGroup(this, g)) { + if(AddMercToGroup(this, g)) + { entity_list.AddGroup(g, g->GetID()); database.SetGroupLeaderName(g->GetID(), mercOwner->GetName()); database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID()); @@ -5571,17 +5654,21 @@ bool Merc::Unsuspend(bool setMaxStats) { g->SaveGroupLeaderAA(); loaded = true; } - else { + else + { g->DisbandGroup(); } - } //else, somebody from our group is already here... - else if (AddMercToGroup(this, mercOwner->GetGroup())) { + } + else if (AddMercToGroup(this, mercOwner->GetGroup())) + { + // Group already exists database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true); database.RefreshGroupFromDB(mercOwner); loaded = true; } - else { + else + { if(MERC_DEBUG > 0) mercOwner->Message(7, "Mercenary failed to join the group - Suspending"); @@ -5589,35 +5676,45 @@ bool Merc::Unsuspend(bool setMaxStats) { } - if(loaded) { + if(loaded) + { LoadMercSpells(); - if(setMaxStats) { + if(setMaxStats) + { SetHP(GetMaxHP()); SetMana(GetMaxMana()); SetEndurance(GetMaxEndurance()); } + + //check for sufficient funds and remove them last + if(RuleB(Mercs, ChargeMercUpkeepCost)) + { + uint32 cost = CalcUpkeepCost(GetMercTemplateID(), GetLevel()) * 100; // Cost is in gold + if(cost > 0 && !mercOwner->HasMoney(cost)) + { + mercOwner->SendMercResponsePackets(1); + return false; + } + } } } return true; } -bool Merc::Dismiss(){ +bool Merc::Dismiss() { Client* mercOwner = GetMercOwner(); - if(!mercOwner) - return false; - - mercOwner->SendClearMercInfo(); - - //SetMercEntityID(0); - - mercOwner->SetMerc(0); - database.DeleteMerc(GetMercID()); - + + if(mercOwner) + { + mercOwner->SendClearMercInfo(); + mercOwner->SetMerc(0); + } + Depop(); return true; @@ -5629,18 +5726,27 @@ void Merc::Zone() { } void Merc::Depop() { + WipeHateList(); - entity_list.RemoveMerc(this->GetID()); + + if(IsCasting()) + { + InterruptSpell(); + } + entity_list.RemoveFromHateLists(this); if(HasGroup()) - Merc::RemoveMercFromGroup(this, GetGroup()); - - if(HasPet()) { - GetPet()->Depop(); + { + RemoveMercFromGroup(this, GetGroup()); } - SetOwnerID(0); + entity_list.RemoveMerc(this->GetID()); + + if(HasPet()) + { + GetPet()->Depop(); + } p_depop = true; @@ -5648,14 +5754,19 @@ void Merc::Depop() { } bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { + bool Result = false; - if(merc && group) { - if(merc->HasGroup()) { - if(!group->IsLeader(merc)) { + if(merc && group) + { + if(merc->HasGroup()) + { + if(!group->IsLeader(merc)) + { merc->SetFollowID(0); - if(group->DelMember(merc)) { + if(group->DelMember(merc, true)) + { if(merc->GetMercCharacterID() != 0) database.SetGroupID(merc->GetName(), 0, merc->GetMercCharacterID(), true); } @@ -5665,8 +5776,10 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { group->DisbandGroup(); } } - else { - for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { + else + { + for(int i = 0; i < MAX_GROUP_MEMBERS; i++) + { if(!group->members[i]) continue; @@ -5675,11 +5788,14 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { Merc* groupmerc = group->members[i]->CastToMerc(); - groupmerc->SetOwnerID(0); + //groupmerc->SetOwnerID(0); + if (!groupmerc->IsSuspended()) + { + groupmerc->Suspend(); + database.SetGroupID(groupmerc->GetCleanName(), 0, groupmerc->GetMercCharacterID(), true); + } } - group->DisbandGroup(); - database.SetGroupID(merc->GetCleanName(), 0, merc->GetMercCharacterID(), true); } Result = true; @@ -5695,15 +5811,17 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) { if(merc && group) { // Remove merc from current group if any if(merc->HasGroup()) { - Merc::RemoveMercFromGroup(merc, merc->GetGroup()); + merc->RemoveMercFromGroup(merc, merc->GetGroup()); } //Try and add the member, followed by checking if the merc owner exists. - if(group->AddMember(merc) && merc->GetMercOwner() != nullptr) { - merc->SetFollowID(merc->GetMercOwner()->GetID()); - Result = true; + if(group->AddMember(merc) && merc->GetMercOwner() != nullptr) + { + merc->SetFollowID(merc->GetMercOwner()->GetID()); + Result = true; } - else { - //Suspend it if the member is not added and the merc's owner is not valid. + else + { + //Suspend it if the member is not added or the merc's owner is not valid. merc->Suspend(); } } @@ -5712,34 +5830,45 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) { } void Client::InitializeMercInfo() { - for(int i=0; iGetOwnerID() != GetID()) { + if(tmp->GetOwnerID() != GetID()) + { SetMercID(0); - return(nullptr); + return (nullptr); } - return(tmp); + return (tmp); } uint8 Client::GetNumMercs() { + uint8 numMercs = 0; - for(int i=0; iGetMercTemplate(template_id); SetMercTemplateID( merc_template->MercTemplateID ); SetMercType( merc_template->MercType ); @@ -5756,6 +5886,7 @@ void Merc::SetMercData( uint32 template_id ) { SetTierID( merc_template->TierID ); SetCostFormula( merc_template->CostFormula ); SetMercNameType( merc_template->MercNameType ); + } MercTemplate* Zone::GetMercTemplate( uint32 template_id ) { @@ -5763,11 +5894,15 @@ MercTemplate* Zone::GetMercTemplate( uint32 template_id ) { } void Client::SetMerc(Merc* newmerc) { + Merc* oldmerc = GetMerc(); - if (oldmerc) { + if (oldmerc) + { oldmerc->SetOwnerID(0); } - if (!newmerc) { + + if (!newmerc) + { SetMercID(0); GetMercInfo().mercid = 0; GetMercInfo().MercTemplateID = 0; @@ -5777,10 +5912,10 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().Gender = 0; GetMercInfo().State = 0; memset(GetMercInfo().merc_name, 0, 64); - memset(GetEPP().merc_name, 0, 64); - } else { + } + else + { SetMercID(newmerc->GetID()); - //newmerc->SetMercEntityID(newmerc->GetID()); //Client* oldowner = entity_list.GetClientByID(newmerc->GetOwnerID()); newmerc->SetOwnerID(this->GetID()); newmerc->SetMercCharacterID(this->CharacterID()); @@ -5792,43 +5927,52 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().SuspendedTime = 0; GetMercInfo().Gender = newmerc->GetGender(); //GetMercInfo().State = newmerc->GetStance(); + snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName()); } } void Client::UpdateMercLevel() { Merc* merc = GetMerc(); - if (merc) { + if (merc) + { merc->UpdateMercStats(this); } } void Client::SendMercMerchantResponsePacket(int32 response_type) { // This response packet brings up the Mercenary Manager window - if(GetClientVersion() >= EQClientSoD) { + if(GetClientVersion() >= EQClientSoD) + { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct)); MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; - mmr->ResponseType = response_type; // send specified response type + mmr->ResponseType = response_type; // send specified response type FastQueuePacket(&outapp); } } void Client::SendMercenaryUnknownPacket(uint8 type) { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); + } void Client::SendMercenaryUnsuspendPacket(uint8 type) { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); + } void Client::SendMercSuspendResponsePacket(uint32 suspended_time) { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenarySuspendResponse, sizeof(SuspendMercenaryResponse_Struct)); SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer; - smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp + smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp FastQueuePacket(&outapp); + } void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspended_time, int32 update_interval, int32 unk01) { @@ -5842,6 +5986,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer FastQueuePacket(&outapp); + } void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) { @@ -5856,19 +6001,21 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) { void NPC::LoadMercTypes() { std::string query = StringFormat("SELECT DISTINCT MTyp.dbstring, MTyp.clientversion " - "FROM merc_merchant_entries MME, merc_merchant_template_entries MMTE, " - "merc_types MTyp, merc_templates MTem " - "WHERE MME.merchant_id = %i " - "AND MME.merc_merchant_template_id = MMTE.merc_merchant_template_id " - "AND MMTE.merc_template_id = MTem.merc_template_id " - "AND MTem.merc_type_id = MTyp.merc_type_id;", GetNPCTypeID()); - auto results = database.QueryDatabase(query); - if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); - return; - } + "FROM merc_merchant_entries MME, merc_merchant_template_entries MMTE, " + "merc_types MTyp, merc_templates MTem " + "WHERE MME.merchant_id = %i " + "AND MME.merc_merchant_template_id = MMTE.merc_merchant_template_id " + "AND MMTE.merc_template_id = MTem.merc_template_id " + "AND MTem.merc_type_id = MTyp.merc_type_id;", GetNPCTypeID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) + { + LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); + return; + } - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end(); ++row) + { MercType tempMercType; tempMercType.Type = atoi(row[0]); @@ -5879,26 +6026,29 @@ void NPC::LoadMercTypes() { } -void NPC::LoadMercs(){ +void NPC::LoadMercs() { std::string query = StringFormat("SELECT DISTINCT MTem.merc_template_id, MTyp.dbstring AS merc_type_id, " - "MTem.dbstring AS merc_subtype_id, 0 AS CostFormula, " - "CASE WHEN MTem.clientversion > MTyp.clientversion " - "THEN MTem.clientversion " - "ELSE MTyp.clientversion END AS clientversion, MTem.merc_npc_type_id " - "FROM merc_merchant_entries MME, merc_merchant_template_entries MMTE, " - "merc_types MTyp, merc_templates MTem " - "WHERE MME.merchant_id = %i AND " - "MME.merc_merchant_template_id = MMTE.merc_merchant_template_id " - "AND MMTE.merc_template_id = MTem.merc_template_id " - "AND MTem.merc_type_id = MTyp.merc_type_id;", GetNPCTypeID()); + "MTem.dbstring AS merc_subtype_id, 0 AS CostFormula, " + "CASE WHEN MTem.clientversion > MTyp.clientversion " + "THEN MTem.clientversion " + "ELSE MTyp.clientversion END AS clientversion, MTem.merc_npc_type_id " + "FROM merc_merchant_entries MME, merc_merchant_template_entries MMTE, " + "merc_types MTyp, merc_templates MTem " + "WHERE MME.merchant_id = %i AND " + "MME.merc_merchant_template_id = MMTE.merc_merchant_template_id " + "AND MMTE.merc_template_id = MTem.merc_template_id " + "AND MTem.merc_type_id = MTyp.merc_type_id;", GetNPCTypeID()); auto results = database.QueryDatabase(query); - if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); - return; - } - for (auto row = results.begin(); row != results.end(); ++row) { + if (!results.Success()) + { + LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); + return; + } + + for (auto row = results.begin(); row != results.end(); ++row) + { MercData tempMerc; tempMerc.MercTemplateID = atoi(row[0]); @@ -5913,8 +6063,8 @@ void NPC::LoadMercs(){ } -int NPC::GetNumMercTypes(uint32 clientVersion) -{ +int NPC::GetNumMercTypes(uint32 clientVersion) { + int count = 0; std::list mercTypeList = GetMercTypesList(); @@ -5926,8 +6076,8 @@ int NPC::GetNumMercTypes(uint32 clientVersion) return count; } -int NPC::GetNumMercs(uint32 clientVersion) -{ +int NPC::GetNumMercs(uint32 clientVersion) { + int count = 0; std::list mercDataList = GetMercsList(); @@ -5940,11 +6090,15 @@ int NPC::GetNumMercs(uint32 clientVersion) } std::list NPC::GetMercTypesList(uint32 clientVersion) { + std::list result; - if(GetNumMercTypes() > 0) { - for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) { - if(mercTypeListItr->ClientVersion <= clientVersion) { + if(GetNumMercTypes() > 0) + { + for(std::list::iterator mercTypeListItr = mercTypeList.begin(); mercTypeListItr != mercTypeList.end(); ++mercTypeListItr) + { + if(mercTypeListItr->ClientVersion <= clientVersion) + { MercType mercType; mercType.Type = mercTypeListItr->Type; mercType.ClientVersion = mercTypeListItr->ClientVersion; @@ -5957,14 +6111,19 @@ std::list NPC::GetMercTypesList(uint32 clientVersion) { } std::list NPC::GetMercsList(uint32 clientVersion) { + std::list result; - if(GetNumMercs() > 0) { - for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) { - if(mercListItr->ClientVersion <= clientVersion) { + if(GetNumMercs() > 0) + { + for(std::list::iterator mercListItr = mercDataList.begin(); mercListItr != mercDataList.end(); ++mercListItr) + { + if(mercListItr->ClientVersion <= clientVersion) + { MercTemplate *merc_template = zone->GetMercTemplate(mercListItr->MercTemplateID); - if(merc_template) { + if(merc_template) + { MercData mercData; mercData.MercTemplateID = mercListItr->MercTemplateID; mercData.MercType = merc_template->MercType; @@ -5981,54 +6140,70 @@ std::list NPC::GetMercsList(uint32 clientVersion) { return result; } -uint32 Merc::CalcPurchaseCost( uint32 templateID , uint8 level, uint8 currency_type) { +uint32 Merc::CalcPurchaseCost(uint32 templateID , uint8 level, uint8 currency_type) { + uint32 cost = 0; MercTemplate *mercData = zone->GetMercTemplate(templateID); - if(mercData) { - if(currency_type == 0) { //calculate cost in coin - cost in gold + if(mercData) + { + //calculate cost in coin - cost in gold + if(currency_type == 0) + { int levels_above_cutoff; - switch (mercData->CostFormula) { + switch (mercData->CostFormula) + { case 0: levels_above_cutoff = level > 10 ? (level - 10) : 0; cost = levels_above_cutoff * 300; cost += level >= 10 ? 100 : 0; + cost /= 100; break; default: break; } } - else if(currency_type == 19) { - cost = 0; - } - } - - return cost/100; -} - -uint32 Merc::CalcUpkeepCost( uint32 templateID , uint8 level, uint8 currency_type) { - uint32 cost = 0; - - MercTemplate *mercData = zone->GetMercTemplate(templateID); - - if(mercData) { - if(currency_type == 0) { //calculate cost in coin - cost in gold - int levels_above_cutoff; - switch (mercData->CostFormula) { - case 0: - levels_above_cutoff = level > 10 ? (level - 10) : 0; - cost = levels_above_cutoff * 300; - cost += level >= 10 ? 100 : 0; - break; - default: - break; - } - } - else if(currency_type == 19) { // cost in Bayle Marks + else if(currency_type == 19) + { + // cost in Bayle Marks cost = 1; } } - return cost/100; + return cost; } + +uint32 Merc::CalcUpkeepCost(uint32 templateID , uint8 level, uint8 currency_type) { + + uint32 cost = 0; + + MercTemplate *mercData = zone->GetMercTemplate(templateID); + + if(mercData) + { + //calculate cost in coin - cost in gold + if(currency_type == 0) + { + int levels_above_cutoff; + switch (mercData->CostFormula) + { + case 0: + levels_above_cutoff = level > 10 ? (level - 10) : 0; + cost = levels_above_cutoff * 300; + cost += level >= 10 ? 100 : 0; + cost /= 100; + break; + default: + break; + } + } + else if(currency_type == 19) + { + // cost in Bayle Marks + cost = 1; + } + } + + return cost; +} \ No newline at end of file diff --git a/zone/merc.h b/zone/merc.h index 838789f49..66c310759 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -4,12 +4,18 @@ #include "zonedb.h" #include "npc.h" -#define MAXMERCS 1 -#define MERC_DEBUG 0 -#define TANK 1 -#define HEALER 2 -#define MELEEDPS 9 -#define CASTERDPS 12 +#define MAXMERCS 1 +#define MERC_DEBUG 0 +#define TANK 1 +#define HEALER 2 +#define MELEEDPS 9 +#define CASTERDPS 12 + +#define NO_MERC_ID 0 +#define MERC_STATE_NORMAL 5 +#define MERC_STATE_SUSPENDED 1 +#define NOT_SUSPENDED_TIME 0 + const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this enum MercStanceType { @@ -25,19 +31,19 @@ enum MercStanceType { }; struct MercSpell { - uint16 spellid; // <= 0 = no spell - uint32 type; // 0 = never, must be one (and only one) of the defined values - int16 stance; // 0 = all, + = only this stance, - = all except this stance - int16 slot; - uint16 proc_chance; - uint32 time_cancast; // when we can cast this spell next + uint16 spellid; // <= 0 = no spell + uint32 type; // 0 = never, must be one (and only one) of the defined values + int16 stance; // 0 = all, + = only this stance, - = all except this stance + int16 slot; + uint16 proc_chance; + uint32 time_cancast; // when we can cast this spell next }; struct MercTimer { - uint16 timerid; // EndurTimerIndex - uint8 timertype; // 1 = spell, 2 = disc - uint16 spellid; // <= 0 = no spell - uint32 time_cancast; // when we can cast this spell next + uint16 timerid; // EndurTimerIndex + uint8 timertype; // 1 = spell, 2 = disc + uint16 spellid; // <= 0 = no spell + uint32 time_cancast; // when we can cast this spell next }; class Merc : public NPC { @@ -48,8 +54,8 @@ public: //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); - virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, - bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, + bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr); virtual bool HasRaid() { return false; } virtual bool HasGroup() { return (GetGroup() ? true : false); } virtual Raid* GetRaid() { return 0; } @@ -126,7 +132,7 @@ public: static Merc* LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, bool updateFromDB = false); void UpdateMercInfo(Client *c); void UpdateMercStats(Client *c); - void UpdateMercAppearance(Client *c); + void UpdateMercAppearance(); void AddItem(uint8 slot, uint32 item_id); static const char *GetRandomName(); bool Spawn(Client *owner); @@ -139,8 +145,8 @@ public: bool GetDepop() { return p_depop; } bool IsDead() { return GetHP() < 0;}; - bool IsMedding() {return _medding; }; - bool IsSuspended() {return _suspended; }; + bool IsMedding() { return _medding; }; + bool IsSuspended() { return _suspended; }; static uint32 CalcPurchaseCost( uint32 templateID , uint8 level, uint8 currency_type = 0); static uint32 CalcUpkeepCost( uint32 templateID , uint8 level, uint8 currency_type = 0); @@ -164,75 +170,75 @@ public: inline const uint8 GetClientVersion() const { return _OwnerClientVersion; } virtual void SetTarget(Mob* mob); - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } virtual void DoClassAttacks(Mob *target); - void CheckHateList(); - bool CheckTaunt(); - bool CheckAETaunt(); - bool CheckConfidence(); - bool TryHide(); + void CheckHateList(); + bool CheckTaunt(); + bool CheckAETaunt(); + bool CheckConfidence(); + bool TryHide(); // stat functions virtual void CalcBonuses(); - int32 GetEndurance() const {return cur_end;} //This gets our current endurance - inline virtual int32 GetAC() const { return AC; } + int32 GetEndurance() const {return cur_end;} //This gets our current endurance + inline virtual int32 GetAC() const { return AC; } inline virtual int32 GetATK() const { return ATK; } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } int32 GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } // "SET" Class Methods void SetMercData (uint32 templateID ); @@ -267,68 +273,69 @@ protected: void AddItemBonuses(const Item_Struct *item, StatBonuses* newbon); int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat); - int16 GetFocusEffect(focusType type, uint16 spell_id); + int16 GetFocusEffect(focusType type, uint16 spell_id); std::vector merc_spells; std::map timers; - uint16 skills[HIGHEST_SKILL+1]; - uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs - uint16 d_meele_texture1; //this is an item Material value - uint16 d_meele_texture2; //this is an item Material value (offhand) - uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation - uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation + uint16 skills[HIGHEST_SKILL+1]; + uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs + uint16 d_meele_texture1; //this is an item Material value + uint16 d_meele_texture2; //this is an item Material value (offhand) + uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation + uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation private: - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 acmod(); - int32 CalcATK(); - //int CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 acmod(); + int32 CalcATK(); + //int CalcHaste(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 GetClassHPFactor(); - int32 CalcHPRegen(); - int32 CalcHPRegenCap(); - int32 CalcMaxMana(); - int32 CalcBaseMana(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - int32 CalcManaRegenCap(); - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 CalcEnduranceRegenCap(); - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceUpkeep(); //does the endurance upkeep - void CalcRestState(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 GetClassHPFactor(); + int32 CalcHPRegen(); + int32 CalcHPRegenCap(); + int32 CalcMaxMana(); + int32 CalcBaseMana(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + int32 CalcManaRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 CalcEnduranceRegenCap(); + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceUpkeep(); //does the endurance upkeep + void CalcRestState(); - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); - int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthRegeneration(); + int GroupLeadershipAAOffenseEnhancement(); void GetMercSize(); void GenerateAppearance(); + bool LoadMercSpells(); bool CheckStance(int16 stance); std::vector GetMercSpells() { return merc_spells; } @@ -344,8 +351,8 @@ private: uint32 _baseWIS; uint32 _baseCHA; uint32 _baseATK; - uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. - uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. + uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. + uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. uint32 _baseMR; uint32 _baseCR; uint32 _baseDR; @@ -368,19 +375,19 @@ private: uint32 _currentStance; Inventory m_inv; - int32 max_end; - int32 cur_end; - bool _medding; - bool _suspended; - bool p_depop; - bool _check_confidence; - bool _lost_confidence; - int _hatedCount; - uint32 owner_char_id; - Timer endupkeep_timer; - Timer rest_timer; - Timer confidence_timer; - Timer check_target_timer; + int32 max_end; + int32 cur_end; + bool _medding; + bool _suspended; + bool p_depop; + bool _check_confidence; + bool _lost_confidence; + int _hatedCount; + uint32 owner_char_id; + Timer endupkeep_timer; + Timer rest_timer; + Timer confidence_timer; + Timer check_target_timer; }; -#endif // MERC_H +#endif // MERC_H \ No newline at end of file diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a1cf4ecfb..fa34e8d9e 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2107,9 +2107,6 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client bool ZoneDatabase::LoadMercInfo(Client *client) { - if(client->GetEPP().merc_name[0] == 0) - return false; - std::string query = StringFormat("SELECT MercID, Slot, Name, TemplateID, SuspendedTime, " "IsSuspended, TimerRemaining, Gender, StanceID, HP, Mana, " "Endurance, Face, LuclinHairStyle, LuclinHairColor, " @@ -2119,6 +2116,9 @@ bool ZoneDatabase::LoadMercInfo(Client *client) { auto results = QueryDatabase(query); if (!results.Success()) return false; + + if(results.RowCount() == 0) + return false; for (auto row = results.begin(); row != results.end(); ++row) { uint8 slot = atoi(row[1]); @@ -2156,9 +2156,6 @@ bool ZoneDatabase::LoadMercInfo(Client *client) { bool ZoneDatabase::LoadCurrentMerc(Client *client) { - if(client->GetEPP().merc_name[0] == 0) - return false; - uint8 slot = client->GetMercSlot(); if(slot > MAXMERCS) @@ -2175,6 +2172,9 @@ bool ZoneDatabase::LoadCurrentMerc(Client *client) { if(!results.Success()) return false; + + if(results.RowCount() == 0) + return false; for (auto row = results.begin(); row != results.end(); ++row) { @@ -2211,71 +2211,73 @@ bool ZoneDatabase::SaveMerc(Merc *merc) { if(!owner) return false; - if(merc->GetMercID() == 0) { + if(merc->GetMercID() == 0) + { // New merc record - uint32 TempNewMercID = 0; std::string query = StringFormat("INSERT INTO mercs " - "(OwnerCharacterID, Slot, Name, TemplateID, " - "SuspendedTime, IsSuspended, TimerRemaining, " - "Gender, StanceID, HP, Mana, Endurance, Face, " - "LuclinHairStyle, LuclinHairColor, LuclinEyeColor, " - "LuclinEyeColor2, LuclinBeardColor, LuclinBeard, " - "DrakkinHeritage, DrakkinTattoo, DrakkinDetails) " - "VALUES('%u', '%u', '%s', '%u', '%u', '%u', '%u', " - "'%u', '%u', '%u', '%u', '%u', '%i', '%i', '%i', " - "'%i', '%i', '%i', '%i', '%i', '%i', '%i')", - merc->GetMercCharacterID(), owner->GetNumMercs(), - merc->GetCleanName(), merc->GetMercTemplateID(), - owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), - owner->GetMercInfo().MercTimerRemaining, merc->GetGender(), - merc->GetStance(), merc->GetHP(), merc->GetMana(), - merc->GetEndurance(), merc->GetLuclinFace(), - merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), - merc->GetEyeColor2(), merc->GetBeardColor(), - merc->GetBeard(), merc->GetDrakkinHeritage(), - merc->GetDrakkinTattoo(), merc->GetDrakkinDetails()); - auto results = database.QueryDatabase(query); + "(OwnerCharacterID, Slot, Name, TemplateID, " + "SuspendedTime, IsSuspended, TimerRemaining, " + "Gender, StanceID, HP, Mana, Endurance, Face, " + "LuclinHairStyle, LuclinHairColor, LuclinEyeColor, " + "LuclinEyeColor2, LuclinBeardColor, LuclinBeard, " + "DrakkinHeritage, DrakkinTattoo, DrakkinDetails) " + "VALUES('%u', '%u', '%s', '%u', '%u', '%u', '%u', " + "'%u', '%u', '%u', '%u', '%u', '%i', '%i', '%i', " + "'%i', '%i', '%i', '%i', '%i', '%i', '%i')", + merc->GetMercCharacterID(), owner->GetNumMercs(), + merc->GetCleanName(), merc->GetMercTemplateID(), + owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), + owner->GetMercInfo().MercTimerRemaining, merc->GetGender(), + merc->GetStance(), merc->GetHP(), merc->GetMana(), + merc->GetEndurance(), merc->GetLuclinFace(), + merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), + merc->GetEyeColor2(), merc->GetBeardColor(), + merc->GetBeard(), merc->GetDrakkinHeritage(), + merc->GetDrakkinTattoo(), merc->GetDrakkinDetails()); + + auto results = database.QueryDatabase(query); if(!results.Success()) { owner->Message(13, results.ErrorMessage().c_str()); return false; } else if (results.RowsAffected() != 1) { - owner->Message(13, "Unable to save merc to the database."); - return false; + owner->Message(13, "Unable to save merc to the database."); + return false; } - merc->SetMercID(TempNewMercID); - merc->UpdateMercInfo(owner); + merc->SetMercID(results.LastInsertedID()); + merc->UpdateMercInfo(owner); database.SaveMercBuffs(merc); - return true; + return true; } - // Update existing merc record - std::string query = StringFormat("UPDATE mercs SET OwnerCharacterID = '%u', Slot = '%u', " - "Name = '%s', TemplateID = '%u', SuspendedTime = '%u', " - "IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', " - "StanceID = '%u', HP = '%u', Mana = '%u', Endurance = '%u', " - "Face = '%i', LuclinHairStyle = '%i', LuclinHairColor = '%i', " - "LuclinEyeColor = '%i', LuclinEyeColor2 = '%i', LuclinBeardColor = '%i', " - "LuclinBeard = '%i', DrakkinHeritage = '%i', DrakkinTattoo = '%i', " - "DrakkinDetails = '%i' WHERE MercID = '%u'", - merc->GetMercCharacterID(), owner->GetMercSlot(), merc->GetCleanName(), - merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, - merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, - merc->GetGender(), merc->GetStance(), merc->GetHP(), merc->GetMana(), - merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), - merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), - merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), - merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID()); - auto results = database.QueryDatabase(query); - if (!results.Success()) { - owner->Message(13, results.ErrorMessage().c_str()); - return false; - } else if (results.RowsAffected() != 1) { - owner->Message(13, "Unable to save merc to the database."); - return false; - } + // Update existing merc record + std::string query = StringFormat("UPDATE mercs SET OwnerCharacterID = '%u', Slot = '%u', " + "Name = '%s', TemplateID = '%u', SuspendedTime = '%u', " + "IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', " + "StanceID = '%u', HP = '%u', Mana = '%u', Endurance = '%u', " + "Face = '%i', LuclinHairStyle = '%i', LuclinHairColor = '%i', " + "LuclinEyeColor = '%i', LuclinEyeColor2 = '%i', LuclinBeardColor = '%i', " + "LuclinBeard = '%i', DrakkinHeritage = '%i', DrakkinTattoo = '%i', " + "DrakkinDetails = '%i' WHERE MercID = '%u'", + merc->GetMercCharacterID(), owner->GetMercSlot(), merc->GetCleanName(), + merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, + merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, + merc->GetGender(), merc->GetStance(), merc->GetHP(), merc->GetMana(), + merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), + merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), + merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), + merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID()); - merc->UpdateMercInfo(owner); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + owner->Message(13, results.ErrorMessage().c_str()); + return false; + } else if (results.RowsAffected() != 1) { + owner->Message(13, "Unable to save merc to the database."); + return false; + } + + merc->UpdateMercInfo(owner); database.SaveMercBuffs(merc); return true; @@ -2386,25 +2388,27 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { bool ZoneDatabase::DeleteMerc(uint32 merc_id) { if(merc_id == 0) - return false; + return false; - bool firstQueryWorked = false; - // TODO: These queries need to be ran together as a transaction.. ie, - // if one or more fail then they all will fail to commit to the database. - std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercID = '%u'", merc_id); - auto results = database.QueryDatabase(query); + // TODO: These queries need to be ran together as a transaction.. ie, + // if one or more fail then they all will fail to commit to the database. + // ...Not all mercs will have buffs, so why is it required that both deletes succeed? + std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = '%u'", merc_id); + auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); - else - firstQueryWorked = true; + { + LogFile->write(EQEMuLog::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); - if(!results.Success()) { + results = database.QueryDatabase(query); + if(!results.Success()) + { LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; - } + } - return firstQueryWorked; + return true; } void ZoneDatabase::LoadMercEquipment(Merc *merc) { From 8f32a9949b9d0317affa335c207792261f3f9129 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 18 Nov 2014 17:32:59 -0600 Subject: [PATCH 0281/1883] Fixed bad formatting of client.h and merc.h caused by my last commit. --- zone/client.h | 1328 ++++++++++++++++++++++++------------------------- zone/merc.h | 234 ++++----- 2 files changed, 764 insertions(+), 798 deletions(-) diff --git a/zone/client.h b/zone/client.h index 8407ff221..c2dabdc62 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org) This program is free software; you can redistribute it and/or modify @@ -61,10 +61,10 @@ class Client; #include -#define CLIENT_TIMEOUT 90000 -#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing -#define TARGETING_RANGE 200 // range for /assist and /target -#define XTARGET_HARDCAP 20 +#define CLIENT_TIMEOUT 90000 +#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing +#define TARGETING_RANGE 200 // range for /assist and /target +#define XTARGET_HARDCAP 20 extern Zone* zone; extern TaskManager *taskmanager; @@ -78,25 +78,25 @@ public: bool ack_req; }; -enum { //Type arguments to the Message* routines. +enum { //Type arguments to the Message* routines. //all not explicitly listed are the same grey color clientMessageWhite0 = 0, - clientMessageLoot = 2, //dark green - clientMessageTradeskill = 4, //light blue - clientMessageTell = 5, //magenta + clientMessageLoot = 2, //dark green + clientMessageTradeskill = 4, //light blue + clientMessageTell = 5, //magenta clientMessageWhite = 7, clientMessageWhite2 = 10, clientMessageLightGrey = 12, - clientMessageError = 13, //red + clientMessageError = 13, //red clientMessageGreen = 14, clientMessageYellow = 15, clientMessageBlue = 16, - clientMessageGroup = 18, //cyan + clientMessageGroup = 18, //cyan clientMessageWhite3 = 20, }; #define SPELLBAR_UNLOCK 0x2bc -enum { //scribing argument to MemorizeSpell +enum { //scribing argument to MemorizeSpell memSpellScribing = 0, memSpellMemorize = 1, memSpellForget = 2, @@ -105,14 +105,14 @@ enum { //scribing argument to MemorizeSpell //Modes for the zoning state of the client. typedef enum { - ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac - GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon - ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only - ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data + ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac + GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon + ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only + ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data ZoneUnsolicited, - GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell - SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons - Rewind, // Summon to /rewind location. + GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell + SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons + Rewind, // Summon to /rewind location. EvacToSafeCoords } ZoneMode; @@ -221,176 +221,176 @@ public: virtual void SetAttackTimer(); float GetQuiverHaste(); - void AI_Init(); - void AI_Start(uint32 iMoveDelay = 0); - void AI_Stop(); - void AI_Process(); - void AI_SpellCast(); - void Trader_ShowItems(); - void Trader_CustomerBrowsing(Client *Customer); - void Trader_EndTrader(); - void Trader_StartTrader(); - uint8 WithCustomer(uint16 NewCustomer); - void KeyRingLoad(); - void KeyRingAdd(uint32 item_id); - bool KeyRingCheck(uint32 item_id); - void KeyRingList(); + void AI_Init(); + void AI_Start(uint32 iMoveDelay = 0); + void AI_Stop(); + void AI_Process(); + void AI_SpellCast(); + void Trader_ShowItems(); + void Trader_CustomerBrowsing(Client *Customer); + void Trader_EndTrader(); + void Trader_StartTrader(); + uint8 WithCustomer(uint16 NewCustomer); + void KeyRingLoad(); + void KeyRingAdd(uint32 item_id); + bool KeyRingCheck(uint32 item_id); + void KeyRingList(); virtual bool IsClient() const { return true; } - void CompleteConnect(); - bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); - void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); - void SendBuyerPacket(Client* Buyer); + void CompleteConnect(); + bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); + void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); + void SendBuyerPacket(Client* Buyer); GetItems_Struct* GetTraderItems(); - void SendBazaarWelcome(); - void DyeArmor(DyeStruct* dye); - uint8 SlotConvert(uint8 slot,bool bracer=false); - void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); - void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); - bool FilteredMessageCheck(Mob *sender, eqFilterType filter); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, + void SendBazaarWelcome(); + void DyeArmor(DyeStruct* dye); + uint8 SlotConvert(uint8 slot,bool bracer=false); + void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); + void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); + bool FilteredMessageCheck(Mob *sender, eqFilterType filter); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id, const char *message1, const char *message2 = nullptr, const char *message3 = nullptr, const char *message4 = nullptr, const char *message5 = nullptr, const char *message6 = nullptr, const char *message7 = nullptr, const char *message8 = nullptr, const char *message9 = nullptr); - void Tell_StringID(uint32 string_id, const char *who, const char *message); - void SendColoredText(uint32 color, std::string message); - void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); - void SendTraderItem(uint32 item_id,uint16 quantity); - uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); + void Tell_StringID(uint32 string_id, const char *who, const char *message); + void SendColoredText(uint32 color, std::string message); + void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); + void SendTraderItem(uint32 item_id,uint16 quantity); + uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber); - void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); - void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); - void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); - void TradeRequestFailed(const EQApplicationPacket* app); - void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); - void TraderUpdate(uint16 slot_id,uint32 trader_id); - void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); - void SendZonePoints(); + void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); + void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); + void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); + void TradeRequestFailed(const EQApplicationPacket* app); + void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); + void TraderUpdate(uint16 slot_id,uint32 trader_id); + void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); + void SendZonePoints(); - void SendBuyerResults(char *SearchQuery, uint32 SearchID); - void ShowBuyLines(const EQApplicationPacket *app); - void SellToBuyer(const EQApplicationPacket *app); - void ToggleBuyerMode(bool TurnOn); - void UpdateBuyLine(const EQApplicationPacket *app); - void BuyerItemSearch(const EQApplicationPacket *app); - void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } - const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } + void SendBuyerResults(char *SearchQuery, uint32 SearchID); + void ShowBuyLines(const EQApplicationPacket *app); + void SellToBuyer(const EQApplicationPacket *app); + void ToggleBuyerMode(bool TurnOn); + void UpdateBuyLine(const EQApplicationPacket *app); + void BuyerItemSearch(const EQApplicationPacket *app); + void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } + const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } - void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); + void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); - void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); - void SendPacketQueue(bool Block = true); - void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); - void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); - void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); - void Message(uint32 type, const char* message, ...); - void QuestJournalledMessage(const char *npcname, const char* message); - void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); - void SendSound(); - void LearnRecipe(uint32 recipeID); - bool CanIncreaseTradeskill(SkillUseTypes tradeskill); + void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); + void SendPacketQueue(bool Block = true); + void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); + void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); + void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); + void Message(uint32 type, const char* message, ...); + void QuestJournalledMessage(const char *npcname, const char* message); + void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); + void SendSound(); + void LearnRecipe(uint32 recipeID); + bool CanIncreaseTradeskill(SkillUseTypes tradeskill); - EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool GetRevoked() const { return revoked; } - void SetRevoked(bool rev) { revoked = rev; } - inline uint32 GetIP() const { return ip; } - inline bool GetHideMe() const { return gmhideme; } - void SetHideMe(bool hm); - inline uint16 GetPort() const { return port; } - bool IsDead() const { return(dead); } - bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } - inline bool IsLFP() { return LFP; } - void UpdateLFP(); + bool GetRevoked() const { return revoked; } + void SetRevoked(bool rev) { revoked = rev; } + inline uint32 GetIP() const { return ip; } + inline bool GetHideMe() const { return gmhideme; } + void SetHideMe(bool hm); + inline uint16 GetPort() const { return port; } + bool IsDead() const { return(dead); } + bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } + inline bool IsLFP() { return LFP; } + void UpdateLFP(); - virtual bool Save() { return Save(0); } - bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now - void SaveBackup(); + virtual bool Save() { return Save(0); } + bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now + void SaveBackup(); /* New PP Save Functions */ bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); } bool SaveAA(); inline bool ClientDataLoaded() const { return client_data_loaded; } - inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } - inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } - inline void Kick() { client_state = CLIENT_KICKED; } - inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } - inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } - void WorldKick(); - inline uint8 GetAnon() const { return m_pp.anon; } - inline PlayerProfile_Struct& GetPP() { return m_pp; } + inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } + inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } + inline void Kick() { client_state = CLIENT_KICKED; } + inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } + inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } + void WorldKick(); + inline uint8 GetAnon() const { return m_pp.anon; } + inline PlayerProfile_Struct& GetPP() { return m_pp; } inline ExtendedProfile_Struct& GetEPP() { return m_epp; } - inline Inventory& GetInv() { return m_inv; } - inline const Inventory& GetInv() const { return m_inv; } - inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } + inline Inventory& GetInv() { return m_inv; } + inline const Inventory& GetInv() const { return m_inv; } + inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } - bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); + bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); - void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); - void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); - bool AutoAttackEnabled() const { return auto_attack; } - bool AutoFireEnabled() const { return auto_fire; } - void MakeCorpse(uint32 exploss); + void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); + void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); + bool AutoAttackEnabled() const { return auto_attack; } + bool AutoFireEnabled() const { return auto_fire; } + void MakeCorpse(uint32 exploss); - bool ChangeFirstName(const char* in_firstname,const char* gmname); + bool ChangeFirstName(const char* in_firstname,const char* gmname); - void Duck(); - void Stand(); + void Duck(); + void Stand(); - virtual void SetMaxHP(); - int32 LevelRegen(); - void HPTick(); - void SetGM(bool toggle); - void SetPVP(bool toggle); + virtual void SetMaxHP(); + int32 LevelRegen(); + void HPTick(); + void SetGM(bool toggle); + void SetPVP(bool toggle); - inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } - inline bool GetGM() const { return m_pp.gm != 0; } + inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } + inline bool GetGM() const { return m_pp.gm != 0; } - inline void SetBaseClass(uint32 i) { m_pp.class_=i; } - inline void SetBaseRace(uint32 i) { m_pp.race=i; } - inline void SetBaseGender(uint32 i) { m_pp.gender=i; } + inline void SetBaseClass(uint32 i) { m_pp.class_=i; } + inline void SetBaseRace(uint32 i) { m_pp.race=i; } + inline void SetBaseGender(uint32 i) { m_pp.gender=i; } inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;} - inline uint8 GetLevel2() const { return m_pp.level2; } - inline uint16 GetBaseRace() const { return m_pp.race; } - inline uint16 GetBaseClass() const { return m_pp.class_; } - inline uint8 GetBaseGender() const { return m_pp.gender; } - inline uint8 GetBaseFace() const { return m_pp.face; } - inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } - inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } - inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } - inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } - inline uint8 GetBaseBeard() const { return m_pp.beard; } - inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } - inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } - inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } - inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } - inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } - inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } - inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } - inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } - int32 CalcMaxMana(); - int32 CalcBaseMana(); - const int32& SetMana(int32 amount); - int32 CalcManaRegenCap(); + inline uint8 GetLevel2() const { return m_pp.level2; } + inline uint16 GetBaseRace() const { return m_pp.race; } + inline uint16 GetBaseClass() const { return m_pp.class_; } + inline uint8 GetBaseGender() const { return m_pp.gender; } + inline uint8 GetBaseFace() const { return m_pp.face; } + inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } + inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } + inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } + inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } + inline uint8 GetBaseBeard() const { return m_pp.beard; } + inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } + inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } + inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } + inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } + inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } + inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } + inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } + inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } + int32 CalcMaxMana(); + int32 CalcBaseMana(); + const int32& SetMana(int32 amount); + int32 CalcManaRegenCap(); - void ServerFilter(SetServerFilter_Struct* filter); - void BulkSendTraderInventory(uint32 char_id); - void SendSingleTraderItem(uint32 char_id, int uniqueid); - void BulkSendMerchantInventory(int merchant_id, int npcid); + void ServerFilter(SetServerFilter_Struct* filter); + void BulkSendTraderInventory(uint32 char_id); + void SendSingleTraderItem(uint32 char_id, int uniqueid); + void BulkSendMerchantInventory(int merchant_id, int npcid); - inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } + inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } - void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); + void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); - inline const char* GetLastName() const { return lastname; } + inline const char* GetLastName() const { return lastname; } inline float ProximityX() const { return(proximity_x); } inline float ProximityY() const { return(proximity_y); } @@ -403,86 +403,86 @@ public: virtual void CalcBonuses(); //these are all precalculated now - inline virtual int32 GetAC() const { return AC; } + inline virtual int32 GetAC() const { return AC; } inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - inline virtual int GetHaste() const { return Haste; } + inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - int32 GetMaxStat() const; - int32 GetMaxResist() const; - int32 GetMaxSTR() const; - int32 GetMaxSTA() const; - int32 GetMaxDEX() const; - int32 GetMaxAGI() const; - int32 GetMaxINT() const; - int32 GetMaxWIS() const; - int32 GetMaxCHA() const; - int32 GetMaxMR() const; - int32 GetMaxPR() const; - int32 GetMaxDR() const; - int32 GetMaxCR() const; - int32 GetMaxFR() const; - int32 GetMaxCorrup() const; - inline uint8 GetBaseSTR() const { return m_pp.STR; } - inline uint8 GetBaseSTA() const { return m_pp.STA; } - inline uint8 GetBaseCHA() const { return m_pp.CHA; } - inline uint8 GetBaseDEX() const { return m_pp.DEX; } - inline uint8 GetBaseINT() const { return m_pp.INT; } - inline uint8 GetBaseAGI() const { return m_pp.AGI; } - inline uint8 GetBaseWIS() const { return m_pp.WIS; } - inline uint8 GetBaseCorrup() const { return 15; } // Same for all + int32 GetMaxStat() const; + int32 GetMaxResist() const; + int32 GetMaxSTR() const; + int32 GetMaxSTA() const; + int32 GetMaxDEX() const; + int32 GetMaxAGI() const; + int32 GetMaxINT() const; + int32 GetMaxWIS() const; + int32 GetMaxCHA() const; + int32 GetMaxMR() const; + int32 GetMaxPR() const; + int32 GetMaxDR() const; + int32 GetMaxCR() const; + int32 GetMaxFR() const; + int32 GetMaxCorrup() const; + inline uint8 GetBaseSTR() const { return m_pp.STR; } + inline uint8 GetBaseSTA() const { return m_pp.STA; } + inline uint8 GetBaseCHA() const { return m_pp.CHA; } + inline uint8 GetBaseDEX() const { return m_pp.DEX; } + inline uint8 GetBaseINT() const { return m_pp.INT; } + inline uint8 GetBaseAGI() const { return m_pp.AGI; } + inline uint8 GetBaseWIS() const { return m_pp.WIS; } + inline uint8 GetBaseCorrup() const { return 15; } // Same for all - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); @@ -504,29 +504,29 @@ public: virtual void InitializeBuffSlots(); virtual void UninitializeBuffSlots(); - inline const int32 GetBaseHP() const { return base_hp; } + inline const int32 GetBaseHP() const { return base_hp; } uint32 GetWeight() const { return(weight); } inline void RecalcWeight() { weight = CalcCurrentWeight(); } uint32 CalcCurrentWeight(); - inline uint32 GetCopper() const { return m_pp.copper; } - inline uint32 GetSilver() const { return m_pp.silver; } - inline uint32 GetGold() const { return m_pp.gold; } - inline uint32 GetPlatinum() const { return m_pp.platinum; } + inline uint32 GetCopper() const { return m_pp.copper; } + inline uint32 GetSilver() const { return m_pp.silver; } + inline uint32 GetGold() const { return m_pp.gold; } + inline uint32 GetPlatinum() const { return m_pp.platinum; } /*Endurance and such*/ - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 GetEndurance() const {return cur_end;} //This gets our current endurance - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegenCap(); - int32 CalcHPRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 GetEndurance() const {return cur_end;} //This gets our current endurance + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegenCap(); + int32 CalcHPRegenCap(); inline uint8 GetEndurancePercent() { return (uint8)((float)cur_end / (float)max_end * 100.0f); } - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceRegen(); //This Regenerates endurance - void DoEnduranceUpkeep(); //does the endurance upkeep + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceRegen(); //This Regenerates endurance + void DoEnduranceUpkeep(); //does the endurance upkeep //This calculates total Attack Rating to match very close to what the client should show uint32 GetTotalATK(); @@ -538,153 +538,153 @@ public: bool Rampage(); void DurationRampage(uint32 duration); - inline uint32 GetEXP() const { return m_pp.exp; } + inline uint32 GetEXP() const { return m_pp.exp; } - bool UpdateLDoNPoints(int32 points, uint32 theme); - void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } - uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } - void AddPVPPoints(uint32 Points); - uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } - void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } - uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } - void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } - void AddCrystals(uint32 Radiant, uint32 Ebon); - void SendCrystalCounts(); + bool UpdateLDoNPoints(int32 points, uint32 theme); + void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } + uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } + void AddPVPPoints(uint32 Points); + uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } + void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } + uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } + void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } + void AddCrystals(uint32 Radiant, uint32 Ebon); + void SendCrystalCounts(); - void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); - void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); - void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); - void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void SendLeadershipEXPUpdate(); - bool IsLeadershipEXPOn(); - inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } - inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } - inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } - inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); - int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); - void InspectBuffs(Client* Inspector, int Rank); - uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } - uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } - uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } - uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } - uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } + void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); + void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); + void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); + void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void SendLeadershipEXPUpdate(); + bool IsLeadershipEXPOn(); + inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } + inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } + inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } + inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthRegeneration(); + int GroupLeadershipAAOffenseEnhancement(); + void InspectBuffs(Client* Inspector, int Rank); + uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } + uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } + uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } + uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } + uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } virtual void SetLevel(uint8 set_level, bool command = false); - void GoToBind(uint8 bindnum = 0); - void GoToSafeCoords(uint16 zone_id, uint16 instance_id); - void Gate(); - void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); - void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); - uint32 GetStartZone(void); - void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void AssignToInstance(uint16 instance_id); - void RemoveFromInstance(uint16 instance_id); - void WhoAll(); - bool CheckLoreConflict(const Item_Struct* item); - void ChangeLastName(const char* in_lastname); - void GetGroupAAs(GroupLeadershipAA_Struct *into) const; - void GetRaidAAs(RaidLeadershipAA_Struct *into) const; - void ClearGroupAAs(); - void UpdateGroupAAs(int32 points, uint32 type); - void SacrificeConfirm(Client* caster); - void Sacrifice(Client* caster); - void GoToDeath(); - inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } + void GoToBind(uint8 bindnum = 0); + void GoToSafeCoords(uint16 zone_id, uint16 instance_id); + void Gate(); + void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); + void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); + uint32 GetStartZone(void); + void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void AssignToInstance(uint16 instance_id); + void RemoveFromInstance(uint16 instance_id); + void WhoAll(); + bool CheckLoreConflict(const Item_Struct* item); + void ChangeLastName(const char* in_lastname); + void GetGroupAAs(GroupLeadershipAA_Struct *into) const; + void GetRaidAAs(RaidLeadershipAA_Struct *into) const; + void ClearGroupAAs(); + void UpdateGroupAAs(int32 points, uint32 type); + void SacrificeConfirm(Client* caster); + void Sacrifice(Client* caster); + void GoToDeath(); + inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } - FACTION_VALUE GetReverseFactionCon(Mob* iOther); - FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); - int32 GetCharacterFactionLevel(int32 faction_id); - int32 GetModCharacterFactionLevel(int32 faction_id); - void MerchantRejectMessage(Mob *merchant, int primaryfaction); - void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); + FACTION_VALUE GetReverseFactionCon(Mob* iOther); + FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); + int32 GetCharacterFactionLevel(int32 faction_id); + int32 GetModCharacterFactionLevel(int32 faction_id); + void MerchantRejectMessage(Mob *merchant, int primaryfaction); + void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); - void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); - void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); - int32 GetRawItemAC(); - uint16 GetCombinedAC_TEST(); + void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); + void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); + int32 GetRawItemAC(); + uint16 GetCombinedAC_TEST(); - inline uint32 LSAccountID() const { return lsaccountid; } - inline uint32 GetWID() const { return WID; } - inline void SetWID(uint32 iWID) { WID = iWID; } - inline uint32 AccountID() const { return account_id; } + inline uint32 LSAccountID() const { return lsaccountid; } + inline uint32 GetWID() const { return WID; } + inline void SetWID(uint32 iWID) { WID = iWID; } + inline uint32 AccountID() const { return account_id; } inline const char* AccountName()const { return account_name; } - inline int16 Admin() const { return admin; } - inline uint32 CharacterID() const { return character_id; } - void UpdateAdmin(bool iFromDB = true); - void UpdateWho(uint8 remove = 0); - bool GMHideMe(Client* client = 0); + inline int16 Admin() const { return admin; } + inline uint32 CharacterID() const { return character_id; } + void UpdateAdmin(bool iFromDB = true); + void UpdateWho(uint8 remove = 0); + bool GMHideMe(Client* client = 0); inline bool IsInAGuild() const { return(guild_id != GUILD_NONE && guild_id != 0); } inline bool IsInGuild(uint32 in_gid) const { return(in_gid == guild_id && IsInAGuild()); } - inline uint32 GuildID() const { return guild_id; } - inline uint8 GuildRank() const { return guildrank; } - void SendGuildMOTD(bool GetGuildMOTDReply = false); - void SendGuildURL(); - void SendGuildChannel(); - void SendGuildSpawnAppearance(); - void SendGuildRanks(); - void SendGuildMembers(); - void SendGuildList(); - void SendGuildJoin(GuildJoin_Struct* gj); - void RefreshGuildInfo(); + inline uint32 GuildID() const { return guild_id; } + inline uint8 GuildRank() const { return guildrank; } + void SendGuildMOTD(bool GetGuildMOTDReply = false); + void SendGuildURL(); + void SendGuildChannel(); + void SendGuildSpawnAppearance(); + void SendGuildRanks(); + void SendGuildMembers(); + void SendGuildList(); + void SendGuildJoin(GuildJoin_Struct* gj); + void RefreshGuildInfo(); - void SendManaUpdatePacket(); - void SendManaUpdate(); - void SendEnduranceUpdate(); - uint8 GetFace() const { return m_pp.face; } - void WhoAll(Who_All_Struct* whom); - void FriendsWho(char *FriendsString); + void SendManaUpdatePacket(); + void SendManaUpdate(); + void SendEnduranceUpdate(); + uint8 GetFace() const { return m_pp.face; } + void WhoAll(Who_All_Struct* whom); + void FriendsWho(char *FriendsString); - void Stun(int duration); - void UnStun(); - void ReadBook(BookRequest_Struct *book); - void QuestReadBook(const char* text, uint8 type); - void SendClientMoneyUpdate(uint8 type,uint32 amount); - void SendMoneyUpdate(); - bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); - void AddMoneyToPP(uint64 copper,bool updateclient); - void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); - bool HasMoney(uint64 copper); - uint64 GetCarriedMoney(); - uint64 GetAllMoney(); + void Stun(int duration); + void UnStun(); + void ReadBook(BookRequest_Struct *book); + void QuestReadBook(const char* text, uint8 type); + void SendClientMoneyUpdate(uint8 type,uint32 amount); + void SendMoneyUpdate(); + bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); + void AddMoneyToPP(uint64 copper,bool updateclient); + void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); + bool HasMoney(uint64 copper); + uint64 GetCarriedMoney(); + uint64 GetAllMoney(); - bool IsDiscovered(uint32 itemid); - void DiscoverItem(uint32 itemid); + bool IsDiscovered(uint32 itemid); + void DiscoverItem(uint32 itemid); - bool TGB() const { return tgb; } + bool TGB() const { return tgb; } - void OnDisconnect(bool hard_disconnect); + void OnDisconnect(bool hard_disconnect); - uint16 GetSkillPoints() { return m_pp.points;} - void SetSkillPoints(int inp) { m_pp.points = inp;} + uint16 GetSkillPoints() { return m_pp.points;} + void SetSkillPoints(int inp) { m_pp.points = inp;} - void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } - void IncreaseLanguageSkill(int skill_id, int value = 1); + void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } + void IncreaseLanguageSkill(int skill_id, int value = 1); virtual uint16 GetSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return((itembonuses.skillmod[skill_id] > 0) ? m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100 : m_pp.skills[skill_id]); } return 0; } - uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - void SetSkill(SkillUseTypes skill_num, uint16 value); - void AddSkill(SkillUseTypes skillid, uint16 value); - void CheckSpecializeIncrease(uint16 spell_id); - void CheckSongSkillIncrease(uint16 spell_id); - bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); - void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); - void SetLanguageSkill(int langid, int value); - void SetHoTT(uint32 mobid); - void ShowSkillsWindow(); - void SendStatsWindow(Client* client, bool use_window); + uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + void SetSkill(SkillUseTypes skill_num, uint16 value); + void AddSkill(SkillUseTypes skillid, uint16 value); + void CheckSpecializeIncrease(uint16 spell_id); + void CheckSongSkillIncrease(uint16 spell_id); + bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); + void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); + void SetLanguageSkill(int langid, int value); + void SetHoTT(uint32 mobid); + void ShowSkillsWindow(); + void SendStatsWindow(Client* client, bool use_window); - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } - uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); void TradeskillSearchResults(const std::string query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); @@ -692,11 +692,11 @@ public: void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); void GMKill(); - inline bool IsMedding() const {return medding;} + inline bool IsMedding() const {return medding;} inline uint16 GetDuelTarget() const { return duel_target; } - inline bool IsDueling() const { return duelaccepted; } - inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } - inline void SetDueling(bool duel) { duelaccepted = duel; } + inline bool IsDueling() const { return duelaccepted; } + inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } + inline void SetDueling(bool duel) { duelaccepted = duel; } // use this one instead void MemSpell(uint16 spell_id, int slot, bool update_client = true); void UnmemSpell(int slot, bool update_client = true); @@ -709,11 +709,11 @@ public: bool SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID); uint32 GetCharMaxLevelFromQGlobal(); - inline bool IsSitting() const {return (playeraction == 1);} - inline bool IsBecomeNPC() const { return npcflag; } - inline uint8 GetBecomeNPCLevel() const { return npclevel; } - inline void SetBecomeNPC(bool flag) { npcflag = flag; } - inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } + inline bool IsSitting() const {return (playeraction == 1);} + inline bool IsBecomeNPC() const { return npcflag; } + inline uint8 GetBecomeNPCLevel() const { return npclevel; } + inline void SetBecomeNPC(bool flag) { npcflag = flag; } + inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } void SetFeigned(bool in_feigned); /// this cures timing issues cuz dead animation isn't done but server side feigning is? inline bool GetFeigned() const { return(feigned); } @@ -735,17 +735,17 @@ public: bool BindWound(Mob* bindmob, bool start, bool fail = false); void SetTradeskillObject(Object* object) { m_tradeskill_object = object; } Object* GetTradeskillObject() { return m_tradeskill_object; } - void SendTributes(); - void SendGuildTributes(); - void DoTributeUpdate(); - void SendTributeDetails(uint32 client_id, uint32 tribute_id); - int32 TributeItem(uint32 slot, uint32 quantity); - int32 TributeMoney(uint32 platinum); - void AddTributePoints(int32 ammount); - void ChangeTributeSettings(TributeInfo_Struct *t); - void SendTributeTimer(); - void ToggleTribute(bool enabled); - void SendPathPacket(std::vector &path); + void SendTributes(); + void SendGuildTributes(); + void DoTributeUpdate(); + void SendTributeDetails(uint32 client_id, uint32 tribute_id); + int32 TributeItem(uint32 slot, uint32 quantity); + int32 TributeMoney(uint32 platinum); + void AddTributePoints(int32 ammount); + void ChangeTributeSettings(TributeInfo_Struct *t); + void SendTributeTimer(); + void ToggleTribute(bool enabled); + void SendPathPacket(std::vector &path); inline PTimerList &GetPTimers() { return(p_timers); } @@ -757,9 +757,9 @@ public: void BuyAA(AA_Action* action); //this function is used by some AA stuff void MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing); - void SetAATitle(const char *Title); - void SetTitleSuffix(const char *txt); - inline uint32 GetMaxAAXP(void) const { return max_AAXP; } + void SetAATitle(const char *Title); + void SetTitleSuffix(const char *txt); + inline uint32 GetMaxAAXP(void) const { return max_AAXP; } inline uint32 GetAAXP() const { return m_pp.expAA; } void SendAAStats(); void SendAATable(); @@ -791,93 +791,93 @@ public: // Item methods void EVENT_ITEM_ScriptStopReturn(); - uint32 NukeItem(uint32 itemnum, uint8 where_to_check = + uint32 NukeItem(uint32 itemnum, uint8 where_to_check = (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); - void SetTint(int16 slot_id, uint32 color); - void SetTint(int16 slot_id, Color_Struct& color); - void SetMaterial(int16 slot_id, uint32 item_id); - void Undye(); - int32 GetItemIDAt(int16 slot_id); - int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); - bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); - bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); - void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); - bool SwapItem(MoveItem_Struct* move_in); - void SwapItemResync(MoveItem_Struct* move_slots); - void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); - void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); - bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); - void SetStats(uint8 type,int16 set_val); - void IncStats(uint8 type,int16 increase_val); - void DropItem(int16 slot_id); - bool MakeItemLink(char* &ret_link, const ItemInst* inst); - int GetItemLinkHash(const ItemInst* inst); - void SendItemLink(const ItemInst* inst, bool sendtoall=false); - void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); - void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool IsValidSlot(uint32 slot); - bool IsBankSlot(uint32 slot); + void SetTint(int16 slot_id, uint32 color); + void SetTint(int16 slot_id, Color_Struct& color); + void SetMaterial(int16 slot_id, uint32 item_id); + void Undye(); + int32 GetItemIDAt(int16 slot_id); + int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); + bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); + bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); + void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); + bool SwapItem(MoveItem_Struct* move_in); + void SwapItemResync(MoveItem_Struct* move_slots); + void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); + void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); + bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); + void SetStats(uint8 type,int16 set_val); + void IncStats(uint8 type,int16 increase_val); + void DropItem(int16 slot_id); + bool MakeItemLink(char* &ret_link, const ItemInst* inst); + int GetItemLinkHash(const ItemInst* inst); + void SendItemLink(const ItemInst* inst, bool sendtoall=false); + void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); + void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + bool IsValidSlot(uint32 slot); + bool IsBankSlot(uint32 slot); - inline bool IsTrader() const { return(Trader); } - inline bool IsBuyer() const { return(Buyer); } - eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } - void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } + inline bool IsTrader() const { return(Trader); } + inline bool IsBuyer() const { return(Buyer); } + eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } + void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } - void BreakInvis(); - void LeaveGroup(); + void BreakInvis(); + void LeaveGroup(); - bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} - bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} -int32 GetHunger() const { return m_pp.hunger_level; } -int32 GetThirst() const { return m_pp.thirst_level; } -void SetHunger(int32 in_hunger); -void SetThirst(int32 in_thirst); -void SetConsumption(int32 in_hunger, int32 in_thirst); + bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} + bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} +int32 GetHunger() const { return m_pp.hunger_level; } +int32 GetThirst() const { return m_pp.thirst_level; } +void SetHunger(int32 in_hunger); +void SetThirst(int32 in_thirst); +void SetConsumption(int32 in_hunger, int32 in_thirst); - bool CheckTradeLoreConflict(Client* other); - void LinkDead(); - void Insight(uint32 t_id); - bool CheckDoubleAttack(bool tripleAttack = false); - bool CheckDoubleRangedAttack(); + bool CheckTradeLoreConflict(Client* other); + void LinkDead(); + void Insight(uint32 t_id); + bool CheckDoubleAttack(bool tripleAttack = false); + bool CheckDoubleRangedAttack(); //remove charges/multiple objects from inventory: - //bool DecreaseByType(uint32 type, uint8 amt); - bool DecreaseByID(uint32 type, uint8 amt); - uint8 SlotConvert2(uint8 slot); //Maybe not needed. - void Escape(); //AA Escape - void RemoveNoRent(bool client_update = true); - void RemoveDuplicateLore(bool client_update = true); - void MoveSlotNotAllowed(bool client_update = true); - virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); - virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); - void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); + //bool DecreaseByType(uint32 type, uint8 amt); + bool DecreaseByID(uint32 type, uint8 amt); + uint8 SlotConvert2(uint8 slot); //Maybe not needed. + void Escape(); //AA Escape + void RemoveNoRent(bool client_update = true); + void RemoveDuplicateLore(bool client_update = true); + void MoveSlotNotAllowed(bool client_update = true); + virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); + virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); + void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); - void SetZoneFlag(uint32 zone_id); - void ClearZoneFlag(uint32 zone_id); - bool HasZoneFlag(uint32 zone_id) const; - void SendZoneFlagInfo(Client *to) const; - void LoadZoneFlags(); + void SetZoneFlag(uint32 zone_id); + void ClearZoneFlag(uint32 zone_id); + bool HasZoneFlag(uint32 zone_id) const; + void SendZoneFlagInfo(Client *to) const; + void LoadZoneFlags(); - void ChangeSQLLog(const char *file); - void LogSQL(const char *fmt, ...); - bool CanFish(); - void GoFish(); - void ForageItem(bool guarantee = false); + void ChangeSQLLog(const char *file); + void LogSQL(const char *fmt, ...); + bool CanFish(); + void GoFish(); + void ForageItem(bool guarantee = false); //Calculate vendor price modifier based on CHA: (reverse==selling) - float CalcPriceMod(Mob* other = 0, bool reverse = false); - void ResetTrade(); - void DropInst(const ItemInst* inst); - bool TrainDiscipline(uint32 itemid); - void SendDisciplineUpdate(); - bool UseDiscipline(uint32 spell_id, uint32 target); + float CalcPriceMod(Mob* other = 0, bool reverse = false); + void ResetTrade(); + void DropInst(const ItemInst* inst); + bool TrainDiscipline(uint32 itemid); + void SendDisciplineUpdate(); + bool UseDiscipline(uint32 spell_id, uint32 target); - bool CheckTitle(int titleset); - void EnableTitle(int titleset); - void RemoveTitle(int titleset); + bool CheckTitle(int titleset); + void EnableTitle(int titleset); + void RemoveTitle(int titleset); - void EnteringMessages(Client* client); - void SendRules(Client* client); + void EnteringMessages(Client* client); + void SendRules(Client* client); std::list consent_list; //Anti-Cheat Stuff @@ -904,97 +904,63 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void SendBuffDurationPacket(Buffs_Struct &buff); void SendBuffNumHitPacket(Buffs_Struct &buff, int slot); - void ProcessInspectRequest(Client* requestee, Client* requester); - bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } - int FindSpellBookSlotBySpellID(uint16 spellid); - int GetNextAvailableSpellBookSlot(int starting_slot = 0); + void ProcessInspectRequest(Client* requestee, Client* requester); + bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } + int FindSpellBookSlotBySpellID(uint16 spellid); + int GetNextAvailableSpellBookSlot(int starting_slot = 0); inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; } inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); } - uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); - void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); - void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); - bool PendingTranslocate; - time_t TranslocateTime; - bool PendingSacrifice; - std::string SacrificeCaster; - struct Translocate_Struct PendingTranslocateData; - void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); + uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); + void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); + void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); + bool PendingTranslocate; + time_t TranslocateTime; + bool PendingSacrifice; + std::string SacrificeCaster; + struct Translocate_Struct PendingTranslocateData; + void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); // Task System Methods - void LoadClientTaskState(); - void RemoveClientTaskState(); - void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); - void SendTaskFailed(int TaskID, int TaskIndex); - void SendTaskComplete(int TaskIndex); + void LoadClientTaskState(); + void RemoveClientTaskState(); + void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); + void SendTaskFailed(int TaskID, int TaskIndex); + void SendTaskComplete(int TaskIndex); inline void CancelTask(int TaskIndex) { if(taskstate) taskstate->CancelTask(this, TaskIndex); } - inline bool SaveTaskState() { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); } - inline bool IsTaskStateLoaded() { return taskstate != nullptr; } - inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); } - inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); } - inline ActivityState GetTaskActivityState(int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); } - inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); } - inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); } - inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); } - inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } - inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); } - inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; } - inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } - inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); } - inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); } - inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); } - inline bool IsTaskEnabled(int TaskID) { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); } - inline void ProcessTaskProximities(float X, float Y, float Z) { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); } - inline void AssignTask(int TaskID, int NPCID) { if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); } - inline int ActiveSpeakTask(int NPCID) { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; } - inline int ActiveSpeakActivity(int NPCID, int TaskID) { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; } - inline void FailTask(int TaskID) { if(taskstate) taskstate->FailTask(this, TaskID); } - inline int TaskTimeLeft(int TaskID) { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); } - inline int EnabledTaskCount(int TaskSetID) { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); } - inline int IsTaskCompleted(int TaskID) { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); } - inline void ShowClientTasks() { if(taskstate) taskstate->ShowClientTasks(this); } - inline void CancelAllTasks() { if(taskstate) taskstate->CancelAllTasks(this); } - inline int GetActiveTaskCount() { return (taskstate ? taskstate->GetActiveTaskCount() : 0); } - inline int GetActiveTaskID(int index) { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); } - inline int GetTaskStartTime(int index) { return (taskstate ? taskstate->GetTaskStartTime(index) : -1); } - inline bool IsTaskActivityCompleted(int index, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); } - inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); } - inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); } - inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } - inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } inline const EQClientVersion GetClientVersion() const { return ClientVersion; } @@ -1047,7 +1013,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void HandleLDoNSenseTraps(NPC *target, uint16 skill, uint8 type); void HandleLDoNDisarm(NPC *target, uint16 skill, uint8 type); void HandleLDoNPickLock(NPC *target, uint16 skill, uint8 type); - int LDoNChest_SkillCheck(NPC *target, int skill); + int LDoNChest_SkillCheck(NPC *target, int skill); void MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 count=1); @@ -1087,7 +1053,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); inline bool GetPendingGuildInvitation() { return PendingGuildInvitation; } void LocateCorpse(); void SendTargetCommand(uint32 EntityID); - bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); + bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); void HandleRespawnFromHover(uint32 Option); bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); } std::list respawn_options; @@ -1134,8 +1100,8 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool CheckCanRetainMerc(uint32 upkeep); bool CheckCanUnsuspendMerc(); bool CheckCanDismissMerc(); - inline uint32 GetMercID() const { return mercid; } - inline uint8 GetMercSlot() const { return mercSlot; } + inline uint32 GetMercID() const { return mercid; } + inline uint8 GetMercSlot() const { return mercSlot; } void SetMercID( uint32 newmercid) { mercid = newmercid; } void SetMercSlot( uint8 newmercslot) { mercSlot = newmercslot; } Merc* GetMerc(); @@ -1184,7 +1150,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); int32 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } void LoadAccountFlags(); void SetAccountFlag(std::string flag, std::string val); - std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); + std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); void Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_consume); void PlayMP3(const char* fname); void ExpeditionSay(const char *str, int ExpID); @@ -1232,10 +1198,10 @@ protected: void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true); bool client_data_loaded; - int16 GetFocusEffect(focusType type, uint16 spell_id); - int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); + int16 GetFocusEffect(focusType type, uint16 spell_id); + int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); - Mob* bind_sight_target; + Mob* bind_sight_target; Map::Vertex aa_los_me; Map::Vertex aa_los_them; @@ -1260,52 +1226,52 @@ protected: private: eqFilterMode ClientFilters[_FilterCount]; - int32 HandlePacket(const EQApplicationPacket *app); - void OPTGB(const EQApplicationPacket *app); - void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); - void OPMemorizeSpell(const EQApplicationPacket *app); - void OPMoveCoin(const EQApplicationPacket* app); - void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); - void OPGMTraining(const EQApplicationPacket *app); - void OPGMEndTraining(const EQApplicationPacket *app); - void OPGMTrainSkill(const EQApplicationPacket *app); - void OPGMSummon(const EQApplicationPacket *app); - void OPCombatAbility(const EQApplicationPacket *app); + int32 HandlePacket(const EQApplicationPacket *app); + void OPTGB(const EQApplicationPacket *app); + void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); + void OPMemorizeSpell(const EQApplicationPacket *app); + void OPMoveCoin(const EQApplicationPacket* app); + void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); + void OPGMTraining(const EQApplicationPacket *app); + void OPGMEndTraining(const EQApplicationPacket *app); + void OPGMTrainSkill(const EQApplicationPacket *app); + void OPGMSummon(const EQApplicationPacket *app); + void OPCombatAbility(const EQApplicationPacket *app); // Bandolier Methods - void CreateBandolier(const EQApplicationPacket *app); - void RemoveBandolier(const EQApplicationPacket *app); - void SetBandolier(const EQApplicationPacket *app); + void CreateBandolier(const EQApplicationPacket *app); + void RemoveBandolier(const EQApplicationPacket *app); + void SetBandolier(const EQApplicationPacket *app); - void HandleTraderPriceUpdate(const EQApplicationPacket *app); + void HandleTraderPriceUpdate(const EQApplicationPacket *app); - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 CalcATK(); - int32 CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 CalcATK(); + int32 CalcHaste(); - int32 CalcAlcoholPhysicalEffect(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcAlcoholPhysicalEffect(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 CalcHPRegen(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - uint32 GetClassHPFactor(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 CalcHPRegen(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + uint32 GetClassHPFactor(); void DoHPRegen(); void DoManaRegen(); void DoStaminaUpdate(); @@ -1317,75 +1283,75 @@ private: EQStreamInterface* eqs; - uint32 ip; - uint16 port; - CLIENT_CONN_STATUS client_state; - uint32 character_id; - uint32 WID; - uint32 account_id; - char account_name[30]; - uint32 lsaccountid; - char lskey[30]; - int16 admin; - uint32 guild_id; - uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK - bool GuildBanker; - uint16 duel_target; - bool duelaccepted; + uint32 ip; + uint16 port; + CLIENT_CONN_STATUS client_state; + uint32 character_id; + uint32 WID; + uint32 account_id; + char account_name[30]; + uint32 lsaccountid; + char lskey[30]; + int16 admin; + uint32 guild_id; + uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK + bool GuildBanker; + uint16 duel_target; + bool duelaccepted; std::list keyring; - bool tellsoff; // GM /toggle - bool gmhideme; - bool LFG; - bool LFP; - uint8 LFGFromLevel; - uint8 LFGToLevel; - bool LFGMatchFilter; - char LFGComments[64]; - bool AFK; - bool auto_attack; - bool auto_fire; - uint8 gmspeed; - bool medding; - uint16 horseId; - bool revoked; - uint32 pQueuedSaveWorkID; - uint16 pClientSideTarget; - uint32 weight; - bool berserk; - bool dead; - uint16 BoatID; - uint16 TrackingID; - uint16 CustomerID; - uint32 account_creation; - uint8 firstlogon; - uint32 mercid; // current merc - uint8 mercSlot; // selected merc slot - bool Trader; - bool Buyer; - std::string BuyerWelcomeMessage; - bool AbilityTimer; + bool tellsoff; // GM /toggle + bool gmhideme; + bool LFG; + bool LFP; + uint8 LFGFromLevel; + uint8 LFGToLevel; + bool LFGMatchFilter; + char LFGComments[64]; + bool AFK; + bool auto_attack; + bool auto_fire; + uint8 gmspeed; + bool medding; + uint16 horseId; + bool revoked; + uint32 pQueuedSaveWorkID; + uint16 pClientSideTarget; + uint32 weight; + bool berserk; + bool dead; + uint16 BoatID; + uint16 TrackingID; + uint16 CustomerID; + uint32 account_creation; + uint8 firstlogon; + uint32 mercid; // current merc + uint8 mercSlot; // selected merc slot + bool Trader; + bool Buyer; + std::string BuyerWelcomeMessage; + bool AbilityTimer; int Haste; //precalced value - int32 max_end; - int32 cur_end; + int32 max_end; + int32 cur_end; - PlayerProfile_Struct m_pp; - ExtendedProfile_Struct m_epp; - Inventory m_inv; - Object* m_tradeskill_object; - PetInfo m_petinfo; // current pet data, used while loading from and saving to DB - PetInfo m_suspendedminion; // pet data for our suspended minion. - MercInfo m_mercinfo[MAXMERCS]; // current mercenary - InspectMessage_Struct m_inspect_message; + PlayerProfile_Struct m_pp; + ExtendedProfile_Struct m_epp; + Inventory m_inv; + Object* m_tradeskill_object; + PetInfo m_petinfo; // current pet data, used while loading from and saving to DB + PetInfo m_suspendedminion; // pet data for our suspended minion. + MercInfo m_mercinfo[MAXMERCS]; // current mercenary + InspectMessage_Struct m_inspect_message; void NPCSpawn(const Seperator* sep); uint32 GetEXPForLevel(uint16 level); - bool CanBeInZone(); - void SendLogoutPackets(); - bool AddPacket(const EQApplicationPacket *, bool); - bool AddPacket(EQApplicationPacket**, bool); - bool SendAllPackets(); + bool CanBeInZone(); + void SendLogoutPackets(); + bool AddPacket(const EQApplicationPacket *, bool); + bool AddPacket(EQApplicationPacket**, bool); + bool SendAllPackets(); LinkedList clientpackets; //Zoning related stuff @@ -1394,62 +1360,62 @@ private: void DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r); void ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm); void ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - float zonesummon_x; - float zonesummon_y; - float zonesummon_z; - uint16 zonesummon_id; - uint8 zonesummon_ignorerestrictions; + float zonesummon_x; + float zonesummon_y; + float zonesummon_z; + uint16 zonesummon_id; + uint8 zonesummon_ignorerestrictions; ZoneMode zone_mode; - Timer position_timer; - uint8 position_timer_counter; + Timer position_timer; + uint8 position_timer_counter; - PTimerList p_timers; //persistent timers - Timer hpupdate_timer; - Timer camp_timer; - Timer process_timer; - Timer stamina_timer; - Timer zoneinpacket_timer; - Timer linkdead_timer; - Timer dead_timer; - Timer global_channel_timer; - Timer shield_timer; - Timer fishing_timer; - Timer endupkeep_timer; - Timer forget_timer; // our 2 min everybody forgets you timer - Timer autosave_timer; + PTimerList p_timers; //persistent timers + Timer hpupdate_timer; + Timer camp_timer; + Timer process_timer; + Timer stamina_timer; + Timer zoneinpacket_timer; + Timer linkdead_timer; + Timer dead_timer; + Timer global_channel_timer; + Timer shield_timer; + Timer fishing_timer; + Timer endupkeep_timer; + Timer forget_timer; // our 2 min everybody forgets you timer + Timer autosave_timer; #ifdef REVERSE_AGGRO - Timer scanarea_timer; + Timer scanarea_timer; #endif - Timer tribute_timer; + Timer tribute_timer; - Timer proximity_timer; - Timer TaskPeriodic_Timer; - Timer charm_update_timer; - Timer rest_timer; - Timer charm_class_attacks_timer; - Timer charm_cast_timer; - Timer qglobal_purge_timer; - Timer TrackingTimer; - Timer RespawnFromHoverTimer; - Timer merc_timer; + Timer proximity_timer; + Timer TaskPeriodic_Timer; + Timer charm_update_timer; + Timer rest_timer; + Timer charm_class_attacks_timer; + Timer charm_cast_timer; + Timer qglobal_purge_timer; + Timer TrackingTimer; + Timer RespawnFromHoverTimer; + Timer merc_timer; - float proximity_x; - float proximity_y; - float proximity_z; + float proximity_x; + float proximity_y; + float proximity_z; - void BulkSendInventoryItems(); + void BulkSendInventoryItems(); faction_map factionvalues; uint32 tribute_master_id; FILE *SQL_log; - uint32 max_AAXP; - uint32 staminacount; - AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile + uint32 max_AAXP; + uint32 staminacount; + AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile std::map aa_points; bool npcflag; uint8 npclevel; @@ -1457,14 +1423,14 @@ private: bool zoning; bool tgb; bool instalog; - int32 last_reported_mana; - int32 last_reported_endur; + int32 last_reported_mana; + int32 last_reported_endur; unsigned int AggroCount; // How many mobs are aggro on us. - unsigned int RestRegenHP; - unsigned int RestRegenMana; - unsigned int RestRegenEndurance; + unsigned int RestRegenHP; + unsigned int RestRegenMana; + unsigned int RestRegenEndurance; bool EngagedRaidTarget; uint32 SavedRaidRestTimer; @@ -1482,7 +1448,7 @@ private: uint32 AttemptedMessages; EQClientVersion ClientVersion; - uint32 ClientVersionBit; + uint32 ClientVersionBit; int XPRate; @@ -1497,18 +1463,18 @@ private: //Connecting debug code. enum { //connecting states, used for debugging only - NoPacketsReceived, //havent gotten anything + NoPacketsReceived, //havent gotten anything //this is the point where the client changes to the loading screen - ReceivedZoneEntry, //got the first packet, loading up PP - PlayerProfileLoaded, //our DB work is done, sending it - ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather + ReceivedZoneEntry, //got the first packet, loading up PP + PlayerProfileLoaded, //our DB work is done, sending it + ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather //this is the point where the client shows a status bar zoning in - NewZoneRequested, //received and sent new zone request - ClientSpawnRequested, //client sent ReqClientSpawn - ZoneContentsSent, //objects, doors, zone points - ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc + NewZoneRequested, //received and sent new zone request + ClientSpawnRequested, //client sent ReqClientSpawn + ZoneContentsSent, //objects, doors, zone points + ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc //this is the point where the client releases the mouse - ClientConnectFinished //client finally moved to finished state, were done here + ClientConnectFinished //client finally moved to finished state, were done here } conn_state; void ReportConnectingState(); @@ -1516,8 +1482,8 @@ private: bool PendingGuildInvitation; int PendingRezzXP; uint32 PendingRezzDBID; - uint16 PendingRezzSpellID; // Only used for resurrect while hovering. - std::string PendingRezzCorpseName; // Only used for resurrect while hovering. + uint16 PendingRezzSpellID; // Only used for resurrect while hovering. + std::string PendingRezzCorpseName; // Only used for resurrect while hovering. std::set PlayerBlockedBuffs; std::set PetBlockedBuffs; diff --git a/zone/merc.h b/zone/merc.h index 66c310759..deb5fe53b 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -4,17 +4,17 @@ #include "zonedb.h" #include "npc.h" -#define MAXMERCS 1 -#define MERC_DEBUG 0 -#define TANK 1 -#define HEALER 2 -#define MELEEDPS 9 -#define CASTERDPS 12 +#define MAXMERCS 1 +#define MERC_DEBUG 0 +#define TANK 1 +#define HEALER 2 +#define MELEEDPS 9 +#define CASTERDPS 12 -#define NO_MERC_ID 0 -#define MERC_STATE_NORMAL 5 +#define NO_MERC_ID 0 +#define MERC_STATE_NORMAL 5 #define MERC_STATE_SUSPENDED 1 -#define NOT_SUSPENDED_TIME 0 +#define NOT_SUSPENDED_TIME 0 const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this @@ -31,19 +31,19 @@ enum MercStanceType { }; struct MercSpell { - uint16 spellid; // <= 0 = no spell - uint32 type; // 0 = never, must be one (and only one) of the defined values - int16 stance; // 0 = all, + = only this stance, - = all except this stance - int16 slot; - uint16 proc_chance; - uint32 time_cancast; // when we can cast this spell next + uint16 spellid; // <= 0 = no spell + uint32 type; // 0 = never, must be one (and only one) of the defined values + int16 stance; // 0 = all, + = only this stance, - = all except this stance + int16 slot; + uint16 proc_chance; + uint32 time_cancast; // when we can cast this spell next }; struct MercTimer { - uint16 timerid; // EndurTimerIndex - uint8 timertype; // 1 = spell, 2 = disc - uint16 spellid; // <= 0 = no spell - uint32 time_cancast; // when we can cast this spell next + uint16 timerid; // EndurTimerIndex + uint8 timertype; // 1 = spell, 2 = disc + uint16 spellid; // <= 0 = no spell + uint32 time_cancast; // when we can cast this spell next }; class Merc : public NPC { @@ -170,16 +170,16 @@ public: inline const uint8 GetClientVersion() const { return _OwnerClientVersion; } virtual void SetTarget(Mob* mob); - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } virtual void DoClassAttacks(Mob *target); - void CheckHateList(); - bool CheckTaunt(); - bool CheckAETaunt(); - bool CheckConfidence(); - bool TryHide(); + void CheckHateList(); + bool CheckTaunt(); + bool CheckAETaunt(); + bool CheckConfidence(); + bool TryHide(); // stat functions virtual void CalcBonuses(); @@ -189,56 +189,56 @@ public: inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } int32 GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } // "SET" Class Methods void SetMercData (uint32 templateID ); @@ -279,53 +279,53 @@ protected: std::map timers; uint16 skills[HIGHEST_SKILL+1]; - uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs - uint16 d_meele_texture1; //this is an item Material value - uint16 d_meele_texture2; //this is an item Material value (offhand) - uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation - uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation + uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs + uint16 d_meele_texture1; //this is an item Material value + uint16 d_meele_texture2; //this is an item Material value (offhand) + uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation + uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation private: - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 acmod(); - int32 CalcATK(); - //int CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 acmod(); + int32 CalcATK(); + //int CalcHaste(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 GetClassHPFactor(); - int32 CalcHPRegen(); - int32 CalcHPRegenCap(); - int32 CalcMaxMana(); - int32 CalcBaseMana(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - int32 CalcManaRegenCap(); - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 CalcEnduranceRegenCap(); - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceUpkeep(); //does the endurance upkeep - void CalcRestState(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 GetClassHPFactor(); + int32 CalcHPRegen(); + int32 CalcHPRegenCap(); + int32 CalcMaxMana(); + int32 CalcBaseMana(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + int32 CalcManaRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 CalcEnduranceRegenCap(); + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceUpkeep(); //does the endurance upkeep + void CalcRestState(); int GroupLeadershipAAHealthEnhancement(); int GroupLeadershipAAManaEnhancement(); @@ -351,8 +351,8 @@ private: uint32 _baseWIS; uint32 _baseCHA; uint32 _baseATK; - uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. - uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. + uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. + uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. uint32 _baseMR; uint32 _baseCR; uint32 _baseDR; From c506e330181c76a6610cabf2241a07ccec1b6da8 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 18 Nov 2014 21:12:48 -0800 Subject: [PATCH 0282/1883] Fixed merge --- common/eq_packet_structs.h | 26 +++++++++++---- world/worlddb.cpp | 68 +++++++++++++++++++++++++------------- zone/attack.cpp | 2 +- zone/client.cpp | 47 ++++++++++++++++---------- zone/client.h | 12 ++++--- zone/client_packet.cpp | 20 +++++------ zone/client_process.cpp | 22 ++++++------ zone/lua_client.cpp | 24 +++++++++----- zone/lua_client.h | 7 ++-- zone/perl_client.cpp | 29 ++++++++++------ zone/qglobals.cpp | 2 +- zone/zone.cpp | 4 ++- zone/zone.h | 2 ++ zone/zonedb.cpp | 39 ++++++++++++---------- zone/zoning.cpp | 14 +++++--- 15 files changed, 198 insertions(+), 120 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 7c663f18e..368cdf931 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -831,17 +831,18 @@ struct BindStruct { /*008*/ float y; /*012*/ float z; /*016*/ float heading; - /*020*/ + /*020*/ uint32 instance_id; + /*024*/ }; struct SuspendedMinion_Struct { - /*000*/ uint16 SpellID; - /*002*/ uint32 HP; - /*006*/ uint32 Mana; - /*010*/ SpellBuff_Struct Buffs[BUFF_COUNT]; - /*510*/ uint32 Items[_MaterialCount]; - /*546*/ char Name[64]; + /*000*/ uint16 SpellID; + /*002*/ uint32 HP; + /*006*/ uint32 Mana; + /*010*/ SpellBuff_Struct Buffs[BUFF_COUNT]; + /*510*/ uint32 Items[_MaterialCount]; + /*546*/ char Name[64]; /*610*/ }; @@ -2663,6 +2664,17 @@ struct Translocate_Struct { /*088*/ uint32 Complete; }; +struct PendingTranslocate_Struct +{ + uint32 zone_id; + uint16 instance_id; + float heading; + float x; + float y; + float z; + uint32 spell_id; +}; + struct Sacrifice_Struct { /*000*/ uint32 CasterID; /*004*/ uint32 TargetID; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 3c9e3f128..d2e092c22 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -222,15 +222,37 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { /* if an invalid bind point is specified, use the primary bind */ - if (bindnum > 4){ bindnum = 0; } - int is_home = 0; - if (bindnum == 4){ is_home = 1; } - - std::string query = StringFormat("SELECT `zone_id` FROM `character_bind` WHERE `id` = %u AND `is_home` = %u LIMIT 1", CharID, is_home); - auto results = database.QueryDatabase(query); int i = 0; - for (auto row = results.begin(); row != results.end(); ++row) { - return atoi(row[0]); + if (bindnum > 4) + { + bindnum = 0; } + + std::string query = StringFormat("SELECT zone_id, instance_id, x, y, z FROM character_bind WHERE id = %u AND is_home = %u LIMIT 1", CharID, bindnum == 4 ? 1 : 0); + auto results = database.QueryDatabase(query); + if(!results.Success() || results.RowCount() == 0) { + return 0; + } + + int zone_id, instance_id; + double x, y, z, heading; + for (auto row = results.begin(); row != results.end(); ++row) { + zone_id = atoi(row[0]); + instance_id = atoi(row[1]); + x = atof(row[2]); + y = atof(row[3]); + z = atof(row[4]); + heading = atof(row[5]); + } + + query = StringFormat("UPDATE character_data SET zone_id = '%d', zone_instance = '%d', x = '%f', y = '%f', z = '%f', heading = '%f'", + zone_id, instance_id, x, y, z, heading); + + results = database.QueryDatabase(query); + if(!results.Success()) { + return 0; + } + + return zone_id; } bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) @@ -239,7 +261,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; - in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; + in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id " "FROM start_zones WHERE player_choice = % i " @@ -267,79 +289,79 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } case 1: { - in_pp->zone_id =2; // qeynos2 + in_pp->zone_id = 2; // qeynos2 in_pp->binds[0].zoneId = 2; // qeynos2 break; } case 2: { - in_pp->zone_id =29; // halas + in_pp->zone_id = 29; // halas in_pp->binds[0].zoneId = 30; // everfrost break; } case 3: { - in_pp->zone_id =19; // rivervale + in_pp->zone_id = 19; // rivervale in_pp->binds[0].zoneId = 20; // kithicor break; } case 4: { - in_pp->zone_id =9; // freportw + in_pp->zone_id = 9; // freportw in_pp->binds[0].zoneId = 9; // freportw break; } case 5: { - in_pp->zone_id =40; // neriaka + in_pp->zone_id = 40; // neriaka in_pp->binds[0].zoneId = 25; // nektulos break; } case 6: { - in_pp->zone_id =52; // gukta + in_pp->zone_id = 52; // gukta in_pp->binds[0].zoneId = 46; // innothule break; } case 7: { - in_pp->zone_id =49; // oggok + in_pp->zone_id = 49; // oggok in_pp->binds[0].zoneId = 47; // feerrott break; } case 8: { - in_pp->zone_id =60; // kaladima + in_pp->zone_id = 60; // kaladima in_pp->binds[0].zoneId = 68; // butcher break; } case 9: { - in_pp->zone_id =54; // gfaydark + in_pp->zone_id = 54; // gfaydark in_pp->binds[0].zoneId = 54; // gfaydark break; } case 10: { - in_pp->zone_id =61; // felwithea + in_pp->zone_id = 61; // felwithea in_pp->binds[0].zoneId = 54; // gfaydark break; } case 11: { - in_pp->zone_id =55; // akanon + in_pp->zone_id = 55; // akanon in_pp->binds[0].zoneId = 56; // steamfont break; } case 12: { - in_pp->zone_id =82; // cabwest + in_pp->zone_id = 82; // cabwest in_pp->binds[0].zoneId = 78; // fieldofbone break; } case 13: { - in_pp->zone_id =155; // sharvahl + in_pp->zone_id = 155; // sharvahl in_pp->binds[0].zoneId = 155; // sharvahl break; } @@ -378,7 +400,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; - in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; + in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i " "AND player_class = %i AND player_deity = %i AND player_race = %i", diff --git a/zone/attack.cpp b/zone/attack.cpp index 569466f68..da812e724 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1695,7 +1695,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att dead_timer.Start(5000, true); m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); Save(); GoToDeath(); diff --git a/zone/client.cpp b/zone/client.cpp index 25dbb2840..3237240c9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -398,7 +398,7 @@ Client::~Client() { if(IsHoveringForRespawn()) { m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; x_pos = m_pp.binds[0].x; y_pos = m_pp.binds[0].y; z_pos = m_pp.binds[0].z; @@ -543,11 +543,11 @@ bool Client::Save(uint8 iCommitNow) { m_pp.endurance = cur_end; /* Save Character Currency */ - database.SaveCharacterCurrency(this->CharacterID(), &m_pp); + database.SaveCharacterCurrency(CharacterID(), &m_pp); - /* Save Current Bind Points : Sets Instance to 0 because it is currently not implemented */ - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */ - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[4].zoneId, 0, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */ + /* Save Current Bind Points */ + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */ + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[4].zoneId, m_pp.binds[4].instance_id, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */ /* Save Character Buffs */ database.SaveBuffs(this); @@ -3848,7 +3848,8 @@ void Client::Sacrifice(Client *caster) void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { - if(!Caster || PendingTranslocate) return; + if(!Caster || PendingTranslocate) + return; const SPDat_Spell_Struct &Spell = spells[SpellID]; @@ -3856,26 +3857,29 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { Translocate_Struct *ts = (Translocate_Struct*)outapp->pBuffer; strcpy(ts->Caster, Caster->GetName()); - ts->SpellID = SpellID; + PendingTranslocateData.spell_id = ts->SpellID = SpellID; if((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) { - ts->ZoneID = m_pp.binds[0].zoneId; - ts->x = m_pp.binds[0].x; - ts->y = m_pp.binds[0].y; - ts->z = m_pp.binds[0].z; + PendingTranslocateData.zone_id = ts->ZoneID = m_pp.binds[0].zoneId; + PendingTranslocateData.instance_id = m_pp.binds[0].instance_id; + PendingTranslocateData.x = ts->x = m_pp.binds[0].x; + PendingTranslocateData.y = ts->y = m_pp.binds[0].y; + PendingTranslocateData.z = ts->z = m_pp.binds[0].z; + PendingTranslocateData.heading = m_pp.binds[0].heading; } else { ts->ZoneID = database.GetZoneID(Spell.teleport_zone); + PendingTranslocateData.instance_id = 0; ts->y = Spell.base[0]; ts->x = Spell.base[1]; ts->z = Spell.base[2]; + PendingTranslocateData.heading = 0.0; } ts->unknown008 = 0; ts->Complete = 0; - PendingTranslocateData = *ts; - PendingTranslocate=true; + PendingTranslocate = true; TranslocateTime = time(nullptr); QueuePacket(outapp); @@ -4473,7 +4477,8 @@ void Client::SendRespawnBinds() BindStruct* b = &m_pp.binds[0]; RespawnOption opt; opt.name = "Bind Location"; - opt.zoneid = b->zoneId; + opt.zone_id = b->zoneId; + opt.instance_id = b->instance_id; opt.x = b->x; opt.y = b->y; opt.z = b->z; @@ -4483,7 +4488,8 @@ void Client::SendRespawnBinds() //Rez is always added at the end RespawnOption rez; rez.name = "Resurrect"; - rez.zoneid = zone->GetZoneID(); + rez.zone_id = zone->GetZoneID(); + rez.instance_id = zone->GetInstanceID(); rez.x = GetX(); rez.y = GetY(); rez.z = GetZ(); @@ -4518,7 +4524,7 @@ void Client::SendRespawnBinds() { opt = &(*itr); VARSTRUCT_ENCODE_TYPE(uint32, buffer, count++); //option num (from 0) - VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zoneid); + VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zone_id); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->x); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->y); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->z); @@ -4891,6 +4897,10 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z) return; m_pp.binds[4].zoneId = zoneid; + if(zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) { + m_pp.binds[4].instance_id = zone->GetInstanceID(); + } + if (x == 0 && y == 0 && z ==0) database.GetSafePoints(m_pp.binds[4].zoneId, 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z); else { @@ -7937,7 +7947,7 @@ void Client::SendItemScale(ItemInst *inst) { } } -void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float heading, bool initial_selection, int8 position) +void Client::AddRespawnOption(std::string option_name, uint32 zoneid, uint16 instance_id, float x, float y, float z, float heading, bool initial_selection, int8 position) { //If respawn window is already open, any changes would create an inconsistency with the client if (IsHoveringForRespawn()) { return; } @@ -7948,7 +7958,8 @@ void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, f //Create respawn option RespawnOption res_opt; res_opt.name = option_name; - res_opt.zoneid = zoneid; + res_opt.zone_id = zoneid; + res_opt.instance_id = instance_id; res_opt.x = x; res_opt.y = y; res_opt.z = z; diff --git a/zone/client.h b/zone/client.h index c2dabdc62..fd797c1b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -177,7 +177,8 @@ struct XTarget_Struct struct RespawnOption { std::string name; - uint32 zoneid; + uint32 zone_id; + uint16 instance_id; float x; float y; float z; @@ -376,6 +377,7 @@ public: inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } + inline uint32 GetBindInstanceID(uint32 index = 0) const { return m_pp.binds[index].instance_id; } int32 CalcMaxMana(); int32 CalcBaseMana(); const int32& SetMana(int32 amount); @@ -573,10 +575,11 @@ public: uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } virtual void SetLevel(uint8 set_level, bool command = false); + void GoToBind(uint8 bindnum = 0); void GoToSafeCoords(uint16 zone_id, uint16 instance_id); void Gate(); - void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); + void SetBindPoint(int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); uint32 GetStartZone(void); void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); @@ -613,6 +616,7 @@ public: inline uint32 GetWID() const { return WID; } inline void SetWID(uint32 iWID) { WID = iWID; } inline uint32 AccountID() const { return account_id; } + inline const char* AccountName()const { return account_name; } inline int16 Admin() const { return admin; } inline uint32 CharacterID() const { return character_id; } @@ -917,7 +921,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); time_t TranslocateTime; bool PendingSacrifice; std::string SacrificeCaster; - struct Translocate_Struct PendingTranslocateData; + PendingTranslocate_Struct PendingTranslocateData; void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); // Task System Methods @@ -1057,7 +1061,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void HandleRespawnFromHover(uint32 Option); bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); } std::list respawn_options; - void AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float h = 0, bool initial_selection = false, int8 position = -1); + void AddRespawnOption(std::string option_name, uint32 zoneid, uint16 instance_id, float x, float y, float z, float h = 0, bool initial_selection = false, int8 position = -1); bool RemoveRespawnOption(std::string option_name); bool RemoveRespawnOption(uint8 position); void ClearRespawnOptions() { respawn_options.clear(); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 15c4f3497..941eaf774 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13725,7 +13725,8 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) } Translocate_Struct *its = (Translocate_Struct*)app->pBuffer; - if (!PendingTranslocate) return; + if (!PendingTranslocate) + return; if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) { Message(13, "You did not accept the Translocate within the required time limit."); @@ -13735,7 +13736,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) if (its->Complete == 1) { - int SpellID = PendingTranslocateData.SpellID; + int SpellID = PendingTranslocateData.spell_id; int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0); if (i == 0) @@ -13745,20 +13746,19 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) // to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before. if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && - zone->GetZoneID() == PendingTranslocateData.ZoneID) + (zone->GetZoneID() == PendingTranslocateData.zone_id && + zone->GetInstanceID() == PendingTranslocateData.instance_id)) { PendingTranslocate = false; GoToBind(); return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Translocate, sizeof(Translocate_Struct)); - Translocate_Struct *ots = (Translocate_Struct*)outapp->pBuffer; - memcpy(ots, &PendingTranslocateData, sizeof(Translocate_Struct)); - - //Was sending the packet back to initiate client zone... - //but that could be abusable, so lets go through proper channels - MovePC(ots->ZoneID, 0, ots->x, ots->y, ots->z, GetHeading(), 0, ZoneSolicited); + ////Was sending the packet back to initiate client zone... + ////but that could be abusable, so lets go through proper channels + MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id, + PendingTranslocateData.x, PendingTranslocateData.y, + PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited); } } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e26dcd2e3..2f46a5688 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -147,11 +147,11 @@ bool Client::Process() { if(mana_timer.Check()) SendManaUpdatePacket(); - if(dead && dead_timer.Check()) - { - database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId)); + if(dead && dead_timer.Check()) { + database.MoveCharacterToZone(GetName(), database.GetZoneName(m_pp.binds[0].zoneId)); + m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.x = m_pp.binds[0].x; m_pp.y = m_pp.binds[0].y; m_pp.z = m_pp.binds[0].z; @@ -2120,7 +2120,8 @@ void Client::HandleRespawnFromHover(uint32 Option) BindStruct* b = &m_pp.binds[0]; default_to_bind = new RespawnOption; default_to_bind->name = "Bind Location"; - default_to_bind->zoneid = b->zoneId; + default_to_bind->zone_id = b->zoneId; + default_to_bind->instance_id = b->instance_id; default_to_bind->x = b->x; default_to_bind->y = b->y; default_to_bind->z = b->z; @@ -2129,7 +2130,7 @@ void Client::HandleRespawnFromHover(uint32 Option) is_rez = false; } - if (chosen->zoneid == zone->GetZoneID()) //If they should respawn in the current zone... + if (chosen->zone_id == zone->GetZoneID() && chosen->instance_id == zone->GetInstanceID()) //If they should respawn in the current zone... { if (is_rez) { @@ -2185,6 +2186,7 @@ void Client::HandleRespawnFromHover(uint32 Option) ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; gmg->bind_zone_id = zone->GetZoneID(); + gmg->bind_instance_id = chosen->instance_id; gmg->x = chosen->x; gmg->y = chosen->y; gmg->z = chosen->z; @@ -2230,13 +2232,13 @@ void Client::HandleRespawnFromHover(uint32 Option) if(r) r->MemberZoned(this); - m_pp.zone_id = chosen->zoneid; - m_pp.zoneInstance = 0; - database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(chosen->zoneid)); + m_pp.zone_id = chosen->zone_id; + m_pp.zoneInstance = chosen->instance_id; + database.MoveCharacterToZone(CharacterID(), database.GetZoneName(chosen->zone_id)); Save(); - MovePC(chosen->zoneid,chosen->x,chosen->y,chosen->z,chosen->heading,1); + MovePC(chosen->zone_id, chosen->instance_id, chosen->x, chosen->y, chosen->z, chosen->heading, 1); } safe_delete(default_to_bind); diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 56abe5f09..22e38b21d 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -235,19 +235,24 @@ void Lua_Client::SetBindPoint(int to_zone) { self->SetBindPoint(to_zone); } -void Lua_Client::SetBindPoint(int to_zone, float new_x) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x); + self->SetBindPoint(to_zone, to_instance); } -void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x, new_y); + self->SetBindPoint(to_zone, to_instance, new_x); } -void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x, new_y, new_z); + self->SetBindPoint(to_zone, to_instance, new_x, new_y); +} + +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { + Lua_Safe_Call_Void(); + self->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); } float Lua_Client::GetBindX() { @@ -1297,9 +1302,10 @@ luabind::scope lua_register_client() { .def("SetEXP", (void(Lua_Client::*)(uint32,uint32,bool))&Lua_Client::SetEXP) .def("SetBindPoint", (void(Lua_Client::*)(void))&Lua_Client::SetBindPoint) .def("SetBindPoint", (void(Lua_Client::*)(int))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float,float))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float,float,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float, float))&Lua_Client::SetBindPoint) .def("GetBindX", (float(Lua_Client::*)(void))&Lua_Client::GetBindX) .def("GetBindX", (float(Lua_Client::*)(int))&Lua_Client::GetBindX) .def("GetBindY", (float(Lua_Client::*)(void))&Lua_Client::GetBindY) diff --git a/zone/lua_client.h b/zone/lua_client.h index ef2af1181..e2b0a6614 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -73,9 +73,10 @@ public: void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp); void SetBindPoint(); void SetBindPoint(int to_zone); - void SetBindPoint(int to_zone, float new_x); - void SetBindPoint(int to_zone, float new_x, float new_y); - void SetBindPoint(int to_zone, float new_x, float new_y, float new_z); + void SetBindPoint(int to_zone, int to_instance); + void SetBindPoint(int to_zone, int to_instance, float new_x); + void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y); + void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z); float GetBindX(); float GetBindX(int index); float GetBindY(); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index aaaa5899f..2a0c055af 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1023,11 +1023,12 @@ XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */ XS(XS_Client_SetBindPoint) { dXSARGS; - if (items < 1 || items > 5) - Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)"); + if (items < 1 || items > 6) + Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, to_instance = 0, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)"); { Client * THIS; int to_zone; + int to_instance; float new_x; float new_y; float new_z; @@ -1047,25 +1048,31 @@ XS(XS_Client_SetBindPoint) to_zone = (int)SvIV(ST(1)); } - if (items < 3) - new_x = 0.0f; + if(items < 3) + to_instance = 0; else { - new_x = (float)SvNV(ST(2)); + to_instance = (int)SvIV(ST(2)); } if (items < 4) - new_y = 0.0f; + new_x = 0.0f; else { - new_y = (float)SvNV(ST(3)); + new_x = (float)SvNV(ST(3)); } if (items < 5) - new_z = 0.0f; + new_y = 0.0f; else { - new_z = (float)SvNV(ST(4)); + new_y = (float)SvNV(ST(4)); } - THIS->SetBindPoint(to_zone, new_x, new_y, new_z); + if (items < 6) + new_z = 0.0f; + else { + new_z = (float)SvNV(ST(5)); + } + + THIS->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); } XSRETURN_EMPTY; } @@ -6155,7 +6162,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$"); newXSproto(strcpy(buf, "AddEXP"), XS_Client_AddEXP, file, "$$;$$"); newXSproto(strcpy(buf, "SetEXP"), XS_Client_SetEXP, file, "$$$;$"); - newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$"); + newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$$"); newXSproto(strcpy(buf, "GetBindX"), XS_Client_GetBindX, file, "$$"); newXSproto(strcpy(buf, "GetBindY"), XS_Client_GetBindY, file, "$$"); newXSproto(strcpy(buf, "GetBindZ"), XS_Client_GetBindZ, file, "$$"); diff --git a/zone/qglobals.cpp b/zone/qglobals.cpp index f63e13dd4..bc7bf680e 100644 --- a/zone/qglobals.cpp +++ b/zone/qglobals.cpp @@ -172,5 +172,5 @@ void QGlobalCache::LoadBy(const std::string &query) return; for (auto row = results.begin(); row != results.end(); ++row) - AddGlobal(0, QGlobal(std::string(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5]? atoi(row[5]): 0xFFFFFFFF)); + AddGlobal(0, QGlobal(row[0], atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5] ? atoi(row[5]) : 0xFFFFFFFF)); } diff --git a/zone/zone.cpp b/zone/zone.cpp index 7a4ad8bac..521684a0d 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -755,6 +755,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) zoneid = in_zoneid; instanceid = in_instanceid; instanceversion = database.GetInstanceVersion(instanceid); + pers_instance = false; zonemap = nullptr; watermap = nullptr; pathing = nullptr; @@ -824,11 +825,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(!is_perma) { if(rem < 150) //give some leeway to people who are zoning in 2.5 minutes to finish zoning in and get ported out - rem = 150; + rem = 150; Instance_Timer = new Timer(rem * 1000); } else { + pers_instance = true; Instance_Timer = nullptr; } } diff --git a/zone/zone.h b/zone/zone.h index 9ad692fa0..0fa390512 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -104,6 +104,7 @@ public: inline const uint32 GetZoneID() const { return zoneid; } inline const uint32 GetInstanceID() const { return instanceid; } inline const uint16 GetInstanceVersion() const { return instanceversion; } + inline const bool IsInstancePersistent() const { return pers_instance; } inline const uint8 GetZoneType() const { return zone_type; } inline Timer* GetInstanceTimer() { return Instance_Timer; } @@ -274,6 +275,7 @@ private: uint32 zoneid; uint32 instanceid; uint16 instanceversion; + bool pers_instance; char* short_name; char file_name[16]; char* long_name; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index fa34e8d9e..bfbdb7424 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1197,21 +1197,21 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str i = 0; /* Is home bind */ if (atoi(row[6]) == 1){ - pp->binds[4].zoneId = atoi(row[i]); i++; - i++; /* Instance ID can go here eventually */ - pp->binds[4].x = atoi(row[i]); i++; - pp->binds[4].y = atoi(row[i]); i++; - pp->binds[4].z = atoi(row[i]); i++; - pp->binds[4].heading = atoi(row[i]); i++; + pp->binds[4].zoneId = atoi(row[i++]); + pp->binds[4].instance_id = atoi(row[i++]); + pp->binds[4].x = atoi(row[i++]); + pp->binds[4].y = atoi(row[i++]); + pp->binds[4].z = atoi(row[i++]); + pp->binds[4].heading = atoi(row[i++]); } /* Is regular bind point */ else{ - pp->binds[0].zoneId = atoi(row[i]); i++; - i++; /* Instance ID can go here eventually */ - pp->binds[0].x = atoi(row[i]); i++; - pp->binds[0].y = atoi(row[i]); i++; - pp->binds[0].z = atoi(row[i]); i++; - pp->binds[0].heading = atoi(row[i]); i++; + pp->binds[0].zoneId = atoi(row[i++]); + pp->binds[0].instance_id = atoi(row[i++]); + pp->binds[0].x = atoi(row[i++]); + pp->binds[0].y = atoi(row[i++]); + pp->binds[0].z = atoi(row[i++]); + pp->binds[0].heading = atoi(row[i++]); } } return true; @@ -1224,12 +1224,18 @@ bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, ui } bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home){ - if (zone_id <= 0){ return false; } + if (zone_id <= 0) { + return false; + } + /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); - auto results = QueryDatabase(query); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } + auto results = QueryDatabase(query); + if (!results.RowsAffected()) { + LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + } ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query); return true; } @@ -3234,7 +3240,6 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in bool ZoneDatabase::LoadFactionData() { - std::string query = "SELECT MAX(id) FROM faction_list"; auto results = QueryDatabase(query); if (!results.Success()) { @@ -3265,7 +3270,6 @@ bool ZoneDatabase::LoadFactionData() strn0cpy(faction_array[index]->name, row[1], 50); faction_array[index]->base = atoi(row[2]); - query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index); auto modResults = QueryDatabase(query); if (!modResults.Success()) @@ -3273,8 +3277,9 @@ bool ZoneDatabase::LoadFactionData() for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow) faction_array[index]->mods[modRow[1]] = atoi(modRow[0]); - } + + return true; } bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction) { diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 42d07810a..6ac85cff6 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -71,9 +71,11 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { break; case GateToBindPoint: target_zone_id = m_pp.binds[0].zoneId; + target_instance_id = m_pp.binds[0].instance_id; break; case ZoneToBindPoint: target_zone_id = m_pp.binds[0].zoneId; + target_instance_id = m_pp.binds[0].instance_id; break; case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. target_zone_id = zonesummon_id; @@ -717,20 +719,22 @@ void NPC::Gate() { Mob::Gate(); } -void Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) { +void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { if (to_zone == -1) { m_pp.binds[0].zoneId = zone->GetZoneID(); + m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0; m_pp.binds[0].x = x_pos; m_pp.binds[0].y = y_pos; m_pp.binds[0].z = z_pos; } else { m_pp.binds[0].zoneId = to_zone; + m_pp.binds[0].instance_id = to_instance; m_pp.binds[0].x = new_x; m_pp.binds[0].y = new_y; m_pp.binds[0].z = new_z; } - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); + database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); } void Client::GoToBind(uint8 bindnum) { @@ -741,13 +745,13 @@ void Client::GoToBind(uint8 bindnum) { // move the client, which will zone them if needed. // ignore restrictions on the zone request..? if(bindnum == 0) - MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint); + MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint); else - MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1); + MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].instance_id, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1); } void Client::GoToDeath() { - MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint); + MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint); } void Client::SetZoneFlag(uint32 zone_id) { From 957041299183f53daef21480a9e8d0d406433ad3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 18 Nov 2014 21:00:59 -0800 Subject: [PATCH 0283/1883] Added special ability functions to perl, removed some of the less used commands (and a few duplicates) --- world/worlddb.cpp | 4 +- zone/command.cpp | 270 +------------------------------------------ zone/lua_general.cpp | 149 +++++++++++++++++++++++- zone/npc.cpp | 1 + zone/perl_mob.cpp | 161 +++++++++++++++++++++++++- 5 files changed, 311 insertions(+), 274 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index d2e092c22..955c0b897 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -244,8 +244,8 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { heading = atof(row[5]); } - query = StringFormat("UPDATE character_data SET zone_id = '%d', zone_instance = '%d', x = '%f', y = '%f', z = '%f', heading = '%f'", - zone_id, instance_id, x, y, z, heading); + query = StringFormat("UPDATE character_data SET zone_id = '%d', zone_instance = '%d', x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = %u", + zone_id, instance_id, x, y, z, heading, CharID); results = database.QueryDatabase(query); if(!results.Success()) { diff --git a/zone/command.cpp b/zone/command.cpp index 31c679288..ce3d67fd6 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -150,31 +150,19 @@ int command_init(void) { if ( command_add("resetaa","- Resets a Player's AA in their profile and refunds spent AA's to unspent, disconnects player.",200,command_resetaa) || - command_add("qtest","- QueryServ testing command.",255,command_qtest) || command_add("bind","- Sets your targets bind spot to their current location",200,command_bind) || - command_add("sendop","[opcode] - LE's Private test command, leave it alone",200,command_sendop) || - command_add("optest","- solar's private test command",255,command_optest) || command_add("setstat","- Sets the stats to a specific value.",255,command_setstat) || command_add("incstat","- Increases or Decreases a client's stats permanently.",200,command_incstat) || command_add("help","[search term] - List available commands and their description, specify partial command as argument to search",0,command_help) || command_add("version","- Display current version of EQEmu server",0,command_version) || command_add("setfaction","[faction number] - Sets targeted NPC's faction in the database",170,command_setfaction) || - command_add("serversidename","- Prints target's server side name",0,command_serversidename) || - command_add("testspawn","[memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct",200,command_testspawn) || - command_add("testspawnkill","- Sends an OP_Death packet for spawn made with #testspawn",200,command_testspawnkill) || command_add("wc","[wear slot] [material] - Sends an OP_WearChange for your target",200,command_wc) || - command_add("numauths","- TODO: describe this command",200,command_numauths) || command_add("setanim","[animnum] - Set target's appearance to animnum",200,command_setanim) || command_add("connectworldserver","- Make zone attempt to connect to worldserver",200,command_connectworldserver) || command_add("connectworld",nullptr,0,command_connectworldserver) || command_add("serverinfo","- Get OS info about server host",200,command_serverinfo) || - command_add("crashtest","- Crash the zoneserver",200,command_crashtest) || command_add("getvariable","[varname] - Get the value of a variable from the database",200,command_getvariable) || command_add("chat","[channel num] [message] - Send a channel message to all zones",200,command_chat) || - command_add("showpetspell","[spellid/searchstring] - search pet summoning spells",200,command_showpetspell) || - #ifdef IPC - command_add("ipc","- Toggle an NPC's interactive flag",200,command_ipc) || - #endif command_add("npcloot","[show/money/add/remove] [itemid/all/money: pp gp sp cp] - Manipulate the loot an NPC is carrying",80,command_npcloot) || command_add("log","- Search character event log",80,command_log) || command_add("gm","- Turn player target's or your GM flag on or off",80,command_gm) || @@ -182,7 +170,6 @@ int command_init(void) { command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) || command_add("zoneinstance","[instanceid] [x] [y] [z] - Go to specified instance zone (coords optional)",50,command_zone_instance) || command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) || - command_add("tgczone",nullptr,0,command_peqzone) || command_add("showbuffs","- List buffs active on your target or you if no target",50,command_showbuffs) || command_add("movechar","[charname] [zonename] - Move charname to zonename",50,command_movechar) || command_add("viewpetition","[petition number] - View a petition",20,command_viewpetition) || @@ -192,14 +179,12 @@ int command_init(void) { command_add("date","[yyyy] [mm] [dd] [HH] [MM] - Set EQ time",90,command_date) || command_add("time","[HH] [MM] - Set EQ time",90,command_time) || command_add("timezone","[HH] [MM] - Set timezone. Minutes are optional",90,command_timezone) || - command_add("synctod","- Send a time of day update to every client in zone",90,command_synctod) || command_add("invulnerable","[on/off] - Turn player target's or your invulnerable flag on or off",80,command_invul) || command_add("invul",nullptr,0,command_invul) || command_add("hideme","[on/off] - Hide yourself from spawn lists.",80,command_hideme) || command_add("gmhideme",nullptr,0,command_hideme) || command_add("emote","['name'/'world'/'zone'] [type] [message] - Send an emote message",80,command_emote) || command_add("fov","- Check wether you're behind or in your target's field of view",80,command_fov) || - command_add("manastat","- Report your or your target's cur/max mana",80,command_manastat) || command_add("npcstats","- Show stats about target NPC",80,command_npcstats) || command_add("zclip","[min] [max] - modifies and resends zhdr packet",80,command_zclip) || command_add("npccast","[targetname/entityid] [spellid] - Causes NPC target to cast spellid on targetname/entityid",80,command_npccast) || @@ -210,7 +195,6 @@ int command_init(void) { command_add("permagender","[gendernum] - Change your or your player target's gender (zone to take effect)",80,command_permagender) || command_add("weather","[0/1/2/3] (Off/Rain/Snow/Manual) - Change the weather",80,command_weather) || command_add("zheader","[zonename] - Load zheader for zonename from the database",80,command_zheader) || - command_add("zhdr",nullptr,0,command_zheader) || command_add("zsky","[skytype] - Change zone sky type",80,command_zsky) || command_add("zcolor","[red] [green] [blue] - Change sky color",80,command_zcolor) || command_add("zuwcoords","[z coord] - Set underworld coord",80,command_zuwcoords) || @@ -218,7 +202,6 @@ int command_init(void) { command_add("zunderworld","[zcoord] - Sets the underworld using zcoord",80,command_zunderworld) || command_add("spon","- Sends OP_MemorizeSpell",80,command_spon) || command_add("spoff","- Sends OP_ManaChange",80,command_spoff) || - command_add("itemtest","- merth's test function",250,command_itemtest) || command_add("gassign","[id] - Assign targetted NPC to predefined wandering grid id",100,command_gassign) || command_add("ai","[factionid/spellslist/con/guard/roambox/stop/start] - Modify AI on NPC target",100,command_ai) || command_add("showspellslist","Shows spell list of targeted NPC",100,command_showspellslist) || @@ -254,7 +237,7 @@ int command_init(void) { command_add("spawn","[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC",10,command_spawn) || command_add("texture","[texture] [helmtexture] - Change your or your target's appearance, use 255 to show equipment",10,command_texture) || command_add("npctypespawn","[npctypeid] [factionid] - Spawn an NPC from the db",10,command_npctypespawn) || - command_add("dbspawn",nullptr,0,command_npctypespawn) || + command_add("dbspawn",nullptr,10,command_npctypespawn) || command_add("heal","- Completely heal your target",10,command_heal) || command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) || command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) || @@ -262,14 +245,12 @@ int command_init(void) { command_add("interrogateinv","- use [help] argument for available options",0,command_interrogateinv) || command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) || command_add("findzone","[search criteria] - Search database zones",100,command_findzone) || - command_add("fz",nullptr,100, command_findzone) || command_add("viewnpctype","[npctype id] - Show info about an npctype",100,command_viewnpctype) || command_add("reloadstatic","- Reload Static Zone Data",150,command_reloadstatic) || command_add("reloadquest"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || command_add("reloadqst"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || command_add("reloadworld",nullptr,255,command_reloadworld) || command_add("reloadlevelmods",nullptr,255,command_reloadlevelmods) || - command_add("rq",nullptr,0,command_reloadqst) || command_add("reloadzonepoints","- Reload zone points from database",150,command_reloadzps) || command_add("reloadzps",nullptr,0,command_reloadzps) || command_add("zoneshutdown","[shortname] - Shut down a zone server",150,command_zoneshutdown) || @@ -334,7 +315,6 @@ int command_init(void) { command_add("manaburn","- Use AA Wizard class skill manaburn on target",10,command_manaburn) || command_add("doanim","[animnum] [type] - Send an EmoteAnim for you or your target",50,command_doanim) || command_add("randomfeatures","- Temporarily randomizes the Facial Features of your target",80,command_randomfeatures) || - command_add("rf",nullptr,80,command_randomfeatures) || command_add("face","- Change the face of your target",80,command_face) || command_add("helm","- Change the helm of your target",80,command_helm) || command_add("hair","- Change the hair style of your target",80,command_hair) || @@ -349,7 +329,6 @@ int command_init(void) { command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) || command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) || command_add("interrupt","[message id] [color] - Interrupt your casting. Arguments are optional.",50,command_interrupt) || - command_add("d1","[type] [spell] [damage] - Send an OP_Action packet with the specified values",200,command_d1) || command_add("summonitem","[itemid] [charges] - Summon an item onto your cursor. Charges are optional.",200,command_summonitem) || command_add("si",nullptr,200,command_summonitem) || command_add("giveitem","[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.",200,command_giveitem) || @@ -709,77 +688,6 @@ void command_resetaa(Client* c,const Seperator *sep){ c->Message(0,"Usage: Target a client and use #resetaa to reset the AA data in their Profile."); } -void command_sendop(Client *c,const Seperator *sep){ - - int RezSpell = 0; - - if(sep->arg[1][0]) { - RezSpell = atoi(sep->arg[1]); - } - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); - Resurrect_Struct *rs = (Resurrect_Struct*)outapp->pBuffer; - - strcpy(rs->your_name, c->GetName()); - strcpy(rs->rezzer_name, "A Cleric01"); - rs->spellid = RezSpell; - DumpPacket(outapp); - c->QueuePacket(outapp); - safe_delete(outapp); - return; -} - -void command_optest(Client *c, const Seperator *sep) -{ - if(sep->IsNumber(1)) - { - switch(atoi(sep->arg[1])) - { - case 1: - { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureFinish, sizeof(AdventureFinish_Struct)); - AdventureFinish_Struct *af = (AdventureFinish_Struct*)outapp->pBuffer; - af->win_lose = 1; - af->points = 125; - c->FastQueuePacket(&outapp); - break; - } - case 2: - { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); - AdventureRequestResponse_Struct *arr = (AdventureRequestResponse_Struct*)outapp->pBuffer; - if(sep->IsHexNumber(2)) - arr->unknown000 = hextoi(sep->arg[2]); - else - arr->unknown000 = 0xBFC40100; - arr->risk = 1; - arr->showcompass = 1; - strcpy(arr->text, "This is some text for an adventure packet!\0"); - arr->timeleft = 60*60; - //arr->timetoenter = 30*60; - if(sep->IsHexNumber(3)) - arr->unknown2080=hextoi(sep->arg[3]); - else - arr->unknown2080=0x0A; - arr->x = c->GetY(); - arr->y = c->GetX(); - arr->z = c->GetZ(); - c->FastQueuePacket(&outapp); - break; - } - case 3: - { - c->SendMarqueeMessage(15, 250, 0, 500, 5000, "Some msg"); - break; - } - default: - { - break; - } - } - } -} - void command_help(Client *c, const Seperator *sep) { int commands_shown=0; @@ -838,50 +746,6 @@ void command_serversidename(Client *c, const Seperator *sep) c->Message(0, "Error: no target"); } -void command_testspawnkill(Client *c, const Seperator *sep) -{ -/* EQApplicationPacket* outapp = new EQApplicationPacket(OP_Death, sizeof(Death_Struct)); - Death_Struct* d = (Death_Struct*)outapp->pBuffer; - d->corpseid = 1000; - // d->unknown011 = 0x05; - d->spawn_id = 1000; - d->killer_id = c->GetID(); - d->damage = 1; - d->spell_id = 0; - d->type = BASH; - d->bindzoneid = 0; - c->FastQueuePacket(&outapp);*/ -} - -void command_testspawn(Client *c, const Seperator *sep) -{ - if (sep->IsNumber(1)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewSpawn, sizeof(NewSpawn_Struct)); - NewSpawn_Struct* ns = (NewSpawn_Struct*)outapp->pBuffer; - c->FillSpawnStruct(ns, c); - strcpy(ns->spawn.name, "Test"); - ns->spawn.spawnId = 1000; - ns->spawn.NPC = 1; - if (sep->IsHexNumber(2)) { - if (strlen(sep->arg[2]) >= 3) // 0x00, 1 byte - *(&((uint8*) &ns->spawn)[atoi(sep->arg[1])]) = hextoi(sep->arg[2]); - else if (strlen(sep->arg[2]) >= 5) // 0x0000, 2 bytes - *((uint16*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]); - else if (strlen(sep->arg[2]) >= 9) // 0x0000, 2 bytes - *((uint32*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]); - else - c->Message(0, "Error: unexpected hex string length"); - } - else { - strcpy((char*) (&((uint8*) &ns->spawn)[atoi(sep->arg[1])]), sep->argplus[2]); - } - EncryptSpawnPacket(outapp); - c->FastQueuePacket(&outapp); - } - else - c->Message(0, "Usage: #testspawn [memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct"); -} - void command_wc(Client *c, const Seperator *sep) { if(sep->argnum < 2) @@ -927,12 +791,6 @@ void command_wc(Client *c, const Seperator *sep) } } -void command_numauths(Client *c, const Seperator *sep) -{ - c->Message(0, "NumAuths: %i", zone->CountAuth()); - c->Message(0, "Your WID: %i", c->GetWID()); -} - void command_setanim(Client *c, const Seperator *sep) { if (c->GetTarget() && sep->IsNumber(1)) { @@ -972,13 +830,6 @@ char buffer[255]; #endif } -void command_crashtest(Client *c, const Seperator *sep) -{ - c->Message(0,"Alright, now we get an GPF ;) "); - char* gpf=0; - memcpy(gpf, "Ready to crash", 30); -} - void command_getvariable(Client *c, const Seperator *sep) { char tmp[512]; @@ -997,71 +848,6 @@ void command_chat(Client *c, const Seperator *sep) c->Message(0, "Error: World server disconnected"); } -void command_showpetspell(Client *c, const Seperator *sep) -{ - if (sep->arg[1][0] == 0) - c->Message(0, "Usage: #ShowPetSpells [spellid | searchstring]"); - else if (SPDAT_RECORDS <= 0) - c->Message(0, "Spells not loaded"); - else if (Seperator::IsNumber(sep->argplus[1])) - { - int spellid = atoi(sep->argplus[1]); - if (spellid <= 0 || spellid >= SPDAT_RECORDS) - c->Message(0, "Error: Number out of range"); - else - c->Message(0, " %i: %s, %s", spellid, spells[spellid].teleport_zone, spells[spellid].name); - } - else - { - int count=0; - char sName[64]; - char sCriteria[65]; - strn0cpy(sCriteria, sep->argplus[1], 64); - strupr(sCriteria); - for (int i = 0; i < SPDAT_RECORDS; i++) - { - if (spells[i].name[0] != 0 && (spells[i].effectid[0] == SE_SummonPet || spells[i].effectid[0] == SE_NecPet)) - { - strcpy(sName, spells[i].teleport_zone); - strupr(sName); - char* pdest = strstr(sName, sCriteria); - if ((pdest != nullptr) && (count <=20)) - { - c->Message(0, " %i: %s, %s", i, spells[i].teleport_zone, spells[i].name); - count++; - } - else if (count > 20) - break; - } - } - if (count > 20) - c->Message(0, "20 spells found... max reached."); - else - c->Message(0, "%i spells found.", count); - } -} - -#ifdef IPC -void command_ipc(Client *c, const Seperator *sep) -{ - if (c->GetTarget() && c->GetTarget()->IsNPC()) - { - if (c->GetTarget()->CastToNPC()->IsInteractive()) - { - c->GetTarget()->CastToNPC()->interactive = false; - c->Message(0, "Disabling IPC"); - } - else - { - c->GetTarget()->CastToNPC()->interactive = true; - c->Message(0, "Enabling IPC"); - } - } - else - c->Message(0, "Error: You must target an NPC"); -} -#endif /* IPC */ - void command_npcloot(Client *c, const Seperator *sep) { if (c->GetTarget() == 0) @@ -1641,16 +1427,6 @@ void command_timezone(Client *c, const Seperator *sep) } } -void command_synctod(Client *c, const Seperator *sep) -{ - c->Message(13, "Updating Time/Date for all clients in zone..."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); - TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer; - zone->zone_time.getEQTimeOfDay(time(0), tod); - entity_list.QueueClients(c, outapp); - safe_delete(outapp); -} - void command_invul(Client *c, const Seperator *sep) { bool state=atobool(sep->arg[1]); @@ -1714,15 +1490,6 @@ void command_fov(Client *c, const Seperator *sep) c->Message(0, "I Need a target!"); } -void command_manastat(Client *c, const Seperator *sep) -{ - Mob *target=c->GetTarget()?c->GetTarget():c; - - c->Message(0, "Mana for %s:", target->GetName()); - c->Message(0, " Current Mana: %d",target->GetMana()); - c->Message(0, " Max Mana: %d",target->GetMaxMana()); -} - void command_npcstats(Client *c, const Seperator *sep) { if (c->GetTarget() == 0) @@ -5915,19 +5682,6 @@ void command_interrupt(Client *c, const Seperator *sep) c->InterruptSpell(ci_message, ci_color); } -void command_d1(Client *c, const Seperator *sep) -{ - EQApplicationPacket app(OP_Action, sizeof(Action_Struct)); - Action_Struct* a = (Action_Struct*)app.pBuffer; - a->target = c->GetTarget()->GetID(); - a->source = c->GetID(); - a->type = atoi(sep->arg[1]); - a->spell = atoi(sep->arg[2]); - a->sequence = atoi(sep->arg[3]); - app.priority = 1; - entity_list.QueueCloseClients(c, &app); -} - void command_summonitem(Client *c, const Seperator *sep) { if (!sep->IsNumber(1)) @@ -10871,28 +10625,6 @@ void command_picklock(Client *c, const Seperator *sep) } } -void command_qtest(Client *c, const Seperator *sep) -{ - - - if(c && sep->arg[1][0]) - { - if(c->GetTarget()) - { - ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct)+strlen(sep->arg[1])+1); - Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer; - strcpy(sem->message, sep->arg[1]); - sem->minstatus = c->Admin(); - sem->type = 1; - strncpy(sem->to,c->GetTarget()->GetCleanName(), 64); - strncpy(sem->to,c->GetCleanName(), 64); - sem->guilddbid = c->GuildID(); - worldserver.SendPacket(pack); - safe_delete(pack); - } - } -} - void command_mysql(Client *c, const Seperator *sep) { if(!sep->arg[1][0] || !sep->arg[2][0]) { diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index d58ea21bc..09b0dcf53 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1249,6 +1249,152 @@ double lua_clock() { return static_cast(t) / 1000.0; } +#define LuaCreateNPCParse(name, c_type, default_value) do { \ + cur = table[#name]; \ + if(luabind::type(cur) != LUA_TNIL) { \ + try { \ + npc_type->name = luabind::object_cast(cur); \ + } \ + catch(luabind::cast_failed) { \ + npc_type->size = default_value; \ + } \ + } \ + else { \ + npc_type->size = default_value; \ + } \ +} while(0) + +#define LuaCreateNPCParseString(name, str_length, default_value) do { \ + cur = table[#name]; \ + if(luabind::type(cur) != LUA_TNIL) { \ + try { \ + std::string tmp = luabind::object_cast(cur); \ + strncpy(npc_type->name, tmp.c_str(), str_length); \ + } \ + catch(luabind::cast_failed) { \ + strncpy(npc_type->name, default_value, str_length); \ + } \ + } \ + else { \ + strncpy(npc_type->name, default_value, str_length); \ + } \ +} while(0) + +void lua_create_npc(luabind::adl::object table, float x, float y, float z, float heading) { + if(luabind::type(table) != LUA_TTABLE) { + return; + } + + NPCType* npc_type = new NPCType; + memset(npc_type, 0, sizeof(NPCType)); + + + luabind::adl::index_proxy cur = table["name"]; + LuaCreateNPCParseString(name, 64, "_"); + LuaCreateNPCParseString(lastname, 64, ""); + LuaCreateNPCParse(cur_hp, int32, 30); + LuaCreateNPCParse(max_hp, int32, 30); + LuaCreateNPCParse(size, float, 6.0f); + LuaCreateNPCParse(runspeed, float, 1.25f); + LuaCreateNPCParse(gender, uint8, 0); + LuaCreateNPCParse(race, uint16, 1); + LuaCreateNPCParse(class_, uint8, WARRIOR); + LuaCreateNPCParse(bodytype, uint8, 0); + LuaCreateNPCParse(deity, uint8, 0); + LuaCreateNPCParse(level, uint8, 1); + LuaCreateNPCParse(npc_id, uint32, 1); + LuaCreateNPCParse(texture, uint8, 0); + LuaCreateNPCParse(helmtexture, uint8, 0); + LuaCreateNPCParse(loottable_id, uint32, 0); + LuaCreateNPCParse(npc_spells_id, uint32, 0); + LuaCreateNPCParse(npc_spells_effects_id, uint32, 0); + LuaCreateNPCParse(npc_faction_id, int32, 0); + LuaCreateNPCParse(merchanttype, uint32, 0); + LuaCreateNPCParse(alt_currency_type, uint32, 0); + LuaCreateNPCParse(adventure_template, uint32, 0); + LuaCreateNPCParse(trap_template, uint32, 0); + LuaCreateNPCParse(light, uint8, 0); + LuaCreateNPCParse(AC, uint32, 0); + LuaCreateNPCParse(Mana, uint32, 0); + LuaCreateNPCParse(ATK, uint32, 0); + LuaCreateNPCParse(STR, uint32, 75); + LuaCreateNPCParse(STA, uint32, 75); + LuaCreateNPCParse(DEX, uint32, 75); + LuaCreateNPCParse(AGI, uint32, 75); + LuaCreateNPCParse(INT, uint32, 75); + LuaCreateNPCParse(WIS, uint32, 75); + LuaCreateNPCParse(CHA, uint32, 75); + LuaCreateNPCParse(MR, int32, 25); + LuaCreateNPCParse(FR, int32, 25); + LuaCreateNPCParse(CR, int32, 25); + LuaCreateNPCParse(PR, int32, 25); + LuaCreateNPCParse(DR, int32, 25); + LuaCreateNPCParse(Corrup, int32, 25); + LuaCreateNPCParse(PhR, int32, 0); + LuaCreateNPCParse(haircolor, uint8, 0); + LuaCreateNPCParse(beardcolor, uint8, 0); + LuaCreateNPCParse(eyecolor1, uint8, 0); + LuaCreateNPCParse(eyecolor2, uint8, 0); + LuaCreateNPCParse(hairstyle, uint8, 0); + LuaCreateNPCParse(luclinface, uint8, 0); + LuaCreateNPCParse(beard, uint8, 0); + LuaCreateNPCParse(drakkin_heritage, uint32, 0); + LuaCreateNPCParse(drakkin_tattoo, uint32, 0); + LuaCreateNPCParse(drakkin_details, uint32, 0); + LuaCreateNPCParse(armor_tint[0], uint32, 0); + LuaCreateNPCParse(armor_tint[1], uint32, 0); + LuaCreateNPCParse(armor_tint[2], uint32, 0); + LuaCreateNPCParse(armor_tint[3], uint32, 0); + LuaCreateNPCParse(armor_tint[4], uint32, 0); + LuaCreateNPCParse(armor_tint[5], uint32, 0); + LuaCreateNPCParse(armor_tint[6], uint32, 0); + LuaCreateNPCParse(armor_tint[7], uint32, 0); + LuaCreateNPCParse(armor_tint[8], uint32, 0); + LuaCreateNPCParse(min_dmg, uint32, 2); + LuaCreateNPCParse(max_dmg, uint32, 4); + LuaCreateNPCParse(attack_count, int16, 0); + LuaCreateNPCParseString(special_abilities, 512, ""); + LuaCreateNPCParse(d_meele_texture1, uint16, 0); + LuaCreateNPCParse(d_meele_texture2, uint16, 0); + LuaCreateNPCParseString(ammo_idfile, 32, ""); + LuaCreateNPCParse(prim_melee_type, uint8, 0); + LuaCreateNPCParse(sec_melee_type, uint8, 0); + LuaCreateNPCParse(ranged_type, uint8, 0); + LuaCreateNPCParse(hp_regen, int32, 1); + LuaCreateNPCParse(mana_regen, int32, 1); + LuaCreateNPCParse(aggroradius, int32, 0); + LuaCreateNPCParse(assistradius, int32, 0); + LuaCreateNPCParse(see_invis, uint8, 0); + LuaCreateNPCParse(see_invis_undead, bool, false); + LuaCreateNPCParse(see_hide, bool, false); + LuaCreateNPCParse(see_improved_hide, bool, false); + LuaCreateNPCParse(qglobal, bool, false); + LuaCreateNPCParse(npc_aggro, bool, false); + LuaCreateNPCParse(spawn_limit, uint8, false); + LuaCreateNPCParse(mount_color, uint8, false); + LuaCreateNPCParse(attack_speed, float, 0); + LuaCreateNPCParse(attack_delay, uint8, 30); + LuaCreateNPCParse(accuracy_rating, int, 0); + LuaCreateNPCParse(avoidance_rating, int, 0); + LuaCreateNPCParse(findable, bool, false); + LuaCreateNPCParse(trackable, bool, false); + LuaCreateNPCParse(slow_mitigation, int16, 0); + LuaCreateNPCParse(maxlevel, uint8, 0); + LuaCreateNPCParse(scalerate, uint32, 0); + LuaCreateNPCParse(private_corpse, bool, false); + LuaCreateNPCParse(unique_spawn_by_name, bool, false); + LuaCreateNPCParse(underwater, bool, false); + LuaCreateNPCParse(emoteid, uint32, 0); + LuaCreateNPCParse(spellscale, float, 0); + LuaCreateNPCParse(healscale, float, 0); + LuaCreateNPCParse(no_target_hotkey, bool, false); + LuaCreateNPCParse(raid_target, bool, false); + LuaCreateNPCParse(probability, uint8, 0); + + NPC* npc = new NPC(npc_type, nullptr, x, y, z, heading, FlyMode3); + npc->GiveNPCTypeData(npc_type); + entity_list.AddNPC(npc); +} luabind::scope lua_register_general() { return luabind::namespace_("eq") [ @@ -1435,7 +1581,8 @@ luabind::scope lua_register_general() { luabind::def("enable_recipe", &lua_enable_recipe), luabind::def("disable_recipe", &lua_disable_recipe), luabind::def("clear_npctype_cache", &lua_clear_npctype_cache), - luabind::def("clock", &lua_clock) + luabind::def("clock", &lua_clock), + luabind::def("create_npc", &lua_create_npc) ]; } diff --git a/zone/npc.cpp b/zone/npc.cpp index d1bdee979..25a349048 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1924,6 +1924,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) else if(id == "PhR") { PhR = atoi(val.c_str()); return; } else if(id == "runspeed") { runspeed = (float)atof(val.c_str()); CalcBonuses(); return; } else if(id == "special_attacks") { NPCSpecialAttacks(val.c_str(), 0, 1); return; } + else if(id == "special_abilities") { ProcessSpecialAbilities(val.c_str()); return; } else if(id == "attack_speed") { attack_speed = (float)atof(val.c_str()); CalcBonuses(); return; } else if(id == "atk") { ATK = atoi(val.c_str()); return; } else if(id == "accuracy") { accuracy_rating = atoi(val.c_str()); return; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index af63066ff..c47b463d3 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -8187,6 +8187,158 @@ XS(XS_Mob_GetSpellStat) XSRETURN(1); } +XS(XS_Mob_GetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_GetSpecialAbility) +{ + dXSARGS; + if(items != 2) + Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbility(THIS, special_ability)"); + { + int RETVAL; + Mob* THIS; + int ability = SvIV(ST(1)); + dXSTARG; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSpecialAbility(ability); + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + +XS(XS_Mob_GetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_GetSpecialAbilityParam) +{ + dXSARGS; + if(items != 3) + Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbilityParam(THIS, special_ability, param)"); + { + int RETVAL; + Mob* THIS; + int ability = SvIV(ST(1)); + int param = SvIV(ST(2)); + dXSTARG; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSpecialAbilityParam(ability, param); + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + +XS(XS_Mob_SetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_SetSpecialAbility) +{ + dXSARGS; + if(items != 3) + Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbility(THIS, ability, value)"); + { + Mob* THIS; + int ability = SvIV(ST(1)); + int value = SvIV(ST(2)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSpecialAbility(ability, value); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_SetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_SetSpecialAbilityParam) +{ + dXSARGS; + if(items != 4) + Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbilityParam(THIS, ability, param, value)"); + { + Mob* THIS; + int ability = SvIV(ST(1)); + int param = SvIV(ST(2)); + int value = SvIV(ST(3)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSpecialAbilityParam(ability, param, value); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_ClearSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_ClearSpecialAbilities) +{ + dXSARGS; + if(items != 1) + Perl_croak(aTHX_ "Usage: Mob::ClearSpecialAbilities(THIS)"); + { + Mob* THIS; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->ClearSpecialAbilities(); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_ProcessSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_ProcessSpecialAbilities) +{ + dXSARGS; + if(items != 2) + Perl_croak(aTHX_ "Usage: Mob::ProcessSpecialAbilities(THIS, str)"); + { + Mob* THIS; + const char *str = (const char*)SvPV_nolen(ST(1)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->ProcessSpecialAbilities(str); + } + XSRETURN_EMPTY; +} #ifdef __cplusplus extern "C" @@ -8485,11 +8637,16 @@ XS(boot_Mob) newXSproto(strcpy(buf, "DoArcheryAttackDmg"), XS_Mob_DoArcheryAttackDmg, file, "$$$$$$$"); newXSproto(strcpy(buf, "DoThrowingAttackDmg"), XS_Mob_DoThrowingAttackDmg, file, "$$$$$$$"); newXSproto(strcpy(buf, "SetDisableMelee"), XS_Mob_SetDisableMelee, file, "$$"); - newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$$"); + newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$"); newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$"); newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$"); newXSproto(strcpy(buf, "GetSpellStat"), XS_Mob_GetSpellStat, file, "$$$$"); - + newXSproto(strcpy(buf, "GetSpecialAbility"), XS_Mob_GetSpecialAbility, file, "$$"); + newXSproto(strcpy(buf, "GetSpecialAbilityParam"), XS_Mob_GetSpecialAbilityParam, file, "$$$"); + newXSproto(strcpy(buf, "SetSpecialAbility"), XS_Mob_SetSpecialAbility, file, "$$$"); + newXSproto(strcpy(buf, "SetSpecialAbilityParam"), XS_Mob_SetSpecialAbilityParam, file, "$$$$"); + newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$"); + newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$"); XSRETURN_YES; } From 5b85aa6550992963384f23c353a260b376253287 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 19 Nov 2014 00:39:42 -0500 Subject: [PATCH 0284/1883] Fix to allow discipline reuse timers to be set on client correclty and therefore have the client return the time remaining instead of the server. Hopefully may resolve some bugs reselated to discipline use. --- zone/client.h | 1 + zone/effects.cpp | 27 +++++++++++++++++---------- zone/spells.cpp | 4 ++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/zone/client.h b/zone/client.h index fd797c1b7..de6d187b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -875,6 +875,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); bool UseDiscipline(uint32 spell_id, uint32 target); + void SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id = SPELL_UNKNOWN); bool CheckTitle(int titleset); void EnableTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 7506f99cf..118acb4a3 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,16 +696,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); - if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS) - { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); - DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; - dts->TimerID = spells[spell_id].EndurTimerIndex; - dts->Duration = reduced_recast; - QueuePacket(outapp); - safe_delete(outapp); - } + SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); } else { @@ -714,6 +705,22 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } +void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id) +{ + if (!timer_id && IsValidSpell(spell_id)) + timer_id = spells[spell_id].EndurTimerIndex; + + if(duration > 0 && timer_id && (timer_id < MAX_DISCIPLINE_TIMERS)) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; + dts->TimerID = timer_id; + dts->Duration = duration; + QueuePacket(outapp); + safe_delete(outapp); + } +} + void EntityList::AETaunt(Client* taunter, float range) { if (range == 0) diff --git a/zone/spells.cpp b/zone/spells.cpp index 315fe8712..05000dc51 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2256,6 +2256,10 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } + //Disc Timer needs to be sent before and after the spell packet. + if (IsClient() && spells[spell_id].IsDisciplineBuff && spells[spell_id].EndurTimerIndex) + CastToClient()->SendDisciplineTimer(casting_spell_timer, casting_spell_timer_duration); + if(IsNPC()) CastToNPC()->AI_Event_SpellCastFinished(true, slot); From 67a9779d5b609f9118e4eaa8c0d815abbb465363 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 19 Nov 2014 02:16:48 -0600 Subject: [PATCH 0285/1883] Slight fixes to upgrade logic - If you ran updates manually yourself, and you don't have a local version that matches the binary version yet. It will go through and get you up to date. Manifest changes - Removed AA 'Required' updates. We will soon have an option to pull them down from PEQ in the prompt menu --- utils/scripts/db_update.pl | 25 +++++++++++++++---------- utils/sql/db_update_manifest.txt | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 12e5aeab2..7e8282d00 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -43,7 +43,8 @@ if($OS eq "Windows"){ @mysql = split(';', $has_mysql_path); foreach my $v (@mysql){ if($v=~/MySQL|MariaDB/i){ - $path = $v . "/mysql"; + $v =~s/\n//g; + $path = trim($v) . "/mysql"; last; } } @@ -106,8 +107,6 @@ if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_world"){ exit; } -if(!$bin_db_ver){ $bin_db_ver = 9100; } - print "Retrieving latest database manifest...\n"; GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt", "db_update/db_update_manifest.txt"); # GetRemoteFile("https://dl.dropboxusercontent.com/u/50023467/dl/db_update_manifest.txt", "db_update/db_update_manifest.txt"); @@ -163,10 +162,10 @@ sub ShowMenuPrompt { sub MenuOptions { if(@total_updates){ - $option[3] = "Run pending updates... (" . scalar (@total_updates) . ")"; + $option[3] = "Run pending REQUIRED updates... (" . scalar (@total_updates) . ")"; } else{ - $option[3] = "Check for pending Database updates + $option[3] = "Check for pending REQUIRED Database updates Stages updates for automatic upgrade..."; } @@ -313,14 +312,14 @@ sub Run_Database_Check{ push(@total_updates, $i); } else{ - print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + print "DB up to date with: " . $i . " - '" . $file_name . "' \n"; } print_match_debug(); print_break(); } if($match_type eq "missing"){ if(GetMySQLResult($query_check)=~/$match_text/i){ - print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + print "DB up to date with: " . $i . " - '" . $file_name . "' \n"; next; } else{ @@ -338,7 +337,7 @@ sub Run_Database_Check{ push(@total_updates, $i); } else{ - print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + print "DB up to date with: " . $i . " - '" . $file_name . "' \n"; } print_match_debug(); print_break(); @@ -350,13 +349,19 @@ sub Run_Database_Check{ push(@total_updates, $i); } else{ - print "DB up to date with: " . $i . " '" . $file_name . "' \n"; + print "DB up to date with: " . $i . " - '" . $file_name . "' \n"; } print_match_debug(); print_break(); } } - print "\n\n"; + print "\n"; + + if(scalar (@total_updates) == 0){ + print "No updates need to be run...\n"; + print "Setting Database to Binary Version (" . $bin_db_ver . ") if not already...\n\n"; + GetMySQLResult("UPDATE db_version SET version = $bin_db_ver"); + } } sub FetchMissingUpdate{ diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 4f1de43df..721beb002 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -261,7 +261,7 @@ 9001|2013_02_25_Impr_HT_LT.sql|SHOW TABLES LIKE 'merc_inventory'|empty| 9002|2013_03_1_Merc_Rules_and_Equipment.sql|SHOW TABLES LIKE 'merc_inventory'|empty| # 9003|2013_03_23_Escape_FadingMemories.sql -9004|2013_04_04_NaturesBounty.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '1230' AND `slot` = '1' AND `effectid` = '313' AND `base1` = '15' AND `base2` = '0'|empty| +# 9004|2013_04_04_NaturesBounty.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '1230' AND `slot` = '1' AND `effectid` = '313' AND `base1` = '15' AND `base2` = '0'|empty| 9005|2013_04_08_Salvage.sql|SHOW COLUMNS FROM `tradeskill_recipe_entries` LIKE 'salvagecount'|empty| 9006|2013_05_05_Account_Flags.sql|SHOW TABLES LIKE 'account_flags'|empty| 9007|2013_05_05_Item_Tick.sql|SHOW TABLES LIKE 'item_tick'|empty| @@ -270,31 +270,31 @@ # 9010|2013_10_12_Merc_vwMercNpcTypes.sql 9011|2013_10_31_Recipe_disabling.sql|SHOW COLUMNS FROM `tradeskill_recipe` LIKE 'enabled'|empty| 9012|2013_11_07_BaseData.sql|SHOW TABLES LIKE 'base_data'|empty| -9013|2013_11_13_Instrument_Singing_Mastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '213' AND `slot` = '1' AND `effectid` = '260' AND `base1` = '2' AND `base2` = '23'|empty| +# 9013|2013_11_13_Instrument_Singing_Mastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '213' AND `slot` = '1' AND `effectid` = '260' AND `base1` = '2' AND `base2` = '23'|empty| 9014|2013_11_18_AssistRadius.sql|SHOW COLUMNS FROM `npc_types` LIKE 'assistradius'|empty| 9015|2013_12_26_MerchantList_Class_Required.sql|SHOW COLUMNS FROM `merchantlist` LIKE 'classes_required'|empty| -9016|2014_01_04_SongModCapAAs.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '571' AND `slot` = '1' AND `effectid` = '261'|empty| +# 9016|2014_01_04_SongModCapAAs.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '571' AND `slot` = '1' AND `effectid` = '261'|empty| 9017|2014_01_08_SpellsNewAdditions.sql|SHOW COLUMNS FROM `spells_new` LIKE 'persistdeath'|empty| 9018|2014_01_09_PreservePetSize.sql|SHOW COLUMNS FROM `character_pet_info` LIKE 'size'|empty| -9019|2014_01_20_MezMastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '781' AND `slot` = '1' AND `effectid` = '287'|empty| +# 9019|2014_01_20_MezMastery.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '781' AND `slot` = '1' AND `effectid` = '287'|empty| 9020|2014_01_20_Not_Extendable.sql|SHOW COLUMNS FROM `spells_new` LIKE 'not_extendable'|empty| -9021|2014_01_20_SpellCastingReinforcement.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '86' AND `slot` = '1' AND `effectid` = '128'|empty| +# 9021|2014_01_20_SpellCastingReinforcement.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '86' AND `slot` = '1' AND `effectid` = '128'|empty| 9022|2014_01_20_Weather.sql|SHOW COLUMNS FROM `zone` LIKE 'rain_chance1'|empty| -9023|2014_01_27_CritcalMendAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '230' AND `slot` = '1' AND `effectid` = '275'|empty -9024|2014_02_02_SpellCriticalsAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '4755' AND `slot` = '1' AND `effectid` = '294'|empty +# 9023|2014_01_27_CritcalMendAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '230' AND `slot` = '1' AND `effectid` = '275'|empty +# 9024|2014_02_02_SpellCriticalsAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '4755' AND `slot` = '1' AND `effectid` = '294'|empty 9025|2014_02_13_Rename_instance_lockout_tables.sql|SHOW TABLES LIKE 'instance_list'|empty| 9026|2014_02_13_spells_new_update.sql|SHOW COLUMNS FROM `spells_new` LIKE 'ConeStartAngle'|empty| 9027|2014_02_20_buff_update.sql|SHOW COLUMNS FROM `character_buffs` LIKE 'caston_y'|empty| 9028|2014_02_26_roambox_update.sql|SHOW COLUMNS FROM `spawngroup` LIKE 'mindelay'|empty| -9029|2014_02_26_virulentvenomAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '888' AND `slot` = '1' AND `effectid` = '250'|empty| +# 9029|2014_02_26_virulentvenomAA.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '888' AND `slot` = '1' AND `effectid` = '250'|empty| 9030|2014_04_04_PhysicalResist.sql|SHOW COLUMNS FROM `npc_types` LIKE 'PhR'|empty| 9031|2014_04_10_No_Target_With_Hotkey.sql|SHOW COLUMNS FROM `npc_types` LIKE 'no_target_hotkey'|empty| 9032|2014_04_12_SlowMitigation.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float 9034|2014_04_25_spawn_events.sql|SHOW COLUMNS FROM `spawn_events` LIKE 'strict'|empty| 9035|2014_04_27_AISpellEffects.sql|SHOW COLUMNS FROM `npc_types` LIKE 'npc_spells_effects_id'|empty| 9036|2014_05_04_SlowMitigationFix.sql|SHOW COLUMNS FROM `npc_types` LIKE 'slow_mitigation'|contains|float -9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty -9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty +# 9038|2014_06_25_AA_Updates.sql|SELECT * FROM `altadv_vars` WHERE `skill_id` = '1604'|empty +# 9039|2014_07_04_AA_Updates.sql|SELECT * FROM `aa_effects` WHERE `aaid` = '158' AND `slot` = '1' AND `effectid` = '238'|empty 9040|2014_07_10_npc_spells.sql|SHOW COLUMNS FROM `npc_spells` LIKE 'engaged_no_sp_recast_min'|empty| 9041|2014_08_02_spells_new.sql|SHOW COLUMNS FROM `spells_new` LIKE 'viral_range'|empty| 9042|2014_08_12_NPC_raid_targets.sql|SHOW COLUMNS FROM `npc_types` LIKE 'raid_target'|empty| From 4f38dba334a9111dc209e8a9e2d44aab87c5a5e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 19 Nov 2014 02:30:59 -0600 Subject: [PATCH 0286/1883] Upload of peq_aa_tables.sql for db management interface --- utils/sql/peq_aa_tables.sql | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 utils/sql/peq_aa_tables.sql diff --git a/utils/sql/peq_aa_tables.sql b/utils/sql/peq_aa_tables.sql new file mode 100644 index 000000000..700106fa0 --- /dev/null +++ b/utils/sql/peq_aa_tables.sql @@ -0,0 +1,75 @@ +DROP TABLE IF EXISTS `aa_effects`; +CREATE TABLE `aa_effects` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `aaid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `slot` tinyint(3) unsigned NOT NULL DEFAULT '0', + `effectid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `base1` mediumint(8) NOT NULL DEFAULT '0', + `base2` mediumint(8) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `NewIndex` (`aaid`,`slot`) +) ENGINE=MyISAM AUTO_INCREMENT=2527 DEFAULT CHARSET=latin1; +INSERT INTO `aa_effects` VALUES (1,2,1,4,2,0),(2,3,1,4,4,0),(3,4,1,4,6,0),(4,5,1,4,8,0),(5,6,1,4,10,0),(6,7,1,7,2,0),(7,8,1,7,4,0),(8,9,1,7,6,0),(9,10,1,7,8,0),(10,11,1,7,10,0),(11,12,1,6,2,0),(12,13,1,6,4,0),(13,14,1,6,6,0),(14,15,1,6,8,0),(15,16,1,6,10,0),(16,17,1,5,2,0),(17,18,1,5,4,0),(18,19,1,5,6,0),(19,20,1,5,8,0),(20,21,1,5,10,0),(21,22,1,8,2,0),(22,23,1,8,4,0),(23,24,1,8,6,0),(24,25,1,8,8,0),(25,26,1,8,10,0),(26,27,1,9,2,0),(27,28,1,9,4,0),(28,29,1,9,6,0),(29,30,1,9,8,0),(30,31,1,9,10,0),(31,32,1,10,2,0),(32,33,1,10,4,0),(33,34,1,10,6,0),(34,35,1,10,8,0),(35,36,1,10,10,0),(36,37,1,46,2,0),(37,38,1,46,4,0),(38,39,1,46,6,0),(39,40,1,46,8,0),(40,41,1,46,10,0),(41,42,1,47,2,0),(42,43,1,47,4,0),(43,44,1,47,6,0),(44,45,1,47,8,0),(45,46,1,47,10,0),(46,47,1,50,2,0),(47,48,1,50,4,0),(48,49,1,50,6,0),(49,50,1,50,8,0),(50,51,1,50,10,0),(51,52,1,48,2,0),(52,53,1,48,4,0),(53,54,1,48,6,0),(54,55,1,48,8,0),(55,56,1,48,10,0),(56,57,1,49,2,0),(57,58,1,49,4,0),(58,59,1,49,6,0),(59,60,1,49,8,0),(60,61,1,49,10,0),(61,62,1,271,8,0),(62,63,1,271,14,0),(63,64,1,271,21,0),(64,65,1,0,1,0),(65,66,1,0,2,0),(66,67,1,0,3,0),(67,71,1,246,110,0),(68,72,1,246,125,0),(69,73,1,246,150,0),(70,89,1,15,1,0),(71,90,1,15,2,0),(72,91,1,15,3,0),(1953,104,1,127,10,10),(1954,104,2,138,1,0),(1955,104,3,140,1,0),(1956,104,4,143,3000,0),(1957,105,1,127,25,25),(1958,105,2,138,1,0),(1959,105,3,140,1,0),(1960,105,4,143,3000,0),(1961,106,1,127,50,50),(1962,106,2,138,1,0),(1963,106,3,140,1,0),(1964,106,4,143,3000,0),(910,107,1,214,200,0),(911,108,1,214,500,0),(912,109,1,214,1000,0),(88,110,1,0,1,0),(89,111,1,0,2,0),(90,112,1,0,3,0),(1908,137,1,127,10,10),(1909,137,2,137,88,0),(1910,138,1,127,25,25),(1911,138,2,137,88,0),(1912,139,1,127,50,50),(1913,139,2,137,88,0),(1893,141,1,127,2,2),(1894,141,2,137,0,0),(1895,141,3,138,0,0),(1896,141,4,141,1,0),(1897,141,5,143,3000,0),(1898,142,1,127,5,5),(1899,142,2,137,0,0),(1900,142,3,138,0,0),(1901,142,4,141,1,0),(1902,142,5,143,3000,0),(1903,143,1,127,10,10),(1904,143,2,137,0,0),(1905,143,3,138,0,0),(1906,143,4,141,1,0),(1907,143,5,143,3000,0),(1941,147,1,127,10,10),(1942,147,2,138,1,0),(1943,147,3,140,1,0),(1944,147,4,143,3000,0),(1945,148,1,127,25,25),(1946,148,2,138,1,0),(1947,148,3,140,1,0),(1948,148,4,143,3000,0),(1949,149,1,127,50,50),(1950,149,2,138,1,0),(1951,149,3,140,1,0),(1952,149,4,143,3000,0),(1914,164,1,127,10,10),(1915,164,2,137,32,0),(1916,164,3,127,10,10),(1917,164,4,137,33,0),(1923,165,1,127,25,25),(1924,165,2,137,32,0),(1925,165,3,127,25,25),(1926,165,4,137,33,0),(1932,166,1,127,50,50),(1933,166,2,137,32,0),(1934,166,3,127,50,50),(1935,166,4,137,33,0),(137,196,1,226,1,0),(138,237,1,227,1,25),(139,238,1,227,3,25),(140,239,1,227,5,25),(1077,270,1,270,10,0),(1078,271,1,270,15,0),(1079,272,1,270,25,0),(144,278,1,0,1,0),(145,278,2,15,1,0),(907,279,1,214,200,0),(147,280,1,227,1,62),(148,280,2,227,1,17),(149,281,1,227,3,62),(150,281,2,227,3,17),(151,282,1,227,5,62),(152,282,2,227,5,17),(153,292,1,4,2,0),(154,293,1,4,4,0),(155,294,1,4,6,0),(156,295,1,4,8,0),(157,296,1,4,10,0),(158,297,1,4,12,0),(159,298,1,4,14,0),(160,299,1,4,16,0),(161,300,1,4,18,0),(162,301,1,4,20,0),(163,302,1,7,2,0),(164,303,1,7,4,0),(165,304,1,7,6,0),(166,305,1,7,8,0),(167,306,1,7,10,0),(168,307,1,7,12,0),(169,308,1,7,14,0),(170,309,1,7,16,0),(171,310,1,7,18,0),(172,311,1,7,20,0),(173,312,1,6,2,0),(174,313,1,6,4,0),(175,314,1,6,6,0),(176,315,1,6,8,0),(177,316,1,6,10,0),(178,317,1,6,12,0),(179,318,1,6,14,0),(180,319,1,6,16,0),(181,320,1,6,18,0),(182,321,1,6,20,0),(183,322,1,5,2,0),(184,323,1,5,4,0),(185,324,1,5,6,0),(186,325,1,5,8,0),(187,326,1,5,10,0),(188,327,1,5,12,0),(189,328,1,5,14,0),(190,329,1,5,16,0),(191,330,1,5,18,0),(192,331,1,5,20,0),(193,332,1,8,2,0),(194,333,1,8,4,0),(195,334,1,8,6,0),(196,335,1,8,8,0),(197,336,1,8,10,0),(198,337,1,8,12,0),(199,338,1,8,14,0),(200,339,1,8,16,0),(201,340,1,8,18,0),(202,341,1,8,20,0),(203,342,1,9,2,0),(204,343,1,9,4,0),(205,344,1,9,6,0),(206,345,1,9,8,0),(207,346,1,9,10,0),(208,347,1,9,12,0),(209,348,1,9,14,0),(210,349,1,9,16,0),(211,350,1,9,18,0),(212,351,1,9,20,0),(213,352,1,10,2,0),(214,353,1,10,4,0),(215,354,1,10,6,0),(216,355,1,10,8,0),(217,356,1,10,10,0),(218,357,1,10,12,0),(219,358,1,10,14,0),(220,359,1,10,16,0),(221,360,1,10,18,0),(222,361,1,10,20,0),(223,362,1,46,2,0),(224,363,1,46,4,0),(225,364,1,46,6,0),(226,365,1,46,8,0),(227,366,1,46,10,0),(229,368,1,46,14,0),(230,369,1,46,16,0),(231,370,1,46,18,0),(232,371,1,46,20,0),(233,372,1,47,2,0),(234,373,1,47,4,0),(235,374,1,47,6,0),(236,375,1,47,8,0),(237,376,1,47,10,0),(238,377,1,47,12,0),(239,378,1,47,14,0),(240,379,1,47,16,0),(241,380,1,47,18,0),(242,381,1,47,20,0),(243,382,1,50,2,0),(244,383,1,50,4,0),(245,384,1,50,6,0),(246,385,1,50,8,0),(247,386,1,50,10,0),(248,387,1,50,12,0),(249,388,1,50,14,0),(250,389,1,50,16,0),(251,390,1,50,18,0),(252,391,1,50,20,0),(253,392,1,48,2,0),(254,393,1,48,4,0),(255,394,1,48,6,0),(256,395,1,48,8,0),(257,396,1,48,10,0),(258,397,1,48,12,0),(259,398,1,48,14,0),(260,399,1,48,16,0),(261,400,1,48,18,0),(262,401,1,48,20,0),(263,402,1,49,2,0),(264,403,1,49,4,0),(265,404,1,49,6,0),(266,405,1,49,8,0),(267,406,1,49,10,0),(268,407,1,49,12,0),(269,408,1,49,14,0),(270,409,1,49,16,0),(271,410,1,49,18,0),(272,411,1,49,20,0),(273,418,1,262,5,0),(274,418,2,262,5,1),(275,418,3,262,5,2),(276,418,4,262,5,3),(277,418,5,262,5,4),(278,418,6,262,5,5),(279,418,7,262,5,6),(280,419,1,262,10,0),(281,419,2,262,10,1),(282,419,3,262,10,2),(283,419,4,262,10,3),(284,419,5,262,10,4),(285,419,6,262,10,5),(286,419,7,262,10,6),(287,420,1,262,15,0),(288,420,2,262,15,1),(289,420,3,262,15,2),(290,420,4,262,15,3),(291,420,5,262,15,4),(292,420,6,262,15,5),(293,420,7,262,15,6),(294,421,1,262,20,0),(295,421,2,262,20,1),(296,421,3,262,20,2),(297,421,4,262,20,3),(298,421,5,262,20,4),(299,421,6,262,20,5),(300,421,7,262,20,6),(301,422,1,262,25,0),(302,422,2,262,25,1),(303,422,3,262,25,2),(304,422,4,262,25,3),(305,422,5,262,25,4),(306,422,6,262,25,5),(307,422,7,262,25,6),(308,423,1,214,150,0),(309,424,1,214,300,0),(310,425,1,214,450,0),(311,426,1,262,10,4),(312,426,2,262,10,5),(313,427,1,262,20,4),(314,427,2,262,20,5),(315,428,1,262,30,4),(316,428,2,262,30,5),(317,429,1,262,40,4),(318,429,2,262,40,5),(319,430,1,262,50,4),(320,430,2,262,50,5),(2267,568,1,270,5,0),(2268,569,1,270,10,0),(2269,570,1,270,15,0),(324,622,1,227,1,29),(325,623,1,227,2,29),(326,624,1,227,3,29),(327,628,1,290,5,0),(328,629,1,290,15,0),(329,672,1,271,7,0),(330,673,1,271,14,0),(331,676,1,246,125,0),(332,677,1,246,150,0),(333,978,1,14,1,0),(334,1001,1,262,5,0),(335,1001,2,262,5,1),(336,1001,3,262,5,2),(337,1001,4,262,5,3),(338,1001,5,262,5,4),(339,1001,6,262,5,5),(340,1001,7,262,5,6),(341,1002,1,262,10,0),(342,1002,2,262,10,1),(343,1002,3,262,10,2),(344,1002,4,262,10,3),(345,1002,5,262,10,4),(346,1002,6,262,10,5),(347,1002,7,262,10,6),(348,1003,1,262,15,0),(349,1003,2,262,15,1),(350,1003,3,262,15,2),(351,1003,4,262,15,3),(352,1003,5,262,15,4),(353,1003,6,262,15,5),(354,1003,7,262,15,6),(355,1004,1,262,20,0),(356,1004,2,262,20,1),(357,1004,3,262,20,2),(358,1004,4,262,20,3),(359,1004,5,262,20,4),(360,1004,6,262,20,5),(361,1004,7,262,20,6),(362,1005,1,262,25,0),(363,1005,2,262,25,1),(364,1005,3,262,25,2),(365,1005,4,262,25,3),(366,1005,5,262,25,4),(367,1005,6,262,25,5),(368,1005,7,262,25,6),(369,1006,1,262,5,7),(370,1006,2,262,5,8),(371,1006,3,262,5,9),(372,1006,4,262,5,10),(373,1006,5,262,5,11),(374,1007,1,262,10,7),(375,1007,2,262,10,8),(376,1007,3,262,10,9),(377,1007,4,262,10,10),(378,1007,5,262,10,11),(379,1008,1,262,15,7),(380,1008,2,262,15,8),(381,1008,3,262,15,9),(382,1008,4,262,15,10),(383,1008,5,262,15,11),(384,1009,1,262,20,7),(385,1009,2,262,20,8),(386,1009,3,262,20,9),(387,1009,4,262,20,10),(388,1009,5,262,20,11),(389,1010,1,262,25,7),(390,1010,2,262,25,8),(391,1010,3,262,25,9),(392,1010,4,262,25,10),(393,1010,5,262,25,11),(394,1021,1,327,1,0),(395,1022,1,327,2,0),(396,1023,1,327,3,0),(397,1024,1,327,4,0),(398,1025,1,327,5,0),(399,1071,1,326,1,0),(2277,1129,1,267,1,0),(2276,288,1,267,1,15),(402,678,1,221,3,0),(403,679,1,221,6,0),(404,680,1,221,9,0),(405,681,1,221,12,0),(406,682,1,221,15,0),(407,807,1,292,5,0),(408,808,1,292,10,0),(409,809,1,292,15,0),(913,864,1,216,10,0),(921,865,1,216,20,0),(929,866,1,216,30,0),(413,907,1,69,100,0),(414,908,1,69,200,0),(415,909,1,69,300,0),(416,910,1,69,400,0),(417,911,1,69,500,0),(2289,580,9,254,0,0),(2288,580,8,254,0,0),(2287,580,7,254,0,0),(2286,580,6,254,0,0),(2285,580,5,254,0,0),(2284,580,4,254,0,0),(2283,580,3,267,1,5),(2282,580,2,267,1,8),(2281,580,1,267,1,4),(1541,1435,1,339,3,8105),(1542,1435,2,142,65,0),(1543,1435,3,311,0,0),(1544,1435,4,134,70,0),(1565,1436,1,339,6,8105),(1566,1436,2,142,65,0),(1567,1436,3,311,0,0),(1568,1436,4,134,70,0),(1589,1437,1,339,10,8105),(1590,1437,2,142,65,0),(1591,1437,3,311,0,0),(1592,1437,4,134,70,0),(1277,1486,1,339,1,8164),(1278,1486,2,138,1,0),(1279,1486,3,141,1,0),(1280,1486,4,142,60,0),(1281,1486,5,137,0,0),(1282,1486,6,311,0,0),(1293,1487,1,339,3,8165),(1294,1487,2,138,1,0),(1295,1487,3,141,1,0),(1296,1487,4,142,60,0),(1297,1487,5,137,0,0),(1298,1487,6,311,0,0),(1309,1488,1,339,5,8166),(1310,1488,2,138,1,0),(1311,1488,3,141,1,0),(1312,1488,4,142,60,0),(1313,1488,5,137,0,0),(1314,1488,6,311,0,0),(1325,1489,1,339,7,8167),(1326,1489,2,138,1,0),(1327,1489,3,141,1,0),(1328,1489,4,142,60,0),(1329,1489,5,137,0,0),(1330,1489,6,311,0,0),(1341,1490,1,339,9,8168),(1342,1490,2,138,1,0),(1343,1490,3,141,1,0),(1344,1490,4,142,60,0),(1345,1490,5,137,0,0),(1346,1490,6,311,0,0),(1749,625,1,294,3,100),(1750,626,1,294,6,100),(1751,627,1,294,9,100),(472,92,1,294,2,100),(473,93,1,294,4,100),(474,94,1,294,7,100),(475,267,1,294,3,100),(476,268,1,294,5,100),(477,269,1,294,7,100),(478,637,1,294,2,100),(479,638,1,294,4,100),(480,639,1,294,6,100),(481,640,1,294,2,100),(482,641,1,294,4,100),(483,642,1,294,6,100),(484,770,1,294,2,100),(485,771,1,294,4,100),(486,772,1,294,6,100),(487,1107,1,294,2,100),(488,1108,1,294,4,100),(489,1109,1,294,6,100),(490,924,1,294,2,100),(491,925,1,294,4,100),(1517,1210,1,294,0,107),(1518,1211,1,294,0,116),(1519,1212,1,294,0,125),(1965,77,1,125,2,2),(1966,77,2,137,0,0),(1973,78,1,125,5,5),(1974,78,2,137,0,0),(1981,79,1,125,10,10),(1982,79,2,137,0,0),(1989,434,1,125,13,13),(1997,435,1,125,16,16),(2005,436,1,125,19,19),(1990,434,2,137,0,0),(1998,435,2,137,0,0),(2006,436,2,137,0,0),(507,80,1,274,3,0),(2299,581,8,254,0,0),(2298,581,7,254,0,0),(510,81,1,274,6,0),(511,82,1,274,10,0),(2297,581,6,254,0,0),(513,437,1,274,2,0),(514,437,2,141,0,0),(515,438,1,274,4,0),(516,438,2,141,0,0),(517,439,1,274,6,0),(518,439,2,141,0,0),(833,113,1,169,15,-1),(834,114,1,169,30,-1),(835,115,1,169,45,-1),(836,443,1,169,50,-1),(837,444,1,169,100,-1),(838,445,1,169,153,-1),(1206,767,1,273,3,0),(1207,768,1,273,6,0),(1208,769,1,273,9,0),(1209,1099,1,273,3,0),(1210,1100,1,273,6,0),(1211,1101,1,273,9,0),(531,1011,1,262,8,7),(532,1011,2,262,8,8),(533,1011,3,262,8,9),(534,1011,4,262,8,10),(535,1011,5,262,8,11),(536,1012,1,262,16,7),(537,1012,2,262,16,8),(538,1012,3,262,16,9),(539,1012,4,262,16,10),(540,1012,5,262,16,11),(541,1013,1,262,24,7),(542,1013,2,262,24,8),(543,1013,3,262,24,9),(544,1013,4,262,24,10),(545,1013,5,262,24,11),(546,1014,1,262,32,7),(547,1014,2,262,32,8),(548,1014,3,262,32,9),(549,1014,4,262,32,10),(550,1014,5,262,32,11),(551,1015,1,262,40,7),(552,1015,2,262,40,8),(553,1015,3,262,40,9),(554,1015,4,262,40,10),(555,1015,5,262,40,11),(556,1016,1,262,50,7),(557,1016,2,262,50,8),(558,1016,3,262,50,9),(559,1016,4,262,50,10),(560,1016,5,262,50,11),(561,1361,1,262,10,0),(562,1361,2,262,10,1),(563,1361,3,262,10,2),(564,1361,4,262,10,3),(565,1361,5,262,10,4),(566,1361,6,262,10,5),(567,1361,7,262,10,6),(568,1362,1,69,250,0),(569,1362,2,97,250,0),(570,1362,3,190,250,0),(571,1363,1,327,1,0),(572,1364,1,273,3,0),(573,1364,2,274,3,0),(574,1364,3,294,3,100),(575,1364,4,319,3,0),(576,1364,5,169,3,0),(577,1365,1,180,3,0),(578,1366,1,262,10,0),(579,1366,2,262,10,1),(580,1366,3,262,10,2),(581,1366,4,262,10,3),(582,1366,5,262,10,4),(583,1366,6,262,10,5),(584,1366,7,262,10,6),(585,1367,1,69,250,0),(586,1367,2,97,250,0),(587,1367,3,190,250,0),(588,1368,1,327,1,0),(589,1369,1,273,3,0),(590,1369,2,274,3,0),(591,1369,3,294,3,100),(592,1369,4,319,3,0),(593,1369,5,169,3,0),(594,1370,1,180,3,0),(595,116,1,181,5,0),(596,117,1,181,15,0),(597,118,1,181,25,0),(598,195,1,181,100,0),(599,683,1,189,1,0),(600,684,1,189,2,0),(601,685,1,189,3,0),(602,674,1,0,1,0),(603,675,1,0,2,0),(604,1031,1,0,1,0),(605,1032,1,0,2,0),(606,1033,1,0,3,0),(607,1034,1,0,4,0),(608,1035,1,0,5,0),(609,1072,1,318,1,0),(610,1073,1,318,2,0),(611,1074,1,318,3,0),(612,1075,1,318,4,0),(613,1076,1,318,5,0),(1215,692,1,229,5,0),(1216,693,1,229,10,0),(1217,694,1,229,15,0),(2296,581,5,267,1,7),(2295,581,4,267,1,2),(2294,581,3,267,1,5),(2293,581,2,267,1,8),(2292,581,1,267,1,4),(2291,580,11,254,0,0),(2290,580,10,254,0,0),(2280,1130,2,267,1,24),(2279,1130,1,267,1,21),(2278,1129,2,267,1,24),(627,1026,1,328,50,0),(628,1027,1,328,100,0),(629,1028,1,328,150,0),(630,1029,1,328,200,0),(631,1030,1,328,250,0),(632,1587,1,344,50,0),(633,1588,1,344,55,0),(634,1589,1,344,60,0),(635,652,1,293,25,0),(636,653,1,293,50,0),(637,654,1,293,75,0),(638,1586,1,293,25,0),(639,74,1,269,10,0),(640,75,1,269,20,0),(641,76,1,269,30,0),(642,263,1,282,10,0),(643,264,1,282,25,0),(644,265,1,282,50,0),(645,537,1,282,60,0),(646,538,1,282,70,0),(647,1611,1,282,4,0),(648,1612,1,282,8,0),(649,1613,1,282,12,0),(650,1614,1,282,16,0),(651,1615,1,282,20,0),(652,5136,1,282,4,0),(653,5137,1,282,8,0),(654,5138,1,282,12,0),(655,5139,1,282,16,0),(656,5140,1,282,20,0),(2246,1621,1,177,5,0),(2247,1622,1,177,10,0),(2248,1623,1,177,15,0),(1819,599,1,266,2,0),(1820,600,1,266,4,0),(1821,601,1,266,8,0),(1822,1536,1,266,3,0),(1823,1537,1,266,6,0),(1824,1538,1,266,9,0),(666,602,1,266,2,0),(667,603,1,266,4,0),(668,604,1,266,8,0),(669,1388,2,13,1,0),(670,1627,1,271,5,0),(671,1628,1,271,10,0),(672,1629,1,271,15,0),(673,855,1,220,5,10),(674,856,1,220,15,10),(675,857,1,220,30,10),(676,820,1,220,10,26),(677,820,2,220,10,30),(678,820,3,220,10,38),(679,821,1,220,20,26),(680,821,2,220,20,30),(681,821,3,220,20,38),(682,822,1,220,30,26),(683,822,2,220,30,30),(684,822,3,220,30,38),(685,915,1,220,5,10),(686,915,2,220,5,30),(687,916,1,220,15,10),(688,916,2,220,15,30),(689,917,1,220,30,10),(690,917,2,220,30,30),(691,1287,1,320,1,0),(692,1288,2,320,3,0),(693,1289,3,320,5,0),(694,1134,1,220,32,74),(695,1135,1,220,64,74),(696,1136,1,220,96,74),(697,1158,1,220,128,74),(698,1159,1,220,192,74),(699,1160,1,220,224,74),(700,1161,1,220,256,74),(701,1162,1,220,288,74),(2225,846,1,258,5,0),(2226,847,1,258,10,0),(2227,848,1,258,15,0),(2228,1301,1,258,5,0),(2229,1302,1,258,10,0),(2230,1303,1,258,15,0),(708,287,1,253,1,0),(709,205,1,251,100,0),(2273,199,1,301,30,0),(2274,200,1,301,60,0),(2275,201,1,301,100,0),(713,1131,1,185,10,51),(714,1132,1,185,20,51),(715,1133,1,185,30,51),(716,806,1,249,1,0),(717,823,1,222,20,0),(718,824,1,222,25,0),(719,825,1,222,30,0),(720,826,1,222,35,0),(721,827,1,222,40,0),(722,631,1,292,15,0),(723,632,1,292,30,0),(724,633,1,292,45,0),(2237,564,1,177,3,0),(2238,565,1,177,6,0),(2239,566,1,177,9,0),(2493,591,1,303,600,0),(2241,562,1,177,6,0),(2242,563,1,177,9,0),(2243,1624,1,177,5,0),(2244,1625,1,177,10,0),(2245,1626,1,177,15,0),(734,551,1,225,3,0),(735,552,1,225,6,0),(736,553,1,225,9,0),(737,554,1,225,12,0),(738,555,1,225,15,0),(739,556,1,225,3,0),(740,557,1,225,6,0),(741,558,1,225,9,0),(742,559,1,225,12,0),(2491,590,1,303,400,0),(744,686,1,200,10,0),(745,687,1,200,20,0),(746,688,1,200,30,0),(747,689,1,200,40,0),(748,690,1,200,50,0),(749,273,1,288,100,21),(750,611,1,283,20,0),(751,612,1,283,40,0),(752,613,1,283,60,0),(753,614,1,283,80,0),(754,615,1,283,100,0),(2231,878,1,252,10,0),(2232,879,1,252,20,0),(2233,880,1,252,30,0),(2234,1539,1,252,5,0),(2235,1540,1,252,10,0),(2236,1541,1,252,15,0),(761,1041,1,330,25,0),(762,1041,2,330,25,1),(763,1041,3,330,25,2),(764,1041,4,330,25,3),(765,1041,5,330,25,28),(766,1041,6,330,25,36),(767,1042,1,330,30,0),(768,1042,2,330,30,1),(769,1042,3,330,30,2),(770,1042,4,330,30,3),(771,1042,5,330,30,28),(772,1042,6,330,30,36),(773,1043,1,330,35,0),(774,1043,2,330,35,1),(775,1043,3,330,35,2),(776,1043,4,330,35,3),(777,1043,5,330,35,28),(778,1043,6,330,35,36),(779,1044,1,330,25,0),(780,1044,2,330,25,1),(781,1044,3,330,25,2),(782,1044,4,330,25,3),(783,1044,5,330,25,28),(784,1044,6,330,25,36),(785,1045,1,330,30,0),(786,1045,2,330,30,1),(787,1045,3,330,30,2),(788,1045,4,330,30,3),(789,1045,5,330,30,28),(790,1045,6,330,30,36),(791,1046,1,330,35,0),(792,1046,2,330,35,1),(793,1046,3,330,35,2),(794,1046,4,330,35,3),(795,1046,5,330,35,28),(796,1046,6,330,35,36),(797,1047,1,330,25,0),(798,1047,2,330,25,1),(799,1047,3,330,25,2),(800,1047,4,330,25,3),(801,1047,5,330,25,28),(802,1047,6,330,25,36),(803,1048,1,330,30,0),(804,1048,2,330,30,1),(805,1048,3,330,30,2),(806,1048,4,330,30,3),(807,1048,5,330,30,28),(808,1048,6,330,30,36),(809,1049,1,330,35,0),(810,1049,2,330,35,1),(811,1049,3,330,35,2),(812,1049,4,330,35,3),(813,1049,5,330,35,28),(814,1049,6,330,35,36),(815,1050,1,330,15,0),(816,1050,2,330,15,1),(817,1050,3,330,15,2),(818,1050,4,330,15,3),(819,1050,5,330,15,28),(820,1050,6,330,15,36),(821,1051,1,330,20,0),(822,1051,2,330,20,1),(823,1051,3,330,20,2),(824,1051,4,330,20,3),(825,1051,5,330,20,28),(826,1051,6,330,20,36),(827,1052,1,330,25,0),(828,1052,2,330,25,1),(829,1052,3,330,25,2),(830,1052,4,330,25,3),(831,1052,5,330,25,28),(832,1052,6,330,25,36),(839,190,1,219,225,680),(840,191,1,219,235,725),(841,192,1,219,245,770),(842,1524,1,219,485,815),(843,1525,1,219,495,860),(844,1526,1,219,515,905),(845,790,1,218,1,0),(846,791,1,218,2,0),(847,792,1,218,3,0),(848,793,1,218,4,0),(849,794,1,218,5,0),(850,834,1,218,1,0),(851,835,1,218,2,0),(852,836,1,218,3,0),(853,837,1,218,4,0),(854,838,1,218,5,0),(855,724,1,218,1,0),(856,725,1,218,2,0),(857,726,1,218,3,0),(858,727,1,218,4,0),(859,728,1,218,5,0),(860,8201,1,218,1,0),(861,8202,1,218,2,0),(862,8203,1,218,3,0),(863,795,1,280,2,0),(864,796,1,280,4,0),(865,797,1,280,6,0),(866,798,1,280,8,0),(867,799,1,280,10,0),(868,839,1,280,2,0),(869,840,1,280,4,0),(870,841,1,280,6,0),(871,842,1,280,8,0),(872,843,1,280,10,0),(873,729,1,280,2,0),(874,730,1,280,4,0),(875,731,1,280,6,0),(876,732,1,280,8,0),(877,733,1,280,10,0),(878,803,1,213,2,0),(879,804,1,213,5,0),(880,805,1,213,10,0),(881,800,1,215,2,0),(882,801,1,215,5,0),(883,802,1,215,10,0),(2061,125,1,172,2,0),(2062,126,1,172,5,0),(2063,127,1,172,10,0),(2064,449,1,172,3,0),(2065,450,1,172,6,0),(2066,451,1,172,9,0),(2067,452,1,172,12,0),(2068,453,1,172,15,0),(2069,1061,1,172,1,0),(2070,1062,1,172,2,0),(2071,1063,1,172,3,0),(2072,1064,1,172,5,0),(2073,1065,1,172,7,0),(2074,1394,1,172,1,0),(2075,1395,1,172,2,0),(2076,1396,1,172,3,0),(2077,1397,1,172,5,0),(2078,1398,1,172,7,0),(2079,5519,1,172,1,0),(2080,5520,1,172,2,0),(2081,5521,1,172,3,0),(2082,5522,1,172,4,0),(2083,5523,1,172,5,0),(908,279,2,259,2,0),(909,279,3,172,2,0),(914,864,2,216,10,1),(915,864,3,216,10,2),(916,864,4,216,10,3),(917,864,5,216,10,10),(918,864,6,216,10,28),(919,864,7,216,10,30),(920,864,8,216,10,36),(922,865,2,216,20,1),(923,865,3,216,20,2),(924,865,4,216,20,3),(925,865,5,216,20,10),(926,865,6,216,20,28),(927,865,7,216,20,30),(928,865,8,216,20,36),(930,866,2,216,30,1),(931,866,3,216,30,2),(932,866,4,216,30,3),(933,866,5,216,30,10),(934,866,6,216,30,28),(935,866,7,216,30,30),(936,866,8,216,30,36),(937,1290,1,216,40,0),(938,1290,2,216,40,1),(939,1290,3,216,40,2),(940,1290,4,216,40,3),(941,1290,5,216,40,10),(942,1290,6,216,40,28),(943,1290,7,216,40,30),(944,1290,8,216,40,36),(945,1291,1,216,50,0),(946,1291,2,216,50,1),(947,1291,3,216,50,2),(948,1291,4,216,50,3),(949,1291,5,216,50,10),(950,1291,6,216,50,28),(951,1291,7,216,50,30),(952,1291,8,216,50,36),(953,1292,1,216,60,0),(954,1292,2,216,60,1),(955,1292,3,216,60,2),(956,1292,4,216,60,3),(957,1292,5,216,60,10),(958,1292,6,216,60,28),(959,1292,7,216,60,30),(960,1292,8,216,60,36),(961,1140,1,216,10,51),(963,1141,1,216,30,51),(2094,122,1,259,2,0),(2095,123,1,259,5,0),(2096,124,1,259,10,0),(2097,454,1,259,3,0),(2098,455,1,259,6,0),(2099,456,1,259,9,0),(2100,457,1,259,12,0),(2101,458,1,259,15,0),(2102,1066,1,259,1,0),(2103,1067,1,259,2,0),(2104,1068,1,259,3,0),(2105,1069,1,259,5,0),(2106,1070,1,259,7,0),(2107,1399,1,259,1,0),(2108,1400,1,259,2,0),(2109,1401,1,259,3,0),(2110,1402,1,259,5,0),(2111,1403,1,259,7,0),(2112,5524,1,259,1,0),(2113,5525,1,259,2,0),(2114,5526,1,259,3,0),(2115,5527,1,259,4,0),(2116,5528,1,259,5,0),(987,247,1,224,15,0),(988,248,1,224,35,0),(989,249,1,224,50,0),(990,504,1,224,60,0),(991,505,1,224,70,0),(992,506,1,224,80,0),(993,240,1,224,20,26),(994,240,2,173,1,0),(995,241,1,224,40,26),(996,241,2,173,2,0),(997,242,1,224,60,26),(998,242,2,173,3,0),(999,6287,1,224,20,30),(1000,6287,2,173,1,0),(1001,6288,1,224,40,30),(1002,6288,2,173,2,0),(1003,6289,1,224,60,30),(1004,6289,2,173,3,0),(1005,7106,1,224,20,30),(1006,7106,2,173,1,0),(1007,7107,1,224,40,30),(1008,7107,2,173,2,0),(1009,7108,1,224,60,30),(1010,7108,2,173,3,0),(1011,6269,1,224,20,30),(1012,6269,2,173,1,0),(1013,6270,1,224,40,30),(1014,6270,2,173,2,0),(1015,6271,1,224,60,30),(1016,6271,2,173,3,0),(1017,6266,1,224,20,10),(1018,6266,2,173,1,0),(1019,6267,1,224,40,10),(1020,6267,2,173,2,0),(1021,6268,1,224,60,10),(1022,6268,2,173,3,0),(1023,1143,1,224,20,74),(1024,1143,2,173,1,0),(1025,1144,1,224,40,74),(1026,1144,2,173,2,0),(1027,1145,1,224,60,74),(1028,1145,2,173,3,0),(1029,6275,1,224,20,8),(1030,6275,2,173,1,0),(1031,6276,1,224,40,8),(1032,6276,2,173,2,0),(1033,6277,1,224,60,8),(1034,6277,2,173,3,0),(2249,255,1,279,7,0),(2250,256,1,279,11,0),(2251,257,1,279,15,0),(2252,542,1,279,2,0),(2253,543,1,279,4,0),(2254,544,1,279,6,0),(2255,1163,1,279,2,0),(2256,1164,1,279,4,0),(2257,1165,1,279,6,0),(2258,4795,1,279,1,0),(2259,4796,1,279,2,0),(2260,4797,1,279,3,0),(2261,815,1,279,7,0),(2262,816,1,279,11,0),(2263,817,1,279,15,0),(2264,1616,1,279,7,0),(2265,1617,1,279,11,0),(2266,1618,1,279,15,0),(1053,198,1,276,32,0),(1054,741,1,232,2,4544),(1055,742,1,232,4,4545),(1056,743,1,232,6,4546),(1057,744,1,232,8,4547),(1058,745,1,232,10,4548),(1059,577,1,277,20,0),(1060,578,1,277,40,0),(1061,579,1,277,60,0),(1062,95,1,235,5,0),(1063,96,1,235,10,0),(1064,97,1,235,15,0),(1065,710,1,235,5,0),(1066,711,1,235,10,0),(1067,712,1,235,15,0),(1068,713,1,235,20,0),(1069,714,1,235,25,0),(2270,144,1,244,50,0),(2271,567,1,244,12,0),(2272,5061,1,244,11,0),(1073,734,1,237,1,0),(1076,225,1,272,1,0),(1083,101,1,265,20,0),(1084,102,1,265,35,0),(1085,103,1,265,52,0),(1086,446,1,265,54,0),(1087,447,1,265,56,0),(1088,448,1,265,58,0),(1089,735,1,265,54,0),(1090,736,1,265,56,0),(1091,737,1,265,58,0),(1092,7056,1,265,62,0),(1093,7057,1,265,64,0),(1094,7058,1,265,66,0),(1095,7059,1,265,67,0),(1096,7060,1,265,68,0),(1097,7061,1,265,69,0),(1100,7066,1,265,72,0),(1101,8263,1,262,5,0),(1102,8264,1,262,10,0),(1103,8265,1,262,15,0),(1104,8266,1,262,20,0),(1105,8267,1,262,25,0),(1106,8268,1,262,5,1),(1107,8269,1,262,10,1),(1108,8270,1,262,15,1),(1109,8271,1,262,20,1),(1110,8272,1,262,25,1),(1111,8273,1,262,5,2),(1112,8274,1,262,10,2),(1113,8275,1,262,15,2),(1114,8276,1,262,20,2),(1115,8277,1,262,25,2),(1116,8278,1,262,5,3),(1117,8279,1,262,10,3),(1118,8280,1,262,15,3),(1119,8281,1,262,20,3),(1120,8282,1,262,25,3),(1121,8283,1,262,5,4),(1122,8284,1,262,10,4),(1123,8285,1,262,15,4),(1124,8286,1,262,20,4),(1125,8287,1,262,25,4),(1126,8288,1,262,5,5),(1127,8289,1,262,10,5),(1128,8290,1,262,15,5),(1129,8291,1,262,20,5),(1130,8292,1,262,25,5),(1131,8293,1,262,5,6),(1132,8294,1,262,10,6),(1133,8295,1,262,15,6),(1134,8296,1,262,20,6),(1135,8297,1,262,25,6),(1136,4678,1,262,5,0),(1137,4679,1,262,10,0),(1138,4680,1,262,15,0),(1139,4681,1,262,20,0),(1140,4682,1,262,25,0),(1141,4678,2,262,5,1),(1142,4679,2,262,10,1),(1143,4680,2,262,15,1),(1144,4681,2,262,20,1),(1145,4682,2,262,25,1),(1146,4678,3,262,5,2),(1147,4679,3,262,10,2),(1148,4680,3,262,15,2),(1149,4681,3,262,20,2),(1150,4682,3,262,25,2),(1151,4678,4,262,5,3),(1152,4679,4,262,10,3),(1153,4680,4,262,15,3),(1154,4681,4,262,20,3),(1155,4682,4,262,25,3),(1156,4678,5,262,5,4),(1157,4679,5,262,10,4),(1158,4680,5,262,15,4),(1159,4681,5,262,20,4),(1160,4682,5,262,25,4),(1161,4678,6,262,5,5),(1162,4679,6,262,10,5),(1163,4680,6,262,15,5),(1164,4681,6,262,20,5),(1165,4682,6,262,25,5),(1166,4678,7,262,5,6),(1167,4679,7,262,10,6),(1168,4680,7,262,15,6),(1169,4681,7,262,20,6),(1170,4682,7,262,25,6),(1171,7547,1,262,5,0),(1172,7548,1,262,10,0),(1173,7549,1,262,15,0),(1174,7550,1,262,20,0),(1175,7551,1,262,25,0),(1176,7547,2,262,5,1),(1177,7548,2,262,10,1),(1178,7549,2,262,15,1),(1179,7550,2,262,20,1),(1180,7551,2,262,25,1),(1181,7547,3,262,5,2),(1182,7548,3,262,10,2),(1183,7549,3,262,15,2),(1184,7550,3,262,20,2),(1185,7551,3,262,25,2),(1186,7547,4,262,5,3),(1187,7548,4,262,10,3),(1188,7549,4,262,15,3),(1189,7550,4,262,20,3),(1190,7551,4,262,25,3),(1191,7537,5,262,5,4),(1192,7538,5,262,10,4),(1193,7539,5,262,15,4),(1194,7540,5,262,20,4),(1195,7541,5,262,25,4),(1196,7547,6,262,5,5),(1197,7548,6,262,10,5),(1198,7549,6,262,15,5),(1199,7550,6,262,20,5),(1200,7551,6,262,25,5),(1201,7547,7,262,5,6),(1202,7548,7,262,10,6),(1203,7549,7,262,15,6),(1204,7550,7,262,20,6),(1205,7551,7,262,25,6),(1212,12423,1,273,3,0),(1213,12424,1,273,6,0),(1214,12425,1,273,9,0),(1218,7647,1,229,5,0),(1219,7648,1,229,10,0),(1220,7649,1,229,15,0),(1221,7670,1,229,5,0),(1222,7671,1,229,10,0),(1223,7672,1,229,15,0),(1224,8224,1,339,10,16230),(1225,8224,2,138,1,0),(1226,8224,3,141,1,0),(1227,8224,4,142,60,0),(1228,8224,5,137,0,0),(1229,8224,6,311,0,0),(1230,8224,7,134,80,0),(1231,8224,8,139,-265,0),(1232,8224,9,139,-754,0),(1233,8224,10,139,-1332,0),(1234,8224,11,139,-1572,0),(1235,8224,12,139,-2749,0),(1236,8224,13,139,-4979,0),(1237,8224,14,139,-5418,0),(1238,8224,15,139,-5403,0),(1239,8225,1,339,10,16231),(1240,8225,2,138,1,0),(1241,8225,3,141,1,0),(1242,8225,4,142,65,0),(1243,8225,5,137,0,0),(1244,8225,6,311,0,0),(1245,8225,7,134,85,0),(1246,8225,8,139,-265,0),(1247,8225,9,139,-754,0),(1248,8225,10,139,-1332,0),(1249,8225,11,139,-1572,0),(1250,8225,12,139,-2749,0),(1251,8225,13,139,-4979,0),(1252,8225,14,139,-5418,0),(1253,8225,15,139,-5403,0),(1254,8226,1,339,10,16232),(1255,8226,2,138,1,0),(1256,8226,3,141,1,0),(1257,8226,4,142,70,0),(1258,8226,5,137,0,0),(1259,8226,6,311,0,0),(1260,8226,7,134,90,0),(1261,8226,8,139,-265,0),(1262,8226,9,139,-754,0),(1263,8226,10,139,-1332,0),(1264,8226,11,139,-1572,0),(1265,8226,12,139,-2749,0),(1266,8226,13,139,-4979,0),(1267,8226,14,139,-5418,0),(1268,8226,15,139,-5403,0),(1269,649,1,243,15,0),(1270,650,1,243,35,0),(1271,651,1,243,50,0),(1272,867,1,59,-3,0),(1273,868,1,59,-6,0),(1274,869,1,59,-9,0),(1275,870,1,59,-12,0),(1276,871,1,59,-15,0),(1283,1486,7,134,75,0),(1284,1486,8,139,-265,0),(1285,1486,9,139,-754,0),(1286,1486,10,139,-1332,0),(1287,1486,11,139,-1572,0),(1288,1486,12,139,-2749,0),(1289,1486,13,139,-4979,0),(1290,1486,14,139,-5418,0),(1291,1486,15,139,-5403,0),(1292,1486,16,348,10,0),(1299,1487,7,134,75,0),(1300,1487,8,139,-265,0),(1301,1487,9,139,-754,0),(1302,1487,10,139,-1332,0),(1303,1487,11,139,-1572,0),(1304,1487,12,139,-2749,0),(1305,1487,13,139,-4979,0),(1306,1487,14,139,-5418,0),(1307,1487,15,139,-5403,0),(1308,1487,16,348,10,0),(1315,1488,7,134,75,0),(1316,1488,8,139,-265,0),(1317,1488,9,139,-754,0),(1318,1488,10,139,-1332,0),(1319,1488,11,139,-1572,0),(1320,1488,12,139,-2749,0),(1321,1488,13,139,-4979,0),(1322,1488,14,139,-5418,0),(1323,1488,15,139,-5403,0),(1324,1488,16,348,10,0),(1331,1489,7,134,75,0),(1332,1489,8,139,-265,0),(1333,1489,9,139,-754,0),(1334,1489,10,139,-1332,0),(1335,1489,11,139,-1572,0),(1336,1489,12,139,-2749,0),(1337,1489,13,139,-4979,0),(1338,1489,14,139,-5418,0),(1339,1489,15,139,-5403,0),(1340,1489,16,348,10,0),(1347,1490,7,134,75,0),(1348,1490,8,139,-265,0),(1349,1490,9,139,-754,0),(1350,1490,10,139,-1332,0),(1351,1490,11,139,-1572,0),(1352,1490,12,139,-2749,0),(1353,1490,13,139,-4979,0),(1354,1490,14,139,-5418,0),(1355,1490,15,139,-5403,0),(1356,1490,16,348,10,0),(1357,5529,1,339,11,12680),(1358,5529,2,138,1,0),(1359,5529,3,141,1,0),(1360,5529,4,142,60,0),(1361,5529,5,137,0,0),(1362,5529,6,311,0,0),(1363,5529,7,134,75,0),(1364,5529,8,139,-265,0),(1365,5529,9,139,-754,0),(1366,5529,10,139,-1332,0),(1367,5529,11,139,-1572,0),(1368,5529,12,139,-2749,0),(1369,5529,13,139,-4979,0),(1370,5529,14,139,-5418,0),(1371,5529,15,139,-5403,0),(1372,5529,16,348,10,0),(1373,5530,1,339,13,12681),(1374,5530,2,138,1,0),(1375,5530,3,141,1,0),(1376,5530,4,142,60,0),(1377,5530,5,137,0,0),(1378,5530,6,311,0,0),(1379,5530,7,134,75,0),(1380,5530,8,139,-265,0),(1381,5530,9,139,-754,0),(1382,5530,10,139,-1332,0),(1383,5530,11,139,-1572,0),(1384,5530,12,139,-2749,0),(1385,5530,13,139,-4979,0),(1386,5530,14,139,-5418,0),(1387,5530,15,139,-5403,0),(1388,5530,16,348,10,0),(1389,5531,1,339,15,12682),(1390,5531,2,138,1,0),(1391,5531,3,141,1,0),(1392,5531,4,142,60,0),(1393,5531,5,137,0,0),(1394,5531,6,311,0,0),(1395,5531,7,134,75,0),(1396,5531,8,139,-265,0),(1397,5531,9,139,-754,0),(1398,5531,10,139,-1332,0),(1399,5531,11,139,-1572,0),(1400,5531,12,139,-2749,0),(1401,5531,13,139,-4979,0),(1402,5531,14,139,-5418,0),(1403,5531,15,139,-5403,0),(1404,5531,16,348,10,0),(2436,5532,16,348,10,0),(2435,5532,15,139,-5403,0),(2434,5532,14,139,-5418,0),(2433,5532,13,139,-4979,0),(2432,5532,12,139,-2749,0),(2431,5532,11,139,-1572,0),(2430,5532,10,139,-1332,0),(2429,5532,9,139,-754,0),(2428,5532,8,139,-265,0),(2427,5532,7,134,75,0),(2426,5532,6,311,0,0),(2425,5532,5,137,0,0),(2424,5532,4,142,60,0),(2423,5532,3,141,1,0),(2422,5532,2,138,1,0),(2421,5532,1,339,17,12683),(1421,5533,1,339,19,12684),(1422,5533,2,138,1,0),(1423,5533,3,141,1,0),(1424,5533,4,142,60,0),(1425,5533,5,137,0,0),(1426,5533,6,311,0,0),(1427,5533,7,134,75,0),(1428,5533,8,139,-265,0),(1429,5533,9,139,-754,0),(1430,5533,10,139,-1332,0),(1431,5533,11,139,-1572,0),(1432,5533,12,139,-2749,0),(1433,5533,13,139,-4979,0),(1434,5533,14,139,-5418,0),(1435,5533,15,139,-5403,0),(1436,5533,16,348,10,0),(1437,7554,1,339,21,16194),(1438,7554,2,138,1,0),(1439,7554,3,141,1,0),(1440,7554,4,142,60,0),(1441,7554,5,137,0,0),(1442,7554,6,311,0,0),(1443,7554,7,134,75,0),(1444,7554,8,139,-265,0),(1445,7554,9,139,-754,0),(1446,7554,10,139,-1332,0),(1447,7554,11,139,-1572,0),(1448,7554,12,139,-2749,0),(1449,7554,13,139,-4979,0),(1450,7554,14,139,-5418,0),(1451,7554,15,139,-5403,0),(1452,7554,16,348,10,0),(1453,7555,1,339,23,16195),(1454,7555,2,138,1,0),(1455,7555,3,141,1,0),(1456,7555,4,142,60,0),(1457,7555,5,137,0,0),(1458,7555,6,311,0,0),(1459,7555,7,134,75,0),(1460,7555,8,139,-265,0),(1461,7555,9,139,-754,0),(1462,7555,10,139,-1332,0),(1463,7555,11,139,-1572,0),(1464,7555,12,139,-2749,0),(1465,7555,13,139,-4979,0),(1466,7555,14,139,-5418,0),(1467,7555,15,139,-5403,0),(1468,7555,16,348,10,0),(1469,7556,1,339,25,16196),(1470,7556,2,138,1,0),(1471,7556,3,141,1,0),(1472,7556,4,142,60,0),(1473,7556,5,137,0,0),(1474,7556,6,311,0,0),(1475,7556,7,134,75,0),(1476,7556,8,139,-265,0),(1477,7556,9,139,-754,0),(1478,7556,10,139,-1332,0),(1479,7556,11,139,-1572,0),(1480,7556,12,139,-2749,0),(1481,7556,13,139,-4979,0),(1482,7556,14,139,-5418,0),(1483,7556,15,139,-5403,0),(1484,7556,16,348,10,0),(1485,7557,1,339,27,16417),(1486,7557,2,138,1,0),(1487,7557,3,141,1,0),(1488,7557,4,142,60,0),(1489,7557,5,137,0,0),(1490,7557,6,311,0,0),(1491,7557,7,134,75,0),(1492,7557,8,139,-265,0),(1493,7557,9,139,-754,0),(1494,7557,10,139,-1332,0),(1495,7557,11,139,-1572,0),(1496,7557,12,139,-2749,0),(1497,7557,13,139,-4979,0),(1498,7557,14,139,-5418,0),(1499,7557,15,139,-5403,0),(1500,7557,16,348,10,0),(1501,7558,1,339,29,16418),(1502,7558,2,138,1,0),(1503,7558,3,141,1,0),(1504,7558,4,142,60,0),(1505,7558,5,137,0,0),(1506,7558,6,311,0,0),(1507,7558,7,134,75,0),(1508,7558,8,139,-265,0),(1509,7558,9,139,-754,0),(1510,7558,10,139,-1332,0),(1511,7558,11,139,-1572,0),(1512,7558,12,139,-2749,0),(1513,7558,13,139,-4979,0),(1514,7558,14,139,-5418,0),(1515,7558,15,139,-5403,0),(1516,7558,16,348,10,0),(2486,4755,1,294,0,130),(2487,4756,1,294,0,135),(2488,4757,1,294,0,140),(1768,5557,1,341,10,0),(1769,5558,1,341,20,0),(1770,5559,1,341,30,0),(1526,7582,1,294,0,120),(1876,7583,1,114,-2,0),(1877,7584,1,114,-4,0),(2317,4779,1,274,2,0),(2318,4780,1,274,4,0),(2319,4781,1,274,6,0),(2320,5592,1,274,1,0),(2321,5593,1,274,2,0),(2322,5594,1,274,3,0),(2323,7590,1,274,1,0),(2324,7591,1,274,2,0),(2325,7592,1,274,3,0),(2326,12452,1,274,1,0),(2327,12453,1,274,2,0),(2328,12454,1,274,3,0),(1545,1435,5,348,10,0),(1546,1435,6,137,0,0),(1547,1435,7,339,3,8105),(1548,1435,8,142,65,0),(1549,1435,9,311,0,0),(1550,1435,10,134,70,0),(1551,1435,11,348,10,0),(1552,1435,12,137,100,0),(1553,1435,13,339,3,8105),(1554,1435,14,142,65,0),(1555,1435,15,311,0,0),(1556,1435,16,134,70,0),(1557,1435,17,348,10,0),(1558,1435,18,137,79,0),(1559,1435,19,339,3,8105),(1560,1435,20,142,65,0),(1561,1435,21,311,0,0),(1562,1435,22,134,70,0),(1563,1435,23,348,10,0),(1564,1435,24,137,149,0),(1569,1436,5,348,10,0),(1570,1436,6,137,0,0),(1571,1436,7,339,6,8105),(1572,1436,8,142,65,0),(1573,1436,9,311,0,0),(1574,1436,10,134,70,0),(1575,1436,11,348,10,0),(1576,1436,12,137,100,0),(1577,1436,13,339,6,8105),(1578,1436,14,142,65,0),(1579,1436,15,311,0,0),(1580,1436,16,134,70,0),(1581,1436,17,348,10,0),(1582,1436,18,137,79,0),(1583,1436,19,339,6,8105),(1584,1436,20,142,65,0),(1585,1436,21,311,0,0),(1586,1436,22,134,70,0),(1587,1436,23,348,10,0),(1588,1436,24,137,147,0),(1593,1437,5,348,10,0),(1594,1437,6,137,0,0),(1595,1437,7,339,10,8105),(1596,1437,8,142,65,0),(1597,1437,9,311,0,0),(1598,1437,10,134,70,0),(1599,1437,11,348,10,0),(1600,1437,12,137,100,0),(1601,1437,13,339,10,8105),(1602,1437,14,142,65,0),(1603,1437,15,311,0,0),(1604,1437,16,134,70,0),(1605,1437,17,348,10,0),(1606,1437,18,137,79,0),(1607,1437,19,339,10,8105),(1608,1437,20,142,65,0),(1609,1437,21,311,0,0),(1610,1437,22,134,70,0),(1611,1437,23,348,10,0),(1612,1437,24,137,147,0),(1613,4773,1,339,10,11404),(1614,4773,2,142,71,0),(1615,4773,3,311,0,0),(1616,4773,4,134,75,0),(1617,4773,5,348,10,0),(1618,4773,6,137,0,0),(1619,4773,7,339,10,11404),(1620,4773,8,142,71,0),(1621,4773,9,311,0,0),(1622,4773,10,134,75,0),(1623,4773,11,348,10,0),(1624,4773,12,137,100,0),(1625,4773,13,339,10,11404),(1626,4773,14,142,71,0),(1627,4773,15,311,0,0),(1628,4773,16,134,75,0),(1629,4773,17,348,10,0),(1630,4773,18,137,79,0),(1631,4773,19,339,10,11404),(1632,4773,20,142,71,0),(1633,4773,21,311,0,0),(1634,4773,22,134,75,0),(1635,4773,23,348,10,0),(1636,4773,24,137,149,0),(1637,6517,1,339,10,13199),(1638,6517,2,142,76,0),(1639,6517,3,311,0,0),(1640,6517,4,134,80,0),(1641,6517,5,348,10,0),(1642,6517,6,137,0,0),(1643,6517,7,339,10,13199),(1644,6517,8,142,76,0),(1645,6517,9,311,0,0),(1646,6517,10,134,80,0),(1647,6517,11,348,10,0),(1648,6517,12,137,100,0),(1649,6517,13,339,10,13199),(1650,6517,14,142,76,0),(1651,6517,15,311,0,0),(1652,6517,16,134,80,0),(1653,6517,17,348,10,0),(1654,6517,18,137,79,0),(1655,6517,19,339,10,13199),(1656,6517,20,142,76,0),(1657,6517,21,311,0,0),(1658,6517,22,134,80,0),(1659,6517,23,348,10,0),(1660,6517,24,137,149,0),(1661,7621,1,339,10,13830),(1662,7621,2,142,81,0),(1663,7621,3,311,0,0),(1664,7621,4,134,85,0),(1665,7621,5,348,10,0),(1666,7621,6,137,0,0),(1667,7621,7,339,10,13830),(1668,7621,8,142,81,0),(1669,7621,9,311,0,0),(1670,7621,10,134,85,0),(1671,7621,11,348,10,0),(1672,7621,12,137,100,0),(1673,7621,13,339,10,13830),(1674,7621,14,142,81,0),(1675,7621,15,311,0,0),(1676,7621,16,134,85,0),(1677,7621,17,348,10,0),(1678,7621,18,137,79,0),(1679,7621,19,339,10,13830),(1680,7621,20,142,81,0),(1681,7621,21,311,0,0),(1682,7621,22,134,85,0),(1683,7621,23,348,10,0),(1684,7621,24,137,149,0),(1806,8235,1,137,-40,0),(1812,8236,1,137,-40,0),(1687,8237,1,1,87,0),(1688,8238,1,1,116,0),(1689,8239,1,1,145,0),(1690,8305,1,1,174,0),(1691,8306,1,1,203,0),(1692,8307,1,1,232,0),(1693,8308,1,1,261,0),(1694,8309,1,1,290,0),(2517,120,1,278,500,32000),(2516,119,2,440,50,200),(2515,119,1,278,500,32000),(1701,440,1,278,550,50800),(1702,440,2,440,56,200),(1703,441,1,278,550,50800),(1704,441,2,440,58,200),(1705,442,1,278,550,50800),(1706,442,2,440,60,200),(1707,1053,1,278,600,65440),(1708,1053,2,440,61,200),(1709,1054,1,278,600,65440),(1710,1054,2,440,63,200),(1711,1055,1,278,600,65440),(1712,1055,2,440,65,200),(1713,4721,1,278,670,82600),(1714,4721,2,440,66,200),(1715,4722,1,278,670,82600),(1716,4722,2,440,68,200),(1717,4723,1,278,670,82600),(1718,4723,2,440,70,200),(1719,5554,1,278,750,102280),(1720,5554,2,440,71,200),(1721,5555,1,278,750,102280),(1722,5555,2,440,73,200),(1723,5556,1,278,750,102280),(1724,5556,2,440,75,200),(1725,7565,1,278,900,124480),(1726,7565,2,440,76,200),(1727,7566,1,278,900,124480),(1728,7566,2,440,78,200),(1729,7567,1,278,900,124480),(1730,7567,2,440,80,200),(1731,6023,1,278,900,132440),(1732,6023,2,440,82,200),(1733,6024,1,278,900,149200),(1734,6024,2,440,84,200),(1735,6025,1,278,900,149200),(1736,6025,2,440,86,200),(1737,4739,1,360,10,11023),(1738,4740,1,360,20,11023),(1739,4741,1,360,30,11023),(1740,5562,1,360,40,11023),(1741,5563,1,360,50,11023),(1742,5564,1,360,60,11023),(1743,7573,1,360,70,11023),(1744,7574,1,360,80,11023),(1745,7575,1,360,90,11023),(1746,8198,1,294,0,110),(1747,8199,1,294,0,120),(1748,8200,1,294,0,130),(1752,4733,1,294,11,100),(1753,4734,1,294,13,100),(1754,4735,1,294,15,100),(1755,7641,1,294,17,100),(1756,7642,1,294,19,100),(1757,7643,1,294,21,100),(1758,1592,1,341,10,0),(1759,1593,1,341,20,0),(1760,1594,1,341,30,0),(1761,1595,1,341,40,0),(1762,1596,1,341,50,0),(1763,4725,1,341,10,0),(1764,4726,1,341,20,0),(1765,4727,1,341,30,0),(1766,4728,1,341,40,0),(1767,4729,1,341,50,0),(1771,5560,1,341,40,0),(1772,5561,1,341,50,0),(1773,7568,1,341,10,0),(1774,7569,1,341,20,0),(1775,7570,1,341,30,0),(1776,7571,1,341,40,0),(1777,7572,1,341,50,0),(1778,12439,1,341,10,0),(1779,12440,1,341,20,0),(1780,12441,1,341,30,0),(1781,12442,1,341,40,0),(1782,12443,1,341,50,0),(2344,8232,1,128,5,5),(2350,8233,1,128,15,15),(2356,8234,1,128,25,25),(2362,8261,1,128,65,65),(1825,5534,1,266,1,0),(1827,5536,1,266,5,0),(1828,7659,1,266,1,0),(1829,7660,1,266,2,0),(1830,7661,1,266,3,0),(1831,1181,1,305,-20,0),(1832,1182,1,305,-40,0),(1833,1183,1,305,-60,0),(1834,1184,1,305,-80,0),(1835,1185,1,305,-100,0),(1836,1093,1,304,-20,0),(1837,1094,1,304,-40,0),(1838,1095,1,304,-60,0),(1839,1096,1,304,-80,0),(1840,1097,1,304,-100,0),(1841,8215,1,190,50,0),(1842,8216,1,190,100,0),(1843,8217,1,190,150,0),(1844,8218,1,190,200,0),(1845,8219,1,190,250,0),(1846,1036,1,189,4,0),(1847,1037,1,189,5,0),(1848,1039,1,189,6,0),(1849,5130,1,189,7,0),(1850,5131,1,189,8,0),(1851,5132,1,189,9,0),(1852,5133,1,189,10,0),(1853,5134,1,189,11,0),(1854,6080,1,189,12,0),(1855,6081,1,189,13,0),(1856,7604,1,189,14,0),(1857,7605,1,189,15,0),(1858,5516,1,320,1,0),(1859,5517,1,320,2,0),(1860,5518,1,320,3,0),(1861,12469,1,320,1,0),(1862,12470,1,320,2,0),(1863,12471,1,320,3,0),(1864,98,1,114,-4,0),(1865,99,1,114,-12,0),(1866,100,1,114,-20,0),(1867,738,1,114,-4,0),(1868,739,1,114,-12,0),(1869,740,1,114,-20,0),(1870,5317,1,114,-3,0),(1871,5318,1,114,-6,0),(1872,5319,1,114,-9,0),(1873,5628,1,114,-3,0),(1874,5629,1,114,-4,0),(1875,5630,1,114,-5,0),(1878,7585,1,114,-6,0),(1879,634,1,274,3,0),(1880,635,1,274,6,0),(1881,636,1,274,10,0),(1882,844,1,274,3,0),(1883,845,1,274,6,0),(1884,1319,1,274,2,0),(1885,1320,1,274,4,0),(1886,1321,1,274,6,0),(1887,210,1,302,50,50),(1888,210,2,385,99,0),(1889,211,1,302,100,100),(1890,211,2,385,99,0),(1891,212,1,302,200,200),(1892,212,2,385,99,0),(1918,164,5,127,10,10),(1919,164,6,137,82,0),(1920,164,7,127,2,2),(1921,164,8,137,152,0),(1922,164,9,143,3000,0),(1927,165,5,127,25,25),(1928,165,6,137,82,0),(1929,165,7,127,4,4),(1930,165,8,137,152,0),(1931,165,9,143,3000,0),(1936,166,5,127,50,50),(1937,166,6,137,82,0),(1938,166,7,127,6,6),(1939,166,8,137,152,0),(1940,166,9,143,3000,0),(1967,77,3,141,1,0),(1968,77,4,139,-6232,0),(1969,77,5,139,-6264,0),(1970,77,6,125,2,2),(1971,77,7,137,147,0),(1972,77,8,141,1,0),(1975,78,3,141,1,0),(1976,78,4,139,-6232,0),(1977,78,5,139,-6264,0),(1978,78,6,125,5,5),(1979,78,7,137,147,0),(1980,78,8,141,1,0),(1983,79,3,141,1,0),(1984,79,4,139,-6232,0),(1985,79,5,139,-6264,0),(1986,79,6,125,10,10),(1987,79,7,137,147,0),(1988,79,8,141,1,0),(1991,434,3,141,1,0),(1992,434,4,139,-6232,0),(1993,434,5,139,-6264,0),(1994,434,6,125,13,13),(1995,434,7,137,147,0),(1996,434,8,141,1,0),(1999,435,3,141,1,0),(2000,435,4,139,-6232,0),(2001,435,5,139,-6264,0),(2002,435,6,125,16,16),(2003,435,7,137,147,0),(2004,435,8,141,1,0),(2007,436,3,141,1,0),(2008,436,4,139,-6232,0),(2009,436,5,139,-6264,0),(2010,436,6,125,19,19),(2011,436,7,137,147,0),(2012,436,8,141,1,0),(2013,1083,1,125,22,13),(2014,1083,2,137,0,0),(2015,1083,3,141,1,0),(2016,1083,4,139,-6232,0),(2017,1083,5,139,-6264,0),(2018,1083,6,125,22,22),(2019,1083,7,137,147,0),(2020,1083,8,141,1,0),(2021,1084,1,125,25,16),(2022,1084,2,137,0,0),(2023,1084,3,141,1,0),(2024,1084,4,139,-6232,0),(2025,1084,5,139,-6264,0),(2026,1084,6,125,25,25),(2027,1084,7,137,147,0),(2028,1084,8,141,1,0),(2029,1085,1,125,28,19),(2030,1085,2,137,0,0),(2031,1085,3,141,1,0),(2032,1085,4,139,-6232,0),(2033,1085,5,139,-6264,0),(2034,1085,6,125,28,28),(2035,1085,7,137,147,0),(2036,1085,8,141,1,0),(2037,12449,1,125,31,31),(2038,12449,2,137,0,0),(2039,12449,3,141,1,0),(2040,12449,4,139,-6232,0),(2041,12449,5,139,-6264,0),(2042,12449,6,125,31,31),(2043,12449,7,137,147,0),(2044,12449,8,141,1,0),(2045,12450,1,125,34,34),(2046,12450,2,137,0,0),(2047,12450,3,141,1,0),(2048,12450,4,139,-6232,0),(2049,12450,5,139,-6264,0),(2050,12450,6,125,33,33),(2051,12450,7,137,147,0),(2052,12450,8,141,1,0),(2053,12451,1,125,37,37),(2054,12451,2,137,0,0),(2055,12451,3,141,1,0),(2056,12451,4,139,-6232,0),(2057,12451,5,139,-6264,0),(2058,12451,6,125,37,37),(2059,12451,7,137,147,0),(2060,12451,8,141,1,0),(2084,7501,1,172,1,0),(2085,7502,1,172,2,0),(2086,7503,1,172,3,0),(2087,7504,1,172,4,0),(2088,7505,1,172,5,0),(2089,12396,1,172,1,0),(2090,12397,1,172,2,0),(2091,12398,1,172,3,0),(2092,12399,1,172,4,0),(2093,12400,1,172,5,0),(2117,7506,1,259,1,0),(2118,7507,1,259,2,0),(2119,7508,1,259,3,0),(2120,7509,1,259,4,0),(2121,7510,1,259,5,0),(2122,12401,1,259,1,0),(2123,12402,1,259,2,0),(2124,12403,1,259,3,0),(2125,12404,1,259,4,0),(2126,12405,1,259,5,0),(2127,1389,1,328,50,0),(2128,1390,1,328,100,0),(2129,1391,1,328,150,0),(2130,1392,1,328,200,0),(2131,1393,1,328,250,0),(2132,4683,1,328,50,0),(2133,4684,1,328,100,0),(2134,4685,1,328,150,0),(2135,4686,1,328,200,0),(2136,4687,1,328,250,0),(2137,6523,1,328,50,0),(2138,6524,1,328,100,0),(2139,6525,1,328,150,0),(2140,6526,1,328,200,0),(2141,6527,1,328,250,0),(2142,7511,1,328,50,0),(2143,7512,1,328,100,0),(2144,7513,1,328,150,0),(2145,7514,1,328,200,0),(2146,7515,1,328,250,0),(2147,1056,1,317,1,0),(2148,1057,1,317,2,0),(2149,1058,1,317,3,0),(2150,1059,1,317,4,0),(2151,1060,1,317,5,0),(2157,6431,1,317,1,0),(2158,6432,1,317,2,0),(2159,6433,1,317,3,0),(2160,6434,1,317,4,0),(2161,6435,1,317,5,0),(2329,6119,1,69,500,0),(2343,7526,1,317,1,0),(2172,12406,1,69,500,0),(2173,12407,1,69,500,0),(2174,12408,1,69,500,0),(2175,12409,1,69,500,0),(2176,12410,1,69,500,0),(2177,7516,1,262,10,7),(2178,7516,2,262,10,8),(2179,7516,3,262,10,9),(2180,7516,4,262,10,10),(2181,7516,5,262,10,11),(2182,7517,1,262,20,7),(2183,7517,2,262,20,8),(2184,7517,3,262,20,9),(2185,7517,4,262,20,10),(2186,7517,5,262,20,11),(2187,7518,1,262,30,7),(2188,7518,2,262,30,8),(2189,7518,3,262,30,9),(2190,7518,4,262,30,10),(2191,7518,5,262,30,11),(2192,7519,1,262,40,7),(2193,7519,2,262,40,8),(2194,7519,3,262,40,9),(2195,7519,4,262,40,10),(2196,7519,5,262,40,11),(2197,7520,1,262,50,7),(2198,7520,2,262,50,8),(2199,7520,3,262,50,9),(2200,7520,4,262,50,10),(2201,7520,5,262,50,11),(2202,6521,1,327,1,0),(2203,6522,1,327,2,0),(2204,7539,1,327,1,0),(2205,7540,1,327,2,0),(2206,7541,1,327,3,0),(2207,7542,1,327,4,0),(2208,7543,1,327,5,0),(2209,5045,1,180,5,0),(2210,8228,1,378,5,22),(2211,8229,1,378,10,22),(2212,8230,1,378,15,22),(2213,7050,1,265,62,0),(2214,7051,1,265,64,0),(2215,7052,1,265,66,0),(2216,7053,1,265,67,0),(2217,7054,1,265,68,0),(2218,7055,1,265,69,0),(2219,7063,1,265,70,0),(2220,7064,1,265,71,0),(2221,7065,1,265,72,0),(2222,7622,1,265,74,0),(2223,7623,1,265,76,0),(2224,7624,1,265,79,0),(2300,581,9,254,0,0),(2301,581,10,254,0,0),(2302,581,11,254,0,0),(2303,582,1,267,1,4),(2304,582,2,267,1,8),(2305,582,3,267,1,5),(2306,582,4,267,1,2),(2307,582,5,267,1,7),(2308,582,6,267,1,6),(2309,582,7,267,1,9),(2310,582,8,267,1,12),(2311,582,9,267,1,11),(2312,582,10,267,1,28),(2313,582,11,267,1,1),(2314,1086,1,274,2,0),(2315,1087,1,274,4,0),(2316,1088,1,274,6,0),(2330,6120,1,69,500,0),(2331,6121,1,69,500,0),(2332,6122,1,69,500,0),(2333,6123,1,69,500,0),(2334,7527,1,69,500,0),(2335,7528,1,69,500,0),(2336,7529,1,69,500,0),(2337,7530,1,69,500,0),(2338,7531,1,69,500,0),(2339,7522,1,317,1,0),(2340,7523,1,317,1,0),(2341,7524,1,317,1,0),(2342,7525,1,317,1,0),(2345,8232,2,138,1,0),(2346,8232,3,140,1,0),(2347,8232,4,311,0,0),(2348,8232,5,411,66434,0),(2349,8232,6,137,-40,0),(2351,8233,2,138,1,0),(2352,8233,3,140,1,0),(2353,8233,4,311,0,0),(2354,8233,5,411,66434,0),(2355,8233,6,137,-40,0),(2357,8234,2,138,1,0),(2358,8234,3,140,1,0),(2359,8234,4,311,0,0),(2360,8234,5,411,66434,0),(2361,8234,6,137,-40,0),(2363,8261,2,138,1,0),(2364,8261,3,140,1,0),(2365,8261,4,311,0,0),(2366,8261,5,411,66434,0),(2367,8261,6,137,-40,0),(2368,1230,1,313,15,0),(2369,1231,1,313,20,0),(2370,1232,1,313,25,0),(2371,5000,1,313,50,0),(2372,5001,1,313,75,0),(2373,5002,1,313,100,0),(2374,997,1,331,5,0),(2375,998,1,331,15,0),(2376,999,1,331,25,0),(2377,226,1,272,2,0),(2378,227,1,272,3,0),(2379,275,1,260,2,50),(2380,276,1,260,4,50),(2381,277,1,260,6,50),(2382,701,1,260,8,50),(2383,213,1,260,2,23),(2384,213,2,260,2,24),(2385,213,3,260,2,25),(2386,213,4,260,2,26),(2387,214,1,260,4,23),(2388,214,2,260,4,24),(2389,214,3,260,4,25),(2390,214,4,260,4,26),(2391,215,1,260,6,23),(2392,215,2,260,6,24),(2393,215,3,260,6,25),(2394,215,4,260,6,26),(2395,700,1,260,2,23),(2396,700,2,260,2,24),(2397,700,3,260,2,25),(2398,700,4,260,2,26),(2399,695,1,247,10,53),(2400,696,1,247,20,53),(2401,697,1,247,30,53),(2402,698,1,247,40,53),(2403,699,1,247,50,53),(2404,762,1,247,10,53),(2405,764,1,247,30,53),(2406,763,1,247,20,53),(2407,765,1,247,40,53),(2408,766,1,247,50,53),(2409,412,1,263,1,0),(2410,413,1,263,2,0),(2411,414,1,263,3,0),(2412,415,1,263,4,0),(2413,416,1,263,5,0),(2414,417,1,263,6,0),(2415,68,1,233,110,0),(2416,69,1,233,125,0),(2417,70,1,233,150,0),(2418,5535,1,266,3,0),(228,367,1,46,12,0),(2419,858,1,220,50,10),(2420,859,1,220,75,10),(2437,606,1,285,20,0),(2438,607,1,285,40,0),(2439,608,1,285,60,0),(2440,609,1,285,80,0),(2441,610,1,285,100,0),(2442,895,1,59,-3,0),(2443,896,1,59,-6,0),(2444,897,1,59,-9,0),(2445,898,1,59,-12,0),(2446,899,1,59,-15,0),(2447,571,1,261,1,0),(2448,572,1,261,2,0),(2449,573,1,261,3,0),(2450,707,1,261,1,0),(2451,708,1,261,2,0),(2452,709,1,261,3,0),(2453,86,1,128,5,5),(2454,86,2,138,1,0),(2455,86,3,140,1,0),(2456,86,4,139,-2741,0),(2457,86,5,139,-16843,0),(2458,86,6,385,-16192,0),(2459,87,1,128,15,15),(2460,87,2,138,1,0),(2461,87,3,140,1,0),(2462,87,4,139,-2741,0),(2463,87,5,139,-16843,0),(2464,87,6,385,-16192,0),(2465,88,1,128,30,30),(2466,88,2,138,1,0),(2467,88,3,140,1,0),(2468,88,4,139,-2741,0),(2469,88,5,139,-16843,0),(2470,88,6,385,-16192,0),(2471,266,1,128,50,50),(2472,266,2,138,1,0),(2473,266,3,140,1,0),(2474,266,4,139,-2741,0),(2475,266,5,139,-16843,0),(2476,266,6,385,-16192,0),(2477,781,1,287,1,1),(2478,781,2,137,31,0),(2479,781,3,136,5,0),(2480,230,1,275,10,0),(2481,231,1,275,25,0),(2482,232,1,275,50,0),(2483,539,1,275,15,0),(2484,540,1,275,25,0),(2485,541,1,275,35,0),(2489,589,1,303,200,0),(2490,589,2,139,2766,0),(2492,590,2,139,2766,0),(2494,591,2,139,2766,0),(2495,893,1,303,800,0),(2496,893,2,139,2766,0),(2497,894,1,303,1000,0),(2498,894,2,139,2766,0),(2499,560,1,225,15,0),(2500,561,1,177,3,0),(2501,888,1,250,10,0),(2502,889,1,250,20,0),(2503,890,1,250,30,0),(2504,891,1,250,40,0),(2505,892,1,250,50,0),(2506,180,1,241,95,0),(2507,644,1,217,0,32000),(2508,644,2,346,46,0),(2509,1604,1,439,0,32000),(2510,1604,2,345,48,0),(2511,1605,1,439,0,32000),(2512,1605,2,345,51,0),(2513,1606,1,439,0,32000),(2514,1606,2,345,53,0),(2518,120,2,440,52,200),(2519,121,1,278,500,32000),(2520,121,2,440,54,200),(2521,158,1,238,1,0),(2522,818,1,279,17,0),(2523,819,1,279,19,0),(2524,691,1,248,100,0),(2525,4698,1,362,1,0),(2526,6545,1,362,1,0); + +DROP TABLE IF EXISTS `aa_required_level_cost`; +CREATE TABLE `aa_required_level_cost` ( + `skill_id` int(10) unsigned NOT NULL, + `level` int(10) unsigned NOT NULL, + `cost` int(10) unsigned NOT NULL DEFAULT '0', + `description` varchar(64) DEFAULT NULL COMMENT 'For reference only', + PRIMARY KEY (`skill_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO `aa_required_level_cost` VALUES (7800,1,0,'Harm Touch'),(7801,6,0,'Harm Touch'),(7802,11,0,'Harm Touch'),(7803,16,0,'Harm Touch'),(7804,21,0,'Harm Touch'),(7805,26,0,'Harm Touch'),(7806,31,0,'Harm Touch'),(7807,36,0,'Harm Touch'),(7808,41,0,'Harm Touch'),(7809,46,0,'Harm Touch'),(7810,51,3,'Harm Touch'),(7811,56,4,'Harm Touch'),(7812,61,5,'Harm Touch'),(7813,66,6,'Harm Touch'),(7814,71,7,'Harm Touch'),(7815,76,8,'Harm Touch'),(7816,81,8,'Harm Touch'),(7817,83,9,'Harm Touch'),(7850,5,0,'Lay on Hands'),(7851,11,0,'Lay on Hands'),(7852,16,0,'Lay on Hands'),(7853,21,0,'Lay on Hands'),(7854,26,0,'Lay on Hands'),(7855,31,0,'Lay on Hands'),(7856,36,0,'Lay on Hands'),(7857,41,0,'Lay on Hands'),(7858,46,0,'Lay on Hands'),(7859,51,0,'Lay on Hands'),(7860,56,3,'Lay on Hands'),(7861,61,4,'Lay on Hands'),(7862,66,5,'Lay on Hands'),(7863,71,6,'Lay on Hands'),(7864,76,7,'Lay on Hands'),(7865,81,8,'Lay on Hands'),(7866,85,9,'Lay on Hands'),(593,61,2,'Fervent Blessing'),(594,63,4,'Fervent Blessing'),(595,65,6,'Fervent Blessing'),(292,61,1,'Advanced Innate Strength'),(293,61,1,'Advanced Innate Strength'),(294,62,1,'Advanced Innate Strength'),(295,62,1,'Advanced Innate Strength'),(296,63,1,'Advanced Innate Strength'),(297,63,1,'Advanced Innate Strength'),(298,64,1,'Advanced Innate Strength'),(299,64,1,'Advanced Innate Strength'),(300,65,1,'Advanced Innate Strength'),(301,65,1,'Advanced Innate Strength'),(302,61,1,'Advanced Innate Stamina'),(303,61,1,'Advanced Innate Stamina'),(304,62,1,'Advanced Innate Stamina'),(305,62,1,'Advanced Innate Stamina'),(306,63,1,'Advanced Innate Stamina'),(307,63,1,'Advanced Innate Stamina'),(308,64,1,'Advanced Innate Stamina'),(309,64,1,'Advanced Innate Stamina'),(310,65,1,'Advanced Innate Stamina'),(311,65,1,'Advanced Innate Stamina'),(312,61,1,'Advanced Innate Agility'),(313,61,1,'Advanced Innate Agility'),(314,62,1,'Advanced Innate Agility'),(315,62,1,'Advanced Innate Agility'),(316,63,1,'Advanced Innate Agility'),(317,63,1,'Advanced Innate Agility'),(318,64,1,'Advanced Innate Agility'),(319,64,1,'Advanced Innate Agility'),(320,65,1,'Advanced Innate Agility'),(321,65,1,'Advanced Innate Agility'),(322,61,1,'Advanced Innate Dexterity'),(323,61,1,'Advanced Innate Dexterity'),(324,62,1,'Advanced Innate Dexterity'),(325,62,1,'Advanced Innate Dexterity'),(326,63,1,'Advanced Innate Dexterity'),(327,63,1,'Advanced Innate Dexterity'),(328,64,1,'Advanced Innate Dexterity'),(329,64,1,'Advanced Innate Dexterity'),(330,65,1,'Advanced Innate Dexterity'),(331,65,1,'Advanced Innate Dexterity'),(332,61,1,'Advanced Innate Intelligence'),(333,61,1,'Advanced Innate Intelligence'),(334,62,1,'Advanced Innate Intelligence'),(335,62,1,'Advanced Innate Intelligence'),(336,63,1,'Advanced Innate Intelligence'),(337,63,1,'Advanced Innate Intelligence'),(338,64,1,'Advanced Innate Intelligence'),(339,64,1,'Advanced Innate Intelligence'),(340,65,1,'Advanced Innate Intelligence'),(341,65,1,'Advanced Innate Intelligence'),(342,61,1,'Advanced Innate Wisdom'),(343,61,1,'Advanced Innate Wisdom'),(344,62,1,'Advanced Innate Wisdom'),(345,62,1,'Advanced Innate Wisdom'),(346,63,1,'Advanced Innate Wisdom'),(347,63,1,'Advanced Innate Wisdom'),(348,64,1,'Advanced Innate Wisdom'),(349,64,1,'Advanced Innate Wisdom'),(350,65,1,'Advanced Innate Wisdom'),(351,65,1,'Advanced Innate Wisdom'),(352,61,1,'Advanced Innate Charisma'),(353,61,1,'Advanced Innate Charisma'),(354,62,1,'Advanced Innate Charisma'),(355,62,1,'Advanced Innate Charisma'),(356,63,1,'Advanced Innate Charisma'),(357,63,1,'Advanced Innate Charisma'),(358,64,1,'Advanced Innate Charisma'),(359,64,1,'Advanced Innate Charisma'),(360,65,1,'Advanced Innate Charisma'),(361,65,1,'Advanced Innate Charisma'),(362,61,1,'Warding of Solusek'),(363,61,1,'Warding of Solusek'),(364,62,1,'Warding of Solusek'),(365,62,1,'Warding of Solusek'),(366,63,1,'Warding of Solusek'),(367,63,1,'Warding of Solusek'),(368,64,1,'Warding of Solusek'),(369,64,1,'Warding of Solusek'),(370,65,1,'Warding of Solusek'),(371,65,1,'Warding of Solusek'),(372,61,1,'Blessing of E\'ci'),(373,61,1,'Blessing of E\'ci'),(374,62,1,'Blessing of E\'ci'),(375,62,1,'Blessing of E\'ci'),(376,63,1,'Blessing of E\'ci'),(377,63,1,'Blessing of E\'ci'),(378,64,1,'Blessing of E\'ci'),(379,64,1,'Blessing of E\'ci'),(380,65,1,'Blessing of E\'ci'),(381,65,1,'Blessing of E\'ci'),(382,61,1,'Marr\'s Protection'),(383,61,1,'Marr\'s Protection'),(384,62,1,'Marr\'s Protection'),(385,62,1,'Marr\'s Protection'),(386,63,1,'Marr\'s Protection'),(387,63,1,'Marr\'s Protection'),(388,64,1,'Marr\'s Protection'),(389,64,1,'Marr\'s Protection'),(390,65,1,'Marr\'s Protection'),(391,65,1,'Marr\'s Protection'),(392,61,1,'Shroud of the Faceless'),(393,61,1,'Shroud of the Faceless'),(394,62,1,'Shroud of the Faceless'),(395,62,1,'Shroud of the Faceless'),(396,63,1,'Shroud of the Faceless'),(397,63,1,'Shroud of the Faceless'),(398,64,1,'Shroud of the Faceless'),(399,64,1,'Shroud of the Faceless'),(400,65,1,'Shroud of the Faceless'),(401,65,1,'Shroud of the Faceless'),(402,61,1,'Bertoxxulous\' Gift'),(403,61,1,'Bertoxxulous\' Gift'),(404,62,1,'Bertoxxulous\' Gift'),(405,62,1,'Bertoxxulous\' Gift'),(406,63,1,'Bertoxxulous\' Gift'),(407,63,1,'Bertoxxulous\' Gift'),(408,64,1,'Bertoxxulous\' Gift'),(409,64,1,'Bertoxxulous\' Gift'),(410,65,1,'Bertoxxulous\' Gift'),(411,65,1,'Bertoxxulous\' Gift'),(418,61,2,'Planar Power'),(419,62,2,'Planar Power'),(420,63,2,'Planar Power'),(421,64,2,'Planar Power'),(422,65,2,'Planar Power'),(423,61,3,'Planar Durability'),(424,63,3,'Planar Durability'),(425,65,3,'Planar Durability'),(426,61,3,'Innate Enlightenment'),(427,62,3,'Innate Enlightenment'),(428,63,3,'Innate Enlightenment'),(429,64,3,'Innate Enlightenment'),(430,65,3,'Innate Enlightenment'),(434,62,2,'Advanced Healing Adept'),(435,63,4,'Advanced Healing Adept'),(436,64,6,'Advanced Healing Adept'),(437,62,2,'Advanced Healing Gift'),(438,63,4,'Advanced Healing Gift'),(439,64,6,'Advanced Healing Gift'),(440,62,2,'Coup de Grace'),(441,63,2,'Coup de Grace'),(442,64,2,'Coup de Grace'),(443,62,3,'Fury of the Ages'),(444,63,3,'Fury of the Ages'),(445,64,3,'Fury of the Ages'),(446,62,3,'Mastery of the Past'),(447,63,3,'Mastery of the Past'),(448,64,3,'Mastery of the Past'),(449,61,3,'Lightning Reflexes'),(7539,80,5,'Mystical Attuning III'),(1025,65,5,'Mystical Attuning'),(1024,65,5,'Mystical Attuning'),(1023,60,5,'Mystical Attuning'),(7540,85,5,'Mystical Attuning III'),(7541,85,5,'Mystical Attuning III'),(459,61,2,'Radiant Cure'),(460,63,4,'Radiant Cure'),(461,65,6,'Radiant Cure'),(462,63,2,'Hastened Divinity'),(463,64,2,'Hastened Divinity'),(464,65,2,'Hastened Divinity'),(468,63,2,'Hastened Purification of the Soul'),(469,64,2,'Hastened Purification of the Soul'),(470,65,2,'Hastened Purification of the Soul'),(471,63,2,'Hastened Gathering'),(472,64,2,'Hastened Gathering'),(473,65,2,'Hastened Gathering'),(474,63,2,'Hastened Rabidity'),(475,64,2,'Hastened Rabidity'),(476,65,2,'Hastened Rabidity'),(477,63,2,'Hastened Exodus'),(478,64,2,'Hastened Exodus'),(479,65,2,'Hastened Exodus'),(480,63,2,'Hastened Root'),(481,64,2,'Hastened Root'),(482,65,2,'Hastened Root'),(483,63,2,'Hastened Mending'),(484,64,2,'Hastened Mending'),(485,65,2,'Hastened Mending'),(486,63,2,'Hastened Banishment'),(487,64,4,'Hastened Banishment'),(488,65,6,'Hastened Banishment'),(489,63,2,'Hastened Instigation'),(490,64,2,'Hastened Instigation'),(491,65,2,'Hastened Instigation'),(492,63,2,'Furious Rampage'),(493,64,2,'Furious Rampage'),(494,65,2,'Furious Rampage'),(495,63,2,'Hastened Purification of the Body'),(496,64,2,'Hastened Purification of the Body'),(497,65,2,'Hastened Purification of the Body'),(498,63,2,'Hasty Exit'),(499,64,2,'Hasty Exit'),(500,65,2,'Hasty Exit'),(501,63,2,'Hastened Purification'),(502,64,2,'Hastened Purification'),(503,65,2,'Hastened Purification'),(504,62,3,'Flash of Steel'),(505,63,3,'Flash of Steel'),(506,64,3,'Flash of Steel'),(507,61,3,'Divine Arbitration'),(508,63,3,'Divine Arbitration'),(509,65,3,'Divine Arbitration'),(510,61,3,'Wrath of the Wild'),(511,63,3,'Wrath of the Wild'),(512,65,3,'Wrath of the Wild'),(513,61,3,'Virulent Paralysis'),(514,63,3,'Virulent Paralysis'),(515,65,3,'Virulent Paralysis'),(517,61,3,'Eldritch Rune'),(518,63,3,'Eldritch Rune'),(519,65,3,'Eldritch Rune'),(520,61,3,'Servant of Ro'),(521,63,3,'Servant of Ro'),(522,65,3,'Servant of Ro'),(523,61,3,'Wake the Dead'),(524,63,2,'Wake the Dead'),(525,65,1,'Wake the Dead'),(526,62,5,'Suspended Minion'),(527,64,3,'Suspended Minion'),(528,61,4,'Spirit Call'),(529,63,3,'Spirit Call'),(530,65,2,'Spirit Call'),(531,63,3,'Celestial Renewal'),(532,64,6,'Celestial Renewal'),(534,61,3,'Hand of Piety'),(535,63,3,'Hand of Piety'),(536,65,3,'Hand of Piety'),(537,63,3,'Mithaniel\'s Binding'),(538,64,3,'Mithaniel\'s Binding'),(539,63,2,'Mending of the Tranquil'),(540,64,4,'Mending of the Tranquil'),(541,65,6,'Mending of the Tranquil'),(542,63,2,'Raging Flurry'),(543,64,4,'Raging Flurry'),(544,65,6,'Raging Flurry'),(545,61,3,'Guardian of the Forest'),(546,63,3,'Guardian of the Forest'),(547,65,3,'Guradian of the Forest'),(548,61,4,'Spirit of the Wood'),(549,63,3,'Spirit of the Wood'),(550,65,2,'Spirit of the Wood'),(551,61,2,'Bestial Frenzy'),(552,62,2,'Bestial Frenzy'),(553,63,2,'Bestial Frenzy'),(554,64,2,'Bestial Frenzy'),(555,65,2,'Bestial Frenzy'),(556,61,2,'Harmonious Attack'),(557,62,2,'Harmonious Attack'),(558,63,2,'Harmonious Attack'),(559,64,2,'Harmonious Attack'),(560,65,2,'Harmonious Attack'),(561,61,2,'Knight\'s Advantage'),(562,63,4,'Knight\'s Advantage'),(563,65,6,'Knight\'s Advantage'),(564,61,3,'Ferocity'),(565,63,3,'Ferocity'),(566,65,3,'Ferocity'),(568,63,2,'Sionachie\'s Crescendo'),(569,64,2,'Sionachie\'s Crescendo'),(570,65,2,'Sionachie\'s Crescendo'),(571,63,2,'Ayonae\'s Tutelage'),(572,64,2,'Ayonae\'s Tutelage'),(573,65,2,'Ayonae\'s Tutelage'),(574,61,3,'Feigned Minion'),(575,63,3,'Feigned Minion'),(576,65,3,'Feigned Minion'),(577,61,2,'Unfailing Divinity'),(578,63,4,'Unfailing Divinity'),(579,65,6,'Unfailing Divinity'),(580,61,4,'Animation Empathy'),(581,63,3,'Animation Empathy'),(582,65,2,'Animation Empathy'),(583,63,2,'Rush to Judgment'),(584,64,2,'Rush to Judgment'),(585,65,2,'Rush to Judgment'),(586,61,2,'Living Shield'),(587,63,4,'Living Shield'),(588,65,6,'Living Shield'),(589,61,3,'Consumption of the Soul'),(590,63,3,'Consumption of the Soul'),(591,65,3,'Consumption of the Soul'),(596,61,2,'Touch of the Wicked'),(597,63,2,'Touch of the Wicked'),(598,65,2,'Touch of the Wicked'),(599,61,2,'Punishing Blade'),(600,63,4,'Punishing Blade'),(601,65,6,'Punishing Blade'),(602,61,3,'Speed of the Knight'),(603,63,3,'Speed of the Knight'),(604,65,3,'Speed of the Knight'),(606,61,1,'Nimble Evasion'),(607,62,1,'Nimble Evasion'),(608,63,1,'Nimble Evasion'),(609,64,1,'Nimble Evasion'),(610,65,1,'Nimble Evasion'),(616,63,5,'Host of the Elements'),(617,64,4,'Host of the Elements'),(618,65,3,'Host of the Elements'),(619,61,3,'Call of Xuzl'),(620,63,2,'Call of Xuzl'),(621,65,1,'Call of Xuzl'),(622,61,3,'Hastened Stealth'),(623,62,3,'Hastened Stealth'),(624,63,3,'Hastened Stealth'),(625,61,1,'Ingenuity'),(626,63,2,'Ingenuity'),(627,65,3,'Ingenuity'),(628,62,2,'Fleet of Foot'),(629,64,4,'Fleet of Foot'),(631,61,2,'Tactical Mastery'),(632,63,3,'Tactical Mastery'),(633,65,4,'Tactical Mastery'),(646,61,2,'Unholy Touch'),(647,63,4,'Unholy Touch'),(648,65,6,'Unholy Touch'),(652,61,2,'Stalwart Endurance'),(1022,55,5,'Mystical Attuning'),(1021,51,5,'Mystical Attuning'),(7542,85,5,'Mystical Attuning III'),(7543,85,5,'Mystical Attuning III'); + +DROP TABLE IF EXISTS `altadv_vars`; +CREATE TABLE `altadv_vars` ( + `skill_id` int(11) NOT NULL DEFAULT '0', + `name` varchar(128) DEFAULT NULL, + `cost` int(11) DEFAULT NULL, + `max_level` int(11) DEFAULT NULL, + `hotkey_sid` int(10) unsigned NOT NULL DEFAULT '0', + `hotkey_sid2` int(10) unsigned NOT NULL DEFAULT '0', + `title_sid` int(10) unsigned NOT NULL DEFAULT '0', + `desc_sid` int(10) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '1', + `spellid` int(10) unsigned NOT NULL DEFAULT '0', + `prereq_skill` int(10) unsigned NOT NULL DEFAULT '0', + `prereq_minpoints` int(10) unsigned NOT NULL DEFAULT '0', + `spell_type` int(10) unsigned NOT NULL DEFAULT '0', + `spell_refresh` int(10) unsigned NOT NULL DEFAULT '0', + `classes` int(10) unsigned NOT NULL DEFAULT '65534', + `berserker` int(10) unsigned NOT NULL DEFAULT '0', + `class_type` int(10) unsigned NOT NULL DEFAULT '0', + `cost_inc` tinyint(4) NOT NULL DEFAULT '0', + `aa_expansion` smallint(3) unsigned NOT NULL DEFAULT '3', + `special_category` int(10) unsigned NOT NULL DEFAULT '4294967295', + `sof_type` tinyint(3) unsigned NOT NULL DEFAULT '1', + `sof_cost_inc` tinyint(3) NOT NULL DEFAULT '0', + `sof_max_level` tinyint(3) unsigned NOT NULL DEFAULT '1', + `sof_next_skill` int(10) unsigned NOT NULL DEFAULT '0', + `clientver` tinyint(3) unsigned NOT NULL DEFAULT '1', + `account_time_required` int(10) unsigned NOT NULL DEFAULT '0', + `sof_current_level` tinyint(3) unsigned NOT NULL DEFAULT '0', + `sof_next_id` int(10) unsigned NOT NULL DEFAULT '0', + `level_inc` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`skill_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `altadv_vars` VALUES (2,'Innate Strength',1,5,4294967295,4294967295,13500,13501,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,2,1,0,0,292,0),(7,'Innate Stamina',1,5,4294967295,4294967295,13502,13503,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,7,1,0,0,302,0),(12,'Innate Agility',1,5,4294967295,4294967295,13504,13505,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,12,1,0,0,312,0),(17,'Innate Dexterity',1,5,4294967295,4294967295,13506,13507,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,17,1,0,0,322,0),(22,'Innate Intelligence',1,5,4294967295,4294967295,13508,13509,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,22,1,0,0,332,0),(27,'Innate Wisdom',1,5,4294967295,4294967295,13510,13511,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,27,1,0,0,342,0),(32,'Innate Charisma',1,5,4294967295,4294967295,13512,13513,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,32,1,0,0,352,0),(37,'Innate Fire Protection',1,5,4294967295,4294967295,13514,13515,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,37,1,0,0,362,0),(42,'Innate Cold Protection',1,5,4294967295,4294967295,13516,13517,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,42,1,0,0,372,0),(47,'Innate Magic Protection',1,5,4294967295,4294967295,13518,13519,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,47,1,0,0,382,0),(52,'Innate Poison Protection',1,5,4294967295,4294967295,13520,13521,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,52,1,0,0,392,0),(57,'Innate Disease Protection',1,5,4294967295,4294967295,13522,13523,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,15,57,1,0,0,402,0),(62,'Innate Run Speed',1,3,4294967295,4294967295,13524,13525,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,5,62,1,0,0,672,0),(65,'Innate Regeneration',1,3,4294967295,4294967295,13526,13527,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,5,65,1,0,0,674,0),(68,'Innate Metabolism',1,3,4294967295,4294967295,13528,13529,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,3,68,1,0,0,0,0),(71,'Innate Lung Capacity',1,3,4294967295,4294967295,13530,13531,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,6,71,1,0,0,676,0),(74,'First Aid',1,3,4294967295,4294967295,13532,13533,1,4294967295,0,0,0,0,65534,1,51,0,3,4294967295,1,0,6,74,1,0,0,263,0),(77,'Healing Adept',2,3,4294967295,4294967295,13534,13535,2,4294967295,4294967295,0,0,0,33884,0,55,2,3,4294967295,2,0,12,77,1,0,0,434,0),(80,'Healing Gift',2,3,4294967295,4294967295,13536,13537,2,4294967295,4294967295,0,0,0,33884,0,55,2,3,4294967295,2,0,21,80,1,0,0,437,0),(83,'Spell Casting Mastery',2,3,4294967295,4294967295,13538,13539,2,4294967295,4294967295,0,0,0,31812,0,55,2,3,4294967295,2,0,3,83,1,0,0,0,0),(86,'Spell Casting Reinforcement',2,3,4294967295,4294967295,13540,13541,2,4294967295,4294967295,0,0,0,50268,0,55,2,3,4294967295,2,0,3,86,1,0,0,0,0),(89,'Mental Clarity',2,3,4294967295,4294967295,13542,13543,2,4294967295,4294967295,0,0,0,64892,0,55,2,3,4294967295,2,0,3,89,1,0,0,0,0),(92,'Spell Casting Fury',2,3,4294967295,4294967295,13544,13545,2,4294967295,0,0,0,0,64892,0,55,2,3,4294967295,2,0,3,92,1,0,0,0,0),(95,'Channeling Focus',2,3,4294967295,4294967295,13546,13547,2,4294967295,4294967295,0,0,0,64892,0,55,2,3,4294967295,2,0,3,95,1,0,0,0,0),(98,'Spell Casting Subtlety',2,3,4294967295,4294967295,13548,13549,2,0,0,0,0,0,30976,0,55,2,3,4294967295,2,0,3,98,1,0,0,0,0),(101,'Spell Casting Expertise',2,3,4294967295,4294967295,13550,13551,2,4294967295,4294967295,0,0,0,31008,0,55,2,3,4294967295,2,0,3,101,1,0,0,0,0),(104,'Spell Casting Deftness',2,3,4294967295,4294967295,13552,13553,2,4294967295,4294967295,0,0,0,14368,0,55,2,3,4294967295,2,0,3,104,1,0,0,0,0),(107,'Natural Durability',2,3,4294967295,4294967295,13554,13555,2,4294967295,4294967295,0,0,0,65534,1,55,2,3,4294967295,1,0,3,107,1,0,0,0,0),(110,'Natural Healing',2,3,4294967295,4294967295,13556,13557,2,4294967295,4294967295,0,0,0,33722,1,55,2,3,4294967295,2,0,8,110,1,0,0,1031,0),(113,'Combat Fury',2,3,4294967295,4294967295,13558,13559,2,4294967295,4294967295,0,0,0,33722,1,55,2,3,4294967295,2,0,6,113,1,0,0,443,0),(116,'Fear Resistance',2,3,4294967295,4294967295,13560,13561,2,4294967295,4294967295,0,0,0,33722,1,55,2,3,4294967295,2,0,3,116,1,0,0,0,0),(119,'Finishing Blow',2,3,4294967295,4294967295,13562,13563,2,4294967295,0,0,0,0,33722,1,55,2,3,4294967295,2,0,21,119,1,0,0,440,0),(122,'Combat Stability',2,3,4294967295,4294967295,13564,13565,2,4294967295,4294967295,0,0,0,65534,1,55,2,3,4294967295,1,0,33,122,1,0,0,454,0),(125,'Combat Agility',2,3,4294967295,4294967295,13566,13567,2,4294967295,4294967295,0,0,0,65534,1,55,2,3,4294967295,1,0,33,125,1,0,0,449,0),(128,'Mass Group Buff',9,1,13811,13812,13809,13810,3,5228,4294967295,0,1,4320,60508,0,59,0,3,4294967295,3,0,1,128,1,0,0,0,0),(129,'Divine Resurrection',5,1,13570,13571,13568,13569,3,2738,80,3,2,259200,4,0,59,0,3,4294967295,3,0,1,129,1,0,0,0,0),(130,'Innate Invis to Undead',3,1,13574,13575,13572,13573,3,235,4294967295,0,3,7,2052,0,59,0,3,4294967295,3,0,1,130,1,0,1,0,0),(131,'Celestial Regeneration',5,1,13578,13579,13576,13577,3,2740,80,3,4,4320,4,0,59,0,3,4294967295,3,0,3,131,1,0,0,531,0),(132,'Bestow Divine Aura',6,1,13582,13583,13580,13581,3,2741,4294967295,0,5,8640,4,0,59,0,3,4294967295,3,0,1,132,1,0,0,0,0),(133,'Turn Undead',3,3,13586,13587,13584,13585,3,2776,4294967295,0,6,4320,4,0,59,3,3,4294967295,3,0,3,133,1,0,0,0,0),(136,'Purify Soul',5,1,13590,4294967295,13588,13589,3,2742,4294967295,0,7,4320,4,0,59,0,3,4294967295,3,0,1,136,1,0,0,0,0),(137,'Quick Evacuation',3,3,4294967295,4294967295,13592,13593,3,4294967295,4294967295,0,0,0,4160,0,59,3,3,4294967295,3,0,3,137,1,0,0,0,0),(140,'Exodus',6,1,13596,4294967295,13594,13595,3,2771,4294967295,0,3,4320,4160,0,59,0,3,4294967295,3,0,1,140,1,0,0,0,0),(141,'Quick Damage',3,3,4294967295,4294967295,13598,13599,3,4294967295,92,3,0,0,12352,0,59,3,3,4294967295,3,0,3,141,1,0,0,0,0),(144,'Enhanced Root',5,1,4294967295,4294967295,13600,13601,3,4294967295,4294967295,0,0,0,64,0,59,0,3,4294967295,3,0,1,144,1,0,0,0,0),(145,'Dire Charm',9,1,13604,13605,13602,13603,3,4294967295,4294967295,0,15,4320,18496,0,59,0,3,4294967295,3,0,1,145,1,0,0,0,0),(146,'Cannibalization',5,1,13608,13609,13606,13607,3,2749,89,3,2,180,1024,0,59,0,3,4294967295,3,0,1,146,1,0,0,0,0),(147,'Quick Buff',3,3,4294967295,4294967295,13610,13611,3,4294967295,4294967295,0,0,0,17408,0,59,3,3,4294967295,3,0,3,147,1,0,0,0,0),(150,'Alchemy Mastery',3,3,4294967295,4294967295,13612,13613,3,4294967295,4294967295,0,0,0,1024,0,59,3,3,4294967295,3,0,3,150,1,0,0,0,0),(153,'Rabid Bear',5,1,13616,13617,13614,13615,3,2750,4294967295,0,3,7200,1024,0,59,0,3,4294967295,3,0,1,153,1,0,0,0,0),(154,'Mana Burn',5,1,13620,13621,13618,13619,3,2751,89,3,7,7200,4096,0,59,0,3,4294967295,3,0,1,154,1,0,0,0,0),(155,'Improved Familiar',9,1,13624,13625,13622,13623,3,2758,0,0,8,420,4096,0,59,0,3,4294967295,3,0,2,155,1,0,0,533,0),(156,'Nexus Gate',6,1,13628,13629,13626,13627,3,2734,4294967295,0,2,4320,4096,0,59,0,3,4294967295,3,0,1,156,1,0,0,0,0),(158,'Permanent Illusion',3,1,4294967295,4294967295,13630,13631,3,4294967295,4294967295,0,0,0,16384,0,59,0,3,4294967295,3,0,1,158,1,0,0,0,0),(159,'Jewelcraft Mastery',3,3,4294967295,4294967295,13632,13633,3,4294967295,4294967295,0,0,0,16384,0,59,3,3,4294967295,3,0,3,159,1,0,0,0,0),(162,'Gather Mana',5,1,13636,13637,13634,13635,3,2753,89,3,3,8640,16384,0,59,0,3,4294967295,3,0,1,162,1,0,0,0,0),(163,'Mend Companion',5,1,13640,13641,13638,13639,3,2752,4294967295,0,2,2160,43008,0,59,0,3,4294967295,3,0,1,163,1,0,0,0,0),(164,'Quick Summoning',3,3,4294967295,4294967295,13642,13643,3,4294967295,4294967295,0,0,0,8192,0,59,3,3,4294967295,3,0,3,164,1,0,0,0,0),(167,'Frenzied Burnout',6,1,13646,13647,13644,13645,3,2754,4294967295,0,14,900,8192,0,59,0,3,4294967295,3,0,1,167,1,0,0,0,0),(168,'Elemental Form: Fire',3,3,13650,13651,13648,13649,3,2795,4294967295,0,4,900,8192,0,59,3,3,4294967295,3,0,3,168,1,0,0,0,0),(171,'Elemental Form: Water',3,3,13654,13655,13652,13653,3,2798,4294967295,0,4,900,8192,0,59,3,3,4294967295,3,0,3,171,1,0,0,0,0),(174,'Elemental Form: Earth',3,3,13658,13659,13656,13657,3,2792,4294967295,0,4,900,8192,0,59,3,3,4294967295,3,0,3,174,1,0,0,0,0),(177,'Elemental Form: Air',3,3,13662,13663,13660,13661,3,2789,4294967295,0,4,900,8192,0,59,3,3,4294967295,3,0,3,177,1,0,0,0,0),(180,'Improved Reclaim Energy',3,1,4294967295,4294967295,13664,13665,3,4294967295,4294967295,0,0,0,8192,0,59,0,3,4294967295,3,0,1,180,1,0,0,0,0),(181,'Turn Summoned',3,3,13668,13669,13666,13667,3,8133,4294967295,0,5,300,8192,0,59,3,3,4294967295,3,0,3,181,1,0,0,0,0),(182,'Elemental Pact',5,1,4294967295,4294967295,13670,13671,3,4294967295,4294967295,0,0,0,8192,0,59,0,3,4294967295,3,0,1,182,1,0,0,0,0),(183,'Lifeburn',9,1,13674,13675,13672,13673,3,2755,4294967295,0,4,8640,2048,0,59,0,3,4294967295,3,0,1,183,1,0,0,0,0),(184,'Dead Mesmerization',3,1,13678,13679,13676,13677,3,2756,4294967295,0,5,4320,2048,0,59,0,3,4294967295,3,0,1,184,1,0,0,0,0),(185,'Fearstorm',5,1,13682,13683,13680,13681,3,2757,4294967295,0,6,4320,2048,0,59,0,3,4294967295,3,0,1,185,1,0,0,0,0),(186,'Flesh to Bone',3,1,13686,13687,13684,13685,3,2772,4294967295,0,7,7,2048,0,59,0,3,4294967295,3,0,1,186,1,0,0,0,0),(187,'Call to Corpse',6,1,13690,13691,13688,13689,3,2764,4294967295,0,8,4320,2048,0,59,0,3,4294967295,3,0,1,187,1,0,0,0,0),(188,'Divine Stun',9,1,13694,13695,13692,13693,3,2190,4294967295,0,9,30,8,0,59,0,3,4294967295,3,0,1,188,1,0,0,0,0),(189,'Improved Lay on Hands',5,1,4294967295,4294967295,13696,13697,3,4294967295,4294967295,0,0,0,8,0,59,0,3,4294967295,3,0,1,189,1,0,0,0,0),(190,'Slay Undead',3,3,4294967295,4294967295,13698,13699,3,4294967295,113,3,0,0,8,0,59,3,3,4294967295,3,0,6,190,1,0,0,1524,0),(193,'Act of Valor',3,1,13702,13703,13700,13701,3,2775,4294967295,0,3,4320,8,0,59,0,3,4294967295,3,0,1,193,1,0,0,0,0),(194,'Holy Steed',5,1,13706,13707,13704,13705,3,2874,4294967295,0,0,1,8,0,59,0,3,4294967295,3,0,1,194,1,0,0,0,0),(195,'Fearless',6,1,4294967295,4294967295,13708,13709,3,4294967295,116,3,0,0,40,0,59,0,3,4294967295,3,0,1,195,1,0,0,0,0),(196,'2 Hand Bash',6,1,4294967295,4294967295,13710,13711,3,4294967295,4294967295,0,0,0,40,0,59,0,3,4294967295,3,0,1,196,1,0,0,0,0),(197,'Innate Camouflage',5,1,13714,13715,13712,13713,3,2765,4294967295,0,2,7,80,0,59,0,3,4294967295,3,0,1,197,1,0,0,0,0),(198,'Ambidexterity',9,1,4294967295,4294967295,13716,13717,3,4294967295,4294967295,0,0,0,33682,0,59,0,3,4294967295,3,0,1,198,1,0,0,0,0),(199,'Archery Mastery',3,3,4294967295,4294967295,13718,13719,3,4294967295,4294967295,0,0,0,16,0,59,3,3,4294967295,3,0,3,199,1,0,0,0,0),(205,'Endless Quiver',9,1,4294967295,4294967295,13722,13723,3,4294967295,4294967295,0,0,0,16,0,59,0,3,4294967295,3,0,1,205,1,0,0,0,0),(206,'Unholy Steed',5,1,13726,13727,13724,13725,3,2875,4294967295,0,0,1,32,0,59,0,3,4294967295,3,0,1,206,1,0,0,0,0),(207,'Improved Harm Touch',6,1,13730,13731,13728,13729,3,2821,4294967295,0,2,4320,32,0,59,0,3,4294967295,3,0,1,207,1,0,0,0,0),(208,'Leech Touch',6,1,13734,13735,13732,13733,3,2774,4294967295,0,2,4320,32,0,59,0,3,4294967295,3,0,1,208,1,0,0,0,0),(210,'Soul Abrasion',3,3,4294967295,4294967295,13740,13741,3,4294967295,4294967295,0,0,0,32,0,59,3,3,4294967295,3,0,3,210,1,0,0,0,0),(213,'Instrument Mastery',3,3,4294967295,4294967295,13742,13743,3,4294967295,4294967295,0,0,0,256,0,59,3,3,4294967295,3,0,4,213,1,0,0,700,0),(225,'Jam Fest',3,3,4294967295,4294967295,13750,13751,3,4294967295,4294967295,0,0,0,256,0,59,3,3,4294967295,3,0,3,225,1,0,0,0,0),(230,'Critical Mend',3,3,4294967295,4294967295,13757,13758,3,4294967295,74,3,0,0,128,0,59,3,3,4294967295,3,0,6,230,1,0,0,539,0),(233,'Purify Body',9,1,13761,13762,13759,13760,3,2742,4294967295,0,1,1800,128,0,59,0,3,4294967295,3,0,1,233,1,0,0,0,0),(237,'Rapid Feign',3,3,4294967295,4294967295,13765,13766,3,4294967295,4294967295,0,0,0,128,0,59,3,3,4294967295,3,0,3,237,1,0,0,0,0),(240,'Return Kick',3,3,4294967295,4294967295,13767,13768,3,4294967295,0,0,0,0,128,0,59,3,3,4294967295,3,0,3,240,1,0,0,0,0),(243,'Escape',9,1,13771,4294967295,13769,13770,3,5244,4294967295,0,1,4320,512,0,59,0,3,4294967295,3,0,1,243,1,0,0,0,0),(244,'Poison Mastery',3,3,4294967295,4294967295,13773,13774,3,4294967295,4294967295,0,0,0,512,0,59,3,3,6,3,0,3,244,1,0,0,0,0),(247,'Double Riposte',3,3,4294967295,4294967295,13775,13776,3,4294967295,4294967295,0,0,0,33466,1,59,3,3,4294967295,3,0,6,247,1,0,0,504,0),(254,'Purge Poison',9,1,13783,13784,13781,13782,3,5232,4294967295,0,12,4320,512,0,59,0,3,4294967295,3,0,1,254,1,0,0,0,0),(255,'Flurry',3,3,4294967295,4294967295,13785,13786,3,4294967295,113,3,0,0,2,1,59,3,3,4294967295,3,0,12,255,1,0,0,542,0),(258,'Rampage',5,1,13789,4294967295,13787,13788,3,5233,4294967295,0,1,600,2,1,59,0,3,4294967295,3,0,1,258,1,0,0,0,0),(259,'Area Taunt',5,1,13793,13794,13791,13792,3,0,4294967295,0,2,900,2,0,59,0,3,4294967295,3,0,1,259,1,0,0,0,0),(260,'Warcry',3,3,13797,4294967295,13795,13796,3,5229,116,3,3,2160,2,0,59,3,3,4294967295,3,0,3,260,1,0,0,0,0),(263,'Bandage Wound',3,3,4294967295,4294967295,13799,13800,3,4294967295,74,3,0,0,2,1,59,3,3,4294967295,3,0,6,74,1,0,3,0,0),(266,'Spell Casting Reinforcement Mastery',8,1,4294967295,4294967295,13801,13802,3,4294967295,86,3,0,0,17476,0,59,0,3,4294967295,3,0,1,266,1,0,0,0,0),(267,'Spell Casting Fury Mastery',3,3,4294967295,4294967295,13803,13804,3,4294967295,92,3,0,0,4096,0,59,3,3,4294967295,2,0,8,267,1,0,0,640,0),(270,'Extended Notes',3,3,4294967295,4294967295,13805,13806,3,4294967295,4294967295,0,0,0,256,0,59,3,3,4294967295,3,0,3,270,1,0,0,0,0),(273,'Dragon Punch',5,1,4294967295,4294967295,13807,13808,3,4294967295,4294967295,0,0,0,128,0,59,0,3,4294967295,3,0,1,273,1,0,0,0,0),(274,'Strong Root',5,1,13815,13816,13813,13814,3,2748,4294967295,0,4,4320,4096,0,59,0,3,4294967295,3,0,1,274,1,0,0,0,0),(275,'Singing Mastery',3,3,4294967295,4294967295,13817,13818,3,4294967295,4294967295,0,0,0,256,0,59,3,3,4294967295,3,0,4,275,1,0,0,701,0),(278,'Body and Mind Rejuvenation',5,1,4294967295,4294967295,13819,13820,3,4294967295,4294967295,0,0,0,33080,0,59,0,3,4294967295,3,0,1,278,1,0,0,0,0),(279,'Physical Enhancement',5,1,4294967295,4294967295,13821,13822,3,4294967295,4294967295,0,0,0,33722,1,59,0,3,4294967295,3,0,1,279,1,0,0,0,0),(280,'Adv. Trap Negotiation',3,3,4294967295,4294967295,13823,13824,3,4294967295,4294967295,0,0,0,768,0,59,3,3,4294967295,3,0,3,280,1,0,0,0,0),(283,'Acrobatics',3,3,4294967295,4294967295,13825,13826,3,4294967295,4294967295,0,0,0,896,0,59,3,3,4294967295,3,0,3,283,1,0,0,0,0),(286,'Scribble Notes',3,1,4294967295,4294967295,13827,13828,3,4294967295,4294967295,0,0,0,256,0,59,0,3,4294967295,3,0,1,286,1,0,0,0,0),(287,'Chaotic Stab',6,1,4294967295,4294967295,13829,13830,3,4294967295,4294967295,0,0,0,512,0,59,0,3,4294967295,3,0,1,287,1,0,0,0,0),(288,'Pet Discipline',6,1,4294967295,4294967295,13831,13832,3,4294967295,4294967295,0,0,0,44064,0,59,0,3,4294967295,2,0,3,288,1,0,0,1129,0),(289,'Hobble of Spirits',5,1,3300,3301,3298,3299,3,3290,4294967295,0,3,300,32768,0,59,0,3,4294967295,3,0,1,289,1,0,0,0,0),(290,'Frenzy of Spirit',4,1,3304,3305,3302,3303,3,3289,4294967295,0,4,720,32768,0,59,0,3,4294967295,3,0,2,290,1,0,0,0,0),(291,'Paragon of Spirit',6,1,3308,3309,3306,3307,3,3291,4294967295,0,5,900,32768,0,59,0,3,4294967295,3,0,1,291,1,0,0,0,0),(292,'Advanced Innate Strength',1,10,4294967295,4294967295,5546,5550,4,4294967295,2,5,0,0,65534,1,61,0,4,4294967295,1,0,15,2,1,0,5,0,0),(302,'Advanced Innate Stamina',1,10,4294967295,4294967295,5551,5552,4,4294967295,7,5,0,0,65534,1,61,0,4,4294967295,1,0,15,7,1,0,5,0,0),(312,'Advanced Innate Agility',1,10,4294967295,4294967295,5553,5554,4,4294967295,12,5,0,0,65534,1,61,0,4,4294967295,1,0,15,12,1,0,5,0,0),(322,'Advanced Innate Dexterity',1,10,4294967295,4294967295,5555,5556,4,4294967295,17,5,0,0,65534,1,61,0,4,4294967295,1,0,15,17,1,0,5,0,0),(332,'Advanced Innate Intelligence',1,10,4294967295,4294967295,5557,5558,4,4294967295,22,5,0,0,65534,1,61,0,4,4294967295,1,0,15,22,1,0,5,0,0),(342,'Advanced Innate Wisdom',1,10,4294967295,4294967295,5559,5560,4,4294967295,27,5,0,0,65534,1,61,0,4,4294967295,1,0,15,27,1,0,5,0,0),(352,'Advanced Innate Charisma',1,10,4294967295,4294967295,5564,5565,4,4294967295,32,5,0,0,65534,1,61,0,4,4294967295,1,0,15,32,1,0,5,0,0),(362,'Warding of Solusek',1,10,4294967295,4294967295,5568,5569,4,4294967295,37,5,0,0,65534,1,61,0,4,4294967295,1,0,15,37,1,0,5,0,0),(372,'Blessing of E\'ci',1,10,4294967295,4294967295,5570,5571,4,4294967295,42,5,0,0,65534,1,61,0,4,4294967295,1,0,15,42,1,0,5,0,0),(382,'Marr\'s Protection',1,10,4294967295,4294967295,5566,5567,4,4294967295,47,5,0,0,65534,1,61,0,4,4294967295,1,0,15,47,1,0,5,0,0),(392,'Shroud of The Faceless',1,10,4294967295,4294967295,5572,5573,4,4294967295,52,5,0,0,65534,1,61,0,4,4294967295,1,0,15,52,1,0,5,0,0),(402,'Bertoxxulous\' Gift',1,10,4294967295,4294967295,5574,5575,4,4294967295,57,5,0,0,65534,1,61,0,4,4294967295,1,0,15,57,1,0,5,0,0),(412,'New Tanaan Crafting Mastery',3,6,4294967295,4294967295,3286,3287,1,4294967295,0,0,0,0,65534,1,51,0,1,6,1,0,6,412,1,0,0,0,0),(418,'Planar Power',2,5,4294967295,4294967295,5547,5548,4,4294967295,0,0,0,0,65534,1,61,0,4,4294967295,1,0,20,418,1,0,0,1001,0),(423,'Planar Durability',3,3,4294967295,4294967295,5549,5560,4,4294967295,0,0,0,0,42,1,61,0,4,4294967295,1,0,3,423,1,0,0,0,0),(426,'Innate Enlightenment',3,5,4294967295,4294967295,5561,5562,4,4294967295,0,0,0,0,31812,0,61,0,4,4294967295,1,0,5,426,1,0,0,0,0),(434,'Advanced Healing Adept',2,3,4294967295,4294967295,5578,5579,5,4294967295,77,3,0,0,33884,0,62,2,4,4294967295,2,0,12,77,1,0,3,1083,0),(437,'Advanced Healing Gift',2,3,4294967295,4294967295,5580,5581,5,4294967295,80,3,0,0,33884,0,62,2,4,4294967295,2,0,21,80,1,0,3,1086,0),(440,'Coup de Grace',2,3,4294967295,4294967295,5618,5619,5,4294967295,119,3,0,0,33722,1,62,0,4,4294967295,2,0,21,119,1,0,3,1053,0),(443,'Fury of the Ages',3,3,4294967295,4294967295,5620,5621,5,4294967295,113,3,0,0,33722,1,62,0,4,4294967295,2,0,6,113,1,0,3,0,0),(446,'Mastery of the Past',3,3,4294967295,4294967295,446,446,5,4294967295,101,3,0,0,31008,0,62,0,4,4294967295,2,0,3,446,1,0,0,7050,0),(449,'Lightning Reflexes',3,5,4294967295,4294967295,5636,5637,5,4294967295,125,3,0,0,65534,1,61,0,4,4294967295,1,0,33,125,1,0,3,1061,1),(454,'Innate Defense',3,5,4294967295,4294967295,5638,5639,5,4294967295,122,3,0,0,65534,1,61,0,4,4294967295,1,0,33,122,1,0,3,1066,1),(459,'Radiant Cure',2,3,3310,4294967294,9283,9284,5,3297,0,0,8,180,1092,0,61,2,4,4294967295,3,0,3,459,1,0,0,0,0),(477,'Hastened Exodus',2,3,4294967295,4294967295,5594,5595,5,4294967295,140,1,0,0,4160,0,63,0,4,4294967295,3,0,3,477,1,0,0,0,0),(480,'Hastened Root',2,3,4294967295,4294967295,5596,5597,5,4294967295,274,1,0,0,4096,0,63,0,4,4294967295,3,0,3,480,1,0,0,0,0),(483,'Hastened Mending',2,3,4294967295,4294967295,5598,5599,5,4294967295,163,1,0,0,43008,0,63,0,4,4294967295,3,0,3,483,1,0,0,0,0),(462,'Hastened Divinity',2,3,4294967295,4294967295,5582,5583,5,4294967295,132,1,0,0,4,0,63,0,4,4294967295,3,0,3,462,1,0,0,0,0),(468,'Hastened Purification of the Soul',2,3,4294967295,4294967295,5588,5589,5,4294967295,136,1,0,0,4,0,63,0,4,4294967295,3,0,3,468,1,0,0,0,0),(471,'Hastened Gathering',2,3,4294967295,4294967295,5590,5591,5,4294967295,162,1,0,0,16384,0,63,0,4,4294967295,3,0,3,471,1,0,0,0,0),(474,'Hastened Rabidity',2,3,4294967295,4294967295,5592,5593,5,4294967295,153,1,0,0,1024,0,63,0,4,4294967295,3,0,3,474,1,0,0,0,0),(486,'Hastened Banishment',2,3,4294967295,4294967295,5600,5601,5,4294967295,182,1,0,0,8192,0,63,2,4,4294967295,3,0,3,486,1,0,0,0,0),(489,'Hastened Instigation',2,3,4294967295,4294967295,5608,5609,5,4294967295,259,1,0,0,2,0,63,0,4,4294967295,3,0,3,489,1,0,0,0,0),(492,'Furious Rampage',2,3,4294967295,4294967295,5610,5611,5,4294967295,258,1,0,0,2,1,63,0,4,4294967295,3,0,3,492,1,0,0,0,0),(495,'Hastened Purification of the Body',2,3,4294967295,4294967295,5612,5613,5,4294967295,233,1,0,0,128,0,63,0,4,4294967295,3,0,3,495,1,0,0,0,0),(498,'Hasty Exit',2,3,4294967295,4294967295,5614,5615,5,4294967295,243,1,0,0,512,0,63,0,4,4294967295,3,0,5,498,1,0,0,886,0),(501,'Hastened Purification',2,3,4294967295,4294967295,5616,5617,5,4294967295,254,1,0,0,512,0,63,0,4,4294967295,3,0,3,501,1,0,0,0,0),(504,'Flash of Steel',3,3,4294967295,4294967295,5622,5623,5,4294967295,249,3,0,0,33466,1,62,0,4,4294967295,3,0,6,247,1,0,3,0,0),(507,'Divine Arbitration',3,3,5696,5697,5532,5533,5,3252,0,0,9,180,4,0,61,0,4,4294967295,3,0,3,507,1,0,0,0,0),(510,'Wrath of the Wild',3,3,5698,5699,5534,5535,5,3255,0,0,4,240,64,0,61,0,4,4294967295,3,0,3,510,1,0,0,0,0),(513,'Virulent Paralysis',3,3,5700,5701,5536,5537,5,3274,0,0,4,120,1024,0,61,0,4,4294967295,3,0,3,513,1,0,0,0,0),(516,'Harvest of Druzzil',2,1,5702,5703,5538,5539,5,3338,0,0,5,480,4096,0,62,0,4,4294967295,3,0,1,516,1,0,0,0,0),(517,'Eldritch Rune',3,3,5706,5707,5542,5543,5,3258,0,0,4,600,16384,0,61,0,4,4294967295,3,0,3,517,1,0,0,0,0),(520,'Servant of Ro',3,3,5704,5705,5540,5541,5,3265,0,0,6,540,8192,0,61,0,4,4294967295,3,0,3,520,1,0,0,0,0),(523,'Wake the Dead',5,3,5708,5709,5544,5545,5,3268,0,0,9,540,2048,0,61,-1,4,4294967295,3,0,3,523,1,0,0,0,0),(526,'Suspended Minion',5,2,5710,5711,5626,5627,5,5844,0,0,0,1,60448,0,62,-2,4,4294967295,3,0,2,526,1,0,0,0,0),(528,'Spirit Call',4,3,5712,5713,5628,5629,5,3283,0,0,5,720,1024,0,61,-1,4,4294967295,3,0,3,528,1,0,0,0,0),(531,'Celestial Renewal',3,2,28226,28227,5630,5631,5,3250,131,1,4,900,4,0,63,3,4,4294967295,3,0,3,131,1,0,1,0,0),(533,'Allegiant Familiar',6,1,9244,4294967295,5632,5633,5,3264,155,1,8,420,4096,0,64,0,4,4294967295,3,0,2,155,1,0,1,0,0),(534,'Hand of Piety',3,3,5724,5725,5634,5635,5,3261,189,1,4,2160,8,0,61,0,4,4294967295,3,0,3,534,1,0,0,0,0),(537,'Mithaniel\'s Binding',3,2,4294967295,4294967295,5640,5641,5,4294967295,263,3,0,0,2,1,63,0,4,4294967295,3,0,2,537,1,0,0,0,0),(539,'Mending of the Tranquil',2,3,4294967295,4294967295,5642,5643,5,4294967295,230,3,0,0,128,0,63,2,4,4294967295,3,0,6,230,1,0,3,0,0),(542,'Raging Flurry',2,3,4294967295,4294967295,5644,5645,5,4294967295,255,3,0,0,2,1,63,2,4,4294967295,3,0,12,255,1,0,3,1163,0),(545,'Guardian of the Forest',3,3,5714,5715,5646,5647,5,3271,0,0,3,900,16,0,61,0,4,4294967295,3,0,3,545,1,0,0,0,0),(548,'Spirit of the Wood',4,3,5716,5717,5648,5649,5,3277,0,0,5,900,64,0,61,-1,4,4294967295,3,0,3,548,1,0,0,0,0),(551,'Bestial Frenzy',2,5,4294967295,4294967295,5650,5651,5,4294967295,0,0,0,0,32768,0,61,0,4,4294967295,3,0,5,551,1,0,0,0,0),(556,'Harmonious Attack',2,5,4294967295,4294967295,5652,5653,5,4294967295,0,0,0,0,256,0,61,0,4,4294967295,3,0,5,556,1,0,0,0,0),(561,'Knight\'s Advantage',2,3,4294967295,4294967295,5654,5655,5,4294967295,0,0,0,0,40,0,61,2,4,4294967295,3,0,6,561,1,0,0,1624,0),(564,'Ferocity',3,3,4294967295,4294967295,5656,5657,2,4294967295,0,0,0,0,658,1,61,2,4,4294967295,3,0,6,564,1,0,0,1621,0),(567,'Viscid Roots',5,1,4294967295,4294967295,5664,5665,5,4294967295,144,1,0,0,64,0,63,0,4,4294967295,3,0,2,567,1,0,0,5061,0),(568,'Sionachie\'s Crescendo',2,3,4294967295,4294967295,5666,5667,5,4294967295,270,3,0,0,256,0,63,0,4,4294967295,3,0,3,568,1,0,0,0,0),(571,'Ayonaes Tutelage',2,3,4294967295,4294967295,5668,5669,5,4294967295,0,0,0,0,256,0,63,0,4,4294967295,3,0,3,571,1,0,0,0,0),(574,'Feigned Minion',3,3,4294967295,4294967295,5674,5675,5,4294967295,288,1,0,0,2048,0,61,0,4,4294967295,3,0,3,574,1,0,0,0,0),(577,'Unfailing Divinity',2,3,4294967295,4294967295,5660,5661,5,4294967295,0,0,0,0,4,0,61,2,4,4294967295,3,0,3,577,1,0,0,0,0),(580,'Animation Empathy',4,3,4294967295,4294967295,5658,5659,5,4294967295,0,0,0,0,16384,0,61,-1,4,4294967295,3,0,3,580,1,0,0,0,0),(583,'Rush to Judgment',2,3,4294967295,4294967295,5672,5673,5,4294967295,188,1,0,0,8,0,63,0,4,4294967295,3,0,3,583,1,0,0,0,0),(586,'Living Shield',2,3,4294967295,4294967295,3275,3276,5,4294967295,279,1,0,0,2,0,61,2,4,4294967295,3,0,3,586,1,0,0,0,0),(589,'Consumption of the Soul',3,3,4294967295,4294967295,3283,3284,5,4294967295,208,1,0,0,32,0,61,0,4,4294967295,3,0,5,589,1,0,0,893,0),(592,'Boastful Bellow',6,1,5718,5719,5676,5677,5,3282,113,1,2,18,256,0,63,0,4,4294967295,3,0,1,592,1,0,0,0,0),(593,'Fervent Blessing',3,3,4294967295,4294967295,5680,5681,5,4294967295,0,0,0,0,8,0,61,0,4,4294967295,3,0,3,593,1,0,0,0,0),(596,'Touch of the Wicked',2,3,4294967295,4294967295,5682,5683,5,4294967295,0,0,0,0,32,0,61,2,4,4294967295,3,0,3,596,1,0,0,0,0),(599,'Punishing Blade',2,3,4294967295,4294967295,5684,5685,5,4294967295,0,0,0,0,146,1,61,2,4,4294967295,2,0,12,599,1,0,0,1536,0),(602,'Speed of the Knight',3,3,4294967295,4294967295,5686,5687,5,4294967295,0,0,0,0,40,0,61,0,4,4294967295,3,0,3,602,1,0,0,0,0),(605,'Shroud of Stealth',6,1,4294967295,4294967295,5688,5689,5,4294967295,0,0,0,0,512,0,63,0,4,4294967295,3,0,1,605,1,0,0,0,0),(606,'Nimble Evasion',1,5,4294967295,4294967295,5690,5691,5,4294967295,0,0,0,0,512,0,61,0,4,4294967295,3,0,5,606,1,0,0,0,0),(611,'Technique of Master Wu',2,5,4294967295,4294967295,5692,5693,5,4294967295,0,0,0,0,128,0,61,0,4,4294967295,3,0,5,611,1,0,0,0,0),(616,'Host of the Elements',5,3,5720,5721,5694,5695,5,3286,0,0,7,900,8192,0,63,-1,4,4294967295,3,0,3,616,1,0,0,0,0),(619,'Call of Xuzl',3,3,3290,3291,3288,3289,5,3292,0,0,6,900,4096,0,61,-1,4,4294967295,3,0,5,619,1,0,0,721,0),(622,'Hastened Stealth',3,3,4294967295,4294967295,3314,3315,5,4294967295,0,0,0,0,512,0,61,0,4,4294967295,3,0,3,622,1,0,0,0,0),(625,'Ingenuity',1,3,4294967295,4294967295,5523,5728,5,4294967295,0,0,0,0,642,1,61,1,4,4294967295,2,0,9,625,1,0,0,4733,0),(628,'Fleet of Foot',2,2,4294967295,4294967295,5584,5585,5,4294967295,0,0,0,0,256,0,62,2,4,4294967295,3,0,2,628,1,0,0,0,0),(630,'Fading Memories',6,1,5732,5733,5730,5731,5,5243,0,0,7,1,256,0,63,0,4,4294967295,3,0,1,630,1,0,0,0,0),(631,'Tactical Mastery',2,3,4294967295,4294967295,5734,5735,5,4294967295,0,0,0,0,2,1,61,1,4,4294967295,3,0,3,631,1,0,0,0,0),(634,'Theft of Life',1,3,4294967295,4294967295,5736,5737,5,4294967295,0,0,0,0,2080,0,61,1,4,4294967295,3,0,8,634,1,0,0,844,0),(637,'Fury of Magic',3,3,4294967295,4294967295,5738,5739,5,4294967295,92,3,0,0,27716,0,61,3,4,4294967295,2,0,6,637,1,0,0,770,0),(640,'Fury of Magic Mastery',2,3,4294967295,4294967295,5740,5741,5,4294967295,267,3,0,0,4096,0,61,2,4,4294967295,2,0,8,267,1,0,3,924,0),(643,'Project Illusion',4,1,5662,5663,5670,5742,5,5227,158,1,0,1,16384,0,62,0,4,4294967295,3,0,1,643,1,0,0,0,0),(644,'Headshot',4,1,4294967295,4294967295,5743,5744,5,4294967295,199,1,0,0,16,0,62,0,4,4294967295,3,0,1,644,1,0,0,0,0),(645,'Entrap',4,1,5749,4294967295,5747,5748,5,3614,0,0,4,5,16,0,64,0,4,4294967295,3,0,1,645,1,0,0,0,0),(646,'Unholy Touch',2,3,4294967295,4294967295,9000,9001,5,4294967295,207,1,0,0,32,0,61,2,4,4294967295,3,0,3,646,1,0,0,0,0),(649,'Total Domination',2,3,4294967295,4294967295,9002,9003,5,4294967295,0,0,0,0,16384,0,61,2,4,4294967295,3,0,3,649,1,0,0,0,0),(652,'Stalwart Endurance',2,3,4294967295,4294967295,5751,5752,5,4294967295,0,0,0,0,2,1,61,2,4,4294967295,3,0,3,652,1,0,0,0,2),(672,'Swift Journey',5,2,4294967295,4294967295,9151,9152,6,4294967295,62,3,0,0,65534,1,61,0,7,4294967295,1,0,5,62,1,0,3,0,0),(674,'Convalescence',3,2,4294967295,4294967295,9153,9154,6,4294967295,65,3,0,0,65534,1,61,0,7,4294967295,1,0,5,65,1,0,3,0,0),(676,'Lasting Breath',2,2,4294967295,4294967295,9155,9156,6,4294967295,71,3,0,0,65534,1,61,0,7,4294967295,1,0,6,71,1,0,3,978,0),(678,'Packrat',3,5,4294967295,4294967295,9325,9326,6,4294967295,0,0,0,0,65534,1,61,0,7,4294967295,1,0,5,678,1,0,0,0,0),(686,'Weapon Affinity',5,5,4294967295,4294967295,9159,9160,6,4294967295,0,0,0,0,33722,1,55,0,7,4294967295,2,0,5,686,1,0,0,0,0),(691,'Secondary Forte',15,1,4294967295,4294967295,9161,9162,6,4294967295,0,0,0,0,31812,0,55,0,7,4294967295,2,0,1,691,1,0,0,0,0),(692,'Persistent Casting',3,3,4294967295,4294967295,9187,9188,6,4294967295,0,0,0,0,64892,0,55,3,7,4294967295,2,0,9,692,1,0,0,7647,0),(718,'Bestial Alignment',3,3,9219,4294967295,9219,9220,6,4521,0,0,7,4320,32768,0,65,3,7,4294967295,2,0,3,718,1,0,0,0,0),(721,'Wrath of Xuzl',5,2,3290,3291,9199,9200,6,5110,619,3,6,900,4096,0,65,0,7,4294967295,2,0,5,619,1,0,3,0,0),(723,'Feral Swipe',9,1,9175,4294967295,9175,9176,6,4788,0,0,6,60,32768,0,65,0,7,4294967295,2,0,1,723,1,0,0,0,0),(724,'Warder\'s Fury',3,5,4294967295,4294967295,9177,9178,6,4294967295,0,0,0,0,32768,0,65,0,7,4294967295,3,0,5,724,1,0,0,0,0),(729,'Warder\'s Alacrity',3,5,4294967295,4294967295,9179,9180,6,4294967295,0,0,0,0,32768,0,65,0,7,4294967295,3,0,5,729,1,0,0,0,0),(734,'Pet Affinity',12,1,4294967295,4294967295,9285,9286,6,4294967295,0,0,0,0,60448,0,65,0,7,4294967295,2,0,1,734,1,0,0,0,0),(735,'Mastery of the Past',3,3,4294967295,4294967295,9163,9164,6,4294967295,0,0,0,0,33884,0,62,0,7,4294967295,2,0,15,735,1,0,0,7050,0),(767,'Critical Affliction',3,3,4294967295,4294967295,9191,9192,6,4294967295,0,0,0,0,36208,0,65,3,7,4294967295,2,0,9,767,1,0,0,1099,0),(806,'Sinister Strikes',15,1,4294967295,4294967295,9231,9232,6,4294967295,198,1,0,0,33682,0,65,0,7,4294967295,2,0,1,806,1,0,0,0,0),(921,'Ro\'s Flaming Familiar',15,1,9269,4294967295,9269,9270,6,4833,0,0,8,60,4096,0,65,0,7,4294967295,2,0,1,921,1,0,0,0,0),(922,'E\'ci\'s Icy Familiar',15,1,9227,4294967295,9227,9228,6,4834,0,0,8,60,4096,0,65,0,7,4294967295,2,0,1,922,1,0,0,0,0),(923,'Druzzil\'s Mystical Familiar',15,1,9279,4294967295,9279,9280,6,4835,0,0,8,60,4096,0,65,0,7,4294967295,2,0,1,923,1,0,0,0,0),(924,'Advanced Fury of Magic Mastery',5,2,4294967295,4294967295,9265,9266,6,4294967295,640,3,0,0,4096,0,65,0,7,4294967295,2,0,8,267,1,0,6,0,0),(926,'Ward of Destruction',3,5,9319,4294967295,9319,9320,6,4836,0,0,12,1800,4096,0,65,0,7,4294967295,2,0,5,926,1,0,0,0,0),(931,'Frenzied Devastation',5,3,9340,4294967295,9340,9341,6,5245,92,1,13,4320,4096,0,65,3,7,4294967295,2,0,3,931,1,0,0,0,0),(978,'Eternal Breath',5,1,4294967295,4294967295,30012,30013,7,4294967295,676,2,0,0,65534,1,68,0,8,4294967295,1,0,6,71,1,0,5,0,0),(979,'Blacksmithing Mastery',3,3,4294967295,4294967295,30016,30017,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,979,1,0,0,0,0),(982,'Baking Mastery',3,3,4294967295,4294967295,30028,30029,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,982,1,0,0,0,0),(985,'Brewing Mastery',3,3,4294967295,4294967295,30040,30041,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,985,1,0,0,0,0),(988,'Fletching Mastery',3,3,4294967295,4294967295,30052,30053,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,988,1,0,0,0,0),(991,'Pottery Mastery',3,3,4294967295,4294967295,30064,30065,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,991,1,0,0,0,0),(994,'Tailoring Mastery',3,3,4294967295,4294967295,30076,30077,7,4294967295,0,0,0,0,65534,1,59,3,7,6,1,0,3,994,1,0,0,0,0),(997,'Salvage',5,3,4294967295,4294967295,30088,30089,7,4294967295,0,0,0,0,65534,1,60,0,7,6,1,0,3,997,1,0,0,0,5),(1000,'Origin',7,1,30102,4294967295,30100,30101,7,5824,0,0,20,4320,65534,1,67,0,8,4294967295,1,0,1,1000,1,0,0,0,0),(1001,'Chaotic Potential',5,5,4294967295,4294967295,30104,30105,7,4294967295,418,5,0,0,65534,1,66,0,8,4294967295,1,0,20,418,1,0,5,4678,1),(1006,'Discordant Defiance',5,5,4294967295,4294967295,30124,30125,7,4294967295,0,0,0,0,65534,1,66,0,8,4294967295,1,0,10,1006,1,0,0,7516,0),(1021,'Mystical Attuning',5,5,4294967295,4294967295,30144,30145,7,4294967295,0,0,0,0,65534,1,51,0,8,4294967295,1,0,12,1021,1,0,0,6521,0),(1026,'Delay Death',3,5,4294967295,4294967295,30164,30165,7,4294967295,0,0,0,0,65534,1,66,0,8,4294967295,1,0,25,1026,1,0,0,1389,0),(1031,'Healthy Aura',3,5,4294967295,4294967295,30184,30185,7,4294967295,674,2,0,0,65534,1,66,0,8,4294967295,1,0,8,110,1,0,3,0,0),(1041,'Veteran\'s Wrath',3,3,4294967295,4294967295,30224,30225,7,4294967295,443,3,0,0,33192,0,67,3,8,4294967295,2,0,3,1041,1,0,0,0,0),(1053,'Deathblow',3,3,4294967295,4294967295,30272,30273,7,4294967295,440,3,0,0,33722,1,66,0,8,4294967295,2,0,21,119,1,0,6,4721,0),(1061,'Reflexive Mastery',5,5,4294967295,4294967295,30304,30305,7,4294967295,449,5,0,0,65534,1,66,0,8,4294967295,1,0,33,125,1,0,8,1394,1),(1066,'Defensive Instincts',5,5,4294967295,4294967295,30324,30325,7,4294967295,454,5,0,0,65534,1,66,0,8,4294967295,1,0,33,122,1,0,8,1399,1),(1071,'Mnemonic Retention',3,1,4294967295,4294967295,30344,30345,7,4294967295,0,0,0,0,64892,0,55,0,8,4294967295,2,0,1,1071,1,0,0,0,0),(1072,'Expansive Mind',5,5,4294967295,4294967295,30348,30349,7,4294967295,0,0,0,0,64892,0,66,0,8,4294967295,2,0,5,1072,1,0,0,0,0),(1083,'Healing Adept Mastery',3,3,4294967295,4294967295,30392,30393,7,4294967295,434,3,0,0,33884,0,66,3,8,4294967295,2,0,12,77,1,0,6,12449,0),(1086,'Healing Gift Mastery',3,3,4294967295,4294967295,30404,30405,7,4294967295,437,3,0,0,33884,0,66,3,8,4294967295,2,0,21,80,1,0,6,4779,0),(1089,'Arcane Tongues',3,3,4294967295,4294967295,30416,30417,7,4294967295,0,0,0,0,30720,0,66,3,8,4294967295,2,0,3,1089,1,0,0,0,0),(1093,'Slippery Attacks',3,5,4294967295,4294967295,30432,30433,7,4294967295,0,0,0,0,33682,0,66,0,8,4294967295,2,0,5,1093,1,0,0,0,0),(1099,'Improved Critical Affliction',3,3,4294967295,4294967295,30456,30457,7,4294967295,767,3,0,0,36192,0,67,3,8,4294967295,2,0,9,767,1,0,3,12423,0),(1107,'Fury of Magic',3,3,4294967295,4294967295,5738,5739,7,4294967295,92,3,0,0,33080,0,66,3,8,4294967295,2,0,3,1107,1,0,0,0,0),(1119,'Roar of Thunder',3,3,30538,30539,30536,30537,7,5841,0,0,8,900,32768,0,68,3,8,4294967295,2,0,3,1119,1,0,0,0,0),(1122,'Persistent Minion',7,1,4294967295,4294967295,30548,30549,7,4294967295,526,2,0,0,60448,0,67,0,8,4294967295,2,0,1,1122,1,0,0,0,0),(1123,'Perfection of Spirit',5,3,30554,30555,30552,30553,7,5854,291,1,5,900,32768,0,66,0,8,4294967295,2,0,3,1123,1,0,0,0,0),(1126,'Replenish Companion',3,3,30566,30567,30564,30565,7,5845,163,1,2,2160,43008,0,66,3,8,4294967295,2,0,3,1126,1,0,0,0,0),(1129,'Advanced Pet Discipline',5,2,4294967295,4294967295,30576,30577,7,4294967295,288,1,0,0,44064,0,67,2,8,4294967295,2,0,3,288,1,0,1,0,0),(1181,'Shielding Resistance',3,5,4294967295,4294967295,1181,1181,7,4294967295,0,0,0,0,33682,0,70,0,8,4294967295,2,0,5,1181,1,0,0,0,0),(1210,'Destructive Fury',3,3,4294967295,4294967295,30900,30901,7,4294967295,640,3,0,0,4096,0,66,3,8,4294967295,2,0,9,1210,1,0,0,4755,0),(1229,'Secondary Recall',7,1,30978,30979,30976,30977,7,6094,0,0,10,600,4160,0,66,0,8,4294967295,2,0,1,1229,1,0,0,0,0),(1334,'Mind Crash',3,3,31410,31411,31408,31409,7,5943,0,0,11,4320,4096,0,66,3,8,4294967295,2,0,3,1334,1,0,0,0,0),(1337,'Prolonged Destruction',5,3,31422,31423,31420,31421,7,5946,931,3,13,4320,4096,0,67,0,8,4294967295,2,0,3,1337,1,0,0,0,0),(1340,'Ro\'s Greater Familiar',12,1,31434,31435,31432,31433,7,5950,921,1,8,60,4096,0,69,0,8,4294967295,2,0,1,921,1,0,0,0,0),(1341,'E\'ci\'s Greater Familiar',12,1,31438,31439,31436,31437,7,5951,922,1,8,60,4096,0,69,0,8,4294967295,2,0,1,922,1,0,0,0,0),(1342,'Druzzil\'s Greater Familiar',12,1,31442,31443,31440,31441,7,5952,923,1,8,60,4096,0,69,0,8,4294967295,2,0,1,923,1,0,0,0,0),(1343,'Teleport Bind',9,1,31446,31447,31444,31445,7,5953,0,0,9,300,4096,0,69,0,8,4294967295,2,0,1,1343,1,0,0,0,0),(1344,'Devoted Familiar',12,1,31450,31451,31448,31449,7,5949,533,1,8,60,4096,0,70,0,8,4294967295,2,0,2,155,1,0,0,0,0),(807,'Strikethrough',3,3,4294967295,4294967295,807,807,6,4294967295,0,0,0,0,128,0,65,3,7,4294967295,2,0,3,807,1,0,0,0,0),(810,'Stonewall',5,5,2147483647,2147483647,2147483647,0,6,0,0,0,0,0,128,0,65,0,7,4294967295,2,0,5,810,1,0,0,0,0),(815,'Rapid Strikes',4,5,4294967295,4294967295,815,815,6,0,0,0,0,0,128,0,65,0,7,4294967295,3,0,5,815,1,0,0,0,0),(820,'Kick Mastery',3,3,4294967295,4294967295,820,820,6,4294967295,0,0,0,0,128,0,65,3,7,4294967295,3,0,3,820,1,0,0,0,0),(823,'Heightened Awareness',5,5,4294967295,4294967295,823,823,6,4294967295,0,0,0,0,128,0,65,0,7,4294967295,3,0,5,823,1,0,0,0,0),(828,'Destructive Force',3,3,2147483647,2147483647,2147483647,2147483647,6,5240,0,0,2,3600,128,0,65,3,7,4294967295,2,0,3,828,1,0,0,0,0),(770,'Fury of Magic Mastery',3,3,4294967295,4294967295,4294967295,4294967295,6,0,637,3,0,0,27716,0,65,3,7,4294967295,2,0,6,637,1,0,3,0,0),(831,'Swarm of Decay',3,3,2147483647,2147483647,2147483647,2147483647,6,0,0,0,10,1800,2048,0,65,3,7,4294967295,2,0,3,831,1,0,0,0,0),(834,'Deaths Fury',3,5,4294967295,4294967295,834,834,6,0,0,0,0,0,2080,0,65,0,7,4294967295,3,0,5,834,1,0,0,0,0),(839,'Quickening of Death',5,5,4294967295,4294967295,839,839,6,0,0,0,0,0,2048,0,65,0,7,4294967295,3,0,5,839,1,0,0,0,0),(864,'Precision of the Pathfinder',3,3,4294967295,4294967295,864,864,6,0,0,0,0,0,16,0,65,3,7,4294967295,3,0,6,864,1,0,0,0,0),(867,'Coat of Thistles',5,5,4294967295,4294967295,867,867,6,0,0,0,0,0,16,0,65,0,7,4294967295,2,0,5,867,1,0,0,0,0),(872,'Flaming Arrows',3,3,2147483647,2147483647,2147483647,2147483647,6,4802,0,0,5,180,16,0,65,3,7,4294967295,2,0,3,872,1,0,0,0,0),(875,'Frost Arrows',3,3,2147483647,2147483647,2147483647,2147483647,6,4805,0,0,5,180,16,0,65,3,7,4294967295,2,0,3,875,1,0,0,0,0),(915,'Strengthened Strike',3,3,4294967295,4294967295,915,915,6,4294967295,0,0,0,0,16,0,65,3,7,4294967295,3,0,3,915,1,0,0,0,0),(683,'Heightened Endurance',3,3,4294967295,4294967295,683,683,6,4294967295,0,0,0,0,642,1,61,3,7,4294967295,2,0,15,683,1,0,0,1036,0),(846,'Triple Backstab',3,3,4294967295,4294967295,846,846,6,4294967295,0,0,0,0,512,0,65,3,7,4294967295,3,0,6,846,1,0,0,1301,0),(878,'Seized Opportunity',3,3,4294967295,4294967295,878,878,6,4294967295,0,0,0,0,512,0,65,3,7,4294967295,3,0,6,878,1,0,0,1539,0),(881,'Trap Circumvention',3,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,512,0,65,0,7,4294967295,2,0,5,881,1,0,0,0,0),(886,'Improved Hasty Exit',5,2,2147483647,2147483647,2147483647,2147483647,6,0,498,3,0,0,512,0,65,0,7,4294967295,2,0,5,498,1,0,2,0,0),(888,'Virulent Venom',3,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,512,0,65,0,7,4294967295,2,0,5,888,1,0,0,0,0),(893,'Improved Consumption of the Soul',5,2,2147483647,2147483647,2147483647,2147483647,6,0,589,3,0,0,32,0,65,0,7,4294967295,2,0,5,589,1,0,3,0,0),(849,'Hastened Piety',3,3,2147483647,2147483647,2147483647,2147483647,6,0,534,3,0,0,8,0,65,3,7,4294967295,2,0,3,849,1,0,0,0,0),(852,'Immobilizing Bash',5,3,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,40,0,65,0,7,4294967295,2,0,3,852,1,0,0,0,0),(855,'Vicious Smash',5,5,4294967295,4294967295,855,855,6,4294967295,0,0,0,0,40,0,65,0,7,4294967295,3,0,5,855,1,0,0,0,0),(860,'Radiant Cure',3,3,2147483647,2147483647,2147483647,2147483647,6,3297,0,0,5,180,8,0,65,3,7,4294967295,2,0,3,860,1,0,0,0,0),(863,'Purification',12,1,2147483647,2147483647,2147483647,2147483647,6,5248,0,0,6,4320,8,0,65,0,7,4294967295,2,0,1,863,1,0,0,0,0),(738,'Spell Casting Subtlety',3,3,4294967295,4294967295,738,738,6,0,0,0,0,0,1092,0,65,3,7,4294967295,2,0,12,738,1,0,0,5317,0),(754,'Quickened Curing',3,3,2147483647,2147483647,2147483647,2147483647,6,0,459,3,0,0,1092,0,65,3,7,4294967295,2,0,3,754,1,0,0,0,0),(900,'Advanced Spirit Call',5,2,2147483647,2147483647,2147483647,2147483647,6,4826,528,3,5,720,1024,0,65,0,7,4294967295,2,0,2,900,1,0,0,0,0),(907,'Sturdiness',5,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,2,0,65,0,7,4294967295,2,0,5,907,1,0,0,0,0),(918,'Extended Shielding',3,3,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,2,0,65,3,7,4294967295,2,0,3,918,1,0,0,0,0),(741,'Touch of the Divine',5,5,4294967295,4294967295,741,741,6,0,0,0,0,0,4,0,65,0,7,4294967295,3,0,5,741,1,0,0,0,0),(746,'Divine Avatar',3,3,2147483647,2147483647,2147483647,2147483647,6,4549,0,0,10,2160,4,0,65,3,7,4294967295,2,0,3,746,1,0,0,0,0),(749,'Exquisite Benediction',5,5,2147483647,2147483647,2147483647,2147483647,6,4790,0,0,13,1800,4,0,65,0,7,4294967295,2,0,5,749,1,0,0,0,0),(757,'Natures Boon',5,5,2147483647,2147483647,2147483647,2147483647,6,4796,0,0,6,1800,64,0,65,0,7,4294967295,2,0,5,757,1,0,0,0,0),(762,'Advanced Tracking',4,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,64,0,65,0,7,4294967295,2,0,5,762,1,0,0,0,0),(844,'Advanced Theft of Life',5,2,4294967295,4294967295,31453,31454,6,4294967295,634,3,0,0,2080,0,65,0,7,4294967295,3,0,8,634,1,0,3,1319,0),(1140,'Dead Aim',3,3,4294967295,4294967295,1140,1140,5,4294967295,0,0,0,0,0,1,61,0,5,4294967295,3,0,3,1140,1,0,0,0,0),(1149,'Desperation',12,1,2147483647,2147483647,2147483647,2147483647,6,5853,0,0,5,1320,0,1,65,0,6,4294967295,2,0,1,1149,1,0,0,0,0),(1150,'Untamed Rage',3,3,1150,1150,1150,1150,6,5848,564,3,2,2160,0,1,65,3,7,4294967295,3,0,3,1150,1,0,0,0,0),(1155,'Echoing Cries',3,3,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,0,1,65,3,6,4294967295,2,0,3,1155,1,0,0,0,0),(773,'Doppelganger',3,3,2147483647,0,2147483647,2147483647,6,4552,643,1,5,1800,16384,0,65,3,7,4294967295,2,0,3,773,1,0,0,0,0),(776,'Enhanced Forgetfulness',3,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,16384,0,65,0,7,4294967295,2,0,5,776,1,0,0,0,0),(781,'Mesmerization Mastery',12,1,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,16384,0,65,0,7,4294967295,2,0,1,781,1,0,0,0,0),(782,'Quick Mass Group Buff',3,3,2147483647,2147483647,2147483647,2147483647,6,0,128,1,0,0,16384,0,65,3,7,4294967295,2,0,3,782,1,0,0,0,0),(785,'Shared Health',5,5,2147483647,2147483647,2147483647,2147483647,6,5235,0,0,8,900,8192,0,65,0,7,4294967295,2,0,5,785,1,0,0,0,0),(790,'Elemental Fury',3,5,4294967295,4294967295,790,790,6,0,0,0,0,0,8192,0,65,0,7,4294967295,3,0,5,790,1,0,0,0,0),(795,'Elemental Alacrity',5,5,4294967295,4294967295,795,795,6,0,0,0,0,0,8192,0,65,0,7,4294967295,3,0,5,795,1,0,0,0,0),(800,'Elemental Agility',3,3,4294967295,4294967295,800,800,6,0,0,0,0,0,8192,0,65,3,7,4294967295,3,0,3,800,1,0,0,0,0),(803,'Elemental Durability',3,3,4294967295,4294967295,803,803,6,0,0,0,0,0,8192,0,65,3,7,4294967295,3,0,3,803,1,0,0,0,0),(695,'Tune of Pursuance',4,5,2147483647,2147483647,2147483647,2147483647,6,0,0,0,0,0,256,0,65,0,7,4294967295,2,0,5,695,1,0,0,0,0),(700,'Improved Instrument Mastery',9,1,4294967295,4294967295,2147483647,2147483647,6,0,213,3,0,0,256,0,61,0,7,4294967295,3,0,4,213,1,0,3,0,0),(701,'Improved Singing Mastery',9,1,4294967295,4294967295,2147483647,2147483647,6,0,275,3,0,0,256,0,61,0,7,4294967295,3,0,4,275,1,0,3,0,0),(702,'Exultant Bellowing',3,5,2147483647,2147483647,2147483647,2147483647,6,4842,592,1,2,18,256,0,65,0,7,4294967295,2,0,5,702,1,0,0,0,0),(707,'Echo of Taelosia',5,3,2147483647,2147483647,2147483647,2147483647,6,0,571,3,0,0,256,0,65,0,7,4294967295,2,0,3,707,1,0,0,0,0),(710,'Internal Metronome',5,5,4294967295,4294967295,710,710,6,0,96,3,0,0,256,0,65,0,7,4294967295,2,0,5,710,1,0,0,0,0),(1319,'Soul Thief',5,3,4294967295,4294967295,31457,31458,7,4294967295,844,2,0,0,2080,0,68,0,8,4294967295,3,0,8,634,1,0,5,0,0),(209,'Death Peace',5,1,13738,13739,13736,13737,7,4294967295,0,0,12,5,2080,0,65,0,3,4294967295,2,0,1,209,1,0,0,0,0),(1134,'Blur of Axes',3,3,4294967295,4294967295,1134,1134,5,4294967295,0,0,0,0,0,1,61,1,4,4294967295,3,0,8,1134,1,0,0,1158,0),(1158,'Vicious Frenzy',4,5,4294967295,4294967295,1158,1158,7,4294967295,1134,3,0,0,0,1,67,0,8,4294967295,3,0,8,1134,1,0,3,0,0),(1373,'Chaotic Jester',0,1,1373,1373,1373,1373,8,6882,0,0,25,72000,65534,1,1,0,8,5,4,0,1,1373,1,0,0,0,0),(1371,'Lesson of the Devoted',0,1,1371,1371,1371,1371,8,6880,0,0,23,72000,65534,1,1,0,8,5,4,0,1,1371,1,0,0,0,0),(1372,'Infusion of the Faithful',0,1,1372,1372,1372,1372,8,6881,0,0,24,72000,65534,1,1,0,8,5,4,0,1,1372,1,0,0,0,0),(1374,'Expedient Recovery',0,1,1374,1374,1374,1374,8,6883,0,0,26,590400,65534,1,1,0,8,5,4,0,1,1374,1,0,0,0,0),(1376,'Staunch Recovery',0,1,1376,1376,1376,1376,8,6885,0,0,28,259200,65534,1,1,0,8,5,4,0,1,1376,1,0,0,0,0),(1375,'Steadfast Servant',0,1,1375,1375,1375,1375,8,6884,0,0,27,72000,65534,1,1,0,8,5,4,0,1,1375,1,0,0,0,0),(1377,'Intensity of the Resolute',0,1,1377,1377,1377,1377,8,6886,0,0,29,14400,65534,1,1,0,8,5,4,0,1,1377,1,0,0,0,0),(1287,'Shield Block',3,3,4294967295,4294967295,1287,1287,7,0,0,0,0,0,42,0,67,3,8,4294967295,2,3,9,1287,1,0,0,5516,0),(7800,'Harm Touch',0,17,7800,7800,7800,7800,3,13531,0,0,39,4320,32,0,1,1,0,9,3,0,17,7800,4,0,0,0,0),(7850,'Lay on Hands',0,17,7850,7850,7850,7850,3,13546,0,0,39,4320,8,0,1,1,0,9,3,0,17,7850,4,0,0,0,0),(1131,'Throwing Mastery',3,3,4294967295,4294967295,1131,1131,5,4294967295,0,0,0,0,0,1,61,3,3,4294967295,3,0,3,1131,1,0,0,0,0),(1146,'Tireless Sprint',3,3,2147483647,2147483647,2147483647,2147483647,5,0,0,0,0,0,0,1,61,3,5,4294967295,3,0,3,1146,1,0,0,0,0),(1137,'Hastened War Cry',3,3,2147483647,2147483647,2147483647,2147483647,5,0,0,0,0,0,0,1,61,3,5,4294967295,3,0,3,1137,1,0,0,0,0),(1435,'Gift of Mana',3,3,4294967295,4294967295,1435,1435,7,0,83,3,0,0,31812,0,66,3,10,4294967295,2,3,3,1435,1,0,0,0,0),(1486,'Abundant Healing',5,5,4294967295,4294967295,1486,1486,7,0,1086,3,0,0,1092,0,66,0,10,4294967295,2,0,15,1486,1,0,0,5529,0),(1478,'Pyromancy',3,3,1478,4294967295,1478,1478,7,8406,0,0,99,1,4096,0,66,0,10,4294967295,3,0,3,1478,2,0,0,0,0),(1378,'Curse of Blood',0,1,4294967295,4294967295,1378,1378,8,0,0,0,0,0,65534,1,0,0,5,2,4,0,1,1378,1,0,0,0,0),(1379,'Affliction of Blood',0,1,4294967295,4294967295,1379,1379,8,0,1378,1,0,0,65534,1,0,0,5,2,4,0,1,1379,1,0,0,0,0),(1380,'Torment of Blood',0,1,4294967295,4294967295,1380,1380,8,0,1379,1,0,0,65534,1,0,0,5,2,4,0,1,1380,1,0,0,0,0),(1381,'Temptation of Blood',0,1,4294967295,4294967295,1381,1381,8,0,1380,1,0,0,65534,1,0,0,5,2,4,0,1,1381,1,0,0,0,0),(1382,'Invitation of Blood',0,1,4294967295,4294967295,1382,1382,8,0,1381,1,0,0,65534,1,0,0,5,2,4,0,1,1382,1,0,0,0,0),(1011,'Trials of Mata Muram',0,6,4294967295,4294967295,1011,1011,7,0,0,0,0,0,65534,1,0,0,0,1,4,0,6,1011,1,0,0,0,0),(1361,'Gift of the Dark Reign',0,1,4294967295,4294967295,1361,1361,8,0,0,0,0,0,65534,1,0,0,0,2,4,0,1,1361,1,0,0,0,0),(1362,'Tenacity of the Dark Reign',0,1,4294967295,4294967295,1362,1362,8,0,1361,1,0,0,65534,1,0,0,0,2,4,0,1,1362,1,0,0,0,0),(1363,'Embrace of the Dark Reign',0,1,4294967295,4294967295,1363,1363,8,0,1362,1,0,0,65534,1,0,0,0,2,4,0,1,1363,1,0,0,0,0),(1364,'Power of the Dark Reign',0,1,4294967295,4294967295,1364,1364,8,0,1363,1,0,0,65534,1,0,0,0,2,4,0,1,1364,1,0,0,0,0),(1365,'Fervor of the Dark Reign',0,1,4294967295,4294967295,1365,1365,8,0,1364,1,0,0,65534,1,0,0,0,2,4,0,1,1365,1,0,0,0,0),(1366,'Gift of the Keepers',0,1,4294967295,4294967295,1366,1366,8,0,0,0,0,0,65534,1,0,0,0,2,4,0,1,1366,1,0,0,0,0),(1367,'Valor of the Keepers',0,1,4294967295,4294967295,1367,1367,8,0,1366,1,0,0,65534,1,0,0,0,2,4,0,1,1367,1,0,0,0,0),(1368,'Embrace of the Keepers',0,1,4294967295,4294967295,1368,1368,8,0,1367,1,0,0,65534,1,0,0,0,2,4,0,1,1368,1,0,0,0,0),(1369,'Power of the Keepers',0,1,4294967295,4294967295,1369,1369,8,0,1368,1,0,0,65534,1,0,0,0,2,4,0,1,1369,1,0,0,0,0),(1370,'Sanctity of the Keepers',0,1,4294967295,4294967295,1370,1370,8,0,1369,1,0,0,65534,1,0,0,0,2,4,0,1,1370,1,0,0,0,0),(5150,'Breath of Atathus',0,15,5150,5150,5150,5150,10,11112,0,0,80,300,65534,1,0,0,523,8,4,0,15,5150,4,0,0,0,0),(5165,'Breath of Draton\'ra',0,15,5165,5165,5165,5165,10,11127,0,0,80,300,65534,1,0,0,524,8,4,0,15,5165,4,0,0,0,0),(5180,'Breath of Osh\'vir',0,15,5180,5180,5180,5180,10,11142,0,0,80,300,65534,1,0,0,525,8,4,0,15,5180,4,0,0,0,0),(5195,'Breath of Venesh',0,15,5195,5195,5195,5195,10,11157,0,0,80,300,65534,1,0,0,526,8,4,0,15,5195,4,0,0,0,0),(5210,'Breath of Mysaphar',0,15,5210,5210,5210,5210,10,11172,0,0,80,300,65534,1,0,0,527,8,4,0,15,5210,4,0,0,0,0),(5225,'Breath of Keikolin',0,15,5225,5225,5225,5225,10,11187,0,0,80,300,65534,1,0,0,528,8,4,0,15,5225,4,0,0,0,0),(1647,'Harmonic Dissonance',0,1,1647,1647,1647,1647,10,8771,0,0,81,30,65534,1,0,0,0,2,4,0,1,1647,4,0,0,0,0),(4702,'Glyph of Dragon Scales',3,1,4702,4702,4702,4702,4,9475,0,0,98,600,65534,1,71,0,12,7,4,0,1,4702,4,0,0,0,0),(4703,'Glyph of Angry Thoughts',4,1,52004,52004,52004,52004,4,12752,0,0,97,600,65534,1,76,0,14,7,4,0,1,52004,4,0,0,0,0),(4704,'Glyph of Arcane Secrets',3,1,4704,4704,4704,4704,4,9477,0,0,96,600,65534,1,71,0,12,7,4,0,1,4704,4,0,0,0,0),(4705,'Glyph of Draconic Potential',3,1,4705,4705,4705,4705,4,9478,0,0,95,600,65534,1,71,0,12,7,4,0,1,4705,4,0,0,0,0),(4706,'Glyph of Destruction',3,1,4706,4706,4706,4706,4,9479,0,0,94,600,65534,1,71,0,12,7,4,0,1,4706,4,0,0,0,0),(4707,'Glyph of Courage',4,1,52000,52000,52000,52000,4,12748,0,0,93,600,65534,1,76,0,14,7,4,0,1,52000,4,0,0,0,0),(4708,'Glyph of Frantic Infusion',4,1,52003,52003,52003,52003,4,12751,0,0,92,600,65534,1,76,0,14,7,4,0,1,52003,4,0,0,0,0),(4709,'Glyph of Stored Life',4,1,52002,52002,52002,52002,4,12750,0,0,91,600,65534,1,76,0,14,7,4,0,1,52002,4,0,0,0,0),(4710,'Glyph of Recovery',4,1,52001,52001,52001,52001,4,12749,0,0,90,600,65534,1,76,0,14,7,4,0,1,52001,4,0,0,0,0),(4665,'Throne of Heroes',0,1,4665,4665,4665,4665,8,9177,0,0,30,4320,65534,1,1,0,8,4294967295,4,0,1,4665,4,0,0,0,0),(1597,'Call of Challenge',9,1,1597,1597,1597,1597,7,8271,0,0,6,10,2,0,70,0,10,4294967295,3,0,1,1597,1,0,0,0,0),(912,'Warlord\'s Tenacity',3,3,912,912,912,912,6,4925,0,0,4,3600,2,0,65,3,7,4294967295,3,0,6,912,1,0,0,0,0),(1583,'Hastened Defiance',5,1,4294967295,4294967295,1583,1583,7,4294967295,912,3,0,0,2,0,70,0,10,4294967295,3,0,1,1583,1,0,0,0,0),(1586,'Dauntless Perseverance',12,1,4294967295,4294967295,1586,1586,7,4294967295,222,3,0,0,2,0,70,0,10,4294967295,3,0,1,1586,1,0,0,0,0),(1611,'Field Dressing',3,5,4294967295,4294967295,1611,1611,7,4294967295,537,2,0,0,2,1,66,0,10,4294967295,3,0,5,1417,1,0,0,0,0),(5136,'Combat Medic',3,5,4294967295,4294967295,4688,4688,3,4294967295,1611,5,0,0,2,1,71,0,12,4294967295,3,0,5,4688,4,0,0,0,1),(1587,'Concentration',3,3,4294967295,4294967295,1587,1587,7,4294967295,0,0,0,0,642,1,66,0,10,4294967295,2,0,3,1587,1,0,0,0,0),(1621,'Relentless Assault',7,3,4294967295,4294967295,1621,1621,7,4294967295,564,3,0,0,658,1,70,0,10,4294967295,2,0,6,564,1,0,3,0,0),(1330,'Resolute Defiance',3,3,912,912,1330,1330,7,4925,912,3,4,3600,2,0,70,3,8,4294967295,3,0,6,912,1,0,0,0,0),(1536,'Wicked Blade',3,3,4294967295,4294967295,1536,1536,7,4294967295,599,3,0,0,146,1,70,0,10,4294967295,2,0,12,599,1,0,3,5534,0),(1388,'Innate See Invis',9,1,4294967295,4294967295,1388,1388,7,0,0,0,0,0,65534,1,70,0,10,4294967295,1,0,1,1388,1,0,0,0,0),(1627,'Selo\'s Enduring Cadence',3,3,4294967295,4294967295,1627,1627,7,4294967295,672,2,0,0,256,0,66,0,10,4294967295,3,0,3,1627,1,0,0,0,0),(1301,'Flurry of Knives',3,3,4294967295,4294967295,1301,1301,7,4294967295,846,3,0,0,512,0,66,3,8,4294967295,3,0,6,846,1,0,3,0,0),(1539,'Forced Opening',3,3,4294967295,4294967295,1539,1539,7,4294967295,878,3,0,0,512,0,70,0,10,4294967295,3,0,6,878,1,0,3,0,0),(1624,'Knight\'s Expertise',7,3,4294967295,4294967295,1624,1624,7,4294967295,561,3,0,0,40,0,70,0,10,4294967295,3,0,6,561,1,0,3,0,0),(1050,'Veteran\'s Wrath',3,3,4294967295,4294967295,1050,1050,7,4294967295,443,3,0,0,2,1,67,3,8,4294967295,2,0,3,1050,1,0,0,0,0),(1044,'Veteran\'s Wrath',3,3,4294967295,4294967295,1044,1044,7,4294967295,443,3,0,0,512,0,67,3,8,4294967295,2,0,3,1044,1,0,0,0,0),(1047,'Veteran\'s Wrath',3,3,4294967295,4294967295,1047,1047,7,4294967295,443,3,0,0,16,0,67,3,8,4294967295,2,0,3,1047,1,0,0,0,0),(1524,'Vanquish Undead',7,3,4294967295,4294967295,1524,1524,10,4294967295,190,3,0,0,8,0,70,0,10,4294967295,3,0,6,190,1,0,3,0,0),(8201,'Companion\'s Fury',7,3,4294967295,4294967295,8201,8201,6,4294967295,0,0,0,0,60448,0,81,0,15,4294967295,2,0,3,8201,5,0,0,0,2),(1327,'Ancestral Aid',5,3,1327,1327,1327,1327,7,5933,0,0,2,900,1024,0,67,0,8,4294967295,3,0,3,1327,1,0,0,0,0),(1323,'Spiritual Channeling',12,1,1323,1323,1323,1323,1,5932,146,1,0,2160,1024,0,70,0,8,4294967295,3,0,1,1323,1,0,0,0,0),(1394,'Precognition',5,5,4294967295,4294967295,1394,1394,7,4294967295,1061,5,0,0,65534,1,70,0,10,4294967295,1,0,33,125,1,0,13,5519,0),(5519,'Combat Agility V',6,5,4294967295,4294967295,125,125,7,4294967295,1394,5,0,0,65534,1,76,1,14,4294967295,1,0,33,125,4,0,18,7501,1),(1290,'Scout\'s Efficiency',3,3,4294967295,4294967295,5519,1290,7,4294967295,864,3,0,0,16,0,70,3,8,4294967295,3,0,6,864,1,0,3,0,0),(1399,'Thick Skin',5,5,4294967295,4294967295,1399,1399,7,4294967295,1066,5,0,0,65534,1,70,0,10,4294967295,1,0,33,122,1,0,13,5524,0),(5524,'Combat Stability V',6,5,4294967295,4294967295,122,122,7,4294967295,1399,5,0,0,65534,1,76,1,14,4294967295,1,0,33,122,4,0,18,7506,1),(6287,'Warlord\'s Return Kick',6,3,4294967295,4294967295,6566,6566,3,4294967295,0,0,0,0,2,0,73,0,14,4294967295,3,0,3,6566,4,0,0,0,0),(7106,'Beastlords Feral Kick',6,3,4294967295,4294967295,7106,7106,3,4294967295,0,0,0,0,32768,0,73,0,14,4294967295,3,0,3,7106,4,0,0,0,0),(6269,'Hunter\'s Return Kick',6,3,4294967295,4294967295,6558,6558,3,4294967295,0,0,0,0,16,0,73,0,14,4294967295,3,0,3,6558,4,0,0,0,0),(6266,'Knight\'s Return Strike',6,3,4294967295,4294967295,6557,6557,3,4294967295,0,0,0,0,40,0,73,0,14,4294967295,3,0,3,6557,4,0,0,0,0),(1166,'Frenzied Defense',3,3,4294967295,4294967295,1143,1143,6,4294967295,0,0,0,0,0,1,65,0,7,4294967295,3,0,3,1143,4,0,0,0,0),(6275,'Knave\'s Return Strike',6,3,4294967295,4294967295,6560,6560,3,4294967295,0,0,0,0,512,0,73,0,14,4294967295,3,0,3,6560,4,0,0,0,0),(1163,'Crazed Onslaught',5,3,4294967295,4294967295,116,116,7,4294967295,542,3,0,0,2,1,67,0,8,4294967295,3,0,12,255,1,0,6,4795,0),(4795,'Flurry IV',5,3,4294967295,4294967295,255,255,7,4294967295,1163,3,0,0,2,1,71,0,12,4294967295,3,0,12,255,4,0,9,0,2),(1616,'Lightning Strikes',5,3,4294967295,4294967295,13785,13786,7,4294967295,0,0,0,0,16,1,66,3,10,4294967295,3,0,3,1616,1,0,0,0,0),(5061,'Petrified Roots ',5,1,4294967295,4294967295,567,567,7,4294967295,567,1,0,0,64,0,71,0,14,4294967295,3,0,2,567,4,0,1,0,0),(8263,'Earthen Brawn',5,5,4294967295,4294967295,8263,8263,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8263,6,0,0,0,0),(8268,'Earthen Stability',5,5,4294967295,4294967295,8268,8268,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8268,6,0,0,0,0),(8273,'Earthen Alacrity',5,5,4294967295,4294967295,8273,8273,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8273,6,0,0,0,0),(8278,'Earthen Artistry',5,5,4294967295,4294967295,8278,8278,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8278,6,0,0,0,0),(8283,'Earthen Sagacity',5,5,4294967295,4294967295,8283,8283,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8283,6,0,0,0,0),(8288,'Earthen Brilliance',5,5,4294967295,4294967295,8288,8288,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8288,6,0,0,0,0),(8293,'Earthen Allure',5,5,4294967295,4294967295,8293,8293,1,4294967295,7357,5,0,0,65534,1,81,0,16,4294967295,1,0,5,8293,6,0,0,0,0),(4678,'Planar Power III',5,5,4294967295,4294967295,418,418,4,4294967295,1001,5,0,0,65534,1,71,0,12,4294967295,1,0,20,418,4,0,10,7547,1),(7547,'Planar Power IV',5,5,4294967295,4294967295,418,418,4,4294967295,4678,5,0,0,65534,1,81,0,15,4294967295,1,0,20,418,5,0,15,0,1),(12423,'Critical Affliction III',9,3,4294967295,4294967295,767,767,7,4294967295,1099,3,0,0,36192,0,81,3,16,4294967295,2,0,9,767,6,0,6,0,0),(7647,'Persistent Casting II',6,3,4294967295,4294967295,692,692,6,4294967295,692,3,0,0,64892,0,81,0,15,4294967295,2,0,9,692,5,0,3,7670,2),(7670,'Persistent Casting III',7,3,4294967295,4294967295,692,692,6,4294967295,7647,3,0,0,64892,0,85,2,16,4294967295,2,0,9,692,6,0,6,0,0),(8224,'Cascade of Life',5,3,4294967295,4294967295,8224,8224,7,4294967295,1486,5,0,0,1092,0,75,0,15,4294967295,2,0,3,8224,5,0,0,0,5),(5529,'Abundant Healing II',7,5,4294967295,4294967295,1486,1486,7,0,1486,5,0,0,1092,0,76,2,14,4294967295,2,0,15,1486,4,0,5,7554,1),(7554,'Abundant Healing III',7,5,4294967295,4294967295,1486,1486,7,0,5529,5,0,0,1092,0,81,2,15,4294967295,2,0,15,1486,5,0,10,0,1),(4755,'Destructive Fury II',6,3,4294967295,4294967295,1210,1210,7,4294967295,1210,3,0,0,4096,0,71,1,12,4294967295,2,0,9,1210,4,0,3,0,2),(5557,'Enhanced Aggression III',5,5,4294967295,4294967295,1592,8232,7,4294967295,4725,5,0,0,33722,1,76,0,14,4294967295,2,0,25,1592,4,0,10,7568,1),(7582,'Destructive Fury IV',8,3,4294967295,4294967295,1210,1210,7,4294967295,5557,3,0,0,27716,0,81,2,15,4294967295,2,0,9,1210,5,0,9,0,2),(4779,'Healing Gift IV',6,3,4294967295,4294967295,30404,30405,7,4294967295,1086,3,0,0,33884,0,71,1,12,4294967295,2,0,21,80,4,0,9,5592,2),(5592,'Healing Gift V',7,3,4294967295,4294967295,30404,30405,7,4294967295,4779,3,0,0,33884,0,76,2,14,4294967295,2,0,21,80,4,0,12,7590,2),(7590,'Healing Gift VI',7,3,4294967295,4294967295,30404,30405,7,4294967295,5592,3,0,0,33884,0,81,2,15,4294967295,2,0,21,80,5,0,15,12454,2),(12454,'Healing Gift VII',12,3,4294967295,4294967295,30404,30405,7,4294967295,7590,0,0,0,33884,0,85,2,16,4294967295,2,0,21,80,6,0,18,0,0),(4773,'Gift of Radiant Mana',9,1,4294967295,4294967295,4773,4773,7,0,1435,3,0,0,31812,0,71,0,12,4294967295,2,0,1,4773,4,0,0,0,0),(6517,'Gift of Exquisite Radiant Mana',9,1,4294967295,4294967295,4773,4773,7,0,4773,1,0,0,31812,0,76,0,14,4294967295,2,0,1,6517,4,0,0,0,0),(7621,'Gift of Amazing Exquisite Radiant Mana',9,1,4294967295,4294967295,4773,4773,7,0,6517,1,0,0,31812,0,81,0,15,4294967295,2,0,1,6517,5,0,0,0,0),(8235,'Armor of Wisdom',6,5,4294967295,4294967295,8235,8235,7,4294967295,0,0,0,0,2,0,81,0,15,4294967295,2,0,10,8235,5,0,0,8305,1),(8305,'Armor of Wisdom II',6,5,4294967295,4294967295,8235,8235,7,4294967295,0,0,0,0,2,0,85,0,16,4294967295,2,0,10,8235,6,0,5,0,0),(4721,'Finishing Blow IV',3,3,4294967295,4294967295,119,119,7,4294967295,1053,3,0,0,33722,1,71,0,12,4294967295,2,0,21,119,4,0,9,5554,2),(5554,'Finishing Blow V',7,3,4294967295,4294967295,119,119,7,4294967295,4721,3,0,0,33722,1,76,2,14,4294967295,2,0,21,119,4,0,12,7565,2),(7565,'Finishing Blow VI',7,3,4294967295,4294967295,119,119,7,4294967295,5554,3,0,0,33722,1,81,2,15,4294967295,2,0,21,119,4,0,15,6023,2),(6023,'Finishing Blow VII',12,3,4294967295,4294967295,119,119,7,4294967295,7565,3,0,0,33722,1,85,0,16,4294967295,2,0,21,119,6,0,18,0,0),(4739,'Killing Spree',3,3,4294967295,4294967295,4739,4739,7,4294967295,0,0,0,0,642,1,71,3,12,4294967295,2,0,9,4739,4,0,0,5562,2),(5562,'Killing Spree II',7,3,4294967295,4294967295,4739,4739,7,4294967295,4739,3,0,0,642,1,76,2,14,4294967295,2,0,9,4739,4,0,3,7573,2),(7573,'Killing Spree III',7,3,4294967295,4294967295,4739,4739,7,4294967295,5562,3,0,0,642,1,76,2,15,4294967295,2,0,9,4739,5,0,6,0,0),(8198,'Empowered Ingenuity',4,3,4294967295,4294967295,8198,8198,7,4294967295,625,3,0,0,642,1,65,0,15,4294967295,2,0,3,8198,5,0,0,0,0),(4733,'Ingenuity II',3,3,4294967295,4294967295,4733,4733,5,4294967295,625,3,0,0,642,1,71,0,12,4294967295,2,0,9,625,4,0,3,7641,2),(7641,'Ingenuity III',3,3,4294967295,4294967295,4733,4733,5,4294967295,4733,3,0,0,642,1,76,0,15,4294967295,2,0,9,625,5,0,6,0,0),(1592,'Enhanced Aggression',5,5,4294967295,4294967295,1592,1592,7,4294967295,0,0,0,0,33722,1,70,0,10,4294967295,2,0,25,1592,1,0,0,4725,0),(4725,'Enhanced Aggression II',5,5,4294967295,4294967295,1592,1592,7,4294967295,1592,5,0,0,33722,1,71,0,12,4294967295,2,0,25,1592,4,0,5,5557,1),(7568,'Enhanced Aggression IV',5,5,4294967295,4294967295,1592,1592,7,4294967295,5557,5,0,0,33722,1,81,0,15,4294967295,2,0,25,1592,5,0,15,12439,1),(12439,'Enhanced Aggression V',5,5,4294967295,4294967295,1592,1592,7,4294967295,7568,5,0,0,33722,1,85,0,16,4294967295,2,0,25,1592,6,0,20,0,0),(8232,'Extended Ingenuity',4,3,4294967295,4294967295,8232,8232,7,4294967295,0,0,0,0,642,1,65,0,15,4294967295,2,0,4,8232,5,0,0,8261,0),(8261,'Extended Ingenuity',4,1,4294967295,4294967295,8232,8232,7,4294967295,8232,5,0,0,642,1,80,0,16,4294967295,2,0,4,8232,6,0,3,0,0),(10367,'Ageless Enmity',12,1,10367,10367,10367,10367,7,21751,0,0,30,360,2,0,85,0,16,4294967295,2,0,1,10367,6,0,0,0,0),(5534,'Punishing Blade III',8,3,4294967295,4294967295,599,599,7,4294967295,1536,3,0,0,146,1,76,2,14,4294967295,2,0,12,599,4,0,6,7659,2),(7659,'Punishing Blade IV',8,3,4294967295,4294967295,599,599,7,4294967295,5534,3,0,0,146,1,81,2,15,4294967295,2,0,12,599,5,0,9,0,2),(8215,'Hard Endurance',5,5,4294967295,4294967295,8215,8215,7,4294967295,0,0,0,0,642,1,65,0,15,4294967295,2,0,5,8215,5,0,0,0,5),(1036,'Fitness',5,3,4294967295,4294967295,1036,1036,7,4294967295,683,3,0,0,642,1,66,0,8,4294967295,2,0,15,683,1,0,3,5130,0),(5130,'Heightened Endurance III',5,5,4294967295,4294967295,683,683,7,4294967295,1036,3,0,0,642,1,71,0,12,4294967295,2,0,15,683,1,0,6,6080,1),(6080,'Heightened Endurance IV',5,2,4294967295,4294967295,683,683,7,4294967295,5130,5,0,0,642,1,75,0,14,4294967295,2,0,15,683,4,0,11,7604,0),(7604,'Heightened Endurance IV',5,2,4294967295,4294967295,683,683,7,4294967295,6080,2,0,0,642,1,80,0,15,4294967295,2,0,15,683,5,0,13,0,0),(5516,'Shield Block II',8,3,4294967295,4294967295,1287,1287,7,0,1287,3,0,0,42,0,76,1,14,4294967295,2,0,9,1287,4,0,3,12469,2),(12469,'Shield Block III',7,3,4294967295,4294967295,1287,1287,7,0,5516,3,0,0,42,0,81,2,16,4294967295,2,0,9,1287,6,0,6,0,0),(5317,'Spell Casting Subtlety II',4,3,4294967295,4294967295,738,738,6,0,738,3,0,0,1092,0,71,0,12,4294967295,2,0,12,738,4,0,3,5628,2),(5628,'Spell Casting Subtlety III',7,3,4294967295,4294967295,738,738,6,0,5317,3,0,0,1092,0,76,2,14,4294967295,2,0,12,738,4,0,6,7583,2),(7583,'Spell Casting Subtlety IV',7,3,4294967295,4294967295,738,738,6,0,5628,3,0,0,1092,0,81,2,15,4294967295,2,0,12,738,5,0,9,0,2),(12449,'Healing Adept IV',10,3,4294967295,4294967295,77,77,7,4294967295,1083,3,0,0,33884,0,81,1,16,4294967295,2,0,12,77,6,0,9,0,0),(7501,'Combat Agility VI',7,5,4294967295,4294967295,125,125,7,4294967295,5519,5,0,0,65534,1,81,1,15,4294967295,1,0,33,125,5,0,23,12396,1),(12396,'Combat Agility VII',8,5,4294967295,4294967295,125,125,7,4294967295,7501,5,0,0,65534,1,85,1,16,4294967295,1,0,33,125,6,0,28,0,0),(7506,'Combat Stability VI',7,5,4294967295,4294967295,122,122,7,4294967295,5524,5,0,0,65534,1,81,1,15,4294967295,1,0,33,122,5,0,23,12401,1),(12401,'Combat Stability VII',8,5,4294967295,4294967295,122,122,7,4294967295,7506,5,0,0,65534,1,85,1,16,4294967295,1,0,33,122,6,0,28,0,0),(1389,'Delay Death II',3,5,4294967295,4294967295,1206,1206,1,4294967295,1026,5,0,0,65534,1,70,0,10,4294967295,1,0,25,1026,1,0,5,4683,0),(4683,'Delay Death III',3,5,4294967295,4294967295,1206,1206,1,4294967295,1389,5,0,0,65534,1,71,0,12,4294967295,1,0,25,1026,4,0,10,6523,1),(6523,'Delay Death IV',3,5,4294967295,4294967295,1206,1206,1,4294967295,4683,5,0,0,65534,1,76,0,14,4294967295,1,0,25,1026,4,0,15,7511,1),(7511,'Delay Death V',3,5,4294967295,4294967295,1206,1206,1,4294967295,6523,5,0,0,65534,1,81,0,15,4294967295,1,0,25,1026,5,0,20,0,1),(1056,'Energetic Attunement',3,5,4294967295,4294967295,1206,1206,1,4294967295,0,0,0,0,65534,1,71,0,12,4294967295,1,0,15,1056,4,0,0,6431,1),(6431,'Energetic Attunement II',3,5,4294967295,4294967295,1643,1643,1,4294967295,1056,5,0,0,65534,1,76,0,14,4294967295,1,0,15,1056,4,0,5,7522,1),(7522,'Energetic Attunement III',3,5,4294967295,4294967295,1643,1643,1,4294967295,6431,5,0,0,65534,1,81,0,15,4294967295,1,0,15,1056,5,0,10,0,1),(6119,'General Sturdiness',6,5,4294967295,4294967295,6119,6119,1,4294967295,0,0,0,0,65534,1,76,0,14,4294967295,1,0,15,6119,4,0,0,7527,1),(7527,'General Sturdiness II',6,5,4294967295,4294967295,6119,6119,1,4294967295,6119,5,0,0,65534,1,81,0,15,4294967295,1,0,15,6119,5,0,5,12406,1),(12406,'General Sturdiness III',6,5,4294967295,4294967295,6119,6119,1,4294967295,7526,5,0,0,65534,1,81,0,16,4294967295,1,0,15,6119,6,0,10,0,0),(7516,'Discordant Defiance II',5,5,4294967295,4294967295,1006,1006,1,4294967295,1006,5,0,0,65534,1,71,0,15,4294967295,1,0,10,1006,5,0,5,0,0),(6521,'Mystical Attuning II',5,2,4294967295,4294967295,1021,1021,1,4294967295,1021,5,0,0,65534,1,75,0,14,4294967295,1,0,12,1021,4,0,5,7539,5),(7539,'Mystical Attuning III',5,5,4294967295,4294967295,1021,1021,1,4294967295,6521,2,0,0,65534,1,80,0,16,4294967295,1,0,12,1021,6,0,7,0,0),(5045,'Mystical Shielding',9,1,4294967295,4294967295,1057,1057,1,4294967295,0,0,0,0,65534,1,85,0,16,4294967295,1,0,1,1057,6,0,0,0,0),(8228,'Mental Fortitude',5,3,4294967295,4294967295,8828,8828,1,4294967295,0,0,0,0,65534,1,75,0,15,4294967295,1,0,3,8228,5,0,0,0,5),(7050,'Mastery of the Past II',5,3,4294967295,4294967295,735,735,5,4294967295,0,0,0,0,33884,0,67,0,8,4294967295,2,0,15,735,1,0,3,7053,0),(7053,'Mastery of the Past III',7,3,4294967295,4294967295,735,735,5,4294967295,7050,3,0,0,33884,0,71,0,12,4294967295,2,0,15,735,4,0,6,7063,2),(7063,'Mastery of the Past IV',8,3,4294967295,4294967295,735,735,5,4294967295,7053,3,0,0,33884,0,76,0,14,4294967295,2,0,15,735,4,0,9,7622,2),(7622,'Mastery of the Past V',8,3,4294967295,4294967295,735,735,5,4294967295,7063,3,0,0,33884,0,81,0,15,4294967295,2,0,15,735,5,0,12,0,2),(895,'Intense Hatred',5,5,4294967295,4294967295,895,895,3,4294967295,0,0,0,0,32,0,65,0,7,4294967295,3,0,5,895,1,0,0,0,0),(1230,'Nature\'s Bounty',1,3,4294967295,4294967295,1230,1230,7,0,0,0,0,0,80,0,51,1,8,4294967295,3,0,6,1230,1,0,0,5000,2),(5000,'Survivalist',2,3,4294967295,4294967295,5000,5000,7,4294967295,1230,3,0,0,80,0,71,0,12,4294967295,3,0,6,1230,1,0,3,0,2),(1604,'Anatomy',5,3,4294967295,4294967295,1604,1604,1,4294967295,0,0,0,0,512,0,60,1,10,4294967295,3,0,3,1604,1,0,0,0,0),(1209,'Sanctuary',12,1,1209,4294967295,1209,1209,3,5912,0,0,14,4320,4,0,70,0,8,4294967295,3,0,1,1209,1,0,0,0,0),(4698,'Quick Draw',5,1,4294967295,4294967295,4698,4698,1,4294967295,0,0,0,0,65534,1,51,0,12,4294967295,1,0,2,4698,4,0,0,6545,0),(6545,'Quick Draw II',5,1,4294967295,4294967295,4698,4698,1,4294967295,4698,1,0,0,65534,1,56,0,14,4294967295,1,0,2,4698,5,0,1,0,0); + +DROP TABLE IF EXISTS `aa_actions`; +CREATE TABLE `aa_actions` ( + `aaid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `rank` tinyint(3) unsigned NOT NULL DEFAULT '0', + `reuse_time` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `target` tinyint(3) unsigned NOT NULL DEFAULT '0', + `nonspell_action` tinyint(3) unsigned NOT NULL DEFAULT '0', + `nonspell_mana` mediumint(8) unsigned NOT NULL DEFAULT '0', + `nonspell_duration` mediumint(8) unsigned NOT NULL DEFAULT '0', + `redux_aa` mediumint(8) unsigned NOT NULL DEFAULT '0', + `redux_rate` tinyint(4) NOT NULL DEFAULT '0', + `redux_aa2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `redux_rate2` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`aaid`,`rank`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `aa_actions` VALUES (128,0,4320,5228,1,0,0,100000,782,10,0,0),(129,0,259200,2738,2,0,0,0,0,0,0,0),(130,0,7,2739,1,0,0,0,0,0,0,0),(131,0,4320,2740,2,0,0,0,0,0,0,0),(132,0,8640,2741,2,0,0,0,462,10,0,0),(133,0,4320,2776,1,0,0,0,0,0,0,0),(133,1,4320,2777,1,0,0,0,0,0,0,0),(133,2,4320,2778,1,0,0,0,0,0,0,0),(136,0,4320,2742,2,0,0,0,468,10,0,0),(140,0,4320,2771,1,0,0,0,477,10,0,0),(145,0,4320,0,2,8,0,0,0,0,0,0),(146,0,180,2749,1,0,0,0,0,0,0,0),(153,0,7200,2750,1,0,0,0,474,10,0,0),(154,0,7200,2751,2,0,0,0,0,0,0,0),(155,0,420,2758,1,0,0,0,0,0,0,0),(156,0,4320,2734,1,0,0,0,0,0,0,0),(162,0,8640,2753,1,0,0,0,471,10,0,0),(163,0,2160,2752,5,0,0,0,483,10,0,0),(167,0,900,2754,5,0,0,0,0,0,0,0),(168,0,900,2795,1,0,0,0,0,0,0,0),(168,1,900,2796,1,0,0,0,0,0,0,0),(168,2,900,2797,1,0,0,0,0,0,0,0),(171,0,900,2798,1,0,0,0,0,0,0,0),(171,1,900,2799,1,0,0,0,0,0,0,0),(171,2,900,2800,1,0,0,0,0,0,0,0),(174,0,900,2792,1,0,0,0,0,0,0,0),(174,1,900,2793,1,0,0,0,0,0,0,0),(174,2,900,2794,1,0,0,0,0,0,0,0),(177,0,900,2789,1,0,0,0,0,0,0,0),(177,1,900,2790,1,0,0,0,0,0,0,0),(177,2,900,2791,1,0,0,0,0,0,0,0),(181,0,300,8133,2,0,0,0,486,10,0,0),(181,1,300,8134,2,0,0,0,486,10,0,0),(181,2,300,8135,2,0,0,0,486,10,0,0),(183,0,8640,2755,2,0,0,0,0,0,0,0),(184,0,4320,2756,2,0,0,0,0,0,0,0),(185,0,4320,2757,1,0,0,0,0,0,0,0),(186,0,7,2772,1,0,0,0,0,0,0,0),(187,0,4320,2764,2,0,0,0,0,0,0,0),(188,0,30,2190,2,0,0,0,583,24,0,0),(193,0,4320,0,2,10,0,0,0,0,0,0),(194,0,1,2874,1,0,0,0,0,0,0,0),(197,0,7,2765,1,0,0,0,0,0,0,0),(206,0,1,2875,1,0,0,0,0,0,0,0),(207,0,4320,2774,2,0,0,0,596,17,0,0),(208,0,4320,2766,2,0,0,0,596,17,0,0),(233,0,1800,2742,1,0,0,0,495,10,0,0),(243,0,4320,5244,1,0,0,0,498,10,886,10),(254,0,4320,5232,1,0,0,0,501,10,0,0),(258,0,600,5233,1,0,0,0,492,10,0,0),(259,0,900,0,1,1,0,0,489,10,0,0),(260,0,2160,5229,1,0,0,0,0,0,0,0),(260,1,2160,5230,1,0,0,0,0,0,0,0),(260,2,2160,5231,1,0,0,0,0,0,0,0),(274,0,4320,2748,2,0,0,0,480,10,0,0),(289,0,300,3290,5,0,0,0,0,0,0,0),(290,0,720,3289,1,0,0,0,0,0,0,0),(291,0,900,3291,3,0,0,0,0,0,0,0),(459,0,180,3297,1,0,0,0,754,10,0,0),(459,1,180,3298,1,0,0,0,754,10,0,0),(459,2,180,3299,1,0,0,0,754,10,0,0),(507,0,180,3252,1,0,0,0,0,0,0,0),(507,1,180,3253,1,0,0,0,0,0,0,0),(507,2,180,3254,1,0,0,0,0,0,0,0),(510,0,240,3255,2,0,0,0,0,0,0,0),(510,1,240,3256,2,0,0,0,0,0,0,0),(510,2,240,3257,2,0,0,0,0,0,0,0),(513,0,120,3274,2,0,0,0,0,0,0,0),(513,1,120,3275,2,0,0,0,0,0,0,0),(513,2,120,3276,2,0,0,0,0,0,0,0),(516,0,480,3338,1,0,0,0,0,0,0,0),(517,0,600,3258,1,0,0,0,0,0,0,0),(517,1,600,3259,1,0,0,0,0,0,0,0),(517,2,600,3260,1,0,0,0,0,0,0,0),(520,0,540,3265,2,0,0,0,0,0,0,0),(520,1,540,3266,2,0,0,0,0,0,0,0),(520,2,540,3267,2,0,0,0,0,0,0,0),(523,0,540,3268,2,0,0,0,0,0,0,0),(523,1,540,3269,2,0,0,0,0,0,0,0),(523,2,540,3270,2,0,0,0,0,0,0,0),(526,0,1,5844,1,0,0,0,0,0,0,0),(526,1,1,3248,1,0,0,0,0,0,0,0),(526,2,1,3249,1,0,0,0,0,0,0,0),(528,0,720,3283,2,0,0,0,0,0,0,0),(528,1,720,3284,2,0,0,0,0,0,0,0),(528,2,720,3285,2,0,0,0,0,0,0,0),(531,0,900,3250,2,0,0,0,0,0,0,0),(531,1,900,3251,2,0,0,0,0,0,0,0),(533,0,420,3264,1,0,0,0,0,0,0,0),(534,0,2160,3261,1,0,0,0,849,10,0,0),(534,1,2160,3262,1,0,0,0,849,10,0,0),(534,2,2160,3263,1,0,0,0,849,10,0,0),(545,0,900,3271,1,0,0,0,0,0,0,0),(545,1,900,3272,1,0,0,0,0,0,0,0),(545,2,900,3273,1,0,0,0,0,0,0,0),(548,0,900,3277,1,0,0,0,0,0,0,0),(548,1,900,3278,1,0,0,0,0,0,0,0),(548,2,900,3279,1,0,0,0,0,0,0,0),(592,0,18,3282,2,0,0,0,0,0,0,0),(616,0,900,3286,2,0,0,0,0,0,0,0),(616,1,900,3287,2,0,0,0,0,0,0,0),(616,2,900,3288,2,0,0,0,0,0,0,0),(619,0,900,3292,2,0,0,0,0,0,0,0),(619,1,900,3293,2,0,0,0,0,0,0,0),(619,2,900,3294,2,0,0,0,0,0,0,0),(630,0,1,5243,1,16,900,0,0,0,0,0),(643,0,0,5227,1,0,0,0,0,0,0,0),(645,0,5,3614,2,0,0,0,0,0,0,0),(718,0,120,4521,1,0,0,0,0,0,0,0),(718,1,120,4522,1,0,0,0,0,0,0,0),(718,2,120,4523,1,0,0,0,0,0,0,0),(721,0,900,5110,2,0,0,0,0,0,0,0),(721,1,900,5111,2,0,0,0,0,0,0,0),(921,0,60,4833,1,0,0,0,0,0,0,0),(922,0,60,4834,1,0,0,0,0,0,0,0),(923,0,60,4835,1,0,0,0,0,0,0,0),(926,0,1800,4836,2,0,0,0,0,0,0,0),(926,1,1800,4837,2,0,0,0,0,0,0,0),(926,2,1800,4848,2,0,0,0,0,0,0,0),(926,3,1800,4839,2,0,0,0,0,0,0,0),(926,4,1800,4840,2,0,0,0,0,0,0,0),(931,0,4320,5245,1,0,0,0,0,0,0,0),(931,1,4320,5246,1,0,0,0,0,0,0,0),(931,2,4320,5247,1,0,0,0,0,0,0,0),(1000,0,4320,5824,1,0,0,0,0,0,0,0),(1119,0,900,5841,2,0,0,0,0,0,0,0),(1119,1,900,5842,2,0,0,0,0,0,0,0),(1119,2,900,5843,2,0,0,0,0,0,0,0),(1123,0,900,5854,1,0,0,0,0,0,0,0),(1123,1,900,5855,1,0,0,0,0,0,0,0),(1123,2,900,5856,1,0,0,0,0,0,0,0),(1126,0,2160,5845,5,0,0,0,483,10,0,0),(1126,1,2160,5846,5,0,0,0,483,10,0,0),(1126,2,2160,5847,5,0,0,0,483,10,0,0),(1229,0,4160,6094,1,0,0,0,0,0,0,0),(1334,0,4320,5943,2,0,0,0,0,0,0,0),(1334,1,4320,5944,2,0,0,0,0,0,0,0),(1334,2,4320,5945,2,0,0,0,0,0,0,0),(1337,0,4320,5946,1,0,0,0,0,0,0,0),(1337,1,4320,5947,1,0,0,0,0,0,0,0),(1337,2,4320,5948,1,0,0,0,0,0,0,0),(1340,0,60,5950,1,0,0,0,0,0,0,0),(1341,0,60,5951,1,0,0,0,0,0,0,0),(1342,0,60,5952,1,0,0,0,0,0,0,0),(1343,0,300,5953,3,0,0,0,0,0,0,0),(1344,0,60,5949,1,0,0,0,0,0,0,0),(828,0,3600,5240,1,0,0,0,0,0,0,0),(828,1,3600,5241,1,0,0,0,0,0,0,0),(828,2,3600,5242,1,0,0,0,0,0,0,0),(831,0,1800,4564,2,0,0,0,0,0,0,0),(831,1,1800,4565,2,0,0,0,0,0,0,0),(831,2,1800,4566,2,0,0,0,0,0,0,0),(872,0,180,4802,0,0,0,0,0,0,0,0),(872,1,180,4803,0,0,0,0,0,0,0,0),(872,2,180,4804,0,0,0,0,0,0,0,0),(875,0,180,4805,0,0,0,0,0,0,0,0),(875,1,180,4806,0,0,0,0,0,0,0,0),(875,2,180,4807,0,0,0,0,0,0,0,0),(860,0,180,3297,0,0,0,0,0,0,0,0),(860,1,180,3298,0,0,0,0,0,0,0,0),(860,2,180,3299,0,0,0,0,0,0,0,0),(863,0,4320,5248,0,0,0,0,0,0,0,0),(900,0,720,4826,2,0,0,0,0,0,0,0),(900,1,720,4827,2,0,0,0,0,0,0,0),(1478,2,1,8408,1,0,0,0,0,0,0,0),(1478,1,1,8407,1,0,0,0,0,0,0,0),(1478,0,1,8406,1,0,0,0,0,0,0,0),(746,0,2160,4549,1,0,0,0,0,0,0,0),(746,1,2160,4550,1,0,0,0,0,0,0,0),(746,2,2160,4551,1,0,0,0,0,0,0,0),(749,0,1800,4790,1,0,0,0,0,0,0,0),(749,1,1800,4791,1,0,0,0,0,0,0,0),(749,2,1800,4792,1,0,0,0,0,0,0,0),(749,3,1800,4793,1,0,0,0,0,0,0,0),(749,4,1800,4794,1,0,0,0,0,0,0,0),(757,0,1800,4796,1,0,0,0,0,0,0,0),(757,1,1800,4797,1,0,0,0,0,0,0,0),(757,2,1800,4798,1,0,0,0,0,0,0,0),(757,3,1800,4799,1,0,0,0,0,0,0,0),(757,4,1800,4800,1,0,0,0,0,0,0,0),(1149,0,1320,5853,1,0,0,0,0,0,0,0),(1150,0,2160,5848,1,0,0,0,0,0,0,0),(1150,1,2160,5849,1,0,0,0,0,0,0,0),(1150,2,2160,5850,1,0,0,0,0,0,0,0),(773,0,1800,4552,2,0,0,0,0,0,0,0),(773,1,1800,4553,2,0,0,0,0,0,0,0),(773,2,1800,4554,2,0,0,0,0,0,0,0),(785,0,900,5235,1,0,0,0,0,0,0,0),(785,1,900,5236,1,0,0,0,0,0,0,0),(785,2,900,5237,1,0,0,0,0,0,0,0),(785,3,900,5238,1,0,0,0,0,0,0,0),(785,4,900,5239,1,0,0,0,0,0,0,0),(702,0,18,4842,2,0,0,0,0,0,0,0),(702,1,18,4843,2,0,0,0,0,0,0,0),(702,2,18,4844,2,0,0,0,0,0,0,0),(702,3,18,4845,2,0,0,0,0,0,0,0),(702,4,18,4846,2,0,0,0,0,0,0,0),(209,0,5,5919,0,0,0,0,0,0,0,0),(1373,0,72000,6882,0,0,0,0,0,0,0,0),(1371,0,72000,6880,0,0,0,0,0,0,0,0),(1372,0,72000,6881,0,0,0,0,0,0,0,0),(1374,0,590400,6883,0,0,0,0,0,0,0,0),(1376,0,259200,6885,0,0,0,0,0,0,0,0),(1375,0,72000,6884,0,0,0,0,0,0,0,0),(1377,0,14400,6886,0,0,0,0,0,0,0,0),(7800,0,4320,13531,2,0,0,0,596,17,0,0),(7800,1,4320,13532,2,0,0,0,596,17,0,0),(7800,2,4320,13533,2,0,0,0,596,17,0,0),(7800,3,4320,13534,2,0,0,0,596,17,0,0),(7800,4,4320,13535,2,0,0,0,596,17,0,0),(7800,5,4320,13536,2,0,0,0,596,17,0,0),(7800,6,4320,13537,2,0,0,0,596,17,0,0),(7800,7,4320,13538,2,0,0,0,596,17,0,0),(7800,8,4320,13539,2,0,0,0,596,17,0,0),(7800,9,4320,13540,2,0,0,0,596,17,0,0),(7800,10,4320,13541,2,0,0,0,596,17,0,0),(7800,11,4320,13542,2,0,0,0,596,17,0,0),(7800,12,4320,13543,2,0,0,0,596,17,0,0),(7800,13,4320,13544,2,0,0,0,596,17,0,0),(7800,14,4320,13545,2,0,0,0,596,17,0,0),(7800,15,4320,13562,2,0,0,0,596,17,0,0),(7800,16,4320,13563,2,0,0,0,596,17,0,0),(7850,0,4320,13546,2,0,0,0,593,17,0,0),(7850,1,4320,13547,2,0,0,0,593,17,0,0),(7850,2,4320,13548,2,0,0,0,593,17,0,0),(7850,3,4320,13549,2,0,0,0,593,17,0,0),(7850,4,4320,13550,2,0,0,0,593,17,0,0),(7850,5,4320,13551,2,0,0,0,593,17,0,0),(7850,6,4320,13552,2,0,0,0,593,17,0,0),(7850,7,4320,13553,2,0,0,0,593,17,0,0),(7850,8,4320,13554,2,0,0,0,593,17,0,0),(7850,9,4320,13555,2,0,0,0,593,17,0,0),(7850,10,4320,13556,2,0,0,0,593,17,0,0),(7850,11,4320,13557,2,0,0,0,593,17,0,0),(7850,12,4320,13558,2,0,0,0,593,17,0,0),(7850,13,4320,13559,2,0,0,0,593,17,0,0),(7850,14,4320,13560,2,0,0,0,593,17,0,0),(7850,15,4320,13561,2,0,0,0,593,17,0,0),(7850,16,4320,16028,2,0,0,0,593,17,0,0),(5150,0,300,11112,1,0,0,0,0,0,0,0),(5150,1,300,11113,1,0,0,0,0,0,0,0),(5150,2,300,11114,1,0,0,0,0,0,0,0),(5150,3,300,11115,1,0,0,0,0,0,0,0),(5150,4,300,11116,1,0,0,0,0,0,0,0),(5150,5,300,11117,1,0,0,0,0,0,0,0),(5150,6,300,11118,1,0,0,0,0,0,0,0),(5150,7,300,11119,1,0,0,0,0,0,0,0),(5150,8,300,11120,1,0,0,0,0,0,0,0),(5150,9,300,11121,1,0,0,0,0,0,0,0),(5150,10,300,11122,1,0,0,0,0,0,0,0),(5150,11,300,11123,1,0,0,0,0,0,0,0),(5150,12,300,11124,1,0,0,0,0,0,0,0),(5150,13,300,11125,1,0,0,0,0,0,0,0),(5150,14,300,11126,1,0,0,0,0,0,0,0),(5165,0,300,11127,1,0,0,0,0,0,0,0),(5165,1,300,11128,1,0,0,0,0,0,0,0),(5165,2,300,11129,1,0,0,0,0,0,0,0),(5165,3,300,11130,1,0,0,0,0,0,0,0),(5165,4,300,11131,1,0,0,0,0,0,0,0),(5165,5,300,11132,1,0,0,0,0,0,0,0),(5165,6,300,11133,1,0,0,0,0,0,0,0),(5165,7,300,11134,1,0,0,0,0,0,0,0),(5165,8,300,11135,1,0,0,0,0,0,0,0),(5165,9,300,11136,1,0,0,0,0,0,0,0),(5165,10,300,11137,1,0,0,0,0,0,0,0),(5165,11,300,11138,1,0,0,0,0,0,0,0),(5165,12,300,11139,1,0,0,0,0,0,0,0),(5165,13,300,11140,1,0,0,0,0,0,0,0),(5165,14,300,11141,1,0,0,0,0,0,0,0),(5180,0,300,11142,1,0,0,0,0,0,0,0),(5180,1,300,11143,1,0,0,0,0,0,0,0),(5180,2,300,11144,1,0,0,0,0,0,0,0),(5180,3,300,11145,1,0,0,0,0,0,0,0),(5180,4,300,11146,1,0,0,0,0,0,0,0),(5180,5,300,11147,1,0,0,0,0,0,0,0),(5180,6,300,11148,1,0,0,0,0,0,0,0),(5180,7,300,11149,1,0,0,0,0,0,0,0),(5180,8,300,11150,1,0,0,0,0,0,0,0),(5180,9,300,11151,1,0,0,0,0,0,0,0),(5180,10,300,11152,1,0,0,0,0,0,0,0),(5180,11,300,11153,1,0,0,0,0,0,0,0),(5180,12,300,11154,1,0,0,0,0,0,0,0),(5180,13,300,11155,1,0,0,0,0,0,0,0),(5180,14,300,11156,1,0,0,0,0,0,0,0),(5195,0,300,11157,1,0,0,0,0,0,0,0),(5195,1,300,11158,1,0,0,0,0,0,0,0),(5195,2,300,11159,1,0,0,0,0,0,0,0),(5195,3,300,11160,1,0,0,0,0,0,0,0),(5195,4,300,11161,1,0,0,0,0,0,0,0),(5195,5,300,11162,1,0,0,0,0,0,0,0),(5195,6,300,11163,1,0,0,0,0,0,0,0),(5195,7,300,11164,1,0,0,0,0,0,0,0),(5195,8,300,11165,1,0,0,0,0,0,0,0),(5195,9,300,11166,1,0,0,0,0,0,0,0),(5195,10,300,11167,1,0,0,0,0,0,0,0),(5195,11,300,11168,1,0,0,0,0,0,0,0),(5195,12,300,11169,1,0,0,0,0,0,0,0),(5195,13,300,11170,1,0,0,0,0,0,0,0),(5195,14,300,11171,1,0,0,0,0,0,0,0),(5210,0,300,11172,1,0,0,0,0,0,0,0),(5210,1,300,11173,1,0,0,0,0,0,0,0),(5210,2,300,11174,1,0,0,0,0,0,0,0),(5210,3,300,11175,1,0,0,0,0,0,0,0),(5210,4,300,11176,1,0,0,0,0,0,0,0),(5210,5,300,11177,1,0,0,0,0,0,0,0),(5210,6,300,11178,1,0,0,0,0,0,0,0),(5210,7,300,11179,1,0,0,0,0,0,0,0),(5210,8,300,11180,1,0,0,0,0,0,0,0),(5210,9,300,11181,1,0,0,0,0,0,0,0),(5210,10,300,11182,1,0,0,0,0,0,0,0),(5210,11,300,11183,1,0,0,0,0,0,0,0),(5210,12,300,11184,1,0,0,0,0,0,0,0),(5210,13,300,11185,1,0,0,0,0,0,0,0),(5210,14,300,11186,1,0,0,0,0,0,0,0),(5225,0,300,11187,1,0,0,0,0,0,0,0),(5225,1,300,11188,1,0,0,0,0,0,0,0),(5225,2,300,11189,1,0,0,0,0,0,0,0),(5225,3,300,11190,1,0,0,0,0,0,0,0),(5225,4,300,11191,1,0,0,0,0,0,0,0),(5225,5,300,11192,1,0,0,0,0,0,0,0),(5225,6,300,11193,1,0,0,0,0,0,0,0),(5225,7,300,11194,1,0,0,0,0,0,0,0),(5225,8,300,11195,1,0,0,0,0,0,0,0),(5225,9,300,11196,1,0,0,0,0,0,0,0),(5225,10,300,11197,1,0,0,0,0,0,0,0),(5225,11,300,11198,1,0,0,0,0,0,0,0),(5225,12,300,11199,1,0,0,0,0,0,0,0),(5225,13,300,11200,1,0,0,0,0,0,0,0),(5225,14,300,11201,1,0,0,0,0,0,0,0),(1647,0,30,8771,1,0,0,0,0,0,0,0),(4702,0,600,9475,1,0,0,0,0,0,0,0),(4703,0,600,12752,1,0,0,0,0,0,0,0),(4704,0,600,9477,1,0,0,0,0,0,0,0),(4705,0,600,9478,1,0,0,0,0,0,0,0),(4706,0,600,9479,1,0,0,0,0,0,0,0),(4707,0,600,12748,1,0,0,0,0,0,0,0),(4708,0,600,12751,5,0,0,0,0,0,0,0),(4709,0,600,12750,1,0,0,0,0,0,0,0),(4710,0,600,12749,1,0,0,0,0,0,0,0),(723,0,60,4788,2,0,0,0,0,0,0,0),(4665,0,4320,9177,0,0,0,0,0,0,0,0),(1597,0,10,8271,2,0,0,0,0,0,0,0),(912,0,3600,4925,1,0,0,0,1583,10,0,0),(912,1,3600,4926,1,0,0,0,1583,10,0,0),(912,2,3600,4927,1,0,0,0,1583,10,0,0),(1330,1,3600,5936,1,0,0,0,1583,10,0,0),(1330,2,3600,5937,1,0,0,0,1583,10,0,0),(1330,3,3600,5938,1,0,0,0,1583,10,0,0),(1327,0,900,5933,2,0,0,0,0,0,0,0),(1327,1,900,5934,2,0,0,0,0,0,0,0),(1327,2,900,5935,2,0,0,0,0,0,0,0),(1323,0,2160,5932,1,0,0,0,0,0,0,0),(10367,1,360,21751,2,0,0,0,0,0,0,0),(1209,0,4320,5912,1,0,0,0,0,0,0,0); From e7681f1b49e417bd63249d1087e8faa2a843c8d2 Mon Sep 17 00:00:00 2001 From: Leere Date: Wed, 19 Nov 2014 09:40:08 +0100 Subject: [PATCH 0287/1883] Fix for GetTradeRecipe results variable overload instead of reuse --- zone/tradeskills.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 0fd130f89..c7ac3339e 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1226,7 +1226,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "WHERE tre.recipe_id IN (%s) " "GROUP BY tre.recipe_id HAVING sum(tre.componentcount) = %u " "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); - auto results = QueryDatabase(query); + results = QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); From 4a83b4acb9f61d707f3045db71529374951fe9ff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 19 Nov 2014 02:40:33 -0600 Subject: [PATCH 0288/1883] PEQ AA Download option 4 implemented - http://i.imgur.com/OBrIOCM.png --- utils/scripts/db_update.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index 7e8282d00..d592bebc3 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -128,6 +128,7 @@ sub ShowMenuPrompt { 1 => \&database_dump, 2 => \&database_dump_compress, 3 => \&Run_Database_Check, + 4 => \&AA_Fetch, 0 => \&Exit, ); @@ -176,6 +177,7 @@ Database Management Menu (Please Select): 2) Backup Database Compressed - (Saves to Backups folder) Ideal to perform before performing updates 3) $option[3] + 4) AAs - Get Latest AA's from PEQ (This deletes AA's already in the database) 0) Exit EO_MENU @@ -268,6 +270,15 @@ sub trim { return $string; } +#::: Fetch Latest PEQ AA's +sub AA_Fetch{ + print "Pulling down PEQ AA Tables...\n"; + GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/peq_aa_tables.sql", "db_update/peq_aa_tables.sql"); + print "\n\nInstalling AA Tables...\n"; + print GetMySQLResultFromFile("db_update/peq_aa_tables.sql"); + print "\nDone...\n\n"; +} + #::: Responsible for Database Upgrade Routines sub Run_Database_Check{ #::: Run 2 - Running pending updates... From 1ed9c3082c8d96f13ed3a73cfbcad0824a30aa5b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 19 Nov 2014 15:00:09 -0500 Subject: [PATCH 0289/1883] Add see invis check to tracking packet --- zone/entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index eeebfa88d..ed5b99219 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2960,7 +2960,8 @@ bool EntityList::MakeTrackPacket(Client *client) Group *g = client->GetGroup(); for (auto it = mob_list.cbegin(); it != mob_list.cend(); ++it) { - if (!it->second || it->second == client || !it->second->IsTrackable()) + if (!it->second || it->second == client || !it->second->IsTrackable() || + it->second->IsInvisible(client)) continue; MobDistance = it->second->DistNoZ(*client); From 6c5248b9a97e78146b283f98968e083acf50986e Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 19 Nov 2014 22:43:19 -0600 Subject: [PATCH 0290/1883] Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly. --- zone/client.cpp | 9 +++ zone/client.h | 4 +- zone/client_packet.cpp | 18 ++++-- zone/merc.cpp | 139 ++++++++++++++++++++++++++++++++--------- zone/merc.h | 3 +- 5 files changed, 134 insertions(+), 39 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 25dbb2840..ec4c8a63e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7305,6 +7305,8 @@ void Client::SendMercPersonalInfo() stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercPersonalInfo Cancelled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount); SendMercMerchantResponsePacket(0); return; } @@ -7398,6 +7400,13 @@ void Client::SendMercPersonalInfo() return; } } + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); + } + else + { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID); } SendMercMerchantResponsePacket(0); } diff --git a/zone/client.h b/zone/client.h index c2dabdc62..025c0744c 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1094,12 +1094,13 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void RemoveGroupXTargets(); void RemoveAutoXTargets(); void ShowXTargets(Client *c); + void InitializeMercInfo(); bool CheckCanSpawnMerc(uint32 template_id); bool CheckCanHireMerc(Mob* merchant, uint32 template_id); bool CheckCanRetainMerc(uint32 upkeep); bool CheckCanUnsuspendMerc(); - bool CheckCanDismissMerc(); + bool DismissMerc(uint32 MercID); inline uint32 GetMercID() const { return mercid; } inline uint8 GetMercSlot() const { return mercSlot; } void SetMercID( uint32 newmercid) { mercid = newmercid; } @@ -1126,6 +1127,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void UpdateMercLevel(); void CheckMercSuspendTimer(); Timer* GetMercTimer() { return &merc_timer; }; + const char* GetRacePlural(Client* client); const char* GetClassPlural(Client* client); void SendWebLink(const char* website); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 15c4f3497..265d7d65d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9557,6 +9557,17 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) if (merchant_id == 0) { //send info about your current merc(s) + if (GetMercID()) + { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercPersonalInfo Request"); + SendMercPersonalInfo(); + } + else + { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercID()); + } } if (!RuleB(Mercs, AllowMercs)) { @@ -9699,12 +9710,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); // Handle the dismiss here... - Merc* merc = GetMerc(); - if (merc) { - if (CheckCanDismissMerc()) { - merc->Dismiss(); - } - } + DismissMerc(GetMercInfo().mercid); // GetMercID() } diff --git a/zone/merc.cpp b/zone/merc.cpp index 4984fcca6..077705de9 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5098,6 +5098,9 @@ bool Merc::Spawn(Client *owner) { entity_list.AddMerc(this, true, true); SendPosition(); + + if (MERC_DEBUG > 0) + owner->Message(7, "Mercenary Debug: Spawn."); //UpdateMercAppearance(); @@ -5244,6 +5247,8 @@ void Client::SendMercResponsePackets(uint32 ResponseType) SendMercMerchantResponsePacket(3); break; } + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercResponsePackets %i.", ResponseType); } void Client::UpdateMercTimer() @@ -5283,6 +5288,9 @@ void Client::UpdateMercTimer() { SendMercResponsePackets(16); } + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: UpdateMercTimer Complete."); // Normal upkeep charge message //Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60)); @@ -5334,6 +5342,9 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { return false; } } + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: CheckCanHireMerc True."); return true; } @@ -5398,6 +5409,9 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) { SendMercResponsePackets(9); return false; } + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: CheckCanSpawnMerc True."); return true; } @@ -5418,17 +5432,9 @@ bool Client::CheckCanUnsuspendMerc() { Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend)); return false; } - - return true; -} - -bool Client::CheckCanDismissMerc() { - - if(!GetMercID()) - { - Message(7, "You have no mercenary to dismiss."); - return false; - } + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: CheckCanUnsuspendMerc True."); return true; } @@ -5441,19 +5447,24 @@ void Client::CheckMercSuspendTimer() { { GetMercInfo().SuspendedTime = 0; SendMercResponsePackets(0); + SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: CheckMercSuspendTimer Ready."); } } } void Client::SuspendMercCommand() { - bool ExistsMerc = GetMercInfo().MercTemplateID != 0; - if(ExistsMerc == true) + if(GetMercInfo().MercTemplateID != 0) { if(GetMercInfo().IsSuspended) { if(!CheckCanUnsuspendMerc()) { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SuspendMercCommand Unable to Unsuspend."); + return; } @@ -5462,11 +5473,15 @@ void Client::SuspendMercCommand() { if(merc) { SpawnMerc(merc, true); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SuspendMercCommand Successful Unsuspend."); } else { //merc failed to spawn SendMercResponsePackets(3); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SuspendMercCommand Failed to Spawn Merc."); } } else @@ -5476,6 +5491,8 @@ void Client::SuspendMercCommand() { if(CurrentMerc && GetMercID()) { CurrentMerc->Suspend(); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SuspendMercCommand Successful Suspend."); } } } @@ -5510,16 +5527,27 @@ void Client::SpawnMercOnZone() { { SpawnMerc(merc, false); } + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SpawnMercOnZone Normal Merc."); } else { + int32 TimeDiff = GetMercInfo().SuspendedTime + RuleI(Mercs, SuspendIntervalS) - time(nullptr); + if (TimeDiff > 0) + { + if (!GetPTimers().Enabled(pTimerMercSuspend)) + { + // Start the timer to send the packet that refreshes the Unsuspend Button + GetPTimers().Start(pTimerMercSuspend, TimeDiff); + } + } // Send Mercenary Status/Timer packet SendMercTimer(GetMerc()); - - SendMercPersonalInfo(); - + //SendMercPersonalInfo(); CheckMercSuspendTimer(); - SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime); + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SpawnMercOnZone Suspended Merc."); } } } @@ -5528,21 +5556,28 @@ void Client::SendMercTimer(Merc* merc) { if (GetMercInfo().mercid == 0) { - //return; + return; } if (!merc) { SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercTimer No Merc."); } else if (merc->IsSuspended()) { SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercTimer Suspended Merc."); } else { SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SendMercTimer Normal Merc."); } + } void Client::SpawnMerc(Merc* merc, bool setMaxStats) { @@ -5559,7 +5594,10 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) { merc->SetStance(GetMercInfo().Stance); GetMercInfo().SuspendedTime = 0; - SendMercTimer(merc); + //SendMercTimer(merc); + + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SpawnMerc Success."); return; @@ -5589,6 +5627,9 @@ bool Merc::Suspend() { // Start the timer to send the packet that refreshes the Unsuspend Button mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS)); + + if (MERC_DEBUG > 0) + mercOwner->Message(7, "Mercenary Debug: Suspend Complete."); return true; } @@ -5622,7 +5663,7 @@ bool Merc::Unsuspend(bool setMaxStats) { if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false)) mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend); - mercOwner->SendMercPersonalInfo(); + //mercOwner->SendMercPersonalInfo(); Group* g = entity_list.GetGroupByClient(mercOwner); //nobody from our group is here... start a new group @@ -5694,30 +5735,41 @@ bool Merc::Unsuspend(bool setMaxStats) { if(cost > 0 && !mercOwner->HasMoney(cost)) { mercOwner->SendMercResponsePackets(1); + Suspend(); return false; } } + Save(); } } return true; } -bool Merc::Dismiss() { +bool Client::DismissMerc(uint32 MercID) { - Client* mercOwner = GetMercOwner(); - - database.DeleteMerc(GetMercID()); - - if(mercOwner) + bool Dismissed = true; + if (!database.DeleteMerc(MercID)) { - mercOwner->SendClearMercInfo(); - mercOwner->SetMerc(0); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Dismiss Failed for MercID %i", MercID); + Dismissed = false; + } + else + { + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Dismiss Successful."); } - Depop(); + if (GetMerc()) + { + GetMerc()->Depop(); + } - return true; + SendClearMercInfo(); + SetMerc(nullptr); + + return Dismissed; } void Merc::Zone() { @@ -5842,6 +5894,8 @@ Merc* Client::GetMerc() { if(GetMercID() == 0) { + if (MERC_DEBUG > 0) + //Message(7, "Mercenary Debug: GetMerc 0."); return (nullptr); } @@ -5849,14 +5903,21 @@ Merc* Client::GetMerc() { if(tmp == nullptr) { SetMercID(0); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: GetMerc No Merc."); return (nullptr); } if(tmp->GetOwnerID() != GetID()) { SetMercID(0); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: GetMerc Owner Mismatch."); return (nullptr); } + + if (MERC_DEBUG > 0) + //Message(7, "Mercenary Debug: GetMerc Success."); return (tmp); } @@ -5872,6 +5933,8 @@ uint8 Client::GetNumMercs() { numMercs++; } } + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: GetNumMercs %i.", numMercs); return numMercs; } @@ -5912,6 +5975,8 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().Gender = 0; GetMercInfo().State = 0; memset(GetMercInfo().merc_name, 0, 64); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SetMerc No Merc."); } else { @@ -5928,6 +5993,8 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().Gender = newmerc->GetGender(); //GetMercInfo().State = newmerc->GetStance(); snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName()); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: SetMerc New Merc."); } } @@ -5947,6 +6014,8 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) { MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; mmr->ResponseType = response_type; // send specified response type FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercMerchantResponsePacket %i.", response_type); } } @@ -5955,6 +6024,8 @@ void Client::SendMercenaryUnknownPacket(uint8 type) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercenaryUnknownPacket %i.", type); } @@ -5963,6 +6034,8 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercenaryUnsuspendPacket %i.", type); } @@ -5972,6 +6045,8 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) { SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer; smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercSuspendResponsePacket %i.", suspended_time); } @@ -5986,6 +6061,8 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01); } @@ -5996,6 +6073,8 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) { mas->MercUnk01 = unk01; mas->MercUnk02 = unk02; FastQueuePacket(&outapp); + if (MERC_DEBUG > 0) + Message(7, "Mercenary Debug: Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02); } void NPC::LoadMercTypes() { diff --git a/zone/merc.h b/zone/merc.h index deb5fe53b..433c614fc 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -4,8 +4,8 @@ #include "zonedb.h" #include "npc.h" -#define MAXMERCS 1 #define MERC_DEBUG 0 +#define MAXMERCS 1 #define TANK 1 #define HEALER 2 #define MELEEDPS 9 @@ -136,7 +136,6 @@ public: void AddItem(uint8 slot, uint32 item_id); static const char *GetRandomName(); bool Spawn(Client *owner); - bool Dismiss(); bool Suspend(); bool Unsuspend(bool setMaxStats); void Zone(); From 62e22d1aeab474b7c571e2b57b70fc7c2e05befb Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 19 Nov 2014 22:46:15 -0600 Subject: [PATCH 0291/1883] Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly. --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index f16222025..6d596a646 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/19/2014 == +Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly. + == 11/18/2014 == Trevius: Mercenaries can now zone once again. From b5c6b4763921ff54eacb6a2fd5191aa7de0f3c36 Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 19 Nov 2014 22:52:49 -0600 Subject: [PATCH 0292/1883] Minor Merc Correction. --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 76ec7b9f2..d8f23f8f7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9557,7 +9557,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) if (merchant_id == 0) { //send info about your current merc(s) - if (GetMercID()) + if (GetMercInfo().mercid) { if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SendMercPersonalInfo Request"); @@ -9566,7 +9566,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) else { if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercID()); + Message(7, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid); } } From 4ad8500a3e8760f808d780feb2c87fdd55f66ff1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 19 Nov 2014 21:01:57 -0800 Subject: [PATCH 0293/1883] luabind now compiles with warnings disabled for this library --- luabind/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/luabind/CMakeLists.txt b/luabind/CMakeLists.txt index 9f3288d4a..3024f3652 100644 --- a/luabind/CMakeLists.txt +++ b/luabind/CMakeLists.txt @@ -21,7 +21,7 @@ SET(lb_sources ) SET(lb_headers - + ) ADD_LIBRARY(luabind ${lb_sources} ${lb_headers}) @@ -29,6 +29,12 @@ ADD_LIBRARY(luabind ${lb_sources} ${lb_headers}) IF(UNIX) ADD_DEFINITIONS(-fPIC) + set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) + ENDIF(UNIX) +IF(MSVC) + set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " ) +ENDIF(MSVC) + SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) From fdd78e41dac5fdb422cfb52f1d143fad64038ae4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 19 Nov 2014 21:22:37 -0800 Subject: [PATCH 0294/1883] warning from library file SocketLib\Mime.cpp disabled --- common/CMakeLists.txt | 2 ++ luabind/CMakeLists.txt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index ac42f5e4e..01fcd6df8 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -334,7 +334,9 @@ ADD_LIBRARY(common ${common_sources} ${common_headers}) IF(UNIX) ADD_DEFINITIONS(-fPIC) + SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) ENDIF(UNIX) + SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/luabind/CMakeLists.txt b/luabind/CMakeLists.txt index 3024f3652..5efdf562f 100644 --- a/luabind/CMakeLists.txt +++ b/luabind/CMakeLists.txt @@ -30,7 +30,6 @@ ADD_LIBRARY(luabind ${lb_sources} ${lb_headers}) IF(UNIX) ADD_DEFINITIONS(-fPIC) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) - ENDIF(UNIX) IF(MSVC) From ac463fe9aae4bcf5bd4d03964a2deb0780887fe0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 20 Nov 2014 01:10:24 -0500 Subject: [PATCH 0295/1883] Fix RoF Raid opcodes --- utils/patches/patch_RoF.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 97098946d..027eac161 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -514,8 +514,8 @@ OP_LFGAppearance=0x0000 OP_LFGResponse=0x0000 # Raid Opcodes -OP_RaidInvite=0x1bd1 -OP_RaidUpdate=0x548e +OP_RaidInvite=0x5fb2 +OP_RaidUpdate=0x1bd1 OP_RaidJoin=0x0000 # Button-push commands From 2330285b04fd80625b7593018dbdf3a2b37613e1 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 20 Nov 2014 05:05:15 -0500 Subject: [PATCH 0296/1883] revert --- zone/client.h | 1 - zone/effects.cpp | 27 ++++++++++----------------- zone/spells.cpp | 4 ---- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/zone/client.h b/zone/client.h index de6d187b7..fd797c1b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -875,7 +875,6 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); bool UseDiscipline(uint32 spell_id, uint32 target); - void SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id = SPELL_UNKNOWN); bool CheckTitle(int titleset); void EnableTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 118acb4a3..7506f99cf 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,7 +696,16 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); + CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); + if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; + dts->TimerID = spells[spell_id].EndurTimerIndex; + dts->Duration = reduced_recast; + QueuePacket(outapp); + safe_delete(outapp); + } } else { @@ -705,22 +714,6 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } -void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id) -{ - if (!timer_id && IsValidSpell(spell_id)) - timer_id = spells[spell_id].EndurTimerIndex; - - if(duration > 0 && timer_id && (timer_id < MAX_DISCIPLINE_TIMERS)) - { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); - DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; - dts->TimerID = timer_id; - dts->Duration = duration; - QueuePacket(outapp); - safe_delete(outapp); - } -} - void EntityList::AETaunt(Client* taunter, float range) { if (range == 0) diff --git a/zone/spells.cpp b/zone/spells.cpp index 05000dc51..315fe8712 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2256,10 +2256,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } - //Disc Timer needs to be sent before and after the spell packet. - if (IsClient() && spells[spell_id].IsDisciplineBuff && spells[spell_id].EndurTimerIndex) - CastToClient()->SendDisciplineTimer(casting_spell_timer, casting_spell_timer_duration); - if(IsNPC()) CastToNPC()->AI_Event_SpellCastFinished(true, slot); From f1701aae9fe0781dcc246f11292764e8ed9c786c Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 20 Nov 2014 05:53:59 -0500 Subject: [PATCH 0297/1883] Fix to remove double CastSpell calls from use disc function. --- zone/client.h | 1 + zone/effects.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/zone/client.h b/zone/client.h index 4ffe6d57d..ad30e0e6f 100644 --- a/zone/client.h +++ b/zone/client.h @@ -874,6 +874,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void DropInst(const ItemInst* inst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); + void SendDisciplineTimer(uint32 timer_id, uint32 duration); bool UseDiscipline(uint32 spell_id, uint32 target); bool CheckTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 7506f99cf..0bface8b7 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,16 +696,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); - if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS) - { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); - DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; - dts->TimerID = spells[spell_id].EndurTimerIndex; - dts->Duration = reduced_recast; - QueuePacket(outapp); - safe_delete(outapp); - } + SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); } else { @@ -714,6 +705,19 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } +void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration) +{ + if (timer_id < MAX_DISCIPLINE_TIMERS) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; + dts->TimerID = timer_id; + dts->Duration = duration; + QueuePacket(outapp); + safe_delete(outapp); + } +} + void EntityList::AETaunt(Client* taunter, float range) { if (range == 0) From 357368697676417998d0e50dbbb41ca8af5f1d2d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 21 Nov 2014 22:50:08 -0500 Subject: [PATCH 0298/1883] Fix issue with PendingTranslocateData --- zone/client.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index f09d24039..e012c7364 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3868,11 +3868,11 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { PendingTranslocateData.heading = m_pp.binds[0].heading; } else { - ts->ZoneID = database.GetZoneID(Spell.teleport_zone); + PendingTranslocateData.zone_id = ts->ZoneID = database.GetZoneID(Spell.teleport_zone); PendingTranslocateData.instance_id = 0; - ts->y = Spell.base[0]; - ts->x = Spell.base[1]; - ts->z = Spell.base[2]; + PendingTranslocateData.y = ts->y = Spell.base[0]; + PendingTranslocateData.x = ts->x = Spell.base[1]; + PendingTranslocateData.z = ts->z = Spell.base[2]; PendingTranslocateData.heading = 0.0; } From c5a90adb396e239683601f57a1d30abf13582935 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 22 Nov 2014 00:22:12 -0600 Subject: [PATCH 0299/1883] Grouping with Mercenaries is considerably less buggy. --- zone/client.cpp | 186 +++++++++++++++++++++++- zone/client.h | 6 +- zone/client_packet.cpp | 306 +++++++++++----------------------------- zone/client_process.cpp | 5 +- zone/groups.cpp | 146 ++++++++++++++----- zone/groups.h | 3 +- zone/merc.cpp | 238 +++++++++++++++++++++---------- zone/merc.h | 1 + zone/questmgr.cpp | 2 +- zone/spells.cpp | 2 +- zone/worldserver.cpp | 71 +++++----- zone/zonedb.cpp | 12 +- 12 files changed, 595 insertions(+), 383 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index f09d24039..f555a26e8 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3218,6 +3218,10 @@ void Client::LinkDead() { entity_list.MessageGroup(this,true,15,"%s has gone linkdead.",GetName()); GetGroup()->DelMember(this); + if (GetMerc()) + { + GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup()); + } } Raid *raid = entity_list.GetRaidByClient(this); if(raid){ @@ -4139,6 +4143,184 @@ void Client::UpdateLFP() { worldserver.UpdateLFP(CharacterID(), LFPMembers); } +bool Client::GroupFollow(Client* inviter) { + + if (inviter) + { + isgrouped = true; + Raid* raid = entity_list.GetRaidByClient(inviter); + Raid* iraid = entity_list.GetRaidByClient(this); + + //inviter has a raid don't do group stuff instead do raid stuff! + if (raid) + { + // Suspend the merc while in a raid (maybe a rule could be added for this) + if (GetMerc()) + GetMerc()->Suspend(); + + uint32 groupToUse = 0xFFFFFFFF; + for (int x = 0; x < MAX_RAID_MEMBERS; x++) + { + if (raid->members[x].member) + { + //this assumes the inviter is in the zone + if (raid->members[x].member == inviter){ + groupToUse = raid->members[x].GroupNumber; + break; + } + } + } + if (iraid == raid) + { + //both in same raid + uint32 ngid = raid->GetGroup(inviter->GetName()); + if (raid->GroupCount(ngid) < 6) + { + raid->MoveMember(GetName(), ngid); + raid->SendGroupDisband(this); + //raid->SendRaidGroupAdd(GetName(), ngid); + //raid->SendGroupUpdate(this); + raid->GroupUpdate(ngid); //break + } + return false; + } + if (raid->RaidCount() < MAX_RAID_MEMBERS) + { + if (raid->GroupCount(groupToUse) < 6) + { + raid->SendRaidCreate(this); + raid->SendMakeLeaderPacketTo(raid->leadername, this); + raid->AddMember(this, groupToUse); + raid->SendBulkRaid(this); + //raid->SendRaidGroupAdd(GetName(), groupToUse); + //raid->SendGroupUpdate(this); + raid->GroupUpdate(groupToUse); //break + if (raid->IsLocked()) + { + raid->SendRaidLockTo(this); + } + return false; + } + else + { + raid->SendRaidCreate(this); + raid->SendMakeLeaderPacketTo(raid->leadername, this); + raid->AddMember(this); + raid->SendBulkRaid(this); + if (raid->IsLocked()) + { + raid->SendRaidLockTo(this); + } + return false; + } + } + } + + Group* group = entity_list.GetGroupByClient(inviter); + + if (!group) + { + //Make new group + group = new Group(inviter); + + if (!group) + { + return false; + } + + entity_list.AddGroup(group); + + if (group->GetID() == 0) + { + Message(13, "Unable to get new group id. Cannot create group."); + inviter->Message(13, "Unable to get new group id. Cannot create group."); + return false; + } + + //now we have a group id, can set inviter's id + database.SetGroupID(inviter->GetName(), group->GetID(), inviter->CharacterID(), false); + database.SetGroupLeaderName(group->GetID(), inviter->GetName()); + group->UpdateGroupAAs(); + + //Invite the inviter into the group first.....dont ask + if (inviter->GetClientVersion() < EQClientSoD) + { + EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); + GroupJoin_Struct* outgj = (GroupJoin_Struct*)outapp->pBuffer; + strcpy(outgj->membername, inviter->GetName()); + strcpy(outgj->yourname, inviter->GetName()); + outgj->action = groupActInviteInitial; // 'You have formed the group'. + group->GetGroupAAs(&outgj->leader_aas); + inviter->QueuePacket(outapp); + safe_delete(outapp); + } + else + { + // SoD and later + inviter->SendGroupCreatePacket(); + inviter->SendGroupLeaderChangePacket(inviter->GetName()); + inviter->SendGroupJoinAcknowledge(); + } + + } + + if (!group) + { + return false; + } + + // Remove merc from old group before adding client to the new one + if (GetMerc() && GetMerc()->HasGroup()) + { + GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup()); + } + + if (!group->AddMember(this)) + { + // If failed to add client to new group, regroup with merc + if (GetMerc()) + { + GetMerc()->MercJoinClientGroup(); + } + else + { + isgrouped = false; + } + return false; + } + + if (GetClientVersion() >= EQClientSoD) + { + SendGroupJoinAcknowledge(); + } + + // Temporary hack for SoD, as things seem to work quite differently + if (inviter->IsClient() && inviter->GetClientVersion() >= EQClientSoD) + { + database.RefreshGroupFromDB(inviter); + } + + // Add the merc back into the new group if possible + if (GetMerc()) + { + GetMerc()->MercJoinClientGroup(); + } + + if (inviter->IsLFP()) + { + // If the player who invited us to a group is LFP, have them update world now that we have joined their group. + inviter->UpdateLFP(); + } + + database.RefreshGroupFromDB(this); + group->SendHPPacketsTo(this); + //send updates to clients out of zone... + group->SendGroupJoinOOZ(this); + return true; + } + return false; +} + uint16 Client::GetPrimarySkillValue() { SkillUseTypes skill = HIGHEST_SKILL; //because nullptr == 0, which is 1H Slashing, & we want it to return 0 from GetSkill @@ -7412,13 +7594,15 @@ void Client::SendMercPersonalInfo() } if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); + + SendMercMerchantResponsePacket(0); } else { if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID); } - SendMercMerchantResponsePacket(0); + } void Client::SendClearMercInfo() diff --git a/zone/client.h b/zone/client.h index 4ffe6d57d..72e69e8eb 100644 --- a/zone/client.h +++ b/zone/client.h @@ -208,7 +208,7 @@ public: Client(EQStreamInterface * ieqs); ~Client(); - //abstract virtual function implementations requird by base abstract class + //abstract virtual function implementations required by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill); virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false); virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = false, bool IsFromSpell = false, @@ -710,7 +710,7 @@ public: void UnscribeSpellAll(bool update_client = true); void UntrainDisc(int slot, bool update_client = true); void UntrainDiscAll(bool update_client = true); - bool SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID); + bool SpellGlobalCheck(uint16 Spell_ID, uint32 Char_ID); uint32 GetCharMaxLevelFromQGlobal(); inline bool IsSitting() const {return (playeraction == 1);} @@ -1098,6 +1098,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void RemoveGroupXTargets(); void RemoveAutoXTargets(); void ShowXTargets(Client *c); + bool GroupFollow(Client* inviter); void InitializeMercInfo(); bool CheckCanSpawnMerc(uint32 template_id); @@ -1105,6 +1106,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool CheckCanRetainMerc(uint32 upkeep); bool CheckCanUnsuspendMerc(); bool DismissMerc(uint32 MercID); + bool MercOnlyOrNoGroup(); inline uint32 GetMercID() const { return mercid; } inline uint8 GetMercSlot() const { return mercSlot; } void SetMercID( uint32 newmercid) { mercid = newmercid; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d8f23f8f7..238f324f2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1637,7 +1637,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) } //else, somebody from our group is already here... if (!group) - database.SetGroupID(GetName(), 0, CharacterID()); //cannot re-establish group, kill it + database.SetGroupID(GetName(), 0, CharacterID(), false); //cannot re-establish group, kill it } else { //no group id @@ -6403,7 +6403,10 @@ void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) safe_delete(pack); } - database.SetGroupID(GetName(), 0, CharacterID()); + if (!GetMerc()) + { + database.SetGroupID(GetName(), 0, CharacterID(), false); + } return; } @@ -6433,7 +6436,8 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; Raid *raid = entity_list.GetRaidByClient(this); - if (raid){ + if (raid) + { Mob* memberToDisband = nullptr; if (!raid->IsGroupLeader(GetName())) @@ -6500,93 +6504,80 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } } #endif - if ((group->IsLeader(this) && (GetTarget() == 0 || GetTarget() == this)) || (group->GroupCount()<3)) { + if (group->GroupCount() < 3) + { group->DisbandGroup(); - if (GetMerc() != nullptr) + if (GetMerc()) GetMerc()->Suspend(); } - else { + else if (group->IsLeader(this) && GetTarget() == nullptr) + { + if (group->GroupCount() > 2 && GetMerc() && !GetMerc()->IsSuspended()) + { + group->DisbandGroup(); + GetMerc()->MercJoinClientGroup(); + } + else + { + group->DisbandGroup(); + if (GetMerc()) + GetMerc()->Suspend(); + } + } + else if (group->IsLeader(this) && GetTarget() == this) + { + LeaveGroup(); + if (GetMerc() && !GetMerc()->IsSuspended()) + { + GetMerc()->MercJoinClientGroup(); + } + } + else + { Mob* memberToDisband = nullptr; memberToDisband = GetTarget(); if (!memberToDisband) memberToDisband = entity_list.GetMob(gd->name2); - if (memberToDisband) { - if (group->IsLeader(this)) { + if (memberToDisband) + { + if (group->IsLeader(this)) + { // the group leader can kick other members out of the group... - //group->DelMember(memberToDisband,false); if (memberToDisband->IsClient()) { group->DelMember(memberToDisband, false); Client* memberClient = memberToDisband->CastToClient(); Merc* memberMerc = memberToDisband->CastToClient()->GetMerc(); - if (memberClient && memberMerc && group) + if (memberClient && memberMerc) { - if (!memberMerc->IsGrouped() && !memberClient->IsGrouped()) { - Group *g = new Group(memberClient); - - entity_list.AddGroup(g); - - if (g->GetID() == 0) { - safe_delete(g); - return; - } - if (Merc::AddMercToGroup(memberMerc, g)) { - database.SetGroupLeaderName(g->GetID(), memberClient->GetName()); - g->SaveGroupLeaderAA(); - database.SetGroupID(memberClient->GetName(), g->GetID(), memberClient->CharacterID()); - database.SetGroupID(memberMerc->GetName(), g->GetID(), memberClient->CharacterID(), true); - database.RefreshGroupFromDB(memberClient); - } - } + memberMerc->MercJoinClientGroup(); } } - else if (memberToDisband->IsMerc()) { + else if (memberToDisband->IsMerc()) + { memberToDisband->CastToMerc()->Suspend(); } } - else { + else + { // ...but other members can only remove themselves group->DelMember(this, false); - if (!IsGrouped() && GetMerc() != nullptr) { - if (!IsGrouped()) { - Group *g = new Group(this); - - if (!g) { - delete g; - g = nullptr; - return; - } - - entity_list.AddGroup(g); - - if (g->GetID() == 0) { - safe_delete(g); - return; - } - - if (Merc::AddMercToGroup(GetMerc(), g)) { - database.SetGroupLeaderName(g->GetID(), this->GetName()); - g->SaveGroupLeaderAA(); - database.SetGroupID(this->GetName(), g->GetID(), this->CharacterID()); - database.SetGroupID(GetMerc()->GetName(), g->GetID(), this->CharacterID(), true); - database.RefreshGroupFromDB(this); - } - else - { - if (GetMerc()) - GetMerc()->Depop(); - } - } + if (GetMerc() && !GetMerc()->IsSuspended()) + { + GetMerc()->MercJoinClientGroup(); } } } else + { LogFile->write(EQEMuLog::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + } } - if (LFP) { + if (LFP) + { // If we are looking for players, update to show we are on our own now. UpdateLFP(); } @@ -6616,157 +6607,22 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) GroupGeneric_Struct* gf = (GroupGeneric_Struct*)app->pBuffer; Mob* inviter = entity_list.GetClientByName(gf->name1); - - if (inviter != nullptr && inviter->IsClient()) { - isgrouped = true; - strn0cpy(gf->name1, inviter->GetName(), 64); - strn0cpy(gf->name2, this->GetName(), 64); - - Raid* raid = entity_list.GetRaidByClient(inviter->CastToClient()); - Raid* iraid = entity_list.GetRaidByClient(this); - - //inviter has a raid don't do group stuff instead do raid stuff! - if (raid){ - // Suspend the merc while in a raid (maybe a rule could be added for this) - if (GetMerc()) - GetMerc()->Suspend(); - - uint32 groupToUse = 0xFFFFFFFF; - for (int x = 0; x < MAX_RAID_MEMBERS; x++){ - if (raid->members[x].member){ //this assumes the inviter is in the zone - if (raid->members[x].member == inviter->CastToClient()){ - groupToUse = raid->members[x].GroupNumber; - break; - } - } - } - if (iraid == raid){ //both in same raid - uint32 ngid = raid->GetGroup(inviter->GetName()); - if (raid->GroupCount(ngid) < 6){ - raid->MoveMember(GetName(), ngid); - raid->SendGroupDisband(this); - //raid->SendRaidGroupAdd(GetName(), ngid); - //raid->SendGroupUpdate(this); - raid->GroupUpdate(ngid); //break - } - return; - } - if (raid->RaidCount() < MAX_RAID_MEMBERS){ - if (raid->GroupCount(groupToUse) < 6){ - raid->SendRaidCreate(this); - raid->SendMakeLeaderPacketTo(raid->leadername, this); - raid->AddMember(this, groupToUse); - raid->SendBulkRaid(this); - //raid->SendRaidGroupAdd(GetName(), groupToUse); - //raid->SendGroupUpdate(this); - raid->GroupUpdate(groupToUse); //break - if (raid->IsLocked()) { - raid->SendRaidLockTo(this); - } - return; - } - else{ - raid->SendRaidCreate(this); - raid->SendMakeLeaderPacketTo(raid->leadername, this); - raid->AddMember(this); - raid->SendBulkRaid(this); - if (raid->IsLocked()) { - raid->SendRaidLockTo(this); - } - return; - } - } + + // Inviter and Invitee are in the same zone + if (inviter != nullptr && inviter->IsClient()) + { + if (GroupFollow(inviter->CastToClient())) + { + strn0cpy(gf->name1, inviter->GetName(), sizeof(gf->name1)); + strn0cpy(gf->name2, GetName(), sizeof(gf->name2)); + inviter->CastToClient()->QueuePacket(app);//notify inviter the client accepted } - - Group* group = entity_list.GetGroupByClient(inviter->CastToClient()); - - if (!group){ - //Make new group - group = new Group(inviter); - if (!group) - return; - entity_list.AddGroup(group); - - if (group->GetID() == 0) { - Message(13, "Unable to get new group id. Cannot create group."); - inviter->Message(13, "Unable to get new group id. Cannot create group."); - return; - } - - //now we have a group id, can set inviter's id - database.SetGroupID(inviter->GetName(), group->GetID(), inviter->CastToClient()->CharacterID()); - database.SetGroupLeaderName(group->GetID(), inviter->GetName()); - - group->UpdateGroupAAs(); - - //Invite the inviter into the group first.....dont ask - if (inviter->CastToClient()->GetClientVersion() < EQClientSoD) - { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); - GroupJoin_Struct* outgj = (GroupJoin_Struct*)outapp->pBuffer; - strcpy(outgj->membername, inviter->GetName()); - strcpy(outgj->yourname, inviter->GetName()); - outgj->action = groupActInviteInitial; // 'You have formed the group'. - group->GetGroupAAs(&outgj->leader_aas); - inviter->CastToClient()->QueuePacket(outapp); - safe_delete(outapp); - } - else - { - // SoD and later - // - inviter->CastToClient()->SendGroupCreatePacket(); - - inviter->CastToClient()->SendGroupLeaderChangePacket(inviter->GetName()); - - inviter->CastToClient()->SendGroupJoinAcknowledge(); - } - - } - if (!group) - return; - - inviter->CastToClient()->QueuePacket(app);//notify inviter the client accepted - - if (!group->AddMember(this)) - return; - - if (inviter->CastToClient()->IsLFP()) { - // If the player who invited us to a group is LFP, have them update world now that we have joined - // their group. - inviter->CastToClient()->UpdateLFP(); - } - - if (GetClientVersion() >= EQClientSoD) - SendGroupJoinAcknowledge(); - - database.RefreshGroupFromDB(this); - group->SendHPPacketsTo(this); - - // Temporary hack for SoD, as things seem to work quite differently - if (inviter->CastToClient()->GetClientVersion() >= EQClientSoD) - database.RefreshGroupFromDB(inviter->CastToClient()); - - // Add the merc back into the new group - if (GetMerc()) { - if (Merc::AddMercToGroup(GetMerc(), group)) { - database.SetGroupID(GetMerc()->GetName(), group->GetID(), inviter->CastToClient()->CharacterID(), true); - database.RefreshGroupFromDB(this); - } - } - - //send updates to clients out of zone... - ServerPacket* pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); - ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack->pBuffer; - gj->gid = group->GetID(); - gj->zoneid = zone->GetZoneID(); - gj->instance_id = zone->GetInstanceID(); - strcpy(gj->member_name, GetName()); - worldserver.SendPacket(pack); - safe_delete(pack); } else if (inviter == nullptr) { + // Inviter is in another zone - Remove merc from group now if any + LeaveGroup(); + ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer; sgfs->CharacterID = CharacterID(); @@ -6801,10 +6657,11 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) return; } - if (Invitee) { - if (Invitee->IsClient()) { - if ((!Invitee->IsGrouped() && !Invitee->IsRaidGrouped()) || - (Invitee->GetGroup() && Invitee->CastToClient()->GetMerc() && Invitee->GetGroup()->GroupCount() == 2)) + if (Invitee) + { + if (Invitee->IsClient()) + { + if(Invitee->CastToClient()->MercOnlyOrNoGroup() && !Invitee->IsRaidGrouped()) { if (app->GetOpcode() == OP_GroupInvite2) { @@ -9507,7 +9364,8 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) Merc* merc = GetMerc(); GetMercInfo().State = option; - if (merc) { + if (merc) + { uint8 numStances = 0; //get number of available stances for the current merc @@ -9519,10 +9377,11 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) } MercTemplate* mercTemplate = zone->GetMercTemplate(GetMerc()->GetMercTemplateID()); - if (mercTemplate) { - + if (mercTemplate) + { //check to see if selected option is a valid stance slot (option is the slot the stance is in, not the actual stance) - if (option >= 0 && option < numStances) { + if (option >= 0 && option < numStances) + { merc->SetStance(mercTemplate->Stances[option]); GetMercInfo().Stance = mercTemplate->Stances[option]; @@ -9710,7 +9569,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); // Handle the dismiss here... - DismissMerc(GetMercInfo().mercid); // GetMercID() + DismissMerc(GetMercInfo().mercid); } @@ -9744,10 +9603,12 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) MercTemplate* merc_template = zone->GetMercTemplate(merc_template_id); - if (merc_template) { + if (merc_template) + { Mob* merchant = entity_list.GetNPCByID(merchant_id); - if (!CheckCanHireMerc(merchant, merc_template_id)) { + if (!CheckCanHireMerc(merchant, merc_template_id)) + { return; } @@ -9762,7 +9623,8 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) SpawnMerc(merc, true); merc->Save(); - if (RuleB(Mercs, ChargeMercPurchaseCost)) { + if (RuleB(Mercs, ChargeMercPurchaseCost)) + { uint32 cost = Merc::CalcPurchaseCost(merc_template->MercTemplateID, GetLevel()) * 100; // Cost is in gold TakeMoneyFromPP(cost, true); } @@ -9770,12 +9632,14 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // 0 is approved hire request SendMercMerchantResponsePacket(0); } - else { + else + { //merc failed to spawn SendMercMerchantResponsePacket(3); } } - else { + else + { //merc doesn't exist in db SendMercMerchantResponsePacket(2); } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 2f46a5688..13973df91 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -245,7 +245,6 @@ bool Client::Process() { if(GetMercInfo().MercTemplateID != 0 && GetMercInfo().IsSuspended) { - //CheckMercSuspendTimer(); if(p_timers.Expired(&database, pTimerMercSuspend, false)) { CheckMercSuspendTimer(); @@ -746,9 +745,9 @@ bool Client::Process() { { entity_list.MessageGroup(this, true, 15, "%s left the zone.", GetName()); mygroup->MemberZoned(this); - if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == mygroup) + if (GetMerc() && GetMerc()->HasGroup()) { - mygroup->DelMember(GetMerc()); + GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup()); } } diff --git a/zone/groups.cpp b/zone/groups.cpp index fb1f4204e..2e7fb3cfe 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -203,28 +203,34 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu } } -bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 CharacterID) +bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 CharacterID, bool ismerc) { bool InZone = true; - bool ismerc = false; // This method should either be passed a Mob*, if the new member is in this zone, or a nullptr Mob* // and the name and CharacterID of the new member, if they are out of zone. - // if(!newmember && !NewMemberName) - return false; + { + return false; + } if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together. + { return false; + } if(!newmember) + { InZone = false; + } else { NewMemberName = newmember->GetCleanName(); if(newmember->IsClient()) + { CharacterID = newmember->CastToClient()->CharacterID(); + } if(newmember->IsMerc()) { Client* owner = newmember->CastToMerc()->GetMercOwner(); @@ -232,18 +238,20 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte { CharacterID = owner->CastToClient()->CharacterID(); NewMemberName = newmember->GetName(); - ismerc = true; } + ismerc = true; } } - uint32 i = 0; - // See if they are already in the group - // + uint32 i = 0; for (i = 0; i < MAX_GROUP_MEMBERS; ++i) + { if(!strcasecmp(membername[i], NewMemberName)) + { return false; + } + } // Put them in the group for (i = 0; i < MAX_GROUP_MEMBERS; ++i) @@ -251,17 +259,20 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte if (membername[i][0] == '\0') { if(InZone) + { members[i] = newmember; - + } + strcpy(membername[i], NewMemberName); + MemberRoles[i] = 0; break; } } + // Is this even possible based on the above loops? Remove? if (i == MAX_GROUP_MEMBERS) + { return false; - - strcpy(membername[i], NewMemberName); - MemberRoles[i] = 0; + } int x=1; @@ -270,11 +281,12 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer; strcpy(gj->membername, NewMemberName); gj->action = groupActJoin; - gj->leader_aas = LeaderAbilities; - for (i = 0;i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr && members[i] != newmember) { + for (i = 0;i < MAX_GROUP_MEMBERS; i++) + { + if (members[i] != nullptr && members[i] != newmember) + { //fill in group join & send it if(members[i]->IsMerc()) { @@ -284,18 +296,23 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte { strcpy(gj->yourname, members[i]->GetCleanName()); } - if(members[i]->IsClient()) { + if(members[i]->IsClient()) + { members[i]->CastToClient()->QueuePacket(outapp); - //put new member into existing person's list + //put new member into existing group members' list(s) strcpy(members[i]->CastToClient()->GetPP().groupMembers[this->GroupCount()-1], NewMemberName); } - //put this existing person into the new member's list - if(InZone && newmember->IsClient()) { + //put existing group member(s) into the new member's list + if(InZone && newmember->IsClient()) + { if(IsLeader(members[i])) + { strcpy(newmember->CastToClient()->GetPP().groupMembers[0], members[i]->GetCleanName()); - else { + } + else + { strcpy(newmember->CastToClient()->GetPP().groupMembers[x], members[i]->GetCleanName()); x++; } @@ -337,7 +354,9 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte #endif //BOTS } else + { database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc); + } safe_delete(outapp); @@ -512,6 +531,30 @@ void Group::MemberZoned(Mob* removemob) { mentoree = nullptr; } +void Group::SendGroupJoinOOZ(Mob* NewMember) { + + if (NewMember == nullptr) + { + return; + } + + if (!NewMember->HasGroup()) + { + return; + } + + //send updates to clients out of zone... + ServerPacket* pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); + ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack->pBuffer; + gj->gid = GetID(); + gj->zoneid = zone->GetZoneID(); + gj->instance_id = zone->GetInstanceID(); + strcpy(gj->member_name, NewMember->GetName()); + worldserver.SendPacket(pack); + safe_delete(pack); + +} + bool Group::DelMemberOOZ(const char *Name) { if(!Name) return false; @@ -619,7 +662,8 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) #endif //BOTS } - if (!ignoresender) { + if (!ignoresender) + { strcpy(gu->yourname,oldmember->GetCleanName()); strcpy(gu->membername,oldmember->GetCleanName()); gu->action = groupActLeave; @@ -629,7 +673,18 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) } if(oldmember->IsClient()) - database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID()); + { + database.SetGroupID(oldmember->GetCleanName(), 0, oldmember->CastToClient()->CharacterID(), false); + } + + if(oldmember->IsMerc()) + { + Client* owner = oldmember->CastToMerc()->GetMercOwner(); + if(owner) + { + database.SetGroupID(oldmember->GetName(), 0, owner->CharacterID(), true); + } + } oldmember->SetGrouped(false); disbandcheck = true; @@ -819,20 +874,33 @@ void Group::DisbandGroup() { Client *Leader = nullptr; uint32 i; - for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] == nullptr) { + for (i = 0; i < MAX_GROUP_MEMBERS; i++) + { + if (members[i] == nullptr) + { continue; } - if (members[i]->IsClient()) { + if (members[i]->IsClient()) + { if(IsLeader(members[i])) + { Leader = members[i]->CastToClient(); + } strcpy(gu->yourname, members[i]->GetName()); - database.SetGroupID(members[i]->GetName(), 0, members[i]->CastToClient()->CharacterID()); + database.SetGroupID(members[i]->GetName(), 0, members[i]->CastToClient()->CharacterID(), false); members[i]->CastToClient()->QueuePacket(outapp); SendMarkedNPCsToMember(members[i]->CastToClient(), true); - + } + + if (members[i]->IsMerc()) + { + Client* owner = members[i]->CastToMerc()->GetMercOwner(); + if(owner) + { + database.SetGroupID(members[i]->GetName(), 0, owner->CharacterID(), true); + } } members[i]->SetGrouped(false); @@ -852,9 +920,12 @@ void Group::DisbandGroup() { entity_list.RemoveGroup(GetID()); if(GetID() != 0) + { database.ClearGroup(GetID()); + } - if(Leader && (Leader->IsLFP())) { + if(Leader && (Leader->IsLFP())) + { Leader->UpdateLFP(); } @@ -936,8 +1007,12 @@ uint8 Group::GroupCount() { uint8 MemberCount = 0; for(uint8 i = 0; i < MAX_GROUP_MEMBERS; ++i) + { if(membername[i][0]) + { ++MemberCount; + } + } return MemberCount; } @@ -1071,7 +1146,14 @@ void Client::LeaveGroup() { if(g) { - if(g->GroupCount() < 3) + int32 MemberCount = g->GroupCount(); + // Account for both client and merc leaving the group + if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g) + { + MemberCount -= 1; + } + + if(MemberCount < 3) { g->DisbandGroup(); } @@ -1080,17 +1162,17 @@ void Client::LeaveGroup() { g->DelMember(this); if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g) { - g->DelMember(GetMerc()); + GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup()); } } } else { //force things a little - database.SetGroupID(GetName(), 0, CharacterID()); + database.SetGroupID(GetName(), 0, CharacterID(), false); if (GetMerc()) { - database.SetGroupID(GetMerc()->GetName(), 0, CharacterID()); + database.SetGroupID(GetMerc()->GetName(), 0, CharacterID(), true); } } diff --git a/zone/groups.h b/zone/groups.h index 951d8881a..a0b17229b 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -51,7 +51,7 @@ public: Group(uint32 gid); ~Group(); - bool AddMember(Mob* newmember, const char* NewMemberName = nullptr, uint32 CharacterID = 0); + bool AddMember(Mob* newmember, const char* NewMemberName = nullptr, uint32 CharacterID = 0, bool ismerc = false); void AddMember(const char* NewMemberName); void SendUpdate(uint32 type,Mob* member); void SendLeadershipAAUpdate(); @@ -63,6 +63,7 @@ public: bool IsGroupMember(const char *Name); bool Process(); bool IsGroup() { return true; } + void SendGroupJoinOOZ(Mob* NewMember); void CastGroupSpell(Mob* caster,uint16 spellid); void GroupBardPulse(Mob* caster,uint16 spellid); void SplitExp(uint32 exp, Mob* other); diff --git a/zone/merc.cpp b/zone/merc.cpp index 077705de9..94d129b14 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1287,8 +1287,8 @@ bool Merc::Process() if (GetDepop()) { - //SetMercCharacterID(0); - //SetOwnerID(0); + SetMercCharacterID(0); + SetOwnerID(0); return false; } @@ -1297,7 +1297,8 @@ bool Merc::Process() //return false; //merc can live after client dies, not sure how long } - if(IsSuspended()) { + if(IsSuspended()) + { return false; } @@ -5368,12 +5369,14 @@ bool Client::CheckCanRetainMerc(uint32 upkeep) { bool Client::CheckCanSpawnMerc(uint32 template_id) { // Check if mercs are enabled globally - if(!RuleB(Mercs, AllowMercs)) { + if(!RuleB(Mercs, AllowMercs)) + { return false; } // Check if zone allows mercs - if(!zone->AllowMercs()) { + if(!zone->AllowMercs()) + { SendMercResponsePackets(3); return false; } @@ -5381,31 +5384,36 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) { MercTemplate* mercTemplate = zone->GetMercTemplate(template_id); // Invalid merc data - if(!mercTemplate) { + if(!mercTemplate) + { SendMercResponsePackets(11); return false; } // Check client version - if(GetClientVersion() < mercTemplate->ClientVersion) { + if(GetClientVersion() < mercTemplate->ClientVersion) + { SendMercResponsePackets(3); return false; } // Check for raid - if(HasRaid()) { + if(HasRaid()) + { SendMercResponsePackets(4); return false; } // Check group size - if(HasGroup() && GetGroup()->GroupCount() >= MAX_GROUP_MEMBERS) { + if(GetGroup() && GetGroup()->GroupCount() >= MAX_GROUP_MEMBERS) // database.GroupCount(GetGroup()->GetID()) + { SendMercResponsePackets(8); return false; } // Check in combat - if(GetAggroCount() > 0) { + if(GetAggroCount() > 0) + { SendMercResponsePackets(9); return false; } @@ -5584,6 +5592,10 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) { if (!merc || !CheckCanSpawnMerc(merc->GetMercTemplateID())) { + if (merc) + { + merc->Suspend(); + } return; } @@ -5618,9 +5630,7 @@ bool Merc::Suspend() { mercOwner->GetMercInfo().Stance = GetStance(); Save(); mercOwner->GetMercTimer()->Disable(); - mercOwner->SendMercSuspendResponsePacket(mercOwner->GetMercInfo().SuspendedTime); - mercOwner->SendMercTimer(this); Depop(); @@ -5634,6 +5644,25 @@ bool Merc::Suspend() { return true; } +bool Client::MercOnlyOrNoGroup() { + + if (!GetGroup()) + { + return true; + } + if (GetMerc()) + { + if (GetMerc()->HasGroup() && GetMerc()->GetGroup() == GetGroup()) + { + if (GetGroup()->GroupCount() < 3) + { + return true; + } + } + } + return false; +} + bool Merc::Unsuspend(bool setMaxStats) { Client* mercOwner = nullptr; @@ -5657,65 +5686,15 @@ bool Merc::Unsuspend(bool setMaxStats) { mercOwner->SendMercenaryUnsuspendPacket(0); mercOwner->SendMercenaryUnknownPacket(1); mercOwner->GetMercInfo().SuspendedTime = 0; + // Reset the upkeep timer + mercOwner->GetMercInfo().MercTimerRemaining = RuleI(Mercs, UpkeepIntervalMS); mercOwner->GetMercTimer()->Start(RuleI(Mercs, UpkeepIntervalMS)); - mercOwner->GetMercTimer()->SetTimer(mercOwner->GetMercInfo().MercTimerRemaining); + //mercOwner->GetMercTimer()->SetTimer(mercOwner->GetMercInfo().MercTimerRemaining); mercOwner->SendMercTimer(this); if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false)) mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend); - //mercOwner->SendMercPersonalInfo(); - Group* g = entity_list.GetGroupByClient(mercOwner); - - //nobody from our group is here... start a new group - if(!g) - { - g = new Group(mercOwner); - - if(!g) { - delete g; - g = nullptr; - return false; - } - - entity_list.AddGroup(g); - - if(g->GetID() == 0) { - delete g; - g = nullptr; - return false; - } - - if(AddMercToGroup(this, g)) - { - entity_list.AddGroup(g, g->GetID()); - database.SetGroupLeaderName(g->GetID(), mercOwner->GetName()); - database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID()); - database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true); - database.RefreshGroupFromDB(mercOwner); - g->SaveGroupLeaderAA(); - loaded = true; - } - else - { - g->DisbandGroup(); - } - } - else if (AddMercToGroup(this, mercOwner->GetGroup())) - { - // Group already exists - database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true); - database.RefreshGroupFromDB(mercOwner); - - loaded = true; - } - else - { - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary failed to join the group - Suspending"); - - Suspend(); - } - + MercJoinClientGroup(); if(loaded) { @@ -5788,7 +5767,7 @@ void Merc::Depop() { entity_list.RemoveFromHateLists(this); - if(HasGroup()) + if(GetGroup()) { RemoveMercFromGroup(this, GetGroup()); } @@ -5820,7 +5799,9 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { if(group->DelMember(merc, true)) { if(merc->GetMercCharacterID() != 0) + { database.SetGroupID(merc->GetName(), 0, merc->GetMercCharacterID(), true); + } } if(group->GroupCount() <= 1 && ZoneLoaded) @@ -5830,6 +5811,17 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { } else { + // A merc is group leader - Disband and re-group each member with their mercs + for(int i = 0; i < MAX_GROUP_MEMBERS; i++) + { + if(!group->members[i]) + continue; + + if(!group->members[i]->IsClient()) + continue; + + group->members[i]->CastToClient()->LeaveGroup(); + } for(int i = 0; i < MAX_GROUP_MEMBERS; i++) { if(!group->members[i]) @@ -5838,15 +5830,9 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { if(!group->members[i]->IsMerc()) continue; - Merc* groupmerc = group->members[i]->CastToMerc(); - - //groupmerc->SetOwnerID(0); - if (!groupmerc->IsSuspended()) - { - groupmerc->Suspend(); - database.SetGroupID(groupmerc->GetCleanName(), 0, groupmerc->GetMercCharacterID(), true); - } + group->members[i]->CastToMerc()->MercJoinClientGroup(); } + // Group should be removed by now, but just in case: group->DisbandGroup(); } @@ -5857,16 +5843,112 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) { return Result; } +bool Merc::MercJoinClientGroup() { + + Client* mercOwner = nullptr; + + if(GetMercOwner()) + { + mercOwner = GetMercOwner(); + } + + if(!mercOwner) + { + Suspend(); + return false; + } + + if(GetID()) + { + if (HasGroup()) + { + RemoveMercFromGroup(this, GetGroup()); + } + + Group* g = entity_list.GetGroupByClient(mercOwner); + + //nobody from our group is here... start a new group + if(!g) + { + g = new Group(mercOwner); + + if(!g) + { + delete g; + g = nullptr; + return false; + } + + entity_list.AddGroup(g); + + if(g->GetID() == 0) + { + delete g; + g = nullptr; + return false; + } + + if(AddMercToGroup(this, g)) + { + entity_list.AddGroup(g, g->GetID()); + database.SetGroupLeaderName(g->GetID(), mercOwner->GetName()); + database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID(), false); + database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true); + database.RefreshGroupFromDB(mercOwner); + g->SaveGroupLeaderAA(); + if(MERC_DEBUG > 0) + mercOwner->Message(7, "Mercenary Debug: Mercenary joined new group."); + } + else + { + g->DisbandGroup(); + Suspend(); + + if(MERC_DEBUG > 0) + mercOwner->Message(7, "Mercenary Debug: Mercenary disbanded new group."); + } + + } + else if (AddMercToGroup(this, mercOwner->GetGroup())) + { + // Group already exists + database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true); + database.RefreshGroupFromDB(mercOwner); + // Update members that are out of zone + GetGroup()->SendGroupJoinOOZ(this); + + if(MERC_DEBUG > 0) + mercOwner->Message(7, "Mercenary Debug: Mercenary joined existing group."); + } + else + { + Suspend(); + + if(MERC_DEBUG > 0) + mercOwner->Message(7, "Mercenary Debug: Mercenary failed to join the group - Suspending"); + } + } + + return true; +} + bool Merc::AddMercToGroup(Merc* merc, Group* group) { bool Result = false; if(merc && group) { - // Remove merc from current group if any - if(merc->HasGroup()) { + // Remove merc from current group if it's not the destination group + if(merc->HasGroup()) + { + if(merc->GetGroup() == group && merc->GetMercOwner()) + { + // Merc is already in the destination group + merc->SetFollowID(merc->GetMercOwner()->GetID()); + return true; + } merc->RemoveMercFromGroup(merc, merc->GetGroup()); } //Try and add the member, followed by checking if the merc owner exists. - if(group->AddMember(merc) && merc->GetMercOwner() != nullptr) + if(group->AddMember(merc) && merc->GetMercOwner()) { merc->SetFollowID(merc->GetMercOwner()->GetID()); Result = true; diff --git a/zone/merc.h b/zone/merc.h index 433c614fc..eca59ba24 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -138,6 +138,7 @@ public: bool Spawn(Client *owner); bool Suspend(); bool Unsuspend(bool setMaxStats); + bool MercJoinClientGroup(); void Zone(); virtual void Depop(); virtual bool Save(); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 46d2deb34..dc9d6d8f6 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -907,7 +907,7 @@ uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) { uint16 book_slot, count; uint16 curspell; - uint16 Char_ID = initiator->CharacterID(); + uint32 Char_ID = initiator->CharacterID(); bool SpellGlobalRule = RuleB(Spells, EnableSpellGlobals); bool SpellGlobalCheckResult = 0; diff --git a/zone/spells.cpp b/zone/spells.cpp index 315fe8712..06c28adaa 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4928,7 +4928,7 @@ int Client::FindSpellBookSlotBySpellID(uint16 spellid) { return -1; //default } -bool Client::SpellGlobalCheck(uint16 spell_ID, uint16 char_ID) { +bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { std::string spell_Global_Name; int spell_Global_Value; diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index be0a1a193..eb717f89a 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -831,12 +831,11 @@ void WorldServer::Process() { } case ServerOP_GroupInvite: { // A player in another zone invited a player in this zone to join their group. - // GroupInvite_Struct* gis = (GroupInvite_Struct*)pack->pBuffer; Mob *Invitee = entity_list.GetMob(gis->invitee_name); - if(Invitee && Invitee->IsClient() && !Invitee->IsGrouped() && !Invitee->IsRaidGrouped()) + if(Invitee && Invitee->IsClient() && Invitee->CastToClient()->MercOnlyOrNoGroup() && !Invitee->IsRaidGrouped()) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupInvite, sizeof(GroupInvite_Struct)); memcpy(outapp->pBuffer, gis, sizeof(GroupInvite_Struct)); @@ -848,7 +847,6 @@ void WorldServer::Process() { } case ServerOP_GroupFollow: { // Player in another zone accepted a group invitation from a player in this zone. - // ServerGroupFollow_Struct* sgfs = (ServerGroupFollow_Struct*) pack->pBuffer; Mob* Inviter = entity_list.GetClientByName(sgfs->gf.name1); @@ -857,12 +855,15 @@ void WorldServer::Process() { { Group* group = entity_list.GetGroupByClient(Inviter->CastToClient()); - if(!group){ - + if(!group) + { + //Make new group group = new Group(Inviter); - if(!group) + if (!group) + { break; + } entity_list.AddGroup(group); @@ -871,10 +872,8 @@ void WorldServer::Process() { break; } - database.SetGroupID(Inviter->GetName(), group->GetID(), Inviter->CastToClient()->CharacterID()); - + database.SetGroupID(Inviter->GetName(), group->GetID(), Inviter->CastToClient()->CharacterID(), false); database.SetGroupLeaderName(group->GetID(), Inviter->GetName()); - group->UpdateGroupAAs(); if(Inviter->CastToClient()->GetClientVersion() < EQClientSoD) @@ -891,25 +890,22 @@ void WorldServer::Process() { else { // SoD and later - // Inviter->CastToClient()->SendGroupCreatePacket(); Inviter->CastToClient()->SendGroupLeaderChangePacket(Inviter->GetName()); Inviter->CastToClient()->SendGroupJoinAcknowledge(); } } + if(!group) + { break; + } EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupFollow, sizeof(GroupGeneric_Struct)); - GroupGeneric_Struct *gg = (GroupGeneric_Struct *)outapp->pBuffer; - strn0cpy(gg->name1, sgfs->gf.name1, sizeof(gg->name1)); - strn0cpy(gg->name2, sgfs->gf.name2, sizeof(gg->name2)); - Inviter->CastToClient()->QueuePacket(outapp); - safe_delete(outapp); if(!group->AddMember(nullptr, sgfs->gf.name2, sgfs->CharacterID)) @@ -919,46 +915,35 @@ void WorldServer::Process() { Inviter->CastToClient()->UpdateLFP(); ServerPacket* pack2 = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); - ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack2->pBuffer; - gj->gid = group->GetID(); - gj->zoneid = zone->GetZoneID(); - gj->instance_id = zone->GetInstanceID(); - strn0cpy(gj->member_name, sgfs->gf.name2, sizeof(gj->member_name)); - worldserver.SendPacket(pack2); - safe_delete(pack2); + + // Send acknowledgement back to the Invitee to let them know we have added them to the group. - // ServerPacket* pack3 = new ServerPacket(ServerOP_GroupFollowAck, sizeof(ServerGroupFollowAck_Struct)); - ServerGroupFollowAck_Struct* sgfas = (ServerGroupFollowAck_Struct*)pack3->pBuffer; - strn0cpy(sgfas->Name, sgfs->gf.name2, sizeof(sgfas->Name)); - worldserver.SendPacket(pack3); - safe_delete(pack3); } break; } case ServerOP_GroupFollowAck: { // The Inviter (in another zone) has successfully added the Invitee (in this zone) to the group. - // ServerGroupFollowAck_Struct* sgfas = (ServerGroupFollowAck_Struct*)pack->pBuffer; - Client *c = entity_list.GetClientByName(sgfas->Name); + Client *client = entity_list.GetClientByName(sgfas->Name); - if(!c) + if(!client) break; - uint32 groupid = database.GetGroupID(c->GetName()); + uint32 groupid = database.GetGroupID(client->GetName()); Group* group = nullptr; @@ -974,26 +959,30 @@ void WorldServer::Process() { entity_list.AddGroup(group, groupid); else group = nullptr; - } //else, somebody from our group is already here... + } if(group) - group->UpdatePlayer(c); + group->UpdatePlayer(client); else { - if(c->GetMerc()) - database.SetGroupID(c->GetMerc()->GetCleanName(), 0, c->CharacterID(), true); - database.SetGroupID(c->GetName(), 0, c->CharacterID()); //cannot re-establish group, kill it + if(client->GetMerc()) + database.SetGroupID(client->GetMerc()->GetCleanName(), 0, client->CharacterID(), true); + database.SetGroupID(client->GetName(), 0, client->CharacterID(), false); //cannot re-establish group, kill it } } if(group) { - database.RefreshGroupFromDB(c); + if (client->GetMerc()) + { + client->GetMerc()->MercJoinClientGroup(); + } + database.RefreshGroupFromDB(client); - group->SendHPPacketsTo(c); + group->SendHPPacketsTo(client); - // If the group leader is not set, pull the group leader infomrmation from the database. + // If the group leader is not set, pull the group leader information from the database. if(!group->GetLeader()) { char ln[64]; @@ -1019,6 +1008,10 @@ void WorldServer::Process() { } } + else if (client->GetMerc()) + { + client->GetMerc()->MercJoinClientGroup(); + } break; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index bfbdb7424..3599a3ff0 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2563,18 +2563,22 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){ std::string query = StringFormat("SELECT name FROM group_id WHERE groupid = %d", group->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - printf("Error in group update query: %s\n", results.ErrorMessage().c_str()); - else + { + printf("Error in group update query: %s\n", results.ErrorMessage().c_str()); + } + else + { for (auto row = results.begin(); row != results.end(); ++row) { if(index >= 6) - continue; + continue; if(strcmp(client->GetName(), row[0]) == 0) - continue; + continue; strcpy(gu->membername[index], row[0]); index++; } + } client->QueuePacket(outapp); safe_delete(outapp); From 1ca397f4265d5e2ce542784515e74dbf7d38a1fe Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 22 Nov 2014 03:20:39 -0800 Subject: [PATCH 0300/1883] Lua parser: script_init.lua for zones will now follow script_init_v[0-9]+\.lua similar to player quests. --- zone/lua_parser.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index dce88d5e6..b05e7619f 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -857,7 +857,9 @@ void LuaParser::ReloadQuests() { if(zone) { std::string zone_script = "quests/"; zone_script += zone->GetShortName(); - zone_script += "/script_init.lua"; + zone_script += "/script_init_v"; + zone_script += std::to_string(zone->GetInstanceVersion()); + zone_script += ".lua"; f = fopen(zone_script.c_str(), "r"); if(f) { fclose(f); @@ -866,6 +868,21 @@ void LuaParser::ReloadQuests() { std::string error = lua_tostring(L, -1); AddError(error); } + + return; + } + + zone_script = "quests/"; + zone_script += zone->GetShortName(); + zone_script += "/script_init.lua"; + f = fopen(zone_script.c_str(), "r"); + if(f) { + fclose(f); + + if(luaL_dofile(L, zone_script.c_str())) { + std::string error = lua_tostring(L, -1); + AddError(error); + } } } } From 79a70271d54b7ef3a409229e75b60a12fc859484 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 22 Nov 2014 12:53:49 -0600 Subject: [PATCH 0301/1883] Crash fix for Swarm Pets. --- changelog.txt | 3 ++- zone/npc.cpp | 51 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2a9dfb762..2e220770e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,7 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/22/2014 == Trevius: Grouping with Mercenaries is now considerably less buggy. -Trevius: Fixed an issue with Spell Globals related to high Character IDs. +Trevius: Fixed an issue with Spell Globals related to high Character IDs. +Trevius: Crash fix for Swarm Pets. == 11/19/2014 == Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly. diff --git a/zone/npc.cpp b/zone/npc.cpp index 25a349048..eca0f194f 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1848,46 +1848,57 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) void NPC::PetOnSpawn(NewSpawn_Struct* ns) { //Basic settings to make sure swarm pets work properly. - if (GetSwarmOwner()) { - - Mob *m = entity_list.GetMobID(GetSwarmOwner()); - - if(m->IsClient()) { + Mob *swarmOwner = nullptr; + if (GetSwarmOwner()) + { + Mob *swarmOwner = entity_list.GetMobID(GetSwarmOwner()); + } + + if (swarmOwner != nullptr) + { + if(swarmOwner->IsClient()) + { SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client. //This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'! if (RuleB(Pets, SwarmPetNotTargetableWithHotKey)) ns->spawn.IsMercenary = 1; - } - //NPC cast swarm pets should still be targetable with F8. + } else + { + //NPC cast swarm pets should still be targetable with F8. ns->spawn.IsMercenary = 0; + } SetTempPet(true); //Simple mob flag for checking if temp pet - m->SetTempPetsActive(true); //Neccessary fail safe flag set if mob ever had a swarm pet to ensure they are removed. - m->SetTempPetCount(m->GetTempPetCount() + 1); + swarmOwner->SetTempPetsActive(true); //Necessary fail safe flag set if mob ever had a swarm pet to ensure they are removed. + swarmOwner->SetTempPetCount(swarmOwner->GetTempPetCount() + 1); //Not recommended if using above (However, this will work better on older clients). - if (RuleB(Pets, UnTargetableSwarmPet)) { + if (RuleB(Pets, UnTargetableSwarmPet)) + { ns->spawn.bodytype = 11; - if(!IsCharmed() && m->IsClient()) - sprintf(ns->spawn.lastName, "%s's Pet", m->GetName()); + if(!IsCharmed() && swarmOwner->IsClient()) + sprintf(ns->spawn.lastName, "%s's Pet", swarmOwner->GetName()); } } - - else if(GetOwnerID()) { + else if(GetOwnerID()) + { ns->spawn.is_pet = 1; - if (!IsCharmed() && GetOwnerID()) { - Client *c = entity_list.GetClientByID(GetOwnerID()); - if(c){ + if (!IsCharmed()) + { + Client *client = entity_list.GetClientByID(GetOwnerID()); + if(client) + { SetPetOwnerClient(true); - sprintf(ns->spawn.lastName, "%s's Pet", c->GetName()); + sprintf(ns->spawn.lastName, "%s's Pet", client->GetName()); } } - } - + } else + { ns->spawn.is_pet = 0; + } } void NPC::SetLevel(uint8 in_level, bool command) From 111fb840416f5469a9ccba0139a7aa69191c4796 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 22 Nov 2014 17:55:48 -0600 Subject: [PATCH 0302/1883] Moved zonedatabase functions out of corpse.cpp Conversion portion mostly complete Some header readability cleanup Some function renaming Struct renaming Many variable renaming MySQL error log for all of QueryDatabase Corpse table renaming Corpse table field renaming Most corpse database functions redone --- common/database.cpp | 275 +++++++++++- common/database.h | 81 ++++ common/dbcore.cpp | 11 + common/shareddb.cpp | 10 +- world/adventure.cpp | 4 +- zone/client.cpp | 6 +- zone/client.h | 6 +- zone/client_packet.cpp | 12 +- zone/client_process.cpp | 2 +- zone/command.cpp | 6 +- zone/corpse.cpp | 806 +++--------------------------------- zone/corpse.h | 94 ++--- zone/doors.cpp | 4 +- zone/entity.cpp | 2 +- zone/lua_corpse.cpp | 2 +- zone/merc.cpp | 4 +- zone/perl_player_corpse.cpp | 2 +- zone/questmgr.cpp | 6 +- zone/spells.cpp | 6 +- zone/worldserver.cpp | 4 +- zone/zone.cpp | 2 +- zone/zonedb.cpp | 721 ++++++++++++++++++++++++++++++++ zone/zonedb.h | 251 +++++------ zone/zonedump.h | 75 +--- 24 files changed, 1380 insertions(+), 1012 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 12ef93223..acc6175a6 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -48,6 +48,7 @@ #include "guilds.h" #include "string_util.h" #include "extprofile.h" + extern Client client; #ifdef _WINDOWS @@ -1349,7 +1350,6 @@ bool Database::CheckDatabaseConversions() { printf("Starting conversion...\n\n"); } - // Testing account = 11001 int char_iter_count = 0; rquery = StringFormat("SELECT `id` FROM `character_`"); results = QueryDatabase(rquery); @@ -2084,6 +2084,275 @@ bool Database::CheckDatabaseConversions() { #endif + DBPlayerCorpse_Struct_temp* dbpc; + classic_db_temp::DBPlayerCorpse_Struct_temp* dbpc_c; + uint32 in_datasize; + bool is_sof = false; + std::string c_type; + std::string scquery; + int8 first_entry = 0; + + rquery = StringFormat("SHOW COLUMNS FROM `character_corpses` LIKE 'data'"); + results = QueryDatabase(rquery); + if (results.RowCount() != 0){ + rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses"); + results = QueryDatabase(rquery); + for (auto row = results.begin(); row != results.end(); ++row) { + squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", atoi(row[0])); + auto results2 = QueryDatabase(squery); + for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) { + in_datasize = results2.LengthOfColumn(2); + dbpc = (DBPlayerCorpse_Struct_temp*)row2[2]; + dbpc_c = (classic_db_temp::DBPlayerCorpse_Struct_temp*)row2[2]; + + if (dbpc == nullptr) + continue; + if (dbpc_c == nullptr) + continue; + + + /* SoF+ */ + uint32 esize1 = (sizeof(DBPlayerCorpse_Struct_temp)+(dbpc->itemcount * sizeof(player_lootitem_temp::ServerLootItem_Struct_temp))); + uint32 esize2 = (sizeof(classic_db_temp::DBPlayerCorpse_Struct_temp) + (dbpc_c->itemcount * sizeof(player_lootitem_temp::ServerLootItem_Struct_temp))); + + /* SoF */ + if (in_datasize == esize1) { + is_sof = true; + c_type = "SOF"; + } + /* Classic */ + if (in_datasize == esize2) { + is_sof = false; + c_type = "Legacy"; + } + if (in_datasize != esize2 && in_datasize != esize1) { + std::cout << "[Error] in Corpse Size - OLD SIZE: " << esize1 << " SOF SIZE: " << esize2 << " db_blob_datasize: " << in_datasize << std::endl; + is_sof = false; + c_type = "NULL"; + continue; + } + std::cout << "Corpse: OK [" << c_type << "]: " << "Corpse ID: " << atoi(row2[0]) << std::endl; + + if (is_sof){ + scquery = StringFormat("UPDATE `character_corpses` SET \n" + "`is_locked` = %d,\n" + "`exp` = %u,\n" + "`size` = %f,\n" + "`level` = %u,\n" + "`race` = %u,\n" + "`gender` = %u,\n" + "`class` = %u,\n" + "`deity` = %u,\n" + "`texture` = %u,\n" + "`helm_texture` = %u,\n" + "`copper` = %u,\n" + "`silver` = %u,\n" + "`gold` = %u,\n" + "`platinum` = %u,\n" + "`hair_color` = %u,\n" + "`beard_color` = %u,\n" + "`eye_color_1` = %u,\n" + "`eye_color_2` = %u,\n" + "`hair_style` = %u,\n" + "`face` = %u,\n" + "`beard` = %u,\n" + "`drakkin_heritage` = %u,\n" + "`drakkin_tattoo` = %u,\n" + "`drakkin_details` = %u,\n" + "`wc_1` = %u,\n" + "`wc_2` = %u,\n" + "`wc_3` = %u,\n" + "`wc_4` = %u,\n" + "`wc_5` = %u,\n" + "`wc_6` = %u,\n" + "`wc_7` = %u,\n" + "`wc_8` = %u,\n" + "`wc_9` = %u \n" + "WHERE `id` = %u \n", + dbpc->locked, + dbpc->exp, + dbpc->size, + dbpc->level, + dbpc->race, + dbpc->gender, + dbpc->class_, + dbpc->deity, + dbpc->texture, + dbpc->helmtexture, + dbpc->copper, + dbpc->silver, + dbpc->gold, + 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, + atoi(row2[0]) + ); + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Base Data", scquery); } + + first_entry = 0; + scquery = ""; + /* Print Items */ + for (unsigned int i = 0; i < dbpc->itemcount; i++) { + if (first_entry != 1){ + scquery = StringFormat("REPLACE INTO `character_corpse_items` \n" + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + atoi(row2[0]), + dbpc->items[i].equipSlot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug1, + dbpc->items[i].aug2, + dbpc->items[i].aug3, + dbpc->items[i].aug4, + dbpc->items[i].aug5 + ); + first_entry = 1; + } + else{ + scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + atoi(row2[0]), + dbpc->items[i].equipSlot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug1, + dbpc->items[i].aug2, + dbpc->items[i].aug3, + dbpc->items[i].aug4, + dbpc->items[i].aug5 + ); + } + } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: SOF: Items", scquery); } + } + else{ + /* Classic Converter */ + scquery = StringFormat("UPDATE `character_corpses` SET \n" + "`is_locked` = %d,\n" + "`exp` = %u,\n" + "`size` = %f,\n" + "`level` = %u,\n" + "`race` = %u,\n" + "`gender` = %u,\n" + "`class` = %u,\n" + "`deity` = %u,\n" + "`texture` = %u,\n" + "`helm_texture` = %u,\n" + "`copper` = %u,\n" + "`silver` = %u,\n" + "`gold` = %u,\n" + "`platinum` = %u,\n" + "`hair_color` = %u,\n" + "`beard_color` = %u,\n" + "`eye_color_1` = %u,\n" + "`eye_color_2` = %u,\n" + "`hair_style` = %u,\n" + "`face` = %u,\n" + "`beard` = %u,\n" + "`wc_1` = %u,\n" + "`wc_2` = %u,\n" + "`wc_3` = %u,\n" + "`wc_4` = %u,\n" + "`wc_5` = %u,\n" + "`wc_6` = %u,\n" + "`wc_7` = %u,\n" + "`wc_8` = %u,\n" + "`wc_9` = %u \n" + "WHERE `id` = %u \n", + dbpc_c->locked, + dbpc_c->exp, + dbpc_c->size, + dbpc_c->level, + dbpc_c->race, + dbpc_c->gender, + dbpc_c->class_, + dbpc_c->deity, + dbpc_c->texture, + dbpc_c->helmtexture, + dbpc_c->copper, + dbpc_c->silver, + dbpc_c->gold, + dbpc_c->plat, + dbpc_c->haircolor, + dbpc_c->beardcolor, + dbpc_c->eyecolor1, + dbpc_c->eyecolor2, + dbpc_c->hairstyle, + dbpc_c->face, + dbpc_c->beard, + dbpc_c->item_tint[0].color, + dbpc_c->item_tint[1].color, + dbpc_c->item_tint[2].color, + dbpc_c->item_tint[3].color, + dbpc_c->item_tint[4].color, + dbpc_c->item_tint[5].color, + dbpc_c->item_tint[6].color, + dbpc_c->item_tint[7].color, + dbpc_c->item_tint[8].color, + atoi(row2[0]) + ); + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy :: Base Data", scquery); } + + first_entry = 0; + scquery = ""; + + /* Print Items */ + for (unsigned int i = 0; i < dbpc_c->itemcount; i++) { + if (first_entry != 1){ + scquery = StringFormat("REPLACE INTO `character_corpse_items` \n" + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + atoi(row2[0]), + dbpc_c->items[i].equipSlot, + dbpc_c->items[i].item_id, + dbpc_c->items[i].charges, + dbpc_c->items[i].aug1, + dbpc_c->items[i].aug2, + dbpc_c->items[i].aug3, + dbpc_c->items[i].aug4, + dbpc_c->items[i].aug5 + ); + first_entry = 1; + } + else{ + scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + atoi(row2[0]), + dbpc_c->items[i].equipSlot, + dbpc_c->items[i].item_id, + dbpc_c->items[i].charges, + dbpc_c->items[i].aug1, + dbpc_c->items[i].aug2, + dbpc_c->items[i].aug3, + dbpc_c->items[i].aug4, + dbpc_c->items[i].aug5 + ); + } + } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy : Items", scquery); } + } + } + } + QueryDatabase(StringFormat("ALTER TABLE `character_corpses` DROP COLUMN `data`")); + } + + /* Fetch Automatic Database Upgrade Script */ if (!std::ifstream("db_update.pl")){ std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; @@ -2093,8 +2362,8 @@ bool Database::CheckDatabaseConversions() { system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); #endif } - /* Run Automatic Database Upgrade Script */ + /* Run Automatic Database Upgrade Script */ system("perl db_update.pl ran_from_world"); return true; @@ -3659,7 +3928,7 @@ bool Database::CheckInstanceExists(uint16 instance_id) void Database::BuryCorpsesInInstance(uint16 instance_id) { - std::string query = StringFormat("UPDATE player_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", instance_id); + std::string query = StringFormat("UPDATE character_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", instance_id); auto results = QueryDatabase(query); } diff --git a/common/database.h b/common/database.h index 9b388c84a..e089b22a9 100644 --- a/common/database.h +++ b/common/database.h @@ -93,6 +93,87 @@ struct ExtendedProfile_Struct; struct GuildMember_Struct; class PTimerList; +#pragma pack(1) + +namespace player_lootitem_temp +{ + struct ServerLootItem_Struct_temp { + uint32 item_id; + int16 equipSlot; + uint8 charges; + uint16 lootslot; + uint32 aug1; + uint32 aug2; + uint32 aug3; + uint32 aug4; + uint32 aug5; + }; +} + +struct DBPlayerCorpse_Struct_temp { + uint32 crc; + bool locked; + uint32 itemcount; + uint32 exp; + float size; + uint8 level; + uint8 race; + uint8 gender; + uint8 class_; + uint8 deity; + uint8 texture; + uint8 helmtexture; + uint32 copper; + uint32 silver; + uint32 gold; + uint32 plat; + Color_Struct item_tint[9]; + uint8 haircolor; + uint8 beardcolor; + uint8 eyecolor1; + uint8 eyecolor2; + uint8 hairstyle; + uint8 face; + uint8 beard; + uint32 drakkin_heritage; + uint32 drakkin_tattoo; + uint32 drakkin_details; + player_lootitem_temp::ServerLootItem_Struct_temp items[0]; +}; + +namespace classic_db_temp +{ + struct DBPlayerCorpse_Struct_temp { + uint32 crc; + bool locked; + uint32 itemcount; + uint32 exp; + float size; + uint8 level; + uint8 race; + uint8 gender; + uint8 class_; + uint8 deity; + uint8 texture; + uint8 helmtexture; + uint32 copper; + uint32 silver; + uint32 gold; + uint32 plat; + Color_Struct item_tint[9]; + uint8 haircolor; + uint8 beardcolor; + uint8 eyecolor1; + uint8 eyecolor2; + uint8 hairstyle; + uint8 face; + uint8 beard; + player_lootitem_temp::ServerLootItem_Struct_temp items[0]; + }; +} + +#pragma pack() + class Database : public DBcore { public: Database(); diff --git a/common/dbcore.cpp b/common/dbcore.cpp index fb038db2e..9e12f64aa 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -4,6 +4,7 @@ #include #endif +#include #include #include #include @@ -126,6 +127,16 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); + /* Implement Logging at the Root*/ + if (requestResult.ErrorMessage() != ""){ + std::cout << "\n[MYSQL ERR] " << requestResult.ErrorMessage() << "\n\n" << query << "\n" << std::endl; + /* Write to log file */ + std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); + log << "[MYSQL ERR] " << requestResult.ErrorMessage() << "\n" << query << "\n"; + log.close(); + } + + #if DEBUG_MYSQL_QUERIES >= 1 if (requestResult.Success()) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b0f29c74b..ae19d8e1f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1217,8 +1217,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) int32 SharedDatabase::DeleteStalePlayerCorpses() { if(RuleB(Zone, EnableShadowrest)) { - std::string query = StringFormat("UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND " - "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d AND NOT timeofdeath = 0", + std::string query = StringFormat("UPDATE character_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND " + "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d AND NOT time_of_death = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); auto results = QueryDatabase(query); if (!results.Success()) @@ -1227,8 +1227,8 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { return results.RowsAffected(); } - std::string query = StringFormat("DELETE FROM player_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d " - "AND NOT timeofdeath = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); + std::string query = StringFormat("DELETE FROM character_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d " + "AND NOT time_of_death = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); auto results = QueryDatabase(query); if (!results.Success()) return -1; @@ -1238,7 +1238,7 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { int32 SharedDatabase::DeleteStalePlayerBackups() { // 1209600 seconds = 2 weeks - const std::string query = "DELETE FROM player_corpses_backup WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > 1209600"; + const std::string query = "DELETE FROM player_corpses_backup WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > 1209600"; auto results = QueryDatabase(query); if (!results.Success()) return -1; diff --git a/world/adventure.cpp b/world/adventure.cpp index 5f61aa5e9..ffb64779c 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -376,7 +376,7 @@ void Adventure::MoveCorpsesToGraveyard() std::list dbid_list; std::list charid_list; - std::string query = StringFormat("SELECT id, charid FROM player_corpses WHERE instanceid=%d", GetInstanceID()); + std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); @@ -392,7 +392,7 @@ void Adventure::MoveCorpsesToGraveyard() float y = GetTemplate()->graveyard_y + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); float z = GetTemplate()->graveyard_z; - query = StringFormat("UPDATE player_corpses " + query = StringFormat("UPDATE character_corpses " "SET zoneid = %d, instanceid = 0, " "x = %f, y = %f, z = %f WHERE instanceid = %d", GetTemplate()->graveyard_zone_id, diff --git a/zone/client.cpp b/zone/client.cpp index 9b10cb174..2c2b82aaa 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4969,7 +4969,7 @@ void Client::SummonAndRezzAllCorpses() entity_list.RemoveAllCorpsesByCharID(CharacterID()); - int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), + int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), GetX(), GetY(), GetZ(), GetHeading()); if(CorpseCount <= 0) { @@ -5007,7 +5007,7 @@ void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float de entity_list.RemoveAllCorpsesByCharID(CharacterID()); - int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), + int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); if(CorpseCount <= 0) { @@ -5051,7 +5051,7 @@ void Client::DepopPlayerCorpse(uint32 dbid) void Client::BuryPlayerCorpses() { - database.BuryAllPlayerCorpses(CharacterID()); + database.BuryAllCharacterCorpses(CharacterID()); } void Client::NotifyNewTitlesAvailable() diff --git a/zone/client.h b/zone/client.h index 3e54771ad..2f4ac0206 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1031,9 +1031,9 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void DepopAllCorpses(); void DepopPlayerCorpse(uint32 dbid); void BuryPlayerCorpses(); - uint32 GetCorpseCount() { return database.GetPlayerCorpseCount(CharacterID()); } - uint32 GetCorpseID(int corpse) { return database.GetPlayerCorpseID(CharacterID(), corpse); } - uint32 GetCorpseItemAt(int corpse_id, int slot_id) { return database.GetPlayerCorpseItemAt(corpse_id, slot_id); } + uint32 GetCorpseCount() { return database.GetCharacterCorpseCount(CharacterID()); } + uint32 GetCorpseID(int corpse) { return database.GetCharacterCorpseID(CharacterID(), corpse); } + uint32 GetCorpseItemAt(int corpse_id, int slot_id) { return database.GetCharacterCorpseItemAt(corpse_id, slot_id); } void SuspendMinion(); void Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration); void NotifyNewTitlesAvailable(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 238f324f2..000ed8fcc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4827,7 +4827,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) else Message(0, "This corpse will decay in %i minutes and %i seconds.", min, sec); - Message(0, "This corpse %s be resurrected.", tcorpse->Rezzed() ? "cannot" : "can"); + Message(0, "This corpse %s be resurrected.", tcorpse->IsRezzed() ? "cannot" : "can"); /* hour = 0; @@ -6175,8 +6175,8 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) char *escSearchString = new char[129]; database.DoEscapeString(escSearchString, gmscs->Name, strlen(gmscs->Name)); - std::string query = StringFormat("SELECT charname, zoneid, x, y, z, timeofdeath, rezzed, IsBurried " - "FROM player_corpses WheRE charname LIKE '%%%s%%' ORDER BY charname LIMIT %i", + std::string query = StringFormat("SELECT charname, zoneid, x, y, z, time_of_death, rezzed, IsBurried " + "FROM character_corpses WheRE charname LIKE '%%%s%%' ORDER BY charname LIMIT %i", escSearchString, maxResults); safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); @@ -6193,7 +6193,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) else Message(clientMessageYellow, "There are %i corpse(s) that match the search string '%s'.", results.RowCount(), gmscs->Name); - char charName[64], timeOfDeath[20]; + char charName[64], time_of_death[20]; std::string popupText = "", - charName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, timeOfDeath, + charName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, time_of_death, corpseRezzed ? "Yes" : "No", corpseBuried ? "Yes" : "No"); if (popupText.size() > 4000) { diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 13973df91..c4eb01f4a 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -2173,7 +2173,7 @@ void Client::HandleRespawnFromHover(uint32 Option) _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); - corpse->Rezzed(true); + corpse->IsRezzed(true); corpse->CompleteRezz(); } } diff --git a/zone/command.cpp b/zone/command.cpp index ce3d67fd6..27516d5a5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -8456,7 +8456,7 @@ void command_setgraveyard(Client *c, const Seperator *sep) zoneid = database.GetZoneID(sep->arg[1]); if(zoneid > 0) { - graveyard_id = database.NewGraveyardRecord(zoneid, t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); + graveyard_id = database.CreateGraveyardRecord(zoneid, t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); if(graveyard_id > 0) { c->Message(0, "Successfuly added a new record for this graveyard!"); @@ -8519,7 +8519,7 @@ void command_summonburriedplayercorpse(Client *c, const Seperator *sep) return; } - Corpse* PlayerCorpse = database.SummonBurriedPlayerCorpse(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); + Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); if(!PlayerCorpse) c->Message(0, "Your target doesn't have any burried corpses."); @@ -8538,7 +8538,7 @@ void command_getplayerburriedcorpsecount(Client *c, const Seperator *sep) return; } - uint32 CorpseCount = database.GetPlayerBurriedCorpseCount(t->CharacterID()); + uint32 CorpseCount = database.GetCharacterBuriedCorpseCount(t->CharacterID()); if(CorpseCount > 0) c->Message(0, "Your target has a total of %u burried corpses.", CorpseCount); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8df695a84..886d32aac 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,131 +63,40 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, uchar* in_data, uint32 in_datasize, float in_x, float in_y, float in_z, float in_heading, char* timeofdeath, bool rezzed, bool wasAtGraveyard) { - if (in_datasize < sizeof(classic_db::DBPlayerCorpse_Struct)) { - LogFile->write(EQEMuLog::Error, "Corpse::LoadFromDBData: Corrupt data: in_datasize < sizeof(DBPlayerCorpse_Struct)"); - return 0; - } - classic_db::DBPlayerCorpse_Struct* dbpc = (classic_db::DBPlayerCorpse_Struct*) in_data; - bool isSoF = true; - - uint32 esize1 = (sizeof(DBPlayerCorpse_Struct) + (dbpc->itemcount * sizeof(player_lootitem::ServerLootItem_Struct))); - uint32 esize2 = (sizeof(classic_db::DBPlayerCorpse_Struct) + (dbpc->itemcount * sizeof(player_lootitem::ServerLootItem_Struct))); - if (in_datasize != esize1) { - LogFile->write(EQEMuLog::Error, "Corpse::LoadFromDBData: Corrupt data: in_datasize (%i) != expected size (%i) Continuing on...", in_datasize, esize1); - if (in_datasize != esize2) { - LogFile->write(EQEMuLog::Error, "Corpse::LoadFromDBData: Corrupt data: in_datasize (%i) != expected size (%i) Your corpse is done broke, sir.", in_datasize, esize2); - return 0; - } - else - { - isSoF = false; - } +Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, PlayerCorpse_Struct* pcs, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard) { + /* Load Items */ + ItemList itemlist; + ServerLootItem_Struct* tmp = 0; + for (unsigned int i = 0; i < pcs->itemcount; i++) { + tmp = new ServerLootItem_Struct; + memcpy(tmp, &pcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); + tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); + itemlist.push_back(tmp); } - if(isSoF) - { - DBPlayerCorpse_Struct* dbpcs = (DBPlayerCorpse_Struct*) in_data; - if (dbpcs->crc != CRC32::Generate(&((uchar*) dbpcs)[4], in_datasize - 4)) { - LogFile->write(EQEMuLog::Error, "Corpse::LoadFromDBData: Corrupt data: crc failure"); - return 0; - } - ItemList itemlist; - ServerLootItem_Struct* tmp = 0; - for (unsigned int i=0; i < dbpcs->itemcount; i++) { - tmp = new ServerLootItem_Struct; - memcpy(tmp, &dbpcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); // temp hack until corpse blobs are removed - itemlist.push_back(tmp); - } + /* Create Corpse Entity */ + Corpse* pc = new Corpse(in_dbid, in_charid, in_charname, &itemlist, pcs->copper, pcs->silver, pcs->gold, pcs->plat, in_x, in_y, in_z, in_heading, pcs->size, pcs->gender, pcs->race, pcs->class_, pcs->deity, pcs->level, pcs->texture, pcs->helmtexture, pcs->exp, was_at_graveyard); + if (pcs->locked) + pc->Lock(); - // Little hack to account for the fact the race in the corpse struct is a uint8 and Froglok/Drakkin race number > 255 - // and to maintain backwards compatability with existing corpses in the database. - uint16 RealRace; + /* Load Item Tints */ + memcpy(pc->item_tint, pcs->item_tint, sizeof(pc->item_tint)); + + /* Load Physical Appearance */ + pc->haircolor = pcs->haircolor; + pc->beardcolor = pcs->beardcolor; + pc->eyecolor1 = pcs->eyecolor1; + pc->eyecolor2 = pcs->eyecolor2; + pc->hairstyle = pcs->hairstyle; + pc->luclinface = pcs->face; + pc->beard = pcs->beard; + pc->drakkin_heritage = pcs->drakkin_heritage; + pc->drakkin_tattoo = pcs->drakkin_tattoo; + pc->drakkin_details = pcs->drakkin_details; + pc->IsRezzed(rezzed); + pc->become_npc = false; - switch(dbpcs->race) { - case 254: - RealRace = DRAKKIN; - break; - case 255: - RealRace = FROGLOK; - break; - default: - RealRace = dbpc->race; - } - - Corpse* pc = new Corpse(in_dbid, in_charid, in_charname, &itemlist, dbpcs->copper, dbpcs->silver, dbpcs->gold, dbpcs->plat, in_x, in_y, in_z, in_heading, dbpcs->size, dbpcs->gender, RealRace, dbpcs->class_, dbpcs->deity, dbpcs->level, dbpcs->texture, dbpcs->helmtexture, dbpcs->exp, wasAtGraveyard); - if (dbpcs->locked) - pc->Lock(); - - // load tints - memcpy(pc->item_tint, dbpcs->item_tint, sizeof(pc->item_tint)); - // appearance - pc->haircolor = dbpcs->haircolor; - pc->beardcolor = dbpcs->beardcolor; - pc->eyecolor1 = dbpcs->eyecolor1; - pc->eyecolor2 = dbpcs->eyecolor2; - pc->hairstyle = dbpcs->hairstyle; - pc->luclinface = dbpcs->face; - pc->beard = dbpcs->beard; - pc->drakkin_heritage = dbpcs->drakkin_heritage; - pc->drakkin_tattoo = dbpcs->drakkin_tattoo; - pc->drakkin_details = dbpcs->drakkin_details; - pc->Rezzed(rezzed); - pc->become_npc = false; - return pc; - } - else - { - if (dbpc->crc != CRC32::Generate(&((uchar*) dbpc)[4], in_datasize - 4)) { - LogFile->write(EQEMuLog::Error, "Corpse::LoadFromDBData: Corrupt data: crc failure"); - return 0; - } - ItemList itemlist; - ServerLootItem_Struct* tmp = 0; - for (unsigned int i=0; i < dbpc->itemcount; i++) { - tmp = new ServerLootItem_Struct; - memcpy(tmp, &dbpc->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); // temp hack until corpse blobs are removed - itemlist.push_back(tmp); - } - - // Little hack to account for the fact the race in the corpse struct is a uint8 and Froglok/Drakkin race number > 255 - // and to maintain backwards compatability with existing corpses in the database. - uint16 RealRace; - - switch(dbpc->race) { - case 254: - RealRace = DRAKKIN; - break; - case 255: - RealRace = FROGLOK; - break; - default: - RealRace = dbpc->race; - } - - Corpse* pc = new Corpse(in_dbid, in_charid, in_charname, &itemlist, dbpc->copper, dbpc->silver, dbpc->gold, dbpc->plat, in_x, in_y, in_z, in_heading, dbpc->size, dbpc->gender, RealRace, dbpc->class_, dbpc->deity, dbpc->level, dbpc->texture, dbpc->helmtexture,dbpc->exp, wasAtGraveyard); - if (dbpc->locked) - pc->Lock(); - - // load tints - memcpy(pc->item_tint, dbpc->item_tint, sizeof(pc->item_tint)); - // appearance - pc->haircolor = dbpc->haircolor; - pc->beardcolor = dbpc->beardcolor; - pc->eyecolor1 = dbpc->eyecolor1; - pc->eyecolor2 = dbpc->eyecolor2; - pc->hairstyle = dbpc->hairstyle; - pc->luclinface = dbpc->face; - pc->beard = dbpc->beard; - pc->drakkin_heritage = 0; - pc->drakkin_tattoo = 0; - pc->drakkin_details = 0; - pc->Rezzed(rezzed); - pc->become_npc = false; - return pc; - } + return pc; } // To be used on NPC death and ZoneStateLoad @@ -222,7 +131,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP npctype_id = in_npctypeid; SetPKItem(0); charid = 0; - dbid = 0; + corpse_db_id = 0; p_depop = false; strcpy(orgname, in_npc->GetName()); strcpy(name, in_npc->GetName()); @@ -331,7 +240,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) pLocked = false; BeingLootedBy = 0xFFFFFFFF; charid = client->CharacterID(); - dbid = 0; + corpse_db_id = 0; p_depop = false; copper = 0; silver = 0; @@ -435,14 +344,14 @@ Corpse::Corpse(Client* client, int32 in_rezexp) client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead client->Save(); - Rezzed(false); + IsRezzed(false); Save(); database.TransactionCommit(); return; } //end "not leaving naked corpses" - Rezzed(false); + IsRezzed(false); Save(); } @@ -503,7 +412,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in p_PlayerCorpse = true; pLocked = false; BeingLootedBy = 0xFFFFFFFF; - dbid = in_dbid; + corpse_db_id = in_dbid; p_depop = false; charid = in_charid; itemlist = *in_itemlist; @@ -522,7 +431,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in } Corpse::~Corpse() { - if (p_PlayerCorpse && !(p_depop && dbid == 0)) { + if (p_PlayerCorpse && !(p_depop && corpse_db_id == 0)) { Save(); } ItemList::iterator cur,end; @@ -557,8 +466,8 @@ bool Corpse::Save() { return true; uint32 tmp = this->CountItems(); - uint32 tmpsize = sizeof(DBPlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct)); - DBPlayerCorpse_Struct* dbpc = (DBPlayerCorpse_Struct*) new uchar[tmpsize]; + uint32 tmpsize = sizeof(PlayerCorpse_Struct)+(tmp * sizeof(player_lootitem::ServerLootItem_Struct)); + PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize]; memset(dbpc, 0, tmpsize); dbpc->itemcount = tmp; dbpc->size = this->size; @@ -567,23 +476,7 @@ bool Corpse::Save() { dbpc->silver = this->silver; dbpc->gold = this->gold; dbpc->plat = this->platinum; - - // Little hack to account for the fact the race in the corpse struct is a uint8 and Froglok/Drakkin race number > 255 - // and to maintain backwards compatability with existing corpses in the database. - uint16 CorpseRace; - - switch(race) { - case DRAKKIN: - CorpseRace = 254; - break; - case FROGLOK: - CorpseRace = 255; - break; - default: - CorpseRace = race; - } - - dbpc->race = CorpseRace; + dbpc->race = this->race; dbpc->class_ = class_; dbpc->gender = gender; dbpc->deity = deity; @@ -604,45 +497,37 @@ bool Corpse::Save() { dbpc->drakkin_details = drakkin_details; uint32 x = 0; - ItemList::iterator cur,end; + ItemList::iterator cur, end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; ++cur) { + for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; item->equipSlot = ServerToCorpseSlot(item->equipSlot); // temp hack until corpse blobs are removed - memcpy((char*) &dbpc->items[x++], (char*) item, sizeof(player_lootitem::ServerLootItem_Struct)); + memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(player_lootitem::ServerLootItem_Struct)); } - dbpc->crc = CRC32::Generate(&((uchar*) dbpc)[4], tmpsize - 4); + if (corpse_db_id == 0) { + corpse_db_id = database.SaveCharacterCorpse(charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); + } + else{ + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); + } - if (dbid == 0) - { - dbid = database.CreatePlayerCorpse(charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), (uchar*) dbpc, tmpsize, x_pos, y_pos, z_pos, heading); - if(RuleB(Zone, UsePlayerCorpseBackups) == true) - database.CreatePlayerCorpseBackup(dbid, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), (uchar*) dbpc, tmpsize, x_pos, y_pos, z_pos, heading); - } - else - dbid = database.UpdatePlayerCorpse(dbid, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), (uchar*) dbpc, tmpsize, x_pos, y_pos, z_pos, heading,Rezzed()); - safe_delete_array(dbpc); - if (dbid == 0) { - std::cout << "Error: Failed to save player corpse '" << this->GetName() << "'" << std::endl; - return false; - } return true; } void Corpse::Delete() { - if (IsPlayerCorpse() && dbid != 0) - database.DeletePlayerCorpse(dbid); - dbid = 0; - + if (IsPlayerCorpse() && corpse_db_id != 0) + database.DeleteCharacterCorpse(corpse_db_id); + + corpse_db_id = 0; p_depop = true; } void Corpse::Bury() { - if (IsPlayerCorpse() && dbid != 0) - database.BuryPlayerCorpse(dbid); - dbid = 0; + if (IsPlayerCorpse() && corpse_db_id != 0) + database.BuryCharacterCorpse(corpse_db_id); + corpse_db_id = 0; p_depop = true; } @@ -677,8 +562,7 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui itemlist.push_back(item); } -ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data) -{ +ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data) { ServerLootItem_Struct *sitem = 0, *sitem2; // find the item @@ -726,9 +610,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const { return 0; } -void Corpse::RemoveItem(uint16 lootslot) -{ - +void Corpse::RemoveItem(uint16 lootslot) { if (lootslot == 0xFFFF) return; @@ -745,10 +627,8 @@ void Corpse::RemoveItem(uint16 lootslot) } } -void Corpse::RemoveItem(ServerLootItem_Struct* item_data) -{ - uint8 material; - +void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ + uint8 material; ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -808,18 +688,18 @@ bool Corpse::Process() { if(zone->HasGraveyard()) { Save(); p_depop = true; - database.GraveyardPlayerCorpse(dbid, zone->graveyard_zoneid(), + database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(), zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading()); corpse_graveyard_timer.Disable(); ServerPacket* pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)); SpawnPlayerCorpse_Struct* spc = (SpawnPlayerCorpse_Struct*)pack->pBuffer; - spc->player_corpse_id = dbid; + spc->player_corpse_id = corpse_db_id; spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); LogFile->write(EQEMuLog::Debug, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); - dbid = 0; + corpse_db_id = 0; } corpse_graveyard_timer.Disable(); @@ -835,10 +715,10 @@ bool Corpse::Process() { if(!RuleB(Zone, EnableShadowrest)) Delete(); else { - if(database.BuryPlayerCorpse(dbid)) { + if(database.BuryCharacterCorpse(corpse_db_id)) { Save(); p_depop = true; - dbid = 0; + corpse_db_id = 0; LogFile->write(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); } else @@ -895,7 +775,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a return; } - if(IsPlayerCorpse() && dbid == 0) { + if(IsPlayerCorpse() && corpse_db_id == 0) { // SendLootReqErrorPacket(client, 0); client->Message(13, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!"); std::cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << std::endl; @@ -1458,534 +1338,6 @@ void Corpse::Spawn() { safe_delete(app); } -bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; - uint32 query_length = 0; - uint32 affected_rows = 0; - - query_length = sprintf(query,"UPDATE zone SET graveyard_id=0 WHERE zoneidnumber=%u AND version=0", zone_id); - - if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) { - safe_delete_array(query); - std::cerr << "Error1 in DeleteGraveyard query " << errbuf << std::endl; - return false; - } - - if (affected_rows == 0) { - std::cerr << "Error2 in DeleteGraveyard query: affected_rows = 0" << std::endl; - return false; - } - - query_length = sprintf(query,"DELETE FROM graveyard WHERE id=%u", graveyard_id); - - if (!RunQuery(query, query_length, errbuf, 0, &affected_rows)) { - safe_delete_array(query); - std::cerr << "Error3 in DeleteGraveyard query " << errbuf << std::endl; - return false; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error4 in DeleteGraveyard query: affected_rows = 0" << std::endl; - return false; - } - - return true; -} -uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; - char* end = query; - uint32 affected_rows = 0; - - end += sprintf(end,"UPDATE zone SET graveyard_id=%u WHERE zoneidnumber=%u AND version=0", graveyard_id, zone_id); - - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - safe_delete_array(query); - std::cerr << "Error1 in AddGraveyardIDToZone query " << errbuf << std::endl; - return 0; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error2 in AddGraveyardIDToZone query: affected_rows = 0" << std::endl; - return 0; - } - - return zone_id; -} -uint32 ZoneDatabase::NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; - char* end = query; - uint32 affected_rows = 0; - uint32 new_graveyard_id = 0; - - end += sprintf(end,"INSERT INTO graveyard SET zone_id=%u, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f", graveyard_zoneid, graveyard_x, graveyard_y, graveyard_z, graveyard_heading); - - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &new_graveyard_id)) { - safe_delete_array(query); - std::cerr << "Error1 in NewGraveyardRecord query " << errbuf << std::endl; - return 0; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error2 in NewGraveyardRecord query: affected_rows = 0" << std::endl; - return 0; - } - - if(new_graveyard_id <= 0) { - std::cerr << "Error3 in NewGraveyardRecord query: new_graveyard_id <= 0" << std::endl; - return 0; - } - - return new_graveyard_id; -} -uint32 ZoneDatabase::GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; - char* end = query; - uint32 affected_rows = 0; - - // We probably don't want a graveyard located in an instance. - end += sprintf(end,"Update player_corpses SET zoneid=%u, instanceid=0, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, WasAtGraveyard=1 WHERE id=%d", zoneid, x, y, z, heading, dbid); - - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - safe_delete_array(query); - std::cerr << "Error1 in GraveyardPlayerCorpse query " << errbuf << std::endl; - return 0; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error2 in GraveyardPlayerCorpse query: affected_rows = 0" << std::endl; - return 0; - } - return dbid; -} -uint32 ZoneDatabase::UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; - char* end = query; - uint32 affected_rows = 0; - - end += sprintf(end, "Update player_corpses SET data="); - *end++ = '\''; - end += DoEscapeString(end, (char*)data, datasize); - *end++ = '\''; - end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f WHERE id=%d", charname, zoneid, instanceid, charid, x, y, z, heading, dbid); - - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - safe_delete_array(query); - std::cerr << "Error1 in UpdatePlayerCorpse query " << errbuf << std::endl; - return 0; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error2 in UpdatePlayerCorpse query: affected_rows = 0" << std::endl; - return 0; - } - if(rezzed){ - if (!RunQuery(query, MakeAnyLenString(&query, "update player_corpses set rezzed = 1 WHERE id=%d",dbid), errbuf)) { - std::cerr << "Error in UpdatePlayerCorpse/Rezzed query: " << errbuf << std::endl; - } - safe_delete_array(query); - } - return dbid; -} - -void ZoneDatabase::MarkCorpseAsRezzed(uint32 dbid) -{ - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = 0; - - if(!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE player_corpses SET rezzed = 1 WHERE id = %i", dbid), errbuf)) - { - LogFile->write(EQEMuLog::Error, "MarkCorpseAsRezzed failed: %s, %s", query, errbuf); - } - safe_delete_array(query); -} - -uint32 ZoneDatabase::CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; - char* end = query; - //MYSQL_RES *result; - //MYSQL_ROW row; - uint32 affected_rows = 0; - uint32 last_insert_id = 0; - - end += sprintf(end, "Insert into player_corpses SET data="); - *end++ = '\''; - end += DoEscapeString(end, (char*)data, datasize); - *end++ = '\''; - end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, timeofdeath=Now(), IsBurried=0", charname, zoneid, instanceid, charid, x, y, z, heading); - - if (!RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows, &last_insert_id)) { - safe_delete_array(query); - std::cerr << "Error1 in CreatePlayerCorpse query " << errbuf << std::endl; - return 0; - } - safe_delete_array(query); - - if (affected_rows == 0) { - std::cerr << "Error2 in CreatePlayerCorpse query: affected_rows = 0" << std::endl; - return 0; - } - - if (last_insert_id == 0) { - std::cerr << "Error3 in CreatePlayerCorpse query: last_insert_id = 0" << std::endl; - return 0; - } - - return last_insert_id; -} - -bool ZoneDatabase::CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256+(datasize*2)]; - char* end = query; - uint32 affected_rows = 0; - uint32 last_insert_id = 0; - bool result = false; - DBPlayerCorpse_Struct* dbpcs = (DBPlayerCorpse_Struct*) data; - - if (dbid != 0) { - if(RuleB(Character, LeaveCorpses) == true && dbpcs->level >= RuleI(Character, DeathItemLossLevel)){ - end += sprintf(end, "Insert into player_corpses_backup SET data="); - *end++ = '\''; - end += DoEscapeString(end, (char*)data, datasize); - *end++ = '\''; - end += sprintf(end,", charname='%s', zoneid=%u, instanceid=%u, charid=%d, x=%1.1f, y=%1.1f, z=%1.1f, heading=%1.1f, timeofdeath=Now(), IsBurried=0, id=%u", charname, zoneid, instanceid, charid, x, y, z, heading, dbid); - - if (RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - if (affected_rows == 1) - result = true; - else - std::cerr << "Error in CreatePlayerCorpseBackup query: affected_rows != 1" << std::endl; - } - else - std::cerr << "Error in CreatePlayerCorpseBackup query " << errbuf << std::endl; - } - safe_delete_array(query); - } - else { - std::cerr << "Error in CreatePlayerCorpseBackup: dbid = 0" << std::endl; - } - return result; -} - -uint32 ZoneDatabase::GetPlayerBurriedCorpseCount(uint32 char_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 CorpseCount = 0; - - if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u' and IsBurried = 1", char_id), errbuf, &result)) { - row = mysql_fetch_row(result); - CorpseCount = atoi(row[0]); - mysql_free_result(result); - } - else { - std::cerr << "Error in GetPlayerBurriedCorpseCount query '" << query << "' " << errbuf << std::endl; - } - - safe_delete_array(query); - - return CorpseCount; -} - -uint32 ZoneDatabase::GetPlayerCorpseCount(uint32 char_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 CorpseCount = 0; - - if (RunQuery(query, MakeAnyLenString(&query, "select count(*) from player_corpses where charid = '%u'", char_id), errbuf, &result)) { - row = mysql_fetch_row(result); - CorpseCount = atoi(row[0]); - mysql_free_result(result); - } - else { - std::cerr << "Error in GetPlayerCorpseCount query '" << query << "' " << errbuf << std::endl; - } - - safe_delete_array(query); - - return CorpseCount; -} - -uint32 ZoneDatabase::GetPlayerCorpseID(uint32 char_id, uint8 corpse) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 id = 0; - - if (RunQuery(query, MakeAnyLenString(&query, "select id from player_corpses where charid = '%u'", char_id), errbuf, &result)) { - for (int i=0; iGetWornItem(slotid); - tmp->DepopCorpse(); - } - return itemid; -} - -Corpse* ZoneDatabase::SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - Corpse* NewCorpse = 0; - unsigned long* lengths; - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charname, data, timeofdeath, rezzed FROM player_corpses WHERE charid='%u' AND IsBurried=1 ORDER BY timeofdeath LIMIT 1", char_id), errbuf, &result)) { - row = mysql_fetch_row(result); - lengths = mysql_fetch_lengths(result); - if(row) { - NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], (uchar*) row[2], lengths[2], dest_x, dest_y, dest_z, dest_heading, row[3],atoi(row[4])==1, false); - if(NewCorpse) { - entity_list.AddCorpse(NewCorpse); - NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); - NewCorpse->Spawn(); - if(!UnburyPlayerCorpse(NewCorpse->GetDBID(), dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading)) - LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); - } - else - LogFile->write(EQEMuLog::Error, "Unable to construct a player corpse from a burried player corpse for character id %u.", char_id); - } - - mysql_free_result(result); - } - else { - std::cerr << "Error in SummonBurriedPlayerCorpse query '" << query << "' " << errbuf << std::endl; - } - - safe_delete_array(query); - - return NewCorpse; -} - -bool ZoneDatabase::SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, - float dest_x, float dest_y, float dest_z, float dest_heading) -{ - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - Corpse* NewCorpse = 0; - int CorpseCount = 0; - unsigned long* lengths; - - if(!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET zoneid = %i, instanceid = %i, x = %f, y = %f, z = %f, " - "heading = %f, IsBurried = 0, WasAtGraveyard = 0 WHERE charid = %i", - dest_zoneid, dest_instanceid, dest_x, dest_y, dest_z, dest_heading, char_id), errbuf)) - LogFile->write(EQEMuLog::Error, "Error moving corpses, Query = %s, Error = %s\n", query, errbuf); - - safe_delete_array(query); - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charname, data, timeofdeath, rezzed FROM player_corpses WHERE charid='%u'" - "ORDER BY timeofdeath", char_id), errbuf, &result)) - { - while((row = mysql_fetch_row(result))) - { - lengths = mysql_fetch_lengths(result); - NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], (uchar*) row[2], lengths[2], dest_x, dest_y, - dest_z, dest_heading, row[3],atoi(row[4])==1, false); - if(NewCorpse) { - entity_list.AddCorpse(NewCorpse); - NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); - NewCorpse->Spawn(); - ++CorpseCount; - } - else - LogFile->write(EQEMuLog::Error, "Unable to construct a player corpse for character id %u.", char_id); - } - - mysql_free_result(result); - } - else - LogFile->write(EQEMuLog::Error, "Error in SummonAllPlayerCorpses Query = %s, Error = %s\n", query, errbuf); - - safe_delete_array(query); - - return (CorpseCount > 0); -} - -bool ZoneDatabase::UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 new_instanceid, float new_x, float new_y, float new_z, float new_heading) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char* query = new char[256]; - char* end = query; - uint32 affected_rows = 0; - bool Result = false; - - end += sprintf(end, "UPDATE player_corpses SET IsBurried=0, zoneid=%u, instanceid=%u, x=%f, y=%f, z=%f, heading=%f, timeofdeath=Now(), WasAtGraveyard=0 WHERE id=%u", new_zoneid, new_instanceid, new_x, new_y, new_z, new_heading, dbid); - - if (RunQuery(query, (uint32) (end - query), errbuf, 0, &affected_rows)) { - if (affected_rows == 1) - Result = true; - else - std::cerr << "Error2 in UnburyPlayerCorpse query: affected_rows NOT EQUAL to 1, as expected." << std::endl; - } - else - std::cerr << "Error1 in UnburyPlayerCorpse query " << errbuf << std::endl; - - safe_delete_array(query); - - return Result; -} - -Corpse* ZoneDatabase::LoadPlayerCorpse(uint32 player_corpse_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - Corpse* NewCorpse = 0; - unsigned long* lengths; - - if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, charid, charname, x, y, z, heading, data, timeofdeath, rezzed, WasAtGraveyard FROM player_corpses WHERE id='%u'", player_corpse_id), errbuf, &result)) { - row = mysql_fetch_row(result); - lengths = mysql_fetch_lengths(result); - if(row && lengths) - { - NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10])); - entity_list.AddCorpse(NewCorpse); - } - mysql_free_result(result); - } - else { - std::cerr << "Error in LoadPlayerCorpse query '" << query << "' " << errbuf << std::endl; - std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n"; - } - - safe_delete_array(query); - - return NewCorpse; -} - -bool ZoneDatabase::LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 query_length = 0; - - unsigned long* lengths; - - if(!RuleB(Zone, EnableShadowrest)) - query_length = MakeAnyLenString(&query, "SELECT id, charid, charname, x, y, z, heading, data, timeofdeath, rezzed, WasAtGraveyard FROM player_corpses WHERE zoneid='%u' AND instanceid='%u'", iZoneID, iInstanceID); - else - query_length = MakeAnyLenString(&query, "SELECT id, charid, charname, x, y, z, heading, data, timeofdeath, rezzed, 0 FROM player_corpses WHERE zoneid='%u' AND instanceid='%u' AND IsBurried=0", iZoneID, iInstanceID); - - if (RunQuery(query, query_length, errbuf, &result)) { - safe_delete_array(query); - while ((row = mysql_fetch_row(result))) { - lengths = mysql_fetch_lengths(result); - entity_list.AddCorpse(Corpse::LoadFromDBData(atoi(row[0]), atoi(row[1]), row[2], (uchar*) row[7], lengths[7], atof(row[3]), atoi(row[4]), atoi(row[5]), atoi(row[6]), row[8],atoi(row[9])==1, atoi(row[10]))); - } - mysql_free_result(result); - } - else { - std::cerr << "Error in LoadPlayerCorpses query '" << query << "' " << errbuf << std::endl; - std::cerr << "Note that if your missing the 'rezzed' field you can add it with:\nALTER TABLE `player_corpses` ADD `rezzed` TINYINT UNSIGNED DEFAULT \"0\";\n"; - safe_delete_array(query); - return false; - } - - return true; -} - -uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - uint32 CorpseID = 0; - - MakeAnyLenString(&query, "SELECT id FROM player_corpses WHERE charid='%u' AND IsBurried=0 ORDER BY timeofdeath LIMIT 1", char_id); - if (RunQuery(query, strlen(query), errbuf, &result)) { - if (mysql_num_rows(result)!= 0){ - row = mysql_fetch_row(result); - CorpseID = atoi(row[0]); - mysql_free_result(result); - } - } - else { - std::cerr << "Error in GetFirstCorpseID query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); - return 0; - } - - safe_delete_array(query); - return CorpseID; -} - -bool ZoneDatabase::BuryPlayerCorpse(uint32 dbid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE id=%d", dbid), errbuf)) { - std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); - return false; - } - - safe_delete_array(query); - return true; -} - -bool ZoneDatabase::BuryAllPlayerCorpses(uint32 charid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE charid=%d", charid), errbuf)) { - std::cerr << "Error in BuryPlayerCorpse query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); - return false; - } - - safe_delete_array(query); - return true; -} - -bool ZoneDatabase::DeletePlayerCorpse(uint32 dbid) { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - - if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where id=%d", dbid), errbuf)) { - std::cerr << "Error in DeletePlayerCorpse query '" << query << "' " << errbuf << std::endl; - safe_delete_array(query); - return false; - } - - safe_delete_array(query); - return true; -} - -// these functions operate with a material slot, which is from 0 to 8 uint32 Corpse::GetEquipment(uint8 material_slot) const { int invslot; @@ -2039,7 +1391,7 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){ char *query = 0; MYSQL_RES *result; MYSQL_ROW row; - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) FROM player_corpses WHERE id=%d and not timeofdeath=0", dbid), errbuf, &result)) { + if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) FROM character_corpses WHERE id=%d and not time_of_death=0", dbid), errbuf, &result)) { safe_delete_array(query); while ((row = mysql_fetch_row(result))) { if(atoi(row[0]) > 0 && RuleI(Character, CorpseDecayTimeMS) > (atoi(row[0]) * 1000)) { @@ -2177,28 +1529,4 @@ int16 Corpse::CorpseToServerSlot(int16 corpse_slot) return corpse_slot; } */ -} - -/* -void Corpse::CastRezz(uint16 spellid, Mob* Caster){ - if(Rezzed()){ - if(Caster && Caster->IsClient()) - Caster->Message(13,"This character has already been resurrected."); - return; - } - - APPLAYER* outapp = new APPLAYER(OP_RezzRequest, sizeof(Resurrect_Struct)); - Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer; - memcpy(rezz->your_name,this->orgname,30); - memcpy(rezz->corpse_name,this->name,30); - memcpy(rezz->rezzer_name,Caster->GetName(),30); - memcpy(rezz->zone,zone->GetShortName(),15); - rezz->spellid = spellid; - rezz->x = this->x_pos; - rezz->y = this->y_pos; - rezz->z = (float)this->z_pos; - worldserver.RezzPlayer(outapp, rezzexp, OP_RezzRequest); - //DumpPacket(outapp); - safe_delete(outapp); -} -*/ +} \ No newline at end of file diff --git a/zone/corpse.h b/zone/corpse.h index 2d1eecc98..8b1269c1b 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -30,8 +30,8 @@ class Corpse : public Mob { public: static void SendEndLootErrorPacket(Client* client); - static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - static Corpse* LoadFromDBData(uint32 in_corpseid, uint32 in_charid, char* in_charname, uchar* in_data, uint32 in_datasize, float in_x, float in_y, float in_z, float in_heading, char* timeofdeath, bool rezzed = false, bool wasAtGraveyard = false); + static void SendLootReqErrorPacket(Client* client, uint8 response = 2); + static Corpse* LoadFromDBData(uint32 in_corpseid, uint32 in_charid, char* in_charname, PlayerCorpse_Struct* pcs, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed = false, bool wasAtGraveyard = false); Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); @@ -39,51 +39,51 @@ public: ~Corpse(); //abstract virtual function implementations requird by base abstract class - virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } - virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, - ExtraAttackOptions *opts = nullptr) { return false; } - virtual bool HasRaid() { return false; } - virtual bool HasGroup() { return false; } - virtual Raid* GetRaid() { return 0; } - virtual Group* GetGroup() { return 0; } + virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } + virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, + bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } + virtual bool HasRaid() { return false; } + virtual bool HasGroup() { return false; } + virtual Raid* GetRaid() { return 0; } + virtual Group* GetGroup() { return 0; } - void LoadPlayerCorpseDecayTime(uint32 dbid); + void LoadPlayerCorpseDecayTime(uint32 dbid); - bool IsCorpse() const { return true; } - bool IsPlayerCorpse() const { return p_PlayerCorpse; } - bool IsNPCCorpse() const { return !p_PlayerCorpse; } - bool IsBecomeNPCCorpse() const { return become_npc; } - bool Process(); - bool Save(); - uint32 GetCharID() { return charid; } - uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (charid=iCharID); } return 0xFFFFFFFF; }; - uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); } - uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); } - void CalcCorpseName(); + bool IsCorpse() const { return true; } + bool IsPlayerCorpse() const { return p_PlayerCorpse; } + bool IsNPCCorpse() const { return !p_PlayerCorpse; } + bool IsBecomeNPCCorpse() const { return become_npc; } + bool Process(); + bool Save(); + uint32 GetCharID() { return charid; } + uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (charid = iCharID); } return 0xFFFFFFFF; }; + uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); } + uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); } + void CalcCorpseName(); inline void Lock() { pLocked = true; } inline void UnLock() { pLocked = false; } inline bool IsLocked() { return pLocked; } inline void ResetLooter() { BeingLootedBy = 0xFFFFFFFF; } inline bool IsBeingLooted() { return (BeingLootedBy != 0xFFFFFFFF); } - inline uint32 GetDBID() { return dbid; } + inline uint32 GetDBID() { return corpse_db_id; } inline char* GetOwnerName() { return orgname;} - void SetDecayTimer(uint32 decaytime); - bool IsEmpty() const; - void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); - uint32 GetWornItem(int16 equipSlot) const; - ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0); - void RemoveItem(uint16 lootslot); - void RemoveItem(ServerLootItem_Struct* item_data); - void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum); - void RemoveCash(); - void QueryLoot(Client* to); - uint32 CountItems(); - void Delete(); - void Bury(); - virtual void Depop(); - virtual void DepopCorpse(); + void SetDecayTimer(uint32 decaytime); + bool IsEmpty() const; + void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); + uint32 GetWornItem(int16 equipSlot) const; + ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0); + void RemoveItem(uint16 lootslot); + void RemoveItem(ServerLootItem_Struct* item_data); + void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum); + void RemoveCash(); + void QueryLoot(Client* to); + uint32 CountItems(); + void Delete(); + void Bury(); + virtual void Depop(); + virtual void DepopCorpse(); uint32 GetCopper() { return copper; } uint32 GetSilver() { return silver; } @@ -99,17 +99,17 @@ public: void CompleteRezz(); void SetPKItem(int32 id) { pkitem = id; } int32 GetPKItem() { return pkitem; } - bool CanMobLoot(int charid); - void AllowMobLoot(Mob *them, uint8 slot); - void AddLooter(Mob *who); - bool Rezzed() { return rez; } - void Rezzed(bool in_rez) { rez = in_rez; } + bool CanMobLoot(int charid); + void AllowMobLoot(Mob *them, uint8 slot); + void AddLooter(Mob *who); + bool IsRezzed() { return rez; } + void IsRezzed(bool in_rez) { rez = in_rez; } void Spawn(); char orgname[64]; - uint32 GetEquipment(uint8 material_slot) const; // returns item id - uint32 GetEquipmentColor(uint8 material_slot) const; - inline int GetRezzExp() { return rezzexp; } + uint32 GetEquipment(uint8 material_slot) const; // returns item id + uint32 GetEquipmentColor(uint8 material_slot) const; + inline int GetRezzExp() { return rezzexp; } // these are a temporary work-around until corpse inventory is removed from the database blob static int16 ServerToCorpseSlot(int16 server_slot); // encode @@ -122,7 +122,7 @@ private: bool p_PlayerCorpse; bool pIsChanged; bool pLocked; int32 pkitem; - uint32 dbid; + uint32 corpse_db_id; uint32 charid; ItemList itemlist; uint32 copper; diff --git a/zone/doors.cpp b/zone/doors.cpp index 5ff7eae26..4af1d3eae 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -50,7 +50,7 @@ Doors::Doors(const Door* door) incline = door->incline; opentype = door->opentype; guild_id = door->guild_id; - lockpick = door->lockpick; + lockpick = door->lock_pick; keyitem = door->keyitem; nokeyring = door->nokeyring; trigger_door = door->trigger_door; @@ -678,7 +678,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name into[rowIndex].heading = (float)atof(row[7]); into[rowIndex].opentype = atoi(row[8]); into[rowIndex].guild_id = atoi(row[9]); - into[rowIndex].lockpick = atoi(row[10]); + into[rowIndex].lock_pick = atoi(row[10]); into[rowIndex].keyitem = atoi(row[11]); into[rowIndex].nokeyring = atoi(row[12]); into[rowIndex].trigger_door = atoi(row[13]); diff --git a/zone/entity.cpp b/zone/entity.cpp index ed5b99219..122e24582 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1678,7 +1678,7 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid) while (it != corpse_list.end()) { if (it->second->GetCharID() == charid) { RezzExp += it->second->GetRezzExp(); - it->second->Rezzed(true); + it->second->IsRezzed(true); it->second->CompleteRezz(); } ++it; diff --git a/zone/lua_corpse.cpp b/zone/lua_corpse.cpp index 6498458ae..beada7e9a 100644 --- a/zone/lua_corpse.cpp +++ b/zone/lua_corpse.cpp @@ -44,7 +44,7 @@ uint32 Lua_Corpse::GetDBID() { bool Lua_Corpse::IsRezzed() { Lua_Safe_Call_Bool(); - return self->Rezzed(); + return self->IsRezzed(); } const char* Lua_Corpse::GetOwnerName() { diff --git a/zone/merc.cpp b/zone/merc.cpp index 94d129b14..2ecd0849e 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4338,7 +4338,7 @@ Corpse* Merc::GetGroupMemberCorpse() { if(g->members[i] && g->members[i]->IsClient()) { corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius)); - if(corpse && !corpse->Rezzed()) { + if(corpse && !corpse->IsRezzed()) { return corpse; } } @@ -6367,4 +6367,4 @@ uint32 Merc::CalcUpkeepCost(uint32 templateID , uint8 level, uint8 currency_type } return cost; -} \ No newline at end of file +} diff --git a/zone/perl_player_corpse.cpp b/zone/perl_player_corpse.cpp index 366299ea2..af5c79f16 100644 --- a/zone/perl_player_corpse.cpp +++ b/zone/perl_player_corpse.cpp @@ -780,7 +780,7 @@ XS(XS_Corpse_IsRezzed) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->Rezzed(); + RETVAL = THIS->IsRezzed(); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index dc9d6d8f6..e014c01cd 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1744,7 +1744,7 @@ bool QuestManager::summonburriedplayercorpse(uint32 char_id, float dest_x, float bool Result = false; if(char_id > 0) { - Corpse* PlayerCorpse = database.SummonBurriedPlayerCorpse(char_id, zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); + Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); if(PlayerCorpse) { Result = true; } @@ -1767,7 +1767,7 @@ uint32 QuestManager::getplayerburriedcorpsecount(uint32 char_id) { uint32 Result = 0; if(char_id > 0) { - Result = database.GetPlayerBurriedCorpseCount(char_id); + Result = database.GetCharacterBuriedCorpseCount(char_id); } return Result; } @@ -1781,7 +1781,7 @@ bool QuestManager::buryplayercorpse(uint32 char_id) uint32 PlayerCorpse = database.GetFirstCorpseID(char_id); if(PlayerCorpse > 0) { - database.BuryPlayerCorpse(PlayerCorpse); + database.BuryCharacterCorpse(PlayerCorpse); Corpse* corpse = entity_list.GetCorpseByDBID(PlayerCorpse); if(corpse) { diff --git a/zone/spells.cpp b/zone/spells.cpp index 06c28adaa..69ded563c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3806,9 +3806,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,Rezzed(),rezzexp); + _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rezzexp); - if(Rezzed()){ + if(IsRezzed()){ if(Caster && Caster->IsClient()) Caster->Message(13,"This character has already been resurrected."); @@ -3838,7 +3838,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) rezz->unknown020 = 0x00000000; rezz->unknown088 = 0x00000000; // We send this to world, because it needs to go to the player who may not be in this zone. - worldserver.RezzPlayer(outapp, rezzexp, dbid, OP_RezzRequest); + worldserver.RezzPlayer(outapp, rezzexp, corpse_db_id, OP_RezzRequest); _pkt(SPELLS__REZ, outapp); safe_delete(outapp); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index eb717f89a..bae01e70f 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -704,7 +704,7 @@ void WorldServer::Process() { _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). - corpse->Rezzed(true); + corpse->IsRezzed(true); corpse->CompleteRezz(); } } @@ -1382,7 +1382,7 @@ void WorldServer::Process() { case ServerOP_SpawnPlayerCorpse: { SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer; - Corpse* NewCorpse = database.LoadPlayerCorpse(s->player_corpse_id); + Corpse* NewCorpse = database.LoadCharacterCorpse(s->player_corpse_id); if(NewCorpse) NewCorpse->Spawn(); else diff --git a/zone/zone.cpp b/zone/zone.cpp index 521684a0d..ecf10bcb5 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -917,7 +917,7 @@ bool Zone::Init(bool iStaticZone) { } LogFile->write(EQEMuLog::Status, "Loading player corpses..."); - if (!database.LoadPlayerCorpses(zoneid, instanceid)) { + if (!database.LoadCharacterCorpses(zoneid, instanceid)) { LogFile->write(EQEMuLog::Error, "Loading player corpses failed."); return false; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 3599a3ff0..671d109ec 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -7,6 +7,7 @@ #include "../common/rulesys.h" #include "../common/rdtsc.h" #include "zone.h" +#include "corpse.h" #include "client.h" #include "merc.h" #include "groups.h" @@ -3328,3 +3329,723 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::listlocked, + dbpc->exp, + dbpc->size, + dbpc->level, + dbpc->race, + dbpc->gender, + dbpc->class_, + dbpc->deity, + dbpc->texture, + dbpc->helmtexture, + dbpc->copper, + dbpc->silver, + dbpc->gold, + 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, + db_id + ); + auto results = QueryDatabase(query); + + query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u"); + results = QueryDatabase(query); + + /* Dump Items from Inventory */ + uint8 first_entry = 0; + for (unsigned int i = 0; i < dbpc->itemcount; i++) { + if (first_entry != 1){ + query = StringFormat("REPLACE INTO `character_corpse_items` \n" + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + db_id, + dbpc->items[i].equip_slot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug_1, + dbpc->items[i].aug_2, + dbpc->items[i].aug_3, + dbpc->items[i].aug_4, + dbpc->items[i].aug_5 + ); + first_entry = 1; + } + else{ + query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + db_id, + dbpc->items[i].equip_slot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug_1, + dbpc->items[i].aug_2, + dbpc->items[i].aug_3, + dbpc->items[i].aug_4, + dbpc->items[i].aug_5 + ); + } + } + results = QueryDatabase(query); + + return db_id; +} + +void ZoneDatabase::MarkCorpseAsRezzed(uint32 db_id) { + std::string query = StringFormat("UPDATE `character_corpses` SET `is_rezzed` = 1 WHERE `id` = %i", db_id); + auto results = QueryDatabase(query); +} + +uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading) { + /* Dump Basic Corpse Data */ + std::string query = StringFormat("INSERT INTO `character_corpses` SET \n" + "`charname` = '%s',\n" + "`zone_id` = %u,\n" + "`instance_id` = %u,\n" + "`charid` = %d,\n" + "`x` = %1.1f,\n" + "`y` = %1.1f,\n" + "`z` = %1.1f,\n" + "`heading` = %1.1f,\n" + "`time_of_death` = NOW(),\n" + "`is_buried` = 0," + "`is_locked` = %d,\n" + "`exp` = %u,\n" + "`size` = %f,\n" + "`level` = %u,\n" + "`race` = %u,\n" + "`gender` = %u,\n" + "`class` = %u,\n" + "`deity` = %u,\n" + "`texture` = %u,\n" + "`helm_texture` = %u,\n" + "`copper` = %u,\n" + "`silver` = %u,\n" + "`gold` = %u,\n" + "`platinum` = %u,\n" + "`hair_color` = %u,\n" + "`beard_color` = %u,\n" + "`eye_color_1` = %u,\n" + "`eye_color_2` = %u,\n" + "`hair_style` = %u,\n" + "`face` = %u,\n" + "`beard` = %u,\n" + "`drakkin_heritage` = %u,\n" + "`drakkin_tattoo` = %u,\n" + "`drakkin_details` = %u,\n" + "`wc_1` = %u,\n" + "`wc_2` = %u,\n" + "`wc_3` = %u,\n" + "`wc_4` = %u,\n" + "`wc_5` = %u,\n" + "`wc_6` = %u,\n" + "`wc_7` = %u,\n" + "`wc_8` = %u,\n" + "`wc_9` = %u \n", + EscapeString(charname).c_str(), + zoneid, + instanceid, + charid, + x, + y, + z, + heading, + dbpc->locked, + dbpc->exp, + dbpc->size, + dbpc->level, + dbpc->race, + dbpc->gender, + dbpc->class_, + dbpc->deity, + dbpc->texture, + dbpc->helmtexture, + dbpc->copper, + dbpc->silver, + dbpc->gold, + 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 + ); + auto results = QueryDatabase(query); + uint32 last_insert_id = results.LastInsertedID(); + + /* Dump Items from Inventory */ + uint8 first_entry = 0; + for (unsigned int i = 0; i < dbpc->itemcount; i++) { + if (first_entry != 1){ + query = StringFormat("REPLACE INTO `character_corpse_items` \n" + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + last_insert_id, + dbpc->items[i].equip_slot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug_1, + dbpc->items[i].aug_2, + dbpc->items[i].aug_3, + dbpc->items[i].aug_4, + dbpc->items[i].aug_5 + ); + first_entry = 1; + } + else{ + query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + last_insert_id, + dbpc->items[i].equip_slot, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug_1, + dbpc->items[i].aug_2, + dbpc->items[i].aug_3, + dbpc->items[i].aug_4, + dbpc->items[i].aug_5 + ); + } + } + auto sc_results = QueryDatabase(query); + return last_insert_id; +} + +uint32 ZoneDatabase::GetCharacterBuriedCorpseCount(uint32 char_id) { + std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1", char_id); + auto results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) { + return atoi(row[0]); + } + return 0; +} + +uint32 ZoneDatabase::GetCharacterCorpseCount(uint32 char_id) { + std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u'", char_id); + auto results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) { + return atoi(row[0]); + } + return 0; +} + +uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u'", char_id); + auto results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) { + for (int i = 0; i < corpse; i++) { + return atoi(row[0]); + } + } + return 0; +} + +uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) { + Corpse* tmp = LoadCharacterCorpse(corpse_id); + uint32 itemid = 0; + + if (tmp) { + itemid = tmp->GetWornItem(slotid); + tmp->DepopCorpse(); + } + return itemid; +} + +bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs){ + std::string query = StringFormat( + "SELECT \n" + "id, \n" + "charid, \n" + "charname, \n" + "zone_id, \n" + "instance_id, \n" + "x, \n" + "y, \n" + "z, \n" + "heading, \n" + "`data`, \n" + "time_of_death, \n" + "is_rezzed, \n" + "is_buried, \n" + "was_at_graveyard, \n" + "is_locked, \n" + "exp, \n" + "size, \n" + "`level`, \n" + "race, \n" + "gender, \n" + "class, \n" + "deity, \n" + "texture, \n" + "helm_texture, \n" + "copper, \n" + "silver, \n" + "gold, \n" + "platinum, \n" + "hair_color, \n" + "beard_color, \n" + "eye_color_1, \n" + "eye_color_2, \n" + "hair_style, \n" + "face, \n" + "beard, \n" + "drakkin_heritage,\n" + "drakkin_tattoo, \n" + "drakkin_details, \n" + "wc_1, \n" + "wc_2, \n" + "wc_3, \n" + "wc_4, \n" + "wc_5, \n" + "wc_6, \n" + "wc_7, \n" + "wc_8, \n" + "wc_9 \n" + "FROM \n" + "character_corpses\n" + "WHERE `id` = %u LIMIT 1\n", + corpse_id + ); + auto results = QueryDatabase(query); + uint16 i = 0; + for (auto row = results.begin(); row != results.end(); ++row) { + pcs->locked = atoi(row[i]); i++; // is_locked, + pcs->exp = atoi(row[i]); i++; // exp, + pcs->size = atoi(row[i]); i++; // size, + pcs->level = atoi(row[i]); i++; // `level`, + pcs->race = atoi(row[i]); i++; // race, + pcs->gender = atoi(row[i]); i++; // gender, + pcs->class_ = atoi(row[i]); i++; // class, + pcs->deity = atoi(row[i]); i++; // deity, + pcs->texture = atoi(row[i]); i++; // texture, + pcs->helmtexture = atoi(row[i]); i++; // helm_texture, + pcs->copper = atoi(row[i]); i++; // copper, + pcs->silver = atoi(row[i]); i++; // silver, + pcs->gold = atoi(row[i]); i++; // gold, + pcs->plat = atoi(row[i]); i++; // platinum, + pcs->haircolor = atoi(row[i]); i++; // hair_color, + pcs->beardcolor = atoi(row[i]); i++; // beard_color, + pcs->eyecolor1 = atoi(row[i]); i++; // eye_color_1, + pcs->eyecolor2 = atoi(row[i]); i++; // eye_color_2, + pcs->hairstyle = atoi(row[i]); i++; // hair_style, + pcs->face = atoi(row[i]); i++; // face, + pcs->beard = atoi(row[i]); i++; // beard, + pcs->drakkin_heritage = atoi(row[i]); i++; // drakkin_heritage, + pcs->drakkin_tattoo = atoi(row[i]); i++; // drakkin_tattoo, + pcs->drakkin_details = atoi(row[i]); i++; // drakkin_details, + pcs->item_tint[0].color = atoi(row[i]); i++; // wc_1, + pcs->item_tint[1].color = atoi(row[i]); i++; // wc_2, + pcs->item_tint[2].color = atoi(row[i]); i++; // wc_3, + pcs->item_tint[3].color = atoi(row[i]); i++; // wc_4, + pcs->item_tint[4].color = atoi(row[i]); i++; // wc_5, + pcs->item_tint[5].color = atoi(row[i]); i++; // wc_6, + pcs->item_tint[6].color = atoi(row[i]); i++; // wc_7, + pcs->item_tint[7].color = atoi(row[i]); i++; // wc_8, + pcs->item_tint[8].color = atoi(row[i]); i++; // wc_9 + } + query = StringFormat( + "SELECT \n" + "equip_slot, \n" + "item_id, \n" + "charges, \n" + "aug_1, \n" + "aug_2, \n" + "aug_3, \n" + "aug_4, \n" + "aug_5, \n" + "attuned \n" + "FROM \n" + "character_corpse_items \n" + "WHERE `corpse_id` = %u\n" + "ORDER BY `equip_slot`", + corpse_id + ); + results = QueryDatabase(query); + i = 0; + uint16 r = 0; + for (auto row = results.begin(); row != results.end(); ++row) { + pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot, + pcs->items[i].item_id = atoi(row[r]); r++; // item_id, + pcs->items[i].charges = atoi(row[r]); r++; // charges, + pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1, + pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2, + pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3, + pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4, + pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5, + r = 0; + i++; + } + pcs->itemcount = i; + return true; +} + +Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { + Corpse* NewCorpse = 0; + std::string query = StringFormat( + "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1", + char_id + ); + auto results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) { + PlayerCorpse_Struct pcs; + database.LoadCharacterCorpseData(atoi(row[0]), &pcs); + NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], &pcs, dest_x, dest_y, dest_z, dest_heading, row[2], atoi(row[3]) == 1, false); + if (NewCorpse) { + entity_list.AddCorpse(NewCorpse); + NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); + NewCorpse->Spawn(); + if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) + LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + } + } + + return NewCorpse; +} + +bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { + Corpse* NewCorpse = 0; + int CorpseCount = 0; + + std::string query = StringFormat( + "UPDATE character_corpses SET zone_id = %i, instance_id = %i, x = %f, y = %f, z = %f, heading = %f, is_buried = 0, was_at_graveyard = 0 WHERE charid = %i", + dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading, char_id + ); + auto results = QueryDatabase(query); + + query = StringFormat( + "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u'" + "ORDER BY time_of_death", + char_id + ); + results = QueryDatabase(query); + + for (auto row = results.begin(); row != results.end(); ++row) { + PlayerCorpse_Struct pcs; + database.LoadCharacterCorpseData(atoi(row[0]), &pcs); + NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), + char_id, + row[1], + &pcs, + dest_x, + dest_y, + dest_z, + dest_heading, + row[2], + atoi(row[3]) == 1, false); + if (NewCorpse) { + entity_list.AddCorpse(NewCorpse); + NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); + NewCorpse->Spawn(); + ++CorpseCount; + } + else{ + LogFile->write(EQEMuLog::Error, "Unable to construct a player corpse for character id %u.", char_id); + } + } + + return (CorpseCount > 0); +} + +bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint16 new_instance_id, float new_x, float new_y, float new_z, float new_heading) { + std::string query = StringFormat( + "UPDATE `character_corpses` SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, `x` = %f, `y` = %f, `z` = %f, `heading` = %f, `time_of_death` = Now(), `was_at_graveyard` = 0 WHERE `id` = %u", + new_zone_id, new_instance_id, new_x, new_y, new_z, new_heading, db_id + ); + auto results = QueryDatabase(query); + if (results.Success() && results.RowsAffected() != 0){ + return true; + } + return false; +} + +Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { + Corpse* NewCorpse = 0; + std::string query = StringFormat( + "SELECT `id`, `charid`, `charname`, `x`, `y`, `z`, `heading`, `time_of_death`, `is_rezzed`, `was_at_graveyard` FROM `character_corpses` WHERE `id` = '%u' LIMIT 1", + player_corpse_id + ); + auto results = QueryDatabase(query); + for (auto row = results.begin(); row != results.end(); ++row) { + PlayerCorpse_Struct pcs; + database.LoadCharacterCorpseData(atoi(row[0]), &pcs); + NewCorpse = Corpse::LoadFromDBData( + atoi(row[0]), // id uint32 in_dbid + atoi(row[1]), // charid uint32 in_charid + row[2], // charname char* in_charname + &pcs, // PlayerCorpse_Struct* pcs + atof(row[3]), // x float in_x + atof(row[4]), // y float in_y + atof(row[5]), // z float in_z + atof(row[6]), // heading float in_heading + row[7], // time_of_death char* time_of_death + atoi(row[8]) == 1, // is_rezzed bool rezzed + atoi(row[9]) // was_at_graveyard bool was_at_graveyard + ); + entity_list.AddCorpse(NewCorpse); + } + return NewCorpse; +} + +bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { + std::string query; + if (!RuleB(Zone, EnableShadowrest)) + query = StringFormat( "SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id); + else + query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, 0 as was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u' AND is_buried=0", zone_id, instance_id); + + auto results = QueryDatabase(query); + for (auto row = results.begin(); row != results.end(); ++row) { + PlayerCorpse_Struct pcs; + database.LoadCharacterCorpseData(atoi(row[0]), &pcs); + entity_list.AddCorpse( + Corpse::LoadFromDBData( + atoi(row[0]), // id uint32 in_dbid + atoi(row[1]), // charid uint32 in_charid + row[2], // charname char* in_charname + &pcs, // PlayerCorpse_tSruct* pcs + atof(row[3]), // x float in_x + atof(row[4]), // y float in_y + atof(row[5]), // z float in_z + atof(row[6]), // heading float in_heading + row[7], // time_of_death char* time_of_death + atoi(row[8]) == 1, // is_rezzed bool rezzed + atoi(row[9]) + ) + ); + } + + return true; +} + +uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 0 ORDER BY `time_of_death` LIMIT 1", char_id); + auto results = QueryDatabase(query); + for (auto row = results.begin(); row != results.end(); ++row) { + return atoi(row[0]); + } + return 0; +} + +bool ZoneDatabase::BuryCharacterCorpse(uint32 db_id) { + std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %d", db_id); + auto results = QueryDatabase(query); + if (results.Success() && results.RowsAffected() != 0){ + return true; + } + return false; +} + +bool ZoneDatabase::BuryAllCharacterCorpses(uint32 char_id) { + std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `charid` = %d", char_id); + auto results = QueryDatabase(query); + if (results.Success() && results.RowsAffected() != 0){ + return true; + } + return false; +} + +bool ZoneDatabase::DeleteCharacterCorpse(uint32 db_id) { + std::string query = StringFormat("DELETE FROM `character_corpses` WHERE `id` = %d", db_id); + auto results = QueryDatabase(query); + if (results.Success() && results.RowsAffected() != 0){ + return true; + } + return false; +} diff --git a/zone/zonedb.h b/zone/zonedb.h index db796e481..982d4e2c7 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -214,7 +214,7 @@ public: ZoneDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port); virtual ~ZoneDatabase(); - /* Objects and World Containers */ + /* Objects and World Containers */ void LoadWorldContainer(uint32 parentid, ItemInst* container); void SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container); void DeleteWorldContainer(uint32 parent_id,uint32 zone_id); @@ -223,23 +223,24 @@ public: void DeleteObject(uint32 id); Ground_Spawns* LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs); - /* Traders */ + /* Traders */ void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot); void UpdateTraderItemCharges(int char_id, uint32 ItemInstID, int32 charges); - void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice); - ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid); + void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice); void DeleteTraderItem(uint32 char_id); void DeleteTraderItem(uint32 char_id,uint16 slot_id); + + ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid); Trader_Struct* LoadTraderItem(uint32 char_id); TraderCharges_Struct* LoadTraderItemWithCharges(uint32 char_id); - /* Buyer/Barter */ + /* Buyer/Barter */ void AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, const char *ItemName, uint32 Quantity, uint32 Price); void RemoveBuyLine(uint32 CharID, uint32 BuySlot); void DeleteBuyLines(uint32 CharID); void UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity); - /* General Character Related Stuff */ + /* General Character Related Stuff */ bool SetServerFilters(char* name, ServerSideFilters_Struct *ssfs); uint32 GetServerFilters(char* name, ServerSideFilters_Struct *ssfs); @@ -249,7 +250,7 @@ public: void SavePetInfo(Client *c); void RemoveTempFactions(Client *c); - /* Character Data Loaders */ + /* Character Data Loaders */ bool LoadCharacterFactionValues(uint32 character_id, faction_map & val_list); bool LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_Struct* pp); @@ -265,14 +266,14 @@ public: bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp); bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp); - /* Character Data Saves */ + /* Character Data Saves */ bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home); bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp); bool SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp); bool SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level); bool SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); bool SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); - bool SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color); + bool SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color); bool SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value); bool SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value); bool SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id); @@ -281,120 +282,122 @@ public: bool SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon); bool SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp); - /* Character Data Deletes */ + /* Character Data Deletes */ bool DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); bool DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); - bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id); + bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id); bool DeleteCharacterBandolier(uint32 character_id, uint32 band_id); bool DeleteCharacterLeadershipAAs(uint32 character_id); bool DeleteCharacterAAs(uint32 character_id); bool DeleteCharacterDye(uint32 character_id); - /* Character Inventory */ + /* Character Inventory */ bool NoRentExpired(const char* name); - /* Corpses */ - bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); - uint32 CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading); - bool CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading); - uint32 UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed = false); - void MarkCorpseAsRezzed(uint32 dbid); - bool BuryPlayerCorpse(uint32 dbid); - bool BuryAllPlayerCorpses(uint32 charid); - bool DeletePlayerCorpse(uint32 dbid); - uint32 GetPlayerBurriedCorpseCount(uint32 char_id); - Corpse* SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); - bool SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); - bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); - Corpse* LoadPlayerCorpse(uint32 player_corpse_id); - bool UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); - bool LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID); - uint32 GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading); - uint32 NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); - uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); - bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); - uint32 GetFirstCorpseID(uint32 char_id); - uint32 GetPlayerCorpseCount(uint32 char_id); - uint32 GetPlayerCorpseID(uint32 char_id, uint8 corpse); - uint32 GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid); - uint32 GetPlayerCorpseTimeLeft(uint8 corpse, uint8 type); + /* Corpses */ + + bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs); + Corpse* LoadCharacterCorpse(uint32 player_corpse_id); + Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + void MarkCorpseAsRezzed(uint32 dbid); + bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); + bool BuryCharacterCorpse(uint32 dbid); + bool BuryAllCharacterCorpses(uint32 charid); + bool DeleteCharacterCorpse(uint32 dbid); + bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); + bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); + bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); + uint32 GetCharacterBuriedCorpseCount(uint32 char_id); + uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading); + uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); + uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); + uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading); + uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false); + uint32 GetFirstCorpseID(uint32 char_id); + uint32 GetCharacterCorpseCount(uint32 char_id); + uint32 GetCharacterCorpseID(uint32 char_id, uint8 corpse); + uint32 GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid); + uint32 GetPlayerCorpseTimeLeft(uint8 corpse, uint8 type); - /* Faction */ - bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0); - bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001 - bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001 - bool GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction = 0); // improve faction handling - bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001 - bool LoadFactionData(); + /* Faction */ + bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0); + bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001 + bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001 + bool GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction = 0); // improve faction handling + bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001 + bool LoadFactionData(); - /* AAs */ - bool LoadAAEffects(); - bool LoadAAEffects2(); - bool LoadSwarmSpells(); - SendAA_Struct* GetAASkillVars(uint32 skill_id); - uint8 GetTotalAALevels(uint32 skill_id); - uint32 GetSizeAA(); - uint32 CountAAs(); - void LoadAAs(SendAA_Struct **load); - uint32 CountAAEffects(); - void FillAAEffects(SendAA_Struct* aa_struct); + /* AAs */ + bool LoadAAEffects(); + bool LoadAAEffects2(); + bool LoadSwarmSpells(); + SendAA_Struct*GetAASkillVars(uint32 skill_id); + uint8 GetTotalAALevels(uint32 skill_id); + uint32 GetSizeAA(); + uint32 CountAAs(); + void LoadAAs(SendAA_Struct **load); + uint32 CountAAEffects(); + void FillAAEffects(SendAA_Struct* aa_struct); - /* Zone related */ - bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, uint8 &zone_type, int &ruleset, char **map_filename); - bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd); - bool LoadStaticZonePoints(LinkedList* zone_point_list,const char* zonename, uint32 version); - bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z); - uint8 GetUseCFGSafeCoords(); - int getZoneShutDownDelay(uint32 zoneID, uint32 version); + /* Zone related */ + bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, uint8 &zone_type, int &ruleset, char **map_filename); + bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd); + bool LoadStaticZonePoints(LinkedList* zone_point_list,const char* zonename, uint32 version); + bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z); + uint8 GetUseCFGSafeCoords(); + int getZoneShutDownDelay(uint32 zoneID, uint32 version); - /* Spawns and Spawn Points */ - bool LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list); - bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list); - bool PopulateZoneSpawnList(uint32 zoneid, LinkedList &spawn2_list, int16 version, uint32 repopdelay = 0); - Spawn2* LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2id, uint32 timeleft); - bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value); - void UpdateSpawn2Timeleft(uint32 id, uint16 instance_id,uint32 timeleft); - uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id); - void UpdateSpawn2Status(uint32 id, uint8 new_status); + /* Spawns and Spawn Points */ + bool LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list); + bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list); + bool PopulateZoneSpawnList(uint32 zoneid, LinkedList &spawn2_list, int16 version, uint32 repopdelay = 0); + Spawn2* LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2id, uint32 timeleft); + bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value); + void UpdateSpawn2Timeleft(uint32 id, uint16 instance_id,uint32 timeleft); + uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id); + void UpdateSpawn2Status(uint32 id, uint8 new_status); - /* Grids/Paths */ - uint32 GetFreeGrid(uint16 zoneid); - void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too,uint16 zoneid); - void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num,uint16 zoneid); -// uint32 AddWP(Client *c, uint32 sg2, uint16 grid_num, uint8 wp_num, float xpos, float ypos, float zpos, uint32 pause, float xpos1, float ypos1, float zpos1, int type1, int type2,uint16 zoneid); - void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading); - uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); - void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0,uint16 zoneid = 0); - void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script=0,uint16 zoneid =0); - uint8 GetGridType(uint32 grid,uint32 zoneid); - uint8 GetGridType2(uint32 grid, uint16 zoneid); - bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); - void AssignGrid(Client *client, float x, float y, uint32 id); - int GetHighestGrid(uint32 zoneid); - int GetHighestWaypoint(uint32 zoneid, uint32 gridid); + /* Grids/Paths */ + uint32 GetFreeGrid(uint16 zoneid); + void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too, uint16 zoneid); + void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid); + void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading); + uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); + void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0); + void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0); + uint8 GetGridType(uint32 grid, uint32 zoneid); + uint8 GetGridType2(uint32 grid, uint16 zoneid); + bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); + void AssignGrid(Client *client, float x, float y, uint32 id); + int GetHighestGrid(uint32 zoneid); + int GetHighestWaypoint(uint32 zoneid, uint32 gridid); - /* NPCs */ - const NPCType* GetNPCType(uint32 id); - uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete - uint32 CreateNewNPCCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 extra); - uint32 AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime); - uint32 DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *client, NPC* spawn); - uint32 DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32 zone_version, Client *client, NPC* spawn); - uint32 AddSpawnFromSpawnGroup(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID); - uint32 AddNPCTypes(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID); - uint32 UpdateNPCTypeAppearance(Client *client, NPC* spawn); - bool SetSpecialAttkFlag(uint8 id, const char* flag); - bool GetPetEntry(const char *pet_type, PetRecord *into); - bool GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into); - bool GetBasePetItems(int32 equipmentset, uint32 *items); - void AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat); - void AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* itemlist, uint8 droplimit, uint8 mindrop); - uint32 GetMaxNPCSpellsID(); - uint32 GetMaxNPCSpellsEffectsID(); - DBnpcspells_Struct* GetNPCSpells(uint32 iDBSpellsID); - DBnpcspellseffects_Struct* GetNPCSpellsEffects(uint32 iDBSpellsEffectsID); + /* NPCs */ + + uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete + uint32 CreateNewNPCCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 extra); + uint32 AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime); + uint32 DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *client, NPC* spawn); + uint32 DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32 zone_version, Client *client, NPC* spawn); + uint32 AddSpawnFromSpawnGroup(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID); + uint32 AddNPCTypes(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID); + uint32 UpdateNPCTypeAppearance(Client *client, NPC* spawn); + bool SetSpecialAttkFlag(uint8 id, const char* flag); + bool GetPetEntry(const char *pet_type, PetRecord *into); + bool GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into); + bool GetBasePetItems(int32 equipmentset, uint32 *items); + void AddLootTableToNPC(NPC* npc, uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat); + void AddLootDropToNPC(NPC* npc, uint32 lootdrop_id, ItemList* itemlist, uint8 droplimit, uint8 mindrop); + uint32 GetMaxNPCSpellsID(); + uint32 GetMaxNPCSpellsEffectsID(); - /* Mercs */ + DBnpcspells_Struct* GetNPCSpells(uint32 iDBSpellsID); + DBnpcspellseffects_Struct* GetNPCSpellsEffects(uint32 iDBSpellsEffectsID); + const NPCType* GetNPCType(uint32 id); + + /* Mercs */ const NPCType* GetMercType(uint32 id, uint16 raceid, uint32 clientlevel); void LoadMercEquipment(Merc *merc); void SaveMercBuffs(Merc *merc); @@ -403,10 +406,8 @@ public: bool LoadCurrentMerc(Client *c); bool SaveMerc(Merc *merc); bool DeleteMerc(uint32 merc_id); - //void LoadMercTypesForMercMerchant(NPC *merchant); - //void LoadMercsForMercMerchant(NPC *merchant); - /* Petitions */ + /* Petitions */ void UpdateBug(BugStruct* bug); void UpdateBug(PetitionBug_Struct* bug); void DeletePetitionFromDB(Petition* wpet); @@ -414,23 +415,23 @@ public: void InsertPetitionToDB(Petition* wpet); void RefreshPetitionsFromDB(); - /* Merchants */ + /* Merchants */ void SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint32 charges); void DeleteMerchantTemp(uint32 npcid, uint32 slot); - /* Tradeskills */ + /* Tradeskills */ bool GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); bool GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec); uint32 GetZoneForage(uint32 ZoneID, uint8 skill); /* for foraging */ uint32 GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance); void UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madecount); - bool EnableRecipe(uint32 recipe_id); - bool DisableRecipe(uint32 recipe_id); + bool EnableRecipe(uint32 recipe_id); + bool DisableRecipe(uint32 recipe_id); - /* Tribute */ + /* Tribute */ bool LoadTributes(); - /* Doors */ + /* Doors */ bool DoorIsOpen(uint8 door_id,const char* zone_name); void SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name); bool LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version); @@ -441,34 +442,34 @@ public: int32 GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version); int32 GetDoorsCountPlusOne(const char *zone_name, int16 version); int32 GetDoorsDBCountPlusOne(const char *zone_name, int16 version); - void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize); + void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize); - /* Blocked Spells */ + /* Blocked Spells */ int32 GetBlockedSpellsCount(uint32 zoneid); bool LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid); - /* Traps */ + /* Traps */ bool LoadTraps(const char* zonename, int16 version); char* GetTrapMessage(uint32 trap_id); - /* Time */ + /* Time */ uint32 GetZoneTZ(uint32 zoneid, uint32 version); bool SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz); - /* Group */ + /* Group */ void RefreshGroupFromDB(Client *c); uint8 GroupCount(uint32 groupid); - /* Raid */ + /* Raid */ uint8 RaidGroupCount(uint32 raidid, uint32 groupid); - /* Instancing */ + /* Instancing */ void ListAllInstances(Client* c, uint32 charid); - /* QGlobals */ + /* QGlobals */ void QGlobalPurge(); - /* Alternate Currency */ + /* Alternate Currency */ void LoadAltCurrencyValues(uint32 char_id, std::map ¤cy); void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value); diff --git a/zone/zonedump.h b/zone/zonedump.h index fc9b7b152..b2ae96319 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -35,11 +35,9 @@ spawn2 mediumblob, npcs mediumblob, npc_loot mediumblob, gmspawntype mediumblob, struct NPCType { char name[64]; - char lastname[70]; - + char lastname[70]; int32 cur_hp; - int32 max_hp; - + int32 max_hp; float size; float runspeed; uint8 gender; @@ -91,7 +89,7 @@ struct NPCType uint32 min_dmg; uint32 max_dmg; int16 attack_count; - char special_abilities[512]; + char special_abilities[512]; uint16 d_meele_texture1; uint16 d_meele_texture2; char ammo_idfile[30]; @@ -130,38 +128,28 @@ struct NPCType uint8 probability; }; -/* -Below are the blob structures for saving player corpses to the database --Quagmire - -create table player_corpses (id int(11) unsigned not null auto_increment primary key, charid int(11) unsigned not null, -charname varchar(30) not null, zonename varchar(16)not null, x float not null, y float not null, z float not null, -heading float not null, data blob not null, time timestamp(14), index zonename (zonename)); -*/ - -namespace player_lootitem -{ +namespace player_lootitem { struct ServerLootItem_Struct { - uint32 item_id; - int16 equipSlot; - uint8 charges; - uint16 lootslot; - uint32 aug1; - uint32 aug2; - uint32 aug3; - uint32 aug4; - uint32 aug5; + uint32 item_id; + int16 equip_slot; + uint8 charges; + uint16 lootslot; + uint32 aug_1; + uint32 aug_2; + uint32 aug_3; + uint32 aug_4; + uint32 aug_5; }; } -struct DBPlayerCorpse_Struct { +struct PlayerCorpse_Struct { uint32 crc; bool locked; uint32 itemcount; uint32 exp; float size; uint8 level; - uint8 race; + uint32 race; uint8 gender; uint8 class_; uint8 deity; @@ -185,37 +173,6 @@ struct DBPlayerCorpse_Struct { player_lootitem::ServerLootItem_Struct items[0]; }; -namespace classic_db -{ - struct DBPlayerCorpse_Struct { - uint32 crc; - bool locked; - uint32 itemcount; - uint32 exp; - float size; - uint8 level; - uint8 race; - uint8 gender; - uint8 class_; - uint8 deity; - uint8 texture; - uint8 helmtexture; - uint32 copper; - uint32 silver; - uint32 gold; - uint32 plat; - Color_Struct item_tint[9]; - uint8 haircolor; - uint8 beardcolor; - uint8 eyecolor1; - uint8 eyecolor2; - uint8 hairstyle; - uint8 face; - uint8 beard; - player_lootitem::ServerLootItem_Struct items[0]; - }; -} - struct Door { uint32 db_id; uint8 door_id; @@ -228,7 +185,7 @@ struct Door { int incline; uint8 opentype; uint32 guild_id; - uint16 lockpick; + uint16 lock_pick; uint32 keyitem; uint8 nokeyring; uint8 trigger_door; From d1b0564698700d232f0339289cd2114a1713a6f9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 22 Nov 2014 18:43:23 -0600 Subject: [PATCH 0303/1883] Changing corpse loading structure --- zone/corpse.cpp | 58 +++++++++++++++++++++++++++++++++++-------------- zone/corpse.h | 5 +++-- zone/zonedb.cpp | 47 +++++++++++++++++++-------------------- 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 886d32aac..c969ed03c 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,36 +63,62 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, PlayerCorpse_Struct* pcs, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard) { +Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard) { + PlayerCorpse_Struct pcs; + database.LoadCharacterCorpseData(in_dbid, &pcs); + /* Load Items */ ItemList itemlist; ServerLootItem_Struct* tmp = 0; - for (unsigned int i = 0; i < pcs->itemcount; i++) { + for (unsigned int i = 0; i < pcs.itemcount; i++) { tmp = new ServerLootItem_Struct; - memcpy(tmp, &pcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); + memcpy(tmp, &pcs.items[i], sizeof(player_lootitem::ServerLootItem_Struct)); tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); itemlist.push_back(tmp); } /* Create Corpse Entity */ - Corpse* pc = new Corpse(in_dbid, in_charid, in_charname, &itemlist, pcs->copper, pcs->silver, pcs->gold, pcs->plat, in_x, in_y, in_z, in_heading, pcs->size, pcs->gender, pcs->race, pcs->class_, pcs->deity, pcs->level, pcs->texture, pcs->helmtexture, pcs->exp, was_at_graveyard); - if (pcs->locked) + Corpse* pc = new Corpse( + in_dbid, + in_charid, + in_charname, + &itemlist, + pcs.copper, + pcs.silver, + pcs.gold, + pcs.plat, + in_x, + in_y, + in_z, + in_heading, + pcs.size, + pcs.gender, + pcs.race, + pcs.class_, + pcs.deity, + pcs.level, + pcs.texture, + pcs.helmtexture, + pcs.exp, + was_at_graveyard + ); + if (pcs.locked) pc->Lock(); /* Load Item Tints */ - memcpy(pc->item_tint, pcs->item_tint, sizeof(pc->item_tint)); + memcpy(pc->item_tint, pcs.item_tint, sizeof(pc->item_tint)); /* Load Physical Appearance */ - pc->haircolor = pcs->haircolor; - pc->beardcolor = pcs->beardcolor; - pc->eyecolor1 = pcs->eyecolor1; - pc->eyecolor2 = pcs->eyecolor2; - pc->hairstyle = pcs->hairstyle; - pc->luclinface = pcs->face; - pc->beard = pcs->beard; - pc->drakkin_heritage = pcs->drakkin_heritage; - pc->drakkin_tattoo = pcs->drakkin_tattoo; - pc->drakkin_details = pcs->drakkin_details; + pc->haircolor = pcs.haircolor; + pc->beardcolor = pcs.beardcolor; + pc->eyecolor1 = pcs.eyecolor1; + pc->eyecolor2 = pcs.eyecolor2; + pc->hairstyle = pcs.hairstyle; + pc->luclinface = pcs.face; + pc->beard = pcs.beard; + pc->drakkin_heritage = pcs.drakkin_heritage; + pc->drakkin_tattoo = pcs.drakkin_tattoo; + pc->drakkin_details = pcs.drakkin_details; pc->IsRezzed(rezzed); pc->become_npc = false; diff --git a/zone/corpse.h b/zone/corpse.h index 8b1269c1b..a3544834f 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -30,13 +30,14 @@ class Corpse : public Mob { public: static void SendEndLootErrorPacket(Client* client); - static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - static Corpse* LoadFromDBData(uint32 in_corpseid, uint32 in_charid, char* in_charname, PlayerCorpse_Struct* pcs, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed = false, bool wasAtGraveyard = false); + static void SendLootReqErrorPacket(Client* client, uint8 response = 2); + Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); + static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard); //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 671d109ec..f42e0ab78 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3884,9 +3884,18 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - PlayerCorpse_Struct pcs; - database.LoadCharacterCorpseData(atoi(row[0]), &pcs); - NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), char_id, row[1], &pcs, dest_x, dest_y, dest_z, dest_heading, row[2], atoi(row[3]) == 1, false); + NewCorpse = Corpse::LoadFromDBData( + atoi(row[0]), // uint32 in_dbid + char_id, // uint32 in_charid + row[1], // char* in_charname + dest_x, // float in_x + dest_y, // float in_y + dest_z, // float in_z + dest_heading, // float in_heading + row[2], // char* time_of_death + atoi(row[3]) == 1, // bool rezzed + false // bool was_at_graveyard + ); if (NewCorpse) { entity_list.AddCorpse(NewCorpse); NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); @@ -3917,18 +3926,17 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - PlayerCorpse_Struct pcs; - database.LoadCharacterCorpseData(atoi(row[0]), &pcs); - NewCorpse = Corpse::LoadFromDBData(atoi(row[0]), + NewCorpse = Corpse::LoadFromDBData( + atoi(row[0]), char_id, row[1], - &pcs, dest_x, dest_y, dest_z, dest_heading, row[2], - atoi(row[3]) == 1, false); + atoi(row[3]) == 1, + false); if (NewCorpse) { entity_list.AddCorpse(NewCorpse); NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); @@ -3963,18 +3971,15 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { ); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - PlayerCorpse_Struct pcs; - database.LoadCharacterCorpseData(atoi(row[0]), &pcs); NewCorpse = Corpse::LoadFromDBData( atoi(row[0]), // id uint32 in_dbid atoi(row[1]), // charid uint32 in_charid - row[2], // charname char* in_charname - &pcs, // PlayerCorpse_Struct* pcs + row[2], // char_name atof(row[3]), // x float in_x - atof(row[4]), // y float in_y + atof(row[4]), // y float in_y atof(row[5]), // z float in_z - atof(row[6]), // heading float in_heading - row[7], // time_of_death char* time_of_death + atof(row[6]), // heading float in_heading + row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed atoi(row[9]) // was_at_graveyard bool was_at_graveyard ); @@ -3992,22 +3997,18 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - PlayerCorpse_Struct pcs; - database.LoadCharacterCorpseData(atoi(row[0]), &pcs); - entity_list.AddCorpse( + entity_list.AddCorpse( Corpse::LoadFromDBData( atoi(row[0]), // id uint32 in_dbid atoi(row[1]), // charid uint32 in_charid - row[2], // charname char* in_charname - &pcs, // PlayerCorpse_tSruct* pcs - atof(row[3]), // x float in_x + row[2], // PlayerCorpse_tSruct* pcs + atof(row[3]), // x float in_x atof(row[4]), // y float in_y atof(row[5]), // z float in_z atof(row[6]), // heading float in_heading row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed - atoi(row[9]) - ) + atoi(row[9])) ); } From f3288532513e370d33eafb2d0f2588fd2383ab99 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 22 Nov 2014 23:28:20 -0600 Subject: [PATCH 0304/1883] More restructures, non-working state --- common/eq_packet_structs.h | 22 ++-- zone/corpse.cpp | 226 +++++++++++++++++++------------------ zone/inventory.cpp | 2 +- zone/loottables.cpp | 16 +-- zone/npc.cpp | 14 +-- zone/zonedb.cpp | 22 ++-- zone/zonedump.h | 5 +- 7 files changed, 160 insertions(+), 147 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 368cdf931..f62517f46 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -5209,17 +5209,17 @@ struct MercenaryMerchantResponse_Struct { }; struct ServerLootItem_Struct { - uint32 item_id; - int16 equipSlot; - uint8 charges; - uint16 lootslot; - uint32 aug1; - uint32 aug2; - uint32 aug3; - uint32 aug4; - uint32 aug5; - uint8 minlevel; - uint8 maxlevel; + uint32 item_id; // uint32 item_id; + int16 equip_slot; // int16 equip_slot; + uint8 charges; // uint8 charges; + uint16 lootslot; // uint16 lootslot; + uint32 aug_1; // uint32 aug_1; + uint32 aug_2; // uint32 aug_2; + uint32 aug_3; // uint32 aug_3; + uint32 aug_4; // uint32 aug_4; + uint32 aug_5; // uint32 aug_5; + uint8 min_level; // + uint8 max_level; // }; //Found in client near a ref to the string: diff --git a/zone/corpse.cpp b/zone/corpse.cpp index c969ed03c..71e8faf5a 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -73,35 +73,35 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna for (unsigned int i = 0; i < pcs.itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &pcs.items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); + tmp->equip_slot = CorpseToServerSlot(tmp->equip_slot); itemlist.push_back(tmp); } /* Create Corpse Entity */ Corpse* pc = new Corpse( - in_dbid, - in_charid, - in_charname, - &itemlist, - pcs.copper, - pcs.silver, - pcs.gold, - pcs.plat, - in_x, - in_y, - in_z, - in_heading, - pcs.size, - pcs.gender, - pcs.race, - pcs.class_, - pcs.deity, - pcs.level, - pcs.texture, - pcs.helmtexture, - pcs.exp, - was_at_graveyard - ); + in_dbid, // uint32 in_dbid + in_charid, // uint32 in_charid + in_charname, // char* in_charname + &itemlist, // ItemList* in_itemlist + pcs.copper, // uint32 in_copper + pcs.silver, // uint32 in_silver + pcs.gold, // uint32 in_gold + pcs.plat, // uint32 in_plat + in_x, // float in_x + in_y, // float in_y + in_z, // float in_z + in_heading, // float in_heading + pcs.size, // float in_size + pcs.gender, // uint8 in_gender + pcs.race, // uint16 in_race + pcs.class_, // uint8 in_class + pcs.deity, // uint8 in_deity + pcs.level, // uint8 in_level + pcs.texture, // uint8 in_texture + pcs.helmtexture, // uint8 in_helmtexture + pcs.exp, // uint32 in_rezexp + was_at_graveyard // bool wasAtGraveyard + ); if (pcs.locked) pc->Lock(); @@ -184,70 +184,66 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP this->rezzexp = 0; } -// To be used on PC death -// Mongrel: added see_invis and see_invis_undead -Corpse::Corpse(Client* client, int32 in_rezexp) -// vesuvias - appearence fix -: Mob -( - "Unnamed_Corpse", - "", - 0, - 0, - client->GetGender(), - client->GetRace(), - client->GetClass(), - BT_Humanoid, // bodytype added - client->GetDeity(), - client->GetLevel(), - 0, - client->GetSize(), - 0, - client->GetHeading(), // heading - client->GetX(), - client->GetY(), - client->GetZ(), - 0, - client->GetTexture(), - client->GetHelmTexture(), - 0, // AC - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, // CHA - client->GetPP().haircolor, - client->GetPP().beardcolor, - client->GetPP().eyecolor1, - client->GetPP().eyecolor2, - client->GetPP().hairstyle, - client->GetPP().face, - client->GetPP().beard, - client->GetPP().drakkin_heritage, - client->GetPP().drakkin_tattoo, - client->GetPP().drakkin_details, - 0, - 0xff, // aa title - 0, - 0, - 0, - 0, - 0, - 0, - 0, // qglobal - 0, // maxlevel - 0 // scalerate -), +Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( + "Unnamed_Corpse", // const char* in_name, + "", // const char* in_lastname, + 0, // int32 in_cur_hp, + 0, // int32 in_max_hp, + client->GetGender(), // uint8 in_gender, + client->GetRace(), // uint16 in_race, + client->GetClass(), // uint8 in_class, + BT_Humanoid, // bodyType in_bodytype, + client->GetDeity(), // uint8 in_deity, + client->GetLevel(), // uint8 in_level, + 0, // uint32 in_npctype_id, + client->GetSize(), // float in_size, + 0, // float in_runspeed, + client->GetHeading(), // float in_heading, + client->GetX(), // float in_x_pos, + client->GetY(), // float in_y_pos, + client->GetZ(), // float in_z_pos, + 0, // uint8 in_light, + client->GetTexture(), // uint8 in_texture, + client->GetHelmTexture(), // uint8 in_helmtexture, + 0, // uint16 in_ac, + 0, // uint16 in_atk, + 0, // uint16 in_str, + 0, // uint16 in_sta, + 0, // uint16 in_dex, + 0, // uint16 in_agi, + 0, // uint16 in_int, + 0, // uint16 in_wis, + 0, // uint16 in_cha, + client->GetPP().haircolor, // uint8 in_haircolor, + client->GetPP().beardcolor, // uint8 in_beardcolor, + client->GetPP().eyecolor1, // uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? + client->GetPP().eyecolor2, // uint8 in_eyecolor2, + client->GetPP().hairstyle, // uint8 in_hairstyle, + client->GetPP().face, // uint8 in_luclinface, + client->GetPP().beard, // uint8 in_beard, + client->GetPP().drakkin_heritage, // uint32 in_drakkin_heritage, + client->GetPP().drakkin_tattoo, // uint32 in_drakkin_tattoo, + client->GetPP().drakkin_details, // uint32 in_drakkin_details, + 0, // uint32 in_armor_tint[_MaterialCount], + 0xff, // uint8 in_aa_title, + 0, // uint8 in_see_invis, // see through invis + 0, // uint8 in_see_invis_undead, // see through invis vs. undead + 0, // uint8 in_see_hide, + 0, // uint8 in_see_improved_hide, + 0, // int32 in_hp_regen, + 0, // int32 in_mana_regen, + 0, // uint8 in_qglobal, + 0, // uint8 in_maxlevel, + 0 // uint32 in_scalerate + ), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), - loot_cooldown_timer(10) + loot_cooldown_timer(10) { int i; + PlayerProfile_Struct *pp = &client->GetPP(); ItemInst *item; @@ -256,7 +252,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) } memset(item_tint, 0, sizeof(item_tint)); - for (i=0; iCharacterID(); - corpse_db_id = 0; + corpse_db_id = 0; p_depop = false; copper = 0; silver = 0; gold = 0; platinum = 0; strcpy(orgname, pp->name); - strcpy(name, pp->name); + strcpy(name, pp->name); //become_npc was not being initialized which led to some pretty funky things with newly created corpses become_npc = false; SetPKItem(0); - if(!RuleB(Character, LeaveNakedCorpses) || RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { + if(!RuleB(Character, LeaveNakedCorpses) || + RuleB(Character, LeaveCorpses) && + GetLevel() >= RuleI(Character, DeathItemLossLevel)) { // cash // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. // (change to first client that supports 'death hover' mode, if not SoF.) @@ -301,8 +299,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) // worn + inventory + cursor std::list removed_list; bool cursor = false; - for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) - { + for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) { if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) { item = client->GetInv().GetItem(MainPowerSource); if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { @@ -492,7 +489,11 @@ bool Corpse::Save() { return true; uint32 tmp = this->CountItems(); - uint32 tmpsize = sizeof(PlayerCorpse_Struct)+(tmp * sizeof(player_lootitem::ServerLootItem_Struct)); + uint32 tmpsize = sizeof(PlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct)); + + std::cout << "tmp: " << tmp << std::endl; + std::cout << "tmpsize: " << tmpsize << std::endl; + PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize]; memset(dbpc, 0, tmpsize); dbpc->itemcount = tmp; @@ -522,14 +523,17 @@ bool Corpse::Save() { dbpc->drakkin_tattoo = drakkin_tattoo; dbpc->drakkin_details = drakkin_details; + std::cout << "SLI1: " << sizeof(player_lootitem::ServerLootItem_Struct) << std::endl; + std::cout << "SLI2: " << sizeof(ServerLootItem_Struct) << std::endl; + uint32 x = 0; ItemList::iterator cur, end; cur = itemlist.begin(); end = itemlist.end(); - for (; cur != end; ++cur) { + for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - item->equipSlot = ServerToCorpseSlot(item->equipSlot); // temp hack until corpse blobs are removed - memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(player_lootitem::ServerLootItem_Struct)); + item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed + memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); } if (corpse_db_id == 0) { @@ -539,6 +543,8 @@ bool Corpse::Save() { corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); } + safe_delete_array(dbpc); + return true; } @@ -579,12 +585,12 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui memset(item, 0, sizeof(ServerLootItem_Struct)); item->item_id = itemnum; item->charges = charges; - item->equipSlot = slot; - item->aug1=aug1; - item->aug2=aug2; - item->aug3=aug3; - item->aug4=aug4; - item->aug5=aug5; + item->equip_slot = slot; + item->aug_1=aug1; + item->aug_2=aug2; + item->aug_3=aug3; + item->aug_4=aug4; + item->aug_5=aug5; itemlist.push_back(item); } @@ -603,17 +609,17 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } } - if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equipSlot)) + if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) { - int16 bagstart = Inventory::CalcSlotId(sitem->equipSlot, SUB_BEGIN); + int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, SUB_BEGIN); cur = itemlist.begin(); end = itemlist.end(); for(; cur != end; ++cur) { sitem2 = *cur; - if(sitem2->equipSlot >= bagstart && sitem2->equipSlot < bagstart + 10) + if(sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10) { - bag_item_data[sitem2->equipSlot - bagstart] = sitem2; + bag_item_data[sitem2->equip_slot - bagstart] = sitem2; } } } @@ -627,7 +633,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - if (item->equipSlot == equipSlot) + if (item->equip_slot == equipSlot) { return item->item_id; } @@ -665,7 +671,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ pIsChanged = true; itemlist.erase(cur); - material = Inventory::CalcMaterialFromSlot(sitem->equipSlot); + material = Inventory::CalcMaterialFromSlot(sitem->equip_slot); if(material != _MaterialInvalid) SendWearChange(material); @@ -924,12 +930,12 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // Dont display the item if it's in a bag // Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse. - if(!IsPlayerCorpse() || item_data->equipSlot <= MainCursor || item_data->equipSlot == MainPowerSource || tCanLoot>=3 || - (item_data->equipSlot >= 8000 && item_data->equipSlot <= 8999)) { + if(!IsPlayerCorpse() || item_data->equip_slot <= MainCursor || item_data->equip_slot == MainPowerSource || tCanLoot>=3 || + (item_data->equip_slot >= 8000 && item_data->equip_slot <= 8999)) { if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); if(client && item) { - ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5); + ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); if(inst) { // MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot); @@ -1046,7 +1052,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) if (item != 0) { if(item_data) - inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5); + inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); else inst = database.CreateItem(item); } @@ -1257,7 +1263,7 @@ void Corpse::QueryLoot(Client* to) { ServerLootItem_Struct* sitem = *cur; if (IsPlayerCorpse()) { - if (sitem->equipSlot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equipSlot <= EmuConstants::CURSOR_BAG_END) + if (sitem->equip_slot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equip_slot <= EmuConstants::CURSOR_BAG_END) sitem->lootslot = 0xFFFF; else x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; @@ -1265,7 +1271,7 @@ void Corpse::QueryLoot(Client* to) { const Item_Struct* item = database.GetItem(sitem->item_id); if (item) - to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges); + to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast(sitem->lootslot), sitem->equip_slot, item->Name, item->ID, sitem->charges); else to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 8cc9e4cff..76b077e2d 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -858,7 +858,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI { if(bag_item_data[i] == nullptr) continue; - const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug1, bag_item_data[i]->aug2, bag_item_data[i]->aug3, bag_item_data[i]->aug4, bag_item_data[i]->aug5); + const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5); interior_slot = Inventory::CalcSlotId(slot_id, i); mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); diff --git a/zone/loottables.cpp b/zone/loottables.cpp index b2ebec5ff..0c66778bd 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -195,13 +195,13 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge item->item_id = item2->ID; item->charges = charges; - item->aug1 = 0; - item->aug2 = 0; - item->aug3 = 0; - item->aug4 = 0; - item->aug5 = 0; - item->minlevel = minlevel; - item->maxlevel = maxlevel; + item->aug_1 = 0; + item->aug_2 = 0; + item->aug_3 = 0; + item->aug_4 = 0; + item->aug_5 = 0; + item->min_level = minlevel; + item->max_level = maxlevel; if (equipit) { uint8 eslot = 0xFF; char newid[20]; @@ -339,7 +339,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge if (found) { CalcBonuses(); // This is less than ideal for bulk adding of items } - item->equipSlot = item2->Slots; + item->equip_slot = item2->Slots; } if(itemlist != nullptr) diff --git a/zone/npc.cpp b/zone/npc.cpp index eca0f194f..84a06c39c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -429,7 +429,7 @@ ServerLootItem_Struct* NPC::GetItem(int slot_id) { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - if (item->equipSlot == slot_id) { + if (item->equip_slot == slot_id) { return item; } } @@ -446,7 +446,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) { itemlist.erase(cur); return; } - else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) { + else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) { //std::cout<<"NPC::RemoveItem"<<" equipSlot:"<equipSlot<<" quantity:"<< quantity<charges <= quantity) itemlist.erase(cur); @@ -471,9 +471,9 @@ void NPC::CheckMinMaxLevel(Mob *them) if(!(*cur)) return; - if(themlevel < (*cur)->minlevel || themlevel > (*cur)->maxlevel) + if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level) { - material = Inventory::CalcMaterialFromSlot((*cur)->equipSlot); + material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot); if(material != 0xFF) SendWearChange(material); @@ -508,15 +508,15 @@ void NPC::QueryLoot(Client* to) { if (item) if (to->GetClientVersion() >= EQClientRoF) { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); + to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); } else if (to->GetClientVersion() >= EQClientSoF) { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); + to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); } else { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); + to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); } else LogFile->write(EQEMuLog::Error, "Database error, invalid item"); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index f42e0ab78..3e5b15cc7 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3858,20 +3858,24 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct ); results = QueryDatabase(query); i = 0; + + pcs->itemcount = results.RowCount(); uint16 r = 0; + // Allocate memory for items. + pcs->items = reinterpret_cast(new char[pcs->itemcount * sizeof(player_lootitem::ServerLootItem_Struct)]); + for (auto row = results.begin(); row != results.end(); ++row) { pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot, - pcs->items[i].item_id = atoi(row[r]); r++; // item_id, - pcs->items[i].charges = atoi(row[r]); r++; // charges, - pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1, - pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2, - pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3, - pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4, - pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5, - r = 0; + pcs->items[i].item_id = atoi(row[r]); r++; // item_id, + pcs->items[i].charges = atoi(row[r]); r++; // charges, + pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1, + pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2, + pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3, + pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4, + pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5, + r = 0; i++; } - pcs->itemcount = i; return true; } diff --git a/zone/zonedump.h b/zone/zonedump.h index b2ae96319..52626aca1 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -139,6 +139,8 @@ namespace player_lootitem { uint32 aug_3; uint32 aug_4; uint32 aug_5; + uint8 min_level; // + uint8 max_level; // }; } @@ -170,7 +172,8 @@ struct PlayerCorpse_Struct { uint32 drakkin_heritage; uint32 drakkin_tattoo; uint32 drakkin_details; - player_lootitem::ServerLootItem_Struct items[0]; + player_lootitem::ServerLootItem_Struct* items[0]; + //std::list items; }; struct Door { From 7fa1256c5d809126ea764432e77e387a68cf7560 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 01:04:50 -0600 Subject: [PATCH 0305/1883] ... --- zone/corpse.cpp | 17 +++++++++++++---- zone/corpse.h | 6 +++--- zone/zonedb.cpp | 34 ++++++++++++++++------------------ zone/zonedump.h | 2 +- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 71e8faf5a..9b41d4b41 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,10 +63,19 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard) { +Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard) +{ + + std::cout << "LoadFromDBData: 0 " << in_dbid << std::endl; + std::cout << "LoadFromDBData: 1 " << in_charid << std::endl; + std::cout << "LoadFromDBData: 2 " << in_charname << std::endl; + std::cout << "LoadFromDBData: 3 " << in_x << std::endl; + std::cout << "LoadFromDBData: 4 " << in_y << std::endl; + std::cout << "LoadFromDBData: 5 " << in_z << std::endl; + PlayerCorpse_Struct pcs; database.LoadCharacterCorpseData(in_dbid, &pcs); - + /* Load Items */ ItemList itemlist; ServerLootItem_Struct* tmp = 0; @@ -81,7 +90,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna Corpse* pc = new Corpse( in_dbid, // uint32 in_dbid in_charid, // uint32 in_charid - in_charname, // char* in_charname + in_charname.c_str(), // char* in_charname &itemlist, // ItemList* in_itemlist pcs.copper, // uint32 in_copper pcs.silver, // uint32 in_silver @@ -412,7 +421,7 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 // To be called from LoadFromDBData // Mongrel: added see_invis and see_invis_undead -Corpse::Corpse(uint32 in_dbid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) +Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture, 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xff, diff --git a/zone/corpse.h b/zone/corpse.h index a3544834f..8b10ed787 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -32,12 +32,12 @@ public: static void SendEndLootErrorPacket(Client* client); static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - + Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); - Corpse(uint32 in_corpseid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard = false); + Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); - static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charname, float in_x, float in_y, float in_z, float in_heading, char* time_of_death, bool rezzed, bool was_at_graveyard); + static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 3e5b15cc7..2a2e04ba3 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3750,20 +3750,6 @@ uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) { bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs){ std::string query = StringFormat( "SELECT \n" - "id, \n" - "charid, \n" - "charname, \n" - "zone_id, \n" - "instance_id, \n" - "x, \n" - "y, \n" - "z, \n" - "heading, \n" - "`data`, \n" - "time_of_death, \n" - "is_rezzed, \n" - "is_buried, \n" - "was_at_graveyard, \n" "is_locked, \n" "exp, \n" "size, \n" @@ -3862,9 +3848,10 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->itemcount = results.RowCount(); uint16 r = 0; // Allocate memory for items. - pcs->items = reinterpret_cast(new char[pcs->itemcount * sizeof(player_lootitem::ServerLootItem_Struct)]); + // pcs->items = reinterpret_cast(new char[pcs->itemcount * sizeof(player_lootitem::ServerLootItem_Struct)]); for (auto row = results.begin(); row != results.end(); ++row) { + memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct)); pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot, pcs->items[i].item_id = atoi(row[r]); r++; // item_id, pcs->items[i].charges = atoi(row[r]); r++; // charges, @@ -4001,18 +3988,29 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - entity_list.AddCorpse( + std::cout << row[0] << std::endl; + std::cout << row[1] << std::endl; + std::cout << row[2] << std::endl; + std::cout << row[3] << std::endl; + std::cout << row[4] << std::endl; + std::cout << row[5] << std::endl; + std::cout << row[6] << std::endl; + std::cout << row[7] << std::endl; + std::cout << row[8] << std::endl; + std::cout << row[9] << std::endl; + + entity_list.AddCorpse( Corpse::LoadFromDBData( atoi(row[0]), // id uint32 in_dbid atoi(row[1]), // charid uint32 in_charid - row[2], // PlayerCorpse_tSruct* pcs + row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y atof(row[5]), // z float in_z atof(row[6]), // heading float in_heading row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed - atoi(row[9])) + atoi(row[9])) ); } diff --git a/zone/zonedump.h b/zone/zonedump.h index 52626aca1..14f9b5d0a 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -172,7 +172,7 @@ struct PlayerCorpse_Struct { uint32 drakkin_heritage; uint32 drakkin_tattoo; uint32 drakkin_details; - player_lootitem::ServerLootItem_Struct* items[0]; + player_lootitem::ServerLootItem_Struct items[0]; //std::list items; }; From 12ceac4c02b41bea202cb3bddbf78a10dc7156c9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 15:55:38 -0600 Subject: [PATCH 0306/1883] Corpses properly loading now --- zone/corpse.cpp | 85 +++++++++++++++++----------------- zone/zonedb.cpp | 118 ++++++++++++++++++++++++++++-------------------- zone/zonedb.h | 3 +- 3 files changed, 115 insertions(+), 91 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 9b41d4b41..f8ae44d49 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -65,23 +65,17 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard) { - - std::cout << "LoadFromDBData: 0 " << in_dbid << std::endl; - std::cout << "LoadFromDBData: 1 " << in_charid << std::endl; - std::cout << "LoadFromDBData: 2 " << in_charname << std::endl; - std::cout << "LoadFromDBData: 3 " << in_x << std::endl; - std::cout << "LoadFromDBData: 4 " << in_y << std::endl; - std::cout << "LoadFromDBData: 5 " << in_z << std::endl; - - PlayerCorpse_Struct pcs; - database.LoadCharacterCorpseData(in_dbid, &pcs); + uint32 item_count = database.GetCharacterCorpseItemCount(in_dbid); + char *buffer = new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; + PlayerCorpse_Struct *pcs = (PlayerCorpse_Struct*)buffer; + database.LoadCharacterCorpseData(in_dbid, pcs); /* Load Items */ ItemList itemlist; ServerLootItem_Struct* tmp = 0; - for (unsigned int i = 0; i < pcs.itemcount; i++) { + for (unsigned int i = 0; i < pcs->itemcount; i++) { tmp = new ServerLootItem_Struct; - memcpy(tmp, &pcs.items[i], sizeof(player_lootitem::ServerLootItem_Struct)); + memcpy(tmp, &pcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); tmp->equip_slot = CorpseToServerSlot(tmp->equip_slot); itemlist.push_back(tmp); } @@ -92,45 +86,57 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ in_charid, // uint32 in_charid in_charname.c_str(), // char* in_charname &itemlist, // ItemList* in_itemlist - pcs.copper, // uint32 in_copper - pcs.silver, // uint32 in_silver - pcs.gold, // uint32 in_gold - pcs.plat, // uint32 in_plat + pcs->copper, // uint32 in_copper + pcs->silver, // uint32 in_silver + pcs->gold, // uint32 in_gold + pcs->plat, // uint32 in_plat in_x, // float in_x in_y, // float in_y in_z, // float in_z in_heading, // float in_heading - pcs.size, // float in_size - pcs.gender, // uint8 in_gender - pcs.race, // uint16 in_race - pcs.class_, // uint8 in_class - pcs.deity, // uint8 in_deity - pcs.level, // uint8 in_level - pcs.texture, // uint8 in_texture - pcs.helmtexture, // uint8 in_helmtexture - pcs.exp, // uint32 in_rezexp + pcs->size, // float in_size + pcs->gender, // uint8 in_gender + pcs->race, // uint16 in_race + pcs->class_, // uint8 in_class + pcs->deity, // uint8 in_deity + pcs->level, // uint8 in_level + pcs->texture, // uint8 in_texture + pcs->helmtexture, // uint8 in_helmtexture + pcs->exp, // uint32 in_rezexp was_at_graveyard // bool wasAtGraveyard ); - if (pcs.locked) + if (pcs->locked) pc->Lock(); /* Load Item Tints */ - memcpy(pc->item_tint, pcs.item_tint, sizeof(pc->item_tint)); - + // memcpy(pc->item_tint, pcs->item_tint, sizeof(pc->item_tint)); + 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; - pc->beardcolor = pcs.beardcolor; - pc->eyecolor1 = pcs.eyecolor1; - pc->eyecolor2 = pcs.eyecolor2; - pc->hairstyle = pcs.hairstyle; - pc->luclinface = pcs.face; - pc->beard = pcs.beard; - pc->drakkin_heritage = pcs.drakkin_heritage; - pc->drakkin_tattoo = pcs.drakkin_tattoo; - pc->drakkin_details = pcs.drakkin_details; + pc->haircolor = pcs->haircolor; + pc->beardcolor = pcs->beardcolor; + pc->eyecolor1 = pcs->eyecolor1; + pc->eyecolor2 = pcs->eyecolor2; + pc->hairstyle = pcs->hairstyle; + pc->luclinface = pcs->face; + pc->beard = pcs->beard; + pc->drakkin_heritage = pcs->drakkin_heritage; + pc->drakkin_tattoo = pcs->drakkin_tattoo; + pc->drakkin_details = pcs->drakkin_details; pc->IsRezzed(rezzed); pc->become_npc = false; + safe_delete_array(pcs); + return pc; } @@ -532,9 +538,6 @@ bool Corpse::Save() { dbpc->drakkin_tattoo = drakkin_tattoo; dbpc->drakkin_details = drakkin_details; - std::cout << "SLI1: " << sizeof(player_lootitem::ServerLootItem_Struct) << std::endl; - std::cout << "SLI2: " << sizeof(ServerLootItem_Struct) << std::endl; - uint32 x = 0; ItemList::iterator cur, end; cur = itemlist.begin(); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 2a2e04ba3..9bcf0bb1f 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3530,7 +3530,7 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c ); auto results = QueryDatabase(query); - query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u"); + query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id); results = QueryDatabase(query); /* Dump Items from Inventory */ @@ -3736,6 +3736,18 @@ uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { return 0; } +uint32 ZoneDatabase::GetCharacterCorpseItemCount(uint32 corpse_id){ + std::string query = StringFormat("SELECT COUNT(*) FROM character_corpse_items WHERE `corpse_id` = %u", + corpse_id + ); + auto results = QueryDatabase(query); + auto row = results.begin(); + if (results.Success() && results.RowsAffected() != 0){ + return atoi(row[0]); + } + return 0; +} + uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) { Corpse* tmp = LoadCharacterCorpse(corpse_id); uint32 itemid = 0; @@ -3791,39 +3803,39 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct auto results = QueryDatabase(query); uint16 i = 0; for (auto row = results.begin(); row != results.end(); ++row) { - pcs->locked = atoi(row[i]); i++; // is_locked, - pcs->exp = atoi(row[i]); i++; // exp, - pcs->size = atoi(row[i]); i++; // size, - pcs->level = atoi(row[i]); i++; // `level`, - pcs->race = atoi(row[i]); i++; // race, - pcs->gender = atoi(row[i]); i++; // gender, - pcs->class_ = atoi(row[i]); i++; // class, - pcs->deity = atoi(row[i]); i++; // deity, - pcs->texture = atoi(row[i]); i++; // texture, - pcs->helmtexture = atoi(row[i]); i++; // helm_texture, - pcs->copper = atoi(row[i]); i++; // copper, - pcs->silver = atoi(row[i]); i++; // silver, - pcs->gold = atoi(row[i]); i++; // gold, - pcs->plat = atoi(row[i]); i++; // platinum, - pcs->haircolor = atoi(row[i]); i++; // hair_color, - pcs->beardcolor = atoi(row[i]); i++; // beard_color, - pcs->eyecolor1 = atoi(row[i]); i++; // eye_color_1, - pcs->eyecolor2 = atoi(row[i]); i++; // eye_color_2, - pcs->hairstyle = atoi(row[i]); i++; // hair_style, - pcs->face = atoi(row[i]); i++; // face, - pcs->beard = atoi(row[i]); i++; // beard, - pcs->drakkin_heritage = atoi(row[i]); i++; // drakkin_heritage, - pcs->drakkin_tattoo = atoi(row[i]); i++; // drakkin_tattoo, - pcs->drakkin_details = atoi(row[i]); i++; // drakkin_details, - pcs->item_tint[0].color = atoi(row[i]); i++; // wc_1, - pcs->item_tint[1].color = atoi(row[i]); i++; // wc_2, - pcs->item_tint[2].color = atoi(row[i]); i++; // wc_3, - pcs->item_tint[3].color = atoi(row[i]); i++; // wc_4, - pcs->item_tint[4].color = atoi(row[i]); i++; // wc_5, - pcs->item_tint[5].color = atoi(row[i]); i++; // wc_6, - pcs->item_tint[6].color = atoi(row[i]); i++; // wc_7, - pcs->item_tint[7].color = atoi(row[i]); i++; // wc_8, - pcs->item_tint[8].color = atoi(row[i]); i++; // wc_9 + pcs->locked = atoi(row[i++]); // is_locked, + pcs->exp = atoi(row[i++]); // exp, + pcs->size = atoi(row[i++]); // size, + pcs->level = atoi(row[i++]); // `level`, + pcs->race = atoi(row[i++]); // race, + pcs->gender = atoi(row[i++]); // gender, + pcs->class_ = atoi(row[i++]); // class, + pcs->deity = atoi(row[i++]); // deity, + pcs->texture = atoi(row[i++]); // texture, + pcs->helmtexture = atoi(row[i++]); // helm_texture, + pcs->copper = atoi(row[i++]); // copper, + pcs->silver = atoi(row[i++]); // silver, + pcs->gold = atoi(row[i++]); // gold, + pcs->plat = atoi(row[i++]); // platinum, + pcs->haircolor = atoi(row[i++]); // hair_color, + pcs->beardcolor = atoi(row[i++]); // beard_color, + pcs->eyecolor1 = atoi(row[i++]); // eye_color_1, + pcs->eyecolor2 = atoi(row[i++]); // eye_color_2, + pcs->hairstyle = atoi(row[i++]); // hair_style, + pcs->face = atoi(row[i++]); // face, + pcs->beard = atoi(row[i++]); // beard, + pcs->drakkin_heritage = atoi(row[i++]); // drakkin_heritage, + pcs->drakkin_tattoo = atoi(row[i++]); // drakkin_tattoo, + pcs->drakkin_details = atoi(row[i++]); // drakkin_details, + pcs->item_tint[0].color = atoi(row[i++]); // wc_1, + pcs->item_tint[1].color = atoi(row[i++]); // wc_2, + pcs->item_tint[2].color = atoi(row[i++]); // wc_3, + pcs->item_tint[3].color = atoi(row[i++]); // wc_4, + pcs->item_tint[4].color = atoi(row[i++]); // wc_5, + pcs->item_tint[5].color = atoi(row[i++]); // wc_6, + pcs->item_tint[6].color = atoi(row[i++]); // wc_7, + pcs->item_tint[7].color = atoi(row[i++]); // wc_8, + pcs->item_tint[8].color = atoi(row[i++]); // wc_9 } query = StringFormat( "SELECT \n" @@ -3847,19 +3859,16 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->itemcount = results.RowCount(); uint16 r = 0; - // Allocate memory for items. - // pcs->items = reinterpret_cast(new char[pcs->itemcount * sizeof(player_lootitem::ServerLootItem_Struct)]); - for (auto row = results.begin(); row != results.end(); ++row) { memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct)); - pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot, - pcs->items[i].item_id = atoi(row[r]); r++; // item_id, - pcs->items[i].charges = atoi(row[r]); r++; // charges, - pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1, - pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2, - pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3, - pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4, - pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5, + pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot, + pcs->items[i].item_id = atoi(row[r++]); // item_id, + pcs->items[i].charges = atoi(row[r++]); // charges, + pcs->items[i].aug_1 = atoi(row[r++]); // aug_1, + pcs->items[i].aug_2 = atoi(row[r++]); // aug_2, + pcs->items[i].aug_3 = atoi(row[r++]); // aug_3, + pcs->items[i].aug_4 = atoi(row[r++]); // aug_4, + pcs->items[i].aug_5 = atoi(row[r++]); // aug_5, r = 0; i++; } @@ -3913,7 +3922,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u'" "ORDER BY time_of_death", char_id - ); + ); results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { @@ -4026,19 +4035,30 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { return 0; } +bool ZoneDatabase::ClearCorpseItems(uint32 db_id){ + std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id); + auto results = QueryDatabase(query); + if (results.Success() && results.RowsAffected() != 0){ + return true; + } + return false; +} + bool ZoneDatabase::BuryCharacterCorpse(uint32 db_id) { - std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %d", db_id); + std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %u", db_id); auto results = QueryDatabase(query); if (results.Success() && results.RowsAffected() != 0){ + ClearCorpseItems(db_id); return true; } return false; } bool ZoneDatabase::BuryAllCharacterCorpses(uint32 char_id) { - std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `charid` = %d", char_id); + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = %u", char_id); auto results = QueryDatabase(query); - if (results.Success() && results.RowsAffected() != 0){ + for (auto row = results.begin(); row != results.end(); ++row) { + BuryCharacterCorpse(atoi(row[0])); return true; } return false; diff --git a/zone/zonedb.h b/zone/zonedb.h index 982d4e2c7..4492b5c9a 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -295,7 +295,8 @@ public: bool NoRentExpired(const char* name); /* Corpses */ - + bool ClearCorpseItems(uint32 db_id); + uint32 GetCharacterCorpseItemCount(uint32 corpse_id); bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs); Corpse* LoadCharacterCorpse(uint32 player_corpse_id); Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); From 3b51aebb510b8a9fce0f2b4d61967c8ad7312a2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 17:49:56 -0600 Subject: [PATCH 0307/1883] More load and delete changes for corpses --- zone/client.cpp | 32 --------- zone/client.h | 1 - zone/corpse.cpp | 179 +++++++++++++++++------------------------------- zone/zonedb.cpp | 49 +++---------- zone/zonedb.h | 1 + 5 files changed, 74 insertions(+), 188 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 2c2b82aaa..9541959ba 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2582,38 +2582,6 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 } } -void Client::LogLoot(Client* player, Corpse* corpse, const Item_Struct* item){ - char* logtext; - char itemid[100]; - char itemname[100]; - char coinloot[100]; - if (item!=0){ - memset(itemid,0,sizeof(itemid)); - memset(itemname,0,sizeof(itemid)); - itoa(item->ID,itemid,10); - sprintf(itemname,"%s",item->Name); - logtext=itemname; - - strcat(logtext,"("); - strcat(logtext,itemid); - strcat(logtext,") Looted"); - database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Looting Item",logtext,4); - } - else{ - if ((corpse->GetPlatinum() + corpse->GetGold() + corpse->GetSilver() + corpse->GetCopper())>0) { - memset(coinloot,0,sizeof(coinloot)); - sprintf(coinloot,"%i PP %i GP %i SP %i CP",corpse->GetPlatinum(),corpse->GetGold(),corpse->GetSilver(),corpse->GetCopper()); - logtext=coinloot; - strcat(logtext," Looted"); - if (corpse->GetPlatinum()>10000) - database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Excessive Loot!",logtext,9); - else - database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Looting Money",logtext,5); - } - } -} - - bool Client::BindWound(Mob* bindmob, bool start, bool fail){ EQApplicationPacket* outapp = 0; if(!fail) { diff --git a/zone/client.h b/zone/client.h index 2f4ac0206..dcf665bab 100644 --- a/zone/client.h +++ b/zone/client.h @@ -335,7 +335,6 @@ public: bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); - void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); bool AutoAttackEnabled() const { return auto_attack; } bool AutoFireEnabled() const { return auto_fire; } void MakeCorpse(uint32 exploss); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index f8ae44d49..21efd4030 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -636,6 +636,8 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } } + std::cout << "sitem EQUIPSLOT: " << sitem->equip_slot << std::endl; + return sitem; } @@ -865,28 +867,6 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a d->unknown1 = 0x42; d->unknown2 = 0xef; if(tCanLoot == 2 || (tCanLoot >= 3 && lootcoin)) { // dont take the coin off if it's a gm peeking at the corpse - if(zone->lootvar != 0) { - int admin = client->Admin(); - if(zone->lootvar == 7) { client->LogLoot(client, this, 0); } - else if((admin >= 10) && (admin < 20)) { - if((zone->lootvar < 8) && (zone->lootvar > 5)) { client->LogLoot(client, this, 0); } - } - else if(admin <= 20) { - if((zone->lootvar < 8) && (zone->lootvar > 4)) { client->LogLoot(client, this, 0); } - } - else if(admin <= 80) { - if((zone->lootvar < 8) && (zone->lootvar > 3)) { client->LogLoot(client, this, 0); } - } - else if(admin <= 100) { - if((zone->lootvar < 9) && (zone->lootvar > 2)) { client->LogLoot(client, this, 0); } - } - else if(admin <= 150) { - if(((zone->lootvar < 8) && (zone->lootvar > 1)) || (zone->lootvar == 9)) { client->LogLoot(client, this, 0); } - } - else if (admin <= 255) { - if((zone->lootvar < 8) && (zone->lootvar > 0)) { client->LogLoot(client, this, 0); } - } - } if(!IsPlayerCorpse() && client->IsGrouped() && client->AutoSplitEnabled() && client->GetGroup()) { d->copper = 0; @@ -994,13 +974,11 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(client->GetClientVersion() >= EQClientSoD) { SendLootReqErrorPacket(client, 6); } } -void Corpse::LootItem(Client* client, const EQApplicationPacket* app) -{ - //this gets sent out no matter what as a sort of 'ack', so send it here. +void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { + /* This gets sent no matter what as a sort of ACK */ client->QueuePacket(app); - if(!loot_cooldown_timer.Check()) - { + if (!loot_cooldown_timer.Check()) { SendEndLootErrorPacket(client); //unlock corpse for others if (this->BeingLootedBy = client->GetID()) { @@ -1009,9 +987,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) return; } - // To prevent item loss for a player using 'Loot All' who doesn't have inventory space for all their items. - if(RuleB(Character, CheckCursorEmptyWhenLooting) && !client->GetInv().CursorEmpty()) - { + /* To prevent item loss for a player using 'Loot All' who doesn't have inventory space for all their items. */ + if (RuleB(Character, CheckCursorEmptyWhenLooting) && !client->GetInv().CursorEmpty()) { client->Message(13, "You may not loot an item while you have an item on your cursor."); SendEndLootErrorPacket(client); //unlock corpse for others @@ -1038,7 +1015,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) client->Message(13, "Error: Corpse locked by GM."); return; } - if(IsPlayerCorpse() && (charid != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem()==0){ + if (IsPlayerCorpse() && (charid != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){ client->Message(13, "Error: You cannot loot any more items from this corpse."); SendEndLootErrorPacket(client); BeingLootedBy = 0xFFFFFFFF; @@ -1049,48 +1026,46 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10]; memset(bag_item_data, 0, sizeof(bag_item_data)); - if(GetPKItem()>1) + if (GetPKItem() > 1){ item = database.GetItem(GetPKItem()); - else if(GetPKItem()==-1 || GetPKItem()==1) + } + else if (GetPKItem() == -1 || GetPKItem() == 1){ item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward - else + } + else{ item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN, bag_item_data); + } - if (GetPKItem()<=1 && item_data != 0) - { + std::cout << "ITEM_DATA EQUIP SLOT: " << item_data->equip_slot << std::endl; + + if (GetPKItem()<=1 && item_data != 0) { item = database.GetItem(item_data->item_id); } - if (item != 0) - { - if(item_data) - inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); - else + if (item != 0) { + if (item_data){ + inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); + } + else { inst = database.CreateItem(item); + } } - if (client && inst) - { - - if (client->CheckLoreConflict(item)) - { - client->Message_StringID(0,LOOT_LORE_ERROR); + if (client && inst) { + if (client->CheckLoreConflict(item)) { + client->Message_StringID(0, LOOT_LORE_ERROR); SendEndLootErrorPacket(client); BeingLootedBy = 0; delete inst; return; } - if(inst->IsAugmented()) - { - for (int i = AUG_BEGIN; iIsAugmented()) { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { ItemInst *itm = inst->GetAugment(i); - if(itm) - { - if(client->CheckLoreConflict(itm->GetItem())) - { - client->Message_StringID(0,LOOT_LORE_ERROR); + if (itm) { + if (client->CheckLoreConflict(itm->GetItem())) { + client->Message_StringID(0, LOOT_LORE_ERROR); SendEndLootErrorPacket(client); BeingLootedBy = 0; delete inst; @@ -1111,86 +1086,57 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) parse->EventPlayer(EVENT_LOOT, client, buf, 0, &args); parse->EventItem(EVENT_LOOT, client, inst, this, buf, 0); - if ((RuleB(Character, EnableDiscoveredItems))) - { - if(client && !client->GetGM() && !client->IsDiscovered(inst->GetItem()->ID)) + if ((RuleB(Character, EnableDiscoveredItems))) { + if (client && !client->GetGM() && !client->IsDiscovered(inst->GetItem()->ID)) client->DiscoverItem(inst->GetItem()->ID); } - if (zone->lootvar != 0) - { - int admin=client->Admin(); - if (zone->lootvar==7){ - client->LogLoot(client,this,item); - } - else if ((admin>=10) && (admin<20)){ - if ((zone->lootvar<8) && (zone->lootvar>5)) - client->LogLoot(client,this,item); - } - else if (admin<=20){ - if ((zone->lootvar<8) && (zone->lootvar>4)) - client->LogLoot(client,this,item); - } - else if (admin<=80){ - if ((zone->lootvar<8) && (zone->lootvar>3)) - client->LogLoot(client,this,item); - } - else if (admin<=100){ - if ((zone->lootvar<9) && (zone->lootvar>2)) - client->LogLoot(client,this,item); - } - else if (admin<=150){ - if (((zone->lootvar<8) && (zone->lootvar>1)) || (zone->lootvar==9)) - client->LogLoot(client,this,item); - } - else if (admin<=255){ - if ((zone->lootvar<8) && (zone->lootvar>0)) - client->LogLoot(client,this,item); - } - } - - if(zone->adv_data) - { + if (zone->adv_data) { ServerZoneAdventureDataReply_Struct *ad = (ServerZoneAdventureDataReply_Struct*)zone->adv_data; - if(ad->type == Adventure_Collect && !IsPlayerCorpse()) - { - if(ad->data_id == inst->GetItem()->ID) - { + if (ad->type == Adventure_Collect && !IsPlayerCorpse()) { + if (ad->data_id == inst->GetItem()->ID) { zone->DoAdventureCountIncrease(); } } } - // first add it to the looter - this will do the bag contents too - if(lootitem->auto_loot) - { - if(!client->AutoPutLootInInventory(*inst, true, true, bag_item_data)) + /* First add it to the looter - this will do the bag contents too */ + if (lootitem->auto_loot) { + if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data)) client->PutLootInInventory(MainCursor, *inst, bag_item_data); } - else - { + else { client->PutLootInInventory(MainCursor, *inst, bag_item_data); } - // Update any tasks that have an activity to loot this item. - if(RuleB(TaskSystem, EnableTaskSystem)) + + /* Update any tasks that have an activity to loot this item */ + if (RuleB(TaskSystem, EnableTaskSystem)) client->UpdateTasksForItem(ActivityLoot, item->ID); - // now remove it from the corpse - if(item_data) + + /* Remove it from Corpse */ + if (item_data){ RemoveItem(item_data->lootslot); - // remove bag contents too - if (item->ItemClass == ItemClassContainer && (GetPKItem()!=-1 || GetPKItem()!=1)) - { - for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) - { - if (bag_item_data[i]) - { + std::cout << "CORPSE DB ID: " << this->corpse_db_id << std::endl; + std::cout << "CORPSE EQUIP SLOT: " << item_data->equip_slot << std::endl; + std::cout << "ITEM SLOT: " << item->Slots << std::endl; + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item->ID); + } + + /* Remove Bag Contents */ + if (item->ItemClass == ItemClassContainer && (GetPKItem() != -1 || GetPKItem() != 1)) { + for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { + if (bag_item_data[i]) { RemoveItem(bag_item_data[i]); + std::cout << "CORPSE BAG DB ID: " << this->corpse_db_id << std::endl; + std::cout << "CORPSE BAG EQUIP SLOT: " << item_data->equip_slot << std::endl; + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item->ID); } } } - if(GetPKItem()!=-1) + if (GetPKItem() != -1){ SetPKItem(0); + } //now send messages to all interested parties @@ -1218,8 +1164,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) } safe_delete_array(link); } - else - { + else { SendEndLootErrorPacket(client); safe_delete(inst); return; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 9bcf0bb1f..29f37e099 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3530,44 +3530,6 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c ); auto results = QueryDatabase(query); - query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id); - results = QueryDatabase(query); - - /* Dump Items from Inventory */ - uint8 first_entry = 0; - for (unsigned int i = 0; i < dbpc->itemcount; i++) { - if (first_entry != 1){ - query = StringFormat("REPLACE INTO `character_corpse_items` \n" - " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" - " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", - db_id, - dbpc->items[i].equip_slot, - dbpc->items[i].item_id, - dbpc->items[i].charges, - dbpc->items[i].aug_1, - dbpc->items[i].aug_2, - dbpc->items[i].aug_3, - dbpc->items[i].aug_4, - dbpc->items[i].aug_5 - ); - first_entry = 1; - } - else{ - query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", - db_id, - dbpc->items[i].equip_slot, - dbpc->items[i].item_id, - dbpc->items[i].charges, - dbpc->items[i].aug_1, - dbpc->items[i].aug_2, - dbpc->items[i].aug_3, - dbpc->items[i].aug_4, - dbpc->items[i].aug_5 - ); - } - } - results = QueryDatabase(query); - return db_id; } @@ -4044,6 +4006,17 @@ bool ZoneDatabase::ClearCorpseItems(uint32 db_id){ return false; } +bool ZoneDatabase::DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id){ + std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u AND equip_slot = %u AND item_id = %u", db_id, equip_slot, item_id); + auto results = QueryDatabase(query); + std::cout << "QUERY: " << query << std::endl; + if (results.Success() && results.RowsAffected() != 0){ + std::cout << "Item Delete Successfully" << std::endl; + return true; + } + return false; +} + bool ZoneDatabase::BuryCharacterCorpse(uint32 db_id) { std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %u", db_id); auto results = QueryDatabase(query); diff --git a/zone/zonedb.h b/zone/zonedb.h index 4492b5c9a..53f3496cd 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -296,6 +296,7 @@ public: /* Corpses */ bool ClearCorpseItems(uint32 db_id); + bool DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id); uint32 GetCharacterCorpseItemCount(uint32 corpse_id); bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs); Corpse* LoadCharacterCorpse(uint32 player_corpse_id); From 5970b0ee41fd7ab432f3e3bf780e73015407d828 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Nov 2014 20:19:54 -0500 Subject: [PATCH 0308/1883] Fix for numhits counter being decreased 2x for Outgoing Hit Success from client melee attacks. --- zone/attack.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index da812e724..a04ed9985 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1362,11 +1362,8 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b MeleeLifeTap(damage); - if (damage > 0){ - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); - if (HasSkillProcSuccess() && other && other->GetHP() > 0) - TrySkillProc(other, skillinuse, 0, true, Hand); - } + if (damage > 0 && HasSkillProcSuccess() && other && other->GetHP() > 0) + TrySkillProc(other, skillinuse, 0, true, Hand); CommonBreakInvisible(); From 3266ed98e68f3b5bd5b5e5a9cff98dbe9d153f5b Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Nov 2014 20:48:07 -0500 Subject: [PATCH 0309/1883] Fix for target type 39 GroupNoPets. Should no longer take hold on a pet if your targeting it when casting spell. --- zone/spells.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index 06c28adaa..0757e4510 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1670,6 +1670,12 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce } else { spell_target = this; } + + if (spell_target && spell_target->IsPet() && spells[spell_id].targettype == ST_GroupNoPets){ + Message_StringID(13,NO_CAST_ON_PET); + return false; + } + CastAction = GroupSpell; break; } From 6b67c3736b0d889391f51af3b757f5bff51b50f6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 19:51:01 -0600 Subject: [PATCH 0310/1883] Increased Max charge or stack count on corpses to uint16 (Beyond 1k) Fixed the deletion of items so that they occur immediately when removed from corpse instead of clicking 'Done' Fixed loading of item tints and other fields since atoi caps at 2147483647 --- common/dbcore.cpp | 20 ++++++++--------- common/eq_packet_structs.h | 2 +- zone/corpse.cpp | 35 +++++++++++++----------------- zone/zonedb.cpp | 44 +++++++++++++++++++------------------- zone/zonedump.h | 2 +- 5 files changed, 48 insertions(+), 55 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 9e12f64aa..3c44544c2 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -105,6 +105,15 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; + /* Implement Logging at the Root*/ + + std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << "\n\n" << query << "\n" << std::endl; + /* Write to log file */ + std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); + log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n"; + log.close(); + + return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); } @@ -127,17 +136,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); - /* Implement Logging at the Root*/ - if (requestResult.ErrorMessage() != ""){ - std::cout << "\n[MYSQL ERR] " << requestResult.ErrorMessage() << "\n\n" << query << "\n" << std::endl; - /* Write to log file */ - std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); - log << "[MYSQL ERR] " << requestResult.ErrorMessage() << "\n" << query << "\n"; - log.close(); - } - - - #if DEBUG_MYSQL_QUERIES >= 1 if (requestResult.Success()) { diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index f62517f46..62a166c67 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -5211,7 +5211,7 @@ struct MercenaryMerchantResponse_Struct { struct ServerLootItem_Struct { uint32 item_id; // uint32 item_id; int16 equip_slot; // int16 equip_slot; - uint8 charges; // uint8 charges; + uint16 charges; // uint8 charges; uint16 lootslot; // uint16 lootslot; uint32 aug_1; // uint32 aug_1; uint32 aug_2; // uint32 aug_2; diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 21efd4030..e3e7c1360 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -636,8 +636,6 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** } } - std::cout << "sitem EQUIPSLOT: " << sitem->equip_slot << std::endl; - return sitem; } @@ -991,7 +989,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (RuleB(Character, CheckCursorEmptyWhenLooting) && !client->GetInv().CursorEmpty()) { client->Message(13, "You may not loot an item while you have an item on your cursor."); SendEndLootErrorPacket(client); - //unlock corpse for others + /* Unlock corpse for others */ if (this->BeingLootedBy = client->GetID()) { BeingLootedBy = 0xFFFFFFFF; } @@ -1036,14 +1034,12 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN, bag_item_data); } - std::cout << "ITEM_DATA EQUIP SLOT: " << item_data->equip_slot << std::endl; - if (GetPKItem()<=1 && item_data != 0) { item = database.GetItem(item_data->item_id); } if (item != 0) { - if (item_data){ + if (item_data){ inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); } else { @@ -1115,21 +1111,20 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { /* Remove it from Corpse */ if (item_data){ - RemoveItem(item_data->lootslot); - std::cout << "CORPSE DB ID: " << this->corpse_db_id << std::endl; - std::cout << "CORPSE EQUIP SLOT: " << item_data->equip_slot << std::endl; - std::cout << "ITEM SLOT: " << item->Slots << std::endl; - database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item->ID); + /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id); + /* Delete Item Instance */ + RemoveItem(item_data->lootslot); } /* Remove Bag Contents */ if (item->ItemClass == ItemClassContainer && (GetPKItem() != -1 || GetPKItem() != 1)) { for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if (bag_item_data[i]) { - RemoveItem(bag_item_data[i]); - std::cout << "CORPSE BAG DB ID: " << this->corpse_db_id << std::endl; - std::cout << "CORPSE BAG EQUIP SLOT: " << item_data->equip_slot << std::endl; - database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item->ID); + /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); + /* Delete Item Instance */ + RemoveItem(bag_item_data[i]); } } } @@ -1138,9 +1133,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { SetPKItem(0); } - //now send messages to all interested parties - - //creates a link for the item + /* Send message with item link to groups and such */ char *link = 0, *link2 = 0; //just like a db query :-) client->MakeItemLink(link2, inst); MakeAnyLenString(&link, "%c" "%s" "%s" "%c", @@ -1170,10 +1163,12 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { return; } - if (IsPlayerCorpse()) + if (IsPlayerCorpse()){ client->SendItemLink(inst); - else + } + else{ client->SendItemLink(inst, true); + } safe_delete(inst); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 29f37e099..a79273322 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3763,10 +3763,11 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct corpse_id ); auto results = QueryDatabase(query); + std::cout << query << std::endl; uint16 i = 0; for (auto row = results.begin(); row != results.end(); ++row) { pcs->locked = atoi(row[i++]); // is_locked, - pcs->exp = atoi(row[i++]); // exp, + pcs->exp = atoll(row[i++]); // exp, pcs->size = atoi(row[i++]); // size, pcs->level = atoi(row[i++]); // `level`, pcs->race = atoi(row[i++]); // race, @@ -3775,10 +3776,10 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->deity = atoi(row[i++]); // deity, pcs->texture = atoi(row[i++]); // texture, pcs->helmtexture = atoi(row[i++]); // helm_texture, - pcs->copper = atoi(row[i++]); // copper, - pcs->silver = atoi(row[i++]); // silver, - pcs->gold = atoi(row[i++]); // gold, - pcs->plat = atoi(row[i++]); // platinum, + pcs->copper = atoll(row[i++]); // copper, + pcs->silver = atoll(row[i++]); // silver, + pcs->gold = atoll(row[i++]); // gold, + pcs->plat = atoll(row[i++]); // platinum, pcs->haircolor = atoi(row[i++]); // hair_color, pcs->beardcolor = atoi(row[i++]); // beard_color, pcs->eyecolor1 = atoi(row[i++]); // eye_color_1, @@ -3786,18 +3787,18 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->hairstyle = atoi(row[i++]); // hair_style, pcs->face = atoi(row[i++]); // face, pcs->beard = atoi(row[i++]); // beard, - pcs->drakkin_heritage = atoi(row[i++]); // drakkin_heritage, - pcs->drakkin_tattoo = atoi(row[i++]); // drakkin_tattoo, - pcs->drakkin_details = atoi(row[i++]); // drakkin_details, - pcs->item_tint[0].color = atoi(row[i++]); // wc_1, - pcs->item_tint[1].color = atoi(row[i++]); // wc_2, - pcs->item_tint[2].color = atoi(row[i++]); // wc_3, - pcs->item_tint[3].color = atoi(row[i++]); // wc_4, - pcs->item_tint[4].color = atoi(row[i++]); // wc_5, - pcs->item_tint[5].color = atoi(row[i++]); // wc_6, - pcs->item_tint[6].color = atoi(row[i++]); // wc_7, - pcs->item_tint[7].color = atoi(row[i++]); // wc_8, - pcs->item_tint[8].color = atoi(row[i++]); // wc_9 + pcs->drakkin_heritage = atoll(row[i++]); // drakkin_heritage, + pcs->drakkin_tattoo = atoll(row[i++]); // drakkin_tattoo, + pcs->drakkin_details = atoll(row[i++]); // drakkin_details, + pcs->item_tint[0].color = atoll(row[i++]); // wc_1, + pcs->item_tint[1].color = atoll(row[i++]); // wc_2, + pcs->item_tint[2].color = atoll(row[i++]); // wc_3, + pcs->item_tint[3].color = atoll(row[i++]); // wc_4, + pcs->item_tint[4].color = atoll(row[i++]); // wc_5, + pcs->item_tint[5].color = atoll(row[i++]); // wc_6, + pcs->item_tint[6].color = atoll(row[i++]); // wc_7, + pcs->item_tint[7].color = atoll(row[i++]); // wc_8, + pcs->item_tint[8].color = atoll(row[i++]); // wc_9 } query = StringFormat( "SELECT \n" @@ -3813,12 +3814,13 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct "FROM \n" "character_corpse_items \n" "WHERE `corpse_id` = %u\n" - "ORDER BY `equip_slot`", + // "ORDER BY `equip_slot`" + , corpse_id ); results = QueryDatabase(query); - i = 0; - + + i = 0; pcs->itemcount = results.RowCount(); uint16 r = 0; for (auto row = results.begin(); row != results.end(); ++row) { @@ -4009,9 +4011,7 @@ bool ZoneDatabase::ClearCorpseItems(uint32 db_id){ bool ZoneDatabase::DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id){ std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u AND equip_slot = %u AND item_id = %u", db_id, equip_slot, item_id); auto results = QueryDatabase(query); - std::cout << "QUERY: " << query << std::endl; if (results.Success() && results.RowsAffected() != 0){ - std::cout << "Item Delete Successfully" << std::endl; return true; } return false; diff --git a/zone/zonedump.h b/zone/zonedump.h index 14f9b5d0a..6d7e67b04 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -132,7 +132,7 @@ namespace player_lootitem { struct ServerLootItem_Struct { uint32 item_id; int16 equip_slot; - uint8 charges; + uint16 charges; uint16 lootslot; uint32 aug_1; uint32 aug_2; From ce4c6b0c8a175806b2c53880a0b6134e28eeab0e Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Nov 2014 20:52:24 -0500 Subject: [PATCH 0311/1883] string --- zone/string_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/string_ids.h b/zone/string_ids.h index 57711a40d..5375c2d7d 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -264,6 +264,7 @@ #define TRADESKILL_MISSING_COMPONENTS 3456 //Sorry, but you don't have everything you need for this recipe in your general inventory. #define TRADESKILL_LEARN_RECIPE 3457 //You have learned the recipe %1! #define EXPEDITION_MIN_REMAIN 3551 //You only have %1 minutes remaining before this expedition comes to an end. +#define NO_CAST_ON_PET 4045 //You cannot cast this spell on your pet. #define REWIND_WAIT 4059 //You must wait a bit longer before using the rewind command again. #define CORPSEDRAG_LIMIT 4061 //You are already dragging as much as you can! #define CORPSEDRAG_ALREADY 4062 //You are already dragging %1. From 5c0fbac7b0361ce251cf575da185966893353b3f Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Nov 2014 21:41:05 -0500 Subject: [PATCH 0312/1883] Removal of 2x numhits outgoing hit success call from special attack. --- zone/special_attacks.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 963bf51a8..3625c9180 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -2128,8 +2128,6 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if (HasDied()) return; - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); - if(aabonuses.SpecialAttackKBProc[0] && aabonuses.SpecialAttackKBProc[1] == skillinuse){ int kb_chance = 25; kb_chance += kb_chance*(100-aabonuses.SpecialAttackKBProc[0])/100; From 3ca282abfa81c519f26528fc2212a09ad4bc754d Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Nov 2014 22:06:15 -0500 Subject: [PATCH 0313/1883] Fix for numhits counter not working where buffslot was 0 in some situations. --- zone/mob.cpp | 4 ++-- zone/mob.h | 2 +- zone/spell_effects.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index a7d141b30..6c451f907 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3059,7 +3059,7 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger) if(IsValidSpell(trigger_spell_id) && GetTarget()){ SpellFinished(trigger_spell_id, GetTarget(),10, 0, -1, spells[trigger_spell_id].ResistDiff); - CheckNumHitsRemaining(NUMHIT_MatchingSpells,0, focus_spell); + CheckNumHitsRemaining(NUMHIT_MatchingSpells,-1, focus_spell); } } } @@ -3396,7 +3396,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); } - CheckNumHitsRemaining(NUMHIT_MatchingSpells, 0, focus_spell); + CheckNumHitsRemaining(NUMHIT_MatchingSpells, -1, focus_spell); } } diff --git a/zone/mob.h b/zone/mob.h index a4dd2d665..525cbb2e8 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -275,7 +275,7 @@ public: int16 GetBuffSlotFromType(uint16 type); uint16 GetSpellIDFromSlot(uint8 slot); int CountDispellableBuffs(); - void CheckNumHitsRemaining(uint8 type, uint32 buff_slot=0, uint16 spell_id=SPELL_UNKNOWN); + void CheckNumHitsRemaining(uint8 type, uint32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); bool HasNumhits() const { return has_numhits; } inline void Numhits(bool val) { has_numhits = val; } bool HasMGB() const { return has_MGB; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 447d34efd..35d93127a 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5586,8 +5586,8 @@ void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) } } } - } else if (type == 7) { - if (buff_slot > 0) { + } else if (type == NUMHIT_MatchingSpells) { + if (buff_slot >= 0) { if (--buffs[buff_slot].numhits == 0) { CastOnNumHitFade(buffs[buff_slot].spellid); if (!TryFadeEffect(buff_slot)) From ce248d83d6799a796b62e551c6b4829b29aa6b88 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 21:37:42 -0600 Subject: [PATCH 0314/1883] Corpse Class Private scope variables renamed for understandability across the source Removed ThrowDBError from the source Implemented MySQL query error log at the root of the MySQL API Readability changes --- common/database.cpp | 152 ++++++++++------------------- common/database.h | 1 - common/dbcore.cpp | 19 ++-- common/shareddb.cpp | 4 +- world/worlddb.cpp | 4 +- zone/corpse.cpp | 233 +++++++++++++++++++++++++------------------- zone/corpse.h | 37 +++---- zone/spawn2.cpp | 2 - zone/zonedb.cpp | 64 ++++++------ 9 files changed, 246 insertions(+), 270 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index acc6175a6..5f8b11cb0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -323,20 +323,6 @@ bool Database::ReserveName(uint32 account_id, char* name) { return true; } -bool Database::ThrowDBError(std::string ErrorMessage, std::string query_title, std::string query){ - if (ErrorMessage != ""){ - std::cout << "\nERROR " << query_title << ": " << ErrorMessage << "\n\n" << query << "\n" << std::endl; - - /* Write to log file */ - std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); - log << "ERROR " << query_title << ": " << ErrorMessage << "\n" << query << "\n"; - log.close(); - - return true; - } - return false; -} - /* Delete the character with the name "name" returns false on failure, true otherwise @@ -355,39 +341,39 @@ bool Database::DeleteCharacter(char *name) { for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); } if (charid <= 0){ std::cerr << "Database::DeleteCharacter :: Character not found, stopping delete...\n"; return false; } - query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `timers` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `inventory` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `char_recipe_list` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `adventure_stats` WHERE `player_id` ='%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `zone_flags` WHERE `charID` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `titles` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `player_titlesets` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `keyring` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `faction_values` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `instance_list_player` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_data` WHERE `id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_skills` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_languages` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_bind` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_currency` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_data` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_disciplines` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); - query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::DeleteCharacter", query); + query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `timers` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `inventory` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `char_recipe_list` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `adventure_stats` WHERE `player_id` ='%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `zone_flags` WHERE `charID` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `titles` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `player_titlesets` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `keyring` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `faction_values` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `instance_list_player` WHERE `charid` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_data` WHERE `id` = '%d'", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_skills` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_languages` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_bind` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_currency` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_data` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_disciplines` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_bandolier` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_potionbelt` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_inspect_messages` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", charid); results = QueryDatabase(query); + query = StringFormat("DELETE FROM `character_alt_currency` WHERE `char_id` = '%d'", charid); results = QueryDatabase(query); #ifdef BOTS query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", charid); #else @@ -675,14 +661,13 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe pp->RestTimer // " RestTimer) " ); auto results = QueryDatabase(query); - ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Character Data", query); /* Save Bind Points */ 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), " "(%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, character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 1 - ); results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Bind Point", query); + ); results = QueryDatabase(query); /* Save Skills */ int firstquery = 0; @@ -697,7 +682,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe } } } - results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Starting Skills", query); + results = QueryDatabase(query); /* Save Language */ firstquery = 0; @@ -712,7 +697,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe } } } - results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate Starting Languages", query); + results = QueryDatabase(query); return true; } @@ -1064,7 +1049,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_currency` */ @@ -1096,7 +1080,6 @@ bool Database::CheckDatabaseConversions() { " ) ENGINE=InnoDB DEFAULT CHARSET=latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_alternate_abilities` */ @@ -1115,7 +1098,6 @@ bool Database::CheckDatabaseConversions() { " ) ENGINE = InnoDB DEFAULT CHARSET = latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_bind` */ @@ -1138,7 +1120,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_languages` */ @@ -1156,7 +1137,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_skills` */ @@ -1174,7 +1154,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_spells` */ @@ -1192,7 +1171,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_memmed_spells` */ @@ -1210,7 +1188,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_disciplines` */ @@ -1228,7 +1205,6 @@ bool Database::CheckDatabaseConversions() { " ) ENGINE = InnoDB DEFAULT CHARSET = latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_material` */ @@ -1250,7 +1226,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_tribute` */ @@ -1267,7 +1242,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_bandolier` */ @@ -1288,7 +1262,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_potionbelt` */ @@ -1307,7 +1280,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_potionbelt` */ @@ -1324,7 +1296,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } /* Check for table `character_leadership_abilities` */ @@ -1342,7 +1313,6 @@ bool Database::CheckDatabaseConversions() { ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Table create", rquery); printf(" done...\n"); } @@ -1409,7 +1379,6 @@ bool Database::CheckDatabaseConversions() { EscapeString(inspectmessage).c_str() ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Character Inspect Message Convert", rquery); } /* Run Currency Convert */ @@ -1437,7 +1406,6 @@ bool Database::CheckDatabaseConversions() { pp->careerEbonCrystals ); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Character Currency Convert", rquery); if (pp->tribute_time_remaining < 0 || pp->tribute_time_remaining == 4294967295){ pp->tribute_time_remaining = 0; } @@ -1743,7 +1711,6 @@ bool Database::CheckDatabaseConversions() { e_pp->expended_aa ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Character Data Convert", rquery); /* @@ -1764,14 +1731,14 @@ bool Database::CheckDatabaseConversions() { } } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "AA Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Bind Home Convert */ if(pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) { rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" " VALUES (%u, %u, %u, %f, %f, %f, %f, 1)", character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading); - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Bind Home Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } } /* Run Bind Convert */ @@ -1779,7 +1746,7 @@ bool Database::CheckDatabaseConversions() { rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" " VALUES (%u, %u, %u, %f, %f, %f, %f, 0)", character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading); - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Bind Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } } /* Run Language Convert */ first_entry = 0; rquery = ""; @@ -1792,7 +1759,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Language Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Skill Convert */ first_entry = 0; rquery = ""; for (i = 0; i < MAX_PP_SKILL; i++){ @@ -1804,7 +1771,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Skills Convert Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Spell Convert */ first_entry = 0; rquery = ""; for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){ @@ -1817,7 +1784,7 @@ bool Database::CheckDatabaseConversions() { } } // std::cout << rquery << "\n"; - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Spell Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Max Memmed Spell Convert */ first_entry = 0; rquery = ""; for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){ @@ -1829,7 +1796,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Memmed Spells Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Discipline Convert */ first_entry = 0; rquery = ""; for (i = 0; i < MAX_PP_DISCIPLINES; i++){ @@ -1841,7 +1808,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Discipline Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Material Color Convert */ first_entry = 0; rquery = ""; for (i = 0; i < _MaterialCount; i++){ @@ -1853,7 +1820,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Material Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Tribute Convert */ first_entry = 0; rquery = ""; for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ @@ -1865,7 +1832,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Tribute Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Bandolier Convert */ first_entry = 0; rquery = ""; for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ @@ -1881,7 +1848,7 @@ bool Database::CheckDatabaseConversions() { } } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Bandolier Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Potion Belt Convert */ first_entry = 0; rquery = ""; for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){ @@ -1894,7 +1861,7 @@ bool Database::CheckDatabaseConversions() { } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Potion Belt Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Leadership AA Convert */ first_entry = 0; rquery = ""; for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){ @@ -1906,7 +1873,7 @@ bool Database::CheckDatabaseConversions() { rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); } } - if (rquery != ""){ results = QueryDatabase(rquery); ThrowDBError(results.ErrorMessage(), "Character Leadership AA Convert", rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } } } if (runconvert == 1){ @@ -1940,9 +1907,6 @@ bool Database::CheckDatabaseConversions() { std::cin.ignore(1); } } - else{ - ThrowDBError(results.ErrorMessage(), "Bot View Discovery", rquery); - } if (runbotsconvert == 1){ printf("Running bot views/function database conversion... \n"); @@ -1950,7 +1914,6 @@ bool Database::CheckDatabaseConversions() { /* Update view `vwbotcharactermobs` */ rquery = StringFormat("DROP VIEW `vwBotCharacterMobs`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwBotCharacterMobs`", rquery); rquery = StringFormat( "CREATE VIEW `vwBotCharacterMobs` AS\n" @@ -1973,13 +1936,11 @@ bool Database::CheckDatabaseConversions() { "FROM bots AS b;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwBotCharacterMobs`", rquery); /* Update function `GetMobType` */ rquery = StringFormat("DROP FUNCTION IF EXISTS `GetMobType`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop Function `GetMobType`", rquery); rquery = StringFormat( "CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1)\n" @@ -1998,13 +1959,11 @@ bool Database::CheckDatabaseConversions() { "END" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create Function `GetMobType`", rquery); /* Update view `vwgroups` */ rquery = StringFormat("DROP VIEW IF EXISTS `vwGroups`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwGroups`", rquery); rquery = StringFormat( "CREATE VIEW `vwGroups` AS\n" @@ -2018,13 +1977,11 @@ bool Database::CheckDatabaseConversions() { "LEFT JOIN `bots` AS b ON g.`name` = b.`Name`;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwGroups`", rquery); /* Update view `vwbotgroups` */ rquery = StringFormat("DROP VIEW IF EXISTS `vwBotGroups`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwBotGroups`", rquery); rquery = StringFormat( "CREATE VIEW `vwBotGroups` AS\n" @@ -2040,13 +1997,11 @@ bool Database::CheckDatabaseConversions() { "ORDER BY b.`BotOwnerCharacterId`, g.`BotGroupName`;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwBotGroups`", rquery); /* Update view `vwguildmembers` */ rquery = StringFormat("DROP VIEW IF EXISTS `vwGuildMembers`;"); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Drop View `vwGuildMembers`", rquery); rquery = StringFormat( "CREATE VIEW `vwGuildMembers` AS\n" @@ -2075,7 +2030,6 @@ bool Database::CheckDatabaseConversions() { "FROM `botguildmembers` AS bm;" ); results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "Create View `vwGuildMembers`", rquery); } if (runbotsconvert == 1){ @@ -2204,7 +2158,7 @@ bool Database::CheckDatabaseConversions() { dbpc->item_tint[8].color, atoi(row2[0]) ); - if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Base Data", scquery); } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } first_entry = 0; scquery = ""; @@ -2240,7 +2194,7 @@ bool Database::CheckDatabaseConversions() { ); } } - if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: SOF: Items", scquery); } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } } else{ /* Classic Converter */ @@ -2308,7 +2262,7 @@ bool Database::CheckDatabaseConversions() { dbpc_c->item_tint[8].color, atoi(row2[0]) ); - if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy :: Base Data", scquery); } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } first_entry = 0; scquery = ""; @@ -2345,7 +2299,7 @@ bool Database::CheckDatabaseConversions() { ); } } - if (scquery != ""){ auto sc_results = QueryDatabase(scquery); ThrowDBError(sc_results.ErrorMessage(), "Corpse Convert: Legacy : Items", scquery); } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } } } } diff --git a/common/database.h b/common/database.h index e089b22a9..04353b657 100644 --- a/common/database.h +++ b/common/database.h @@ -180,7 +180,6 @@ public: Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port); ~Database(); - bool ThrowDBError(std::string ErrorMessage, std::string query_title, std::string query); /* diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 3c44544c2..8e609dae8 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -105,15 +105,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; - /* Implement Logging at the Root*/ - - std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << "\n\n" << query << "\n" << std::endl; - /* Write to log file */ - std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); - log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n"; - log.close(); - - return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); } @@ -123,6 +114,16 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo #ifdef _EQDEBUG std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; #endif + + /* Implement Logging at the Root */ + if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ + std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl; + /* Write to log file */ + std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); + log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n"; + log.close(); + } + return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer); } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index ae19d8e1f..9948f6e00 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1915,7 +1915,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id); - auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::LoadCharacterInspectMessage", query); + auto results = QueryDatabase(query); auto row = results.begin(); memcpy(message, "", sizeof(InspectMessage_Struct)); for (auto row = results.begin(); row != results.end(); ++row) { @@ -1925,7 +1925,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) { std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str()); - auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query); + auto results = QueryDatabase(query); } void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) { diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 955c0b897..cd01e01b2 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -142,14 +142,14 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* 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); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Home Point", query); + auto results_bset = QueryDatabase(query); } /* If no regular bind set, set it */ 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); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Bind Point", query); + auto results_bset = QueryDatabase(query); } } /* Bind End */ diff --git a/zone/corpse.cpp b/zone/corpse.cpp index e3e7c1360..a84b4161e 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -158,10 +158,10 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP { corpse_graveyard_timer.Disable(); memset(item_tint, 0, sizeof(item_tint)); - pIsChanged = false; - p_PlayerCorpse = false; - pLocked = false; - BeingLootedBy = 0xFFFFFFFF; + is_corpse_changed = false; + is_player_corpse = false; + is_locked = false; + being_looted_by = 0xFFFFFFFF; if (in_itemlist) { itemlist = *in_itemlist; in_itemlist->clear(); @@ -171,9 +171,9 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP npctype_id = in_npctypeid; SetPKItem(0); - charid = 0; + char_id = 0; corpse_db_id = 0; - p_depop = false; + player_corpse_depop = false; strcpy(orgname, in_npc->GetName()); strcpy(name, in_npc->GetName()); // Added By Hogie @@ -270,15 +270,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( for (i=0; i < MAX_LOOTERS; i++) looters[i] = 0; - pIsChanged = true; + is_corpse_changed = true; rezzexp = in_rezexp; can_rez = true; - p_PlayerCorpse = true; - pLocked = false; - BeingLootedBy = 0xFFFFFFFF; - charid = client->CharacterID(); + is_player_corpse = true; + is_locked = false; + being_looted_by = 0xFFFFFFFF; + char_id = client->CharacterID(); corpse_db_id = 0; - p_depop = false; + player_corpse_depop = false; copper = 0; silver = 0; gold = 0; @@ -428,10 +428,56 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 // To be called from LoadFromDBData // Mongrel: added see_invis and see_invis_undead Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) - : Mob("Unnamed_Corpse","",0,0,in_gender, in_race, in_class, BT_Humanoid, in_deity, in_level,0, in_size, 0, in_heading, in_x, in_y, in_z,0,in_texture,in_helmtexture, - 0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0xff, - 0,0,0,0,0,0,0,0,0), +: Mob("Unnamed_Corpse", +"", +0, +0, +in_gender, +in_race, +in_class, +BT_Humanoid, +in_deity, +in_level, +0, +in_size, +0, +in_heading, +in_x, +in_y, +in_z, +0, +in_texture, +in_helmtexture, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0xff, +0, +0, +0, +0, +0, +0, +0, +0, +0), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), @@ -446,13 +492,13 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi corpse_graveyard_timer.Disable(); memset(item_tint, 0, sizeof(item_tint)); - pIsChanged = false; - p_PlayerCorpse = true; - pLocked = false; - BeingLootedBy = 0xFFFFFFFF; + is_corpse_changed = false; + is_player_corpse = true; + is_locked = false; + being_looted_by = 0xFFFFFFFF; corpse_db_id = in_dbid; - p_depop = false; - charid = in_charid; + player_corpse_depop = false; + char_id = in_charid; itemlist = *in_itemlist; in_itemlist->clear(); @@ -469,7 +515,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi } Corpse::~Corpse() { - if (p_PlayerCorpse && !(p_depop && corpse_db_id == 0)) { + if (is_player_corpse && !(player_corpse_depop && corpse_db_id == 0)) { Save(); } ItemList::iterator cur,end; @@ -489,7 +535,7 @@ the client does this too, so it's unchangable void Corpse::CalcCorpseName() { EntityList::RemoveNumbers(name); char tmp[64]; - if (p_PlayerCorpse) + if (is_player_corpse) snprintf(tmp, sizeof(tmp), "'s corpse%d", GetID()); else snprintf(tmp, sizeof(tmp), "`s_corpse%d", GetID()); @@ -498,9 +544,9 @@ void Corpse::CalcCorpseName() { } bool Corpse::Save() { - if (!p_PlayerCorpse) + if (!is_player_corpse) return true; - if (!pIsChanged) + if (!is_corpse_changed) return true; uint32 tmp = this->CountItems(); @@ -513,7 +559,7 @@ bool Corpse::Save() { memset(dbpc, 0, tmpsize); dbpc->itemcount = tmp; dbpc->size = this->size; - dbpc->locked = pLocked; + dbpc->locked = is_locked; dbpc->copper = this->copper; dbpc->silver = this->silver; dbpc->gold = this->gold; @@ -549,10 +595,10 @@ bool Corpse::Save() { } if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); } else{ - corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); } safe_delete_array(dbpc); @@ -565,7 +611,7 @@ void Corpse::Delete() { database.DeleteCharacterCorpse(corpse_db_id); corpse_db_id = 0; - p_depop = true; + player_corpse_depop = true; } void Corpse::Bury() { @@ -573,16 +619,16 @@ void Corpse::Bury() { database.BuryCharacterCorpse(corpse_db_id); corpse_db_id = 0; - p_depop = true; + player_corpse_depop = true; } void Corpse::Depop() { if (IsNPCCorpse()) - p_depop = true; + player_corpse_depop = true; } void Corpse::DepopCorpse() { - p_depop = true; + player_corpse_depop = true; } uint32 Corpse::CountItems() { @@ -592,7 +638,8 @@ uint32 Corpse::CountItems() { void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) { if (!database.GetItem(itemnum)) return; - pIsChanged = true; + + is_corpse_changed = true; ServerLootItem_Struct* item = new ServerLootItem_Struct; memset(item, 0, sizeof(ServerLootItem_Struct)); item->item_id = itemnum; @@ -680,7 +727,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ ServerLootItem_Struct* sitem = *cur; if (sitem == item_data) { - pIsChanged = true; + is_corpse_changed = true; itemlist.erase(cur); material = Inventory::CalcMaterialFromSlot(sitem->equip_slot); @@ -699,7 +746,7 @@ void Corpse::SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 this->silver = in_silver; this->gold = in_gold; this->platinum = in_platinum; - pIsChanged = true; + is_corpse_changed = true; } void Corpse::RemoveCash() { @@ -707,7 +754,7 @@ void Corpse::RemoveCash() { this->silver = 0; this->gold = 0; this->platinum = 0; - pIsChanged = true; + is_corpse_changed = true; } bool Corpse::IsEmpty() const { @@ -717,11 +764,10 @@ bool Corpse::IsEmpty() const { } bool Corpse::Process() { - if (p_depop) + if (player_corpse_depop) return false; - if(corpse_delay_timer.Check()) - { + if(corpse_delay_timer.Check()) { for (int i=0; iHasGraveyard()) { Save(); - p_depop = true; + player_corpse_depop = true; database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(), zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading()); @@ -761,7 +807,7 @@ bool Corpse::Process() { else { if(database.BuryCharacterCorpse(corpse_db_id)) { Save(); - p_depop = true; + player_corpse_depop = true; corpse_db_id = 0; LogFile->write(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); } @@ -800,8 +846,7 @@ bool Corpse::CanMobLoot(int charid) { return false; } -void Corpse::AllowMobLoot(Mob *them, uint8 slot) -{ +void Corpse::AllowMobLoot(Mob *them, uint8 slot) { if(slot >= MAX_LOOTERS) return; if(them == nullptr || !them->IsClient()) @@ -814,7 +859,7 @@ void Corpse::AllowMobLoot(Mob *them, uint8 slot) void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) { // Added 12/08. Started compressing loot struct on live. char tmp[10]; - if(p_depop) { + if(player_corpse_depop) { SendLootReqErrorPacket(client, 0); return; } @@ -826,29 +871,29 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // return; } - if(pLocked && client->Admin() < 100) { + if(is_locked && client->Admin() < 100) { SendLootReqErrorPacket(client, 0); client->Message(13, "Error: Corpse locked by GM."); return; } - if(BeingLootedBy == 0) { BeingLootedBy = 0xFFFFFFFF; } + if(being_looted_by == 0) { being_looted_by = 0xFFFFFFFF; } - if(this->BeingLootedBy != 0xFFFFFFFF) { + if(this->being_looted_by != 0xFFFFFFFF) { // lets double check.... - Entity* looter = entity_list.GetID(this->BeingLootedBy); - if(looter == 0) { this->BeingLootedBy = 0xFFFFFFFF; } + Entity* looter = entity_list.GetID(this->being_looted_by); + if(looter == 0) { this->being_looted_by = 0xFFFFFFFF; } } uint8 tCanLoot = 1; bool lootcoin = false; if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); } - if(this->BeingLootedBy != 0xFFFFFFFF && this->BeingLootedBy != client->GetID()) { + if(this->being_looted_by != 0xFFFFFFFF && this->being_looted_by != client->GetID()) { SendLootReqErrorPacket(client, 0); tCanLoot = 0; } - else if(IsPlayerCorpse() && charid == client->CharacterID()) { tCanLoot = 2; } + else if(IsPlayerCorpse() && char_id == client->CharacterID()) { tCanLoot = 2; } else if((IsNPCCorpse() || become_npc) && CanMobLoot(client->CharacterID())) { tCanLoot = 2; } else if(GetPKItem() == -1 && CanMobLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash else if(GetPKItem() == 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash @@ -857,7 +902,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } } if(tCanLoot >= 2 || (tCanLoot == 1 && client->Admin() >= 100 && client->GetGM())) { - this->BeingLootedBy = client->GetID(); + this->being_looted_by = client->GetID(); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer; @@ -940,7 +985,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } } - if(IsPlayerCorpse() && (charid == client->CharacterID() || client->GetGM())) { + if(IsPlayerCorpse() && (char_id == client->CharacterID() || client->GetGM())) { if(i > corpselootlimit) { client->Message(15, "*** This corpse contains more items than can be displayed! ***"); client->Message(0, "Remove items and re-loot corpse to access remaining inventory."); @@ -979,8 +1024,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (!loot_cooldown_timer.Check()) { SendEndLootErrorPacket(client); //unlock corpse for others - if (this->BeingLootedBy = client->GetID()) { - BeingLootedBy = 0xFFFFFFFF; + if (this->being_looted_by = client->GetID()) { + being_looted_by = 0xFFFFFFFF; } return; } @@ -990,33 +1035,33 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { client->Message(13, "You may not loot an item while you have an item on your cursor."); SendEndLootErrorPacket(client); /* Unlock corpse for others */ - if (this->BeingLootedBy = client->GetID()) { - BeingLootedBy = 0xFFFFFFFF; + if (this->being_looted_by = client->GetID()) { + being_looted_by = 0xFFFFFFFF; } return; } LootingItem_Struct* lootitem = (LootingItem_Struct*)app->pBuffer; - if (this->BeingLootedBy != client->GetID()) { + if (this->being_looted_by != client->GetID()) { client->Message(13, "Error: Corpse::LootItem: BeingLootedBy != client"); SendEndLootErrorPacket(client); return; } - if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (charid != client->CharacterID() && client->Admin() < 150)) { + if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (char_id != client->CharacterID() && client->Admin() < 150)) { client->Message(13, "Error: This is a player corpse and you dont own it."); SendEndLootErrorPacket(client); return; } - if (pLocked && client->Admin() < 100) { + if (is_locked && client->Admin() < 100) { SendLootReqErrorPacket(client, 0); client->Message(13, "Error: Corpse locked by GM."); return; } - if (IsPlayerCorpse() && (charid != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){ + if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){ client->Message(13, "Error: You cannot loot any more items from this corpse."); SendEndLootErrorPacket(client); - BeingLootedBy = 0xFFFFFFFF; + being_looted_by = 0xFFFFFFFF; return; } const Item_Struct* item = 0; @@ -1051,7 +1096,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (client->CheckLoreConflict(item)) { client->Message_StringID(0, LOOT_LORE_ERROR); SendEndLootErrorPacket(client); - BeingLootedBy = 0; + being_looted_by = 0; delete inst; return; } @@ -1063,7 +1108,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (client->CheckLoreConflict(itm->GetItem())) { client->Message_StringID(0, LOOT_LORE_ERROR); SendEndLootErrorPacket(client); - BeingLootedBy = 0; + being_looted_by = 0; delete inst; return; } @@ -1181,15 +1226,14 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) { safe_delete(outapp); //client->Save(); //inventory operations auto-commit - this->BeingLootedBy = 0xFFFFFFFF; + this->being_looted_by = 0xFFFFFFFF; if (this->IsEmpty()) Delete(); else Save(); } -void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) -{ +void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { Mob::FillSpawnStruct(ns, ForWho); ns->spawn.max_hp = 120; @@ -1200,8 +1244,7 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.NPC = 2; } -void Corpse::QueryLoot(Client* to) { - +void Corpse::QueryLoot(Client* to) { int x = 0, y = 0; // x = visible items, y = total items to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper); @@ -1253,8 +1296,7 @@ void Corpse::QueryLoot(Client* to) { } } -bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) -{ +bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { uint32 dist2 = 10000; // pow(100, 2); if (!spell) { if (this->GetCharID() == client->CharacterID()) { @@ -1262,13 +1304,11 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) client->Message(13, "That corpse is locked by a GM."); return false; } - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) - { + if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); - pIsChanged = true; + is_corpse_changed = true; } - else - { + else { client->Message(0, "Corpse is too far away."); return false; } @@ -1277,25 +1317,20 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { bool consented = false; std::list::iterator itr; - for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) - { - if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) - { - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) - { + for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) { + if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) { + if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); - pIsChanged = true; + is_corpse_changed = true; } - else - { + else { client->Message(0, "Corpse is too far away."); return false; } consented = true; } } - if(!consented) - { + if(!consented) { client->Message(0, "You do not have permission to move this corpse."); return false; } @@ -1303,7 +1338,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) } else { GMMove(client->GetX(), client->GetY(), client->GetZ()); - pIsChanged = true; + is_corpse_changed = true; } Save(); return true; @@ -1311,7 +1346,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) void Corpse::CompleteRezz(){ rezzexp = 0; - pIsChanged = true; + is_corpse_changed = true; this->Save(); } @@ -1325,8 +1360,7 @@ void Corpse::Spawn() { uint32 Corpse::GetEquipment(uint8 material_slot) const { int invslot; - if(material_slot > EmuConstants::MATERIAL_END) - { + if(material_slot > EmuConstants::MATERIAL_END) { return NO_ITEM; } @@ -1340,14 +1374,12 @@ uint32 Corpse::GetEquipment(uint8 material_slot) const { uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { const Item_Struct *item; - if(material_slot > EmuConstants::MATERIAL_END) - { + if(material_slot > EmuConstants::MATERIAL_END) { return 0; } item = database.GetItem(GetEquipment(material_slot)); - if(item != NO_ITEM) - { + if(item != NO_ITEM) { return item_tint[material_slot].rgb.use_tint ? item_tint[material_slot].color : item->Color; @@ -1356,12 +1388,9 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { return 0; } -void Corpse::AddLooter(Mob* who) -{ - for (int i=0; iCastToClient()->CharacterID(); break; } diff --git a/zone/corpse.h b/zone/corpse.h index 8b10ed787..c292823bd 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -52,21 +52,21 @@ public: void LoadPlayerCorpseDecayTime(uint32 dbid); bool IsCorpse() const { return true; } - bool IsPlayerCorpse() const { return p_PlayerCorpse; } - bool IsNPCCorpse() const { return !p_PlayerCorpse; } + bool IsPlayerCorpse() const { return is_player_corpse; } + bool IsNPCCorpse() const { return !is_player_corpse; } bool IsBecomeNPCCorpse() const { return become_npc; } bool Process(); bool Save(); - uint32 GetCharID() { return charid; } - uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (charid = iCharID); } return 0xFFFFFFFF; }; + uint32 GetCharID() { return char_id; } + uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; }; uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); } uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); } void CalcCorpseName(); - inline void Lock() { pLocked = true; } - inline void UnLock() { pLocked = false; } - inline bool IsLocked() { return pLocked; } - inline void ResetLooter() { BeingLootedBy = 0xFFFFFFFF; } - inline bool IsBeingLooted() { return (BeingLootedBy != 0xFFFFFFFF); } + inline void Lock() { is_locked = true; } + inline void UnLock() { is_locked = false; } + inline bool IsLocked() { return is_locked; } + inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; } + inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); } inline uint32 GetDBID() { return corpse_db_id; } inline char* GetOwnerName() { return orgname;} @@ -98,8 +98,8 @@ public: bool Summon(Client* client, bool spell, bool CheckDistance); void CastRezz(uint16 spellid, Mob* Caster); void CompleteRezz(); - void SetPKItem(int32 id) { pkitem = id; } - int32 GetPKItem() { return pkitem; } + void SetPKItem(int32 id) { player_kill_item = id; } + int32 GetPKItem() { return player_kill_item; } bool CanMobLoot(int charid); void AllowMobLoot(Mob *them, uint8 slot); void AddLooter(Mob *who); @@ -120,24 +120,25 @@ protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); private: - bool p_PlayerCorpse; bool pIsChanged; - bool pLocked; - int32 pkitem; + bool is_player_corpse; + bool is_corpse_changed; + bool is_locked; + int32 player_kill_item; uint32 corpse_db_id; - uint32 charid; + uint32 char_id; ItemList itemlist; uint32 copper; uint32 silver; uint32 gold; uint32 platinum; - bool p_depop; - uint32 BeingLootedBy; + bool player_corpse_depop; + uint32 being_looted_by; uint32 rezzexp; bool rez; bool can_rez; bool become_npc; int looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id - Timer corpse_decay_timer; + Timer corpse_decay_timer; Timer corpse_res_timer; Timer corpse_delay_timer; Timer corpse_graveyard_timer; diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 25cbb8ccf..8d8562157 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -736,8 +736,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //clear out old stuff.. spawn_conditions.clear(); - - std::string query = StringFormat("SELECT id, onchange, value " "FROM spawn_conditions " "WHERE zone = '%s'", zone_name); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a79273322..2fb47eb28 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1237,7 +1237,6 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u if (!results.RowsAffected()) { LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query); return true; } @@ -1248,14 +1247,12 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterMaterialColor", query); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterSkill", query); return true; } @@ -1263,7 +1260,6 @@ bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterDisc", query); return true; } @@ -1286,7 +1282,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBandolier", query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; @@ -1295,7 +1290,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterPotionBelt", query); if (!results.RowsAffected()){ std::cout << "ERROR Potionbelt Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1312,7 +1306,6 @@ bool ZoneDatabase::SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_ } } auto results = QueryDatabase(query); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterLeadershipAA", query); return true; } @@ -1604,7 +1597,6 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase:SaveCharacterData", query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1646,7 +1638,6 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterCurrency", query); LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1656,7 +1647,6 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterAA", rquery); LogFile->write(EQEMuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -3441,6 +3431,7 @@ uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, } return dbid; } + uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) { std::string query = StringFormat("UPDATE `character_corpses` SET \n" "`charname` = '%s',\n" @@ -3692,7 +3683,7 @@ uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { for (auto row = results.begin(); row != results.end(); ++row) { for (int i = 0; i < corpse; i++) { - return atoi(row[0]); + return atoll(row[0]); } } return 0; @@ -3778,8 +3769,8 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->helmtexture = atoi(row[i++]); // helm_texture, pcs->copper = atoll(row[i++]); // copper, pcs->silver = atoll(row[i++]); // silver, - pcs->gold = atoll(row[i++]); // gold, - pcs->plat = atoll(row[i++]); // platinum, + pcs->gold = atoll(row[i++]); // gold, + pcs->plat = atoll(row[i++]); // platinum, pcs->haircolor = atoi(row[i++]); // hair_color, pcs->beardcolor = atoi(row[i++]); // beard_color, pcs->eyecolor1 = atoi(row[i++]); // eye_color_1, @@ -3787,7 +3778,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->hairstyle = atoi(row[i++]); // hair_style, pcs->face = atoi(row[i++]); // face, pcs->beard = atoi(row[i++]); // beard, - pcs->drakkin_heritage = atoll(row[i++]); // drakkin_heritage, + pcs->drakkin_heritage = atoll(row[i++]); // drakkin_heritage, pcs->drakkin_tattoo = atoll(row[i++]); // drakkin_tattoo, pcs->drakkin_details = atoll(row[i++]); // drakkin_details, pcs->item_tint[0].color = atoll(row[i++]); // wc_1, @@ -3826,7 +3817,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct for (auto row = results.begin(); row != results.end(); ++row) { memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct)); pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot, - pcs->items[i].item_id = atoi(row[r++]); // item_id, + pcs->items[i].item_id = atoll(row[r++]); // item_id, pcs->items[i].charges = atoi(row[r++]); // charges, pcs->items[i].aug_1 = atoi(row[r++]); // aug_1, pcs->items[i].aug_2 = atoi(row[r++]); // aug_2, @@ -3836,6 +3827,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct r = 0; i++; } + return true; } @@ -3849,7 +3841,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadFromDBData( - atoi(row[0]), // uint32 in_dbid + atoll(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname dest_x, // float in_x @@ -3891,7 +3883,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadFromDBData( - atoi(row[0]), + atoll(row[0]), char_id, row[1], dest_x, @@ -3936,8 +3928,8 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadFromDBData( - atoi(row[0]), // id uint32 in_dbid - atoi(row[1]), // charid uint32 in_charid + atoll(row[0]), // id uint32 in_dbid + atoll(row[1]), // charid uint32 in_charid row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y @@ -3954,28 +3946,30 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { std::string query; - if (!RuleB(Zone, EnableShadowrest)) - query = StringFormat( "SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id); - else + if (!RuleB(Zone, EnableShadowrest)){ + query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id); + } + else{ query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, 0 as was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u' AND is_buried=0", zone_id, instance_id); - + } + auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - std::cout << row[0] << std::endl; - std::cout << row[1] << std::endl; - std::cout << row[2] << std::endl; - std::cout << row[3] << std::endl; - std::cout << row[4] << std::endl; - std::cout << row[5] << std::endl; - std::cout << row[6] << std::endl; - std::cout << row[7] << std::endl; - std::cout << row[8] << std::endl; - std::cout << row[9] << std::endl; + // std::cout << row[0] << std::endl; + // std::cout << row[1] << std::endl; + // std::cout << row[2] << std::endl; + // std::cout << row[3] << std::endl; + // std::cout << row[4] << std::endl; + // std::cout << row[5] << std::endl; + // std::cout << row[6] << std::endl; + // std::cout << row[7] << std::endl; + // std::cout << row[8] << std::endl; + // std::cout << row[9] << std::endl; entity_list.AddCorpse( Corpse::LoadFromDBData( - atoi(row[0]), // id uint32 in_dbid - atoi(row[1]), // charid uint32 in_charid + atoll(row[0]), // id uint32 in_dbid + atoll(row[1]), // charid uint32 in_charid row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y From c30850f00a33d896faeae1fd07ea5ca3852bee5a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 22:33:57 -0600 Subject: [PATCH 0315/1883] Rest of ZoneDB Corpse functions converted to new API --- zone/corpse.cpp | 80 +++++++++++++++--------------- zone/corpse.h | 7 ++- zone/zonedb.cpp | 127 ++++++++++++------------------------------------ 3 files changed, 73 insertions(+), 141 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a84b4161e..a95b279ea 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -183,19 +183,18 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP break; } } - if(IsEmpty()) - { + if(IsEmpty()) { corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000); } - if(in_npc->HasPrivateCorpse()) - { + if(in_npc->HasPrivateCorpse()) { corpse_delay_timer.SetTimer(corpse_decay_timer.GetRemainingTime() + 1000); } // Added By Hogie -- End - for (int i=0; irezzexp = 0; } @@ -262,13 +261,16 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( PlayerProfile_Struct *pp = &client->GetPP(); ItemInst *item; + /* Check if Zone has Graveyard First */ if(!zone->HasGraveyard()) { corpse_graveyard_timer.Disable(); } memset(item_tint, 0, sizeof(item_tint)); - for (i=0; i < MAX_LOOTERS; i++) - looters[i] = 0; + + for (i = 0; i < MAX_LOOTERS; i++){ + allowed_looters[i] = 0; + } is_corpse_changed = true; rezzexp = in_rezexp; @@ -283,14 +285,16 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( silver = 0; gold = 0; platinum = 0; + strcpy(orgname, pp->name); strcpy(name, pp->name); - //become_npc was not being initialized which led to some pretty funky things with newly created corpses + /* become_npc was not being initialized which led to some pretty funky things with newly created corpses */ become_npc = false; SetPKItem(0); + /* Check Rule to see if we can leave corpses */ if(!RuleB(Character, LeaveNakedCorpses) || RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { @@ -405,16 +409,13 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 returnlist.push_back(equipslot); // Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea. - if(item->IsType(ItemClassContainer) && ((equipslot >= EmuConstants::GENERAL_BEGIN && equipslot <= MainCursor))) // Limit the bag check to inventory and cursor slots. - { - for(bagindex = SUB_BEGIN; bagindex <= EmuConstants::ITEM_CONTAINER_SIZE; bagindex++) - { + if(item->IsType(ItemClassContainer) && ((equipslot >= EmuConstants::GENERAL_BEGIN && equipslot <= MainCursor))) { + for(bagindex = SUB_BEGIN; bagindex <= EmuConstants::ITEM_CONTAINER_SIZE; bagindex++) { // For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1) interior_slot = Inventory::CalcSlotId(equipslot, bagindex); interior_item = client->GetInv().GetItem(interior_slot); - if(interior_item) - { + if(interior_item) { AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4)); returnlist.push_back(Inventory::CalcSlotId(equipslot, bagindex)); client->DeleteItemInInventory(interior_slot, 0, true, false); @@ -485,13 +486,13 @@ in_helmtexture, loot_cooldown_timer(10) { - //we really should be loading the decay timer here... LoadPlayerCorpseDecayTime(in_dbid); if(!zone->HasGraveyard() || wasAtGraveyard) corpse_graveyard_timer.Disable(); memset(item_tint, 0, sizeof(item_tint)); + is_corpse_changed = false; is_player_corpse = true; is_locked = false; @@ -509,8 +510,10 @@ in_helmtexture, this->gold = in_gold; this->platinum = in_plat; rezzexp = in_rezexp; - for (int i=0; iCountItems(); uint32 tmpsize = sizeof(PlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct)); - std::cout << "tmp: " << tmp << std::endl; - std::cout << "tmpsize: " << tmpsize << std::endl; - PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize]; memset(dbpc, 0, tmpsize); dbpc->itemcount = tmp; @@ -594,9 +596,11 @@ bool Corpse::Save() { memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); } + /* Create New Corpse*/ if (corpse_db_id == 0) { corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); } + /* Update Corpse Data */ else{ corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); } @@ -661,23 +665,20 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** cur = itemlist.begin(); end = itemlist.end(); for(; cur != end; ++cur) { - if((*cur)->lootslot == lootslot) - { + if((*cur)->lootslot == lootslot) { sitem = *cur; break; } } - if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) - { + if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot)) { int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, SUB_BEGIN); cur = itemlist.begin(); end = itemlist.end(); for(; cur != end; ++cur) { sitem2 = *cur; - if(sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10) - { + if(sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10) { bag_item_data[sitem2->equip_slot - bagstart] = sitem2; } } @@ -692,8 +693,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - if (item->equip_slot == equipSlot) - { + if (item->equip_slot == equipSlot) { return item->item_id; } } @@ -710,8 +710,7 @@ void Corpse::RemoveItem(uint16 lootslot) { end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; - if (sitem->lootslot == lootslot) - { + if (sitem->lootslot == lootslot) { RemoveItem(sitem); return; } @@ -725,8 +724,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; - if (sitem == item_data) - { + if (sitem == item_data) { is_corpse_changed = true; itemlist.erase(cur); @@ -769,7 +767,7 @@ bool Corpse::Process() { if(corpse_delay_timer.Check()) { for (int i=0; iIsClient()) return; - looters[slot] = them->CastToClient()->CharacterID(); + allowed_looters[slot] = them->CastToClient()->CharacterID(); } // @merth: this function needs some work @@ -1390,8 +1388,8 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { void Corpse::AddLooter(Mob* who) { for (int i=0; iCastToClient()->CharacterID(); + if (allowed_looters[i] == 0) { + allowed_looters[i] = who->CastToClient()->CharacterID(); break; } } diff --git a/zone/corpse.h b/zone/corpse.h index c292823bd..f365dd041 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -26,13 +26,12 @@ class NPC; #define MAX_LOOTERS 72 -class Corpse : public Mob -{ +class Corpse : public Mob { public: + static void SendEndLootErrorPacket(Client* client); static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); @@ -137,7 +136,7 @@ private: bool rez; bool can_rez; bool become_npc; - int looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id + int allowed_looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id Timer corpse_decay_timer; Timer corpse_res_timer; Timer corpse_delay_timer; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 2fb47eb28..a1b7779a8 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3320,115 +3320,50 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list Date: Sun, 23 Nov 2014 23:44:14 -0500 Subject: [PATCH 0316/1883] Swarm pets will no longer assist owners if special ability '34' IMMUNE_AGGRO is set. --- zone/entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index ed5b99219..a17bf9317 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3652,7 +3652,8 @@ void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy) NPC* n = it->second; if (n->GetSwarmInfo()) { if (n->GetSwarmInfo()->owner_id == owner->GetID()) { - n->CastToNPC()->hate_list.Add(other, 0, 0, bFrenzy); + if (!n->GetSpecialAbility(IMMUNE_AGGRO)) + n->hate_list.Add(other, 0, 0, bFrenzy); } } ++it; From e4f45d7b35d1ebd36ce66d38963637ea0e13186a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 22:57:46 -0600 Subject: [PATCH 0317/1883] Removed DBCore::RunQuery Converted last corpse.cpp function that mixed database code with corpse code --- common/database.cpp | 2 +- common/dbcore.cpp | 89 --------------------------------------------- common/dbcore.h | 1 - zone/corpse.cpp | 54 ++++++++------------------- zone/zonedb.cpp | 10 +++++ zone/zonedb.h | 1 + 6 files changed, 28 insertions(+), 129 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 5f8b11cb0..58896f0d1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2303,7 +2303,7 @@ bool Database::CheckDatabaseConversions() { } } } - QueryDatabase(StringFormat("ALTER TABLE `character_corpses` DROP COLUMN `data`")); + QueryDatabase(StringFormat("ALTER TABLE `character_corpses` DROP COLUMN `data`")); } diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 8e609dae8..84d2528f0 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -155,95 +155,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo return requestResult; } -bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum, bool retry) { - if (errnum) - *errnum = 0; - if (errbuf) - errbuf[0] = 0; - bool ret = false; - LockMutex lock(&MDatabase); - if (pStatus != Connected) - Open(); - - if (mysql_real_query(&mysql, query, querylen)) { - if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) - pStatus = Error; - if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) { - if (retry) { - std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl; - ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false); - if (ret) - std::cout << "Reconnection to database successful." << std::endl; - } - else { - pStatus = Error; - if (errnum) - *errnum = mysql_errno(&mysql); - if (errbuf) - snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); - std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; - ret = false; - } - } - else { - if (errnum) - *errnum = mysql_errno(&mysql); - if (errbuf) - snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); -#ifdef _EQDEBUG - std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; -#endif - ret = false; - } - } - else { - if (result && mysql_field_count(&mysql)) { - *result = mysql_store_result(&mysql); -#ifdef _EQDEBUG - DBMemLeak::Alloc(*result, query); -#endif - } - else if (result) - *result = 0; - if (affected_rows) - *affected_rows = mysql_affected_rows(&mysql); - if (last_insert_id) - *last_insert_id = (uint32)mysql_insert_id(&mysql); - if (result) { - if (*result) { - ret = true; - } - else { -#ifdef _EQDEBUG - std::cout << "DB Query Error: No Result" << std::endl; -#endif - if (errnum) - *errnum = UINT_MAX; - if (errbuf) - strcpy(errbuf, "DBcore::RunQuery: No Result"); - ret = false; - } - } - else { - ret = true; - } - } -#if DEBUG_MYSQL_QUERIES >= 1 - if (ret) { - std::cout << "query successful"; - if (result && (*result)) - std::cout << ", " << (int) mysql_num_rows(*result) << " rows returned"; - if (affected_rows) - std::cout << ", " << (*affected_rows) << " rows affected"; - std::cout<< std::endl; - } - else { - std::cout << "QUERY: query FAILED" << std::endl; - } -#endif - return ret; -} - void DBcore::TransactionBegin() { QueryDatabase("START TRANSACTION"); } diff --git a/common/dbcore.h b/common/dbcore.h index 9dd5aef5e..0cdceb61b 100644 --- a/common/dbcore.h +++ b/common/dbcore.h @@ -23,7 +23,6 @@ public: DBcore(); ~DBcore(); eStatus GetStatus() { return pStatus; } - bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true); MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true); MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true); void TransactionBegin(); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a95b279ea..8be978350 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -344,8 +344,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( iter_queue it; for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); ++it,i++) { item = *it; - if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) - { + if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { std::list slot_list = MoveItemToCorpse(client, item, i); removed_list.merge(slot_list); cursor = true; @@ -370,7 +369,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( ++iter; } ss << ")"; - database.RunQuery(ss.str().c_str(), ss.str().length()); + database.QueryDatabase(ss.str().c_str()); } if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) @@ -1395,44 +1394,23 @@ void Corpse::AddLooter(Mob* who) { } } -void Corpse::LoadPlayerCorpseDecayTime(uint32 dbid){ - if(!dbid) +void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){ + if(!corpse_db_id) return; - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; - if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) FROM character_corpses WHERE id=%d and not time_of_death=0", dbid), errbuf, &result)) { - safe_delete_array(query); - while ((row = mysql_fetch_row(result))) { - if(atoi(row[0]) > 0 && RuleI(Character, CorpseDecayTimeMS) > (atoi(row[0]) * 1000)) { - corpse_decay_timer.SetTimer(RuleI(Character, CorpseDecayTimeMS) - (atoi(row[0]) * 1000)); - /* - if(RuleI(Character, CorpseResTimeMS) > (atoi(row[0]) * 1000)) { - corpse_res_timer.SetTimer(RuleI(Character, CorpseResTimeMS) - (atoi(row[0]) * 1000)); - } - else { - corpse_res_timer.Disable(); - can_rez = false; - } - */ - } - else { - corpse_decay_timer.SetTimer(2000); - //corpse_res_timer.SetTimer(300000); - } - if(atoi(row[0]) > 0 && RuleI(Zone, GraveyardTimeMS) > (atoi(row[0]) * 1000)) { - corpse_graveyard_timer.SetTimer(RuleI(Zone, GraveyardTimeMS) - (atoi(row[0]) * 1000)); - } - else { - corpse_graveyard_timer.SetTimer(3000); - } - } - mysql_free_result(result); + uint32 active_corpse_decay_timer = database.GetCharacterCorpseDecayTimer(corpse_db_id); + if (active_corpse_decay_timer > 0 && RuleI(Character, CorpseDecayTimeMS) > (active_corpse_decay_timer * 1000)) { + corpse_decay_timer.SetTimer(RuleI(Character, CorpseDecayTimeMS) - (active_corpse_decay_timer * 1000)); + } + else { + corpse_decay_timer.SetTimer(2000); + } + if (active_corpse_decay_timer > 0 && RuleI(Zone, GraveyardTimeMS) > (active_corpse_decay_timer * 1000)) { + corpse_graveyard_timer.SetTimer(RuleI(Zone, GraveyardTimeMS) - (active_corpse_decay_timer * 1000)); + } + else { + corpse_graveyard_timer.SetTimer(3000); } - else - safe_delete_array(query); } /* diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a1b7779a8..aa05208df 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3367,6 +3367,16 @@ uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, return dbid; } +uint32 ZoneDatabase::GetCharacterCorpseDecayTimer(uint32 corpse_db_id){ + std::string query = StringFormat("SELECT(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) FROM `character_corpses` WHERE `id` = %d AND NOT `time_of_death` = 0", corpse_db_id); + auto results = QueryDatabase(query); + auto row = results.begin(); + if (results.Success() && results.RowsAffected() != 0){ + return atoll(row[0]); + } + return 0; +} + uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) { std::string query = StringFormat("UPDATE `character_corpses` SET \n" "`charname` = '%s',\n" diff --git a/zone/zonedb.h b/zone/zonedb.h index 53f3496cd..33554aac3 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -311,6 +311,7 @@ public: bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); + uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id); uint32 GetCharacterBuriedCorpseCount(uint32 char_id); uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading); uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); From 2f1191b263717c03601b997312a73808614973a2 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 23 Nov 2014 23:17:57 -0600 Subject: [PATCH 0318/1883] Fixing my Swarm Pet "fix". --- zone/npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index eca0f194f..2e5ac4825 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1851,7 +1851,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) Mob *swarmOwner = nullptr; if (GetSwarmOwner()) { - Mob *swarmOwner = entity_list.GetMobID(GetSwarmOwner()); + swarmOwner = entity_list.GetMobID(GetSwarmOwner()); } if (swarmOwner != nullptr) From 3c2b8d13b97175283eb693cfa37bb15d25449e25 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 23 Nov 2014 23:46:06 -0600 Subject: [PATCH 0319/1883] Restructure and refactoring of database convert/upgrade check routine, breaking out to individual functions --- common/database.cpp | 1206 ++++++++++++++++++++++--------------------- common/database.h | 6 +- common/shareddb.cpp | 25 +- common/shareddb.h | 1 - world/net.cpp | 3 - zone/zonedb.cpp | 1 - 6 files changed, 619 insertions(+), 623 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 58896f0d1..77e952d1d 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -896,6 +896,27 @@ static inline void loadbar(unsigned int x, unsigned int n, unsigned int w = 50) } bool Database::CheckDatabaseConversions() { + CheckDatabaseConvertPPDeblob(); + CheckDatabaseConvertBotsPostPPDeblob(); + CheckDatabaseConvertCorpseDeblob(); + + /* Fetch Automatic Database Upgrade Script */ + if (!std::ifstream("db_update.pl")){ + std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; +#ifdef _WIN32 + system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); +#else + system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); +#endif + } + + /* Run Automatic Database Upgrade Script */ + system("perl db_update.pl ran_from_world"); + + return true; +} + +bool Database::CheckDatabaseConvertPPDeblob(){ unsigned int lengths; unsigned int lengths_e; std::string squery; @@ -910,26 +931,26 @@ bool Database::CheckDatabaseConversions() { int runconvert = 0; /* Check For Legacy Storage Method */ - std::string rquery = StringFormat("SHOW TABLES LIKE 'character_'"); + std::string rquery = StringFormat("SHOW TABLES LIKE 'character_'"); auto results = QueryDatabase(rquery); if (results.RowCount() == 1){ - runconvert = 1; + runconvert = 1; printf("\n\n::: Legacy Character Data Binary Blob Storage Detected... \n"); printf("----------------------------------------------------------\n\n"); - printf(" Database currently has character data being stored via \n"); + printf(" Database currently has character data being stored via \n"); printf(" the legacy character storage method and will proceed with converting...\n\n"); printf(" It is recommended that you backup your database \n"); printf(" before continuing the automatic conversion process...\n\n"); printf("----------------------------------------------------------\n\n"); std::cout << "Press ENTER to continue....." << std::endl << std::endl; - std::cin.ignore(1); + std::cin.ignore(1); } // runconvert = 0; // printppdebug = 1; if (runconvert == 1){ - printf("Running character binary blob to database conversion... \n"); + printf("Running character binary blob to database conversion... \n"); /* Get the number of characters */ rquery = StringFormat("SELECT COUNT(`id`) FROM `character_`"); results = QueryDatabase(rquery); @@ -1047,7 +1068,7 @@ bool Database::CheckDatabaseConversions() { "UNIQUE KEY `name` (`name`), " "KEY `account_id` (`account_id`) " ") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1; " - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1078,7 +1099,7 @@ bool Database::CheckDatabaseConversions() { " PRIMARY KEY (`id`), " " KEY `id` (`id`) " " ) ENGINE=InnoDB DEFAULT CHARSET=latin1; " - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1096,7 +1117,7 @@ bool Database::CheckDatabaseConversions() { " PRIMARY KEY(`id`,`slot`), " " KEY `id` (`id`) " " ) ENGINE = InnoDB DEFAULT CHARSET = latin1; " - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1117,8 +1138,8 @@ bool Database::CheckDatabaseConversions() { "`heading` float NOT NULL DEFAULT '0', " "PRIMARY KEY(`id`, `is_home`), " "KEY `id` (`id`) " - ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1135,7 +1156,7 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`, `lang_id`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1144,7 +1165,7 @@ bool Database::CheckDatabaseConversions() { results = QueryDatabase(rquery); if (results.RowCount() == 0){ printf("Table: `character_skills` doesn't exist... creating..."); - rquery = StringFormat( + rquery = StringFormat( "CREATE TABLE `character_skills` ( " "`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, " "`skill_id` smallint(11) UNSIGNED NOT NULL DEFAULT '0', " @@ -1152,7 +1173,7 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`, `skill_id`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1169,10 +1190,10 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`, `slot_id`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); - } + } /* Check for table `character_memmed_spells` */ rquery = StringFormat("SHOW TABLES LIKE 'character_memmed_spells'"); results = QueryDatabase(rquery); @@ -1186,9 +1207,9 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`, `slot_id`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); - printf(" done...\n"); + printf(" done...\n"); } /* Check for table `character_disciplines` */ rquery = StringFormat("SHOW TABLES LIKE 'character_disciplines'"); @@ -1202,8 +1223,8 @@ bool Database::CheckDatabaseConversions() { " `disc_id` smallint(11) UNSIGNED NOT NULL DEFAULT '0', " " PRIMARY KEY(`id`, `slot_id`), " " KEY `id` (`id`) " - " ) ENGINE = InnoDB DEFAULT CHARSET = latin1; " - ); + " ) ENGINE = InnoDB DEFAULT CHARSET = latin1; " + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1212,7 +1233,7 @@ bool Database::CheckDatabaseConversions() { results = QueryDatabase(rquery); if (results.RowCount() == 0){ printf("Table: `character_material` doesn't exist... creating..."); - rquery = StringFormat( + rquery = StringFormat( "CREATE TABLE `character_material` ( " "`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT," "`slot` tinyint(11) UNSIGNED NOT NULL DEFAULT '0'," @@ -1224,10 +1245,10 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`, `slot`)," "KEY `id` (`id`)" ") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); - } + } /* Check for table `character_tribute` */ rquery = StringFormat("SHOW TABLES LIKE 'character_tribute'"); results = QueryDatabase(rquery); @@ -1240,7 +1261,7 @@ bool Database::CheckDatabaseConversions() { "`tribute` int(11) UNSIGNED NOT NULL DEFAULT '0', " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1260,7 +1281,7 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`,`bandolier_id`, `bandolier_slot`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1278,7 +1299,7 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`,`potion_id`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1;" - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } @@ -1311,580 +1332,583 @@ bool Database::CheckDatabaseConversions() { "PRIMARY KEY(`id`,`slot`), " "KEY `id` (`id`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " - ); + ); auto results = QueryDatabase(rquery); printf(" done...\n"); } /* Done */ printf("Starting conversion...\n\n"); - } - int char_iter_count = 0; - rquery = StringFormat("SELECT `id` FROM `character_`"); - results = QueryDatabase(rquery); - uint8 firstlogon = 0; - uint8 lfg = 0; - uint8 lfp = 0; - std::string mailkey; - uint8 xtargets = 0; - std::string inspectmessage; + int char_iter_count = 0; + rquery = StringFormat("SELECT `id` FROM `character_`"); + results = QueryDatabase(rquery); - for (auto row = results.begin(); row != results.end(); ++row) { - char_iter_count++; - squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", atoi(row[0])); - auto results2 = QueryDatabase(squery); - auto row2 = results2.begin(); - pp = (PlayerProfile_Struct*)row2[1]; - e_pp = (ExtendedProfile_Struct*)row2[11]; - character_id = atoi(row[0]); - account_id = atoi(row2[4]); - /* Convert some data from the character_ table that is still relevant */ - firstlogon = atoi(row2[5]); - lfg = atoi(row2[6]); - lfp = atoi(row2[7]); - mailkey = row2[8]; - xtargets = atoi(row2[9]); - inspectmessage = row2[10]; + uint8 firstlogon = 0; + uint8 lfg = 0; + uint8 lfp = 0; + std::string mailkey; + uint8 xtargets = 0; + std::string inspectmessage; - /* Verify PP Integrity */ - lengths = results2.LengthOfColumn(1); - if (lengths == sizeof(PlayerProfile_Struct)) { /* If PP is the size it is expected to be */ - memcpy(pp, row2[1], sizeof(PlayerProfile_Struct)); - } - /* Continue of PP Size does not match (Usually a created character never logged in) */ - else { - // printf("%s ID: %i profile mismatch, not converting. PP %u - Profile Length %u \n", row2[2] ? row2[2] : "Unknown", character_id, sizeof(PlayerProfile_Struct), lengths); - std::cout << (row2[2] ? row2[2] : "Unknown") << " ID: " << character_id << " size mismatch. Expected Size: " << sizeof(PlayerProfile_Struct) << " Seen: " << lengths << std::endl; - continue; - } + for (auto row = results.begin(); row != results.end(); ++row) { + char_iter_count++; + squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", atoi(row[0])); + auto results2 = QueryDatabase(squery); + auto row2 = results2.begin(); + pp = (PlayerProfile_Struct*)row2[1]; + e_pp = (ExtendedProfile_Struct*)row2[11]; + character_id = atoi(row[0]); + account_id = atoi(row2[4]); + /* Convert some data from the character_ table that is still relevant */ + firstlogon = atoi(row2[5]); + lfg = atoi(row2[6]); + lfp = atoi(row2[7]); + mailkey = row2[8]; + xtargets = atoi(row2[9]); + inspectmessage = row2[10]; - lengths_e = results2.LengthOfColumn(11); - if (lengths_e == sizeof(ExtendedProfile_Struct)) { - memcpy(e_pp, row2[11], sizeof(ExtendedProfile_Struct)); - } - if (e_pp->expended_aa > 4000000){ e_pp->expended_aa = 0; } - - /* Loading Status on conversion */ - if (runconvert == 1){ - std::cout << "\r" << char_iter_count << "/" << number_of_characters << " " << std::flush; - loadbar(char_iter_count, number_of_characters, 50); - - /* Run inspect message convert */ - if (inspectmessage != ""){ - std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)" - "VALUES (%u, '%s')", - character_id, - EscapeString(inspectmessage).c_str() - ); - auto results = QueryDatabase(rquery); + /* Verify PP Integrity */ + lengths = results2.LengthOfColumn(1); + if (lengths == sizeof(PlayerProfile_Struct)) { /* If PP is the size it is expected to be */ + memcpy(pp, row2[1], sizeof(PlayerProfile_Struct)); + } + /* Continue of PP Size does not match (Usually a created character never logged in) */ + else { + // printf("%s ID: %i profile mismatch, not converting. PP %u - Profile Length %u \n", row2[2] ? row2[2] : "Unknown", character_id, sizeof(PlayerProfile_Struct), lengths); + std::cout << (row2[2] ? row2[2] : "Unknown") << " ID: " << character_id << " size mismatch. Expected Size: " << sizeof(PlayerProfile_Struct) << " Seen: " << lengths << std::endl; + continue; } - /* Run Currency Convert */ - std::string rquery = StringFormat("REPLACE INTO `character_currency` (id, platinum, gold, silver, copper," - "platinum_bank, gold_bank, silver_bank, copper_bank," - "platinum_cursor, gold_cursor, silver_cursor, copper_cursor, " - "radiant_crystals, career_radiant_crystals, ebon_crystals, career_ebon_crystals)" - "VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u)", - character_id, - pp->platinum, - pp->gold, - pp->silver, - pp->copper, - pp->platinum_bank, - pp->gold_bank, - pp->silver_bank, - pp->copper_bank, - pp->platinum_cursor, - pp->gold_cursor, - pp->silver_cursor, - pp->copper_cursor, - pp->currentRadCrystals, - pp->careerRadCrystals, - pp->currentEbonCrystals, - pp->careerEbonCrystals - ); - auto results = QueryDatabase(rquery); + lengths_e = results2.LengthOfColumn(11); + if (lengths_e == sizeof(ExtendedProfile_Struct)) { + memcpy(e_pp, row2[11], sizeof(ExtendedProfile_Struct)); + } + if (e_pp->expended_aa > 4000000){ e_pp->expended_aa = 0; } - if (pp->tribute_time_remaining < 0 || pp->tribute_time_remaining == 4294967295){ pp->tribute_time_remaining = 0; } + /* Loading Status on conversion */ + if (runconvert == 1){ + std::cout << "\r" << char_iter_count << "/" << number_of_characters << " " << std::flush; + loadbar(char_iter_count, number_of_characters, 50); - /* Run Character Data Convert */ - rquery = StringFormat( - "REPLACE INTO `character_data` (" - "id," - "account_id," - "`name`," - "last_name," - "gender," - "race," - "class," - "`level`," - "deity," - "birthday," - "last_login," - "time_played," - "pvp_status," - "level2," - "anon," - "gm," - "intoxication," - "hair_color," - "beard_color," - "eye_color_1," - "eye_color_2," - "hair_style," - "beard," - "ability_time_seconds," - "ability_number," - "ability_time_minutes," - "ability_time_hours," - "title," - "suffix," - "exp," - "points," - "mana," - "cur_hp," - "str," - "sta," - "cha," - "dex," - "`int`," - "agi," - "wis," - "face," - "y," - "x," - "z," - "heading," - "pvp2," - "pvp_type," - "autosplit_enabled," - "zone_change_count," - "drakkin_heritage," - "drakkin_tattoo," - "drakkin_details," - "toxicity," - "hunger_level," - "thirst_level," - "ability_up," - "zone_id," - "zone_instance," - "leadership_exp_on," - "ldon_points_guk," - "ldon_points_mir," - "ldon_points_mmc," - "ldon_points_ruj," - "ldon_points_tak," - "ldon_points_available," - "tribute_time_remaining," - "show_helm," - "career_tribute_points," - "tribute_points," - "tribute_active," - "endurance," - "group_leadership_exp," - "raid_leadership_exp," - "group_leadership_points," - "raid_leadership_points," - "air_remaining," - "pvp_kills," - "pvp_deaths," - "pvp_current_points," - "pvp_career_points," - "pvp_best_kill_streak," - "pvp_worst_death_streak," - "pvp_current_kill_streak," - "aa_points_spent," - "aa_exp," - "aa_points," - "group_auto_consent," - "raid_auto_consent," - "guild_auto_consent," - "RestTimer," - "firstlogon," - "lfg," - "lfp," - "mailkey," - "xtargets," - "e_aa_effects," - "e_percent_to_aa," - "e_expended_aa_spent" - ")" - "VALUES (" - "%u," // id - "%u," // account_id - "'%s'," // `name` - "'%s'," // last_name - "%u," // gender - "%u," // race - "%u," // class - "%u," // `level` - "%u," // deity - "%u," // birthday - "%u," // last_login - "%u," // time_played - "%u," // pvp_status - "%u," // level2 - "%u," // anon - "%u," // gm - "%u," // intoxication - "%u," // hair_color - "%u," // beard_color - "%u," // eye_color_1 - "%u," // eye_color_2 - "%u," // hair_style - "%u," // beard - "%u," // ability_time_seconds - "%u," // ability_number - "%u," // ability_time_minutes - "%u," // ability_time_hours - "'%s'," // title - "'%s'," // suffix - "%u," // exp - "%u," // points - "%u," // mana - "%u," // cur_hp - "%u," // str - "%u," // sta - "%u," // cha - "%u," // dex - "%u," // `int` - "%u," // agi - "%u," // wis - "%u," // face - "%f," // y - "%f," // x - "%f," // z - "%f," // heading - "%u," // pvp2 - "%u," // pvp_type - "%u," // autosplit_enabled - "%u," // zone_change_count - "%u," // drakkin_heritage - "%u," // drakkin_tattoo - "%u," // drakkin_details - "%i," // toxicity - "%u," // hunger_level - "%u," // thirst_level - "%u," // ability_up - "%u," // zone_id - "%u," // zone_instance - "%u," // leadership_exp_on - "%u," // ldon_points_guk - "%u," // ldon_points_mir - "%u," // ldon_points_mmc - "%u," // ldon_points_ruj - "%u," // ldon_points_tak - "%u," // ldon_points_available - "%u," // tribute_time_remaining - "%u," // show_helm - "%u," // career_tribute_points - "%u," // tribute_points - "%u," // tribute_active - "%u," // endurance - "%u," // group_leadership_exp - "%u," // raid_leadership_exp - "%u," // group_leadership_points - "%u," // raid_leadership_points - "%u," // air_remaining - "%u," // pvp_kills - "%u," // pvp_deaths - "%u," // pvp_current_points - "%u," // pvp_career_points - "%u," // pvp_best_kill_streak - "%u," // pvp_worst_death_streak - "%u," // pvp_current_kill_streak - "%u," // aa_points_spent - "%u," // aa_exp - "%u," // aa_points - "%u," // group_auto_consent - "%u," // raid_auto_consent - "%u," // guild_auto_consent - "%u," // RestTimer - "%u," // First Logon - References online status for EVENT_CONNECT/EVENT_DISCONNECt - "%u," // Looking for Group - "%u," // Looking for P? - "'%s'," // Mailkey - "%u," // X Targets - "%u," // AA Effects - "%u," // Percent to AA - "%u" // e_expended_aa_spent - ")", - character_id, - account_id, - EscapeString(pp->name).c_str(), - EscapeString(pp->last_name).c_str(), - pp->gender, - pp->race, - pp->class_, - pp->level, - pp->deity, - pp->birthday, - pp->lastlogin, - pp->timePlayedMin, - pp->pvp, - pp->level2, - pp->anon, - pp->gm, - pp->intoxication, - pp->haircolor, - pp->beardcolor, - pp->eyecolor1, - pp->eyecolor2, - pp->hairstyle, - pp->beard, - pp->ability_time_seconds, - pp->ability_number, - pp->ability_time_minutes, - pp->ability_time_hours, - EscapeString(pp->title).c_str(), - EscapeString(pp->suffix).c_str(), - pp->exp, - pp->points, - pp->mana, - pp->cur_hp, - pp->STR, - pp->STA, - pp->CHA, - pp->DEX, - pp->INT, - pp->AGI, - pp->WIS, - pp->face, - pp->y, - pp->x, - pp->z, - pp->heading, - pp->pvp2, - pp->pvptype, - pp->autosplit, - pp->zone_change_count, - pp->drakkin_heritage, - pp->drakkin_tattoo, - pp->drakkin_details, - pp->toxicity, - pp->hunger_level, - pp->thirst_level, - pp->ability_up, - pp->zone_id, - pp->zoneInstance, - pp->leadAAActive == 0 ? 0 : 1, - pp->ldon_points_guk, - pp->ldon_points_mir, - pp->ldon_points_mmc, - pp->ldon_points_ruj, - pp->ldon_points_tak, - pp->ldon_points_available, - pp->tribute_time_remaining, - pp->showhelm, - pp->career_tribute_points, - pp->tribute_points, - pp->tribute_active, - pp->endurance, - pp->group_leadership_exp, - pp->raid_leadership_exp, - pp->group_leadership_points, - pp->raid_leadership_points, - pp->air_remaining, - pp->PVPKills, - pp->PVPDeaths, - pp->PVPCurrentPoints, - pp->PVPCareerPoints, - pp->PVPBestKillStreak, - pp->PVPWorstDeathStreak, - pp->PVPCurrentKillStreak, - pp->aapoints_spent, - pp->expAA, - pp->aapoints, - pp->groupAutoconsent, - pp->raidAutoconsent, - pp->guildAutoconsent, - pp->RestTimer, - firstlogon, - lfg, - lfp, - mailkey.c_str(), - xtargets, - e_pp->aa_effects, - e_pp->perAA, - e_pp->expended_aa - ); - results = QueryDatabase(rquery); - + /* Run inspect message convert */ + if (inspectmessage != ""){ + std::string rquery = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message)" + "VALUES (%u, '%s')", + character_id, + EscapeString(inspectmessage).c_str() + ); + auto results = QueryDatabase(rquery); + } - /* + /* Run Currency Convert */ + std::string rquery = StringFormat("REPLACE INTO `character_currency` (id, platinum, gold, silver, copper," + "platinum_bank, gold_bank, silver_bank, copper_bank," + "platinum_cursor, gold_cursor, silver_cursor, copper_cursor, " + "radiant_crystals, career_radiant_crystals, ebon_crystals, career_ebon_crystals)" + "VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u)", + character_id, + pp->platinum, + pp->gold, + pp->silver, + pp->copper, + pp->platinum_bank, + pp->gold_bank, + pp->silver_bank, + pp->copper_bank, + pp->platinum_cursor, + pp->gold_cursor, + pp->silver_cursor, + pp->copper_cursor, + pp->currentRadCrystals, + pp->careerRadCrystals, + pp->currentEbonCrystals, + pp->careerEbonCrystals + ); + auto results = QueryDatabase(rquery); + + if (pp->tribute_time_remaining < 0 || pp->tribute_time_remaining == 4294967295){ pp->tribute_time_remaining = 0; } + + /* Run Character Data Convert */ + rquery = StringFormat( + "REPLACE INTO `character_data` (" + "id," + "account_id," + "`name`," + "last_name," + "gender," + "race," + "class," + "`level`," + "deity," + "birthday," + "last_login," + "time_played," + "pvp_status," + "level2," + "anon," + "gm," + "intoxication," + "hair_color," + "beard_color," + "eye_color_1," + "eye_color_2," + "hair_style," + "beard," + "ability_time_seconds," + "ability_number," + "ability_time_minutes," + "ability_time_hours," + "title," + "suffix," + "exp," + "points," + "mana," + "cur_hp," + "str," + "sta," + "cha," + "dex," + "`int`," + "agi," + "wis," + "face," + "y," + "x," + "z," + "heading," + "pvp2," + "pvp_type," + "autosplit_enabled," + "zone_change_count," + "drakkin_heritage," + "drakkin_tattoo," + "drakkin_details," + "toxicity," + "hunger_level," + "thirst_level," + "ability_up," + "zone_id," + "zone_instance," + "leadership_exp_on," + "ldon_points_guk," + "ldon_points_mir," + "ldon_points_mmc," + "ldon_points_ruj," + "ldon_points_tak," + "ldon_points_available," + "tribute_time_remaining," + "show_helm," + "career_tribute_points," + "tribute_points," + "tribute_active," + "endurance," + "group_leadership_exp," + "raid_leadership_exp," + "group_leadership_points," + "raid_leadership_points," + "air_remaining," + "pvp_kills," + "pvp_deaths," + "pvp_current_points," + "pvp_career_points," + "pvp_best_kill_streak," + "pvp_worst_death_streak," + "pvp_current_kill_streak," + "aa_points_spent," + "aa_exp," + "aa_points," + "group_auto_consent," + "raid_auto_consent," + "guild_auto_consent," + "RestTimer," + "firstlogon," + "lfg," + "lfp," + "mailkey," + "xtargets," + "e_aa_effects," + "e_percent_to_aa," + "e_expended_aa_spent" + ")" + "VALUES (" + "%u," // id + "%u," // account_id + "'%s'," // `name` + "'%s'," // last_name + "%u," // gender + "%u," // race + "%u," // class + "%u," // `level` + "%u," // deity + "%u," // birthday + "%u," // last_login + "%u," // time_played + "%u," // pvp_status + "%u," // level2 + "%u," // anon + "%u," // gm + "%u," // intoxication + "%u," // hair_color + "%u," // beard_color + "%u," // eye_color_1 + "%u," // eye_color_2 + "%u," // hair_style + "%u," // beard + "%u," // ability_time_seconds + "%u," // ability_number + "%u," // ability_time_minutes + "%u," // ability_time_hours + "'%s'," // title + "'%s'," // suffix + "%u," // exp + "%u," // points + "%u," // mana + "%u," // cur_hp + "%u," // str + "%u," // sta + "%u," // cha + "%u," // dex + "%u," // `int` + "%u," // agi + "%u," // wis + "%u," // face + "%f," // y + "%f," // x + "%f," // z + "%f," // heading + "%u," // pvp2 + "%u," // pvp_type + "%u," // autosplit_enabled + "%u," // zone_change_count + "%u," // drakkin_heritage + "%u," // drakkin_tattoo + "%u," // drakkin_details + "%i," // toxicity + "%u," // hunger_level + "%u," // thirst_level + "%u," // ability_up + "%u," // zone_id + "%u," // zone_instance + "%u," // leadership_exp_on + "%u," // ldon_points_guk + "%u," // ldon_points_mir + "%u," // ldon_points_mmc + "%u," // ldon_points_ruj + "%u," // ldon_points_tak + "%u," // ldon_points_available + "%u," // tribute_time_remaining + "%u," // show_helm + "%u," // career_tribute_points + "%u," // tribute_points + "%u," // tribute_active + "%u," // endurance + "%u," // group_leadership_exp + "%u," // raid_leadership_exp + "%u," // group_leadership_points + "%u," // raid_leadership_points + "%u," // air_remaining + "%u," // pvp_kills + "%u," // pvp_deaths + "%u," // pvp_current_points + "%u," // pvp_career_points + "%u," // pvp_best_kill_streak + "%u," // pvp_worst_death_streak + "%u," // pvp_current_kill_streak + "%u," // aa_points_spent + "%u," // aa_exp + "%u," // aa_points + "%u," // group_auto_consent + "%u," // raid_auto_consent + "%u," // guild_auto_consent + "%u," // RestTimer + "%u," // First Logon - References online status for EVENT_CONNECT/EVENT_DISCONNECt + "%u," // Looking for Group + "%u," // Looking for P? + "'%s'," // Mailkey + "%u," // X Targets + "%u," // AA Effects + "%u," // Percent to AA + "%u" // e_expended_aa_spent + ")", + character_id, + account_id, + EscapeString(pp->name).c_str(), + EscapeString(pp->last_name).c_str(), + pp->gender, + pp->race, + pp->class_, + pp->level, + pp->deity, + pp->birthday, + pp->lastlogin, + pp->timePlayedMin, + pp->pvp, + pp->level2, + pp->anon, + pp->gm, + pp->intoxication, + pp->haircolor, + pp->beardcolor, + pp->eyecolor1, + pp->eyecolor2, + pp->hairstyle, + pp->beard, + pp->ability_time_seconds, + pp->ability_number, + pp->ability_time_minutes, + pp->ability_time_hours, + EscapeString(pp->title).c_str(), + EscapeString(pp->suffix).c_str(), + pp->exp, + pp->points, + pp->mana, + pp->cur_hp, + pp->STR, + pp->STA, + pp->CHA, + pp->DEX, + pp->INT, + pp->AGI, + pp->WIS, + pp->face, + pp->y, + pp->x, + pp->z, + pp->heading, + pp->pvp2, + pp->pvptype, + pp->autosplit, + pp->zone_change_count, + pp->drakkin_heritage, + pp->drakkin_tattoo, + pp->drakkin_details, + pp->toxicity, + pp->hunger_level, + pp->thirst_level, + pp->ability_up, + pp->zone_id, + pp->zoneInstance, + pp->leadAAActive == 0 ? 0 : 1, + pp->ldon_points_guk, + pp->ldon_points_mir, + pp->ldon_points_mmc, + pp->ldon_points_ruj, + pp->ldon_points_tak, + pp->ldon_points_available, + pp->tribute_time_remaining, + pp->showhelm, + pp->career_tribute_points, + pp->tribute_points, + pp->tribute_active, + pp->endurance, + pp->group_leadership_exp, + pp->raid_leadership_exp, + pp->group_leadership_points, + pp->raid_leadership_points, + pp->air_remaining, + pp->PVPKills, + pp->PVPDeaths, + pp->PVPCurrentPoints, + pp->PVPCareerPoints, + pp->PVPBestKillStreak, + pp->PVPWorstDeathStreak, + pp->PVPCurrentKillStreak, + pp->aapoints_spent, + pp->expAA, + pp->aapoints, + pp->groupAutoconsent, + pp->raidAutoconsent, + pp->guildAutoconsent, + pp->RestTimer, + firstlogon, + lfg, + lfp, + mailkey.c_str(), + xtargets, + e_pp->aa_effects, + e_pp->perAA, + e_pp->expended_aa + ); + results = QueryDatabase(rquery); + + + /* We set a first entry variable because we need the first initial piece of the query to be declared This is to speed up the INSERTS and trim down the amount of individual sends during the process. The speed difference is dramatic - */ - /* Run AA Convert */ - int first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_AA_ARRAY; i++){ - if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value)" - " VALUES (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value); - first_entry = 1; - } else { - rquery = rquery + StringFormat(", (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value); - } - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - - /* Run Bind Home Convert */ - if(pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) { - rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" - " VALUES (%u, %u, %u, %f, %f, %f, %f, 1)", - character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading); - if (rquery != ""){ results = QueryDatabase(rquery); } - } - - /* Run Bind Convert */ - if(pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) { - rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" - " VALUES (%u, %u, %u, %f, %f, %f, %f, 0)", - character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading); - if (rquery != ""){ results = QueryDatabase(rquery); } - } - /* Run Language Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_LANGUAGE; i++){ - if (pp->languages[i] > 0){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, i, pp->languages[i]); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Skill Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_SKILL; i++){ - if (pp->skills[i] > 0){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, i, pp->skills[i]); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Spell Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){ - if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->spell_book[i]); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->spell_book[i]); - } - } - // std::cout << rquery << "\n"; - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Max Memmed Spell Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){ - if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->mem_spells[i]); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Discipline Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_PP_DISCIPLINES; i++){ - if(pp->disciplines.values[i] > 0 && pp->disciplines.values[i] < 60000){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Material Color Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < _MaterialCount; i++){ - if (pp->item_tint[i].color > 0){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Tribute Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ - if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); - } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Bandolier Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ - 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 (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); - 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); + */ + /* Run AA Convert */ + int first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_AA_ARRAY; i++){ + if (pp->aa_array[i].AA > 0 && pp->aa_array[i].value > 0){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value)" + " VALUES (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value); + first_entry = 1; + } + else { + rquery = rquery + StringFormat(", (%u, %u, %u, %u)", character_id, i, pp->aa_array[i].AA, pp->aa_array[i].value); } } } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* 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 (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); - first_entry = 1; - } - rquery = rquery + StringFormat(", (%i, %u, %u, %u)", character_id, i, pp->potionbelt.items[i].item_id, pp->potionbelt.items[i].icon); + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Bind Home Convert */ + if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) { + rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" + " VALUES (%u, %u, %u, %f, %f, %f, %f, 1)", + character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading); + if (rquery != ""){ results = QueryDatabase(rquery); } } - } - if (rquery != ""){ results = QueryDatabase(rquery); } - /* Run Leadership AA Convert */ - first_entry = 0; rquery = ""; - for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){ - if(pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){ - if (first_entry != 1){ - rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); - first_entry = 1; + + /* Run Bind Convert */ + if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) { + rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" + " VALUES (%u, %u, %u, %f, %f, %f, %f, 0)", + character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading); + if (rquery != ""){ results = QueryDatabase(rquery); } + } + /* Run Language Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_LANGUAGE; i++){ + if (pp->languages[i] > 0){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, i, pp->languages[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->languages[i]); } - rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); } - } - if (rquery != ""){ results = QueryDatabase(rquery); } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Skill Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_SKILL; i++){ + if (pp->skills[i] > 0){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, i, pp->skills[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->skills[i]); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Spell Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_REF_SPELLBOOK; i++){ + if (pp->spell_book[i] > 0 && pp->spell_book[i] != 4294967295 && pp->spell_book[i] < 40000 && pp->spell_book[i] != 1){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->spell_book[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->spell_book[i]); + } + } + // std::cout << rquery << "\n"; + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Max Memmed Spell Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_REF_MEMSPELL; i++){ + if (pp->mem_spells[i] > 0 && pp->mem_spells[i] != 65535 && pp->mem_spells[i] != 4294967295){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, i, pp->mem_spells[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->mem_spells[i]); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Discipline Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_PP_DISCIPLINES; i++){ + if (pp->disciplines.values[i] > 0 && pp->disciplines.values[i] < 60000){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->disciplines.values[i]); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Material Color Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < _MaterialCount; i++){ + if (pp->item_tint[i].color > 0){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Tribute Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ + if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Bandolier Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++){ + 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 (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); + 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); + } + } + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* 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 (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); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%i, %u, %u, %u)", character_id, i, pp->potionbelt.items[i].item_id, pp->potionbelt.items[i].icon); + + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + /* Run Leadership AA Convert */ + first_entry = 0; rquery = ""; + for (i = 0; i < MAX_LEADERSHIP_AA_ARRAY; i++){ + if (pp->leader_abilities.ranks[i] > 0 && pp->leader_abilities.ranks[i] < 6){ + if (first_entry != 1){ + rquery = StringFormat("REPLACE INTO `character_leadership_abilities` (id, slot, rank) VALUES (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); + first_entry = 1; + } + rquery = rquery + StringFormat(", (%i, %u, %u)", character_id, i, pp->leader_abilities.ranks[i]); + } + } + if (rquery != ""){ results = QueryDatabase(rquery); } + } + } + if (runconvert == 1){ + std::string rquery = StringFormat("RENAME TABLE `character_` TO `character_old`"); QueryDatabase(rquery); + printf("\n\nRenaming `character_` table to `character_old`, this is a LARGE table so when you don't need it anymore, I would suggest deleting it yourself...\n"); + printf("\n\nCharacter blob conversion complete, continuing world bootup...\n"); } } - if (runconvert == 1){ - std::string rquery = StringFormat("RENAME TABLE `character_` TO `character_old`"); QueryDatabase(rquery); - printf("\n\nRenaming `character_` table to `character_old`, this is a LARGE table so when you don't need it anymore, I would suggest deleting it yourself...\n"); - printf("\n\nCharacter blob conversion complete, continuing world bootup...\n"); - } - + return true; +} +bool Database::CheckDatabaseConvertBotsPostPPDeblob(){ #ifdef BOTS - int runbotsconvert = 0; /* Check For Legacy Bot References */ @@ -2037,7 +2061,10 @@ bool Database::CheckDatabaseConversions() { } #endif + return true; +} +bool Database::CheckDatabaseConvertCorpseDeblob(){ DBPlayerCorpse_Struct_temp* dbpc; classic_db_temp::DBPlayerCorpse_Struct_temp* dbpc_c; uint32 in_datasize; @@ -2046,13 +2073,13 @@ bool Database::CheckDatabaseConversions() { std::string scquery; int8 first_entry = 0; - rquery = StringFormat("SHOW COLUMNS FROM `character_corpses` LIKE 'data'"); - results = QueryDatabase(rquery); + std::string rquery = StringFormat("SHOW COLUMNS FROM `character_corpses` LIKE 'data'"); + auto results = QueryDatabase(rquery); if (results.RowCount() != 0){ rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses"); results = QueryDatabase(rquery); for (auto row = results.begin(); row != results.end(); ++row) { - squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", atoi(row[0])); + std::string squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", atoi(row[0])); auto results2 = QueryDatabase(squery); for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) { in_datasize = results2.LengthOfColumn(2); @@ -2262,7 +2289,7 @@ bool Database::CheckDatabaseConversions() { dbpc_c->item_tint[8].color, atoi(row2[0]) ); - if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } + if (scquery != ""){ auto sc_results = QueryDatabase(scquery); } first_entry = 0; scquery = ""; @@ -2303,23 +2330,8 @@ bool Database::CheckDatabaseConversions() { } } } - QueryDatabase(StringFormat("ALTER TABLE `character_corpses` DROP COLUMN `data`")); + QueryDatabase(StringFormat("ALTER TABLE `character_corpses` DROP COLUMN `data`")); } - - - /* Fetch Automatic Database Upgrade Script */ - if (!std::ifstream("db_update.pl")){ - std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; -#ifdef _WIN32 - system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); -#else - system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); -#endif - } - - /* Run Automatic Database Upgrade Script */ - system("perl db_update.pl ran_from_world"); - return true; } @@ -3864,9 +3876,7 @@ bool Database::RemoveClientsFromInstance(uint16 instance_id) return results.Success(); } -bool Database::CheckInstanceExists(uint16 instance_id) -{ - +bool Database::CheckInstanceExists(uint16 instance_id) { std::string query = StringFormat("SELECT * FROM instance_list where id=%u", instance_id); auto results = QueryDatabase(query); @@ -3879,15 +3889,12 @@ bool Database::CheckInstanceExists(uint16 instance_id) return true; } -void Database::BuryCorpsesInInstance(uint16 instance_id) -{ - - std::string query = StringFormat("UPDATE character_corpses SET IsBurried=1, instanceid=0 WHERE instanceid=%u", instance_id); +void Database::BuryCorpsesInInstance(uint16 instance_id) { + std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1, `instance_id` =0 WHERE `instance_id` = %u", instance_id); auto results = QueryDatabase(query); } -uint16 Database::GetInstanceVersion(uint16 instance_id) -{ +uint16 Database::GetInstanceVersion(uint16 instance_id) { if(instance_id == 0) return 0; @@ -3904,8 +3911,7 @@ uint16 Database::GetInstanceVersion(uint16 instance_id) return atoi(row[0]); } -uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) -{ +uint16 Database::GetInstanceID(const char* zone, uint32 charid, int16 version) { std::string query = StringFormat("SELECT instance_list.id FROM instance_list, instance_list_player " "WHERE instance_list.zone=%u AND instance_list.version=%u AND instance_list.id=instance_list_player.id AND " diff --git a/common/database.h b/common/database.h index 04353b657..3581c9367 100644 --- a/common/database.h +++ b/common/database.h @@ -301,7 +301,11 @@ public: void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid); void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0); - bool CheckDatabaseConversions(); + /* Database Conversions*/ + bool CheckDatabaseConversions(); + bool CheckDatabaseConvertPPDeblob(); + bool CheckDatabaseConvertCorpseDeblob(); + bool CheckDatabaseConvertBotsPostPPDeblob(); /* * Database Variables diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 9948f6e00..d543db87f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1215,11 +1215,11 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) } int32 SharedDatabase::DeleteStalePlayerCorpses() { - if(RuleB(Zone, EnableShadowrest)) - { - std::string query = StringFormat("UPDATE character_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND " - "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d AND NOT time_of_death = 0", - (RuleI(Character, CorpseDecayTimeMS) / 1000)); + if(RuleB(Zone, EnableShadowrest)) { + std::string query = StringFormat( + "UPDATE `character_corpses` SET `is_buried` = 1 WHERE `is_buried` = 0 AND " + "(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d AND NOT time_of_death = 0", + (RuleI(Character, CorpseDecayTimeMS) / 1000)); auto results = QueryDatabase(query); if (!results.Success()) return -1; @@ -1227,8 +1227,9 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { return results.RowsAffected(); } - std::string query = StringFormat("DELETE FROM character_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d " - "AND NOT time_of_death = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); + std::string query = StringFormat( + "DELETE FROM `character_corpses` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d " + "AND NOT time_of_death = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000)); auto results = QueryDatabase(query); if (!results.Success()) return -1; @@ -1236,16 +1237,6 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() { return results.RowsAffected(); } -int32 SharedDatabase::DeleteStalePlayerBackups() { - // 1209600 seconds = 2 weeks - const std::string query = "DELETE FROM player_corpses_backup WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > 1209600"; - auto results = QueryDatabase(query); - if (!results.Success()) - return -1; - - return results.RowsAffected(); -} - bool SharedDatabase::GetCommandSettings(std::map &commands) { const std::string query = "SELECT command, access FROM commands"; diff --git a/common/shareddb.h b/common/shareddb.h index 14793f792..0b0dcf839 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -41,7 +41,6 @@ public: uint8 GetGMSpeed(uint32 account_id); bool SetHideMe(uint32 account_id, uint8 hideme); int32 DeleteStalePlayerCorpses(); - int32 DeleteStalePlayerBackups(); void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message); void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message); void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message); diff --git a/world/net.cpp b/world/net.cpp index eb2721c92..ee1158520 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -336,9 +336,6 @@ int main(int argc, char** argv) { _log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); _log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - if (RuleB(World, DeleteStaleCorpeBackups) == true) { - _log(WORLD__INIT, "Deleted %i stale player backups from database", database.DeleteStalePlayerBackups()); - } _log(WORLD__INIT, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index aa05208df..11d76e4af 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3699,7 +3699,6 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct corpse_id ); auto results = QueryDatabase(query); - std::cout << query << std::endl; uint16 i = 0; for (auto row = results.begin(); row != results.end(); ++row) { pcs->locked = atoi(row[i++]); // is_locked, From a5207b58e1ad622c5097ebc04799dc40fcf1ee2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 24 Nov 2014 01:12:12 -0600 Subject: [PATCH 0320/1883] Added namespace Convert:: to contain all of the player profile and corpse related structs so that when any of the structs change else where in the code, it does not break the conversion scripts. These are self contained structs just for the conversion scripts. --- common/database.cpp | 24 +-- common/database.h | 414 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 381 insertions(+), 57 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 77e952d1d..406cb5360 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -920,7 +920,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ unsigned int lengths; unsigned int lengths_e; std::string squery; - PlayerProfile_Struct* pp; + Convert::PlayerProfile_Struct* pp; ExtendedProfile_Struct* e_pp; uint32 pplen = 0; uint32 i; @@ -1357,7 +1357,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ squery = StringFormat("SELECT `id`, `profile`, `name`, `level`, `account_id`, `firstlogon`, `lfg`, `lfp`, `mailkey`, `xtargets`, `inspectmessage`, `extprofile` FROM `character_` WHERE `id` = %i", atoi(row[0])); auto results2 = QueryDatabase(squery); auto row2 = results2.begin(); - pp = (PlayerProfile_Struct*)row2[1]; + pp = (Convert::PlayerProfile_Struct*)row2[1]; e_pp = (ExtendedProfile_Struct*)row2[11]; character_id = atoi(row[0]); account_id = atoi(row2[4]); @@ -1371,13 +1371,13 @@ bool Database::CheckDatabaseConvertPPDeblob(){ /* Verify PP Integrity */ lengths = results2.LengthOfColumn(1); - if (lengths == sizeof(PlayerProfile_Struct)) { /* If PP is the size it is expected to be */ - memcpy(pp, row2[1], sizeof(PlayerProfile_Struct)); + if (lengths == sizeof(Convert::PlayerProfile_Struct)) { /* If PP is the size it is expected to be */ + memcpy(pp, row2[1], sizeof(Convert::PlayerProfile_Struct)); } /* Continue of PP Size does not match (Usually a created character never logged in) */ else { // printf("%s ID: %i profile mismatch, not converting. PP %u - Profile Length %u \n", row2[2] ? row2[2] : "Unknown", character_id, sizeof(PlayerProfile_Struct), lengths); - std::cout << (row2[2] ? row2[2] : "Unknown") << " ID: " << character_id << " size mismatch. Expected Size: " << sizeof(PlayerProfile_Struct) << " Seen: " << lengths << std::endl; + std::cout << (row2[2] ? row2[2] : "Unknown") << " ID: " << character_id << " size mismatch. Expected Size: " << sizeof(Convert::PlayerProfile_Struct) << " Seen: " << lengths << std::endl; continue; } @@ -1730,7 +1730,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){ e_pp->aa_effects, e_pp->perAA, e_pp->expended_aa - ); + ); results = QueryDatabase(rquery); @@ -2065,8 +2065,8 @@ bool Database::CheckDatabaseConvertBotsPostPPDeblob(){ } bool Database::CheckDatabaseConvertCorpseDeblob(){ - DBPlayerCorpse_Struct_temp* dbpc; - classic_db_temp::DBPlayerCorpse_Struct_temp* dbpc_c; + Convert::DBPlayerCorpse_Struct_temp* dbpc; + Convert::classic_db_temp::DBPlayerCorpse_Struct_temp* dbpc_c; uint32 in_datasize; bool is_sof = false; std::string c_type; @@ -2083,8 +2083,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ auto results2 = QueryDatabase(squery); for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) { in_datasize = results2.LengthOfColumn(2); - dbpc = (DBPlayerCorpse_Struct_temp*)row2[2]; - dbpc_c = (classic_db_temp::DBPlayerCorpse_Struct_temp*)row2[2]; + dbpc = (Convert::DBPlayerCorpse_Struct_temp*)row2[2]; + dbpc_c = (Convert::classic_db_temp::DBPlayerCorpse_Struct_temp*)row2[2]; if (dbpc == nullptr) continue; @@ -2093,8 +2093,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ /* SoF+ */ - uint32 esize1 = (sizeof(DBPlayerCorpse_Struct_temp)+(dbpc->itemcount * sizeof(player_lootitem_temp::ServerLootItem_Struct_temp))); - uint32 esize2 = (sizeof(classic_db_temp::DBPlayerCorpse_Struct_temp) + (dbpc_c->itemcount * sizeof(player_lootitem_temp::ServerLootItem_Struct_temp))); + uint32 esize1 = (sizeof(Convert::DBPlayerCorpse_Struct_temp) + (dbpc->itemcount * sizeof(Convert::player_lootitem_temp::ServerLootItem_Struct_temp))); + uint32 esize2 = (sizeof(Convert::classic_db_temp::DBPlayerCorpse_Struct_temp) + (dbpc_c->itemcount * sizeof(Convert::player_lootitem_temp::ServerLootItem_Struct_temp))); /* SoF */ if (in_datasize == esize1) { diff --git a/common/database.h b/common/database.h index 3581c9367..9be14f1cb 100644 --- a/common/database.h +++ b/common/database.h @@ -95,54 +95,345 @@ class PTimerList; #pragma pack(1) -namespace player_lootitem_temp -{ - struct ServerLootItem_Struct_temp { - uint32 item_id; - int16 equipSlot; - uint8 charges; - uint16 lootslot; - uint32 aug1; - uint32 aug2; - uint32 aug3; - uint32 aug4; - uint32 aug5; +/* Conversion Structs */ + +namespace Convert { + struct BindStruct { + /*000*/ uint32 zoneId; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + }; + 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; + }; + }; + struct AA_Array + { + uint32 AA; + uint32 value; + }; + struct SpellBuff_Struct + { + /*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise + /*001*/ uint8 level; + /*002*/ uint8 bard_modifier; + /*003*/ uint8 effect; //not real + /*004*/ uint32 spellid; + /*008*/ uint32 duration; + /*012*/ uint32 counters; + /*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages + /*020*/ + }; + struct Tribute_Struct { + uint32 tribute; + uint32 tier; + }; + struct Disciplines_Struct { + uint32 values[MAX_PP_DISCIPLINES]; + }; + struct GroupLeadershipAA_Struct { + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; }; -} -struct DBPlayerCorpse_Struct_temp { - uint32 crc; - bool locked; - uint32 itemcount; - uint32 exp; - float size; - uint8 level; - uint8 race; - uint8 gender; - uint8 class_; - uint8 deity; - uint8 texture; - uint8 helmtexture; - uint32 copper; - uint32 silver; - uint32 gold; - uint32 plat; - Color_Struct item_tint[9]; - uint8 haircolor; - uint8 beardcolor; - uint8 eyecolor1; - uint8 eyecolor2; - uint8 hairstyle; - uint8 face; - uint8 beard; - uint32 drakkin_heritage; - uint32 drakkin_tattoo; - uint32 drakkin_details; - player_lootitem_temp::ServerLootItem_Struct_temp items[0]; -}; + struct RaidLeadershipAA_Struct { + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; + }; + + struct LeadershipAA_Struct { + union { + struct { + Convert::GroupLeadershipAA_Struct group; + Convert::RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; + }; + typedef struct + { + /*00*/ char Name[64]; + /*64*/ uint32 Level; + /*68*/ uint32 Race; + /*72*/ uint32 Class; + /*76*/ uint32 Zone; + /*80*/ uint32 Time; + /*84*/ uint32 Points; + /*88*/ + } PVPStatsEntry_Struct; + struct BandolierItem_Struct { + uint32 item_id; + uint32 icon; + char item_name[64]; + }; + struct Bandolier_Struct { + char name[32]; + Convert::BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE]; + }; + struct PotionBelt_Struct { + Convert::BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE]; + }; + struct SuspendedMinion_Struct + { + /*000*/ uint16 SpellID; + /*002*/ uint32 HP; + /*006*/ uint32 Mana; + /*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT]; + /*510*/ uint32 Items[_MaterialCount]; + /*546*/ char Name[64]; + /*610*/ + }; + + struct PlayerProfile_Struct { + /*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum + /*0004*/ char name[64]; // Name of player sizes not right + /*0068*/ char last_name[32]; // Last name of player sizes not right + /*0100*/ uint32 gender; // Player Gender - 0 Male, 1 Female + /*0104*/ uint32 race; // Player race + /*0108*/ uint32 class_; // Player class + /*0112*/ uint32 unknown0112; // + /*0116*/ uint32 level; // Level of player (might be one byte) + /*0120*/ Convert::BindStruct binds[5]; // Bind points (primary is first, home city is fifth) + /*0220*/ uint32 deity; // deity + /*0224*/ uint32 guild_id; + /*0228*/ uint32 birthday; // characters bday + /*0232*/ uint32 lastlogin; // last login or zone time + /*0236*/ uint32 timePlayedMin; // in minutes + /*0240*/ uint8 pvp; + /*0241*/ uint8 level2; //no idea why this is here, but thats how it is on live + /*0242*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon + /*0243*/ uint8 gm; + /*0244*/ uint8 guildrank; + /*0245*/ uint8 guildbanker; + /*0246*/ uint8 unknown0246[6]; // + /*0252*/ uint32 intoxication; + /*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms + /*0292*/ uint32 abilitySlotRefresh; + /*0296*/ uint8 haircolor; // Player hair color + /*0297*/ uint8 beardcolor; // Player beard color + /*0298*/ uint8 eyecolor1; // Player left eye color + /*0299*/ uint8 eyecolor2; // Player right eye color + /*0300*/ uint8 hairstyle; // Player hair style + /*0301*/ uint8 beard; // Beard type + /*0302*/ uint8 ability_time_seconds; //The following four spots are unknown right now..... + /*0303*/ uint8 ability_number; //ability used + /*0304*/ uint8 ability_time_minutes; + /*0305*/ uint8 ability_time_hours; //place holder + /*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag? + /*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items + /*0348*/ uint8 unknown0348[44]; + /*0392*/ Convert::Color_Struct item_tint[_MaterialCount]; + /*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY]; + /*2348*/ float unknown2384; //seen ~128, ~47 + /*2352*/ char servername[32]; // length probably not right + /*2384*/ char title[32]; // length might be wrong + /*2416*/ char suffix[32]; // length might be wrong + /*2448*/ uint32 guildid2; // + /*2452*/ uint32 exp; // Current Experience + /*2456*/ uint32 unknown2492; + /*2460*/ uint32 points; // Unspent Practice points + /*2464*/ uint32 mana; // current mana + /*2468*/ uint32 cur_hp; // current hp + /*2472*/ uint32 unknown2508; // 0x05 + /*2476*/ uint32 STR; // Strength + /*2480*/ uint32 STA; // Stamina + /*2484*/ uint32 CHA; // Charisma + /*2488*/ uint32 DEX; // Dexterity + /*2492*/ uint32 INT; // Intelligence + /*2496*/ uint32 AGI; // Agility + /*2500*/ uint32 WIS; // Wisdom + /*2504*/ uint8 face; // Player face + /*2505*/ uint8 unknown2541[47]; // ? + /*2552*/ uint8 languages[MAX_PP_LANGUAGE]; + /*2580*/ uint8 unknown2616[4]; + /*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK]; + /*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff + /*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL]; + /*4668*/ uint8 unknown4704[32]; // + /*4700*/ float y; // Player y position + /*4704*/ float x; // Player x position + /*4708*/ float z; // Player z position + /*4712*/ float heading; // Direction player is facing + /*4716*/ uint8 unknown4752[4]; // + /*4720*/ int32 platinum; // Platinum Pieces on player + /*4724*/ int32 gold; // Gold Pieces on player + /*4728*/ int32 silver; // Silver Pieces on player + /*4732*/ int32 copper; // Copper Pieces on player + /*4736*/ int32 platinum_bank; // Platinum Pieces in Bank + /*4740*/ int32 gold_bank; // Gold Pieces in Bank + /*4744*/ int32 silver_bank; // Silver Pieces in Bank + /*4748*/ int32 copper_bank; // Copper Pieces in Bank + /*4752*/ int32 platinum_cursor; // Platinum on cursor + /*4756*/ int32 gold_cursor; // Gold on cursor + /*4760*/ int32 silver_cursor; // Silver on cursor + /*4764*/ int32 copper_cursor; // Copper on cursor + /*4768*/ int32 platinum_shared; // Platinum shared between characters + /*4772*/ uint8 unknown4808[24]; + /*4796*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer + /*5196*/ uint8 unknown5132[184]; + /*5380*/ uint32 pvp2; // + /*5384*/ uint32 unknown5420; // + /*5388*/ uint32 pvptype; // + /*5392*/ uint32 unknown5428; // + /*5396*/ uint32 ability_down; // Guessing + /*5400*/ uint8 unknown5436[8]; // + /*5408*/ uint32 autosplit; //not used right now + /*5412*/ uint8 unknown5448[8]; + /*5420*/ uint32 zone_change_count; // Number of times user has zoned in their career (guessing) + /*5424*/ uint8 unknown5460[16]; // + /*5440*/ uint32 drakkin_heritage; // + /*5444*/ uint32 drakkin_tattoo; // + /*5448*/ uint32 drakkin_details; // + /*5452*/ uint32 expansions; // expansion setting, bit field of expansions avaliable + /*5456*/ int32 toxicity; //from drinking potions, seems to increase by 3 each time you drink + /*5460*/ char unknown5496[16]; // + /*5476*/ int32 hunger_level; + /*5480*/ int32 thirst_level; + /*5484*/ uint32 ability_up; + /*5488*/ char unknown5524[16]; + /*5504*/ uint16 zone_id; // Current zone of the player + /*5506*/ uint16 zoneInstance; // Instance ID + /*5508*/ Convert::SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player + /*6008*/ char groupMembers[6][64];// + /*6392*/ char unknown6428[656]; + /*7048*/ uint32 entityid; + /*7052*/ uint32 leadAAActive; + /*7056*/ uint32 unknown7092; + /*7060*/ int32 ldon_points_guk; //client uses these as signed + /*7064*/ int32 ldon_points_mir; + /*7068*/ int32 ldon_points_mmc; + /*7072*/ int32 ldon_points_ruj; + /*7076*/ int32 ldon_points_tak; + /*7080*/ int32 ldon_points_available; + /*7084*/ int32 ldon_wins_guk; + /*7088*/ int32 ldon_wins_mir; + /*7092*/ int32 ldon_wins_mmc; + /*7096*/ int32 ldon_wins_ruj; + /*7100*/ int32 ldon_wins_tak; + /*7104*/ int32 ldon_losses_guk; + /*7108*/ int32 ldon_losses_mir; + /*7112*/ int32 ldon_losses_mmc; + /*7116*/ int32 ldon_losses_ruj; + /*7120*/ int32 ldon_losses_tak; + /*7124*/ uint8 unknown7160[72]; + /*7196*/ uint32 tribute_time_remaining; //in miliseconds + /*7200*/ uint32 showhelm; + /*7204*/ uint32 career_tribute_points; + /*7208*/ uint32 unknown7244; + /*7212*/ uint32 tribute_points; + /*7216*/ uint32 unknown7252; + /*7220*/ uint32 tribute_active; //1=active + /*7224*/ Convert::Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE]; + /*7264*/ Convert::Disciplines_Struct disciplines; + /*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use) + /*7744*/ char unknown7780[160]; + /*7904*/ uint32 endurance; + /*7908*/ uint32 group_leadership_exp; //0-1000 + /*7912*/ uint32 raid_leadership_exp; //0-2000 + /*7916*/ uint32 group_leadership_points; + /*7920*/ uint32 raid_leadership_points; + /*7924*/ Convert::LeadershipAA_Struct leader_abilities; + /*8052*/ uint8 unknown8088[132]; + /*8184*/ uint32 air_remaining; + /*8188*/ uint32 PVPKills; + /*8192*/ uint32 PVPDeaths; + /*8196*/ uint32 PVPCurrentPoints; + /*8200*/ uint32 PVPCareerPoints; + /*8204*/ uint32 PVPBestKillStreak; + /*8208*/ uint32 PVPWorstDeathStreak; + /*8212*/ uint32 PVPCurrentKillStreak; + /*8216*/ Convert::PVPStatsEntry_Struct PVPLastKill; + /*8304*/ Convert::PVPStatsEntry_Struct PVPLastDeath; + /*8392*/ uint32 PVPNumberOfKillsInLast24Hours; + /*8396*/ Convert::PVPStatsEntry_Struct PVPRecentKills[50]; + /*12796*/ uint32 aapoints_spent; + /*12800*/ uint32 expAA; + /*12804*/ uint32 aapoints; //avaliable, unspent + /*12808*/ uint8 unknown12844[36]; + /*12844*/ Convert::Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT]; + /*14124*/ uint8 unknown14160[4506]; + /*18630*/ Convert::SuspendedMinion_Struct SuspendedMinion; // No longer in use + /*19240*/ uint32 timeentitledonaccount; + /*19244*/ Convert::PotionBelt_Struct potionbelt; //there should be 3 more of these + /*19532*/ uint8 unknown19568[8]; + /*19540*/ uint32 currentRadCrystals; // Current count of radiant crystals + /*19544*/ uint32 careerRadCrystals; // Total count of radiant crystals ever + /*19548*/ uint32 currentEbonCrystals;// Current count of ebon crystals + /*19552*/ uint32 careerEbonCrystals; // Total count of ebon crystals ever + /*19556*/ uint8 groupAutoconsent; // 0=off, 1=on + /*19557*/ uint8 raidAutoconsent; // 0=off, 1=on + /*19558*/ uint8 guildAutoconsent; // 0=off, 1=on + /*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005) + /*19564*/ uint32 RestTimer; + /*19568*/ + }; + + + namespace player_lootitem_temp + { + struct ServerLootItem_Struct_temp { + uint32 item_id; + int16 equipSlot; + uint8 charges; + uint16 lootslot; + uint32 aug1; + uint32 aug2; + uint32 aug3; + uint32 aug4; + uint32 aug5; + }; + } -namespace classic_db_temp -{ struct DBPlayerCorpse_Struct_temp { uint32 crc; bool locked; @@ -168,8 +459,41 @@ namespace classic_db_temp uint8 hairstyle; uint8 face; uint8 beard; + uint32 drakkin_heritage; + uint32 drakkin_tattoo; + uint32 drakkin_details; player_lootitem_temp::ServerLootItem_Struct_temp items[0]; }; + + namespace classic_db_temp { + struct DBPlayerCorpse_Struct_temp { + uint32 crc; + bool locked; + uint32 itemcount; + uint32 exp; + float size; + uint8 level; + uint8 race; + uint8 gender; + uint8 class_; + uint8 deity; + uint8 texture; + uint8 helmtexture; + uint32 copper; + uint32 silver; + uint32 gold; + uint32 plat; + Color_Struct item_tint[9]; + uint8 haircolor; + uint8 beardcolor; + uint8 eyecolor1; + uint8 eyecolor2; + uint8 hairstyle; + uint8 face; + uint8 beard; + player_lootitem_temp::ServerLootItem_Struct_temp items[0]; + }; + } } #pragma pack() From 50a69a8e203ccd108aaf8a0c2b8ba45c25f0e4ee Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 24 Nov 2014 01:53:21 -0600 Subject: [PATCH 0321/1883] Finish of automatic corpse convert routine --- common/database.cpp | 77 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 406cb5360..996f408db 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2073,8 +2073,79 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ std::string scquery; int8 first_entry = 0; + std::string query = StringFormat("SHOW TABLES LIKE 'player_corpses'"); + auto results = QueryDatabase(query); + if (results.RowCount() != 0){ + query = StringFormat( + "CREATE TABLE `character_corpse_items` ( " + "`corpse_id` int(11) unsigned NOT NULL, " + "`equip_slot` int(11) unsigned NOT NULL, " + "`item_id` int(11) unsigned DEFAULT NULL, " + "`charges` int(11) unsigned DEFAULT NULL, " + "`aug_1` int(11) unsigned DEFAULT '0', " + "`aug_2` int(11) unsigned DEFAULT '0', " + "`aug_3` int(11) unsigned DEFAULT '0', " + "`aug_4` int(11) unsigned DEFAULT '0', " + "`aug_5` int(11) unsigned DEFAULT '0', " + "`attuned` smallint(5) NOT NULL DEFAULT '0', " + "PRIMARY KEY(`corpse_id`, `equip_slot`) " + ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " + ); + results = QueryDatabase(query); + query = StringFormat("RENAME TABLE `player_corpses` TO `character_corpses`"); + results = QueryDatabase(query); + query = StringFormat( + " ALTER TABLE `character_corpses` \n" + " ADD COLUMN `is_locked` tinyint(11) NULL DEFAULT 0 AFTER `WasAtGraveyard`, \n" + " ADD COLUMN `exp` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `size` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `level` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `race` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `gender` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `class` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `deity` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `texture` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `helm_texture` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `copper` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `silver` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `gold` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `platinum` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `hair_color` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `beard_color` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `eye_color_1` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `eye_color_2` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `hair_style` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `face` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `beard` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `drakkin_heritage` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `drakkin_tattoo` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `drakkin_details` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_1` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_2` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_3` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_4` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_5` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_6` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_7` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_8` int(11) UNSIGNED NULL DEFAULT 0, \n" + " ADD COLUMN `wc_9` int(11) UNSIGNED NULL DEFAULT 0, \n" + " CHANGE COLUMN `zoneid` `zone_id` smallint(5) NOT NULL DEFAULT 0 AFTER `charname`, \n" + " CHANGE COLUMN `instanceid` `instance_id` smallint(5) UNSIGNED NOT NULL DEFAULT 0 AFTER `zone_id`, \n" + " CHANGE COLUMN `timeofdeath` `time_of_death` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `data`, \n" + " CHANGE COLUMN `rezzed` `is_rezzed` tinyint(3) UNSIGNED NULL DEFAULT 0 AFTER `time_of_death`, \n" + " CHANGE COLUMN `IsBurried` `is_buried` tinyint(3) NOT NULL DEFAULT 0 AFTER `is_rezzed`; \n" + + ); + results = QueryDatabase(query); + query = StringFormat( + " ALTER TABLE `character_corpses` \n" + " CHANGE COLUMN `WasAtGraveyard` `was_at_graveyard` tinyint(3) NOT NULL DEFAULT 0 AFTER `is_buried` \n" + ); + results = QueryDatabase(query); + } + std::string rquery = StringFormat("SHOW COLUMNS FROM `character_corpses` LIKE 'data'"); - auto results = QueryDatabase(rquery); + results = QueryDatabase(rquery); if (results.RowCount() != 0){ rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses"); results = QueryDatabase(rquery); @@ -2107,12 +2178,12 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ c_type = "Legacy"; } if (in_datasize != esize2 && in_datasize != esize1) { - std::cout << "[Error] in Corpse Size - OLD SIZE: " << esize1 << " SOF SIZE: " << esize2 << " db_blob_datasize: " << in_datasize << std::endl; + // std::cout << "[Error] in Corpse Size - OLD SIZE: " << esize1 << " SOF SIZE: " << esize2 << " db_blob_datasize: " << in_datasize << std::endl; is_sof = false; c_type = "NULL"; continue; } - std::cout << "Corpse: OK [" << c_type << "]: " << "Corpse ID: " << atoi(row2[0]) << std::endl; + std::cout << "Converting Corpse: [OK] [" << c_type << "]: " << "ID: " << atoi(row2[0]) << std::endl; if (is_sof){ scquery = StringFormat("UPDATE `character_corpses` SET \n" From 02e82f1cfce94ffe995600845fdf29a6cb5d983f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 24 Nov 2014 02:06:51 -0600 Subject: [PATCH 0322/1883] Fix for bot build --- common/database.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 996f408db..241c4d171 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1912,8 +1912,8 @@ bool Database::CheckDatabaseConvertBotsPostPPDeblob(){ int runbotsconvert = 0; /* Check For Legacy Bot References */ - rquery = StringFormat("SHOW CREATE VIEW `vwBotCharacterMobs`"); - results = QueryDatabase(rquery); + std::string rquery = StringFormat("SHOW CREATE VIEW `vwBotCharacterMobs`"); + auto results = QueryDatabase(rquery); if (results.RowCount() == 1){ auto row = results.begin(); std::string table_check = row[1]; From 2fbe6b304c7ee60acee2e71e32de7f71e9ee415b Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 24 Nov 2014 02:32:33 -0600 Subject: [PATCH 0323/1883] Added Rule NPC:EnableMeritBasedFaction (disabled by default) - Allows faction gain to work similar to experience. --- common/ruletypes.h | 1 + zone/attack.cpp | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 1d266a269..052571d82 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -437,6 +437,7 @@ RULE_BOOL ( NPC, SmartLastFightingDelayMoving, true) RULE_BOOL ( NPC, ReturnNonQuestNoDropItems, false) // Returns NO DROP items on NPCs that don't have an EVENT_TRADE sub in their script RULE_INT ( NPC, StartEnrageValue, 9) // % HP that an NPC will begin to enrage RULE_BOOL ( NPC, LiveLikeEnrage, false) // If set to true then only player controlled pets will enrage +RULE_BOOL ( NPC, EnableMeritBasedFaction, false) // If set to true, faction will given in the same way as experience (solo/group/raid) RULE_CATEGORY_END() RULE_CATEGORY ( Aggro ) diff --git a/zone/attack.cpp b/zone/attack.cpp index da812e724..51b8bb26a 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2131,7 +2131,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack give_exp_client = give_exp->CastToClient(); bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); - if (give_exp_client && !IsCorpse() && MerchantType == 0) + if (give_exp_client && !IsCorpse()) { Group *kg = entity_list.GetGroupByClient(give_exp_client); Raid *kr = entity_list.GetRaidByClient(give_exp_client); @@ -2141,15 +2141,19 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if(kr) { - if(!IsLdonTreasure) { + if(!IsLdonTreasure && MerchantType == 0) { kr->SplitExp((finalxp), this); if(killerMob && (kr->IsRaidMember(killerMob->GetName()) || kr->IsRaidMember(killerMob->GetUltimateOwner()->GetName()))) killerMob->TrySpellOnKill(killed_level,spell); } /* Send the EVENT_KILLED_MERIT event for all raid members */ for (int i = 0; i < MAX_RAID_MEMBERS; i++) { - if (kr->members[i].member != nullptr) { // If Group Member is Client - parse->EventNPC(EVENT_KILLED_MERIT, this, kr->members[i].member, "killed", 0); + if (kr->members[i].member != nullptr && kr->members[i].member->IsClient()) { // If Group Member is Client + Client *c = kr->members[i].member; + parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0); + + if(RuleB(NPC, EnableMeritBasedFaction)) + c->SetFactionLevel(c->CharacterID(), GetNPCFactionID(), c->GetBaseClass(), c->GetBaseRace(), c->GetDeity()); mod_npc_killed_merit(kr->members[i].member); @@ -2168,7 +2172,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack QS->s1.ZoneID = this->GetZoneID(); QS->s1.Type = 2; // Raid Fight for (int i = 0; i < MAX_RAID_MEMBERS; i++) { - if (kr->members[i].member != nullptr) { // If Group Member is Client + if (kr->members[i].member != nullptr && kr->members[i].member->IsClient()) { // If Group Member is Client Client *c = kr->members[i].member; QS->Chars[PlayerCount].char_id = c->CharacterID(); PlayerCount++; @@ -2182,7 +2186,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } else if (give_exp_client->IsGrouped() && kg != nullptr) { - if(!IsLdonTreasure) { + if(!IsLdonTreasure && MerchantType == 0) { kg->SplitExp((finalxp), this); if(killerMob && (kg->IsGroupMember(killerMob->GetName()) || kg->IsGroupMember(killerMob->GetUltimateOwner()->GetName()))) killerMob->TrySpellOnKill(killed_level,spell); @@ -2194,6 +2198,9 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack Client *c = kg->members[i]->CastToClient(); parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0); + if(RuleB(NPC, EnableMeritBasedFaction)) + c->SetFactionLevel(c->CharacterID(), GetNPCFactionID(), c->GetBaseClass(), c->GetBaseRace(), c->GetDeity()); + mod_npc_killed_merit(c); if(RuleB(TaskSystem, EnableTaskSystem)) @@ -2225,14 +2232,13 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } else { - if(!IsLdonTreasure) { + if(!IsLdonTreasure && MerchantType == 0) { int conlevel = give_exp->GetLevelCon(GetLevel()); if (conlevel != CON_GREEN) { - if(GetOwner() && GetOwner()->IsClient()){ - } - else { - give_exp_client->AddEXP((finalxp), conlevel); // Pyro: Comment this if NPC death crashes zone + if(!GetOwner() || (GetOwner() && !GetOwner()->IsClient())) + { + give_exp_client->AddEXP((finalxp), conlevel); if(killerMob && (killerMob->GetID() == give_exp_client->GetID() || killerMob->GetUltimateOwner()->GetID() == give_exp_client->GetID())) killerMob->TrySpellOnKill(killed_level,spell); } @@ -2241,6 +2247,10 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack /* Send the EVENT_KILLED_MERIT event */ parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0); + if(RuleB(NPC, EnableMeritBasedFaction)) + give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), + give_exp_client->GetBaseRace(), give_exp_client->GetDeity()); + mod_npc_killed_merit(give_exp_client); if(RuleB(TaskSystem, EnableTaskSystem)) @@ -2264,7 +2274,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } //do faction hits even if we are a merchant, so long as a player killed us - if(give_exp_client) + if(give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) hate_list.DoFactionHits(GetNPCFactionID()); if (!HasOwner() && !IsMerc() && class_ != MERCHANT && class_ != ADVENTUREMERCHANT && !GetSwarmInfo() From 09e13d00341748b2988820591ba99fe84f0f7397 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 25 Nov 2014 02:22:58 -0600 Subject: [PATCH 0324/1883] Spells that modify model size are now limited to 2 size adjustments from the base size. --- changelog.txt | 3 +++ .../optional/2014_11_24_EnableMeritBasedFaction.sql | 2 +- zone/merc.cpp | 6 +++--- zone/spell_effects.cpp | 11 ++++++++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3a72ea152..b75a58dbc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 11/24/2014 == +Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size. + == 11/24/2014 == Trevius: Added Rule NPC:EnableMeritBasedFaction (disabled by default) - Allows faction gain to work similar to experience. diff --git a/utils/sql/git/optional/2014_11_24_EnableMeritBasedFaction.sql b/utils/sql/git/optional/2014_11_24_EnableMeritBasedFaction.sql index 67e1b1888..942b016ab 100644 --- a/utils/sql/git/optional/2014_11_24_EnableMeritBasedFaction.sql +++ b/utils/sql/git/optional/2014_11_24_EnableMeritBasedFaction.sql @@ -1 +1 @@ -INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'NPC:EnableMeritBasedFaction', 'false', 'If set to true, faction will given in the same way as experience (solo/group/raid).'); \ No newline at end of file +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'NPC:EnableMeritBasedFaction', 'false', 'If set to true, faction will be given in the same way as experience (solo/group/raid).'); \ No newline at end of file diff --git a/zone/merc.cpp b/zone/merc.cpp index 2ecd0849e..489b51e56 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4338,7 +4338,7 @@ Corpse* Merc::GetGroupMemberCorpse() { if(g->members[i] && g->members[i]->IsClient()) { corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius)); - if(corpse && !corpse->IsRezzed()) { + if(corpse && !corpse->Rezzed()) { return corpse; } } @@ -5540,7 +5540,7 @@ void Client::SpawnMercOnZone() { } else { - int32 TimeDiff = GetMercInfo().SuspendedTime + RuleI(Mercs, SuspendIntervalS) - time(nullptr); + int32 TimeDiff = GetMercInfo().SuspendedTime - time(nullptr); if (TimeDiff > 0) { if (!GetPTimers().Enabled(pTimerMercSuspend)) @@ -6367,4 +6367,4 @@ uint32 Merc::CalcUpkeepCost(uint32 templateID , uint8 level, uint8 currency_type } return cost; -} +} \ No newline at end of file diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 447d34efd..d73c667a1 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1665,7 +1665,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Model Size: %d%%", effect_value); #endif - ChangeSize(GetSize() * (static_cast(effect_value) / 100.0f)); + // Only allow 2 size changes from Base Size + float modifyAmount = (static_cast(effect_value) / 100.0f); + float maxModAmount = GetBaseSize() * modifyAmount * modifyAmount; + if ((GetSize() <= GetBaseSize() && GetSize() > maxModAmount) || + (GetSize() >= GetBaseSize() && GetSize() < maxModAmount) || + (GetSize() <= GetBaseSize() && maxModAmount > 1.0f) || + (GetSize() >= GetBaseSize() && maxModAmount < 1.0f)) + { + ChangeSize(GetSize() * modifyAmount); + } break; } From b4862dea45ab81e94def92b3cf9c86cee79a8a51 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 25 Nov 2014 02:54:02 -0600 Subject: [PATCH 0325/1883] Compile Fix and fix to prevent Mercenaries from being set as Group Leader. --- changelog.txt | 1 + zone/groups.cpp | 44 ++++++++++++++++++++++++++++++-------------- zone/merc.cpp | 2 +- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index b75a58dbc..b05fc26ee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 11/24/2014 == Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size. +Trevius: Fix to prevent Mercenaries from being set as Group Leader. == 11/24/2014 == Trevius: Added Rule NPC:EnableMeritBasedFaction (disabled by default) - Allows faction gain to work similar to experience. diff --git a/zone/groups.cpp b/zone/groups.cpp index 2e7fb3cfe..3180e51f1 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -592,12 +592,15 @@ bool Group::DelMemberOOZ(const char *Name) { bool Group::DelMember(Mob* oldmember,bool ignoresender) { - if (oldmember == nullptr){ + if (oldmember == nullptr) + { return false; } - for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] == oldmember) { + for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) + { + if (members[i] == oldmember) + { members[i] = nullptr; membername[i][0] = '\0'; memset(membername[i],0,64); @@ -606,16 +609,6 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) } } - //handle leader quitting group gracefully - if (oldmember == GetLeader() && GroupCount() >= 2) { - for(uint32 nl = 0; nl < MAX_GROUP_MEMBERS; nl++) { - if(members[nl]) { - ChangeLeader(members[nl]); - break; - } - } - } - /* This may seem pointless but the case above does not cover the following situation: * Group has Leader a, member b, member c * b and c are out of zone @@ -624,10 +617,33 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) * a is still "leader" from GetLeader()'s perspective and will crash the zone when we DelMember(b) * Ultimately we should think up a better solution to this. */ - if(oldmember == GetLeader()) { + if(oldmember == GetLeader()) + { SetLeader(nullptr); } + //handle leader quitting group gracefully + if (oldmember == GetLeader() && GroupCount() >= 2) + { + for(uint32 nl = 0; nl < MAX_GROUP_MEMBERS; nl++) + { + if(members[nl]) + { + if (members[nl]->IsClient()) + { + ChangeLeader(members[nl]); + break; + } + } + } + } + + if (GetLeader() == nullptr) + { + DisbandGroup(); + return true; + } + ServerPacket* pack = new ServerPacket(ServerOP_GroupLeave, sizeof(ServerGroupLeave_Struct)); ServerGroupLeave_Struct* gl = (ServerGroupLeave_Struct*)pack->pBuffer; gl->gid = GetID(); diff --git a/zone/merc.cpp b/zone/merc.cpp index 489b51e56..b2793db73 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4338,7 +4338,7 @@ Corpse* Merc::GetGroupMemberCorpse() { if(g->members[i] && g->members[i]->IsClient()) { corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius)); - if(corpse && !corpse->Rezzed()) { + if(corpse && !corpse->IsRezzed()) { return corpse; } } From 640aea24bc2c769cffc013289c74a61ba0446e22 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 24 Nov 2014 23:22:10 -0800 Subject: [PATCH 0326/1883] xyz_heading, xyz_location, and xy_location built --- zone/CMakeLists.txt | 4 +- zone/position.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++++ zone/position.h | 80 +++++++++++++++++++++++++++++++++ 3 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 zone/position.cpp create mode 100644 zone/position.h diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 8cd086405..f7573ecdb 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -16,7 +16,7 @@ SET(zone_sources command.cpp corpse.cpp doors.cpp - effects.cpp + effects.cpp embparser.cpp embparser_api.cpp embperl.cpp @@ -92,6 +92,7 @@ SET(zone_sources perlpacket.cpp petitions.cpp pets.cpp + position.cpp qglobals.cpp queryserv.cpp questmgr.cpp @@ -182,6 +183,7 @@ SET(zone_headers perlpacket.h petitions.h pets.h + position.h qglobals.h quest_interface.h queryserv.h diff --git a/zone/position.cpp b/zone/position.cpp new file mode 100644 index 000000000..9264f18cd --- /dev/null +++ b/zone/position.cpp @@ -0,0 +1,106 @@ +#include "position.h" + +xy_location::xy_location(float x, float y) : + m_X(x), + m_Y(y) { +} + +const xy_location xy_location::operator -(const xy_location& rhs) { + xy_location minus{m_X - rhs.m_X, m_Y - rhs.m_Y}; + return minus; +} + +xyz_heading::xyz_heading(float x, float y, float z, float heading) : + m_X(x), + m_Y(y), + m_Z(z), + m_Heading(heading) { +} + +xyz_heading::xyz_heading(const xyz_heading& locationDir) : + m_X(locationDir.m_X), + m_Y(locationDir.m_Y), + m_Z(locationDir.m_Z), + m_Heading(locationDir.m_Heading) { +} + +xyz_heading::xyz_heading(const xyz_location& locationDir, float heading) : + m_X(locationDir.m_X), + m_Y(locationDir.m_Y), + m_Z(locationDir.m_Z), + m_Heading(heading) { +} + +xyz_heading::xyz_heading(const xy_location& locationDir, float z, float heading) : + m_X(locationDir.m_X), + m_Y(locationDir.m_Y), + m_Z(z), + m_Heading(heading) { +} + + +xyz_heading::xyz_heading(const xyz_location locationDir, float heading) : + m_X(locationDir.m_X), + m_Y(locationDir.m_Y), + m_Z(locationDir.m_Z), + m_Heading(heading) { +} + +xyz_heading::xyz_heading(const xy_location locationDir, float z, float heading) : + m_X(locationDir.m_X), + m_Y(locationDir.m_Y), + m_Z(z), + m_Heading(heading) { +} + +xyz_heading::operator xyz_location() const { + return xyz_location{m_X,m_Y,m_Z}; +} + +xyz_heading::operator xy_location() const { + return xy_location{m_X,m_Y}; +} + +const xyz_heading xyz_heading::operator +(const xyz_location& rhs) { + return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z, m_Heading}; +} + +const xyz_heading xyz_heading::operator +(const xy_location& rhs) { + return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z, m_Heading}; +} + +const xyz_heading xyz_heading::operator -(const xyz_location& rhs) { + return xyz_heading{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading}; +} + + +xyz_location::xyz_location(float x, float y, float z) : + m_X(x), + m_Y(y), + m_Z(z) { +} + +xyz_location::xyz_location(double x, double y, double z) : + m_X(static_cast(x)), + m_Y(static_cast(y)), + m_Z(static_cast(z)) { +} + +xyz_location::operator xy_location() const { + return xy_location{m_X, m_Y}; +} + +const xyz_location xyz_location::operator -(const xyz_location& rhs) { + return xyz_location{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z}; +} + +void xyz_location::ABS_XYZ(void) { + if (m_X < 0) + m_X = -m_X; + + if (m_Y < 0) + m_Y = -m_Y; + + if (m_Z < 0) + m_Z = -m_Z; +} diff --git a/zone/position.h b/zone/position.h new file mode 100644 index 000000000..6258e901f --- /dev/null +++ b/zone/position.h @@ -0,0 +1,80 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef POSITION_H +#define POSITION_H + +class xy_location { +public: + float m_X; + float m_Y; + + xy_location(float x = 0.0f, float y = 0.0f); + + const xy_location operator -(const xy_location& rhs); +}; + +class xyz_location { +public: + float m_X; + float m_Y; + float m_Z; + + static const xyz_location& Origin() {static xyz_location origin; return origin;} + + xyz_location(float x = 0.0f, float y = 0.0f, float z = 0.0f); + xyz_location(double x, double y, double z); + + operator xy_location() const; + + const xyz_location operator -(const xyz_location& rhs); + + void ABS_XYZ(); + bool isOrigin() const { return m_X == 0 && m_Y == 0 && m_Z == 0;} + +}; + +class xyz_heading { +public: + float m_X; + float m_Y; + float m_Z; + + float m_Heading; + + static const xyz_heading& Origin() {static xyz_heading origin; return origin;} + + xyz_heading(float x = 0.0f, float y = 0.0f, float z = 0.0f, float heading = 0.0f); + xyz_heading(const xyz_heading& locationDir); + xyz_heading(const xyz_location& locationDir, float heading = 0.0f); + xyz_heading(const xyz_location locationDir, float heading = 0.0f); + explicit xyz_heading(const xy_location& locationDir, float z, float heading); + explicit xyz_heading(const xy_location locationDir, float z, float heading); + + operator xyz_location() const; + operator xy_location() const; + + const xyz_heading operator +(const xyz_location& rhs); + const xyz_heading operator +(const xy_location& rhs); + + const xyz_heading operator -(const xyz_location& rhs); + + bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;} +}; + + +#endif From 53602e3c61172a9d4c5f644c544d968b96f1b16e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 20:16:04 -0800 Subject: [PATCH 0327/1883] heading, x_pos, y_pos, and z_pos replaced with m_Position in Mob --- zone/beacon.cpp | 8 +- zone/bot.cpp | 6 +- zone/client.cpp | 24 ++--- zone/client_packet.cpp | 53 +++++----- zone/client_process.cpp | 38 ++++---- zone/corpse.cpp | 42 ++++---- zone/forage.cpp | 8 +- zone/mob.cpp | 102 +++++++++---------- zone/mob.h | 42 ++++---- zone/mob_ai.cpp | 2 +- zone/spells.cpp | 46 ++++----- zone/waypoints.cpp | 210 ++++++++++++++++++++-------------------- zone/zoning.cpp | 56 +++++------ 13 files changed, 318 insertions(+), 319 deletions(-) diff --git a/zone/beacon.cpp b/zone/beacon.cpp index 9b88dd524..4713e7c63 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -58,10 +58,10 @@ Beacon::Beacon(Mob *at_mob, int lifetime) caster_id = 0; // copy location - x_pos = at_mob->GetX(); - y_pos = at_mob->GetY(); - z_pos = at_mob->GetZ(); - heading = at_mob->GetHeading(); + m_Position.m_X = at_mob->GetX(); + m_Position.m_Y = at_mob->GetY(); + m_Position.m_Z = at_mob->GetZ(); + m_Position.m_Heading = at_mob->GetHeading(); if(lifetime) { diff --git a/zone/bot.cpp b/zone/bot.cpp index a68273fae..2a8921dd7 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4122,9 +4122,9 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) { this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName()); // Spawn the bot at the bow owner's loc - this->x_pos = botCharacterOwner->GetX(); - this->y_pos = botCharacterOwner->GetY(); - this->z_pos = botCharacterOwner->GetZ(); + this->m_Position.m_X = botCharacterOwner->GetX(); + this->m_Position.m_Y = botCharacterOwner->GetY(); + this->m_Position.m_Z = botCharacterOwner->GetZ(); // Make the bot look at the bot owner FaceTarget(botCharacterOwner); diff --git a/zone/client.cpp b/zone/client.cpp index 9541959ba..2c6c73b8a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -399,9 +399,9 @@ Client::~Client() { { m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zoneInstance = m_pp.binds[0].instance_id; - x_pos = m_pp.binds[0].x; - y_pos = m_pp.binds[0].y; - z_pos = m_pp.binds[0].z; + m_Position.m_X = m_pp.binds[0].x; + m_Position.m_Y = m_pp.binds[0].y; + m_Position.m_Z = m_pp.binds[0].z; } // we save right now, because the client might be zoning and the world @@ -525,11 +525,11 @@ bool Client::Save(uint8 iCommitNow) { return false; /* Wrote current basics to PP for saves */ - m_pp.x = x_pos; - m_pp.y = y_pos; - m_pp.z = z_pos; + m_pp.x = m_Position.m_X; + m_pp.y = m_Position.m_Y; + m_pp.z = m_Position.m_Z; m_pp.guildrank = guildrank; - m_pp.heading = heading; + m_pp.heading = m_Position.m_Heading; /* Mana and HP */ if (GetHP() <= 0) { @@ -3820,7 +3820,7 @@ void Client::Sacrifice(Client *caster) void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { - if(!Caster || PendingTranslocate) + if(!Caster || PendingTranslocate) return; const SPDat_Spell_Struct &Spell = spells[SpellID]; @@ -4273,7 +4273,7 @@ bool Client::GroupFollow(Client* inviter) { { GetMerc()->MercJoinClientGroup(); } - + if (inviter->IsLFP()) { // If the player who invited us to a group is LFP, have them update world now that we have joined their group. @@ -5832,7 +5832,7 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = aug_weap->Icon; - } + } else { strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = item->Icon; @@ -7460,7 +7460,7 @@ void Client::SendMercPersonalInfo() uint32 altCurrentType = 19; //TODO: Implement alternate currency purchases involving mercs! MercTemplate *mercData = &zone->merc_templates[GetMercInfo().MercTemplateID]; - + int stancecount = 0; stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) @@ -7562,7 +7562,7 @@ void Client::SendMercPersonalInfo() } if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); - + SendMercMerchantResponsePacket(0); } else diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 000ed8fcc..06611b413 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1472,10 +1472,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Set Mob variables for spawn */ class_ = m_pp.class_; level = m_pp.level; - x_pos = m_pp.x; - y_pos = m_pp.y; - z_pos = m_pp.z; - heading = m_pp.heading; + m_Position.m_X = m_pp.x; + m_Position.m_Y = m_pp.y; + m_Position.m_Z = m_pp.z; + m_Position.m_Heading = m_pp.heading; race = m_pp.race; base_race = m_pp.race; gender = m_pp.gender; @@ -4380,9 +4380,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) float dist = 0; float tmp; - tmp = x_pos - ppu->x_pos; + tmp = m_Position.m_X - ppu->x_pos; dist += tmp*tmp; - tmp = y_pos - ppu->y_pos; + tmp = m_Position.m_Y - ppu->y_pos; dist += tmp*tmp; dist = sqrt(dist); @@ -4534,9 +4534,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) //If the player has moved more than units for x or y, then we'll store //his pre-PPU x and y for /rewind, in case he gets stuck. if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) { - rewind_x = x_pos; - rewind_y = y_pos; - rewind_z = z_pos; + rewind_x = m_Position.m_X; + rewind_y = m_Position.m_Y; + rewind_z = m_Position.m_Z; } //If the PPU was a large jump, such as a cross zone gate or Call of Hero, @@ -4563,13 +4563,13 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) delta_z = ppu->delta_z; delta_heading = ppu->delta_heading; - if(IsTracking() && ((x_pos!=ppu->x_pos) || (y_pos!=ppu->y_pos))){ + if(IsTracking() && ((m_Position.m_X!=ppu->x_pos) || (m_Position.m_Y!=ppu->y_pos))){ if(MakeRandomFloat(0, 100) < 70)//should be good CheckIncreaseSkill(SkillTracking, nullptr, -20); } // Break Hide if moving without sneaking and set rewind timer if moved - if(ppu->y_pos != y_pos || ppu->x_pos != x_pos){ + if(ppu->y_pos != m_Position.m_Y || ppu->x_pos != m_Position.m_X){ if((hidden || improved_hidden) && !sneaking){ hidden = false; improved_hidden = false; @@ -4589,13 +4589,14 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) // Outgoing client packet float tmpheading = EQ19toFloat(ppu->heading); - if (!FCMP(ppu->y_pos, y_pos) || !FCMP(ppu->x_pos, x_pos) || !FCMP(tmpheading, heading) || ppu->animation != animation) + if (!FCMP(ppu->y_pos, m_Position.m_Y) || !FCMP(ppu->x_pos, m_Position.m_X) || !FCMP(tmpheading, m_Position.m_Heading) || ppu->animation != animation) { - x_pos = ppu->x_pos; - y_pos = ppu->y_pos; - z_pos = ppu->z_pos; - animation = ppu->animation; - heading = tmpheading; + m_Position.m_X = ppu->x_pos; + m_Position.m_Y = ppu->y_pos; + m_Position.m_Z = ppu->z_pos; + m_Position.m_Heading = tmpheading; + animation = ppu->animation; + EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; @@ -4609,7 +4610,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if(zone->watermap) { - if(zone->watermap->InLiquid(x_pos, y_pos, z_pos)) + if(zone->watermap->InLiquid(m_Position.m_X, m_Position.m_Y, m_Position.m_Z)) { CheckIncreaseSkill(SkillSwimming, nullptr, -17); } @@ -6607,7 +6608,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) GroupGeneric_Struct* gf = (GroupGeneric_Struct*)app->pBuffer; Mob* inviter = entity_list.GetClientByName(gf->name1); - + // Inviter and Invitee are in the same zone if (inviter != nullptr && inviter->IsClient()) { @@ -6622,7 +6623,7 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { // Inviter is in another zone - Remove merc from group now if any LeaveGroup(); - + ServerPacket* pack = new ServerPacket(ServerOP_GroupFollow, sizeof(ServerGroupFollow_Struct)); ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *)pack->pBuffer; sgfs->CharacterID = CharacterID(); @@ -8019,7 +8020,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) InspectResponse_Struct* insr = (InspectResponse_Struct*)outapp->pBuffer; Mob* tmp = entity_list.GetMob(insr->TargetID); const Item_Struct* item = nullptr; - + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); for (int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) { const ItemInst* inst = GetInv().GetItem(L); @@ -12807,9 +12808,9 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) m_pp.spell_book[swapspell->from_slot] = m_pp.spell_book[swapspell->to_slot]; m_pp.spell_book[swapspell->to_slot] = swapspelltemp; - /* Save Spell Swaps */ + /* Save Spell Swaps */ if (!database.SaveCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot)){ - database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); + database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[swapspell->from_slot], swapspell->from_slot); } if (!database.SaveCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot)){ database.DeleteCharacterSpell(this->CharacterID(), swapspelltemp, swapspell->to_slot); @@ -13595,7 +13596,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) } Translocate_Struct *its = (Translocate_Struct*)app->pBuffer; - if (!PendingTranslocate) + if (!PendingTranslocate) return; if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) { @@ -13616,7 +13617,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) // to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before. if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && - (zone->GetZoneID() == PendingTranslocateData.zone_id && + (zone->GetZoneID() == PendingTranslocateData.zone_id && zone->GetInstanceID() == PendingTranslocateData.instance_id)) { PendingTranslocate = false; @@ -13627,7 +13628,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) ////Was sending the packet back to initiate client zone... ////but that could be abusable, so lets go through proper channels MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id, - PendingTranslocateData.x, PendingTranslocateData.y, + PendingTranslocateData.x, PendingTranslocateData.y, PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited); } } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c4eb01f4a..42b1316ef 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -188,7 +188,7 @@ bool Client::Process() { GetMerc()->Save(); GetMerc()->Depop(); } - + Raid *myraid = entity_list.GetRaidByClient(this); if (myraid) { @@ -581,7 +581,7 @@ bool Client::Process() { if(projectile_timer.Check()) SpellProjectileEffect(); - + if(spellbonuses.GravityEffect == 1) { if(gravity_timer.Check()) DoGravityEffect(); @@ -800,32 +800,32 @@ void Client::OnDisconnect(bool hard_disconnect) { if (MyRaid) MyRaid->MemberZoned(this); - parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); + parse->EventPlayer(EVENT_DISCONNECT, this, "", 0); /* QS: PlayerLogConnectDisconnect */ if (RuleB(QueryServ, PlayerLogConnectDisconnect)){ std::string event_desc = StringFormat("Disconnect :: in zoneid:%i instid:%i", this->GetZoneID(), this->GetInstanceID()); QServ->PlayerLogEvent(Player_Log_Connect_State, this->CharacterID(), event_desc); - } + } } - Mob *Other = trade->With(); + Mob *Other = trade->With(); if(Other) { - mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); + mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) Other->CastToClient()->FinishTrade(Other); /* Reset both sides of the trade */ - trade->Reset(); + trade->Reset(); Other->trade->Reset(); } database.SetFirstLogon(CharacterID(), 0); //We change firstlogon status regardless of if a player logs out to zone or not, because we only want to trigger it on their first login from world. - /* Remove ourself from all proximities */ + /* Remove ourself from all proximities */ ClearAllProximities(); EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogoutReply); @@ -1570,7 +1570,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) if (from_bucket == &m_pp.platinum_shared) amount_to_add = 0 - amount_to_take; - database.SetSharedPlatinum(AccountID(),amount_to_add); + database.SetSharedPlatinum(AccountID(),amount_to_add); } } else{ @@ -1756,7 +1756,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) } SetSkill(skill, t_level); - } else { + } else { switch(skill) { case SkillBrewing: case SkillMakePoison: @@ -1958,7 +1958,7 @@ void Client::DoEnduranceUpkeep() { int upkeep_sum = 0; int cost_redux = spellbonuses.EnduranceReduction + itembonuses.EnduranceReduction + aabonuses.EnduranceReduction; - + bool has_effect = false; uint32 buffs_i; uint32 buff_count = GetMaxTotalSlots(); @@ -2144,9 +2144,9 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse) { - x_pos = corpse->GetX(); - y_pos = corpse->GetY(); - z_pos = corpse->GetZ(); + m_Position.m_X = corpse->GetX(); + m_Position.m_Y = corpse->GetY(); + m_Position.m_Z = corpse->GetZ(); } EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZonePlayerToBind, sizeof(ZonePlayerToBind_Struct) + 10); @@ -2199,10 +2199,10 @@ void Client::HandleRespawnFromHover(uint32 Option) SetMana(GetMaxMana()); SetEndurance(GetMaxEndurance()); - x_pos = chosen->x; - y_pos = chosen->y; - z_pos = chosen->z; - heading = chosen->heading; + m_Position.m_X = chosen->x; + m_Position.m_Y = chosen->y; + m_Position.m_Z = chosen->z; + m_Position.m_Heading = chosen->heading; ClearHover(); entity_list.RefreshClientXTargets(this); @@ -2212,7 +2212,7 @@ void Client::HandleRespawnFromHover(uint32 Option) //After they've respawned into the same zone, trigger EVENT_RESPAWN parse->EventPlayer(EVENT_RESPAWN, this, static_cast(itoa(Option)), is_rez ? 1 : 0); - //Pop Rez option from the respawn options list; + //Pop Rez option from the respawn options list; //easiest way to make sure it stays at the end and //doesn't disrupt adding/removing scripted options respawn_options.pop_back(); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8be978350..5c56be256 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -249,15 +249,15 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( 0, // uint8 in_qglobal, 0, // uint8 in_maxlevel, 0 // uint32 in_scalerate - ), + ), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), - loot_cooldown_timer(10) + loot_cooldown_timer(10) { int i; - + PlayerProfile_Struct *pp = &client->GetPP(); ItemInst *item; @@ -287,7 +287,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( platinum = 0; strcpy(orgname, pp->name); - strcpy(name, pp->name); + strcpy(name, pp->name); /* become_npc was not being initialized which led to some pretty funky things with newly created corpses */ become_npc = false; @@ -295,8 +295,8 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( SetPKItem(0); /* Check Rule to see if we can leave corpses */ - if(!RuleB(Character, LeaveNakedCorpses) || - RuleB(Character, LeaveCorpses) && + if(!RuleB(Character, LeaveNakedCorpses) || + RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { // cash // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. @@ -589,7 +589,7 @@ bool Corpse::Save() { ItemList::iterator cur, end; cur = itemlist.begin(); end = itemlist.end(); - for (; cur != end; ++cur) { + for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); @@ -597,11 +597,11 @@ bool Corpse::Save() { /* Create New Corpse*/ if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading); } /* Update Corpse Data */ else{ - corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, IsRezzed()); } safe_delete_array(dbpc); @@ -611,8 +611,8 @@ bool Corpse::Save() { void Corpse::Delete() { if (IsPlayerCorpse() && corpse_db_id != 0) - database.DeleteCharacterCorpse(corpse_db_id); - + database.DeleteCharacterCorpse(corpse_db_id); + corpse_db_id = 0; player_corpse_depop = true; } @@ -717,7 +717,7 @@ void Corpse::RemoveItem(uint16 lootslot) { } void Corpse::RemoveItem(ServerLootItem_Struct* item_data){ - uint8 material; + uint8 material; ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -925,7 +925,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } RemoveCash(); - Save(); + Save(); } outapp->priority = 6; @@ -1081,7 +1081,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } if (item != 0) { - if (item_data){ + if (item_data){ inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); } else { @@ -1156,7 +1156,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id); /* Delete Item Instance */ - RemoveItem(item_data->lootslot); + RemoveItem(item_data->lootslot); } /* Remove Bag Contents */ @@ -1164,9 +1164,9 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ - database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); + database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id); /* Delete Item Instance */ - RemoveItem(bag_item_data[i]); + RemoveItem(bag_item_data[i]); } } } @@ -1241,7 +1241,7 @@ void Corpse::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.NPC = 2; } -void Corpse::QueryLoot(Client* to) { +void Corpse::QueryLoot(Client* to) { int x = 0, y = 0; // x = visible items, y = total items to->Message(0, "Coin: %ip, %ig, %is, %ic", platinum, gold, silver, copper); @@ -1415,10 +1415,10 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){ /* ** Corpse slot translations are needed until corpse database blobs are converted -** +** ** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into ** the contiguous possessions slot enumeration, the following designations will be used: -** +** ** Designatiom Server Corpse Offset ** -------------------------------------------------- ** MainCharm 0 0 0 @@ -1518,4 +1518,4 @@ int16 Corpse::CorpseToServerSlot(int16 corpse_slot) return corpse_slot; } */ -} \ No newline at end of file +} diff --git a/zone/forage.cpp b/zone/forage.cpp index d1008031a..24482017c 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -225,15 +225,15 @@ bool Client::CanFish() { HeadingDegrees = (int) ((GetHeading()*360)/256); HeadingDegrees = HeadingDegrees % 360; - RodX = x_pos + RodLength * sin(HeadingDegrees * M_PI/180.0f); - RodY = y_pos + RodLength * cos(HeadingDegrees * M_PI/180.0f); + RodX = m_Position.m_X + RodLength * sin(HeadingDegrees * M_PI/180.0f); + RodY = m_Position.m_Y + RodLength * cos(HeadingDegrees * M_PI/180.0f); // Do BestZ to find where the line hanging from the rod intersects the water (if it is water). // and go 1 unit into the water. Map::Vertex dest; dest.x = RodX; dest.y = RodY; - dest.z = z_pos+10; + dest.z = m_Position.m_Z+10; RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4; bool in_lava = zone->watermap->InLava(RodX, RodY, RodZ); @@ -243,7 +243,7 @@ bool Client::CanFish() { Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something? return false; } - if((!in_water) || (z_pos-RodZ)>LineLength) { //Didn't hit the water OR the water is too far below us + if((!in_water) || (m_Position.m_Z-RodZ)>LineLength) { //Didn't hit the water OR the water is too far below us Message_StringID(MT_Skills, FISHING_LAND); //Trying to catch land sharks perhaps? return false; } diff --git a/zone/mob.cpp b/zone/mob.cpp index a7d141b30..cb2f6e35d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -157,10 +157,10 @@ Mob::Mob(const char* in_name, if (runspeed < 0 || runspeed > 20) runspeed = 1.25f; - heading = in_heading; - x_pos = in_x_pos; - y_pos = in_y_pos; - z_pos = in_z_pos; + m_Position.m_Heading = in_heading; + m_Position.m_X = in_x_pos; + m_Position.m_Y = in_y_pos; + m_Position.m_Z = in_z_pos; light = in_light; texture = in_texture; helmtexture = in_helmtexture; @@ -373,7 +373,7 @@ Mob::Mob(const char* in_name, m_targetable = true; targetring_x = 0.0f; - targetring_y = 0.0f; + targetring_y = 0.0f; targetring_z = 0.0f; flymode = FlyMode3; @@ -882,10 +882,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); } - ns->spawn.heading = FloatToEQ19(heading); - ns->spawn.x = FloatToEQ19(x_pos);//((int32)x_pos)<<3; - ns->spawn.y = FloatToEQ19(y_pos);//((int32)y_pos)<<3; - ns->spawn.z = FloatToEQ19(z_pos);//((int32)z_pos)<<3; + ns->spawn.heading = FloatToEQ19(m_Position.m_Heading); + ns->spawn.x = FloatToEQ19(m_Position.m_X);//((int32)x_pos)<<3; + ns->spawn.y = FloatToEQ19(m_Position.m_Y);//((int32)y_pos)<<3; + ns->spawn.z = FloatToEQ19(m_Position.m_Z);//((int32)z_pos)<<3; ns->spawn.spawnId = GetID(); ns->spawn.curHp = static_cast(GetHPRatio()); ns->spawn.max_hp = 100; //this field needs a better name @@ -1211,13 +1211,13 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) { void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){ memset(spu,0xff,sizeof(PlayerPositionUpdateServer_Struct)); spu->spawn_id = GetID(); - spu->x_pos = FloatToEQ19(x_pos); - spu->y_pos = FloatToEQ19(y_pos); - spu->z_pos = FloatToEQ19(z_pos); + spu->x_pos = FloatToEQ19(m_Position.m_X); + spu->y_pos = FloatToEQ19(m_Position.m_Y); + spu->z_pos = FloatToEQ19(m_Position.m_Z); spu->delta_x = NewFloatToEQ13(0); spu->delta_y = NewFloatToEQ13(0); spu->delta_z = NewFloatToEQ13(0); - spu->heading = FloatToEQ19(heading); + spu->heading = FloatToEQ19(m_Position.m_Heading); spu->animation = 0; spu->delta_heading = NewFloatToEQ13(0); spu->padding0002 =0; @@ -1230,13 +1230,13 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){ // this is for SendPosUpdate() void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) { spu->spawn_id = GetID(); - spu->x_pos = FloatToEQ19(x_pos); - spu->y_pos = FloatToEQ19(y_pos); - spu->z_pos = FloatToEQ19(z_pos); + spu->x_pos = FloatToEQ19(m_Position.m_X); + spu->y_pos = FloatToEQ19(m_Position.m_Y); + spu->z_pos = FloatToEQ19(m_Position.m_Z); spu->delta_x = NewFloatToEQ13(delta_x); spu->delta_y = NewFloatToEQ13(delta_y); spu->delta_z = NewFloatToEQ13(delta_z); - spu->heading = FloatToEQ19(heading); + spu->heading = FloatToEQ19(m_Position.m_Heading); spu->padding0002 =0; spu->padding0006 =7; spu->padding0014 =0x7f; @@ -1361,11 +1361,11 @@ void Mob::GMMove(float x, float y, float z, float heading, bool SendUpdate) { entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; - if (heading != 0.01) - this->heading = heading; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; + if (m_Position.m_Heading != 0.01) + this->m_Position.m_Heading = heading; if(IsNPC()) CastToNPC()->SaveGuardSpot(true); if(SendUpdate) @@ -2062,9 +2062,9 @@ bool Mob::CanThisClassBlock(void) const } float Mob::Dist(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; - float zDiff = other.z_pos - z_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; + float zDiff = other.m_Position.m_Z - m_Position.m_Z; return sqrtf( (xDiff * xDiff) + (yDiff * yDiff) @@ -2072,17 +2072,17 @@ float Mob::Dist(const Mob &other) const { } float Mob::DistNoZ(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; return sqrtf( (xDiff * xDiff) + (yDiff * yDiff) ); } float Mob::DistNoRoot(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; - float zDiff = other.z_pos - z_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; + float zDiff = other.m_Position.m_Z - m_Position.m_Z; return ( (xDiff * xDiff) + (yDiff * yDiff) @@ -2090,9 +2090,9 @@ float Mob::DistNoRoot(const Mob &other) const { } float Mob::DistNoRoot(float x, float y, float z) const { - float xDiff = x - x_pos; - float yDiff = y - y_pos; - float zDiff = z - z_pos; + float xDiff = x - m_Position.m_X; + float yDiff = y - m_Position.m_Y; + float zDiff = z - m_Position.m_Z; return ( (xDiff * xDiff) + (yDiff * yDiff) @@ -2100,15 +2100,15 @@ float Mob::DistNoRoot(float x, float y, float z) const { } float Mob::DistNoRootNoZ(float x, float y) const { - float xDiff = x - x_pos; - float yDiff = y - y_pos; + float xDiff = x - m_Position.m_X; + float yDiff = y - m_Position.m_Y; return ( (xDiff * xDiff) + (yDiff * yDiff) ); } float Mob::DistNoRootNoZ(const Mob &other) const { - float xDiff = other.x_pos - x_pos; - float yDiff = other.y_pos - y_pos; + float xDiff = other.m_Position.m_X - m_Position.m_X; + float yDiff = other.m_Position.m_Y - m_Position.m_Y; return ( (xDiff * xDiff) + (yDiff * yDiff) ); } @@ -2253,7 +2253,7 @@ bool Mob::HateSummon() { entity_list.MessageClose(this, true, 500, MT_Say, "%s says,'You will not evade me, %s!' ", GetCleanName(), target->GetCleanName() ); if (target->IsClient()) { - target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x_pos, y_pos, z_pos, target->GetHeading(), 0, SummonPC); + target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading(), 0, SummonPC); } else { #ifdef BOTS @@ -2266,7 +2266,7 @@ bool Mob::HateSummon() { } #endif //BOTS - target->GMMove(x_pos, y_pos, z_pos, target->GetHeading()); + target->GMMove(m_Position.m_X, m_Position.m_Y, m_Position.m_Z, target->GetHeading()); } return true; @@ -2614,9 +2614,9 @@ void Mob::Warp( float x, float y, float z ) entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; Mob* target = GetTarget(); if (target) { @@ -2829,9 +2829,9 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != nullptr) { Map::Vertex me; - me.x = new_x; - me.y = new_y; - me.z = z_pos+z_offset; + me.x = m_Position.m_X; + me.y = m_Position.m_Y; + me.z = m_Position.m_Z + z_offset; Map::Vertex hit; float best_z = zone->zonemap->FindBestZ(me, &hit); if (best_z != -999999) @@ -2849,9 +2849,9 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != 0) { Map::Vertex me; - me.x = new_x; - me.y = new_y; - me.z = z_pos+z_offset; + me.x = m_Position.m_X; + me.y = m_Position.m_Y; + me.z = m_Position.m_Z+z_offset; Map::Vertex hit; float best_z = zone->zonemap->FindBestZ(me, &hit); if (best_z != -999999) @@ -3068,7 +3068,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { if(!target || !IsValidSpell(spell_id)) return false; - + int spell_trig = 0; // Count all the percentage chances to trigger for all effects for(int i = 0; i < EFFECT_COUNT; i++) @@ -5060,7 +5060,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) if (slot < 4){ if (id == "components") { spells[spell_id].components[slot];} - else if (id == "component_counts") {spells[spell_id].component_counts[slot];} + else if (id == "component_counts") {spells[spell_id].component_counts[slot];} else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];} } @@ -5138,7 +5138,7 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) else if (id == "max_dist") {stat = static_cast(spells[spell_id].max_dist); } else if (id == "min_range") {stat = static_cast(spells[spell_id].min_range); } else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; } - + return stat; } diff --git a/zone/mob.h b/zone/mob.h index a4dd2d665..9b57bbc6a 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -23,6 +23,7 @@ #include "entity.h" #include "hate_list.h" #include "pathing.h" +#include "position.h" #include #include #include @@ -176,7 +177,7 @@ public: bool IsInvisible(Mob* other = 0) const; void SetInvisible(uint8 state); bool AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* weapon); - + //Song bool UseBardSpellLogic(uint16 spell_id = 0xffff, int slot = -1); bool ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot); @@ -392,10 +393,10 @@ public: ((static_cast(cur_mana) / max_mana) * 100); } virtual int32 CalcMaxMana(); uint32 GetNPCTypeID() const { return npctype_id; } - inline const float GetX() const { return x_pos; } - inline const float GetY() const { return y_pos; } - inline const float GetZ() const { return z_pos; } - inline const float GetHeading() const { return heading; } + inline const float GetX() const { return m_Position.m_X; } + inline const float GetY() const { return m_Position.m_Y; } + inline const float GetZ() const { return m_Position.m_Z; } + inline const float GetHeading() const { return m_Position.m_Heading; } inline const float GetSize() const { return size; } inline const float GetBaseSize() const { return base_size; } inline const float GetTarX() const { return tarx; } @@ -437,8 +438,8 @@ public: void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu); void SendPosition(); void SetFlyMode(uint8 flymode); - inline void Teleport(Map::Vertex NewPosition) { x_pos = NewPosition.x; y_pos = NewPosition.y; - z_pos = NewPosition.z; }; + inline void Teleport(Map::Vertex NewPosition) { m_Position.m_X = NewPosition.x; m_Position.m_Y = NewPosition.y; + m_Position.m_Z = NewPosition.z; }; //AI static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); @@ -459,8 +460,8 @@ public: bool IsEngaged() { return(!hate_list.IsEmpty()); } bool HateSummon(); void FaceTarget(Mob* MobToFace = 0); - void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); - heading = iHeading; } } + void SetHeading(float iHeading) { if(m_Position.m_Heading != iHeading) { pLastChange = Timer::GetCurrentTime(); + m_Position.m_Heading = iHeading; } } void WipeHateList(); void AddFeignMemory(Client* attacker); void RemoveFromFeignMemory(Client* attacker); @@ -566,10 +567,10 @@ public: int16 CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, bool best_focus=false); uint8 IsFocusEffect(uint16 spellid, int effect_index, bool AA=false,uint32 aa_effect=0); - void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, - uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, - uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, - uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, + void SendIllusionPacket(uint16 in_race, uint8 in_gender = 0xFF, uint8 in_texture = 0xFF, uint8 in_helmtexture = 0xFF, + uint8 in_haircolor = 0xFF, uint8 in_beardcolor = 0xFF, uint8 in_eyecolor1 = 0xFF, uint8 in_eyecolor2 = 0xFF, + uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, + uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = -1.0f); virtual void Stun(int duration); virtual void UnStun(); @@ -617,7 +618,7 @@ public: bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } bool DoHPToManaCovert(uint16 mana_cost = 0); int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); - int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); + int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg); void MeleeLifeTap(int32 damage); bool PassCastRestriction(bool UseCastRestriction = true, int16 value = 0, bool IsDamage = true); @@ -678,9 +679,9 @@ public: inline int16 GetTempPetCount() const { return count_TempPet; } inline void SetTempPetCount(int16 i) { count_TempPet = i; } bool HasPetAffinity() { if (aabonuses.GivePetGroupTarget || itembonuses.GivePetGroupTarget || spellbonuses.GivePetGroupTarget) return true; return false; } - inline bool IsPetOwnerClient() const { return pet_owner_client; } + inline bool IsPetOwnerClient() const { return pet_owner_client; } inline void SetPetOwnerClient(bool value) { pet_owner_client = value; } - inline bool IsTempPet() const { return _IsTempPet; } + inline bool IsTempPet() const { return _IsTempPet; } inline void SetTempPet(bool value) { _IsTempPet = value; } inline const bodyType GetBodyType() const { return bodytype; } @@ -806,7 +807,7 @@ public: void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } // calculate interruption of spell via movement of mob - void SaveSpellLoc() {spell_x = x_pos; spell_y = y_pos; spell_z = z_pos; } + void SaveSpellLoc() {spell_x = m_Position.m_X; spell_y = m_Position.m_Y; spell_z = m_Position.m_Z; } inline float GetSpellX() const {return spell_x;} inline float GetSpellY() const {return spell_y;} inline float GetSpellZ() const {return spell_z;} @@ -860,7 +861,7 @@ public: Shielders_Struct shielder[MAX_SHIELDERS]; Trade* trade; - + inline float GetCWPX() const { return(cur_wp_x); } inline float GetCWPY() const { return(cur_wp_y); } inline float GetCWPZ() const { return(cur_wp_z); } @@ -998,10 +999,7 @@ protected: uint8 level; uint8 orig_level; uint32 npctype_id; - float x_pos; - float y_pos; - float z_pos; - float heading; + xyz_heading m_Position; uint16 animation; float base_size; float size; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 614ba984d..67b0e6678 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1792,7 +1792,7 @@ void NPC::AI_DoMovement() { CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); else { - if(!((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z))) + if(!((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z))) { bool WaypointChanged, NodeReached; Map::Vertex Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); diff --git a/zone/spells.cpp b/zone/spells.cpp index 69ded563c..f50d74bbf 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -297,7 +297,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, sprintf(temp, "%d", spell_id); parse->EventNPC(EVENT_CAST_BEGIN, CastToNPC(), nullptr, temp, 0); } - + //To prevent NPC ghosting when spells are cast from scripts if (IsNPC() && IsMoving() && cast_time > 0) SendPosition(); @@ -1607,7 +1607,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) return false; - + ae_center = spell_target; CastAction = AETarget; } @@ -1626,7 +1626,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) return false; - + ae_center = spell_target; CastAction = AETarget; } @@ -2072,7 +2072,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } else { // regular PB AE or targeted AE spell - spell_target is null if PB if(spell_target) // this must be an AETarget spell - { + { bool cast_on_target = true; if (spells[spell_id].targettype == ST_TargetAENoPlayersPets && spell_target->IsPetOwnerClient()) cast_on_target = false; @@ -2181,7 +2181,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 ConeDirectional(spell_id, resist_adjust); break; } - + case Beam: { BeamDirectional(spell_id, resist_adjust); @@ -3704,7 +3704,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (IsValidSpell(spells[spell_id].RecourseLink)) SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff); - + if (IsDetrimentalSpell(spell_id)) { CheckNumHitsRemaining(NUMHIT_OutgoingSpells); @@ -3831,9 +3831,9 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) rezz->zone_id = zone->GetZoneID(); rezz->instance_id = zone->GetInstanceID(); rezz->spellid = spellid; - rezz->x = this->x_pos; - rezz->y = this->y_pos; - rezz->z = this->z_pos; + rezz->x = this->m_Position.m_X; + rezz->y = this->m_Position.m_Y; + rezz->z = this->m_Position.m_Z; rezz->unknown000 = 0x00000000; rezz->unknown020 = 0x00000000; rezz->unknown088 = 0x00000000; @@ -4495,7 +4495,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(partial_modifier <= 0) { return 100; - } + } else if(partial_modifier >= 100) { return 0; @@ -4816,7 +4816,7 @@ void Client::UnmemSpell(int slot, bool update_client) m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); - + if(update_client) { MemorizeSpell(slot, m_pp.mem_spells[slot], memSpellForget); @@ -4860,8 +4860,8 @@ void Client::UnscribeSpell(int slot, bool update_client) mlog(CLIENT__SPELLS, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; - - database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); + + database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); if(update_client) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_DeleteSpell, sizeof(DeleteSpell_Struct)); @@ -4889,7 +4889,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - mlog(CLIENT__SPELLS, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + mlog(CLIENT__SPELLS, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -5438,27 +5438,27 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) if (IsBeneficialSpell(spell_id) && IsClient()) beneficial_targets = true; - + std::list targets_in_range; std::list::iterator iter; entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].range, spells[spell_id].range / 2, targets_in_range); iter = targets_in_range.begin(); - + float dX = 0; float dY = 0; float dZ = 0; - + CalcDestFromHeading(GetHeading(), spells[spell_id].range, 5, GetX(), GetY(), dX, dY, dZ); dZ = GetZ(); - + //FIND SLOPE: Put it into the form y = mx + b float m = (dY - GetY()) / (dX - GetX()); float b = (GetY() * dX - dY * GetX()) / (dX - GetX()); - + while(iter != targets_in_range.end()) { - if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) + if (!(*iter) || (beneficial_targets && ((*iter)->IsNPC() && !(*iter)->IsPetOwnerClient())) || (*iter)->BehindMob(this, (*iter)->GetX(),(*iter)->GetY())){ ++iter; continue; @@ -5466,7 +5466,7 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust) //# shortest distance from line to target point float d = abs( (*iter)->GetY() - m * (*iter)->GetX() - b) / sqrt(m * m + 1); - + if (d <= spells[spell_id].aoerange) { if(CheckLosFN((*iter)) || spells[spell_id].npc_no_los) { @@ -5513,7 +5513,7 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) } float heading_to_target = (CalculateHeadingToTarget((*iter)->GetX(), (*iter)->GetY()) * 360.0f / 256.0f); - + while(heading_to_target < 0.0f) heading_to_target += 360.0f; @@ -5544,4 +5544,4 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) ++iter; } -} \ No newline at end of file +} diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index cfefe73f3..4cb3b2e84 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -437,10 +437,10 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = 0; } else { - guard_x = x_pos; - guard_y = y_pos; - guard_z = z_pos; - guard_heading = heading; + guard_x = m_Position.m_X; + guard_y = m_Position.m_Y; + guard_z = m_Position.m_Z; + guard_heading = m_Position.m_Heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); @@ -452,7 +452,7 @@ void NPC::NextGuardPosition() { SetHeading(guard_heading); mlog(AI__WAYPOINTS, "Unable to move to next guard position. Probably rooted."); } - else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) + else if((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z)) { if(moved) { @@ -480,7 +480,7 @@ void Mob::SaveSpawnSpot() { }*/ float Mob::CalculateDistance(float x, float y, float z) { - return (float)sqrtf( ((x_pos-x)*(x_pos-x)) + ((y_pos-y)*(y_pos-y)) + ((z_pos-z)*(z_pos-z)) ); + return (float)sqrtf( ((m_Position.m_X-x)*(m_Position.m_X-x)) + ((m_Position.m_Y-y)*(m_Position.m_Y-y)) + ((m_Position.m_Z-z)*(m_Position.m_Z-z)) ); } /* @@ -491,13 +491,13 @@ uint8 NPC::CalculateHeadingToNextWaypoint() { float Mob::CalculateHeadingToTarget(float in_x, float in_y) { float angle; - if (in_x-x_pos > 0) - angle = - 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; - else if (in_x-x_pos < 0) - angle = + 90 + atan((float)(in_y-y_pos) / (float)(in_x-x_pos)) * 180 / M_PI; + if (in_x-m_Position.m_X > 0) + angle = - 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI; + else if (in_x-m_Position.m_X < 0) + angle = + 90 + atan((float)(in_y-m_Position.m_Y) / (float)(in_x-m_Position.m_X)) * 180 / M_PI; else // Added? { - if (in_y-y_pos > 0) + if (in_y-m_Position.m_Y > 0) angle = 0; else angle = 180; @@ -513,16 +513,16 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(GetID()==0) return true; - if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords - if(z_pos-z != 0) { - z_pos = z; + if ((m_Position.m_X-x == 0) && (m_Position.m_Y-y == 0)) {//spawn is at target coords + if(m_Position.m_Z-z != 0) { + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } - else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) + else if ((ABS(m_Position.m_X - x) < 0.1) && (ABS(m_Position.m_Y - y) < 0.1)) { mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); @@ -530,25 +530,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; return true; } int compare_steps = IsBoat() ? 1 : 20; if(tar_ndx < compare_steps && tarx==x && tary==y) { - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); @@ -563,25 +563,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if((ABS(x - x_pos) < 0.5) && (ABS(y - y_pos) < 0.5)) + if((ABS(x - m_Position.m_X) < 0.5) && (ABS(y - m_Position.m_Y) < 0.5)) { - if(ABS(z-z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z-m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } } @@ -600,9 +600,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b tary=y; tarz=z; - float nx = this->x_pos; - float ny = this->y_pos; - float nz = this->z_pos; + float nx = this->m_Position.m_X; + float ny = this->m_Position.m_Y; + float nz = this->m_Position.m_Z; // float nh = this->heading; tar_vx = x - nx; @@ -635,19 +635,19 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b tar_vy = tar_vy/numsteps; tar_vz = tar_vz/numsteps; - float new_x = x_pos + tar_vx; - float new_y = y_pos + tar_vy; - float new_z = z_pos + tar_vz; + float new_x = m_Position.m_X + tar_vx; + float new_y = m_Position.m_Y + tar_vy; + float new_z = m_Position.m_Z + tar_vz; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + m_Position.m_Heading = CalculateHeadingToTarget(x, y); tar_ndx=22-numsteps; - heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z, numsteps); } else { @@ -655,9 +655,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Only a single step to get there... jumping."); @@ -667,18 +667,18 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b else { tar_vector/=20; - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; - heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + m_Position.m_Heading = CalculateHeadingToTarget(x, y); + mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z, numsteps); } uint8 NPCFlyMode = 0; @@ -692,25 +692,25 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if(ABS(x - x_pos) < 0.5 && ABS(y - y_pos) < 0.5) + if(ABS(x - m_Position.m_X) < 0.5 && ABS(y - m_Position.m_Y) < 0.5) { - if(ABS(z - z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz+1; + m_Position.m_Z = newz+1; } } } @@ -718,9 +718,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b SetMoving(true); moved=true; - delta_x=x_pos-nx; - delta_y=y_pos-ny; - delta_z=z_pos-nz; + delta_x=m_Position.m_X-nx; + delta_y=m_Position.m_Y-ny; + delta_z=m_Position.m_Z-nz; delta_heading=0; if (IsClient()) @@ -746,9 +746,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(GetID()==0) return true; - float nx = x_pos; - float ny = y_pos; - float nz = z_pos; + float nx = m_Position.m_X; + float ny = m_Position.m_Y; + float nz = m_Position.m_Z; // if NPC is rooted if (speed == 0.0) { @@ -780,30 +780,30 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec // -------------------------------------------------------------------------- test_vector=sqrtf (x*x + y*y + z*z); tar_vector = speed / sqrtf (tar_vx*tar_vx + tar_vy*tar_vy + tar_vz*tar_vz); - heading = CalculateHeadingToTarget(x, y); + m_Position.m_Heading = CalculateHeadingToTarget(x, y); if (tar_vector >= 1.0) { if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); } - x_pos = x; - y_pos = y; - z_pos = z; + m_Position.m_X = x; + m_Position.m_Y = y; + m_Position.m_Z = z; mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint"); } else { - float new_x = x_pos + tar_vx*tar_vector; - float new_y = y_pos + tar_vy*tar_vector; - float new_z = z_pos + tar_vz*tar_vector; + float new_x = m_Position.m_X + tar_vx*tar_vector; + float new_y = m_Position.m_Y + tar_vy*tar_vector; + float new_z = m_Position.m_Z + tar_vz*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; - mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; + mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", m_Position.m_X, m_Position.m_Y, m_Position.m_Z); } uint8 NPCFlyMode = 0; @@ -817,25 +817,25 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { - if(ABS(x - x_pos) < 0.5 && ABS(y - y_pos) < 0.5) + if(ABS(x - m_Position.m_X) < 0.5 && ABS(y - m_Position.m_Y) < 0.5) { - if(ABS(z - z_pos) <= RuleR(Map, FixPathingZMaxDeltaMoving)) - z_pos = z; + if(ABS(z - m_Position.m_Z) <= RuleR(Map, FixPathingZMaxDeltaMoving)) + m_Position.m_Z = z; else - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } else - z_pos = newz+1; + m_Position.m_Z = newz+1; } } } @@ -845,9 +845,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec tar_ndx=0; this->SetMoving(true); moved=true; - delta_x=(x_pos-nx); - delta_y=(y_pos-ny); - delta_z=(z_pos-nz); + delta_x=(m_Position.m_X-nx); + delta_y=(m_Position.m_Y-ny); + delta_z=(m_Position.m_Z-nz); delta_heading=0;//(heading-nh)*8; SendPosUpdate(); } @@ -948,9 +948,9 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z; mlog(AI__WAYPOINTS, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) @@ -961,20 +961,20 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) ) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } else - z_pos += 0.1; + m_Position.m_Z += 0.1; } void Mob::SendToFixZ(float new_x, float new_y, float new_z) { @@ -982,9 +982,9 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z + 0.1); } - x_pos = new_x; - y_pos = new_y; - z_pos = new_z + 0.1; + m_Position.m_X = new_x; + m_Position.m_Y = new_y; + m_Position.m_Z = new_z + 0.1; //fix up pathing Z, this shouldent be needed IF our waypoints //are corrected instead @@ -992,16 +992,16 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo)) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(x_pos, y_pos, z_pos))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) { - Map::Vertex dest(x_pos, y_pos, z_pos); + Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.m_X,m_Position.m_Y,m_Position.m_Z); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. - z_pos = newz + 1; + m_Position.m_Z = newz + 1; } } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 6ac85cff6..fe6bcf557 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -347,16 +347,16 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc //set the player's coordinates in the new zone so they have them //when they zone into it - x_pos = dest_x; //these coordinates will now be saved when ~client is called - y_pos = dest_y; - z_pos = dest_z; - heading = dest_h; // Cripp: fix for zone heading + m_Position.m_X = dest_x; //these coordinates will now be saved when ~client is called + m_Position.m_Y = dest_y; + m_Position.m_Z = dest_z; + m_Position.m_Heading = dest_h; // Cripp: fix for zone heading m_pp.heading = dest_h; m_pp.zone_id = zone_id; m_pp.zoneInstance = instance_id; //Force a save so its waiting for them when they zone - Save(2); + Save(2); if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { // No need to ask worldserver if we're zoning to ourselves (most @@ -500,9 +500,9 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case GMSummon: - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); zonesummon_id = zoneID; @@ -518,31 +518,31 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z zonesummon_ignorerestrictions = ignorerestrictions; break; case GateToBindPoint: - x = x_pos = m_pp.binds[0].x; - y = y_pos = m_pp.binds[0].y; - z = z_pos = m_pp.binds[0].z; + x = m_Position.m_X = m_pp.binds[0].x; + y = m_Position.m_Y = m_pp.binds[0].y; + z = m_Position.m_Z = m_pp.binds[0].z; heading = m_pp.binds[0].heading; break; case ZoneToBindPoint: - x = x_pos = m_pp.binds[0].x; - y = y_pos = m_pp.binds[0].y; - z = z_pos = m_pp.binds[0].z; + x = m_Position.m_X = m_pp.binds[0].x; + y = m_Position.m_Y = m_pp.binds[0].y; + z = m_Position.m_Z = m_pp.binds[0].z; heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; LogFile->write(EQEMuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); break; case Rewind: - LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); - zonesummon_x = x_pos = x; - zonesummon_y = y_pos = y; - zonesummon_z = z_pos = z; + LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + zonesummon_x = m_Position.m_X = x; + zonesummon_y = m_Position.m_Y = y; + zonesummon_z = m_Position.m_Z = z; SetHeading(heading); break; default: @@ -652,10 +652,10 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z else { if(zoneID == GetZoneID()) { //properly handle proximities - entity_list.ProcessMove(this, x_pos, y_pos, z_pos); - proximity_x = x_pos; - proximity_y = y_pos; - proximity_z = z_pos; + entity_list.ProcessMove(this, m_Position.m_X, m_Position.m_Y, m_Position.m_Z); + proximity_x = m_Position.m_X; + proximity_y = m_Position.m_Y; + proximity_z = m_Position.m_Z; //send out updates to people in zone. SendPosition(); @@ -723,9 +723,9 @@ void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y if (to_zone == -1) { m_pp.binds[0].zoneId = zone->GetZoneID(); m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0; - m_pp.binds[0].x = x_pos; - m_pp.binds[0].y = y_pos; - m_pp.binds[0].z = z_pos; + m_pp.binds[0].x = m_Position.m_X; + m_pp.binds[0].y = m_Position.m_Y; + m_pp.binds[0].z = m_Position.m_Z; } else { m_pp.binds[0].zoneId = to_zone; From 096cbaf1bba58dfdc59022cba8cb0ce7eaaa66d9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 20:43:09 -0800 Subject: [PATCH 0328/1883] delta_x, delta_y, delta_z, and int delta_heading converted to m_Delta --- zone/client_packet.cpp | 5 +---- zone/client_process.cpp | 4 +--- zone/mob.cpp | 18 ++++++------------ zone/mob.h | 7 ++----- zone/mob_ai.cpp | 5 +---- zone/waypoints.cpp | 10 ++-------- 6 files changed, 13 insertions(+), 36 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 06611b413..b81ef24ea 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4558,10 +4558,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) } // Update internal state - delta_x = ppu->delta_x; - delta_y = ppu->delta_y; - delta_z = ppu->delta_z; - delta_heading = ppu->delta_heading; + m_Delta = {ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading}; if(IsTracking() && ((m_Position.m_X!=ppu->x_pos) || (m_Position.m_Y!=ppu->y_pos))){ if(MakeRandomFloat(0, 100) < 70)//should be good diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 42b1316ef..cf106ae65 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -543,9 +543,7 @@ bool Client::Process() { else { animation = 0; - delta_x = 0; - delta_y = 0; - delta_z = 0; + m_Delta = {0.0f, 0.0f, 0.0f, m_Delta.m_Heading}; SendPosUpdate(2); } } diff --git a/zone/mob.cpp b/zone/mob.cpp index cb2f6e35d..6574d481d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -255,10 +255,7 @@ Mob::Mob(const char* in_name, } } - delta_heading = 0; - delta_x = 0; - delta_y = 0; - delta_z = 0; + m_Delta = xyz_heading::Origin(); animation = 0; logging_enabled = false; @@ -1233,9 +1230,9 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) { spu->x_pos = FloatToEQ19(m_Position.m_X); spu->y_pos = FloatToEQ19(m_Position.m_Y); spu->z_pos = FloatToEQ19(m_Position.m_Z); - spu->delta_x = NewFloatToEQ13(delta_x); - spu->delta_y = NewFloatToEQ13(delta_y); - spu->delta_z = NewFloatToEQ13(delta_z); + spu->delta_x = NewFloatToEQ13(m_Delta.m_X); + spu->delta_y = NewFloatToEQ13(m_Delta.m_Y); + spu->delta_z = NewFloatToEQ13(m_Delta.m_Z); spu->heading = FloatToEQ19(m_Position.m_Heading); spu->padding0002 =0; spu->padding0006 =7; @@ -1245,7 +1242,7 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) { spu->animation = animation; else spu->animation = pRunAnimSpeed;//animation; - spu->delta_heading = NewFloatToEQ13(static_cast(delta_heading)); + spu->delta_heading = NewFloatToEQ13(m_Delta.m_Heading); } void Mob::ShowStats(Client* client) @@ -2947,10 +2944,7 @@ void Mob::TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand, in } void Mob::SetDeltas(float dx, float dy, float dz, float dh) { - delta_x = dx; - delta_y = dy; - delta_z = dz; - delta_heading = static_cast(dh); + m_Delta = {dx,dy,dz,dh}; } void Mob::SetEntityVariable(const char *id, const char *m_var) diff --git a/zone/mob.h b/zone/mob.h index 9b57bbc6a..eb6e6e99f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -421,7 +421,7 @@ public: //Movement void Warp( float x, float y, float z ); inline bool IsMoving() const { return moving; } - virtual void SetMoving(bool move) { moving = move; delta_x = 0; delta_y = 0; delta_z = 0; delta_heading = 0; } + virtual void SetMoving(bool move) { moving = move; m_Delta = xyz_heading::Origin(); } virtual void GoToBind(uint8 bindnum = 0) { } virtual void Gate(); float GetWalkspeed() const { return(_GetMovementSpeed(-47)); } @@ -1047,10 +1047,7 @@ protected: char clean_name[64]; char lastname[64]; - int32 delta_heading; - float delta_x; - float delta_y; - float delta_z; + xyz_heading m_Delta; uint8 light; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 67b0e6678..da579a2db 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -493,10 +493,7 @@ void Mob::AI_Start(uint32 iMoveDelay) { pAssistRange = 70; hate_list.Wipe(); - delta_heading = 0; - delta_x = 0; - delta_y = 0; - delta_z = 0; + m_Delta = xyz_heading::Origin(); pRunAnimSpeed = 0; pLastChange = Timer::GetCurrentTime(); } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 4cb3b2e84..9dae8d41f 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -718,10 +718,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b SetMoving(true); moved=true; - delta_x=m_Position.m_X-nx; - delta_y=m_Position.m_Y-ny; - delta_z=m_Position.m_Z-nz; - delta_heading=0; + m_Delta = {m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f}; if (IsClient()) SendPosUpdate(1); @@ -845,10 +842,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec tar_ndx=0; this->SetMoving(true); moved=true; - delta_x=(m_Position.m_X-nx); - delta_y=(m_Position.m_Y-ny); - delta_z=(m_Position.m_Z-nz); - delta_heading=0;//(heading-nh)*8; + m_Delta = {m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f}; SendPosUpdate(); } tar_ndx++; From 0598f7e87ccc791223617f17f763c32729c7e614 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 25 Nov 2014 22:47:50 -0600 Subject: [PATCH 0329/1883] Fixed an issue that has surfaced with new code behaving how it should, breaking old code. Naked corpses were not despawning on their decay timers because of incorrect return logic on a database function Removed ClearCorpseItems as it is no longer necessary as corpses deleted items appropriately when they are removed from the corpse General cleanup of functions and variables in corpse code --- zone/corpse.cpp | 236 ++++++++++++++++++++++-------------- zone/corpse.h | 4 +- zone/lua_corpse.cpp | 2 +- zone/perl_player_corpse.cpp | 2 +- zone/zonedb.cpp | 10 -- zone/zonedb.h | 1 - 6 files changed, 150 insertions(+), 105 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8be978350..6572012bc 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -140,16 +140,58 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ return pc; } -// To be used on NPC death and ZoneStateLoad -// Mongrel: added see_invis and see_invis_undead Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime) -// vesuvias - appearence fix -: Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid,//bodytype added - in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0, - in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0, - in_npc->GetTexture(),in_npc->GetHelmTexture(), - 0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0), + : Mob("Unnamed_Corpse", // const char* in_name, + "", // const char* in_lastname, + 0, // int32 in_cur_hp, + 0, // int32 in_max_hp, + in_npc->GetGender(), // uint8 in_gender, + in_npc->GetRace(), // uint16 in_race, + in_npc->GetClass(), // uint8 in_class, + BT_Humanoid, // bodyType in_bodytype, + in_npc->GetDeity(), // uint8 in_deity, + in_npc->GetLevel(), // uint8 in_level, + in_npc->GetNPCTypeID(), // uint32 in_npctype_id, + in_npc->GetSize(), // float in_size, + 0, // float in_runspeed, + in_npc->GetHeading(), // float in_heading, + in_npc->GetX(), // float in_x_pos, + in_npc->GetY(), // float in_y_pos, + in_npc->GetZ(), // float in_z_pos, + 0, // uint8 in_light, + in_npc->GetTexture(), // uint8 in_texture, + in_npc->GetHelmTexture(), // uint8 in_helmtexture, + 0, // uint16 in_ac, + 0, // uint16 in_atk, + 0, // uint16 in_str, + 0, // uint16 in_sta, + 0, // uint16 in_dex, + 0, // uint16 in_agi, + 0, // uint16 in_int, + 0, // uint16 in_wis, + 0, // uint16 in_cha, + 0, // uint8 in_haircolor, + 0, // uint8 in_beardcolor, + 0, // uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? + 0, // uint8 in_eyecolor2, + 0, // uint8 in_hairstyle, + 0, // uint8 in_luclinface, + 0, // uint8 in_beard, + 0, // uint32 in_drakkin_heritage, + 0, // uint32 in_drakkin_tattoo, + 0, // uint32 in_drakkin_details, + 0, // uint32 in_armor_tint[_MaterialCount], + 0xff, // uint8 in_aa_title, + 0, // uint8 in_see_invis, // see through invis/ivu + 0, // uint8 in_see_invis_undead, + 0, // uint8 in_see_hide, + 0, // uint8 in_see_improved_hide, + 0, // int32 in_hp_regen, + 0, // int32 in_mana_regen, + 0, // uint8 in_qglobal, + 0, // uint8 in_maxlevel, + 0 // uint32 in_scalerate +), corpse_decay_timer(in_decaytime), corpse_res_timer(0), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), @@ -157,7 +199,9 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP loot_cooldown_timer(10) { corpse_graveyard_timer.Disable(); + memset(item_tint, 0, sizeof(item_tint)); + is_corpse_changed = false; is_player_corpse = false; is_locked = false; @@ -396,7 +440,6 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( Save(); } -// solar: helper function for client corpse constructor std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot) { int bagindex; @@ -425,59 +468,59 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 return returnlist; } -// To be called from LoadFromDBData -// Mongrel: added see_invis and see_invis_undead +/* Called from Database Load */ + Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) -: Mob("Unnamed_Corpse", -"", -0, -0, -in_gender, -in_race, -in_class, -BT_Humanoid, -in_deity, -in_level, -0, -in_size, -0, -in_heading, -in_x, -in_y, -in_z, -0, -in_texture, -in_helmtexture, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0xff, -0, -0, -0, -0, -0, -0, -0, -0, -0), + : Mob("Unnamed_Corpse", // const char* in_name, + "", // const char* in_lastname, + 0, // int32 in_cur_hp, + 0, // int32 in_max_hp, + in_gender, // uint8 in_gender, + in_race, // uint16 in_race, + in_class, // uint8 in_class, + BT_Humanoid, // bodyType in_bodytype, + in_deity, // uint8 in_deity, + in_level, // uint8 in_level, + 0, // uint32 in_npctype_id, + in_size, // float in_size, + 0, // float in_runspeed, + in_heading, // float in_heading, + in_x, // float in_x_pos, + in_y, // float in_y_pos, + in_z, // float in_z_pos, + 0, // uint8 in_light, + in_texture, // uint8 in_texture, + in_helmtexture, // uint8 in_helmtexture, + 0, // uint16 in_ac, + 0, // uint16 in_atk, + 0, // uint16 in_str, + 0, // uint16 in_sta, + 0, // uint16 in_dex, + 0, // uint16 in_agi, + 0, // uint16 in_int, + 0, // uint16 in_wis, + 0, // uint16 in_cha, + 0, // uint8 in_haircolor, + 0, // uint8 in_beardcolor, + 0, // uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye? + 0, // uint8 in_eyecolor2, + 0, // uint8 in_hairstyle, + 0, // uint8 in_luclinface, + 0, // uint8 in_beard, + 0, // uint32 in_drakkin_heritage, + 0, // uint32 in_drakkin_tattoo, + 0, // uint32 in_drakkin_details, + 0, // uint32 in_armor_tint[_MaterialCount], + 0xff, // uint8 in_aa_title, + 0, // uint8 in_see_invis, // see through invis/ivu + 0, // uint8 in_see_invis_undead, + 0, // uint8 in_see_hide, + 0, // uint8 in_see_improved_hide, + 0, // int32 in_hp_regen, + 0, // int32 in_mana_regen, + 0, // uint8 in_qglobal, + 0, // uint8 in_maxlevel, + 0), // uint32 in_scalerate corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), @@ -487,8 +530,9 @@ in_helmtexture, LoadPlayerCorpseDecayTime(in_dbid); - if(!zone->HasGraveyard() || wasAtGraveyard) + if (!zone->HasGraveyard() || wasAtGraveyard){ corpse_graveyard_timer.Disable(); + } memset(item_tint, 0, sizeof(item_tint)); @@ -504,10 +548,12 @@ in_helmtexture, strcpy(orgname, in_charname); strcpy(name, in_charname); + this->copper = in_copper; this->silver = in_silver; this->gold = in_gold; this->platinum = in_plat; + rezzexp = in_rezexp; for (int i = 0; i < MAX_LOOTERS; i++){ @@ -757,16 +803,19 @@ void Corpse::RemoveCash() { bool Corpse::IsEmpty() const { if (copper != 0 || silver != 0 || gold != 0 || platinum != 0) return false; + return(itemlist.size() == 0); } bool Corpse::Process() { - if (player_corpse_depop) + if (player_corpse_depop){ return false; + } if(corpse_delay_timer.Check()) { - for (int i=0; iwrite(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); } - else - { + else { LogFile->write(EQEMuLog::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } @@ -828,19 +885,22 @@ void Corpse::SetDecayTimer(uint32 decaytime) { corpse_decay_timer.Start(decaytime); } -bool Corpse::CanMobLoot(int charid) { - uint8 z=0; - for(int i=0; iCastToClient()->CharacterID(); } -// @merth: this function needs some work void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) { // Added 12/08. Started compressing loot struct on live. char tmp[10]; @@ -883,18 +942,18 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a } uint8 tCanLoot = 1; - bool lootcoin = false; - if(database.GetVariable("LootCoin", tmp, 9)) { lootcoin = (atoi(tmp) == 1); } + bool loot_coin = false; + if(database.GetVariable("LootCoin", tmp, 9)) { loot_coin = (atoi(tmp) == 1); } if(this->being_looted_by != 0xFFFFFFFF && this->being_looted_by != client->GetID()) { SendLootReqErrorPacket(client, 0); tCanLoot = 0; } else if(IsPlayerCorpse() && char_id == client->CharacterID()) { tCanLoot = 2; } - else if((IsNPCCorpse() || become_npc) && CanMobLoot(client->CharacterID())) { tCanLoot = 2; } - else if(GetPKItem() == -1 && CanMobLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash - else if(GetPKItem() == 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash - else if(GetPKItem() > 1 && CanMobLoot(client->CharacterID())) { tCanLoot = 5; } //pvp loot 1 set item, variable cash + else if((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) { tCanLoot = 2; } + else if(GetPKItem() == -1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash + else if(GetPKItem() == 1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash + else if(GetPKItem() > 1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 5; } //pvp loot 1 set item, variable cash if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } } @@ -906,7 +965,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a d->response = 1; d->unknown1 = 0x42; d->unknown2 = 0xef; - if(tCanLoot == 2 || (tCanLoot >= 3 && lootcoin)) { // dont take the coin off if it's a gm peeking at the corpse + if(tCanLoot == 2 || (tCanLoot >= 3 && loot_coin)) { // dont take the coin off if it's a gm peeking at the corpse if(!IsPlayerCorpse() && client->IsGrouped() && client->AutoSplitEnabled() && client->GetGroup()) { d->copper = 0; @@ -951,8 +1010,6 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a cur = itemlist.begin(); end = itemlist.end(); - uint8 containercount = 0; - int corpselootlimit = EQLimits::InventoryMapSize(MapCorpse, client->GetClientVersion()); for(; cur != end; ++cur) { @@ -1045,7 +1102,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { SendEndLootErrorPacket(client); return; } - if (IsPlayerCorpse() && !CanMobLoot(client->CharacterID()) && !become_npc && (char_id != client->CharacterID() && client->Admin() < 150)) { + if (IsPlayerCorpse() && !CanPlayerLoot(client->CharacterID()) && !become_npc && (char_id != client->CharacterID() && client->Admin() < 150)) { client->Message(13, "Error: This is a player corpse and you dont own it."); SendEndLootErrorPacket(client); return; @@ -1055,7 +1112,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { client->Message(13, "Error: Corpse locked by GM."); return; } - if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanMobLoot(client->CharacterID()) && GetPKItem() == 0){ + if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPKItem() == 0){ client->Message(13, "Error: You cannot loot any more items from this corpse."); SendEndLootErrorPacket(client); being_looted_by = 0xFFFFFFFF; @@ -1222,7 +1279,6 @@ void Corpse::EndLoot(Client* client, const EQApplicationPacket* app) { client->QueuePacket(outapp); safe_delete(outapp); - //client->Save(); //inventory operations auto-commit this->being_looted_by = 0xFFFFFFFF; if (this->IsEmpty()) Delete(); diff --git a/zone/corpse.h b/zone/corpse.h index f365dd041..4f0e96d05 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -69,7 +69,7 @@ public: inline uint32 GetDBID() { return corpse_db_id; } inline char* GetOwnerName() { return orgname;} - void SetDecayTimer(uint32 decaytime); + void SetDecayTimer(uint32 decay_time); bool IsEmpty() const; void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); uint32 GetWornItem(int16 equipSlot) const; @@ -99,7 +99,7 @@ public: void CompleteRezz(); void SetPKItem(int32 id) { player_kill_item = id; } int32 GetPKItem() { return player_kill_item; } - bool CanMobLoot(int charid); + bool CanPlayerLoot(int charid); void AllowMobLoot(Mob *them, uint8 slot); void AddLooter(Mob *who); bool IsRezzed() { return rez; } diff --git a/zone/lua_corpse.cpp b/zone/lua_corpse.cpp index beada7e9a..5862bbe96 100644 --- a/zone/lua_corpse.cpp +++ b/zone/lua_corpse.cpp @@ -114,7 +114,7 @@ void Lua_Corpse::SetDecayTimer(uint32 decaytime) { bool Lua_Corpse::CanMobLoot(int charid) { Lua_Safe_Call_Bool(); - return self->CanMobLoot(charid); + return self->CanPlayerLoot(charid); } void Lua_Corpse::AllowMobLoot(Lua_Mob them, uint8 slot) { diff --git a/zone/perl_player_corpse.cpp b/zone/perl_player_corpse.cpp index af5c79f16..f8b2d4388 100644 --- a/zone/perl_player_corpse.cpp +++ b/zone/perl_player_corpse.cpp @@ -687,7 +687,7 @@ XS(XS_Corpse_CanMobLoot) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->CanMobLoot(charid); + RETVAL = THIS->CanPlayerLoot(charid); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 11d76e4af..8794f3570 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3937,15 +3937,6 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { return 0; } -bool ZoneDatabase::ClearCorpseItems(uint32 db_id){ - std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id); - auto results = QueryDatabase(query); - if (results.Success() && results.RowsAffected() != 0){ - return true; - } - return false; -} - bool ZoneDatabase::DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id){ std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u AND equip_slot = %u AND item_id = %u", db_id, equip_slot, item_id); auto results = QueryDatabase(query); @@ -3959,7 +3950,6 @@ bool ZoneDatabase::BuryCharacterCorpse(uint32 db_id) { std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %u", db_id); auto results = QueryDatabase(query); if (results.Success() && results.RowsAffected() != 0){ - ClearCorpseItems(db_id); return true; } return false; diff --git a/zone/zonedb.h b/zone/zonedb.h index 33554aac3..3f8719946 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -295,7 +295,6 @@ public: bool NoRentExpired(const char* name); /* Corpses */ - bool ClearCorpseItems(uint32 db_id); bool DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id); uint32 GetCharacterCorpseItemCount(uint32 corpse_id); bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs); From 5115a29bb77921062b43fd0d16d8080e086ee3b3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 21:06:13 -0800 Subject: [PATCH 0330/1883] spell_x,spell_y, spell_z converted to m_SpellLocation, xyz_location --- zone/mob.h | 10 +++++----- zone/spells.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/mob.h b/zone/mob.h index eb6e6e99f..493288c51 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -807,10 +807,10 @@ public: void SetDontCureMeBefore(uint32 time) { pDontCureMeBefore = time; } // calculate interruption of spell via movement of mob - void SaveSpellLoc() {spell_x = m_Position.m_X; spell_y = m_Position.m_Y; spell_z = m_Position.m_Z; } - inline float GetSpellX() const {return spell_x;} - inline float GetSpellY() const {return spell_y;} - inline float GetSpellZ() const {return spell_z;} + void SaveSpellLoc() {m_SpellLocation = m_Position; } + inline float GetSpellX() const {return m_SpellLocation.m_X;} + inline float GetSpellY() const {return m_SpellLocation.m_Y;} + inline float GetSpellZ() const {return m_SpellLocation.m_Z;} inline bool IsGrouped() const { return isgrouped; } void SetGrouped(bool v); inline bool IsRaidGrouped() const { return israidgrouped; } @@ -1069,7 +1069,7 @@ protected: //spell casting vars Timer spellend_timer; uint16 casting_spell_id; - float spell_x, spell_y, spell_z; + xyz_location m_SpellLocation; int attacked_count; bool delaytimer; uint16 casting_spell_targetid; diff --git a/zone/spells.cpp b/zone/spells.cpp index f50d74bbf..52bb094fa 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -350,7 +350,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - mlog(SPELLS__CASTING, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + mlog(SPELLS__CASTING, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, m_SpellLocation.m_X, m_SpellLocation.m_Y, m_SpellLocation.m_Z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this From fbaae2b1e471a9c007c6b2e181c1c8eb735c86ca Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 25 Nov 2014 23:17:08 -0600 Subject: [PATCH 0331/1883] Renamed Corpse::LoadFromDBData to Corpse* Corpse::LoadCharacterCorpseEntity Corpse Private class descriptors added General cleanup --- zone/corpse.cpp | 125 ++++++++++++++++++++++++++++-------------------- zone/corpse.h | 39 +++++++-------- zone/npc.h | 3 +- zone/spells.cpp | 4 +- zone/zonedb.cpp | 8 ++-- 5 files changed, 100 insertions(+), 79 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 6572012bc..0b93306f1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,8 +63,7 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard) -{ +Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard){ uint32 item_count = database.GetCharacterCorpseItemCount(in_dbid); char *buffer = new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; PlayerCorpse_Struct *pcs = (PlayerCorpse_Struct*)buffer; @@ -105,11 +104,11 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ pcs->exp, // uint32 in_rezexp was_at_graveyard // bool wasAtGraveyard ); - if (pcs->locked) + if (pcs->locked){ pc->Lock(); + } /* Load Item Tints */ - // memcpy(pc->item_tint, pcs->item_tint, sizeof(pc->item_tint)); 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; @@ -118,8 +117,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ 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[8].color = pcs->item_tint[8].color; /* Load Physical Appearance */ pc->haircolor = pcs->haircolor; @@ -231,15 +229,15 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000); } + if(in_npc->HasPrivateCorpse()) { corpse_delay_timer.SetTimer(corpse_decay_timer.GetRemainingTime() + 1000); } - // Added By Hogie -- End for (int i = 0; i < MAX_LOOTERS; i++){ allowed_looters[i] = 0; } - this->rezzexp = 0; + this->rez_experience = 0; } Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( @@ -317,8 +315,8 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( } is_corpse_changed = true; - rezzexp = in_rezexp; - can_rez = true; + rez_experience = in_rezexp; + can_corpse_be_rezzed = true; is_player_corpse = true; is_locked = false; being_looted_by = 0xFFFFFFFF; @@ -386,9 +384,9 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // this was mainly for client profile state reflection..should match db player inventory entries now. iter_queue it; - for(it=client->GetInv().cursor_begin(),i=8001; it!=client->GetInv().cursor_end(); ++it,i++) { + for (it = client->GetInv().cursor_begin(), i = 8001; it != client->GetInv().cursor_end(); ++it, i++) { item = *it; - if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { + if ((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { std::list slot_list = MoveItemToCorpse(client, item, i); removed_list.merge(slot_list); cursor = true; @@ -397,16 +395,17 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( } database.TransactionBegin(); - if(removed_list.size() != 0) { + if (removed_list.size() != 0) { std::stringstream ss(""); ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID(); ss << " AND ("; std::list::const_iterator iter = removed_list.begin(); bool first = true; - while(iter != removed_list.end()) { - if(first) { + while (iter != removed_list.end()) { + if (first) { first = false; - } else { + } + else { ss << " OR "; } ss << "slotid=" << (*iter); @@ -416,8 +415,8 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( database.QueryDatabase(ss.str().c_str()); } - if(cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) - while(!client->GetInv().CursorEmpty()) + if (cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) + while (!client->GetInv().CursorEmpty()) client->DeleteItemInInventory(MainCursor, 0, false, false); } else { // only visible cursor made it to corpse (client >= Sof and RespawnFromHover = true) @@ -451,13 +450,13 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 returnlist.push_back(equipslot); // Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea. - if(item->IsType(ItemClassContainer) && ((equipslot >= EmuConstants::GENERAL_BEGIN && equipslot <= MainCursor))) { - for(bagindex = SUB_BEGIN; bagindex <= EmuConstants::ITEM_CONTAINER_SIZE; bagindex++) { + if (item->IsType(ItemClassContainer) && ((equipslot >= EmuConstants::GENERAL_BEGIN && equipslot <= MainCursor))) { + for (bagindex = SUB_BEGIN; bagindex <= EmuConstants::ITEM_CONTAINER_SIZE; bagindex++) { // For empty bags in cursor queue, slot was previously being resolved as SLOT_INVALID (-1) interior_slot = Inventory::CalcSlotId(equipslot, bagindex); interior_item = client->GetInv().GetItem(interior_slot); - if(interior_item) { + if (interior_item) { AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4)); returnlist.push_back(Inventory::CalcSlotId(equipslot, bagindex)); client->DeleteItemInInventory(interior_slot, 0, true, false); @@ -554,7 +553,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi this->gold = in_gold; this->platinum = in_plat; - rezzexp = in_rezexp; + rez_experience = in_rezexp; for (int i = 0; i < MAX_LOOTERS; i++){ allowed_looters[i] = 0; @@ -564,7 +563,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi Corpse::~Corpse() { if (is_player_corpse && !(player_corpse_depop && corpse_db_id == 0)) { - Save(); + Save(); } ItemList::iterator cur,end; cur = itemlist.begin(); @@ -618,7 +617,7 @@ bool Corpse::Save() { dbpc->level = level; dbpc->texture = this->texture; dbpc->helmtexture = this->helmtexture; - dbpc->exp = rezzexp; + dbpc->exp = rez_experience; memcpy(dbpc->item_tint, item_tint, sizeof(dbpc->item_tint)); dbpc->haircolor = haircolor; @@ -664,10 +663,10 @@ void Corpse::Delete() { } void Corpse::Bury() { - if (IsPlayerCorpse() && corpse_db_id != 0) + if (IsPlayerCorpse() && corpse_db_id != 0){ database.BuryCharacterCorpse(corpse_db_id); + } corpse_db_id = 0; - player_corpse_depop = true; } @@ -677,7 +676,7 @@ void Corpse::Depop() { } void Corpse::DepopCorpse() { - player_corpse_depop = true; + player_corpse_depop = true; } uint32 Corpse::CountItems() { @@ -689,7 +688,9 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui return; is_corpse_changed = true; + ServerLootItem_Struct* item = new ServerLootItem_Struct; + memset(item, 0, sizeof(ServerLootItem_Struct)); item->item_id = itemnum; item->charges = charges; @@ -705,7 +706,6 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data) { ServerLootItem_Struct *sitem = 0, *sitem2; - // find the item ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); @@ -721,9 +721,9 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct** cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; ++cur) { + for (; cur != end; ++cur) { sitem2 = *cur; - if(sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10) { + if (sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10) { bag_item_data[sitem2->equip_slot - bagstart] = sitem2; } } @@ -753,7 +753,7 @@ void Corpse::RemoveItem(uint16 lootslot) { ItemList::iterator cur,end; cur = itemlist.begin(); end = itemlist.end(); - for(; cur != end; ++cur) { + for (; cur != end; ++cur) { ServerLootItem_Struct* sitem = *cur; if (sitem->lootslot == lootslot) { RemoveItem(sitem); @@ -812,7 +812,7 @@ bool Corpse::Process() { return false; } - if(corpse_delay_timer.Check()) { + if (corpse_delay_timer.Check()) { for (int i = 0; i < MAX_LOOTERS; i++){ allowed_looters[i] = 0; } @@ -820,8 +820,8 @@ bool Corpse::Process() { return true; } - if(corpse_graveyard_timer.Check()) { - if(zone->HasGraveyard()) { + if (corpse_graveyard_timer.Check()) { + if (zone->HasGraveyard()) { Save(); player_corpse_depop = true; database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), @@ -849,7 +849,7 @@ bool Corpse::Process() { */ /* This is when a corpse hits decay timer and does checks*/ - if(corpse_decay_timer.Check()) { + if (corpse_decay_timer.Check()) { /* NPC */ if (IsNPCCorpse()){ corpse_decay_timer.Disable(); @@ -860,7 +860,7 @@ bool Corpse::Process() { Delete(); } else { - if(database.BuryCharacterCorpse(corpse_db_id)) { + if (database.BuryCharacterCorpse(corpse_db_id)) { Save(); player_corpse_depop = true; corpse_db_id = 0; @@ -887,7 +887,7 @@ void Corpse::SetDecayTimer(uint32 decaytime) { bool Corpse::CanPlayerLoot(int charid) { uint8 looters = 0; - for(int i = 0; i < MAX_LOOTERS; i++) { + for (int i = 0; i < MAX_LOOTERS; i++) { if (allowed_looters[i] != 0){ looters++; } @@ -933,31 +933,49 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a return; } - if(being_looted_by == 0) { being_looted_by = 0xFFFFFFFF; } + if(being_looted_by == 0) { + being_looted_by = 0xFFFFFFFF; + } if(this->being_looted_by != 0xFFFFFFFF) { // lets double check.... Entity* looter = entity_list.GetID(this->being_looted_by); - if(looter == 0) { this->being_looted_by = 0xFFFFFFFF; } + if(looter == 0) { + this->being_looted_by = 0xFFFFFFFF; + } } - uint8 tCanLoot = 1; + uint8 Loot_Request_Type = 1; bool loot_coin = false; if(database.GetVariable("LootCoin", tmp, 9)) { loot_coin = (atoi(tmp) == 1); } - if(this->being_looted_by != 0xFFFFFFFF && this->being_looted_by != client->GetID()) { + if (this->being_looted_by != 0xFFFFFFFF && this->being_looted_by != client->GetID()) { SendLootReqErrorPacket(client, 0); - tCanLoot = 0; + Loot_Request_Type = 0; + } + else if (IsPlayerCorpse() && char_id == client->CharacterID()) { + Loot_Request_Type = 2; + } + else if ((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) { + Loot_Request_Type = 2; + } + else if (GetPKItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */ + Loot_Request_Type = 3; + } + else if (GetPKItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */ + Loot_Request_Type = 4; + } + else if (GetPKItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */ + Loot_Request_Type = 5; } - else if(IsPlayerCorpse() && char_id == client->CharacterID()) { tCanLoot = 2; } - else if((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) { tCanLoot = 2; } - else if(GetPKItem() == -1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 3; } //pvp loot all items, variable cash - else if(GetPKItem() == 1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 4; } //pvp loot 1 item, variable cash - else if(GetPKItem() > 1 && CanPlayerLoot(client->CharacterID())) { tCanLoot = 5; } //pvp loot 1 set item, variable cash - if(tCanLoot == 1) { if(client->Admin() < 100 || !client->GetGM()) { SendLootReqErrorPacket(client, 2); } } + if (Loot_Request_Type == 1) { + if (client->Admin() < 100 || !client->GetGM()) { + SendLootReqErrorPacket(client, 2); + } + } - if(tCanLoot >= 2 || (tCanLoot == 1 && client->Admin() >= 100 && client->GetGM())) { + if(Loot_Request_Type >= 2 || (Loot_Request_Type == 1 && client->Admin() >= 100 && client->GetGM())) { this->being_looted_by = client->GetID(); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct)); moneyOnCorpseStruct* d = (moneyOnCorpseStruct*) outapp->pBuffer; @@ -965,8 +983,9 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a d->response = 1; d->unknown1 = 0x42; d->unknown2 = 0xef; - if(tCanLoot == 2 || (tCanLoot >= 3 && loot_coin)) { // dont take the coin off if it's a gm peeking at the corpse + /* Dont take the coin off if it's a gm peeking at the corpse */ + if(Loot_Request_Type == 2 || (Loot_Request_Type >= 3 && loot_coin)) { if(!IsPlayerCorpse() && client->IsGrouped() && client->AutoSplitEnabled() && client->GetGroup()) { d->copper = 0; d->silver = 0; @@ -990,7 +1009,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a outapp->priority = 6; client->QueuePacket(outapp); safe_delete(outapp); - if(tCanLoot == 5) { + if(Loot_Request_Type == 5) { int pkitem = GetPKItem(); const Item_Struct* item = database.GetItem(pkitem); ItemInst* inst = database.CreateItem(item, item->MaxCharges); @@ -1019,7 +1038,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // Dont display the item if it's in a bag // Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse. - if(!IsPlayerCorpse() || item_data->equip_slot <= MainCursor || item_data->equip_slot == MainPowerSource || tCanLoot>=3 || + if(!IsPlayerCorpse() || item_data->equip_slot <= MainCursor || item_data->equip_slot == MainPowerSource || Loot_Request_Type>=3 || (item_data->equip_slot >= 8000 && item_data->equip_slot <= 8999)) { if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); @@ -1398,7 +1417,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { } void Corpse::CompleteRezz(){ - rezzexp = 0; + rez_experience = 0; is_corpse_changed = true; this->Save(); } diff --git a/zone/corpse.h b/zone/corpse.h index 4f0e96d05..9fe6a899a 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -36,7 +36,7 @@ public: Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); - static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); + static Corpse* LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } @@ -109,7 +109,7 @@ public: char orgname[64]; uint32 GetEquipment(uint8 material_slot) const; // returns item id uint32 GetEquipmentColor(uint8 material_slot) const; - inline int GetRezzExp() { return rezzexp; } + inline int GetRezzExp() { return rez_experience; } // these are a temporary work-around until corpse inventory is removed from the database blob static int16 ServerToCorpseSlot(int16 server_slot); // encode @@ -119,30 +119,31 @@ protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); private: - bool is_player_corpse; - bool is_corpse_changed; - bool is_locked; - int32 player_kill_item; - uint32 corpse_db_id; - uint32 char_id; - ItemList itemlist; - uint32 copper; + bool is_player_corpse; /* Determines if Player Corpse or not */ + bool is_corpse_changed; /* Determines if corpse has changed or not */ + bool is_locked; /* Determines if corpse is locked */ + int32 player_kill_item; /* Determines if Player Kill Item */ + uint32 corpse_db_id; /* Corpse Database ID (Player Corpse) */ + uint32 char_id; /* Character ID */ + ItemList itemlist; /* Internal Item list used for corpses */ + uint32 copper; uint32 silver; uint32 gold; uint32 platinum; - bool player_corpse_depop; - uint32 being_looted_by; - uint32 rezzexp; + bool player_corpse_depop; /* Sets up Corpse::Process to depop the player corpse */ + uint32 being_looted_by; /* Determines what the corpse is being looted by internally for logic */ + uint32 rez_experience; /* Amount of experience that the corpse would rez for */ bool rez; - bool can_rez; + bool can_corpse_be_rezzed; /* Bool declaring whether or not a corpse can be rezzed */ bool become_npc; - int allowed_looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id - Timer corpse_decay_timer; - Timer corpse_res_timer; - Timer corpse_delay_timer; + int allowed_looters[MAX_LOOTERS]; /* People allowed to loot the corpse, character id */ + Timer corpse_decay_timer; /* The amount of time in millseconds in which a corpse will take to decay (Depop/Poof) */ + Timer corpse_res_timer; /* The amount of time in millseconds in which a corpse can be rezzed */ + Timer corpse_delay_timer; Timer corpse_graveyard_timer; - Timer loot_cooldown_timer; + Timer loot_cooldown_timer; /* Delay between loot actions on the corpse entity */ Color_Struct item_tint[9]; + }; #endif diff --git a/zone/npc.h b/zone/npc.h index 71e6596ad..a88ae9176 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -359,8 +359,9 @@ public: const bool GetCombatEvent() const { return combat_event; } void SetCombatEvent(bool b) { combat_event = b; } - //The corpse we make can only be looted by people who got credit for the kill + /* Only allows players that killed corpse to loot */ const bool HasPrivateCorpse() const { return NPCTypedata->private_corpse; } + const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; } const char* GetRawNPCTypeName() const { return NPCTypedata->name; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 69ded563c..bcd2150c6 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3806,7 +3806,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rezzexp); + _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -3838,7 +3838,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) rezz->unknown020 = 0x00000000; rezz->unknown088 = 0x00000000; // We send this to world, because it needs to go to the player who may not be in this zone. - worldserver.RezzPlayer(outapp, rezzexp, corpse_db_id, OP_RezzRequest); + worldserver.RezzPlayer(outapp, rez_experience, corpse_db_id, OP_RezzRequest); _pkt(SPELLS__REZ, outapp); safe_delete(outapp); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8794f3570..4ffd70625 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3784,7 +3784,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - NewCorpse = Corpse::LoadFromDBData( + NewCorpse = Corpse::LoadCharacterCorpseEntity( atoll(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname @@ -3826,7 +3826,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - NewCorpse = Corpse::LoadFromDBData( + NewCorpse = Corpse::LoadCharacterCorpseEntity( atoll(row[0]), char_id, row[1], @@ -3871,7 +3871,7 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { ); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - NewCorpse = Corpse::LoadFromDBData( + NewCorpse = Corpse::LoadCharacterCorpseEntity( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name @@ -3911,7 +3911,7 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { // std::cout << row[9] << std::endl; entity_list.AddCorpse( - Corpse::LoadFromDBData( + Corpse::LoadCharacterCorpseEntity( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name From 65ad5b5c996ff658c36b63c7ae3e8465bd540a9b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 21:45:41 -0800 Subject: [PATCH 0332/1883] Removed use of initializer lists. so less pretty --- zone/client_packet.cpp | 2 +- zone/client_process.cpp | 2 +- zone/mob.cpp | 2 +- zone/position.cpp | 16 ++++++++-------- zone/waypoints.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b81ef24ea..3c440a8ff 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4558,7 +4558,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) } // Update internal state - m_Delta = {ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading}; + m_Delta = xyz_heading(ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading); if(IsTracking() && ((m_Position.m_X!=ppu->x_pos) || (m_Position.m_Y!=ppu->y_pos))){ if(MakeRandomFloat(0, 100) < 70)//should be good diff --git a/zone/client_process.cpp b/zone/client_process.cpp index cf106ae65..14f26f4df 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -543,7 +543,7 @@ bool Client::Process() { else { animation = 0; - m_Delta = {0.0f, 0.0f, 0.0f, m_Delta.m_Heading}; + m_Delta = xyz_heading(0.0f, 0.0f, 0.0f, m_Delta.m_Heading); SendPosUpdate(2); } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 6574d481d..ac8baa99e 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2944,7 +2944,7 @@ void Mob::TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand, in } void Mob::SetDeltas(float dx, float dy, float dz, float dh) { - m_Delta = {dx,dy,dz,dh}; + m_Delta = xyz_heading(dx,dy,dz,dh); } void Mob::SetEntityVariable(const char *id, const char *m_var) diff --git a/zone/position.cpp b/zone/position.cpp index 9264f18cd..4cb7dfd53 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -6,7 +6,7 @@ xy_location::xy_location(float x, float y) : } const xy_location xy_location::operator -(const xy_location& rhs) { - xy_location minus{m_X - rhs.m_X, m_Y - rhs.m_Y}; + xy_location minus(m_X - rhs.m_X, m_Y - rhs.m_Y); return minus; } @@ -54,23 +54,23 @@ xyz_heading::xyz_heading(const xy_location locationDir, float z, float heading) } xyz_heading::operator xyz_location() const { - return xyz_location{m_X,m_Y,m_Z}; + return xyz_location(m_X,m_Y,m_Z); } xyz_heading::operator xy_location() const { - return xy_location{m_X,m_Y}; + return xy_location(m_X,m_Y); } const xyz_heading xyz_heading::operator +(const xyz_location& rhs) { - return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z, m_Heading}; + return xyz_heading(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z, m_Heading); } const xyz_heading xyz_heading::operator +(const xy_location& rhs) { - return xyz_heading{m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z, m_Heading}; + return xyz_heading(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z, m_Heading); } const xyz_heading xyz_heading::operator -(const xyz_location& rhs) { - return xyz_heading{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading}; + return xyz_heading(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading); } @@ -87,11 +87,11 @@ xyz_location::xyz_location(double x, double y, double z) : } xyz_location::operator xy_location() const { - return xy_location{m_X, m_Y}; + return xy_location(m_X, m_Y); } const xyz_location xyz_location::operator -(const xyz_location& rhs) { - return xyz_location{m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z}; + return xyz_location(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z); } void xyz_location::ABS_XYZ(void) { diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 9dae8d41f..f786eeb57 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -718,7 +718,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b SetMoving(true); moved=true; - m_Delta = {m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f}; + m_Delta = xyz_heading(m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f); if (IsClient()) SendPosUpdate(1); @@ -842,7 +842,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec tar_ndx=0; this->SetMoving(true); moved=true; - m_Delta = {m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f}; + m_Delta = xyz_heading(m_Position.m_X - nx, m_Position.m_Y - ny, m_Position.m_Z - nz, 0.0f); SendPosUpdate(); } tar_ndx++; From b43cfa126f455ae8727ebc6e2847c35d083059e2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 25 Nov 2014 23:54:59 -0600 Subject: [PATCH 0333/1883] Renamed SetPKItem to SetPlayerKillItemID Renamed AllowMobLoot to AllowPlayerLoot Renamed DepopCorpse (PC) to DepopPlayerCorpse Renamed GetPKItem to GetPlayerKillItem Renamed Corpse class variable 'orgname' to 'corpse_name' Renamed CompleteRezz to CompleteResurrection Renamed GetDBID to GetCorpseDBID Removed CorpseToServerSlot as it is unnecessary Removed ServerToCorpseSlot as it is unnecessary Reogrganized corpse.h header --- zone/attack.cpp | 24 ++--- zone/client_process.cpp | 2 +- zone/command.cpp | 4 +- zone/corpse.cpp | 179 +++++++----------------------------- zone/corpse.h | 124 +++++++++++++------------ zone/entity.cpp | 10 +- zone/lua_corpse.cpp | 4 +- zone/mob.cpp | 2 +- zone/perl_player_corpse.cpp | 6 +- zone/questmgr.cpp | 2 +- zone/spells.cpp | 2 +- zone/worldserver.cpp | 2 +- zone/zonedb.cpp | 4 +- 13 files changed, 131 insertions(+), 234 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 51b8bb26a..eec84e3c4 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1631,14 +1631,14 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att database.GetVariable("PvPitem", tmp2, 9); int pvpitem = atoi(tmp2); if(pvpitem>0 && pvpitem<200000) - new_corpse->SetPKItem(pvpitem); + new_corpse->SetPlayerKillItemID(pvpitem); } else if(reward==2) - new_corpse->SetPKItem(-1); + new_corpse->SetPlayerKillItemID(-1); else if(reward==1) - new_corpse->SetPKItem(1); + new_corpse->SetPlayerKillItemID(1); else - new_corpse->SetPKItem(0); + new_corpse->SetPlayerKillItemID(0); if(killerMob->CastToClient()->isgrouped) { Group* group = entity_list.GetGroupByClient(killerMob->CastToClient()); if(group != 0) @@ -1647,7 +1647,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att { if(group->members[i] != nullptr) { - new_corpse->AllowMobLoot(group->members[i],i); + new_corpse->AllowPlayerLoot(group->members[i],i); } } } @@ -2301,13 +2301,13 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if(killer != 0 && emoteid != 0) corpse->CastToNPC()->DoNPCEmote(AFTERDEATH, emoteid); if(killer != 0 && killer->IsClient()) { - corpse->AllowMobLoot(killer, 0); + corpse->AllowPlayerLoot(killer, 0); if(killer->IsGrouped()) { Group* group = entity_list.GetGroupByClient(killer->CastToClient()); if(group != 0) { for(int i=0;i<6;i++) { // Doesnt work right, needs work if(group->members[i] != nullptr) { - corpse->AllowMobLoot(group->members[i],i); + corpse->AllowPlayerLoot(group->members[i],i); } } } @@ -2323,30 +2323,30 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack case 0: case 1: if(r->members[x].member && r->members[x].IsRaidLeader){ - corpse->AllowMobLoot(r->members[x].member, i); + corpse->AllowPlayerLoot(r->members[x].member, i); i++; } break; case 2: if(r->members[x].member && r->members[x].IsRaidLeader){ - corpse->AllowMobLoot(r->members[x].member, i); + corpse->AllowPlayerLoot(r->members[x].member, i); i++; } else if(r->members[x].member && r->members[x].IsGroupLeader){ - corpse->AllowMobLoot(r->members[x].member, i); + corpse->AllowPlayerLoot(r->members[x].member, i); i++; } break; case 3: if(r->members[x].member && r->members[x].IsLooter){ - corpse->AllowMobLoot(r->members[x].member, i); + corpse->AllowPlayerLoot(r->members[x].member, i); i++; } break; case 4: if(r->members[x].member) { - corpse->AllowMobLoot(r->members[x].member, i); + corpse->AllowPlayerLoot(r->members[x].member, i); i++; } break; diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c4eb01f4a..c07a73aea 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -2174,7 +2174,7 @@ void Client::HandleRespawnFromHover(uint32 Option) _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); - corpse->CompleteRezz(); + corpse->CompleteResurrection(); } } else //Not rez diff --git a/zone/command.cpp b/zone/command.cpp index 27516d5a5..12241de52 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3421,7 +3421,7 @@ void command_corpse(Client *c, const Seperator *sep) c->Message(0, "Error: Target must be a player corpse."); else if (c->Admin() >= commandEditPlayerCorpses && target->IsPlayerCorpse()) { c->Message(0, "Depoping %s.", target->GetName()); - target->CastToCorpse()->DepopCorpse(); + target->CastToCorpse()->DepopPlayerCorpse(); if(!sep->arg[2][0] || atoi(sep->arg[2]) != 0) target->CastToCorpse()->Bury(); } @@ -3906,7 +3906,7 @@ void command_save(Client *c, const Seperator *sep) } else if (c->GetTarget()->IsPlayerCorpse()) { if (c->GetTarget()->CastToMob()->Save()) - c->Message(0, "%s successfully saved. (dbid=%u)", c->GetTarget()->GetName(), c->GetTarget()->CastToCorpse()->GetDBID()); + c->Message(0, "%s successfully saved. (dbid=%u)", c->GetTarget()->GetName(), c->GetTarget()->CastToCorpse()->GetCorpseDBID()); else c->Message(0, "Manual save for %s failed.", c->GetTarget()->GetName()); } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 0b93306f1..40ecccf80 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -69,13 +69,12 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std: PlayerCorpse_Struct *pcs = (PlayerCorpse_Struct*)buffer; database.LoadCharacterCorpseData(in_dbid, pcs); - /* Load Items */ + /* Load Items */ ItemList itemlist; ServerLootItem_Struct* tmp = 0; for (unsigned int i = 0; i < pcs->itemcount; i++) { tmp = new ServerLootItem_Struct; memcpy(tmp, &pcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct)); - tmp->equip_slot = CorpseToServerSlot(tmp->equip_slot); itemlist.push_back(tmp); } @@ -191,7 +190,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP 0 // uint32 in_scalerate ), corpse_decay_timer(in_decaytime), - corpse_res_timer(0), + corpse_rez_timer(0), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(0), loot_cooldown_timer(10) @@ -212,13 +211,13 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum()); npctype_id = in_npctypeid; - SetPKItem(0); + SetPlayerKillItemID(0); char_id = 0; corpse_db_id = 0; player_corpse_depop = false; - strcpy(orgname, in_npc->GetName()); + strcpy(corpse_name, in_npc->GetName()); strcpy(name, in_npc->GetName()); - // Added By Hogie + for(int count = 0; count < 100; count++) { if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) { corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000); @@ -293,7 +292,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( 0 // uint32 in_scalerate ), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), - corpse_res_timer(RuleI(Character, CorpseResTimeMS)), + corpse_rez_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), loot_cooldown_timer(10) @@ -328,13 +327,13 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( gold = 0; platinum = 0; - strcpy(orgname, pp->name); + strcpy(corpse_name, pp->name); strcpy(name, pp->name); /* become_npc was not being initialized which led to some pretty funky things with newly created corpses */ become_npc = false; - SetPKItem(0); + SetPlayerKillItemID(0); /* Check Rule to see if we can leave corpses */ if(!RuleB(Character, LeaveNakedCorpses) || @@ -521,7 +520,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi 0, // uint8 in_maxlevel, 0), // uint32 in_scalerate corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), - corpse_res_timer(RuleI(Character, CorpseResTimeMS)), + corpse_rez_timer(RuleI(Character, CorpseResTimeMS)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), loot_cooldown_timer(10) @@ -545,7 +544,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi itemlist = *in_itemlist; in_itemlist->clear(); - strcpy(orgname, in_charname); + strcpy(corpse_name, in_charname); strcpy(name, in_charname); this->copper = in_copper; @@ -558,7 +557,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi for (int i = 0; i < MAX_LOOTERS; i++){ allowed_looters[i] = 0; } - SetPKItem(0); + SetPlayerKillItemID(0); } Corpse::~Corpse() { @@ -636,17 +635,16 @@ bool Corpse::Save() { end = itemlist.end(); for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); } /* Create New Corpse*/ if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, corpse_name, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading); } /* Update Corpse Data */ else{ - corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, corpse_name, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); } safe_delete_array(dbpc); @@ -670,12 +668,12 @@ void Corpse::Bury() { player_corpse_depop = true; } -void Corpse::Depop() { +void Corpse::DepopNPCCorpse() { if (IsNPCCorpse()) player_corpse_depop = true; } -void Corpse::DepopCorpse() { +void Corpse::DepopPlayerCorpse() { player_corpse_depop = true; } @@ -903,7 +901,7 @@ bool Corpse::CanPlayerLoot(int charid) { return false; } -void Corpse::AllowMobLoot(Mob *them, uint8 slot) { +void Corpse::AllowPlayerLoot(Mob *them, uint8 slot) { if(slot >= MAX_LOOTERS) return; if(them == nullptr || !them->IsClient()) @@ -959,13 +957,13 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a else if ((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) { Loot_Request_Type = 2; } - else if (GetPKItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */ + else if (GetPlayerKillItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */ Loot_Request_Type = 3; } - else if (GetPKItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */ + else if (GetPlayerKillItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */ Loot_Request_Type = 4; } - else if (GetPKItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */ + else if (GetPlayerKillItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */ Loot_Request_Type = 5; } @@ -1010,14 +1008,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a client->QueuePacket(outapp); safe_delete(outapp); if(Loot_Request_Type == 5) { - int pkitem = GetPKItem(); + int pkitem = GetPlayerKillItem(); const Item_Struct* item = database.GetItem(pkitem); ItemInst* inst = database.CreateItem(item, item->MaxCharges); if(inst) { client->SendItemPacket(EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot); safe_delete(inst); } - else { client->Message(13, "Could not find item number %i to send!!", GetPKItem()); } + else { client->Message(13, "Could not find item number %i to send!!", GetPlayerKillItem()); } client->QueuePacket(app); return; @@ -1068,14 +1066,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(IsPlayerCorpse() && i == 0 && itemlist.size() > 0) { // somehow, player corpse contains items, but client doesn't see them... client->Message(13, "This corpse contains items that are inaccessable!"); client->Message(15, "Contact a GM for item replacement, if necessary."); - client->Message(15, "BUGGED CORPSE [DBID: %i, Name: %s, Item Count: %i]", GetDBID(), GetName(), itemlist.size()); + client->Message(15, "BUGGED CORPSE [DBID: %i, Name: %s, Item Count: %i]", GetCorpseDBID(), GetName(), itemlist.size()); cur = itemlist.begin(); end = itemlist.end(); for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } @@ -1131,7 +1129,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { client->Message(13, "Error: Corpse locked by GM."); return; } - if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPKItem() == 0){ + if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPlayerKillItem() == 0){ client->Message(13, "Error: You cannot loot any more items from this corpse."); SendEndLootErrorPacket(client); being_looted_by = 0xFFFFFFFF; @@ -1142,17 +1140,17 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10]; memset(bag_item_data, 0, sizeof(bag_item_data)); - if (GetPKItem() > 1){ - item = database.GetItem(GetPKItem()); + if (GetPlayerKillItem() > 1){ + item = database.GetItem(GetPlayerKillItem()); } - else if (GetPKItem() == -1 || GetPKItem() == 1){ + else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1){ item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward } else{ item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN, bag_item_data); } - if (GetPKItem()<=1 && item_data != 0) { + if (GetPlayerKillItem()<=1 && item_data != 0) { item = database.GetItem(item_data->item_id); } @@ -1191,7 +1189,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { char buf[88]; char corpse_name[64]; - strcpy(corpse_name, orgname); + strcpy(corpse_name, corpse_name); snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(corpse_name)); buf[87] = '\0'; std::vector args; @@ -1236,7 +1234,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } /* Remove Bag Contents */ - if (item->ItemClass == ItemClassContainer && (GetPKItem() != -1 || GetPKItem() != 1)) { + if (item->ItemClass == ItemClassContainer && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) { for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if (bag_item_data[i]) { /* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */ @@ -1247,8 +1245,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } } - if (GetPKItem() != -1){ - SetPKItem(0); + if (GetPlayerKillItem() != -1){ + SetPlayerKillItemID(0); } /* Send message with item link to groups and such */ @@ -1361,7 +1359,7 @@ void Corpse::QueryLoot(Client* to) { } if (IsPlayerCorpse()) { - to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID()); + to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetCorpseDBID()); } else { to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName()); @@ -1416,7 +1414,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { return true; } -void Corpse::CompleteRezz(){ +void Corpse::CompleteResurrection(){ rez_experience = 0; is_corpse_changed = true; this->Save(); @@ -1461,7 +1459,7 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const { } void Corpse::AddLooter(Mob* who) { - for (int i=0; iCastToClient()->CharacterID(); break; @@ -1486,111 +1484,4 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){ else { corpse_graveyard_timer.SetTimer(3000); } -} - -/* -** Corpse slot translations are needed until corpse database blobs are converted -** -** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into -** the contiguous possessions slot enumeration, the following designations will be used: -** -** Designatiom Server Corpse Offset -** -------------------------------------------------- -** MainCharm 0 0 0 -** ... ... ... 0 -** MainWaist 20 20 0 -** MainPowerSource 21 9999 +9978 -** MainAmmo 22 21 -1 -** -** MainGeneral1 23 22 -1 -** ... ... ... -1 -** MainGeneral8 30 29 -1 -** MainGeneral9 31 9997 +9966 -** MainGeneral10 32 9998 +9966 -** -** MainCursor 33 30 -3 -** -** MainGeneral1_1 251 251 0 -** ... ... ... 0 -** MainGeneral8_10 330 330 0 -** MainGeneral9_1 331 341 +10 -** ... ... ... +10 -** MainGeneral10_10 350 360 +10 -** -** MainCursor_1 351 331 -20 -** ... ... ... -20 -** MainCursor_10 360 340 -20 -** -** (Not all slot designations are valid to all clients..see ##_constants.h files for valid slot enumerations) -*/ -int16 Corpse::ServerToCorpseSlot(int16 server_slot) -{ - return server_slot; // temporary return - - /* - switch (server_slot) - { - case MainPowerSource: - return 9999; - case MainGeneral9: - return 9997; - case MainGeneral10: - return 9998; - case MainCursor: - return 30; - case MainAmmo: - case MainGeneral1: - case MainGeneral2: - case MainGeneral3: - case MainGeneral4: - case MainGeneral5: - case MainGeneral6: - case MainGeneral7: - case MainGeneral8: - return server_slot - 1; - default: - if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) - return server_slot - 20; - else if (server_slot >= EmuConstants::GENERAL_BAGS_END - 19 && server_slot <= EmuConstants::GENERAL_BAGS_END) - return server_slot + 10; - else - return server_slot; - } - */ -} - -int16 Corpse::CorpseToServerSlot(int16 corpse_slot) -{ - return corpse_slot; // temporary return - - /* - switch (corpse_slot) - { - case 9999: - return MainPowerSource; - case 9997: - return MainGeneral9; - case 9998: - return MainGeneral10; - case 30: - return MainCursor; - case 21: // old SLOT_AMMO - case 22: // old PERSONAL_BEGIN - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: // old PERSONAL_END - return corpse_slot + 1; - default: - if (corpse_slot >= 331 && corpse_slot <= 340) - return corpse_slot + 20; - else if (corpse_slot >= 341 && corpse_slot <= 360) - return corpse_slot - 10; - else - return corpse_slot; - } - */ } \ No newline at end of file diff --git a/zone/corpse.h b/zone/corpse.h index 9fe6a899a..3a3d2bce9 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -27,7 +27,7 @@ class NPC; #define MAX_LOOTERS 72 class Corpse : public Mob { -public: + public: static void SendEndLootErrorPacket(Client* client); static void SendLootReqErrorPacket(Client* client, uint8 response = 2); @@ -35,85 +35,91 @@ public: Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); - ~Corpse(); + + ~Corpse(); static Corpse* LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); - //abstract virtual function implementations requird by base abstract class + /* Corpse: General */ virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, - bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } - virtual bool HasRaid() { return false; } - virtual bool HasGroup() { return false; } - virtual Raid* GetRaid() { return 0; } - virtual Group* GetGroup() { return 0; } - - void LoadPlayerCorpseDecayTime(uint32 dbid); - + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, + bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { + return false; + } + virtual bool HasRaid() { return false; } + virtual bool HasGroup() { return false; } + virtual Raid* GetRaid() { return 0; } + virtual Group* GetGroup() { return 0; } + inline uint32 GetCorpseDBID() { return corpse_db_id; } + inline char* GetOwnerName() { return corpse_name; } + bool IsEmpty() const; bool IsCorpse() const { return true; } bool IsPlayerCorpse() const { return is_player_corpse; } bool IsNPCCorpse() const { return !is_player_corpse; } bool IsBecomeNPCCorpse() const { return become_npc; } + virtual void DepopNPCCorpse(); + virtual void DepopPlayerCorpse(); bool Process(); bool Save(); - uint32 GetCharID() { return char_id; } - uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; }; - uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); } - uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); } + uint32 GetCharID() { return char_id; } + uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; }; + uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); } + uint32 GetRezTime() { if (!corpse_rez_timer.Enabled()) return 0; else return corpse_rez_timer.GetRemainingTime(); } + void SetDecayTimer(uint32 decay_time); + + void Delete(); + void Bury(); void CalcCorpseName(); - inline void Lock() { is_locked = true; } - inline void UnLock() { is_locked = false; } - inline bool IsLocked() { return is_locked; } - inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; } - inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); } - inline uint32 GetDBID() { return corpse_db_id; } - inline char* GetOwnerName() { return orgname;} + void LoadPlayerCorpseDecayTime(uint32 dbid); - void SetDecayTimer(uint32 decay_time); - bool IsEmpty() const; - void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); + /* Corpse: Items */ uint32 GetWornItem(int16 equipSlot) const; - ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0); - void RemoveItem(uint16 lootslot); - void RemoveItem(ServerLootItem_Struct* item_data); - void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum); - void RemoveCash(); - void QueryLoot(Client* to); - uint32 CountItems(); - void Delete(); - void Bury(); - virtual void Depop(); - virtual void DepopCorpse(); - + ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0); + void SetPlayerKillItemID(int32 pk_item_id) { player_kill_item = pk_item_id; } + int32 GetPlayerKillItem() { return player_kill_item; } + void RemoveItem(uint16 lootslot); + void RemoveItem(ServerLootItem_Struct* item_data); + void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0); + + /* Corpse: Coin */ + void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum); + void RemoveCash(); uint32 GetCopper() { return copper; } uint32 GetSilver() { return silver; } uint32 GetGold() { return gold; } uint32 GetPlatinum() { return platinum; } - void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); - void MakeLootRequestPackets(Client* client, const EQApplicationPacket* app); - void LootItem(Client* client, const EQApplicationPacket* app); - void EndLoot(Client* client, const EQApplicationPacket* app); - bool Summon(Client* client, bool spell, bool CheckDistance); - void CastRezz(uint16 spellid, Mob* Caster); - void CompleteRezz(); - void SetPKItem(int32 id) { player_kill_item = id; } - int32 GetPKItem() { return player_kill_item; } - bool CanPlayerLoot(int charid); - void AllowMobLoot(Mob *them, uint8 slot); - void AddLooter(Mob *who); + /* Corpse: Resurrection */ bool IsRezzed() { return rez; } void IsRezzed(bool in_rez) { rez = in_rez; } - void Spawn(); + void CastRezz(uint16 spellid, Mob* Caster); + void CompleteResurrection(); - char orgname[64]; - uint32 GetEquipment(uint8 material_slot) const; // returns item id + /* Corpse: Loot */ + void QueryLoot(Client* to); + void LootItem(Client* client, const EQApplicationPacket* app); + void EndLoot(Client* client, const EQApplicationPacket* app); + void MakeLootRequestPackets(Client* client, const EQApplicationPacket* app); + void AllowPlayerLoot(Mob *them, uint8 slot); + void AddLooter(Mob *who); + uint32 CountItems(); + bool CanPlayerLoot(int charid); + + inline void Lock() { is_locked = true; } + inline void UnLock() { is_locked = false; } + inline bool IsLocked() { return is_locked; } + inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; } + inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); } + + /* Mob */ + void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); + bool Summon(Client* client, bool spell, bool CheckDistance); + void Spawn(); + + char corpse_name[64]; + uint32 GetEquipment(uint8 material_slot) const; uint32 GetEquipmentColor(uint8 material_slot) const; - inline int GetRezzExp() { return rez_experience; } - - // these are a temporary work-around until corpse inventory is removed from the database blob - static int16 ServerToCorpseSlot(int16 server_slot); // encode - static int16 CorpseToServerSlot(int16 corpse_slot); // decode + inline int GetRezExp() { return rez_experience; } protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); @@ -138,7 +144,7 @@ private: bool become_npc; int allowed_looters[MAX_LOOTERS]; /* People allowed to loot the corpse, character id */ Timer corpse_decay_timer; /* The amount of time in millseconds in which a corpse will take to decay (Depop/Poof) */ - Timer corpse_res_timer; /* The amount of time in millseconds in which a corpse can be rezzed */ + Timer corpse_rez_timer; /* The amount of time in millseconds in which a corpse can be rezzed */ Timer corpse_delay_timer; Timer corpse_graveyard_timer; Timer loot_cooldown_timer; /* Delay between loot actions on the corpse entity */ diff --git a/zone/entity.cpp b/zone/entity.cpp index 122e24582..eef15b2ff 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1606,7 +1606,7 @@ Corpse *EntityList::GetCorpseByDBID(uint32 dbid) { auto it = corpse_list.begin(); while (it != corpse_list.end()) { - if (it->second->GetDBID() == dbid) + if (it->second->GetCorpseDBID() == dbid) return it->second; ++it; } @@ -1660,7 +1660,7 @@ void EntityList::RemoveCorpseByDBID(uint32 dbid) { auto it = corpse_list.begin(); while (it != corpse_list.end()) { - if (it->second->GetDBID() == dbid) { + if (it->second->GetCorpseDBID() == dbid) { safe_delete(it->second); free_ids.push(it->first); it = corpse_list.erase(it); @@ -1677,9 +1677,9 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid) auto it = corpse_list.begin(); while (it != corpse_list.end()) { if (it->second->GetCharID() == charid) { - RezzExp += it->second->GetRezzExp(); + RezzExp += it->second->GetRezExp(); it->second->IsRezzed(true); - it->second->CompleteRezz(); + it->second->CompleteResurrection(); } ++it; } @@ -2655,7 +2655,7 @@ int32 EntityList::DeleteNPCCorpses() auto it = corpse_list.begin(); while (it != corpse_list.end()) { if (it->second->IsNPCCorpse()) { - it->second->Depop(); + it->second->DepopNPCCorpse(); x++; } ++it; diff --git a/zone/lua_corpse.cpp b/zone/lua_corpse.cpp index 5862bbe96..789555a54 100644 --- a/zone/lua_corpse.cpp +++ b/zone/lua_corpse.cpp @@ -39,7 +39,7 @@ void Lua_Corpse::ResetLooter() { uint32 Lua_Corpse::GetDBID() { Lua_Safe_Call_Int(); - return self->GetDBID(); + return self->GetCorpseDBID(); } bool Lua_Corpse::IsRezzed() { @@ -119,7 +119,7 @@ bool Lua_Corpse::CanMobLoot(int charid) { void Lua_Corpse::AllowMobLoot(Lua_Mob them, uint8 slot) { Lua_Safe_Call_Void(); - self->AllowMobLoot(them, slot); + self->AllowPlayerLoot(them, slot); } bool Lua_Corpse::Summon(Lua_Client client, bool spell, bool checkdistance) { diff --git a/zone/mob.cpp b/zone/mob.cpp index a7d141b30..55c3773c1 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1255,7 +1255,7 @@ void Mob::ShowStats(Client* client) } else if (IsCorpse()) { if (IsPlayerCorpse()) { - client->Message(0, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetDBID()); + client->Message(0, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetCorpseDBID()); } else { client->Message(0, " NPCCorpse", GetID()); diff --git a/zone/perl_player_corpse.cpp b/zone/perl_player_corpse.cpp index f8b2d4388..675ee9697 100644 --- a/zone/perl_player_corpse.cpp +++ b/zone/perl_player_corpse.cpp @@ -208,7 +208,7 @@ XS(XS_Corpse_GetDBID) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetDBID(); + RETVAL = THIS->GetCorpseDBID(); XSprePUSH; PUSHu((UV)RETVAL); } XSRETURN(1); @@ -662,7 +662,7 @@ XS(XS_Corpse_CompleteRezz) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->CompleteRezz(); + THIS->CompleteResurrection(); } XSRETURN_EMPTY; } @@ -723,7 +723,7 @@ XS(XS_Corpse_AllowMobLoot) if(them == nullptr) Perl_croak(aTHX_ "them is nullptr, avoiding crash."); - THIS->AllowMobLoot(them, slot); + THIS->AllowPlayerLoot(them, slot); } XSRETURN_EMPTY; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index e014c01cd..458a448d9 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1786,7 +1786,7 @@ bool QuestManager::buryplayercorpse(uint32 char_id) if(corpse) { corpse->Save(); - corpse->DepopCorpse(); + corpse->DepopPlayerCorpse(); } else { diff --git a/zone/spells.cpp b/zone/spells.cpp index bcd2150c6..858bb6412 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3825,7 +3825,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer; // Why are we truncating these names to 30 characters ? - memcpy(rezz->your_name,this->orgname,30); + memcpy(rezz->your_name,this->corpse_name,30); memcpy(rezz->corpse_name,this->name,30); memcpy(rezz->rezzer_name,Caster->GetName(),30); rezz->zone_id = zone->GetZoneID(); diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index bae01e70f..d51cb0904 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -705,7 +705,7 @@ void WorldServer::Process() { _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); - corpse->CompleteRezz(); + corpse->CompleteResurrection(); } } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 4ffd70625..7c2c04550 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3652,7 +3652,7 @@ uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) { if (tmp) { itemid = tmp->GetWornItem(slotid); - tmp->DepopCorpse(); + tmp->DepopPlayerCorpse(); } return itemid; } @@ -3800,7 +3800,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z entity_list.AddCorpse(NewCorpse); NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); - if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) + if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } From 08e787da59bd40016246dd7b1d1f7def75d701c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 26 Nov 2014 00:24:31 -0600 Subject: [PATCH 0334/1883] Replaced atoll with more appropriate macro atoul --- zone/zonedb.cpp | 64 ++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7c2c04550..8bc696888 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3372,7 +3372,7 @@ uint32 ZoneDatabase::GetCharacterCorpseDecayTimer(uint32 corpse_db_id){ auto results = QueryDatabase(query); auto row = results.begin(); if (results.Success() && results.RowsAffected() != 0){ - return atoll(row[0]); + return atoul(row[0]); } return 0; } @@ -3628,7 +3628,7 @@ uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { for (auto row = results.begin(); row != results.end(); ++row) { for (int i = 0; i < corpse; i++) { - return atoll(row[0]); + return atoul(row[0]); } } return 0; @@ -3702,7 +3702,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct uint16 i = 0; for (auto row = results.begin(); row != results.end(); ++row) { pcs->locked = atoi(row[i++]); // is_locked, - pcs->exp = atoll(row[i++]); // exp, + pcs->exp = atoul(row[i++]); // exp, pcs->size = atoi(row[i++]); // size, pcs->level = atoi(row[i++]); // `level`, pcs->race = atoi(row[i++]); // race, @@ -3711,10 +3711,10 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->deity = atoi(row[i++]); // deity, pcs->texture = atoi(row[i++]); // texture, pcs->helmtexture = atoi(row[i++]); // helm_texture, - pcs->copper = atoll(row[i++]); // copper, - pcs->silver = atoll(row[i++]); // silver, - pcs->gold = atoll(row[i++]); // gold, - pcs->plat = atoll(row[i++]); // platinum, + pcs->copper = atoul(row[i++]); // copper, + pcs->silver = atoul(row[i++]); // silver, + pcs->gold = atoul(row[i++]); // gold, + pcs->plat = atoul(row[i++]); // platinum, pcs->haircolor = atoi(row[i++]); // hair_color, pcs->beardcolor = atoi(row[i++]); // beard_color, pcs->eyecolor1 = atoi(row[i++]); // eye_color_1, @@ -3722,18 +3722,18 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->hairstyle = atoi(row[i++]); // hair_style, pcs->face = atoi(row[i++]); // face, pcs->beard = atoi(row[i++]); // beard, - pcs->drakkin_heritage = atoll(row[i++]); // drakkin_heritage, - pcs->drakkin_tattoo = atoll(row[i++]); // drakkin_tattoo, - pcs->drakkin_details = atoll(row[i++]); // drakkin_details, - pcs->item_tint[0].color = atoll(row[i++]); // wc_1, - pcs->item_tint[1].color = atoll(row[i++]); // wc_2, - pcs->item_tint[2].color = atoll(row[i++]); // wc_3, - pcs->item_tint[3].color = atoll(row[i++]); // wc_4, - pcs->item_tint[4].color = atoll(row[i++]); // wc_5, - pcs->item_tint[5].color = atoll(row[i++]); // wc_6, - pcs->item_tint[6].color = atoll(row[i++]); // wc_7, - pcs->item_tint[7].color = atoll(row[i++]); // wc_8, - pcs->item_tint[8].color = atoll(row[i++]); // wc_9 + 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 } query = StringFormat( "SELECT \n" @@ -3749,7 +3749,6 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct "FROM \n" "character_corpse_items \n" "WHERE `corpse_id` = %u\n" - // "ORDER BY `equip_slot`" , corpse_id ); @@ -3761,7 +3760,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct for (auto row = results.begin(); row != results.end(); ++row) { memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct)); pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot, - pcs->items[i].item_id = atoll(row[r++]); // item_id, + pcs->items[i].item_id = atoul(row[r++]); // item_id, pcs->items[i].charges = atoi(row[r++]); // charges, pcs->items[i].aug_1 = atoi(row[r++]); // aug_1, pcs->items[i].aug_2 = atoi(row[r++]); // aug_2, @@ -3785,7 +3784,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadCharacterCorpseEntity( - atoll(row[0]), // uint32 in_dbid + atoul(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname dest_x, // float in_x @@ -3827,7 +3826,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadCharacterCorpseEntity( - atoll(row[0]), + atoul(row[0]), char_id, row[1], dest_x, @@ -3872,8 +3871,8 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { NewCorpse = Corpse::LoadCharacterCorpseEntity( - atoll(row[0]), // id uint32 in_dbid - atoll(row[1]), // charid uint32 in_charid + atoul(row[0]), // id uint32 in_dbid + atoul(row[1]), // charid uint32 in_charid row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y @@ -3899,21 +3898,10 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - // std::cout << row[0] << std::endl; - // std::cout << row[1] << std::endl; - // std::cout << row[2] << std::endl; - // std::cout << row[3] << std::endl; - // std::cout << row[4] << std::endl; - // std::cout << row[5] << std::endl; - // std::cout << row[6] << std::endl; - // std::cout << row[7] << std::endl; - // std::cout << row[8] << std::endl; - // std::cout << row[9] << std::endl; - entity_list.AddCorpse( Corpse::LoadCharacterCorpseEntity( - atoll(row[0]), // id uint32 in_dbid - atoll(row[1]), // charid uint32 in_charid + atoul(row[0]), // id uint32 in_dbid + atoul(row[1]), // charid uint32 in_charid row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y From 5c5cde7fe57b4fc2ec826e73a3b4b9bcd11b8c47 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 26 Nov 2014 00:31:50 -0600 Subject: [PATCH 0335/1883] Database::GetGroupLeaderForLogin fix --- common/database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 241c4d171..82931e457 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3254,7 +3254,7 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf) { strcpy(leaderbuf, ""); uint32 group_id = 0; - std::string query = StringFormat("SELECT `groupid` FROM `group_id` WHERE `name = '%s'", name); + std::string query = StringFormat("SELECT `groupid` FROM `group_id` WHERE `name` = '%s'", name); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) From d25c5b1fa03282eb2576cf4f0371a3c46fd6bea9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 23:24:17 -0800 Subject: [PATCH 0336/1883] cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading replaced with m_CurrentWayPoint --- zone/mob.cpp | 4 +--- zone/mob.h | 14 ++++++-------- zone/mob_ai.cpp | 10 +++++----- zone/waypoints.cpp | 20 +++++++------------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index ac8baa99e..3087ccfb7 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -317,9 +317,7 @@ Mob::Mob(const char* in_name, wandertype=0; pausetype=0; cur_wp = 0; - cur_wp_x = 0; - cur_wp_y = 0; - cur_wp_z = 0; + m_CurrentWayPoint = xyz_heading::Origin(); cur_wp_pause = 0; patrol=0; follow=0; diff --git a/zone/mob.h b/zone/mob.h index 493288c51..f1e79d1a1 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -862,10 +862,10 @@ public: Shielders_Struct shielder[MAX_SHIELDERS]; Trade* trade; - inline float GetCWPX() const { return(cur_wp_x); } - inline float GetCWPY() const { return(cur_wp_y); } - inline float GetCWPZ() const { return(cur_wp_z); } - inline float GetCWPH() const { return(cur_wp_heading); } + inline float GetCWPX() const { return(m_CurrentWayPoint.m_X); } + inline float GetCWPY() const { return(m_CurrentWayPoint.m_Y); } + inline float GetCWPZ() const { return(m_CurrentWayPoint.m_Z); } + inline float GetCWPH() const { return(m_CurrentWayPoint.m_Heading); } inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } inline int GetCWP() const { return(cur_wp); } void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } @@ -1189,11 +1189,9 @@ protected: int pausetype; int cur_wp; - float cur_wp_x; - float cur_wp_y; - float cur_wp_z; + xyz_heading m_CurrentWayPoint; int cur_wp_pause; - float cur_wp_heading; + int patrol; float fear_walkto_x; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index da579a2db..e36ffb11a 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1724,15 +1724,15 @@ void NPC::AI_DoMovement() { } // endif (movetimercompleted==true) else if (!(AIwalking_timer->Enabled())) { // currently moving - if (cur_wp_x == GetX() && cur_wp_y == GetY()) + if (m_CurrentWayPoint.m_X == GetX() && m_CurrentWayPoint.m_Y == GetY()) { // are we there yet? then stop mlog(AI__WAYPOINTS, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); SetMoving(false); - if (cur_wp_heading >= 0.0) { - SetHeading(cur_wp_heading); + if (m_CurrentWayPoint.m_Heading >= 0.0) { + SetHeading(m_CurrentWayPoint.m_Heading); } SendPosition(); @@ -1748,12 +1748,12 @@ void NPC::AI_DoMovement() { else { // not at waypoint yet, so keep moving if(!RuleB(Pathing, AggroReturnToGrid) || !zone->pathing || (DistractedFromGrid == 0)) - CalculateNewPosition2(cur_wp_x, cur_wp_y, cur_wp_z, walksp, true); + CalculateNewPosition2(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z, walksp, true); else { bool WaypointChanged; bool NodeReached; - Map::Vertex Goal = UpdatePath(cur_wp_x, cur_wp_y, cur_wp_z, walksp, WaypointChanged, NodeReached); + Map::Vertex Goal = UpdatePath(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z, walksp, WaypointChanged, NodeReached); if(WaypointChanged) tar_ndx = 20; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index f786eeb57..678504c1c 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -122,7 +122,7 @@ void NPC::ResumeWandering() return; } - if (cur_wp_x == GetX() && cur_wp_y == GetY()) + if (m_CurrentWayPoint.m_X == GetX() && m_CurrentWayPoint.m_Y == GetY()) { // are we we at a waypoint? if so, trigger event and start to next char temp[100]; itoa(cur_wp,temp,10); //do this before updating to next waypoint @@ -201,11 +201,8 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } - cur_wp_x = mtx; - cur_wp_y = mty; - cur_wp_z = mtz; + m_CurrentWayPoint = xyz_heading(mtx, mty, mtz, mth); cur_wp_pause = 0; - cur_wp_heading = mth; pLastFightingDelayMoving = 0; if(AIwalking_timer->Enabled()) AIwalking_timer->Start(100); @@ -221,26 +218,23 @@ void NPC::UpdateWaypoint(int wp_index) cur = Waypoints.begin(); cur += wp_index; - cur_wp_x = cur->x; - cur_wp_y = cur->y; - cur_wp_z = cur->z; + m_CurrentWayPoint = xyz_heading(cur->x, cur->y, cur->z, cur->heading); cur_wp_pause = cur->pause; - cur_wp_heading = cur->heading; - mlog(AI__WAYPOINTS, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + mlog(AI__WAYPOINTS, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z, m_CurrentWayPoint.m_Heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) { if(!RuleB(Watermap, CheckForWaterAtWaypoints) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(cur_wp_x, cur_wp_y, cur_wp_z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z))) { - Map::Vertex dest(cur_wp_x, cur_wp_y, cur_wp_z); + Map::Vertex dest(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z); float newz = zone->zonemap->FindBestZ(dest, nullptr); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaWaypoint)) - cur_wp_z = newz + 1; + m_CurrentWayPoint.m_Z = newz + 1; } } From cab1f986f18b5d902fdbcf98489703ac120b8e60 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 25 Nov 2014 23:44:02 -0800 Subject: [PATCH 0337/1883] targetring_x, targetring_y, targetring_z replaced with m_TargetRing as an xyz_location --- zone/client_packet.cpp | 8 ++------ zone/mob.cpp | 4 +--- zone/mob.h | 10 ++++------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3c440a8ff..4c5017917 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3984,9 +3984,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) CastSpell_Struct* castspell = (CastSpell_Struct*)app->pBuffer; - targetring_x = castspell->x_pos; - targetring_y = castspell->y_pos; - targetring_z = castspell->z_pos; + m_TargetRing = xyz_location(castspell->x_pos, castspell->y_pos, castspell->z_pos); #ifdef _EQDEBUG LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); @@ -4018,9 +4016,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) return; } - targetring_x = castspell->x_pos; - targetring_y = castspell->y_pos; - targetring_z = castspell->z_pos; + m_TargetRing = xyz_location(castspell->x_pos, castspell->y_pos, castspell->z_pos); CastSpell(spell_to_cast, castspell->target_id, castspell->slot); } diff --git a/zone/mob.cpp b/zone/mob.cpp index 3087ccfb7..bc9d7885f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -367,9 +367,7 @@ Mob::Mob(const char* in_name, nimbus_effect3 = 0; m_targetable = true; - targetring_x = 0.0f; - targetring_y = 0.0f; - targetring_z = 0.0f; + m_TargetRing = xyz_location::Origin(); flymode = FlyMode3; // Pathing diff --git a/zone/mob.h b/zone/mob.h index f1e79d1a1..a00eb56bb 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -290,9 +290,9 @@ public: inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } void RemoveNimbusEffect(int effectid); - inline float GetTargetRingX() const { return targetring_x; } - inline float GetTargetRingY() const { return targetring_y; } - inline float GetTargetRingZ() const { return targetring_z; } + inline float GetTargetRingX() const { return m_TargetRing.m_X; } + inline float GetTargetRingY() const { return m_TargetRing.m_Y; } + inline float GetTargetRingZ() const { return m_TargetRing.m_Z; } inline bool HasEndurUpkeep() const { return endur_upkeep; } inline void SetEndurUpkeep(bool val) { endur_upkeep = val; } @@ -1241,9 +1241,7 @@ protected: float tar_vz; float test_vector; - float targetring_x; - float targetring_y; - float targetring_z; + xyz_location m_TargetRing; uint32 m_spellHitsLeft[38]; // Used to track which spells will have their numhits incremented when spell finishes casting, 38 Buffslots int flymode; From 09f75c09b85d8f480a89a3b66b82f506deb1f91f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 00:56:07 -0800 Subject: [PATCH 0338/1883] rewind_x, rewind_y,rewind_z replaced with m_RewindLocation of type xyz_location --- zone/client_packet.cpp | 20 +++++++------------- zone/mob.cpp | 4 +--- zone/mob.h | 6 ++---- zone/zoning.cpp | 2 +- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 4c5017917..9f7d533b2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4521,28 +4521,22 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) float rewind_x_diff = 0; float rewind_y_diff = 0; - rewind_x_diff = ppu->x_pos - rewind_x; + rewind_x_diff = ppu->x_pos - m_RewindLocation.m_X; rewind_x_diff *= rewind_x_diff; - rewind_y_diff = ppu->y_pos - rewind_y; + rewind_y_diff = ppu->y_pos - m_RewindLocation.m_Y; rewind_y_diff *= rewind_y_diff; //We only need to store updated values if the player has moved. //If the player has moved more than units for x or y, then we'll store //his pre-PPU x and y for /rewind, in case he gets stuck. - if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) { - rewind_x = m_Position.m_X; - rewind_y = m_Position.m_Y; - rewind_z = m_Position.m_Z; - } + if ((rewind_x_diff > 750) || (rewind_y_diff > 750)) + m_RewindLocation = m_Position; //If the PPU was a large jump, such as a cross zone gate or Call of Hero, //just update rewind coords to the new ppu coords. This will prevent exploitation. - if ((rewind_x_diff > 5000) || (rewind_y_diff > 5000)) { - rewind_x = ppu->x_pos; - rewind_y = ppu->y_pos; - rewind_z = ppu->z_pos; - } + if ((rewind_x_diff > 5000) || (rewind_y_diff > 5000)) + m_RewindLocation = xyz_location(ppu->x_pos, ppu->y_pos, ppu->z_pos); if(proximity_timer.Check()) { entity_list.ProcessMove(this, ppu->x_pos, ppu->y_pos, ppu->z_pos); @@ -11585,7 +11579,7 @@ void Client::Handle_OP_Rewind(const EQApplicationPacket *app) Message_StringID(MT_System, REWIND_WAIT); } else { - CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), rewind_x, rewind_y, rewind_z, 0, 2, Rewind); + CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_RewindLocation.m_X, m_RewindLocation.m_Y, m_RewindLocation.m_Z, 0, 2, Rewind); rewind_timer.Start(30000, true); } } diff --git a/zone/mob.cpp b/zone/mob.cpp index bc9d7885f..5d495e84f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -118,9 +118,7 @@ Mob::Mob(const char* in_name, AI_Init(); SetMoving(false); moved=false; - rewind_x = 0; //Stored x_pos for /rewind - rewind_y = 0; //Stored y_pos for /rewind - rewind_z = 0; //Stored z_pos for /rewind + m_RewindLocation = xyz_location::Origin(); move_tic_count = 0; _egnode = nullptr; diff --git a/zone/mob.h b/zone/mob.h index a00eb56bb..6e227763c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1056,7 +1056,6 @@ protected: uint8 pRunAnimSpeed; bool m_is_running; - Timer attack_timer; Timer attack_dw_timer; Timer ranged_timer; @@ -1091,9 +1090,8 @@ protected: uint8 projectile_increment[MAX_SPELL_PROJECTILE]; float projectile_x[MAX_SPELL_PROJECTILE], projectile_y[MAX_SPELL_PROJECTILE], projectile_z[MAX_SPELL_PROJECTILE]; - float rewind_x; - float rewind_y; - float rewind_z; + xyz_location m_RewindLocation; + Timer rewind_timer; // Currently 3 max nimbus particle effects at a time diff --git a/zone/zoning.cpp b/zone/zoning.cpp index fe6bcf557..b05b6a6e1 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -539,7 +539,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_RewindLocation.m_X, m_RewindLocation.m_Y, m_RewindLocation.m_Z, zone->GetShortName()); zonesummon_x = m_Position.m_X = x; zonesummon_y = m_Position.m_Y = y; zonesummon_z = m_Position.m_Z = z; From daec5bde662dcb6b9241e14b802c91f64be4358a Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Wed, 26 Nov 2014 13:57:18 -0800 Subject: [PATCH 0339/1883] Item Transformation now works! --- common/item.cpp | 56 +++++++++++++++++++ common/item.h | 7 +++ common/patches/rof.cpp | 10 ++++ common/patches/underfoot.cpp | 6 ++ common/ruletypes.h | 2 + common/shareddb.cpp | 27 +++++++-- .../2014_11_26_TransformationRules.sql | 3 + .../2014_11_26_InventoryTableUpdate.sql | 4 ++ world/worlddb.cpp | 3 + zone/client.cpp | 18 +++++- zone/client.h | 2 +- zone/client_packet.cpp | 4 ++ zone/inventory.cpp | 7 ++- zone/mob.cpp | 3 + zone/string_ids.h | 2 + zone/tradeskills.cpp | 20 +++++++ 16 files changed, 166 insertions(+), 8 deletions(-) create mode 100644 utils/sql/git/optional/2014_11_26_TransformationRules.sql create mode 100644 utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql diff --git a/common/item.cpp b/common/item.cpp index e59edebe3..ca469aa6e 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1412,6 +1412,8 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) { m_scaledItem = nullptr; m_evolveInfo = nullptr; m_scaling = false; + m_ornamenticon = 0; + m_ornamentidfile = 0; } ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { @@ -1434,6 +1436,8 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_scaledItem = nullptr; m_evolveInfo = nullptr; m_scaling = false; + m_ornamenticon = 0; + m_ornamentidfile = 0; } ItemInst::ItemInst(ItemInstTypes use_type) { @@ -1451,6 +1455,8 @@ ItemInst::ItemInst(ItemInstTypes use_type) { m_scaledItem = nullptr; m_evolveInfo = nullptr; m_scaling = false; + m_ornamenticon = 0; + m_ornamentidfile = 0; } // Make a copy of an ItemInst object @@ -1501,6 +1507,8 @@ ItemInst::ItemInst(const ItemInst& copy) m_evolveInfo = nullptr; m_scaling = copy.m_scaling; + m_ornamenticon = copy.m_ornamenticon; + m_ornamentidfile = copy.m_ornamentidfile; } // Clean up container contents @@ -1789,6 +1797,54 @@ ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const return nullptr; } +bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll) { + if (!ItemToTry || !Container) return false; + + if (ItemToTry->ItemType == ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) + return false; + + if (AllowAll && Container->CharmFile != "ITEMTRANSFIGSHIELD" && Container->CharmFile != "ITEMTransfigBow") { + switch (ItemToTry->ItemType) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 35: + case 45: + return true; + } + } + + static std::map types = { + { "ITEMTransfig1HP", 2 }, + { "ITEMTransfig1HS", 0 }, + { "ITEMTransfig2HB", 4 }, + { "ITEMTransfig2HP", 35 }, + { "ITEMTransfig2HS", 1 }, + { "ITEMTransfigBlunt", 3 }, + { "ITEMTransfigBow", 5 }, + { "ITEMTransfigHTH", 45 }, + { "ITEMTRANSFIGSHIELD", 8 }, + { "ITEMTransfigSlashing", 0 } + }; + + auto i = types.find(Container->CharmFile); + if (i != types.end() && i->second == ItemToTry->ItemType) + return true; + + static std::map typestwo = { + { "ITEMTransfigBlunt", 4 }, + { "ITEMTransfigSlashing", 1 } + }; + + i = typestwo.find(Container->CharmFile); + if (i != typestwo.end() && i->second == ItemToTry->ItemType) + return true; + + return false; +} + uint32 ItemInst::GetAugmentItemID(uint8 slot) const { uint32 id = NO_ITEM; diff --git a/common/item.h b/common/item.h index e6d1e8bee..cce166eb0 100644 --- a/common/item.h +++ b/common/item.h @@ -330,6 +330,7 @@ public: ItemInst* RemoveAugment(uint8 index); bool IsAugmented(); ItemInst* GetOrnamentationAug(int ornamentationAugtype) const; + static bool CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll = false); // Has attack/delay? bool IsWeapon() const; @@ -392,6 +393,10 @@ public: void SetActivated(bool activated) { m_activated = activated; } int8 GetEvolveLvl() const { return m_evolveLvl; } void SetScaling(bool v) { m_scaling = v; } + uint32 GetOrnamentationIcon() const { return m_ornamenticon; } + void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; } + uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; } + void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; } void Initialize(SharedDatabase *db = nullptr); void ScaleItem(); @@ -436,6 +441,8 @@ protected: Item_Struct* m_scaledItem; EvolveInfo* m_evolveInfo; bool m_scaling; + uint32 m_ornamenticon; + uint32 m_ornamentidfile; // // Items inside of this item (augs or contents); diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 092101d7d..c7efe0264 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4888,6 +4888,16 @@ namespace RoF //Icon ornaIcon = aug_weap->Icon; } + else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { + char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); + //Mainhand + ss.write(tmp, strlen(tmp)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Offhand + ss.write(tmp, strlen(tmp)); + ss.write((const char*)&null_term, sizeof(uint8)); + ornaIcon = inst->GetOrnamentationIcon(); + } else { ss.write((const char*)&null_term, sizeof(uint8)); //no mh ss.write((const char*)&null_term, sizeof(uint8));//no of diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index adc4ed6e3..c9d726a25 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3664,6 +3664,12 @@ namespace Underfoot ss.write((const char*)&null_term, sizeof(uint8)); ornaIcon = aug_weap->Icon; } + else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { + char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); + ss.write(tmp, strlen(tmp)); + ss.write((const char*)&null_term, sizeof(uint8)); + ornaIcon = inst->GetOrnamentationIcon(); + } else { ss.write((const char*)&null_term, sizeof(uint8)); //no idfile } diff --git a/common/ruletypes.h b/common/ruletypes.h index 052571d82..b3e9b4f1c 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -586,6 +586,8 @@ RULE_CATEGORY( Inventory ) RULE_BOOL ( Inventory, EnforceAugmentRestriction, true) // Forces augment slot restrictions RULE_BOOL ( Inventory, EnforceAugmentUsability, true) // Forces augmented item usability RULE_BOOL ( Inventory, EnforceAugmentWear, true) // Forces augment wear slot validation +RULE_BOOL ( Inventory, DeleteTransformationMold, true) //False if you want mold to last forever +RULE_BOOL ( Inventory, AllowAnyWeaponTransformation, false) //Weapons can use any weapon transformation RULE_CATEGORY_END() RULE_CATEGORY( Client ) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d543db87f..05c7b6962 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -199,14 +199,14 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i // Update/Insert item std::string query = StringFormat("REPLACE INTO inventory " "(charid, slotid, itemid, charges, instnodrop, custom_data, color, " - "augslot1, augslot2, augslot3, augslot4, augslot5) " + "augslot1, augslot2, augslot3, augslot4, augslot5, ornamenticon, ornamentidfile) " "VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, " - "%lu, %lu, %lu, %lu, %lu)", + "%lu, %lu, %lu, %lu, %lu, %lu, %lu)", (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, (unsigned long)(inst->IsInstNoDrop()? 1: 0), inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(), (unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2], - (unsigned long)augslot[3],(unsigned long)augslot[4]); + (unsigned long)augslot[3],(unsigned long)augslot[4], (unsigned long)inst->GetOrnamentationIcon(), (unsigned long)inst->GetOrnamentationIDFile()); auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents @@ -488,7 +488,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile " "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -513,6 +513,9 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool instnodrop = (row[9] && (uint16)atoi(row[9]))? true: false; + uint32 ornament_icon = (uint32)atoul(row[11]); + uint32 ornament_idfile = (uint32)atoul(row[12]); + const Item_Struct* item = GetItem(item_id); if (!item) { @@ -549,6 +552,11 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { value.push_back(v); } } + if (ornament_icon > 0) + inst->SetOrnamentIcon(ornament_icon); + + if (ornament_idfile > 0) + inst->SetOrnamentationIDFile(ornament_idfile); if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) inst->SetInstNoDrop(true); @@ -591,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile " "FROM inventory INNER JOIN character_data ch " "ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid", name, account_id); @@ -617,6 +625,9 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) aug[4] = (uint32)atoi(row[8]); bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; + uint32 ornament_icon = (uint32)atoul(row[11]); + uint32 ornament_idfile = (uint32)atoul(row[12]); + const Item_Struct* item = GetItem(item_id); int16 put_slot_id = INVALID_INDEX; if(!item) @@ -651,6 +662,12 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } } + + if (ornament_icon > 0) + inst->SetOrnamentIcon(ornament_icon); + + if (ornament_idfile > 0) + inst->SetOrnamentationIDFile(ornament_idfile); if (color > 0) inst->SetColor(color); diff --git a/utils/sql/git/optional/2014_11_26_TransformationRules.sql b/utils/sql/git/optional/2014_11_26_TransformationRules.sql new file mode 100644 index 000000000..d31b6b26e --- /dev/null +++ b/utils/sql/git/optional/2014_11_26_TransformationRules.sql @@ -0,0 +1,3 @@ +--Optional Transformation Rules +INSERT INTO `rule_values` VALUES (1, 'Inventory:DeleteTransformationMold', 'true', 'false to keep transformation mold forever'); +INSERT INTO `rule_values` VALUES (1, 'Inventory:AllowAnyWeaponTransformation', 'false', 'True allows any MELEE weapon to use the other melee type transformatios'); diff --git a/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql b/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql new file mode 100644 index 000000000..ca25e4e2d --- /dev/null +++ b/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql @@ -0,0 +1,4 @@ +--Inventory table update +ALTER TABLE `inventory` + ADD COLUMN `ornamenticon` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `custom_data`, + ADD COLUMN `ornamentidfile` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `ornamenticon`; \ No newline at end of file diff --git a/world/worlddb.cpp b/world/worlddb.cpp index cd01e01b2..458025349 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -197,6 +197,9 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (item->GetOrnamentationAug(ornamentationAugtype)) { idfile = atoi(&item->GetOrnamentationAug(ornamentationAugtype)->GetItem()->IDFile[2]); } + else if (item->GetOrnamentationIcon() && item->GetOrnamentationIDFile()) { + idfile = item->GetOrnamentationIDFile(); + } else { idfile = atoi(&item->GetItem()->IDFile[2]); } diff --git a/zone/client.cpp b/zone/client.cpp index 9541959ba..7ceb12496 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1889,6 +1889,9 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) if (strlen(item->IDFile) > 2) ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); } + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + ns->spawn.equipment[MaterialPrimary] = inst->GetOrnamentationIDFile(); + } else { item = inst->GetItem(); if (strlen(item->IDFile) > 2) @@ -1901,6 +1904,9 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) if (strlen(item->IDFile) > 2) ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); } + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + ns->spawn.equipment[MaterialSecondary] = inst->GetOrnamentationIDFile(); + } else { item = inst->GetItem(); if (strlen(item->IDFile) > 2) @@ -2766,6 +2772,9 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); } + else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + m_pp.item_material[MaterialPrimary] = inst->GetOrnamentationIDFile(); + } else { m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); } @@ -2776,6 +2785,9 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); } + else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + m_pp.item_material[MaterialSecondary] = inst->GetOrnamentationIDFile(); + } else { m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); } @@ -5832,7 +5844,11 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = aug_weap->Icon; - } + } + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = inst->GetOrnamentationIcon(); + } else { strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = item->Icon; diff --git a/zone/client.h b/zone/client.h index dcf665bab..4c69917fd 100644 --- a/zone/client.h +++ b/zone/client.h @@ -810,7 +810,7 @@ public: void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 000ed8fcc..a12247cc6 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8031,6 +8031,10 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = aug_weap->Icon; } + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + strcpy(insr->itemnames[L], item->Name); + insr->itemicons[L] = inst->GetOrnamentationIcon(); + } else { strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = item->Icon; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 76b077e2d..a7f61819e 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -199,7 +199,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) { return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != INVALID_INDEX); } -bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot) { +bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile) { this->EVENT_ITEM_ScriptStopReturn(); // TODO: update calling methods and script apis to handle a failure return @@ -557,6 +557,11 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // attune item if(attuned && inst->GetItem()->Attuneable) inst->SetInstNoDrop(true); + + if(ornament_icon > 0 && ornament_idfile > 0) { + inst->SetOrnamentIcon(ornament_icon); + inst->SetOrnamentationIDFile(ornament_idfile); + } // check to see if item is usable in requested slot if(enforceusable && (((to_slot >= MainCharm) && (to_slot <= MainAmmo)) || (to_slot == MainPowerSource))) { diff --git a/zone/mob.cpp b/zone/mob.cpp index 15fb731e2..35a019252 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2455,6 +2455,9 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); return atoi(&item->IDFile[2]); } + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { + return inst->GetOrnamentationIDFile(); + } else { if (strlen(item->IDFile) > 2) return atoi(&item->IDFile[2]); diff --git a/zone/string_ids.h b/zone/string_ids.h index 5375c2d7d..044dd215f 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -296,6 +296,8 @@ #define GUILD_BANK_FULL 6098 // There is no more room in the Guild Bank. #define GUILD_BANK_TRANSFERRED 6100 // '%1' transferred to Guild Bank from Deposits. #define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank. +#define TRANSFORM_FAILED 6326 //This mold cannot be applied to your %1. +#define TRANSFORM_COMPLETE 6327 //You have successfully transformed your %1. #define GENERIC_STRING 6688 //%1 (used to any basic message) #define SENTINEL_TRIG_YOU 6724 //You have triggered your sentinel. #define SENTINEL_TRIG_OTHER 6725 //%1 has triggered your sentinel. diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index c7ac3339e..e9de6c4a6 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -283,6 +283,26 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } container = inst; + if (container->GetItem()->BagType == BagTypeTransformationmold) { + const ItemInst* inst = container->GetItem(0); + bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); + if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { + const Item_Struct* new_weapon = inst->GetItem(); + user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + container->Clear(); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->IsInstNoDrop(), MainCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); + user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); + if (RuleB(Inventory, DeleteTransformationMold)) + user->DeleteItemInInventory(in_combine->container_slot, 0, true); + } + else if (inst) { + user->Message_StringID(4, TRANSFORM_FAILED, inst->GetItem()->Name); + } + EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { From a6177859fffd33cd9f97486dd87c8fe09b9ec8e6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 14:57:12 -0800 Subject: [PATCH 0340/1883] fear_walkto_x, fear_walkto_y, fear_walkto_z replaced with m_FearWalkTarget converted to xyz_location --- zone/fearpath.cpp | 12 ++---------- zone/mob.cpp | 7 +------ zone/mob.h | 4 +--- zone/mob_ai.cpp | 12 ++++++------ 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 47fc53a96..8addf3f9a 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,9 +167,7 @@ void Mob::CalculateNewFearpoint() if(Route.size() > 0) { - fear_walkto_x = Loc.x; - fear_walkto_y = Loc.y; - fear_walkto_z = Loc.z; + m_FearWalkTarget = xyz_location(Loc.x, Loc.y, Loc.z); curfp = true; mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); @@ -199,14 +197,8 @@ void Mob::CalculateNewFearpoint() } } if (curfp) - { - fear_walkto_x = ranx; - fear_walkto_y = rany; - fear_walkto_z = ranz; - } + m_FearWalkTarget = xyz_location(ranx, rany, ranz); else //Break fear - { BuffFadeByEffect(SE_Fear); - } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 5d495e84f..989f7cde1 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -98,6 +98,7 @@ Mob::Mob(const char* in_name, bardsong_timer(6000), gravity_timer(1000), viral_timer(0), + m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), flee_timer(FLEE_CHECK_TIMER) { @@ -110,9 +111,6 @@ Mob::Mob(const char* in_name, tarx=0; tary=0; tarz=0; - fear_walkto_x = -999999; - fear_walkto_y = -999999; - fear_walkto_z = -999999; curfp = false; AI_Init(); @@ -321,9 +319,6 @@ Mob::Mob(const char* in_name, follow=0; follow_dist = 100; // Default Distance for Follow flee_mode = false; - fear_walkto_x = -999999; - fear_walkto_y = -999999; - fear_walkto_z = -999999; curfp = false; flee_timer.Start(); diff --git a/zone/mob.h b/zone/mob.h index 6e227763c..fb60240ff 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1192,9 +1192,7 @@ protected: int patrol; - float fear_walkto_x; - float fear_walkto_y; - float fear_walkto_z; + xyz_location m_FearWalkTarget; bool curfp; // Pathing diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e36ffb11a..e2fa84560 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -785,17 +785,17 @@ void Client::AI_Process() if(AImovement_timer->Check()) { animation = GetRunspeed() * 21; // Check if we have reached the last fear point - if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) { + if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) { // Calculate a new point to run to CalculateNewFearpoint(); } if(!RuleB(Pathing, Fear) || !zone->pathing) - CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true); + CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true); else { bool WaypointChanged, NodeReached; - Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, + Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged) @@ -1053,17 +1053,17 @@ void Mob::AI_Process() { } else { if(AImovement_timer->Check()) { // Check if we have reached the last fear point - if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) { + if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) { // Calculate a new point to run to CalculateNewFearpoint(); } if(!RuleB(Pathing, Fear) || !zone->pathing) - CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true); + CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true); else { bool WaypointChanged, NodeReached; - Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z, + Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), WaypointChanged, NodeReached); if(WaypointChanged) From 75543e68e3f86d58432a3f130d8fdfc1cba0d84b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 15:10:49 -0800 Subject: [PATCH 0341/1883] tarx, tary, tarz converted to m_TargetLocation as xyz_location --- zone/mob.cpp | 4 +--- zone/mob.h | 10 ++++------ zone/waypoints.cpp | 6 ++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 989f7cde1..3e617511b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -99,6 +99,7 @@ Mob::Mob(const char* in_name, gravity_timer(1000), viral_timer(0), m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), + m_TargetLocation(0.0f, 0.0f, 0.0f), flee_timer(FLEE_CHECK_TIMER) { @@ -108,9 +109,6 @@ Mob::Mob(const char* in_name, tar_vx=0; tar_vy=0; tar_vz=0; - tarx=0; - tary=0; - tarz=0; curfp = false; AI_Init(); diff --git a/zone/mob.h b/zone/mob.h index fb60240ff..d3b72fdcf 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -399,9 +399,9 @@ public: inline const float GetHeading() const { return m_Position.m_Heading; } inline const float GetSize() const { return size; } inline const float GetBaseSize() const { return base_size; } - inline const float GetTarX() const { return tarx; } - inline const float GetTarY() const { return tary; } - inline const float GetTarZ() const { return tarz; } + inline const float GetTarX() const { return m_TargetLocation.m_X; } + inline const float GetTarY() const { return m_TargetLocation.m_Y; } + inline const float GetTarZ() const { return m_TargetLocation.m_Z; } inline const float GetTarVX() const { return tar_vx; } inline const float GetTarVY() const { return tar_vy; } inline const float GetTarVZ() const { return tar_vz; } @@ -1227,9 +1227,7 @@ protected: bool pet_owner_client; //Flags regular and pets as belonging to a client EGNode *_egnode; //the EG node we are in - float tarx; - float tary; - float tarz; + xyz_location m_TargetLocation; uint8 tar_ndx; float tar_vector; float tar_vx; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 678504c1c..7a407cd9f 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -531,7 +531,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b } int compare_steps = IsBoat() ? 1 : 20; - if(tar_ndx < compare_steps && tarx==x && tary==y) { + if(tar_ndx < compare_steps && m_TargetLocation.m_X==x && m_TargetLocation.m_Y==y) { float new_x = m_Position.m_X + tar_vx*tar_vector; float new_y = m_Position.m_Y + tar_vy*tar_vector; @@ -590,9 +590,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b } else { tar_ndx=0; } - tarx=x; - tary=y; - tarz=z; + m_TargetLocation = xyz_location(x, y, z); float nx = this->m_Position.m_X; float ny = this->m_Position.m_Y; From c5c778f575b39d693e132bc9786d06bfd559170b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 26 Nov 2014 18:29:07 -0500 Subject: [PATCH 0342/1883] Minor bug fixes --- common/item.cpp | 30 +++++++++---------- .../2014_11_26_InventoryTableUpdate.sql | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index ca469aa6e..f23d87665 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1803,7 +1803,7 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con if (ItemToTry->ItemType == ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) return false; - if (AllowAll && Container->CharmFile != "ITEMTRANSFIGSHIELD" && Container->CharmFile != "ITEMTransfigBow") { + if (AllowAll && !strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && !strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) { switch (ItemToTry->ItemType) { case 0: case 1: @@ -1817,28 +1817,28 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con } static std::map types = { - { "ITEMTransfig1HP", 2 }, - { "ITEMTransfig1HS", 0 }, - { "ITEMTransfig2HB", 4 }, - { "ITEMTransfig2HP", 35 }, - { "ITEMTransfig2HS", 1 }, - { "ITEMTransfigBlunt", 3 }, - { "ITEMTransfigBow", 5 }, - { "ITEMTransfigHTH", 45 }, - { "ITEMTRANSFIGSHIELD", 8 }, - { "ITEMTransfigSlashing", 0 } + { "itemtransfig1hp", 2 }, + { "itemtransfig1hs", 0 }, + { "itemtransfig2hb", 4 }, + { "itemtransfig2hp", 35 }, + { "itemtransfig2hs", 1 }, + { "itemtransfigblunt", 3 }, + { "itemtransfigbow", 5 }, + { "itemtransfighth", 45 }, + { "itemtransfigshield", 8 }, + { "itemtransfigslashing", 0 } }; - auto i = types.find(Container->CharmFile); + auto i = types.find(MakeLowerString(Container->CharmFile)); if (i != types.end() && i->second == ItemToTry->ItemType) return true; static std::map typestwo = { - { "ITEMTransfigBlunt", 4 }, - { "ITEMTransfigSlashing", 1 } + { "itemtransfigblunt", 4 }, + { "itemtransfigslashing", 1 } }; - i = typestwo.find(Container->CharmFile); + i = typestwo.find(MakeLowerString(Container->CharmFile)); if (i != typestwo.end() && i->second == ItemToTry->ItemType) return true; diff --git a/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql b/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql index ca25e4e2d..27a6d6c37 100644 --- a/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql +++ b/utils/sql/git/required/2014_11_26_InventoryTableUpdate.sql @@ -1,4 +1,4 @@ ---Inventory table update +-- Inventory table update ALTER TABLE `inventory` ADD COLUMN `ornamenticon` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `custom_data`, - ADD COLUMN `ornamentidfile` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `ornamenticon`; \ No newline at end of file + ADD COLUMN `ornamentidfile` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `ornamenticon`; From 408fdc71781b79ba1704d4ec5b62c29128f43f40 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 15:58:29 -0800 Subject: [PATCH 0343/1883] tarv_x, tarv_y. tarv_z converted to xyz_location --- zone/mob.cpp | 6 ++--- zone/mob.h | 10 ++++----- zone/waypoints.cpp | 56 +++++++++++++++++++++++----------------------- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 3e617511b..4db71440c 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -99,16 +99,14 @@ Mob::Mob(const char* in_name, gravity_timer(1000), viral_timer(0), m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), - m_TargetLocation(0.0f, 0.0f, 0.0f), + m_TargetLocation(xyz_location::Origin()), + m_TargetV(xyz_location::Origin()), flee_timer(FLEE_CHECK_TIMER) { targeted = 0; tar_ndx=0; tar_vector=0; - tar_vx=0; - tar_vy=0; - tar_vz=0; curfp = false; AI_Init(); diff --git a/zone/mob.h b/zone/mob.h index d3b72fdcf..bbab7eaa5 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -402,9 +402,9 @@ public: inline const float GetTarX() const { return m_TargetLocation.m_X; } inline const float GetTarY() const { return m_TargetLocation.m_Y; } inline const float GetTarZ() const { return m_TargetLocation.m_Z; } - inline const float GetTarVX() const { return tar_vx; } - inline const float GetTarVY() const { return tar_vy; } - inline const float GetTarVZ() const { return tar_vz; } + inline const float GetTarVX() const { return m_TargetV.m_X; } + inline const float GetTarVY() const { return m_TargetV.m_Y; } + inline const float GetTarVZ() const { return m_TargetV.m_Z; } inline const float GetTarVector() const { return tar_vector; } inline const uint8 GetTarNDX() const { return tar_ndx; } bool IsBoat() const; @@ -1230,9 +1230,7 @@ protected: xyz_location m_TargetLocation; uint8 tar_ndx; float tar_vector; - float tar_vx; - float tar_vy; - float tar_vz; + xyz_location m_TargetV; float test_vector; xyz_location m_TargetRing; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 7a407cd9f..306714260 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -533,9 +533,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b int compare_steps = IsBoat() ? 1 : 20; if(tar_ndx < compare_steps && m_TargetLocation.m_X==x && m_TargetLocation.m_Y==y) { - float new_x = m_Position.m_X + tar_vx*tar_vector; - float new_y = m_Position.m_Y + tar_vy*tar_vector; - float new_z = m_Position.m_Z + tar_vz*tar_vector; + float new_x = m_Position.m_X + m_TargetV.m_X*tar_vector; + float new_y = m_Position.m_Y + m_TargetV.m_Y*tar_vector; + float new_z = m_Position.m_Z + m_TargetV.m_Z*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } @@ -544,7 +544,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b m_Position.m_Y = new_y; m_Position.m_Z = new_z; - mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, m_TargetV.m_X, m_TargetV.m_Y, m_TargetV.m_Z); uint8 NPCFlyMode = 0; @@ -597,19 +597,19 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float nz = this->m_Position.m_Z; // float nh = this->heading; - tar_vx = x - nx; - tar_vy = y - ny; - tar_vz = z - nz; + m_TargetV.m_X = x - nx; + m_TargetV.m_Y = y - ny; + m_TargetV.m_Z = z - nz; //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, m_TargetV.m_X, m_TargetV.m_Y, m_TargetV.m_Z, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector // -------------------------------------------------------------------------- - float mag = sqrtf (tar_vx*tar_vx + tar_vy*tar_vy + tar_vz*tar_vz); + float mag = sqrtf (m_TargetV.m_X*m_TargetV.m_X + m_TargetV.m_Y*m_TargetV.m_Y + m_TargetV.m_Z*m_TargetV.m_Z); tar_vector = speed / mag; // mob move fix @@ -622,14 +622,14 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b { if (numsteps>1) { - tar_vector=1.0f ; - tar_vx = tar_vx/numsteps; - tar_vy = tar_vy/numsteps; - tar_vz = tar_vz/numsteps; + tar_vector=1.0f ; + m_TargetV.m_X = m_TargetV.m_X/numsteps; + m_TargetV.m_Y = m_TargetV.m_Y/numsteps; + m_TargetV.m_Z = m_TargetV.m_Z/numsteps; - float new_x = m_Position.m_X + tar_vx; - float new_y = m_Position.m_Y + tar_vy; - float new_z = m_Position.m_Z + tar_vz; + float new_x = m_Position.m_X + m_TargetV.m_X; + float new_y = m_Position.m_Y + m_TargetV.m_Y; + float new_z = m_Position.m_Z + m_TargetV.m_Z; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } @@ -659,9 +659,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b else { tar_vector/=20; - float new_x = m_Position.m_X + tar_vx*tar_vector; - float new_y = m_Position.m_Y + tar_vy*tar_vector; - float new_z = m_Position.m_Z + tar_vz*tar_vector; + float new_x = m_Position.m_X + m_TargetV.m_X*tar_vector; + float new_y = m_Position.m_Y + m_TargetV.m_Y*tar_vector; + float new_z = m_Position.m_Z + m_TargetV.m_Z*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } @@ -753,22 +753,22 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec } float old_test_vector=test_vector; - tar_vx = x - nx; - tar_vy = y - ny; - tar_vz = z - nz; + m_TargetV.m_X = x - nx; + m_TargetV.m_Y = y - ny; + m_TargetV.m_Z = z - nz; - if (tar_vx == 0 && tar_vy == 0) + if (m_TargetV.m_X == 0 && m_TargetV.m_Y == 0) return false; pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - mlog(AI__WAYPOINTS, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + mlog(AI__WAYPOINTS, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, m_TargetV.m_X, m_TargetV.m_Y, m_TargetV.m_Z, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector // -------------------------------------------------------------------------- test_vector=sqrtf (x*x + y*y + z*z); - tar_vector = speed / sqrtf (tar_vx*tar_vx + tar_vy*tar_vy + tar_vz*tar_vz); + tar_vector = speed / sqrtf (m_TargetV.m_X*m_TargetV.m_X + m_TargetV.m_Y*m_TargetV.m_Y + m_TargetV.m_Z*m_TargetV.m_Z); m_Position.m_Heading = CalculateHeadingToTarget(x, y); if (tar_vector >= 1.0) { @@ -782,9 +782,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint"); } else { - float new_x = m_Position.m_X + tar_vx*tar_vector; - float new_y = m_Position.m_Y + tar_vy*tar_vector; - float new_z = m_Position.m_Z + tar_vz*tar_vector; + float new_x = m_Position.m_X + m_TargetV.m_X*tar_vector; + float new_y = m_Position.m_Y + m_TargetV.m_Y*tar_vector; + float new_z = m_Position.m_Z + m_TargetV.m_Z*tar_vector; if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), new_x, new_y, new_z); } From 2814130aad846a65f9679a22a4cec1ea96352f24 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 26 Nov 2014 19:04:20 -0500 Subject: [PATCH 0344/1883] Fix for compilers w/o C++11 uniform initialization --- common/item.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index f23d87665..af661626a 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1816,28 +1816,26 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con } } - static std::map types = { - { "itemtransfig1hp", 2 }, - { "itemtransfig1hs", 0 }, - { "itemtransfig2hb", 4 }, - { "itemtransfig2hp", 35 }, - { "itemtransfig2hs", 1 }, - { "itemtransfigblunt", 3 }, - { "itemtransfigbow", 5 }, - { "itemtransfighth", 45 }, - { "itemtransfigshield", 8 }, - { "itemtransfigslashing", 0 } - }; + static std::map types; + types["itemtransfig1hp"] = 2; + types["itemtransfig1hs"] = 0; + types["itemtransfig2hb"] = 4; + types["itemtransfig2hp"] = 35; + types["itemtransfig2hs"] = 1; + types["itemtransfigblunt"] = 3; + types["itemtransfigbow"] = 5; + types["itemtransfighth"] = 45; + types["itemtransfigshield"] = 8; + types["itemtransfigslashing"] = 0; auto i = types.find(MakeLowerString(Container->CharmFile)); if (i != types.end() && i->second == ItemToTry->ItemType) return true; - static std::map typestwo = { - { "itemtransfigblunt", 4 }, - { "itemtransfigslashing", 1 } - }; - + static std::map typestwo; + typestwo["itemtransfigblunt"] = 4; + typestwo["itemtransfigslashing"] = 1; + i = typestwo.find(MakeLowerString(Container->CharmFile)); if (i != typestwo.end() && i->second == ItemToTry->ItemType) return true; From 32a034bd587890249e1e84c996295020a874afce Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 26 Nov 2014 19:12:04 -0500 Subject: [PATCH 0345/1883] Flipped logic wrong :P --- common/item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/item.cpp b/common/item.cpp index af661626a..f92bc6a67 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1803,7 +1803,7 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con if (ItemToTry->ItemType == ItemTypeArrow || strnlen(Container->CharmFile, 30) == 0) return false; - if (AllowAll && !strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && !strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) { + if (AllowAll && strncasecmp(Container->CharmFile, "ITEMTRANSFIGSHIELD", 18) && strncasecmp(Container->CharmFile, "ITEMTransfigBow", 15)) { switch (ItemToTry->ItemType) { case 0: case 1: From 56a96dc817915e327b4b0eea20d7c391d04c5547 Mon Sep 17 00:00:00 2001 From: af4t Date: Wed, 26 Nov 2014 19:55:46 -0500 Subject: [PATCH 0346/1883] Typo? --- utils/sql/git/optional/2014_11_26_TransformationRules.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/sql/git/optional/2014_11_26_TransformationRules.sql b/utils/sql/git/optional/2014_11_26_TransformationRules.sql index d31b6b26e..d86e6811d 100644 --- a/utils/sql/git/optional/2014_11_26_TransformationRules.sql +++ b/utils/sql/git/optional/2014_11_26_TransformationRules.sql @@ -1,3 +1,3 @@ ---Optional Transformation Rules +/* Optional Transformation Rules */ INSERT INTO `rule_values` VALUES (1, 'Inventory:DeleteTransformationMold', 'true', 'false to keep transformation mold forever'); INSERT INTO `rule_values` VALUES (1, 'Inventory:AllowAnyWeaponTransformation', 'false', 'True allows any MELEE weapon to use the other melee type transformatios'); From f63c5ab6ba4e9220bcfbeb3ee900098208db904a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 17:21:33 -0800 Subject: [PATCH 0347/1883] Added overloads for to_string to handle xyz_heading, xyz_location, and xy_location --- zone/position.cpp | 15 +++++++++++++++ zone/position.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/zone/position.cpp b/zone/position.cpp index 4cb7dfd53..a5f0cf5f1 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -1,4 +1,6 @@ #include "position.h" +#include +#include "../common/string_util.h" xy_location::xy_location(float x, float y) : m_X(x), @@ -104,3 +106,16 @@ void xyz_location::ABS_XYZ(void) { if (m_Z < 0) m_Z = -m_Z; } + +std::string to_string(const xyz_heading &position) { + return StringFormat("(%.3f, %.3f, %.3f, %.3f)", position.m_X,position.m_Y,position.m_Z,position.m_Heading); +} + +std::string to_string(const xyz_location &position){ + return StringFormat("(%.3f, %.3f, %.3f)", position.m_X,position.m_Y,position.m_Z); +} + +std::string to_string(const xy_location &position){ + return StringFormat("(%.3f, %.3f)", position.m_X,position.m_Y); +} + diff --git a/zone/position.h b/zone/position.h index 6258e901f..900d2cdfe 100644 --- a/zone/position.h +++ b/zone/position.h @@ -18,6 +18,8 @@ #ifndef POSITION_H #define POSITION_H +#include + class xy_location { public: float m_X; @@ -76,5 +78,8 @@ public: bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;} }; +std::string to_string(const xyz_heading &position); +std::string to_string(const xyz_location &position); +std::string to_string(const xy_location &position); #endif From d9d89ba9b340dceba6d36f62df81cb40faea5dca Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 17:34:45 -0800 Subject: [PATCH 0348/1883] GetCWPX(), GetCWPY(), GetCWPZ(), GetCWPH() converted to GetCurrentWayPoint --- zone/command.cpp | 60 +++++++++++++++++++++++------------------------ zone/lua_mob.cpp | 32 ++++++++++++------------- zone/mob.h | 5 +--- zone/perl_mob.cpp | 10 ++++---- 4 files changed, 52 insertions(+), 55 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 27516d5a5..37d252698 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2551,7 +2551,7 @@ void command_peekinv(Client *c, const Seperator *sep) peekTrade = 0x20, peekWorld = 0x40 } ; - + if (!c->GetTarget() || !c->GetTarget()->IsClient()) { c->Message(0, "You must have a PC target selected for this command"); return; @@ -2605,10 +2605,10 @@ void command_peekinv(Client *c, const Seperator *sep) instMain = targetClient->GetInv().GetItem(MainPowerSource); itemData = (instMain ? instMain->GetItem() : nullptr); itemLinkCore = nullptr; - + if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", @@ -2625,9 +2625,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2640,9 +2640,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2665,9 +2665,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", MainCursor, cursorDepth, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2680,9 +2680,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2700,9 +2700,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2717,9 +2717,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null" ); - + c->Message((itemData == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2732,9 +2732,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2749,9 +2749,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2764,9 +2764,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2782,9 +2782,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2797,9 +2797,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -2824,9 +2824,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instMain); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", (EmuConstants::WORLD_BEGIN + indexMain), ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); @@ -2839,9 +2839,9 @@ void command_peekinv(Client *c, const Seperator *sep) if (itemData) c->MakeItemLink(itemLinkCore, instSub); - + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - + c->Message((itemData == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", INVALID_INDEX, indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); @@ -7590,7 +7590,7 @@ void command_pf(Client *c, const Seperator *sep) { Mob *who = c->GetTarget(); c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ()); - c->Message(0, "WP: (%.2f, %.2f, %.2f) (%d/%d)", who->GetCWPX(), who->GetCWPY(), who->GetCWPZ(), who->GetCWP(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1); + c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1); c->Message(0, "TAR: (%.2f, %.2f, %.2f)", who->GetTarX(), who->GetTarY(), who->GetTarZ()); c->Message(0, "TARV: (%.2f, %.2f, %.2f)", who->GetTarVX(), who->GetTarVY(), who->GetTarVZ()); c->Message(0, "|TV|=%.2f index=%d", who->GetTarVector(), who->GetTarNDX()); diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 50a8b50a7..089f311bf 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -626,7 +626,7 @@ double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool return self->ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override); } -double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override, +double Lua_Mob::ResistSpell(int resist_type, int spell_id, Lua_Mob caster, bool use_resist_override, int resist_override, bool charisma_check) { Lua_Safe_Call_Real(); return self->ResistSpell(resist_type, spell_id, caster, use_resist_override, resist_override, charisma_check); @@ -669,22 +669,22 @@ double Lua_Mob::GetHeading() { double Lua_Mob::GetWaypointX() { Lua_Safe_Call_Real(); - return self->GetCWPX(); + return self->GetCurrentWayPoint().m_X; } double Lua_Mob::GetWaypointY() { Lua_Safe_Call_Real(); - return self->GetCWPY(); + return self->GetCurrentWayPoint().m_Y; } double Lua_Mob::GetWaypointZ() { Lua_Safe_Call_Real(); - return self->GetCWPZ(); + return self->GetCurrentWayPoint().m_Z; } double Lua_Mob::GetWaypointH() { Lua_Safe_Call_Real(); - return self->GetCWPH(); + return self->GetCurrentWayPoint().m_Heading; } double Lua_Mob::GetWaypointPause() { @@ -772,19 +772,19 @@ bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, in return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot)); } -bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, +bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, int timer_duration) { Lua_Safe_Call_Bool(); - return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), + return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), static_cast(timer), static_cast(timer_duration)); } -bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, +bool Lua_Mob::CastSpell(int spell_id, int target_id, int slot, int cast_time, int mana_cost, int item_slot, int timer, int timer_duration, int resist_adjust) { Lua_Safe_Call_Bool(); int16 res = resist_adjust; - return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), + return self->CastSpell(spell_id, target_id, slot, cast_time, mana_cost, nullptr, static_cast(item_slot), static_cast(timer), static_cast(timer_duration), 0, &res); } @@ -836,7 +836,7 @@ Lua_Mob Lua_Mob::GetOwner() { Lua_HateList Lua_Mob::GetHateList() { Lua_Safe_Call_Class(Lua_HateList); Lua_HateList ret; - + auto h_list = self->GetHateList(); auto iter = h_list.begin(); while(iter != h_list.end()) { @@ -1217,7 +1217,7 @@ bool Lua_Mob::EntityVariableExists(const char *name) { void Lua_Mob::Signal(uint32 id) { Lua_Safe_Call_Void(); - + if(self->IsClient()) { self->CastToClient()->Signal(id); } else if(self->IsNPC()) { @@ -1250,7 +1250,7 @@ void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, in self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time); } -void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, +void Lua_Mob::DoSpecialAttackDamage(Lua_Mob other, int skill, int max_damage, int min_damage, int hate_override, int reuse_time, bool hit_chance) { Lua_Safe_Call_Void(); self->DoSpecialAttackDamage(other, static_cast(skill), max_damage, min_damage, hate_override, reuse_time, hit_chance); @@ -1281,7 +1281,7 @@ void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ self->DoThrowingAttackDmg(other, range_weapon, item, weapon_damage, chance_mod); } -void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_Item item, int weapon_damage, int chance_mod, +void Lua_Mob::DoThrowingAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_Item item, int weapon_damage, int chance_mod, int focus) { Lua_Safe_Call_Void(); self->DoThrowingAttackDmg(other, range_weapon, item, weapon_damage, chance_mod, focus); @@ -1332,7 +1332,7 @@ void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_I self->DoArcheryAttackDmg(other, range_weapon, ammo, weapon_damage, chance_mod); } -void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ItemInst ammo, int weapon_damage, int chance_mod, +void Lua_Mob::DoArcheryAttackDmg(Lua_Mob other, Lua_ItemInst range_weapon, Lua_ItemInst ammo, int weapon_damage, int chance_mod, int focus) { Lua_Safe_Call_Void(); self->DoArcheryAttackDmg(other, range_weapon, ammo, weapon_damage, chance_mod, focus); @@ -1390,7 +1390,7 @@ void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double void Lua_Mob::ProjectileAnimation(Lua_Mob to, int item_id, bool is_arrow, double speed, double angle, double tilt, double arc) { Lua_Safe_Call_Void(); - self->ProjectileAnimation(to, item_id, is_arrow, static_cast(speed), static_cast(angle), static_cast(tilt), + self->ProjectileAnimation(to, item_id, is_arrow, static_cast(speed), static_cast(angle), static_cast(tilt), static_cast(arc)); } @@ -1630,7 +1630,7 @@ void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_d self->SendSpellEffect(effect_id, duration, finish_delay, zone_wide, unk020, perm_effect); } -void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, +void Lua_Mob::SendSpellEffect(uint32 effect_id, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, Lua_Client c) { Lua_Safe_Call_Void(); self->SendSpellEffect(effect_id, duration, finish_delay, zone_wide, unk020, perm_effect, c); diff --git a/zone/mob.h b/zone/mob.h index bbab7eaa5..57da56de5 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -862,10 +862,7 @@ public: Shielders_Struct shielder[MAX_SHIELDERS]; Trade* trade; - inline float GetCWPX() const { return(m_CurrentWayPoint.m_X); } - inline float GetCWPY() const { return(m_CurrentWayPoint.m_Y); } - inline float GetCWPZ() const { return(m_CurrentWayPoint.m_Z); } - inline float GetCWPH() const { return(m_CurrentWayPoint.m_Heading); } + inline xyz_heading GetCurrentWayPoint() const { return m_CurrentWayPoint; } inline float GetCWPP() const { return(static_cast(cur_wp_pause)); } inline int GetCWP() const { return(cur_wp); } void SetCurrentWP(uint16 waypoint) { cur_wp = waypoint; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index c47b463d3..f41685a1c 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -1615,7 +1615,7 @@ XS(XS_Mob_TypesTempPet) else Perl_croak(aTHX_ "target is not of type Mob"); - + if (items < 7) sticktarg = false; else { @@ -3525,7 +3525,7 @@ XS(XS_Mob_GetWaypointX) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPX(); + RETVAL = THIS->GetCurrentWayPoint().m_X; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3551,7 +3551,7 @@ XS(XS_Mob_GetWaypointY) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPY(); + RETVAL = THIS->GetCurrentWayPoint().m_Y; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3577,7 +3577,7 @@ XS(XS_Mob_GetWaypointZ) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPZ(); + RETVAL = THIS->GetCurrentWayPoint().m_Z; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -3603,7 +3603,7 @@ XS(XS_Mob_GetWaypointH) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetCWPH(); + RETVAL = THIS->GetCurrentWayPoint().m_Heading; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); From cfa05587fc2d152d63a56192d89aaf606000e2f8 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 26 Nov 2014 21:05:43 -0500 Subject: [PATCH 0349/1883] Added versioning for required ornament inventory sql --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/version.h b/common/version.h index caff584d8..88131e9be 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9057 +#define CURRENT_BINARY_DATABASE_VERSION 9058 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 721beb002..039b0135a 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -311,6 +311,7 @@ 9055|2014_10_30_special_abilities_null.sql|SHOW COLUMNS FROM `npc_types` LIKE 'special_abilities'|contains|NO 9056|2014_11_08_RaidMembers.sql|SHOW COLUMNS FROM `raid_members` LIKE 'groupid'|missing|unsigned 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| +9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not From f9e65acf78477cc022fa2070f7bfbb5ee11f2204 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:18:06 -0800 Subject: [PATCH 0350/1883] InWater(y,x,z) converted to InWater(xyz_location) --- zone/command.cpp | 6 ++++-- zone/forage.cpp | 19 ++++++++++--------- zone/water_map.h | 7 ++++--- zone/water_map_v2.cpp | 9 +++++---- zone/water_map_v2.h | 4 ++-- zone/waypoints.cpp | 15 ++++++++------- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 37d252698..ed551b183 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7632,15 +7632,17 @@ void command_bestz(Client *c, const Seperator *sep) { if(c->GetTarget()) { z=c->GetTarget()->GetZ(); + auto position = xyz_location(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); RegionType = zone->watermap->ReturnRegionType(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); - c->Message(0,"InWater returns %d", zone->watermap->InWater(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); + c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); } else { z=c->GetZ(); + auto position = xyz_location(c->GetX(), c->GetY(), z); RegionType = zone->watermap->ReturnRegionType(c->GetX(), c->GetY(), z); - c->Message(0,"InWater returns %d", zone->watermap->InWater(c->GetX(), c->GetY(), z)); + c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetX(), c->GetY(), z)); } diff --git a/zone/forage.cpp b/zone/forage.cpp index 24482017c..ad4959ec5 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -216,7 +216,8 @@ bool Client::CanFish() { } if(zone->zonemap != nullptr && zone->watermap != nullptr && RuleB(Watermap, CheckForWaterWhenFishing)) { - float RodX, RodY, RodZ; + + xyz_location rodPosition; // Tweak Rod and LineLength if required const float RodLength = RuleR(Watermap, FishingRodLength); const float LineLength = RuleR(Watermap, FishingLineLength); @@ -225,25 +226,25 @@ bool Client::CanFish() { HeadingDegrees = (int) ((GetHeading()*360)/256); HeadingDegrees = HeadingDegrees % 360; - RodX = m_Position.m_X + RodLength * sin(HeadingDegrees * M_PI/180.0f); - RodY = m_Position.m_Y + RodLength * cos(HeadingDegrees * M_PI/180.0f); + rodPosition.m_X = m_Position.m_X + RodLength * sin(HeadingDegrees * M_PI/180.0f); + rodPosition.m_Y = m_Position.m_Y + RodLength * cos(HeadingDegrees * M_PI/180.0f); // Do BestZ to find where the line hanging from the rod intersects the water (if it is water). // and go 1 unit into the water. Map::Vertex dest; - dest.x = RodX; - dest.y = RodY; + dest.x = rodPosition.m_X; + dest.y = rodPosition.m_Y; dest.z = m_Position.m_Z+10; - RodZ = zone->zonemap->FindBestZ(dest, nullptr) + 4; - bool in_lava = zone->watermap->InLava(RodX, RodY, RodZ); - bool in_water = zone->watermap->InWater(RodX, RodY, RodZ) || zone->watermap->InVWater(RodX, RodY, RodZ); + rodPosition.m_Z = zone->zonemap->FindBestZ(dest, nullptr) + 4; + bool in_lava = zone->watermap->InLava(rodPosition.m_X, rodPosition.m_Y, rodPosition.m_Z); + bool in_water = zone->watermap->InWater(rodPosition) || zone->watermap->InVWater(rodPosition.m_X, rodPosition.m_Y, rodPosition.m_Z); //Message(0, "Rod is at %4.3f, %4.3f, %4.3f, InWater says %d, InLava says %d", RodX, RodY, RodZ, in_water, in_lava); if (in_lava) { Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something? return false; } - if((!in_water) || (m_Position.m_Z-RodZ)>LineLength) { //Didn't hit the water OR the water is too far below us + if((!in_water) || (m_Position.m_Z-rodPosition.m_Z)>LineLength) { //Didn't hit the water OR the water is too far below us Message_StringID(MT_Skills, FISHING_LAND); //Trying to catch land sharks perhaps? return false; } diff --git a/zone/water_map.h b/zone/water_map.h index 2141a3000..0e5ccc141 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -2,6 +2,7 @@ #define EQEMU_WATER_MAP_H #include "../common/types.h" +#include "position.h" #include enum WaterRegionType { @@ -22,14 +23,14 @@ class WaterMap public: WaterMap() { } ~WaterMap() { } - + static WaterMap* LoadWaterMapfile(std::string zone_name); virtual WaterRegionType ReturnRegionType(float y, float x, float z) const { return RegionTypeNormal; } - virtual bool InWater(float y, float x, float z) const { return false; } + virtual bool InWater(const xyz_location& location) const { return false; } virtual bool InVWater(float y, float x, float z) const { return false; } virtual bool InLava(float y, float x, float z) const { return false; } virtual bool InLiquid(float y, float x, float z) const { return false; } - + protected: virtual bool Load(FILE *fp) { return false; } }; diff --git a/zone/water_map_v2.cpp b/zone/water_map_v2.cpp index 29823b96c..b08c9ca89 100644 --- a/zone/water_map_v2.cpp +++ b/zone/water_map_v2.cpp @@ -17,8 +17,8 @@ WaterRegionType WaterMapV2::ReturnRegionType(float y, float x, float z) const { return RegionTypeNormal; } -bool WaterMapV2::InWater(float y, float x, float z) const { - return ReturnRegionType(y, x, z) == RegionTypeWater; +bool WaterMapV2::InWater(const xyz_location& location) const { + return ReturnRegionType(location.m_Y, location.m_X, location.m_Z) == RegionTypeWater; } bool WaterMapV2::InVWater(float y, float x, float z) const { @@ -30,7 +30,8 @@ bool WaterMapV2::InLava(float y, float x, float z) const { } bool WaterMapV2::InLiquid(float y, float x, float z) const { - return InWater(y, x, z) || InLava(y, x, z); + auto location = xyz_location(y, x, z); + return InWater(location) || InLava(y, x, z); } bool WaterMapV2::Load(FILE *fp) { @@ -106,7 +107,7 @@ bool WaterMapV2::Load(FILE *fp) { return false; } - regions.push_back(std::make_pair((WaterRegionType)region_type, + regions.push_back(std::make_pair((WaterRegionType)region_type, OrientedBoundingBox(glm::vec3(x, y, z), glm::vec3(x_rot, y_rot, z_rot), glm::vec3(x_scale, y_scale, z_scale), glm::vec3(x_extent, y_extent, z_extent)))); } diff --git a/zone/water_map_v2.h b/zone/water_map_v2.h index 726e6a798..eef514af5 100644 --- a/zone/water_map_v2.h +++ b/zone/water_map_v2.h @@ -13,11 +13,11 @@ public: ~WaterMapV2(); virtual WaterRegionType ReturnRegionType(float y, float x, float z) const; - virtual bool InWater(float y, float x, float z) const; + virtual bool InWater(const xyz_location& location) const; virtual bool InVWater(float y, float x, float z) const; virtual bool InLava(float y, float x, float z) const; virtual bool InLiquid(float y, float x, float z) const; - + protected: virtual bool Load(FILE *fp); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 306714260..6f4b3e90a 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -227,7 +227,7 @@ void NPC::UpdateWaypoint(int wp_index) { if(!RuleB(Watermap, CheckForWaterAtWaypoints) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_CurrentWayPoint))) { Map::Vertex dest(m_CurrentWayPoint.m_X, m_CurrentWayPoint.m_Y, m_CurrentWayPoint.m_Z); @@ -557,7 +557,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X))) { Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); @@ -684,7 +684,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position))) { Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); @@ -806,7 +806,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving)) { if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position))) { Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); @@ -900,8 +900,9 @@ void NPC::AssignWaypoints(int32 grid) { if(zone->HasMap() && RuleB(Map, FixPathingZWhenLoading) ) { + auto positon = xyz_location(newwp.x,newwp.y,newwp.z); if(!RuleB(Watermap, CheckWaypointsInWaterWhenLoading) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(newwp.x, newwp.y, newwp.z))) + (zone->HasWaterMap() && !zone->watermap->InWater(positon))) { Map::Vertex dest(newwp.x, newwp.y, newwp.z); @@ -947,7 +948,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) ) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position))) { Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); @@ -978,7 +979,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo)) { if(!RuleB(Watermap, CheckForWaterOnSendTo) || !zone->HasWaterMap() || - (zone->HasWaterMap() && !zone->watermap->InWater(m_Position.m_X, m_Position.m_Y, m_Position.m_Z))) + (zone->HasWaterMap() && !zone->watermap->InWater(m_Position))) { Map::Vertex dest(m_Position.m_X, m_Position.m_Y, m_Position.m_Z); From c0faaa9c208e6cd8303dcf2c05c435fab888ff2d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:20:41 -0800 Subject: [PATCH 0351/1883] ReturnRegionType converted to xyz_location --- zone/command.cpp | 4 ++-- zone/water_map.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index ed551b183..5f4d16aaf 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7633,7 +7633,7 @@ void command_bestz(Client *c, const Seperator *sep) { if(c->GetTarget()) { z=c->GetTarget()->GetZ(); auto position = xyz_location(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); - RegionType = zone->watermap->ReturnRegionType(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); + RegionType = zone->watermap->ReturnRegionType(position); c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); @@ -7641,7 +7641,7 @@ void command_bestz(Client *c, const Seperator *sep) { else { z=c->GetZ(); auto position = xyz_location(c->GetX(), c->GetY(), z); - RegionType = zone->watermap->ReturnRegionType(c->GetX(), c->GetY(), z); + RegionType = zone->watermap->ReturnRegionType(position); c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetX(), c->GetY(), z)); diff --git a/zone/water_map.h b/zone/water_map.h index 0e5ccc141..6d5b70443 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -25,7 +25,7 @@ public: ~WaterMap() { } static WaterMap* LoadWaterMapfile(std::string zone_name); - virtual WaterRegionType ReturnRegionType(float y, float x, float z) const { return RegionTypeNormal; } + virtual WaterRegionType ReturnRegionType(const xyz_location& location) const { return RegionTypeNormal; } virtual bool InWater(const xyz_location& location) const { return false; } virtual bool InVWater(float y, float x, float z) const { return false; } virtual bool InLava(float y, float x, float z) const { return false; } From d8692c1dc7ad5bcc98c3a143d025ea666b9f33b3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:22:41 -0800 Subject: [PATCH 0352/1883] InVWater converted to xyz_location --- zone/forage.cpp | 2 +- zone/water_map.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/forage.cpp b/zone/forage.cpp index ad4959ec5..34bfdbc12 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -238,7 +238,7 @@ bool Client::CanFish() { rodPosition.m_Z = zone->zonemap->FindBestZ(dest, nullptr) + 4; bool in_lava = zone->watermap->InLava(rodPosition.m_X, rodPosition.m_Y, rodPosition.m_Z); - bool in_water = zone->watermap->InWater(rodPosition) || zone->watermap->InVWater(rodPosition.m_X, rodPosition.m_Y, rodPosition.m_Z); + bool in_water = zone->watermap->InWater(rodPosition) || zone->watermap->InVWater(rodPosition); //Message(0, "Rod is at %4.3f, %4.3f, %4.3f, InWater says %d, InLava says %d", RodX, RodY, RodZ, in_water, in_lava); if (in_lava) { Message_StringID(MT_Skills, FISHING_LAVA); //Trying to catch a fire elemental or something? diff --git a/zone/water_map.h b/zone/water_map.h index 6d5b70443..d8428a6ef 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -27,7 +27,7 @@ public: static WaterMap* LoadWaterMapfile(std::string zone_name); virtual WaterRegionType ReturnRegionType(const xyz_location& location) const { return RegionTypeNormal; } virtual bool InWater(const xyz_location& location) const { return false; } - virtual bool InVWater(float y, float x, float z) const { return false; } + virtual bool InVWater(const xyz_location& location) const { return false; } virtual bool InLava(float y, float x, float z) const { return false; } virtual bool InLiquid(float y, float x, float z) const { return false; } From 29573d7d19fe323acd9b21e41e4da7d3062e7b80 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:24:28 -0800 Subject: [PATCH 0353/1883] InLava converted to xyz_location --- zone/command.cpp | 4 ++-- zone/forage.cpp | 2 +- zone/water_map.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 5f4d16aaf..7499edd6b 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7635,7 +7635,7 @@ void command_bestz(Client *c, const Seperator *sep) { auto position = xyz_location(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z); RegionType = zone->watermap->ReturnRegionType(position); c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); - c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetTarget()->GetX(), c->GetTarget()->GetY(), z)); + c->Message(0,"InLava returns %d", zone->watermap->InLava(position)); } else { @@ -7643,7 +7643,7 @@ void command_bestz(Client *c, const Seperator *sep) { auto position = xyz_location(c->GetX(), c->GetY(), z); RegionType = zone->watermap->ReturnRegionType(position); c->Message(0,"InWater returns %d", zone->watermap->InWater(position)); - c->Message(0,"InLava returns %d", zone->watermap->InLava(c->GetX(), c->GetY(), z)); + c->Message(0,"InLava returns %d", zone->watermap->InLava(position)); } diff --git a/zone/forage.cpp b/zone/forage.cpp index 34bfdbc12..459fee6a7 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -237,7 +237,7 @@ bool Client::CanFish() { dest.z = m_Position.m_Z+10; rodPosition.m_Z = zone->zonemap->FindBestZ(dest, nullptr) + 4; - bool in_lava = zone->watermap->InLava(rodPosition.m_X, rodPosition.m_Y, rodPosition.m_Z); + bool in_lava = zone->watermap->InLava(rodPosition); bool in_water = zone->watermap->InWater(rodPosition) || zone->watermap->InVWater(rodPosition); //Message(0, "Rod is at %4.3f, %4.3f, %4.3f, InWater says %d, InLava says %d", RodX, RodY, RodZ, in_water, in_lava); if (in_lava) { diff --git a/zone/water_map.h b/zone/water_map.h index d8428a6ef..82de8cc2d 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -28,7 +28,7 @@ public: virtual WaterRegionType ReturnRegionType(const xyz_location& location) const { return RegionTypeNormal; } virtual bool InWater(const xyz_location& location) const { return false; } virtual bool InVWater(const xyz_location& location) const { return false; } - virtual bool InLava(float y, float x, float z) const { return false; } + virtual bool InLava(const xyz_location& location) const { return false; } virtual bool InLiquid(float y, float x, float z) const { return false; } protected: From 6cd614a05e0a81d1cf7df9fb79d7cde171f17935 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:32:46 -0800 Subject: [PATCH 0354/1883] InLiquid converted to xyz_location --- zone/attack.cpp | 197 +++++++++++++++++++++-------------------- zone/client_packet.cpp | 9 +- zone/hate_list.cpp | 18 ++-- zone/mob_ai.cpp | 3 +- zone/pathing.cpp | 8 +- zone/water_map.h | 2 +- 6 files changed, 119 insertions(+), 118 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 51b8bb26a..271a94f53 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -274,21 +274,21 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c } //Avoidance Bonuses on defender decreases baseline hit chance by percent. - avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + - defender->itembonuses.AvoidMeleeChanceEffect + + avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + + defender->itembonuses.AvoidMeleeChanceEffect + defender->aabonuses.AvoidMeleeChanceEffect + (defender->itembonuses.AvoidMeleeChance / 10.0f); //Item Mod 'Avoidence' Mob *owner = nullptr; - if (defender->IsPet()) + if (defender->IsPet()) owner = defender->GetOwner(); else if ((defender->IsNPC() && defender->CastToNPC()->GetSwarmOwner())) owner = entity_list.GetMobID(defender->CastToNPC()->GetSwarmOwner()); - + if (owner) avoidanceBonus += owner->aabonuses.PetAvoidance + owner->spellbonuses.PetAvoidance + owner->itembonuses.PetAvoidance; - if(defender->IsNPC()) + if(defender->IsNPC()) avoidanceBonus += (defender->CastToNPC()->GetAvoidanceRating() / 10.0f); //Modifier from database //Hit Chance Bonuses on attacker increases baseline hit chance by percent. @@ -312,7 +312,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC()) hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database - + if(skillinuse == SkillArchery) hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); @@ -332,7 +332,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c else if(chancetohit < RuleR(Combat,MinChancetoHit)) { chancetohit = RuleR(Combat,MinChancetoHit); } - + //I dont know the best way to handle a garunteed hit discipline being used //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins @@ -568,7 +568,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac armor = (armor / RuleR(Combat, NPCACFactor)); Mob *owner = nullptr; - if (IsPet()) + if (IsPet()) owner = GetOwner(); else if ((CastToNPC()->GetSwarmOwner())) owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner()); @@ -1302,9 +1302,9 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b } else { //we hit, try to avoid it other->AvoidDamage(this, damage); other->MeleeMitigation(this, damage, min_hit, opts); - if(damage > 0) + if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - + mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage); } @@ -1437,7 +1437,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(dead) return false; //cant die more than once... - if(!spell) + if(!spell) spell = SPELL_UNKNOWN; char buffer[48] = { 0 }; @@ -1462,7 +1462,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att #1: Send death packet to everyone */ uint8 killed_level = GetLevel(); - + SendLogoutPackets(); /* Make self become corpse packet */ @@ -1675,8 +1675,8 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(LeftCorpse && (GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover)) { - ClearDraggedCorpses(); - RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000); + ClearDraggedCorpses(); + RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000); SendRespawnBinds(); } else @@ -1693,19 +1693,19 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(r) r->MemberZoned(this); - dead_timer.Start(5000, true); + dead_timer.Start(5000, true); m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zoneInstance = m_pp.binds[0].instance_id; - database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); - Save(); + database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); + Save(); GoToDeath(); } /* QS: PlayerLogDeaths */ if (RuleB(QueryServ, PlayerLogDeaths)){ const char * killer_name = ""; - if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); } - std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); + if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); } + std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); QServ->PlayerLogEvent(Player_Log_Deaths, this->CharacterID(), event_desc); } @@ -1864,7 +1864,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } - + damage = mod_npc_damage(damage, skillinuse, Hand, weapon, other); int32 hate = damage; @@ -1943,7 +1943,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool return false; MeleeLifeTap(damage); - + CommonBreakInvisible(); //I doubt this works... @@ -1952,15 +1952,15 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(!bRiposte && !other->HasDied()) { TryWeaponProc(nullptr, weapon, other, Hand); //no weapon - + if (!other->HasDied()) TrySpellProc(nullptr, weapon, other, Hand); - + if (damage > 0 && HasSkillProcSuccess() && !other->HasDied()) TrySkillProc(other, skillinuse, 0, true, Hand); } - if(GetHP() > 0 && !other->HasDied()) + if(GetHP() > 0 && !other->HasDied()) TriggerDefensiveProcs(nullptr, other, Hand, damage); // now check ripostes @@ -2020,7 +2020,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); - + Mob *oos = nullptr; if(killerMob) { oos = killerMob->GetOwnerOrSelf(); @@ -2075,7 +2075,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if(p_depop == true) return false; - + HasAISpellEffects = false; BuffFadeAll(); uint8 killed_level = GetLevel(); @@ -2248,7 +2248,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0); if(RuleB(NPC, EnableMeritBasedFaction)) - give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), + give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), give_exp_client->GetBaseRace(), give_exp_client->GetDeity()); mod_npc_killed_merit(give_exp_client); @@ -2410,9 +2410,9 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { - + assert(other != nullptr); - + if (other == this) return; @@ -2429,12 +2429,12 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if(other){ AddRampage(other); int hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod; - + int32 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod; if (shieldhatemod && other->HasShieldEquiped()) hatemod += shieldhatemod; - + if(hatemod < 1) hatemod = 1; hate = ((hate * (hatemod))/100); @@ -2451,7 +2451,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0)) TryTriggerOnValueAmount(false, false, false, true); - + if(IsClient() && !IsAIControlled()) return; @@ -2478,8 +2478,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, } } + auto otherPosition = xyz_location(other->GetX(), other->GetY(), other->GetZ()); if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(other->GetX(), other->GetY(), other->GetZ())) { + if(!zone->watermap->InLiquid(otherPosition)) { return; } } @@ -2493,9 +2494,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if(damage > GetHP()) damage = GetHP(); - if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0]) + if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0]) && other && (buffs[spellbonuses.ImprovedTaunt[2]].casterid != other->GetID())) - hate = (hate*spellbonuses.ImprovedTaunt[1])/100; + hate = (hate*spellbonuses.ImprovedTaunt[1])/100; hate_list.Add(other, hate, damage, bFrenzy, !iBuffTic); @@ -3141,7 +3142,7 @@ int32 Mob::ReduceDamage(int32 damage) slot = spellbonuses.NegateAttacks[1]; if(slot >= 0) { if(--buffs[slot].numhits == 0) { - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot , true); } @@ -3156,8 +3157,8 @@ int32 Mob::ReduceDamage(int32 damage) //Only mitigate if damage is above the minimium specified. if (spellbonuses.MeleeThresholdGuard[0]){ slot = spellbonuses.MeleeThresholdGuard[1]; - - if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) + + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) { DisableMeleeRune = true; int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; @@ -3188,7 +3189,7 @@ int32 Mob::ReduceDamage(int32 damage) if (spellbonuses.MitigateMeleeRune[2] && (damage_to_reduce > spellbonuses.MitigateMeleeRune[2])) damage_to_reduce = spellbonuses.MitigateMeleeRune[2]; - + if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" @@ -3201,10 +3202,10 @@ int32 Mob::ReduceDamage(int32 damage) { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); - + if (spellbonuses.MitigateMeleeRune[3]) buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3235,7 +3236,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi slot = spellbonuses.NegateAttacks[1]; if(slot >= 0) { if(--buffs[slot].numhits == 0) { - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot , true); } @@ -3250,7 +3251,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi // If this is a DoT, use DoT Shielding... if(iBuffTic) { damage -= (damage * itembonuses.DoTShielding / 100); - + if (spellbonuses.MitigateDotRune[0]){ slot = spellbonuses.MitigateDotRune[1]; if(slot >= 0) @@ -3270,7 +3271,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi { if (spellbonuses.MitigateDotRune[3]) buffs[slot].dot_rune = (buffs[slot].dot_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3283,12 +3284,12 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi // Reduce damage by the Spell Shielding first so that the runes don't take the raw damage. damage -= (damage * itembonuses.SpellShield / 100); - + //Only mitigate if damage is above the minimium specified. if (spellbonuses.SpellThresholdGuard[0]){ slot = spellbonuses.SpellThresholdGuard[1]; - - if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) + + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) { DisableSpellRune = true; int damage_to_reduce = damage * spellbonuses.SpellThresholdGuard[0] / 100; @@ -3305,8 +3306,8 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } } } - - + + // Do runes now. if (spellbonuses.MitigateSpellRune[0] && !DisableSpellRune){ slot = spellbonuses.MitigateSpellRune[1]; @@ -3329,10 +3330,10 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); - + if (spellbonuses.MitigateSpellRune[3]) buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3340,14 +3341,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(damage < 1) return 0; - + //Regular runes absorb spell damage (except dots) - Confirmed on live. if (spellbonuses.MeleeRune[0] && spellbonuses.MeleeRune[1] >= 0) - damage = RuneAbsorb(damage, SE_Rune); + damage = RuneAbsorb(damage, SE_Rune); if (spellbonuses.AbsorbMagicAtt[0] && spellbonuses.AbsorbMagicAtt[1] >= 0) damage = RuneAbsorb(damage, SE_AbsorbMagicAtt); - + if(damage < 1) return 0; } @@ -3367,7 +3368,7 @@ int32 Mob::ReduceAllDamage(int32 damage) TryTriggerOnValueAmount(false, true); } } - + CheckNumHitsRemaining(NUMHIT_IncomingDamage); return(damage); @@ -3454,7 +3455,7 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { } bool Client::CheckDoubleRangedAttack() { - + int32 chance = spellbonuses.DoubleRangedAttack + itembonuses.DoubleRangedAttack + aabonuses.DoubleRangedAttack; if(chance && (MakeRandomInt(0, 100) < chance)) @@ -3474,7 +3475,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons mlog(COMBAT__DAMAGE, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } - + if( spell_id != SPELL_UNKNOWN || attacker == nullptr ) avoidable = false; @@ -3575,7 +3576,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons attacker->CastToClient()->sneaking = false; attacker->SendAppearancePacket(AT_Sneak, 0); } - + //final damage has been determined. SetHP(GetHP() - damage); @@ -3607,7 +3608,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); - } + } //check stun chances if bashing if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) { @@ -3905,7 +3906,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) } float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand, Mob* on) { - + if (!on) return ProcChance; @@ -3961,7 +3962,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } - + if (!IsAttackAllowed(on)) { mlog(COMBAT__PROCS, "Preventing procing off of unattackable things."); return; @@ -3988,7 +3989,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand) { - + if (!weapon) return; uint16 skillinuse = 28; @@ -4149,7 +4150,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 skillinuse = 28; if (weapon) skillinuse = GetSkillByItemType(weapon->ItemType); - + TrySkillProc(on, skillinuse, 0, false, hand); } @@ -4260,7 +4261,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack //are defined you will have an innate chance to hit at Level 1 regardless of bonuses. //Warning: Do not define these rules if you want live like critical hits. critChance += RuleI(Combat, MeleeBaseCritChance); - + if (IsClient()) { critChance += RuleI(Combat, ClientBaseCritChance); @@ -4313,7 +4314,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack uint32 critMod = 200; bool crip_success = false; int32 CripplingBlowChance = GetCrippBlowChance(); - + //Crippling Blow Chance: The percent value of the effect is applied //to the your Chance to Critical. (ie You have 10% chance to critical and you //have a 200% Chance to Critical Blow effect, therefore you have a 20% Chance to Critical Blow. @@ -4367,7 +4368,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){ uint32 FB_Dmg = aabonuses.FinishingBlow[1] + spellbonuses.FinishingBlow[1] + itembonuses.FinishingBlow[1]; - + uint32 FB_Level = 0; FB_Level = aabonuses.FinishingBlowLvl[0]; if (FB_Level < spellbonuses.FinishingBlowLvl[0]) @@ -4510,8 +4511,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!spellbonuses.LimitToSkill[skill] && !itembonuses.LimitToSkill[skill] && !aabonuses.LimitToSkill[skill]) return; - /*Allow one proc from each (Spell/Item/AA) - Kayen: Due to limited avialability of effects on live it is too difficult + /*Allow one proc from each (Spell/Item/AA) + Kayen: Due to limited avialability of effects on live it is too difficult to confirm how they stack at this time, will adjust formula when more data is avialablle to test.*/ bool CanProc = true; @@ -4519,7 +4520,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui uint16 proc_spell_id = 0; float ProcMod = 0; float chance = 0; - + if (IsDefensive) chance = on->GetSkillProcChances(ReuseTime, hand); else @@ -4528,16 +4529,16 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (spellbonuses.LimitToSkill[skill]){ for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && - (!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) + + if (CanProc && + (!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e]))) { base_spell_id = spellbonuses.SkillProc[e]; base_spell_id = 0; ProcMod = 0; - + for (int i = 0; i < EFFECT_COUNT; i++) { - + if (spells[base_spell_id].effectid[i] == SE_SkillProc) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); @@ -4567,16 +4568,16 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (itembonuses.LimitToSkill[skill]){ CanProc = true; for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && - (!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) + + if (CanProc && + (!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e]))) { base_spell_id = itembonuses.SkillProc[e]; base_spell_id = 0; ProcMod = 0; for (int i = 0; i < EFFECT_COUNT; i++) { - + if (spells[base_spell_id].effectid[i] == SE_SkillProc) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); @@ -4607,12 +4608,12 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui CanProc = true; uint32 effect = 0; int32 base1 = 0; - int32 base2 = 0; + int32 base2 = 0; uint32 slot = 0; for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && + + if (CanProc && (!Success && aabonuses.SkillProc[e]) || (Success && aabonuses.SkillProcSuccess[e])){ int aaid = aabonuses.SkillProc[e]; @@ -4660,44 +4661,44 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) { uint32 weapon_speed; float ProcChance = 0; - + if (!ReuseTime && hand) { weapon_speed = GetWeaponSpeedbyHand(hand); ProcChance = static_cast(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); - + if (hand != MainPrimary) ProcChance /= 2; } - else + else ProcChance = static_cast(ReuseTime) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); return ProcChance; } bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { - + /*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443 The Viscid Roots AA does the following: Reduces the chance for root to break by X percent. There is no distinction of any kind between the caster inflicted damage, or anyone else's damage. There is also no distinction between Direct and DOT damage in the root code. - + /* General Mechanics - Check buffslot to make sure damage from a root does not cancel the root - - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. + - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. - Only roots on determental spells can be broken by damage. - Root break chance values obtained from live parses. */ - + if (!attacker || !spellbonuses.Root[0] || spellbonuses.Root[1] < 0) return false; - + if (IsDetrimentalSpell(spellbonuses.Root[1]) && spellbonuses.Root[1] != buffslot){ - + int BreakChance = RuleI(Spells, RootBreakFromSpells); - + BreakChance -= BreakChance*buffs[spellbonuses.Root[1]].RootBreakChance/100; int level_diff = attacker->GetLevel() - GetLevel(); @@ -4705,13 +4706,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (level_diff == 2) BreakChance = (BreakChance * 80) /100; //Decrease by 20%; - + else if (level_diff >= 3 && level_diff <= 20) BreakChance = (BreakChance * 60) /100; //Decrease by 40%; else if (level_diff > 21) BreakChance = (BreakChance * 20) /100; //Decrease by 80%; - + if (BreakChance < 1) BreakChance = 1; @@ -4736,7 +4737,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.MeleeRune[1] && spellbonuses.MeleeRune[0] && buffs[slot].melee_rune && IsValidSpell(buffs[slot].spellid)){ int melee_rune_left = buffs[slot].melee_rune; - + if(melee_rune_left > damage) { melee_rune_left -= damage; @@ -4748,7 +4749,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) { if(melee_rune_left > 0) damage -= melee_rune_left; - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot); } @@ -4756,7 +4757,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) } } - + else{ for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.AbsorbMagicAtt[1] && spellbonuses.AbsorbMagicAtt[0] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)){ @@ -4772,7 +4773,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) { if(magic_rune_left > 0) damage -= magic_rune_left; - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot); } @@ -4785,7 +4786,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse) { - if (!defender) + if (!defender) return; ApplyMeleeDamageBonus(skillInUse, damage); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9f7d533b2..70b33dd1b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4595,13 +4595,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) safe_delete(outapp); } - if(zone->watermap) - { - if(zone->watermap->InLiquid(m_Position.m_X, m_Position.m_Y, m_Position.m_Z)) - { - CheckIncreaseSkill(SkillSwimming, nullptr, -17); - } - } + if(zone->watermap && zone->watermap->InLiquid(m_Position)) + CheckIncreaseSkill(SkillSwimming, nullptr, -17); return; } diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 4c4290232..5b028f0df 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -199,7 +199,7 @@ void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAd parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); if (ent->IsClient()) { - if (owner->CastToNPC()->IsRaidTarget()) + if (owner->CastToNPC()->IsRaidTarget()) ent->CastToClient()->SetEngagedRaidTarget(true); ent->CastToClient()->IncrementAggroCount(); } @@ -222,7 +222,7 @@ bool HateList::RemoveEnt(Mob *ent) parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); found = true; - + if(ent && ent->IsClient()) ent->CastToClient()->DecrementAggroCount(); @@ -263,11 +263,11 @@ int HateList::SummonedPetCount(Mob *hater) { auto iterator = list.begin(); while(iterator != list.end()) { - if((*iterator)->ent != nullptr && (*iterator)->ent->IsNPC() && ((*iterator)->ent->CastToNPC()->IsPet() || ((*iterator)->ent->CastToNPC()->GetSwarmOwner() > 0))) + if((*iterator)->ent != nullptr && (*iterator)->ent->IsNPC() && ((*iterator)->ent->CastToNPC()->IsPet() || ((*iterator)->ent->CastToNPC()->GetSwarmOwner() > 0))) { ++petcount; } - + ++iterator; } @@ -303,15 +303,16 @@ Mob *HateList::GetTop(Mob *center) continue; } + auto hateEntryPosition = xyz_location(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ()); if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + if(!zone->watermap->InLiquid(hateEntryPosition)) { skipped_count++; ++iterator; continue; } } - if (cur->ent->Sanctuary()) { + if (cur->ent->Sanctuary()) { if(hate == -1) { top = cur->ent; @@ -428,8 +429,9 @@ Mob *HateList::GetTop(Mob *center) while(iterator != list.end()) { tHateEntry *cur = (*iterator); + auto hateEntryPosition = xyz_location(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ()); if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + if(!zone->watermap->InLiquid(hateEntryPosition)) { skipped_count++; ++iterator; continue; @@ -488,7 +490,7 @@ Mob *HateList::GetRandom() int random = MakeRandomInt(0, count - 1); for (int i = 0; i < random; i++) ++iterator; - + return (*iterator)->ent; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e2fa84560..b727d20b2 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1372,7 +1372,8 @@ void Mob::AI_Process() { //we cannot reach our target... //underwater stuff only works with water maps in the zone! if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { + auto targetPosition = xyz_location(target->GetX(), target->GetY(), target->GetZ()); + if(!zone->watermap->InLiquid(targetPosition)) { Mob *tar = hate_list.GetTop(this); if(tar == target) { WipeHateList(); diff --git a/zone/pathing.cpp b/zone/pathing.cpp index c860913fe..7bd44c757 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -1197,12 +1197,14 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) if (zone->watermap) { - if (zone->watermap->InLiquid(From.x, From.y, From.z) || zone->watermap->InLiquid(To.x, To.y, To.z)) + auto from = xyz_location(From.x, From.y, From.z); + auto to = xyz_location(To.x, To.y, To.z); + if (zone->watermap->InLiquid(from) || zone->watermap->InLiquid(to)) { break; } - - if (zone->watermap->InLiquid(TestPoint.x, TestPoint.y, NewZ)) + auto testPointNewZ = xyz_location(TestPoint.x, TestPoint.y, NewZ); + if (zone->watermap->InLiquid(testPointNewZ)) { Map::Vertex TestPointWater(TestPoint.x, TestPoint.y, NewZ - 0.5f); Map::Vertex TestPointWaterDest = TestPointWater; diff --git a/zone/water_map.h b/zone/water_map.h index 82de8cc2d..dd07fca5f 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -29,7 +29,7 @@ public: virtual bool InWater(const xyz_location& location) const { return false; } virtual bool InVWater(const xyz_location& location) const { return false; } virtual bool InLava(const xyz_location& location) const { return false; } - virtual bool InLiquid(float y, float x, float z) const { return false; } + virtual bool InLiquid(const xyz_location& location) const { return false; } protected: virtual bool Load(FILE *fp) { return false; } From ef1845848045a2ecdd07e06fb97ab8447e451c5d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:36:47 -0800 Subject: [PATCH 0355/1883] ReturnRegionType converted to xyz_location --- zone/water_map_v2.cpp | 14 ++++++++------ zone/water_map_v2.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/zone/water_map_v2.cpp b/zone/water_map_v2.cpp index b08c9ca89..7c9f3bce3 100644 --- a/zone/water_map_v2.cpp +++ b/zone/water_map_v2.cpp @@ -6,11 +6,11 @@ WaterMapV2::WaterMapV2() { WaterMapV2::~WaterMapV2() { } -WaterRegionType WaterMapV2::ReturnRegionType(float y, float x, float z) const { +WaterRegionType WaterMapV2::ReturnRegionType(const xyz_location& location) const { size_t sz = regions.size(); for(size_t i = 0; i < sz; ++i) { auto const ®ion = regions[i]; - if (region.second.ContainsPoint(glm::vec3(x, y, z))) { + if (region.second.ContainsPoint(glm::vec3(location.m_X, location.m_Y, location.m_Z))) { return region.first; } } @@ -18,19 +18,21 @@ WaterRegionType WaterMapV2::ReturnRegionType(float y, float x, float z) const { } bool WaterMapV2::InWater(const xyz_location& location) const { - return ReturnRegionType(location.m_Y, location.m_X, location.m_Z) == RegionTypeWater; + return ReturnRegionType(location) == RegionTypeWater; } bool WaterMapV2::InVWater(float y, float x, float z) const { - return ReturnRegionType(y, x, z) == RegionTypeVWater; + auto location = xyz_location(x, y, z); + return ReturnRegionType(location) == RegionTypeVWater; } bool WaterMapV2::InLava(float y, float x, float z) const { - return ReturnRegionType(y, x, z) == RegionTypeLava; + auto location = xyz_location(x, y, z); + return ReturnRegionType(location) == RegionTypeLava; } bool WaterMapV2::InLiquid(float y, float x, float z) const { - auto location = xyz_location(y, x, z); + auto location = xyz_location(x, y, z); return InWater(location) || InLava(y, x, z); } diff --git a/zone/water_map_v2.h b/zone/water_map_v2.h index eef514af5..fea136957 100644 --- a/zone/water_map_v2.h +++ b/zone/water_map_v2.h @@ -12,7 +12,7 @@ public: WaterMapV2(); ~WaterMapV2(); - virtual WaterRegionType ReturnRegionType(float y, float x, float z) const; + virtual WaterRegionType ReturnRegionType(const xyz_location& location) const; virtual bool InWater(const xyz_location& location) const; virtual bool InVWater(float y, float x, float z) const; virtual bool InLava(float y, float x, float z) const; From 5140e6fabf82c3ad114a6239656fd292cba4f0ab Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:37:32 -0800 Subject: [PATCH 0356/1883] InVWater converted to xyz_location --- zone/water_map_v2.cpp | 3 +-- zone/water_map_v2.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/zone/water_map_v2.cpp b/zone/water_map_v2.cpp index 7c9f3bce3..2ba0a7d35 100644 --- a/zone/water_map_v2.cpp +++ b/zone/water_map_v2.cpp @@ -21,8 +21,7 @@ bool WaterMapV2::InWater(const xyz_location& location) const { return ReturnRegionType(location) == RegionTypeWater; } -bool WaterMapV2::InVWater(float y, float x, float z) const { - auto location = xyz_location(x, y, z); +bool WaterMapV2::InVWater(const xyz_location& location) const { return ReturnRegionType(location) == RegionTypeVWater; } diff --git a/zone/water_map_v2.h b/zone/water_map_v2.h index fea136957..5c4ba9e80 100644 --- a/zone/water_map_v2.h +++ b/zone/water_map_v2.h @@ -14,7 +14,7 @@ public: virtual WaterRegionType ReturnRegionType(const xyz_location& location) const; virtual bool InWater(const xyz_location& location) const; - virtual bool InVWater(float y, float x, float z) const; + virtual bool InVWater(const xyz_location& location) const; virtual bool InLava(float y, float x, float z) const; virtual bool InLiquid(float y, float x, float z) const; From 2f203fa6bb3cf8fd48c72d5abc86d60bc1271213 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:38:53 -0800 Subject: [PATCH 0357/1883] InLava converted to xyz_location --- zone/water_map_v2.cpp | 5 ++--- zone/water_map_v2.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/zone/water_map_v2.cpp b/zone/water_map_v2.cpp index 2ba0a7d35..6f5977d79 100644 --- a/zone/water_map_v2.cpp +++ b/zone/water_map_v2.cpp @@ -25,14 +25,13 @@ bool WaterMapV2::InVWater(const xyz_location& location) const { return ReturnRegionType(location) == RegionTypeVWater; } -bool WaterMapV2::InLava(float y, float x, float z) const { - auto location = xyz_location(x, y, z); +bool WaterMapV2::InLava(const xyz_location& location) const { return ReturnRegionType(location) == RegionTypeLava; } bool WaterMapV2::InLiquid(float y, float x, float z) const { auto location = xyz_location(x, y, z); - return InWater(location) || InLava(y, x, z); + return InWater(location) || InLava(location); } bool WaterMapV2::Load(FILE *fp) { diff --git a/zone/water_map_v2.h b/zone/water_map_v2.h index 5c4ba9e80..02e549cc7 100644 --- a/zone/water_map_v2.h +++ b/zone/water_map_v2.h @@ -15,7 +15,7 @@ public: virtual WaterRegionType ReturnRegionType(const xyz_location& location) const; virtual bool InWater(const xyz_location& location) const; virtual bool InVWater(const xyz_location& location) const; - virtual bool InLava(float y, float x, float z) const; + virtual bool InLava(const xyz_location& location) const; virtual bool InLiquid(float y, float x, float z) const; protected: From 4094d43c49acca8c651cf8ecdd71f4afb24438b4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 19:39:39 -0800 Subject: [PATCH 0358/1883] InLiquid converted to xyz_location --- zone/water_map_v2.cpp | 3 +-- zone/water_map_v2.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/zone/water_map_v2.cpp b/zone/water_map_v2.cpp index 6f5977d79..9a8eb9564 100644 --- a/zone/water_map_v2.cpp +++ b/zone/water_map_v2.cpp @@ -29,8 +29,7 @@ bool WaterMapV2::InLava(const xyz_location& location) const { return ReturnRegionType(location) == RegionTypeLava; } -bool WaterMapV2::InLiquid(float y, float x, float z) const { - auto location = xyz_location(x, y, z); +bool WaterMapV2::InLiquid(const xyz_location& location) const { return InWater(location) || InLava(location); } diff --git a/zone/water_map_v2.h b/zone/water_map_v2.h index 02e549cc7..a0adccc48 100644 --- a/zone/water_map_v2.h +++ b/zone/water_map_v2.h @@ -16,7 +16,7 @@ public: virtual bool InWater(const xyz_location& location) const; virtual bool InVWater(const xyz_location& location) const; virtual bool InLava(const xyz_location& location) const; - virtual bool InLiquid(float y, float x, float z) const; + virtual bool InLiquid(const xyz_location& location) const; protected: virtual bool Load(FILE *fp); From 5b783e84e9993023893a23b1250f54f0d4bb266f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 21:25:09 -0800 Subject: [PATCH 0359/1883] added automatic conversion of Map::Vertex into xyz_location --- zone/map.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zone/map.h b/zone/map.h index 224e30c73..64a289a41 100644 --- a/zone/map.h +++ b/zone/map.h @@ -22,6 +22,7 @@ #ifndef ZONE_MAP_H #define ZONE_MAP_H +#include "position.h" #include #include @@ -36,10 +37,14 @@ public: Vertex() : x(0.0f), y(0.0f), z(0.0f) { } Vertex(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { } ~Vertex() { } - bool operator==(const Vertex &v) const + bool operator==(const Vertex &v) const { return((v.x == x) && (v.y == y) && (v.z == z)); } + operator xyz_location() const + { + return xyz_location(x,y,z); + } float x; float y; @@ -49,7 +54,7 @@ public: Map(); ~Map(); - + float FindBestZ(Vertex &start, Vertex *result) const; bool LineIntersectsZone(Vertex start, Vertex end, float step, Vertex *result) const; bool LineIntersectsZoneNoZLeaps(Vertex start, Vertex end, float step_mag, Vertex *result) const; @@ -62,7 +67,7 @@ private: void TranslateVertex(Vertex &v, float tx, float ty, float tz); bool LoadV1(FILE *f); bool LoadV2(FILE *f); - + struct impl; impl *imp; }; From 98c21635c20fffb4b1035439acab55480a6fba26 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 26 Nov 2014 23:45:08 -0600 Subject: [PATCH 0360/1883] db_update.pl self update routine Some linux adjustments --- utils/scripts/db_update.pl | 46 +++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index d592bebc3..bf92ce60f 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -6,6 +6,21 @@ #::: Purpose: To upgrade databases with ease and maintain versioning ########################################################### + +#::: If current version is less than what world is reporting, then download a new one... +$current_version = 1; +if($ARGV[0] eq "V"){ + if($ARGV[1] > $current_version){ + print "Retrieving latest database manifest...\n"; + GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl", "db_update.pl"); + exit; + } + else{ + print "No update necessary \n"; + } + exit; +} + $perl_version = $^V; $perl_version =~s/v//g; print "Perl Version is " . $perl_version . "\n"; @@ -26,14 +41,14 @@ while() { elsif(/(.*)<\/db>/i) { $db = $1; } } -print +$console_output = "============================================================ EQEmu: Automatic Database Upgrade Check ============================================================ "; use Config; -print " Operating System is: $Config{osname}\n"; +$console_output .= " Operating System is: $Config{osname}\n"; if($Config{osname}=~/linux/i){ $OS = "Linux"; } if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } @@ -48,9 +63,9 @@ if($OS eq "Windows"){ last; } } - print " (Windows) MySQL is in system path \n"; - print " Path = " . $path . "\n"; - print "============================================================\n"; + $console_output .= " (Windows) MySQL is in system path \n"; + $console_output .= " Path = " . $path . "\n"; + $console_output .= "============================================================\n"; } } @@ -62,9 +77,9 @@ if($OS eq "Linux"){ } $path =~s/\n//g; - print " (Linux) MySQL is in system path \n"; - print " Path = " . $path . "\n"; - print "============================================================\n"; + $console_output .= " (Linux) MySQL is in system path \n"; + $console_output .= " Path = " . $path . "\n"; + $console_output .= "============================================================\n"; } #::: Path not found, error and exit @@ -93,10 +108,21 @@ if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){ } if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); } -if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); } +if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); } $bin_db_ver = trim($db_version[1]); $local_db_ver = trim(GetMySQLResult("SELECT version FROM db_version LIMIT 1")); + +#::: If ran from Linux startup script, supress output +if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_start"){ + print "Database up to date...\n"; + exit; +} +else{ + print $console_output; +} + + print " Binary Database Version: (" . $bin_db_ver . ")\n"; print " Local Database Version: (" . $local_db_ver . ")\n\n"; @@ -135,7 +161,7 @@ sub ShowMenuPrompt { while (1) { { local $| = 1; - if(!$menu_show && $ARGV[0] eq "ran_from_world"){ + if(!$menu_show && ($ARGV[0] eq "ran_from_world" || $ARGV[0] eq "ran_from_start")){ $menu_show++; next; } From 12ea532a7ad89f00bd6e53b03a4b2e7423150785 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 26 Nov 2014 23:50:08 -0600 Subject: [PATCH 0361/1883] Renamed db_update.pl to db_updater.pl --- utils/scripts/{db_update.pl => db_updater.pl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename utils/scripts/{db_update.pl => db_updater.pl} (100%) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_updater.pl similarity index 100% rename from utils/scripts/db_update.pl rename to utils/scripts/db_updater.pl From 521106e286901817d78a7e5f2ecb518554281e4c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 27 Nov 2014 00:01:26 -0600 Subject: [PATCH 0362/1883] Renamed back the db_update.pl file --- utils/scripts/{db_updater.pl => db_update.pl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename utils/scripts/{db_updater.pl => db_update.pl} (100%) diff --git a/utils/scripts/db_updater.pl b/utils/scripts/db_update.pl similarity index 100% rename from utils/scripts/db_updater.pl rename to utils/scripts/db_update.pl From f0881d4aa98c8db15eb407c1acc19c68f16421d3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 27 Nov 2014 00:03:49 -0600 Subject: [PATCH 0363/1883] Self patching db_update script for when new versions come out --- common/database.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/database.cpp b/common/database.cpp index 82931e457..ecf83dc57 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -910,6 +910,19 @@ bool Database::CheckDatabaseConversions() { #endif } + /* + Automatic Database Upgrade Script + Script: db_updater.pl V 1 - the number that world passes to the script will + force the script to check for a newer version to update itself with + db_updater.pl ran_from_world - won't bring up a menu if your database versions match + db_updater.pl - ran standalone will bring up a menu prompt + */ + + /* Check for a new version of this script, the arg passed + would have to be higher than the copy they have downloaded + locally and they will re fetch */ + system("perl db_update.pl V 1"); + /* Run Automatic Database Upgrade Script */ system("perl db_update.pl ran_from_world"); From 4e3842b9d80a29b98678569fb1d7600e7c12ca1d Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Thu, 27 Nov 2014 13:05:50 -0800 Subject: [PATCH 0364/1883] Detransformation of mold type ornamentations. --- zone/string_ids.h | 1 + zone/tradeskills.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/zone/string_ids.h b/zone/string_ids.h index 044dd215f..e1e1bc7b3 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -298,6 +298,7 @@ #define GUILD_BANK_EMPTY_HANDS 6108 // You must empty your hands to withdraw from the Guild Bank. #define TRANSFORM_FAILED 6326 //This mold cannot be applied to your %1. #define TRANSFORM_COMPLETE 6327 //You have successfully transformed your %1. +#define DETRANSFORM_FAILED 6341 //%1 has no transformation that can be removed. #define GENERIC_STRING 6688 //%1 (used to any basic message) #define SENTINEL_TRIG_YOU 6724 //You have triggered your sentinel. #define SENTINEL_TRIG_OTHER 6725 //%1 has triggered your sentinel. diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index e9de6c4a6..da5114ed2 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -304,6 +304,24 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } + if (container->GetItem()->BagType == BagTypeDetransformationmold) { + const ItemInst* inst = container->GetItem(0); + if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { + const Item_Struct* new_weapon = inst->GetItem(); + user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); + container->Clear(); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->IsInstNoDrop(), MainCursor, 0, 0); + user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); + } + else if (inst) { + user->Message_StringID(4, DETRANSFORM_FAILED, inst->GetItem()->Name); + } + EQApplicationPacket* outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); + user->QueuePacket(outapp); + safe_delete(outapp); + return; + } + DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) { user->Message_StringID(MT_Emote,TRADESKILL_NOCOMBINE); From 191aa575f853a2db6afd8160745e499324939726 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 27 Nov 2014 22:12:13 -0500 Subject: [PATCH 0365/1883] Projectiles (ie Arrows) fired from an archery attacks will do damage upon actually hitting the target, instead of instantly when fired. Consistent with live. Optional SQL added to disable this. Throwing will be implemented in a future update. --- changelog.txt | 5 + common/ruletypes.h | 1 + .../2014_11_27_ProjectileDmgOnImpact.sql | 1 + zone/client_process.cpp | 2 + zone/common.h | 14 + zone/mob.cpp | 15 + zone/mob.h | 9 +- zone/special_attacks.cpp | 402 ++++++++++++------ 8 files changed, 323 insertions(+), 126 deletions(-) create mode 100644 utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql diff --git a/changelog.txt b/changelog.txt index b05fc26ee..c05951538 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- + +== 11/27/2014 == +Kayen: Projectiles (ie Arrows) fired from archery will now do damage upon impact instead of instantly (consistent w/ live). +Optional SQL: utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql + == 11/24/2014 == Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size. Trevius: Fix to prevent Mercenaries from being set as Group Leader. diff --git a/common/ruletypes.h b/common/ruletypes.h index b3e9b4f1c..8ff077809 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -419,6 +419,7 @@ RULE_INT ( Combat, ArcheryBonusChance, 50) RULE_INT ( Combat, BerserkerFrenzyStart, 35) RULE_INT ( Combat, BerserkerFrenzyEnd, 45) RULE_BOOL ( Combat, OneProcPerWeapon, true) //If enabled, One proc per weapon per round +RULE_BOOL ( Combat, ProjectileDmgOnImpact, true) //If enabled, projectiles (ie arrows) will hit on impact, instead of instantly. RULE_CATEGORY_END() RULE_CATEGORY( NPC ) diff --git a/utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql b/utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql new file mode 100644 index 000000000..ce7e16905 --- /dev/null +++ b/utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Combat:ProjectileDmgOnImpact', 'true', 'If enabled, projectiles (ie arrows) will hit on impact, instead of instantly.'); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c07a73aea..40b7420d3 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -579,6 +579,8 @@ bool Client::Process() { viral_timer_counter = 0; } + ProjectileAttack(); + if(projectile_timer.Check()) SpellProjectileEffect(); diff --git a/zone/common.h b/zone/common.h index ea299ab11..d1aad5e40 100644 --- a/zone/common.h +++ b/zone/common.h @@ -459,6 +459,20 @@ struct Shielders_Struct { uint16 shielder_bonus; }; +typedef struct +{ + uint16 increment; + uint16 hit_increment; + uint16 target_id; + int32 wpn_dmg; + float origin_x; + float origin_y; + float origin_z; + uint32 ranged_id; + uint32 ammo_id; + uint8 skill; +} tProjatk; + //eventually turn this into a typedef and //make DoAnim take it instead of int, to enforce its use. enum { //type arguments to DoAnim diff --git a/zone/mob.cpp b/zone/mob.cpp index 35a019252..3b74d2417 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -287,6 +287,21 @@ Mob::Mob(const char* in_name, for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_z[i] = 0; } projectile_timer.Disable(); + ActiveProjectileATK = false; + for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) + { + ProjectileAtk[i].increment = 0; + ProjectileAtk[i].hit_increment = 0; + ProjectileAtk[i].target_id = 0; + ProjectileAtk[i].wpn_dmg = 0; + ProjectileAtk[i].origin_x = 0.0f; + ProjectileAtk[i].origin_y = 0.0f; + ProjectileAtk[i].origin_z = 0.0f; + ProjectileAtk[i].ranged_id = 0; + ProjectileAtk[i].ammo_id = 0; + ProjectileAtk[i].skill = 0; + } + memset(&itembonuses, 0, sizeof(StatBonuses)); memset(&spellbonuses, 0, sizeof(StatBonuses)); memset(&aabonuses, 0, sizeof(StatBonuses)); diff --git a/zone/mob.h b/zone/mob.h index 525cbb2e8..df694aae9 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -724,7 +724,11 @@ public: virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false, bool CanAvoid=true); virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); - virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0); + virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr); + bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo); + void ProjectileAttack(); + inline bool HasProjectileAttack() const { return ActiveProjectileATK; } + inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } bool CanDoSpecialAttack(Mob *other); bool Flurry(ExtraAttackOptions *opts); bool Rampage(ExtraAttackOptions *opts); @@ -1096,6 +1100,9 @@ protected: uint8 projectile_increment[MAX_SPELL_PROJECTILE]; float projectile_x[MAX_SPELL_PROJECTILE], projectile_y[MAX_SPELL_PROJECTILE], projectile_z[MAX_SPELL_PROJECTILE]; + bool ActiveProjectileATK; + tProjatk ProjectileAtk[MAX_SPELL_PROJECTILE]; + float rewind_x; float rewind_y; float rewind_z; diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 3625c9180..879515d20 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -789,8 +789,8 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { return; } - SendItemAnimation(GetTarget(), AmmoItem, SkillArchery); - DoArcheryAttackDmg(GetTarget(), RangeWeapon, Ammo); + //Shoots projectile and/or applies the archery damage + DoArcheryAttackDmg(GetTarget(), RangeWeapon, Ammo,0,0,0,0,0,0, AmmoItem); //EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow. int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile; @@ -806,147 +806,206 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { CommonBreakInvisible(); } -void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime) { - if (!CanDoSpecialAttack(other)) +void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, + uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem) { + + if ((other == nullptr || + ((IsClient() && CastToClient()->dead) || + (other->IsClient() && other->CastToClient()->dead)) || + HasDied() || + (!IsAttackAllowed(other)) || + (other->GetInvul() || + other->GetSpecialAbility(IMMUNE_MELEE)))) + { return; + } - if (!other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) { + const ItemInst* _RangeWeapon = nullptr; + const ItemInst* _Ammo = nullptr; + const Item_Struct* ammo_lost = nullptr; + + /* + If LaunchProjectile is false this function will do archery damage on target, + otherwise it will shoot the projectile at the target, once the projectile hits target + this function is then run again to do the damage portion + */ + bool LaunchProjectile = false; + bool ProjectileMiss = false; + + if (RuleB(Combat, ProjectileDmgOnImpact)){ + + if (AmmoItem) + LaunchProjectile = true; + else{ + /* + Item sync check on projectile landing. + Weapon damage is already calculated so this only affects procs! + Ammo proc check will use database to find proc if you used up your last ammo. + If you change range item mid projectile flight, you loose your chance to proc from bow (Deal with it!). + */ + + if (!RangeWeapon && !Ammo && range_id && ammo_id){ + + if (weapon_damage == 0) + ProjectileMiss = true; //This indicates that MISS was originally calculated. + + if (IsClient()){ + + _RangeWeapon = CastToClient()->m_inv[MainRange]; + if (!_RangeWeapon || _RangeWeapon->GetItem()->ID != range_id) + RangeWeapon = nullptr; + else + RangeWeapon = _RangeWeapon; + + _Ammo = CastToClient()->m_inv[MainAmmo]; + if (!_Ammo || _Ammo->GetItem()->ID != ammo_id) + ammo_lost = database.GetItem(ammo_id); + else + Ammo = _Ammo; + } + } + } + } + else if (AmmoItem) + SendItemAnimation(other, AmmoItem, SkillArchery); + + if (ProjectileMiss || !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) { mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); - other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); + + if (LaunchProjectile){ + TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo); + return; + } + else + other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { mlog(COMBAT__RANGED, "Ranged attack hit %s.", other->GetName()); + bool HeadShot = false; + uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); + if (HeadShot_Dmg) + HeadShot = true; - bool HeadShot = false; - uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); - if (HeadShot_Dmg) - HeadShot = true; + int32 hate = 0; + int32 TotalDmg = 0; + int16 WDmg = 0; + int16 ADmg = 0; + if (!weapon_damage){ + WDmg = GetWeaponDamage(other, RangeWeapon); + ADmg = GetWeaponDamage(other, Ammo); + } + else + WDmg = weapon_damage; - int32 TotalDmg = 0; - int16 WDmg = 0; - int16 ADmg = 0; - if (!weapon_damage){ - WDmg = GetWeaponDamage(other, RangeWeapon); - ADmg = GetWeaponDamage(other, Ammo); - } - else - WDmg = weapon_damage; + if (LaunchProjectile){//1: Shoot the Projectile once we calculate weapon damage. + TryProjectileAttack(other, AmmoItem, SkillArchery, WDmg, RangeWeapon, Ammo); + return; + } - if (focus) //From FcBaseEffects - WDmg += WDmg*focus/100; + if (focus) //From FcBaseEffects + WDmg += WDmg*focus/100; - if((WDmg > 0) || (ADmg > 0)) { - if(WDmg < 0) - WDmg = 0; - if(ADmg < 0) - ADmg = 0; - uint32 MaxDmg = (RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg+ADmg)*GetDamageTable(SkillArchery)) / 100; - int32 hate = ((WDmg+ADmg)); - - if (HeadShot) - MaxDmg = HeadShot_Dmg; - - uint16 bonusArcheryDamageModifier = aabonuses.ArcheryDamageModifier + itembonuses.ArcheryDamageModifier + spellbonuses.ArcheryDamageModifier; - - MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - - mlog(COMBAT__RANGED, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); - - bool dobonus = false; - if(GetClass() == RANGER && GetLevel() > 50) - { - int bonuschance = RuleI(Combat, ArcheryBonusChance); - - bonuschance = mod_archery_bonus_chance(bonuschance, RangeWeapon); - - if( !RuleB(Combat, UseArcheryBonusRoll) || (MakeRandomInt(1, 100) < bonuschance) ) - { - if(RuleB(Combat, ArcheryBonusRequiresStationary)) - { - if(other->IsNPC() && !other->IsMoving() && !other->IsRooted()) - { - dobonus = true; - } - } - else - { - dobonus = true; - } - } - - if(dobonus) - { - MaxDmg *= 2; - hate *= 2; - MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - - mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); - Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); - } - } - - if (MaxDmg == 0) - MaxDmg = 1; - - if(RuleB(Combat, UseIntervalAC)) - TotalDmg = MaxDmg; - else - TotalDmg = MakeRandomInt(1, MaxDmg); - - int minDmg = 1; - if(GetLevel() > 25){ - //twice, for ammo and weapon - TotalDmg += (2*((GetLevel()-25)/3)); - minDmg += (2*((GetLevel()-25)/3)); - minDmg += minDmg * GetMeleeMinDamageMod_SE(SkillArchery) / 100; - hate += (2*((GetLevel()-25)/3)); - } - - if (!HeadShot) - other->AvoidDamage(this, TotalDmg, false); - - other->MeleeMitigation(this, TotalDmg, minDmg); - if(TotalDmg > 0) - { - ApplyMeleeDamageBonus(SkillArchery, TotalDmg); - TotalDmg += other->GetFcDamageAmtIncoming(this, 0, true, SkillArchery); - TotalDmg += (itembonuses.HeroicDEX / 10) + (TotalDmg * other->GetSkillDmgTaken(SkillArchery) / 100) + GetSkillDmgAmt(SkillArchery); - - TotalDmg = mod_archery_damage(TotalDmg, dobonus, RangeWeapon); - - TryCriticalHit(other, SkillArchery, TotalDmg); - other->AddToHateList(this, hate, 0, false); - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); - } - } - else - TotalDmg = -5; + if((WDmg > 0) || (ADmg > 0)) { + if(WDmg < 0) + WDmg = 0; + if(ADmg < 0) + ADmg = 0; + uint32 MaxDmg = (RuleR(Combat, ArcheryBaseDamageBonus)*(WDmg+ADmg)*GetDamageTable(SkillArchery)) / 100; + hate = ((WDmg+ADmg)); if (HeadShot) - entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FATAL_BOW_SHOT, GetName()); - - other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillArchery); - - if (TotalDmg > 0 && HasSkillProcSuccess() && GetTarget() && other && !other->HasDied()){ - if (ReuseTime) - TrySkillProc(other, SkillArchery, ReuseTime); - else - TrySkillProc(other, SkillArchery, 0, true, MainRange); + MaxDmg = HeadShot_Dmg; + + uint16 bonusArcheryDamageModifier = aabonuses.ArcheryDamageModifier + itembonuses.ArcheryDamageModifier + spellbonuses.ArcheryDamageModifier; + + MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; + + mlog(COMBAT__RANGED, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + + bool dobonus = false; + if(GetClass() == RANGER && GetLevel() > 50){ + + int bonuschance = RuleI(Combat, ArcheryBonusChance); + bonuschance = mod_archery_bonus_chance(bonuschance, RangeWeapon); + + if( !RuleB(Combat, UseArcheryBonusRoll) || (MakeRandomInt(1, 100) < bonuschance)){ + if(RuleB(Combat, ArcheryBonusRequiresStationary)){ + if(other->IsNPC() && !other->IsMoving() && !other->IsRooted()) + dobonus = true; + } + else + dobonus = true; + } + + if(dobonus){ + MaxDmg *= 2; + hate *= 2; + MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); + + mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); + } } + + if (MaxDmg == 0) + MaxDmg = 1; + + if(RuleB(Combat, UseIntervalAC)) + TotalDmg = MaxDmg; + else + TotalDmg = MakeRandomInt(1, MaxDmg); + + int minDmg = 1; + if(GetLevel() > 25){ + //twice, for ammo and weapon + TotalDmg += (2*((GetLevel()-25)/3)); + minDmg += (2*((GetLevel()-25)/3)); + minDmg += minDmg * GetMeleeMinDamageMod_SE(SkillArchery) / 100; + hate += (2*((GetLevel()-25)/3)); + } + + if (!HeadShot) + other->AvoidDamage(this, TotalDmg, false); + + other->MeleeMitigation(this, TotalDmg, minDmg); + if(TotalDmg > 0){ + CommonOutgoingHitSuccess(other, TotalDmg, SkillArchery); + TotalDmg = mod_archery_damage(TotalDmg, dobonus, RangeWeapon); + } + } + else + TotalDmg = -5; + + if (HeadShot) + entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FATAL_BOW_SHOT, GetName()); + + other->AddToHateList(this, hate, 0, false); + other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillArchery); + + //Skill Proc Success + if (TotalDmg > 0 && HasSkillProcSuccess() && other && !other->HasDied()){ + if (ReuseTime) + TrySkillProc(other, SkillArchery, ReuseTime); + else + TrySkillProc(other, SkillArchery, 0, true, MainRange); + } } - //try proc on hits and misses - if((RangeWeapon != nullptr) && GetTarget() && other && !other->HasDied()){ + if (LaunchProjectile) + return;//Shouldn't reach this point, but just in case. + + //Weapon Proc + if(!RangeWeapon && other && !other->HasDied()) TryWeaponProc(RangeWeapon, other, MainRange); - } - //Arrow procs because why not? - if((Ammo != NULL) && GetTarget() && other && !other->HasDied()) - { - TryWeaponProc(Ammo, other, MainRange); - } + //Ammo Proc + if (ammo_lost) + TryWeaponProc(nullptr, ammo_lost, other, MainRange); + else if(Ammo && other && !other->HasDied()) + TryWeaponProc(Ammo, other, MainRange); - if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){ + //Skill Proc + if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, SkillArchery, ReuseTime); else @@ -954,6 +1013,99 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item } } +bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo){ + + if (!other) + return false; + + int slot = -1; + + //Make sure there is an avialable slot. + for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { + if (ProjectileAtk[i].target_id == 0){ + slot = i; + break; + } + } + + if (slot < 0) + return false; + + float distance = other->CalculateDistance(GetX(), GetY(), GetZ()); + float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) + + ProjectileAtk[slot].increment = 1; + ProjectileAtk[slot].hit_increment = hit; //This projected hit time if target does NOT MOVE + ProjectileAtk[slot].target_id = other->GetID(); + ProjectileAtk[slot].wpn_dmg = weapon_dmg; + ProjectileAtk[slot].origin_x = GetX(); + ProjectileAtk[slot].origin_y = GetY(); + ProjectileAtk[slot].origin_z = GetZ(); + ProjectileAtk[slot].ranged_id = RangeWeapon->GetItem()->ID; + ProjectileAtk[slot].ammo_id = Ammo->GetItem()->ID; + ProjectileAtk[slot].skill = skillInUse; + + SetProjectileAttack(true); + + if(item) + SendItemAnimation(other, item, skillInUse); + else if (IsNPC()) + ProjectileAnimation(other, 0,false,0,0,0,0,CastToNPC()->GetAmmoIDfile(),skillInUse); + + return true; +} + + +void Mob::ProjectileAttack() +{ + if (!HasProjectileAttack()) + return;; + + Mob* target = nullptr; + bool disable = true; + + for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { + + if (ProjectileAtk[i].increment == 0){ + continue; + } + + disable = false; + Mob* target = entity_list.GetMobID(ProjectileAtk[i].target_id); + + float distance = 0.0f; + + if (target && IsMoving()){ //Only recalculate hit increment if target moving + distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); + float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) + ProjectileAtk[i].hit_increment = static_cast(hit); + } + + if (ProjectileAtk[i].hit_increment <= ProjectileAtk[i].increment){ + + if (ProjectileAtk[i].skill == SkillArchery) + DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id); + + ProjectileAtk[i].increment = 0; + ProjectileAtk[i].target_id = 0; + ProjectileAtk[i].wpn_dmg = 0; + ProjectileAtk[i].origin_x = 0.0f; + ProjectileAtk[i].origin_y = 0.0f; + ProjectileAtk[i].origin_z = 0.0f; + ProjectileAtk[i].ranged_id = 0; + ProjectileAtk[i].ammo_id = 0; + ProjectileAtk[i].skill = 0; + } + + else { + ProjectileAtk[i].increment++; + } + } + + if (disable) + SetProjectileAttack(false); +} + void NPC::RangedAttack(Mob* other) { From 6f67577115161953b4184e92ef949dee8d2e6319 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 27 Nov 2014 22:30:44 -0500 Subject: [PATCH 0366/1883] Crash fixes --- zone/tradeskills.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index da5114ed2..059a1b909 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -283,7 +283,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } container = inst; - if (container->GetItem()->BagType == BagTypeTransformationmold) { + if (containe->GetItem() && container->GetItem()->BagType == BagTypeTransformationmold) { const ItemInst* inst = container->GetItem(0); bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { @@ -304,7 +304,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob return; } - if (container->GetItem()->BagType == BagTypeDetransformationmold) { + if (container->GetItem() && container->GetItem()->BagType == BagTypeDetransformationmold) { const ItemInst* inst = container->GetItem(0); if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIcon()) { const Item_Struct* new_weapon = inst->GetItem(); From cf1370b9e2dfcc71cf8c9091c1f7c781a678bf01 Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Thu, 27 Nov 2014 22:56:40 -0500 Subject: [PATCH 0367/1883] Spelling matters! --- zone/tradeskills.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 059a1b909..82d84e5cf 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -283,7 +283,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob } container = inst; - if (containe->GetItem() && container->GetItem()->BagType == BagTypeTransformationmold) { + if (container->GetItem() && container->GetItem()->BagType == BagTypeTransformationmold) { const ItemInst* inst = container->GetItem(0); bool AllowAll = RuleB(Inventory, AllowAnyWeaponTransformation); if (inst && ItemInst::CanTransform(inst->GetItem(), container->GetItem(), AllowAll)) { From 6b45b2bc527d9079a3dd8bd8a8b2a152c5fa2a49 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 27 Nov 2014 23:14:49 -0500 Subject: [PATCH 0368/1883] Fix for better ammo slot sync check. --- zone/common.h | 1 + zone/mob.cpp | 1 + zone/mob.h | 4 ++-- zone/special_attacks.cpp | 15 ++++++++------- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/zone/common.h b/zone/common.h index d1aad5e40..c4f643525 100644 --- a/zone/common.h +++ b/zone/common.h @@ -470,6 +470,7 @@ typedef struct float origin_z; uint32 ranged_id; uint32 ammo_id; + int ammo_slot; uint8 skill; } tProjatk; diff --git a/zone/mob.cpp b/zone/mob.cpp index 3b74d2417..398bffd3d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -299,6 +299,7 @@ Mob::Mob(const char* in_name, ProjectileAtk[i].origin_z = 0.0f; ProjectileAtk[i].ranged_id = 0; ProjectileAtk[i].ammo_id = 0; + ProjectileAtk[i].ammo_slot = 0; ProjectileAtk[i].skill = 0; } diff --git a/zone/mob.h b/zone/mob.h index df694aae9..63e687854 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -724,8 +724,8 @@ public: virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false, bool CanAvoid=true); virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); - virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr); - bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo); + virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0); + bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot); void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 879515d20..10456e2fa 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -790,7 +790,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } //Shoots projectile and/or applies the archery damage - DoArcheryAttackDmg(GetTarget(), RangeWeapon, Ammo,0,0,0,0,0,0, AmmoItem); + DoArcheryAttackDmg(GetTarget(), RangeWeapon, Ammo,0,0,0,0,0,0, AmmoItem, ammo_slot); //EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow. int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile; @@ -807,7 +807,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, - uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem) { + uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem, int AmmoSlot) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -857,7 +857,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else RangeWeapon = _RangeWeapon; - _Ammo = CastToClient()->m_inv[MainAmmo]; + _Ammo = CastToClient()->m_inv[AmmoSlot]; if (!_Ammo || _Ammo->GetItem()->ID != ammo_id) ammo_lost = database.GetItem(ammo_id); else @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo); + TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot); return; } else @@ -898,7 +898,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite WDmg = weapon_damage; if (LaunchProjectile){//1: Shoot the Projectile once we calculate weapon damage. - TryProjectileAttack(other, AmmoItem, SkillArchery, WDmg, RangeWeapon, Ammo); + TryProjectileAttack(other, AmmoItem, SkillArchery, WDmg, RangeWeapon, Ammo, AmmoSlot); return; } @@ -1013,7 +1013,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo){ +bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot){ if (!other) return false; @@ -1043,6 +1043,7 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes ProjectileAtk[slot].origin_z = GetZ(); ProjectileAtk[slot].ranged_id = RangeWeapon->GetItem()->ID; ProjectileAtk[slot].ammo_id = Ammo->GetItem()->ID; + ProjectileAtk[slot].ammo_slot = 0; ProjectileAtk[slot].skill = skillInUse; SetProjectileAttack(true); @@ -1084,7 +1085,7 @@ void Mob::ProjectileAttack() if (ProjectileAtk[i].hit_increment <= ProjectileAtk[i].increment){ if (ProjectileAtk[i].skill == SkillArchery) - DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id); + DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); ProjectileAtk[i].increment = 0; ProjectileAtk[i].target_id = 0; From baa7a1feb948233f63e876a77c13c28ec20d51f6 Mon Sep 17 00:00:00 2001 From: akkadius Date: Thu, 27 Nov 2014 23:24:32 -0600 Subject: [PATCH 0369/1883] Disabling file check for db_updater.pl temporarily to force update the update script for users. Will leave it this way for a few weeks and the nre-enable it because the latest one supports automatic update checking --- common/database.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index ecf83dc57..558f1d5c0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -901,21 +901,21 @@ bool Database::CheckDatabaseConversions() { CheckDatabaseConvertCorpseDeblob(); /* Fetch Automatic Database Upgrade Script */ - if (!std::ifstream("db_update.pl")){ + // if (!std::ifstream("db_update.pl")){ std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; #ifdef _WIN32 system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); #else system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); #endif - } + // } /* Automatic Database Upgrade Script - Script: db_updater.pl V 1 - the number that world passes to the script will + Script: db_update.pl V 1 - the number that world passes to the script will force the script to check for a newer version to update itself with - db_updater.pl ran_from_world - won't bring up a menu if your database versions match - db_updater.pl - ran standalone will bring up a menu prompt + db_update.pl ran_from_world - won't bring up a menu if your database versions match + db_update.pl - ran standalone will bring up a menu prompt */ /* Check for a new version of this script, the arg passed From 28ad768c0ad87b755e939fef1359150021007400 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 28 Nov 2014 01:05:57 -0500 Subject: [PATCH 0370/1883] fixes --- zone/mob.h | 2 +- zone/special_attacks.cpp | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/zone/mob.h b/zone/mob.h index 63e687854..373650661 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -722,7 +722,7 @@ public: int32 ReduceAllDamage(int32 damage); virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false, bool CanAvoid=true); - virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0); + virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 ammo_id=0, int AmmoSlot=0); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0); bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 10456e2fa..04f2b199a 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -199,7 +199,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { SetAttackTimer(); ThrowingAttack(GetTarget()); if (CheckDoubleRangedAttack()) - RangedAttack(GetTarget(), true); + ThrowingAttack(GetTarget(), true); return; } //ranged attack (archery) @@ -1074,18 +1074,18 @@ void Mob::ProjectileAttack() disable = false; Mob* target = entity_list.GetMobID(ProjectileAtk[i].target_id); - float distance = 0.0f; - - if (target && IsMoving()){ //Only recalculate hit increment if target moving - distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); + if (target && target->IsMoving()){ //Only recalculate hit increment if target moving + float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[i].hit_increment = static_cast(hit); } if (ProjectileAtk[i].hit_increment <= ProjectileAtk[i].increment){ - if (ProjectileAtk[i].skill == SkillArchery) - DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); + if (target){ + if (ProjectileAtk[i].skill == SkillArchery) + DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); + } ProjectileAtk[i].increment = 0; ProjectileAtk[i].target_id = 0; @@ -1323,7 +1323,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 else if(DistNoRootNoZ(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ return; } - + Shout("SLOT = %i", ammo_slot); if(!IsAttackAllowed(GetTarget()) || IsCasting() || IsSitting() || @@ -1345,7 +1345,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 CommonBreakInvisible(); } -void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* item, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime) +void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* item, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 ammo_id, int AmmoSlot) { if (!CanDoSpecialAttack(other)) return; @@ -1358,8 +1358,12 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite int16 WDmg = 0; - if (!weapon_damage && item != nullptr) - WDmg = GetWeaponDamage(other, item); + if (!weapon_damage){ + if (IsClient() && RangeWeapon) + WDmg = GetWeaponDamage(other, RangeWeapon); + else if (item) + WDmg = GetWeaponDamage(other, item); + } else WDmg = weapon_damage; @@ -1396,7 +1400,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite other->AddToHateList(this, 2*WDmg, 0, false); other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillThrowing); - if (TotalDmg > 0 && HasSkillProcSuccess() && GetTarget() && other && !other->HasDied()){ + if (TotalDmg > 0 && HasSkillProcSuccess() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, SkillThrowing, ReuseTime); else @@ -1404,10 +1408,10 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } - if((RangeWeapon != nullptr) && GetTarget() && other && (other->GetHP() > -10)) + if((RangeWeapon != nullptr) && other && (other->GetHP() > -10)) TryWeaponProc(RangeWeapon, other, MainRange); - if (HasSkillProcs() && GetTarget() && other && !other->HasDied()){ + if (HasSkillProcs() && other && !other->HasDied()){ if (ReuseTime) TrySkillProc(other, SkillThrowing, ReuseTime); else From b7c19e4034bc4523726d9f385a94e54b68cfac46 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 28 Nov 2014 02:19:45 -0500 Subject: [PATCH 0371/1883] Fix model_name in RoF Arrow_Struct --- common/patches/rof_structs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 0a62a90bf..075e6633b 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4169,7 +4169,8 @@ struct Arrow_Struct { /*070*/ uint8 unknown070; /*071*/ uint8 item_type; /*072*/ uint8 skill; -/*073*/ char model_name[43]; +/*073*/ uint8 unknown073[16]; +/*089*/ char model_name[27]; /*116*/ }; From ac0933719ae39ced2c2da17ae8ad710cf6054d30 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 28 Nov 2014 05:42:36 -0500 Subject: [PATCH 0372/1883] Sanity check added before calculating distance. --- zone/common.h | 1 + zone/mob.cpp | 1 + zone/special_attacks.cpp | 11 ++++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/zone/common.h b/zone/common.h index c4f643525..267831368 100644 --- a/zone/common.h +++ b/zone/common.h @@ -468,6 +468,7 @@ typedef struct float origin_x; float origin_y; float origin_z; + float sanitycheck; uint32 ranged_id; uint32 ammo_id; int ammo_slot; diff --git a/zone/mob.cpp b/zone/mob.cpp index 398bffd3d..b4645b115 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -297,6 +297,7 @@ Mob::Mob(const char* in_name, ProjectileAtk[i].origin_x = 0.0f; ProjectileAtk[i].origin_y = 0.0f; ProjectileAtk[i].origin_z = 0.0f; + ProjectileAtk[i].sanitycheck = 0.0f; ProjectileAtk[i].ranged_id = 0; ProjectileAtk[i].ammo_id = 0; ProjectileAtk[i].ammo_slot = 0; diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 04f2b199a..5f8373cac 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1075,9 +1075,14 @@ void Mob::ProjectileAttack() Mob* target = entity_list.GetMobID(ProjectileAtk[i].target_id); if (target && target->IsMoving()){ //Only recalculate hit increment if target moving - float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); - float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) - ProjectileAtk[i].hit_increment = static_cast(hit); + + //Due to frequency that we need to check increment the targets position variables may not be updated even if moving. Do a simple check before calculating distance. + if (ProjectileAtk[i].sanitycheck != target->GetX() * target->GetY()){ + ProjectileAtk[i].sanitycheck = target->GetX() * target->GetY(); + float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); + float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) + ProjectileAtk[i].hit_increment = static_cast(hit); + } } if (ProjectileAtk[i].hit_increment <= ProjectileAtk[i].increment){ From 67863e364b48b5c4e0ea5b99dda0e006a9de5c72 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 28 Nov 2014 05:46:23 -0500 Subject: [PATCH 0373/1883] fix --- zone/special_attacks.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 5f8373cac..38cbceb3b 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1098,8 +1098,10 @@ void Mob::ProjectileAttack() ProjectileAtk[i].origin_x = 0.0f; ProjectileAtk[i].origin_y = 0.0f; ProjectileAtk[i].origin_z = 0.0f; + ProjectileAtk[i].sanitycheck = 0.0f; ProjectileAtk[i].ranged_id = 0; ProjectileAtk[i].ammo_id = 0; + ProjectileAtk[i].ammo_slot = 0; ProjectileAtk[i].skill = 0; } From 3d83f647bf9400e952885f05d755c5cac1e3163d Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 28 Nov 2014 07:08:28 -0500 Subject: [PATCH 0374/1883] Implemented projectile on impact for Throwing --- zone/mob.h | 2 +- zone/special_attacks.cpp | 108 ++++++++++++++++++++++++++++++--------- 2 files changed, 86 insertions(+), 24 deletions(-) diff --git a/zone/mob.h b/zone/mob.h index 373650661..a0fcf2d79 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -722,7 +722,7 @@ public: int32 ReduceAllDamage(int32 damage); virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false, bool CanAvoid=true); - virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* item=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 ammo_id=0, int AmmoSlot=0); + virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0); bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 38cbceb3b..48bf2aaba 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -852,16 +852,14 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (IsClient()){ _RangeWeapon = CastToClient()->m_inv[MainRange]; - if (!_RangeWeapon || _RangeWeapon->GetItem()->ID != range_id) - RangeWeapon = nullptr; - else - RangeWeapon = _RangeWeapon; + if (_RangeWeapon && !_RangeWeapon->GetItem() && _RangeWeapon->GetItem()->ID == range_id) + RangeWeapon = _RangeWeapon; _Ammo = CastToClient()->m_inv[AmmoSlot]; - if (!_Ammo || _Ammo->GetItem()->ID != ammo_id) - ammo_lost = database.GetItem(ammo_id); - else + if (_Ammo && _Ammo->GetItem() && _Ammo->GetItem()->ID == ammo_id) Ammo = _Ammo; + else + ammo_lost = database.GetItem(ammo_id); } } } @@ -1035,14 +1033,19 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[slot].increment = 1; - ProjectileAtk[slot].hit_increment = hit; //This projected hit time if target does NOT MOVE + ProjectileAtk[slot].hit_increment = static_cast(hit); //This projected hit time if target does NOT MOVE ProjectileAtk[slot].target_id = other->GetID(); ProjectileAtk[slot].wpn_dmg = weapon_dmg; ProjectileAtk[slot].origin_x = GetX(); ProjectileAtk[slot].origin_y = GetY(); ProjectileAtk[slot].origin_z = GetZ(); - ProjectileAtk[slot].ranged_id = RangeWeapon->GetItem()->ID; - ProjectileAtk[slot].ammo_id = Ammo->GetItem()->ID; + + if (RangeWeapon && RangeWeapon->GetItem()) + ProjectileAtk[slot].ranged_id = RangeWeapon->GetItem()->ID; + + if (Ammo && Ammo->GetItem()) + ProjectileAtk[slot].ammo_id = Ammo->GetItem()->ID; + ProjectileAtk[slot].ammo_slot = 0; ProjectileAtk[slot].skill = skillInUse; @@ -1077,8 +1080,9 @@ void Mob::ProjectileAttack() if (target && target->IsMoving()){ //Only recalculate hit increment if target moving //Due to frequency that we need to check increment the targets position variables may not be updated even if moving. Do a simple check before calculating distance. - if (ProjectileAtk[i].sanitycheck != target->GetX() * target->GetY()){ - ProjectileAtk[i].sanitycheck = target->GetX() * target->GetY(); + float _sanitycheck = target->GetX() * target->GetY(); + if (ProjectileAtk[i].sanitycheck != _sanitycheck){ + ProjectileAtk[i].sanitycheck = _sanitycheck; float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[i].hit_increment = static_cast(hit); @@ -1090,6 +1094,8 @@ void Mob::ProjectileAttack() if (target){ if (ProjectileAtk[i].skill == SkillArchery) DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); + else if (ProjectileAtk[i].skill == SkillThrowing) + DoThrowingAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0, ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_slot); } ProjectileAtk[i].increment = 0; @@ -1330,7 +1336,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 else if(DistNoRootNoZ(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ return; } - Shout("SLOT = %i", ammo_slot); + if(!IsAttackAllowed(GetTarget()) || IsCasting() || IsSitting() || @@ -1341,8 +1347,6 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 (GetAppearance() == eaDead)){ return; } - //send item animation, also does the throw animation - SendItemAnimation(GetTarget(), item, SkillThrowing); DoThrowingAttackDmg(GetTarget(), RangeWeapon, item); @@ -1352,14 +1356,62 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 CommonBreakInvisible(); } -void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* item, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 ammo_id, int AmmoSlot) +void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* AmmoItem, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot) { - if (!CanDoSpecialAttack(other)) + if ((other == nullptr || + ((IsClient() && CastToClient()->dead) || + (other->IsClient() && other->CastToClient()->dead)) || + HasDied() || + (!IsAttackAllowed(other)) || + (other->GetInvul() || + other->GetSpecialAbility(IMMUNE_MELEE)))) + { return; + } - if (!other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ + const ItemInst* _RangeWeapon = nullptr; + const Item_Struct* ammo_lost = nullptr; + + /* + If LaunchProjectile is false this function will do archery damage on target, + otherwise it will shoot the projectile at the target, once the projectile hits target + this function is then run again to do the damage portion + */ + bool LaunchProjectile = false; + bool ProjectileMiss = false; + + if (RuleB(Combat, ProjectileDmgOnImpact)){ + + if (AmmoItem) + LaunchProjectile = true; + else{ + if (!RangeWeapon && range_id){ + + if (weapon_damage == 0) + ProjectileMiss = true; //This indicates that MISS was originally calculated. + + if (IsClient()){ + + _RangeWeapon = CastToClient()->m_inv[AmmoSlot]; + if (_RangeWeapon && _RangeWeapon->GetItem() && _RangeWeapon->GetItem()->ID != range_id) + RangeWeapon = _RangeWeapon; + else + ammo_lost = database.GetItem(range_id); + } + } + } + } + else if (AmmoItem) + SendItemAnimation(other, AmmoItem, SkillThrowing); + + if (ProjectileMiss || !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); - other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); + if (LaunchProjectile){ + TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot); + return; + } + else + other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { mlog(COMBAT__RANGED, "Throwing attack hit %s.", other->GetName()); @@ -1368,8 +1420,13 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (!weapon_damage){ if (IsClient() && RangeWeapon) WDmg = GetWeaponDamage(other, RangeWeapon); - else if (item) - WDmg = GetWeaponDamage(other, item); + else if (AmmoItem) + WDmg = GetWeaponDamage(other, AmmoItem); + + if (LaunchProjectile){ + TryProjectileAttack(other, AmmoItem, SkillThrowing, WDmg, RangeWeapon, nullptr, AmmoSlot); + return; + } } else WDmg = weapon_damage; @@ -1415,7 +1472,13 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } - if((RangeWeapon != nullptr) && other && (other->GetHP() > -10)) + if (LaunchProjectile) + return; + + //Throwing item Proc + if (ammo_lost) + TryWeaponProc(nullptr, ammo_lost, other, MainRange); + else if(RangeWeapon && other && !other->HasDied()) TryWeaponProc(RangeWeapon, other, MainRange); if (HasSkillProcs() && other && !other->HasDied()){ @@ -1424,7 +1487,6 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else TrySkillProc(other, SkillThrowing, 0, false, MainRange); } - } void Mob::SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse) { From 84fa042c75a0dd0231d70f98e6bc90782b953e17 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 28 Nov 2014 20:23:42 -0600 Subject: [PATCH 0375/1883] Fixed a zone crash related to numhits for spells. Fixed a query related to group leaders logging in. Fixed a world crash related to attempting to join an adventure with Mercenaries. --- changelog.txt | 7 ++++++- common/database.cpp | 7 +++++-- world/adventure.cpp | 17 +++++++++++------ zone/mob.h | 2 +- zone/spell_effects.cpp | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index b05fc26ee..cf7d51346 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 11/24/2014 == +== 11/28/2014 == +Trevius: Fixed a zone crash related to numhits for spells. +Trevius: Fixed a query related to group leaders logging in. +Trevius (Natedog): Fixed a world crash related to attempting to join an adventure with Mercenaries. + +== 11/25/2014 == Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size. Trevius: Fix to prevent Mercenaries from being set as Group Leader. diff --git a/common/database.cpp b/common/database.cpp index 558f1d5c0..e950d8bd4 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -768,7 +768,10 @@ uint32 Database::GetCharacterID(const char *name) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); auto results = QueryDatabase(query); auto row = results.begin(); - if (row[0]){ return atoi(row[0]); } + if (results.RowCount() == 1) + { + return atoi(row[0]); + } return 0; } @@ -3277,7 +3280,7 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf) { if (group_id == 0) return leaderbuf; - query = StringFormat("SELECT `leadername` FROM `group_leader` WHERE `gid` = '%u' AND `groupid` = %u LIMIT 1", group_id); + query = StringFormat("SELECT `leadername` FROM `group_leaders` WHERE `gid` = '%u' LIMIT 1", group_id); results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) diff --git a/world/adventure.cpp b/world/adventure.cpp index ffb64779c..979347409 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -54,10 +54,10 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc { if(!PlayerExists(character_name)) { - int client_id = database.GetCharacterID(character_name.c_str()); - if(add_client_to_instance) + int32 character_id = database.GetCharacterID(character_name.c_str()); + if(character_id && add_client_to_instance) { - database.AddClientToInstance(instance_id, client_id); + database.AddClientToInstance(instance_id, character_id); } players.push_back(character_name); } @@ -68,11 +68,16 @@ void Adventure::RemovePlayer(std::string character_name) std::list::iterator iter = players.begin(); while(iter != players.end()) { + if((*iter).compare(character_name) == 0) { - database.RemoveClientFromInstance(instance_id, database.GetCharacterID(character_name.c_str())); - players.erase(iter); - return; + int32 character_id = database.GetCharacterID(character_name.c_str()); + if (character_id) + { + database.RemoveClientFromInstance(instance_id, character_id); + players.erase(iter); + return; + } } ++iter; } diff --git a/zone/mob.h b/zone/mob.h index 525cbb2e8..944dfc515 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -275,7 +275,7 @@ public: int16 GetBuffSlotFromType(uint16 type); uint16 GetSpellIDFromSlot(uint8 slot); int CountDispellableBuffs(); - void CheckNumHitsRemaining(uint8 type, uint32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); + void CheckNumHitsRemaining(uint8 type, int32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); bool HasNumhits() const { return has_numhits; } inline void Numhits(bool val) { has_numhits = val; } bool HasMGB() const { return has_MGB; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 4a73926c3..b55102072 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5558,7 +5558,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2 + realTotal3; } -void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) +void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) { /* Field 175 = numhits type From 8cd19670abef46d5bb0887d16f906a9c32f96f04 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 28 Nov 2014 20:30:35 -0600 Subject: [PATCH 0376/1883] Minor improvement to last commit. --- world/adventure.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index 979347409..80b1dcaca 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -68,7 +68,6 @@ void Adventure::RemovePlayer(std::string character_name) std::list::iterator iter = players.begin(); while(iter != players.end()) { - if((*iter).compare(character_name) == 0) { int32 character_id = database.GetCharacterID(character_name.c_str()); @@ -76,8 +75,8 @@ void Adventure::RemovePlayer(std::string character_name) { database.RemoveClientFromInstance(instance_id, character_id); players.erase(iter); - return; } + return; } ++iter; } From ad9c0df5525237dcb29b7bb6ec718f9e8ffa75b5 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 03:12:34 -0600 Subject: [PATCH 0377/1883] #include and forward declaration cleanup of client.cpp net.cpp questmgr.cpp zone.cpp zone.h --- zone/client.cpp | 14 ---------- zone/net.cpp | 2 +- zone/questmgr.cpp | 71 ++++++++++------------------------------------- zone/zone.cpp | 63 +++++++++++++++++++---------------------- zone/zone.h | 28 +++++-------------- 5 files changed, 51 insertions(+), 127 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 7ceb12496..e4f2c823a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -17,13 +17,9 @@ */ #include "../common/debug.h" #include -#include -#include #include #include #include -#include -#include // for windows compile #ifdef _WINDOWS @@ -39,27 +35,17 @@ extern volatile bool RunLoops; #include "../common/features.h" -#include "../common/misc.h" #include "../common/spdat.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "../common/serverinfo.h" -#include "../common/zone_numbers.h" -#include "../common/moremath.h" #include "../common/guilds.h" -#include "../common/breakdowns.h" #include "../common/rulesys.h" #include "../common/string_util.h" #include "../common/data_verification.h" #include "net.h" -#include "masterentity.h" #include "worldserver.h" #include "zonedb.h" #include "petitions.h" -#include "forage.h" #include "command.h" #include "string_ids.h" -#include "npc_ai.h" #include "client_logs.h" #include "guild_mgr.h" #include "quest_parser_collection.h" diff --git a/zone/net.cpp b/zone/net.cpp index 498ed5102..034c30747 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -97,7 +97,7 @@ extern Zone* zone; EQStreamFactory eqsf(ZoneStream); npcDecayTimes_Struct npcCorpseDecayTimes[100]; TitleManager title_manager; -QueryServ *QServ = 0; +QueryServ *QServ = 0; TaskManager *taskmanager = 0; QuestParserCollection *parse = 0; diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 458a448d9..2ce1dbc37 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -16,66 +16,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - -Assuming you want to add a new perl quest function named joe -that takes 1 integer argument.... - -1. Add the prototype to the quest manager: -questmgr.h: add (~line 50) - void joe(int arg); - -2. Define the actual function in questmgr.cpp: -void QuestManager::joe(int arg) { - //... do something -} - -3. Copy one of the XS routines in perlparser.cpp, preferably - one with the same number of arguments as your routine. Rename - as needed. - Finally, add your routine to the list at the bottom of perlparser.cpp - - -4. -If you want it to work in old mode perl and .qst, edit parser.cpp -Parser::ExCommands (~line 777) - else if (!strcmp(command,"joe")) { - quest_manager.joe(atoi(arglist[0])); - } - -And then at then end of embparser.cpp, add: -"sub joe{push(@cmd_queue,{func=>'joe',args=>join(',',@_)});}" - - - -*/ - -#include "../common/debug.h" -#include "entity.h" -#include "masterentity.h" -#include - -#include -#include -#include - -#include "worldserver.h" -#include "net.h" -#include "../common/skills.h" #include "../common/classes.h" -#include "../common/races.h" -#include "zonedb.h" +#include "../common/debug.h" +#include "../common/rulesys.h" +#include "../common/skills.h" #include "../common/spdat.h" -#include "../common/packet_functions.h" #include "../common/string_util.h" -#include "spawn2.h" -#include "zone.h" +#include "entity.h" #include "event_codes.h" #include "guild_mgr.h" -#include "../common/rulesys.h" +#include "net.h" #include "qglobals.h" -#include "quest_parser_collection.h" #include "queryserv.h" +#include "questmgr.h" +#include "quest_parser_collection.h" +#include "spawn2.h" +#include "worldserver.h" +#include "zone.h" +#include "zonedb.h" +#include +#include +#include + #ifdef BOTS #include "bot.h" #endif @@ -85,9 +47,6 @@ extern Zone* zone; extern WorldServer worldserver; extern EntityList entity_list; -#include "questmgr.h" - -//declare our global instance QuestManager quest_manager; #define QuestManagerCurrentQuestVars() \ diff --git a/zone/zone.cpp b/zone/zone.cpp index ecf10bcb5..9b42bfb68 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -15,17 +15,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" + +#include #include -#include +#include #include #include -#include -#include -#include #ifdef _WINDOWS -#include #define snprintf _snprintf #define vsnprintf _vsnprintf #else @@ -33,31 +30,26 @@ #include "../common/unix.h" #endif -#include "masterentity.h" +#include "../common/debug.h" #include "../common/features.h" -#include "spawngroup.h" -#include "spawn2.h" -#include "zone.h" -#include "worldserver.h" -#include "npc.h" -#include "net.h" -#include "../common/seperator.h" -#include "../common/packet_dump_file.h" -#include "../common/eq_stream_factory.h" -#include "../common/eq_stream.h" -#include "../common/string_util.h" -#include "zone_config.h" -#include "../common/breakdowns.h" -#include "map.h" -#include "water_map.h" -#include "object.h" -#include "petitions.h" -#include "pathing.h" -#include "event_codes.h" -#include "client_logs.h" #include "../common/rulesys.h" +#include "../common/seperator.h" +#include "../common/string_util.h" +#include "client_logs.h" #include "guild_mgr.h" +#include "map.h" +#include "net.h" +#include "npc.h" +#include "object.h" +#include "pathing.h" +#include "petitions.h" #include "quest_parser_collection.h" +#include "spawn2.h" +#include "spawngroup.h" +#include "water_map.h" +#include "worldserver.h" +#include "zone_config.h" +#include "zone.h" #ifdef _WINDOWS #define snprintf _snprintf @@ -65,18 +57,19 @@ #define strcasecmp _stricmp #endif - +extern bool staticzone; +extern NetConnection net; +extern PetitionList petition_list; +extern QuestParserCollection* parse; +extern uint16 adverrornum; +extern uint32 numclients; extern WorldServer worldserver; extern Zone* zone; -extern uint32 numclients; -extern NetConnection net; -extern uint16 adverrornum; -extern PetitionList petition_list; + Mutex MZoneShutdown; -extern bool staticzone; -Zone* zone = 0; + volatile bool ZoneLoaded = false; -extern QuestParserCollection* parse; +Zone* zone = 0; bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { const char* zonename = database.GetZoneName(iZoneID); diff --git a/zone/zone.h b/zone/zone.h index 0fa390512..2d74c9f17 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -18,25 +18,13 @@ #ifndef ZONE_H #define ZONE_H -#include "../common/mutex.h" -#include "../common/linked_list.h" -#include "../common/types.h" #include "../common/eqtime.h" -#include "../common/servertalk.h" +#include "../common/linked_list.h" #include "../common/rulesys.h" -#include "../common/eq_packet_structs.h" -#include "../common/features.h" -#include "spawngroup.h" -//#include "mob.h" -#include "zonedump.h" -#include "spawn2.h" -#include "tasks.h" -#include "pathing.h" +#include "../common/types.h" #include "qglobals.h" -#include - -class Map; -class WaterMap; +#include "spawn2.h" +#include "spawngroup.h" struct ZonePoint { @@ -78,12 +66,10 @@ struct item_tick_struct { std::string qglobal; }; -extern EntityList entity_list; -class database; +class Map; +class WaterMap; class PathManager; -struct SendAA_Struct; - -class database; +extern EntityList entity_list; class Zone { From 700de3f518a1a317822bbb5b18126995fb504a03 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 03:24:48 -0600 Subject: [PATCH 0378/1883] questmgr.h forward declarations client_process.cpp #include removals --- zone/client_process.cpp | 36 +++++++++++------------------------- zone/questmgr.h | 4 +++- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c07a73aea..2c391bd34 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -20,13 +20,8 @@ */ #include "../common/debug.h" #include -#include -#include -#include #include -#include #include -#include #ifdef _WINDOWS #include @@ -41,29 +36,20 @@ #include #endif -#include "masterentity.h" -#include "zonedb.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "worldserver.h" -#include "../common/packet_dump_file.h" -#include "../common/string_util.h" -#include "../common/spdat.h" -#include "petitions.h" -#include "npc_ai.h" -#include "../common/skills.h" -#include "forage.h" -#include "zone.h" -#include "event_codes.h" -#include "../common/faction.h" -#include "../common/crc32.h" #include "../common/rulesys.h" -#include "string_ids.h" -#include "map.h" +#include "../common/skills.h" +#include "../common/spdat.h" +#include "../common/string_util.h" +#include "event_codes.h" #include "guild_mgr.h" -#include -#include "quest_parser_collection.h" +#include "map.h" +#include "petitions.h" #include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "worldserver.h" +#include "zone.h" +#include "zonedb.h" extern QueryServ* QServ; extern Zone* zone; diff --git a/zone/questmgr.h b/zone/questmgr.h index 6b47bab04..dd471d74f 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -25,8 +25,10 @@ #include #include -class NPC; class Client; +class ItemInst; +class Mob; +class NPC; class QuestManager { struct running_quest { From 82e96d7014f2c86cda16b1d340a8b3f78a2e6f1b Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 03:48:26 -0600 Subject: [PATCH 0379/1883] client_packet.cpp #include cleanup --- zone/client_packet.cpp | 46 +++++++++++++++--------------------------- zone/client_packet.h | 4 ++-- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a12247cc6..8f2450621 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -16,14 +16,11 @@ */ #include "../common/debug.h" -#include #include #include #include #include -#include #include -#include #include #include @@ -38,39 +35,28 @@ #include #endif -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "worldserver.h" -#include "../common/rdtsc.h" -#include "../common/packet_dump_file.h" -#include "../common/string_util.h" -#include "../common/breakdowns.h" -#include "../common/guilds.h" -#include "../common/rulesys.h" -#include "../common/spdat.h" -#include "../common/data_verification.h" -#include "petitions.h" -#include "npc_ai.h" -#include "../common/skills.h" -#include "forage.h" -#include "zone.h" -#include "event_codes.h" -#include "../common/faction.h" #include "../common/crc32.h" +#include "../common/data_verification.h" +#include "../common/faction.h" +#include "../common/guilds.h" +#include "../common/rdtsc.h" +#include "../common/rulesys.h" +#include "../common/skills.h" +#include "../common/spdat.h" +#include "../common/string_util.h" +#include "../common/zone_numbers.h" +#include "event_codes.h" +#include "guild_mgr.h" +#include "merc.h" +#include "petitions.h" +#include "pets.h" +#include "queryserv.h" +#include "quest_parser_collection.h" #include "string_ids.h" #include "titles.h" #include "water_map.h" #include "worldserver.h" #include "zone.h" -#include "zone_config.h" -#include "guild_mgr.h" -#include "pathing.h" -#include "water_map.h" -#include "merc.h" -#include "pets.h" -#include "../common/zone_numbers.h" -#include "quest_parser_collection.h" -#include "queryserv.h" extern QueryServ* QServ; extern Zone* zone; diff --git a/zone/client_packet.h b/zone/client_packet.h index 0868b93ba..51b6713b7 100644 --- a/zone/client_packet.h +++ b/zone/client_packet.h @@ -1,4 +1,4 @@ - // connecting opcode handlers + /* Connecting OpCode Handlers */ void Handle_Connect_0x3e33(const EQApplicationPacket *app); void Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app); void Handle_Connect_OP_ClientError(const EQApplicationPacket *app); @@ -20,7 +20,7 @@ void Handle_Connect_OP_WorldObjectsSent(const EQApplicationPacket *app); void Handle_Connect_OP_ZoneComplete(const EQApplicationPacket *app); void Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app); - // connected opcode handlers + /* Connected opcode handlers*/ void Handle_0x0193(const EQApplicationPacket *app); void Handle_0x01e7(const EQApplicationPacket *app); void Handle_OP_AAAction(const EQApplicationPacket *app); From 8da864bada536099577fcc4b8c8340f07e85f2d3 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 03:54:25 -0600 Subject: [PATCH 0380/1883] command.cpp #include cleanup command.h forward declaration --- zone/command.cpp | 27 +++++++++++---------------- zone/command.h | 3 +++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 12241de52..c9bef2e12 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -42,27 +42,22 @@ #endif #include "../common/debug.h" -#include "../common/ptimer.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "../common/serverinfo.h" -#include "../common/opcodemgr.h" #include "../common/eq_packet.h" -#include "../common/guilds.h" -#include "../common/rulesys.h" -#include "../common/string_util.h" -//#include "../common/servertalk.h" // for oocmute and revoke -#include "worldserver.h" -#include "masterentity.h" -#include "map.h" -#include "water_map.h" #include "../common/features.h" -#include "pathing.h" +#include "../common/guilds.h" +#include "../common/patches/patches.h" +#include "../common/ptimer.h" +#include "../common/rulesys.h" +#include "../common/serverinfo.h" +#include "../common/string_util.h" #include "client_logs.h" #include "guild_mgr.h" -#include "titles.h" -#include "../common/patches/patches.h" +#include "map.h" +#include "pathing.h" #include "queryserv.h" +#include "titles.h" +#include "water_map.h" +#include "worldserver.h" extern QueryServ* QServ; extern WorldServer worldserver; diff --git a/zone/command.h b/zone/command.h index db069b57c..ea710482b 100644 --- a/zone/command.h +++ b/zone/command.h @@ -20,6 +20,9 @@ #ifndef COMMAND_H #define COMMAND_H +class Client; +class Seperator; + #include "../common/seperator.h" #include "../common/eq_stream.h" #include "client.h" From 6d763256f148faf9da95fdcf22bad859faa48871 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 04:04:49 -0600 Subject: [PATCH 0381/1883] client_mods.cpp cleanup --- zone/client_mods.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 5431b2dfe..55b522378 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -18,23 +18,17 @@ #include #include "../common/debug.h" -#include "../common/spdat.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "../common/serverinfo.h" -#include "../common/zone_numbers.h" -#include "../common/moremath.h" -#include "../common/guilds.h" #include "../common/logsys.h" +#include "../common/spdat.h" +#include "../common/rulesys.h" #include "masterentity.h" -#include "worldserver.h" -#include "zonedb.h" +#include "npc_ai.h" #include "petitions.h" #include "string_ids.h" -#include "npc_ai.h" +#include "worldserver.h" +#include "zonedb.h" -// Return max stat value for level int32 Client::GetMaxStat() const { if((RuleI(Character, StatCap)) > 0) From e833f457a1e7e3b6f2cf6d1ae656de85fa17c21e Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 04:08:37 -0600 Subject: [PATCH 0382/1883] inventory.cpp #include clean/remove --- zone/inventory.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index a7f61819e..d290658d0 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -15,24 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include "masterentity.h" -#include "worldserver.h" -#include "net.h" -#include "zonedb.h" -#include "../common/spdat.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "petitions.h" -#include "../common/serverinfo.h" -#include "../common/zone_numbers.h" -#include "../common/moremath.h" -#include "../common/guilds.h" #include "../common/logsys.h" #include "../common/string_util.h" -#include "string_ids.h" -#include "npc_ai.h" #include "quest_parser_collection.h" +#include "worldserver.h" +#include "zonedb.h" extern WorldServer worldserver; // @merth: this needs to be touched up From 251e940fe83f494dd7f4bad2a6584cb996fb51ea Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 04:18:18 -0600 Subject: [PATCH 0383/1883] zonedb.h forward declarations zonedb.cpp #include cleanup --- zone/inventory.cpp | 1 + zone/zonedb.cpp | 19 +++++++------------ zone/zonedb.h | 26 +++++++++++++++++--------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index d290658d0..6b7a0b297 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -22,6 +22,7 @@ #include "quest_parser_collection.h" #include "worldserver.h" #include "zonedb.h" + extern WorldServer worldserver; // @merth: this needs to be touched up diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8bc696888..1f520ed88 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1,21 +1,16 @@ -#include "zonedb.h" -#include "../common/item.h" -#include "../common/string_util.h" #include "../common/extprofile.h" -#include "../common/guilds.h" +#include "../common/item.h" #include "../common/rulesys.h" -#include "../common/rdtsc.h" -#include "zone.h" -#include "corpse.h" +#include "../common/string_util.h" #include "client.h" -#include "merc.h" +#include "corpse.h" #include "groups.h" -#include "raids.h" -#include -#include -#include +#include "merc.h" +#include "zone.h" +#include "zonedb.h" #include +#include extern Zone* zone; diff --git a/zone/zonedb.h b/zone/zonedb.h index 3f8719946..5adc893ff 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -3,10 +3,24 @@ #include "../common/shareddb.h" #include "../common/eq_packet_structs.h" -#include "../common/loottable.h" -#include "zonedump.h" #include "../common/faction.h" -#include + +class Client; +class Corpse; +class Merc; +class NPC; +class Petition; +class Spawn2; +class SpawnGroupList; +class ItemInst; +struct CharacterEventLog_Struct; +struct Door; +struct ExtendedProfile_Struct; +struct NPCType; +struct PlayerCorpse_Struct; +struct ZonePoint; +struct npcDecayTimes_Struct; +template class LinkedList; //#include "doors.h" @@ -201,12 +215,6 @@ struct ClientMercEntry { uint32 npcid; }; -class ItemInst; -struct FactionMods; -struct FactionValue; -struct LootTable_Struct; - - class ZoneDatabase : public SharedDatabase { typedef std::list ItemList; public: From 5d5c3fbfd1784bdcf75311bd3c8eb576371720bd Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 04:30:03 -0600 Subject: [PATCH 0384/1883] database.h forward declaration database.cpp #include house-keeping --- common/database.cpp | 16 ++++++---------- common/database.h | 11 +++-------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index e950d8bd4..4cafc56d1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -17,19 +17,16 @@ */ #include "../common/debug.h" #include "../common/rulesys.h" -#include -#include +#include +#include #include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include // Disgrace: for windows compile #ifdef _WINDOWS @@ -45,7 +42,6 @@ #include "database.h" #include "eq_packet_structs.h" -#include "guilds.h" #include "string_util.h" #include "extprofile.h" diff --git a/common/database.h b/common/database.h index 9be14f1cb..6325b4e3d 100644 --- a/common/database.h +++ b/common/database.h @@ -41,6 +41,7 @@ class SpawnGroupList; class Petition; class Client; class Merc; +class MySQLRequestResult; struct Combine_Struct; //struct Faction; //struct FactionMods; @@ -68,21 +69,15 @@ uint8 eventid; EventLogDetails_Struct eld[255]; }; - -// Added By Hogie -// INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]'); -// IE: decaytime 1 54 = Levels 1 through 54 -// decaytime 55 100 = Levels 55 through 100 -// It will always put the LAST time for the level (I think) from the Database struct npcDecayTimes_Struct { uint16 minlvl; uint16 maxlvl; uint32 seconds; }; -// Added By Hogie -- End + struct VarCache_Struct { - char varname[26]; // varname is char(25) in database + char varname[26]; char value[0]; }; From 4faca5543ace09b9db836e73ebf80be2a9f6e544 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 04:56:42 -0600 Subject: [PATCH 0385/1883] net.h cleanup --- zone/net.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/zone/net.h b/zone/net.h index e81dd6d51..c49e1ec8e 100644 --- a/zone/net.h +++ b/zone/net.h @@ -26,9 +26,6 @@ #include #endif - -#include -#include #include "../common/types.h" #include "../common/timer.h" void CatchSignal(int); From 904ae416c51d4c7d439182d3dad6c4e9d03fdb58 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 05:01:49 -0600 Subject: [PATCH 0386/1883] Small world server cleanup --- zone/worldserver.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/worldserver.h b/zone/worldserver.h index 6feead496..c1e86421f 100644 --- a/zone/worldserver.h +++ b/zone/worldserver.h @@ -20,12 +20,10 @@ #include "../common/worldconn.h" #include "../common/eq_packet_structs.h" -#include -struct GuildJoin_Struct; +class ServerPacket; class EQApplicationPacket; class Client; -class Database; class WorldServer : public WorldConnection { public: From 35e9c3ad9804128b9971b1230eae0758778e45e3 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 05:22:27 -0600 Subject: [PATCH 0387/1883] special_attacks.cpp #include clean --- zone/special_attacks.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 3625c9180..6c29cade1 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -14,19 +14,18 @@ You 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 -*/ + */ + + #include "../common/debug.h" -#include -#include -#include -#include - -#include "masterentity.h" -#include "string_ids.h" #include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "masterentity.h" +#include "string_ids.h" +#include +#include int Mob::GetKickDamage() { From 7db731a47de5b4c84611838a9a1fb2236af5a7d0 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 14:07:40 -0600 Subject: [PATCH 0388/1883] net.cpp #include cleanup net.cpp forward declaration --- zone/net.cpp | 89 ++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 51 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index 034c30747..e82a29bca 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -18,57 +18,39 @@ #define DONT_SHARED_OPCODES -#include "../common/debug.h" -#include "../common/features.h" -#include "../common/queue.h" -#include "../common/timer.h" -#include "../common/eq_stream.h" -#include "../common/eq_stream_factory.h" -#include "../common/eq_packet_structs.h" -#include "../common/mutex.h" -#include "../common/version.h" -#include "../common/eqemu_error.h" -#include "../common/packet_dump_file.h" -#include "../common/opcodemgr.h" -#include "../common/guilds.h" -#include "../common/eq_stream_ident.h" -#include "../common/patches/patches.h" -#include "../common/rulesys.h" -#include "../common/misc_functions.h" -#include "../common/string_util.h" -#include "../common/platform.h" + #include "../common/crash.h" +#include "../common/debug.h" +#include "../common/eq_stream_factory.h" +#include "../common/eq_stream_ident.h" +#include "../common/eqemu_error.h" +#include "../common/eqemu_exception.h" +#include "../common/features.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" -#include "../common/eqemu_exception.h" +#include "../common/patches/patches.h" +#include "../common/platform.h" +#include "../common/rulesys.h" #include "../common/spdat.h" +#include "../common/timer.h" +#include "../common/version.h" -#include "zone_config.h" -#include "masterentity.h" -#include "worldserver.h" -#include "net.h" -#include "zone.h" -#include "queryserv.h" -#include "command.h" -#include "zone_config.h" -#include "titles.h" -#include "guild_mgr.h" -#include "tasks.h" - -#include "quest_parser_collection.h" -#include "embparser.h" -#include "lua_parser.h" #include "client_logs.h" +#include "command.h" +#include "embparser.h" +#include "guild_mgr.h" +#include "lua_parser.h" +#include "net.h" +#include "queryserv.h" +#include "quest_parser_collection.h" #include "questmgr.h" +#include "tasks.h" +#include "titles.h" +#include "worldserver.h" +#include "zone_config.h" +#include "zone.h" -#include -#include -#include - -#include -#include #include -#include #ifdef _CRTDBG_MAP_ALLOC #undef new @@ -86,20 +68,25 @@ volatile bool RunLoops = true; extern volatile bool ZoneLoaded; -TimeoutManager timeout_manager; -NetConnection net; -EntityList entity_list; -WorldServer worldserver; -uint32 numclients = 0; +class EQStream; +class EQStreamInterface; + char errorname[32]; -uint16 adverrornum = 0; -extern Zone* zone; +EntityList entity_list; EQStreamFactory eqsf(ZoneStream); +extern Zone* zone; +NetConnection net; npcDecayTimes_Struct npcCorpseDecayTimes[100]; -TitleManager title_manager; QueryServ *QServ = 0; -TaskManager *taskmanager = 0; QuestParserCollection *parse = 0; +TaskManager *taskmanager = 0; +TimeoutManager timeout_manager; +TitleManager title_manager; +WorldServer worldserver; + +uint16 adverrornum = 0; +uint32 numclients = 0; + const SPDat_Spell_Struct* spells; void LoadSpells(EQEmu::MemoryMappedFile **mmf); From b06fec6ad0a5e5482d8ce4a0ba9a029c6efa64a5 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 14:11:16 -0600 Subject: [PATCH 0389/1883] attack.cpp #include cleanup --- zone/attack.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index ef18f6fae..65c3fd9d1 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -21,28 +21,22 @@ #endif #include "../common/debug.h" -#include -#include -#include -#include -#include -#include - -#include "masterentity.h" -#include "npc_ai.h" -#include "../common/packet_dump.h" -#include "../common/eq_packet_structs.h" #include "../common/eq_constants.h" +#include "../common/eq_packet_structs.h" +#include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" -#include "zone.h" -#include "string_ids.h" #include "../common/string_util.h" -#include "../common/rulesys.h" +#include "queryserv.h" #include "quest_parser_collection.h" +#include "string_ids.h" #include "water_map.h" #include "worldserver.h" -#include "queryserv.h" +#include "zone.h" + +#include +#include +#include extern QueryServ* QServ; extern WorldServer worldserver; From ad603fd213e429bfea0042c0c7ad3d9d92c42510 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 14:39:27 -0600 Subject: [PATCH 0390/1883] loottable.cpp #include fix, previously reliant on npc.h to get to loottable.h npc.cpp #include cleanup npc.h #include cleanup and forward declaration --- zone/loottables.cpp | 1 + zone/npc.cpp | 50 +++++++++++++++++++++++---------------------- zone/npc.h | 27 ++++++++++++------------ 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 0c66778bd..121dad8c5 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -22,6 +22,7 @@ #include "npc.h" #include "masterentity.h" #include "zonedb.h" +#include "../common/loottable.h" #include "../common/misc_functions.h" #ifdef _WINDOWS #define snprintf _snprintf diff --git a/zone/npc.cpp b/zone/npc.cpp index eae42b670..b8d838d6d 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -15,15 +15,34 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "../common/bodytypes.h" +#include "../common/classes.h" #include "../common/debug.h" -#include -#include -#include -#include -#include "../common/moremath.h" -#include -#include "../common/packet_dump_file.h" +#include "../common/misc_functions.h" +#include "../common/rulesys.h" +#include "../common/seperator.h" +#include "../common/spdat.h" +#include "../common/string_util.h" +#include "../common/clientversions.h" +#include "../common/features.h" // +#include "../common/item.h" // +#include "../common/item_struct.h" // +#include "../common/linked_list.h" // +#include "../common/servertalk.h" + +#include "aa.h" +#include "client.h" +#include "entity.h" +#include "npc.h" +#include "string_ids.h" +#include "spawn2.h" #include "zone.h" + +#include +#include +#include + #ifdef _WINDOWS #define snprintf _snprintf #define strncasecmp _strnicmp @@ -33,27 +52,10 @@ #include #endif -#include "npc.h" -#include "map.h" -#include "entity.h" -#include "masterentity.h" -#include "../common/spdat.h" -#include "../common/bodytypes.h" -#include "spawngroup.h" -#include "../common/misc_functions.h" -#include "../common/string_util.h" -#include "../common/rulesys.h" -#include "string_ids.h" - -//#define SPELLQUEUE //Use only if you want to be spammed by spell testing - - extern Zone* zone; extern volatile bool ZoneLoaded; extern EntityList entity_list; -#include "quest_parser_collection.h" - NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse) : Mob(d->name, d->lastname, diff --git a/zone/npc.h b/zone/npc.h index a88ae9176..cccf3ecf0 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -18,20 +18,17 @@ #ifndef NPC_H #define NPC_H -class NPC; -#include "zonedb.h" -#include "mob.h" -//#include "spawn.h" - -#include -#include - -#include "spawn2.h" -#include "../common/loottable.h" -#include "zonedump.h" -#include "qglobals.h" #include "../common/rulesys.h" +#include "mob.h" +#include "qglobals.h" +#include "zonedb.h" +#include "zonedump.h" + +#include +#include + + #ifdef _WINDOWS #define M_PI 3.141592 #endif @@ -88,8 +85,12 @@ struct AISpellsVar_Struct { uint8 idle_beneficial_chance; }; - class AA_SwarmPetInfo; +class Client; +class Group; +class Raid; +class Spawn2; +struct Item_Struct; class NPC : public Mob { From cb6948b6fd526103b55a538498075d00aa46e303 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:02:34 -0600 Subject: [PATCH 0391/1883] npc.cpp #include cleanup entity.cpp #include cleanup --- zone/entity.cpp | 18 +++++++----------- zone/npc.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 781e1164e..cae20c3ce 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -30,19 +29,16 @@ #include "../common/unix.h" #endif -#include "net.h" -#include "masterentity.h" -#include "worldserver.h" -#include "../common/guilds.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "petitions.h" -#include "../common/spdat.h" #include "../common/features.h" -#include "string_ids.h" +#include "../common/guilds.h" +#include "../common/spdat.h" #include "guild_mgr.h" -#include "raids.h" +#include "net.h" +#include "petitions.h" #include "quest_parser_collection.h" +#include "raids.h" +#include "string_ids.h" +#include "worldserver.h" #ifdef _WINDOWS #define snprintf _snprintf diff --git a/zone/npc.cpp b/zone/npc.cpp index b8d838d6d..b5716e845 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -25,10 +25,10 @@ #include "../common/spdat.h" #include "../common/string_util.h" #include "../common/clientversions.h" -#include "../common/features.h" // -#include "../common/item.h" // -#include "../common/item_struct.h" // -#include "../common/linked_list.h" // +#include "../common/features.h" +#include "../common/item.h" +#include "../common/item_struct.h" +#include "../common/linked_list.h" #include "../common/servertalk.h" #include "aa.h" From 6d52f3c02aa6289d171725c7ddc555373129f77b Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:08:16 -0600 Subject: [PATCH 0392/1883] aa.cpp #include cleanup aa.h #include cleanup --- zone/aa.cpp | 78 ++++++++++------------------------------------------- zone/aa.h | 3 ++- 2 files changed, 16 insertions(+), 65 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 3a3101746..a8c6ff3d0 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -16,84 +16,34 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Test 1 - -#include - -#include "../common/debug.h" -#include "aa.h" -#include "mob.h" -#include "client.h" -#include "groups.h" -#include "raids.h" -#include "../common/spdat.h" -#include "object.h" -#include "doors.h" -#include "beacon.h" -#include "corpse.h" -#include "titles.h" -#include "../common/races.h" #include "../common/classes.h" +#include "../common/debug.h" #include "../common/eq_packet_structs.h" #include "../common/packet_dump.h" +#include "../common/races.h" +#include "../common/spdat.h" #include "../common/string_util.h" -#include "../common/logsys.h" -#include "zonedb.h" -#include "string_ids.h" + +#include "aa.h" +#include "client.h" +#include "corpse.h" +#include "groups.h" +#include "mob.h" #include "queryserv.h" +#include "raids.h" +#include "string_ids.h" +#include "titles.h" +#include "zonedb.h" extern QueryServ* QServ; -//static data arrays, really not big enough to warrant shared mem. + AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS]; //[aaid][rank] std::mapaas_send; std::map > aa_effects; //stores the effects from the aa_effects table in memory std::map AARequiredLevelAndCost; -/* - -Schema: - -spell_id is spell to cast, SPELL_UNKNOWN == no spell -nonspell_action is action to preform on activation which is not a spell, 0=none -nonspell_mana is mana that the nonspell action consumes -nonspell_duration is a duration which may be used by the nonspell action -redux_aa is the aa which reduces the reuse timer of the skill -redux_rate is the multiplier of redux_aa, as a percentage of total rate (10 == 10% faster) - -CREATE TABLE aa_actions ( - aaid mediumint unsigned not null, - rank tinyint unsigned not null, - reuse_time mediumint unsigned not null, - spell_id mediumint unsigned not null, - target tinyint unsigned not null, - nonspell_action tinyint unsigned not null, - nonspell_mana mediumint unsigned not null, - nonspell_duration mediumint unsigned not null, - redux_aa mediumint unsigned not null, - redux_rate tinyint not null, - - PRIMARY KEY(aaid, rank) -); - -CREATE TABLE aa_swarmpets ( - spell_id mediumint unsigned not null, - count tinyint unsigned not null, - npc_id int not null, - duration mediumint unsigned not null, - PRIMARY KEY(spell_id) -); -*/ - -/* - -Credits for this function: - -FatherNitwit: Structure and mechanism - -Wiz: Initial set of AAs, original function contents - -Branks: Much updated info and a bunch of higher-numbered AAs - -*/ int Client::GetAATimerID(aaID activate) { SendAA_Struct* aa2 = zone->FindAA(activate); diff --git a/zone/aa.h b/zone/aa.h index b143aae9a..00f74e8c6 100644 --- a/zone/aa.h +++ b/zone/aa.h @@ -2,7 +2,8 @@ #ifndef AA_H #define AA_H -#include "../common/eq_packet_structs.h" +struct AA_Ability; +struct SendAA_Struct; #define MANA_BURN 664 From 88984a3960a1a194a68ed8d4f304fc3db913e841 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:44:09 -0600 Subject: [PATCH 0393/1883] petitions.cpp #include cleanup petititons.h #include cleanup --- zone/petitions.cpp | 15 +++------------ zone/petitions.h | 10 ++++++---- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index ba57fe7f2..ad38bc04d 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -16,10 +16,6 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/debug.h" -#include -#include -#include -#include #include #ifdef _WINDOWS #include @@ -32,16 +28,12 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #define strncasecmp _strnicmp #define strcasecmp _stricmp #endif -#include "../common/string_util.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "../common/packet_dump_file.h" -#include "../common/emu_opcodes.h" + + #include "../common/eq_packet_structs.h" #include "../common/servertalk.h" +#include "../common/string_util.h" #include "entity.h" -#include "masterentity.h" - #include "petitions.h" #include "worldserver.h" @@ -49,7 +41,6 @@ PetitionList petition_list; extern WorldServer worldserver; - void Petition::SendPetitionToPlayer(Client* clientto) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionCheckout,sizeof(Petition_Struct)); Petition_Struct* pet = (Petition_Struct*) outapp->pBuffer; diff --git a/zone/petitions.h b/zone/petitions.h index 4b68362e0..604d4ddcc 100644 --- a/zone/petitions.h +++ b/zone/petitions.h @@ -19,11 +19,13 @@ #define PETITIONS_H #include "../common/linked_list.h" -#include "../common/types.h" -#include "zonedb.h" -#include "client.h" -#include "../common/mutex.h" #include "../common/misc_functions.h" +#include "../common/mutex.h" +#include "../common/types.h" +#include "client.h" +#include "zonedb.h" + +class Client; class Petition { From 3577ff5a8135a8f29a366bdf410e86c46baa43ab Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:53:17 -0600 Subject: [PATCH 0394/1883] waypoints.cpp #include cleanup --- zone/waypoints.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index cfefe73f3..908f0f946 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -19,21 +19,17 @@ #ifdef _EQDEBUG #include #endif -//#include -#include -#include -#include "npc.h" -#include "masterentity.h" -#include "npc_ai.h" -#include "map.h" -#include "water_map.h" -#include "../common/moremath.h" -#include "string_ids.h" -#include "../common/misc_functions.h" -#include "../common/string_util.h" -#include "../common/rulesys.h" + #include "../common/features.h" +#include "../common/misc_functions.h" +#include "../common/rulesys.h" +#include "../common/string_util.h" +#include "map.h" +#include "npc.h" #include "quest_parser_collection.h" +#include "water_map.h" +#include +#include struct wp_distance { From 2d052a7a283f1617008b60a01cd1890d5eebc834 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:56:51 -0600 Subject: [PATCH 0395/1883] mod_functions.cpp #include cleanup --- zone/mod_functions.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/zone/mod_functions.cpp b/zone/mod_functions.cpp index b948dff38..6ae0eddad 100644 --- a/zone/mod_functions.cpp +++ b/zone/mod_functions.cpp @@ -1,22 +1,15 @@ -#include "../common/debug.h" -#include "../common/timer.h" -#include -#include -#include "spawn2.h" -#include "entity.h" -#include "masterentity.h" -#include "zone.h" -#include "spawngroup.h" -#include "zonedb.h" -#include "npc.h" -#include "mob.h" #include "client.h" +#include "entity.h" +#include "mob.h" +#include "npc.h" #include "worldserver.h" -#include "quest_parser_collection.h" -#include "event_codes.h" -#include "embparser.h" -#include -#include +#include "zone.h" + +class ItemInst; +class Spawn2; +struct Consider_Struct; +struct DBTradeskillRecipe_Struct; +struct Item_Struct; extern EntityList entity_list; extern Zone* zone; From f5ba442ba69dae323e602562ab388cd02fa9fe2f Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 15:59:24 -0600 Subject: [PATCH 0396/1883] spells.cpp #include cleanup --- zone/spells.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 1b78030e6..3bdc3557e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -66,20 +66,19 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) and not SpellFinished(). */ -#include "../common/debug.h" -#include "../common/spdat.h" -#include "masterentity.h" -#include "../common/packet_dump.h" -#include "../common/moremath.h" -#include "../common/item.h" -#include "worldserver.h" -#include "../common/skills.h" #include "../common/bodytypes.h" #include "../common/classes.h" +#include "../common/debug.h" +#include "../common/item.h" #include "../common/rulesys.h" +#include "../common/skills.h" +#include "../common/spdat.h" #include "../common/string_util.h" -#include +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "worldserver.h" #include +#include #ifndef WIN32 #include @@ -90,8 +89,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/packet_dump_file.h" #endif -#include "string_ids.h" -#include "quest_parser_collection.h" + extern Zone* zone; extern volatile bool ZoneLoaded; From c7a79d81ca3100ee097f2fd384f3808bdb0356e7 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:28:48 -0600 Subject: [PATCH 0397/1883] pets.cpp #include cleanup --- zone/pets.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/zone/pets.cpp b/zone/pets.cpp index 1f61b227b..cf9ecab8c 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -15,30 +15,26 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" +#include "../common/misc_functions.h" #include "../common/spdat.h" -#include "masterentity.h" -#include "../common/packet_dump.h" -#include "../common/moremath.h" -#include "../common/item.h" -#include "zonedb.h" -#include "worldserver.h" -#include "../common/skills.h" -#include "../common/bodytypes.h" -#include "../common/classes.h" #include "../common/string_util.h" +#include "../common/types.h" + +#include "entity.h" +#include "client.h" +#include "mob.h" + #include "pets.h" -#include -#include +#include "worldserver.h" +#include "zonedb.h" + #ifndef WIN32 #include #include "../common/unix.h" #endif -#include "string_ids.h" - -/////////////////////////////////////////////////////////////////////////////// -// pet related functions const char *GetRandPetName() { From 9821c7da6518247bf3f1fbd2632b167ef8d7fa72 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:32:49 -0600 Subject: [PATCH 0398/1883] zoning.cpp #include cleanup --- zone/zoning.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 6ac85cff6..71ea65dc8 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -15,17 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "zone.h" -#include "worldserver.h" -#include "masterentity.h" -#include "../common/packet_dump.h" +#include "../common/debug.h" #include "../common/rulesys.h" #include "../common/string_util.h" -#include "string_ids.h" -#include "quest_parser_collection.h" #include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "worldserver.h" +#include "zone.h" extern QueryServ* QServ; extern WorldServer worldserver; From 55620305949a515c4427594d3c33319f1b9bcce3 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:43:19 -0600 Subject: [PATCH 0399/1883] guild.cpp #include cleanup spell_effects.cpp #include cleanup --- zone/guild.cpp | 16 +++------------- zone/spell_effects.cpp | 20 +++++++++----------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/zone/guild.cpp b/zone/guild.cpp index 5f8378d2b..58b0f006e 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -15,23 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "masterentity.h" -#include "worldserver.h" -#include "net.h" + #include "../common/database.h" -#include "../common/spdat.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "petitions.h" -#include "../common/serverinfo.h" -#include "../common/zone_numbers.h" -#include "../common/moremath.h" #include "../common/guilds.h" #include "../common/string_util.h" + #include "guild_mgr.h" -#include "string_ids.h" -#include "npc_ai.h" +#include "worldserver.h" extern WorldServer worldserver; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b55102072..620d2669c 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -15,26 +15,24 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "../common/spdat.h" -#include "masterentity.h" -#include "../common/packet_dump.h" -#include "../common/moremath.h" -#include "../common/item.h" -#include "worldserver.h" -#include "../common/skills.h" + #include "../common/bodytypes.h" #include "../common/classes.h" +#include "../common/debug.h" +#include "../common/item.h" #include "../common/rulesys.h" +#include "../common/skills.h" +#include "../common/spdat.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "worldserver.h" #include -#include + #ifndef WIN32 #include #include "../common/unix.h" #endif -#include "string_ids.h" -#include "quest_parser_collection.h" extern Zone* zone; extern volatile bool ZoneLoaded; From 34b19508207cd2a499d63cef98bc9854850646b4 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:46:43 -0600 Subject: [PATCH 0400/1883] forage.cpp #include cleanup --- zone/forage.cpp | 68 ++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 55 deletions(-) diff --git a/zone/forage.cpp b/zone/forage.cpp index d1008031a..cbb6550db 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -15,75 +15,33 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include -#include -#include - -#ifdef _WINDOWS -#define snprintf _snprintf -#endif - -#include "forage.h" -#include "entity.h" -#include "masterentity.h" -#include "npc.h" -#include "water_map.h" -#include "titles.h" -#include "string_ids.h" #include "../common/misc_functions.h" -#include "../common/string_util.h" #include "../common/rulesys.h" +#include "../common/string_util.h" +#include "entity.h" +#include "forage.h" +#include "npc.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "titles.h" +#include "water_map.h" #include "zonedb.h" + +#include + #ifdef _WINDOWS #define snprintf _snprintf #endif -#include "quest_parser_collection.h" +struct NPCType; //max number of items which can be in the foraging table //for a given zone. #define FORAGE_ITEM_LIMIT 50 -/* - -The fishing and foraging need some work... -foraging currently gives each item an equal chance of dropping -fishing gives items which come in last from the select a very -very low chance of dropping. - - -Schema: -CREATE TABLE forage ( - id int(11) NOT NULL auto_increment, - zoneid int(4) NOT NULL default '0', - Itemid int(11) NOT NULL default '0', - level smallint(6) NOT NULL default '0', - chance smallint(6) NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM; - -old table upgrade: -alter table forage add chance smallint(6) NOT NULL default '0'; -update forage set chance=100; - - -CREATE TABLE fishing ( - id int(11) NOT NULL auto_increment, - zoneid int(4) NOT NULL default '0', - Itemid int(11) NOT NULL default '0', - skill_level smallint(6) NOT NULL default '0', - chance smallint(6) NOT NULL default '0', - npc_id int NOT NULL default 0, - npc_chance int NOT NULL default 0, - PRIMARY KEY (id) -) TYPE=MyISAM; - - -*/ - -// This allows EqEmu to have zone specific foraging - BoB uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { uint32 item[FORAGE_ITEM_LIMIT]; From 4a597a2b38869410ad25fdecb5a93f6ad4ab5996 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:48:48 -0600 Subject: [PATCH 0401/1883] tradeskills.cpp #include cleanup --- zone/tradeskills.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 82d84e5cf..fd9f5a632 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -24,17 +24,14 @@ #include //for htonl #endif -#include "masterentity.h" -#include "zonedb.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "titles.h" -#include "string_ids.h" #include "../common/misc_functions.h" -#include "../common/string_util.h" #include "../common/rulesys.h" -#include "quest_parser_collection.h" +#include "../common/string_util.h" #include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "titles.h" +#include "zonedb.h" extern QueryServ* QServ; From fde9517247ed1ffea4a019d137f928cdbcfe58ae Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 16:55:35 -0600 Subject: [PATCH 0402/1883] mob.cpp #include cleanup mob.h declarations mob.h #include cleanup --- zone/mob.cpp | 14 +++++++------- zone/mob.h | 13 ++++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 35a019252..6772ff432 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -15,17 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "masterentity.h" + #include "../common/spdat.h" -#include "string_ids.h" -#include "worldserver.h" -#include "quest_parser_collection.h" #include "../common/string_util.h" -#include -#include +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "worldserver.h" + #include +#include +#include extern EntityList entity_list; diff --git a/zone/mob.h b/zone/mob.h index 944dfc515..55147ff7a 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -18,21 +18,28 @@ #ifndef MOB_H #define MOB_H -#include "../common/features.h" #include "common.h" #include "entity.h" #include "hate_list.h" #include "pathing.h" #include #include -#include char* strn0cpy(char* dest, const char* source, uint32 size); #define MAX_SPECIAL_ATTACK_PARAMS 8 class EGNode; -class MobFearState; +class Client; +class EQApplicationPacket; +class Group; +class ItemInst; +class NPC; +class Raid; +struct Item_Struct; +struct NewSpawn_Struct; +struct PlayerPositionUpdateServer_Struct; + class Mob : public Entity { public: enum CLIENT_CONN_STATUS { CLIENT_CONNECTING, CLIENT_CONNECTED, CLIENT_LINKDEAD, From 11ecf77c85022082091353a1fff3e0800c568cbc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 26 Nov 2014 21:41:14 -0800 Subject: [PATCH 0403/1883] added constness to operators --- zone/position.cpp | 8 ++++---- zone/position.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/position.cpp b/zone/position.cpp index a5f0cf5f1..d7e0d48f4 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -63,15 +63,15 @@ xyz_heading::operator xy_location() const { return xy_location(m_X,m_Y); } -const xyz_heading xyz_heading::operator +(const xyz_location& rhs) { +const xyz_heading xyz_heading::operator +(const xyz_location& rhs) const{ return xyz_heading(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z, m_Heading); } -const xyz_heading xyz_heading::operator +(const xy_location& rhs) { +const xyz_heading xyz_heading::operator +(const xy_location& rhs) const{ return xyz_heading(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z, m_Heading); } -const xyz_heading xyz_heading::operator -(const xyz_location& rhs) { +const xyz_heading xyz_heading::operator -(const xyz_location& rhs) const{ return xyz_heading(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading); } @@ -92,7 +92,7 @@ xyz_location::operator xy_location() const { return xy_location(m_X, m_Y); } -const xyz_location xyz_location::operator -(const xyz_location& rhs) { +const xyz_location xyz_location::operator -(const xyz_location& rhs) const { return xyz_location(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z); } diff --git a/zone/position.h b/zone/position.h index 900d2cdfe..eadd187ce 100644 --- a/zone/position.h +++ b/zone/position.h @@ -43,7 +43,7 @@ public: operator xy_location() const; - const xyz_location operator -(const xyz_location& rhs); + const xyz_location operator -(const xyz_location& rhs) const; void ABS_XYZ(); bool isOrigin() const { return m_X == 0 && m_Y == 0 && m_Z == 0;} @@ -70,10 +70,10 @@ public: operator xyz_location() const; operator xy_location() const; - const xyz_heading operator +(const xyz_location& rhs); - const xyz_heading operator +(const xy_location& rhs); + const xyz_heading operator +(const xyz_location& rhs) const; + const xyz_heading operator +(const xy_location& rhs) const; - const xyz_heading operator -(const xyz_location& rhs); + const xyz_heading operator -(const xyz_location& rhs) const; bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;} }; From 607e28dcbf61d3f140931be66f15816bb5690f92 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 29 Nov 2014 16:43:24 -0800 Subject: [PATCH 0404/1883] added GetPosition to mob --- zone/mob.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/mob.h b/zone/mob.h index 57da56de5..ff1364e07 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -393,6 +393,7 @@ public: ((static_cast(cur_mana) / max_mana) * 100); } virtual int32 CalcMaxMana(); uint32 GetNPCTypeID() const { return npctype_id; } + inline const xyz_heading GetPosition() const { return m_Position; } inline const float GetX() const { return m_Position.m_X; } inline const float GetY() const { return m_Position.m_Y; } inline const float GetZ() const { return m_Position.m_Z; } From ad2fd9e4d5415f89b4baa17dc1a4029216af4c03 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 29 Nov 2014 21:10:51 -0500 Subject: [PATCH 0405/1883] update to projectile move check --- zone/common.h | 3 ++- zone/mob.cpp | 3 ++- zone/special_attacks.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/zone/common.h b/zone/common.h index 267831368..ddb7b4b0a 100644 --- a/zone/common.h +++ b/zone/common.h @@ -468,7 +468,8 @@ typedef struct float origin_x; float origin_y; float origin_z; - float sanitycheck; + float tlast_x; + float tlast_y; uint32 ranged_id; uint32 ammo_id; int ammo_slot; diff --git a/zone/mob.cpp b/zone/mob.cpp index 7261aeb46..58aafa1cb 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -297,7 +297,8 @@ Mob::Mob(const char* in_name, ProjectileAtk[i].origin_x = 0.0f; ProjectileAtk[i].origin_y = 0.0f; ProjectileAtk[i].origin_z = 0.0f; - ProjectileAtk[i].sanitycheck = 0.0f; + ProjectileAtk[i].tlast_x = 0.0f; + ProjectileAtk[i].tlast_y = 0.0f; ProjectileAtk[i].ranged_id = 0; ProjectileAtk[i].ammo_id = 0; ProjectileAtk[i].ammo_slot = 0; diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index c73a2cb11..0ba5ebe09 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1077,11 +1077,10 @@ void Mob::ProjectileAttack() Mob* target = entity_list.GetMobID(ProjectileAtk[i].target_id); if (target && target->IsMoving()){ //Only recalculate hit increment if target moving - //Due to frequency that we need to check increment the targets position variables may not be updated even if moving. Do a simple check before calculating distance. - float _sanitycheck = target->GetX() * target->GetY(); - if (ProjectileAtk[i].sanitycheck != _sanitycheck){ - ProjectileAtk[i].sanitycheck = _sanitycheck; + if (ProjectileAtk[i].tlast_x != target->GetX() || ProjectileAtk[i].tlast_y != target->GetY()){ + ProjectileAtk[i].tlast_x = target->GetX(); + ProjectileAtk[i].tlast_y = target->GetY(); float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[i].hit_increment = static_cast(hit); @@ -1103,7 +1102,8 @@ void Mob::ProjectileAttack() ProjectileAtk[i].origin_x = 0.0f; ProjectileAtk[i].origin_y = 0.0f; ProjectileAtk[i].origin_z = 0.0f; - ProjectileAtk[i].sanitycheck = 0.0f; + ProjectileAtk[i].tlast_x = 0.0f; + ProjectileAtk[i].tlast_y = 0.0f; ProjectileAtk[i].ranged_id = 0; ProjectileAtk[i].ammo_id = 0; ProjectileAtk[i].ammo_slot = 0; From 4b48ed7cbc69dacc7d3fb661ccadbbc9c6ce021e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 29 Nov 2014 21:07:08 -0800 Subject: [PATCH 0406/1883] SetDeltas converted to SetDelta --- zone/client_packet.cpp | 3 ++- zone/mob.cpp | 4 ++-- zone/mob.h | 2 +- zone/perl_mob.cpp | 7 ++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 70b33dd1b..62f4f12dd 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4360,7 +4360,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) } // set the boat's position deltas - boat->SetDeltas(ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading); + auto boatDelta = xyz_heading(ppu->delta_x, ppu->delta_y, ppu->delta_z, ppu->delta_heading); + boat->SetDelta(boatDelta); // send an update to everyone nearby except the client controlling the boat EQApplicationPacket* outapp = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); PlayerPositionUpdateServer_Struct* ppus = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; diff --git a/zone/mob.cpp b/zone/mob.cpp index 4db71440c..d2cd3d6df 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2928,8 +2928,8 @@ void Mob::TriggerDefensiveProcs(const ItemInst* weapon, Mob *on, uint16 hand, in } } -void Mob::SetDeltas(float dx, float dy, float dz, float dh) { - m_Delta = xyz_heading(dx,dy,dz,dh); +void Mob::SetDelta(const xyz_heading& delta) { + m_Delta = delta; } void Mob::SetEntityVariable(const char *id, const char *m_var) diff --git a/zone/mob.h b/zone/mob.h index ff1364e07..8d42642c3 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -432,7 +432,7 @@ public: bool IsRunning() const { return m_is_running; } void SetRunning(bool val) { m_is_running = val; } virtual void GMMove(float x, float y, float z, float heading = 0.01, bool SendUpdate = true); - void SetDeltas(float delta_x, float delta_y, float delta_z, float delta_h); + void SetDelta(const xyz_heading& delta); void SetTargetDestSteps(uint8 target_steps) { tar_ndx = target_steps; } void SendPosUpdate(uint8 iSendToSelf = 0); void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index f41685a1c..23694bf4a 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -7632,10 +7632,7 @@ XS(XS_Mob_SetDeltas) Perl_croak(aTHX_ "Usage: Mob::SetDeltas(THIS, delta_x, delta_y, delta_z, delta_h)"); { Mob * THIS; - float delta_x = (float)SvNV(ST(1)); - float delta_y = (float)SvNV(ST(2)); - float delta_z = (float)SvNV(ST(3)); - float delta_h = (float)SvNV(ST(4)); + auto delta = xyz_heading((float)SvNV(ST(1)), (float)SvNV(ST(2)), (float)SvNV(ST(3)), (float)SvNV(ST(4))); if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -7646,7 +7643,7 @@ XS(XS_Mob_SetDeltas) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetDeltas(delta_x, delta_y, delta_z, delta_h); + THIS->SetDelta(delta); } XSRETURN_EMPTY; } From 0d0917b779f3acfba564fb201d83d408d78c4299 Mon Sep 17 00:00:00 2001 From: akkadius Date: Sat, 29 Nov 2014 23:12:09 -0600 Subject: [PATCH 0407/1883] Temporary revert of net.cpp to wave 1 of cleanups --- zone/net.cpp | 92 +++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index e82a29bca..9b4080eb2 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -18,39 +18,57 @@ #define DONT_SHARED_OPCODES - -#include "../common/crash.h" #include "../common/debug.h" -#include "../common/eq_stream_factory.h" -#include "../common/eq_stream_ident.h" -#include "../common/eqemu_error.h" -#include "../common/eqemu_exception.h" #include "../common/features.h" +#include "../common/queue.h" +#include "../common/timer.h" +#include "../common/eq_stream.h" +#include "../common/eq_stream_factory.h" +#include "../common/eq_packet_structs.h" +#include "../common/mutex.h" +#include "../common/version.h" +#include "../common/eqemu_error.h" +#include "../common/packet_dump_file.h" +#include "../common/opcodemgr.h" +#include "../common/guilds.h" +#include "../common/eq_stream_ident.h" +#include "../common/patches/patches.h" +#include "../common/rulesys.h" +#include "../common/misc_functions.h" +#include "../common/string_util.h" +#include "../common/platform.h" +#include "../common/crash.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" -#include "../common/patches/patches.h" -#include "../common/platform.h" -#include "../common/rulesys.h" +#include "../common/eqemu_exception.h" #include "../common/spdat.h" -#include "../common/timer.h" -#include "../common/version.h" -#include "client_logs.h" -#include "command.h" -#include "embparser.h" -#include "guild_mgr.h" -#include "lua_parser.h" -#include "net.h" -#include "queryserv.h" -#include "quest_parser_collection.h" -#include "questmgr.h" -#include "tasks.h" -#include "titles.h" -#include "worldserver.h" #include "zone_config.h" +#include "masterentity.h" +#include "worldserver.h" +#include "net.h" #include "zone.h" +#include "queryserv.h" +#include "command.h" +#include "zone_config.h" +#include "titles.h" +#include "guild_mgr.h" +#include "tasks.h" +#include "quest_parser_collection.h" +#include "embparser.h" +#include "lua_parser.h" +#include "client_logs.h" +#include "questmgr.h" + +#include +#include +#include + +#include +#include #include +#include #ifdef _CRTDBG_MAP_ALLOC #undef new @@ -68,25 +86,20 @@ volatile bool RunLoops = true; extern volatile bool ZoneLoaded; -class EQStream; -class EQStreamInterface; - -char errorname[32]; -EntityList entity_list; -EQStreamFactory eqsf(ZoneStream); -extern Zone* zone; -NetConnection net; -npcDecayTimes_Struct npcCorpseDecayTimes[100]; -QueryServ *QServ = 0; -QuestParserCollection *parse = 0; -TaskManager *taskmanager = 0; TimeoutManager timeout_manager; -TitleManager title_manager; +NetConnection net; +EntityList entity_list; WorldServer worldserver; - -uint16 adverrornum = 0; uint32 numclients = 0; - +char errorname[32]; +uint16 adverrornum = 0; +extern Zone* zone; +EQStreamFactory eqsf(ZoneStream); +npcDecayTimes_Struct npcCorpseDecayTimes[100]; +TitleManager title_manager; +QueryServ *QServ = 0; +TaskManager *taskmanager = 0; +QuestParserCollection *parse = 0; const SPDat_Spell_Struct* spells; void LoadSpells(EQEmu::MemoryMappedFile **mmf); @@ -629,4 +642,3 @@ void UpdateWindowTitle(char* iNewTitle) { SetConsoleTitle(tmp); #endif } - From 82cc830297cd65283bbb80f81a18a42122cdbad5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 29 Nov 2014 21:24:57 -0800 Subject: [PATCH 0408/1883] converted Warp to xyz_location instead of x,y,z --- zone/bot.cpp | 6 +++--- zone/mob.cpp | 14 +++++--------- zone/mob.h | 2 +- zone/position.cpp | 8 -------- zone/position.h | 1 - 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 2a8921dd7..f2bde8980 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10715,12 +10715,12 @@ void Bot::BotGroupSummon(Group* group, Client* client) { if(botMember->GetBotOwnerCharacterID() == client->CharacterID()) { botMember->SetTarget(botMember->GetBotOwner()); botMember->WipeHateList(); - botMember->Warp(botMember->GetBotOwner()->GetX(), botMember->GetBotOwner()->GetY(), botMember->GetBotOwner()->GetZ()); + botMember->Warp(botMember->GetBotOwner()->GetPosition()); if(botMember->HasPet() && botMember->GetPet()) { botMember->GetPet()->SetTarget(botMember); botMember->GetPet()->WipeHateList(); - botMember->GetPet()->Warp(botMember->GetBotOwner()->GetX(), botMember->GetBotOwner()->GetY(), botMember->GetBotOwner()->GetZ()); + botMember->GetPet()->Warp(botMember->GetBotOwner()->GetPosition()); } } } @@ -11729,7 +11729,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { else { b->SetTarget(c->CastToMob()); - b->Warp(c->GetX(), c->GetY(), c->GetZ()); + b->Warp(c->GetPosition()); } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index d2cd3d6df..48aee2260 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2590,20 +2590,16 @@ void Mob::SetNextIncHPEvent( int inchpevent ) nextinchpevent = inchpevent; } //warp for quest function,from sandy -void Mob::Warp( float x, float y, float z ) +void Mob::Warp(const xyz_location& location) { - if(IsNPC()) { - entity_list.ProcessMove(CastToNPC(), x, y, z); - } + if(IsNPC()) + entity_list.ProcessMove(CastToNPC(), location.m_X, location.m_Y, location.m_Z); - m_Position.m_X = x; - m_Position.m_Y = y; - m_Position.m_Z = z; + m_Position = location; Mob* target = GetTarget(); - if (target) { + if (target) FaceTarget( target ); - } SendPosition(); } diff --git a/zone/mob.h b/zone/mob.h index 8d42642c3..cf904a97d 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -420,7 +420,7 @@ public: virtual inline int32 GetPrimaryFaction() const { return 0; } //Movement - void Warp( float x, float y, float z ); + void Warp(const xyz_location& location); inline bool IsMoving() const { return moving; } virtual void SetMoving(bool move) { moving = move; m_Delta = xyz_heading::Origin(); } virtual void GoToBind(uint8 bindnum = 0) { } diff --git a/zone/position.cpp b/zone/position.cpp index d7e0d48f4..2d7d48cf8 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -40,14 +40,6 @@ xyz_heading::xyz_heading(const xy_location& locationDir, float z, float heading) m_Heading(heading) { } - -xyz_heading::xyz_heading(const xyz_location locationDir, float heading) : - m_X(locationDir.m_X), - m_Y(locationDir.m_Y), - m_Z(locationDir.m_Z), - m_Heading(heading) { -} - xyz_heading::xyz_heading(const xy_location locationDir, float z, float heading) : m_X(locationDir.m_X), m_Y(locationDir.m_Y), diff --git a/zone/position.h b/zone/position.h index eadd187ce..591c14b10 100644 --- a/zone/position.h +++ b/zone/position.h @@ -63,7 +63,6 @@ public: xyz_heading(float x = 0.0f, float y = 0.0f, float z = 0.0f, float heading = 0.0f); xyz_heading(const xyz_heading& locationDir); xyz_heading(const xyz_location& locationDir, float heading = 0.0f); - xyz_heading(const xyz_location locationDir, float heading = 0.0f); explicit xyz_heading(const xy_location& locationDir, float z, float heading); explicit xyz_heading(const xy_location locationDir, float z, float heading); From e04496188b118e56ce2dbc4a5d7a0ee4ffde6f63 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 30 Nov 2014 01:43:51 -0500 Subject: [PATCH 0409/1883] Spell Projectiles have been revamped to use new system. --- zone/client_process.cpp | 3 --- zone/common.h | 1 + zone/mob.cpp | 53 ++-------------------------------------- zone/mob.h | 17 ++++--------- zone/mob_ai.cpp | 1 - zone/npc.cpp | 3 +-- zone/special_attacks.cpp | 36 +++++++++++++++------------ zone/spell_effects.cpp | 47 ++++++++++++++++++++--------------- 8 files changed, 57 insertions(+), 104 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index dfadde437..c2e3ae1f3 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -566,9 +566,6 @@ bool Client::Process() { } ProjectileAttack(); - - if(projectile_timer.Check()) - SpellProjectileEffect(); if(spellbonuses.GravityEffect == 1) { if(gravity_timer.Check()) diff --git a/zone/common.h b/zone/common.h index ddb7b4b0a..477d5b876 100644 --- a/zone/common.h +++ b/zone/common.h @@ -474,6 +474,7 @@ typedef struct uint32 ammo_id; int ammo_slot; uint8 skill; + float speed_mod; } tProjatk; //eventually turn this into a typedef and diff --git a/zone/mob.cpp b/zone/mob.cpp index 58aafa1cb..afb9889fe 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -279,14 +279,6 @@ Mob::Mob(const char* in_name, casting_spell_inventory_slot = 0; target = 0; - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_spell_id[i] = 0; } - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_target_id[i] = 0; } - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_increment[i] = 0; } - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_x[i] = 0; } - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_y[i] = 0; } - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { projectile_z[i] = 0; } - projectile_timer.Disable(); - ActiveProjectileATK = false; for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { @@ -303,6 +295,8 @@ Mob::Mob(const char* in_name, ProjectileAtk[i].ammo_id = 0; ProjectileAtk[i].ammo_slot = 0; ProjectileAtk[i].skill = 0; + ProjectileAtk[i].speed_mod = 0.0f; + } memset(&itembonuses, 0, sizeof(StatBonuses)); @@ -4253,49 +4247,6 @@ bool Mob::TryReflectSpell(uint32 spell_id) return false; } -void Mob::SpellProjectileEffect() -{ - bool time_disable = false; - - for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { - - if (projectile_increment[i] == 0){ - continue; - } - - Mob* target = entity_list.GetMobID(projectile_target_id[i]); - - float dist = 0; - - if (target) - dist = target->CalculateDistance(projectile_x[i], projectile_y[i], projectile_z[i]); - - int increment_end = 0; - increment_end = static_cast(dist / 10) - 1; //This pretty accurately determines end time for speed for 1.5 and timer of 250 ms - - if (increment_end <= projectile_increment[i]){ - - if (target && IsValidSpell(projectile_spell_id[i])) - SpellOnTarget(projectile_spell_id[i], target, false, true, spells[projectile_spell_id[i]].ResistDiff, true); - - projectile_spell_id[i] = 0; - projectile_target_id[i] = 0; - projectile_x[i] = 0, projectile_y[i] = 0, projectile_z[i] = 0; - projectile_increment[i] = 0; - time_disable = true; - } - - else { - projectile_increment[i]++; - time_disable = false; - } - } - - if (time_disable) - projectile_timer.Disable(); -} - - void Mob::DoGravityEffect() { Mob *caster = nullptr; diff --git a/zone/mob.h b/zone/mob.h index 49c37d783..0e04c43b1 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -237,8 +237,7 @@ public: uint16 CastingSpellID() const { return casting_spell_id; } bool DoCastingChecks(); bool TryDispel(uint8 caster_level, uint8 buff_level, int level_modifier); - void SpellProjectileEffect(); - bool TrySpellProjectile(Mob* spell_target, uint16 spell_id); + bool TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed = 1.5f); void ResourceTap(int32 damage, uint16 spell_id); void TryTriggerThreshHold(int32 damage, int effect_id, Mob* attacker); bool CheckSpellCategory(uint16 spell_id, int category_id, int effect_id); @@ -729,10 +728,10 @@ public: int32 ReduceAllDamage(int32 damage); virtual void DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int32 min_damage = 1, int32 hate_override = -1, int ReuseTime = 10, bool HitChance=false, bool CanAvoid=true); - virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0); + virtual void DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const Item_Struct* AmmoItem=nullptr, uint16 weapon_damage=0, int16 chance_mod=0,int16 focus=0, int ReuseTime=0, uint32 range_id=0, int AmmoSlot=0, float speed = 4.0f); virtual void DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse, int16 chance_mod=0, int16 focus=0, bool CanRiposte=false, int ReuseTime=0); - virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0); - bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot); + virtual void DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon=nullptr, const ItemInst* Ammo=nullptr, uint16 weapon_damage=0, int16 chance_mod=0, int16 focus=0, int ReuseTime=0, uint32 range_id=0, uint32 ammo_id=0, const Item_Struct *AmmoItem=nullptr, int AmmoSlot=0, float speed= 4.0f); + bool TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed); void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } @@ -851,7 +850,7 @@ public: // HP Event inline int GetNextHPEvent() const { return nexthpevent; } void SetNextHPEvent( int hpevent ); - void SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse); + void SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse, float velocity= 4.0); inline int& GetNextIncHPEvent() { return nextinchpevent; } void SetNextIncHPEvent( int inchpevent ); @@ -1101,12 +1100,6 @@ protected: uint8 bardsong_slot; uint32 bardsong_target_id; - Timer projectile_timer; - uint32 projectile_spell_id[MAX_SPELL_PROJECTILE]; - uint16 projectile_target_id[MAX_SPELL_PROJECTILE]; - uint8 projectile_increment[MAX_SPELL_PROJECTILE]; - float projectile_x[MAX_SPELL_PROJECTILE], projectile_y[MAX_SPELL_PROJECTILE], projectile_z[MAX_SPELL_PROJECTILE]; - bool ActiveProjectileATK; tProjatk ProjectileAtk[MAX_SPELL_PROJECTILE]; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 614ba984d..30f435dfa 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -597,7 +597,6 @@ void Mob::AI_ShutDown() { tic_timer.Disable(); mana_timer.Disable(); spellend_timer.Disable(); - projectile_timer.Disable(); rewind_timer.Disable(); bindwound_timer.Disable(); stunned_timer.Disable(); diff --git a/zone/npc.cpp b/zone/npc.cpp index b5716e845..17ab9ed48 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -670,8 +670,7 @@ bool NPC::Process() viral_timer_counter = 0; } - if(projectile_timer.Check()) - SpellProjectileEffect(); + ProjectileAttack(); if(spellbonuses.GravityEffect == 1) { if(gravity_timer.Check()) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 0ba5ebe09..481599bac 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -596,7 +596,6 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; ++i) { ItemInst *aug = wpn->GetAugment(i); - if(aug) { backstab_dmg += aug->GetItem()->BackstabDmg; } @@ -806,7 +805,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const ItemInst* Ammo, uint16 weapon_damage, int16 chance_mod, int16 focus, int ReuseTime, - uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem, int AmmoSlot) { + uint32 range_id, uint32 ammo_id, const Item_Struct *AmmoItem, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -870,7 +869,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot); + TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); return; } else @@ -895,7 +894,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite WDmg = weapon_damage; if (LaunchProjectile){//1: Shoot the Projectile once we calculate weapon damage. - TryProjectileAttack(other, AmmoItem, SkillArchery, WDmg, RangeWeapon, Ammo, AmmoSlot); + TryProjectileAttack(other, AmmoItem, SkillArchery, WDmg, RangeWeapon, Ammo, AmmoSlot, speed); return; } @@ -1010,7 +1009,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot){ +bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes skillInUse, uint16 weapon_dmg, const ItemInst* RangeWeapon, const ItemInst* Ammo, int AmmoSlot, float speed){ if (!other) return false; @@ -1024,12 +1023,15 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes break; } } - + speed = 2.0f; + Shout("Speed %.2f", speed); if (slot < 0) return false; + float speed_mod = speed * 0.45f; + float distance = other->CalculateDistance(GetX(), GetY(), GetZ()); - float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) + float hit = 60.0f + (distance / speed_mod); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[slot].increment = 1; ProjectileAtk[slot].hit_increment = static_cast(hit); //This projected hit time if target does NOT MOVE @@ -1047,13 +1049,14 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes ProjectileAtk[slot].ammo_slot = 0; ProjectileAtk[slot].skill = skillInUse; + ProjectileAtk[slot].speed_mod = speed_mod; SetProjectileAttack(true); if(item) - SendItemAnimation(other, item, skillInUse); + SendItemAnimation(other, item, skillInUse, speed); else if (IsNPC()) - ProjectileAnimation(other, 0,false,0,0,0,0,CastToNPC()->GetAmmoIDfile(),skillInUse); + ProjectileAnimation(other, 0,false,speed,0,0,0,CastToNPC()->GetAmmoIDfile(),skillInUse); return true; } @@ -1082,7 +1085,7 @@ void Mob::ProjectileAttack() ProjectileAtk[i].tlast_x = target->GetX(); ProjectileAtk[i].tlast_y = target->GetY(); float distance = target->CalculateDistance(ProjectileAtk[i].origin_x, ProjectileAtk[i].origin_y, ProjectileAtk[i].origin_z); - float hit = 60.0f + (distance / 1.8f); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) + float hit = 60.0f + (distance / ProjectileAtk[i].speed_mod); //Calcuation: 60 = Animation Lag, 1.8 = Speed modifier for speed of (4) ProjectileAtk[i].hit_increment = static_cast(hit); } } @@ -1094,6 +1097,8 @@ void Mob::ProjectileAttack() DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); else if (ProjectileAtk[i].skill == SkillThrowing) DoThrowingAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0, ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_slot); + else if (ProjectileAtk[i].skill == SkillConjuration && IsValidSpell(ProjectileAtk[i].wpn_dmg)) + SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); } ProjectileAtk[i].increment = 0; @@ -1108,6 +1113,7 @@ void Mob::ProjectileAttack() ProjectileAtk[i].ammo_id = 0; ProjectileAtk[i].ammo_slot = 0; ProjectileAtk[i].skill = 0; + ProjectileAtk[i].speed_mod = 0.0f; } else { @@ -1355,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 CommonBreakInvisible(); } -void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* AmmoItem, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot) +void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Item_Struct* AmmoItem, uint16 weapon_damage, int16 chance_mod,int16 focus, int ReuseTime, uint32 range_id, int AmmoSlot, float speed) { if ((other == nullptr || ((IsClient() && CastToClient()->dead) || @@ -1406,7 +1412,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (ProjectileMiss || !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot); + TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; } else @@ -1423,7 +1429,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite WDmg = GetWeaponDamage(other, AmmoItem); if (LaunchProjectile){ - TryProjectileAttack(other, AmmoItem, SkillThrowing, WDmg, RangeWeapon, nullptr, AmmoSlot); + TryProjectileAttack(other, AmmoItem, SkillThrowing, WDmg, RangeWeapon, nullptr, AmmoSlot, speed); return; } } @@ -1488,7 +1494,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite } } -void Mob::SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse) { +void Mob::SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skillInUse, float velocity) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_SomeItemPacketMaybe, sizeof(Arrow_Struct)); Arrow_Struct *as = (Arrow_Struct *) outapp->pBuffer; as->type = 1; @@ -1516,7 +1522,7 @@ void Mob::SendItemAnimation(Mob *to, const Item_Struct *item, SkillUseTypes skil Arc causes the object to form an arc in motion. A value too high will */ - as->velocity = 4.0; + as->velocity = velocity; //these angle and tilt used together seem to make the arrow/knife throw as straight as I can make it diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 620d2669c..79fe70e00 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -6400,17 +6400,16 @@ bool Mob::PassCastRestriction(bool UseCastRestriction, int16 value, bool IsDama return false; } -bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id){ +bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed){ /*For mage 'Bolt' line and other various spells. -This is mostly accurate for how the modern clients handle this effect. -It was changed at some point to use an actual projectile as done here (opposed to a particle effect in classic) - -The projectile graphic appears to be that of 'Ball of Sunlight' ID 80648 and will be visible to anyone in SoF+ -There is no LOS check to prevent a bolt from being cast. If you don't have LOS your bolt simply goes into whatever barrier and you lose your mana. If there is LOS the bolt will lock onto your target and the damage is applied when it hits the target. -If your target moves the bolt moves with it in any direction or angle (consistent with other projectiles). - -The way this is written once a bolt is cast a timer checks the distance from the initial cast to the target repeatedly - and calculates at what predicted time the bolt should hit that target in client_process (therefore accounting for any target movement). + -The way this is written once a bolt is cast a the distance from the initial cast to the target repeatedly + check and if target is moving recalculates at what predicted time the bolt should hit that target in client_process When bolt hits its predicted point the damage is then done to target. Note: Projectile speed of 1 takes 3 seconds to go 100 distance units. Calculations are based on this constant. Live Bolt speed: Projectile speed of X takes 5 seconds to go 300 distance units. @@ -6422,31 +6421,41 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id){ return false; uint8 anim = spells[spell_id].CastingAnim; - int bolt_id = -1; + int slot = -1; //Make sure there is an avialable bolt to be cast. for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { - if (projectile_spell_id[i] == 0){ - bolt_id = i; + if (ProjectileAtk[slot].target_id == 0){ + slot = i; break; } } - if (bolt_id < 0) + if (slot < 0) return false; if (CheckLosFN(spell_target)) { - projectile_spell_id[bolt_id] = spell_id; - projectile_target_id[bolt_id] = spell_target->GetID(); - projectile_x[bolt_id] = GetX(), projectile_y[bolt_id] = GetY(), projectile_z[bolt_id] = GetZ(); - projectile_increment[bolt_id] = 1; - projectile_timer.Start(250); + float speed_mod = speed * 0.45f; //Constant for adjusting speeds to match calculated impact time. + float distance = spell_target->CalculateDistance(GetX(), GetY(), GetZ()); + float hit = 60.0f + (distance / speed_mod); + + ProjectileAtk[slot].increment = 1; + ProjectileAtk[slot].hit_increment = static_cast(hit); //This projected hit time if target does NOT MOVE + ProjectileAtk[slot].target_id = spell_target->GetID(); + ProjectileAtk[slot].wpn_dmg = spell_id; //Store spell_id in weapon damage field + ProjectileAtk[slot].origin_x = GetX(); + ProjectileAtk[slot].origin_y = GetY(); + ProjectileAtk[slot].origin_z = GetZ(); + ProjectileAtk[slot].skill = SkillConjuration; + ProjectileAtk[slot].speed_mod = speed_mod; + + SetProjectileAttack(true); } //This will use the correct graphic as defined in the player_1 field of spells_new table. Found in UF+ spell files. if (RuleB(Spells, UseLiveSpellProjectileGFX)) { - ProjectileAnimation(spell_target,0, false, 1.5,0,0,0, spells[spell_id].player_1); + ProjectileAnimation(spell_target,0, false, speed,0,0,0, spells[spell_id].player_1); } //This allows limited support for server using older spell files that do not contain data for bolt graphics. @@ -6456,19 +6465,17 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id){ if (IsClient()){ if (CastToClient()->GetClientVersionBit() <= 4) //Titanium needs alternate graphic. - ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_Titanium)), false, 1.5); + ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_Titanium)), false, speed); else - ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_SOF)), false, 1.5); + ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_SOF)), false, speed); } else - ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_NPC)), false, 1.5); - + ProjectileAnimation(spell_target,(RuleI(Spells, FRProjectileItem_NPC)), false, speed); } - //Default to an arrow if not using a mage bolt (Use up to date spell file and enable above rules for best results) else - ProjectileAnimation(spell_target,0, 1, 1.5); + ProjectileAnimation(spell_target,0, 1, speed); } if (spells[spell_id].CastingAnim == 64) From 8dfd61bbcf71e1447a784615413df1e335c21105 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 30 Nov 2014 01:58:23 -0500 Subject: [PATCH 0410/1883] fix --- zone/mob.cpp | 1 - zone/special_attacks.cpp | 3 +-- zone/spell_effects.cpp | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index afb9889fe..e56f3839c 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -296,7 +296,6 @@ Mob::Mob(const char* in_name, ProjectileAtk[i].ammo_slot = 0; ProjectileAtk[i].skill = 0; ProjectileAtk[i].speed_mod = 0.0f; - } memset(&itembonuses, 0, sizeof(StatBonuses)); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 481599bac..cf6a83c80 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1023,8 +1023,7 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes break; } } - speed = 2.0f; - Shout("Speed %.2f", speed); + if (slot < 0) return false; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 79fe70e00..d3ef1145d 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -6425,7 +6425,7 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed){ //Make sure there is an avialable bolt to be cast. for (int i = 0; i < MAX_SPELL_PROJECTILE; i++) { - if (ProjectileAtk[slot].target_id == 0){ + if (ProjectileAtk[i].target_id == 0){ slot = i; break; } @@ -6433,7 +6433,7 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed){ if (slot < 0) return false; - + if (CheckLosFN(spell_target)) { float speed_mod = speed * 0.45f; //Constant for adjusting speeds to match calculated impact time. From de84065cde04a46b66a6b6cefb6f764dcedea69f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 30 Nov 2014 02:32:11 -0500 Subject: [PATCH 0411/1883] Fix some debug statements --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 8f2450621..e2884e738 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -460,10 +460,10 @@ int Client::HandlePacket(const EQApplicationPacket *app) mlog(CLIENT__NET_ERR, "Unhandled incoming opcode: %s", buffer); if(app->size < 1000) - DumpPacket(app->pBuffer, app->size); + DumpPacket(app, app->size); else{ std::cout << "Dump limited to 1000 characters:\n"; - DumpPacket(app->pBuffer, 1000); + DumpPacket(app, 1000); } #endif break; From 6ffd7203ffa8df7b76288f994d40f690f7a56561 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 13:51:57 -0800 Subject: [PATCH 0412/1883] org_x, org_y, org_z, and org_heading converted to xyz_heading as m_SpawnPoint --- zone/command.cpp | 5 +++-- zone/npc.cpp | 17 +++++++---------- zone/npc.h | 28 ++++++++++++++-------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 7499edd6b..1dfab5bb0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1800,10 +1800,11 @@ void command_gassign(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && c->GetTarget() && c->GetTarget()->IsNPC()) { + auto npcBind = c->GetTarget()->CastToNPC()->m_SpawnPoint; database.AssignGrid( c, - (c->GetTarget()->CastToNPC()->org_x), - (c->GetTarget()->CastToNPC()->org_y), + npcBind.m_X, + npcBind.m_Y, atoi(sep->arg[1]) ); } diff --git a/zone/npc.cpp b/zone/npc.cpp index eae42b670..147d275f9 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -113,7 +113,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float qglobal_purge_timer(30000), sendhpupdate_timer(1000), enraged_timer(1000), - taunt_timer(TauntReuseTime * 1000) + taunt_timer(TauntReuseTime * 1000), + m_SpawnPoint(x,y,z,heading) { //What is the point of this, since the names get mangled.. Mob* mob = entity_list.GetMob(name); @@ -203,9 +204,6 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float MerchantType = d->merchanttype; merchant_open = GetClass() == MERCHANT; adventure_template_id = d->adventure_template; - org_x = x; - org_y = y; - org_z = z; flymode = iflymode; guard_x = -1; //just some value we might be able to recongize as "unset" guard_y = -1; @@ -221,7 +219,6 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float roambox_movingto_y = -2; roambox_min_delay = 1000; roambox_delay = 1000; - org_heading = heading; p_depop = false; loottable_id = d->loottable_id; @@ -1853,7 +1850,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) { swarmOwner = entity_list.GetMobID(GetSwarmOwner()); } - + if (swarmOwner != nullptr) { if(swarmOwner->IsClient()) @@ -1873,7 +1870,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) SetTempPet(true); //Simple mob flag for checking if temp pet swarmOwner->SetTempPetsActive(true); //Necessary fail safe flag set if mob ever had a swarm pet to ensure they are removed. swarmOwner->SetTempPetCount(swarmOwner->GetTempPetCount() + 1); - + //Not recommended if using above (However, this will work better on older clients). if (RuleB(Pets, UnTargetableSwarmPet)) { @@ -1881,7 +1878,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) if(!IsCharmed() && swarmOwner->IsClient()) sprintf(ns->spawn.lastName, "%s's Pet", swarmOwner->GetName()); } - } + } else if(GetOwnerID()) { ns->spawn.is_pet = 1; @@ -2430,7 +2427,7 @@ void NPC::DepopSwarmPets() Mob* owner = entity_list.GetMobID(GetSwarmInfo()->owner_id); if (owner) owner->SetTempPetCount(owner->GetTempPetCount() - 1); - + Depop(); return; } @@ -2448,4 +2445,4 @@ void NPC::DepopSwarmPets() } } } -} \ No newline at end of file +} diff --git a/zone/npc.h b/zone/npc.h index 71e6596ad..1770219ba 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -67,10 +67,10 @@ struct AISpells_Struct { }; struct AISpellsEffects_Struct { - uint16 spelleffectid; - int32 base; - int32 limit; - int32 max; + uint16 spelleffectid; + int32 base; + int32 limit; + int32 max; }; struct AISpellsVar_Struct { @@ -86,7 +86,7 @@ struct AISpellsVar_Struct { uint32 idle_no_sp_recast_min; uint32 idle_no_sp_recast_max; uint8 idle_beneficial_chance; -}; +}; class AA_SwarmPetInfo; @@ -163,7 +163,7 @@ public: FACTION_VALUE CheckNPCFactionAlly(int32 other_faction); virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther); - void GoToBind(uint8 bindnum = 0) { GMMove(org_x, org_y, org_z, org_heading); } + void GoToBind(uint8 bindnum = 0) { GMMove(m_SpawnPoint.m_X, m_SpawnPoint.m_Y, m_SpawnPoint.m_Z, m_SpawnPoint.m_Heading); } void Gate(); void GetPetState(SpellBuff_Struct *buffs, uint32 *items, char *name); @@ -211,10 +211,10 @@ public: uint32 GetSp2() const { return spawn_group; } uint32 GetSpawnPointID() const; - float GetSpawnPointX() const { return org_x; } - float GetSpawnPointY() const { return org_y; } - float GetSpawnPointZ() const { return org_z; } - float GetSpawnPointH() const { return org_heading; } + float GetSpawnPointX() const { return m_SpawnPoint.m_X; } + float GetSpawnPointY() const { return m_SpawnPoint.m_Y; } + float GetSpawnPointZ() const { return m_SpawnPoint.m_Z; } + float GetSpawnPointH() const { return m_SpawnPoint.m_Heading; } float GetGuardPointX() const { return guard_x; } float GetGuardPointY() const { return guard_y; } float GetGuardPointZ() const { return guard_z; } @@ -255,7 +255,7 @@ public: void SetNPCFactionID(int32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); } - float org_x, org_y, org_z, org_heading; + xyz_heading m_SpawnPoint; uint32 GetMaxDMG() const {return max_dmg;} uint32 GetMinDMG() const {return min_dmg;} @@ -385,7 +385,7 @@ public: inline void SetHealScale(float amt) { healscale = amt; } inline float GetHealScale() { return healscale; } - + inline void SetSpellFocusDMG(int32 NewSpellFocusDMG) {SpellFocusDMG = NewSpellFocusDMG;} inline int32 GetSpellFocusDMG() const { return SpellFocusDMG;} @@ -443,7 +443,7 @@ protected: virtual bool AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes); virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0); AISpellsVar_Struct AISpellVar; - + uint32 npc_spells_effects_id; std::vector AIspellsEffects; bool HasAISpellEffects; @@ -510,7 +510,7 @@ protected: //mercenary stuff std::list mercTypeList; std::list mercDataList; - + bool raid_target; uint8 probability; From 4b71d28747e71738dd319aa60a68a70f5ea5d78a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 14:17:14 -0800 Subject: [PATCH 0413/1883] guard_x, guard_y, guard_z, guard_heading converted to xyz_heading as m_GuardPoint --- zone/mob_ai.cpp | 10 ++++----- zone/npc.cpp | 11 ++++------ zone/npc.h | 12 +++++------ zone/waypoints.cpp | 54 ++++++++++++++++++++-------------------------- 4 files changed, 38 insertions(+), 49 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index b727d20b2..9c720957e 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1787,13 +1787,13 @@ void NPC::AI_DoMovement() { { bool CP2Moved; if(!RuleB(Pathing, Guard) || !zone->pathing) - CP2Moved = CalculateNewPosition2(guard_x, guard_y, guard_z, walksp); + CP2Moved = CalculateNewPosition2(m_GuardPoint.m_X, m_GuardPoint.m_Y, m_GuardPoint.m_Z, walksp); else { - if(!((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z))) + if(!((m_Position.m_X == m_GuardPoint.m_X) && (m_Position.m_Y == m_GuardPoint.m_Y) && (m_Position.m_Z == m_GuardPoint.m_Z))) { bool WaypointChanged, NodeReached; - Map::Vertex Goal = UpdatePath(guard_x, guard_y, guard_z, walksp, WaypointChanged, NodeReached); + Map::Vertex Goal = UpdatePath(m_GuardPoint.m_X, m_GuardPoint.m_Y, m_GuardPoint.m_Z, walksp, WaypointChanged, NodeReached); if(WaypointChanged) tar_ndx = 20; @@ -1809,13 +1809,13 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", m_GuardPoint.m_X, m_GuardPoint.m_Y, m_GuardPoint.m_Z); ClearFeignMemory(); moved=false; SetMoving(false); if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 ) { - SetHeading(guard_heading); + SetHeading(m_GuardPoint.m_Heading); } else { FaceTarget(GetTarget()); } diff --git a/zone/npc.cpp b/zone/npc.cpp index 147d275f9..4469292f6 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -114,7 +114,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float sendhpupdate_timer(1000), enraged_timer(1000), taunt_timer(TauntReuseTime * 1000), - m_SpawnPoint(x,y,z,heading) + m_SpawnPoint(x,y,z,heading), + m_GuardPoint(-1,-1,-1,0) { //What is the point of this, since the names get mangled.. Mob* mob = entity_list.GetMob(name); @@ -205,10 +206,6 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float merchant_open = GetClass() == MERCHANT; adventure_template_id = d->adventure_template; flymode = iflymode; - guard_x = -1; //just some value we might be able to recongize as "unset" - guard_y = -1; - guard_z = -1; - guard_heading = 0; guard_anim = eaStanding; roambox_distance = 0; roambox_max_x = -2; @@ -673,8 +670,8 @@ bool NPC::Process() DoGravityEffect(); } - if(reface_timer->Check() && !IsEngaged() && (guard_x == GetX() && guard_y == GetY() && guard_z == GetZ())) { - SetHeading(guard_heading); + if(reface_timer->Check() && !IsEngaged() && (m_GuardPoint.m_X == GetX() && m_GuardPoint.m_Y == GetY() && m_GuardPoint.m_Z == GetZ())) { + SetHeading(m_GuardPoint.m_Heading); SendPosition(); reface_timer->Disable(); } diff --git a/zone/npc.h b/zone/npc.h index 1770219ba..ce943174c 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -215,10 +215,10 @@ public: float GetSpawnPointY() const { return m_SpawnPoint.m_Y; } float GetSpawnPointZ() const { return m_SpawnPoint.m_Z; } float GetSpawnPointH() const { return m_SpawnPoint.m_Heading; } - float GetGuardPointX() const { return guard_x; } - float GetGuardPointY() const { return guard_y; } - float GetGuardPointZ() const { return guard_z; } - float GetGuardPointH() const { return guard_heading; } + float GetGuardPointX() const { return m_GuardPoint.m_X; } + float GetGuardPointY() const { return m_GuardPoint.m_Y; } + float GetGuardPointZ() const { return m_GuardPoint.m_Z; } + float GetGuardPointH() const { return m_GuardPoint.m_Heading; } EmuAppearance GetGuardPointAnim() const { return guard_anim; } void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; } @@ -295,7 +295,7 @@ public: void NextGuardPosition(); void SaveGuardSpot(bool iClearGuardSpot = false); - inline bool IsGuarding() const { return(guard_heading != 0); } + inline bool IsGuarding() const { return(m_GuardPoint.m_Heading != 0); } void SaveGuardSpotCharm(); void RestoreGuardSpotCharm(); void AI_SetRoambox(float iDist, float iRoamDist, uint32 iDelay = 2500, uint32 iMinDelay = 2500); @@ -473,7 +473,7 @@ protected: void _ClearWaypints(); int max_wp; int save_wp; - float guard_x, guard_y, guard_z, guard_heading; + xyz_heading m_GuardPoint; float guard_x_saved, guard_y_saved, guard_z_saved, guard_heading_saved; EmuAppearance guard_anim; float roambox_max_x; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 6f4b3e90a..606149925 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -187,18 +187,15 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) } if (saveguardspot) { - guard_x = mtx; - guard_y = mty; - guard_z = mtz; - guard_heading = mth; + m_GuardPoint = xyz_heading(mtx, mty, mtz, mth); - if(guard_heading == 0) - guard_heading = 0.0001; //hack to make IsGuarding simpler + if(m_GuardPoint.m_Heading == 0) + m_GuardPoint.m_Heading = 0.0001; //hack to make IsGuarding simpler - if(guard_heading == -1) - guard_heading = this->CalculateHeadingToTarget(mtx, mty); + if(m_GuardPoint.m_Heading == -1) + m_GuardPoint.m_Heading = this->CalculateHeadingToTarget(mtx, mty); - mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + mlog(AI__WAYPOINTS, "Setting guard position to %s", to_string(static_cast(m_GuardPoint)).c_str()); } m_CurrentWayPoint = xyz_heading(mtx, mty, mtz, mth); @@ -425,28 +422,23 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { mlog(AI__WAYPOINTS, "Clearing guard order."); - guard_x = 0; - guard_y = 0; - guard_z = 0; - guard_heading = 0; + m_GuardPoint = xyz_heading(0, 0, 0, 0); } else { - guard_x = m_Position.m_X; - guard_y = m_Position.m_Y; - guard_z = m_Position.m_Z; - guard_heading = m_Position.m_Heading; - if(guard_heading == 0) - guard_heading = 0.0001; //hack to make IsGuarding simpler - mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + m_GuardPoint = m_Position; + + if(m_GuardPoint.m_Heading == 0) + m_GuardPoint.m_Heading = 0.0001; //hack to make IsGuarding simpler + mlog(AI__WAYPOINTS, "Setting guard position to %s", to_string(static_cast(m_GuardPoint)).c_str()); } } void NPC::NextGuardPosition() { - if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { - SetHeading(guard_heading); + if (!CalculateNewPosition2(m_GuardPoint.m_X, m_GuardPoint.m_Y, m_GuardPoint.m_Z, GetMovespeed())) { + SetHeading(m_GuardPoint.m_Heading); mlog(AI__WAYPOINTS, "Unable to move to next guard position. Probably rooted."); } - else if((m_Position.m_X == guard_x) && (m_Position.m_Y == guard_y) && (m_Position.m_Z == guard_z)) + else if((m_Position.m_X == m_GuardPoint.m_X) && (m_Position.m_Y == m_GuardPoint.m_Y) && (m_Position.m_Z == m_GuardPoint.m_Z)) { if(moved) { @@ -1336,16 +1328,16 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { void NPC::SaveGuardSpotCharm() { - guard_x_saved = guard_x; - guard_y_saved = guard_y; - guard_z_saved = guard_z; - guard_heading_saved = guard_heading; + guard_x_saved = m_GuardPoint.m_X; + guard_y_saved = m_GuardPoint.m_Y; + guard_z_saved = m_GuardPoint.m_Z; + guard_heading_saved = m_GuardPoint.m_Heading; } void NPC::RestoreGuardSpotCharm() { - guard_x = guard_x_saved; - guard_y = guard_y_saved; - guard_z = guard_z_saved; - guard_heading = guard_heading_saved; + m_GuardPoint.m_X = guard_x_saved; + m_GuardPoint.m_Y = guard_y_saved; + m_GuardPoint.m_Z = guard_z_saved; + m_GuardPoint.m_Heading = guard_heading_saved; } From c060723762e7c2bf2d0ae654dee1745e298a922a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 14:34:27 -0800 Subject: [PATCH 0414/1883] guard_x_saved, guard_y_saved, guard_z_saved, guard_heading_saved converted to m_GuardPointSaved --- zone/npc.cpp | 7 ++----- zone/npc.h | 2 +- zone/waypoints.cpp | 10 ++-------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 4469292f6..b43a36611 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -115,7 +115,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float enraged_timer(1000), taunt_timer(TauntReuseTime * 1000), m_SpawnPoint(x,y,z,heading), - m_GuardPoint(-1,-1,-1,0) + m_GuardPoint(-1,-1,-1,0), + m_GuardPointSaved(0,0,0,0) { //What is the point of this, since the names get mangled.. Mob* mob = entity_list.GetMob(name); @@ -346,10 +347,6 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float reface_timer = new Timer(15000); reface_timer->Disable(); qGlobals = nullptr; - guard_x_saved = 0; - guard_y_saved = 0; - guard_z_saved = 0; - guard_heading_saved = 0; SetEmoteID(d->emoteid); InitializeBuffSlots(); CalcBonuses(); diff --git a/zone/npc.h b/zone/npc.h index ce943174c..9b0b68b28 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -474,7 +474,7 @@ protected: int max_wp; int save_wp; xyz_heading m_GuardPoint; - float guard_x_saved, guard_y_saved, guard_z_saved, guard_heading_saved; + xyz_heading m_GuardPointSaved; EmuAppearance guard_anim; float roambox_max_x; float roambox_max_y; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 606149925..e3193c2c8 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1328,16 +1328,10 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { void NPC::SaveGuardSpotCharm() { - guard_x_saved = m_GuardPoint.m_X; - guard_y_saved = m_GuardPoint.m_Y; - guard_z_saved = m_GuardPoint.m_Z; - guard_heading_saved = m_GuardPoint.m_Heading; + m_GuardPointSaved = m_GuardPoint; } void NPC::RestoreGuardSpotCharm() { - m_GuardPoint.m_X = guard_x_saved; - m_GuardPoint.m_Y = guard_y_saved; - m_GuardPoint.m_Z = guard_z_saved; - m_GuardPoint.m_Heading = guard_heading_saved; + m_GuardPoint = m_GuardPointSaved; } From f9036ddc6ac0c369619c30bb152b166d34d4dc94 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 15:05:50 -0800 Subject: [PATCH 0415/1883] GetGuardPointX(), GetGuardPointY(), GetGuardPointZ(), and GetGuardPointH() replaced with GetGuardPoint() --- zone/lua_npc.cpp | 6 +++--- zone/npc.h | 5 +---- zone/perl_npc.cpp | 6 +++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index 869efb019..e247e34e3 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -334,17 +334,17 @@ float Lua_NPC::GetSpawnPointH() { float Lua_NPC::GetGuardPointX() { Lua_Safe_Call_Real(); - return self->GetGuardPointX(); + return self->GetGuardPoint().m_X; } float Lua_NPC::GetGuardPointY() { Lua_Safe_Call_Real(); - return self->GetGuardPointY(); + return self->GetGuardPoint().m_Y; } float Lua_NPC::GetGuardPointZ() { Lua_Safe_Call_Real(); - return self->GetGuardPointZ(); + return self->GetGuardPoint().m_Z; } void Lua_NPC::SetPrimSkill(int skill_id) { diff --git a/zone/npc.h b/zone/npc.h index 9b0b68b28..4bb15de9a 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -215,10 +215,7 @@ public: float GetSpawnPointY() const { return m_SpawnPoint.m_Y; } float GetSpawnPointZ() const { return m_SpawnPoint.m_Z; } float GetSpawnPointH() const { return m_SpawnPoint.m_Heading; } - float GetGuardPointX() const { return m_GuardPoint.m_X; } - float GetGuardPointY() const { return m_GuardPoint.m_Y; } - float GetGuardPointZ() const { return m_GuardPoint.m_Z; } - float GetGuardPointH() const { return m_GuardPoint.m_Heading; } + xyz_heading const GetGuardPoint() const { return m_GuardPoint; } EmuAppearance GetGuardPointAnim() const { return guard_anim; } void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; } diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index c1f8d8828..2696eae7d 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -1653,7 +1653,7 @@ XS(XS_NPC_GetGuardPointX) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetGuardPointX(); + RETVAL = THIS->GetGuardPoint().m_X; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -1680,7 +1680,7 @@ XS(XS_NPC_GetGuardPointY) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetGuardPointY(); + RETVAL = THIS->GetGuardPoint().m_Y; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -1707,7 +1707,7 @@ XS(XS_NPC_GetGuardPointZ) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetGuardPointZ(); + RETVAL = THIS->GetGuardPoint().m_Z; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); From 69dbdb24854d09fae401646f2fa61e8d8febcd30 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 15:29:13 -0800 Subject: [PATCH 0416/1883] GetSpawnPointX(). GetSpawnPointY(), GetSpawnPointZ(), and GetSpawnPointH() replaced with GetSpawnPoint() --- zone/lua_npc.cpp | 8 ++++---- zone/mob_ai.cpp | 9 +++++---- zone/npc.h | 5 +---- zone/perl_npc.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index e247e34e3..8e04a9ae6 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -314,22 +314,22 @@ int Lua_NPC::GetSpawnPointID() { float Lua_NPC::GetSpawnPointX() { Lua_Safe_Call_Real(); - return self->GetSpawnPointX(); + return self->GetSpawnPoint().m_X; } float Lua_NPC::GetSpawnPointY() { Lua_Safe_Call_Real(); - return self->GetSpawnPointY(); + return self->GetSpawnPoint().m_Y; } float Lua_NPC::GetSpawnPointZ() { Lua_Safe_Call_Real(); - return self->GetSpawnPointZ(); + return self->GetSpawnPoint().m_Z; } float Lua_NPC::GetSpawnPointH() { Lua_Safe_Call_Real(); - return self->GetSpawnPointH(); + return self->GetSpawnPoint().m_Heading; } float Lua_NPC::GetGuardPointX() { diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 9c720957e..c510aa035 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1125,19 +1125,20 @@ void Mob::AI_Process() { if(DivineAura()) return; + auto npcSpawnPoint = CastToNPC()->GetSpawnPoint(); if(GetSpecialAbility(TETHER)) { float tether_range = static_cast(GetSpecialAbilityParam(TETHER, 0)); tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(CastToNPC()->GetSpawnPointX(), CastToNPC()->GetSpawnPointY()) > tether_range) { - GMMove(CastToNPC()->GetSpawnPointX(), CastToNPC()->GetSpawnPointY(), CastToNPC()->GetSpawnPointZ(), CastToNPC()->GetSpawnPointH()); + if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > tether_range) { + GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); } } else if(GetSpecialAbility(LEASH)) { float leash_range = static_cast(GetSpecialAbilityParam(LEASH, 0)); leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(CastToNPC()->GetSpawnPointX(), CastToNPC()->GetSpawnPointY()) > leash_range) { - GMMove(CastToNPC()->GetSpawnPointX(), CastToNPC()->GetSpawnPointY(), CastToNPC()->GetSpawnPointZ(), CastToNPC()->GetSpawnPointH()); + if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > leash_range) { + GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); SetHP(GetMaxHP()); BuffFadeAll(); WipeHateList(); diff --git a/zone/npc.h b/zone/npc.h index 4bb15de9a..55b613289 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -211,10 +211,7 @@ public: uint32 GetSp2() const { return spawn_group; } uint32 GetSpawnPointID() const; - float GetSpawnPointX() const { return m_SpawnPoint.m_X; } - float GetSpawnPointY() const { return m_SpawnPoint.m_Y; } - float GetSpawnPointZ() const { return m_SpawnPoint.m_Z; } - float GetSpawnPointH() const { return m_SpawnPoint.m_Heading; } + xyz_heading const GetSpawnPoint() const { return m_SpawnPoint; } xyz_heading const GetGuardPoint() const { return m_GuardPoint; } EmuAppearance GetGuardPointAnim() const { return guard_anim; } void SaveGuardPointAnim(EmuAppearance anim) { guard_anim = anim; } diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 2696eae7d..f12f97d26 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -1545,7 +1545,7 @@ XS(XS_NPC_GetSpawnPointX) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetSpawnPointX(); + RETVAL = THIS->GetSpawnPoint().m_X; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -1572,7 +1572,7 @@ XS(XS_NPC_GetSpawnPointY) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetSpawnPointY(); + RETVAL = THIS->GetSpawnPoint().m_Y; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -1599,7 +1599,7 @@ XS(XS_NPC_GetSpawnPointZ) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetSpawnPointZ(); + RETVAL = THIS->GetSpawnPoint().m_Z; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -1626,7 +1626,7 @@ XS(XS_NPC_GetSpawnPointH) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetSpawnPointH(); + RETVAL = THIS->GetSpawnPoint().m_Heading; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); From 4a7984f04db66bc25fbf4bd5a11e68c7bbdebd99 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 30 Nov 2014 18:32:45 -0500 Subject: [PATCH 0417/1883] Fix clang compile error --- zone/command.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index c9bef2e12..b2914cf46 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -9996,7 +9996,8 @@ void command_object(Client *c, const Seperator *sep) // Couldn't copy the object. - if (results.ErrorMessage().c_str() != '\0') { + // got an error message + if (!results.Success()) { c->Message(0, "Database Error: %s", results.ErrorMessage().c_str()); return; } From 2e6711916e4dc2e178850406b07fa1134c1f5d28 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 15:40:24 -0800 Subject: [PATCH 0418/1883] GetClosestWaypoint converted to xyz_location --- zone/npc.h | 2 +- zone/waypoints.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zone/npc.h b/zone/npc.h index 55b613289..4491d5e6c 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -282,7 +282,7 @@ public: void ResumeWandering(); void PauseWandering(int pausetime); void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot); - void GetClosestWaypoint(std::list &wp_list, int count, float m_x, float m_y, float m_z); + void GetClosestWaypoint(std::list &wp_list, int count, const xyz_location& location ); uint32 GetEquipment(uint8 material_slot) const; // returns item id int32 GetEquipmentMaterial(uint8 material_slot) const; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index e3193c2c8..51f68e952 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -260,7 +260,7 @@ void NPC::CalculateNewWaypoint() case 1: //10 closest { std::list closest; - GetClosestWaypoint(closest, 10, GetX(), GetY(), GetZ()); + GetClosestWaypoint(closest, 10, GetPosition()); std::list::iterator iter = closest.begin(); if(closest.size() != 0) { @@ -316,7 +316,7 @@ void NPC::CalculateNewWaypoint() case 5: //pick random closest 5 and pick one that's in sight { std::list closest; - GetClosestWaypoint(closest, 5, GetX(), GetY(), GetZ()); + GetClosestWaypoint(closest, 5, GetPosition()); std::list::iterator iter = closest.begin(); while(iter != closest.end()) @@ -357,7 +357,7 @@ bool wp_distance_pred(const wp_distance& left, const wp_distance& right) return left.dist < right.dist; } -void NPC::GetClosestWaypoint(std::list &wp_list, int count, float m_x, float m_y, float m_z) +void NPC::GetClosestWaypoint(std::list &wp_list, int count, const xyz_location& location) { wp_list.clear(); if(Waypoints.size() <= count) @@ -372,11 +372,11 @@ void NPC::GetClosestWaypoint(std::list &wp_list, int count, float m_x, f std::list distances; for(int i = 0; i < Waypoints.size(); ++i) { - float cur_x = (Waypoints[i].x - m_x); + float cur_x = (Waypoints[i].x - location.m_X); cur_x *= cur_x; - float cur_y = (Waypoints[i].y - m_y); + float cur_y = (Waypoints[i].y - location.m_Y); cur_y *= cur_y; - float cur_z = (Waypoints[i].z - m_z); + float cur_z = (Waypoints[i].z - location.m_Z); cur_z *= cur_z; float cur_dist = cur_x + cur_y + cur_z; wp_distance w_dist; From 7198e670aeae9a18dbea55ad3d1fd819f2212a03 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 30 Nov 2014 18:56:01 -0500 Subject: [PATCH 0419/1883] Clang bots compile fix --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index a68273fae..496ddc7ae 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -11864,7 +11864,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { } if(!strcasecmp(sep->arg[1], "inventory") && !strcasecmp(sep->arg[2], "remove")) { - if((c->GetTarget() == nullptr) || (sep->arg[3] == '\0') || !c->GetTarget()->IsBot()) + if((c->GetTarget() == nullptr) || (sep->arg[3][0] == '\0') || !c->GetTarget()->IsBot()) { c->Message(15, "Usage: #bot inventory remove [slotid] (You must have a bot targetted) "); return; From e6d23228e53f185395309982e567e51b20a12120 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 15:58:44 -0800 Subject: [PATCH 0420/1883] GetSpawnPointX(), GetSpawnPointY(), GetSpawnPointZ(), and GetSpawnPointH(), converted to GetSpawnPoint() --- zone/lua_npc.cpp | 3 ++- zone/npc.h | 4 ++-- zone/perl_npc.cpp | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zone/lua_npc.cpp b/zone/lua_npc.cpp index 8e04a9ae6..95ae4c5c9 100644 --- a/zone/lua_npc.cpp +++ b/zone/lua_npc.cpp @@ -269,7 +269,8 @@ void Lua_NPC::PauseWandering(int pause_time) { void Lua_NPC::MoveTo(float x, float y, float z, float h, bool save) { Lua_Safe_Call_Void(); - self->MoveTo(x, y, z, h, save); + auto position = xyz_heading(x, y, z, h); + self->MoveTo(position, save); } void Lua_NPC::NextGuardPosition() { diff --git a/zone/npc.h b/zone/npc.h index 4491d5e6c..dde3ebf2a 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -281,8 +281,8 @@ public: void StopWandering(); void ResumeWandering(); void PauseWandering(int pausetime); - void MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot); - void GetClosestWaypoint(std::list &wp_list, int count, const xyz_location& location ); + void MoveTo(const xyz_heading& position, bool saveguardspot); + void GetClosestWaypoint(std::list &wp_list, int count, const xyz_location& location); uint32 GetEquipment(uint8 material_slot) const; // returns item id int32 GetEquipmentMaterial(uint8 material_slot) const; diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index f12f97d26..330e21283 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -1345,7 +1345,8 @@ XS(XS_NPC_MoveTo) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->MoveTo(mtx, mty, mtz, mth, saveguard); + auto position = xyz_heading(mtx, mty, mtz, mth); + THIS->MoveTo(position, saveguard); } XSRETURN_EMPTY; } From 0570722b3b6cd5d117cca59c46f39a29027c0bad Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 16:30:09 -0800 Subject: [PATCH 0421/1883] MoveTo converted to xyz_heading --- zone/command.cpp | 2 +- zone/npc.cpp | 4 ++-- zone/npc.h | 2 +- zone/questmgr.cpp | 15 ++++++++------- zone/waypoints.cpp | 12 ++++++------ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 1dfab5bb0..9783361e5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2430,7 +2430,7 @@ void command_spawn(Client *c, const Seperator *sep) LogFile->write(EQEMuLog::Debug,"#spawn Spawning:"); #endif - NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), c); + NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetPosition(), c); if (!npc) { c->Message(0, "Format: #spawn name race level material hp gender class priweapon secweapon merchantid bodytype - spawns a npc those parameters."); c->Message(0, "Name Format: NPCFirstname_NPCLastname - All numbers in a name are stripped and \"_\" characters become a space."); diff --git a/zone/npc.cpp b/zone/npc.cpp index b43a36611..03fc7c45a 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -773,7 +773,7 @@ bool NPC::DatabaseCastAccepted(int spell_id) { return false; } -NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, float in_heading, Client* client) { +NPC* NPC::SpawnNPC(const char* spawncommand, const xyz_heading& position, Client* client) { if(spawncommand == 0 || spawncommand[0] == 0) { return 0; } @@ -932,7 +932,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, npc_type->prim_melee_type = 28; npc_type->sec_melee_type = 28; - NPC* npc = new NPC(npc_type, 0, in_x, in_y, in_z, in_heading/8, FlyMode3); + NPC* npc = new NPC(npc_type, 0, position.m_X, position.m_Y, position.m_Z, position.m_Heading, FlyMode3); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc); diff --git a/zone/npc.h b/zone/npc.h index dde3ebf2a..0c1c42aa8 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -94,7 +94,7 @@ class AA_SwarmPetInfo; class NPC : public Mob { public: - static NPC* SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, float in_heading = 0, Client* client = 0); + static NPC* SpawnNPC(const char* spawncommand, const xyz_heading& position, Client* client = 0); static int8 GetAILevel(bool iForceReRead = false); NPC(const NPCType* data, Spawn2* respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse = false); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index e014c01cd..0c56a46bc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -963,7 +963,7 @@ uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) { spells[curspell].skill != 52 && ( !RuleB(Spells, UseCHAScribeHack) || spells[curspell].effectid[EFFECT_COUNT - 1] != 10 ) ) - { + { if(IsDiscipline(curspell)){ //we may want to come up with a function like Client::GetNextAvailableSpellBookSlot() to help speed this up a little for(uint32 r = 0; r < MAX_PP_DISCIPLINES; r++) { @@ -977,12 +977,12 @@ uint16 QuestManager::traindiscs(uint8 max_level, uint8 min_level) { SpellGlobalCheckResult = initiator->SpellGlobalCheck(curspell, Char_ID); if (SpellGlobalCheckResult) { initiator->GetPP().disciplines.values[r] = curspell; - database.SaveCharacterDisc(Char_ID, r, curspell); + database.SaveCharacterDisc(Char_ID, r, curspell); initiator->SendDisciplineUpdate(); initiator->Message(0, "You have learned a new discipline!"); count++; //success counter } - break; //continue the 1st loop + break; //continue the 1st loop } else { initiator->GetPP().disciplines.values[r] = curspell; @@ -1558,7 +1558,8 @@ void QuestManager::moveto(float x, float y, float z, float h, bool saveguardspot if (!owner || !owner->IsNPC()) return; - owner->CastToNPC()->MoveTo(x, y, z, h, saveguardspot); + auto position = xyz_heading(x,y,z,h); + owner->CastToNPC()->MoveTo(position, saveguardspot); } void QuestManager::resume() { @@ -2926,7 +2927,7 @@ void QuestManager::CrossZoneSignalPlayerByName(const char *CharName, uint32 data CZSC->data = data; worldserver.SendPacket(pack); safe_delete(pack); -} +} void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharName, const char *Message){ uint32 message_len = strlen(CharName) + 1; @@ -2936,7 +2937,7 @@ void QuestManager::CrossZoneMessagePlayerByName(uint32 Type, const char *CharNam CZSC->Type = Type; strn0cpy(CZSC->CharName, CharName, 64); strn0cpy(CZSC->Message, Message, 512); - worldserver.SendPacket(pack); + worldserver.SendPacket(pack); safe_delete(pack); } @@ -2946,7 +2947,7 @@ void QuestManager::CrossZoneSetEntityVariableByNPCTypeID(uint32 npctype_id, cons ServerPacket* pack = new ServerPacket(ServerOP_CZSetEntityVariableByNPCTypeID, sizeof(CZSetEntVarByNPCTypeID_Struct) + message_len + message_len2); CZSetEntVarByNPCTypeID_Struct* CZSNBYNID = (CZSetEntVarByNPCTypeID_Struct*)pack->pBuffer; CZSNBYNID->npctype_id = npctype_id; - strn0cpy(CZSNBYNID->id, id, 256); + strn0cpy(CZSNBYNID->id, id, 256); strn0cpy(CZSNBYNID->m_var, m_var, 256); worldserver.SendPacket(pack); safe_delete(pack); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 51f68e952..b36f63106 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -161,7 +161,7 @@ void NPC::PauseWandering(int pausetime) return; } -void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) +void NPC::MoveTo(const xyz_heading& position, bool saveguardspot) { // makes mob walk to specified location if (IsNPC() && GetGrid() != 0) { // he is on a grid @@ -176,29 +176,29 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - mlog(AI__WAYPOINTS, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + mlog(AI__WAYPOINTS, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d",to_string(static_cast(position)).c_str(), -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - mlog(AI__WAYPOINTS, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + mlog(AI__WAYPOINTS, "MoveTo %s without a grid.", to_string(static_cast(position)).c_str()); } if (saveguardspot) { - m_GuardPoint = xyz_heading(mtx, mty, mtz, mth); + m_GuardPoint = position; if(m_GuardPoint.m_Heading == 0) m_GuardPoint.m_Heading = 0.0001; //hack to make IsGuarding simpler if(m_GuardPoint.m_Heading == -1) - m_GuardPoint.m_Heading = this->CalculateHeadingToTarget(mtx, mty); + m_GuardPoint.m_Heading = this->CalculateHeadingToTarget(position.m_X, position.m_Y); mlog(AI__WAYPOINTS, "Setting guard position to %s", to_string(static_cast(m_GuardPoint)).c_str()); } - m_CurrentWayPoint = xyz_heading(mtx, mty, mtz, mth); + m_CurrentWayPoint = position; cur_wp_pause = 0; pLastFightingDelayMoving = 0; if(AIwalking_timer->Enabled()) From 54bc1b06e4b143ecc629d182cd5d63255aa948eb Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 17:32:11 -0800 Subject: [PATCH 0422/1883] NPC constructor converted to use xyz_heading --- zone/aa.cpp | 47 ++++++++++++++++++++++---------------------- zone/bot.cpp | 4 ++-- zone/client.cpp | 11 +++++++---- zone/command.cpp | 2 +- zone/forage.cpp | 4 +++- zone/horse.cpp | 2 +- zone/lua_general.cpp | 10 +++++----- zone/merc.cpp | 34 ++++++++++++++++---------------- zone/npc.cpp | 14 ++++++------- zone/npc.h | 4 ++-- zone/pathing.cpp | 10 ++++++---- zone/pets.cpp | 2 +- zone/questmgr.cpp | 22 ++++++++------------- zone/spawn2.cpp | 2 +- zone/trap.cpp | 10 +++++++--- zone/zone.cpp | 10 +++++----- 16 files changed, 96 insertions(+), 92 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 3a3101746..87b997cca 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -319,10 +319,10 @@ void Client::ActivateAA(aaID activate){ } // Check if AA is expendable if (aas_send[activate - activate_val]->special_category == 7) { - + // Add the AA cost to the extended profile to track overall total m_epp.expended_aa += aas_send[activate]->cost; - + SetAA(activate, 0); SaveAA(); /* Save Character AA */ @@ -598,12 +598,12 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, - 10, -10, 10, -10, - 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, - 10, 10, -10, -10, - 8, 8, -8, -8 }; + static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { + {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, + {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, + {8, 8}, {-8, 8}, {8, -8}, {-8, -8} + }; + while(summon_count > 0) { int pet_duration = pet.duration; if(duration_override > 0) @@ -620,8 +620,8 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u NPC* npca = new NPC( (npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer 0, - GetX()+swarm_pet_x[summon_count], GetY()+swarm_pet_y[summon_count], - GetZ(), GetHeading(), FlyMode3); + GetPosition() + swarmPetLocations[summon_count], + FlyMode3); if (followme) npca->SetFollowID(GetID()); @@ -692,12 +692,11 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, - 10, -10, 10, -10, - 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, - 10, 10, -10, -10, - 8, 8, -8, -8 }; + static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { + {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, + {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, + {8, 8}, {-8, 8}, {8, -8}, {-8, -8} + }; while(summon_count > 0) { int pet_duration = pet.duration; @@ -715,8 +714,8 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid NPC* npca = new NPC( (npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer 0, - GetX()+swarm_pet_x[summon_count], GetY()+swarm_pet_y[summon_count], - GetZ(), GetHeading(), FlyMode3); + GetPosition()+swarmPetLocations[summon_count], + FlyMode3); if (followme) npca->SetFollowID(GetID()); @@ -899,7 +898,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) make_npc->d_meele_texture1 = 0; make_npc->d_meele_texture2 = 0; - NPC* npca = new NPC(make_npc, 0, GetX(), GetY(), GetZ(), GetHeading(), FlyMode3); + NPC* npca = new NPC(make_npc, 0, GetPosition(), FlyMode3); if(!npca->GetSwarmInfo()){ AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; @@ -1056,7 +1055,7 @@ void Client::BuyAA(AA_Action* action) /* Do Player Profile rank calculations and set player profile */ SaveAA(); /* Save to Database to avoid having to write the whole AA array to the profile, only write changes*/ - // database.SaveCharacterAA(this->CharacterID(), aa2->id, (cur_level + 1)); + // database.SaveCharacterAA(this->CharacterID(), aa2->id, (cur_level + 1)); if ((RuleB(AA, Stacking) && (GetClientVersionBit() >= 4) && (aa2->hotkey_sid == 4294967295u)) && ((aa2->max_level == (cur_level + 1)) && aa2->sof_next_id)){ @@ -1077,7 +1076,7 @@ void Client::BuyAA(AA_Action* action) if (cur_level < 1){ Message(15, "You have gained the ability \"%s\" at a cost of %d ability %s.", aa2->name, real_cost, (real_cost>1) ? "points" : "point"); - /* QS: Player_Log_AA_Purchases */ + /* QS: Player_Log_AA_Purchases */ if (RuleB(QueryServ, PlayerLogAAPurchases)){ std::string event_desc = StringFormat("Initial AA Purchase :: aa_name:%s aa_id:%i at cost:%i in zoneid:%i instid:%i", aa2->name, aa2->id, real_cost, this->GetZoneID(), this->GetInstanceID()); QServ->PlayerLogEvent(Player_Log_AA_Purchases, this->CharacterID(), event_desc); @@ -1522,13 +1521,13 @@ bool ZoneDatabase::LoadAAEffects2() { return true; } void Client::ResetAA(){ - RefundAA(); + RefundAA(); uint32 i; for(i=0;iAA = 0; aa[i]->value = 0; m_pp.aa_array[MAX_PP_AA_ARRAY].AA = 0; - m_pp.aa_array[MAX_PP_AA_ARRAY].value = 0; + m_pp.aa_array[MAX_PP_AA_ARRAY].value = 0; } std::map::iterator itr; @@ -1544,7 +1543,7 @@ void Client::ResetAA(){ m_pp.raid_leadership_exp = 0; database.DeleteCharacterAAs(this->CharacterID()); - SaveAA(); + SaveAA(); SendAATable(); database.DeleteCharacterLeadershipAAs(this->CharacterID()); Kick(); diff --git a/zone/bot.cpp b/zone/bot.cpp index f2bde8980..05dead52a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -9,7 +9,7 @@ extern volatile bool ZoneLoaded; // This constructor is used during the bot create command -Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, 0, 0, 0, 0, 0, 0, false), rest_timer(1) { +Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, xyz_heading::Origin(), 0, false), rest_timer(1) { if(botOwner) { this->SetBotOwner(botOwner); this->_botOwnerCharacterID = botOwner->CharacterID(); @@ -99,7 +99,7 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, 0, 0, 0, 0, } // This constructor is used when the bot is loaded out of the database -Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData) : NPC(&npcTypeData, 0, 0, 0, 0, 0, 0, false), rest_timer(1) { +Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double totalPlayTime, uint32 lastZoneId, NPCType npcTypeData) : NPC(&npcTypeData, nullptr, xyz_heading::Origin(), 0, false), rest_timer(1) { this->_botOwnerCharacterID = botOwnerCharacterID; if(this->_botOwnerCharacterID > 0) { diff --git a/zone/client.cpp b/zone/client.cpp index 2c6c73b8a..5f5089d2b 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6422,8 +6422,11 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const float swarm_pet_x[MAX_SWARM_PETS] = { 5, -5, 5, -5, 10, -10, 10, -10, 8, -8, 8, -8 }; - static const float swarm_pet_y[MAX_SWARM_PETS] = { 5, 5, -5, -5, 10, 10, -10, -10, 8, 8, -8, -8 }; + static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { + {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, + {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, + {8, 8}, {-8, 8}, {8, -8}, {-8, -8} + }; while(summon_count > 0) { NPCType *npc_dup = nullptr; @@ -6435,8 +6438,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid NPC* npca = new NPC( (npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer 0, - GetX()+swarm_pet_x[summon_count], GetY()+swarm_pet_y[summon_count], - GetZ(), GetHeading(), FlyMode3); + GetPosition()+swarmPetLocations[summon_count], + FlyMode3); if(!npca->GetSwarmInfo()){ AA_SwarmPetInfo* nSI = new AA_SwarmPetInfo; diff --git a/zone/command.cpp b/zone/command.cpp index 9783361e5..d74fedabe 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2489,7 +2489,7 @@ void command_npctypespawn(Client *c, const Seperator *sep) const NPCType* tmp = 0; if ((tmp = database.GetNPCType(atoi(sep->arg[1])))) { //tmp->fixedZ = 1; - NPC* npc = new NPC(tmp, 0, c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), FlyMode3); + NPC* npc = new NPC(tmp, 0, c->GetPosition(), FlyMode3); if (npc && sep->IsNumber(2)) npc->SetNPCFactionID(atoi(sep->arg[2])); diff --git a/zone/forage.cpp b/zone/forage.cpp index 459fee6a7..2760a779c 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -315,7 +315,9 @@ void Client::GoFish() if(npc_chance < MakeRandomInt(0, 99)) { const NPCType* tmp = database.GetNPCType(npc_id); if(tmp != nullptr) { - NPC* npc = new NPC(tmp, nullptr, GetX()+3, GetY(), GetZ(), GetHeading(), FlyMode3); + auto positionNPC = GetPosition(); + positionNPC.m_X = positionNPC.m_X + 3; + NPC* npc = new NPC(tmp, nullptr, positionNPC, FlyMode3); npc->AddLootTable(); npc->AddToHateList(this, 1, 0, false); //no help yelling diff --git a/zone/horse.cpp b/zone/horse.cpp index df7c7e7c1..cdcd8a28e 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -29,7 +29,7 @@ std::map Horse::horse_types; LinkedList horses_auto_delete; Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading) - : NPC(GetHorseType(spell_id), nullptr, x, y, z, heading, FlyMode3) + : NPC(GetHorseType(spell_id), nullptr, xyz_heading(x, y, z, heading), FlyMode3) { //give the horse its proper name. strn0cpy(name, _owner->GetCleanName(), 55); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 09b0dcf53..f18ff95fb 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -124,7 +124,7 @@ void register_event(std::string package_name, std::string name, int evt, luabind e.encounter_name = name; e.lua_reference = func; e.event_id = static_cast(evt); - + auto liter = lua_encounter_events_registered.find(package_name); if(liter == lua_encounter_events_registered.end()) { std::list elist; @@ -201,7 +201,7 @@ void unregister_player_event(int evt) { void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) { std::string package_name = "item_"; package_name += std::to_string(static_cast(item_id)); - + if(luabind::type(func) == LUA_TFUNCTION) { register_event(package_name, name, evt, func); } @@ -1036,7 +1036,7 @@ void lua_add_spawn_point(luabind::adl::object table) { int condition_min_value = 0; bool enabled = true; int animation = 0; - + auto cur = table["spawn2_id"]; if(luabind::type(cur) != LUA_TNIL) { try { @@ -1284,7 +1284,7 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float if(luabind::type(table) != LUA_TTABLE) { return; } - + NPCType* npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); @@ -1391,7 +1391,7 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float LuaCreateNPCParse(raid_target, bool, false); LuaCreateNPCParse(probability, uint8, 0); - NPC* npc = new NPC(npc_type, nullptr, x, y, z, heading, FlyMode3); + NPC* npc = new NPC(npc_type, nullptr, xyz_heading(x, y, z, heading), FlyMode3); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc); } diff --git a/zone/merc.cpp b/zone/merc.cpp index 2ecd0849e..aa8bb98c1 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -17,7 +17,7 @@ extern volatile bool ZoneLoaded; Merc::Merc(const NPCType* d, float x, float y, float z, float heading) -: NPC(d, 0, x, y, z, heading, 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000) +: NPC(d, nullptr, xyz_heading(x, y, z, heading), 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000) { base_hp = d->max_hp; base_mana = d->Mana; @@ -4925,11 +4925,11 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, if(merc_template) { //TODO: Maybe add a way of updating client merc stats in a seperate function? like, for example, on leveling up. - const NPCType* npc_type_to_copy = database.GetMercType(merc_template->MercNPCID, merc_template->RaceID, c->GetLevel()); + const NPCType* npc_type_to_copy = database.GetMercType(merc_template->MercNPCID, merc_template->RaceID, c->GetLevel()); if(npc_type_to_copy != nullptr) { //This is actually a very terrible method of assigning stats, and should be changed at some point. See the comment in merc's deconstructor. - NPCType* npc_type = new NPCType; + NPCType* npc_type = new NPCType; memset(npc_type, 0, sizeof(NPCType)); memcpy(npc_type, npc_type_to_copy, sizeof(NPCType)); if(c && !updateFromDB) @@ -5099,7 +5099,7 @@ bool Merc::Spawn(Client *owner) { entity_list.AddMerc(this, true, true); SendPosition(); - + if (MERC_DEBUG > 0) owner->Message(7, "Mercenary Debug: Spawn."); @@ -5125,7 +5125,7 @@ void Client::SendMercResponsePackets(uint32 ResponseType) break; case 3: //Mercenary failed to spawn! SendMercMerchantResponsePacket(3); - break; + break; case 4: //Mercenaries are not allowed in raids! SendMercMerchantResponsePacket(4); break; @@ -5289,7 +5289,7 @@ void Client::UpdateMercTimer() { SendMercResponsePackets(16); } - + if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: UpdateMercTimer Complete."); @@ -5312,7 +5312,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { MercTemplate* mercTemplate = zone->GetMercTemplate(template_id); //check for suspended merc - if(GetMercInfo().mercid != 0 && GetMercInfo().IsSuspended) { + if(GetMercInfo().mercid != 0 && GetMercInfo().IsSuspended) { SendMercResponsePackets(6); return false; } @@ -5343,7 +5343,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { return false; } } - + if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: CheckCanHireMerc True."); @@ -5417,7 +5417,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) { SendMercResponsePackets(9); return false; } - + if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: CheckCanSpawnMerc True."); @@ -5440,7 +5440,7 @@ bool Client::CheckCanUnsuspendMerc() { Message(0, "You must wait %i seconds before unsuspending your mercenary.", GetPTimers().GetRemainingTime(pTimerMercSuspend)); return false; } - + if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: CheckCanUnsuspendMerc True."); @@ -5588,7 +5588,7 @@ void Client::SendMercTimer(Merc* merc) { } -void Client::SpawnMerc(Merc* merc, bool setMaxStats) { +void Client::SpawnMerc(Merc* merc, bool setMaxStats) { if (!merc || !CheckCanSpawnMerc(merc->GetMercTemplateID())) { @@ -5607,7 +5607,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) { GetMercInfo().SuspendedTime = 0; //SendMercTimer(merc); - + if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SpawnMerc Success."); @@ -5632,12 +5632,12 @@ bool Merc::Suspend() { mercOwner->GetMercTimer()->Disable(); mercOwner->SendMercSuspendResponsePacket(mercOwner->GetMercInfo().SuspendedTime); mercOwner->SendMercTimer(this); - + Depop(); // Start the timer to send the packet that refreshes the Unsuspend Button mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS)); - + if (MERC_DEBUG > 0) mercOwner->Message(7, "Mercenary Debug: Suspend Complete."); @@ -5739,7 +5739,7 @@ bool Client::DismissMerc(uint32 MercID) { if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: Dismiss Successful."); } - + if (GetMerc()) { GetMerc()->Depop(); @@ -5907,7 +5907,7 @@ bool Merc::MercJoinClientGroup() { if(MERC_DEBUG > 0) mercOwner->Message(7, "Mercenary Debug: Mercenary disbanded new group."); } - + } else if (AddMercToGroup(this, mercOwner->GetGroup())) { @@ -5997,7 +5997,7 @@ Merc* Client::GetMerc() { Message(7, "Mercenary Debug: GetMerc Owner Mismatch."); return (nullptr); } - + if (MERC_DEBUG > 0) //Message(7, "Mercenary Debug: GetMerc Success."); diff --git a/zone/npc.cpp b/zone/npc.cpp index 03fc7c45a..8f947a0c7 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -54,7 +54,7 @@ extern EntityList entity_list; #include "quest_parser_collection.h" -NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse) +NPC::NPC(const NPCType* d, Spawn2* in_respawn, const xyz_heading& position, int iflymode, bool IsCorpse) : Mob(d->name, d->lastname, d->max_hp, @@ -68,10 +68,10 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float d->npc_id, d->size, d->runspeed, - heading, - x, - y, - z, + position.m_Heading, + position.m_X, + position.m_Y, + position.m_Z, d->light, d->texture, d->helmtexture, @@ -114,7 +114,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float sendhpupdate_timer(1000), enraged_timer(1000), taunt_timer(TauntReuseTime * 1000), - m_SpawnPoint(x,y,z,heading), + m_SpawnPoint(position), m_GuardPoint(-1,-1,-1,0), m_GuardPointSaved(0,0,0,0) { @@ -932,7 +932,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, const xyz_heading& position, Client npc_type->prim_melee_type = 28; npc_type->sec_melee_type = 28; - NPC* npc = new NPC(npc_type, 0, position.m_X, position.m_Y, position.m_Z, position.m_Heading, FlyMode3); + NPC* npc = new NPC(npc_type, nullptr, position, FlyMode3); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc); diff --git a/zone/npc.h b/zone/npc.h index 0c1c42aa8..8db5514de 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -94,10 +94,10 @@ class AA_SwarmPetInfo; class NPC : public Mob { public: - static NPC* SpawnNPC(const char* spawncommand, const xyz_heading& position, Client* client = 0); + static NPC* SpawnNPC(const char* spawncommand, const xyz_heading& position, Client* client = nullptr); static int8 GetAILevel(bool iForceReRead = false); - NPC(const NPCType* data, Spawn2* respawn, float x, float y, float z, float heading, int iflymode, bool IsCorpse = false); + NPC(const NPCType* data, Spawn2* respawn, const xyz_heading& position, int iflymode, bool IsCorpse = false); virtual ~NPC(); diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 7bd44c757..016e7afe1 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -587,8 +587,8 @@ void PathManager::SpawnPathNodes() npc_type->CHA = 150; npc_type->findable = 1; - - NPC* npc = new NPC(npc_type, 0, PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, 0, FlyMode1); + auto position = xyz_heading(PathNodes[i].v.x, PathNodes[i].v.y, PathNodes[i].v.z, 0.0f); + NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc, true, true); @@ -1578,7 +1578,8 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->CHA = 150; npc_type->findable = 1; - NPC* npc = new NPC(npc_type, 0, new_node.v.x, new_node.v.y, new_node.v.z, 0, FlyMode1); + auto position = xyz_heading(new_node.v.x, new_node.v.y, new_node.v.z, 0.0f); + NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc, true, true); @@ -1638,7 +1639,8 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->CHA = 150; npc_type->findable = 1; - NPC* npc = new NPC(npc_type, 0, new_node.v.x, new_node.v.y, new_node.v.z, 0, FlyMode1); + auto position = xyz_heading(new_node.v.x, new_node.v.y, new_node.v.z, 0.0f); + NPC* npc = new NPC(npc_type, nullptr, position, FlyMode1); npc->GiveNPCTypeData(npc_type); entity_list.AddNPC(npc, true, true); diff --git a/zone/pets.cpp b/zone/pets.cpp index 1f61b227b..8556bb620 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -435,7 +435,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, into walls or objects (+10), this sometimes creates the "ghost" effect. I changed to +2 (as close as I could get while it still looked good). I also noticed this can happen if an NPC is spawned on the same spot of another or in a related bad spot.*/ Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power) -: NPC(type_data, 0, owner->GetX()+2, owner->GetY()+2, owner->GetZ(), owner->GetHeading(), FlyMode3) +: NPC(type_data, 0, owner->GetPosition() + xy_location(2, 2), FlyMode3) { GiveNPCTypeData(type_data); typeofpet = type; diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 0c56a46bc..bcef4ef98 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -245,7 +245,7 @@ Mob* QuestManager::spawn2(int npc_type, int grid, int unused, float x, float y, const NPCType* tmp = 0; if (tmp = database.GetNPCType(npc_type)) { - NPC* npc = new NPC(tmp, 0, x, y, z, heading, FlyMode3); + NPC* npc = new NPC(tmp, nullptr, xyz_heading(x, y, z, heading), FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) @@ -267,7 +267,7 @@ Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, float x, flo const NPCType* tmp = 0; if (tmp = database.GetNPCType(npc_type)) { - NPC* npc = new NPC(tmp, 0, x, y, z, heading, FlyMode3); + NPC* npc = new NPC(tmp, nullptr, xyz_heading(x, y, z, heading), FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) @@ -340,8 +340,8 @@ Mob* QuestManager::spawn_from_spawn2(uint32 spawn2_id) database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), 0); found_spawn->SetCurrentNPCID(npcid); - NPC* npc = new NPC(tmp, found_spawn, found_spawn->GetX(), found_spawn->GetY(), found_spawn->GetZ(), - found_spawn->GetHeading(), FlyMode3); + auto position = xyz_heading(found_spawn->GetX(), found_spawn->GetY(), found_spawn->GetZ(), found_spawn->GetHeading()); + NPC* npc = new NPC(tmp, found_spawn, position, FlyMode3); found_spawn->SetNPCPointer(npc); npc->AddLootTable(); @@ -1600,26 +1600,20 @@ void QuestManager::setnextinchpevent(int at) { owner->SetNextIncHPEvent(at); } -void QuestManager::respawn(int npc_type, int grid) { +void QuestManager::respawn(int npcTypeID, int grid) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) return; - float x,y,z,h; - - x = owner->GetX(); - y = owner->GetY(); - z = owner->GetZ(); - h = owner->GetHeading(); running_quest e = quests_running_.top(); e.depop_npc = true; quests_running_.pop(); quests_running_.push(e); - const NPCType* tmp = 0; - if ((tmp = database.GetNPCType(npc_type))) + const NPCType* npcType = nullptr; + if ((npcType = database.GetNPCType(npcTypeID))) { - owner = new NPC(tmp, 0, x, y, z, h, FlyMode3); + owner = new NPC(npcType, nullptr, owner->GetPosition(), FlyMode3); owner->CastToNPC()->AddLootTable(); entity_list.AddNPC(owner->CastToNPC(),true,true); if(grid > 0) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 8d8562157..1e973ebc7 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -217,7 +217,7 @@ bool Spawn2::Process() { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), 0); currentnpcid = npcid; - NPC* npc = new NPC(tmp, this, x, y, z, heading, FlyMode3); + NPC* npc = new NPC(tmp, this, xyz_heading(x, y, z, heading), FlyMode3); npc->mod_prespawn(this); diff --git a/zone/trap.cpp b/zone/trap.cpp index 44c177118..b4a4a1f1f 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -144,7 +144,9 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-5+MakeRandomInt(0, 10), y-5+MakeRandomInt(0, 10), z-5+MakeRandomInt(0, 10), MakeRandomInt(0, 249), FlyMode3); + auto randomOffset = xyz_heading(-5 + MakeRandomInt(0, 10),-5 + MakeRandomInt(0, 10),-5 + MakeRandomInt(0, 10), MakeRandomInt(0, 249)); + auto position = randomOffset + xyz_location(x, y, z); + NPC* new_npc = new NPC(tmp, nullptr, position, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -165,7 +167,9 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-2+MakeRandomInt(0, 5), y-2+MakeRandomInt(0, 5), z-2+MakeRandomInt(0, 5), MakeRandomInt(0, 249), FlyMode3); + auto randomOffset = xyz_heading(-2 + MakeRandomInt(0, 5), -2 + MakeRandomInt(0, 5), -2 + MakeRandomInt(0, 5), MakeRandomInt(0, 249)); + auto position = randomOffset + xyz_location(x, y, z); + NPC* new_npc = new NPC(tmp, nullptr, position, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -318,7 +322,7 @@ void Trap::CreateHiddenTrigger() make_npc->trackable = 0; make_npc->level = level; strcpy(make_npc->special_abilities, "19,1^20,1^24,1^25,1"); - NPC* npca = new NPC(make_npc, 0, x, y, z, 0, FlyMode3); + NPC* npca = new NPC(make_npc, nullptr, xyz_heading(x, y, z, 0.0f), FlyMode3); npca->GiveNPCTypeData(make_npc); entity_list.AddNPC(npca); diff --git a/zone/zone.cpp b/zone/zone.cpp index ecf10bcb5..eaf73f1da 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -103,7 +103,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { } zone->zonemap = Map::LoadMapFile(zone->map_name); zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name); - zone->pathing = PathManager::LoadPathFile(zone->map_name); + zone->pathing = PathManager::LoadPathFile(zone->map_name); char tmp[10]; if (database.GetVariable("loglevel",tmp, 9)) { @@ -470,7 +470,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { void Zone::GetMerchantDataForZoneLoad() { LogFile->write(EQEMuLog::Status, "Loading Merchant Lists..."); - std::string query = StringFormat( + std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " "ml.slot, " @@ -488,14 +488,14 @@ void Zone::GetMerchantDataForZoneLoad() { "WHERE nt.merchant_id = ml.merchantid AND nt.id = se.npcid " "AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i " "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); - auto results = database.QueryDatabase(query); + auto results = database.QueryDatabase(query); std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { LogFile->write(EQEMuLog::Debug, "No Merchant Data found for %s.", GetShortName()); return; } - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end(); ++row) { MerchantList ml; ml.id = atoul(row[0]); if (npcid != ml.id) { @@ -2199,7 +2199,7 @@ void Zone::DoAdventureActions() const NPCType* tmp = database.GetNPCType(ds->data_id); if(tmp) { - NPC* npc = new NPC(tmp, 0, ds->assa_x, ds->assa_y, ds->assa_z, ds->assa_h, FlyMode3); + NPC* npc = new NPC(tmp, nullptr, xyz_heading(ds->assa_x, ds->assa_y, ds->assa_z, ds->assa_h), FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc); npc->Shout("Rarrrgh!"); From 2546c6c226272211e10999282a11f770fb1c30e7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 18:10:30 -0800 Subject: [PATCH 0423/1883] Trap converted to use xyz_location as m_Position instead of x, y, z --- zone/client_packet.cpp | 22 ++++++------- zone/entity.cpp | 48 ++++++++++++--------------- zone/position.cpp | 10 ++++++ zone/position.h | 1 + zone/trap.cpp | 74 ++++++++++++++++++------------------------ zone/trap.h | 4 +-- 6 files changed, 74 insertions(+), 85 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 62f4f12dd..958834784 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11699,29 +11699,29 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) int uskill = GetSkill(SkillSenseTraps); if ((MakeRandomInt(0, 99) + uskill) >= (MakeRandomInt(0, 99) + trap->skill*0.75)) { - float xdif = trap->x - GetX(); - float ydif = trap->y - GetY(); - if (xdif == 0 && ydif == 0) + auto diff = trap->m_Position - GetPosition(); + + if (diff.m_X == 0 && diff.m_Y == 0) Message(MT_Skills, "You sense a trap right under your feet!"); - else if (xdif > 10 && ydif > 10) + else if (diff.m_X > 10 && diff.m_Y > 10) Message(MT_Skills, "You sense a trap to the NorthWest."); - else if (xdif < -10 && ydif > 10) + else if (diff.m_X < -10 && diff.m_Y > 10) Message(MT_Skills, "You sense a trap to the NorthEast."); - else if (ydif > 10) + else if (diff.m_Y > 10) Message(MT_Skills, "You sense a trap to the North."); - else if (xdif > 10 && ydif < -10) + else if (diff.m_X > 10 && diff.m_Y < -10) Message(MT_Skills, "You sense a trap to the SouthWest."); - else if (xdif < -10 && ydif < -10) + else if (diff.m_X < -10 && diff.m_Y < -10) Message(MT_Skills, "You sense a trap to the SouthEast."); - else if (ydif < -10) + else if (diff.m_Y < -10) Message(MT_Skills, "You sense a trap to the South."); - else if (xdif > 10) + else if (diff.m_X > 10) Message(MT_Skills, "You sense a trap to the West."); else Message(MT_Skills, "You sense a trap to the East."); trap->detected = true; - float angle = CalculateHeadingToTarget(trap->x, trap->y); + float angle = CalculateHeadingToTarget(trap->m_Position.m_X, trap->m_Position.m_Y); if (angle < 0) angle = (256 + angle); diff --git a/zone/entity.cpp b/zone/entity.cpp index 122e24582..792deaad4 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -68,7 +68,7 @@ Entity::Entity() Entity::~Entity() { - + } Client *Entity::CastToClient() @@ -493,14 +493,14 @@ void EntityList::MobProcess() while (it != mob_list.end()) { uint16 id = it->first; Mob *mob = it->second; - + size_t sz = mob_list.size(); bool p_val = mob->Process(); size_t a_sz = mob_list.size(); - + if(a_sz > sz) { //increased size can potentially screw with iterators so reset it to current value - //if buckets are re-orderered we may skip a process here and there but since + //if buckets are re-orderered we may skip a process here and there but since //process happens so often it shouldn't matter much it = mob_list.find(id); ++it; @@ -3106,33 +3106,25 @@ void EntityList::OpenDoorsNear(NPC *who) void EntityList::SendAlarm(Trap *trap, Mob *currenttarget, uint8 kos) { - float val2 = trap->effectvalue * trap->effectvalue; + float preSquareDistance = trap->effectvalue * trap->effectvalue; - auto it = npc_list.begin(); - while (it != npc_list.end()) { + for (auto it = npc_list.begin();it != npc_list.end(); ++it) { NPC *cur = it->second; - float curdist = 0; - float tmp = cur->GetX() - trap->x; - curdist += tmp*tmp; - tmp = cur->GetY() - trap->y; - curdist += tmp*tmp; - tmp = cur->GetZ() - trap->z; - curdist += tmp*tmp; - if (!cur->GetOwner() && - /*!cur->CastToMob()->dead && */ - !cur->IsEngaged() && - curdist <= val2 ) - { - if (kos) { - uint8 factioncon = currenttarget->GetReverseFactionCon(cur); - if (factioncon == FACTION_THREATENLY || factioncon == FACTION_SCOWLS) { - cur->AddToHateList(currenttarget,1); - } - } else { + + auto diff = cur->GetPosition() - trap->m_Position; + float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z; + + if (cur->GetOwner() || cur->IsEngaged() || curdist > preSquareDistance ) + continue; + + if (kos) { + uint8 factioncon = currenttarget->GetReverseFactionCon(cur); + if (factioncon == FACTION_THREATENLY || factioncon == FACTION_SCOWLS) { cur->AddToHateList(currenttarget,1); } - } - ++it; + } + else + cur->AddToHateList(currenttarget,1); } } @@ -3636,7 +3628,7 @@ int16 EntityList::CountTempPets(Mob *owner) } ++it; } - + owner->SetTempPetCount(count); return count; diff --git a/zone/position.cpp b/zone/position.cpp index 2d7d48cf8..887949f41 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -67,6 +67,16 @@ const xyz_heading xyz_heading::operator -(const xyz_location& rhs) const{ return xyz_heading(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z, m_Heading); } +void xyz_heading::ABS_XYZ(void) { + if (m_X < 0) + m_X = -m_X; + + if (m_Y < 0) + m_Y = -m_Y; + + if (m_Z < 0) + m_Z = -m_Z; +} xyz_location::xyz_location(float x, float y, float z) : m_X(x), diff --git a/zone/position.h b/zone/position.h index 591c14b10..653cd4ba6 100644 --- a/zone/position.h +++ b/zone/position.h @@ -74,6 +74,7 @@ public: const xyz_heading operator -(const xyz_location& rhs) const; + void ABS_XYZ(); bool isOrigin() const { return m_X == 0.0f && m_Y == 0.0f && m_Z == 0.0f;} }; diff --git a/zone/trap.cpp b/zone/trap.cpp index b4a4a1f1f..7d53bcc70 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -50,12 +50,10 @@ CREATE TABLE traps ( Trap::Trap() : Entity(), respawn_timer(600000), - chkarea_timer(500) + chkarea_timer(500), + m_Position(xyz_location::Origin()) { trap_id = 0; - x = 0; - y = 0; - z = 0; maxzdiff = 0; radius = 0; effect = 0; @@ -145,8 +143,8 @@ void Trap::Trigger(Mob* trigger) if ((tmp = database.GetNPCType(effectvalue))) { auto randomOffset = xyz_heading(-5 + MakeRandomInt(0, 10),-5 + MakeRandomInt(0, 10),-5 + MakeRandomInt(0, 10), MakeRandomInt(0, 249)); - auto position = randomOffset + xyz_location(x, y, z); - NPC* new_npc = new NPC(tmp, nullptr, position, FlyMode3); + auto spawnPosition = randomOffset + m_Position; + NPC* new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -168,8 +166,8 @@ void Trap::Trigger(Mob* trigger) if ((tmp = database.GetNPCType(effectvalue))) { auto randomOffset = xyz_heading(-2 + MakeRandomInt(0, 5), -2 + MakeRandomInt(0, 5), -2 + MakeRandomInt(0, 5), MakeRandomInt(0, 249)); - auto position = randomOffset + xyz_location(x, y, z); - NPC* new_npc = new NPC(tmp, nullptr, position, FlyMode3); + auto spawnPosition = randomOffset + m_Position; + NPC* new_npc = new NPC(tmp, nullptr, spawnPosition, FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -212,55 +210,47 @@ Trap* EntityList::FindNearbyTrap(Mob* searcher, float max_dist) { float max_dist2 = max_dist*max_dist; Trap *cur; - auto it = trap_list.begin(); - while (it != trap_list.end()) { - cur = it->second; - if(!cur->disarmed) { - float curdist = 0; - float tmp = searcher->GetX() - cur->x; - curdist += tmp*tmp; - tmp = searcher->GetY() - cur->y; - curdist += tmp*tmp; - tmp = searcher->GetZ() - cur->z; - curdist += tmp*tmp; - if (curdist < max_dist2 && curdist < dist) - { - dist = curdist; - current_trap = cur; - } - } - ++it; + for (auto it = trap_list.begin(); it != trap_list.end(); ++it) { + cur = it->second; + if(cur->disarmed) + continue; + + auto diff = searcher->GetPosition() - cur->m_Position; + float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z; + + if (curdist < max_dist2 && curdist < dist) + { + dist = curdist; + current_trap = cur; + } } + return current_trap; } Mob* EntityList::GetTrapTrigger(Trap* trap) { Mob* savemob = 0; - float xdiff, ydiff, zdiff; - float maxdist = trap->radius * trap->radius; - auto it = client_list.begin(); - while (it != client_list.end()) { + for (auto it = client_list.begin(); it != client_list.end(); ++it) { Client* cur = it->second; - zdiff = cur->GetZ() - trap->z; - if(zdiff < 0) - zdiff = 0 - zdiff; - xdiff = cur->GetX() - trap->x; - ydiff = cur->GetY() - trap->y; - if ((xdiff*xdiff + ydiff*ydiff) <= maxdist - && zdiff < trap->maxzdiff) + auto diff = cur->GetPosition() - trap->m_Position; + diff.ABS_XYZ(); + + if ((diff.m_X*diff.m_X + diff.m_Y*diff.m_Y) <= maxdist + && diff.m_Z < trap->maxzdiff) { if (MakeRandomInt(0,100) < trap->chance) - return(cur); + return cur; else savemob = cur; } - ++it; + } + return savemob; } @@ -279,9 +269,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { for (auto row = results.begin(); row != results.end(); ++row) { Trap* trap = new Trap(); trap->trap_id = atoi(row[0]); - trap->x = atof(row[1]); - trap->y = atof(row[2]); - trap->z = atof(row[3]); + trap->m_Position = xyz_location(atof(row[1]), atof(row[2]), atof(row[3])); trap->effect = atoi(row[4]); trap->effectvalue = atoi(row[5]); trap->effectvalue2 = atoi(row[6]); @@ -322,7 +310,7 @@ void Trap::CreateHiddenTrigger() make_npc->trackable = 0; make_npc->level = level; strcpy(make_npc->special_abilities, "19,1^20,1^24,1^25,1"); - NPC* npca = new NPC(make_npc, nullptr, xyz_heading(x, y, z, 0.0f), FlyMode3); + NPC* npca = new NPC(make_npc, nullptr, xyz_heading(m_Position, 0.0f), FlyMode3); npca->GiveNPCTypeData(make_npc); entity_list.AddNPC(npca); diff --git a/zone/trap.h b/zone/trap.h index ad2e2171a..ac1925e41 100644 --- a/zone/trap.h +++ b/zone/trap.h @@ -53,9 +53,7 @@ public: Timer respawn_timer; //Respawn Time when Trap's been disarmed Timer chkarea_timer; uint32 trap_id; //Database ID of trap - float x; //X position - float y; //Y position - float z; //Z position + xyz_location m_Position; float maxzdiff; //maximum z diff to be triggerable float radius; //radius around trap to be triggerable uint8 chance; //%chance that the trap is triggered each 'tick' From 51d6ea622ea977b91dd74728b139c4dd317ceadd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 18:13:28 -0800 Subject: [PATCH 0424/1883] Switched to c++11 based abs instead of hacky custom version --- zone/position.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/zone/position.cpp b/zone/position.cpp index 887949f41..90b85726d 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -1,5 +1,7 @@ -#include "position.h" #include +#include + +#include "position.h" #include "../common/string_util.h" xy_location::xy_location(float x, float y) : @@ -68,14 +70,9 @@ const xyz_heading xyz_heading::operator -(const xyz_location& rhs) const{ } void xyz_heading::ABS_XYZ(void) { - if (m_X < 0) - m_X = -m_X; - - if (m_Y < 0) - m_Y = -m_Y; - - if (m_Z < 0) - m_Z = -m_Z; + m_X = abs(m_X); + m_Y = abs(m_Y); + m_Z = abs(m_Z); } xyz_location::xyz_location(float x, float y, float z) : @@ -99,14 +96,9 @@ const xyz_location xyz_location::operator -(const xyz_location& rhs) const { } void xyz_location::ABS_XYZ(void) { - if (m_X < 0) - m_X = -m_X; - - if (m_Y < 0) - m_Y = -m_Y; - - if (m_Z < 0) - m_Z = -m_Z; + m_X = abs(m_X); + m_Y = abs(m_Y); + m_Z = abs(m_Z); } std::string to_string(const xyz_heading &position) { From 1054bfe476c389a073150073c9fdc45b7550503b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 30 Nov 2014 20:32:00 -0600 Subject: [PATCH 0425/1883] command.cpp #include cleanup command.h #include cleanup command.h forward declarations --- zone/command.cpp | 9 +++++---- zone/command.h | 4 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b2914cf46..453c58ec9 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -50,11 +50,16 @@ #include "../common/rulesys.h" #include "../common/serverinfo.h" #include "../common/string_util.h" + #include "client_logs.h" +#include "command.h" #include "guild_mgr.h" #include "map.h" #include "pathing.h" +#include "qglobals.h" #include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" #include "titles.h" #include "water_map.h" #include "worldserver.h" @@ -64,11 +69,7 @@ extern WorldServer worldserver; extern TaskManager *taskmanager; void CatchSignal(int sig_num); -#include "quest_parser_collection.h" -#include "string_ids.h" -#include "command.h" -#include "qglobals.h" //struct cl_struct *commandlist; // the actual linked list of commands int commandcount; // how many commands we have diff --git a/zone/command.h b/zone/command.h index ea710482b..72ee5c06a 100644 --- a/zone/command.h +++ b/zone/command.h @@ -23,9 +23,7 @@ class Client; class Seperator; -#include "../common/seperator.h" -#include "../common/eq_stream.h" -#include "client.h" +#include "../common/types.h" #define COMMAND_CHAR '#' #define CMDALIASES 5 From 708b4f3bfb7053fd7b09618f2eb50e4feee23574 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 18:33:45 -0800 Subject: [PATCH 0426/1883] Horse constructor converted to xyz_heading --- zone/horse.cpp | 6 +++--- zone/horse.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/horse.cpp b/zone/horse.cpp index cdcd8a28e..f4efa931b 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -28,8 +28,8 @@ std::map Horse::horse_types; LinkedList horses_auto_delete; -Horse::Horse(Client *_owner, uint16 spell_id, float x, float y, float z, float heading) - : NPC(GetHorseType(spell_id), nullptr, xyz_heading(x, y, z, heading), FlyMode3) +Horse::Horse(Client *_owner, uint16 spell_id, const xyz_heading& position) + : NPC(GetHorseType(spell_id), nullptr, position, FlyMode3) { //give the horse its proper name. strn0cpy(name, _owner->GetCleanName(), 55); @@ -126,7 +126,7 @@ void Client::SummonHorse(uint16 spell_id) { // No Horse, lets get them one. - Horse* horse = new Horse(this, spell_id, GetX(), GetY(), GetZ(), GetHeading()); + Horse* horse = new Horse(this, spell_id, GetPosition()); //we want to manage the spawn packet ourself. //another reason is we dont want quests executing on it. diff --git a/zone/horse.h b/zone/horse.h index dd58007eb..e34b4aaa0 100644 --- a/zone/horse.h +++ b/zone/horse.h @@ -25,7 +25,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) class Horse : public NPC { public: - Horse(Client *owner, uint16 spell_id, float x, float y, float z, float heading); + Horse(Client *owner, uint16 spell_id, const xyz_heading& position); virtual void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); From 6b1b0838024ea0d784310b04dadf8573f6de467c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 18:57:50 -0800 Subject: [PATCH 0427/1883] mob constructor converted to xyz_heading --- zone/beacon.cpp | 8 +------- zone/client.cpp | 5 +---- zone/corpse.cpp | 13 +++---------- zone/mob.cpp | 14 +++----------- zone/mob.h | 5 +---- zone/npc.cpp | 5 +---- 6 files changed, 10 insertions(+), 40 deletions(-) diff --git a/zone/beacon.cpp b/zone/beacon.cpp index 4713e7c63..2b10ed1ab 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -43,7 +43,7 @@ extern Zone* zone; Beacon::Beacon(Mob *at_mob, int lifetime) :Mob ( - nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, at_mob->GetPosition(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), remove_timer(lifetime), @@ -57,12 +57,6 @@ Beacon::Beacon(Mob *at_mob, int lifetime) spell_iterations = 0; caster_id = 0; - // copy location - m_Position.m_X = at_mob->GetX(); - m_Position.m_Y = at_mob->GetY(); - m_Position.m_Z = at_mob->GetZ(); - m_Position.m_Heading = at_mob->GetHeading(); - if(lifetime) { remove_timer.Start(); diff --git a/zone/client.cpp b/zone/client.cpp index 5f5089d2b..fd229f29d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -89,10 +89,7 @@ Client::Client(EQStreamInterface* ieqs) 0, // npctypeid 0, // size 0.7, // runspeed - 0, // heading - 0, // x - 0, // y - 0, // z + xyz_heading::Origin(), 0, // light 0xFF, // texture 0xFF, // helmtexture diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 5c56be256..766c70345 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -146,8 +146,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP // vesuvias - appearence fix : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid,//bodytype added in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0, - in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0, - in_npc->GetTexture(),in_npc->GetHelmTexture(), + in_npc->GetPosition(), 0, in_npc->GetTexture(),in_npc->GetHelmTexture(), 0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0), corpse_decay_timer(in_decaytime), @@ -212,10 +211,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( 0, // uint32 in_npctype_id, client->GetSize(), // float in_size, 0, // float in_runspeed, - client->GetHeading(), // float in_heading, - client->GetX(), // float in_x_pos, - client->GetY(), // float in_y_pos, - client->GetZ(), // float in_z_pos, + client->GetPosition(), 0, // uint8 in_light, client->GetTexture(), // uint8 in_texture, client->GetHelmTexture(), // uint8 in_helmtexture, @@ -441,10 +437,7 @@ in_level, 0, in_size, 0, -in_heading, -in_x, -in_y, -in_z, +xyz_heading(in_x, in_y,in_z,in_heading), 0, in_texture, in_helmtexture, diff --git a/zone/mob.cpp b/zone/mob.cpp index 48aee2260..8ccbfe5fe 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -45,11 +45,7 @@ Mob::Mob(const char* in_name, uint32 in_npctype_id, float in_size, float in_runspeed, - float in_heading, - float in_x_pos, - float in_y_pos, - float in_z_pos, - + const xyz_heading& position, uint8 in_light, uint8 in_texture, uint8 in_helmtexture, @@ -101,8 +97,8 @@ Mob::Mob(const char* in_name, m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), m_TargetLocation(xyz_location::Origin()), m_TargetV(xyz_location::Origin()), - flee_timer(FLEE_CHECK_TIMER) - + flee_timer(FLEE_CHECK_TIMER), + m_Position(position) { targeted = 0; tar_ndx=0; @@ -149,10 +145,6 @@ Mob::Mob(const char* in_name, if (runspeed < 0 || runspeed > 20) runspeed = 1.25f; - m_Position.m_Heading = in_heading; - m_Position.m_X = in_x_pos; - m_Position.m_Y = in_y_pos; - m_Position.m_Z = in_z_pos; light = in_light; texture = in_texture; helmtexture = in_helmtexture; diff --git a/zone/mob.h b/zone/mob.h index cf904a97d..dd208b615 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -71,10 +71,7 @@ public: uint32 in_npctype_id, float in_size, float in_runspeed, - float in_heading, - float in_x_pos, - float in_y_pos, - float in_z_pos, + const xyz_heading& position, uint8 in_light, uint8 in_texture, uint8 in_helmtexture, diff --git a/zone/npc.cpp b/zone/npc.cpp index 8f947a0c7..f1ea80639 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -68,10 +68,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const xyz_heading& position, int d->npc_id, d->size, d->runspeed, - position.m_Heading, - position.m_X, - position.m_Y, - position.m_Z, + position, d->light, d->texture, d->helmtexture, From 381dc7574f2d33cefe31b6476f51ecbd193c1f38 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 19:14:24 -0800 Subject: [PATCH 0428/1883] replaced _preSummonX, _preSummonY, and _preSummonZ in bot with xyz_location m_PreSummonlocation --- zone/bot.cpp | 8 +++----- zone/bot.h | 16 +++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 05dead52a..b1b926520 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -16279,11 +16279,9 @@ bool Bot::HasOrMayGetAggro() { void Bot::SetHasBeenSummoned(bool wasSummoned) { _hasBeenSummoned = wasSummoned; - if(!wasSummoned) { - _preSummonX = 0; - _preSummonY = 0; - _preSummonZ = 0; - } + if(!wasSummoned) + m_PreSummonLocation = xyz_location::Origin(); + } void Bot::SetDefaultBotStance() { diff --git a/zone/bot.h b/zone/bot.h index 6e7b452af..ffb757c7b 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -448,9 +448,9 @@ public: uint32 GetAA(uint32 aa_id); void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon); bool GetHasBeenSummoned() { return _hasBeenSummoned; } - float GetPreSummonX() { return _preSummonX; } - float GetPreSummonY() { return _preSummonY; } - float GetPreSummonZ() { return _preSummonZ; } + float GetPreSummonX() { return m_PreSummonLocation.m_X; } + float GetPreSummonY() { return m_PreSummonLocation.m_Y; } + float GetPreSummonZ() { return m_PreSummonLocation.m_Z; } bool GetGroupMessagesOn() { return _groupMessagesOn; } bool GetInHealRotation() { return _isInHealRotation; } bool GetHealRotationActive() { return (GetInHealRotation() && _isHealRotationActive); } @@ -535,9 +535,9 @@ public: void SetSpellRecastTimer(int timer_index, int32 recast_delay); void SetDisciplineRecastTimer(int timer_index, int32 recast_delay); void SetHasBeenSummoned(bool s); - void SetPreSummonX(float x) { _preSummonX = x; } - void SetPreSummonY(float y) { _preSummonY = y; } - void SetPreSummonZ(float z) { _preSummonZ = z; } + void SetPreSummonX(float x) { m_PreSummonLocation.m_X = x; } + void SetPreSummonY(float y) { m_PreSummonLocation.m_Y = y; } + void SetPreSummonZ(float z) { m_PreSummonLocation.m_Z = z; } void SetGroupMessagesOn(bool groupMessagesOn) { _groupMessagesOn = groupMessagesOn; } void SetInHealRotation( bool inRotation ) { _isInHealRotation = inRotation; } void SetHealRotationActive( bool isActive ) { _isHealRotationActive = isActive; } @@ -604,9 +604,7 @@ private: int32 end_regen; uint32 timers[MaxTimer]; bool _hasBeenSummoned; - float _preSummonX; - float _preSummonY; - float _preSummonZ; + xyz_location m_PreSummonLocation; uint8 _spellCastingChances[MaxStances][MaxSpellTypes]; bool _groupMessagesOn; bool _isInHealRotation; From 98a8ddbb2104a95781edef2b2f04e2f08fb020c3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 19:23:35 -0800 Subject: [PATCH 0429/1883] Replace GetPreSummonX(), GetPreSummonY(), GetPreSummonZ() with GetPreSummonLocation as xyz_location --- zone/bot.cpp | 6 +++--- zone/bot.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index b1b926520..add609d9a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3371,7 +3371,7 @@ void Bot::AI_Process() { if(GetHasBeenSummoned()) { if(IsBotCaster() || IsBotArcher()) { if (AImovement_timer->Check()) { - if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistNoRootNoZ(GetPreSummonX(), GetPreSummonY()) < 10)) { + if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistNoRootNoZ(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y) < 10)) { if(GetTarget()) FaceTarget(GetTarget()); SetHasBeenSummoned(false); @@ -3380,8 +3380,8 @@ void Bot::AI_Process() { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { mlog(AI__WAYPOINTS, "Returning to location prior to being summoned."); - CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); - SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); + CalculateNewPosition2(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y, m_PreSummonLocation.m_Z, GetRunspeed()); + SetHeading(CalculateHeadingToTarget(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y)); return; } } diff --git a/zone/bot.h b/zone/bot.h index ffb757c7b..a370f9ece 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -448,9 +448,7 @@ public: uint32 GetAA(uint32 aa_id); void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon); bool GetHasBeenSummoned() { return _hasBeenSummoned; } - float GetPreSummonX() { return m_PreSummonLocation.m_X; } - float GetPreSummonY() { return m_PreSummonLocation.m_Y; } - float GetPreSummonZ() { return m_PreSummonLocation.m_Z; } + const xyz_location GetPreSummonLocation() const { return m_PreSummonLocation; } bool GetGroupMessagesOn() { return _groupMessagesOn; } bool GetInHealRotation() { return _isInHealRotation; } bool GetHealRotationActive() { return (GetInHealRotation() && _isHealRotationActive); } From 70d26a532cfff8300d98c83b7294f69a2189e3c2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 19:34:44 -0800 Subject: [PATCH 0430/1883] SetPreSummonX(), SetPreSummonY(), and SetPreSummonZ() converted to SetPreSummonLocation() --- zone/bot.h | 4 +--- zone/mob.cpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/zone/bot.h b/zone/bot.h index a370f9ece..47fafa052 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -533,9 +533,7 @@ public: void SetSpellRecastTimer(int timer_index, int32 recast_delay); void SetDisciplineRecastTimer(int timer_index, int32 recast_delay); void SetHasBeenSummoned(bool s); - void SetPreSummonX(float x) { m_PreSummonLocation.m_X = x; } - void SetPreSummonY(float y) { m_PreSummonLocation.m_Y = y; } - void SetPreSummonZ(float z) { m_PreSummonLocation.m_Z = z; } + void SetPreSummonLocation(const xyz_location& location) { m_PreSummonLocation = location; } void SetGroupMessagesOn(bool groupMessagesOn) { _groupMessagesOn = groupMessagesOn; } void SetInHealRotation( bool inRotation ) { _isInHealRotation = inRotation; } void SetHealRotationActive( bool isActive ) { _isHealRotationActive = isActive; } diff --git a/zone/mob.cpp b/zone/mob.cpp index 8ccbfe5fe..18616323a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2234,9 +2234,7 @@ bool Mob::HateSummon() { if(target && target->IsBot()) { // set pre summoning info to return to (to get out of melee range for caster) target->CastToBot()->SetHasBeenSummoned(true); - target->CastToBot()->SetPreSummonX(target->GetX()); - target->CastToBot()->SetPreSummonY(target->GetY()); - target->CastToBot()->SetPreSummonZ(target->GetZ()); + target->CastToBot()->SetPreSummonLocation(target->GetPosition()); } #endif //BOTS From 9f62f0e485f66f455def51ab4f95d516e28be3b7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 19:47:49 -0800 Subject: [PATCH 0431/1883] replaced pos_x, pos_y, pos_z, heading in Doors with xyz_heading m_Position --- zone/doors.cpp | 36 ++++++++++++++---------------------- zone/doors.h | 13 +++++-------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 4af1d3eae..5b430df80 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -36,17 +36,14 @@ extern EntityList entity_list; extern WorldServer worldserver; -Doors::Doors(const Door* door) -: close_timer(5000) +Doors::Doors(const Door* door) : + close_timer(5000), + m_Position(door->pos_x, door->pos_y, door->pos_z, door->heading) { db_id = door->db_id; door_id = door->door_id; strn0cpy(zone_name,door->zone_name,32); strn0cpy(door_name,door->door_name,32); - pos_x = door->pos_x; - pos_y = door->pos_y; - pos_z = door->pos_z; - heading = door->heading; incline = door->incline; opentype = door->opentype; guild_id = door->guild_id; @@ -74,17 +71,14 @@ Doors::Doors(const Door* door) client_version_mask = door->client_version_mask; } -Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) -: close_timer(5000) +Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) : + close_timer(5000), + m_Position(dx, dy, dz, dheading) { db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); door_id = database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); strn0cpy(zone_name,zone->GetShortName(),32); strn0cpy(door_name,dmodel,32); - pos_x = dx; - pos_y = dy; - pos_z = dz; - heading = dheading; incline = 0; opentype = dopentype; guild_id = 0; @@ -141,7 +135,7 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - _log(DOORS__INFO, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + _log(DOORS__INFO, "%s clicked door %s (dbid %d, eqid %d) at %s", sender->GetName(), door_name, db_id, door_id, to_string(m_Position).c_str()); _log(DOORS__INFO, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); _log(DOORS__INFO, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); @@ -557,8 +551,8 @@ void Doors::ToggleState(Mob *sender) void Doors::DumpDoor(){ LogFile->write(EQEMuLog::Debug, - "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", - db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); + "db_id:%i door_id:%i zone_name:%s door_name:%s %s", + db_id, door_id, zone_name, door_name, to_string(m_Position).c_str()); LogFile->write(EQEMuLog::Debug, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); @@ -706,30 +700,28 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name void Doors::SetLocation(float x, float y, float z) { entity_list.DespawnAllDoors(); - pos_x = x; - pos_y = y; - pos_z = z; + m_Position = xyz_location(x, y, z); entity_list.RespawnAllDoors(); } void Doors::SetX(float in) { entity_list.DespawnAllDoors(); - pos_x = in; + m_Position.m_X = in; entity_list.RespawnAllDoors(); } void Doors::SetY(float in) { entity_list.DespawnAllDoors(); - pos_y = in; + m_Position.m_Y = in; entity_list.RespawnAllDoors(); } void Doors::SetZ(float in) { entity_list.DespawnAllDoors(); - pos_z = in; + m_Position.m_Z = in; entity_list.RespawnAllDoors(); } void Doors::SetHeading(float in) { entity_list.DespawnAllDoors(); - heading = in; + m_Position.m_Heading = in; entity_list.RespawnAllDoors(); } diff --git a/zone/doors.h b/zone/doors.h index 59fe394c8..f79ecd5ea 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -25,10 +25,10 @@ public: char* GetDoorName() { return door_name; } uint32 GetDoorParam() { return door_param; } int GetInvertState() { return invert_state; } - float GetX() { return pos_x; } - float GetY() { return pos_y; } - float GetZ() { return pos_z; } - float GetHeading() { return heading; } + float GetX() { return m_Position.m_X; } + float GetY() { return m_Position.m_Y; } + float GetZ() { return m_Position.m_Z; } + float GetHeading() { return m_Position.m_Heading; } int GetIncline() { return incline; } bool triggered; void SetOpenState(bool st) { isopen = st; } @@ -80,10 +80,7 @@ private: uint8 door_id; char zone_name[32]; char door_name[32]; - float pos_x; - float pos_y; - float pos_z; - float heading; + xyz_heading m_Position; int incline; uint8 opentype; uint32 guild_id; From 95f7bd94f3d5a7db77834523feb9c76389de7fc7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 19:58:56 -0800 Subject: [PATCH 0432/1883] replaced dest_x, dest_y, dest_z, and dest_headingg in Doors with xyz_heading m_Destination --- zone/doors.cpp | 30 ++++++++++++------------------ zone/doors.h | 13 +++++-------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 5b430df80..be4b733a5 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -38,7 +38,8 @@ extern WorldServer worldserver; Doors::Doors(const Door* door) : close_timer(5000), - m_Position(door->pos_x, door->pos_y, door->pos_z, door->heading) + m_Position(door->pos_x, door->pos_y, door->pos_z, door->heading), + m_Destination(door->dest_x, door->dest_y, door->dest_z, door->dest_heading) { db_id = door->db_id; door_id = door->door_id; @@ -62,10 +63,6 @@ Doors::Doors(const Door* door) : strn0cpy(dest_zone,door->dest_zone,32); dest_instance_id = door->dest_instance_id; - dest_x = door->dest_x; - dest_y = door->dest_y; - dest_z = door->dest_z; - dest_heading = door->dest_heading; is_ldon_door = door->is_ldon_door; client_version_mask = door->client_version_mask; @@ -73,7 +70,8 @@ Doors::Doors(const Door* door) : Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) : close_timer(5000), - m_Position(dx, dy, dz, dheading) + m_Position(dx, dy, dz, dheading), + m_Destination(xyz_heading::Origin()) { db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); door_id = database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); @@ -97,10 +95,6 @@ Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, u strn0cpy(dest_zone,"NONE",32); dest_instance_id = 0; - dest_x = 0; - dest_y = 0; - dest_z = 0; - dest_heading = 0; is_ldon_door = 0; client_version_mask = 4294967295u; @@ -137,7 +131,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) //door debugging info dump _log(DOORS__INFO, "%s clicked door %s (dbid %d, eqid %d) at %s", sender->GetName(), door_name, db_id, door_id, to_string(m_Position).c_str()); _log(DOORS__INFO, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - _log(DOORS__INFO, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + _log(DOORS__INFO, " size %d, invert %d, dest: %s %s", size, invert_state, dest_zone, to_string(m_Destination).c_str()); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; @@ -413,7 +407,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) { sender->KeyRingAdd(playerkey); } - sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); + sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Destination.m_X, m_Destination.m_Y, m_Destination.m_Z, m_Destination.m_Heading); } else if (( !IsDoorOpen() || opentype == 58 ) && (keyneeded && ((keyneeded == playerkey) || sender->GetGM()))) { @@ -423,22 +417,22 @@ void Doors::HandleClick(Client* sender, uint8 trigger) } if(database.GetZoneID(dest_zone) == zone->GetZoneID()) { - sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); + sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Destination.m_X, m_Destination.m_Y, m_Destination.m_Z, m_Destination.m_Heading); } else { - sender->MovePC(database.GetZoneID(dest_zone), dest_instance_id, dest_x, dest_y, dest_z, dest_heading); + sender->MovePC(database.GetZoneID(dest_zone), dest_instance_id, m_Destination.m_X, m_Destination.m_Y, m_Destination.m_Z, m_Destination.m_Heading); } } if (( !IsDoorOpen() || opentype == 58 ) && (!keyneeded)) { if(database.GetZoneID(dest_zone) == zone->GetZoneID()) { - sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); + sender->MovePC(zone->GetZoneID(), zone->GetInstanceID(), m_Destination.m_X, m_Destination.m_Y, m_Destination.m_Z, m_Destination.m_Heading); } else { - sender->MovePC(database.GetZoneID(dest_zone), dest_instance_id, dest_x, dest_y, dest_z, dest_heading); + sender->MovePC(database.GetZoneID(dest_zone), dest_instance_id, m_Destination.m_X, m_Destination.m_Y, m_Destination.m_Z, m_Destination.m_Heading); } } } @@ -557,8 +551,8 @@ void Doors::DumpDoor(){ "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); LogFile->write(EQEMuLog::Debug, - "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", - dest_zone, dest_x, dest_y, dest_z, dest_heading); + "dest_zone:%s destination:%s ", + dest_zone, to_string(m_Destination).c_str()); } int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version) { diff --git a/zone/doors.h b/zone/doors.h index f79ecd5ea..3b519f90b 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -50,10 +50,10 @@ public: void SetEntityID(uint32 entity) { entity_id = entity; } void DumpDoor(); - float GetDestX() { return dest_x; } - float GetDestY() { return dest_y; } - float GetDestZ() { return dest_z; } - float GetDestHeading() { return dest_heading; } + float GetDestX() { return m_Destination.m_X; } + float GetDestY() { return m_Destination.m_Y; } + float GetDestZ() { return m_Destination.m_Z; } + float GetDestHeading() { return m_Destination.m_Heading; } uint8 IsLDoNDoor() { return is_ldon_door; } uint32 GetClientVersionMask() { return client_version_mask; } @@ -99,10 +99,7 @@ private: char dest_zone[16]; int dest_instance_id; - float dest_x; - float dest_y; - float dest_z; - float dest_heading; + xyz_heading m_Destination; uint8 is_ldon_door; uint32 client_version_mask; From 40d26b5bcf737d8f5575d43b5e9c5b48dd3b18de Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 20:05:51 -0800 Subject: [PATCH 0433/1883] replaced GetDestX(), GetDestY(), GetDestZ(), and GetDestHeading() with GetDestination in Doors --- zone/doors.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zone/doors.h b/zone/doors.h index 3b519f90b..1a31b67c1 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -50,10 +50,7 @@ public: void SetEntityID(uint32 entity) { entity_id = entity; } void DumpDoor(); - float GetDestX() { return m_Destination.m_X; } - float GetDestY() { return m_Destination.m_Y; } - float GetDestZ() { return m_Destination.m_Z; } - float GetDestHeading() { return m_Destination.m_Heading; } + const xyz_heading GetDestination() const { return m_Destination; } uint8 IsLDoNDoor() { return is_ldon_door; } uint32 GetClientVersionMask() { return client_version_mask; } From a70eadecf47697432755d304488cc9042e779c73 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 20:23:18 -0800 Subject: [PATCH 0434/1883] Replaced GetX(), GetY(), GetZ(), and GetHeading() in Doors with GetPosition() --- zone/bot.cpp | 62 ++++++++++++++++++++------------------------- zone/doors.cpp | 2 +- zone/doors.h | 5 +--- zone/entity.cpp | 36 +++++++++++++------------- zone/lua_door.cpp | 8 +++--- zone/perl_doors.cpp | 8 +++--- 6 files changed, 54 insertions(+), 67 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index add609d9a..76363ab7c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -15854,47 +15854,39 @@ std::list EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacte void EntityList::BotPickLock(Bot* rogue) { - auto it = door_list.begin(); for (auto it = door_list.begin(); it != door_list.end(); ++it) { Doors *cdoor = it->second; - if(cdoor && !cdoor->IsDoorOpen()) { - float zdiff = rogue->GetZ() - cdoor->GetZ(); - if(zdiff < 0) - zdiff = 0 - zdiff; - float curdist = 0; - float tmp = rogue->GetX() - cdoor->GetX(); - curdist += (tmp * tmp); - tmp = rogue->GetY() - cdoor->GetY(); - curdist += (tmp * tmp); - if((zdiff < 10) && (curdist <= 130)) { - // All rogue items with lock pick bonuses are hands or primary - const ItemInst* item1 = rogue->GetBotItem(MainHands); - const ItemInst* item2 = rogue->GetBotItem(MainPrimary); + if(!cdoor || cdoor->IsDoorOpen()) + continue; - float bonus1 = 0.0f; - float bonus2 = 0.0f; - float skill = rogue->GetSkill(SkillPickLock); + auto diff = rogue->GetPosition() - cdoor->GetPosition(); + diff.ABS_XYZ(); - if(item1) { // Hand slot item - if(item1->GetItem()->SkillModType == SkillPickLock) { - bonus1 = skill * (((float)item1->GetItem()->SkillModValue) / 100.0f); - } - } + float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y; - if(item2) { // Primary slot item - if(item2->GetItem()->SkillModType == SkillPickLock) { - bonus2 = skill * (((float)item2->GetItem()->SkillModValue) / 100.0f); - } - } + if((diff.m_Z * diff.m_Z >= 10) || (curdist > 130)) + continue; - if((skill+bonus1+bonus2) >= cdoor->GetLockpick()) { - cdoor->ForceOpen(rogue); - } - else { - rogue->Say("I am not skilled enough for this lock."); - } - } - } + // All rogue items with lock pick bonuses are hands or primary + const ItemInst* item1 = rogue->GetBotItem(MainHands); + const ItemInst* item2 = rogue->GetBotItem(MainPrimary); + + float bonus1 = 0.0f; + float bonus2 = 0.0f; + float skill = rogue->GetSkill(SkillPickLock); + + if(item1) // Hand slot item + if(item1->GetItem()->SkillModType == SkillPickLock) + bonus1 = skill * (((float)item1->GetItem()->SkillModValue) / 100.0f); + + if(item2) // Primary slot item + if(item2->GetItem()->SkillModType == SkillPickLock) + bonus2 = skill * (((float)item2->GetItem()->SkillModValue) / 100.0f); + + if((skill+bonus1+bonus2) >= cdoor->GetLockpick()) + cdoor->ForceOpen(rogue); + else + rogue->Say("I am not skilled enough for this lock."); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index be4b733a5..d54d75edf 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -750,6 +750,6 @@ void Doors::CreateDatabaseEntry() { return; } - database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), GetX(), GetY(), GetZ(), GetHeading(), GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); + database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); } diff --git a/zone/doors.h b/zone/doors.h index 1a31b67c1..3c57b967c 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -25,10 +25,7 @@ public: char* GetDoorName() { return door_name; } uint32 GetDoorParam() { return door_param; } int GetInvertState() { return invert_state; } - float GetX() { return m_Position.m_X; } - float GetY() { return m_Position.m_Y; } - float GetZ() { return m_Position.m_Z; } - float GetHeading() { return m_Position.m_Heading; } + const xyz_heading GetPosition() const{ return m_Position; } int GetIncline() { return incline; } bool triggered; void SetOpenState(bool st) { isopen = st; } diff --git a/zone/entity.cpp b/zone/entity.cpp index 792deaad4..da95f4025 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -855,10 +855,11 @@ bool EntityList::MakeDoorSpawnPacket(EQApplicationPacket *app, Client *client) strlen(door->GetDoorName()) > 3) { memset(&nd, 0, sizeof(nd)); memcpy(nd.name, door->GetDoorName(), 32); - nd.xPos = door->GetX(); - nd.yPos = door->GetY(); - nd.zPos = door->GetZ(); - nd.heading = door->GetHeading(); + auto position = door->GetPosition(); + nd.xPos = position.m_X; + nd.yPos = position.m_Y; + nd.zPos = position.m_Z; + nd.heading = position.m_Heading; nd.incline = door->GetIncline(); nd.size = door->GetSize(); nd.doorId = door->GetDoorID(); @@ -3085,22 +3086,19 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam) void EntityList::OpenDoorsNear(NPC *who) { - auto it = door_list.begin(); - while (it != door_list.end()) { + + for (auto it = door_list.begin();it != door_list.end(); ++it) { Doors *cdoor = it->second; - if (cdoor && !cdoor->IsDoorOpen()) { - float zdiff = who->GetZ() - cdoor->GetZ(); - if (zdiff < 0) - zdiff = 0 - zdiff; - float curdist = 0; - float tmp = who->GetX() - cdoor->GetX(); - curdist += tmp * tmp; - tmp = who->GetY() - cdoor->GetY(); - curdist += tmp * tmp; - if (zdiff < 10 && curdist <= 100) - cdoor->NPCOpen(who); - } - ++it; + if (!cdoor || cdoor->IsDoorOpen()) + continue; + + auto diff = who->GetPosition() - cdoor->GetPosition(); + diff.ABS_XYZ(); + + float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y; + + if (diff.m_Z * diff.m_Z < 10 && curdist <= 100) + cdoor->NPCOpen(who); } } diff --git a/zone/lua_door.cpp b/zone/lua_door.cpp index 091cd0c0e..b6427e70e 100644 --- a/zone/lua_door.cpp +++ b/zone/lua_door.cpp @@ -20,22 +20,22 @@ const char *Lua_Door::GetDoorName() { float Lua_Door::GetX() { Lua_Safe_Call_Real(); - return self->GetX(); + return self->GetPosition().m_X; } float Lua_Door::GetY() { Lua_Safe_Call_Real(); - return self->GetY(); + return self->GetPosition().m_Y; } float Lua_Door::GetZ() { Lua_Safe_Call_Real(); - return self->GetZ(); + return self->GetPosition().m_Z; } float Lua_Door::GetHeading() { Lua_Safe_Call_Real(); - return self->GetHeading(); + return self->GetPosition().m_Heading; } void Lua_Door::SetX(float x) { diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index 77ad1902b..acdef2003 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.cpp @@ -138,7 +138,7 @@ XS(XS_Doors_GetX) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetX(); + RETVAL = THIS->GetPosition().m_X; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -164,7 +164,7 @@ XS(XS_Doors_GetY) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetY(); + RETVAL = THIS->GetPosition().m_Y; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -190,7 +190,7 @@ XS(XS_Doors_GetZ) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetZ(); + RETVAL = THIS->GetPosition().m_Z; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); @@ -216,7 +216,7 @@ XS(XS_Doors_GetHeading) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetHeading(); + RETVAL = THIS->GetPosition().m_Heading; XSprePUSH; PUSHn((double)RETVAL); } XSRETURN(1); From 7239a1339ea6d7ca85c26766a1318060592da8cf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 20:37:43 -0800 Subject: [PATCH 0435/1883] Replaced SetX(), SetY(), SetZ(), and SetHeading() with SetPosition() on Doors --- zone/doors.cpp | 19 ++----------------- zone/doors.h | 7 ++----- zone/lua_door.cpp | 16 ++++++++++++---- zone/perl_doors.cpp | 23 +++++++++++++++-------- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index d54d75edf..ba8668f80 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -698,24 +698,9 @@ void Doors::SetLocation(float x, float y, float z) entity_list.RespawnAllDoors(); } -void Doors::SetX(float in) { +void Doors::SetPosition(const xyz_heading& position) { entity_list.DespawnAllDoors(); - m_Position.m_X = in; - entity_list.RespawnAllDoors(); -} -void Doors::SetY(float in) { - entity_list.DespawnAllDoors(); - m_Position.m_Y = in; - entity_list.RespawnAllDoors(); -} -void Doors::SetZ(float in) { - entity_list.DespawnAllDoors(); - m_Position.m_Z = in; - entity_list.RespawnAllDoors(); -} -void Doors::SetHeading(float in) { - entity_list.DespawnAllDoors(); - m_Position.m_Heading = in; + m_Position = position; entity_list.RespawnAllDoors(); } diff --git a/zone/doors.h b/zone/doors.h index 3c57b967c..f52d04108 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -57,14 +57,11 @@ public: void ForceClose(Mob *sender, bool alt_mode=false); void ToggleState(Mob *sender); - void SetX(float in); - void SetY(float in); - void SetZ(float in); - void SetHeading(float in); + void SetPosition(const xyz_heading& position); + void SetLocation(float x, float y, float z); void SetIncline(int in); void SetDoorName(const char* name); void SetOpenType(uint8 in); - void SetLocation(float x, float y, float z); void SetSize(uint16 size); void CreateDatabaseEntry(); diff --git a/zone/lua_door.cpp b/zone/lua_door.cpp index b6427e70e..bcd0ca284 100644 --- a/zone/lua_door.cpp +++ b/zone/lua_door.cpp @@ -40,22 +40,30 @@ float Lua_Door::GetHeading() { void Lua_Door::SetX(float x) { Lua_Safe_Call_Void(); - self->SetX(x); + auto position = self->GetPosition(); + position.m_X = x; + self->SetPosition(position); } void Lua_Door::SetY(float y) { Lua_Safe_Call_Void(); - self->SetY(y); + auto position = self->GetPosition(); + position.m_Y = y; + self->SetPosition(position); } void Lua_Door::SetZ(float z) { Lua_Safe_Call_Void(); - self->SetZ(z); + auto position = self->GetPosition(); + position.m_Z = z; + self->SetPosition(position); } void Lua_Door::SetHeading(float h) { Lua_Safe_Call_Void(); - self->SetHeading(h); + auto position = self->GetPosition(); + position.m_Heading = h; + self->SetPosition(position); } void Lua_Door::SetLocation(float x, float y, float z) { diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index acdef2003..615cce6e9 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.cpp @@ -556,7 +556,7 @@ XS(XS_Doors_SetX) Perl_croak(aTHX_ "Usage: Doors::SetX(THIS, XPos)"); { Doors * THIS; - float pos = (float)SvNV(ST(1)); + float x = (float)SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -566,8 +566,9 @@ XS(XS_Doors_SetX) Perl_croak(aTHX_ "THIS is not of type Doors"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - - THIS->SetX(pos); + auto position = THIS->GetPosition(); + position.m_X = x; + THIS->SetPosition(position); } XSRETURN_EMPTY; } @@ -580,7 +581,7 @@ XS(XS_Doors_SetY) Perl_croak(aTHX_ "Usage: Doors::SetY(THIS, YPos)"); { Doors * THIS; - float pos = (float)SvNV(ST(1)); + float y = (float)SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -591,7 +592,9 @@ XS(XS_Doors_SetY) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetY(pos); + auto position = THIS->GetPosition(); + position.m_Y = y; + THIS->SetPosition(position); } XSRETURN_EMPTY; } @@ -604,7 +607,7 @@ XS(XS_Doors_SetZ) Perl_croak(aTHX_ "Usage: Doors::SetZ(THIS, ZPos)"); { Doors * THIS; - float pos = (float)SvNV(ST(1)); + float z = (float)SvNV(ST(1)); if (sv_derived_from(ST(0), "Doors")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -615,7 +618,9 @@ XS(XS_Doors_SetZ) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetZ(pos); + auto position = THIS->GetPosition(); + position.m_Z = z; + THIS->SetPosition(position); } XSRETURN_EMPTY; } @@ -639,7 +644,9 @@ XS(XS_Doors_SetHeading) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->SetHeading(heading); + auto position = THIS->GetPosition(); + position.m_Heading = heading; + THIS->SetPosition(position); } XSRETURN_EMPTY; } From 7ac9a5c5a63e47dea2b5e63eaceb57b3ceeae594 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 20:49:48 -0800 Subject: [PATCH 0436/1883] Doors constructor converted to xyz_heading --- zone/doors.cpp | 4 ++-- zone/doors.h | 2 +- zone/entity.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index ba8668f80..24bee901b 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -68,9 +68,9 @@ Doors::Doors(const Door* door) : client_version_mask = door->client_version_mask; } -Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) : +Doors::Doors(const char *dmodel, const xyz_heading& position, uint8 dopentype, uint16 dsize) : close_timer(5000), - m_Position(dx, dy, dz, dheading), + m_Position(position), m_Destination(xyz_heading::Origin()) { db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); diff --git a/zone/doors.h b/zone/doors.h index f52d04108..cd5fa61a1 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -13,7 +13,7 @@ class Doors : public Entity { public: Doors(const Door* door); - Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype = 58, uint16 dsize = 100); + Doors(const char *dmodel, const xyz_heading& position, uint8 dopentype = 58, uint16 dsize = 100); ~Doors(); bool IsDoor() const { return true; } void HandleClick(Client* sender, uint8 trigger); diff --git a/zone/entity.cpp b/zone/entity.cpp index da95f4025..1c17be825 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3852,7 +3852,7 @@ uint16 EntityList::CreateDoor(const char *model, float x, float y, float z, float heading, uint8 opentype, uint16 size) { if (model) { - Doors *door = new Doors(model, x, y, z, heading, opentype, size); + Doors *door = new Doors(model, xyz_heading(x, y, z, heading), opentype, size); RemoveAllDoors(); zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion()); entity_list.AddDoor(door); From 4f03ebb3afdba42d26b241e2dda21fe11f1fd94e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 21:04:39 -0800 Subject: [PATCH 0437/1883] EntityList::CreateDoor converted to xyz_heading --- zone/entity.cpp | 23 ++++++++++++----------- zone/entity.h | 5 +++-- zone/questmgr.cpp | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 1c17be825..8dd09bfab 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3848,19 +3848,20 @@ uint16 EntityList::CreateGroundObjectFromModel(const char *model, float x, return 0; // fell through everything, this is bad/incomplete from perl } -uint16 EntityList::CreateDoor(const char *model, float x, float y, float z, - float heading, uint8 opentype, uint16 size) +uint16 EntityList::CreateDoor(const char *model, const xyz_heading& position, uint8 opentype, uint16 size) { - if (model) { - Doors *door = new Doors(model, xyz_heading(x, y, z, heading), opentype, size); - RemoveAllDoors(); - zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion()); - entity_list.AddDoor(door); - entity_list.RespawnAllDoors(); + if (!model) + return 0; // fell through everything, this is bad/incomplete from perl + + Doors *door = new Doors(model, position, opentype, size); + RemoveAllDoors(); + zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion()); + entity_list.AddDoor(door); + entity_list.RespawnAllDoors(); + + if (door) + return door->GetEntityID(); - if (door) - return door->GetEntityID(); - } return 0; // fell through everything, this is bad/incomplete from perl } diff --git a/zone/entity.h b/zone/entity.h index 486f1d49f..8e888a9b1 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -26,6 +26,7 @@ #include "../common/bodytypes.h" #include "../common/eq_constants.h" +#include "position.h" #include "zonedb.h" #include "zonedump.h" #include "qglobals.h" @@ -52,7 +53,7 @@ class Bot; class BotRaids; #endif -extern EntityList entity_list; +extern EntityList entity_list; class Entity { @@ -388,7 +389,7 @@ public: uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); uint16 CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); - uint16 CreateDoor(const char *model, float x, float y, float z, float heading, uint8 type = 0, uint16 size = 100); + uint16 CreateDoor(const char *model, const xyz_heading& position, uint8 type = 0, uint16 size = 100); void ZoneWho(Client *c, Who_All_Struct* Who); void UnMarkNPC(uint16 ID); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index bcef4ef98..165a37071 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2878,7 +2878,7 @@ void QuestManager::SendMail(const char *to, const char *from, const char *subjec uint16 QuestManager::CreateDoor(const char* model, float x, float y, float z, float heading, uint8 opentype, uint16 size) { uint16 entid = 0; //safety check - entid = entity_list.CreateDoor(model, x, y, z, heading, opentype, size); + entid = entity_list.CreateDoor(model, xyz_heading(x, y, z, heading), opentype, size); return entid; } From d54215ea18f092cff5fb11075bc57d11de5afc13 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 21:20:46 -0800 Subject: [PATCH 0438/1883] EntityList::CreateGroundObjectFromModel converted to to xyz_heading --- zone/entity.cpp | 19 ++++++++++--------- zone/entity.h | 2 +- zone/questmgr.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 8dd09bfab..7b427314b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3835,17 +3835,18 @@ uint16 EntityList::CreateGroundObject(uint32 itemid, float x, float y, float z, return 0; // fell through everything, this is bad/incomplete from perl } -uint16 EntityList::CreateGroundObjectFromModel(const char *model, float x, - float y, float z, float heading, uint8 type, uint32 decay_time) +uint16 EntityList::CreateGroundObjectFromModel(const char *model, const xyz_heading& position, uint8 type, uint32 decay_time) { - if (model) { - Object *object = new Object(model, x, y, z, heading, type); - entity_list.AddObject(object, true); + if (!model) + return 0; - if (object) - return object->GetID(); - } - return 0; // fell through everything, this is bad/incomplete from perl + Object *object = new Object(model, position.m_X, position.m_Y, position.m_Z, position.m_Heading, type); + entity_list.AddObject(object, true); + + if (!object) + return 0; + + return object->GetID(); } uint16 EntityList::CreateDoor(const char *model, const xyz_heading& position, uint8 opentype, uint16 size) diff --git a/zone/entity.h b/zone/entity.h index 8e888a9b1..a992a3a5d 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -388,7 +388,7 @@ public: void ReloadAllClientsTaskState(int TaskID=0); uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); - uint16 CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); + uint16 CreateGroundObjectFromModel(const char *model, const xyz_heading& position, uint8 type = 0x00, uint32 decay_time = 0); uint16 CreateDoor(const char *model, const xyz_heading& position, uint8 type = 0, uint16 size = 100); void ZoneWho(Client *c, Who_All_Struct* Who); void UnMarkNPC(uint16 ID); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 165a37071..8c4de1aed 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2352,7 +2352,7 @@ uint16 QuestManager::CreateGroundObject(uint32 itemid, float x, float y, float z uint16 QuestManager::CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type, uint32 decay_time) { uint16 entid = 0; //safety check - entid = entity_list.CreateGroundObjectFromModel(model, x, y, z, heading, type, decay_time); + entid = entity_list.CreateGroundObjectFromModel(model, xyz_heading(x, y, z, heading), type, decay_time); return entid; } From c3471ed88e33a35323497f611e95db9cac8c485c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 21:30:16 -0800 Subject: [PATCH 0439/1883] EntityList::CreateGroundObject converted to xyz_heading --- zone/entity.cpp | 29 +++++++++++++++-------------- zone/entity.h | 2 +- zone/questmgr.cpp | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 7b427314b..da89e9397 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3816,23 +3816,24 @@ void EntityList::GroupMessage(uint32 gid, const char *from, const char *message) } } -uint16 EntityList::CreateGroundObject(uint32 itemid, float x, float y, float z, - float heading, uint32 decay_time) +uint16 EntityList::CreateGroundObject(uint32 itemid, const xyz_heading& position, uint32 decay_time) { const Item_Struct *is = database.GetItem(itemid); - if (is) { - ItemInst *i = new ItemInst(is, is->MaxCharges); - if (i) { - Object *object = new Object(i, x, y, z, heading,decay_time); - entity_list.AddObject(object, true); + if (!is) + return 0; - safe_delete(i); - if (object) - return object->GetID(); - } - return 0; // fell through itemstruct - } - return 0; // fell through everything, this is bad/incomplete from perl + ItemInst *i = new ItemInst(is, is->MaxCharges); + if (!i) + return 0; + + Object *object = new Object(i, position.m_X, position.m_Y, position.m_Z, position.m_Heading,decay_time); + entity_list.AddObject(object, true); + + safe_delete(i); + if (!object) + return 0; + + return object->GetID(); } uint16 EntityList::CreateGroundObjectFromModel(const char *model, const xyz_heading& position, uint8 type, uint32 decay_time) diff --git a/zone/entity.h b/zone/entity.h index a992a3a5d..176aa1678 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -387,7 +387,7 @@ public: void SaveAllClientsTaskState(); void ReloadAllClientsTaskState(int TaskID=0); - uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); + uint16 CreateGroundObject(uint32 itemid, const xyz_heading& position, uint32 decay_time = 300000); uint16 CreateGroundObjectFromModel(const char *model, const xyz_heading& position, uint8 type = 0x00, uint32 decay_time = 0); uint16 CreateDoor(const char *model, const xyz_heading& position, uint8 type = 0, uint16 size = 100); void ZoneWho(Client *c, Who_All_Struct* Who); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 8c4de1aed..ccf4ef8ea 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2345,7 +2345,7 @@ int QuestManager::getlevel(uint8 type) uint16 QuestManager::CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time) { uint16 entid = 0; //safety check - entid = entity_list.CreateGroundObject(itemid, x, y, z, heading, decay_time); + entid = entity_list.CreateGroundObject(itemid, xyz_heading(x, y, z, heading), decay_time); return entid; } From 4c5117cabe3d39d5e4b507290b0774a1a5dafc36 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 21:42:59 -0800 Subject: [PATCH 0440/1883] QuestManager::CreateGroundObject converted to xyz_heading --- zone/embparser_api.cpp | 24 ++++++++++++------------ zone/lua_general.cpp | 4 ++-- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 0e8b10a8e..b1f3c126d 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -31,7 +31,7 @@ #include "queryserv.h" extern Zone* zone; -extern QueryServ* QServ; +extern QueryServ* QServ; /* @@ -1174,7 +1174,7 @@ XS(XS__createguild) Perl_croak(aTHX_ "Usage: createguild(guild_name, leader)"); char * guild_name = (char *)SvPV_nolen(ST(0)); - char * leader = (char *)SvPV_nolen(ST(1)); + char * leader = (char *)SvPV_nolen(ST(1)); quest_manager.CreateGuild(guild_name, leader); @@ -2668,10 +2668,10 @@ XS(XS__CreateGroundObject) uint16 id = 0; if(items == 5) - id = quest_manager.CreateGroundObject(itemid, x, y, z, heading); + id = quest_manager.CreateGroundObject(itemid, xyz_heading(x, y, z, heading)); else{ uint32 decay_time = (uint32)SvIV(ST(5)); - id = quest_manager.CreateGroundObject(itemid, x, y, z, heading, decay_time); + id = quest_manager.CreateGroundObject(itemid, xyz_heading(x, y, z, heading), decay_time); } XSRETURN_IV(id); @@ -3289,7 +3289,7 @@ XS(XS__GetZoneID) char *zone = (char *)SvPV_nolen(ST(0)); int32 id = quest_manager.GetZoneID(zone); - + XSRETURN_IV(id); } @@ -3302,7 +3302,7 @@ XS(XS__GetZoneLongName) dXSTARG; char *zone = (char *)SvPV_nolen(ST(0)); Const_char* RETVAL = quest_manager.GetZoneLongName(zone); - + sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; XSRETURN(1); } @@ -3432,7 +3432,7 @@ XS(XS__clear_npctype_cache) int32 npctype_id = (int32)SvIV(ST(0)); quest_manager.ClearNPCTypeCache(npctype_id); } - + XSRETURN_EMPTY; } @@ -3455,11 +3455,11 @@ XS(XS__qs_player_event); XS(XS__qs_player_event) { dXSARGS; - if (items != 2){ + if (items != 2){ Perl_croak(aTHX_ "Usage: qs_player_event(char_id, event_desc)"); } else{ - int char_id = (int)SvIV(ST(0)); + int char_id = (int)SvIV(ST(0)); std::string event_desc = (std::string)SvPV_nolen(ST(1)); QServ->PlayerLogEvent(Player_Log_Quest, char_id, event_desc); } @@ -3494,7 +3494,7 @@ XS(XS__crosszonesignalnpcbynpctypeid) if (items == 2) { uint32 npctype_id = (uint32)SvIV(ST(0)); - uint32 data = (uint32)SvIV(ST(1)); + uint32 data = (uint32)SvIV(ST(1)); quest_manager.CrossZoneSignalNPCByNPCTypeID(npctype_id, data); } @@ -3725,8 +3725,8 @@ EXTERN_C XS(boot_quest) newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file); newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file); newXS(strcpy(buf, "clear_npctype_cache"), XS__clear_npctype_cache, file); - newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file); - newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file); + newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file); + newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file); newXS(strcpy(buf, "crosszonesetentityvariablebynpctypeid"), XS__crosszonesetentityvariablebynpctypeid, file); newXS(strcpy(buf, "crosszonesignalnpcbynpctypeid"), XS__crosszonesignalnpcbynpctypeid, file); XSRETURN_YES; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index f18ff95fb..6513d967f 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -685,11 +685,11 @@ int lua_get_level(int type) { } void lua_create_ground_object(uint32 item_id, float x, float y, float z, float h) { - quest_manager.CreateGroundObject(item_id, x, y, z, h); + quest_manager.CreateGroundObject(item_id, xyz_heading(x, y, z, h)); } void lua_create_ground_object(uint32 item_id, float x, float y, float z, float h, uint32 decay_time) { - quest_manager.CreateGroundObject(item_id, x, y, z, h, decay_time); + quest_manager.CreateGroundObject(item_id, xyz_heading(x, y, z, h), decay_time); } void lua_create_ground_object_from_model(const char *model, float x, float y, float z, float h) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index ccf4ef8ea..5afd56efb 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2342,10 +2342,10 @@ int QuestManager::getlevel(uint8 type) return 0; } -uint16 QuestManager::CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time) +uint16 QuestManager::CreateGroundObject(uint32 itemid, const xyz_heading& position, uint32 decay_time) { uint16 entid = 0; //safety check - entid = entity_list.CreateGroundObject(itemid, xyz_heading(x, y, z, heading), decay_time); + entid = entity_list.CreateGroundObject(itemid, position, decay_time); return entid; } diff --git a/zone/questmgr.h b/zone/questmgr.h index 6b47bab04..41314b212 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -207,7 +207,7 @@ public: void enabletitle(int titleset); bool checktitle(int titlecheck); void removetitle(int titlecheck); - uint16 CreateGroundObject(uint32 itemid, float x, float y, float z, float heading, uint32 decay_time = 300000); + uint16 CreateGroundObject(uint32 itemid, const xyz_heading& position, uint32 decay_time = 300000); uint16 CreateGroundObjectFromModel(const char* model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); void ModifyNPCStat(const char *identifier, const char *newValue); void UpdateSpawnTimer(uint32 id, uint32 newTime); @@ -240,7 +240,7 @@ public: uint16 CreateDoor( const char* model, float x, float y, float z, float heading, uint8 opentype, uint16 size); int32 GetZoneID(const char *zone); const char *GetZoneLongName(const char *zone); - void CrossZoneSignalPlayerByCharID(int charid, uint32 data); + void CrossZoneSignalPlayerByCharID(int charid, uint32 data); void CrossZoneSignalNPCByNPCTypeID(uint32 npctype_id, uint32 data); void CrossZoneSignalPlayerByName(const char *CharName, uint32 data); void CrossZoneSetEntityVariableByNPCTypeID(uint32 npctype_id, const char *id, const char *m_var); From c8063c31ed38d4884b7a7918c312c6d35850d06e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 22:05:34 -0800 Subject: [PATCH 0441/1883] QuestMgr::CreateObjectFromModel converted to xyz_heading --- zone/embparser_api.cpp | 2 +- zone/lua_general.cpp | 6 +++--- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index b1f3c126d..ef486b68f 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2699,7 +2699,7 @@ XS(XS__CreateGroundObjectFromModel) if (items > 6) decay_time = (uint32)SvIV(ST(6)); - id = quest_manager.CreateGroundObjectFromModel(modelname, x, y, z, heading, type, decay_time); + id = quest_manager.CreateGroundObjectFromModel(modelname, xyz_heading(x, y, z, heading), type, decay_time); XSRETURN_IV(id); } diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 6513d967f..efc6c48fe 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -693,15 +693,15 @@ void lua_create_ground_object(uint32 item_id, float x, float y, float z, float h } void lua_create_ground_object_from_model(const char *model, float x, float y, float z, float h) { - quest_manager.CreateGroundObjectFromModel(model, x, y, z, h); + quest_manager.CreateGroundObjectFromModel(model, xyz_heading(x, y, z, h)); } void lua_create_ground_object_from_model(const char *model, float x, float y, float z, float h, int type) { - quest_manager.CreateGroundObjectFromModel(model, x, y, z, h, type); + quest_manager.CreateGroundObjectFromModel(model, xyz_heading(x, y, z, h), type); } void lua_create_ground_object_from_model(const char *model, float x, float y, float z, float h, int type, uint32 decay_time) { - quest_manager.CreateGroundObjectFromModel(model, x, y, z, h, type, decay_time); + quest_manager.CreateGroundObjectFromModel(model, xyz_heading(x, y, z, h), type, decay_time); } void lua_create_door(const char *model, float x, float y, float z, float h, int open_type, int size) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 5afd56efb..79123f906 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2349,10 +2349,10 @@ uint16 QuestManager::CreateGroundObject(uint32 itemid, const xyz_heading& positi return entid; } -uint16 QuestManager::CreateGroundObjectFromModel(const char *model, float x, float y, float z, float heading, uint8 type, uint32 decay_time) +uint16 QuestManager::CreateGroundObjectFromModel(const char *model, const xyz_heading& position, uint8 type, uint32 decay_time) { uint16 entid = 0; //safety check - entid = entity_list.CreateGroundObjectFromModel(model, xyz_heading(x, y, z, heading), type, decay_time); + entid = entity_list.CreateGroundObjectFromModel(model, position, type, decay_time); return entid; } diff --git a/zone/questmgr.h b/zone/questmgr.h index 41314b212..1fd028e7b 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -208,7 +208,7 @@ public: bool checktitle(int titlecheck); void removetitle(int titlecheck); uint16 CreateGroundObject(uint32 itemid, const xyz_heading& position, uint32 decay_time = 300000); - uint16 CreateGroundObjectFromModel(const char* model, float x, float y, float z, float heading, uint8 type = 0x00, uint32 decay_time = 0); + uint16 CreateGroundObjectFromModel(const char* model, const xyz_heading& position, uint8 type = 0x00, uint32 decay_time = 0); void ModifyNPCStat(const char *identifier, const char *newValue); void UpdateSpawnTimer(uint32 id, uint32 newTime); void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0); From 8b7a09dbc1a1148fbb4a35e7649ceda6cc86169b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 22:14:57 -0800 Subject: [PATCH 0442/1883] QuestMgr::movePCInstance converted to xyz_heading --- zone/embparser_api.cpp | 4 ++-- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index ef486b68f..4faae7c8c 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2974,12 +2974,12 @@ XS(XS__MovePCInstance) if (items == 4) { - quest_manager.MovePCInstance(zoneid, instanceid, x, y, z, 0.0f); + quest_manager.MovePCInstance(zoneid, instanceid, xyz_heading(x, y, z, 0.0f)); } else { float heading = (float)SvNV(ST(5)); - quest_manager.MovePCInstance(zoneid, instanceid, x, y, z, heading); + quest_manager.MovePCInstance(zoneid, instanceid, xyz_heading(x, y, z, heading)); } XSRETURN_EMPTY; diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 79123f906..bd3c07cef 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2616,12 +2616,12 @@ void QuestManager::RemoveAllFromInstance(uint16 instance_id) } } -void QuestManager::MovePCInstance(int zone_id, int instance_id, float x, float y, float z, float heading) +void QuestManager::MovePCInstance(int zone_id, int instance_id, const xyz_heading& position) { QuestManagerCurrentQuestVars(); if(initiator) { - initiator->MovePC(zone_id, instance_id, x, y, z, heading); + initiator->MovePC(zone_id, instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading); } } diff --git a/zone/questmgr.h b/zone/questmgr.h index 1fd028e7b..6e8c6f4b5 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -223,7 +223,7 @@ public: //void RemoveGroupFromInstance(uint16 instance_id); //potentially useful but not implmented at this time. //void RemoveRaidFromInstance(uint16 instance_id); //potentially useful but not implmented at this time. void RemoveAllFromInstance(uint16 instance_id); - void MovePCInstance(int zone_id, int instance_id, float x, float y, float z, float heading); + void MovePCInstance(int zone_id, int instance_id, const xyz_heading& position); void FlagInstanceByGroupLeader(uint32 zone, int16 version); void FlagInstanceByRaidLeader(uint32 zone, int16 version); const char* varlink(char* perltext, int item_id); From 54f3f7f343abb35b1bf49e977b65aaa7bd909a4c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 22:28:17 -0800 Subject: [PATCH 0443/1883] EntityList::GetRandomClient converted to xyz_location --- zone/entity.cpp | 10 ++++------ zone/entity.h | 2 +- zone/lua_entity_list.cpp | 4 ++-- zone/perl_entity.cpp | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index da89e9397..baae4913f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1561,16 +1561,14 @@ Client *EntityList::GetClientByWID(uint32 iWID) return nullptr; } -Client *EntityList::GetRandomClient(float x, float y, float z, float Distance, Client *ExcludeClient) +Client *EntityList::GetRandomClient(const xyz_location& location, float Distance, Client *ExcludeClient) { std::vector ClientsInRange; - auto it = client_list.begin(); - while (it != client_list.end()) { - if ((it->second != ExcludeClient) && (it->second->DistNoRoot(x, y, z) <= Distance)) + + for (auto it = client_list.begin();it != client_list.end(); ++it) + if ((it->second != ExcludeClient) && (it->second->DistNoRoot(location.m_X, location.m_Y, location.m_Z) <= Distance)) ClientsInRange.push_back(it->second); - ++it; - } if (ClientsInRange.empty()) return nullptr; diff --git a/zone/entity.h b/zone/entity.h index 176aa1678..9a23bafd0 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -150,7 +150,7 @@ public: Client *GetClientByCharID(uint32 iCharID); Client *GetClientByWID(uint32 iWID); Client *GetClient(uint32 ip, uint16 port); - Client *GetRandomClient(float x, float y, float z, float Distance, Client *ExcludeClient = nullptr); + Client *GetRandomClient(const xyz_location& location, float Distance, Client *ExcludeClient = nullptr); Group *GetGroupByMob(Mob* mob); Group *GetGroupByClient(Client* client); Group *GetGroupByID(uint32 id); diff --git a/zone/lua_entity_list.cpp b/zone/lua_entity_list.cpp index eace84a69..9632b6624 100644 --- a/zone/lua_entity_list.cpp +++ b/zone/lua_entity_list.cpp @@ -298,12 +298,12 @@ void Lua_EntityList::MessageGroup(Lua_Mob who, bool skip_close, uint32 type, con Lua_Client Lua_EntityList::GetRandomClient(float x, float y, float z, float dist) { Lua_Safe_Call_Class(Lua_Client); - return self->GetRandomClient(x, y, z, dist); + return self->GetRandomClient(xyz_location(x, y, z), dist); } Lua_Client Lua_EntityList::GetRandomClient(float x, float y, float z, float dist, Lua_Client exclude) { Lua_Safe_Call_Class(Lua_Client); - return self->GetRandomClient(x, y, z, dist, exclude); + return self->GetRandomClient(xyz_location(x, y, z), dist, exclude); } Lua_Mob_List Lua_EntityList::GetMobList() { diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index 3d685e011..a5ad00827 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.cpp @@ -1875,7 +1875,7 @@ XS(XS_EntityList_GetRandomClient) c = INT2PTR(Client *,tmp); } } - RETVAL = entity_list.GetRandomClient(x, y, z, d * d, c); + RETVAL = entity_list.GetRandomClient(xyz_location(x, y, z), d * d, c); ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "Client", (void*)RETVAL); } From e31c95670a13ce08b19d2bb2314629354ec7c242 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 30 Nov 2014 23:50:24 -0800 Subject: [PATCH 0444/1883] EntityList::ProcessMove converted to xyz_location --- zone/client.h | 2 +- zone/client_packet.cpp | 2 +- zone/entity.cpp | 14 +++++++------- zone/entity.h | 2 +- zone/zoning.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zone/client.h b/zone/client.h index dcf665bab..80053a263 100644 --- a/zone/client.h +++ b/zone/client.h @@ -396,7 +396,7 @@ public: inline float ProximityX() const { return(proximity_x); } inline float ProximityY() const { return(proximity_y); } inline float ProximityZ() const { return(proximity_z); } - inline void ClearAllProximities() { entity_list.ProcessMove(this, FLT_MAX, FLT_MAX, FLT_MAX); proximity_x = FLT_MAX; proximity_y = FLT_MAX; proximity_z = FLT_MAX; } + inline void ClearAllProximities() { entity_list.ProcessMove(this, xyz_location(FLT_MAX, FLT_MAX, FLT_MAX)); proximity_x = FLT_MAX; proximity_y = FLT_MAX; proximity_z = FLT_MAX; } /* Begin client modifiers diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 958834784..31d7a192f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4540,7 +4540,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) m_RewindLocation = xyz_location(ppu->x_pos, ppu->y_pos, ppu->z_pos); if(proximity_timer.Check()) { - entity_list.ProcessMove(this, ppu->x_pos, ppu->y_pos, ppu->z_pos); + entity_list.ProcessMove(this, xyz_location(ppu->x_pos, ppu->y_pos, ppu->z_pos)); if(RuleB(TaskSystem, EnableTaskSystem) && RuleB(TaskSystem,EnableTaskProximity)) ProcessTaskProximities(ppu->x_pos, ppu->y_pos, ppu->z_pos); proximity_x = ppu->x_pos; diff --git a/zone/entity.cpp b/zone/entity.cpp index baae4913f..b084235eb 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3160,7 +3160,7 @@ struct quest_proximity_event { int area_type; }; -void EntityList::ProcessMove(Client *c, float x, float y, float z) +void EntityList::ProcessMove(Client *c, const xyz_location& location) { float last_x = c->ProximityX(); float last_y = c->ProximityY(); @@ -3182,9 +3182,9 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) last_z < l->min_z || last_z > l->max_z) { old_in = false; } - if (x < l->min_x || x > l->max_x || - y < l->min_y || y > l->max_y || - z < l->min_z || z > l->max_z) { + if (location.m_X < l->min_x || location.m_X > l->max_x || + location.m_Y < l->min_y || location.m_Y > l->max_y || + location.m_Z < l->min_z || location.m_Z > l->max_z) { new_in = false; } @@ -3217,9 +3217,9 @@ void EntityList::ProcessMove(Client *c, float x, float y, float z) old_in = false; } - if (x < a.min_x || x > a.max_x || - y < a.min_y || y > a.max_y || - z < a.min_z || z > a.max_z ) { + if (location.m_X < a.min_x || location.m_X > a.max_x || + location.m_Y < a.min_y || location.m_Y > a.max_y || + location.m_Z < a.min_z || location.m_Z > a.max_z ) { new_in = false; } diff --git a/zone/entity.h b/zone/entity.h index 9a23bafd0..47bf35be5 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -198,7 +198,7 @@ public: void MobProcess(); void TrapProcess(); void BeaconProcess(); - void ProcessMove(Client *c, float x, float y, float z); + void ProcessMove(Client *c, const xyz_location& location); void ProcessMove(NPC *n, float x, float y, float z); void AddArea(int id, int type, float min_x, float max_x, float min_y, float max_y, float min_z, float max_z); void RemoveArea(int id); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index b05b6a6e1..4dc99dd2b 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -652,7 +652,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z else { if(zoneID == GetZoneID()) { //properly handle proximities - entity_list.ProcessMove(this, m_Position.m_X, m_Position.m_Y, m_Position.m_Z); + entity_list.ProcessMove(this, m_Position); proximity_x = m_Position.m_X; proximity_y = m_Position.m_Y; proximity_z = m_Position.m_Z; From fb1d5842eac17d76853652c309d5d7054cbc15ab Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 00:03:59 -0800 Subject: [PATCH 0445/1883] proximity_x, proximity_y, and proximity_z converted to xyz_location m_Proximity --- zone/client.cpp | 6 ++---- zone/client.h | 13 +++++-------- zone/client_packet.cpp | 5 ++--- zone/zoning.cpp | 4 +--- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index fd229f29d..7cff859b2 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -155,7 +155,8 @@ Client::Client(EQStreamInterface* ieqs) RespawnFromHoverTimer(0), merc_timer(RuleI(Mercs, UpkeepIntervalMS)), ItemTickTimer(10000), - ItemQuestTimer(500) + ItemQuestTimer(500), + m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX) //arbitrary large number { for(int cf=0; cf < _FilterCount; cf++) ClientFilters[cf] = FilterShow; @@ -208,9 +209,6 @@ Client::Client(EQStreamInterface* ieqs) zonesummon_ignorerestrictions = 0; zoning = false; zone_mode = ZoneUnsolicited; - proximity_x = FLT_MAX; //arbitrary large number - proximity_y = FLT_MAX; - proximity_z = FLT_MAX; casting_spell_id = 0; npcflag = false; npclevel = 0; diff --git a/zone/client.h b/zone/client.h index 80053a263..0bba0d931 100644 --- a/zone/client.h +++ b/zone/client.h @@ -393,10 +393,10 @@ public: inline const char* GetLastName() const { return lastname; } - inline float ProximityX() const { return(proximity_x); } - inline float ProximityY() const { return(proximity_y); } - inline float ProximityZ() const { return(proximity_z); } - inline void ClearAllProximities() { entity_list.ProcessMove(this, xyz_location(FLT_MAX, FLT_MAX, FLT_MAX)); proximity_x = FLT_MAX; proximity_y = FLT_MAX; proximity_z = FLT_MAX; } + inline float ProximityX() const { return m_Proximity.m_X; } + inline float ProximityY() const { return m_Proximity.m_Y; } + inline float ProximityZ() const { return m_Proximity.m_Z; } + inline void ClearAllProximities() { entity_list.ProcessMove(this, xyz_location(FLT_MAX, FLT_MAX, FLT_MAX)); m_Proximity = xyz_location(FLT_MAX,FLT_MAX,FLT_MAX); } /* Begin client modifiers @@ -1409,10 +1409,7 @@ private: Timer RespawnFromHoverTimer; Timer merc_timer; - float proximity_x; - float proximity_y; - float proximity_z; - + xyz_location m_Proximity; void BulkSendInventoryItems(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 31d7a192f..1346b20e6 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4543,9 +4543,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) entity_list.ProcessMove(this, xyz_location(ppu->x_pos, ppu->y_pos, ppu->z_pos)); if(RuleB(TaskSystem, EnableTaskSystem) && RuleB(TaskSystem,EnableTaskProximity)) ProcessTaskProximities(ppu->x_pos, ppu->y_pos, ppu->z_pos); - proximity_x = ppu->x_pos; - proximity_y = ppu->y_pos; - proximity_z = ppu->z_pos; + + m_Proximity = xyz_location(ppu->x_pos, ppu->y_pos, ppu->z_pos); } // Update internal state diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 4dc99dd2b..3032662ab 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -653,9 +653,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z if(zoneID == GetZoneID()) { //properly handle proximities entity_list.ProcessMove(this, m_Position); - proximity_x = m_Position.m_X; - proximity_y = m_Position.m_Y; - proximity_z = m_Position.m_Z; + m_Proximity = m_Position; //send out updates to people in zone. SendPosition(); From 0a685d316de33658531baee47181157c3dbaaa39 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 00:26:35 -0800 Subject: [PATCH 0446/1883] zonesummon_x, zonesummon_y, and zonesummon_z converted to xyz_location m_ZoneSummonLocation --- zone/client.cpp | 6 ++---- zone/client.h | 5 ++--- zone/zoning.cpp | 36 ++++++++++++------------------------ 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 7cff859b2..c894a0ad9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -156,7 +156,8 @@ Client::Client(EQStreamInterface* ieqs) merc_timer(RuleI(Mercs, UpkeepIntervalMS)), ItemTickTimer(10000), ItemQuestTimer(500), - m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX) //arbitrary large number + m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number + m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f) { for(int cf=0; cf < _FilterCount; cf++) ClientFilters[cf] = FilterShow; @@ -202,9 +203,6 @@ Client::Client(EQStreamInterface* ieqs) auto_attack = false; auto_fire = false; linkdead_timer.Disable(); - zonesummon_x = -2; - zonesummon_y = -2; - zonesummon_z = -2; zonesummon_id = 0; zonesummon_ignorerestrictions = 0; zoning = false; diff --git a/zone/client.h b/zone/client.h index 0bba0d931..53a8ad521 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1368,9 +1368,8 @@ private: void DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r); void ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm); void ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - float zonesummon_x; - float zonesummon_y; - float zonesummon_z; + + xyz_location m_ZoneSummonLocation; uint16 zonesummon_id; uint8 zonesummon_ignorerestrictions; ZoneMode zone_mode; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 3032662ab..49a5601aa 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -195,9 +195,9 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { dest_z = safe_z; break; case GMSummon: - dest_x = zonesummon_x; - dest_y = zonesummon_y; - dest_z = zonesummon_z; + dest_x = m_ZoneSummonLocation.m_X; + dest_y = m_ZoneSummonLocation.m_Y; + dest_z = m_ZoneSummonLocation.m_Z; ignorerestrictions = 1; break; case GateToBindPoint: @@ -213,9 +213,9 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { break; case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. //recycle zonesummon variables - dest_x = zonesummon_x; - dest_y = zonesummon_y; - dest_z = zonesummon_z; + dest_x = m_ZoneSummonLocation.m_X; + dest_y = m_ZoneSummonLocation.m_Y; + dest_z = m_ZoneSummonLocation.m_Z; break; case ZoneUnsolicited: //client came up with this on its own. //client requested a zoning... what are the cases when this could happen? @@ -391,9 +391,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc //reset to unsolicited. zone_mode = ZoneUnsolicited; - zonesummon_x = 0; - zonesummon_y = 0; - zonesummon_z = 0; + m_ZoneSummonLocation = xyz_location::Origin(); zonesummon_id = 0; zonesummon_ignorerestrictions = 0; } @@ -500,18 +498,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case GMSummon: - zonesummon_x = m_Position.m_X = x; - zonesummon_y = m_Position.m_Y = y; - zonesummon_z = m_Position.m_Z = z; + m_ZoneSummonLocation = m_Position = xyz_heading(x,y,z,heading); SetHeading(heading); zonesummon_id = zoneID; zonesummon_ignorerestrictions = 1; break; case ZoneSolicited: - zonesummon_x = x; - zonesummon_y = y; - zonesummon_z = z; + m_ZoneSummonLocation = xyz_location(x,y,z); SetHeading(heading); zonesummon_id = zoneID; @@ -533,16 +527,12 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z LogFile->write(EQEMuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: - zonesummon_x = m_Position.m_X = x; - zonesummon_y = m_Position.m_Y = y; - zonesummon_z = m_Position.m_Z = z; + m_ZoneSummonLocation = m_Position = xyz_location(x, y, z); SetHeading(heading); break; case Rewind: LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_RewindLocation.m_X, m_RewindLocation.m_Y, m_RewindLocation.m_Z, zone->GetShortName()); - zonesummon_x = m_Position.m_X = x; - zonesummon_y = m_Position.m_Y = y; - zonesummon_z = m_Position.m_Z = z; + m_ZoneSummonLocation = m_Position = xyz_location(x, y, z); SetHeading(heading); break; default: @@ -682,9 +672,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z { if(zm != EvacToSafeCoords && zm != ZoneToSafeCoords && zm != ZoneToBindPoint) { - zonesummon_x = 0; - zonesummon_y = 0; - zonesummon_z = 0; + m_ZoneSummonLocation = xyz_location::Origin(); zonesummon_id = 0; zonesummon_ignorerestrictions = 0; zone_mode = ZoneUnsolicited; From f973d256dc966f0d6853fc3ae0c1c3b0100b92f7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 01:12:19 -0800 Subject: [PATCH 0447/1883] aa_los_me and aa_los_me_heading converted xyz_heading m_AutoAttackPosition --- zone/client.cpp | 7 ++----- zone/client.h | 3 +-- zone/client_packet.cpp | 15 +++------------ zone/client_process.cpp | 20 +++++++------------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index c894a0ad9..c4aab1733 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -157,7 +157,8 @@ Client::Client(EQStreamInterface* ieqs) ItemTickTimer(10000), ItemQuestTimer(500), m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number - m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f) + m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f), + m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f) { for(int cf=0; cf < _FilterCount; cf++) ClientFilters[cf] = FilterShow; @@ -275,10 +276,6 @@ Client::Client(EQStreamInterface* ieqs) m_AssistExemption = 0; m_CheatDetectMoved = false; CanUseReport = true; - aa_los_me.x = 0; - aa_los_me.y = 0; - aa_los_me.z = 0; - aa_los_me_heading = 0; aa_los_them.x = 0; aa_los_them.y = 0; aa_los_them.z = 0; diff --git a/zone/client.h b/zone/client.h index 53a8ad521..ad2414d60 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1211,11 +1211,10 @@ protected: Mob* bind_sight_target; - Map::Vertex aa_los_me; + xyz_heading m_AutoAttackPosition; Map::Vertex aa_los_them; Mob *aa_los_them_mob; bool los_status; - float aa_los_me_heading; bool los_status_facing; QGlobalCache *qGlobals; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1346b20e6..fbbce9e83 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3224,10 +3224,7 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) ranged_timer.Disable(); attack_dw_timer.Disable(); - aa_los_me.x = 0; - aa_los_me.y = 0; - aa_los_me.z = 0; - aa_los_me_heading = 0; + m_AutoAttackPosition = xyz_heading::Origin(); aa_los_them.x = 0; aa_los_them.y = 0; aa_los_them.z = 0; @@ -3244,10 +3241,7 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) if (GetTarget()) { aa_los_them_mob = GetTarget(); - aa_los_me.x = GetX(); - aa_los_me.y = GetY(); - aa_los_me.z = GetZ(); - aa_los_me_heading = GetHeading(); + m_AutoAttackPosition = GetPosition(); aa_los_them.x = aa_los_them_mob->GetX(); aa_los_them.y = aa_los_them_mob->GetY(); aa_los_them.z = aa_los_them_mob->GetZ(); @@ -3256,10 +3250,7 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) } else { - aa_los_me.x = GetX(); - aa_los_me.y = GetY(); - aa_los_me.z = GetZ(); - aa_los_me_heading = GetHeading(); + m_AutoAttackPosition = GetPosition(); aa_los_them.x = 0; aa_los_them.y = 0; aa_los_them.z = 0; diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 14f26f4df..22498e4ab 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -354,38 +354,32 @@ bool Client::Process() { if(aa_los_them_mob) { if(auto_attack_target != aa_los_them_mob || - aa_los_me.x != GetX() || - aa_los_me.y != GetY() || - aa_los_me.z != GetZ() || + m_AutoAttackPosition.m_X != GetX() || + m_AutoAttackPosition.m_Y != GetY() || + m_AutoAttackPosition.m_Z != GetZ() || aa_los_them.x != aa_los_them_mob->GetX() || aa_los_them.y != aa_los_them_mob->GetY() || aa_los_them.z != aa_los_them_mob->GetZ()) { aa_los_them_mob = auto_attack_target; - aa_los_me.x = GetX(); - aa_los_me.y = GetY(); - aa_los_me.z = GetZ(); + m_AutoAttackPosition = GetPosition(); aa_los_them.x = aa_los_them_mob->GetX(); aa_los_them.y = aa_los_them_mob->GetY(); aa_los_them.z = aa_los_them_mob->GetZ(); los_status = CheckLosFN(auto_attack_target); - aa_los_me_heading = GetHeading(); los_status_facing = IsFacingMob(aa_los_them_mob); } // If only our heading changes, we can skip the CheckLosFN call // but above we still need to update los_status_facing - if (aa_los_me_heading != GetHeading()) { - aa_los_me_heading = GetHeading(); + if (m_AutoAttackPosition.m_Heading != GetHeading()) { + m_AutoAttackPosition.m_Heading = GetHeading(); los_status_facing = IsFacingMob(aa_los_them_mob); } } else { aa_los_them_mob = auto_attack_target; - aa_los_me.x = GetX(); - aa_los_me.y = GetY(); - aa_los_me.z = GetZ(); - aa_los_me_heading = GetHeading(); + m_AutoAttackPosition = GetPosition(); aa_los_them.x = aa_los_them_mob->GetX(); aa_los_them.y = aa_los_them_mob->GetY(); aa_los_them.z = aa_los_them_mob->GetZ(); From 5af1998167fc232a6549587b92389deebb9f1e6e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 01:23:58 -0800 Subject: [PATCH 0448/1883] aa_los_them converted to xyz_location m_AutoAttackTargetLocation --- zone/client.cpp | 6 ++---- zone/client.h | 2 +- zone/client_packet.cpp | 12 +++--------- zone/client_process.cpp | 14 +++++--------- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index c4aab1733..e2ec14178 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -158,7 +158,8 @@ Client::Client(EQStreamInterface* ieqs) ItemQuestTimer(500), m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f), - m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f) + m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f), + m_AutoAttackTargetLocation(0.0f, 0.0f, 0.0f) { for(int cf=0; cf < _FilterCount; cf++) ClientFilters[cf] = FilterShow; @@ -276,9 +277,6 @@ Client::Client(EQStreamInterface* ieqs) m_AssistExemption = 0; m_CheatDetectMoved = false; CanUseReport = true; - aa_los_them.x = 0; - aa_los_them.y = 0; - aa_los_them.z = 0; aa_los_them_mob = nullptr; los_status = false; los_status_facing = false; diff --git a/zone/client.h b/zone/client.h index ad2414d60..004adfede 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1212,7 +1212,7 @@ protected: Mob* bind_sight_target; xyz_heading m_AutoAttackPosition; - Map::Vertex aa_los_them; + xyz_location m_AutoAttackTargetLocation; Mob *aa_los_them_mob; bool los_status; bool los_status_facing; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fbbce9e83..475188975 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3225,9 +3225,7 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) attack_dw_timer.Disable(); m_AutoAttackPosition = xyz_heading::Origin(); - aa_los_them.x = 0; - aa_los_them.y = 0; - aa_los_them.z = 0; + m_AutoAttackTargetLocation = xyz_location::Origin(); aa_los_them_mob = nullptr; } else if (app->pBuffer[0] == 1) @@ -3242,18 +3240,14 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { aa_los_them_mob = GetTarget(); m_AutoAttackPosition = GetPosition(); - aa_los_them.x = aa_los_them_mob->GetX(); - aa_los_them.y = aa_los_them_mob->GetY(); - aa_los_them.z = aa_los_them_mob->GetZ(); + m_AutoAttackTargetLocation = aa_los_them_mob->GetPosition(); los_status = CheckLosFN(aa_los_them_mob); los_status_facing = IsFacingMob(aa_los_them_mob); } else { m_AutoAttackPosition = GetPosition(); - aa_los_them.x = 0; - aa_los_them.y = 0; - aa_los_them.z = 0; + m_AutoAttackTargetLocation = xyz_location::Origin(); aa_los_them_mob = nullptr; los_status = false; los_status_facing = false; diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 22498e4ab..7d2bac2c9 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -357,15 +357,13 @@ bool Client::Process() { m_AutoAttackPosition.m_X != GetX() || m_AutoAttackPosition.m_Y != GetY() || m_AutoAttackPosition.m_Z != GetZ() || - aa_los_them.x != aa_los_them_mob->GetX() || - aa_los_them.y != aa_los_them_mob->GetY() || - aa_los_them.z != aa_los_them_mob->GetZ()) + m_AutoAttackTargetLocation.m_X != aa_los_them_mob->GetX() || + m_AutoAttackTargetLocation.m_Y != aa_los_them_mob->GetY() || + m_AutoAttackTargetLocation.m_Z != aa_los_them_mob->GetZ()) { aa_los_them_mob = auto_attack_target; m_AutoAttackPosition = GetPosition(); - aa_los_them.x = aa_los_them_mob->GetX(); - aa_los_them.y = aa_los_them_mob->GetY(); - aa_los_them.z = aa_los_them_mob->GetZ(); + m_AutoAttackTargetLocation = aa_los_them_mob->GetPosition(); los_status = CheckLosFN(auto_attack_target); los_status_facing = IsFacingMob(aa_los_them_mob); } @@ -380,9 +378,7 @@ bool Client::Process() { { aa_los_them_mob = auto_attack_target; m_AutoAttackPosition = GetPosition(); - aa_los_them.x = aa_los_them_mob->GetX(); - aa_los_them.y = aa_los_them_mob->GetY(); - aa_los_them.z = aa_los_them_mob->GetZ(); + m_AutoAttackTargetLocation = aa_los_them_mob->GetPosition(); los_status = CheckLosFN(auto_attack_target); los_status_facing = IsFacingMob(aa_los_them_mob); } From c98964a9e84e1fda6fa0bbe1376d5b01ee281a8a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 10:33:57 -0800 Subject: [PATCH 0449/1883] Lua, perl, boost, zlib, mysql, and glm include files are now being included marked as system (library) files. warnings for these libraries are now suppressed --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e2f5f9e2..0b7569ed5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,8 @@ #EQEMU_DISABLE_LOGSYS #EQEMU_COMMANDS_LOGGING #EQEMU_BUILD_SERVER -#EQEMU_BUILD_LOGIN -#EQEMU_BUILD_TESTS +#EQEMU_BUILD_LOGIN +#EQEMU_BUILD_TESTS #EQEMU_BUILD_PERL #EQEMU_BUILD_LUA #EQEMU_SANITIZE_LUA_LIBS @@ -103,7 +103,7 @@ IF(MSVC) SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO") SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO") ENDIF(EQEMU_DISABLE_SAFESEH) - + OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON) IF(EQEMU_BUILD_MSVC_MP) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") @@ -115,7 +115,7 @@ IF(MSVC) STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ENDIF(${flag_var} MATCHES "/MD") ENDFOREACH(flag_var) - + ADD_DEFINITIONS(-DNOMINMAX) ELSE(MSVC) #Normally set by perl but we don't use the perl flags anymore so we set it. @@ -306,26 +306,26 @@ FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(MySQL REQUIRED) IF(EQEMU_BUILD_PERL) FIND_PACKAGE(PerlLibs REQUIRED) - INCLUDE_DIRECTORIES("${PERL_INCLUDE_PATH}") + INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}") ENDIF(EQEMU_BUILD_PERL) IF(EQEMU_BUILD_LUA) FIND_PACKAGE(EQLua51 REQUIRED) SET(Boost_USE_STATIC_LIBS OFF) - SET(Boost_USE_MULTITHREADED ON) + SET(Boost_USE_MULTITHREADED ON) SET(Boost_USE_STATIC_RUNTIME OFF) SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost") FIND_PACKAGE(Boost REQUIRED) - INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind") - + INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind") + OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) IF(EQEMU_SANITIZE_LUA_LIBS) ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS) ENDIF(EQEMU_SANITIZE_LUA_LIBS) ENDIF(EQEMU_BUILD_LUA) -INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm") +INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm") IF(EQEMU_BUILD_LUA) ADD_SUBDIRECTORY(luabind) From 31d32682b05997ce5a33947821f9e1e7ec4c0264 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 12:30:07 -0800 Subject: [PATCH 0450/1883] ZoneDatabase::InsertDoor converted to xyz_heading --- zone/doors.cpp | 2 +- zone/zonedb.cpp | 236 ++++++++++++++++++++++++------------------------ zone/zonedb.h | 15 +-- 3 files changed, 127 insertions(+), 126 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 24bee901b..5910b320b 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -735,6 +735,6 @@ void Doors::CreateDatabaseEntry() { return; } - database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); + database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), m_Position, GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize()); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 11d76e4af..3b9c69943 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -567,7 +567,7 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) return loadti; } -ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { +ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i AND serialnumber = %i " "ORDER BY slot_id LIMIT 80", CharID, SerialNumber); auto results = QueryDatabase(query); @@ -624,7 +624,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum } -void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { +void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { _log(TRADING__CLIENT, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", @@ -718,7 +718,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { } -void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, const char* ItemName, uint32 Quantity, uint32 Price) { +void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, const char* ItemName, uint32 Quantity, uint32 Price) { std::string query = StringFormat("REPLACE INTO buyer VALUES(%i, %i, %i, \"%s\", %i, %i)", CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); @@ -727,7 +727,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons } -void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { +void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) @@ -735,7 +735,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { } -void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) { +void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) { if(Quantity <= 0) { RemoveBuyLine(CharID, BuySlot); return; @@ -959,16 +959,16 @@ bool ZoneDatabase::LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_ "FROM " "`character_memmed_spells` " "WHERE `id` = %u ORDER BY `slot_id`", character_id); - auto results = database.QueryDatabase(query); + auto results = database.QueryDatabase(query); int i = 0; /* Initialize Spells */ for (i = 0; i < MAX_PP_MEMSPELL; i++){ pp->mem_spells[i] = 0xFFFFFFFF; } for (auto row = results.begin(); row != results.end(); ++row) { - i = atoi(row[0]); + i = atoi(row[0]); if (i < MAX_PP_MEMSPELL && atoi(row[1]) <= SPDAT_RECORDS){ - pp->mem_spells[i] = atoi(row[1]); + pp->mem_spells[i] = atoi(row[1]); } } return true; @@ -982,36 +982,36 @@ bool ZoneDatabase::LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Str "FROM " "`character_spells` " "WHERE `id` = %u ORDER BY `slot_id`", character_id); - auto results = database.QueryDatabase(query); + auto results = database.QueryDatabase(query); int i = 0; /* Initialize Spells */ for (i = 0; i < MAX_PP_SPELLBOOK; i++){ - pp->spell_book[i] = 0xFFFFFFFF; + pp->spell_book[i] = 0xFFFFFFFF; } - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); if (i < MAX_PP_SPELLBOOK && atoi(row[1]) <= SPDAT_RECORDS){ - pp->spell_book[i] = atoi(row[1]); - } - } + pp->spell_book[i] = atoi(row[1]); + } + } return true; } -bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp){ +bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat( "SELECT " "lang_id, " "`value` " "FROM " "`character_languages` " - "WHERE `id` = %u ORDER BY `lang_id`", character_id); - auto results = database.QueryDatabase(query); int i = 0; + "WHERE `id` = %u ORDER BY `lang_id`", character_id); + auto results = database.QueryDatabase(query); int i = 0; /* Initialize Languages */ - for (i = 0; i < MAX_PP_LANGUAGE; i++){ + for (i = 0; i < MAX_PP_LANGUAGE; i++){ pp->languages[i] = 0; } - for (auto row = results.begin(); row != results.end(); ++row) { - i = atoi(row[0]); + for (auto row = results.begin(); row != results.end(); ++row) { + i = atoi(row[0]); if (i < MAX_PP_LANGUAGE){ pp->languages[i] = atoi(row[1]); } @@ -1022,9 +1022,9 @@ bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat("SELECT slot, rank FROM character_leadership_abilities WHERE `id` = %u", character_id); auto results = database.QueryDatabase(query); uint32 slot = 0; - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end(); ++row) { slot = atoi(row[0]); - pp->leader_abilities.ranks[slot] = atoi(row[1]); + pp->leader_abilities.ranks[slot] = atoi(row[1]); } return true; } @@ -1036,17 +1036,17 @@ bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_S "FROM " "`character_disciplines`" "WHERE `id` = %u ORDER BY `slot_id`", character_id); - auto results = database.QueryDatabase(query); + auto results = database.QueryDatabase(query); int i = 0; /* Initialize Disciplines */ memset(pp->disciplines.values, 0, (sizeof(pp->disciplines.values[0]) * MAX_PP_DISCIPLINES)); - for (auto row = results.begin(); row != results.end(); ++row) { - if (i < MAX_PP_DISCIPLINES){ + for (auto row = results.begin(); row != results.end(); ++row) { + if (i < MAX_PP_DISCIPLINES){ pp->disciplines.values[i] = atoi(row[0]); } - i++; - } - return true; + i++; + } + return true; } bool ZoneDatabase::LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct* pp){ @@ -1057,13 +1057,13 @@ bool ZoneDatabase::LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct "FROM " "`character_skills` " "WHERE `id` = %u ORDER BY `skill_id`", character_id); - auto results = database.QueryDatabase(query); int i = 0; + auto results = database.QueryDatabase(query); int i = 0; /* Initialize Skill */ - for (i = 0; i < MAX_PP_SKILL; i++){ + for (i = 0; i < MAX_PP_SKILL; i++){ pp->skills[i] = 0; } - for (auto row = results.begin(); row != results.end(); ++row) { - i = atoi(row[0]); + for (auto row = results.begin(); row != results.end(); ++row) { + i = atoi(row[0]); if (i < MAX_PP_SKILL){ pp->skills[i] = atoi(row[1]); } @@ -1091,7 +1091,7 @@ bool ZoneDatabase::LoadCharacterCurrency(uint32 character_id, PlayerProfile_Stru "ebon_crystals, " "career_ebon_crystals " "FROM " - "character_currency " + "character_currency " "WHERE `id` = %i ", character_id); auto results = database.QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { @@ -1134,7 +1134,7 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str 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; } } @@ -1142,9 +1142,9 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str 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].item_id = atoi(row[r]); r++; pp->bandoliers[i].items[si].icon = atoi(row[r]); r++; - strcpy(pp->bandoliers[i].name, row[r]); r++; + strcpy(pp->bandoliers[i].name, row[r]); r++; si++; } return true; @@ -1152,7 +1152,7 @@ bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat("SELECT `tier`, `tribute` FROM `character_tribute` WHERE `id` = %u", character_id); - auto results = database.QueryDatabase(query); + auto results = database.QueryDatabase(query); int i = 0; for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ pp->tributes[i].tribute = 0xFFFFFFFF; @@ -1170,7 +1170,7 @@ 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 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; @@ -1194,10 +1194,10 @@ bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struc bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp){ std::string query = StringFormat("SELECT `zone_id`, `instance_id`, `x`, `y`, `z`, `heading`, `is_home` FROM `character_bind` WHERE `id` = %u LIMIT 2", character_id); auto results = database.QueryDatabase(query); int i = 0; - for (auto row = results.begin(); row != results.end(); ++row) { + for (auto row = results.begin(); row != results.end(); ++row) { i = 0; /* Is home bind */ - if (atoi(row[6]) == 1){ + if (atoi(row[6]) == 1){ pp->binds[4].zoneId = atoi(row[i++]); pp->binds[4].instance_id = atoi(row[i++]); pp->binds[4].x = atoi(row[i++]); @@ -1225,7 +1225,7 @@ bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, ui } bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home){ - if (zone_id <= 0) { + if (zone_id <= 0) { return false; } @@ -1233,7 +1233,7 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u 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, zone_id, instance_id, x, y, z, heading, is_home); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); if (!results.RowsAffected()) { LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } @@ -1241,9 +1241,9 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u } bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color){ - uint8 red = (color & 0x00FF0000) >> 16; + uint8 red = (color & 0x00FF0000) >> 16; uint8 green = (color & 0x0000FF00) >> 8; - uint8 blue = (color & 0x000000FF); + uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); @@ -1257,30 +1257,30 @@ bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ - std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); + std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); - return true; + return true; } bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp){ - std::string query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", character_id); + std::string query = StringFormat("DELETE FROM `character_tribute` WHERE `id` = %u", character_id); QueryDatabase(query); /* Save Tributes only if we have values... */ for (int i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){ if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ - std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } - } + } return true; } 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); + 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); auto results = QueryDatabase(query); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } @@ -1501,7 +1501,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla "%u," // e_aa_effects "%u," // e_percent_to_aa "%u" // e_expended_aa_spent - ")", + ")", character_id, // " id, " account_id, // " account_id, " EscapeString(pp->name).c_str(), // " `name`, " @@ -1637,8 +1637,8 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->careerRadCrystals, pp->currentEbonCrystals, pp->careerEbonCrystals); - auto results = database.QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id); + auto results = database.QueryDatabase(query); + LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1653,62 +1653,62 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur bool ZoneDatabase::SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ if (spell_id > SPDAT_RECORDS){ return false; } - std::string query = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); - QueryDatabase(query); + std::string query = StringFormat("REPLACE INTO `character_memmed_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); + QueryDatabase(query); return true; } bool ZoneDatabase::SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ if (spell_id > SPDAT_RECORDS){ return false; } - std::string query = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); - QueryDatabase(query); + std::string query = StringFormat("REPLACE INTO `character_spells` (id, slot_id, spell_id) VALUES (%u, %u, %u)", character_id, slot_id, spell_id); + QueryDatabase(query); return true; } bool ZoneDatabase::DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ - std::string query = StringFormat("DELETE FROM `character_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); - QueryDatabase(query); + std::string query = StringFormat("DELETE FROM `character_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); + QueryDatabase(query); return true; } bool ZoneDatabase::DeleteCharacterDisc(uint32 character_id, uint32 slot_id){ - std::string query = StringFormat("DELETE FROM `character_disciplines` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); - QueryDatabase(query); - return true; + std::string query = StringFormat("DELETE FROM `character_disciplines` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); + QueryDatabase(query); + return true; } bool ZoneDatabase::DeleteCharacterBandolier(uint32 character_id, uint32 band_id){ - std::string query = StringFormat("DELETE FROM `character_bandolier` WHERE `bandolier_id` = %u AND `id` = %u", band_id, character_id); - QueryDatabase(query); - return true; + std::string query = StringFormat("DELETE FROM `character_bandolier` WHERE `bandolier_id` = %u AND `id` = %u", band_id, character_id); + QueryDatabase(query); + return true; } bool ZoneDatabase::DeleteCharacterLeadershipAAs(uint32 character_id){ - std::string query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", character_id); - QueryDatabase(query); - return true; + std::string query = StringFormat("DELETE FROM `character_leadership_abilities` WHERE `id` = %u", character_id); + QueryDatabase(query); + return true; } bool ZoneDatabase::DeleteCharacterAAs(uint32 character_id){ - std::string query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", character_id); - QueryDatabase(query); + std::string query = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u", character_id); + QueryDatabase(query); return true; } bool ZoneDatabase::DeleteCharacterDye(uint32 character_id){ std::string query = StringFormat("DELETE FROM `character_material` WHERE `id` = %u", character_id); - QueryDatabase(query); + QueryDatabase(query); return true; } -bool ZoneDatabase::DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ - std::string query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); - QueryDatabase(query); +bool ZoneDatabase::DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id){ + std::string query = StringFormat("DELETE FROM `character_memmed_spells` WHERE `slot_id` = %u AND `id` = %u", slot_id, character_id); + QueryDatabase(query); return true; } bool ZoneDatabase::NoRentExpired(const char* name){ - std::string query = StringFormat("SELECT (UNIX_TIMESTAMP(NOW()) - last_login) FROM `character_data` WHERE name = '%s'", name); + std::string query = StringFormat("SELECT (UNIX_TIMESTAMP(NOW()) - last_login) FROM `character_data` WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) return false; @@ -2113,7 +2113,7 @@ bool ZoneDatabase::LoadMercInfo(Client *client) { auto results = QueryDatabase(query); if (!results.Success()) return false; - + if(results.RowCount() == 0) return false; @@ -2169,7 +2169,7 @@ bool ZoneDatabase::LoadCurrentMerc(Client *client) { if(!results.Success()) return false; - + if(results.RowCount() == 0) return false; @@ -2750,7 +2750,7 @@ void ZoneDatabase::QGlobalPurge() database.QueryDatabase(query); } -void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize){ +void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoor_name, const xyz_heading& position, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize){ std::string query = StringFormat("REPLACE INTO doors (id, doorid, zone, version, name, " "pos_x, pos_y, pos_z, heading, opentype, guild, lockpick, " @@ -2758,8 +2758,8 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo "VALUES('%i', '%i', '%s', '%i', '%s', '%f', '%f', " "'%f', '%f', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')", ddoordbid, ddoorid, zone->GetShortName(), zone->GetInstanceVersion(), - ddoor_name, dxpos, dypos, dzpos, dheading, dopentype, dguildid, - dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize); + ddoor_name, position.m_X, position.m_Y, position.m_Z, position.m_Heading, + dopentype, dguildid, dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize); auto results = QueryDatabase(query); if (!results.Success()) std::cerr << "Error in InsertDoor" << query << "' " << results.ErrorMessage() << std::endl; @@ -3332,13 +3332,13 @@ bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) { if (results.Success() && results2.Success()){ return true; } - + return false; } uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { std::string query = StringFormat( - "UPDATE `zone` SET `graveyard_id` = %u WHERE `zone_idnumber` = %u AND `version` = 0", + "UPDATE `zone` SET `graveyard_id` = %u WHERE `zone_idnumber` = %u AND `version` = 0", graveyard_id, zone_id ); auto results = QueryDatabase(query); @@ -3347,7 +3347,7 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) { std::string query = StringFormat( - "INSERT INTO `graveyard` SET `zone_id` = %u, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f", + "INSERT INTO `graveyard` SET `zone_id` = %u, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f", graveyard_zone_id, graveyard_x, graveyard_y, graveyard_z, graveyard_heading ); auto results = QueryDatabase(query); @@ -3360,7 +3360,7 @@ uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, std::string query = StringFormat( "UPDATE `character_corpses` " "SET `zone_id` = %u, `instance_id` = 0, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, `was_at_graveyard` = 1 " - "WHERE `id` = %d", + "WHERE `id` = %d", zone_id, x, y, z, heading, dbid ); QueryDatabase(query); @@ -3372,7 +3372,7 @@ uint32 ZoneDatabase::GetCharacterCorpseDecayTimer(uint32 corpse_db_id){ auto results = QueryDatabase(query); auto row = results.begin(); if (results.Success() && results.RowsAffected() != 0){ - return atoll(row[0]); + return atoll(row[0]); } return 0; } @@ -3421,12 +3421,12 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c "`wc_8` = %u,\n" "`wc_9` = %u \n" "WHERE `id` = %u", - EscapeString(char_name).c_str(), - zone_id, - instance_id, - char_id, - x, - y, + EscapeString(char_name).c_str(), + zone_id, + instance_id, + char_id, + x, + y, z, heading, dbpc->locked, @@ -3562,29 +3562,29 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui dbpc->item_tint[7].color, dbpc->item_tint[8].color ); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); uint32 last_insert_id = results.LastInsertedID(); /* Dump Items from Inventory */ uint8 first_entry = 0; - for (unsigned int i = 0; i < dbpc->itemcount; i++) { + for (unsigned int i = 0; i < dbpc->itemcount; i++) { if (first_entry != 1){ query = StringFormat("REPLACE INTO `character_corpse_items` \n" " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", - last_insert_id, + last_insert_id, dbpc->items[i].equip_slot, - dbpc->items[i].item_id, - dbpc->items[i].charges, - dbpc->items[i].aug_1, - dbpc->items[i].aug_2, - dbpc->items[i].aug_3, - dbpc->items[i].aug_4, + dbpc->items[i].item_id, + dbpc->items[i].charges, + dbpc->items[i].aug_1, + dbpc->items[i].aug_2, + dbpc->items[i].aug_3, + dbpc->items[i].aug_4, dbpc->items[i].aug_5 ); first_entry = 1; } - else{ + else{ query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", last_insert_id, dbpc->items[i].equip_slot, @@ -3598,13 +3598,13 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui ); } } - auto sc_results = QueryDatabase(query); + auto sc_results = QueryDatabase(query); return last_insert_id; } uint32 ZoneDatabase::GetCharacterBuriedCorpseCount(uint32 char_id) { std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1", char_id); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { return atoi(row[0]); @@ -3614,7 +3614,7 @@ uint32 ZoneDatabase::GetCharacterBuriedCorpseCount(uint32 char_id) { uint32 ZoneDatabase::GetCharacterCorpseCount(uint32 char_id) { std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u'", char_id); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { return atoi(row[0]); @@ -3698,7 +3698,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct "WHERE `id` = %u LIMIT 1\n", corpse_id ); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); uint16 i = 0; for (auto row = results.begin(); row != results.end(); ++row) { pcs->locked = atoi(row[i++]); // is_locked, @@ -3755,7 +3755,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct ); results = QueryDatabase(query); - i = 0; + i = 0; pcs->itemcount = results.RowCount(); uint16 r = 0; for (auto row = results.begin(); row != results.end(); ++row) { @@ -3778,7 +3778,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { Corpse* NewCorpse = 0; std::string query = StringFormat( - "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1", + "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1", char_id ); auto results = QueryDatabase(query); @@ -3796,7 +3796,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z atoi(row[3]) == 1, // bool rezzed false // bool was_at_graveyard ); - if (NewCorpse) { + if (NewCorpse) { entity_list.AddCorpse(NewCorpse); NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); @@ -3820,7 +3820,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id query = StringFormat( "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u'" - "ORDER BY time_of_death", + "ORDER BY time_of_death", char_id ); results = QueryDatabase(query); @@ -3853,7 +3853,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint16 new_instance_id, float new_x, float new_y, float new_z, float new_heading) { std::string query = StringFormat( - "UPDATE `character_corpses` SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, `x` = %f, `y` = %f, `z` = %f, `heading` = %f, `time_of_death` = Now(), `was_at_graveyard` = 0 WHERE `id` = %u", + "UPDATE `character_corpses` SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, `x` = %f, `y` = %f, `z` = %f, `heading` = %f, `time_of_death` = Now(), `was_at_graveyard` = 0 WHERE `id` = %u", new_zone_id, new_instance_id, new_x, new_y, new_z, new_heading, db_id ); auto results = QueryDatabase(query); @@ -3866,7 +3866,7 @@ bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint1 Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { Corpse* NewCorpse = 0; std::string query = StringFormat( - "SELECT `id`, `charid`, `charname`, `x`, `y`, `z`, `heading`, `time_of_death`, `is_rezzed`, `was_at_graveyard` FROM `character_corpses` WHERE `id` = '%u' LIMIT 1", + "SELECT `id`, `charid`, `charname`, `x`, `y`, `z`, `heading`, `time_of_death`, `is_rezzed`, `was_at_graveyard` FROM `character_corpses` WHERE `id` = '%u' LIMIT 1", player_corpse_id ); auto results = QueryDatabase(query); @@ -3889,7 +3889,7 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { } bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { - std::string query; + std::string query; if (!RuleB(Zone, EnableShadowrest)){ query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id); } @@ -3905,7 +3905,7 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { // std::cout << row[3] << std::endl; // std::cout << row[4] << std::endl; // std::cout << row[5] << std::endl; - // std::cout << row[6] << std::endl; + // std::cout << row[6] << std::endl; // std::cout << row[7] << std::endl; // std::cout << row[8] << std::endl; // std::cout << row[9] << std::endl; @@ -3914,7 +3914,7 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { Corpse::LoadFromDBData( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid - row[2], // char_name + row[2], // char_name atof(row[3]), // x float in_x atof(row[4]), // y float in_y atof(row[5]), // z float in_z @@ -3929,7 +3929,7 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { } uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { - std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 0 ORDER BY `time_of_death` LIMIT 1", char_id); + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 0 ORDER BY `time_of_death` LIMIT 1", char_id); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { return atoi(row[0]); @@ -3940,10 +3940,10 @@ uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) { bool ZoneDatabase::ClearCorpseItems(uint32 db_id){ std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id); auto results = QueryDatabase(query); - if (results.Success() && results.RowsAffected() != 0){ + if (results.Success() && results.RowsAffected() != 0){ return true; } - return false; + return false; } bool ZoneDatabase::DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id){ @@ -3978,7 +3978,7 @@ bool ZoneDatabase::BuryAllCharacterCorpses(uint32 char_id) { bool ZoneDatabase::DeleteCharacterCorpse(uint32 db_id) { std::string query = StringFormat("DELETE FROM `character_corpses` WHERE `id` = %d", db_id); auto results = QueryDatabase(query); - if (results.Success() && results.RowsAffected() != 0){ + if (results.Success() && results.RowsAffected() != 0){ return true; } return false; diff --git a/zone/zonedb.h b/zone/zonedb.h index 33554aac3..2dc240817 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -5,6 +5,7 @@ #include "../common/eq_packet_structs.h" #include "../common/loottable.h" #include "zonedump.h" +#include "position.h" #include "../common/faction.h" #include @@ -226,7 +227,7 @@ public: /* Traders */ void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot); void UpdateTraderItemCharges(int char_id, uint32 ItemInstID, int32 charges); - void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice); + void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice); void DeleteTraderItem(uint32 char_id); void DeleteTraderItem(uint32 char_id,uint16 slot_id); @@ -302,14 +303,14 @@ public: Corpse* LoadCharacterCorpse(uint32 player_corpse_id); Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); void MarkCorpseAsRezzed(uint32 dbid); - bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); + bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); bool BuryCharacterCorpse(uint32 dbid); bool BuryAllCharacterCorpses(uint32 charid); - bool DeleteCharacterCorpse(uint32 dbid); + bool DeleteCharacterCorpse(uint32 dbid); bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); - bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); - bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); + bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id); uint32 GetCharacterBuriedCorpseCount(uint32 char_id); @@ -378,7 +379,7 @@ public: int GetHighestWaypoint(uint32 zoneid, uint32 gridid); /* NPCs */ - + uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete uint32 CreateNewNPCCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 extra); uint32 AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime); @@ -445,7 +446,7 @@ public: int32 GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version); int32 GetDoorsCountPlusOne(const char *zone_name, int16 version); int32 GetDoorsDBCountPlusOne(const char *zone_name, int16 version); - void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize); + void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, const xyz_heading& position, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize); /* Blocked Spells */ int32 GetBlockedSpellsCount(uint32 zoneid); From 2fe80d32f961b4b1f7e181ff5ae4e95c0fd225bb Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 13:05:40 -0800 Subject: [PATCH 0451/1883] ZoneSpellsBlocked converted x,y, and z to m_Location as xyz_location --- zone/zone.cpp | 12 ++++++------ zone/zonedb.cpp | 4 +--- zone/zonedb.h | 4 +--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index eaf73f1da..946f432f9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1919,9 +1919,9 @@ bool Zone::IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz) } case 2: { - if ((( nx >= (blocked_spells[x].x-blocked_spells[x].xdiff)) && (nx <= (blocked_spells[x].x+blocked_spells[x].xdiff))) && - (( ny >= (blocked_spells[x].y-blocked_spells[x].ydiff)) && (ny <= (blocked_spells[x].y+blocked_spells[x].ydiff))) && - (( nz >= (blocked_spells[x].z-blocked_spells[x].zdiff)) && (nz <= (blocked_spells[x].z+blocked_spells[x].zdiff)))) + if ((( nx >= (blocked_spells[x].m_Location.m_X-blocked_spells[x].xdiff)) && (nx <= (blocked_spells[x].m_Location.m_X+blocked_spells[x].xdiff))) && + (( ny >= (blocked_spells[x].m_Location.m_Y-blocked_spells[x].ydiff)) && (ny <= (blocked_spells[x].m_Location.m_Y+blocked_spells[x].ydiff))) && + (( nz >= (blocked_spells[x].m_Location.m_Z-blocked_spells[x].zdiff)) && (nz <= (blocked_spells[x].m_Location.m_Z+blocked_spells[x].zdiff)))) { return true; } @@ -1957,9 +1957,9 @@ const char* Zone::GetSpellBlockedMessage(uint32 spell_id, float nx, float ny, fl } case 2: { - if((( nx > (blocked_spells[x].x-blocked_spells[x].xdiff)) && (nx < (blocked_spells[x].x+blocked_spells[x].xdiff))) && - (( ny > (blocked_spells[x].y-blocked_spells[x].ydiff)) && (ny < (blocked_spells[x].y+blocked_spells[x].ydiff))) && - (( nz > (blocked_spells[x].z-blocked_spells[x].zdiff)) && (nz < (blocked_spells[x].z+blocked_spells[x].zdiff)))) + if((( nx > (blocked_spells[x].m_Location.m_X-blocked_spells[x].xdiff)) && (nx < (blocked_spells[x].m_Location.m_X+blocked_spells[x].xdiff))) && + (( ny > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].ydiff)) && (ny < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].ydiff))) && + (( nz > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].zdiff)) && (nz < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].zdiff)))) { return blocked_spells[x].message; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 3b9c69943..740b67a49 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2666,9 +2666,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked memset(&into[index], 0, sizeof(ZoneSpellsBlocked)); into[index].spellid = atoi(row[1]); into[index].type = atoi(row[2]); - into[index].x = atof(row[3]); - into[index].y = atof(row[4]); - into[index].z = atof(row[5]); + into[index].m_Location = xyz_location(atof(row[3]), atof(row[4]), atof(row[5])); into[index].xdiff = atof(row[6]); into[index].ydiff = atof(row[7]); into[index].zdiff = atof(row[8]); diff --git a/zone/zonedb.h b/zone/zonedb.h index 2dc240817..73192f8d2 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -116,9 +116,7 @@ struct PetInfo { struct ZoneSpellsBlocked { uint32 spellid; int8 type; - float x; - float y; - float z; + xyz_location m_Location; float xdiff; float ydiff; float zdiff; From 81d2e7d242de8d72fb4ebaae2f825d9c4b65acdd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 13:32:19 -0800 Subject: [PATCH 0452/1883] xdiff, ydiff, and zdiff in ZoneSpellsBlocked converted to xyz_location m_Difference --- zone/zone.cpp | 12 ++++++------ zone/zonedb.cpp | 4 +--- zone/zonedb.h | 4 +--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 946f432f9..b343c335b 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1919,9 +1919,9 @@ bool Zone::IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz) } case 2: { - if ((( nx >= (blocked_spells[x].m_Location.m_X-blocked_spells[x].xdiff)) && (nx <= (blocked_spells[x].m_Location.m_X+blocked_spells[x].xdiff))) && - (( ny >= (blocked_spells[x].m_Location.m_Y-blocked_spells[x].ydiff)) && (ny <= (blocked_spells[x].m_Location.m_Y+blocked_spells[x].ydiff))) && - (( nz >= (blocked_spells[x].m_Location.m_Z-blocked_spells[x].zdiff)) && (nz <= (blocked_spells[x].m_Location.m_Z+blocked_spells[x].zdiff)))) + if ((( nx >= (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (nx <= (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && + (( ny >= (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (ny <= (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && + (( nz >= (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (nz <= (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) { return true; } @@ -1957,9 +1957,9 @@ const char* Zone::GetSpellBlockedMessage(uint32 spell_id, float nx, float ny, fl } case 2: { - if((( nx > (blocked_spells[x].m_Location.m_X-blocked_spells[x].xdiff)) && (nx < (blocked_spells[x].m_Location.m_X+blocked_spells[x].xdiff))) && - (( ny > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].ydiff)) && (ny < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].ydiff))) && - (( nz > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].zdiff)) && (nz < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].zdiff)))) + if((( nx > (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (nx < (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && + (( ny > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (ny < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && + (( nz > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (nz < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) { return blocked_spells[x].message; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 740b67a49..7f49a1ca1 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2667,9 +2667,7 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked into[index].spellid = atoi(row[1]); into[index].type = atoi(row[2]); into[index].m_Location = xyz_location(atof(row[3]), atof(row[4]), atof(row[5])); - into[index].xdiff = atof(row[6]); - into[index].ydiff = atof(row[7]); - into[index].zdiff = atof(row[8]); + into[index].m_Difference = xyz_location(atof(row[6]), atof(row[7]), atof(row[8])); strn0cpy(into[index].message, row[9], 255); } diff --git a/zone/zonedb.h b/zone/zonedb.h index 73192f8d2..30b51760b 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -117,9 +117,7 @@ struct ZoneSpellsBlocked { uint32 spellid; int8 type; xyz_location m_Location; - float xdiff; - float ydiff; - float zdiff; + xyz_location m_Difference; char message[256]; }; From fb9d76f851e5bc7a05ad59be7e153c643c4cf784 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 14:16:53 -0800 Subject: [PATCH 0453/1883] GetSpellBlockedMessage converted to xyz_location --- zone/spells.cpp | 4 ++-- zone/zone.cpp | 8 ++++---- zone/zone.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index 52bb094fa..da6e4f40c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -522,7 +522,7 @@ bool Mob::DoCastingChecks() } if (zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - const char *msg = zone->GetSpellBlockedMessage(spell_id, GetX(), GetY(), GetZ()); + const char *msg = zone->GetSpellBlockedMessage(spell_id, GetPosition()); if (msg) { Message(13, msg); return false; @@ -1894,7 +1894,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsClient() && !CastToClient()->GetGM()){ if(zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())){ - const char *msg = zone->GetSpellBlockedMessage(spell_id, GetX(), GetY(), GetZ()); + const char *msg = zone->GetSpellBlockedMessage(spell_id, GetPosition()); if(msg){ Message(13, msg); return false; diff --git a/zone/zone.cpp b/zone/zone.cpp index b343c335b..b61cb3968 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1939,7 +1939,7 @@ bool Zone::IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz) return false; } -const char* Zone::GetSpellBlockedMessage(uint32 spell_id, float nx, float ny, float nz) +const char* Zone::GetSpellBlockedMessage(uint32 spell_id, const xyz_location& location) { if(blocked_spells) { @@ -1957,9 +1957,9 @@ const char* Zone::GetSpellBlockedMessage(uint32 spell_id, float nx, float ny, fl } case 2: { - if((( nx > (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (nx < (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && - (( ny > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (ny < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && - (( nz > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (nz < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) + if((( location.m_X > (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (location.m_X < (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && + (( location.m_Y > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (location.m_Y < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && + (( location.m_Z > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (location.m_Z < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) { return blocked_spells[x].message; } diff --git a/zone/zone.h b/zone/zone.h index 0fa390512..48557ccad 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -246,7 +246,7 @@ public: void LoadBlockedSpells(uint32 zoneid); void ClearBlockedSpells(); bool IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz); - const char *GetSpellBlockedMessage(uint32 spell_id, float nx, float ny, float nz); + const char *GetSpellBlockedMessage(uint32 spell_id, const xyz_location& location); int GetTotalBlockedSpells() { return totalBS; } inline bool HasMap() { return zonemap != nullptr; } inline bool HasWaterMap() { return watermap != nullptr; } @@ -324,7 +324,7 @@ private: Timer* Instance_Warning_timer; LinkedList client_auth_list; QGlobalCache *qGlobals; - + Timer hotzone_timer; }; From 395be050a3329a5cbf3532e71f7a5cf5e71a5894 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 1 Dec 2014 18:13:12 -0500 Subject: [PATCH 0454/1883] Switch random function to std::mt19937 Added class EQEmu::Random Functions: EQEmu::Random::Int(int low, int high) EQEmu::Random::Real(double low, double high) EQEmu::Random::Roll(int required) EQEmu::Random::Roll(double required) EQEmu::Random::Reseed() For zone, you will access the random object through the zone object ex. zone->random.Int(0, 100); Int returns a random int between low and high Real returns a random double between low and high Roll(int) returns true if Int(0, 99) < required is true Roll(double) returns true if Real(0.0, 1.0) <= required is true --- common/CMakeLists.txt | 1 + common/misc_functions.cpp | 154 ------------------------------------ common/random.h | 67 ++++++++++++++++ loginserver/client.cpp | 2 +- loginserver/client.h | 3 + world/adventure.cpp | 6 +- world/adventure_manager.cpp | 4 +- world/client.cpp | 20 ++--- world/net.cpp | 2 + world/zonelist.cpp | 4 +- zone/aggro.cpp | 6 +- zone/attack.cpp | 154 +++++++++++++++++------------------- zone/bot.cpp | 146 +++++++++++++++++----------------- zone/botspellsai.cpp | 8 +- zone/client.cpp | 24 +++--- zone/client_packet.cpp | 38 ++++----- zone/client_process.cpp | 14 ++-- zone/command.cpp | 125 ++++++++++++++--------------- zone/effects.cpp | 90 +++++++++------------ zone/embparser_api.cpp | 2 +- zone/entity.cpp | 10 +-- zone/fearpath.cpp | 4 +- zone/forage.cpp | 26 +++--- zone/hate_list.cpp | 4 +- zone/loottables.cpp | 16 ++-- zone/merc.cpp | 106 ++++++++++++------------- zone/mob.cpp | 30 +++---- zone/mob_ai.cpp | 63 ++++++++------- zone/npc.cpp | 24 +++--- zone/object.cpp | 4 +- zone/pathing.cpp | 2 +- zone/pets.cpp | 2 +- zone/spawn2.cpp | 4 +- zone/spawngroup.cpp | 4 +- zone/special_attacks.cpp | 131 +++++++++++++++--------------- zone/spell_effects.cpp | 116 ++++++++++++--------------- zone/spells.cpp | 22 +++--- zone/tradeskills.cpp | 10 +-- zone/trap.cpp | 12 +-- zone/waypoints.cpp | 10 +-- zone/zone.cpp | 6 +- zone/zone.h | 6 +- 42 files changed, 683 insertions(+), 799 deletions(-) create mode 100644 common/random.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 01fcd6df8..07fb4f098 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -168,6 +168,7 @@ SET(common_headers ptimer.h queue.h races.h + random.h rdtsc.h rulesys.h ruletypes.h diff --git a/common/misc_functions.cpp b/common/misc_functions.cpp index 882cc61c7..81fc2434b 100644 --- a/common/misc_functions.cpp +++ b/common/misc_functions.cpp @@ -54,20 +54,6 @@ #include #endif -static bool WELLRNG_init = false; -static int state_i = 0; -static unsigned int STATE[R]; -static unsigned int z0, z1, z2; -unsigned int (*WELLRNG19937)(void); -static unsigned int case_1 (void); -static unsigned int case_2 (void); -static unsigned int case_3 (void); -static unsigned int case_4 (void); -static unsigned int case_5 (void); -static unsigned int case_6 (void); -uint32 rnd_hash(time_t t, clock_t c); -void oneseed(const uint32 seed); - void CoutTimestamp(bool ms) { time_t rawtime; struct tm* gmt_t; @@ -179,41 +165,6 @@ const char * itoa(int num, char* a,int b) { } #endif -/* - * generate a random integer in the range low-high this - * should be used instead of the rand()%limit method - */ -int MakeRandomInt(int low, int high) -{ - if(low >= high) - return(low); - - //return (rand()%(high-low+1) + (low)); - if(!WELLRNG_init) { - WELLRNG_init = true; - oneseed( rnd_hash( time(nullptr), clock() ) ); - WELLRNG19937 = case_1; - } - unsigned int randomnum = ((WELLRNG19937)()); - if(randomnum == 0xffffffffUL) - return high; - return int ((randomnum / (double)0xffffffffUL) * (high - low + 1) + low); -} - -double MakeRandomFloat(double low, double high) -{ - if(low >= high) - return(low); - - //return (rand() / (double)RAND_MAX * (high - low) + low); - if(!WELLRNG_init) { - WELLRNG_init = true; - oneseed( rnd_hash( time(nullptr), clock() ) ); - WELLRNG19937 = case_1; - } - return ((WELLRNG19937)() / (double)0xffffffffUL * (high - low) + low); -} - uint32 rnd_hash( time_t t, clock_t c ) { // Get a uint32 from t and c @@ -239,111 +190,6 @@ uint32 rnd_hash( time_t t, clock_t c ) return ( h1 + differ++ ) ^ h2; } -void oneseed( const uint32 seed ) -{ - // Initialize generator state with seed - // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. - // In previous versions, most significant bits (MSBs) of the seed affect - // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. - register int j = 0; - STATE[j] = seed & 0xffffffffUL; - for (j = 1; j < R; j++) - { - STATE[j] = ( 1812433253UL * ( STATE[j-1] ^ (STATE[j-1] >> 30) ) + j ) & 0xffffffffUL; - } -} - -// WELL RNG code - -/* ***************************************************************************** */ -/* Copyright: Francois Panneton and Pierre L'Ecuyer, University of Montreal */ -/* Makoto Matsumoto, Hiroshima University */ -/* Notice: This code can be used freely for personal, academic, */ -/* or non-commercial purposes. For commercial purposes, */ -/* please contact P. L'Ecuyer at: lecuyer@iro.UMontreal.ca */ -/* A modified "maximally equidistributed" implementation */ -/* by Shin Harase, Hiroshima University. */ -/* ***************************************************************************** */ - -unsigned int case_1 (void){ - // state_i == 0 - z0 = (VRm1Under & MASKL) | (VRm2Under & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0Under = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i = R - 1; - WELLRNG19937 = case_3; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); -} - -static unsigned int case_2 (void){ - // state_i == 1 - z0 = (VRm1 & MASKL) | (VRm2Under & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i = 0; - WELLRNG19937 = case_1; - return (STATE[state_i] ^ (newVM2 & BITMASK)); -} - -static unsigned int case_3 (void){ - // state_i+M1 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1Over); - z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M1 < R) - WELLRNG19937 = case_5; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); -} - -static unsigned int case_4 (void){ - // state_i+M3 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M3 < R) - WELLRNG19937 = case_6; - return (STATE[state_i] ^ (newVM2 & BITMASK)); -} - -static unsigned int case_5 (void){ - // state_i+M2 >= R - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2Over) ^ MAT0POS (1, VM3Over); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i + M2 < R) - WELLRNG19937 = case_4; - return (STATE[state_i] ^ (newVM2Over & BITMASK)); -} - -static unsigned int case_6 (void){ - // 2 <= state_i <= (R - M3 - 1) - z0 = (VRm1 & MASKL) | (VRm2 & MASKU); - z1 = MAT0NEG (-25, V0) ^ MAT0POS (27, VM1); - z2 = MAT3POS (9, VM2) ^ MAT0POS (1, VM3); - newV1 = z1 ^ z2; - newV0 = MAT1 (z0) ^ MAT0NEG (-9, z1) ^ MAT0NEG (-21, z2) ^ MAT0POS (21, newV1); - state_i--; - if (state_i == 1) - WELLRNG19937 = case_2; - return (STATE[state_i] ^ (newVM2 & BITMASK)); -} - -// end WELL RNG code - - float EQ13toFloat(int d) { return ( float(d)/float(1<<2)); diff --git a/common/random.h b/common/random.h new file mode 100644 index 000000000..0e7316007 --- /dev/null +++ b/common/random.h @@ -0,0 +1,67 @@ +#ifndef __random_h__ +#define __random_h__ + +#include +#include + +/* This uses mt19937 seeded with the std::random_device + * The idea is to have this be included as a member of another class + * so mocking out for testing is easier + * If you need to reseed random.Reseed() + * Eventually this should be derived from an abstract base class + */ + +namespace EQEmu { + class Random { + public: + // AKA old MakeRandomInt + const int Int(int low, int high) + { + if (low > high) + std::swap(low, high); + return std::uniform_int_distribution(low, high)(m_gen); // [low, high] + } + + // AKA old MakeRandomFloat + const double Real(double low, double high) + { + if (low > high) + std::swap(low, high); + return std::uniform_real_distribution(low, high)(m_gen); // [low, high) + } + + // example Roll(50) would have a 50% success rate + // Roll(100) 100%, etc + // valid values 0-100 (well, higher works too but ...) + const bool Roll(const int required) + { + return Int(0, 99) < required; + } + + // valid values 0.0 - 1.0 + const bool Roll(const double required) + { + return Real(0.0, 1.0) <= required; + } + + void Reseed() + { + // We could do the seed_seq thing here too if we need better seeding + // but that is mostly overkill for us, so just seed once + std::random_device rd; + m_gen.seed(rd()); + } + + Random() + { + Reseed(); + } + + private: + std::mt19937 m_gen; + }; +} + + +#endif /* !__random_h__ */ + diff --git a/loginserver/client.cpp b/loginserver/client.cpp index 9883c059d..bc0a86fa8 100644 --- a/loginserver/client.cpp +++ b/loginserver/client.cpp @@ -389,7 +389,7 @@ void Client::GenerateKey() '6', '7', '8', '9' }; - key.append((const char*)&key_selection[MakeRandomInt(0, 35)], 1); + key.append((const char*)&key_selection[random.Int(0, 35)], 1); count++; } } diff --git a/loginserver/client.h b/loginserver/client.h index 3248aefb5..c1b44dc6f 100644 --- a/loginserver/client.h +++ b/loginserver/client.h @@ -22,6 +22,7 @@ #include "../common/opcodemgr.h" #include "../common/eq_stream_type.h" #include "../common/eq_stream_factory.h" +#include "../common/random.h" #ifndef WIN32 #include "eq_crypto_api.h" #endif @@ -129,6 +130,8 @@ public: * Gets the connection for this client. */ EQStream *GetConnection() { return connection; } + + EQEmu::Random random; private: EQStream *connection; ClientVersion version; diff --git a/world/adventure.cpp b/world/adventure.cpp index 80b1dcaca..b6db3d6d0 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -4,6 +4,7 @@ #include "../common/rulesys.h" #include "../common/misc_functions.h" #include "../common/string_util.h" +#include "../common/random.h" #include "adventure.h" #include "adventure_manager.h" #include "worlddb.h" @@ -14,6 +15,7 @@ extern ZSList zoneserver_list; extern ClientList client_list; extern AdventureManager adventure_manager; +extern EQEmu::Random emu_random; Adventure::Adventure(AdventureTemplate *t) { @@ -392,8 +394,8 @@ void Adventure::MoveCorpsesToGraveyard() for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter) { - float x = GetTemplate()->graveyard_x + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); - float y = GetTemplate()->graveyard_y + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); + float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); + float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); float z = GetTemplate()->graveyard_z; query = StringFormat("UPDATE character_corpses " diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index aeee8e3c5..47ea42c51 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -3,6 +3,7 @@ #include "../common/string_util.h" #include "../common/servertalk.h" #include "../common/rulesys.h" +#include "../common/random.h" #include "adventure.h" #include "adventure_manager.h" #include "worlddb.h" @@ -14,6 +15,7 @@ extern ZSList zoneserver_list; extern ClientList client_list; +extern EQEmu::Random emu_random; AdventureManager::AdventureManager() { @@ -325,7 +327,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) if(eligible_adventures.size() > 0) { ea_iter = eligible_adventures.begin(); - int c_index = MakeRandomInt(0, (eligible_adventures.size()-1)); + int c_index = emu_random.Int(0, (eligible_adventures.size()-1)); for(int i = 0; i < c_index; ++i) { ++ea_iter; diff --git a/world/client.cpp b/world/client.cpp index f3f1a78c8..0f9b92abf 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -15,6 +15,7 @@ #include "../common/extprofile.h" #include "../common/string_util.h" #include "../common/clientversions.h" +#include "../common/random.h" #include "client.h" #include "worlddb.h" @@ -61,6 +62,7 @@ std::vector character_create_race_class_combos; extern ZSList zoneserver_list; extern LoginServerList loginserverlist; extern ClientList client_list; +extern EQEmu::Random emu_random; extern uint32 numclients; extern volatile bool RunLoops; @@ -519,7 +521,7 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) { char cons[48]="bcdfghjklmnpqrstvwxzybcdgklmnprstvwbcdgkpstrkd"; char rndname[17]="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; char paircons[33]="ngrkndstshthphsktrdrbrgrfrclcr"; - int rndnum=MakeRandomInt(0, 75),n=1; + int rndnum=emu_random.Int(0, 75),n=1; bool dlc=false; bool vwl=false; bool dbl=false; @@ -540,18 +542,18 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) { rndname[0]=vowels[rndnum]; vwl=true; } - int namlen=MakeRandomInt(5, 10); + int namlen=emu_random.Int(5, 10); for (int i=n;i46) { // pick a cons pair if (i>namlen-3) // last 2 chars in name? { // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng" - rndnum=MakeRandomInt(0, 7)*2; + rndnum=emu_random.Int(0, 7)*2; } else { // pick any from the set @@ -569,12 +571,12 @@ bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) { } else { // select a vowel - rndname[i]=vowels[MakeRandomInt(0, 16)]; + rndname[i]=vowels[emu_random.Int(0, 16)]; } vwl=!vwl; if (!dbl && !dlc) { // one chance at double letters in name - if (!MakeRandomInt(0, i+9)) // chances decrease towards end of name + if (!emu_random.Int(0, i+9)) // chances decrease towards end of name { rndname[i+1]=rndname[i]; dbl=true; @@ -831,7 +833,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { QueuePacket(outapp); safe_delete(outapp); - int MailKey = MakeRandomInt(1, INT_MAX); + int MailKey = emu_random.Int(1, INT_MAX); database.SetMailKey(charid, GetIP(), MailKey); @@ -1242,8 +1244,8 @@ void Client::ZoneUnavail() { bool Client::GenPassKey(char* key) { char* passKey=nullptr; - *passKey += ((char)('A'+((int)MakeRandomInt(0, 25)))); - *passKey += ((char)('A'+((int)MakeRandomInt(0, 25)))); + *passKey += ((char)('A'+((int)emu_random.Int(0, 25)))); + *passKey += ((char)('A'+((int)emu_random.Int(0, 25)))); memcpy(key, passKey, strlen(passKey)); return true; } diff --git a/world/net.cpp b/world/net.cpp index ee1158520..44107e39b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -69,6 +69,7 @@ #include "../common/emu_tcp_server.h" #include "../common/patches/patches.h" +#include "../common/random.h" #include "zoneserver.h" #include "console.h" #include "login_server.h" @@ -97,6 +98,7 @@ UCSConnection UCSLink; QueryServConnection QSLink; LauncherList launcher_list; AdventureManager adventure_manager; +EQEmu::Random emu_random; volatile bool RunLoops = true; uint32 numclients = 0; uint32 numzones = 0; diff --git a/world/zonelist.cpp b/world/zonelist.cpp index c97010aa8..c6c1043f5 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -24,10 +24,12 @@ #include "world_config.h" #include "../common/servertalk.h" #include "../common/string_util.h" +#include "../common/random.h" extern uint32 numzones; extern bool holdzones; extern ConsoleList console_list; +extern EQEmu::Random emu_random; void CatchSignal(int sig_num); ZSList::ZSList() @@ -565,7 +567,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip safe_delete(tmp); return; } - uint32 z = MakeRandomInt(0, y-1); + uint32 z = emu_random.Int(0, y-1); ServerPacket* pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct)); ServerZoneReboot_Struct* s = (ServerZoneReboot_Struct*) pack->pBuffer; diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 8f5da2eaa..a904b9707 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -329,7 +329,7 @@ bool Mob::CheckWillAggro(Mob *mob) { || ( fv == FACTION_THREATENLY - && MakeRandomInt(0,99) < THREATENLY_ARRGO_CHANCE - heroicCHA_mod + && zone->random.Roll(THREATENLY_ARRGO_CHANCE - heroicCHA_mod) ) ) ) @@ -1254,7 +1254,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) { return true; //1: The mob has a default 25% chance of being allowed a resistance check against the charm. - if (MakeRandomInt(0, 99) > RuleI(Spells, CharmBreakCheckChance)) + if (zone->random.Int(0, 99) > RuleI(Spells, CharmBreakCheckChance)) return true; if (RuleB(Spells, CharismaCharmDuration)) @@ -1273,7 +1273,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) { //3: At maxed ability, Total Domination has a 50% chance of preventing the charm break that otherwise would have occurred. int16 TotalDominationBonus = caster->aabonuses.CharmBreakChance + caster->spellbonuses.CharmBreakChance + caster->itembonuses.CharmBreakChance; - if (MakeRandomInt(0, 99) < TotalDominationBonus) + if (zone->random.Int(0, 99) < TotalDominationBonus) return true; } diff --git a/zone/attack.cpp b/zone/attack.cpp index 65c3fd9d1..825e90b58 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -339,7 +339,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c // Did we hit? // - float tohit_roll = MakeRandomFloat(0, 100); + float tohit_roll = zone->random.Real(0, 100); mlog(COMBAT__TOHIT, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); @@ -415,7 +415,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) //Live AA - HightenedAwareness int BlockBehindChance = aabonuses.BlockBehind + spellbonuses.BlockBehind + itembonuses.BlockBehind; - if (BlockBehindChance && (BlockBehindChance > MakeRandomInt(1, 100))){ + if (BlockBehindChance && zone->random.Roll(BlockBehindChance)) { bBlockFromRear = true; if (spellbonuses.BlockBehind || itembonuses.BlockBehind) @@ -508,7 +508,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } if(damage > 0){ - roll = MakeRandomFloat(0,100); + roll = zone->random.Real(0,100); if(roll <= RollTable[0]){ damage = -3; } @@ -674,7 +674,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac if (acfail>100) acfail=100; } - if (acfail<=0 || MakeRandomInt(0, 100)>acfail) { + if (acfail<=0 || zone->random.Int(0, 100)>acfail) { float acreduction=1; int acrandom=300; if (database.GetVariable("ACreduction", tmp, 9)) @@ -693,7 +693,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (int32) (GetAC() * acreduction/100.0f); } if (acrandom>0) { - damage -= (myac * MakeRandomInt(0, acrandom) / 10000); + damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; mlog(COMBAT__DAMAGE, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); @@ -721,8 +721,8 @@ int32 Mob::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating) { float d = 10.0; - float mit_roll = MakeRandomFloat(0, mit_rating); - float atk_roll = MakeRandomFloat(0, atk_rating); + float mit_roll = zone->random.Real(0, mit_rating); + float atk_roll = zone->random.Real(0, atk_rating); if (atk_roll > mit_roll) { float a_diff = atk_roll - mit_roll; @@ -771,8 +771,8 @@ int32 Client::GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit, dmg_bonus -= dmg_bonus * (itembonuses.MeleeMitigation / 100.0); dmg_interval -= dmg_interval * spellMeleeMit; - float mit_roll = MakeRandomFloat(0, mit_rating); - float atk_roll = MakeRandomFloat(0, atk_rating); + float mit_roll = zone->random.Real(0, mit_rating); + float atk_roll = zone->random.Real(0, atk_rating); if (atk_roll > mit_roll) { float a_diff = atk_roll - mit_roll; @@ -1272,7 +1272,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(RuleB(Combat, UseIntervalAC)) damage = max_hit; else - damage = MakeRandomInt(min_hit, max_hit); + damage = zone->random.Int(min_hit, max_hit); damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); @@ -1296,9 +1296,9 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b } else { //we hit, try to avoid it other->AvoidDamage(this, damage); other->MeleeMitigation(this, damage, min_hit, opts); - if(damage > 0) + if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - + mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage); } @@ -1314,7 +1314,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b OffhandRiposteFail *= -1; //Live uses a negative value for this. if (OffhandRiposteFail && - (OffhandRiposteFail > 99 || (MakeRandomInt(0, 100) < OffhandRiposteFail))) { + (OffhandRiposteFail > 99 || zone->random.Roll(OffhandRiposteFail))) { damage = 0; // Counts as a miss slippery_attack = true; } else @@ -1330,7 +1330,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (((damage < 0) || slippery_attack) && !bRiposte && !IsStrikethrough) { // Hack to still allow Strikethrough chance w/ Slippery Attacks AA int32 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; - if(bonusStrikeThrough && (MakeRandomInt(0, 100) < bonusStrikeThrough)) { + if(bonusStrikeThrough && zone->random.Roll(bonusStrikeThrough)) { Message_StringID(MT_StrikeThrough, STRIKETHROUGH_STRING); // You strike through your opponents defenses! Attack(other, Hand, false, true); // Strikethrough only gives another attempted hit return false; @@ -1843,7 +1843,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(RuleB(Combat, UseIntervalAC)) damage = (max_dmg+eleBane); else - damage = MakeRandomInt((min_dmg+eleBane),(max_dmg+eleBane)); + damage = zone->random.Int((min_dmg+eleBane),(max_dmg+eleBane)); //check if we're hitting above our max or below it. @@ -3438,17 +3438,16 @@ bool Client::CheckDoubleAttack(bool tripleAttack) { chance *= float(100.0f+triple_bonus)/100.0f; //Apply modifiers. } - if((MakeRandomFloat(0, 1) < chance)) + if(zone->random.Roll(chance)) return true; return false; } bool Client::CheckDoubleRangedAttack() { - int32 chance = spellbonuses.DoubleRangedAttack + itembonuses.DoubleRangedAttack + aabonuses.DoubleRangedAttack; - if(chance && (MakeRandomInt(0, 100) < chance)) + if(chance && zone->random.Roll(chance)) return true; return false; @@ -3465,7 +3464,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons mlog(COMBAT__DAMAGE, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } - + if( spell_id != SPELL_UNKNOWN || attacker == nullptr ) avoidable = false; @@ -3632,7 +3631,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } } - if (stun_chance && MakeRandomInt(0, 99) < stun_chance) { + if (stun_chance && zone->random.Roll(stun_chance)) { // Passed stun, try to resist now int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; @@ -3645,18 +3644,18 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // frontal stun check for ogres/bonuses if (((GetBaseRace() == OGRE && IsClient()) || - (frontal_stun_resist && MakeRandomInt(0, 99) < frontal_stun_resist)) && + (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { mlog(COMBAT__HITS, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. - if (stun_resist && MakeRandomInt(0, 99) < stun_resist) { + if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); mlog(COMBAT__HITS, "Stun Resisted. %d chance.", stun_resist); } else { mlog(COMBAT__HITS, "Stunned. %d resist chance.", stun_resist); - Stun(MakeRandomInt(0, 2) * 1000); // 0-2 seconds + Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { @@ -3937,7 +3936,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { for (int i = 0; i < MAX_PROCS; i++) { if (IsValidSpell(DefensiveProcs[i].spellID)) { float chance = ProcChance * (static_cast(DefensiveProcs[i].chance)/100.0f); - if ((MakeRandomFloat(0, 1) <= chance)) { + if (zone->random.Roll(chance)) { ExecWeaponProc(nullptr, DefensiveProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_DefensiveSpellProcs,0,DefensiveProcs[i].base_spellID); } @@ -3999,7 +3998,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on if (weapon->Proc.Type == ET_CombatProc) { float WPC = ProcChance * (100.0f + // Proc chance for this weapon static_cast(weapon->ProcRate)) / 100.0f; - if (MakeRandomFloat(0, 1) <= WPC) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. + if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { mlog(COMBAT__PROCS, "Tried to proc (%s), but our level (%d) is lower than required (%d)", @@ -4037,7 +4036,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on if (aug->Proc.Type == ET_CombatProc) { float APC = ProcChance * (100.0f + // Proc chance for this aug static_cast(aug->ProcRate)) / 100.0f; - if (MakeRandomFloat(0, 1) <= APC) { + if (zone->random.Roll(APC)) { if (aug->Proc.Level > ourlevel) { if (IsPet()) { Mob *own = GetOwner(); @@ -4090,7 +4089,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (!rangedattk) { // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { - if (MakeRandomInt(0, 99) < PermaProcs[i].chance) { // TODO: Do these get spell bonus? + if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? mlog(COMBAT__PROCS, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); @@ -4105,7 +4104,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Spell procs (buffs) if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); - if (MakeRandomFloat(0, 1) <= chance) { + if (zone->random.Roll(chance)) { mlog(COMBAT__PROCS, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); @@ -4121,7 +4120,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // ranged spell procs (buffs) if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); - if (MakeRandomFloat(0, 1) <= chance) { + if (zone->random.Roll(chance)) { mlog(COMBAT__PROCS, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); @@ -4189,7 +4188,7 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage) critChance /= 100; - if(MakeRandomFloat(0, 1) < critChance) + if(zone->random.Roll(critChance)) { critMod += GetCritDmgMob(skill) * 2; // To account for base crit mod being 200 not 100 damage = (damage * critMod) / 100; @@ -4228,7 +4227,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack int32 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0]; if (SlayRateBonus) { float slayChance = static_cast(SlayRateBonus) / 10000.0f; - if (MakeRandomFloat(0, 1) < slayChance) { + if (zone->random.Roll(slayChance)) { int32 SlayDmgBonus = aabonuses.SlayUndead[1] + itembonuses.SlayUndead[1] + spellbonuses.SlayUndead[1]; damage = (damage * SlayDmgBonus * 2.25) / 100; if (GetGender() == 1) // female @@ -4299,12 +4298,12 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack critChance /= 100; - if(MakeRandomFloat(0, 1) < critChance) + if(zone->random.Roll(critChance)) { uint32 critMod = 200; bool crip_success = false; int32 CripplingBlowChance = GetCrippBlowChance(); - + //Crippling Blow Chance: The percent value of the effect is applied //to the your Chance to Critical. (ie You have 10% chance to critical and you //have a 200% Chance to Critical Blow effect, therefore you have a 20% Chance to Critical Blow. @@ -4312,7 +4311,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack if (!IsBerserk() && !IsBerskerSPA) critChance *= float(CripplingBlowChance)/100.0f; - if ((IsBerserk() || IsBerskerSPA) || MakeRandomFloat(0, 1) < critChance) { + if ((IsBerserk() || IsBerskerSPA) || zone->random.Roll(critChance)) { critMod = 400; crip_success = true; } @@ -4322,7 +4321,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack damage = damage * critMod / 100; bool deadlySuccess = false; - if (deadlyChance && MakeRandomFloat(0, 1) < static_cast(deadlyChance) / 100.0f) { + if (deadlyChance && zone->random.Roll(static_cast(deadlyChance) / 100.0f)) { if (BehindMob(defender, GetX(), GetY())) { damage *= deadlyMod; deadlySuccess = true; @@ -4358,7 +4357,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){ uint32 FB_Dmg = aabonuses.FinishingBlow[1] + spellbonuses.FinishingBlow[1] + itembonuses.FinishingBlow[1]; - + uint32 FB_Level = 0; FB_Level = aabonuses.FinishingBlowLvl[0]; if (FB_Level < spellbonuses.FinishingBlowLvl[0]) @@ -4369,7 +4368,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) //Proc Chance value of 500 = 5% uint32 ProcChance = (aabonuses.FinishingBlow[0] + spellbonuses.FinishingBlow[0] + spellbonuses.FinishingBlow[0])/10; - if(FB_Level && FB_Dmg && (defender->GetLevel() <= FB_Level) && (ProcChance >= MakeRandomInt(0, 1000))){ + if(FB_Level && FB_Dmg && (defender->GetLevel() <= FB_Level) && (ProcChance >= zone->random.Int(0, 1000))){ entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); DoSpecialAttackDamage(defender, skillinuse, FB_Dmg, 1, -1, 10, false, false); return true; @@ -4396,7 +4395,7 @@ void Mob::DoRiposte(Mob* defender) { defender->itembonuses.DoubleRiposte; //Live AA - Double Riposte - if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { + if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { mlog(COMBAT__ATTACKS, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; @@ -4407,7 +4406,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; - if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { + if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { mlog(COMBAT__ATTACKS, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) @@ -4510,7 +4509,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui uint16 proc_spell_id = 0; float ProcMod = 0; float chance = 0; - + if (IsDefensive) chance = on->GetSkillProcChances(ReuseTime, hand); else @@ -4519,16 +4518,14 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (spellbonuses.LimitToSkill[skill]){ for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && + if (CanProc && (!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e]))) { base_spell_id = spellbonuses.SkillProc[e]; base_spell_id = 0; ProcMod = 0; - + for (int i = 0; i < EFFECT_COUNT; i++) { - if (spells[base_spell_id].effectid[i] == SE_SkillProc) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); @@ -4538,7 +4535,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); - if (MakeRandomFloat(0, 1) <= final_chance) { + if (zone->random.Roll(final_chance)) { ExecWeaponProc(nullptr, proc_spell_id, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs,0, base_spell_id); CanProc = false; @@ -4558,8 +4555,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (itembonuses.LimitToSkill[skill]){ CanProc = true; for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && + if (CanProc && (!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e]))) { base_spell_id = itembonuses.SkillProc[e]; @@ -4567,7 +4563,6 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui ProcMod = 0; for (int i = 0; i < EFFECT_COUNT; i++) { - if (spells[base_spell_id].effectid[i] == SE_SkillProc) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); @@ -4577,7 +4572,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); - if (MakeRandomFloat(0, 1) <= final_chance) { + if (zone->random.Roll(final_chance)) { ExecWeaponProc(nullptr, proc_spell_id, on); CanProc = false; break; @@ -4602,8 +4597,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui uint32 slot = 0; for(int e = 0; e < MAX_SKILL_PROCS; e++){ - - if (CanProc && + if (CanProc && (!Success && aabonuses.SkillProc[e]) || (Success && aabonuses.SkillProcSuccess[e])){ int aaid = aabonuses.SkillProc[e]; @@ -4630,7 +4624,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && base1 == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); - if (MakeRandomFloat(0, 1) <= final_chance) { + if (zone->random.Roll(final_chance)) { ExecWeaponProc(nullptr, proc_spell_id, on); CanProc = false; break; @@ -4651,62 +4645,58 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) { uint32 weapon_speed; float ProcChance = 0; - + if (!ReuseTime && hand) { - weapon_speed = GetWeaponSpeedbyHand(hand); - ProcChance = static_cast(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); - if (hand != MainPrimary) ProcChance /= 2; } - else + else ProcChance = static_cast(ReuseTime) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f); return ProcChance; } bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { - - /*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443 - The Viscid Roots AA does the following: Reduces the chance for root to break by X percent. - There is no distinction of any kind between the caster inflicted damage, or anyone - else's damage. There is also no distinction between Direct and DOT damage in the root code. - - /* General Mechanics - - Check buffslot to make sure damage from a root does not cancel the root - - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. - - Only roots on determental spells can be broken by damage. + + /*Dev Quote 2010: http://forums.station.sony.com/eq/posts/list.m?topic_id=161443 + The Viscid Roots AA does the following: Reduces the chance for root to break by X percent. + There is no distinction of any kind between the caster inflicted damage, or anyone + else's damage. There is also no distinction between Direct and DOT damage in the root code. + + General Mechanics + - Check buffslot to make sure damage from a root does not cancel the root + - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. + - Only roots on determental spells can be broken by damage. - Root break chance values obtained from live parses. - */ - + */ + if (!attacker || !spellbonuses.Root[0] || spellbonuses.Root[1] < 0) - return false; - - if (IsDetrimentalSpell(spellbonuses.Root[1]) && spellbonuses.Root[1] != buffslot){ - - int BreakChance = RuleI(Spells, RootBreakFromSpells); - - BreakChance -= BreakChance*buffs[spellbonuses.Root[1]].RootBreakChance/100; + return false; + + if (IsDetrimentalSpell(spellbonuses.Root[1]) && spellbonuses.Root[1] != buffslot){ + int BreakChance = RuleI(Spells, RootBreakFromSpells); + + BreakChance -= BreakChance*buffs[spellbonuses.Root[1]].RootBreakChance/100; int level_diff = attacker->GetLevel() - GetLevel(); //Use baseline if level difference <= 1 (ie. If target is (1) level less than you, or equal or greater level) if (level_diff == 2) BreakChance = (BreakChance * 80) /100; //Decrease by 20%; - + else if (level_diff >= 3 && level_diff <= 20) BreakChance = (BreakChance * 60) /100; //Decrease by 40%; else if (level_diff > 21) BreakChance = (BreakChance * 20) /100; //Decrease by 80%; - - if (BreakChance < 1) - BreakChance = 1; - if (MakeRandomInt(0, 99) < BreakChance) { + if (BreakChance < 1) + BreakChance = 1; + + if (zone->random.Roll(BreakChance)) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); @@ -4727,7 +4717,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.MeleeRune[1] && spellbonuses.MeleeRune[0] && buffs[slot].melee_rune && IsValidSpell(buffs[slot].spellid)){ int melee_rune_left = buffs[slot].melee_rune; - + if(melee_rune_left > damage) { melee_rune_left -= damage; diff --git a/zone/bot.cpp b/zone/bot.cpp index 496ddc7ae..9ae33318a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -775,49 +775,49 @@ void Bot::GenerateAppearance() { // Randomize facial appearance int iFace = 0; if(this->GetRace() == 2) { // Barbarian w/Tatoo - iFace = MakeRandomInt(0, 79); + iFace = zone->random.Int(0, 79); } else { - iFace = MakeRandomInt(0, 7); + iFace = zone->random.Int(0, 7); } int iHair = 0; int iBeard = 0; int iBeardColor = 1; if(this->GetRace() == 522) { - iHair = MakeRandomInt(0, 8); - iBeard = MakeRandomInt(0, 11); - iBeardColor = MakeRandomInt(0, 3); + iHair = zone->random.Int(0, 8); + iBeard = zone->random.Int(0, 11); + iBeardColor = zone->random.Int(0, 3); } else if(this->GetGender()) { - iHair = MakeRandomInt(0, 2); + iHair = zone->random.Int(0, 2); if(this->GetRace() == 8) { // Dwarven Females can have a beard - if(MakeRandomInt(1, 100) < 50) { + if(zone->random.Int(1, 100) < 50) { iFace += 10; } } } else { - iHair = MakeRandomInt(0, 3); - iBeard = MakeRandomInt(0, 5); - iBeardColor = MakeRandomInt(0, 19); + iHair = zone->random.Int(0, 3); + iBeard = zone->random.Int(0, 5); + iBeardColor = zone->random.Int(0, 19); } int iHairColor = 0; if(this->GetRace() == 522) { - iHairColor = MakeRandomInt(0, 3); + iHairColor = zone->random.Int(0, 3); } else { - iHairColor = MakeRandomInt(0, 19); + iHairColor = zone->random.Int(0, 19); } - uint8 iEyeColor1 = (uint8)MakeRandomInt(0, 9); + uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9); uint8 iEyeColor2 = 0; if(this->GetRace() == 522) { - iEyeColor1 = iEyeColor2 = (uint8)MakeRandomInt(0, 11); + iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11); } - else if(MakeRandomInt(1, 100) > 96) { - iEyeColor2 = MakeRandomInt(0, 9); + else if(zone->random.Int(1, 100) > 96) { + iEyeColor2 = zone->random.Int(0, 9); } else { iEyeColor2 = iEyeColor1; @@ -827,9 +827,9 @@ void Bot::GenerateAppearance() { int iTattoo = 0; int iDetails = 0; if(this->GetRace() == 522) { - iHeritage = MakeRandomInt(0, 6); - iTattoo = MakeRandomInt(0, 7); - iDetails = MakeRandomInt(0, 7); + iHeritage = zone->random.Int(0, 6); + iTattoo = zone->random.Int(0, 7); + iDetails = zone->random.Int(0, 7); } this->luclinface = iFace; @@ -3098,7 +3098,7 @@ bool Bot::CheckBotDoubleAttack(bool tripleAttack) { chance *= float(100.0f+triple_bonus)/100.0f; //Apply modifiers. } - if((MakeRandomFloat(0, 1) < chance)) + if((zone->random.Real(0, 1) < chance)) return true; return false; @@ -3148,7 +3148,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if(RuleB(Combat, UseIntervalAC)) damage = max_hit; else - damage = MakeRandomInt(min_hit, max_hit); + damage = zone->random.Int(min_hit, max_hit); if(!other->CheckHitChance(this, skillinuse, Hand, chance_mod)) { damage = 0; @@ -3203,7 +3203,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if (damage > 0) CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); - if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && MakeRandomInt(0, 99) < 25){ + if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){ SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); other->Stun(100); } @@ -3483,7 +3483,7 @@ void Bot::AI_Process() { meleeDistance = meleeDistance * .30; } else { - meleeDistance *= (float)MakeRandomFloat(.50, .85); + meleeDistance *= (float)zone->random.Real(.50, .85); } bool atArcheryRange = IsArcheryRange(GetTarget()); @@ -3616,7 +3616,7 @@ void Bot::AI_Process() { if (GetTarget() && flurrychance) { - if(MakeRandomInt(0, 100) < flurrychance) + if(zone->random.Int(0, 100) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); Attack(GetTarget(), MainPrimary, false); @@ -3633,7 +3633,7 @@ void Bot::AI_Process() { wpn->GetItem()->ItemType == ItemType2HBlunt || wpn->GetItem()->ItemType == ItemType2HPiercing ) { - if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) + if(zone->random.Int(0, 100) < ExtraAttackChanceBonus) { Attack(GetTarget(), MainPrimary, false); } @@ -3678,7 +3678,7 @@ void Bot::AI_Process() { int32 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - float random = MakeRandomFloat(0, 1); + float random = zone->random.Real(0, 1); if (random < DualWieldProbability){ // Max 78% of DW @@ -3912,7 +3912,7 @@ void Bot::PetAIProcess() { if (botPet->GetTarget()) // Do we still have a target? { // We're a pet so we re able to dual attack - int32 RandRoll = MakeRandomInt(0, 99); + int32 RandRoll = zone->random.Int(0, 99); if (botPet->CanThisClassDoubleAttack() && (RandRoll < (botPet->GetLevel() + NPCDualAttackModifier))) { if(botPet->Attack(botPet->GetTarget(), MainPrimary)) @@ -3945,7 +3945,7 @@ void Bot::PetAIProcess() { //aa_chance += botPet->GetOwner()->GetAA(aaCompanionsAlacrity) * 3; - if (MakeRandomInt(1, 100) < aa_chance) + if (zone->random.Int(1, 100) < aa_chance) Flurry(nullptr); } @@ -3955,12 +3955,12 @@ void Bot::PetAIProcess() { if(botPet->GetOwner()->GetLevel() >= 24) { float DualWieldProbability = (botPet->GetSkill(SkillDualWield) + botPet->GetLevel()) / 400.0f; - DualWieldProbability -= MakeRandomFloat(0, 1); + DualWieldProbability -= zone->random.Real(0, 1); if(DualWieldProbability < 0){ botPet->Attack(botPet->GetTarget(), MainSecondary); if (botPet->CanThisClassDoubleAttack()) { - int32 RandRoll = MakeRandomInt(0, 99); + int32 RandRoll = zone->random.Int(0, 99); if (RandRoll < (botPet->GetLevel() + 20)) { botPet->Attack(botPet->GetTarget(), MainSecondary); @@ -6213,7 +6213,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(RuleB(Combat, UseIntervalAC)) damage = max_hit; else - damage = MakeRandomInt(min_hit, max_hit); + damage = zone->random.Int(min_hit, max_hit); mlog(COMBAT__DAMAGE, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); @@ -6258,7 +6258,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b OffhandRiposteFail *= -1; //Live uses a negative value for this. if (OffhandRiposteFail && - (OffhandRiposteFail > 99 || (MakeRandomInt(0, 100) < OffhandRiposteFail))) { + (OffhandRiposteFail > 99 || (zone->random.Int(0, 100) < OffhandRiposteFail))) { damage = 0; // Counts as a miss slippery_attack = true; } else @@ -6274,7 +6274,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if (((damage < 0) || slippery_attack) && !FromRiposte && !IsStrikethrough) { // Hack to still allow Strikethrough chance w/ Slippery Attacks AA int32 bonusStrikeThrough = itembonuses.StrikeThrough + spellbonuses.StrikeThrough + aabonuses.StrikeThrough; - if(bonusStrikeThrough && (MakeRandomInt(0, 100) < bonusStrikeThrough)) { + if(bonusStrikeThrough && (zone->random.Int(0, 100) < bonusStrikeThrough)) { Message_StringID(MT_StrikeThrough, STRIKETHROUGH_STRING); // You strike through your opponents defenses! Attack(other, Hand, false, true); // Strikethrough only gives another attempted hit return false; @@ -6623,7 +6623,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) { if(type == focusTriggerOnCast) { - if(MakeRandomInt(0, 100) <= base1){ + if(zone->random.Int(0, 100) <= base1){ value = base2; } @@ -6646,7 +6646,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) { if(type == focusBlockNextSpell) { - if(MakeRandomInt(1, 100) <= base1) + if(zone->random.Int(1, 100) <= base1) value = 1; } break; @@ -6670,7 +6670,7 @@ int32 Bot::CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id) int32 cast_time = GetActSpellCasttime(spell_id, spells[spell_id].cast_time); GetSympatheticProcChances(ProcBonus, ProcChance, cast_time, ProcRateMod); - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Real(0, 1) <= ProcChance) value = focus_id; else @@ -7147,7 +7147,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -7165,7 +7165,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -7183,7 +7183,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -7273,7 +7273,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel { if(bottype == BotfocusTriggerOnCast) - if(MakeRandomInt(0, 100) <= focus_spell.base[i]) + if(zone->random.Int(0, 100) <= focus_spell.base[i]) value = focus_spell.base2[i]; else @@ -7293,7 +7293,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel { if(bottype == BotfocusBlockNextSpell) { - if(MakeRandomInt(1, 100) <= focus_spell.base[i]) + if(zone->random.Int(1, 100) <= focus_spell.base[i]) value = 1; } break; @@ -7313,7 +7313,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel float ProcChance = GetSympatheticProcChances(spell_id, focus_spell.base[i]); - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Real(0, 1) <= ProcChance) value = focus_id; else @@ -7503,7 +7503,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) //Live AA - HightenedAwareness int BlockBehindChance = aabonuses.BlockBehind + spellbonuses.BlockBehind + itembonuses.BlockBehind; - if (BlockBehindChance && (BlockBehindChance > MakeRandomInt(1, 100))){ + if (BlockBehindChance && (BlockBehindChance > zone->random.Int(1, 100))){ bBlockFromRear = true; if (spellbonuses.BlockBehind || itembonuses.BlockBehind) @@ -7595,7 +7595,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) if(damage > 0) { - roll = MakeRandomFloat(0,100); + roll = zone->random.Real(0,100); if(roll <= RollTable[0]){ damage = -3; } @@ -7662,7 +7662,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint32 damage = aabonuses.FinishingBlow[1]; uint16 levelreq = aabonuses.FinishingBlowLvl[0]; - if(defender->GetLevel() <= levelreq && (chance >= MakeRandomInt(0, 1000))){ + if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ mlog(COMBAT__ATTACKS, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); @@ -7690,7 +7690,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetSpellBonuses().GiveDoubleRiposte[0] + defender->GetItemBonuses().GiveDoubleRiposte[0]; - if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { + if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { mlog(COMBAT__ATTACKS, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); @@ -7700,7 +7700,7 @@ void Bot::DoRiposte(Mob* defender) { //Coded narrowly: Limit to one per client. Limit AA only. [1 = Skill Attack Chance, 2 = Skill] DoubleRipChance = defender->GetAABonuses().GiveDoubleRiposte[1]; - if(DoubleRipChance && (DoubleRipChance >= MakeRandomInt(0, 100))) { + if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->GetAABonuses().GiveDoubleRiposte[2]); else if (defender->IsBot()) @@ -7766,7 +7766,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int kb_chance = 25; kb_chance += kb_chance*(100-aabonuses.SpecialAttackKBProc[0])/100; - if (MakeRandomInt(0, 99) < kb_chance) + if (zone->random.Int(0, 99) < kb_chance) SpellFinished(904, who, 10, 0, -1, spells[904].ResistDiff); //who->Stun(100); Kayen: This effect does not stun on live, it only moves the NPC. } @@ -7807,7 +7807,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { //Live AA - Seized Opportunity int FrontalBSChance = itembonuses.FrontalBackstabChance + spellbonuses.FrontalBackstabChance + aabonuses.FrontalBackstabChance; - if (FrontalBSChance && (FrontalBSChance > MakeRandomInt(0, 100))) + if (FrontalBSChance && (FrontalBSChance > zone->random.Int(0, 100))) bCanFrontalBS = true; } @@ -7821,7 +7821,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { !other->CastToNPC()->IsEngaged() && // not aggro other->GetHP()<=32000 && other->IsNPC() - && MakeRandomFloat(0, 99) < chance // chance + && zone->random.Real(0, 99) < chance // chance ) { entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); RogueAssassinate(other); @@ -7832,12 +7832,12 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { float DoubleAttackProbability = (GetSkill(SkillDoubleAttack) + GetLevel()) / 500.0f; // 62.4 max // Check for double attack with main hand assuming maxed DA Skill (MS) - if(MakeRandomFloat(0, 1) < DoubleAttackProbability) // Max 62.4 % chance of DA + if(zone->random.Real(0, 1) < DoubleAttackProbability) // Max 62.4 % chance of DA { if(other->GetHP() > 0) RogueBackstab(other,false,ReuseTime); - if (tripleChance && other->GetHP() > 0 && tripleChance > MakeRandomInt(0, 100)) + if (tripleChance && other->GetHP() > 0 && tripleChance > zone->random.Int(0, 100)) RogueBackstab(other,false,ReuseTime); } } @@ -7851,11 +7851,11 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { if (level > 54) { float DoubleAttackProbability = (GetSkill(SkillDoubleAttack) + GetLevel()) / 500.0f; // 62.4 max // Check for double attack with main hand assuming maxed DA Skill (MS) - if(MakeRandomFloat(0, 1) < DoubleAttackProbability) // Max 62.4 % chance of DA + if(zone->random.Real(0, 1) < DoubleAttackProbability) // Max 62.4 % chance of DA if(other->GetHP() > 0) RogueBackstab(other,true, ReuseTime); - if (tripleChance && other->GetHP() > 0 && tripleChance > MakeRandomInt(0, 100)) + if (tripleChance && other->GetHP() > 0 && tripleChance > zone->random.Int(0, 100)) RogueBackstab(other,false,ReuseTime); } } @@ -7929,7 +7929,7 @@ void Bot::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) if(RuleB(Combat, UseIntervalAC)) ndamage = max_hit; else - ndamage = MakeRandomInt(min_hit, max_hit); + ndamage = zone->random.Int(min_hit, max_hit); } } @@ -8036,7 +8036,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { canBash = true; } - if(!canBash || MakeRandomInt(0, 100) > 25) { //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. + if(!canBash || zone->random.Int(0, 100) > 25) { //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. skill_to_use = SkillKick; } else { @@ -8117,7 +8117,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else - dmg = MakeRandomInt(1, GetBashDamage()); + dmg = zone->random.Int(1, GetBashDamage()); } } @@ -8164,7 +8164,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { //Live parses show around 55% Triple 35% Double 10% Single, you will always get first hit. while(AtkRounds > 0) { - if (GetTarget() && (AtkRounds == 1 || MakeRandomInt(0,100) < 75)){ + if (GetTarget() && (AtkRounds == 1 || zone->random.Int(0,100) < 75)){ DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg , reuse, true); } AtkRounds--; @@ -8192,7 +8192,7 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else - dmg = MakeRandomInt(1, GetKickDamage()); + dmg = zone->random.Int(1, GetKickDamage()); } } @@ -8215,18 +8215,18 @@ void Bot::DoClassAttacks(Mob *target, bool IsRiposte) { //Live AA - Technique of Master Wu uint32 bDoubleSpecialAttack = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; - if( bDoubleSpecialAttack && (bDoubleSpecialAttack >= 100 || bDoubleSpecialAttack > MakeRandomInt(0,100))) { + if( bDoubleSpecialAttack && (bDoubleSpecialAttack >= 100 || bDoubleSpecialAttack > zone->random.Int(0,100))) { int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; - MonkSpecialAttack(target, MonkSPA[MakeRandomInt(0,4)]); + MonkSpecialAttack(target, MonkSPA[zone->random.Int(0,4)]); int TripleChance = 25; if (bDoubleSpecialAttack > 100) TripleChance += TripleChance*(100-bDoubleSpecialAttack)/100; - if(TripleChance > MakeRandomInt(0,100)) { - MonkSpecialAttack(target, MonkSPA[MakeRandomInt(0,4)]); + if(TripleChance > zone->random.Int(0,100)) { + MonkSpecialAttack(target, MonkSPA[zone->random.Int(0,4)]); } } @@ -8259,7 +8259,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { // WildcardX: These chance formula's below are arbitrary. If someone has a better formula that is more // consistent with live, feel free to update these. float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); - float DefenderChance = (float)MakeRandomFloat(0.00f, 1.00f); + float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { mlog(COMBAT__ATTACKS, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW @@ -8734,14 +8734,14 @@ int32 Bot::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if (spell_id == SPELL_IMP_HARM_TOUCH && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0)) chance = 100; - if (MakeRandomInt(1,100) <= chance){ + if (zone->random.Int(1,100) <= chance){ Critical = true; ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; } - else if (GetClass() == WIZARD && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (MakeRandomInt(1,100) <= RuleI(Spells, WizCritChance))) { - ratio = MakeRandomInt(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. + else if (GetClass() == WIZARD && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Int(1,100) <= RuleI(Spells, WizCritChance))) { + ratio = zone->random.Int(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. Critical = true; } @@ -8820,7 +8820,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalHealDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); - if(chance && (MakeRandomInt(0,99) < chance)) { + if(chance && (zone->random.Int(0,99) < chance)) { Critical = true; modifier = 2; //At present time no critical heal amount modifier SPA exists. } @@ -8851,7 +8851,7 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalRegenDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); - if(chance && (MakeRandomInt(0,99) < chance)) + if(chance && (zone->random.Int(0,99) < chance)) return (value * 2); } @@ -8950,7 +8950,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { - int32 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100; + int32 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; // Doesnt generate mana, so best case is a free spell if(mana_back > cost) mana_back = cost; @@ -8963,7 +8963,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { // WildcardX float PercentManaReduction = 0; float SpecializeSkill = GetSpecializeSkillValue(spell_id); - int SuccessChance = MakeRandomInt(0, 100); + int SuccessChance = zone->random.Int(0, 100); float bonus = 1.0; switch(GetAA(aaSpellCastingMastery)) @@ -9015,7 +9015,7 @@ int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) { if(focus_redux > 0) { - PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); + PercentManaReduction += zone->random.Real(1, (double)focus_redux); } cost -= (cost * (PercentManaReduction / 100)); @@ -15580,7 +15580,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl return false; if (iChance < 100) { - uint8 tmp = MakeRandomInt(1, 100); + uint8 tmp = zone->random.Int(1, 100); if (tmp > iChance) return false; } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 4917ed953..a5be7341e 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -13,7 +13,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { return false; if (iChance < 100) { - if (MakeRandomInt(0, 100) > iChance){ + if (zone->random.Int(0, 100) > iChance){ return false; } } @@ -485,7 +485,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { if(botClass == PALADIN) stunChance = 50; - if(!tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned() && (MakeRandomInt(1, 100) <= stunChance)) { + if(!tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned() && (zone->random.Int(1, 100) <= stunChance)) { botSpell = GetBestBotSpellForStunByTargetType(this, ST_Target); } } @@ -1843,7 +1843,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { result = std::string("SumEarth"); else if(botCaster->GetLevel() < 30) { // Under level 30 - int counter = MakeRandomInt(0, 3); + int counter = zone->random.Int(0, 3); switch(counter) { case 0: @@ -1865,7 +1865,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) { } else { // Over level 30 - int counter = MakeRandomInt(0, 4); + int counter = zone->random.Int(0, 4); switch(counter) { case 0: diff --git a/zone/client.cpp b/zone/client.cpp index e4f2c823a..f67328ae9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2328,7 +2328,7 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(Chance < 1) Chance = 1; // Make it always possible - if(MakeRandomFloat(0, 99) < Chance) + if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); @@ -2356,7 +2356,7 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { int32 Chance = 5 + ((TeacherSkill - LangSkill)/10); // greater chance to learn if teacher's skill is much higher than yours Chance = (Chance * RuleI(Character, SkillUpModifier)/100); - if(MakeRandomFloat(0,100) < Chance) { // if they make the roll + if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 _log(SKILLS__GAIN, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } @@ -4904,7 +4904,7 @@ int Client::LDoNChest_SkillCheck(NPC *target, int skill) chance = 100.0f - base_difficulty; } - float d100 = (float)MakeRandomFloat(0, 100); + float d100 = (float)zone->random.Real(0, 100); if(d100 <= chance) return 1; @@ -7608,9 +7608,9 @@ void Client::GarbleMessage(char *message, uint8 variance) const char alpha_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; // only change alpha characters for now for (size_t i = 0; i < strlen(message); i++) { - uint8 chance = (uint8)MakeRandomInt(0, 115); // variation just over worst possible scrambling + uint8 chance = (uint8)zone->random.Int(0, 115); // variation just over worst possible scrambling if (isalpha(message[i]) && (chance <= variance)) { - uint8 rand_char = (uint8)MakeRandomInt(0,51); // choose a random character from the alpha list + uint8 rand_char = (uint8)zone->random.Int(0,51); // choose a random character from the alpha list message[i] = alpha_list[rand_char]; } } @@ -7728,7 +7728,7 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui // If our result is truncated, then double a mob's value every once and a while to equal what they would have got else { - if (MakeRandomInt(0, 100) < faction_mod) + if (zone->random.Int(0, 100) < faction_mod) npc_value[i] *= 2; } } @@ -7821,11 +7821,11 @@ void Client::MerchantRejectMessage(Mob *merchant, int primaryfaction) } // If no primary faction or biggest influence is your faction hit if (primaryfaction <= 0 || lowestvalue == tmpFactionValue) { - merchant->Say_StringID(MakeRandomInt(WONT_SELL_DEEDS1, WONT_SELL_DEEDS6)); + merchant->Say_StringID(zone->random.Int(WONT_SELL_DEEDS1, WONT_SELL_DEEDS6)); } else if (lowestvalue == fmod.race_mod) { // race biggest // Non-standard race (ex. illusioned to wolf) if (GetRace() > PLAYER_RACE_COUNT) { - messageid = MakeRandomInt(1, 3); // these aren't sequential StringIDs :( + messageid = zone->random.Int(1, 3); // these aren't sequential StringIDs :( switch (messageid) { case 1: messageid = WONT_SELL_NONSTDRACE1; @@ -7842,7 +7842,7 @@ void Client::MerchantRejectMessage(Mob *merchant, int primaryfaction) } merchant->Say_StringID(messageid); } else { // normal player races - messageid = MakeRandomInt(1, 4); + messageid = zone->random.Int(1, 4); switch (messageid) { case 1: messageid = WONT_SELL_RACE1; @@ -7863,7 +7863,7 @@ void Client::MerchantRejectMessage(Mob *merchant, int primaryfaction) merchant->Say_StringID(messageid, itoa(GetRace())); } } else if (lowestvalue == fmod.class_mod) { - merchant->Say_StringID(MakeRandomInt(WONT_SELL_CLASS1, WONT_SELL_CLASS5), itoa(GetClass())); + merchant->Say_StringID(zone->random.Int(WONT_SELL_CLASS1, WONT_SELL_CLASS5), itoa(GetClass())); } return; } @@ -7966,7 +7966,7 @@ void Client::TryItemTick(int slot) if(zone->tick_items.count(iid) > 0) { - if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EmuConstants::EQUIPMENT_END) ) + if( GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) && (zone->tick_items[iid].bagslot || slot <= EmuConstants::EQUIPMENT_END) ) { ItemInst* e_inst = (ItemInst*)inst; parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot); @@ -7985,7 +7985,7 @@ void Client::TryItemTick(int slot) if(zone->tick_items.count(iid) > 0) { - if( GetLevel() >= zone->tick_items[iid].level && MakeRandomInt(0, 100) >= (100 - zone->tick_items[iid].chance) ) + if( GetLevel() >= zone->tick_items[iid].level && zone->random.Int(0, 100) >= (100 - zone->tick_items[iid].chance) ) { ItemInst* e_inst = (ItemInst*)a_inst; parse->EventItem(EVENT_ITEM_TICK, this, e_inst, nullptr, "", slot); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e2884e738..c4885252b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2953,7 +2953,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == ItemType1HPiercing) || (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == ItemType1HPiercing)) { float SuccessChance = (GetSkill(SkillApplyPoison) + GetLevel()) / 400.0f; - double ChanceRoll = MakeRandomFloat(0, 1); + double ChanceRoll = zone->random.Real(0, 1); CheckIncreaseSkill(SkillApplyPoison, nullptr, 10); @@ -3642,14 +3642,14 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) return; } - int RandomChance = MakeRandomInt(0, 100); + int RandomChance = zone->random.Int(0, 100); int ChanceToAttack = 0; if (GetLevel() > GetTarget()->GetLevel()) - ChanceToAttack = MakeRandomInt(0, 15); + ChanceToAttack = zone->random.Int(0, 15); else - ChanceToAttack = MakeRandomInt(((this->GetTarget()->GetLevel() - this->GetLevel()) * 10) - 5, ((this->GetTarget()->GetLevel() - this->GetLevel()) * 10)); + ChanceToAttack = zone->random.Int(((this->GetTarget()->GetLevel() - this->GetLevel()) * 10) - 5, ((this->GetTarget()->GetLevel() - this->GetLevel()) * 10)); if (ChanceToAttack < 0) ChanceToAttack = -ChanceToAttack; @@ -3668,7 +3668,7 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) if (RandomChance < ChanceToBeg) { - brs->Amount = MakeRandomInt(1, 10); + brs->Amount = zone->random.Int(1, 10); // This needs some work to determine how much money they can beg, based on skill level etc. if (CurrentSkill < 50) { @@ -4550,7 +4550,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) delta_heading = ppu->delta_heading; if(IsTracking() && ((x_pos!=ppu->x_pos) || (y_pos!=ppu->y_pos))){ - if(MakeRandomFloat(0, 100) < 70)//should be good + if(zone->random.Real(0, 100) < 70)//should be good CheckIncreaseSkill(SkillTracking, nullptr, -20); } @@ -5252,16 +5252,16 @@ void Client::Handle_OP_DisarmTraps(const EQApplicationPacket *app) if (trap && trap->detected) { int uskill = GetSkill(SkillDisarmTraps); - if ((MakeRandomInt(0, 49) + uskill) >= (MakeRandomInt(0, 49) + trap->skill)) + if ((zone->random.Int(0, 49) + uskill) >= (zone->random.Int(0, 49) + trap->skill)) { Message(MT_Skills, "You disarm a trap."); trap->disarmed = true; trap->chkarea_timer.Disable(); - trap->respawn_timer.Start((trap->respawn_time + MakeRandomInt(0, trap->respawn_var)) * 1000); + trap->respawn_timer.Start((trap->respawn_time + zone->random.Int(0, trap->respawn_var)) * 1000); } else { - if (MakeRandomInt(0, 99) < 25){ + if (zone->random.Int(0, 99) < 25){ Message(MT_Skills, "You set off the trap while trying to disarm it!"); trap->Trigger(this); } @@ -5622,7 +5622,7 @@ void Client::Handle_OP_FeignDeath(const EQApplicationPacket *app) secfeign = 0; uint16 totalfeign = primfeign + secfeign; - if (MakeRandomFloat(0, 160) > totalfeign) { + if (zone->random.Real(0, 160) > totalfeign) { SetFeigned(false); entity_list.MessageClose_StringID(this, false, 200, 10, STRING_FEIGNFAILED, GetName()); } @@ -7886,7 +7886,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) p_timers.Start(pTimerHide, reuse - 1); float hidechance = ((GetSkill(SkillHide) / 250.0f) + .25) * 100; - float random = MakeRandomFloat(0, 100); + float random = zone->random.Real(0, 100); CheckIncreaseSkill(SkillHide, nullptr, 5); if (random < hidechance) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct)); @@ -7910,7 +7910,7 @@ void Client::Handle_OP_Hide(const EQApplicationPacket *app) Mob *evadetar = GetTarget(); if (!auto_attack && (evadetar && evadetar->CheckAggro(this) && evadetar->IsNPC())) { - if (MakeRandomInt(0, 260) < (int)GetSkill(SkillHide)) { + if (zone->random.Int(0, 260) < (int)GetSkill(SkillHide)) { msg->string_id = EVADE_SUCCESS; RogueEvade(evadetar); } @@ -9293,11 +9293,11 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) int mendhp = GetMaxHP() / 4; int currenthp = GetHP(); - if (MakeRandomInt(0, 199) < (int)GetSkill(SkillMend)) { + if (zone->random.Int(0, 199) < (int)GetSkill(SkillMend)) { int criticalchance = spellbonuses.CriticalMend + itembonuses.CriticalMend + aabonuses.CriticalMend; - if (MakeRandomInt(0, 99) < criticalchance){ + if (zone->random.Int(0, 99) < criticalchance){ mendhp *= 2; Message_StringID(4, MEND_CRITICAL); } @@ -9312,7 +9312,7 @@ void Client::Handle_OP_Mend(const EQApplicationPacket *app) 0 skill - 25% chance to worsen 20 skill - 23% chance to worsen 50 skill - 16% chance to worsen */ - if ((GetSkill(SkillMend) <= 75) && (MakeRandomInt(GetSkill(SkillMend), 100) < 75) && (MakeRandomInt(1, 3) == 1)) + if ((GetSkill(SkillMend) <= 75) && (zone->random.Int(GetSkill(SkillMend), 100) < 75) && (zone->random.Int(1, 3) == 1)) { SetHP(currenthp > mendhp ? (GetHP() - mendhp) : 1); SendHPUpdate(); @@ -11213,7 +11213,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) randLow = 0; randHigh = 100; } - randResult = MakeRandomInt(randLow, randHigh); + randResult = zone->random.Int(randLow, randHigh); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RandomReply, sizeof(RandomReply_Struct)); RandomReply_Struct* rr = (RandomReply_Struct*)outapp->pBuffer; @@ -11703,7 +11703,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) if (trap && trap->skill > 0) { int uskill = GetSkill(SkillSenseTraps); - if ((MakeRandomInt(0, 99) + uskill) >= (MakeRandomInt(0, 99) + trap->skill*0.75)) + if ((zone->random.Int(0, 99) + uskill) >= (zone->random.Int(0, 99) + trap->skill*0.75)) { float xdif = trap->x - GetX(); float ydif = trap->y - GetY(); @@ -12446,7 +12446,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) // 1199 I don't have time for that now. etc if (!tmp->CastToNPC()->IsMerchantOpen()) { - tmp->Say_StringID(MakeRandomInt(1199, 1202)); + tmp->Say_StringID(zone->random.Int(1199, 1202)); action = 0; } @@ -12501,7 +12501,7 @@ void Client::Handle_OP_Sneak(const EQApplicationPacket *app) CheckIncreaseSkill(SkillSneak, nullptr, 5); } float hidechance = ((GetSkill(SkillSneak) / 300.0f) + .25) * 100; - float random = MakeRandomFloat(0, 99); + float random = zone->random.Real(0, 99); if (!was && random < hidechance) { sneaking = true; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c2e3ae1f3..0b99b1c2a 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -436,7 +436,7 @@ bool Client::Process() { if (auto_attack_target && flurrychance) { - if(MakeRandomInt(0, 99) < flurrychance) + if(zone->random.Int(0, 99) < flurrychance) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); Attack(auto_attack_target, MainPrimary, false); @@ -453,7 +453,7 @@ bool Client::Process() { wpn->GetItem()->ItemType == ItemType2HBlunt || wpn->GetItem()->ItemType == ItemType2HPiercing ) { - if(MakeRandomInt(0, 99) < ExtraAttackChanceBonus) + if(zone->random.Int(0, 99) < ExtraAttackChanceBonus) { Attack(auto_attack_target, MainPrimary, false); } @@ -498,7 +498,7 @@ bool Client::Process() { int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - float random = MakeRandomFloat(0, 1); + float random = zone->random.Real(0, 1); CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10); if (random < DualWieldProbability){ // Max 78% of DW if(CheckAAEffect(aaEffectRampage)) { @@ -1003,7 +1003,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { if (fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) continue; - handychance = MakeRandomInt(0, merlist.size() + tmp_merlist.size() - 1); + handychance = zone->random.Int(0, merlist.size() + tmp_merlist.size() - 1); item = database.GetItem(ml.item); if (item) { @@ -1079,7 +1079,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { zone->tmpmerchanttable[npcid] = tmp_merlist; if (merch != nullptr && handyitem) { char handy_id[8] = { 0 }; - int greeting = MakeRandomInt(0, 4); + int greeting = zone->random.Int(0, 4); int greet_id = 0; switch (greeting) { case 1: @@ -1640,7 +1640,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app) // welcome message if (pTrainer && pTrainer->IsNPC()) { - pTrainer->Say_StringID(MakeRandomInt(1204, 1207), GetCleanName()); + pTrainer->Say_StringID(zone->random.Int(1204, 1207), GetCleanName()); } } @@ -1667,7 +1667,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app) // goodbye message if (pTrainer->IsNPC()) { - pTrainer->Say_StringID(MakeRandomInt(1208, 1211), GetCleanName()); + pTrainer->Say_StringID(zone->random.Int(1208, 1211), GetCleanName()); } } diff --git a/zone/command.cpp b/zone/command.cpp index 453c58ec9..1f4d76498 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5003,157 +5003,157 @@ void command_randomfeatures(Client *c, const Seperator *sep) uint32 DrakkinDetails = 0xFFFFFFFF; // Set some common feature settings - EyeColor1 = MakeRandomInt(0, 9); - EyeColor2 = MakeRandomInt(0, 9); - LuclinFace = MakeRandomInt(0, 7); + EyeColor1 = zone->random.Int(0, 9); + EyeColor2 = zone->random.Int(0, 9); + LuclinFace = zone->random.Int(0, 7); // Adjust all settings based on the min and max for each feature of each race and gender switch (Race) { case 1: // Human - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 2: // Barbarian - HairColor = MakeRandomInt(0, 19); - LuclinFace = MakeRandomInt(0, 87); + HairColor = zone->random.Int(0, 19); + LuclinFace = zone->random.Int(0, 87); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 3: // Erudite if (Gender == 0) { - BeardColor = MakeRandomInt(0, 19); - Beard = MakeRandomInt(0, 5); - LuclinFace = MakeRandomInt(0, 57); + BeardColor = zone->random.Int(0, 19); + Beard = zone->random.Int(0, 5); + LuclinFace = zone->random.Int(0, 57); } if (Gender == 1) { - LuclinFace = MakeRandomInt(0, 87); + LuclinFace = zone->random.Int(0, 87); } break; case 4: // WoodElf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); + HairStyle = zone->random.Int(0, 3); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 5: // HighElf - HairColor = MakeRandomInt(0, 14); + HairColor = zone->random.Int(0, 14); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 6: // DarkElf - HairColor = MakeRandomInt(13, 18); + HairColor = zone->random.Int(13, 18); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 7: // HalfElf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 8: // Dwarf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); BeardColor = HairColor; if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - LuclinFace = MakeRandomInt(0, 17); + HairStyle = zone->random.Int(0, 2); + LuclinFace = zone->random.Int(0, 17); } break; case 9: // Troll - EyeColor1 = MakeRandomInt(0, 10); - EyeColor2 = MakeRandomInt(0, 10); + EyeColor1 = zone->random.Int(0, 10); + EyeColor2 = zone->random.Int(0, 10); if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); + HairStyle = zone->random.Int(0, 3); + HairColor = zone->random.Int(0, 23); } break; case 10: // Ogre if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); + HairStyle = zone->random.Int(0, 3); + HairColor = zone->random.Int(0, 23); } break; case 11: // Halfling - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 12: // Gnome - HairColor = MakeRandomInt(0, 24); + HairColor = zone->random.Int(0, 24); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 128: // Iksar case 130: // VahShir break; case 330: // Froglok - LuclinFace = MakeRandomInt(0, 9); + LuclinFace = zone->random.Int(0, 9); case 522: // Drakkin - HairColor = MakeRandomInt(0, 3); + HairColor = zone->random.Int(0, 3); BeardColor = HairColor; - EyeColor1 = MakeRandomInt(0, 11); - EyeColor2 = MakeRandomInt(0, 11); - LuclinFace = MakeRandomInt(0, 6); - DrakkinHeritage = MakeRandomInt(0, 6); - DrakkinTattoo = MakeRandomInt(0, 7); - DrakkinDetails = MakeRandomInt(0, 7); + EyeColor1 = zone->random.Int(0, 11); + EyeColor2 = zone->random.Int(0, 11); + LuclinFace = zone->random.Int(0, 6); + DrakkinHeritage = zone->random.Int(0, 6); + DrakkinTattoo = zone->random.Int(0, 7); + DrakkinDetails = zone->random.Int(0, 7); if (Gender == 0) { - Beard = MakeRandomInt(0, 12); - HairStyle = MakeRandomInt(0, 8); + Beard = zone->random.Int(0, 12); + HairStyle = zone->random.Int(0, 8); } if (Gender == 1) { - Beard = MakeRandomInt(0, 3); - HairStyle = MakeRandomInt(0, 7); + Beard = zone->random.Int(0, 3); + HairStyle = zone->random.Int(0, 7); } break; default: @@ -10443,6 +10443,7 @@ void command_distance(Client *c, const Seperator *sep) { void command_cvs(Client *c, const Seperator *sep) { + c->Message(0, "%f %d", zone->random.Real(0.0f, 1.0f), zone->random.Int(0, 100)); if(c) { ServerPacket *pack = new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct)); diff --git a/zone/effects.cpp b/zone/effects.cpp index 0bface8b7..5c542d16d 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -55,30 +55,25 @@ int32 NPC::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { else value -= target->GetFcDamageAmtIncoming(this, spell_id)/spells[spell_id].buffduration; } - - value += dmg*GetSpellFocusDMG()/100; + + value += dmg*GetSpellFocusDMG()/100; if (AI_HasSpellsEffects()){ int16 chance = 0; int ratio = 0; if (spells[spell_id].buffduration == 0) { - chance += spellbonuses.CriticalSpellChance + spellbonuses.FrenziedDevastation; - - if (chance && MakeRandomInt(1,100) <= chance){ - + + if (chance && zone->random.Roll(chance)) { ratio += spellbonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncNoStack; value += (value*ratio)/100; entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_BLAST, GetCleanName(), itoa(-value)); } } else { - chance += spellbonuses.CriticalDoTChance; - - if (chance && MakeRandomInt(1,100) <= chance){ - + if (chance && zone->random.Roll(chance)) { ratio += spellbonuses.DotCritDmgIncrease; value += (value*ratio)/100; } @@ -119,14 +114,14 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if (spell_id == SPELL_IMP_HARM_TOUCH && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0)) chance = 100; - if (MakeRandomInt(1,100) <= chance){ + if (zone->random.Roll(chance)) { Critical = true; ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; } - else if (GetClass() == WIZARD && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (MakeRandomInt(1,100) <= RuleI(Spells, WizCritChance))) { - ratio += MakeRandomInt(20,70); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. (20-70 is parse confirmed) + else if (GetClass() == WIZARD && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Roll(RuleI(Spells, WizCritChance)))) { + ratio += zone->random.Int(20,70); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. (20-70 is parse confirmed) Critical = true; } @@ -193,22 +188,16 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalDotDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalDotDecay); - + value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); - if (chance > 0 && (MakeRandomInt(1, 100) <= chance)) { - + if (chance > 0 && (zone->random.Roll(chance))) { int32 ratio = 200; ratio += itembonuses.DotCritDmgIncrease + spellbonuses.DotCritDmgIncrease + aabonuses.DotCritDmgIncrease; - - value = value_BaseEffect*ratio/100; - - value += int(value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100)*ratio/100; - + value = value_BaseEffect*ratio/100; + value += int(value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100)*ratio/100; value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100; - - value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100; - + value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100; extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) + int(GetFocusEffect(focusFcDamageAmtCrit, spell_id)*ratio/100) + GetFocusEffect(focusFcDamageAmt, spell_id); @@ -216,7 +205,7 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { if (extra_dmg) { int duration = CalcBuffDuration(this, this, spell_id); if (duration > 0) - extra_dmg /= duration; + extra_dmg /= duration; } value -= extra_dmg; @@ -224,25 +213,20 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { return value; } - value = value_BaseEffect; - - value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; - - value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; - - value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; - - extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) + + value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; + value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; + value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; + extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) + GetFocusEffect(focusFcDamageAmtCrit, spell_id) + - GetFocusEffect(focusFcDamageAmt, spell_id); + GetFocusEffect(focusFcDamageAmt, spell_id); if (extra_dmg) { int duration = CalcBuffDuration(this, this, spell_id); if (duration > 0) - extra_dmg /= duration; - } - + extra_dmg /= duration; + } + value -= extra_dmg; return value; @@ -275,28 +259,26 @@ int32 NPC::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { //Scale all NPC spell healing via SetSpellFocusHeal(value) - value += value*GetSpellFocusHeal()/100; + value += value*GetSpellFocusHeal()/100; if (target) { - value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); + value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); value += value*target->GetHealRate(spell_id, this)/100; } //Allow for critical heal chance if NPC is loading spell effect bonuses. if (AI_HasSpellsEffects()){ - if(spells[spell_id].buffduration < 1) { - - if(spellbonuses.CriticalHealChance && (MakeRandomInt(0,99) < spellbonuses.CriticalHealChance)) { - value = value*2; + if(spellbonuses.CriticalHealChance && (zone->random.Roll(spellbonuses.CriticalHealChance))) { + value = value*2; entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_HEAL, GetCleanName(), itoa(value)); } } - else if(spellbonuses.CriticalHealOverTime && (MakeRandomInt(0,99) < spellbonuses.CriticalHealOverTime)) { - value = value*2; + else if(spellbonuses.CriticalHealOverTime && (zone->random.Roll(spellbonuses.CriticalHealOverTime))) { + value = value*2; } } - + return value; } @@ -326,7 +308,7 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalHealDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); - if(chance && (MakeRandomInt(0,99) < chance)) { + if(chance && (zone->random.Roll(chance))) { Critical = true; modifier = 2; //At present time no critical heal amount modifier SPA exists. } @@ -360,7 +342,7 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalRegenDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); - if(chance && (MakeRandomInt(0,99) < chance)) + if(chance && zone->random.Roll(chance)) return (value * 2); } @@ -374,12 +356,12 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) int16 FrenziedDevastation = itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation; if (FrenziedDevastation && IsPureNukeSpell(spell_id)) - cost *= 2; - + cost *= 2; + // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { - int16 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100; + int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; // Doesnt generate mana, so best case is a free spell if(mana_back > cost) mana_back = cost; @@ -392,7 +374,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) // WildcardX float PercentManaReduction = 0; float SpecializeSkill = GetSpecializeSkillValue(spell_id); - int SuccessChance = MakeRandomInt(0, 100); + int SuccessChance = zone->random.Int(0, 100); float bonus = 1.0; switch(GetAA(aaSpellCastingMastery)) @@ -444,7 +426,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) if(focus_redux > 0) { - PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); + PercentManaReduction += zone->random.Real(1, (double)focus_redux); } cost -= (cost * (PercentManaReduction / 100)); diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 0e8b10a8e..62fa1dd70 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1521,7 +1521,7 @@ XS(XS__ChooseRandom) if (items < 1) Perl_croak(aTHX_ "Usage: ChooseRandom(... list ...)"); - int index = MakeRandomInt(0, items-1); + int index = zone->random.Int(0, items-1); SV *tmp = ST(0); ST(0) = ST(index); diff --git a/zone/entity.cpp b/zone/entity.cpp index cae20c3ce..fd3d79f1f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -628,7 +628,7 @@ void EntityList::AddCorpse(Corpse *corpse, uint32 in_id) void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue) { npc->SetID(GetFreeID()); - npc->SetMerchantProbability((uint8) MakeRandomInt(0, 99)); + npc->SetMerchantProbability((uint8) zone->random.Int(0, 99)); parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0); uint16 emoteid = npc->GetEmoteID(); @@ -1570,7 +1570,7 @@ Client *EntityList::GetRandomClient(float x, float y, float z, float Distance, C if (ClientsInRange.empty()) return nullptr; - return ClientsInRange[MakeRandomInt(0, ClientsInRange.size() - 1)]; + return ClientsInRange[zone->random.Int(0, ClientsInRange.size() - 1)]; } Corpse *EntityList::GetCorpseByOwner(Client *client) @@ -2890,7 +2890,7 @@ void EntityList::ClearFeignAggro(Mob *targ) it->second->RemoveFromHateList(targ); if (targ->IsClient()) { - if (it->second->GetLevel() >= 35 && MakeRandomInt(1, 100) <= 60) + if (it->second->GetLevel() >= 35 && zone->random.Roll(60)) it->second->AddFeignMemory(targ->CastToClient()); else targ->CastToClient()->RemoveXTarget(it->second, false); @@ -4505,7 +4505,7 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count) selection.push_back(j); while (selection.size() > 0 && count > 0) { - int k = MakeRandomInt(0, selection.size() - 1); + int k = zone->random.Int(0, selection.size() - 1); counts[selection[k]]++; count--; selection.erase(selection.begin() + k); @@ -4687,6 +4687,6 @@ Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) if(TargetsInRange.size() == 0) return nullptr; - return TargetsInRange[MakeRandomInt(0, TargetsInRange.size() - 1)]; + return TargetsInRange[zone->random.Int(0, TargetsInRange.size() - 1)]; } diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 47fc53a96..25d514cfe 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -186,8 +186,8 @@ void Mob::CalculateNewFearpoint() { int ran = 250 - (loop*2); loop++; - ranx = GetX()+MakeRandomInt(0, ran-1)-MakeRandomInt(0, ran-1); - rany = GetY()+MakeRandomInt(0, ran-1)-MakeRandomInt(0, ran-1); + ranx = GetX()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1); + rany = GetY()+zone->random.Int(0, ran-1)-zone->random.Int(0, ran-1); ranz = FindGroundZ(ranx,rany); if (ranz == -999999) continue; diff --git a/zone/forage.cpp b/zone/forage.cpp index cbb6550db..7e2f7d457 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -83,7 +83,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { ret = 0; - uint32 rindex = MakeRandomInt(1, chancepool); + uint32 rindex = zone->random.Int(1, chancepool); for(int i = 0; i < index; i++) { if(rindex <= chance[i]) { @@ -136,7 +136,7 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, if (index <= 0) return 0; - uint32 random = MakeRandomInt(1, chancepool); + uint32 random = zone->random.Int(1, chancepool); for (int i = 0; i < index; i++) { if (random > chance[i]) @@ -258,18 +258,18 @@ void Client::GoFish() fishing_skill = 100+((fishing_skill-100)/2); } - if (MakeRandomInt(0,175) < fishing_skill) { + if (zone->random.Int(0,175) < fishing_skill) { uint32 food_id = 0; //25% chance to fish an item. - if (MakeRandomInt(0, 399) <= fishing_skill ) { + if (zone->random.Int(0, 399) <= fishing_skill ) { uint32 npc_id = 0; uint8 npc_chance = 0; food_id = database.GetZoneFishing(m_pp.zone_id, fishing_skill, npc_id, npc_chance); //check for add NPC if(npc_chance > 0 && npc_id) { - if(npc_chance < MakeRandomInt(0, 99)) { + if(npc_chance < zone->random.Int(0, 99)) { const NPCType* tmp = database.GetNPCType(npc_id); if(tmp != nullptr) { NPC* npc = new NPC(tmp, nullptr, GetX()+3, GetY(), GetZ(), GetHeading(), FlyMode3); @@ -289,7 +289,7 @@ void Client::GoFish() DeleteItemInInventory(bslot, 1, true); //do we need client update? if(food_id == 0) { - int index = MakeRandomInt(0, MAX_COMMON_FISH_IDS-1); + int index = zone->random.Int(0, MAX_COMMON_FISH_IDS-1); food_id = common_fish_ids[index]; } @@ -324,11 +324,11 @@ void Client::GoFish() else { //chance to use bait when you dont catch anything... - if (MakeRandomInt(0, 4) == 1) { + if (zone->random.Int(0, 4) == 1) { DeleteItemInInventory(bslot, 1, true); //do we need client update? Message_StringID(MT_Skills, FISHING_LOST_BAIT); //You lost your bait! } else { - if (MakeRandomInt(0, 15) == 1) //give about a 1 in 15 chance to spill your beer. we could make this a rule, but it doesn't really seem worth it + if (zone->random.Int(0, 15) == 1) //give about a 1 in 15 chance to spill your beer. we could make this a rule, but it doesn't really seem worth it //TODO: check for & consume an alcoholic beverage from inventory when this triggers, and set it as a rule that's disabled by default Message_StringID(MT_Skills, FISHING_SPILL_BEER); //You spill your beer while bringing in your line. else @@ -341,7 +341,7 @@ void Client::GoFish() //chance to break fishing pole... //this is potentially exploitable in that they can fish //and then swap out items in primary slot... too lazy to fix right now - if (MakeRandomInt(0, 49) == 1) { + if (zone->random.Int(0, 49) == 1) { Message_StringID(MT_Skills, FISHING_POLE_BROKE); //Your fishing pole broke! DeleteItemInInventory(MainPrimary, 0, true); } @@ -370,18 +370,18 @@ void Client::ForageItem(bool guarantee) { }; // these may need to be fine tuned, I am just guessing here - if (guarantee || MakeRandomInt(0,199) < skill_level) { + if (guarantee || zone->random.Int(0,199) < skill_level) { uint32 foragedfood = 0; uint32 stringid = FORAGE_NOEAT; - if (MakeRandomInt(0,99) <= 25) { + if (zone->random.Roll(25)) { foragedfood = database.GetZoneForage(m_pp.zone_id, skill_level); } //not an else in case theres no DB food if(foragedfood == 0) { uint8 index = 0; - index = MakeRandomInt(0, MAX_COMMON_FOOD_IDS-1); + index = zone->random.Int(0, MAX_COMMON_FOOD_IDS-1); foragedfood = common_food_ids[index]; } @@ -438,7 +438,7 @@ void Client::ForageItem(bool guarantee) { } int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems; - if(!guarantee && MakeRandomInt(0,99) < ChanceSecondForage) { + if(!guarantee && zone->random.Roll(ChanceSecondForage)) { Message_StringID(MT_Skills, FORAGE_MASTERY); ForageItem(true); } diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 4c4290232..2e64f092f 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -485,10 +485,10 @@ Mob *HateList::GetRandom() } auto iterator = list.begin(); - int random = MakeRandomInt(0, count - 1); + int random = zone->random.Int(0, count - 1); for (int i = 0; i < random; i++) ++iterator; - + return (*iterator)->ent; } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 121dad8c5..c5fda890e 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -49,15 +49,15 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite if (lts->mincash == lts->maxcash) cash = lts->mincash; else - cash = MakeRandomInt(lts->mincash, lts->maxcash); + cash = zone->random.Int(lts->mincash, lts->maxcash); if (cash != 0) { if (lts->avgcoin != 0) { //this is some crazy ass stuff... and makes very little sense... dont use it, k? uint32 mincoin = (uint32) (lts->avgcoin * 0.75 + 1); uint32 maxcoin = (uint32) (lts->avgcoin * 1.25 + 1); - *copper = MakeRandomInt(mincoin, maxcoin); - *silver = MakeRandomInt(mincoin, maxcoin); - *gold = MakeRandomInt(mincoin, maxcoin); + *copper = zone->random.Int(mincoin, maxcoin); + *silver = zone->random.Int(mincoin, maxcoin); + *gold = zone->random.Int(mincoin, maxcoin); if(*copper > cash) { *copper = cash; } cash -= *copper; if(*silver>(cash/10)) { *silver = (cash/10); } @@ -92,7 +92,7 @@ void ZoneDatabase::AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* ite float drop_chance = 0.0f; if(ltchance > 0.0 && ltchance < 100.0) { - drop_chance = MakeRandomFloat(0.0, 100.0); + drop_chance = zone->random.Real(0.0, 100.0); } if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance < ltchance)) { @@ -118,7 +118,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml uint8 limit = 0; // Start at a random point in itemlist. - uint32 item = MakeRandomInt(0, lds->NumEntries-1); + uint32 item = zone->random.Int(0, lds->NumEntries-1); // Main loop. for (uint32 i=0; iNumEntries;) { @@ -137,7 +137,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml float drop_chance = 0.0; if(thischance != 100.0) - drop_chance = MakeRandomFloat(0.0, 100.0); + drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 LogFile->write(EQEMuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); @@ -282,7 +282,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge eslot = MaterialPrimary; } else if (foundslot == MainSecondary - && (GetOwner() != nullptr || (GetLevel() >= 13 && MakeRandomInt(0,99) < NPC_DW_CHANCE) || (item2->Damage==0)) && + && (GetOwner() != nullptr || (GetLevel() >= 13 && zone->random.Roll(NPC_DW_CHANCE)) || (item2->Damage==0)) && (item2->ItemType == ItemType1HSlash || item2->ItemType == ItemType1HBlunt || item2->ItemType == ItemTypeShield || item2->ItemType == ItemType1HPiercing)) { diff --git a/zone/merc.cpp b/zone/merc.cpp index b2793db73..21c5092c9 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -170,49 +170,49 @@ void Merc::GenerateAppearance() { // Randomize facial appearance int iFace = 0; if(this->GetRace() == 2) { // Barbarian w/Tatoo - iFace = MakeRandomInt(0, 79); + iFace = zone->random.Int(0, 79); } else { - iFace = MakeRandomInt(0, 7); + iFace = zone->random.Int(0, 7); } int iHair = 0; int iBeard = 0; int iBeardColor = 1; if(this->GetRace() == 522) { - iHair = MakeRandomInt(0, 8); - iBeard = MakeRandomInt(0, 11); - iBeardColor = MakeRandomInt(0, 3); + iHair = zone->random.Int(0, 8); + iBeard = zone->random.Int(0, 11); + iBeardColor = zone->random.Int(0, 3); } else if(this->GetGender()) { - iHair = MakeRandomInt(0, 2); + iHair = zone->random.Int(0, 2); if(this->GetRace() == 8) { // Dwarven Females can have a beard - if(MakeRandomInt(1, 100) < 50) { + if(zone->random.Roll(50)) { iFace += 10; } } } else { - iHair = MakeRandomInt(0, 3); - iBeard = MakeRandomInt(0, 5); - iBeardColor = MakeRandomInt(0, 19); + iHair = zone->random.Int(0, 3); + iBeard = zone->random.Int(0, 5); + iBeardColor = zone->random.Int(0, 19); } int iHairColor = 0; if(this->GetRace() == 522) { - iHairColor = MakeRandomInt(0, 3); + iHairColor = zone->random.Int(0, 3); } else { - iHairColor = MakeRandomInt(0, 19); + iHairColor = zone->random.Int(0, 19); } - uint8 iEyeColor1 = (uint8)MakeRandomInt(0, 9); + uint8 iEyeColor1 = (uint8)zone->random.Int(0, 9); uint8 iEyeColor2 = 0; if(this->GetRace() == 522) { - iEyeColor1 = iEyeColor2 = (uint8)MakeRandomInt(0, 11); + iEyeColor1 = iEyeColor2 = (uint8)zone->random.Int(0, 11); } - else if(MakeRandomInt(1, 100) > 96) { - iEyeColor2 = MakeRandomInt(0, 9); + else if(zone->random.Int(1, 100) > 96) { + iEyeColor2 = zone->random.Int(0, 9); } else { iEyeColor2 = iEyeColor1; @@ -222,9 +222,9 @@ void Merc::GenerateAppearance() { int iTattoo = 0; int iDetails = 0; if(this->GetRace() == 522) { - iHeritage = MakeRandomInt(0, 6); - iTattoo = MakeRandomInt(0, 7); - iDetails = MakeRandomInt(0, 7); + iHeritage = zone->random.Int(0, 6); + iTattoo = zone->random.Int(0, 7); + iDetails = zone->random.Int(0, 7); } this->luclinface = iFace; @@ -1523,7 +1523,7 @@ void Merc::AI_Process() { meleeDistance = meleeDistance * .30; } else { - meleeDistance *= (float)MakeRandomFloat(.50, .85); + meleeDistance *= (float)zone->random.Real(.50, .85); } if(IsMercCaster() && GetLevel() > 12) { if(IsMercCasterCombatRange(GetTarget())) @@ -1624,7 +1624,7 @@ void Merc::AI_Process() { if (GetTarget() && flurrychance) { - if(MakeRandomInt(0, 100) < flurrychance) + if(zone->random.Roll(flurrychance)) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); Attack(GetTarget(), MainPrimary, false); @@ -1635,7 +1635,7 @@ void Merc::AI_Process() { int16 ExtraAttackChanceBonus = spellbonuses.ExtraAttackChance + itembonuses.ExtraAttackChance + aabonuses.ExtraAttackChance; if (GetTarget() && ExtraAttackChanceBonus) { - if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) + if(zone->random.Roll(ExtraAttackChanceBonus)) { Attack(GetTarget(), MainPrimary, false); } @@ -1669,10 +1669,8 @@ void Merc::AI_Process() { int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - float random = MakeRandomFloat(0, 1); - // Max 78% of DW - if (random < DualWieldProbability) + if (zone->random.Roll(DualWieldProbability)) { Attack(GetTarget(), MainSecondary); // Single attack with offhand @@ -1934,7 +1932,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, return false; if (iChance < 100) { - int8 tmp = MakeRandomInt(1, 100); + int8 tmp = zone->random.Int(1, 100); if (tmp > iChance) return false; } @@ -2030,7 +2028,7 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { return false; if (iChance < 100) { - if (MakeRandomInt(0, 100) > iChance){ + if (zone->random.Int(0, 100) > iChance){ return false; } } @@ -2315,14 +2313,14 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { if(selectedMercSpell.spellid == 0 && !tar->GetSpecialAbility(UNSTUNABLE) && !tar->IsStunned()) { uint8 stunChance = 15; - if(MakeRandomInt(1, 100) <= stunChance) { + if(zone->random.Roll(stunChance)) { selectedMercSpell = GetBestMercSpellForStun(this); } } if(selectedMercSpell.spellid == 0) { uint8 lureChance = 25; - if(MakeRandomInt(1, 100) <= lureChance) { + if(zone->random.Roll(lureChance)) { selectedMercSpell = GetBestMercSpellForNukeByTargetResists(this, tar); } } @@ -2742,14 +2740,14 @@ int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals. - if (MakeRandomInt(1,100) <= chance){ + if (zone->random.Roll(chance)) { Critical = true; ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; } - else if (GetClass() == CASTERDPS && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (MakeRandomInt(1,100) <= RuleI(Spells, WizCritChance))) { - ratio = MakeRandomInt(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. + else if (GetClass() == CASTERDPS && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Roll(RuleI(Spells, WizCritChance)))) { + ratio = zone->random.Int(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. Critical = true; } @@ -2833,7 +2831,7 @@ int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalHealDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); - if(chance && (MakeRandomInt(0,99) < chance)) { + if(chance && zone->random.Roll(chance)) { Critical = true; modifier = 2; //At present time no critical heal amount modifier SPA exists. } @@ -2864,7 +2862,7 @@ int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (spellbonuses.CriticalRegenDecay) chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); - if(chance && (MakeRandomInt(0,99) < chance)) + if(chance && zone->random.Roll(chance)) return (value * 2); } @@ -2876,7 +2874,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost) // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { - int16 mana_back = this->itembonuses.Clairvoyance * MakeRandomInt(1, 100) / 100; + int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; // Doesnt generate mana, so best case is a free spell if(mana_back > cost) mana_back = cost; @@ -2893,7 +2891,7 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost) if(focus_redux > 0) { - PercentManaReduction += MakeRandomFloat(1, (double)focus_redux); + PercentManaReduction += zone->random.Real(1, (double)focus_redux); } cost -= (cost * (PercentManaReduction / 100)); @@ -3825,17 +3823,17 @@ MercSpell Merc::GetBestMercSpellForAENuke(Merc* caster, Mob* tar) { } //check of we even want to cast an AE nuke - if(MakeRandomInt(1, 100) <= initialCastChance) { + if(zone->random.Roll(initialCastChance)) { result = GetBestMercSpellForAERainNuke(caster, tar); //check if we have a spell & allow for other AE nuke types - if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) { + if(result.spellid == 0 && zone->random.Roll(castChanceFalloff)) { result = GetBestMercSpellForPBAENuke(caster, tar); //check if we have a spell & allow for other AE nuke types - if(result.spellid == 0 && MakeRandomInt(1, 100) <= castChanceFalloff) { + if(result.spellid == 0 && zone->random.Roll(castChanceFalloff)) { result = GetBestMercSpellForTargetedAENuke(caster, tar); } @@ -3879,7 +3877,7 @@ MercSpell Merc::GetBestMercSpellForTargetedAENuke(Merc* caster, Mob* tar) { && !IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) { - if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) { + if(numTargets >= numTargetsCheck && zone->random.Roll(castChance)) { result.spellid = mercSpellListItr->spellid; result.stance = mercSpellListItr->stance; result.type = mercSpellListItr->type; @@ -3929,7 +3927,7 @@ MercSpell Merc::GetBestMercSpellForPBAENuke(Merc* caster, Mob* tar) { if(IsPBAENukeSpell(mercSpellListItr->spellid) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; if(CheckAENuke(caster, caster, mercSpellListItr->spellid, numTargets)) { - if(numTargets >= numTargetsCheck && MakeRandomInt(1, 100) <= castChance) { + if(numTargets >= numTargetsCheck && zone->random.Roll(castChance)) { result.spellid = mercSpellListItr->spellid; result.stance = mercSpellListItr->stance; result.type = mercSpellListItr->type; @@ -3976,7 +3974,7 @@ MercSpell Merc::GetBestMercSpellForAERainNuke(Merc* caster, Mob* tar) { for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order - if(IsAERainNukeSpell(mercSpellListItr->spellid) && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { + if(IsAERainNukeSpell(mercSpellListItr->spellid) && zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { uint8 numTargets = 0; if(CheckAENuke(caster, tar, mercSpellListItr->spellid, numTargets)) { if(numTargets >= numTargetsCheck) { @@ -4015,7 +4013,7 @@ MercSpell Merc::GetBestMercSpellForNuke(Merc* caster) { for(std::list::iterator mercSpellListItr = mercSpellList.begin(); mercSpellListItr != mercSpellList.end(); ++mercSpellListItr) { // Assuming all the spells have been loaded into this list by level and in descending order if(IsPureNukeSpell(mercSpellListItr->spellid) && !IsAENukeSpell(mercSpellListItr->spellid) - && MakeRandomInt(1, 100) <= castChance && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { + && zone->random.Roll(castChance) && CheckSpellRecastTimers(caster, mercSpellListItr->spellid)) { result.spellid = mercSpellListItr->spellid; result.stance = mercSpellListItr->stance; result.type = mercSpellListItr->type; @@ -4447,7 +4445,7 @@ bool Merc::CheckConfidence() { ConfidenceLossChance = 25 - ( 5 * (GetTierID() - 1)); } - if(MakeRandomInt(0 ,100) < ConfidenceLossChance) { + if(zone->random.Roll(ConfidenceLossChance)) { result = false; } @@ -4593,7 +4591,7 @@ void Merc::DoClassAttacks(Mob *target) { break; case TANK:{ if(level >= RuleI(Combat, NPCBashKickLevel)){ - if(MakeRandomInt(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. + if(zone->random.Int(0, 100) > 25) //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. { DoAnim(animKick); int32 dmg = 0; @@ -4606,7 +4604,7 @@ void Merc::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else - dmg = MakeRandomInt(1, GetKickDamage()); + dmg = zone->random.Int(1, GetKickDamage()); } } @@ -4628,7 +4626,7 @@ void Merc::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else - dmg = MakeRandomInt(1, GetBashDamage()); + dmg = zone->random.Int(1, GetBashDamage()); } } @@ -4756,7 +4754,7 @@ const char* Merc::GetRandomName(){ bool valid = false; while(!valid) { - int rndnum=MakeRandomInt(0, 75),n=1; + int rndnum=zone->random.Int(0, 75),n=1; bool dlc=false; bool vwl=false; bool dbl=false; @@ -4777,18 +4775,18 @@ const char* Merc::GetRandomName(){ rndname[0]=vowels[rndnum]; vwl=true; } - int namlen=MakeRandomInt(5, 10); + int namlen=zone->random.Int(5, 10); for (int i=n;irandom.Int(0, 62); if (rndnum>46) { // pick a cons pair if (i>namlen-3) // last 2 chars in name? { // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng" - rndnum=MakeRandomInt(0, 7)*2; + rndnum=zone->random.Int(0, 7)*2; } else { // pick any from the set @@ -4806,12 +4804,12 @@ const char* Merc::GetRandomName(){ } else { // select a vowel - rndname[i]=vowels[MakeRandomInt(0, 16)]; + rndname[i]=vowels[zone->random.Int(0, 16)]; } vwl=!vwl; if (!dbl && !dlc) { // one chance at double letters in name - if (!MakeRandomInt(0, i+9)) // chances decrease towards end of name + if (!zone->random.Int(0, i+9)) // chances decrease towards end of name { rndname[i+1]=rndname[i]; dbl=true; @@ -6367,4 +6365,4 @@ uint32 Merc::CalcUpkeepCost(uint32 templateID , uint8 level, uint8 currency_type } return cost; -} \ No newline at end of file +} diff --git a/zone/mob.cpp b/zone/mob.cpp index e56f3839c..7e58cb037 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2356,7 +2356,7 @@ uint32 Mob::RandomTimer(int min,int max) { int r = 14000; if(min != 0 && max != 0 && min < max) { - r = MakeRandomInt(min, max); + r = zone->random.Int(min, max); } return r; } @@ -2753,7 +2753,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(IsClient()) twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id); - if(twinproc_chance && (MakeRandomInt(0,99) < twinproc_chance)) + if(twinproc_chance && zone->random.Roll(twinproc_chance)) twinproc = true; if (IsBeneficialSpell(spell_id)) { @@ -3082,7 +3082,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { if(!target || !IsValidSpell(spell_id)) return false; - + int spell_trig = 0; // Count all the percentage chances to trigger for all effects for(int i = 0; i < EFFECT_COUNT; i++) @@ -3098,7 +3098,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) { if (spells[spell_id].effectid[i] == SE_SpellTrigger) { - if(MakeRandomInt(0, trig_chance) <= spells[spell_id].base[i]) + if(zone->random.Int(0, trig_chance) <= spells[spell_id].base[i]) { // If we trigger an effect then its over. if (IsValidSpell(spells[spell_id].base2[i])){ @@ -3118,7 +3118,7 @@ bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect) // if the chances don't add to 100, then each effect gets a chance to fire, chance for no trigger as well. else { - if(MakeRandomInt(0, 100) <= spells[spell_id].base[effect]) + if(zone->random.Int(0, 100) <= spells[spell_id].base[effect]) { if (IsValidSpell(spells[spell_id].base2[effect])){ SpellFinished(spells[spell_id].base2[effect], target, 10, 0, -1, spells[spells[spell_id].base2[effect]].ResistDiff); @@ -3223,7 +3223,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id) if (focus > 0) { - if(MakeRandomInt(0, 100) <= focus) + if(zone->random.Roll(focus)) { Message(MT_Spells,"You twincast %s!",spells[spell_id].name); SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff); @@ -3242,7 +3242,7 @@ void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id) int32 focus = CalcFocusEffect(focusTwincast, buffs[i].spellid, spell_id); if(focus > 0) { - if(MakeRandomInt(0, 100) <= focus) + if(zone->random.Roll(focus)) { SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff); } @@ -4023,7 +4023,7 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id) { if (IsValidSpell(spells[spell_id].base2[i]) && spells[spell_id].max[i] <= level) { - if(MakeRandomInt(0,99) < spells[spell_id].base[i]) + if(zone->random.Roll(spells[spell_id].base[i])) SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); } } @@ -4038,17 +4038,17 @@ void Mob::TrySpellOnKill(uint8 level, uint16 spell_id) for(int i = 0; i < MAX_SPELL_TRIGGER*3; i+=3) { if(aabonuses.SpellOnKill[i] && IsValidSpell(aabonuses.SpellOnKill[i]) && (level >= aabonuses.SpellOnKill[i + 2])) { - if(MakeRandomInt(0, 99) < static_cast(aabonuses.SpellOnKill[i + 1])) + if(zone->random.Roll(static_cast(aabonuses.SpellOnKill[i + 1]))) SpellFinished(aabonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } if(itembonuses.SpellOnKill[i] && IsValidSpell(itembonuses.SpellOnKill[i]) && (level >= itembonuses.SpellOnKill[i + 2])){ - if(MakeRandomInt(0, 99) < static_cast(itembonuses.SpellOnKill[i + 1])) + if(zone->random.Roll(static_cast(itembonuses.SpellOnKill[i + 1]))) SpellFinished(itembonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } if(spellbonuses.SpellOnKill[i] && IsValidSpell(spellbonuses.SpellOnKill[i]) && (level >= spellbonuses.SpellOnKill[i + 2])) { - if(MakeRandomInt(0, 99) < static_cast(spellbonuses.SpellOnKill[i + 1])) + if(zone->random.Roll(static_cast(spellbonuses.SpellOnKill[i + 1]))) SpellFinished(spellbonuses.SpellOnKill[i], this, 10, 0, -1, spells[aabonuses.SpellOnKill[i]].ResistDiff); } @@ -4065,19 +4065,19 @@ bool Mob::TrySpellOnDeath() for(int i = 0; i < MAX_SPELL_TRIGGER*2; i+=2) { if(IsClient() && aabonuses.SpellOnDeath[i] && IsValidSpell(aabonuses.SpellOnDeath[i])) { - if(MakeRandomInt(0, 99) < static_cast(aabonuses.SpellOnDeath[i + 1])) { + if(zone->random.Roll(static_cast(aabonuses.SpellOnDeath[i + 1]))) { SpellFinished(aabonuses.SpellOnDeath[i], this, 10, 0, -1, spells[aabonuses.SpellOnDeath[i]].ResistDiff); } } if(itembonuses.SpellOnDeath[i] && IsValidSpell(itembonuses.SpellOnDeath[i])) { - if(MakeRandomInt(0, 99) < static_cast(itembonuses.SpellOnDeath[i + 1])) { + if(zone->random.Roll(static_cast(itembonuses.SpellOnDeath[i + 1]))) { SpellFinished(itembonuses.SpellOnDeath[i], this, 10, 0, -1, spells[itembonuses.SpellOnDeath[i]].ResistDiff); } } if(spellbonuses.SpellOnDeath[i] && IsValidSpell(spellbonuses.SpellOnDeath[i])) { - if(MakeRandomInt(0, 99) < static_cast(spellbonuses.SpellOnDeath[i + 1])) { + if(zone->random.Roll(static_cast(spellbonuses.SpellOnDeath[i + 1]))) { SpellFinished(spellbonuses.SpellOnDeath[i], this, 10, 0, -1, spells[spellbonuses.SpellOnDeath[i]].ResistDiff); } } @@ -4240,7 +4240,7 @@ bool Mob::TryReflectSpell(uint32 spell_id) int chance = itembonuses.reflect_chance + spellbonuses.reflect_chance + aabonuses.reflect_chance; - if(chance && MakeRandomInt(0, 99) < chance) + if(chance && zone->random.Roll(chance)) return true; return false; diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 30f435dfa..d041ac884 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -57,7 +57,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { return false; if (iChance < 100) { - if (MakeRandomInt(0, 100) >= iChance) + if (zone->random.Int(0, 100) >= iChance) return false; } @@ -94,7 +94,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range ) && (mana_cost <= GetMana() || GetMana() == GetMaxMana()) - && (AIspells[i].time_cancast + (MakeRandomInt(0, 4) * 1000)) <= Timer::GetCurrentTime() //break up the spelling casting over a period of time. + && (AIspells[i].time_cancast + (zone->random.Int(0, 4) * 1000)) <= Timer::GetCurrentTime() //break up the spelling casting over a period of time. ) { #if MobAI_DEBUG_Spells >= 21 @@ -126,7 +126,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_Root: { Mob *rootee = GetHateRandom(); - if (rootee && !rootee->IsRooted() && MakeRandomInt(0, 99) < 50 + if (rootee && !rootee->IsRooted() && zone->random.Roll(50) && rootee->DontRootMeBefore() < Timer::GetCurrentTime() && rootee->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { @@ -165,7 +165,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_InCombatBuff: { - if(MakeRandomInt(0, 99) < 50) + if(zone->random.Roll(50)) { AIDoSpellCast(i, tar, mana_cost); return true; @@ -184,7 +184,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case SpellType_Slow: case SpellType_Debuff: { Mob * debuffee = GetHateRandom(); - if (debuffee && manaR >= 10 && MakeRandomInt(0, 99 < 70) && + if (debuffee && manaR >= 10 && zone->random.Roll(70) && debuffee->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0) { if (!checked_los) { if (!CheckLosFN(debuffee)) @@ -198,7 +198,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_Nuke: { if ( - manaR >= 10 && MakeRandomInt(0, 99) < 70 + manaR >= 10 && zone->random.Roll(70) && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { if(!checked_los) { @@ -212,7 +212,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { break; } case SpellType_Dispel: { - if(MakeRandomInt(0, 99) < 15) + if(zone->random.Roll(15)) { if(!checked_los) { if(!CheckLosFN(tar)) @@ -228,7 +228,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { break; } case SpellType_Mez: { - if(MakeRandomInt(0, 99) < 20) + if(zone->random.Roll(20)) { Mob * mezTar = nullptr; mezTar = entity_list.GetTargetForMez(this); @@ -244,7 +244,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case SpellType_Charm: { - if(!IsPet() && MakeRandomInt(0, 99) < 20) + if(!IsPet() && zone->random.Roll(20)) { Mob * chrmTar = GetHateRandom(); if(chrmTar && chrmTar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0) @@ -258,7 +258,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case SpellType_Pet: { //keep mobs from recasting pets when they have them. - if (!IsPet() && !GetPetID() && MakeRandomInt(0, 99) < 25) { + if (!IsPet() && !GetPetID() && zone->random.Roll(25)) { AIDoSpellCast(i, tar, mana_cost); return true; } @@ -266,7 +266,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_Lifetap: { if (GetHPRatio() <= 95 - && MakeRandomInt(0, 99) < 50 + && zone->random.Roll(50) && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { if(!checked_los) { @@ -282,7 +282,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { case SpellType_Snare: { if ( !tar->IsRooted() - && MakeRandomInt(0, 99) < 50 + && zone->random.Roll(50) && tar->DontSnareMeBefore() < Timer::GetCurrentTime() && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { @@ -300,7 +300,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { } case SpellType_DOT: { if ( - MakeRandomInt(0, 99) < 60 + zone->random.Roll(60) && tar->DontDotMeBefore() < Timer::GetCurrentTime() && tar->CanBuffStack(AIspells[i].spellid, GetLevel(), true) >= 0 ) { @@ -369,7 +369,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float return false; if (iChance < 100) { - uint8 tmp = MakeRandomInt(0, 99); + uint8 tmp = zone->random.Int(0, 99); if (tmp >= iChance) return false; } @@ -687,7 +687,7 @@ void Client::AI_SpellCast() } else { - uint32 idx = MakeRandomInt(0, (valid_spells.size()-1)); + uint32 idx = zone->random.Int(0, (valid_spells.size()-1)); spell_to_cast = valid_spells[idx]; slot_to_use = slots[idx]; } @@ -875,7 +875,7 @@ void Client::AI_Process() if (flurrychance) { - if(MakeRandomInt(0, 100) < flurrychance) + if(zone->random.Roll(flurrychance)) { Message_StringID(MT_NPCFlurry, YOU_FLURRY); Attack(GetTarget(), MainPrimary, false); @@ -892,7 +892,7 @@ void Client::AI_Process() wpn->GetItem()->ItemType == ItemType2HBlunt || wpn->GetItem()->ItemType == ItemType2HPiercing ) { - if(MakeRandomInt(0, 100) < ExtraAttackChanceBonus) + if(zone->random.Roll(ExtraAttackChanceBonus)) { Attack(GetTarget(), MainPrimary, false); } @@ -931,7 +931,7 @@ void Client::AI_Process() int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability) + if(zone->random.Roll(DualWieldProbability)) { Attack(GetTarget(), MainSecondary); if(CheckDoubleAttack()) @@ -1191,7 +1191,7 @@ void Mob::AI_Process() { //we use this random value in three comparisons with different //thresholds, and if its truely random, then this should work //out reasonably and will save us compute resources. - int32 RandRoll = MakeRandomInt(0, 99); + int32 RandRoll = zone->random.Int(0, 99); if ((CanThisClassDoubleAttack() || GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) //check double attack, this is NOT the same rules that clients use... @@ -1215,7 +1215,7 @@ void Mob::AI_Process() { int flurry_chance = GetSpecialAbilityParam(SPECATK_FLURRY, 0); flurry_chance = flurry_chance > 0 ? flurry_chance : RuleI(Combat, NPCFlurryChance); - if (MakeRandomInt(0, 99) < flurry_chance) { + if (zone->random.Roll(flurry_chance)) { ExtraAttackOptions opts; int cur = GetSpecialAbilityParam(SPECATK_FLURRY, 2); if (cur > 0) @@ -1257,7 +1257,7 @@ void Mob::AI_Process() { int16 flurry_chance = owner->aabonuses.PetFlurry + owner->spellbonuses.PetFlurry + owner->itembonuses.PetFlurry; - if (flurry_chance && (MakeRandomInt(0, 99) < flurry_chance)) + if (flurry_chance && zone->random.Roll(flurry_chance)) Flurry(nullptr); } } @@ -1266,7 +1266,7 @@ void Mob::AI_Process() { { int rampage_chance = GetSpecialAbilityParam(SPECATK_RAMPAGE, 0); rampage_chance = rampage_chance > 0 ? rampage_chance : 20; - if(MakeRandomInt(0, 99) < rampage_chance) { + if(zone->random.Roll(rampage_chance)) { ExtraAttackOptions opts; int cur = GetSpecialAbilityParam(SPECATK_RAMPAGE, 2); if(cur > 0) { @@ -1305,7 +1305,7 @@ void Mob::AI_Process() { { int rampage_chance = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 0); rampage_chance = rampage_chance > 0 ? rampage_chance : 20; - if(MakeRandomInt(0, 99) < rampage_chance) { + if(zone->random.Roll(rampage_chance)) { ExtraAttackOptions opts; int cur = GetSpecialAbilityParam(SPECATK_AREA_RAMPAGE, 2); if(cur > 0) { @@ -1349,13 +1349,12 @@ void Mob::AI_Process() { //can only dual wield without a weapon if your a monk if(GetSpecialAbility(SPECATK_INNATE_DW) || (GetEquipment(MaterialSecondary) != 0 && GetLevel() > 29) || myclass == MONK || myclass == MONKGM) { float DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel()) / 400.0f; - if(MakeRandomFloat(0.0, 1.0) < DualWieldProbability) + if(zone->random.Roll(DualWieldProbability)) { Attack(target, MainSecondary); if (CanThisClassDoubleAttack()) { - int32 RandRoll = MakeRandomInt(0, 99); - if (RandRoll < (GetLevel() + 20)) + if (zone->random.Roll(GetLevel() + 20)) { Attack(target, MainSecondary); } @@ -1619,12 +1618,12 @@ void NPC::AI_DoMovement() { ) { float movedist = roambox_distance*roambox_distance; - float movex = MakeRandomFloat(0, movedist); + float movex = zone->random.Real(0, movedist); float movey = movedist - movex; movex = sqrtf(movex); movey = sqrtf(movey); - movex *= MakeRandomInt(0, 1) ? 1 : -1; - movey *= MakeRandomInt(0, 1) ? 1 : -1; + movex *= zone->random.Int(0, 1) ? 1 : -1; + movey *= zone->random.Int(0, 1) ? 1 : -1; roambox_movingto_x = GetX() + movex; roambox_movingto_y = GetY() + movey; //Try to calculate new coord using distance. @@ -1635,9 +1634,9 @@ void NPC::AI_DoMovement() { //New coord is still invalid, ignore distance and just pick a new random coord. //If we're here we may have a roambox where one side is shorter than the specified distance. Commons, Wkarana, etc. if (roambox_movingto_x > roambox_max_x || roambox_movingto_x < roambox_min_x) - roambox_movingto_x = MakeRandomFloat(roambox_min_x+1,roambox_max_x-1); + roambox_movingto_x = zone->random.Real(roambox_min_x+1,roambox_max_x-1); if (roambox_movingto_y > roambox_max_y || roambox_movingto_y < roambox_min_y) - roambox_movingto_y = MakeRandomFloat(roambox_min_y+1,roambox_max_y-1); + roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } mlog(AI__WAYPOINTS, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", @@ -1879,7 +1878,7 @@ void Mob::AI_Event_NoLongerEngaged() { if (minLastFightingDelayMoving == maxLastFightingDelayMoving) pLastFightingDelayMoving += minLastFightingDelayMoving; else - pLastFightingDelayMoving += MakeRandomInt(minLastFightingDelayMoving, maxLastFightingDelayMoving); + pLastFightingDelayMoving += zone->random.Int(minLastFightingDelayMoving, maxLastFightingDelayMoving); // So mobs don't keep running as a ghost until AIwalking_timer fires // if they were moving prior to losing all hate if(IsMoving()){ diff --git a/zone/npc.cpp b/zone/npc.cpp index 17ab9ed48..034be8f75 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -293,7 +293,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float if(trap_list.size() > 0) { std::list::iterator trap_list_iter = trap_list.begin(); - std::advance(trap_list_iter, MakeRandomInt(0, trap_list.size() - 1)); + std::advance(trap_list_iter, zone->random.Int(0, trap_list.size() - 1)); LDoNTrapTemplate* tt = (*trap_list_iter); if(tt) { @@ -550,10 +550,10 @@ void NPC::AddCash(uint16 in_copper, uint16 in_silver, uint16 in_gold, uint16 in_ } void NPC::AddCash() { - copper = MakeRandomInt(1, 100); - silver = MakeRandomInt(1, 50); - gold = MakeRandomInt(1, 10); - platinum = MakeRandomInt(1, 5); + copper = zone->random.Int(1, 100); + silver = zone->random.Int(1, 50); + gold = zone->random.Int(1, 10); + platinum = zone->random.Int(1, 5); } void NPC::RemoveCash() { @@ -1372,7 +1372,7 @@ void NPC::PickPocket(Client* thief) { return; } - if(MakeRandomInt(0, 100) > 95){ + if(zone->random.Roll(5)) { AddToHateList(thief, 50); Say("Stop thief!"); thief->Message(13, "You are noticed trying to steal!"); @@ -1401,7 +1401,7 @@ void NPC::PickPocket(Client* thief) { memset(charges,0,50); //Determine wheter to steal money or an item. bool no_coin = ((money[0] + money[1] + money[2] + money[3]) == 0); - bool steal_item = (MakeRandomInt(0, 99) < 50 || no_coin); + bool steal_item = (zone->random.Roll(50) || no_coin); if (steal_item) { ItemList::iterator cur,end; @@ -1431,7 +1431,7 @@ void NPC::PickPocket(Client* thief) { } if (x > 0) { - int random = MakeRandomInt(0, x-1); + int random = zone->random.Int(0, x-1); inst = database.CreateItem(steal_items[random], charges[random]); if (inst) { @@ -1466,7 +1466,7 @@ void NPC::PickPocket(Client* thief) { } if (!steal_item) //Steal money { - uint32 amt = MakeRandomInt(1, (steal_skill/25)+1); + uint32 amt = zone->random.Int(1, (steal_skill/25)+1); int steal_type = 0; if (!money[0]) { @@ -1481,7 +1481,7 @@ void NPC::PickPocket(Client* thief) { } } - if (MakeRandomInt(0, 100) <= stealchance) + if (zone->random.Roll(stealchance)) { switch (steal_type) { @@ -1962,7 +1962,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) void NPC::LevelScale() { - uint8 random_level = (MakeRandomInt(level, maxlevel)); + uint8 random_level = (zone->random.Int(level, maxlevel)); float scaling = (((random_level / (float)level) - 1) * (scalerate / 100.0f)); @@ -2449,4 +2449,4 @@ void NPC::DepopSwarmPets() } } } -} \ No newline at end of file +} diff --git a/zone/object.cpp b/zone/object.cpp index 0201434c0..b1acc53c9 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -441,8 +441,8 @@ void Object::RandomSpawn(bool send_packet) { if(!m_ground_spawn) return; - m_data.x = MakeRandomFloat(m_min_x, m_max_x); - m_data.y = MakeRandomFloat(m_min_y, m_max_y); + m_data.x = zone->random.Real(m_min_x, m_max_x); + m_data.y = zone->random.Real(m_min_y, m_max_y); respawn_timer.Disable(); if(send_packet) { diff --git a/zone/pathing.cpp b/zone/pathing.cpp index c860913fe..3bf02115e 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -1344,7 +1344,7 @@ PathNode* PathManager::FindPathNodeByCoordinates(float x, float y, float z) int PathManager::GetRandomPathNode() { - return MakeRandomInt(0, Head.PathNodeCount - 1); + return zone->random.Int(0, Head.PathNodeCount - 1); } diff --git a/zone/pets.cpp b/zone/pets.cpp index cf9ecab8c..052a44bea 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -109,7 +109,7 @@ const char *GetRandPetName() "Zibann","Zibarer","Zibartik","Zibekn","Zibn","Zibobn","Zobaner","Zobann", "Zobarn","Zober","Zobn","Zonanab","Zonaner","Zonann","Zonantik","Zonarer", "Zonartik","Zonobn","Zonobtik","Zontik","Ztik" }; - int r = MakeRandomInt(0, (sizeof(petnames)/sizeof(const char *))-1); + int r = zone->random.Int(0, (sizeof(petnames)/sizeof(const char *))-1); printf("Pet being created: %s\n",petnames[r]); // DO NOT COMMENT THIS OUT! return petnames[r]; } diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 8d8562157..bf7192107 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -109,7 +109,7 @@ uint32 Spawn2::resetTimer() if (variance_ != 0) { int var_over_2 = (variance_ * 1000) / 2; - rspawn = MakeRandomInt(rspawn - var_over_2, rspawn + var_over_2); + rspawn = zone->random.Int(rspawn - var_over_2, rspawn + var_over_2); //put a lower bound on it, not a lot of difference below 100, so set that as the bound. if(rspawn < 100) @@ -126,7 +126,7 @@ uint32 Spawn2::despawnTimer(uint32 despawn_timer) if (variance_ != 0) { int var_over_2 = (variance_ * 1000) / 2; - dspawn = MakeRandomInt(dspawn - var_over_2, dspawn + var_over_2); + dspawn = zone->random.Int(dspawn - var_over_2, dspawn + var_over_2); //put a lower bound on it, not a lot of difference below 100, so set that as the bound. if(dspawn < 100) diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 81d6c5d51..6943d9349 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -25,8 +25,10 @@ #include "zonedb.h" #include "../common/misc_functions.h" #include "../common/string_util.h" +#include "zone.h" extern EntityList entity_list; +extern Zone* zone; SpawnEntry::SpawnEntry( uint32 in_NPCType, int in_chance, uint8 in_npc_spawn_limit ) { NPCType = in_NPCType; @@ -77,7 +79,7 @@ uint32 SpawnGroup::GetNPCType() { int32 roll = 0; - roll = MakeRandomInt(0, totalchance-1); + roll = zone->random.Int(0, totalchance-1); cur = possible.begin(); end = possible.end(); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index cf6a83c80..767efc410 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -138,9 +138,9 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, who->MeleeMitigation(this, max_damage, min_damage); - if(max_damage > 0) + if(max_damage > 0) CommonOutgoingHitSuccess(who, max_damage, skill); - + } who->AddToHateList(this, hate, 0, false); @@ -155,17 +155,17 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, int kb_chance = 25; kb_chance += kb_chance*(100-aabonuses.SpecialAttackKBProc[0])/100; - if (MakeRandomInt(0, 99) < kb_chance) + if (zone->random.Roll(kb_chance)) SpellFinished(904, who, 10, 0, -1, spells[904].ResistDiff); //who->Stun(100); Kayen: This effect does not stun on live, it only moves the NPC. } if (HasSkillProcs()) TrySkillProc(who, skill, ReuseTime*1000); - + if (max_damage > 0 && HasSkillProcSuccess()) TrySkillProc(who, skill, ReuseTime*1000, true); - + if(max_damage == -3 && !who->HasDied()) DoRiposte(who); } @@ -256,7 +256,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { if(RuleB(Combat, UseIntervalAC)) ht = dmg = GetBashDamage(); else - ht = dmg = MakeRandomInt(1, GetBashDamage()); + ht = dmg = zone->random.Int(1, GetBashDamage()); } } @@ -295,8 +295,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //Live parses show around 55% Triple 35% Double 10% Single, you will always get first hit. while(AtkRounds > 0) { - - if (GetTarget() && (AtkRounds == 1 || MakeRandomInt(0,100) < 75)){ + if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg , ReuseTime, true); } AtkRounds--; @@ -333,7 +332,7 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { if(RuleB(Combat, UseIntervalAC)) ht = dmg = GetKickDamage(); else - ht = dmg = MakeRandomInt(1, GetKickDamage()); + ht = dmg = zone->random.Int(1, GetKickDamage()); } } @@ -348,18 +347,18 @@ void Client::OPCombatAbility(const EQApplicationPacket *app) { //Live AA - Technique of Master Wu int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; if (wuchance) { - if (wuchance >= 100 || wuchance > MakeRandomInt(0, 99)) { + if (wuchance >= 100 || zone->random.Roll(wuchance)) { int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; int extra = 1; // always 1/4 of the double attack chance, 25% at rank 5 (100/4) - if (wuchance / 4 > MakeRandomInt(0, 99)) + if (zone->random.Roll(wuchance / 4)) extra++; // They didn't add a string ID for this. std::string msg = StringFormat("The spirit of Master Wu fills you! You gain %d additional attack(s).", extra); // live uses 400 here -- not sure if it's the best for all clients though SendColoredText(400, msg); while (extra) { - MonkSpecialAttack(GetTarget(), MonkSPA[MakeRandomInt(0, 4)]); + MonkSpecialAttack(GetTarget(), MonkSPA[zone->random.Int(0, 4)]); extra--; } } @@ -484,7 +483,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) if(RuleB(Combat, UseIntervalAC)) ht = ndamage = max_dmg; else - ht = ndamage = MakeRandomInt(min_dmg, max_dmg); + ht = ndamage = zone->random.Int(min_dmg, max_dmg); } else{ ht = max_dmg; @@ -525,15 +524,14 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { //Live AA - Seized Opportunity int FrontalBSChance = itembonuses.FrontalBackstabChance + spellbonuses.FrontalBackstabChance + aabonuses.FrontalBackstabChance; - if (FrontalBSChance && (FrontalBSChance > MakeRandomInt(0, 100))) + if (FrontalBSChance && zone->random.Roll(FrontalBSChance)) bCanFrontalBS = true; } - - if (bIsBehind || bCanFrontalBS){ // Player is behind other OR can do Frontal Backstab - if (bCanFrontalBS) + if (bIsBehind || bCanFrontalBS){ // Player is behind other OR can do Frontal Backstab + if (bCanFrontalBS) CastToClient()->Message(0,"Your fierce attack is executed with such grace, your target did not see it coming!"); - + RogueBackstab(other,false,ReuseTime); if (level > 54) { if(IsClient() && CastToClient()->CheckDoubleAttack(false)) @@ -541,14 +539,14 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { if(other->GetHP() > 0) RogueBackstab(other,false,ReuseTime); - if (tripleChance && other->GetHP() > 0 && tripleChance > MakeRandomInt(0, 100)) + if (tripleChance && other->GetHP() > 0 && zone->random.Roll(tripleChance)) RogueBackstab(other,false,ReuseTime); } } - + if(IsClient()) CastToClient()->CheckIncreaseSkill(SkillBackstab, other, 10); - + } //Live AA - Chaotic Backstab else if(aabonuses.FrontalBackstabMinDmg || itembonuses.FrontalBackstabMinDmg || spellbonuses.FrontalBackstabMinDmg) { @@ -562,7 +560,7 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) { if(other->GetHP() > 0) RogueBackstab(other,true, ReuseTime); - if (tripleChance && other->GetHP() > 0 && tripleChance > MakeRandomInt(0, 100)) + if (tripleChance && other->GetHP() > 0 && zone->random.Roll(tripleChance)) RogueBackstab(other,false,ReuseTime); } @@ -640,7 +638,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) if(RuleB(Combat, UseIntervalAC)) ndamage = max_hit; else - ndamage = MakeRandomInt(min_hit, max_hit); + ndamage = zone->random.Int(min_hit, max_hit); } } } @@ -793,7 +791,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow. int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile; - if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && MakeRandomInt(0,99) > ChanceAvoidConsume)){ + if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); mlog(COMBAT__RANGED, "Consumed one arrow from slot %d", ammo_slot); } else { @@ -920,11 +918,10 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ - int bonuschance = RuleI(Combat, ArcheryBonusChance); bonuschance = mod_archery_bonus_chance(bonuschance, RangeWeapon); - if( !RuleB(Combat, UseArcheryBonusRoll) || (MakeRandomInt(1, 100) < bonuschance)){ + if( !RuleB(Combat, UseArcheryBonusRoll) || zone->random.Roll(bonuschance)){ if(RuleB(Combat, ArcheryBonusRequiresStationary)){ if(other->IsNPC() && !other->IsMoving() && !other->IsRooted()) dobonus = true; @@ -949,7 +946,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if(RuleB(Combat, UseIntervalAC)) TotalDmg = MaxDmg; else - TotalDmg = MakeRandomInt(1, MaxDmg); + TotalDmg = zone->random.Int(1, MaxDmg); int minDmg = 1; if(GetLevel() > 25){ @@ -1193,9 +1190,9 @@ void NPC::RangedAttack(Mob* other) if(ammo) SendItemAnimation(other, ammo, SkillArchery); - else + else ProjectileAnimation(other, 0,false,0,0,0,0,GetAmmoIDfile(),skillinuse); - + FaceTarget(other); if (!other->CheckHitChance(this, skillinuse, MainRange, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2))) @@ -1211,17 +1208,17 @@ void NPC::RangedAttack(Mob* other) if(WDmg > 0 || ADmg > 0) { mlog(COMBAT__RANGED, "Ranged attack hit %s.", other->GetName()); - + int32 MaxDmg = max_dmg * RuleR(Combat, ArcheryNPCMultiplier); // should add a field to npc_types int32 MinDmg = min_dmg * RuleR(Combat, ArcheryNPCMultiplier); if(RuleB(Combat, UseIntervalAC)) TotalDmg = MaxDmg; else - TotalDmg = MakeRandomInt(MinDmg, MaxDmg); + TotalDmg = zone->random.Int(MinDmg, MaxDmg); TotalDmg += TotalDmg * GetSpecialAbilityParam(SPECATK_RANGED_ATK, 3) / 100; //Damage modifier - + other->AvoidDamage(this, TotalDmg, false); other->MeleeMitigation(this, TotalDmg, MinDmg); if (TotalDmg > 0) @@ -1262,7 +1259,7 @@ uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { if(RuleB(Combat, UseIntervalAC)) TotalDmg = MaxDmg; else - TotalDmg = MakeRandomInt(1, MaxDmg); + TotalDmg = zone->random.Int(1, MaxDmg); minDmg = 1; if(GetLevel() > 25){ @@ -1680,7 +1677,7 @@ void NPC::DoClassAttacks(Mob *target) { } case WARRIOR: case WARRIORGM:{ if(level >= RuleI(Combat, NPCBashKickLevel)){ - if(MakeRandomInt(0, 100) > 25){ //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. + if(zone->random.Roll(75)) { //tested on live, warrior mobs both kick and bash, kick about 75% of the time, casting doesn't seem to make a difference. DoAnim(animKick); int32 dmg = 0; @@ -1692,7 +1689,7 @@ void NPC::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else - dmg = MakeRandomInt(1, GetKickDamage()); + dmg = zone->random.Int(1, GetKickDamage()); } } @@ -1713,7 +1710,7 @@ void NPC::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else - dmg = MakeRandomInt(1, GetBashDamage()); + dmg = zone->random.Int(1, GetBashDamage()); } } @@ -1740,8 +1737,8 @@ void NPC::DoClassAttacks(Mob *target) { reuse = FrenzyReuseTime * 1000; - while(AtkRounds > 0) { - if (GetTarget() && (AtkRounds == 1 || MakeRandomInt(0,100) < 75)){ + while(AtkRounds > 0) { + if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, -1 , reuse, true); } AtkRounds--; @@ -1766,7 +1763,7 @@ void NPC::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else - dmg = MakeRandomInt(1, GetKickDamage()); + dmg = zone->random.Int(1, GetKickDamage()); } } @@ -1791,7 +1788,7 @@ void NPC::DoClassAttacks(Mob *target) { if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else - dmg = MakeRandomInt(1, GetBashDamage()); + dmg = zone->random.Int(1, GetBashDamage()); } } @@ -1900,7 +1897,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if(RuleB(Combat, UseIntervalAC)) dmg = GetBashDamage(); else - dmg = MakeRandomInt(1, GetBashDamage()); + dmg = zone->random.Int(1, GetBashDamage()); } } @@ -1937,7 +1934,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) //Live parses show around 55% Triple 35% Double 10% Single, you will always get first hit. while(AtkRounds > 0) { - if (GetTarget() && (AtkRounds == 1 || MakeRandomInt(0,100) < 75)){ + if (GetTarget() && (AtkRounds == 1 || zone->random.Roll(75))) { DoSpecialAttackDamage(GetTarget(), SkillFrenzy, max_dmg, min_dmg, max_dmg , ReuseTime, true); } AtkRounds--; @@ -1964,7 +1961,7 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) if(RuleB(Combat, UseIntervalAC)) dmg = GetKickDamage(); else - dmg = MakeRandomInt(1, GetKickDamage()); + dmg = zone->random.Int(1, GetKickDamage()); } } @@ -1984,17 +1981,17 @@ void Client::DoClassAttacks(Mob *ca_target, uint16 skill, bool IsRiposte) //Live AA - Technique of Master Wu int wuchance = itembonuses.DoubleSpecialAttack + spellbonuses.DoubleSpecialAttack + aabonuses.DoubleSpecialAttack; if (wuchance) { - if (wuchance >= 100 || wuchance > MakeRandomInt(0, 99)) { + if (wuchance >= 100 || zone->random.Roll(wuchance)) { int MonkSPA [5] = { SkillFlyingKick, SkillDragonPunch, SkillEagleStrike, SkillTigerClaw, SkillRoundKick }; int extra = 1; - if (wuchance / 4 > MakeRandomInt(0, 99)) + if (zone->random.Roll(wuchance / 4)) extra++; // They didn't add a string ID for this. std::string msg = StringFormat("The spirit of Master Wu fills you! You gain %d additional attack(s).", extra); // live uses 400 here -- not sure if it's the best for all clients though SendColoredText(400, msg); while (extra) { - MonkSpecialAttack(ca_target, MonkSPA[MakeRandomInt(0, 4)]); + MonkSpecialAttack(ca_target, MonkSPA[zone->random.Int(0, 4)]); extra--; } } @@ -2046,7 +2043,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) { int32 newhate = 0; float tauntchance = 50.0f; - + if(always_succeed) tauntchance = 101.0f; @@ -2078,7 +2075,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) { tauntchance /= 100.0f; - if (tauntchance > MakeRandomFloat(0, 1)) { + if (tauntchance > zone->random.Real(0, 1)) { if (hate_top && hate_top != this){ newhate = (who->GetNPCHate(hate_top) - who->GetNPCHate(this)) + 1; who->CastToNPC()->AddToHateList(this, newhate); @@ -2100,7 +2097,7 @@ void Mob::Taunt(NPC* who, bool always_succeed, float chance_bonus) { if (HasSkillProcs()) TrySkillProc(who, SkillTaunt, TauntReuseTime*1000); - + if (Success && HasSkillProcSuccess()) TrySkillProc(who, SkillTaunt, TauntReuseTime*1000, true); } @@ -2134,7 +2131,7 @@ void Mob::InstillDoubt(Mob *who) { //target's counters value -= target->GetLevel()*4 + who->GetWIS()/4; - if (MakeRandomInt(0,99) < value) { + if (zone->random.Roll(value)) { //temporary hack... //cast fear on them... should prolly be a different spell //and should be un-resistable. @@ -2143,7 +2140,7 @@ void Mob::InstillDoubt(Mob *who) { } else { Message_StringID(4,NOT_SCARING); //Idea from WR: - /* if (target->IsNPC() && MakeRandomInt(0,99) < 10 ) { + /* if (target->IsNPC() && zone->random.Int(0,99) < 10 ) { entity_list.MessageClose(target, false, 50, MT_NPCRampage, "%s lashes out in anger!",target->GetName()); //should we actually do this? and the range is completely made up, unconfirmed entity_list.AEAttack(target, 50); @@ -2151,12 +2148,12 @@ void Mob::InstillDoubt(Mob *who) { } } -uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { +uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { //Only works on YOUR target. - if(defender && (defender->GetBodyType() == BT_Humanoid) && !defender->IsClient() + if(defender && (defender->GetBodyType() == BT_Humanoid) && !defender->IsClient() && (skillInUse == SkillArchery) && (GetTarget() == defender)) { - - uint32 HeadShot_Dmg = aabonuses.HeadShot[1] + spellbonuses.HeadShot[1] + itembonuses.HeadShot[1]; + + uint32 HeadShot_Dmg = aabonuses.HeadShot[1] + spellbonuses.HeadShot[1] + itembonuses.HeadShot[1]; uint8 HeadShot_Level = 0; //Get Highest Headshot Level HeadShot_Level = aabonuses.HSLevel; if (HeadShot_Level < spellbonuses.HSLevel) @@ -2164,9 +2161,9 @@ uint32 Mob::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { else if (HeadShot_Level < itembonuses.HSLevel) HeadShot_Level = itembonuses.HSLevel; - if(HeadShot_Dmg && HeadShot_Level && (defender->GetLevel() <= HeadShot_Level)){ + if(HeadShot_Dmg && HeadShot_Level && (defender->GetLevel() <= HeadShot_Level)){ float ProcChance = GetSpecialProcChances(MainRange); - if(ProcChance > MakeRandomFloat(0,1)) + if(zone->random.Roll(ProcChance)) return HeadShot_Dmg; } } @@ -2195,7 +2192,7 @@ float Mob::GetSpecialProcChances(uint16 hand) } else { /*PRE 2014 CHANGE Dev Quote - "Elidroth SOE:Proc chance is a function of your base hardcapped Dexterity / 35 + Heroic Dexterity / 25.” Kayen: Most reports suggest a ~ 6% chance to Headshot which consistent with above.*/ - + ProcChance = (static_cast(mydex/35) + static_cast(itembonuses.HeroicDEX / 25))/100.0f; } @@ -2206,9 +2203,9 @@ uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 Reuse if(defender && (defender->GetBodyType() == BT_Humanoid) && !defender->IsClient() && (skillInUse == SkillBackstab || skillInUse == SkillThrowing)) { - + uint32 Assassinate_Dmg = aabonuses.Assassinate[1] + spellbonuses.Assassinate[1] + itembonuses.Assassinate[1]; - + uint8 Assassinate_Level = 0; //Get Highest Headshot Level Assassinate_Level = aabonuses.AssassinateLevel; if (Assassinate_Level < spellbonuses.AssassinateLevel) @@ -2226,13 +2223,13 @@ uint32 Mob::TryAssassinate(Mob* defender, SkillUseTypes skillInUse, uint16 Reuse if(Assassinate_Dmg && Assassinate_Level && (defender->GetLevel() <= Assassinate_Level)){ float ProcChance = 0.0f; - + if (skillInUse == SkillThrowing) ProcChance = GetSpecialProcChances(MainRange); else ProcChance = GetAssassinateProcChances(ReuseTime); - if(ProcChance > MakeRandomFloat(0,1)) + if(zone->random.Roll(ProcChance)) return Assassinate_Dmg; } } @@ -2252,7 +2249,7 @@ float Mob::GetAssassinateProcChances(uint16 ReuseTime) if (RuleB(Combat, AdjustSpecialProcPerMinute)) { ProcChance = (static_cast(ReuseTime*1000) * - RuleR(Combat, AvgSpecialProcsPerMinute) / 60000.0f); + RuleR(Combat, AvgSpecialProcsPerMinute) / 60000.0f); ProcBonus += (10 + (static_cast(mydex/10) + static_cast(itembonuses.HeroicDEX /10)))/100.0f; ProcChance += ProcChance * ProcBonus / 100.0f; @@ -2314,7 +2311,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes } } - ApplySpecialAttackMod(skillinuse, max_hit, min_hit); + ApplySpecialAttackMod(skillinuse, max_hit, min_hit); min_hit += min_hit * GetMeleeMinDamageMod_SE(skillinuse) / 100; if(max_hit < min_hit) @@ -2323,8 +2320,8 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes if(RuleB(Combat, UseIntervalAC)) damage = max_hit; else - damage = MakeRandomInt(min_hit, max_hit); - + damage = zone->random.Int(min_hit, max_hit); + if(!other->CheckHitChance(this, skillinuse, Hand, chance_mod)) { damage = 0; } else { @@ -2362,7 +2359,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes int kb_chance = 25; kb_chance += kb_chance*(100-aabonuses.SpecialAttackKBProc[0])/100; - if (MakeRandomInt(0, 99) < kb_chance) + if (zone->random.Roll(kb_chance)) SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index d3ef1145d..59526fbbc 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -455,7 +455,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsClient()) { - if(MakeRandomInt(0, 99) < RuleI(Spells, SuccorFailChance)) { //2% Fail chance by default + if(zone->random.Roll(RuleI(Spells, SuccorFailChance))) { //2% Fail chance by default if(IsClient()) { CastToClient()->Message_StringID(MT_SpellFailure,SUCCOR_FAIL); @@ -710,9 +710,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) stun_resist += aabonuses.StunResist; - if (stun_resist <= 0 || MakeRandomInt(0,99) >= stun_resist) { + if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance.", stun_resist); - + if (caster->IsClient()) effect_value += effect_value*caster->CastToClient()->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -1033,8 +1033,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #endif if(!spellbonuses.AntiGate){ - if(MakeRandomInt(0, 99) < effect_value) - Gate(); + if(zone->random.Roll(effect_value)) + Gate(); else caster->Message_StringID(MT_SpellFailure,GATE_FAIL); } @@ -1475,16 +1475,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #endif int wipechance = spells[spell_id].base[i]; int bonus = 0; - + if (caster){ - bonus = caster->spellbonuses.IncreaseChanceMemwipe + - caster->itembonuses.IncreaseChanceMemwipe + + bonus = caster->spellbonuses.IncreaseChanceMemwipe + + caster->itembonuses.IncreaseChanceMemwipe + caster->aabonuses.IncreaseChanceMemwipe; } wipechance += wipechance*bonus/100; - - if(MakeRandomInt(0, 99) < wipechance) + + if(zone->random.Roll(wipechance)) { if(IsAIControlled()) { @@ -1597,7 +1597,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(IsClient()) { - if (MakeRandomInt(0, 99) > spells[spell_id].base[i]) { + if (zone->random.Int(0, 99) > spells[spell_id].base[i]) { CastToClient()->SetFeigned(false); entity_list.MessageClose_StringID(this, false, 200, 10, STRING_FEIGNFAILED, GetName()); } @@ -2187,7 +2187,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #ifdef SPELL_EFFECT_SPAM snprintf(effect_desc, _EDLEN, "Fading Memories"); #endif - if(MakeRandomInt(0, 99) < spells[spell_id].base[i] ) { + if(zone->random.Roll(spells[spell_id].base[i])) { if(caster && caster->IsClient()) caster->CastToClient()->Escape(); @@ -2711,11 +2711,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } }else{ int32 newhate = GetHateAmount(caster) + effect_value; - if (newhate < 1) + if (newhate < 1) SetHate(caster,1); - else + else SetHate(caster,newhate); - } + } } break; } @@ -2724,9 +2724,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (buffslot >= 0) break; - if(!spells[spell_id].uninterruptable && IsCasting() && MakeRandomInt(0, 100) <= spells[spell_id].base[i]) + if(!spells[spell_id].uninterruptable && IsCasting() && zone->random.Roll(spells[spell_id].base[i])) InterruptSpell(); - + break; } @@ -2742,17 +2742,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) Message(10, "The power of your next illusion spell will flow to your grouped target in your place."); break; } - + case SE_ApplyEffect: { if (caster && IsValidSpell(spells[spell_id].base2[i])){ - - if(MakeRandomInt(0, 100) <= spells[spell_id].base[i]) + if(zone->random.Roll(spells[spell_id].base[i])) caster->SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spells[spell_id].base2[i]].ResistDiff); } break; } - + case SE_SpellTrigger: { if (!SE_SpellTrigger_HasCast) { @@ -3209,7 +3208,7 @@ snare has both of them negative, yet their range should work the same: break; } case 123: // added 2/6/04 - result = MakeRandomInt(ubase, abs(max)); + result = zone->random.Int(ubase, abs(max)); break; case 124: // check sign @@ -3573,16 +3572,16 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste int wipechance = spells[spell_id].base[i]; int bonus = 0; - + if (caster){ - bonus = caster->spellbonuses.IncreaseChanceMemwipe + - caster->itembonuses.IncreaseChanceMemwipe + + bonus = caster->spellbonuses.IncreaseChanceMemwipe + + caster->itembonuses.IncreaseChanceMemwipe + caster->aabonuses.IncreaseChanceMemwipe; } - + wipechance += wipechance*bonus/100; - - if(MakeRandomInt(0, 99) < wipechance) + + if(zone->random.Roll(wipechance)) { if(IsAIControlled()) { @@ -3602,16 +3601,14 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste } case SE_Root: { - /* Root formula derived from extensive personal live parses - Kayen ROOT has a 70% chance to do a resist check to break. */ - if (MakeRandomInt(0, 99) < RuleI(Spells, RootBreakCheckChance)){ - + if (zone->random.Roll(RuleI(Spells, RootBreakCheckChance))) { float resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, 0,0,0,0,true); - if(resist_check == 100) + if(resist_check == 100) break; else if(!TryFadeEffect(slot)) @@ -3623,11 +3620,10 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste case SE_Fear: { - if (MakeRandomInt(0, 99) < RuleI(Spells, FearBreakCheckChance)){ - + if (zone->random.Roll(RuleI(Spells, FearBreakCheckChance))) { float resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster); - if(resist_check == 100) + if(resist_check == 100) break; else if(!TryFadeEffect(slot)) @@ -3664,7 +3660,7 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste break_chance -= (2 * (((double)GetSkill(SkillDivination) + ((double)GetLevel() * 3.0)) / 650.0)); } - if(MakeRandomFloat(0.0, 100.0) < break_chance) + if(zone->random.Real(0.0, 100.0) < break_chance) { BuffModifyDurationBySpellID(spell_id, 3); } @@ -3684,7 +3680,7 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste { if(IsCasting()) { - if(MakeRandomInt(0, 100) <= spells[spell_id].base[i]) + if(zone->random.Roll(spells[spell_id].base[i])) { InterruptSpell(); } @@ -4582,11 +4578,9 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) case SE_TriggerOnCast: if(type == focusTriggerOnCast){ - if(MakeRandomInt(0, 100) <= base1){ + if(zone->random.Roll(base1)) { value = base2; - } - - else{ + } else { value = 0; LimitFailure = true; } @@ -4600,7 +4594,7 @@ int16 Client::CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id) case SE_BlockNextSpellFocus: if(type == focusBlockNextSpell){ - if(MakeRandomInt(1, 100) <= base1) + if(zone->random.Roll(base1)) value = 1; } break; @@ -4955,7 +4949,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -4974,7 +4968,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -4993,7 +4987,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo value = focus_spell.base[i]; } else { - value = MakeRandomInt(focus_spell.base[i], focus_spell.base2[i]); + value = zone->random.Int(focus_spell.base[i], focus_spell.base2[i]); } } break; @@ -5062,7 +5056,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo case SE_TriggerOnCast: if(type == focusTriggerOnCast){ - if(MakeRandomInt(1, 100) <= focus_spell.base[i]) + if(zone->random.Roll(focus_spell.base[i])) value = focus_spell.base2[i]; else value = 0; @@ -5071,7 +5065,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo case SE_BlockNextSpellFocus: if(type == focusBlockNextSpell){ - if(MakeRandomInt(1, 100) <= focus_spell.base[i]) + if(zone->random.Roll(focus_spell.base[i])) value = 1; } break; @@ -5219,12 +5213,9 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (TempItem && TempItem->Focus.Effect > 0 && IsValidSpell(TempItem->Focus.Effect)) { proc_spellid = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id); - if (IsValidSpell(proc_spellid)){ - ProcChance = GetSympatheticProcChances(spell_id, spells[TempItem->Focus.Effect].base[0], TempItem->ProcRate); - - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Roll(ProcChance)) SympatheticProcList.push_back(proc_spellid); } } @@ -5240,14 +5231,10 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { { const Item_Struct* TempItemAug = aug->GetItem(); if (TempItemAug && TempItemAug->Focus.Effect > 0 && IsValidSpell(TempItemAug->Focus.Effect)) { - proc_spellid = CalcFocusEffect(type, TempItemAug->Focus.Effect, spell_id); - if (IsValidSpell(proc_spellid)){ - ProcChance = GetSympatheticProcChances(spell_id, spells[TempItemAug->Focus.Effect].base[0], TempItemAug->ProcRate); - - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Roll(ProcChance)) SympatheticProcList.push_back(proc_spellid); } } @@ -5275,8 +5262,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (IsValidSpell(proc_spellid)){ ProcChance = GetSympatheticProcChances(spell_id, spells[focusspellid].base[0]); - - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Roll(ProcChance)) SympatheticProcList.push_back(proc_spellid); } } @@ -5302,10 +5288,8 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { proc_spellid = CalcAAFocus(type, aa_AA, spell_id); if (IsValidSpell(proc_spellid)){ - ProcChance = GetSympatheticProcChances(spell_id, GetAABase1(aa_AA, 1)); - - if(MakeRandomFloat(0, 1) <= ProcChance) + if(zone->random.Roll(ProcChance)) SympatheticProcList.push_back(proc_spellid); } } @@ -5313,7 +5297,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (SympatheticProcList.size() > 0) { - uint8 random = MakeRandomInt(0, SympatheticProcList.size()-1); + uint8 random = zone->random.Int(0, SympatheticProcList.size()-1); int FinalSympatheticProc = SympatheticProcList[random]; SympatheticProcList.clear(); return FinalSympatheticProc; @@ -5672,7 +5656,7 @@ bool Mob::TryDivineSave() */ int32 SuccessChance = aabonuses.DivineSaveChance[0] + itembonuses.DivineSaveChance[0] + spellbonuses.DivineSaveChance[0]; - if (SuccessChance && MakeRandomInt(0, 100) <= SuccessChance) + if (SuccessChance && zone->random.Roll(SuccessChance)) { SetHP(1); @@ -5731,7 +5715,7 @@ bool Mob::TryDeathSave() { if (SuccessChance > 95) SuccessChance = 95; - if(SuccessChance >= MakeRandomInt(0, 100)) { + if(zone->random.Roll(SuccessChance)) { if(spellbonuses.DeathSave[0] == 2) HealAmt = RuleI(Spells, DivineInterventionHeal); //8000HP is how much LIVE Divine Intervention max heals @@ -5762,7 +5746,7 @@ bool Mob::TryDeathSave() { if (SuccessChance > 95) SuccessChance = 95; - if(SuccessChance >= MakeRandomInt(0, 100)) { + if(zone->random.Roll(SuccessChance)) { if(spellbonuses.DeathSave[0] == 2) HealAmt = RuleI(Spells, DivineInterventionHeal); @@ -6064,7 +6048,7 @@ bool Mob::TryDispel(uint8 caster_level, uint8 buff_level, int level_modifier){ else if (dispel_chance < 10) dispel_chance = 10; - if (MakeRandomInt(0,99) < dispel_chance) + if (zone->random.Roll(dispel_chance)) return true; else return false; diff --git a/zone/spells.cpp b/zone/spells.cpp index 3bdc3557e..b051dfdca 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -178,7 +178,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if(IsClient()){ int chance = CastToClient()->GetFocusEffect(focusFcMute, spell_id); - if (MakeRandomInt(0,99) < chance){ + if (zone->random.Roll(chance)) { Message_StringID(13, SILENCED_STRING); if(IsClient()) CastToClient()->SendSpellBarEnable(spell_id); @@ -697,7 +697,7 @@ bool Client::CheckFizzle(uint16 spell_id) specialize = specialize * 1.3; break; } - if(((specialize/6.0f) + 15.0f) < MakeRandomFloat(0, 100)) { + if(((specialize/6.0f) + 15.0f) < zone->random.Real(0, 100)) { specialize *= SPECIALIZE_FIZZLE / 200.0f; } else { specialize = 0.0f; @@ -739,7 +739,7 @@ bool Client::CheckFizzle(uint16 spell_id) } */ - float fizzle_roll = MakeRandomFloat(0, 100); + float fizzle_roll = zone->random.Real(0, 100); mlog(SPELLS__CASTING, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); @@ -1028,7 +1028,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, mlog(SPELLS__CASTING, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); - if(!spells[spell_id].uninterruptable && MakeRandomFloat(0, 100) > channelchance) { + if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; @@ -1044,7 +1044,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // first check for component reduction if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id); - if(MakeRandomInt(1, 100) <= reg_focus) { + if(zone->random.Roll(reg_focus)) { mlog(SPELLS__CASTING, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) @@ -4204,7 +4204,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use { IsFear = true; int fear_resist_bonuses = CalcFearResistChance(); - if(MakeRandomInt(0, 99) < fear_resist_bonuses) + if(zone->random.Roll(fear_resist_bonuses)) { mlog(SPELLS__RESISTS, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; @@ -4215,14 +4215,14 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Check for Spell Effect specific resistance chances (ie AA Mental Fortitude) int se_resist_bonuses = GetSpellEffectResistChance(spell_id); - if(se_resist_bonuses && (MakeRandomInt(0, 99) < se_resist_bonuses)) + if(se_resist_bonuses && zone->random.Roll(se_resist_bonuses)) { return 0; } // Check for Chance to Resist Spell bonuses (ie Sanctification Discipline) int resist_bonuses = CalcResistChanceBonus(); - if(resist_bonuses && (MakeRandomInt(0, 99) < resist_bonuses)) + if(resist_bonuses && zone->random.Roll(resist_bonuses)) { mlog(SPELLS__RESISTS, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; @@ -4448,7 +4448,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use } //Finally our roll - int roll = MakeRandomInt(0, 200); + int roll = zone->random.Int(0, 200); if(roll > resist_chance) { return 100; @@ -4665,7 +4665,7 @@ void Mob::Stun(int duration) if(IsValidSpell(casting_spell_id) && !spells[casting_spell_id].uninterruptable) { int persistent_casting = spellbonuses.PersistantCasting + itembonuses.PersistantCasting + aabonuses.PersistantCasting; - if(MakeRandomInt(0,99) > persistent_casting) + if(zone->random.Int(0,99) > persistent_casting) InterruptSpell(); } @@ -5548,4 +5548,4 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust) ++iter; } -} \ No newline at end of file +} diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index fd9f5a632..58774f4b1 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -923,7 +923,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { _log(TRADESKILLS__TRACE, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); _log(TRADESKILLS__TRACE, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); - float res = MakeRandomFloat(0, 99); + float res = zone->random.Real(0, 99); int aa_chance = 0; //AA modifiers @@ -1057,7 +1057,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = mod_tradeskill_chance(chance, spec); - if (((spec->tradeskill==75) || GetGM() || (chance > res)) || MakeRandomInt(0, 99) < aa_chance){ + if (((spec->tradeskill==75) || GetGM() || (chance > res)) || zone->random.Roll(aa_chance)) { success_modifier = 1; if(over_trivial < 0) @@ -1127,7 +1127,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { uint8 sc = 0; while(itr != spec->salvage.end()) { for(sc = 0; sc < itr->second; sc++) - if(MakeRandomInt(0,99) < SalvageChance) + if(zone->random.Roll(SalvageChance)) SummonItem(itr->first, 1); ++itr; } @@ -1153,7 +1153,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float //In stage2 the only thing that matters is your current unmodified skill. //If you want to customize here you probbably need to implement your own //formula instead of tweaking the below one. - if (chance_stage1 > MakeRandomFloat(0, 99)) { + if (chance_stage1 > zone->random.Real(0, 99)) { if (current_raw_skill < 15) { //Always succeed chance_stage2 = 100; @@ -1168,7 +1168,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float chance_stage2 = mod_tradeskill_skillup(chance_stage2); - if (chance_stage2 > MakeRandomFloat(0, 99)) { + if (chance_stage2 > zone->random.Real(0, 99)) { //Only if stage1 and stage2 succeeded you get a skillup. SetSkill(tradeskill, current_raw_skill + 1); diff --git a/zone/trap.cpp b/zone/trap.cpp index 44c177118..7d412d7cb 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -144,7 +144,7 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-5+MakeRandomInt(0, 10), y-5+MakeRandomInt(0, 10), z-5+MakeRandomInt(0, 10), MakeRandomInt(0, 249), FlyMode3); + NPC* new_npc = new NPC(tmp, 0, x-5+zone->random.Int(0, 10), y-5+zone->random.Int(0, 10), z-5+zone->random.Int(0, 10), zone->random.Int(0, 249), FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -165,7 +165,7 @@ void Trap::Trigger(Mob* trigger) { if ((tmp = database.GetNPCType(effectvalue))) { - NPC* new_npc = new NPC(tmp, 0, x-2+MakeRandomInt(0, 5), y-2+MakeRandomInt(0, 5), z-2+MakeRandomInt(0, 5), MakeRandomInt(0, 249), FlyMode3); + NPC* new_npc = new NPC(tmp, 0, x-2+zone->random.Int(0, 5), y-2+zone->random.Int(0, 5), z-2+zone->random.Int(0, 5), zone->random.Int(0, 249), FlyMode3); new_npc->AddLootTable(); entity_list.AddNPC(new_npc); new_npc->AddToHateList(trigger,1); @@ -185,10 +185,10 @@ void Trap::Trigger(Mob* trigger) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_Damage, sizeof(CombatDamage_Struct)); CombatDamage_Struct* a = (CombatDamage_Struct*)outapp->pBuffer; - int dmg = MakeRandomInt(effectvalue, effectvalue2); + int dmg = zone->random.Int(effectvalue, effectvalue2); trigger->SetHP(trigger->GetHP() - dmg); a->damage = dmg; - a->sequence = MakeRandomInt(0, 1234567); + a->sequence = zone->random.Int(0, 1234567); a->source = GetHiddenTrigger()!=nullptr ? GetHiddenTrigger()->GetID() : trigger->GetID(); a->spellid = 0; a->target = trigger->GetID(); @@ -197,7 +197,7 @@ void Trap::Trigger(Mob* trigger) safe_delete(outapp); } } - respawn_timer.Start((respawn_time + MakeRandomInt(0, respawn_var)) * 1000); + respawn_timer.Start((respawn_time + zone->random.Int(0, respawn_var)) * 1000); chkarea_timer.Disable(); disarmed = true; } @@ -250,7 +250,7 @@ Mob* EntityList::GetTrapTrigger(Trap* trap) { if ((xdiff*xdiff + ydiff*ydiff) <= maxdist && zdiff < trap->maxzdiff) { - if (MakeRandomInt(0,100) < trap->chance) + if (zone->random.Roll(trap->chance)) return(cur); else savemob = cur; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 908f0f946..410e76f3f 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -270,7 +270,7 @@ void NPC::CalculateNewWaypoint() if(closest.size() != 0) { iter = closest.begin(); - std::advance(iter, MakeRandomInt(0, closest.size() - 1)); + std::advance(iter, zone->random.Int(0, closest.size() - 1)); cur_wp = (*iter).index; } @@ -278,7 +278,7 @@ void NPC::CalculateNewWaypoint() } case 2: //random { - cur_wp = MakeRandomInt(0, Waypoints.size() - 1); + cur_wp = zone->random.Int(0, Waypoints.size() - 1); if(cur_wp == old_wp) { if(cur_wp == (Waypoints.size() - 1)) @@ -339,7 +339,7 @@ void NPC::CalculateNewWaypoint() if(closest.size() != 0) { iter = closest.begin(); - std::advance(iter, MakeRandomInt(0, closest.size() - 1)); + std::advance(iter, zone->random.Int(0, closest.size() - 1)); cur_wp = (*iter).index; } break; @@ -412,13 +412,13 @@ void NPC::SetWaypointPause() switch (pausetype) { case 0: //Random Half - AIwalking_timer->Start((cur_wp_pause - MakeRandomInt(0, cur_wp_pause-1)/2)*1000); + AIwalking_timer->Start((cur_wp_pause - zone->random.Int(0, cur_wp_pause-1)/2)*1000); break; case 1: //Full AIwalking_timer->Start(cur_wp_pause*1000); break; case 2: //Random Full - AIwalking_timer->Start(MakeRandomInt(0, cur_wp_pause-1)*1000); + AIwalking_timer->Start(zone->random.Int(0, cur_wp_pause-1)*1000); break; } } diff --git a/zone/zone.cpp b/zone/zone.cpp index 9b42bfb68..257d8e5a7 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1300,13 +1300,13 @@ void Zone::ChangeWeather() return; } - int chance = MakeRandomInt(0, 3); + int chance = zone->random.Int(0, 3); uint8 rainchance = zone->newzone_data.rain_chance[chance]; uint8 rainduration = zone->newzone_data.rain_duration[chance]; uint8 snowchance = zone->newzone_data.snow_chance[chance]; uint8 snowduration = zone->newzone_data.snow_duration[chance]; uint32 weathertimer = 0; - uint16 tmpweather = MakeRandomInt(0, 100); + uint16 tmpweather = zone->random.Int(0, 100); uint8 duration = 0; uint8 tmpOldWeather = zone->zone_weather; bool changed = false; @@ -1315,7 +1315,7 @@ void Zone::ChangeWeather() { if(rainchance > 0 || snowchance > 0) { - uint8 intensity = MakeRandomInt(1, 10); + uint8 intensity = zone->random.Int(1, 10); if((rainchance > snowchance) || (rainchance == snowchance)) { //It's gunna rain! diff --git a/zone/zone.h b/zone/zone.h index 2d74c9f17..40c3a8d11 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -22,6 +22,7 @@ #include "../common/linked_list.h" #include "../common/rulesys.h" #include "../common/types.h" +#include "../common/random.h" #include "qglobals.h" #include "spawn2.h" #include "spawngroup.h" @@ -253,6 +254,9 @@ public: void UpdateHotzone(); std::unordered_map tick_items; + // random object that provides random values for the zone + EQEmu::Random random; + //MODDING HOOKS void mod_init(); void mod_repop(); @@ -310,7 +314,7 @@ private: Timer* Instance_Warning_timer; LinkedList client_auth_list; QGlobalCache *qGlobals; - + Timer hotzone_timer; }; From feac1728dc69bd6ba44eded3e40a46b7b9db5291 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 15:25:37 -0800 Subject: [PATCH 0455/1883] Added two axis aligned bounding box check functions --- zone/position.cpp | 32 ++++++++++++++++++++++++++++++++ zone/position.h | 4 ++++ 2 files changed, 36 insertions(+) diff --git a/zone/position.cpp b/zone/position.cpp index 90b85726d..6f9a31d29 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -95,6 +95,10 @@ const xyz_location xyz_location::operator -(const xyz_location& rhs) const { return xyz_location(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z); } +const xyz_location xyz_location::operator +(const xyz_location& rhs) const { + return xyz_location(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z); +} + void xyz_location::ABS_XYZ(void) { m_X = abs(m_X); m_Y = abs(m_Y); @@ -113,3 +117,31 @@ std::string to_string(const xy_location &position){ return StringFormat("(%.3f, %.3f)", position.m_X,position.m_Y); } +/** +* Determines if 'position' is within (inclusive) the axis aligned +* box (3 dimensional) formed from the points minimum and maximum. +*/ +bool IsWithinAxisAlignedBox(const xyz_location &position, const xyz_location &minimum, const xyz_location &maximum) { + auto actualMinimum = xyz_location(std::min(minimum.m_X, maximum.m_X), std::min(minimum.m_Y, maximum.m_Y),std::min(minimum.m_Z, maximum.m_Z)); + auto actualMaximum = xyz_location(std::max(minimum.m_X, maximum.m_X), std::max(minimum.m_Y, maximum.m_Y),std::max(minimum.m_Z, maximum.m_Z)); + + bool xcheck = position.m_X >= actualMinimum.m_X && position.m_X <= actualMaximum.m_X; + bool ycheck = position.m_Y >= actualMinimum.m_Y && position.m_Y <= actualMaximum.m_Y; + bool zcheck = position.m_Z >= actualMinimum.m_Z && position.m_Z <= actualMaximum.m_Z; + + return xcheck && ycheck && zcheck; +} + +/** +* Determines if 'position' is within (inclusive) the axis aligned +* box (2 dimensional) formed from the points minimum and maximum. +*/ +bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &minimum, const xy_location &maximum) { + auto actualMinimum = xy_location(std::min(minimum.m_X, maximum.m_X), std::min(minimum.m_Y, maximum.m_Y)); + auto actualMaximum = xy_location(std::max(minimum.m_X, maximum.m_X), std::max(minimum.m_Y, maximum.m_Y)); + + bool xcheck = position.m_X >= actualMinimum.m_X && position.m_X <= actualMaximum.m_X; + bool ycheck = position.m_Y >= actualMinimum.m_Y && position.m_Y <= actualMaximum.m_Y; + + return xcheck && ycheck; +} diff --git a/zone/position.h b/zone/position.h index 653cd4ba6..77c09603e 100644 --- a/zone/position.h +++ b/zone/position.h @@ -44,6 +44,7 @@ public: operator xy_location() const; const xyz_location operator -(const xyz_location& rhs) const; + const xyz_location operator +(const xyz_location& rhs) const; void ABS_XYZ(); bool isOrigin() const { return m_X == 0 && m_Y == 0 && m_Z == 0;} @@ -82,4 +83,7 @@ std::string to_string(const xyz_heading &position); std::string to_string(const xyz_location &position); std::string to_string(const xy_location &position); +bool IsWithinAxisAlignedBox(const xyz_location &position, const xyz_location &minimum, const xyz_location &maximum); +bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &minimum, const xy_location &maximum); + #endif From b06647b7638ad51897145e23fab15c6c4a82636d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 15:48:59 -0800 Subject: [PATCH 0456/1883] Zone::GetSpellBlockedMessage convered to use IsWithinAxisAlignedBox --- zone/zone.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index b61cb3968..8ed12673e 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1957,12 +1957,8 @@ const char* Zone::GetSpellBlockedMessage(uint32 spell_id, const xyz_location& lo } case 2: { - if((( location.m_X > (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (location.m_X < (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && - (( location.m_Y > (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (location.m_Y < (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && - (( location.m_Z > (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (location.m_Z < (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) - { + if(!IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference)) return blocked_spells[x].message; - } break; } default: From f5a94ed07b1f2b5f0bb8a7a2a3fa6ea46b67055c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 16:00:48 -0800 Subject: [PATCH 0457/1883] IsSpellBlocked converted to use xyz_location --- zone/bot.cpp | 2 +- zone/spells.cpp | 4 ++-- zone/zone.cpp | 8 ++------ zone/zone.h | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 76363ab7c..8d84899f3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -9128,7 +9128,7 @@ void Bot::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust) { bool Result = false; - if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { + if(zone && !zone->IsSpellBlocked(spell_id, GetPosition())) { mlog(SPELLS__CASTING, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); diff --git a/zone/spells.cpp b/zone/spells.cpp index da6e4f40c..223a584f3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -521,7 +521,7 @@ bool Mob::DoCastingChecks() return false; } - if (zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { + if (zone->IsSpellBlocked(spell_id, GetPosition())) { const char *msg = zone->GetSpellBlockedMessage(spell_id, GetPosition()); if (msg) { Message(13, msg); @@ -1893,7 +1893,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsClient() && !CastToClient()->GetGM()){ - if(zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())){ + if(zone->IsSpellBlocked(spell_id, GetPosition())){ const char *msg = zone->GetSpellBlockedMessage(spell_id, GetPosition()); if(msg){ Message(13, msg); diff --git a/zone/zone.cpp b/zone/zone.cpp index 8ed12673e..292d4fc79 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1869,7 +1869,7 @@ void Zone::ClearBlockedSpells() } } -bool Zone::IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz) +bool Zone::IsSpellBlocked(uint32 spell_id, const xyz_location& location) { if (blocked_spells) { @@ -1919,12 +1919,8 @@ bool Zone::IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz) } case 2: { - if ((( nx >= (blocked_spells[x].m_Location.m_X-blocked_spells[x].m_Difference.m_X)) && (nx <= (blocked_spells[x].m_Location.m_X+blocked_spells[x].m_Difference.m_X))) && - (( ny >= (blocked_spells[x].m_Location.m_Y-blocked_spells[x].m_Difference.m_Y)) && (ny <= (blocked_spells[x].m_Location.m_Y+blocked_spells[x].m_Difference.m_Y))) && - (( nz >= (blocked_spells[x].m_Location.m_Z-blocked_spells[x].m_Difference.m_Z)) && (nz <= (blocked_spells[x].m_Location.m_Z+blocked_spells[x].m_Difference.m_Z)))) - { + if (!IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference)) return true; - } break; } default: diff --git a/zone/zone.h b/zone/zone.h index 48557ccad..e0a89ac50 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -245,7 +245,7 @@ public: void LoadBlockedSpells(uint32 zoneid); void ClearBlockedSpells(); - bool IsSpellBlocked(uint32 spell_id, float nx, float ny, float nz); + bool IsSpellBlocked(uint32 spell_id, const xyz_location& location); const char *GetSpellBlockedMessage(uint32 spell_id, const xyz_location& location); int GetTotalBlockedSpells() { return totalBS; } inline bool HasMap() { return zonemap != nullptr; } From 6f867ebca304d74ce8624c2bc0bc7eb2424ae7f1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 1 Dec 2014 19:50:05 -0500 Subject: [PATCH 0458/1883] Add license info --- common/random.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/common/random.h b/common/random.h index 0e7316007..ef2b3ef73 100644 --- a/common/random.h +++ b/common/random.h @@ -1,3 +1,21 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2014 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 __random_h__ #define __random_h__ @@ -62,6 +80,5 @@ namespace EQEmu { }; } - #endif /* !__random_h__ */ From 24ea7a0d45a85c219a59e5e10ca936c41ea15503 Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 1 Dec 2014 19:54:01 -0600 Subject: [PATCH 0459/1883] Mercenaries now spawn as the same Gender and Size of the Merchant they are purchased from. Mercenaries now spawn with randomized facial features when purchased. Setting a lastname for NPCs will now override any hard coded lastname (such as GM Trainers). --- changelog.txt | 6 + common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../2014_12_01_mercs_table_update.sql | 1 + zone/client_packet.cpp | 2 +- zone/command.cpp | 185 +----- zone/entity.cpp | 10 +- zone/merc.cpp | 237 +++----- zone/merc.h | 4 +- zone/mob.cpp | 555 ++++++++++++------ zone/mob.h | 2 + zone/zonedb.cpp | 83 +-- zone/zonedb.h | 1 + 13 files changed, 549 insertions(+), 540 deletions(-) create mode 100644 utils/sql/git/required/2014_12_01_mercs_table_update.sql diff --git a/changelog.txt b/changelog.txt index e3de59b35..d8ed052ab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/01/2014 == +Trevius: Mercenaries now spawn as the same Gender and Size of the Merchant they are purchased from. +Trevius: Mercenaries now spawn with randomized facial features when purchased. +Trevius: Setting a lastname for NPCs will now override any hard coded lastname (such as GM Trainers). + +Required SQL: utils/sql/git/required/2014_12_01_mercs_table_update.sql == 11/28/2014 == Trevius: Fixed a zone crash related to numhits for spells. diff --git a/common/version.h b/common/version.h index 88131e9be..43b4f8b10 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9058 +#define CURRENT_BINARY_DATABASE_VERSION 9059 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 039b0135a..8291465a4 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -312,6 +312,7 @@ 9056|2014_11_08_RaidMembers.sql|SHOW COLUMNS FROM `raid_members` LIKE 'groupid'|missing|unsigned 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| 9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| +9059|2014_11_30_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_01_mercs_table_update.sql b/utils/sql/git/required/2014_12_01_mercs_table_update.sql new file mode 100644 index 000000000..e5dc895f9 --- /dev/null +++ b/utils/sql/git/required/2014_12_01_mercs_table_update.sql @@ -0,0 +1 @@ +ALTER TABLE `mercs` ADD `MercSize` float( 0 ) NOT NULL DEFAULT '5' AFTER `Gender`; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e2884e738..adb3b4464 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9619,7 +9619,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) TakeMoneyFromPP(cost, true); } - // 0 is approved hire request + // approved hire request SendMercMerchantResponsePacket(0); } else diff --git a/zone/command.cpp b/zone/command.cpp index 453c58ec9..f4c2c8e91 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4985,189 +4985,10 @@ void command_randomfeatures(Client *c, const Seperator *sep) c->Message(0,"Error: This command requires a target"); else { - uint16 Race = target->GetRace(); - if (Race <= 12 || Race == 128 || Race == 130 || Race == 330 || Race == 522) { - - uint8 Gender = target->GetGender(); - uint8 Texture = 0xFF; - uint8 HelmTexture = 0xFF; - uint8 HairColor = 0xFF; - uint8 BeardColor = 0xFF; - uint8 EyeColor1 = 0xFF; - uint8 EyeColor2 = 0xFF; - uint8 HairStyle = 0xFF; - uint8 LuclinFace = 0xFF; - uint8 Beard = 0xFF; - uint32 DrakkinHeritage = 0xFFFFFFFF; - uint32 DrakkinTattoo = 0xFFFFFFFF; - uint32 DrakkinDetails = 0xFFFFFFFF; - - // Set some common feature settings - EyeColor1 = MakeRandomInt(0, 9); - EyeColor2 = MakeRandomInt(0, 9); - LuclinFace = MakeRandomInt(0, 7); - - // Adjust all settings based on the min and max for each feature of each race and gender - switch (Race) - { - case 1: // Human - HairColor = MakeRandomInt(0, 19); - if (Gender == 0) { - BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 2: // Barbarian - HairColor = MakeRandomInt(0, 19); - LuclinFace = MakeRandomInt(0, 87); - if (Gender == 0) { - BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 3: // Erudite - if (Gender == 0) { - BeardColor = MakeRandomInt(0, 19); - Beard = MakeRandomInt(0, 5); - LuclinFace = MakeRandomInt(0, 57); - } - if (Gender == 1) { - LuclinFace = MakeRandomInt(0, 87); - } - break; - case 4: // WoodElf - HairColor = MakeRandomInt(0, 19); - if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 5: // HighElf - HairColor = MakeRandomInt(0, 14); - if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); - BeardColor = HairColor; - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 6: // DarkElf - HairColor = MakeRandomInt(13, 18); - if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); - BeardColor = HairColor; - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 7: // HalfElf - HairColor = MakeRandomInt(0, 19); - if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); - BeardColor = HairColor; - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 8: // Dwarf - HairColor = MakeRandomInt(0, 19); - BeardColor = HairColor; - if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - LuclinFace = MakeRandomInt(0, 17); - } - break; - case 9: // Troll - EyeColor1 = MakeRandomInt(0, 10); - EyeColor2 = MakeRandomInt(0, 10); - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); - } - break; - case 10: // Ogre - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); - } - break; - case 11: // Halfling - HairColor = MakeRandomInt(0, 19); - if (Gender == 0) { - BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 12: // Gnome - HairColor = MakeRandomInt(0, 24); - if (Gender == 0) { - BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); - } - if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - } - break; - case 128: // Iksar - case 130: // VahShir - break; - case 330: // Froglok - LuclinFace = MakeRandomInt(0, 9); - case 522: // Drakkin - HairColor = MakeRandomInt(0, 3); - BeardColor = HairColor; - EyeColor1 = MakeRandomInt(0, 11); - EyeColor2 = MakeRandomInt(0, 11); - LuclinFace = MakeRandomInt(0, 6); - DrakkinHeritage = MakeRandomInt(0, 6); - DrakkinTattoo = MakeRandomInt(0, 7); - DrakkinDetails = MakeRandomInt(0, 7); - if (Gender == 0) { - Beard = MakeRandomInt(0, 12); - HairStyle = MakeRandomInt(0, 8); - } - if (Gender == 1) { - Beard = MakeRandomInt(0, 3); - HairStyle = MakeRandomInt(0, 7); - } - break; - default: - break; - } - - target->SendIllusionPacket(Race, Gender, Texture, HelmTexture, HairColor, BeardColor, - EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF, - DrakkinHeritage, DrakkinTattoo, DrakkinDetails); - - c->Message(0,"NPC Features Randomized"); - } + if (target->RandomizeFeatures()) + c->Message(0,"Features Randomized"); else - c->Message(0,"This command requires a Playable Race as the Target"); + c->Message(0,"This command requires a Playable Race as the target"); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index cae20c3ce..f0e077e78 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -658,10 +658,12 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue) void EntityList::AddMerc(Merc *merc, bool SendSpawnPacket, bool dontqueue) { - if (merc) { + if (merc) + { merc->SetID(GetFreeID()); - if (SendSpawnPacket) { + if (SendSpawnPacket) + { if (dontqueue) { // Send immediately EQApplicationPacket *outapp = new EQApplicationPacket(); @@ -673,12 +675,10 @@ void EntityList::AddMerc(Merc *merc, bool SendSpawnPacket, bool dontqueue) // Queue the packet NewSpawn_Struct *ns = new NewSpawn_Struct; memset(ns, 0, sizeof(NewSpawn_Struct)); - merc->FillSpawnStruct(ns, merc); + merc->FillSpawnStruct(ns, 0); AddToSpawnQueue(merc->GetID(), &ns); safe_delete(ns); } - - //parse->EventMERC(EVENT_SPAWN, merc, nullptr, "", 0); } merc_list.insert(std::pair(merc->GetID(), merc)); diff --git a/zone/merc.cpp b/zone/merc.cpp index b2793db73..5593c3e50 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -62,7 +62,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) skills[r] = database.GetSkillCap(GetClass(),(SkillUseTypes)r,GetLevel()); } - GetMercSize(); + size = d->size; CalcBonuses(); SetHP(GetMaxHP()); @@ -112,131 +112,66 @@ void Merc::CalcBonuses() rooted = FindType(SE_Root); } -void Merc::GetMercSize() { +float Merc::GetDefaultSize() { float MercSize = GetSize(); - switch(this->GetRace()) { - case 1: // Humans have no race bonus - break; - case 2: // Barbarian - MercSize = 7.0; - break; - case 3: // Erudite - break; - case 4: // Wood Elf - MercSize = 5.0; - break; - case 5: // High Elf - break; - case 6: // Dark Elf - MercSize = 5.0; - break; - case 7: // Half Elf - MercSize = 5.5; - break; - case 8: // Dwarf - MercSize = 4.0; - break; - case 9: // Troll - MercSize = 8.0; - break; - case 10: // Ogre - MercSize = 9.0; - break; - case 11: // Halfling - MercSize = 3.5; - break; - case 12: // Gnome - MercSize = 3.0; - break; - case 128: // Iksar - break; - case 130: // Vah Shir - MercSize = 7.0; - break; - case 330: // Froglok - MercSize = 5.0; - break; - case 522: // Drakkin - MercSize = 5.0; - break; + switch(this->GetRace()) + { + case 1: // Humans + MercSize = 6.0; + break; + case 2: // Barbarian + MercSize = 7.0; + break; + case 3: // Erudite + MercSize = 6.0; + break; + case 4: // Wood Elf + MercSize = 5.0; + break; + case 5: // High Elf + MercSize = 6.0; + break; + case 6: // Dark Elf + MercSize = 5.0; + break; + case 7: // Half Elf + MercSize = 5.5; + break; + case 8: // Dwarf + MercSize = 4.0; + break; + case 9: // Troll + MercSize = 8.0; + break; + case 10: // Ogre + MercSize = 9.0; + break; + case 11: // Halfling + MercSize = 3.5; + break; + case 12: // Gnome + MercSize = 3.0; + break; + case 128: // Iksar + MercSize = 6.0; + break; + case 130: // Vah Shir + MercSize = 7.0; + break; + case 330: // Froglok + MercSize = 5.0; + break; + case 522: // Drakkin + MercSize = 5.0; + break; + default: + MercSize = 6.0; + break; } - this->size = MercSize; -} - -void Merc::GenerateAppearance() { - // Randomize facial appearance - int iFace = 0; - if(this->GetRace() == 2) { // Barbarian w/Tatoo - iFace = MakeRandomInt(0, 79); - } - else { - iFace = MakeRandomInt(0, 7); - } - - int iHair = 0; - int iBeard = 0; - int iBeardColor = 1; - if(this->GetRace() == 522) { - iHair = MakeRandomInt(0, 8); - iBeard = MakeRandomInt(0, 11); - iBeardColor = MakeRandomInt(0, 3); - } - else if(this->GetGender()) { - iHair = MakeRandomInt(0, 2); - if(this->GetRace() == 8) { // Dwarven Females can have a beard - if(MakeRandomInt(1, 100) < 50) { - iFace += 10; - } - } - } - else { - iHair = MakeRandomInt(0, 3); - iBeard = MakeRandomInt(0, 5); - iBeardColor = MakeRandomInt(0, 19); - } - - int iHairColor = 0; - if(this->GetRace() == 522) { - iHairColor = MakeRandomInt(0, 3); - } - else { - iHairColor = MakeRandomInt(0, 19); - } - - uint8 iEyeColor1 = (uint8)MakeRandomInt(0, 9); - uint8 iEyeColor2 = 0; - if(this->GetRace() == 522) { - iEyeColor1 = iEyeColor2 = (uint8)MakeRandomInt(0, 11); - } - else if(MakeRandomInt(1, 100) > 96) { - iEyeColor2 = MakeRandomInt(0, 9); - } - else { - iEyeColor2 = iEyeColor1; - } - - int iHeritage = 0; - int iTattoo = 0; - int iDetails = 0; - if(this->GetRace() == 522) { - iHeritage = MakeRandomInt(0, 6); - iTattoo = MakeRandomInt(0, 7); - iDetails = MakeRandomInt(0, 7); - } - - this->luclinface = iFace; - this->hairstyle = iHair; - this->beard = iBeard; - this->beardcolor = iBeardColor; - this->haircolor = iHairColor; - this->eyecolor1 = iEyeColor1; - this->eyecolor2 = iEyeColor2; - this->drakkin_heritage = iHeritage; - this->drakkin_tattoo = iTattoo; - this->drakkin_details = iDetails; + return MercSize; } int Merc::CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat) @@ -1258,7 +1193,6 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.guildrank = 0; ns->spawn.showhelm = 1; ns->spawn.flymode = 0; - ns->spawn.size = 0; ns->spawn.NPC = 1; // 0=player,1=npc,2=pc corpse,3=npc corpse ns->spawn.IsMercenary = 1; @@ -4940,22 +4874,37 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, } snprintf(npc_type->name, 64, "%s", c->GetMercInfo().merc_name); } - uint8 gender = 0; - if(merchant_id > 0) { + + npc_type->race = merc_template->RaceID; + + // Use the Gender and Size of the Merchant if possible + uint8 tmpgender = 0; + float tmpsize = 6.0f; + if(merchant_id > 0) + { NPC* tar = entity_list.GetNPCByID(merchant_id); - if(tar) { - gender = Mob::GetDefaultGender(npc_type->race, tar->GetGender()); + if(tar) + { + tmpgender = tar->GetGender(); + tmpsize = tar->GetSize(); } + else + { + tmpgender = Mob::GetDefaultGender(npc_type->race, c->GetMercInfo().Gender); + } + } - else { - gender = c->GetMercInfo().Gender; + else + { + tmpgender = c->GetMercInfo().Gender; + tmpsize = c->GetMercInfo().MercSize; } - sprintf(npc_type->lastname, "%s's %s", c->GetName(), "Mercenary"); - npc_type->gender = gender; + sprintf(npc_type->lastname, "%s's Mercenary", c->GetName()); + npc_type->gender = tmpgender; + npc_type->size = tmpsize; npc_type->loottable_id = 0; // Loottable has to be 0, otherwise we'll be leavin' some corpses! npc_type->npc_id = 0; //NPC ID has to be 0, otherwise db gets all confuzzled. - npc_type->race = merc_template->RaceID; npc_type->class_ = merc_template->ClassID; npc_type->maxlevel = 0; //We should hard-set this to override scalerate's functionality in the NPC class when it is constructed. @@ -4975,6 +4924,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, snprintf(merc->name, 64, "%s", c->GetMercInfo().merc_name); merc->SetSuspended(c->GetMercInfo().IsSuspended); merc->gender = c->GetMercInfo().Gender; + merc->size = c->GetMercInfo().MercSize; merc->SetHP(c->GetMercInfo().hp <= 0 ? merc->GetMaxHP() : c->GetMercInfo().hp); merc->SetMana(c->GetMercInfo().hp <= 0 ? merc->GetMaxMana() : c->GetMercInfo().mana); merc->SetEndurance(c->GetMercInfo().endurance); @@ -4989,6 +4939,11 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, merc->drakkin_tattoo = c->GetMercInfo().drakkinTattoo; merc->drakkin_details = c->GetMercInfo().drakkinDetails; } + else + { + // Give Random Features to newly hired Mercs + merc->RandomizeFeatures(false, true); + } if(merc->GetMercID()) { database.LoadMercBuffs(merc); @@ -5008,7 +4963,8 @@ void Merc::UpdateMercInfo(Client *c) { snprintf(c->GetMercInfo().merc_name, 64, "%s", name); c->GetMercInfo().mercid = GetMercID(); c->GetMercInfo().IsSuspended = IsSuspended(); - c->GetMercInfo().Gender = gender; + c->GetMercInfo().Gender = GetGender(); + c->GetMercInfo().MercSize = GetSize(); c->GetMercInfo().hp = GetHP(); c->GetMercInfo().mana = GetMana(); c->GetMercInfo().endurance = GetEndurance(); @@ -5558,6 +5514,11 @@ void Client::SpawnMercOnZone() { Message(7, "Mercenary Debug: SpawnMercOnZone Suspended Merc."); } } + else + { + // No Merc Hired + SendClearMercInfo(); + } } void Client::SendMercTimer(Merc* merc) { @@ -5604,10 +5565,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) { SetMerc(merc); merc->Unsuspend(setMaxStats); merc->SetStance(GetMercInfo().Stance); - GetMercInfo().SuspendedTime = 0; - //SendMercTimer(merc); - if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SpawnMerc Success."); @@ -5666,7 +5624,6 @@ bool Client::MercOnlyOrNoGroup() { bool Merc::Unsuspend(bool setMaxStats) { Client* mercOwner = nullptr; - bool loaded = false; if(GetMercOwner()) { mercOwner = GetMercOwner(); @@ -5694,12 +5651,8 @@ bool Merc::Unsuspend(bool setMaxStats) { if(!mercOwner->GetPTimers().Expired(&database, pTimerMercSuspend, false)) mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend); - MercJoinClientGroup(); - - if(loaded) + if (MercJoinClientGroup()) { - LoadMercSpells(); - if(setMaxStats) { SetHP(GetMaxHP()); @@ -6073,7 +6026,7 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().IsSuspended = newmerc->IsSuspended(); GetMercInfo().SuspendedTime = 0; GetMercInfo().Gender = newmerc->GetGender(); - //GetMercInfo().State = newmerc->GetStance(); + GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL; snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName()); if (MERC_DEBUG > 0) Message(7, "Mercenary Debug: SetMerc New Merc."); diff --git a/zone/merc.h b/zone/merc.h index eca59ba24..fdcdbec49 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -332,9 +332,7 @@ private: int GroupLeadershipAAHealthRegeneration(); int GroupLeadershipAAOffenseEnhancement(); - void GetMercSize(); - void GenerateAppearance(); - + float GetDefaultSize(); bool LoadMercSpells(); bool CheckStance(int16 stance); diff --git a/zone/mob.cpp b/zone/mob.cpp index e56f3839c..830217ef4 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -739,7 +739,8 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, Mob* ForWho) { NewSpawn_Struct* ns = (NewSpawn_Struct*)app->pBuffer; FillSpawnStruct(ns, ForWho); - if(strlen(ns->spawn.lastName) == 0) { + if(strlen(ns->spawn.lastName) == 0) + { switch(ns->spawn.class_) { case TRIBUTE_MASTER: @@ -817,70 +818,78 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns) { // Custom packet data NewSpawn_Struct* ns2 = (NewSpawn_Struct*)app->pBuffer; strcpy(ns2->spawn.name, ns->spawn.name); - switch(ns->spawn.class_) - { - case TRIBUTE_MASTER: - strcpy(ns2->spawn.lastName, "Tribute Master"); - break; - case ADVENTURERECRUITER: - strcpy(ns2->spawn.lastName, "Adventure Recruiter"); - break; - case BANKER: - strcpy(ns2->spawn.lastName, "Banker"); - break; - case ADVENTUREMERCHANT: - strcpy(ns->spawn.lastName,"Adventure Merchant"); - break; - case WARRIORGM: - strcpy(ns2->spawn.lastName, "GM Warrior"); - break; - case PALADINGM: - strcpy(ns2->spawn.lastName, "GM Paladin"); - break; - case RANGERGM: - strcpy(ns2->spawn.lastName, "GM Ranger"); - break; - case SHADOWKNIGHTGM: - strcpy(ns2->spawn.lastName, "GM Shadowknight"); - break; - case DRUIDGM: - strcpy(ns2->spawn.lastName, "GM Druid"); - break; - case BARDGM: - strcpy(ns2->spawn.lastName, "GM Bard"); - break; - case ROGUEGM: - strcpy(ns2->spawn.lastName, "GM Rogue"); - break; - case SHAMANGM: - strcpy(ns2->spawn.lastName, "GM Shaman"); - break; - case NECROMANCERGM: - strcpy(ns2->spawn.lastName, "GM Necromancer"); - break; - case WIZARDGM: - strcpy(ns2->spawn.lastName, "GM Wizard"); - break; - case MAGICIANGM: - strcpy(ns2->spawn.lastName, "GM Magician"); - break; - case ENCHANTERGM: - strcpy(ns2->spawn.lastName, "GM Enchanter"); - break; - case BEASTLORDGM: - strcpy(ns2->spawn.lastName, "GM Beastlord"); - break; - case BERSERKERGM: - strcpy(ns2->spawn.lastName, "GM Berserker"); - break; - case MERCERNARY_MASTER: - strcpy(ns->spawn.lastName, "Mercenary Recruiter"); - break; - default: - strcpy(ns2->spawn.lastName, ns->spawn.lastName); - break; - } + // Set default Last Names for certain Classes if not defined + if (strlen(ns->spawn.lastName) == 0) + { + switch (ns->spawn.class_) + { + case TRIBUTE_MASTER: + strcpy(ns2->spawn.lastName, "Tribute Master"); + break; + case ADVENTURERECRUITER: + strcpy(ns2->spawn.lastName, "Adventure Recruiter"); + break; + case BANKER: + strcpy(ns2->spawn.lastName, "Banker"); + break; + case ADVENTUREMERCHANT: + strcpy(ns2->spawn.lastName, "Adventure Merchant"); + break; + case WARRIORGM: + strcpy(ns2->spawn.lastName, "GM Warrior"); + break; + case PALADINGM: + strcpy(ns2->spawn.lastName, "GM Paladin"); + break; + case RANGERGM: + strcpy(ns2->spawn.lastName, "GM Ranger"); + break; + case SHADOWKNIGHTGM: + strcpy(ns2->spawn.lastName, "GM Shadowknight"); + break; + case DRUIDGM: + strcpy(ns2->spawn.lastName, "GM Druid"); + break; + case BARDGM: + strcpy(ns2->spawn.lastName, "GM Bard"); + break; + case ROGUEGM: + strcpy(ns2->spawn.lastName, "GM Rogue"); + break; + case SHAMANGM: + strcpy(ns2->spawn.lastName, "GM Shaman"); + break; + case NECROMANCERGM: + strcpy(ns2->spawn.lastName, "GM Necromancer"); + break; + case WIZARDGM: + strcpy(ns2->spawn.lastName, "GM Wizard"); + break; + case MAGICIANGM: + strcpy(ns2->spawn.lastName, "GM Magician"); + break; + case ENCHANTERGM: + strcpy(ns2->spawn.lastName, "GM Enchanter"); + break; + case BEASTLORDGM: + strcpy(ns2->spawn.lastName, "GM Beastlord"); + break; + case BERSERKERGM: + strcpy(ns2->spawn.lastName, "GM Berserker"); + break; + case MERCERNARY_MASTER: + strcpy(ns2->spawn.lastName, "Mercenary liaison"); + break; + default: + strcpy(ns2->spawn.lastName, ns->spawn.lastName); + break; + } + } + else + { + strcpy(ns2->spawn.lastName, ns->spawn.lastName); + } memset(&app->pBuffer[sizeof(Spawn_Struct)-7], 0xFF, 7); } @@ -941,7 +950,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) } ns->spawn.guildrank = 0xFF; - ns->spawn.size = size; + ns->spawn.size = size; ns->spawn.bodytype = bodytype; // The 'flymode' settings have the following effect: // 0 - Mobs in water sink like a stone to the bottom @@ -1387,147 +1396,150 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, uint16 BaseRace = GetBaseRace(); - if (in_race == 0) { - this->race = BaseRace; + if (in_race == 0) + { + race = BaseRace; if (in_gender == 0xFF) - this->gender = GetBaseGender(); - else - this->gender = in_gender; - } - else { - this->race = in_race; - if (in_gender == 0xFF) { - uint8 tmp = Mob::GetDefaultGender(this->race, gender); - if (tmp == 2) - gender = 2; - else if (gender == 2 && GetBaseGender() == 2) - gender = tmp; - else if (gender == 2) - gender = GetBaseGender(); - } + gender = GetBaseGender(); else gender = in_gender; } - if (in_texture == 0xFF) { - if (in_race <= 12 || in_race == 128 || in_race == 130 || in_race == 330 || in_race == 522) - this->texture = 0xFF; - else - this->texture = GetTexture(); - } else - this->texture = in_texture; + { + race = in_race; + if (in_gender == 0xFF) + gender = GetDefaultGender(race, gender); + else + gender = in_gender; + } - if (in_helmtexture == 0xFF) { - if (in_race <= 12 || in_race == 128 || in_race == 130 || in_race == 330 || in_race == 522) - this->helmtexture = 0xFF; - else if (in_texture != 0xFF) - this->helmtexture = in_texture; + if (in_texture == 0xFF) + { + if (IsPlayerRace(in_race)) + texture = 0xFF; else - this->helmtexture = GetHelmTexture(); + texture = GetTexture(); } else - this->helmtexture = in_helmtexture; + { + texture = in_texture; + } + + if (in_helmtexture == 0xFF) + { + if (IsPlayerRace(in_race)) + helmtexture = 0xFF; + else if (in_texture != 0xFF) + helmtexture = in_texture; + else + helmtexture = GetHelmTexture(); + } + else + { + helmtexture = in_helmtexture; + } if (in_haircolor == 0xFF) - this->haircolor = GetHairColor(); + haircolor = GetHairColor(); else - this->haircolor = in_haircolor; + haircolor = in_haircolor; if (in_beardcolor == 0xFF) - this->beardcolor = GetBeardColor(); + beardcolor = GetBeardColor(); else - this->beardcolor = in_beardcolor; + beardcolor = in_beardcolor; if (in_eyecolor1 == 0xFF) - this->eyecolor1 = GetEyeColor1(); + eyecolor1 = GetEyeColor1(); else - this->eyecolor1 = in_eyecolor1; + eyecolor1 = in_eyecolor1; if (in_eyecolor2 == 0xFF) - this->eyecolor2 = GetEyeColor2(); + eyecolor2 = GetEyeColor2(); else - this->eyecolor2 = in_eyecolor2; + eyecolor2 = in_eyecolor2; if (in_hairstyle == 0xFF) - this->hairstyle = GetHairStyle(); + hairstyle = GetHairStyle(); else - this->hairstyle = in_hairstyle; + hairstyle = in_hairstyle; if (in_luclinface == 0xFF) - this->luclinface = GetLuclinFace(); + luclinface = GetLuclinFace(); else - this->luclinface = in_luclinface; + luclinface = in_luclinface; if (in_beard == 0xFF) - this->beard = GetBeard(); + beard = GetBeard(); else - this->beard = in_beard; + beard = in_beard; - this->aa_title = 0xFF; + aa_title = in_aa_title; if (in_drakkin_heritage == 0xFFFFFFFF) - this->drakkin_heritage = GetDrakkinHeritage(); + drakkin_heritage = GetDrakkinHeritage(); else - this->drakkin_heritage = in_drakkin_heritage; + drakkin_heritage = in_drakkin_heritage; if (in_drakkin_tattoo == 0xFFFFFFFF) - this->drakkin_tattoo = GetDrakkinTattoo(); + drakkin_tattoo = GetDrakkinTattoo(); else - this->drakkin_tattoo = in_drakkin_tattoo; + drakkin_tattoo = in_drakkin_tattoo; if (in_drakkin_details == 0xFFFFFFFF) - this->drakkin_details = GetDrakkinDetails(); + drakkin_details = GetDrakkinDetails(); else - this->drakkin_details = in_drakkin_details; + drakkin_details = in_drakkin_details; if (in_size <= 0.0f) - this->size = GetSize(); + size = GetSize(); else - this->size = in_size; + size = in_size; - // Forces the feature information to be pulled from the Player Profile - if (this->IsClient() && in_race == 0) { - this->race = CastToClient()->GetBaseRace(); - this->gender = CastToClient()->GetBaseGender(); - this->texture = 0xFF; - this->helmtexture = 0xFF; - this->haircolor = CastToClient()->GetBaseHairColor(); - this->beardcolor = CastToClient()->GetBaseBeardColor(); - this->eyecolor1 = CastToClient()->GetBaseEyeColor(); - this->eyecolor2 = CastToClient()->GetBaseEyeColor(); - this->hairstyle = CastToClient()->GetBaseHairStyle(); - this->luclinface = CastToClient()->GetBaseFace(); - this->beard = CastToClient()->GetBaseBeard(); - this->aa_title = 0xFF; - this->drakkin_heritage = CastToClient()->GetBaseHeritage(); - this->drakkin_tattoo = CastToClient()->GetBaseTattoo(); - this->drakkin_details = CastToClient()->GetBaseDetails(); + // Reset features to Base from the Player Profile + if (IsClient() && in_race == 0) + { + race = CastToClient()->GetBaseRace(); + gender = CastToClient()->GetBaseGender(); + texture = 0xFF; + helmtexture = 0xFF; + haircolor = CastToClient()->GetBaseHairColor(); + beardcolor = CastToClient()->GetBaseBeardColor(); + eyecolor1 = CastToClient()->GetBaseEyeColor(); + eyecolor2 = CastToClient()->GetBaseEyeColor(); + hairstyle = CastToClient()->GetBaseHairStyle(); + luclinface = CastToClient()->GetBaseFace(); + beard = CastToClient()->GetBaseBeard(); + aa_title = 0xFF; + drakkin_heritage = CastToClient()->GetBaseHeritage(); + drakkin_tattoo = CastToClient()->GetBaseTattoo(); + drakkin_details = CastToClient()->GetBaseDetails(); switch(race){ case OGRE: - this->size = 9; + size = 9; break; case TROLL: - this->size = 8; + size = 8; break; case VAHSHIR: case BARBARIAN: - this->size = 7; + size = 7; break; case HALF_ELF: case WOOD_ELF: case DARK_ELF: case FROGLOK: - this->size = 5; + size = 5; break; case DWARF: - this->size = 4; + size = 4; break; case HALFLING: case GNOME: - this->size = 3; + size = 3; break; default: - this->size = 6; + size = 6; break; } } @@ -1535,39 +1547,250 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, EQApplicationPacket* outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct)); memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); Illusion_Struct* is = (Illusion_Struct*) outapp->pBuffer; - is->spawnid = this->GetID(); + is->spawnid = GetID(); strcpy(is->charname, GetCleanName()); - is->race = this->race; - is->gender = this->gender; - is->texture = this->texture; - is->helmtexture = this->helmtexture; - is->haircolor = this->haircolor; - is->beardcolor = this->beardcolor; - is->beard = this->beard; - is->eyecolor1 = this->eyecolor1; - is->eyecolor2 = this->eyecolor2; - is->hairstyle = this->hairstyle; - is->face = this->luclinface; - //is->aa_title = this->aa_title; - is->drakkin_heritage = this->drakkin_heritage; - is->drakkin_tattoo = this->drakkin_tattoo; - is->drakkin_details = this->drakkin_details; - is->size = this->size; + is->race = race; + is->gender = gender; + is->texture = texture; + is->helmtexture = helmtexture; + is->haircolor = haircolor; + is->beardcolor = beardcolor; + is->beard = beard; + is->eyecolor1 = eyecolor1; + is->eyecolor2 = eyecolor2; + is->hairstyle = hairstyle; + is->face = luclinface; + is->drakkin_heritage = drakkin_heritage; + is->drakkin_tattoo = drakkin_tattoo; + is->drakkin_details = drakkin_details; + is->size = size; entity_list.QueueClients(this, outapp); safe_delete(outapp); mlog(CLIENT__SPELLS, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", - this->race, this->gender, this->texture, this->helmtexture, this->haircolor, this->beardcolor, this->eyecolor1, this->eyecolor2, this->hairstyle, this->luclinface, this->drakkin_heritage, this->drakkin_tattoo, this->drakkin_details, this->size); + race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } +bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables) +{ + if (IsPlayerRace(GetRace())) + { + uint8 Gender = GetGender(); + uint8 Texture = 0xFF; + uint8 HelmTexture = 0xFF; + uint8 HairColor = 0xFF; + uint8 BeardColor = 0xFF; + uint8 EyeColor1 = 0xFF; + uint8 EyeColor2 = 0xFF; + uint8 HairStyle = 0xFF; + uint8 LuclinFace = 0xFF; + uint8 Beard = 0xFF; + uint32 DrakkinHeritage = 0xFFFFFFFF; + uint32 DrakkinTattoo = 0xFFFFFFFF; + uint32 DrakkinDetails = 0xFFFFFFFF; + + // Set some common feature settings + EyeColor1 = MakeRandomInt(0, 9); + EyeColor2 = MakeRandomInt(0, 9); + LuclinFace = MakeRandomInt(0, 7); + + // Adjust all settings based on the min and max for each feature of each race and gender + switch (GetRace()) + { + case 1: // Human + HairColor = MakeRandomInt(0, 19); + if (Gender == 0) { + BeardColor = HairColor; + HairStyle = MakeRandomInt(0, 3); + Beard = MakeRandomInt(0, 5); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 2: // Barbarian + HairColor = MakeRandomInt(0, 19); + LuclinFace = MakeRandomInt(0, 87); + if (Gender == 0) { + BeardColor = HairColor; + HairStyle = MakeRandomInt(0, 3); + Beard = MakeRandomInt(0, 5); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 3: // Erudite + if (Gender == 0) { + BeardColor = MakeRandomInt(0, 19); + Beard = MakeRandomInt(0, 5); + LuclinFace = MakeRandomInt(0, 57); + } + if (Gender == 1) { + LuclinFace = MakeRandomInt(0, 87); + } + break; + case 4: // WoodElf + HairColor = MakeRandomInt(0, 19); + if (Gender == 0) { + HairStyle = MakeRandomInt(0, 3); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 5: // HighElf + HairColor = MakeRandomInt(0, 14); + if (Gender == 0) { + HairStyle = MakeRandomInt(0, 3); + LuclinFace = MakeRandomInt(0, 37); + BeardColor = HairColor; + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 6: // DarkElf + HairColor = MakeRandomInt(13, 18); + if (Gender == 0) { + HairStyle = MakeRandomInt(0, 3); + LuclinFace = MakeRandomInt(0, 37); + BeardColor = HairColor; + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 7: // HalfElf + HairColor = MakeRandomInt(0, 19); + if (Gender == 0) { + HairStyle = MakeRandomInt(0, 3); + LuclinFace = MakeRandomInt(0, 37); + BeardColor = HairColor; + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 8: // Dwarf + HairColor = MakeRandomInt(0, 19); + BeardColor = HairColor; + if (Gender == 0) { + HairStyle = MakeRandomInt(0, 3); + Beard = MakeRandomInt(0, 5); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + LuclinFace = MakeRandomInt(0, 17); + } + break; + case 9: // Troll + EyeColor1 = MakeRandomInt(0, 10); + EyeColor2 = MakeRandomInt(0, 10); + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 3); + HairColor = MakeRandomInt(0, 23); + } + break; + case 10: // Ogre + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 3); + HairColor = MakeRandomInt(0, 23); + } + break; + case 11: // Halfling + HairColor = MakeRandomInt(0, 19); + if (Gender == 0) { + BeardColor = HairColor; + HairStyle = MakeRandomInt(0, 3); + Beard = MakeRandomInt(0, 5); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 12: // Gnome + HairColor = MakeRandomInt(0, 24); + if (Gender == 0) { + BeardColor = HairColor; + HairStyle = MakeRandomInt(0, 3); + Beard = MakeRandomInt(0, 5); + } + if (Gender == 1) { + HairStyle = MakeRandomInt(0, 2); + } + break; + case 128: // Iksar + case 130: // VahShir + break; + case 330: // Froglok + LuclinFace = MakeRandomInt(0, 9); + case 522: // Drakkin + HairColor = MakeRandomInt(0, 3); + BeardColor = HairColor; + EyeColor1 = MakeRandomInt(0, 11); + EyeColor2 = MakeRandomInt(0, 11); + LuclinFace = MakeRandomInt(0, 6); + DrakkinHeritage = MakeRandomInt(0, 6); + DrakkinTattoo = MakeRandomInt(0, 7); + DrakkinDetails = MakeRandomInt(0, 7); + if (Gender == 0) { + Beard = MakeRandomInt(0, 12); + HairStyle = MakeRandomInt(0, 8); + } + if (Gender == 1) { + Beard = MakeRandomInt(0, 3); + HairStyle = MakeRandomInt(0, 7); + } + break; + default: + break; + } + + if (set_variables) + { + haircolor = HairColor; + beardcolor = BeardColor; + eyecolor1 = EyeColor1; + eyecolor2 = EyeColor2; + hairstyle = HairStyle; + luclinface = LuclinFace; + beard = Beard; + drakkin_heritage = DrakkinHeritage; + drakkin_tattoo = DrakkinTattoo; + drakkin_details = DrakkinDetails; + } + + if (send_illusion) + { + SendIllusionPacket(GetRace(), Gender, Texture, HelmTexture, HairColor, BeardColor, + EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF, DrakkinHeritage, + DrakkinTattoo, DrakkinDetails); + } + + return true; + } + return false; +} + + +bool Mob::IsPlayerRace(uint16 in_race) { + + if ((in_race >= HUMAN && in_race <= GNOME) || in_race == IKSAR || in_race == VAHSHIR || in_race == FROGLOK || in_race == DRAKKIN) + { + return true; + } + + return false; +} + + uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) { //std::cout << "Gender in: " << (int)in_gender << std::endl; // undefined cout [CODEBUG] - if ((in_race > 0 && in_race <= GNOME ) - || in_race == IKSAR || in_race == VAHSHIR || in_race == FROGLOK || in_race == DRAKKIN - || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118) { + if (Mob::IsPlayerRace(in_race) || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118) { if (in_gender >= 2) { - // Female default for PC Races - return 1; + // Male default for PC Races + return 0; } else return in_gender; diff --git a/zone/mob.h b/zone/mob.h index 0e04c43b1..18f61281f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -497,6 +497,7 @@ public: //Util static uint32 RandomTimer(int min, int max); static uint8 GetDefaultGender(uint16 in_race, uint8 in_gender = 0xFF); + static bool IsPlayerRace(uint16 in_race); uint16 GetSkillByItemType(int ItemType); uint8 GetItemTypeBySkill(SkillUseTypes skill); virtual void MakePet(uint16 spell_id, const char* pettype, const char *petname = nullptr); @@ -577,6 +578,7 @@ public: uint8 in_hairstyle = 0xFF, uint8 in_luclinface = 0xFF, uint8 in_beard = 0xFF, uint8 in_aa_title = 0xFF, uint32 in_drakkin_heritage = 0xFFFFFFFF, uint32 in_drakkin_tattoo = 0xFFFFFFFF, uint32 in_drakkin_details = 0xFFFFFFFF, float in_size = -1.0f); + bool RandomizeFeatures(bool send_illusion = true, bool set_variables = true); virtual void Stun(int duration); virtual void UnStun(); inline void Silence(bool newval) { silenced = newval; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 1f520ed88..17b5ff508 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2100,7 +2100,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client bool ZoneDatabase::LoadMercInfo(Client *client) { std::string query = StringFormat("SELECT MercID, Slot, Name, TemplateID, SuspendedTime, " - "IsSuspended, TimerRemaining, Gender, StanceID, HP, Mana, " + "IsSuspended, TimerRemaining, Gender, MercSize, StanceID, HP, Mana, " "Endurance, Face, LuclinHairStyle, LuclinHairColor, " "LuclinEyeColor, LuclinEyeColor2, LuclinBeardColor, LuclinBeard, " "DrakkinHeritage, DrakkinTattoo, DrakkinDetails " @@ -2126,21 +2126,22 @@ bool ZoneDatabase::LoadMercInfo(Client *client) { client->GetMercInfo(slot).IsSuspended = atoi(row[5]) == 1 ? true : false; client->GetMercInfo(slot).MercTimerRemaining = atoi(row[6]); client->GetMercInfo(slot).Gender = atoi(row[7]); + client->GetMercInfo(slot).MercSize = atof(row[8]); client->GetMercInfo(slot).State = 5; - client->GetMercInfo(slot).Stance = atoi(row[8]); - client->GetMercInfo(slot).hp = atoi(row[9]); - client->GetMercInfo(slot).mana = atoi(row[10]); - client->GetMercInfo(slot).endurance = atoi(row[11]); - client->GetMercInfo(slot).face = atoi(row[12]); - client->GetMercInfo(slot).luclinHairStyle = atoi(row[13]); - client->GetMercInfo(slot).luclinHairColor = atoi(row[14]); - client->GetMercInfo(slot).luclinEyeColor = atoi(row[15]); - client->GetMercInfo(slot).luclinEyeColor2 = atoi(row[16]); - client->GetMercInfo(slot).luclinBeardColor = atoi(row[17]); - client->GetMercInfo(slot).luclinBeard = atoi(row[18]); - client->GetMercInfo(slot).drakkinHeritage = atoi(row[19]); - client->GetMercInfo(slot).drakkinTattoo = atoi(row[20]); - client->GetMercInfo(slot).drakkinDetails = atoi(row[21]); + client->GetMercInfo(slot).Stance = atoi(row[9]); + client->GetMercInfo(slot).hp = atoi(row[10]); + client->GetMercInfo(slot).mana = atoi(row[11]); + client->GetMercInfo(slot).endurance = atoi(row[12]); + client->GetMercInfo(slot).face = atoi(row[13]); + client->GetMercInfo(slot).luclinHairStyle = atoi(row[14]); + client->GetMercInfo(slot).luclinHairColor = atoi(row[15]); + client->GetMercInfo(slot).luclinEyeColor = atoi(row[16]); + client->GetMercInfo(slot).luclinEyeColor2 = atoi(row[17]); + client->GetMercInfo(slot).luclinBeardColor = atoi(row[18]); + client->GetMercInfo(slot).luclinBeard = atoi(row[19]); + client->GetMercInfo(slot).drakkinHeritage = atoi(row[20]); + client->GetMercInfo(slot).drakkinTattoo = atoi(row[21]); + client->GetMercInfo(slot).drakkinDetails = atoi(row[22]); } return true; @@ -2154,7 +2155,7 @@ bool ZoneDatabase::LoadCurrentMerc(Client *client) { return false; std::string query = StringFormat("SELECT MercID, Name, TemplateID, SuspendedTime, " - "IsSuspended, TimerRemaining, Gender, StanceID, HP, " + "IsSuspended, TimerRemaining, Gender, MercSize, StanceID, HP, " "Mana, Endurance, Face, LuclinHairStyle, LuclinHairColor, " "LuclinEyeColor, LuclinEyeColor2, LuclinBeardColor, " "LuclinBeard, DrakkinHeritage, DrakkinTattoo, DrakkinDetails " @@ -2178,20 +2179,21 @@ bool ZoneDatabase::LoadCurrentMerc(Client *client) { client->GetMercInfo(slot).IsSuspended = atoi(row[4]) == 1? true: false; client->GetMercInfo(slot).MercTimerRemaining = atoi(row[5]); client->GetMercInfo(slot).Gender = atoi(row[6]); - client->GetMercInfo(slot).State = atoi(row[7]); - client->GetMercInfo(slot).hp = atoi(row[8]); - client->GetMercInfo(slot).mana = atoi(row[9]); - client->GetMercInfo(slot).endurance = atoi(row[10]); - client->GetMercInfo(slot).face = atoi(row[11]); - client->GetMercInfo(slot).luclinHairStyle = atoi(row[12]); - client->GetMercInfo(slot).luclinHairColor = atoi(row[13]); - client->GetMercInfo(slot).luclinEyeColor = atoi(row[14]); - client->GetMercInfo(slot).luclinEyeColor2 = atoi(row[15]); - client->GetMercInfo(slot).luclinBeardColor = atoi(row[16]); - client->GetMercInfo(slot).luclinBeard = atoi(row[17]); - client->GetMercInfo(slot).drakkinHeritage = atoi(row[18]); - client->GetMercInfo(slot).drakkinTattoo = atoi(row[19]); - client->GetMercInfo(slot).drakkinDetails = atoi(row[20]); + client->GetMercInfo(slot).MercSize = atof(row[7]); + client->GetMercInfo(slot).State = atoi(row[8]); + client->GetMercInfo(slot).hp = atoi(row[9]); + client->GetMercInfo(slot).mana = atoi(row[10]); + client->GetMercInfo(slot).endurance = atoi(row[11]); + client->GetMercInfo(slot).face = atoi(row[12]); + client->GetMercInfo(slot).luclinHairStyle = atoi(row[13]); + client->GetMercInfo(slot).luclinHairColor = atoi(row[14]); + client->GetMercInfo(slot).luclinEyeColor = atoi(row[15]); + client->GetMercInfo(slot).luclinEyeColor2 = atoi(row[16]); + client->GetMercInfo(slot).luclinBeardColor = atoi(row[17]); + client->GetMercInfo(slot).luclinBeard = atoi(row[18]); + client->GetMercInfo(slot).drakkinHeritage = atoi(row[19]); + client->GetMercInfo(slot).drakkinTattoo = atoi(row[20]); + client->GetMercInfo(slot).drakkinDetails = atoi(row[21]); } return true; @@ -2209,19 +2211,19 @@ bool ZoneDatabase::SaveMerc(Merc *merc) { std::string query = StringFormat("INSERT INTO mercs " "(OwnerCharacterID, Slot, Name, TemplateID, " "SuspendedTime, IsSuspended, TimerRemaining, " - "Gender, StanceID, HP, Mana, Endurance, Face, " + "Gender, MercSize, StanceID, HP, Mana, Endurance, Face, " "LuclinHairStyle, LuclinHairColor, LuclinEyeColor, " "LuclinEyeColor2, LuclinBeardColor, LuclinBeard, " "DrakkinHeritage, DrakkinTattoo, DrakkinDetails) " "VALUES('%u', '%u', '%s', '%u', '%u', '%u', '%u', " - "'%u', '%u', '%u', '%u', '%u', '%i', '%i', '%i', " + "'%u', '%u', '%f', '%u', '%u', '%u', '%i', '%i', '%i', " "'%i', '%i', '%i', '%i', '%i', '%i', '%i')", merc->GetMercCharacterID(), owner->GetNumMercs(), merc->GetCleanName(), merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, merc->GetGender(), - merc->GetStance(), merc->GetHP(), merc->GetMana(), - merc->GetEndurance(), merc->GetLuclinFace(), + merc->GetSize(), merc->GetStance(), merc->GetHP(), + merc->GetMana(), merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), @@ -2245,7 +2247,7 @@ bool ZoneDatabase::SaveMerc(Merc *merc) { // Update existing merc record std::string query = StringFormat("UPDATE mercs SET OwnerCharacterID = '%u', Slot = '%u', " "Name = '%s', TemplateID = '%u', SuspendedTime = '%u', " - "IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', " + "IsSuspended = '%u', TimerRemaining = '%u', Gender = '%u', MercSize = '%f', " "StanceID = '%u', HP = '%u', Mana = '%u', Endurance = '%u', " "Face = '%i', LuclinHairStyle = '%i', LuclinHairColor = '%i', " "LuclinEyeColor = '%i', LuclinEyeColor2 = '%i', LuclinBeardColor = '%i', " @@ -2254,11 +2256,12 @@ bool ZoneDatabase::SaveMerc(Merc *merc) { merc->GetMercCharacterID(), owner->GetMercSlot(), merc->GetCleanName(), merc->GetMercTemplateID(), owner->GetMercInfo().SuspendedTime, merc->IsSuspended(), owner->GetMercInfo().MercTimerRemaining, - merc->GetGender(), merc->GetStance(), merc->GetHP(), merc->GetMana(), - merc->GetEndurance(), merc->GetLuclinFace(), merc->GetHairStyle(), - merc->GetHairColor(), merc->GetEyeColor1(), merc->GetEyeColor2(), - merc->GetBeardColor(), merc->GetBeard(), merc->GetDrakkinHeritage(), - merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), merc->GetMercID()); + merc->GetGender(), merc->GetSize(), merc->GetStance(), merc->GetHP(), + merc->GetMana(), merc->GetEndurance(), merc->GetLuclinFace(), + merc->GetHairStyle(), merc->GetHairColor(), merc->GetEyeColor1(), + merc->GetEyeColor2(), merc->GetBeardColor(), merc->GetBeard(), + merc->GetDrakkinHeritage(), merc->GetDrakkinTattoo(), merc->GetDrakkinDetails(), + merc->GetMercID()); auto results = database.QueryDatabase(query); if (!results.Success()) { diff --git a/zone/zonedb.h b/zone/zonedb.h index 5adc893ff..1c103074a 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -181,6 +181,7 @@ struct MercInfo { bool IsSuspended; uint32 MercTimerRemaining; uint8 Gender; + float MercSize; int32 State; uint32 Stance; int32 hp; From 52eb4d2d4e06238aa6e8d6cb9bf84a14bf198b26 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 2 Dec 2014 00:07:09 -0600 Subject: [PATCH 0460/1883] Fixed Mercenary Depop Crash in Windows. --- zone/merc.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 5593c3e50..c94616eab 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5930,7 +5930,7 @@ Merc* Client::GetMerc() { if(GetMercID() == 0) { if (MERC_DEBUG > 0) - //Message(7, "Mercenary Debug: GetMerc 0."); + Message(7, "Mercenary Debug: GetMerc 0."); return (nullptr); } @@ -5950,9 +5950,6 @@ Merc* Client::GetMerc() { Message(7, "Mercenary Debug: GetMerc Owner Mismatch."); return (nullptr); } - - if (MERC_DEBUG > 0) - //Message(7, "Mercenary Debug: GetMerc Success."); return (tmp); } From 40ec1f805f1754662f49d2f744d91925b8773e8d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 22:35:46 -0800 Subject: [PATCH 0461/1883] psafe_x, psafe_y, and psafe_z replaced with xyz_location m_SafePoint --- zone/zone.cpp | 8 +++----- zone/zone.h | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 292d4fc79..73ea2c643 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -750,7 +750,8 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) clientauth_timer(AUTHENTICATION_TIMEOUT * 1000), spawn2_timer(1000), qglobal_purge_timer(30000), - hotzone_timer(120000) + hotzone_timer(120000), + m_SafePoint(0.0f,0.0f,0.0f) { zoneid = in_zoneid; instanceid = in_instanceid; @@ -777,9 +778,6 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) long_name = 0; aggroedmobs =0; - psafe_x = 0; - psafe_y = 0; - psafe_z = 0; pgraveyard_id = 0; pgraveyard_zoneid = 0; pgraveyard_x = 0; @@ -791,7 +789,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) pvpzone = false; if(database.GetServerType() == 1) pvpzone = true; - database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); + database.GetZoneLongName(short_name, &long_name, file_name, &m_SafePoint.m_X, &m_SafePoint.m_Y, &m_SafePoint.m_Z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { LogFile->write(EQEMuLog::Debug, "Graveyard ID is %i.", graveyard_id()); diff --git a/zone/zone.h b/zone/zone.h index e0a89ac50..7553a855d 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -109,9 +109,9 @@ public: inline Timer* GetInstanceTimer() { return Instance_Timer; } - inline const float& safe_x() { return psafe_x; } - inline const float& safe_y() { return psafe_y; } - inline const float& safe_z() { return psafe_z; } + inline const float& safe_x() { return m_SafePoint.m_X; } + inline const float& safe_y() { return m_SafePoint.m_Y; } + inline const float& safe_z() { return m_SafePoint.m_Z; } inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; } inline const float& graveyard_x() { return pgraveyard_x; } inline const float& graveyard_y() { return pgraveyard_y; } @@ -281,7 +281,7 @@ private: char* long_name; char* map_name; bool pvpzone; - float psafe_x, psafe_y, psafe_z; + xyz_location m_SafePoint; uint32 pMaxClients; bool can_bind; bool is_city; From c3333a46c99ad7090c95809fbfb18716e0158ed2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 23:12:19 -0800 Subject: [PATCH 0462/1883] pgraveyard_x, pgraveyard_y, pgraveyard_z, and pgraveyard_heading converted to xyz_heading as m_Graveyard --- zone/zone.cpp | 15 ++++----------- zone/zone.h | 10 +++++----- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 73ea2c643..1c26b9785 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -751,7 +751,8 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) spawn2_timer(1000), qglobal_purge_timer(30000), hotzone_timer(120000), - m_SafePoint(0.0f,0.0f,0.0f) + m_SafePoint(0.0f,0.0f,0.0f), + m_Graveyard(0.0f,0.0f,0.0f,0.0f) { zoneid = in_zoneid; instanceid = in_instanceid; @@ -777,13 +778,8 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) memset(file_name, 0, sizeof(file_name)); long_name = 0; aggroedmobs =0; - pgraveyard_id = 0; pgraveyard_zoneid = 0; - pgraveyard_x = 0; - pgraveyard_y = 0; - pgraveyard_z = 0; - pgraveyard_heading = 0; pMaxClients = 0; pQueuedMerchantsWorkID = 0; pvpzone = false; @@ -793,7 +789,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(graveyard_id() > 0) { LogFile->write(EQEMuLog::Debug, "Graveyard ID is %i.", graveyard_id()); - bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); + bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &m_Graveyard.m_X, &m_Graveyard.m_Y, &m_Graveyard.m_Z, &m_Graveyard.m_Heading); if(GraveYardLoaded) LogFile->write(EQEMuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else @@ -1837,10 +1833,7 @@ bool Zone::HasGraveyard() { void Zone::SetGraveyard(uint32 zoneid, uint32 x, uint32 y, uint32 z, uint32 heading) { pgraveyard_zoneid = zoneid; - pgraveyard_x = x; - pgraveyard_y = y; - pgraveyard_z = z; - pgraveyard_heading = heading; + m_Graveyard = xyz_heading(x, y, z, heading); } void Zone::LoadBlockedSpells(uint32 zoneid) diff --git a/zone/zone.h b/zone/zone.h index 7553a855d..b790fad5d 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -113,10 +113,10 @@ public: inline const float& safe_y() { return m_SafePoint.m_Y; } inline const float& safe_z() { return m_SafePoint.m_Z; } inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; } - inline const float& graveyard_x() { return pgraveyard_x; } - inline const float& graveyard_y() { return pgraveyard_y; } - inline const float& graveyard_z() { return pgraveyard_z; } - inline const float& graveyard_heading() { return pgraveyard_heading; } + inline const float& graveyard_x() { return m_Graveyard.m_X; } + inline const float& graveyard_y() { return m_Graveyard.m_Y; } + inline const float& graveyard_z() { return m_Graveyard.m_Z; } + inline const float& graveyard_heading() { return m_Graveyard.m_Heading; } inline const uint32& graveyard_id() { return pgraveyard_id; } inline const uint32& GetMaxClients() { return pMaxClients; } @@ -292,7 +292,7 @@ private: uint8 zone_type; bool allow_mercs; uint32 pgraveyard_id, pgraveyard_zoneid; - float pgraveyard_x, pgraveyard_y, pgraveyard_z, pgraveyard_heading; + xyz_heading m_Graveyard; int default_ruleset; int totalBS; From 14608c972aa401024764b51c4907473938079e2a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Mon, 1 Dec 2014 23:34:41 -0800 Subject: [PATCH 0463/1883] SetGraveyard to xyz_header --- zone/zone.cpp | 4 ++-- zone/zone.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 1c26b9785..cc333c5fa 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1831,9 +1831,9 @@ bool Zone::HasGraveyard() { return Result; } -void Zone::SetGraveyard(uint32 zoneid, uint32 x, uint32 y, uint32 z, uint32 heading) { +void Zone::SetGraveyard(uint32 zoneid, const xyz_heading& graveyardPosition) { pgraveyard_zoneid = zoneid; - m_Graveyard = xyz_heading(x, y, z, heading); + m_Graveyard = graveyardPosition; } void Zone::LoadBlockedSpells(uint32 zoneid) diff --git a/zone/zone.h b/zone/zone.h index b790fad5d..0701c26e2 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -241,7 +241,7 @@ public: uint8 lootvar; bool HasGraveyard(); - void SetGraveyard(uint32 zoneid, uint32 x, uint32 y, uint32 z, uint32 heading); + void SetGraveyard(uint32 zoneid, const xyz_heading& graveyardPosition); void LoadBlockedSpells(uint32 zoneid); void ClearBlockedSpells(); From 70dd4471563abe283ac8ede9362a20cf1ca59704 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 2 Dec 2014 03:42:35 -0500 Subject: [PATCH 0464/1883] Fix for error introduced in projectile update for throwing/archery to do hit chance check 2x resulting in much greater chance to miss. --- zone/special_attacks.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index cf6a83c80..8b6f11d96 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -828,6 +828,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite this function is then run again to do the damage portion */ bool LaunchProjectile = false; + bool ProjectileImpact = false; bool ProjectileMiss = false; if (RuleB(Combat, ProjectileDmgOnImpact)){ @@ -844,6 +845,8 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (!RangeWeapon && !Ammo && range_id && ammo_id){ + ProjectileImpact = true; + if (weapon_damage == 0) ProjectileMiss = true; //This indicates that MISS was originally calculated. @@ -865,7 +868,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else if (AmmoItem) SendItemAnimation(other, AmmoItem, SkillArchery); - if (ProjectileMiss || !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) { + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ @@ -1382,6 +1385,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite this function is then run again to do the damage portion */ bool LaunchProjectile = false; + bool ProjectileImpact = false; bool ProjectileMiss = false; if (RuleB(Combat, ProjectileDmgOnImpact)){ @@ -1391,6 +1395,8 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else{ if (!RangeWeapon && range_id){ + ProjectileImpact = true; + if (weapon_damage == 0) ProjectileMiss = true; //This indicates that MISS was originally calculated. @@ -1408,7 +1414,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else if (AmmoItem) SendItemAnimation(other, AmmoItem, SkillThrowing); - if (ProjectileMiss || !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); From 2995b20d62507955114444da28a428e3df7eb3c4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 10:29:35 -0800 Subject: [PATCH 0465/1883] SaveCharacterBindPoint converted to xyz_heading --- zone/client.cpp | 6 ++++-- zone/zonedb.cpp | 6 +++--- zone/zonedb.h | 2 +- zone/zoning.cpp | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index e2ec14178..1bc23b38f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -534,8 +534,10 @@ bool Client::Save(uint8 iCommitNow) { database.SaveCharacterCurrency(CharacterID(), &m_pp); /* Save Current Bind Points */ - database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */ - database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[4].zoneId, m_pp.binds[4].instance_id, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */ + auto regularBindPosition = xyz_heading(m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0.0f); + auto homeBindPosition = xyz_heading(m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0.0f); + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, regularBindPosition, 0); /* Regular bind */ + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[4].zoneId, m_pp.binds[4].instance_id, homeBindPosition, 1); /* Home Bind */ /* Save Character Buffs */ database.SaveBuffs(this); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7f49a1ca1..184ecdf92 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1224,15 +1224,15 @@ bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, ui return true; } -bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home){ +bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, const xyz_heading& position, uint8 is_home){ if (zone_id <= 0) { return false; } /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + " VALUES (%u, %u, %u, %f, %f, %f, %f, %i)", character_id, zone_id, instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading, is_home); + LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u position: %s ishome: %u", character_id, zone_id, instance_id, to_string(position).c_str(), is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); diff --git a/zone/zonedb.h b/zone/zonedb.h index 30b51760b..b5af4484a 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -264,7 +264,7 @@ public: bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp); /* Character Data Saves */ - bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home); + bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, const xyz_heading& position, uint8 is_home); bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp); bool SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp); bool SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 49a5601aa..758bb48f9 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -720,7 +720,8 @@ void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y m_pp.binds[0].y = new_y; m_pp.binds[0].z = new_z; } - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); + auto regularBindPoint = xyz_heading(m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0.0f); + database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, regularBindPoint, 0); } void Client::GoToBind(uint8 bindnum) { From 525eb518f661fe7cbe89b0aebfce406c539d1685 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 2 Dec 2014 13:44:23 -0500 Subject: [PATCH 0466/1883] Crash fix, this check got removed accidentally --- zone/special_attacks.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index cf6a83c80..671968350 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -596,6 +596,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) for (int i = 0; i < EmuConstants::ITEM_COMMON_SIZE; ++i) { ItemInst *aug = wpn->GetAugment(i); + if(aug) { backstab_dmg += aug->GetItem()->BackstabDmg; } From 7ce7af05f3f18041cb44dd596e37020caebb447d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 10:47:46 -0800 Subject: [PATCH 0467/1883] SetBindPoint converted to xyz_location --- zone/client.h | 2 +- zone/lua_client.cpp | 12 ++++++------ zone/perl_client.cpp | 14 +++++++------- zone/questmgr.cpp | 2 +- zone/zoning.cpp | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/zone/client.h b/zone/client.h index 004adfede..caec8513d 100644 --- a/zone/client.h +++ b/zone/client.h @@ -578,7 +578,7 @@ public: void GoToBind(uint8 bindnum = 0); void GoToSafeCoords(uint16 zone_id, uint16 instance_id); void Gate(); - void SetBindPoint(int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); + void SetBindPoint(int to_zone = -1, int to_instance = 0, const xyz_location& location = xyz_location::Origin()); void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); uint32 GetStartZone(void); void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 22e38b21d..ac7fe6eec 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -242,17 +242,17 @@ void Lua_Client::SetBindPoint(int to_zone, int to_instance) { void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, to_instance, new_x); + self->SetBindPoint(to_zone, to_instance, xyz_location(new_x,0.0f,0.0f)); } void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, to_instance, new_x, new_y); + self->SetBindPoint(to_zone, to_instance, xyz_location(new_x, new_y, 0.0f)); } void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); + self->SetBindPoint(to_zone, to_instance, xyz_location(new_x, new_y, new_z)); } float Lua_Client::GetBindX() { @@ -700,13 +700,13 @@ void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5); } -void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, +void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned) { Lua_Safe_Call_Void(); self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned); } -void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, +void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, int to_slot) { Lua_Safe_Call_Void(); self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned, to_slot); @@ -1396,7 +1396,7 @@ luabind::scope lua_register_client() { .def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem) .def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem) .def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,bool))&Lua_Client::SummonItem) - .def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,bool,int))&Lua_Client::SummonItem) + .def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,bool,int))&Lua_Client::SummonItem) .def("SetStats", (void(Lua_Client::*)(int,int))&Lua_Client::SetStats) .def("IncStats", (void(Lua_Client::*)(int,int))&Lua_Client::IncStats) .def("DropItem", (void(Lua_Client::*)(int))&Lua_Client::DropItem) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 2a0c055af..ed0371924 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1072,7 +1072,7 @@ XS(XS_Client_SetBindPoint) new_z = (float)SvNV(ST(5)); } - THIS->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); + THIS->SetBindPoint(to_zone, to_instance, xyz_location(new_x, new_y, new_z)); } XSRETURN_EMPTY; } @@ -1277,7 +1277,7 @@ XS(XS_Client_MovePC) #ifdef BOTS else if (THIS->IsBot()) _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type Bot reference"); - #endif + #endif else _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); @@ -1327,7 +1327,7 @@ XS(XS_Client_MovePCInstance) else _log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); - Perl_croak(aTHX_ "THIS is not of type Client"); + Perl_croak(aTHX_ "THIS is not of type Client"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -5087,7 +5087,7 @@ XS(XS_Client_GetTaskActivityDoneCount) Perl_croak(aTHX_ "Usage: Client::GetTaskActivityDoneCount(THIS, TaskID, ActivityID)"); { Client * THIS; - int RETVAL; + int RETVAL; int TaskID = (int)SvIV(ST(1)); int ActivityID = (int)SvIV(ST(2)); dXSTARG; @@ -5101,7 +5101,7 @@ XS(XS_Client_GetTaskActivityDoneCount) if (THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - + RETVAL = THIS->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID); XSprePUSH; PUSHi((IV)RETVAL); } @@ -5945,7 +5945,7 @@ XS(XS_Client_SilentMessage) { Client * THIS; dXSTARG; - + if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); THIS = INT2PTR(Client *,tmp); @@ -6344,7 +6344,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "SendMarqueeMessage"), XS_Client_SendMarqueeMessage, file, "$$$$$$$"); newXSproto(strcpy(buf, "SendColoredText"), XS_Client_SendColoredText, file, "$$$"); newXSproto(strcpy(buf, "SendSpellAnim"), XS_Client_SendSpellAnim, file, "$$$"); - + XSRETURN_YES; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index bd3c07cef..a1a6a419f 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1525,7 +1525,7 @@ void QuestManager::ding() { void QuestManager::rebind(int zoneid, float x, float y, float z) { QuestManagerCurrentQuestVars(); if(initiator && initiator->IsClient()) { - initiator->SetBindPoint(zoneid, x, y, z); + initiator->SetBindPoint(zoneid, 0, xyz_location(x, y, z)); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 758bb48f9..266951f1b 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -705,7 +705,7 @@ void NPC::Gate() { Mob::Gate(); } -void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { +void Client::SetBindPoint(int to_zone, int to_instance, const xyz_location& location) { if (to_zone == -1) { m_pp.binds[0].zoneId = zone->GetZoneID(); m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0; @@ -716,9 +716,9 @@ void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y else { m_pp.binds[0].zoneId = to_zone; m_pp.binds[0].instance_id = to_instance; - m_pp.binds[0].x = new_x; - m_pp.binds[0].y = new_y; - m_pp.binds[0].z = new_z; + m_pp.binds[0].x = location.m_X; + m_pp.binds[0].y = location.m_Y; + m_pp.binds[0].z = location.m_Z; } auto regularBindPoint = xyz_heading(m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0.0f); database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, regularBindPoint, 0); From 9d6a89c65db8ab3dccded9a750936f1184549d8e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 10:56:02 -0800 Subject: [PATCH 0468/1883] rebind converted to xyz_location --- zone/embparser_api.cpp | 6 ++---- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 4faae7c8c..0e65240d4 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1321,11 +1321,9 @@ XS(XS__rebind) Perl_croak(aTHX_ "Usage: rebind(zoneid, x, y, z)"); int zoneid = (int)SvIV(ST(0)); - float x = (float)SvNV(ST(1)); - float y = (float)SvNV(ST(2)); - float z = (float)SvNV(ST(3)); + auto location = xyz_location((float)SvNV(ST(1)),(float)SvNV(ST(2)),(float)SvNV(ST(3))); - quest_manager.rebind(zoneid, x, y, z); + quest_manager.rebind(zoneid, location); XSRETURN_EMPTY; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index a1a6a419f..425175e43 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1522,10 +1522,10 @@ void QuestManager::ding() { } -void QuestManager::rebind(int zoneid, float x, float y, float z) { +void QuestManager::rebind(int zoneid, const xyz_location& location) { QuestManagerCurrentQuestVars(); if(initiator && initiator->IsClient()) { - initiator->SetBindPoint(zoneid, 0, xyz_location(x, y, z)); + initiator->SetBindPoint(zoneid, 0, location); } } diff --git a/zone/questmgr.h b/zone/questmgr.h index 6e8c6f4b5..de824c8a2 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -131,7 +131,7 @@ public: void targlobal(const char *varname, const char *value, const char *duration, int npcid, int charid, int zoneid); void delglobal(const char *varname); void ding(); - void rebind(int zoneid, float x, float y, float z); + void rebind(int zoneid, const xyz_location& location); void start(int wp); void stop(); void pause(int duration); From 9636ef34996b8b9645f2530b54ef582b84a38fcb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 2 Dec 2014 14:09:14 -0500 Subject: [PATCH 0469/1883] Update to new random functions --- zone/mob.cpp | 124 +++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 34da067e5..13a2eb06b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1590,157 +1590,157 @@ bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables) uint32 DrakkinDetails = 0xFFFFFFFF; // Set some common feature settings - EyeColor1 = MakeRandomInt(0, 9); - EyeColor2 = MakeRandomInt(0, 9); - LuclinFace = MakeRandomInt(0, 7); + EyeColor1 = zone->random.Int(0, 9); + EyeColor2 = zone->random.Int(0, 9); + LuclinFace = zone->random.Int(0, 7); // Adjust all settings based on the min and max for each feature of each race and gender switch (GetRace()) { case 1: // Human - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 2: // Barbarian - HairColor = MakeRandomInt(0, 19); - LuclinFace = MakeRandomInt(0, 87); + HairColor = zone->random.Int(0, 19); + LuclinFace = zone->random.Int(0, 87); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 3: // Erudite if (Gender == 0) { - BeardColor = MakeRandomInt(0, 19); - Beard = MakeRandomInt(0, 5); - LuclinFace = MakeRandomInt(0, 57); + BeardColor = zone->random.Int(0, 19); + Beard = zone->random.Int(0, 5); + LuclinFace = zone->random.Int(0, 57); } if (Gender == 1) { - LuclinFace = MakeRandomInt(0, 87); + LuclinFace = zone->random.Int(0, 87); } break; case 4: // WoodElf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); + HairStyle = zone->random.Int(0, 3); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 5: // HighElf - HairColor = MakeRandomInt(0, 14); + HairColor = zone->random.Int(0, 14); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 6: // DarkElf - HairColor = MakeRandomInt(13, 18); + HairColor = zone->random.Int(13, 18); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 7: // HalfElf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - LuclinFace = MakeRandomInt(0, 37); + HairStyle = zone->random.Int(0, 3); + LuclinFace = zone->random.Int(0, 37); BeardColor = HairColor; } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 8: // Dwarf - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); BeardColor = HairColor; if (Gender == 0) { - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); - LuclinFace = MakeRandomInt(0, 17); + HairStyle = zone->random.Int(0, 2); + LuclinFace = zone->random.Int(0, 17); } break; case 9: // Troll - EyeColor1 = MakeRandomInt(0, 10); - EyeColor2 = MakeRandomInt(0, 10); + EyeColor1 = zone->random.Int(0, 10); + EyeColor2 = zone->random.Int(0, 10); if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); + HairStyle = zone->random.Int(0, 3); + HairColor = zone->random.Int(0, 23); } break; case 10: // Ogre if (Gender == 1) { - HairStyle = MakeRandomInt(0, 3); - HairColor = MakeRandomInt(0, 23); + HairStyle = zone->random.Int(0, 3); + HairColor = zone->random.Int(0, 23); } break; case 11: // Halfling - HairColor = MakeRandomInt(0, 19); + HairColor = zone->random.Int(0, 19); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 12: // Gnome - HairColor = MakeRandomInt(0, 24); + HairColor = zone->random.Int(0, 24); if (Gender == 0) { BeardColor = HairColor; - HairStyle = MakeRandomInt(0, 3); - Beard = MakeRandomInt(0, 5); + HairStyle = zone->random.Int(0, 3); + Beard = zone->random.Int(0, 5); } if (Gender == 1) { - HairStyle = MakeRandomInt(0, 2); + HairStyle = zone->random.Int(0, 2); } break; case 128: // Iksar case 130: // VahShir break; case 330: // Froglok - LuclinFace = MakeRandomInt(0, 9); + LuclinFace = zone->random.Int(0, 9); case 522: // Drakkin - HairColor = MakeRandomInt(0, 3); + HairColor = zone->random.Int(0, 3); BeardColor = HairColor; - EyeColor1 = MakeRandomInt(0, 11); - EyeColor2 = MakeRandomInt(0, 11); - LuclinFace = MakeRandomInt(0, 6); - DrakkinHeritage = MakeRandomInt(0, 6); - DrakkinTattoo = MakeRandomInt(0, 7); - DrakkinDetails = MakeRandomInt(0, 7); + EyeColor1 = zone->random.Int(0, 11); + EyeColor2 = zone->random.Int(0, 11); + LuclinFace = zone->random.Int(0, 6); + DrakkinHeritage = zone->random.Int(0, 6); + DrakkinTattoo = zone->random.Int(0, 7); + DrakkinDetails = zone->random.Int(0, 7); if (Gender == 0) { - Beard = MakeRandomInt(0, 12); - HairStyle = MakeRandomInt(0, 8); + Beard = zone->random.Int(0, 12); + HairStyle = zone->random.Int(0, 8); } if (Gender == 1) { - Beard = MakeRandomInt(0, 3); - HairStyle = MakeRandomInt(0, 7); + Beard = zone->random.Int(0, 3); + HairStyle = zone->random.Int(0, 7); } break; default: From 04e24ddce439f3ed550c724cc6faeaba62801501 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 11:20:10 -0800 Subject: [PATCH 0470/1883] moveto converted to xyz_heading --- zone/embparser_api.cpp | 2 +- zone/lua_general.cpp | 6 +++--- zone/questmgr.cpp | 3 +-- zone/questmgr.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 0e65240d4..3ec5801ef 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1392,7 +1392,7 @@ XS(XS__moveto) else saveguard = false; - quest_manager.moveto(x, y, z, h, saveguard); + quest_manager.moveto(xyz_heading(x, y, z, h), saveguard); XSRETURN_EMPTY; } diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index efc6c48fe..9238278cc 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -421,15 +421,15 @@ void lua_pause(int duration) { } void lua_move_to(float x, float y, float z) { - quest_manager.moveto(x, y, z, 0, false); + quest_manager.moveto(xyz_heading(x, y, z, 0.0f), false); } void lua_move_to(float x, float y, float z, float h) { - quest_manager.moveto(x, y, z, h, false); + quest_manager.moveto(xyz_heading(x, y, z, h), false); } void lua_move_to(float x, float y, float z, float h, bool save_guard_spot) { - quest_manager.moveto(x, y, z, h, save_guard_spot); + quest_manager.moveto(xyz_heading(x, y, z, h), save_guard_spot); } void lua_path_resume() { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 425175e43..e8da20496 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1553,12 +1553,11 @@ void QuestManager::pause(int duration) { owner->CastToNPC()->PauseWandering(duration); } -void QuestManager::moveto(float x, float y, float z, float h, bool saveguardspot) { +void QuestManager::moveto(const xyz_heading& position, bool saveguardspot) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) return; - auto position = xyz_heading(x,y,z,h); owner->CastToNPC()->MoveTo(position, saveguardspot); } diff --git a/zone/questmgr.h b/zone/questmgr.h index de824c8a2..4a01a6e49 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -135,7 +135,7 @@ public: void start(int wp); void stop(); void pause(int duration); - void moveto(float x, float y, float z, float h, bool saveguardspot); + void moveto(const xyz_heading& position, bool saveguardspot); void resume(); void addldonpoints(int32 points, uint32 theme); void addldonwin(int32 wins, uint32 theme); From efc4ba0e27e89816c906001bd124a7649840d956 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 12:00:45 -0800 Subject: [PATCH 0471/1883] summonburriedplayercorpse converted to xyz_heading --- zone/embparser_api.cpp | 7 ++----- zone/lua_general.cpp | 2 +- zone/questmgr.cpp | 17 +++++++++-------- zone/questmgr.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 3ec5801ef..ba2e397b5 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1747,12 +1747,9 @@ XS(XS__summonburriedplayercorpse) bool RETVAL; uint32 char_id = (int)SvIV(ST(0)); - float dest_x = (float)SvIV(ST(1)); - float dest_y = (float)SvIV(ST(2)); - float dest_z = (float)SvIV(ST(3)); - float dest_heading = (float)SvIV(ST(4)); + auto position = xyz_heading((float)SvIV(ST(1)), (float)SvIV(ST(2)), (float)SvIV(ST(3)),(float)SvIV(ST(4))); - RETVAL = quest_manager.summonburriedplayercorpse(char_id, dest_x, dest_y, dest_z, dest_heading); + RETVAL = quest_manager.summonburriedplayercorpse(char_id, position); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 9238278cc..7d619803a 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -485,7 +485,7 @@ void lua_toggle_spawn_event(int event_id, bool enable, bool strict, bool reset) } void lua_summon_burried_player_corpse(uint32 char_id, float x, float y, float z, float h) { - quest_manager.summonburriedplayercorpse(char_id, x, y, z, h); + quest_manager.summonburriedplayercorpse(char_id, xyz_heading(x, y, z, h)); } void lua_summon_all_player_corpses(uint32 char_id, float x, float y, float z, float h) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index e8da20496..d4e914204 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1734,16 +1734,17 @@ void QuestManager::sethp(int hpperc) { owner->Damage(owner, newhp, SPELL_UNKNOWN, SkillHandtoHand, false, 0, false); } -bool QuestManager::summonburriedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading) { +bool QuestManager::summonburriedplayercorpse(uint32 char_id, const xyz_heading& position) { bool Result = false; - if(char_id > 0) { - Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading); - if(PlayerCorpse) { - Result = true; - } - } - return Result; + if(char_id <= 0) + return false; + + Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), position.m_X, position.m_Y, position.m_Z, position.m_Heading); + if(!PlayerCorpse) + return false; + + return true; } bool QuestManager::summonallplayercorpses(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading) { diff --git a/zone/questmgr.h b/zone/questmgr.h index 4a01a6e49..c6c28111e 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -156,7 +156,7 @@ public: void set_zone_flag(int zone_id); void clear_zone_flag(int zone_id); void sethp(int hpperc); - bool summonburriedplayercorpse(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading); + bool summonburriedplayercorpse(uint32 char_id, const xyz_heading& position); bool summonallplayercorpses(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading); uint32 getplayerburriedcorpsecount(uint32 char_id); bool buryplayercorpse(uint32 char_id); From dd5265dc02b564ed583f0400ee406e7a2b0d4f89 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 12:04:21 -0800 Subject: [PATCH 0472/1883] SummonBuriedCharacterCorpses converted to xyz_heading --- zone/command.cpp | 2 +- zone/questmgr.cpp | 2 +- zone/zonedb.cpp | 40 +++++++++++++++++++++------------------- zone/zonedb.h | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index d74fedabe..030ce7de5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -8522,7 +8522,7 @@ void command_summonburriedplayercorpse(Client *c, const Seperator *sep) return; } - Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); + Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetPosition()); if(!PlayerCorpse) c->Message(0, "Your target doesn't have any burried corpses."); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index d4e914204..8ec522537 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1740,7 +1740,7 @@ bool QuestManager::summonburriedplayercorpse(uint32 char_id, const xyz_heading& if(char_id <= 0) return false; - Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), position.m_X, position.m_Y, position.m_Z, position.m_Heading); + Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), position); if(!PlayerCorpse) return false; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 184ecdf92..762484411 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3771,37 +3771,39 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct return true; } -Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { - Corpse* NewCorpse = 0; - std::string query = StringFormat( - "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1", - char_id - ); +Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, const xyz_heading& position) { + Corpse* corpse = nullptr; + std::string query = StringFormat("SELECT `id`, `charname`, `time_of_death`, `is_rezzed` " + "FROM `character_corpses` " + "WHERE `charid` = '%u' AND `is_buried` = 1 " + "ORDER BY `time_of_death` LIMIT 1", + char_id); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - NewCorpse = Corpse::LoadFromDBData( + corpse = Corpse::LoadFromDBData( atoll(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname - dest_x, // float in_x - dest_y, // float in_y - dest_z, // float in_z - dest_heading, // float in_heading + position.m_X, // float in_x + position.m_Y, // float in_y + position.m_Z, // float in_z + position.m_Heading, // float in_heading row[2], // char* time_of_death atoi(row[3]) == 1, // bool rezzed false // bool was_at_graveyard ); - if (NewCorpse) { - entity_list.AddCorpse(NewCorpse); - NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); - NewCorpse->Spawn(); - if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); - } + if (!corpse) + continue; + + entity_list.AddCorpse(corpse); + corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); + corpse->Spawn(); + if (!UnburyCharacterCorpse(corpse->GetDBID(), dest_zone_id, dest_instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading)) + LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } - return NewCorpse; + return corpse; } bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { diff --git a/zone/zonedb.h b/zone/zonedb.h index b5af4484a..ba9c6d924 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -297,7 +297,7 @@ public: uint32 GetCharacterCorpseItemCount(uint32 corpse_id); bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs); Corpse* LoadCharacterCorpse(uint32 player_corpse_id); - Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); void MarkCorpseAsRezzed(uint32 dbid); bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes); bool BuryCharacterCorpse(uint32 dbid); From 7a74df5ff16296a312777206b260e0d0d5319f9b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 12:42:47 -0800 Subject: [PATCH 0473/1883] summonallplayercorpses converted to xyz_heading --- zone/embparser_api.cpp | 7 ++----- zone/lua_general.cpp | 2 +- zone/questmgr.cpp | 16 ++++++++-------- zone/questmgr.h | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index ba2e397b5..6df722934 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -1765,12 +1765,9 @@ XS(XS__summonallplayercorpses) bool RETVAL; uint32 char_id = (int)SvIV(ST(0)); - float dest_x = (float)SvIV(ST(1)); - float dest_y = (float)SvIV(ST(2)); - float dest_z = (float)SvIV(ST(3)); - float dest_heading = (float)SvIV(ST(4)); + auto position = xyz_heading((float)SvIV(ST(1)),(float)SvIV(ST(2)),(float)SvIV(ST(3)),(float)SvIV(ST(4))); - RETVAL = quest_manager.summonallplayercorpses(char_id, dest_x, dest_y, dest_z, dest_heading); + RETVAL = quest_manager.summonallplayercorpses(char_id, position); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 7d619803a..28dbba206 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -489,7 +489,7 @@ void lua_summon_burried_player_corpse(uint32 char_id, float x, float y, float z, } void lua_summon_all_player_corpses(uint32 char_id, float x, float y, float z, float h) { - quest_manager.summonallplayercorpses(char_id, x, y, z, h); + quest_manager.summonallplayercorpses(char_id, xyz_heading(x, y, z, h)); } int lua_get_player_burried_corpse_count(uint32 char_id) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 8ec522537..25e43752e 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1747,15 +1747,15 @@ bool QuestManager::summonburriedplayercorpse(uint32 char_id, const xyz_heading& return true; } -bool QuestManager::summonallplayercorpses(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading) { - bool Result = false; +bool QuestManager::summonallplayercorpses(uint32 char_id, const xyz_heading& position) { - if(char_id > 0) { - Client* c = entity_list.GetClientByCharID(char_id); - c->SummonAllCorpses(dest_x, dest_y, dest_z, dest_heading); - Result = true; - } - return Result; + if(char_id <= 0) + return false; + + Client* c = entity_list.GetClientByCharID(char_id); + c->SummonAllCorpses(position.m_X, position.m_Y, position.m_Z, position.m_Heading); + + return true; } uint32 QuestManager::getplayerburriedcorpsecount(uint32 char_id) { diff --git a/zone/questmgr.h b/zone/questmgr.h index c6c28111e..d001beab4 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -157,7 +157,7 @@ public: void clear_zone_flag(int zone_id); void sethp(int hpperc); bool summonburriedplayercorpse(uint32 char_id, const xyz_heading& position); - bool summonallplayercorpses(uint32 char_id, float dest_x, float dest_y, float dest_z, float dest_heading); + bool summonallplayercorpses(uint32 char_id, const xyz_heading& position); uint32 getplayerburriedcorpsecount(uint32 char_id); bool buryplayercorpse(uint32 char_id); void forcedooropen(uint32 doorid, bool altmode); From 3791c38f97e03d3fa0c5281e42540dd0103c9fe1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 12:52:40 -0800 Subject: [PATCH 0474/1883] SummonAllCharacterCorpses converted to xyz_heading --- zone/client.cpp | 5 ++--- zone/zonedb.cpp | 15 +++++++-------- zone/zonedb.h | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 1bc23b38f..02c35feaa 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4927,8 +4927,7 @@ void Client::SummonAndRezzAllCorpses() entity_list.RemoveAllCorpsesByCharID(CharacterID()); - int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), - GetX(), GetY(), GetZ(), GetHeading()); + int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), GetPosition()); if(CorpseCount <= 0) { Message(clientMessageYellow, "You have no corpses to summnon."); @@ -4966,7 +4965,7 @@ void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float de entity_list.RemoveAllCorpsesByCharID(CharacterID()); int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), - dest_x, dest_y, dest_z, dest_heading); + xyz_heading(dest_x, dest_y, dest_z, dest_heading)); if(CorpseCount <= 0) { return; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 762484411..7b8cb2d6d 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3806,21 +3806,20 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z return corpse; } -bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) { +bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, const xyz_heading& position) { Corpse* NewCorpse = 0; int CorpseCount = 0; std::string query = StringFormat( "UPDATE character_corpses SET zone_id = %i, instance_id = %i, x = %f, y = %f, z = %f, heading = %f, is_buried = 0, was_at_graveyard = 0 WHERE charid = %i", - dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading, char_id + dest_zone_id, dest_instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading, char_id ); auto results = QueryDatabase(query); query = StringFormat( "SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u'" "ORDER BY time_of_death", - char_id - ); + char_id); results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { @@ -3828,10 +3827,10 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id atoll(row[0]), char_id, row[1], - dest_x, - dest_y, - dest_z, - dest_heading, + position.m_X, + position.m_Y, + position.m_Z, + position.m_Heading, row[2], atoi(row[3]) == 1, false); diff --git a/zone/zonedb.h b/zone/zonedb.h index ba9c6d924..e66448a47 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -303,7 +303,7 @@ public: bool BuryCharacterCorpse(uint32 dbid); bool BuryAllCharacterCorpses(uint32 charid); bool DeleteCharacterCorpse(uint32 dbid); - bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); From 0ad62461f0d4ebf6575e6914df6b5525ccaa0398 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 13:13:04 -0800 Subject: [PATCH 0475/1883] CorpseLoadFromDBData converted to xyz_heading --- zone/corpse.cpp | 10 +++++----- zone/corpse.h | 12 ++++++------ zone/zonedb.cpp | 33 ++++++--------------------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 766c70345..8f8d6a4e1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -63,7 +63,7 @@ void Corpse::SendLootReqErrorPacket(Client* client, uint8 response) { safe_delete(outapp); } -Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard) +Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, const xyz_heading& position, std::string time_of_death, bool rezzed, bool was_at_graveyard) { uint32 item_count = database.GetCharacterCorpseItemCount(in_dbid); char *buffer = new char[sizeof(PlayerCorpse_Struct) + (item_count * sizeof(player_lootitem::ServerLootItem_Struct))]; @@ -90,10 +90,10 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ pcs->silver, // uint32 in_silver pcs->gold, // uint32 in_gold pcs->plat, // uint32 in_plat - in_x, // float in_x - in_y, // float in_y - in_z, // float in_z - in_heading, // float in_heading + position.m_X, // float in_x + position.m_Y, // float in_y + position.m_Z, // float in_z + position.m_Heading, // float in_heading pcs->size, // float in_size pcs->gender, // uint8 in_gender pcs->race, // uint16 in_race diff --git a/zone/corpse.h b/zone/corpse.h index f365dd041..ba2dfbecc 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -30,18 +30,18 @@ class Corpse : public Mob { public: static void SendEndLootErrorPacket(Client* client); - static void SendLootReqErrorPacket(Client* client, uint8 response = 2); - + static void SendLootReqErrorPacket(Client* client, uint8 response = 2); + Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); - static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard); + static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, const xyz_heading& position, std::string time_of_death, bool rezzed, bool was_at_graveyard); //abstract virtual function implementations requird by base abstract class virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; } virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; } - virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, + virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; } virtual bool HasRaid() { return false; } virtual bool HasGroup() { return false; } @@ -119,7 +119,7 @@ protected: std::list MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot); private: - bool is_player_corpse; + bool is_player_corpse; bool is_corpse_changed; bool is_locked; int32 player_kill_item; @@ -137,7 +137,7 @@ private: bool can_rez; bool become_npc; int allowed_looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id - Timer corpse_decay_timer; + Timer corpse_decay_timer; Timer corpse_res_timer; Timer corpse_delay_timer; Timer corpse_graveyard_timer; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7b8cb2d6d..239608473 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3785,10 +3785,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z atoll(row[0]), // uint32 in_dbid char_id, // uint32 in_charid row[1], // char* in_charname - position.m_X, // float in_x - position.m_Y, // float in_y - position.m_Z, // float in_z - position.m_Heading, // float in_heading + position, row[2], // char* time_of_death atoi(row[3]) == 1, // bool rezzed false // bool was_at_graveyard @@ -3827,10 +3824,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id atoll(row[0]), char_id, row[1], - position.m_X, - position.m_Y, - position.m_Z, - position.m_Heading, + position, row[2], atoi(row[3]) == 1, false); @@ -3868,14 +3862,12 @@ Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) { ); auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { + auto position = xyz_heading(atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6])); NewCorpse = Corpse::LoadFromDBData( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name - atof(row[3]), // x float in_x - atof(row[4]), // y float in_y - atof(row[5]), // z float in_z - atof(row[6]), // heading float in_heading + position, row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed atoi(row[9]) // was_at_graveyard bool was_at_graveyard @@ -3896,26 +3888,13 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { - // std::cout << row[0] << std::endl; - // std::cout << row[1] << std::endl; - // std::cout << row[2] << std::endl; - // std::cout << row[3] << std::endl; - // std::cout << row[4] << std::endl; - // std::cout << row[5] << std::endl; - // std::cout << row[6] << std::endl; - // std::cout << row[7] << std::endl; - // std::cout << row[8] << std::endl; - // std::cout << row[9] << std::endl; - + auto position = xyz_heading(atof(row[3]), atof(row[4]), atof(row[5]), atof(row[6])); entity_list.AddCorpse( Corpse::LoadFromDBData( atoll(row[0]), // id uint32 in_dbid atoll(row[1]), // charid uint32 in_charid row[2], // char_name - atof(row[3]), // x float in_x - atof(row[4]), // y float in_y - atof(row[5]), // z float in_z - atof(row[6]), // heading float in_heading + position, row[7], // time_of_death char* time_of_death atoi(row[8]) == 1, // is_rezzed bool rezzed atoi(row[9])) From 2e0cfa86bfda6cd437c93b484b5c7c95c4d83034 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 13:26:55 -0800 Subject: [PATCH 0476/1883] QuestManager::spawn2 converted to xyz_heading --- zone/embparser_api.cpp | 13 ++++--------- zone/lua_general.cpp | 4 ++-- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 6df722934..45086093c 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -218,11 +218,9 @@ XS(XS__spawn) int npc_type = (int)SvIV(ST(0)); int grid = (int)SvIV(ST(1)); int unused = (int)SvIV(ST(2)); - float x = (float)SvNV(ST(3)); - float y = (float)SvNV(ST(4)); - float z = (float)SvNV(ST(5)); + auto position = xyz_heading((float)SvNV(ST(3)), (float)SvNV(ST(4)), (float)SvNV(ST(5)), 0.0f); - Mob *r = quest_manager.spawn2(npc_type, grid, unused, x, y, z, 0); + Mob *r = quest_manager.spawn2(npc_type, grid, unused, position); RETVAL = (r != nullptr) ? r->GetID() : 0; XSprePUSH; PUSHu((UV)RETVAL); @@ -242,12 +240,9 @@ XS(XS__spawn2) int npc_type = (int)SvIV(ST(0)); int grid = (int)SvIV(ST(1)); int unused = (int)SvIV(ST(2)); - float x = (float)SvNV(ST(3)); - float y = (float)SvNV(ST(4)); - float z = (float)SvNV(ST(5)); - float heading = (float)SvNV(ST(6)); + auto position = xyz_heading((float)SvNV(ST(3)), (float)SvNV(ST(4)), (float)SvNV(ST(5)), (float)SvNV(ST(6))); - Mob *r = quest_manager.spawn2(npc_type, grid, unused, x, y, z, heading); + Mob *r = quest_manager.spawn2(npc_type, grid, unused, position); RETVAL = (r != nullptr) ? r->GetID() : 0; XSprePUSH; PUSHu((UV)RETVAL); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 28dbba206..915efe780 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -251,8 +251,8 @@ void unregister_spell_event(int evt, int spell_id) { } Lua_Mob lua_spawn2(int npc_type, int grid, int unused, double x, double y, double z, double heading) { - return Lua_Mob(quest_manager.spawn2(npc_type, grid, unused, - static_cast(x), static_cast(y), static_cast(z), static_cast(heading))); + auto position = xyz_heading(x, y, z, heading); + return Lua_Mob(quest_manager.spawn2(npc_type, grid, unused, position)); } Lua_Mob lua_unique_spawn(int npc_type, int grid, int unused, double x, double y, double z, double heading = 0.0) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 25e43752e..48c94f1cc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -241,11 +241,11 @@ void QuestManager::write(const char *file, const char *str) { fclose (pFile); } -Mob* QuestManager::spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading) { +Mob* QuestManager::spawn2(int npc_type, int grid, int unused, const xyz_heading& position) { const NPCType* tmp = 0; if (tmp = database.GetNPCType(npc_type)) { - NPC* npc = new NPC(tmp, nullptr, xyz_heading(x, y, z, heading), FlyMode3); + NPC* npc = new NPC(tmp, nullptr, position, FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) diff --git a/zone/questmgr.h b/zone/questmgr.h index d001beab4..072fceb31 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -56,7 +56,7 @@ public: void me(const char *str); void summonitem(uint32 itemid, int16 charges = -1); void write(const char *file, const char *str); - Mob* spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading); + Mob* spawn2(int npc_type, int grid, int unused, const xyz_heading& position); Mob* unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading = 0); Mob* spawn_from_spawn2(uint32 spawn2_id); void enable_spawn2(uint32 spawn2_id); From 4daf4ab50785ebee4e8af656359aa9536abed44d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 14:36:51 -0800 Subject: [PATCH 0477/1883] QuestManager::unique_spawn converted to xyz_heading --- zone/embparser_api.cpp | 3 ++- zone/lua_general.cpp | 4 ++-- zone/questmgr.cpp | 4 ++-- zone/questmgr.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 45086093c..034c9e80e 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -269,7 +269,8 @@ XS(XS__unique_spawn) if(items == 7) heading = (float)SvNV(ST(6)); - Mob *r = quest_manager.unique_spawn(npc_type, grid, unused, x, y, z, heading); + + Mob *r = quest_manager.unique_spawn(npc_type, grid, unused, xyz_heading(x, y, z, heading)); RETVAL = (r != nullptr) ? r->GetID() : 0; XSprePUSH; PUSHu((UV)RETVAL); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 915efe780..99e802c24 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -256,8 +256,8 @@ Lua_Mob lua_spawn2(int npc_type, int grid, int unused, double x, double y, doubl } Lua_Mob lua_unique_spawn(int npc_type, int grid, int unused, double x, double y, double z, double heading = 0.0) { - return Lua_Mob(quest_manager.unique_spawn(npc_type, grid, unused, - static_cast(x), static_cast(y), static_cast(z), static_cast(heading))); + auto position = xyz_heading(x,y,z,heading); + return Lua_Mob(quest_manager.unique_spawn(npc_type, grid, unused, position)); } Lua_Mob lua_spawn_from_spawn2(uint32 spawn2_id) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 48c94f1cc..3ced16e87 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -258,7 +258,7 @@ Mob* QuestManager::spawn2(int npc_type, int grid, int unused, const xyz_heading& return nullptr; } -Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading) { +Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, const xyz_heading& position) { Mob *other = entity_list.GetMobByNpcTypeID(npc_type); if(other != nullptr) { return other; @@ -267,7 +267,7 @@ Mob* QuestManager::unique_spawn(int npc_type, int grid, int unused, float x, flo const NPCType* tmp = 0; if (tmp = database.GetNPCType(npc_type)) { - NPC* npc = new NPC(tmp, nullptr, xyz_heading(x, y, z, heading), FlyMode3); + NPC* npc = new NPC(tmp, nullptr, position, FlyMode3); npc->AddLootTable(); entity_list.AddNPC(npc,true,true); if(grid > 0) diff --git a/zone/questmgr.h b/zone/questmgr.h index 072fceb31..a46b7adcd 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -57,7 +57,7 @@ public: void summonitem(uint32 itemid, int16 charges = -1); void write(const char *file, const char *str); Mob* spawn2(int npc_type, int grid, int unused, const xyz_heading& position); - Mob* unique_spawn(int npc_type, int grid, int unused, float x, float y, float z, float heading = 0); + Mob* unique_spawn(int npc_type, int grid, int unused, const xyz_heading& position); Mob* spawn_from_spawn2(uint32 spawn2_id); void enable_spawn2(uint32 spawn2_id); void disable_spawn2(uint32 spawn2_id); From f6c98132f08a08a5cdd71682e6dbcf0c6cfbe1c3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 14:50:48 -0800 Subject: [PATCH 0478/1883] SummonAllCorpses converted to xyz_heading --- zone/client.cpp | 17 +++++------------ zone/client.h | 2 +- zone/questmgr.cpp | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 02c35feaa..4bde10bc0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4942,13 +4942,11 @@ void Client::SummonAndRezzAllCorpses() Message(clientMessageYellow, "All your corpses have been summoned to your feet and have received a 100% resurrection."); } -void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float dest_heading) +void Client::SummonAllCorpses(const xyz_heading& position) { - - if(dest_x == 0 && dest_y == 0 && dest_z == 0 && dest_heading == 0) - { - dest_x = GetX(); dest_y = GetY(); dest_z = GetZ(); dest_heading = GetHeading(); - } + auto summonLocation = position; + if(position.m_X == 0.0f && position.m_Y == 0.0f && position.m_Z == 0.0f && position.m_Heading == 0.0f) + summonLocation = GetPosition(); ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); @@ -4964,12 +4962,7 @@ void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float de entity_list.RemoveAllCorpsesByCharID(CharacterID()); - int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), - xyz_heading(dest_x, dest_y, dest_z, dest_heading)); - if(CorpseCount <= 0) - { - return; - } + database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(), summonLocation); } void Client::DepopAllCorpses() diff --git a/zone/client.h b/zone/client.h index caec8513d..b39777046 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1026,7 +1026,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void DoItemEnterZone(); bool DoItemEnterZone(uint32 slot_x, uint32 slot_y); // behavior change: 'slot_y' is now [RANGE]_END and not [RANGE]_END + 1 void SummonAndRezzAllCorpses(); - void SummonAllCorpses(float dest_x, float dest_y, float dest_z, float dest_heading); + void SummonAllCorpses(const xyz_heading& position); void DepopAllCorpses(); void DepopPlayerCorpse(uint32 dbid); void BuryPlayerCorpses(); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 3ced16e87..d49528163 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1753,7 +1753,7 @@ bool QuestManager::summonallplayercorpses(uint32 char_id, const xyz_heading& pos return false; Client* c = entity_list.GetClientByCharID(char_id); - c->SummonAllCorpses(position.m_X, position.m_Y, position.m_Z, position.m_Heading); + c->SummonAllCorpses(position); return true; } From eb6c963c70bb9ab6750537b9ca5adb43320a39ef Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 15:04:13 -0800 Subject: [PATCH 0479/1883] SummonAllGraveyardCorpses converted to xyz_heading --- zone/zonedb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zonedb.h b/zone/zonedb.h index e66448a47..ed2988048 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -304,7 +304,7 @@ public: bool BuryAllCharacterCorpses(uint32 charid); bool DeleteCharacterCorpse(uint32 dbid); bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); - bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading); + bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); From 361b4d1c62bb4d05db7a331e7317b8749fd88c0e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 15:18:16 -0800 Subject: [PATCH 0480/1883] UnburyCharacterCorpse converted to xyz_heading --- zone/zonedb.cpp | 19 +++++++++++-------- zone/zonedb.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 239608473..f54846185 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3796,7 +3796,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z entity_list.AddCorpse(corpse); corpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); corpse->Spawn(); - if (!UnburyCharacterCorpse(corpse->GetDBID(), dest_zone_id, dest_instance_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading)) + if (!UnburyCharacterCorpse(corpse->GetDBID(), dest_zone_id, dest_instance_id, position)) LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } @@ -3842,15 +3842,18 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id return (CorpseCount > 0); } -bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint16 new_instance_id, float new_x, float new_y, float new_z, float new_heading) { - std::string query = StringFormat( - "UPDATE `character_corpses` SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, `x` = %f, `y` = %f, `z` = %f, `heading` = %f, `time_of_death` = Now(), `was_at_graveyard` = 0 WHERE `id` = %u", - new_zone_id, new_instance_id, new_x, new_y, new_z, new_heading, db_id - ); +bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint16 new_instance_id, const xyz_heading& position) { + std::string query = StringFormat("UPDATE `character_corpses` " + "SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, " + "`x` = %f, `y` = %f, `z` = %f, `heading` = %f, " + "`time_of_death` = Now(), `was_at_graveyard` = 0 " + "WHERE `id` = %u", + new_zone_id, new_instance_id, + position.m_X, position.m_Y, position.m_Z, position.m_Heading, db_id); auto results = QueryDatabase(query); - if (results.Success() && results.RowsAffected() != 0){ + if (results.Success() && results.RowsAffected() != 0) return true; - } + return false; } diff --git a/zone/zonedb.h b/zone/zonedb.h index ed2988048..b126efef4 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -305,7 +305,7 @@ public: bool DeleteCharacterCorpse(uint32 dbid); bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, const xyz_heading& position); - bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading); + bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, const xyz_heading& position); bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID); bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id); From d22f136eeae667f68b81302cd934caa35aadc412 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 15:27:43 -0800 Subject: [PATCH 0481/1883] SendCharacterCorpseToGraveyard to xyz_heading --- zone/corpse.cpp | 4 ++-- zone/zonedb.cpp | 14 +++++++------- zone/zonedb.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8f8d6a4e1..8b8cfef14 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -769,8 +769,8 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), - (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->graveyard_x(), - zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading()); + (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, xyz_heading(zone->graveyard_x(), + zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading())); corpse_graveyard_timer.Disable(); ServerPacket* pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)); SpawnPlayerCorpse_Struct* spc = (SpawnPlayerCorpse_Struct*)pack->pBuffer; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index f54846185..4fec05758 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3352,13 +3352,13 @@ uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, float grave } return 0; } -uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, float x, float y, float z, float heading) { - std::string query = StringFormat( - "UPDATE `character_corpses` " - "SET `zone_id` = %u, `instance_id` = 0, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, `was_at_graveyard` = 1 " - "WHERE `id` = %d", - zone_id, x, y, z, heading, dbid - ); +uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, const xyz_heading& position) { + std::string query = StringFormat("UPDATE `character_corpses` " + "SET `zone_id` = %u, `instance_id` = 0, " + "`x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, " + "`was_at_graveyard` = 1 " + "WHERE `id` = %d", + zone_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading, dbid); QueryDatabase(query); return dbid; } diff --git a/zone/zonedb.h b/zone/zonedb.h index b126efef4..e72670e83 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -310,7 +310,7 @@ public: bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id); uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id); uint32 GetCharacterBuriedCorpseCount(uint32 char_id); - uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading); + uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, const xyz_heading& position); uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading); From 76210e1f0e41afb25c98c7db10ece80346fd3ffe Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 15:42:30 -0800 Subject: [PATCH 0482/1883] CreateGraveyardRecord converted to xyz_heading --- zone/command.cpp | 2 +- zone/zonedb.cpp | 13 ++++++------- zone/zonedb.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 030ce7de5..0841149f2 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -8459,7 +8459,7 @@ void command_setgraveyard(Client *c, const Seperator *sep) zoneid = database.GetZoneID(sep->arg[1]); if(zoneid > 0) { - graveyard_id = database.CreateGraveyardRecord(zoneid, t->GetX(), t->GetY(), t->GetZ(), t->GetHeading()); + graveyard_id = database.CreateGraveyardRecord(zoneid, t->GetPosition()); if(graveyard_id > 0) { c->Message(0, "Successfuly added a new record for this graveyard!"); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 4fec05758..a49ea0b98 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3341,15 +3341,14 @@ uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) { return zone_id; } -uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) { - std::string query = StringFormat( - "INSERT INTO `graveyard` SET `zone_id` = %u, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f", - graveyard_zone_id, graveyard_x, graveyard_y, graveyard_z, graveyard_heading - ); +uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, const xyz_heading& position) { + std::string query = StringFormat("INSERT INTO `graveyard` " + "SET `zone_id` = %u, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f", + graveyard_zone_id, position.m_X, position.m_Y, position.m_Z, position.m_Heading); auto results = QueryDatabase(query); - if (results.Success()){ + if (results.Success()) return results.LastInsertedID(); - } + return 0; } uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, const xyz_heading& position) { diff --git a/zone/zonedb.h b/zone/zonedb.h index e72670e83..53fd89584 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -311,7 +311,7 @@ public: uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id); uint32 GetCharacterBuriedCorpseCount(uint32 char_id); uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, const xyz_heading& position); - uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading); + uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, const xyz_heading& position); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading); uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false); From 4243ce8582fbb93ab4e21daaf127564852286039 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 16:02:12 -0800 Subject: [PATCH 0483/1883] SaveCharacterCorpse converted to xyz_heading --- zone/corpse.cpp | 2 +- zone/zonedb.cpp | 112 +++++++++++------------------------------------- zone/zonedb.h | 2 +- 3 files changed, 27 insertions(+), 89 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8b8cfef14..c75725179 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -590,7 +590,7 @@ bool Corpse::Save() { /* Create New Corpse*/ if (corpse_db_id == 0) { - corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading); + corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position); } /* Update Corpse Data */ else{ diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a49ea0b98..7859301dd 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3469,94 +3469,32 @@ void ZoneDatabase::MarkCorpseAsRezzed(uint32 db_id) { auto results = QueryDatabase(query); } -uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading) { +uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position) { /* Dump Basic Corpse Data */ - std::string query = StringFormat("INSERT INTO `character_corpses` SET \n" - "`charname` = '%s',\n" - "`zone_id` = %u,\n" - "`instance_id` = %u,\n" - "`charid` = %d,\n" - "`x` = %1.1f,\n" - "`y` = %1.1f,\n" - "`z` = %1.1f,\n" - "`heading` = %1.1f,\n" - "`time_of_death` = NOW(),\n" - "`is_buried` = 0," - "`is_locked` = %d,\n" - "`exp` = %u,\n" - "`size` = %f,\n" - "`level` = %u,\n" - "`race` = %u,\n" - "`gender` = %u,\n" - "`class` = %u,\n" - "`deity` = %u,\n" - "`texture` = %u,\n" - "`helm_texture` = %u,\n" - "`copper` = %u,\n" - "`silver` = %u,\n" - "`gold` = %u,\n" - "`platinum` = %u,\n" - "`hair_color` = %u,\n" - "`beard_color` = %u,\n" - "`eye_color_1` = %u,\n" - "`eye_color_2` = %u,\n" - "`hair_style` = %u,\n" - "`face` = %u,\n" - "`beard` = %u,\n" - "`drakkin_heritage` = %u,\n" - "`drakkin_tattoo` = %u,\n" - "`drakkin_details` = %u,\n" - "`wc_1` = %u,\n" - "`wc_2` = %u,\n" - "`wc_3` = %u,\n" - "`wc_4` = %u,\n" - "`wc_5` = %u,\n" - "`wc_6` = %u,\n" - "`wc_7` = %u,\n" - "`wc_8` = %u,\n" - "`wc_9` = %u \n", - EscapeString(charname).c_str(), - zoneid, - instanceid, - charid, - x, - y, - z, - heading, - dbpc->locked, - dbpc->exp, - dbpc->size, - dbpc->level, - dbpc->race, - dbpc->gender, - dbpc->class_, - dbpc->deity, - dbpc->texture, - dbpc->helmtexture, - dbpc->copper, - dbpc->silver, - dbpc->gold, - 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 - ); + std::string query = StringFormat("INSERT INTO `character_corpses` " + "SET `charname` = '%s', `zone_id` = %u, `instance_id` = %u, `charid` = %d," + "`x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f," + "`time_of_death` = NOW(), `is_buried` = 0, `is_locked` = %d," + "`exp` = %u, `size` = %f, `level` = %u, `race` = %u, `gender` = %u," + "`class` = %u, `deity` = %u, `texture` = %u, `helm_texture` = %u," + "`copper` = %u, `silver` = %u,`gold` = %u,`platinum` = %u," + "`hair_color` = %u, `beard_color` = %u, `eye_color_1` = %u," + "`eye_color_2` = %u, `hair_style` = %u, `face` = %u," + "`beard` = %u, `drakkin_heritage` = %u, `drakkin_tattoo` = %u," + "`drakkin_details` = %u, `wc_1` = %u, `wc_2` = %u," + "`wc_3` = %u, `wc_4` = %u, `wc_5` = %u, `wc_6` = %u," + "`wc_7` = %u,`wc_8` = %u,`wc_9` = %u", + EscapeString(charname).c_str(), zoneid, instanceid, charid, + position.m_X, position.m_Y, position.m_Z, position.m_Heading, + dbpc->locked, dbpc->exp, dbpc->size, dbpc->level, dbpc->race, + dbpc->gender, dbpc->class_, dbpc->deity, dbpc->texture, + dbpc->helmtexture, dbpc->copper, dbpc->silver, dbpc->gold, + 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); auto results = QueryDatabase(query); uint32 last_insert_id = results.LastInsertedID(); diff --git a/zone/zonedb.h b/zone/zonedb.h index 53fd89584..a50c5d189 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -313,7 +313,7 @@ public: uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, const xyz_heading& position); uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, const xyz_heading& position); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); - uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading); + uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position); uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false); uint32 GetFirstCorpseID(uint32 char_id); uint32 GetCharacterCorpseCount(uint32 char_id); From 275f2aa80fee8889ec0f5c9610e59a4c71a14d07 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 16:21:20 -0800 Subject: [PATCH 0484/1883] UpdateCharacterCorpse converted to xyz_heading --- zone/corpse.cpp | 2 +- zone/zonedb.cpp | 113 +++++++++++------------------------------------- zone/zonedb.h | 2 +- 3 files changed, 28 insertions(+), 89 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index c75725179..c37b2cde3 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -594,7 +594,7 @@ bool Corpse::Save() { } /* Update Corpse Data */ else{ - corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, IsRezzed()); + corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, m_Position, IsRezzed()); } safe_delete_array(dbpc); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7859301dd..a59223f68 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3372,93 +3372,32 @@ uint32 ZoneDatabase::GetCharacterCorpseDecayTimer(uint32 corpse_db_id){ return 0; } -uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) { - std::string query = StringFormat("UPDATE `character_corpses` SET \n" - "`charname` = '%s',\n" - "`zone_id` = %u,\n" - "`instance_id` = %u,\n" - "`charid` = %d,\n" - "`x` = %1.1f,\n" - "`y` = %1.1f,\n" - "`z` = %1.1f,\n" - "`heading` = %1.1f,\n" - "`is_locked` = %d,\n" - "`exp` = %u,\n" - "`size` = %f,\n" - "`level` = %u,\n" - "`race` = %u,\n" - "`gender` = %u,\n" - "`class` = %u,\n" - "`deity` = %u,\n" - "`texture` = %u,\n" - "`helm_texture` = %u,\n" - "`copper` = %u,\n" - "`silver` = %u,\n" - "`gold` = %u,\n" - "`platinum` = %u,\n" - "`hair_color` = %u,\n" - "`beard_color` = %u,\n" - "`eye_color_1` = %u,\n" - "`eye_color_2` = %u,\n" - "`hair_style` = %u,\n" - "`face` = %u,\n" - "`beard` = %u,\n" - "`drakkin_heritage` = %u,\n" - "`drakkin_tattoo` = %u,\n" - "`drakkin_details` = %u,\n" - "`wc_1` = %u,\n" - "`wc_2` = %u,\n" - "`wc_3` = %u,\n" - "`wc_4` = %u,\n" - "`wc_5` = %u,\n" - "`wc_6` = %u,\n" - "`wc_7` = %u,\n" - "`wc_8` = %u,\n" - "`wc_9` = %u \n" - "WHERE `id` = %u", - EscapeString(char_name).c_str(), - zone_id, - instance_id, - char_id, - x, - y, - z, - heading, - dbpc->locked, - dbpc->exp, - dbpc->size, - dbpc->level, - dbpc->race, - dbpc->gender, - dbpc->class_, - dbpc->deity, - dbpc->texture, - dbpc->helmtexture, - dbpc->copper, - dbpc->silver, - dbpc->gold, - 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, - db_id - ); +uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, const xyz_heading& position, bool is_rezzed) { + std::string query = StringFormat("UPDATE `character_corpses` " + "SET `charname` = '%s', `zone_id` = %u, `instance_id` = %u, `charid` = %d, " + "`x` = %1.1f,`y` = %1.1f,`z` = %1.1f, `heading` = %1.1f, " + "`is_locked` = %d, `exp` = %u, `size` = %f, `level` = %u, " + "`race` = %u, `gender` = %u, `class` = %u, `deity` = %u, " + "`texture` = %u, `helm_texture` = %u, `copper` = %u, " + "`silver` = %u, `gold` = %u, `platinum` = %u, `hair_color` = %u, " + "`beard_color` = %u, `eye_color_1` = %u, `eye_color_2` = %u, " + "`hair_style` = %u, `face` = %u, `beard` = %u, `drakkin_heritage` = %u, " + "`drakkin_tattoo` = %u, `drakkin_details` = %u, `wc_1` = %u, " + "`wc_2` = %u, `wc_3` = %u, `wc_4` = %u, `wc_5` = %u, `wc_6` = %u, " + "`wc_7` = %u, `wc_8` = %u, `wc_9` = %u " + "WHERE `id` = %u", + EscapeString(char_name).c_str(), zone_id, instance_id, char_id, + position.m_X, position.m_Y, position.m_Z, position.m_Heading, + dbpc->locked, dbpc->exp, dbpc->size, dbpc->level, dbpc->race, + dbpc->gender, dbpc->class_, dbpc->deity, dbpc->texture, + dbpc->helmtexture, dbpc->copper, dbpc->silver, dbpc->gold, + 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, + db_id); auto results = QueryDatabase(query); return db_id; diff --git a/zone/zonedb.h b/zone/zonedb.h index a50c5d189..7fadaf6cf 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -314,7 +314,7 @@ public: uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, const xyz_heading& position); uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id); uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position); - uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false); + uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, const xyz_heading& position, bool rezzed = false); uint32 GetFirstCorpseID(uint32 char_id); uint32 GetCharacterCorpseCount(uint32 char_id); uint32 GetCharacterCorpseID(uint32 char_id, uint8 corpse); From cafa266c89a16b3245118d18a4720e7c0d0f7a2a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 16:42:19 -0800 Subject: [PATCH 0485/1883] UpdateZoneSafeCoords converted to xyz_heading --- zone/zonedb.cpp | 5 +++-- zone/zonedb.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a59223f68..029726bef 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2471,10 +2471,11 @@ void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ } -bool ZoneDatabase::UpdateZoneSafeCoords(const char* zonename, float x=0, float y=0, float z=0) { +bool ZoneDatabase::UpdateZoneSafeCoords(const char* zonename, const xyz_location& location) { std::string query = StringFormat("UPDATE zone SET safe_x='%f', safe_y='%f', safe_z='%f' " - "WHERE short_name='%s';", x, y, z, zonename); + "WHERE short_name='%s';", + location.m_X, location.m_Y, location.m_Z, zonename); auto results = QueryDatabase(query); if (!results.Success() || results.RowsAffected() == 0) return false; diff --git a/zone/zonedb.h b/zone/zonedb.h index 7fadaf6cf..f89bb5865 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -345,7 +345,7 @@ public: bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, uint8 &zone_type, int &ruleset, char **map_filename); bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd); bool LoadStaticZonePoints(LinkedList* zone_point_list,const char* zonename, uint32 version); - bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z); + bool UpdateZoneSafeCoords(const char* zonename, const xyz_location& location); uint8 GetUseCFGSafeCoords(); int getZoneShutDownDelay(uint32 zoneID, uint32 version); From 2da6dfa9313a450e586100b03bfbc41a188ce883 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 16:53:52 -0800 Subject: [PATCH 0486/1883] CreateSpawn2 converted to xyz_heading --- zone/command.cpp | 2 +- zone/spawn2.cpp | 4 ++-- zone/zonedb.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 0841149f2..47cdbd754 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1980,7 +1980,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) if(sep->IsNumber(5)) cond_min = atoi(sep->arg[5]); } - database.CreateSpawn2(c, atoi(sep->arg[1]), zone->GetShortName(), c->GetHeading(), c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[2]), atoi(sep->arg[3]), cond, cond_min); + database.CreateSpawn2(c, atoi(sep->arg[1]), zone->GetShortName(), c->GetPosition(), atoi(sep->arg[2]), atoi(sep->arg[3]), cond, cond_min); } else { c->Message(0, "Usage: #dbspawn2 spawngroup respawn variance [condition_id] [condition_min]"); diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 1e973ebc7..f052980b7 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -413,13 +413,13 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 return newSpawn; } -bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value) +bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* zone, const xyz_heading& position, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value) { std::string query = StringFormat("INSERT INTO spawn2 (spawngroupID, zone, x, y, z, heading, " "respawntime, variance, _condition, cond_value) " "VALUES (%i, '%s', %f, %f, %f, %f, %i, %i, %u, %i)", - spawngroup, zone, x, y, z, heading, + spawngroup, zone, position.m_X, position.m_Y, position.m_Z, position.m_Heading, respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { diff --git a/zone/zonedb.h b/zone/zonedb.h index f89bb5865..877bc26c9 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -354,7 +354,7 @@ public: bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list); bool PopulateZoneSpawnList(uint32 zoneid, LinkedList &spawn2_list, int16 version, uint32 repopdelay = 0); Spawn2* LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2id, uint32 timeleft); - bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value); + bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, const xyz_heading& position, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value); void UpdateSpawn2Timeleft(uint32 id, uint16 instance_id,uint32 timeleft); uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id); void UpdateSpawn2Status(uint32 id, uint8 new_status); From 6206133729302593f7b8e1aceae3fc9319f5b517 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 17:41:01 -0800 Subject: [PATCH 0487/1883] AddWP converted to xyz_heading --- zone/command.cpp | 6 ++++-- zone/waypoints.cpp | 4 ++-- zone/zonedb.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 47cdbd754..b47ec1fac 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2059,10 +2059,12 @@ void command_wp(Client *c, const Seperator *sep) if (wp == 0) //default to highest if it's left blank, or we enter 0 wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2])) + 1; if (strcasecmp("-h",sep->arg[5]) == 0) { - database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID(), c->GetHeading()); + database.AddWP(c, atoi(sep->arg[2]),wp, c->GetPosition(), atoi(sep->arg[3]),zone->GetZoneID()); } else { - database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID(), -1); + auto position = c->GetPosition(); + position.m_Heading = -1; + database.AddWP(c, atoi(sep->arg[2]),wp, position, atoi(sep->arg[3]),zone->GetZoneID()); } } else if (strcasecmp("delete",sep->arg[1]) == 0) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index b36f63106..a8b123fc3 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1168,11 +1168,11 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type /************************************** * AddWP - Adds a new waypoint to a specific grid for a specific zone. */ -void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading) +void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, const xyz_heading& position, uint32 pause, uint16 zoneid) { std::string query = StringFormat("INSERT INTO grid_entries (gridid, zoneid, `number`, x, y, z, pause, heading) " "VALUES (%i, %i, %i, %f, %f, %f, %i, %f)", - gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); + gridid, zoneid, wpnum, position.m_X, position.m_Y, position.m_Z, pause, position.m_Heading); auto results = QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); diff --git a/zone/zonedb.h b/zone/zonedb.h index 877bc26c9..832ad9f4b 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -363,7 +363,7 @@ public: uint32 GetFreeGrid(uint16 zoneid); void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too, uint16 zoneid); void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid); - void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading); + void AddWP(Client *c, uint32 gridid, uint32 wpnum, const xyz_heading& position, uint32 pause, uint16 zoneid); uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0); void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0); From e58dc94b2cb16f35c8dedd0f220706e0d1dfbb1b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 18:15:51 -0800 Subject: [PATCH 0488/1883] AddWPForSpawn converted to xyz_heading --- zone/command.cpp | 11 ++++++----- zone/waypoints.cpp | 4 ++-- zone/zonedb.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b47ec1fac..bd1626f85 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5635,8 +5635,7 @@ void command_wpadd(Client *c, const Seperator *sep) { int type1=0, type2=0, - pause=0, - heading=-1; // Defaults for a new grid + pause=0; // Defaults for a new grid Mob *t=c->GetTarget(); if (t && t->IsNPC()) @@ -5659,9 +5658,11 @@ void command_wpadd(Client *c, const Seperator *sep) return; } } - if (strcmp("-h",sep->arg[2]) == 0) - heading = c->GetHeading(); - uint32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), c->GetX(),c->GetY(),c->GetZ(), pause, type1, type2, zone->GetZoneID(), heading); + auto position = c->GetPosition(); + if (strcmp("-h",sep->arg[2]) != 0) + position.m_Heading = -1; + + uint32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), position, pause, type1, type2, zone->GetZoneID()); if (tmp_grid) t->CastToNPC()->SetGrid(tmp_grid); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index a8b123fc3..bd012daca 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1217,7 +1217,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num * Returns 0 if the function didn't have to create a new grid. If the function had to create a new grid for the spawn, then the ID of * the created grid is returned. */ -uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading) { +uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, const xyz_heading& position, uint32 pause, int type1, int type2, uint16 zoneid) { uint32 grid_num; // The grid number the spawn is assigned to (if spawn has no grid, will be the grid number we end up creating) uint32 next_wp_num; // The waypoint number we should be assigning to the new waypoint @@ -1280,7 +1280,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, query = StringFormat("INSERT INTO grid_entries(gridid, zoneid, `number`, x, y, z, pause, heading) " "VALUES (%i, %i, %i, %f, %f, %f, %i, %f)", - grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); + grid_num, zoneid, next_wp_num, position.m_X, position.m_Y, position.m_Z, pause, position.m_Heading); results = QueryDatabase(query); if(!results.Success()) LogFile->write(EQEMuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); diff --git a/zone/zonedb.h b/zone/zonedb.h index 832ad9f4b..4a563f2b9 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -364,7 +364,7 @@ public: void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too, uint16 zoneid); void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid); void AddWP(Client *c, uint32 gridid, uint32 wpnum, const xyz_heading& position, uint32 pause, uint16 zoneid); - uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading); + uint32 AddWPForSpawn(Client *c, uint32 spawn2id, const xyz_heading& position, uint32 pause, int type1, int type2, uint16 zoneid); void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0); void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0); uint8 GetGridType(uint32 grid, uint32 zoneid); From 2b7ecfdb2c821d3dc5568a2eaa8b7326eca0643e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 18:24:56 -0800 Subject: [PATCH 0489/1883] ModifyWP converted to xyz_location --- zone/zonedb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zonedb.h b/zone/zonedb.h index 4a563f2b9..f196e5127 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -366,7 +366,7 @@ public: void AddWP(Client *c, uint32 gridid, uint32 wpnum, const xyz_heading& position, uint32 pause, uint16 zoneid); uint32 AddWPForSpawn(Client *c, uint32 spawn2id, const xyz_heading& position, uint32 pause, int type1, int type2, uint16 zoneid); void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0); - void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0); + void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, const xyz_location& location, uint32 script = 0, uint16 zoneid = 0); uint8 GetGridType(uint32 grid, uint32 zoneid); uint8 GetGridType2(uint32 grid, uint16 zoneid); bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); From ad506ece4db72eb3e023f00648420709cf7379ec Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 19:28:28 -0800 Subject: [PATCH 0490/1883] Added distance functions for position --- zone/command.cpp | 10 +-------- zone/position.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++--- zone/position.h | 14 +++++++++--- zone/waypoints.cpp | 12 +++++----- zone/zonedb.h | 2 +- 5 files changed, 70 insertions(+), 23 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index bd1626f85..31cc9aa19 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1799,15 +1799,7 @@ void command_itemtest(Client *c, const Seperator *sep) void command_gassign(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && c->GetTarget() && c->GetTarget()->IsNPC()) - { - auto npcBind = c->GetTarget()->CastToNPC()->m_SpawnPoint; - database.AssignGrid( - c, - npcBind.m_X, - npcBind.m_Y, - atoi(sep->arg[1]) - ); - } + database.AssignGrid(c, c->GetTarget()->CastToNPC()->m_SpawnPoint, atoi(sep->arg[1])); else c->Message(0,"Usage: #gassign [num] - must have an npc target!"); } diff --git a/zone/position.cpp b/zone/position.cpp index 6f9a31d29..ddbe429af 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -9,11 +9,16 @@ xy_location::xy_location(float x, float y) : m_Y(y) { } -const xy_location xy_location::operator -(const xy_location& rhs) { +xy_location xy_location::operator -(const xy_location& rhs) const { xy_location minus(m_X - rhs.m_X, m_Y - rhs.m_Y); return minus; } +xy_location xy_location::operator +(const xy_location& rhs) const { + xy_location addition(m_X + rhs.m_X, m_Y + rhs.m_Y); + return addition; +} + xyz_heading::xyz_heading(float x, float y, float z, float heading) : m_X(x), m_Y(y), @@ -91,11 +96,11 @@ xyz_location::operator xy_location() const { return xy_location(m_X, m_Y); } -const xyz_location xyz_location::operator -(const xyz_location& rhs) const { +xyz_location xyz_location::operator -(const xyz_location& rhs) const { return xyz_location(m_X - rhs.m_X, m_Y - rhs.m_Y, m_Z - rhs.m_Z); } -const xyz_location xyz_location::operator +(const xyz_location& rhs) const { +xyz_location xyz_location::operator +(const xyz_location& rhs) const { return xyz_location(m_X + rhs.m_X, m_Y + rhs.m_Y, m_Z + rhs.m_Z); } @@ -117,6 +122,50 @@ std::string to_string(const xy_location &position){ return StringFormat("(%.3f, %.3f)", position.m_X,position.m_Y); } +/** +* Produces the non square root'ed distance between the two points within the XY plane. +*/ +float ComparativeDistance(const xy_location& point1, const xy_location& point2) { + auto diff = point1 - point2; + return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y; +} + +/** +* Produces the distance between the two points on the XY plane. +*/ +float Distance(const xy_location& point1, const xy_location& point2) { + return sqrt(ComparativeDistance(point1, point2)); +} + +/** +* Produces the non square root'ed distance between the two points. +*/ +float ComparativeDistance(const xyz_location& point1, const xyz_location& point2) { + auto diff = point1 - point2; + return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z; +} + +/** +* Produces the distance between the two points. +*/ +float Distance(const xyz_location& point1, const xyz_location& point2) { + return sqrt(ComparativeDistance(point1, point2)); +} + +/** +* Produces the distance between the two points within the XY plane. +*/ +float DistanceNoZ(const xyz_location& point1, const xyz_location& point2) { + return Distance(static_cast(point1),static_cast(point2)); +} + +/** +* Produces the non square root'ed distance between the two points within the XY plane. +*/ +float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2) { + return ComparativeDistance(static_cast(point1),static_cast(point2)); +} + /** * Determines if 'position' is within (inclusive) the axis aligned * box (3 dimensional) formed from the points minimum and maximum. diff --git a/zone/position.h b/zone/position.h index 77c09603e..fd66ede5f 100644 --- a/zone/position.h +++ b/zone/position.h @@ -27,7 +27,8 @@ public: xy_location(float x = 0.0f, float y = 0.0f); - const xy_location operator -(const xy_location& rhs); + xy_location operator -(const xy_location& rhs) const; + xy_location operator +(const xy_location& rhs) const; }; class xyz_location { @@ -43,8 +44,8 @@ public: operator xy_location() const; - const xyz_location operator -(const xyz_location& rhs) const; - const xyz_location operator +(const xyz_location& rhs) const; + xyz_location operator -(const xyz_location& rhs) const; + xyz_location operator +(const xyz_location& rhs) const; void ABS_XYZ(); bool isOrigin() const { return m_X == 0 && m_Y == 0 && m_Z == 0;} @@ -86,4 +87,11 @@ std::string to_string(const xy_location &position); bool IsWithinAxisAlignedBox(const xyz_location &position, const xyz_location &minimum, const xyz_location &maximum); bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &minimum, const xy_location &maximum); +float ComparativeDistance(const xy_location& point1, const xy_location& point2); +float Distance(const xy_location& point1, const xy_location& point2); +float ComparativeDistance(const xyz_location& point1, const xyz_location& point2); +float Distance(const xyz_location& point1, const xyz_location& point2); +float DistanceNoZ(const xyz_location& point1, const xyz_location& point2); +float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2); + #endif diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index bd012daca..12a81254e 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1046,15 +1046,14 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* return true; } -void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) +void ZoneDatabase::AssignGrid(Client *client, const xy_location& location, uint32 grid) { int matches = 0, fuzzy = 0, spawn2id = 0; - float dbx = 0, dby = 0; // looks like most of the stuff in spawn2 is straight integers // so let's try that first std::string query = StringFormat("SELECT id, x, y FROM spawn2 WHERE zone = '%s' AND x = %i AND y = %i", - zone->GetShortName(), (int)x, (int)y); + zone->GetShortName(), (int)location.m_X, (int)location.m_Y); auto results = QueryDatabase(query); if(!results.Success()) { LogFile->write(EQEMuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); @@ -1068,7 +1067,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) query = StringFormat("SELECT id,x,y FROM spawn2 WHERE zone='%s' AND " "ABS( ABS(x) - ABS(%f) ) < %f AND " "ABS( ABS(y) - ABS(%f) ) < %f", - zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); + zone->GetShortName(), location.m_X, _GASSIGN_TOLERANCE, location.m_Y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { LogFile->write(EQEMuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); @@ -1094,8 +1093,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) auto row = results.begin(); spawn2id = atoi(row[0]); - dbx = atof(row[1]); - dby = atof(row[2]); + xy_location dbLocation = xy_location(atof(row[1]), atof(row[2])); query = StringFormat("UPDATE spawn2 SET pathgrid = %d WHERE id = %d", grid, spawn2id); results = QueryDatabase(query); @@ -1120,7 +1118,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) return; } - float difference = sqrtf(pow(fabs(x - dbx) , 2) + pow(fabs(y - dby), 2)); + float difference = sqrtf(pow(fabs(location.m_X - dbLocation.m_X) , 2) + pow(fabs(location.m_Y - dbLocation.m_Y), 2)); client->Message(0, "Grid assign: spawn2 id = %d updated - fuzzy match: deviation %f", spawn2id, difference); } diff --git a/zone/zonedb.h b/zone/zonedb.h index f196e5127..9e0d50e3f 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -370,7 +370,7 @@ public: uint8 GetGridType(uint32 grid, uint32 zoneid); uint8 GetGridType2(uint32 grid, uint16 zoneid); bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp); - void AssignGrid(Client *client, float x, float y, uint32 id); + void AssignGrid(Client *client, const xy_location& location, uint32 id); int GetHighestGrid(uint32 zoneid); int GetHighestWaypoint(uint32 zoneid, uint32 gridid); From 7c211e1e1150d521082d558ac621cdb61cd83e26 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 19:29:43 -0800 Subject: [PATCH 0491/1883] simplified SummonAllCorpses --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 4bde10bc0..826e22b00 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4945,7 +4945,7 @@ void Client::SummonAndRezzAllCorpses() void Client::SummonAllCorpses(const xyz_heading& position) { auto summonLocation = position; - if(position.m_X == 0.0f && position.m_Y == 0.0f && position.m_Z == 0.0f && position.m_Heading == 0.0f) + if(position.isOrigin() && position.m_Heading == 0.0f) summonLocation = GetPosition(); ServerPacket *Pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); From 75c1a302c978eb89b9e66f46ade278420b562c5e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 19:38:15 -0800 Subject: [PATCH 0492/1883] Converted Corpse constructor to xyz_heading --- zone/corpse.cpp | 13 +++++-------- zone/corpse.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index c37b2cde3..205eddf83 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -90,10 +90,7 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_ pcs->silver, // uint32 in_silver pcs->gold, // uint32 in_gold pcs->plat, // uint32 in_plat - position.m_X, // float in_x - position.m_Y, // float in_y - position.m_Z, // float in_z - position.m_Heading, // float in_heading + position, pcs->size, // float in_size pcs->gender, // uint8 in_gender pcs->race, // uint16 in_race @@ -423,7 +420,7 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 // To be called from LoadFromDBData // Mongrel: added see_invis and see_invis_undead -Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) +Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, const xyz_heading& position, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard) : Mob("Unnamed_Corpse", "", 0, @@ -437,7 +434,7 @@ in_level, 0, in_size, 0, -xyz_heading(in_x, in_y,in_z,in_heading), +position, 0, in_texture, in_helmtexture, @@ -503,9 +500,9 @@ in_helmtexture, this->platinum = in_plat; rezzexp = in_rezexp; - for (int i = 0; i < MAX_LOOTERS; i++){ + for (int i = 0; i < MAX_LOOTERS; i++) allowed_looters[i] = 0; - } + SetPKItem(0); } diff --git a/zone/corpse.h b/zone/corpse.h index ba2dfbecc..6d1d45575 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -34,7 +34,7 @@ public: Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000); Corpse(Client* client, int32 in_rezexp); - Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); + Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, const xyz_heading& position, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false); ~Corpse(); static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, const xyz_heading& position, std::string time_of_death, bool rezzed, bool was_at_graveyard); From 0275e9646ca9c4820a84e8f578ad80391ec7d8ee Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 19:55:29 -0800 Subject: [PATCH 0493/1883] Added GetSafePoint to Zone --- zone/zone.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/zone.h b/zone/zone.h index 0701c26e2..32b17c274 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -109,6 +109,7 @@ public: inline Timer* GetInstanceTimer() { return Instance_Timer; } + inline xyz_heading GetSafePoint() { return m_SafePoint; } inline const float& safe_x() { return m_SafePoint.m_X; } inline const float& safe_y() { return m_SafePoint.m_Y; } inline const float& safe_z() { return m_SafePoint.m_Z; } From e64e131c9c22a3feeb770ba9a571e2e421ec4608 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 20:17:14 -0800 Subject: [PATCH 0494/1883] Removed safe_x(), safe_y(), safe_z() from Zone --- zone/client_packet.cpp | 7 ++++--- zone/zone.h | 5 +---- zone/zoning.cpp | 8 +++++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 475188975..ad6e3745b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1460,9 +1460,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) strcpy(lastname, m_pp.last_name); /* If PP is set to weird coordinates */ if ((m_pp.x == -1 && m_pp.y == -1 && m_pp.z == -1) || (m_pp.x == -2 && m_pp.y == -2 && m_pp.z == -2)) { - m_pp.x = zone->safe_x(); - m_pp.y = zone->safe_y(); - m_pp.z = zone->safe_z(); + auto safePoint = zone->GetSafePoint(); + m_pp.x = safePoint.m_X; + m_pp.y = safePoint.m_Y; + m_pp.z = safePoint.m_Z; } /* If too far below ground, then fix */ // float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z); diff --git a/zone/zone.h b/zone/zone.h index 32b17c274..7bb1d196e 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -109,10 +109,7 @@ public: inline Timer* GetInstanceTimer() { return Instance_Timer; } - inline xyz_heading GetSafePoint() { return m_SafePoint; } - inline const float& safe_x() { return m_SafePoint.m_X; } - inline const float& safe_y() { return m_SafePoint.m_Y; } - inline const float& safe_z() { return m_SafePoint.m_Z; } + inline xyz_location GetSafePoint() { return m_SafePoint; } inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; } inline const float& graveyard_x() { return m_Graveyard.m_X; } inline const float& graveyard_y() { return m_Graveyard.m_Y; } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 266951f1b..4a22746c8 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -488,13 +488,15 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z return; } iZoneNameLength = strlen(pZoneName); + xyz_heading safePoint; switch(zm) { case EvacToSafeCoords: case ZoneToSafeCoords: - x = zone->safe_x(); - y = zone->safe_y(); - z = zone->safe_z(); + safePoint = zone->GetSafePoint(); + x = safePoint.m_X; + y = safePoint.m_Y; + z = safePoint.m_Z; SetHeading(heading); break; case GMSummon: From ff1942245ba0de8664242e56b97ffad214ad195b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 20:25:38 -0800 Subject: [PATCH 0495/1883] Added GetGraveyardPoint() to Zone --- zone/zone.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/zone.h b/zone/zone.h index 7bb1d196e..1cc387f18 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -111,6 +111,7 @@ public: inline xyz_location GetSafePoint() { return m_SafePoint; } inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; } + inline xyz_heading GetGraveyardPoint() { return m_Graveyard; } inline const float& graveyard_x() { return m_Graveyard.m_X; } inline const float& graveyard_y() { return m_Graveyard.m_Y; } inline const float& graveyard_z() { return m_Graveyard.m_Z; } From f00cddd67e9aaaf54d66c6b06e486c770be13c16 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 21:00:31 -0800 Subject: [PATCH 0496/1883] graveyard_x(), graveyard_y(), graveyard_z(), and graveyard_heading() converted to GetGraveyardPoint() --- zone/corpse.cpp | 3 +-- zone/zone.cpp | 2 +- zone/zone.h | 4 ---- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 205eddf83..4abdc72e2 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -766,8 +766,7 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; database.SendCharacterCorpseToGraveyard(corpse_db_id, zone->graveyard_zoneid(), - (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, xyz_heading(zone->graveyard_x(), - zone->graveyard_y(), zone->graveyard_z(), zone->graveyard_heading())); + (zone->GetZoneID() == zone->graveyard_zoneid()) ? zone->GetInstanceID() : 0, zone->GetGraveyardPoint()); corpse_graveyard_timer.Disable(); ServerPacket* pack = new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)); SpawnPlayerCorpse_Struct* spc = (SpawnPlayerCorpse_Struct*)pack->pBuffer; diff --git a/zone/zone.cpp b/zone/zone.cpp index cc333c5fa..333d3f4da 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -791,7 +791,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) LogFile->write(EQEMuLog::Debug, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &m_Graveyard.m_X, &m_Graveyard.m_Y, &m_Graveyard.m_Z, &m_Graveyard.m_Heading); if(GraveYardLoaded) - LogFile->write(EQEMuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + LogFile->write(EQEMuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u at %s.", short_name, graveyard_zoneid(), to_string(m_Graveyard).c_str()); else LogFile->write(EQEMuLog::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } diff --git a/zone/zone.h b/zone/zone.h index 1cc387f18..6c2581d38 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -112,10 +112,6 @@ public: inline xyz_location GetSafePoint() { return m_SafePoint; } inline const uint32& graveyard_zoneid() { return pgraveyard_zoneid; } inline xyz_heading GetGraveyardPoint() { return m_Graveyard; } - inline const float& graveyard_x() { return m_Graveyard.m_X; } - inline const float& graveyard_y() { return m_Graveyard.m_Y; } - inline const float& graveyard_z() { return m_Graveyard.m_Z; } - inline const float& graveyard_heading() { return m_Graveyard.m_Heading; } inline const uint32& graveyard_id() { return pgraveyard_id; } inline const uint32& GetMaxClients() { return pMaxClients; } From 523562c152bb703f012acaff4fbdeeeb060dafd5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Tue, 2 Dec 2014 21:27:22 -0800 Subject: [PATCH 0497/1883] GetClosestZonePoint converted to xyz_location (id version) --- zone/zone.cpp | 6 +++--- zone/zone.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 333d3f4da..5b9910441 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1580,10 +1580,10 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien return closest_zp; } -ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, const char* to_name, Client* client, float max_distance) { +ZonePoint* Zone::GetClosestZonePoint(const xyz_location& location, const char* to_name, Client* client, float max_distance) { if(to_name == nullptr) - return GetClosestZonePointWithoutZone(x,y,z, client, max_distance); - return GetClosestZonePoint(x, y, z, database.GetZoneID(to_name), client, max_distance); + return GetClosestZonePointWithoutZone(location.m_X, location.m_Y, location.m_Z, client, max_distance); + return GetClosestZonePoint(location.m_X, location.m_Y, location.m_Z, database.GetZoneID(to_name), client, max_distance); } ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Client* client, float max_distance) { diff --git a/zone/zone.h b/zone/zone.h index 6c2581d38..4716b3757 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -127,7 +127,7 @@ public: void ReloadStaticData(); uint32 CountSpawn2(); - ZonePoint* GetClosestZonePoint(float x, float y, float z, const char* to_name, Client *client, float max_distance = 40000.0f); + ZonePoint* GetClosestZonePoint(const xyz_location& location, const char* to_name, Client *client, float max_distance = 40000.0f); ZonePoint* GetClosestZonePoint(float x, float y, float z, uint32 to, Client *client, float max_distance = 40000.0f); ZonePoint* GetClosestZonePointWithoutZone(float x, float y, float z, Client *client, float max_distance = 40000.0f); SpawnGroupList spawn_group_list; From 804421095ad878349bed459bf87f4f073c429cec Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 3 Dec 2014 16:55:43 -0500 Subject: [PATCH 0498/1883] Fix DB manifest --- utils/sql/db_update_manifest.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 8291465a4..2af5e6e90 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -312,7 +312,7 @@ 9056|2014_11_08_RaidMembers.sql|SHOW COLUMNS FROM `raid_members` LIKE 'groupid'|missing|unsigned 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| 9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| -9059|2014_11_30_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| +9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not @@ -331,4 +331,4 @@ # not_empty = If the query is not empty # 4 = Text to match # -# \ No newline at end of file +# From fc282f86c03c70fd1718c5ef0d28faf9fbba0df8 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 3 Dec 2014 17:04:26 -0500 Subject: [PATCH 0499/1883] Rework raid invite handling, shouldn't break rsay being invited to raid anymore --- zone/client_packet.cpp | 51 +++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index adb3b4464..537f7126b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -10617,37 +10617,28 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) case RaidCommandInviteIntoExisting: case RaidCommandInvite: { Client *i = entity_list.GetClientByName(ri->player_name); - if (i){ - Group *g = i->GetGroup(); - if (g){ - if (g->IsLeader(i) == false) - Message(13, "You can only invite an ungrouped player or group leader to join your raid."); - else{ - //This sends an "invite" to the client in question. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; - strn0cpy(rg->leader_name, ri->leader_name, 64); - strn0cpy(rg->player_name, ri->player_name, 64); - - rg->parameter = 0; - rg->action = 20; - i->QueuePacket(outapp); - safe_delete(outapp); - } - } - else{ - //This sends an "invite" to the client in question. - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); - RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; - strn0cpy(rg->leader_name, ri->leader_name, 64); - strn0cpy(rg->player_name, ri->player_name, 64); - - rg->parameter = 0; - rg->action = 20; - i->QueuePacket(outapp); - safe_delete(outapp); - } + if (!i) + break; + Group *g = i->GetGroup(); + // These two messages should be generated by the client I think, just do this for now + if (i->HasRaid()) { + Message(13, "%s is already in a raid.", i->GetName()); + break; } + if (g && !g->IsLeader(i)) { + Message(13, "You can only invite an ungrouped player or group leader to join your raid."); + break; + } + //This sends an "invite" to the client in question. + EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); + RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; + strn0cpy(rg->leader_name, ri->leader_name, 64); + strn0cpy(rg->player_name, ri->player_name, 64); + + rg->parameter = 0; + rg->action = 20; + i->QueuePacket(outapp); + safe_delete(outapp); break; } case RaidCommandAcceptInvite: { From 052b41fbb2e3063616b5862eb05118e0694a7be7 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 4 Dec 2014 02:40:51 -0500 Subject: [PATCH 0500/1883] Ranged attacks will now much more accurately calculate max distance server side via accounting for differences in attacker/target size. This fixes a very common issue of player hitting range attack and nothing happening due to server improperly calculating max range. --- changelog.txt | 4 +++ zone/mob.h | 1 + zone/special_attacks.cpp | 58 +++++++++++++++++++++++++++++++++------- zone/string_ids.h | 3 ++- 4 files changed, 56 insertions(+), 10 deletions(-) diff --git a/changelog.txt b/changelog.txt index d8ed052ab..e72fc04a3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/04/2014 == +Kayen: Ranged attacks will now more accurately check MAX firing range, fixing the issue where you would +hit ranged attack and nothing would happpen due to incorrect server side range checks. + == 12/01/2014 == Trevius: Mercenaries now spawn as the same Gender and Size of the Merchant they are purchased from. Trevius: Mercenaries now spawn with randomized facial features when purchased. diff --git a/zone/mob.h b/zone/mob.h index 18f61281f..6135c6571 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -737,6 +737,7 @@ public: void ProjectileAttack(); inline bool HasProjectileAttack() const { return ActiveProjectileATK; } inline void SetProjectileAttack(bool value) { ActiveProjectileATK = value; } + float GetRangeDistTargetSizeMod(Mob* other); bool CanDoSpecialAttack(Mob *other); bool Flurry(ExtraAttackOptions *opts); bool Rampage(ExtraAttackOptions *opts); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 1ecf10934..632a2dad1 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -765,15 +765,16 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } } - float range = RangeItem->Range + AmmoItem->Range + 5.0f; //Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0 + float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - if(DistNoRootNoZ(*GetTarget()) > range) { + if(DistNoRoot(*GetTarget()) > range) { mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", DistNoRootNoZ(*GetTarget()), range); - //target is out of range, client does a message + Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } - else if(DistNoRootNoZ(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ + else if(DistNoRoot(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ + Message_StringID(15,RANGED_TOO_CLOSE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1128,6 +1129,45 @@ void Mob::ProjectileAttack() SetProjectileAttack(false); } +float Mob::GetRangeDistTargetSizeMod(Mob* other) +{ + /* + Range is enforced client side, therefore these numbers do not need to be 100% accurate just close enough to + prevent any exploitation. The range mod changes in some situations depending on if size is from spawn or from SendIllusionPacket changes. + At present time only calculate from spawn (it is no consistent what happens to the calc when changing it after spawn). + */ + if (!other) + return 0.0f; + + float tsize = other->GetSize(); + + if (GetSize() > tsize) + tsize = GetSize(); + + float mod = 0.0f; + /*These are correct numbers if mob size is changed via #size (Don't know why it matters but it does) + if (tsize < 7) + mod = 16.0f; + else if (tsize >=7 && tsize <= 20) + mod = 16.0f + (0.6f * (tsize - 6.0f)); + else if (tsize >=20 && tsize <= 60) + mod = 25.0f + (1.25f * (tsize - 20.0f)); + else + mod = 75.0f; + */ + + if (tsize < 10) + mod = 18.0f; + else if (tsize >=10 && tsize < 15) + mod = 20.0f + (4.0f * (tsize - 10.0f)); + else if (tsize >=15 && tsize <= 20) + mod = 42.0f + (5.8f * (tsize - 15.0f)); + else + mod = 75.0f; + + return (mod + 2.0f); //Add 2.0f as buffer to prevent any chance of failures, client enforce range check regardless. +} + void NPC::RangedAttack(Mob* other) { @@ -1333,16 +1373,16 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 } } - int range = item->Range +50/*Fudge it a little, client will let you hit something at 0 0 0 when you are at 205 0 0*/; + float range = item->Range + GetRangeDistTargetSizeMod(GetTarget()); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - if(DistNoRootNoZ(*GetTarget()) > range) { + if(DistNoRoot(*GetTarget()) > range) { mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", DistNoRootNoZ(*GetTarget()), range); - //target is out of range, client does a message + Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } - else if(DistNoRootNoZ(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ - return; + else if(DistNoRoot(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ + Message_StringID(15,RANGED_TOO_CLOSE);//Client enforces range and sends the message, this is a backup just incase. } if(!IsAttackAllowed(GetTarget()) || diff --git a/zone/string_ids.h b/zone/string_ids.h index e1e1bc7b3..ef758dba6 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -396,7 +396,8 @@ #define SONG_ENDS_OTHER 12688 //%1's song ends. #define SONG_ENDS_ABRUPTLY_OTHER 12689 //%1's song ends abruptly. #define DIVINE_AURA_NO_ATK 12695 //You can't attack while invulnerable! -#define TRY_ATTACKING_SOMEONE 12696 //Try attacking someone other than yourself, it's more productive. +#define TRY_ATTACKING_SOMEONE 12696 //Try attacking someone other than yourself, it's more productive +#define RANGED_TOO_CLOSE 12698 //Your target is too close to use a ranged weapon! #define BACKSTAB_WEAPON 12874 //You need a piercing weapon as your primary weapon in order to backstab #define MORE_SKILLED_THAN_I 12931 //%1 tells you, 'You are more skilled than I! What could I possibly teach you?' #define SURNAME_EXISTS 12939 //You already have a surname. Operation failed. From af42af786935195f8b75278d85c80559630357d1 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 4 Dec 2014 02:13:01 -0600 Subject: [PATCH 0501/1883] Initial addition of the RoF2 client from May 10th 2013 (currently available on Steam as the F2P client). RoF2 is disabled by default, but you can enable by editing /common/patches/patches.cpp (see comments) --- changelog.txt | 2 + common/CMakeLists.txt | 14 +- common/eq_dictionary.h | 2 +- common/patches/patches.cpp | 4 +- common/patches/rof2.cpp | 5673 +++++++++++++++++ common/patches/rof2.h | 37 + common/patches/rof2_constants.h | 216 + common/patches/rof2_itemfields.h | 439 ++ common/patches/rof2_ops.h | 173 + common/patches/rof2_structs.h | 4922 ++++++++++++++ utils/patches/patch_RoF2.conf | 660 ++ .../scripts/opcode_scripts/conf_to_oplist.pl | 66 + utils/scripts/opcode_scripts/opcodelist.txt | 1671 +++++ .../scripts/opcode_scripts/oplist_to_conf.pl | 88 + utils/scripts/opcode_scripts/patch_NEW.conf | 661 ++ utils/scripts/opcode_scripts/patch_OLD.conf | 661 ++ 16 files changed, 15286 insertions(+), 3 deletions(-) create mode 100644 common/patches/rof2.cpp create mode 100644 common/patches/rof2.h create mode 100644 common/patches/rof2_constants.h create mode 100644 common/patches/rof2_itemfields.h create mode 100644 common/patches/rof2_ops.h create mode 100644 common/patches/rof2_structs.h create mode 100644 utils/patches/patch_RoF2.conf create mode 100644 utils/scripts/opcode_scripts/conf_to_oplist.pl create mode 100644 utils/scripts/opcode_scripts/opcodelist.txt create mode 100644 utils/scripts/opcode_scripts/oplist_to_conf.pl create mode 100644 utils/scripts/opcode_scripts/patch_NEW.conf create mode 100644 utils/scripts/opcode_scripts/patch_OLD.conf diff --git a/changelog.txt b/changelog.txt index e72fc04a3..e24dcd59d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 12/04/2014 == Kayen: Ranged attacks will now more accurately check MAX firing range, fixing the issue where you would hit ranged attack and nothing would happpen due to incorrect server side range checks. +Trevius: Initial addition of the RoF2 client from May 10th 2013 (currently available on Steam as the F2P client). +Trevius: RoF2 is disabled by default, but you can enable by editing /common/patches/patches.cpp (see comments) == 12/01/2014 == Trevius: Mercenaries now spawn as the same Gender and Size of the Merchant they are purchased from. diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 01fcd6df8..be495e9b7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -72,6 +72,7 @@ SET(common_sources patches/sod.cpp patches/sof.cpp patches/rof.cpp + patches/rof2.cpp patches/titanium.cpp patches/underfoot.cpp SocketLib/Base64.cpp @@ -216,6 +217,11 @@ SET(common_headers patches/rof_itemfields.h patches/rof_ops.h patches/rof_structs.h + patches/rof2.h + patches/rof2_constants.h + patches/rof2_itemfields.h + patches/rof2_ops.h + patches/rof2_structs.h patches/titanium.h patches/titanium_constants.h patches/titanium_itemfields.h @@ -269,6 +275,11 @@ SOURCE_GROUP(Patches FILES patches/rof_ops.h patches/rof_constants.h patches/rof_structs.h + patches/rof2.h + patches/rof2_itemfields.h + patches/rof2_ops.h + patches/rof2_constants.h + patches/rof2_structs.h patches/titanium.h patches/titanium_itemfields.h patches/titanium_ops.h @@ -284,6 +295,7 @@ SOURCE_GROUP(Patches FILES patches/sod.cpp patches/sof.cpp patches/rof.cpp + patches/rof2.cpp patches/titanium.cpp patches/underfoot.cpp ) @@ -335,7 +347,7 @@ ADD_LIBRARY(common ${common_sources} ${common_headers}) IF(UNIX) ADD_DEFINITIONS(-fPIC) SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) - SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) + SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0) ENDIF(UNIX) diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index c08809a12..8ef38c77c 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/patches/sod_constants.h" #include "../common/patches/underfoot_constants.h" #include "../common/patches/rof_constants.h" -//#include "../common/patches/rof2_constants.h" +#include "../common/patches/rof2_constants.h" // *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! *** // *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! *** diff --git a/common/patches/patches.cpp b/common/patches/patches.cpp index 212042210..d35ded9ba 100644 --- a/common/patches/patches.cpp +++ b/common/patches/patches.cpp @@ -8,7 +8,7 @@ #include "sof.h" #include "sod.h" #include "rof.h" -//#include "rof2.h" +#include "rof2.h" void RegisterAllPatches(EQStreamIdentifier &into) { Client62::Register(into); @@ -17,6 +17,7 @@ void RegisterAllPatches(EQStreamIdentifier &into) { SoD::Register(into); Underfoot::Register(into); RoF::Register(into); + // Uncomment the line below to enable RoF2 Client //RoF2::Register(into); } @@ -27,5 +28,6 @@ void ReloadAllPatches() { SoD::Reload(); Underfoot::Reload(); RoF::Reload(); + // Uncomment the line below to enable RoF2 Client //RoF2::Reload(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp new file mode 100644 index 000000000..372da9b07 --- /dev/null +++ b/common/patches/rof2.cpp @@ -0,0 +1,5673 @@ +#include "../debug.h" +#include "rof2.h" +#include "../opcodemgr.h" +#include "../logsys.h" +#include "../eq_stream_ident.h" +#include "../crc32.h" + +#include "../eq_packet_structs.h" +#include "../misc_functions.h" +#include "../string_util.h" +#include "../item.h" +#include "rof2_structs.h" +#include "../rulesys.h" + +#include +#include + +namespace RoF2 +{ + static const char *name = "RoF2"; + static OpcodeManager *opcodes = nullptr; + static Strategy struct_strategy; + + char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); + + // server to client inventory location converters + static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot); + static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 ServerSlot); + static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse); + + // client to server inventory location converters + static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot); + static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot); + static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse); + + void Register(EQStreamIdentifier &into) + { + //create our opcode manager if we havent already + if (opcodes == nullptr) { + //TODO: get this file name from the config file + std::string opfile = "patch_"; + opfile += name; + opfile += ".conf"; + //load up the opcode manager. + //TODO: figure out how to support shared memory with multiple patches... + opcodes = new RegularOpcodeManager(); + if (!opcodes->LoadOpcodes(opfile.c_str())) { + _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + return; + } + } + + //ok, now we have what we need to register. + + EQStream::Signature signature; + std::string pname; + + //register our world signature. + pname = std::string(name) + "_world"; + signature.ignore_eq_opcode = 0; + signature.first_length = sizeof(structs::LoginInfo_Struct); + signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); + into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); + + //register our zone signature. + pname = std::string(name) + "_zone"; + signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); + signature.first_length = sizeof(structs::ClientZoneEntry_Struct); + signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); + into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); + + + + _log(NET__IDENTIFY, "Registered patch %s", name); + } + + void Reload() + { + //we have a big problem to solve here when we switch back to shared memory + //opcode managers because we need to change the manager pointer, which means + //we need to go to every stream and replace it's manager. + + if (opcodes != nullptr) { + //TODO: get this file name from the config file + std::string opfile = "patch_"; + opfile += name; + opfile += ".conf"; + if (!opcodes->ReloadOpcodes(opfile.c_str())) { + _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + return; + } + _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + } + } + + Strategy::Strategy() : StructStrategy() + { + //all opcodes default to passthrough. +#include "ss_register.h" +#include "rof_ops.h" + } + + std::string Strategy::Describe() const + { + std::string r; + r += "Patch "; + r += name; + return(r); + } + + const EQClientVersion Strategy::ClientVersion() const + { + return EQClientRoF2; + } + +#include "ss_define.h" + +// ENCODE methods + ENCODE(OP_Action) + { + ENCODE_LENGTH_EXACT(Action_Struct); + SETUP_DIRECT_ENCODE(Action_Struct, structs::ActionAlt_Struct); + + OUT(target); + OUT(source); + OUT(level); + eq->unknown06 = 0; + eq->instrument_mod = 1.0f + (emu->instrument_mod - 10) / 10.0f; + eq->bard_focus_id = emu->bard_focus_id; + eq->knockback_angle = emu->sequence; + eq->unknown22 = 0; + OUT(type); + eq->damage = 0; + eq->unknown31 = 0; + OUT(spell); + eq->level2 = eq->level; + eq->effect_flag = emu->buff_unknown; + eq->unknown39 = 14; + eq->unknown43 = 0; + eq->unknown44 = 17; + eq->unknown45 = 0; + eq->unknown46 = -1; + eq->unknown50 = 0; + eq->unknown54 = 0; + + FINISH_ENCODE(); + } + + ENCODE(OP_AdventureMerchantSell) + { + ENCODE_LENGTH_EXACT(Adventure_Sell_Struct); + SETUP_DIRECT_ENCODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + eq->unknown000 = 1; + OUT(npcid); + eq->slot = ServerToRoF2MainInvSlot(emu->slot); + OUT(charges); + OUT(sell_price); + + FINISH_ENCODE(); + } + + ENCODE(OP_AltCurrency) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *emu_buffer = in->pBuffer; + uint32 opcode = *((uint32*)emu_buffer); + + if (opcode == 8) { + AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(structs::AltCurrencyPopulate_Struct) + + sizeof(structs::AltCurrencyPopulateEntry_Struct) * populate->count); + structs::AltCurrencyPopulate_Struct *out_populate = (structs::AltCurrencyPopulate_Struct*)outapp->pBuffer; + + out_populate->opcode = populate->opcode; + out_populate->count = populate->count; + for (uint32 i = 0; i < populate->count; ++i) { + out_populate->entries[i].currency_number = populate->entries[i].currency_number; + out_populate->entries[i].unknown00 = populate->entries[i].unknown00; + out_populate->entries[i].currency_number2 = populate->entries[i].currency_number2; + out_populate->entries[i].item_id = populate->entries[i].item_id; + out_populate->entries[i].item_icon = populate->entries[i].item_icon; + out_populate->entries[i].stack_size = populate->entries[i].stack_size; + out_populate->entries[i].display = ((populate->entries[i].stack_size > 0) ? 1 : 0); + } + + dest->FastQueuePacket(&outapp, ack_req); + } + else { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_AltCurrency, sizeof(AltCurrencyUpdate_Struct)); + memcpy(outapp->pBuffer, emu_buffer, sizeof(AltCurrencyUpdate_Struct)); + dest->FastQueuePacket(&outapp, ack_req); + } + + //dest->FastQueuePacket(&outapp, ack_req); + delete in; + } + + ENCODE(OP_AltCurrencySell) + { + ENCODE_LENGTH_EXACT(AltCurrencySellItem_Struct); + SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); + + OUT(merchant_entity_id); + eq->slot_id = ServerToRoF2Slot(emu->slot_id); + OUT(charges); + OUT(cost); + + FINISH_ENCODE(); + } + + ENCODE(OP_Animation) + { + ENCODE_LENGTH_EXACT(Animation_Struct); + SETUP_DIRECT_ENCODE(Animation_Struct, structs::Animation_Struct); + + OUT(spawnid); + OUT(value); + OUT(action); + + FINISH_ENCODE(); + } + + ENCODE(OP_ApplyPoison) + { + ENCODE_LENGTH_EXACT(ApplyPoison_Struct); + SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + eq->inventorySlot = ServerToRoF2MainInvSlot(emu->inventorySlot); + OUT(success); + + FINISH_ENCODE(); + } + + ENCODE(OP_AugmentInfo) + { + ENCODE_LENGTH_EXACT(AugmentInfo_Struct); + SETUP_DIRECT_ENCODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + OUT(itemid); + OUT(window); + strn0cpy(eq->augment_info, emu->augment_info, 64); + + FINISH_ENCODE(); + } + + ENCODE(OP_Barter) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + char *Buffer = (char *)in->pBuffer; + + uint32 SubAction = VARSTRUCT_DECODE_TYPE(uint32, Buffer); + + if (SubAction != Barter_BuyerAppearance) + { + dest->FastQueuePacket(&in, ack_req); + + return; + } + + unsigned char *__emu_buffer = in->pBuffer; + + in->size = 80; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + char Name[64]; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, SubAction); + uint32 EntityID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, EntityID); + uint8 Toggle = VARSTRUCT_DECODE_TYPE(uint8, Buffer); + VARSTRUCT_DECODE_STRING(Name, Buffer); + VARSTRUCT_ENCODE_STRING(OutBuffer, Name); + OutBuffer = (char *)in->pBuffer + 72; + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, Toggle); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_BazaarSearch) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + char *Buffer = (char *)in->pBuffer; + + uint8 SubAction = VARSTRUCT_DECODE_TYPE(uint8, Buffer); + + if (SubAction != BazaarSearchResults) + { + dest->FastQueuePacket(&in, ack_req); + return; + } + + unsigned char *__emu_buffer = in->pBuffer; + + BazaarSearchResults_Struct *emu = (BazaarSearchResults_Struct *)__emu_buffer; + + int EntryCount = in->size / sizeof(BazaarSearchResults_Struct); + + if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) + { + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + delete in; + return; + } + + in->size = EntryCount * sizeof(structs::BazaarSearchResults_Struct); + in->pBuffer = new unsigned char[in->size]; + + memset(in->pBuffer, 0, in->size); + + structs::BazaarSearchResults_Struct *eq = (structs::BazaarSearchResults_Struct *)in->pBuffer; + + for (int i = 0; i < EntryCount; ++i, ++emu, ++eq) + { + OUT(Beginning.Action); + OUT(SellerID); + memcpy(eq->SellerName, emu->SellerName, sizeof(eq->SellerName)); + OUT(NumItems); + OUT(ItemID); + OUT(SerialNumber); + memcpy(eq->ItemName, emu->ItemName, sizeof(eq->ItemName)); + OUT(Cost); + OUT(ItemStat); + } + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_BeginCast) + { + SETUP_DIRECT_ENCODE(BeginCast_Struct, structs::BeginCast_Struct); + + OUT(spell_id); + OUT(caster_id); + OUT(cast_time); + + FINISH_ENCODE(); + } + + ENCODE(OP_BlockedBuffs) + { + ENCODE_LENGTH_EXACT(BlockedBuffs_Struct); + SETUP_DIRECT_ENCODE(BlockedBuffs_Struct, structs::BlockedBuffs_Struct); + + for (uint32 i = 0; i < BLOCKED_BUFF_COUNT; ++i) + eq->SpellID[i] = emu->SpellID[i]; + + // -1 for the extra 10 added in RoF2. We should really be encoding for the older clients, not RoF2, but + // we can sort that out later. + + for (uint32 i = BLOCKED_BUFF_COUNT; i < structs::BLOCKED_BUFF_COUNT; ++i) + eq->SpellID[i] = -1; + + OUT(Count); + OUT(Pet); + OUT(Initialise); + OUT(Flags); + + FINISH_ENCODE(); + } + + ENCODE(OP_Buff) + { + ENCODE_LENGTH_EXACT(SpellBuffFade_Struct); + SETUP_DIRECT_ENCODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live); + + OUT(entityid); + eq->unknown004 = 2; + //eq->level = 80; + //eq->effect = 0; + OUT(level); + OUT(effect); + eq->unknown007 = 0; + eq->unknown008 = 1.0f; + OUT(spellid); + OUT(duration); + eq->playerId = 0x7cde; + OUT(slotid); + OUT(num_hits); + if (emu->bufffade == 1) + eq->bufffade = 1; + else + eq->bufffade = 2; + + // Bit of a hack. OP_Buff appears to add/remove the buff while OP_BuffCreate adds/removes the actual buff icon + EQApplicationPacket *outapp = nullptr; + if (eq->bufffade == 1) + { + outapp = new EQApplicationPacket(OP_BuffCreate, 29); + outapp->WriteUInt32(emu->entityid); + outapp->WriteUInt32(0x0271); // Unk + outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ? + outapp->WriteUInt16(1); // 1 buff in this packet + outapp->WriteUInt32(emu->slotid); + outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove) + outapp->WriteUInt32(0); // Duration + outapp->WriteUInt32(0); // ? + outapp->WriteUInt8(0); // Caster name + outapp->WriteUInt8(0); // Terminating byte + } + FINISH_ENCODE(); + + if (outapp) + dest->FastQueuePacket(&outapp); // Send the OP_BuffCreate to remove the buff + } + + ENCODE(OP_BuffCreate) + { + SETUP_VAR_ENCODE(BuffIcon_Struct); + + uint32 sz = 12 + (17 * emu->count); + __packet->size = sz; + __packet->pBuffer = new unsigned char[sz]; + memset(__packet->pBuffer, 0, sz); + + __packet->WriteUInt32(emu->entity_id); + __packet->WriteUInt32(0); // PlayerID ? + __packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff) + __packet->WriteUInt16(emu->count); + + for (uint16 i = 0; i < emu->count; ++i) + { + uint16 buffslot = emu->entries[i].buff_slot; + // Not sure if this is needs amending for RoF2 yet. + if (emu->entries[i].buff_slot >= 25) + { + buffslot += 17; + } + + __packet->WriteUInt32(buffslot); + __packet->WriteUInt32(emu->entries[i].spell_id); + __packet->WriteUInt32(emu->entries[i].tics_remaining); + __packet->WriteUInt32(emu->entries[i].num_hits); // Unknown + __packet->WriteString(""); + } + __packet->WriteUInt8(!emu->all_buffs); // Unknown + + FINISH_ENCODE(); + } + + ENCODE(OP_CancelTrade) + { + ENCODE_LENGTH_EXACT(CancelTrade_Struct); + SETUP_DIRECT_ENCODE(CancelTrade_Struct, structs::CancelTrade_Struct); + + OUT(fromid); + OUT(action); + + FINISH_ENCODE(); + } + + ENCODE(OP_CastSpell) + { + ENCODE_LENGTH_EXACT(CastSpell_Struct); + SETUP_DIRECT_ENCODE(CastSpell_Struct, structs::CastSpell_Struct); + + if (emu->slot == 10) + eq->slot = 13; + else + OUT(slot); + + OUT(spell_id); + eq->inventoryslot = ServerToRoF2Slot(emu->inventoryslot); + //OUT(inventoryslot); + OUT(target_id); + + FINISH_ENCODE(); + } + + ENCODE(OP_ChannelMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sender); + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->targetname); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->language); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->chan_num); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->skill_in_language); + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->message); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint16, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_CharInventory) + { + //consume the packet + EQApplicationPacket *in = *p; + + *p = nullptr; + + if (in->size == 0) { + + in->size = 4; + in->pBuffer = new uchar[in->size]; + + *((uint32 *)in->pBuffer) = 0; + + dest->FastQueuePacket(&in, ack_req); + return; + } + + //store away the emu struct + unsigned char *__emu_buffer = in->pBuffer; + + int ItemCount = in->size / sizeof(InternalSerializedItem_Struct); + + if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { + + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + + delete in; + + return; + } + + InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *)in->pBuffer; + + in->pBuffer = new uchar[4]; + *(uint32 *)in->pBuffer = ItemCount; + in->size = 4; + + for (int r = 0; r < ItemCount; r++, eq++) { + + uint32 Length = 0; + + char* Serialized = SerializeItem((const ItemInst*)eq->inst, eq->slot_id, &Length, 0); + + if (Serialized) { + + uchar *OldBuffer = in->pBuffer; + in->pBuffer = new uchar[in->size + Length]; + memcpy(in->pBuffer, OldBuffer, in->size); + + safe_delete_array(OldBuffer); + + memcpy(in->pBuffer + in->size, Serialized, Length); + in->size += Length; + + safe_delete_array(Serialized); + } + else { + _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + } + } + + delete[] __emu_buffer; + + //_log(NET__ERROR, "Sending inventory to client"); + //_hex(NET__ERROR, in->pBuffer, in->size); + + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_ClickObjectAction) + { + ENCODE_LENGTH_EXACT(ClickObjectAction_Struct); + SETUP_DIRECT_ENCODE(ClickObjectAction_Struct, structs::ClickObjectAction_Struct); + + OUT(drop_id); + eq->unknown04 = -1; + eq->unknown08 = -1; + OUT(type); + OUT(icon); + eq->unknown16 = 0; + OUT_str(object_name); + + FINISH_ENCODE(); + } + + ENCODE(OP_ClientUpdate) + { + ENCODE_LENGTH_EXACT(PlayerPositionUpdateServer_Struct); + SETUP_DIRECT_ENCODE(PlayerPositionUpdateServer_Struct, structs::PlayerPositionUpdateServer_Struct); + + OUT(spawn_id); + OUT(x_pos); + OUT(delta_x); + OUT(delta_y); + OUT(z_pos); + OUT(delta_heading); + OUT(y_pos); + OUT(delta_z); + OUT(animation); + OUT(heading); + + FINISH_ENCODE(); + } + + ENCODE(OP_Consider) + { + ENCODE_LENGTH_EXACT(Consider_Struct); + SETUP_DIRECT_ENCODE(Consider_Struct, structs::Consider_Struct); + + OUT(playerid); + OUT(targetid); + OUT(faction); + OUT(level); + OUT(pvpcon); + + FINISH_ENCODE(); + } + + ENCODE(OP_Damage) + { + ENCODE_LENGTH_EXACT(CombatDamage_Struct); + SETUP_DIRECT_ENCODE(CombatDamage_Struct, structs::CombatDamage_Struct); + + OUT(target); + OUT(source); + OUT(type); + OUT(spellid); + OUT(damage); + eq->sequence = emu->sequence; + + FINISH_ENCODE(); + } + + ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); } + + ENCODE(OP_DeleteItem) + { + ENCODE_LENGTH_EXACT(DeleteItem_Struct); + SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + eq->from_slot = ServerToRoF2Slot(emu->from_slot); + eq->to_slot = ServerToRoF2Slot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + + ENCODE(OP_DeleteSpawn) + { + ENCODE_LENGTH_EXACT(DeleteSpawn_Struct); + SETUP_DIRECT_ENCODE(DeleteSpawn_Struct, structs::DeleteSpawn_Struct); + + OUT(spawn_id); + eq->unknown04 = 1; // Observed + + FINISH_ENCODE(); + } + + ENCODE(OP_DisciplineUpdate) + { + ENCODE_LENGTH_EXACT(Disciplines_Struct); + SETUP_DIRECT_ENCODE(Disciplines_Struct, structs::Disciplines_Struct); + + memcpy(&eq->values, &emu->values, sizeof(Disciplines_Struct)); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzCompass) + { + SETUP_VAR_ENCODE(ExpeditionCompass_Struct); + ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count); + + OUT(count); + + for (uint32 i = 0; i < emu->count; ++i) + { + OUT(entries[i].x); + OUT(entries[i].y); + OUT(entries[i].z); + } + + FINISH_ENCODE(); + } + + ENCODE(OP_DzExpeditionEndsWarning) + { + ENCODE_LENGTH_EXACT(ExpeditionExpireWarning); + SETUP_DIRECT_ENCODE(ExpeditionExpireWarning, structs::ExpeditionExpireWarning); + + OUT(minutes_remaining); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzExpeditionInfo) + { + ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct); + SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct); + + OUT(max_players); + eq->unknown004 = 785316192; + eq->unknown008 = 435601; + strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name)); + strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name)); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzExpeditionList) + { + SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct); + + std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); + uint32 client_id = 0; + uint8 null_term = 0; + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&emu->count, sizeof(uint32)); + for (uint32 i = 0; i < emu->count; ++i) + { + ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition)); + ss.write((const char*)&null_term, sizeof(char)); + ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event)); + ss.write((const char*)&null_term, sizeof(char)); + } + + __packet->size = ss.str().length(); + __packet->pBuffer = new unsigned char[__packet->size]; + memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzJoinExpeditionConfirm) + { + ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct); + SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct); + + strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name)); + strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name)); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzLeaderStatus) + { + SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct); + + std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); + uint32 client_id = 0; + uint8 null_term = 0; + + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write(emu->leader_name, strlen(emu->leader_name)); + ss.write((const char*)&null_term, sizeof(char)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&client_id, sizeof(uint32));//1 + ss.write((const char*)&client_id, sizeof(uint32)); + + __packet->size = ss.str().length(); + __packet->pBuffer = new unsigned char[__packet->size]; + memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); + + FINISH_ENCODE(); + } + + ENCODE(OP_DzMemberList) + { + SETUP_VAR_ENCODE(ExpeditionMemberList_Struct); + + std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); + + uint32 client_id = 0; + uint8 null_term = 0; + ss.write((const char*)&client_id, sizeof(uint32)); + ss.write((const char*)&emu->count, sizeof(uint32)); + for (uint32 i = 0; i < emu->count; ++i) + { + ss.write(emu->entries[i].name, strlen(emu->entries[i].name)); + ss.write((const char*)&null_term, sizeof(char)); + ss.write((const char*)&emu->entries[i].status, sizeof(char)); + } + + __packet->size = ss.str().length(); + __packet->pBuffer = new unsigned char[__packet->size]; + memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size); + + FINISH_ENCODE(); + } + + ENCODE(OP_ExpansionInfo) + { + ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); + SETUP_DIRECT_ENCODE(ExpansionInfo_Struct, structs::ExpansionInfo_Struct); + + OUT(Expansions); + + FINISH_ENCODE(); + } + + ENCODE(OP_GMLastName) + { + ENCODE_LENGTH_EXACT(GMLastName_Struct); + SETUP_DIRECT_ENCODE(GMLastName_Struct, structs::GMLastName_Struct); + + OUT_str(name); + OUT_str(gmname); + OUT_str(lastname); + for (int i = 0; i<4; i++) + { + eq->unknown[i] = emu->unknown[i]; + } + + FINISH_ENCODE(); + } + + ENCODE(OP_GMTrainSkillConfirm) + { + ENCODE_LENGTH_EXACT(GMTrainSkillConfirm_Struct); + SETUP_DIRECT_ENCODE(GMTrainSkillConfirm_Struct, structs::GMTrainSkillConfirm_Struct); + + OUT(SkillID); + OUT(Cost); + OUT(NewSkill); + OUT_str(TrainerName); + + FINISH_ENCODE(); + } + + ENCODE(OP_GroundSpawn) + { + // We are not encoding the spawn_id field here, but it doesn't appear to matter. + // + EQApplicationPacket *in = *p; + *p = nullptr; + + Object_Struct *emu = (Object_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + in->size = strlen(emu->object_name) + sizeof(Object_Struct)-1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->object_name); + VARSTRUCT_ENCODE_TYPE(uint16, OutBuffer, emu->zone_id); + VARSTRUCT_ENCODE_TYPE(uint16, OutBuffer, emu->zone_instance); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->drop_id); // Some unique id + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Same for all objects in the zone + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->heading); + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, 0); // Normally 0, but seen (float)255.0 as well + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, 0); // Unknown + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, 1); // Need to add emu->size to struct + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->y); + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->x); + VARSTRUCT_ENCODE_TYPE(float, OutBuffer, emu->z); + VARSTRUCT_ENCODE_TYPE(int32, OutBuffer, emu->object_type); // Unknown, observed 0x00000014 + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_GroupCancelInvite) + { + ENCODE_LENGTH_EXACT(GroupCancel_Struct); + SETUP_DIRECT_ENCODE(GroupCancel_Struct, structs::GroupCancel_Struct); + + memcpy(eq->name1, emu->name1, sizeof(eq->name1)); + memcpy(eq->name2, emu->name2, sizeof(eq->name2)); + OUT(toggle); + + FINISH_ENCODE(); + } + + ENCODE(OP_GroupFollow) + { + ENCODE_LENGTH_EXACT(GroupGeneric_Struct); + SETUP_DIRECT_ENCODE(GroupGeneric_Struct, structs::GroupFollow_Struct); + + memcpy(eq->name1, emu->name1, sizeof(eq->name1)); + memcpy(eq->name2, emu->name2, sizeof(eq->name2)); + + FINISH_ENCODE(); + } + + ENCODE(OP_GroupFollow2) + { + ENCODE_LENGTH_EXACT(GroupGeneric_Struct); + SETUP_DIRECT_ENCODE(GroupGeneric_Struct, structs::GroupFollow_Struct); + + memcpy(eq->name1, emu->name1, sizeof(eq->name1)); + memcpy(eq->name2, emu->name2, sizeof(eq->name2)); + + FINISH_ENCODE(); + } + + ENCODE(OP_GroupInvite) + { + ENCODE_LENGTH_EXACT(GroupGeneric_Struct); + SETUP_DIRECT_ENCODE(GroupGeneric_Struct, structs::GroupInvite_Struct); + + memcpy(eq->invitee_name, emu->name1, sizeof(eq->invitee_name)); + memcpy(eq->inviter_name, emu->name2, sizeof(eq->inviter_name)); + + FINISH_ENCODE(); + } + + ENCODE(OP_GroupUpdate) + { + //_log(NET__ERROR, "OP_GroupUpdate"); + EQApplicationPacket *in = *p; + GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; + + //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); + if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) + { + if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) + { + //_log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); + + structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; + memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); + memcpy(ggs->name2, gjs->membername, sizeof(ggs->name1)); + dest->FastQueuePacket(&outapp); + + // Make an empty GLAA packet to clear out their useable GLAAs + // + outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + + dest->FastQueuePacket(&outapp); + delete in; + return; + } + //if(gjs->action == groupActLeave) + // _log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); + + structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; + memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); + memcpy(ggs->name2, gjs->membername, sizeof(ggs->name2)); + //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + dest->FastQueuePacket(&outapp); + + delete in; + return; + } + + if (in->size == sizeof(GroupUpdate2_Struct)) + { + // Group Update2 + //_log(NET__ERROR, "Struct is GroupUpdate2"); + + unsigned char *__emu_buffer = in->pBuffer; + GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; + + //_log(NET__ERROR, "Yourname is %s", gu2->yourname); + + int MemberCount = 1; + int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; + + for (int i = 0; i < 5; ++i) + { + //_log(NET__ERROR, "Membername[%i] is %s", i, gu2->membername[i]); + if (gu2->membername[i][0] != '\0') + { + PacketLength += (22 + strlen(gu2->membername[i]) + 1); + ++MemberCount; + } + } + + //_log(NET__ERROR, "Leadername is %s", gu2->leadersname); + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); + + char *Buffer = (char *)outapp->pBuffer; + + // Header + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Think this should be SpawnID, but it doesn't seem to matter + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberCount); + VARSTRUCT_ENCODE_STRING(Buffer, gu2->leadersname); + + // Leader + // + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_STRING(Buffer, gu2->yourname); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + //VARSTRUCT_ENCODE_STRING(Buffer, ""); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // This is a string + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x46); // Observed 0x41 and 0x46 here + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); + + int MemberNumber = 1; + + for (int i = 0; i < 5; ++i) + { + if (gu2->membername[i][0] == '\0') + continue; + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, MemberNumber++); + VARSTRUCT_ENCODE_STRING(Buffer, gu2->membername[i]); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + //VARSTRUCT_ENCODE_STRING(Buffer, ""); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // This is a string + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x41); // Observed 0x41 and 0x46 here + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // Low byte is Main Assist Flag + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); + } + + //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + dest->FastQueuePacket(&outapp); + + outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + + GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; + + GLAAus->NPCMarkerID = gu2->NPCMarkerID; + memcpy(&GLAAus->LeaderAAs, &gu2->leader_aas, sizeof(GLAAus->LeaderAAs)); + + dest->FastQueuePacket(&outapp); + delete in; + + return; + + } + //_log(NET__ERROR, "Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + ENCODE_LENGTH_EXACT(GroupJoin_Struct); + SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); + + memcpy(eq->membername, emu->membername, sizeof(eq->membername)); + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); + GroupLeadershipAAUpdate_Struct *GLAAus = (GroupLeadershipAAUpdate_Struct*)outapp->pBuffer; + + GLAAus->NPCMarkerID = emu->NPCMarkerID; + + memcpy(&GLAAus->LeaderAAs, &emu->leader_aas, sizeof(GLAAus->LeaderAAs)); + //_hex(NET__ERROR, __packet->pBuffer, __packet->size); + + FINISH_ENCODE(); + + dest->FastQueuePacket(&outapp); + } + + ENCODE(OP_GuildMemberList) + { + //consume the packet + EQApplicationPacket *in = *p; + *p = nullptr; + + //store away the emu struct + unsigned char *__emu_buffer = in->pBuffer; + Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *)in->pBuffer; + + //make a new EQ buffer. + uint32 pnl = strlen(emu->player_name); + uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + + emu->count*sizeof(structs::GuildMemberEntry_Struct) + + emu->name_length + emu->note_length; + in->pBuffer = new uint8[length]; + in->size = length; + //no memset since we fill every byte. + + uint8 *buffer; + buffer = in->pBuffer; + + //easier way to setup GuildMembers_Struct + //set prefix name + strcpy((char *)buffer, emu->player_name); + buffer += pnl; + *buffer = '\0'; + buffer++; + + // Guild ID + buffer += sizeof(uint32); + + //add member count. + *((uint32 *)buffer) = htonl(emu->count); + buffer += sizeof(uint32); + + if (emu->count > 0) { + Internal_GuildMemberEntry_Struct *emu_e = emu->member; + const char *emu_name = (const char *)(__emu_buffer + + sizeof(Internal_GuildMembers_Struct)+ //skip header + emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data + ); + const char *emu_note = (emu_name + + emu->name_length + //skip name contents + emu->count //skip string terminators + ); + + structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; + + uint32 r; + for (r = 0; r < emu->count; r++, emu_e++) { + + //the order we set things here must match the struct + + //nice helper macro +#define SlideStructString(field, str) \ + { \ + int sl = strlen(str); \ + memcpy(e->field, str, sl+1); \ + e = (structs::GuildMemberEntry_Struct *) ( ((uint8 *)e) + sl ); \ + str += sl + 1; \ + } +#define PutFieldN(field) e->field = htonl(emu_e->field) + + SlideStructString(name, emu_name); + PutFieldN(level); + PutFieldN(banker); + PutFieldN(class_); + + /* Translate older ranks to new values */ + switch (emu_e->rank) { + case 0: { e->rank = htonl(5); break; } // GUILD_MEMBER 0 + case 1: { e->rank = htonl(3); break; } // GUILD_OFFICER 1 + case 2: { e->rank = htonl(1); break; } // GUILD_LEADER 2 + default: { e->rank = htonl(emu_e->rank); break; } // GUILD_NONE + } + + PutFieldN(time_last_on); + PutFieldN(tribute_enable); + e->unknown01 = 0; + PutFieldN(total_tribute); + PutFieldN(last_tribute); + e->unknown_one = htonl(1); + SlideStructString(public_note, emu_note); + e->zoneinstance = 0; + e->zone_id = htons(emu_e->zone_id); + e->unknown_one2 = htonl(1); + e->unknown04 = 0; + +#undef SlideStructString +#undef PutFieldN + + e++; + } + } + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_GuildMemberUpdate) + { + SETUP_DIRECT_ENCODE(GuildMemberUpdate_Struct, structs::GuildMemberUpdate_Struct); + + OUT(GuildID); + memcpy(eq->MemberName, emu->MemberName, sizeof(eq->MemberName)); + OUT(ZoneID); + OUT(InstanceID); + OUT(LastSeen); + eq->Unknown76 = 0; + + FINISH_ENCODE(); + } + + ENCODE(OP_GuildsList) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + uint32 NumberOfGuilds = in->size / 64; + uint32 PacketSize = 68; // 64 x 0x00 + a uint32 that I am guessing is the highest guild ID in use. + + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)__emu_buffer; + + uint32 HighestGuildID = 0; + + for (unsigned int i = 0; i < NumberOfGuilds; ++i) + { + if (InBuffer[0]) + { + PacketSize += (5 + strlen(InBuffer)); + HighestGuildID = i - 1; + } + InBuffer += 64; + } + + PacketSize++; // Appears to be an extra 0x00 at the very end. + + in->size = PacketSize; + in->pBuffer = new unsigned char[in->size]; + + InBuffer = (char *)__emu_buffer; + + char *OutBuffer = (char *)in->pBuffer; + + // Init the first 64 bytes to zero, as per live. + // + memset(OutBuffer, 0, 64); + + OutBuffer += 64; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, HighestGuildID); + + for (unsigned int i = 0; i < NumberOfGuilds; ++i) + { + if (InBuffer[0]) + { + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, i - 1); + VARSTRUCT_ENCODE_STRING(OutBuffer, InBuffer); + } + InBuffer += 64; + } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0x00); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_HPUpdate) + { + SETUP_DIRECT_ENCODE(SpawnHPUpdate_Struct, structs::SpawnHPUpdate_Struct); + + OUT(spawn_id); + OUT(cur_hp); + OUT(max_hp); + + FINISH_ENCODE(); + } + + ENCODE(OP_Illusion) + { + ENCODE_LENGTH_EXACT(Illusion_Struct); + SETUP_DIRECT_ENCODE(Illusion_Struct, structs::Illusion_Struct); + + OUT(spawnid); + OUT_str(charname); + OUT(race); + OUT(unknown006[0]); + OUT(unknown006[1]); + OUT(gender); + OUT(texture); + OUT(helmtexture); + OUT(face); + OUT(hairstyle); + OUT(haircolor); + OUT(beard); + OUT(beardcolor); + OUT(size); + OUT(drakkin_heritage); + OUT(drakkin_tattoo); + OUT(drakkin_details); + eq->unknown316 = -1; // Observed + + FINISH_ENCODE(); + } + + /*ENCODE(OP_InspectAnswer) + { + ENCODE_LENGTH_EXACT(InspectResponse_Struct); + SETUP_DIRECT_ENCODE(InspectResponse_Struct, structs::InspectResponse_Struct); + + OUT(TargetID); + OUT(playerid); + + int r; + for (r = 0; r < 21; r++) { + strn0cpy(eq->itemnames[r], emu->itemnames[r], sizeof(eq->itemnames[r])); + } + // Swap last 2 slots for Arrow and Power Source + strn0cpy(eq->itemnames[21], emu->itemnames[22], sizeof(eq->itemnames[21])); + strn0cpy(eq->unknown_zero, emu->itemnames[21], sizeof(eq->unknown_zero)); + + int k; + for (k = 0; k < 21; k++) { + OUT(itemicons[k]); + } + // Swap last 2 slots for Arrow and Power Source + eq->itemicons[21] = emu->itemicons[22]; + eq->unknown_zero2 = emu->itemicons[21]; + strn0cpy(eq->text, emu->text, sizeof(eq->text)); + + FINISH_ENCODE(); + }*/ + + ENCODE(OP_InspectBuffs) + { + ENCODE_LENGTH_EXACT(InspectBuffs_Struct); + SETUP_DIRECT_ENCODE(InspectBuffs_Struct, structs::InspectBuffs_Struct); + + // we go over the internal 25 instead of the packet's since no entry is 0, which it will be already + for (int i = 0; i < BUFF_COUNT; i++) { + OUT(spell_id[i]); + OUT(tics_remaining[i]); + } + + FINISH_ENCODE(); + } + + ENCODE(OP_InspectRequest) + { + ENCODE_LENGTH_EXACT(Inspect_Struct); + SETUP_DIRECT_ENCODE(Inspect_Struct, structs::Inspect_Struct); + + OUT(TargetID); + OUT(PlayerID); + + FINISH_ENCODE(); + } + + ENCODE(OP_InterruptCast) + { + ENCODE_LENGTH_EXACT(InterruptCast_Struct); + SETUP_DIRECT_ENCODE(InterruptCast_Struct, structs::InterruptCast_Struct); + + OUT(spawnid); + OUT(messageid); + + FINISH_ENCODE(); + } + + ENCODE(OP_ItemLinkResponse) { ENCODE_FORWARD(OP_ItemPacket); } + + ENCODE(OP_ItemPacket) + { + //consume the packet + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + ItemPacket_Struct *old_item_pkt = (ItemPacket_Struct *)__emu_buffer; + InternalSerializedItem_Struct *int_struct = (InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); + + uint32 length; + char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); + + if (!serialized) { + _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + delete in; + return; + } + in->size = length + 4; + in->pBuffer = new unsigned char[in->size]; + ItemPacket_Struct *new_item_pkt = (ItemPacket_Struct *)in->pBuffer; + new_item_pkt->PacketType = old_item_pkt->PacketType; + memcpy(new_item_pkt->SerializedItem, serialized, length); + + delete[] __emu_buffer; + safe_delete_array(serialized); + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_ItemVerifyReply) + { + ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct); + SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct); + + eq->slot = ServerToRoF2Slot(emu->slot); + OUT(spell); + OUT(target); + + FINISH_ENCODE(); + } + + ENCODE(OP_LeadershipExpUpdate) + { + SETUP_DIRECT_ENCODE(LeadershipExpUpdate_Struct, structs::LeadershipExpUpdate_Struct); + + OUT(group_leadership_exp); + OUT(group_leadership_points); + OUT(raid_leadership_exp); + OUT(raid_leadership_points); + + FINISH_ENCODE(); + } + + ENCODE(OP_LogServer) + { + ENCODE_LENGTH_EXACT(LogServer_Struct); + SETUP_DIRECT_ENCODE(LogServer_Struct, structs::LogServer_Struct); + + strncpy(eq->worldshortname, emu->worldshortname, sizeof(eq->worldshortname)); + + //OUT(enablevoicemacros); // These two are lost, but must be one of the 1s in unknown[249] + //OUT(enablemail); + OUT(enable_pvp); + OUT(enable_FV); + + eq->unknown016 = 1; + eq->unknown020[0] = 1; + + eq->unknown249[0] = 1; + eq->unknown249[1] = 1; + eq->unknown249[8] = 1; + eq->unknown249[9] = 1; + eq->unknown249[12] = 1; + eq->unknown249[14] = 1; + eq->unknown249[15] = 1; + eq->unknown249[16] = 1; + + eq->unknown276[0] = 1.0f; + eq->unknown276[1] = 1.0f; + eq->unknown276[6] = 1.0f; + + FINISH_ENCODE(); + } + + ENCODE(OP_LootItem) + { + ENCODE_LENGTH_EXACT(LootingItem_Struct); + SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct); + + OUT(lootee); + OUT(looter); + eq->slot_id = ServerToRoF2CorpseSlot(emu->slot_id); + OUT(auto_loot); + + FINISH_ENCODE(); + } + + ENCODE(OP_ManaChange) + { + ENCODE_LENGTH_EXACT(ManaChange_Struct); + SETUP_DIRECT_ENCODE(ManaChange_Struct, structs::ManaChange_Struct); + + OUT(new_mana); + OUT(stamina); + OUT(spell_id); + eq->unknown16 = -1; // Self Interrupt/Success = -1, Fizzle = 1, Other Interrupt = 2? + + FINISH_ENCODE(); + } + + ENCODE(OP_MercenaryDataResponse) + { + //consume the packet + EQApplicationPacket *in = *p; + *p = nullptr; + + //store away the emu struct + unsigned char *__emu_buffer = in->pBuffer; + MercenaryMerchantList_Struct *emu = (MercenaryMerchantList_Struct *)__emu_buffer; + + char *Buffer = (char *)in->pBuffer; + + int PacketSize = sizeof(structs::MercenaryMerchantList_Struct) - 4 + emu->MercTypeCount * 4; + PacketSize += (sizeof(structs::MercenaryListEntry_Struct) - sizeof(structs::MercenaryStance_Struct)) * emu->MercCount; + + uint32 r; + uint32 k; + for (r = 0; r < emu->MercCount; r++) + { + PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->Mercs[r].StanceCount; + } + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryDataResponse, PacketSize); + Buffer = (char *)outapp->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercTypeCount); + + for (r = 0; r < emu->MercTypeCount; r++) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercGrades[r]); + } + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercCount); + + for (r = 0; r < emu->MercCount; r++) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MercID); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MercType); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MercSubType); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].PurchaseCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].UpkeepCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].Status); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].AltCurrencyCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].AltCurrencyUpkeep); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].AltCurrencyType); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->Mercs[r].MercUnk01); + VARSTRUCT_ENCODE_TYPE(int32, Buffer, emu->Mercs[r].TimeLeft); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MerchantSlot); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MercUnk02); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].StanceCount); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].MercUnk03); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->Mercs[r].MercUnk04); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // MercName + for (k = 0; k < emu->Mercs[r].StanceCount; k++) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].Stances[k].StanceIndex); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->Mercs[r].Stances[k].Stance); + } + } + + dest->FastQueuePacket(&outapp, ack_req); + delete in; + } + + ENCODE(OP_MercenaryDataUpdate) + { + //consume the packet + EQApplicationPacket *in = *p; + *p = nullptr; + + //store away the emu struct + unsigned char *__emu_buffer = in->pBuffer; + MercenaryDataUpdate_Struct *emu = (MercenaryDataUpdate_Struct *)__emu_buffer; + + char *Buffer = (char *)in->pBuffer; + + EQApplicationPacket *outapp; + + uint32 PacketSize = 0; + + // There are 2 different sized versions of this packet depending if a merc is hired or not + if (emu->MercStatus >= 0) + { + PacketSize += sizeof(structs::MercenaryDataUpdate_Struct) + (sizeof(structs::MercenaryData_Struct) - sizeof(structs::MercenaryStance_Struct)) * emu->MercCount; + + uint32 r; + uint32 k; + for (r = 0; r < emu->MercCount; r++) + { + PacketSize += sizeof(structs::MercenaryStance_Struct) * emu->MercData[r].StanceCount; + PacketSize += strlen(emu->MercData[r].MercName); // Null Terminator size already accounted for in the struct + } + + outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, PacketSize); + Buffer = (char *)outapp->pBuffer; + + VARSTRUCT_ENCODE_TYPE(int32, Buffer, emu->MercStatus); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercCount); + + for (r = 0; r < emu->MercCount; r++) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].MercID); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].MercType); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].MercSubType); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].PurchaseCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].UpkeepCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].Status); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].AltCurrencyCost); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].AltCurrencyUpkeep); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].AltCurrencyType); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->MercData[r].MercUnk01); + VARSTRUCT_ENCODE_TYPE(int32, Buffer, emu->MercData[r].TimeLeft); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].MerchantSlot); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].MercUnk02); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].StanceCount); + VARSTRUCT_ENCODE_TYPE(int32, Buffer, emu->MercData[r].MercUnk03); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->MercData[r].MercUnk04); + //VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // MercName + VARSTRUCT_ENCODE_STRING(Buffer, emu->MercData[r].MercName); + for (k = 0; k < emu->MercData[r].StanceCount; k++) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].Stances[k].StanceIndex); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercData[r].Stances[k].Stance); + } + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 1); // MercUnk05 + } + } + else + { + PacketSize += sizeof(structs::NoMercenaryHired_Struct); + + outapp = new EQApplicationPacket(OP_MercenaryDataUpdate, PacketSize); + Buffer = (char *)outapp->pBuffer; + + VARSTRUCT_ENCODE_TYPE(int32, Buffer, emu->MercStatus); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->MercCount); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 1); + } + + dest->FastQueuePacket(&outapp, ack_req); + delete in; + } + + ENCODE(OP_MoveItem) + { + ENCODE_LENGTH_EXACT(MoveItem_Struct); + SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct); + + eq->from_slot = ServerToRoF2Slot(emu->from_slot); + eq->to_slot = ServerToRoF2Slot(emu->to_slot); + OUT(number_in_stack); + + FINISH_ENCODE(); + } + + ENCODE(OP_NewSpawn) { ENCODE_FORWARD(OP_ZoneSpawns); } + + ENCODE(OP_NewZone) + { + SETUP_DIRECT_ENCODE(NewZone_Struct, structs::NewZone_Struct); + + OUT_str(char_name); + OUT_str(zone_short_name); + OUT_str(zone_long_name); + OUT(ztype); + int r; + for (r = 0; r < 4; r++) { + OUT(fog_red[r]); + OUT(fog_green[r]); + OUT(fog_blue[r]); + OUT(fog_minclip[r]); + OUT(fog_maxclip[r]); + } + OUT(gravity); + OUT(time_type); + for (r = 0; r < 4; r++) { + OUT(rain_chance[r]); + } + for (r = 0; r < 4; r++) { + OUT(rain_duration[r]); + } + for (r = 0; r < 4; r++) { + OUT(snow_chance[r]); + } + for (r = 0; r < 4; r++) { + OUT(snow_duration[r]); + } + for (r = 0; r < 32; r++) { + eq->unknown537[r] = 0xFF; //observed + } + OUT(sky); + OUT(zone_exp_multiplier); + OUT(safe_y); + OUT(safe_x); + OUT(safe_z); + OUT(max_z); + OUT(underworld); + OUT(minclip); + OUT(maxclip); + OUT_str(zone_short_name2); + OUT(zone_id); + OUT(zone_instance); + OUT(SuspendBuffs); + + eq->FogDensity = emu->fog_density; + + /*fill in some unknowns with observed values, hopefully it will help */ + eq->unknown800 = -1; + eq->unknown844 = 600; + eq->unknown880 = 50; + eq->unknown884 = 10; + eq->unknown888 = 1; + eq->unknown889 = 0; + eq->unknown890 = 1; + eq->unknown891 = 0; + eq->unknown892 = 0; + eq->unknown893 = 0; + eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off + eq->unknown895 = 0; + eq->unknown896 = 180; + eq->unknown900 = 180; + eq->unknown904 = 180; + eq->unknown908 = 2; + eq->unknown912 = 2; + eq->unknown932 = -1; // Set from PoK Example + eq->unknown936 = -1; // Set from PoK Example + eq->unknown944 = 1.0; // Set from PoK Example + + FINISH_ENCODE(); + } + + ENCODE(OP_OnLevelMessage) + { + ENCODE_LENGTH_EXACT(OnLevelMessage_Struct); + SETUP_DIRECT_ENCODE(OnLevelMessage_Struct, structs::OnLevelMessage_Struct); + + // This packet is variable sized now, but forcing it to the old packet size for now. + eq->Title_Count = 128; + memcpy(eq->Title, emu->Title, sizeof(eq->Title)); + eq->Text_Count = 4096; + memcpy(eq->Text, emu->Text, sizeof(eq->Text)); + OUT(Buttons); + OUT(Duration); + OUT(PopupID); + OUT(NegativeID); + // These two field names are used if Buttons == 1. We should add an interface to them via Perl. + eq->ButtonName0_Count = 25; + OUT_str(ButtonName0); + eq->ButtonName1_Count = 25; + OUT_str(ButtonName1); + + FINISH_ENCODE(); + } + + /* + ENCODE(OP_OpenNewTasksWindow) + { + AvailableTaskHeader_Struct* __emu_AvailableTaskHeader; + AvailableTaskData1_Struct* __emu_AvailableTaskData1; + AvailableTaskData2_Struct* __emu_AvailableTaskData2; + AvailableTaskTrailer_Struct* __emu_AvailableTaskTrailer; + + structs::AvailableTaskHeader_Struct* __eq_AvailableTaskHeader; + structs::AvailableTaskData1_Struct* __eq_AvailableTaskData1; + structs::AvailableTaskData2_Struct* __eq_AvailableTaskData2; + structs::AvailableTaskTrailer_Struct* __eq_AvailableTaskTrailer; + + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + + __emu_AvailableTaskHeader = (AvailableTaskHeader_Struct*)__emu_buffer; + + // For each task, SoF has an extra uint32 and what appears to be space for a null terminated string. + // + in->size = in->size + (__emu_AvailableTaskHeader->TaskCount * 5); + + in->pBuffer = new unsigned char[in->size]; + + unsigned char *__eq_buffer = in->pBuffer; + + __eq_AvailableTaskHeader = (structs::AvailableTaskHeader_Struct*)__eq_buffer; + + char *__eq_ptr, *__emu_Ptr; + + // Copy Header + // + // + + __eq_AvailableTaskHeader->TaskCount = __emu_AvailableTaskHeader->TaskCount; + __eq_AvailableTaskHeader->unknown1 = __emu_AvailableTaskHeader->unknown1; + __eq_AvailableTaskHeader->TaskGiver = __emu_AvailableTaskHeader->TaskGiver; + + __emu_Ptr = (char *) __emu_AvailableTaskHeader + sizeof(AvailableTaskHeader_Struct); + __eq_ptr = (char *) __eq_AvailableTaskHeader + sizeof(structs::AvailableTaskHeader_Struct); + + for(uint32 i=0; i<__emu_AvailableTaskHeader->TaskCount; i++) { + + __emu_AvailableTaskData1 = (AvailableTaskData1_Struct*)__emu_Ptr; + __eq_AvailableTaskData1 = (structs::AvailableTaskData1_Struct*)__eq_ptr; + + __eq_AvailableTaskData1->TaskID = __emu_AvailableTaskData1->TaskID; + // This next unknown seems to affect the colour of the task title. 0x3f80000 is what I have seen + // in RoF2 packets. Changing it to 0x3f000000 makes the title red. + __eq_AvailableTaskData1->unknown1 = 0x3f800000; + __eq_AvailableTaskData1->TimeLimit = __emu_AvailableTaskData1->TimeLimit; + __eq_AvailableTaskData1->unknown2 = __emu_AvailableTaskData1->unknown2; + + __emu_Ptr += sizeof(AvailableTaskData1_Struct); + __eq_ptr += sizeof(structs::AvailableTaskData1_Struct); + + strcpy(__eq_ptr, __emu_Ptr); // Title + + __emu_Ptr += strlen(__emu_Ptr) + 1; + __eq_ptr += strlen(__eq_ptr) + 1; + + strcpy(__eq_ptr, __emu_Ptr); // Description + + __emu_Ptr += strlen(__emu_Ptr) + 1; + __eq_ptr += strlen(__eq_ptr) + 1; + + __eq_ptr[0] = 0; + __eq_ptr += strlen(__eq_ptr) + 1; + + __emu_AvailableTaskData2 = (AvailableTaskData2_Struct*)__emu_Ptr; + __eq_AvailableTaskData2 = (structs::AvailableTaskData2_Struct*)__eq_ptr; + + __eq_AvailableTaskData2->unknown1 = __emu_AvailableTaskData2->unknown1; + __eq_AvailableTaskData2->unknown2 = __emu_AvailableTaskData2->unknown2; + __eq_AvailableTaskData2->unknown3 = __emu_AvailableTaskData2->unknown3; + __eq_AvailableTaskData2->unknown4 = __emu_AvailableTaskData2->unknown4; + + __emu_Ptr += sizeof(AvailableTaskData2_Struct); + __eq_ptr += sizeof(structs::AvailableTaskData2_Struct); + + strcpy(__eq_ptr, __emu_Ptr); // Unknown string + + __emu_Ptr += strlen(__emu_Ptr) + 1; + __eq_ptr += strlen(__eq_ptr) + 1; + + strcpy(__eq_ptr, __emu_Ptr); // Unknown string + + __emu_Ptr += strlen(__emu_Ptr) + 1; + __eq_ptr += strlen(__eq_ptr) + 1; + + __emu_AvailableTaskTrailer = (AvailableTaskTrailer_Struct*)__emu_Ptr; + __eq_AvailableTaskTrailer = (structs::AvailableTaskTrailer_Struct*)__eq_ptr; + + __eq_AvailableTaskTrailer->ItemCount = __emu_AvailableTaskTrailer->ItemCount; + __eq_AvailableTaskTrailer->unknown1 = __emu_AvailableTaskTrailer->unknown1; + __eq_AvailableTaskTrailer->unknown2 = __emu_AvailableTaskTrailer->unknown2; + __eq_AvailableTaskTrailer->StartZone = __emu_AvailableTaskTrailer->StartZone; + + __emu_Ptr += sizeof(AvailableTaskTrailer_Struct); + __eq_ptr += sizeof(structs::AvailableTaskTrailer_Struct); + + strcpy(__eq_ptr, __emu_Ptr); // Unknown string + + __emu_Ptr += strlen(__emu_Ptr) + 1; + __eq_ptr += strlen(__eq_ptr) + 1; + } + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + */ + + ENCODE(OP_PetBuffWindow) + { + // The format of the RoF2 packet is identical to the OP_BuffCreate packet. + + SETUP_VAR_ENCODE(PetBuff_Struct); + + uint32 sz = 12 + (17 * emu->buffcount); + __packet->size = sz; + __packet->pBuffer = new unsigned char[sz]; + memset(__packet->pBuffer, 0, sz); + + __packet->WriteUInt32(emu->petid); + __packet->WriteUInt32(0); // PlayerID ? + __packet->WriteUInt8(1); // 1 indicates all buffs on the pet (0 to add or remove a single buff) + __packet->WriteUInt16(emu->buffcount); + + for (uint16 i = 0; i < BUFF_COUNT; ++i) + { + if (emu->spellid[i]) + { + __packet->WriteUInt32(i); + __packet->WriteUInt32(emu->spellid[i]); + __packet->WriteUInt32(emu->ticsremaining[i]); + __packet->WriteUInt32(0); // Unknown + __packet->WriteString(""); + } + } + __packet->WriteUInt8(0); // Unknown + + FINISH_ENCODE(); + } + + ENCODE(OP_PlayerProfile) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + PlayerProfile_Struct *emu = (PlayerProfile_Struct *)__emu_buffer; + + uint32 PacketSize = 40000; // Calculate this later + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_PlayerProfile, PacketSize); + + outapp->WriteUInt32(0); // Checksum, we will update this later + outapp->WriteUInt32(0); // Checksum size, we will update this later + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + + outapp->WriteUInt8(emu->gender); // Gender + outapp->WriteUInt32(emu->race); // Race + outapp->WriteUInt8(emu->class_); // Class + outapp->WriteUInt8(emu->level); // Level + outapp->WriteUInt8(emu->level); // Level1 + + + outapp->WriteUInt32(5); // Bind count + + for (int r = 0; r < 5; r++) + { + outapp->WriteUInt32(emu->binds[r].zoneId); + outapp->WriteFloat(emu->binds[r].x); + outapp->WriteFloat(emu->binds[r].y); + outapp->WriteFloat(emu->binds[r].z); + outapp->WriteFloat(emu->binds[r].heading); + } + + outapp->WriteUInt32(emu->deity); + outapp->WriteUInt32(emu->intoxication); + + outapp->WriteUInt32(10); // Unknown count + + for (int r = 0; r < 10; r++) + { + outapp->WriteUInt32(0); // Unknown + } + + outapp->WriteUInt32(22); // Equipment count + + for (int r = 0; r < 9; r++) + { + outapp->WriteUInt32(emu->item_material[r]); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + + // Write zeroes for the next 13 equipment slots + + for (int r = 0; r < 13; r++) + { + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(9); // Equipment2 count + + for (int r = 0; r < 9; r++) + { + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(9); // Tint Count + + for (int r = 0; r < 7; r++) + { + outapp->WriteUInt32(emu->item_tint[r].color); + } + // Write zeroes for extra two tint values + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + + outapp->WriteUInt32(9); // Tint2 Count + + for (int r = 0; r < 7; r++) + { + outapp->WriteUInt32(emu->item_tint[r].color); + } + // Write zeroes for extra two tint values + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + + outapp->WriteUInt8(emu->haircolor); + outapp->WriteUInt8(emu->beardcolor); + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt8(emu->eyecolor1); + outapp->WriteUInt8(emu->eyecolor2); + outapp->WriteUInt8(emu->hairstyle); + outapp->WriteUInt8(emu->beard); + outapp->WriteUInt8(emu->face); + + // Think there should be an extra byte before the drakkin stuff (referred to as oldface in client) + // Then one of the five bytes following the drakkin stuff needs removing. + + outapp->WriteUInt32(emu->drakkin_heritage); + outapp->WriteUInt32(emu->drakkin_tattoo); + outapp->WriteUInt32(emu->drakkin_details); + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteFloat(5.0f); // Height ? + + outapp->WriteFloat(3.0f); // Unknown + outapp->WriteFloat(2.5f); // Unknown + outapp->WriteFloat(5.5f); // Unknown + + outapp->WriteUInt32(0); // Primary ? + outapp->WriteUInt32(0); // Secondary ? + + outapp->WriteUInt32(emu->points); // Unspent skill points + outapp->WriteUInt32(emu->mana); + outapp->WriteUInt32(emu->cur_hp); + + outapp->WriteUInt32(emu->STR); + outapp->WriteUInt32(emu->STA); + outapp->WriteUInt32(emu->CHA); + outapp->WriteUInt32(emu->DEX); + outapp->WriteUInt32(emu->INT); + outapp->WriteUInt32(emu->AGI); + outapp->WriteUInt32(emu->WIS); + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(300); // AA Count + + for (uint32 r = 0; r < MAX_PP_AA_ARRAY; r++) + { + outapp->WriteUInt32(emu->aa_array[r].AA); + outapp->WriteUInt32(emu->aa_array[r].value); + outapp->WriteUInt32(0); + } + + // Fill the other 60 AAs with zeroes + + for (uint32 r = 0; r < structs::MAX_PP_AA_ARRAY - MAX_PP_AA_ARRAY; r++) + { + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(structs::MAX_PP_SKILL); + + for (uint32 r = 0; r < structs::MAX_PP_SKILL; r++) + { + outapp->WriteUInt32(emu->skills[r]); + } + + // deprecated + // Write zeroes for the rest of the skills + /* + for(uint32 r = 0; r < structs::MAX_PP_SKILL - MAX_PP_SKILL; r++) + { + outapp->WriteUInt32(emu->skills[r]); + } + */ + + outapp->WriteUInt32(25); // Unknown count + + for (uint32 r = 0; r < 25; r++) + { + outapp->WriteUInt32(0); // Unknown + } + + outapp->WriteUInt32(structs::MAX_PP_DISCIPLINES); // Discipline count + + for (uint32 r = 0; r < MAX_PP_DISCIPLINES; r++) + { + outapp->WriteUInt32(emu->disciplines.values[r]); + } + + // Write zeroes for the rest of the disciplines + for (uint32 r = 0; r < structs::MAX_PP_DISCIPLINES - MAX_PP_DISCIPLINES; r++) + { + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(20); // Timestamp count + + for (uint32 r = 0; r < 20; r++) + { + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(MAX_RECAST_TYPES); // Timestamp count + + for (uint32 r = 0; r < MAX_RECAST_TYPES; r++) + { + outapp->WriteUInt32(emu->recastTimers[r]); + } + + outapp->WriteUInt32(100); // Timestamp2 count + + for (uint32 r = 0; r < 100; r++) + { + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(structs::MAX_PP_SPELLBOOK); // Spellbook slots + + for (uint32 r = 0; r < MAX_PP_SPELLBOOK; r++) + { + outapp->WriteUInt32(emu->spell_book[r]); + } + // zeroes for the rest of the spellbook slots + for (uint32 r = 0; r < structs::MAX_PP_SPELLBOOK - MAX_PP_SPELLBOOK; r++) + { + outapp->WriteUInt32(0xFFFFFFFFU); + } + + outapp->WriteUInt32(structs::MAX_PP_MEMSPELL); // Memorised spell slots + + for (uint32 r = 0; r < MAX_PP_MEMSPELL; r++) + { + outapp->WriteUInt32(emu->mem_spells[r]); + } + // zeroes for the rest of the slots + for (uint32 r = 0; r < structs::MAX_PP_MEMSPELL - MAX_PP_MEMSPELL; r++) + { + outapp->WriteUInt32(0xFFFFFFFFU); + } + + outapp->WriteUInt32(13); // Unknown count + + for (uint32 r = 0; r < 13; r++) + { + outapp->WriteUInt32(0); // Unknown + } + + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(structs::BUFF_COUNT); + + //*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise + //*001*/ float unknown004; // Seen 1 for no buff + //*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages + //*009*/ uint32 unknown016; + //*013*/ uint8 bard_modifier; + //*014*/ uint32 duration; + //*018*/ uint8 level; + //*019*/ uint32 spellid; + //*023*/ uint32 counters; + //*027*/ uint8 unknown0028[53]; + //*080*/ + + for (uint32 r = 0; r < BUFF_COUNT; r++) + { + float instrument_mod = 0.0f; + uint8 slotid = emu->buffs[r].slotid; + uint32 player_id = emu->buffs[r].player_id;; + + if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0) + { + instrument_mod = 1.0f + (emu->buffs[r].bard_modifier - 10) / 10.0f; + slotid = 2; + player_id = 0x000717fd; + } + else + { + slotid = 0; + } + outapp->WriteUInt8(0); // Had this as slot, but always appears to be 0 on live. + outapp->WriteFloat(instrument_mod); + outapp->WriteUInt32(player_id); + outapp->WriteUInt8(0); + outapp->WriteUInt32(emu->buffs[r].counters); + //outapp->WriteUInt8(emu->buffs[r].bard_modifier); + outapp->WriteUInt32(emu->buffs[r].duration); + outapp->WriteUInt8(emu->buffs[r].level); + outapp->WriteUInt32(emu->buffs[r].spellid); + outapp->WriteUInt32(slotid); // Only ever seen 2 + outapp->WriteUInt32(0); + outapp->WriteUInt8(0); + outapp->WriteUInt32(emu->buffs[r].counters); // Appears twice ? + + for (uint32 j = 0; j < 44; ++j) + outapp->WriteUInt8(0); // Unknown + } + + for (uint32 r = 0; r < structs::BUFF_COUNT - BUFF_COUNT; r++) + { + // 80 bytes of zeroes + for (uint32 j = 0; j < 20; ++j) + outapp->WriteUInt32(0); + + } + + outapp->WriteUInt32(emu->platinum); + outapp->WriteUInt32(emu->gold); + outapp->WriteUInt32(emu->silver); + outapp->WriteUInt32(emu->copper); + + outapp->WriteUInt32(emu->platinum_cursor); + outapp->WriteUInt32(emu->gold_cursor); + outapp->WriteUInt32(emu->silver_cursor); + outapp->WriteUInt32(emu->copper_cursor); + + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(0); // This is the cooldown timer for the monk 'Mend' skill. Client will add 6 minutes to this value the first time the + // player logs in. After that it will honour whatever value we send here. + + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(emu->thirst_level); + outapp->WriteUInt32(emu->hunger_level); + + outapp->WriteUInt32(emu->aapoints_spent); + + outapp->WriteUInt32(5); // AA Points count ?? + outapp->WriteUInt32(1234); // AA Points assigned + outapp->WriteUInt32(0); // AA Points in General ? + outapp->WriteUInt32(0); // AA Points in Class ? + outapp->WriteUInt32(0); // AA Points in Archetype ? + outapp->WriteUInt32(0); // AA Points in Special ? + outapp->WriteUInt32(emu->aapoints); // AA Points unspent + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(structs::MAX_PLAYER_BANDOLIER); + + for (uint32 r = 0; r < EmuConstants::BANDOLIERS_COUNT; r++) + { + 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); + outapp->WriteUInt32(emu->bandoliers[r].items[j].icon); + } + } + + for (uint32 r = 0; r < structs::MAX_PLAYER_BANDOLIER - EmuConstants::BANDOLIERS_COUNT; r++) + { + outapp->WriteString(""); + + for (uint32 j = 0; j < EmuConstants::BANDOLIER_SIZE; ++j) + { + outapp->WriteString(""); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + } + + outapp->WriteUInt32(structs::MAX_POTIONS_IN_BELT); + + 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); + outapp->WriteUInt32(emu->potionbelt.items[r].icon); + } + + for (uint32 r = 0; r < structs::MAX_POTIONS_IN_BELT - EmuConstants::POTION_BELT_SIZE; r++) + { + outapp->WriteString(""); + outapp->WriteUInt32(0); + outapp->WriteUInt32(0); + } + + outapp->WriteSInt32(-1); // Unknown; + outapp->WriteSInt32(123); // HP Total ? + outapp->WriteSInt32(234); // Endurance Total ? + outapp->WriteSInt32(345); // Mana Total ? + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(20); // Unknown - Expansion count ? + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(emu->endurance); + outapp->WriteUInt32(0); // Unknown - Observed 0x7cde - This is also seen in guild packets sent to this character. + outapp->WriteUInt32(0); // Unknown - Observed 0x64 + + outapp->WriteUInt32(64); // Name Length + + uint32 CurrentPosition = outapp->GetWritePosition(); + + outapp->WriteString(emu->name); + + outapp->SetWritePosition(CurrentPosition + 64); + + outapp->WriteUInt32(32); // Last Name Length + + CurrentPosition = outapp->GetWritePosition(); + + outapp->WriteString(emu->last_name); + + outapp->SetWritePosition(CurrentPosition + 32); + + outapp->WriteUInt32(emu->birthday); + outapp->WriteUInt32(emu->birthday); // Account start date ? + outapp->WriteUInt32(emu->lastlogin); + outapp->WriteUInt32(emu->timePlayedMin); + outapp->WriteUInt32(emu->timeentitledonaccount); + outapp->WriteUInt32(0x0007ffff); // Expansion bitmask + + outapp->WriteUInt32(structs::MAX_PP_LANGUAGE); + + for (uint32 r = 0; r < MAX_PP_LANGUAGE; r++) + { + outapp->WriteUInt8(emu->languages[r]); + } + + for (uint32 r = 0; r < structs::MAX_PP_LANGUAGE - MAX_PP_LANGUAGE; r++) + { + outapp->WriteUInt8(0); + } + + outapp->WriteUInt16(emu->zone_id); + outapp->WriteUInt16(emu->zoneInstance); + + outapp->WriteFloat(emu->y); + outapp->WriteFloat(emu->x); + outapp->WriteFloat(emu->z); + outapp->WriteFloat(emu->heading); + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(emu->pvp); + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(emu->gm); + + outapp->WriteUInt32(emu->guild_id); + outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. + outapp->WriteUInt32(0); // Unknown - observed 1 in a live packet. + outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt64(emu->exp); + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(emu->platinum_bank); + outapp->WriteUInt32(emu->gold_bank); + outapp->WriteUInt32(emu->silver_bank); + outapp->WriteUInt32(emu->copper_bank); + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(42); // The meaning of life ? + + for (uint32 r = 0; r < 42; r++) + { + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + } + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt32(emu->career_tribute_points); + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(emu->tribute_points); + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(EmuConstants::TRIBUTE_SIZE); + + for (uint32 r = 0; r < EmuConstants::TRIBUTE_SIZE; r++) + { + outapp->WriteUInt32(emu->tributes[r].tribute); + outapp->WriteUInt32(emu->tributes[r].tier); + } + + outapp->WriteUInt32(10); // Guild Tribute Count ? + + for (uint32 r = 0; r < 10; r++) + { + outapp->WriteUInt32(0xffffffff); + outapp->WriteUInt32(0); + } + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + // Block of 121 unknown bytes + for (uint32 r = 0; r < 121; r++) + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(emu->currentRadCrystals); + outapp->WriteUInt32(emu->careerRadCrystals); + outapp->WriteUInt32(emu->currentEbonCrystals); + outapp->WriteUInt32(emu->careerEbonCrystals); + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + // Unknown String ? + outapp->WriteUInt32(64); // Unknown + for (uint32 r = 0; r < 64; r++) + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + + // Unknown String ? + outapp->WriteUInt32(64); // Unknown + for (uint32 r = 0; r < 64; r++) + outapp->WriteUInt8(0); // Unknown + + // Unknown String ? + outapp->WriteUInt32(64); // Unknown + for (uint32 r = 0; r < 64; r++) + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + + // Block of 320 unknown bytes + for (uint32 r = 0; r < 320; r++) + outapp->WriteUInt8(0); // Unknown + + // Block of 343 unknown bytes + for (uint32 r = 0; r < 343; r++) + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(emu->leadAAActive); + + outapp->WriteUInt32(6); // Count ... of LDoN stats ? + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(emu->ldon_points_guk); + outapp->WriteUInt32(emu->ldon_points_mir); + outapp->WriteUInt32(emu->ldon_points_mmc); + outapp->WriteUInt32(emu->ldon_points_ruj); + outapp->WriteUInt32(emu->ldon_points_tak); + + outapp->WriteUInt32(emu->ldon_points_available); + + outapp->WriteDouble(emu->group_leadership_exp); + outapp->WriteDouble(emu->raid_leadership_exp); + + outapp->WriteUInt32(emu->group_leadership_points); + outapp->WriteUInt32(emu->raid_leadership_points); + + outapp->WriteUInt32(64); // Group of 64 int32s follow Group/Raid Leadership abilities ? + + for (uint32 r = 0; r < MAX_LEADERSHIP_AA_ARRAY; r++) + outapp->WriteUInt32(emu->leader_abilities.ranks[r]); + + for (uint32 r = 0; r < 64 - MAX_LEADERSHIP_AA_ARRAY; r++) + outapp->WriteUInt32(0); // Unused/unsupported Leadership abilities + + outapp->WriteUInt32(emu->air_remaining); // ? + + // PVP Stats + + outapp->WriteUInt32(emu->PVPKills); + outapp->WriteUInt32(emu->PVPDeaths); + outapp->WriteUInt32(emu->PVPCurrentPoints); + outapp->WriteUInt32(emu->PVPCareerPoints); + outapp->WriteUInt32(emu->PVPBestKillStreak); + outapp->WriteUInt32(emu->PVPWorstDeathStreak); + outapp->WriteUInt32(emu->PVPCurrentKillStreak); + + // Last PVP Kill + + outapp->WriteString(emu->PVPLastKill.Name); + outapp->WriteUInt32(emu->PVPLastKill.Level); + outapp->WriteUInt32(emu->PVPLastKill.Race); + outapp->WriteUInt32(emu->PVPLastKill.Class); + outapp->WriteUInt32(emu->PVPLastKill.Zone); + outapp->WriteUInt32(emu->PVPLastKill.Time); + outapp->WriteUInt32(emu->PVPLastKill.Points); + + // Last PVP Death + + outapp->WriteString(emu->PVPLastDeath.Name); + outapp->WriteUInt32(emu->PVPLastDeath.Level); + outapp->WriteUInt32(emu->PVPLastDeath.Race); + outapp->WriteUInt32(emu->PVPLastDeath.Class); + outapp->WriteUInt32(emu->PVPLastDeath.Zone); + outapp->WriteUInt32(emu->PVPLastDeath.Time); + outapp->WriteUInt32(emu->PVPLastDeath.Points); + + outapp->WriteUInt32(emu->PVPNumberOfKillsInLast24Hours); + + // Last 50 Kills + outapp->WriteUInt32(50); + for (uint32 r = 0; r < 50; ++r) + { + outapp->WriteString(emu->PVPRecentKills[r].Name); + outapp->WriteUInt32(emu->PVPRecentKills[r].Level); + outapp->WriteUInt32(emu->PVPRecentKills[r].Race); + outapp->WriteUInt32(emu->PVPRecentKills[r].Class); + outapp->WriteUInt32(emu->PVPRecentKills[r].Zone); + outapp->WriteUInt32(emu->PVPRecentKills[r].Time); + outapp->WriteUInt32(emu->PVPRecentKills[r].Points); + } + + outapp->WriteUInt32(emu->expAA); + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + outapp->WriteUInt8(emu->groupAutoconsent); + outapp->WriteUInt8(emu->raidAutoconsent); + outapp->WriteUInt8(emu->guildAutoconsent); + + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(emu->level); // Level3 ? + + outapp->WriteUInt8(emu->showhelm); + + outapp->WriteUInt32(emu->RestTimer); + + outapp->WriteUInt32(1024); // Unknown Count + + // Block of 1024 unknown bytes + outapp->WriteUInt8(31); // Unknown + + for (uint32 r = 0; r < 1023; r++) + outapp->WriteUInt8(0); // Unknown + + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + + // Think we need 1 byte of padding at the end + + outapp->WriteUInt8(0); // Unknown + + _log(NET__STRUCTS, "Player Profile Packet is %i bytes", outapp->GetWritePosition()); + + unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; + memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); + safe_delete_array(outapp->pBuffer); + outapp->pBuffer = NewBuffer; + outapp->size = outapp->GetWritePosition(); + outapp->SetWritePosition(4); + outapp->WriteUInt32(outapp->size - 9); + + CRC32::SetEQChecksum(outapp->pBuffer, outapp->size - 1, 8); + //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + + dest->FastQueuePacket(&outapp, ack_req); + delete in; + return; + } + + ENCODE(OP_RaidJoin) + { + EQApplicationPacket *inapp = *p; + unsigned char * __emu_buffer = inapp->pBuffer; + RaidCreate_Struct *raid_create = (RaidCreate_Struct*)__emu_buffer; + + EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + structs::RaidGeneral_Struct *general = (structs::RaidGeneral_Struct*)outapp_create->pBuffer; + + general->action = 8; + general->parameter = 1; + strn0cpy(general->leader_name, raid_create->leader_name, 64); + strn0cpy(general->player_name, raid_create->leader_name, 64); + + dest->FastQueuePacket(&outapp_create); + delete[] __emu_buffer; + } + + ENCODE(OP_RaidUpdate) + { + EQApplicationPacket *inapp = *p; + *p = nullptr; + unsigned char * __emu_buffer = inapp->pBuffer; + RaidGeneral_Struct *raid_gen = (RaidGeneral_Struct*)__emu_buffer; + + if (raid_gen->action == 0) // raid add has longer length than other raid updates + { + RaidAddMember_Struct* in_add_member = (RaidAddMember_Struct*)__emu_buffer; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidAddMember_Struct)); + structs::RaidAddMember_Struct *add_member = (structs::RaidAddMember_Struct*)outapp->pBuffer; + + add_member->raidGen.action = in_add_member->raidGen.action; + add_member->raidGen.parameter = in_add_member->raidGen.parameter; + strn0cpy(add_member->raidGen.leader_name, in_add_member->raidGen.leader_name, 64); + strn0cpy(add_member->raidGen.player_name, in_add_member->raidGen.player_name, 64); + add_member->_class = in_add_member->_class; + add_member->level = in_add_member->level; + add_member->isGroupLeader = in_add_member->isGroupLeader; + add_member->flags[0] = in_add_member->flags[0]; + add_member->flags[1] = in_add_member->flags[1]; + add_member->flags[2] = in_add_member->flags[2]; + add_member->flags[3] = in_add_member->flags[3]; + add_member->flags[4] = in_add_member->flags[4]; + dest->FastQueuePacket(&outapp); + } + else if (raid_gen->action == 35) + { + RaidMOTD_Struct *inmotd = (RaidMOTD_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidMOTD_Struct) + strlen(inmotd->motd) + 1); + structs::RaidMOTD_Struct *outmotd = (structs::RaidMOTD_Struct *)outapp->pBuffer; + + outmotd->general.action = inmotd->general.action; + strn0cpy(outmotd->general.player_name, inmotd->general.player_name, 64); + strn0cpy(outmotd->motd, inmotd->motd, strlen(inmotd->motd) + 1); + dest->FastQueuePacket(&outapp); + } + else if (raid_gen->action == 14 || raid_gen->action == 30) + { + RaidLeadershipUpdate_Struct *inlaa = (RaidLeadershipUpdate_Struct *)__emu_buffer; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidLeadershipUpdate_Struct)); + structs::RaidLeadershipUpdate_Struct *outlaa = (structs::RaidLeadershipUpdate_Struct *)outapp->pBuffer; + + outlaa->action = inlaa->action; + strn0cpy(outlaa->player_name, inlaa->player_name, 64); + strn0cpy(outlaa->leader_name, inlaa->leader_name, 64); + memcpy(&outlaa->raid, &inlaa->raid, sizeof(RaidLeadershipAA_Struct)); + dest->FastQueuePacket(&outapp); + } + else + { + RaidGeneral_Struct* in_raid_general = (RaidGeneral_Struct*)__emu_buffer; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(structs::RaidGeneral_Struct)); + structs::RaidGeneral_Struct *raid_general = (structs::RaidGeneral_Struct*)outapp->pBuffer; + strn0cpy(raid_general->leader_name, in_raid_general->leader_name, 64); + strn0cpy(raid_general->player_name, in_raid_general->player_name, 64); + raid_general->action = in_raid_general->action; + raid_general->parameter = in_raid_general->parameter; + dest->FastQueuePacket(&outapp); + } + + delete[] __emu_buffer; + } + + ENCODE(OP_ReadBook) + { + ENCODE_LENGTH_ATLEAST(BookText_Struct); + SETUP_DIRECT_ENCODE(BookText_Struct, structs::BookRequest_Struct); + + if (emu->window == 0xFF) + eq->window = 0xFFFFFFFF; + else + eq->window = emu->window; + OUT(type); + OUT(invslot); + strn0cpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile)); + + FINISH_ENCODE(); + } + + ENCODE(OP_RecipeAutoCombine) + { + ENCODE_LENGTH_EXACT(RecipeAutoCombine_Struct); + SETUP_DIRECT_ENCODE(RecipeAutoCombine_Struct, structs::RecipeAutoCombine_Struct); + + OUT(object_type); + OUT(some_id); + eq->container_slot = ServerToRoF2Slot(emu->unknown1); + structs::ItemSlotStruct RoF2Slot; + RoF2Slot.SlotType = 8; // Observed + RoF2Slot.Unknown02 = 0; + RoF2Slot.MainSlot = 0xffff; + RoF2Slot.SubSlot = 0xffff; + RoF2Slot.AugSlot = 0xffff; + RoF2Slot.Unknown01 = 0; + eq->unknown_slot = RoF2Slot; + OUT(recipe_id); + OUT(reply_code); + + FINISH_ENCODE(); + } + + ENCODE(OP_RemoveBlockedBuffs) { ENCODE_FORWARD(OP_BlockedBuffs); } + + ENCODE(OP_RequestClientZoneChange) + { + ENCODE_LENGTH_EXACT(RequestClientZoneChange_Struct); + SETUP_DIRECT_ENCODE(RequestClientZoneChange_Struct, structs::RequestClientZoneChange_Struct); + + OUT(zone_id); + OUT(instance_id); + OUT(y); + OUT(x); + OUT(z); + OUT(heading); + eq->type = 0x0b; + eq->unknown004 = 0xffffffff; + eq->unknown172 = 0x0168b500; + + FINISH_ENCODE(); + } + + ENCODE(OP_RespondAA) + { + SETUP_DIRECT_ENCODE(AATable_Struct, structs::AATable_Struct); + + eq->aa_spent = emu->aa_spent; + // These fields may need to be correctly populated at some point + eq->aapoints_assigned = emu->aa_spent + 1; + eq->aa_spent_general = 0; + eq->aa_spent_archetype = 0; + eq->aa_spent_class = 0; + eq->aa_spent_special = 0; + + for (uint32 i = 0; i < MAX_PP_AA_ARRAY; ++i) + { + eq->aa_list[i].aa_skill = emu->aa_list[i].aa_skill; + eq->aa_list[i].aa_value = emu->aa_list[i].aa_value; + eq->aa_list[i].unknown08 = emu->aa_list[i].unknown08; + } + + FINISH_ENCODE(); + } + + ENCODE(OP_RezzRequest) + { + SETUP_DIRECT_ENCODE(Resurrect_Struct, structs::Resurrect_Struct); + + OUT(zone_id); + OUT(instance_id); + OUT(y); + OUT(x); + OUT(z); + OUT_str(your_name); + OUT_str(rezzer_name); + OUT(spellid); + OUT_str(corpse_name); + OUT(action); + + FINISH_ENCODE(); + } + + ENCODE(OP_SendAATable) + { + ENCODE_LENGTH_ATLEAST(SendAA_Struct); + SETUP_VAR_ENCODE(SendAA_Struct); + ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); + + // Check clientver field to verify this AA should be sent for SoF + // clientver 1 is for all clients and 5 is for Live + if (emu->clientver <= 5) + { + OUT(id); + eq->unknown004 = 1; + //eq->hotkey_sid = (emu->hotkey_sid==4294967295UL)?0:(emu->id - emu->current_level + 1); + //eq->hotkey_sid2 = (emu->hotkey_sid2==4294967295UL)?0:(emu->id - emu->current_level + 1); + //eq->title_sid = emu->id - emu->current_level + 1; + //eq->desc_sid = emu->id - emu->current_level + 1; + eq->hotkey_sid = (emu->hotkey_sid == 4294967295UL) ? -1 : (emu->sof_next_skill); + eq->hotkey_sid2 = (emu->hotkey_sid2 == 4294967295UL) ? -1 : (emu->sof_next_skill); + eq->title_sid = emu->sof_next_skill; + eq->desc_sid = emu->sof_next_skill; + OUT(class_type); + OUT(cost); + OUT(seq); + OUT(current_level); + eq->unknown037 = 1; // Introduced during HoT + OUT(prereq_skill); + eq->unknown045 = 1; // New Mar 21 2012 - Seen 1 + OUT(prereq_minpoints); + eq->type = emu->sof_type; + OUT(spellid); + eq->unknown057 = 1; // Introduced during HoT + OUT(spell_type); + OUT(spell_refresh); + OUT(classes); + OUT(berserker); + //eq->max_level = emu->sof_max_level; + OUT(max_level); + OUT(last_id); + OUT(next_id); + OUT(cost2); + eq->aa_expansion = emu->aa_expansion; + eq->special_category = emu->special_category; + OUT(total_abilities); + unsigned int r; + for (r = 0; r < emu->total_abilities; r++) { + OUT(abilities[r].skill_id); + OUT(abilities[r].base1); + OUT(abilities[r].base2); + OUT(abilities[r].slot); + } + } + + _hex(NET__ERROR, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); + + FINISH_ENCODE(); + } + + ENCODE(OP_SendCharInfo) + { + ENCODE_LENGTH_EXACT(CharacterSelect_Struct); + SETUP_VAR_ENCODE(CharacterSelect_Struct); + + //EQApplicationPacket *packet = *p; + //const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer; + + 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]); + } + + int total_length = sizeof(structs::CharacterSelect_Struct) + + char_count * sizeof(structs::CharacterSelectEntry_Struct) + + namelen; + + ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length); + + //unsigned char *eq_buffer = new unsigned char[total_length]; + //structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer; + + eq->char_count = char_count; + //eq->total_chars = 10; + + 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); + } + //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].equip0 = emu->equip[r][k]; + eq2->equip[k].equip1 = 0; + eq2->equip[k].equip2 = 0; + eq2->equip[k].itemid = 0; + eq2->equip[k].equip3 = emu->equip[r][k]; + eq2->equip[k].color.color = emu->cs_colors[r][k].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->LastLogin = 1212696584; + eq2->unknown2 = 0; + } + bufptr += sizeof(structs::CharacterSelectEntry_Struct); + } + + FINISH_ENCODE(); + } + + ENCODE(OP_SendMembership) + { + ENCODE_LENGTH_EXACT(Membership_Struct); + SETUP_DIRECT_ENCODE(Membership_Struct, structs::Membership_Struct); + + eq->membership = emu->membership; + eq->races = emu->races; + eq->classes = emu->classes; + eq->entrysize = 22; + for (int i = 0; i<21; i++) + { + eq->entries[i] = emu->entries[i]; + } + eq->entries[21] = 0; + + FINISH_ENCODE(); + } + + ENCODE(OP_SendZonepoints) + { + SETUP_VAR_ENCODE(ZonePoints); + ALLOC_VAR_ENCODE(structs::ZonePoints, sizeof(structs::ZonePoints) + sizeof(structs::ZonePoint_Entry) * (emu->count + 1)); + + eq->count = emu->count; + for (uint32 i = 0; i < emu->count; ++i) + { + eq->zpe[i].iterator = emu->zpe[i].iterator; + eq->zpe[i].x = emu->zpe[i].x; + eq->zpe[i].y = emu->zpe[i].y; + eq->zpe[i].z = emu->zpe[i].z; + eq->zpe[i].heading = emu->zpe[i].heading; + eq->zpe[i].zoneid = emu->zpe[i].zoneid; + eq->zpe[i].zoneinstance = emu->zpe[i].zoneinstance; + } + + FINISH_ENCODE(); + } + + ENCODE(OP_SetGuildRank) + { + ENCODE_LENGTH_EXACT(GuildSetRank_Struct); + SETUP_DIRECT_ENCODE(GuildSetRank_Struct, structs::GuildSetRank_Struct); + + eq->GuildID = emu->Unknown00; + + /* Translate older ranks to new values */ + switch (emu->Rank) { + case 0: { eq->Rank = 5; break; } // GUILD_MEMBER 0 + case 1: { eq->Rank = 3; break; } // GUILD_OFFICER 1 + case 2: { eq->Rank = 1; break; } // GUILD_LEADER 2 + default: { eq->Rank = emu->Rank; break; } + } + + memcpy(eq->MemberName, emu->MemberName, sizeof(eq->MemberName)); + OUT(Banker); + eq->Unknown76 = 1; + + FINISH_ENCODE(); + } + + ENCODE(OP_ShopPlayerBuy) + { + ENCODE_LENGTH_EXACT(Merchant_Sell_Struct); + SETUP_DIRECT_ENCODE(Merchant_Sell_Struct, structs::Merchant_Sell_Struct); + + OUT(npcid); + OUT(playerid); + OUT(itemslot); + OUT(quantity); + OUT(price); + + FINISH_ENCODE(); + } + + ENCODE(OP_ShopPlayerSell) + { + ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct); + SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + OUT(npcid); + eq->itemslot = ServerToRoF2MainInvSlot(emu->itemslot); + //OUT(itemslot); + OUT(quantity); + OUT(price); + + FINISH_ENCODE(); + } + + ENCODE(OP_ShopRequest) + { + ENCODE_LENGTH_EXACT(Merchant_Click_Struct); + SETUP_DIRECT_ENCODE(Merchant_Click_Struct, structs::Merchant_Click_Struct); + + OUT(npcid); + OUT(playerid); + OUT(command); + OUT(rate); + eq->unknown01 = 3; // Not sure what these values do yet, but list won't display without them + eq->unknown02 = 2592000; + + FINISH_ENCODE(); + } + + ENCODE(OP_SkillUpdate) + { + ENCODE_LENGTH_EXACT(SkillUpdate_Struct); + SETUP_DIRECT_ENCODE(SkillUpdate_Struct, structs::SkillUpdate_Struct); + + OUT(skillId); + OUT(value); + eq->unknown08 = 1; // Observed + eq->unknown09 = 80; // Observed + eq->unknown10 = 136; // Observed + eq->unknown11 = 54; // Observed + + FINISH_ENCODE(); + } + + ENCODE(OP_SomeItemPacketMaybe) + { + // This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow + // and flying to the target. + // + + ENCODE_LENGTH_EXACT(Arrow_Struct); + SETUP_DIRECT_ENCODE(Arrow_Struct, structs::Arrow_Struct); + + OUT(src_y); + OUT(src_x); + OUT(src_z); + OUT(velocity); + OUT(launch_angle); + OUT(tilt); + OUT(arc); + OUT(source_id); + OUT(target_id); + OUT(item_id); + + eq->unknown070 = 175; // This needs to be set to something, else we get a 1HS animation instead of ranged. + + OUT(item_type); + OUT(skill); + + strncpy(eq->model_name, emu->model_name, sizeof(eq->model_name)); + + FINISH_ENCODE(); + } + + ENCODE(OP_SpawnAppearance) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *emu_buffer = in->pBuffer; + + SpawnAppearance_Struct *sas = (SpawnAppearance_Struct *)emu_buffer; + + if (sas->type != AT_Size) + { + dest->FastQueuePacket(&in, ack_req); + return; + } + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChangeSize, sizeof(ChangeSize_Struct)); + + ChangeSize_Struct *css = (ChangeSize_Struct *)outapp->pBuffer; + + css->EntityID = sas->spawn_id; + css->Size = (float)sas->parameter; + css->Unknown08 = 0; + css->Unknown12 = 1.0f; + + dest->FastQueuePacket(&outapp, ack_req); + delete in; + } + + ENCODE(OP_SpawnDoor) + { + SETUP_VAR_ENCODE(Door_Struct); + int door_count = __packet->size / sizeof(Door_Struct); + int total_length = door_count * sizeof(structs::Door_Struct); + ALLOC_VAR_ENCODE(structs::Door_Struct, total_length); + + int r; + for (r = 0; r < door_count; r++) { + strncpy(eq[r].name, emu[r].name, sizeof(eq[r].name)); + eq[r].xPos = emu[r].xPos; + eq[r].yPos = emu[r].yPos; + eq[r].zPos = emu[r].zPos; + eq[r].heading = emu[r].heading; + eq[r].incline = emu[r].incline; + eq[r].size = emu[r].size; + eq[r].doorId = emu[r].doorId; + eq[r].opentype = emu[r].opentype; + eq[r].state_at_spawn = emu[r].state_at_spawn; + eq[r].invert_state = emu[r].invert_state; + eq[r].door_param = emu[r].door_param; + eq[r].unknown0080 = 0; + eq[r].unknown0081 = 1; // Both must be 1 to allow clicking doors + eq[r].unknown0082 = 0; + eq[r].unknown0083 = 1; // Both must be 1 to allow clicking doors + eq[r].unknown0084 = 0; + eq[r].unknown0085 = 0; + eq[r].unknown0086 = 0; + } + + FINISH_ENCODE(); + } + + ENCODE(OP_Stun) + { + ENCODE_LENGTH_EXACT(Stun_Struct); + SETUP_DIRECT_ENCODE(Stun_Struct, structs::Stun_Struct); + + OUT(duration); + eq->unknown005 = 163; + eq->unknown006 = 67; + + FINISH_ENCODE(); + } + + ENCODE(OP_TargetBuffs) { ENCODE_FORWARD(OP_BuffCreate); } + + ENCODE(OP_TaskDescription) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskDescription, in->size + 1); + // Set the Write pointer as we don't know what has been done with the packet before we get it. + in->SetReadPosition(0); + // Copy the header + for (int i = 0; i < 5; ++i) + outapp->WriteUInt32(in->ReadUInt32()); + + // Copy Title + while (uint8 c = in->ReadUInt8()) + outapp->WriteUInt8(c); + outapp->WriteUInt8(0); + + outapp->WriteUInt32(in->ReadUInt32()); // Duration + outapp->WriteUInt32(in->ReadUInt32()); // Unknown + uint32 StartTime = in->ReadUInt32(); + outapp->WriteUInt32(time(nullptr) - StartTime); // RoF2 has elapsed time here rather than starttime + + // Copy the rest of the packet verbatim + uint32 BytesLeftToCopy = in->size - in->GetReadPosition(); + memcpy(outapp->pBuffer + outapp->GetWritePosition(), in->pBuffer + in->GetReadPosition(), BytesLeftToCopy); + + delete in; + dest->FastQueuePacket(&outapp, ack_req); + } + + ENCODE(OP_TaskHistoryReply) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + // First we need to calculate the length of the new packet + in->SetReadPosition(4); + uint32 ActivityCount = in->ReadUInt32(); + + uint32 Text1Length = 0; + uint32 Text2Length = 0; + uint32 Text3Length = 0; + + uint32 OutboundPacketSize = 8; + + for (uint32 i = 0; i < ActivityCount; ++i) + { + Text1Length = 0; + Text2Length = 0; + Text3Length = 0; + + in->ReadUInt32(); // Activity type + + // Skip past Text1 + while (in->ReadUInt8()) + ++Text1Length; + + // Skip past Text2 + while (in->ReadUInt8()) + ++Text2Length; + + in->ReadUInt32(); + in->ReadUInt32(); + in->ReadUInt32(); + uint32 ZoneID = in->ReadUInt32(); + in->ReadUInt32(); + + // Skip past Text3 + while (in->ReadUInt8()) + ++Text3Length; + + char ZoneNumber[10]; + + sprintf(ZoneNumber, "%i", ZoneID); + + OutboundPacketSize += (24 + Text1Length + 1 + Text2Length + Text3Length + 1 + 7 + (strlen(ZoneNumber) * 2)); + } + + in->SetReadPosition(0); + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskHistoryReply, OutboundPacketSize); + + outapp->WriteUInt32(in->ReadUInt32()); // Task index + outapp->WriteUInt32(in->ReadUInt32()); // Activity count + + for (uint32 i = 0; i < ActivityCount; ++i) + { + Text1Length = 0; + Text2Length = 0; + Text3Length = 0; + + outapp->WriteUInt32(in->ReadUInt32()); // ActivityType + + // Copy Text1 + while (uint8 c = in->ReadUInt8()) + outapp->WriteUInt8(c); + + outapp->WriteUInt8(0); // Text1 has a null terminator + + uint32 CurrentPosition = in->GetReadPosition(); + + // Determine Length of Text2 + while (in->ReadUInt8()) + ++Text2Length; + + outapp->WriteUInt32(Text2Length); + + in->SetReadPosition(CurrentPosition); + + // Copy Text2 + while (uint8 c = in->ReadUInt8()) + outapp->WriteUInt8(c); + + outapp->WriteUInt32(in->ReadUInt32()); // Goalcount + in->ReadUInt32(); + in->ReadUInt32(); + uint32 ZoneID = in->ReadUInt32(); + in->ReadUInt32(); + + char ZoneNumber[10]; + + sprintf(ZoneNumber, "%i", ZoneID); + + outapp->WriteUInt32(2); + outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x31); // "1" + + outapp->WriteUInt32(2); + outapp->WriteUInt8(0x2d); // "-" + outapp->WriteUInt8(0x31); // "1" + outapp->WriteString(ZoneNumber); + + outapp->WriteUInt32(0); + + // Copy Tex3t + while (uint8 c = in->ReadUInt8()) + outapp->WriteUInt8(c); + + outapp->WriteUInt8(0); // Text3 has a null terminator + + outapp->WriteUInt8(0x31); // "1" + outapp->WriteString(ZoneNumber); + } + + delete in; + dest->FastQueuePacket(&outapp, ack_req); + } + + ENCODE(OP_Track) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + Track_Struct *emu = (Track_Struct *)__emu_buffer; + + int EntryCount = in->size / sizeof(Track_Struct); + + if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) + { + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + delete in; + return; + } + + int PacketSize = 2; + + for (int i = 0; i < EntryCount; ++i, ++emu) + PacketSize += (12 + strlen(emu->name)); + + emu = (Track_Struct *)__emu_buffer; + + in->size = PacketSize; + in->pBuffer = new unsigned char[in->size]; + + char *Buffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint16, Buffer, EntryCount); + + for (int i = 0; i < EntryCount; ++i, ++emu) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->entityid); + VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->distance); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + VARSTRUCT_ENCODE_STRING(Buffer, emu->name); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->GroupMember); + } + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + + ENCODE(OP_Trader) + { + if ((*p)->size == sizeof(ClickTrader_Struct)) + { + ENCODE_LENGTH_EXACT(ClickTrader_Struct); + SETUP_DIRECT_ENCODE(ClickTrader_Struct, structs::ClickTrader_Struct); + + eq->Code = emu->Code; + // Live actually has 200 items now, but 80 is the most our internal struct supports + for (uint32 i = 0; i < 200; i++) + { + strncpy(eq->items[i].SerialNumber, "0000000000000000", sizeof(eq->items[i].SerialNumber)); + eq->items[i].Unknown18 = 0; + if (i < 80) { + eq->ItemCost[i] = emu->ItemCost[i]; + } + else { + eq->ItemCost[i] = 0; + } + } + + FINISH_ENCODE(); + } + else if ((*p)->size == sizeof(Trader_ShowItems_Struct)) + { + ENCODE_LENGTH_EXACT(Trader_ShowItems_Struct); + SETUP_DIRECT_ENCODE(Trader_ShowItems_Struct, structs::Trader_ShowItems_Struct); + + eq->Code = emu->Code; + strncpy(eq->SerialNumber, "0000000000000000", sizeof(eq->SerialNumber)); + eq->TraderID = emu->TraderID; + eq->Stacksize = 0; + eq->Price = 0; + + FINISH_ENCODE(); + } + else if ((*p)->size == sizeof(TraderStatus_Struct)) + { + ENCODE_LENGTH_EXACT(TraderStatus_Struct); + SETUP_DIRECT_ENCODE(TraderStatus_Struct, structs::TraderStatus_Struct); + + eq->Code = emu->Code; + + FINISH_ENCODE(); + } + else if ((*p)->size == sizeof(TraderBuy_Struct)) + { + ENCODE_FORWARD(OP_TraderBuy); + } + } + + ENCODE(OP_TraderBuy) + { + ENCODE_LENGTH_EXACT(TraderBuy_Struct); + SETUP_DIRECT_ENCODE(TraderBuy_Struct, structs::TraderBuy_Struct); + + OUT(Action); + OUT(Price); + OUT(TraderID); + memcpy(eq->ItemName, emu->ItemName, sizeof(eq->ItemName)); + OUT(ItemID); + OUT(Quantity); + OUT(AlreadySold); + + FINISH_ENCODE(); + } + + ENCODE(OP_TributeInfo) + { + ENCODE_LENGTH_ATLEAST(TributeAbility_Struct); + SETUP_VAR_ENCODE(TributeAbility_Struct); + ALLOC_VAR_ENCODE(structs::TributeAbility_Struct, sizeof(structs::TributeAbility_Struct) + strlen(emu->name) + 1); + + OUT(tribute_id); + OUT(tier_count); + + for (uint32 i = 0; i < MAX_TRIBUTE_TIERS; ++i) + { + eq->tiers[i].level = emu->tiers[i].level; + eq->tiers[i].tribute_item_id = emu->tiers[i].tribute_item_id; + eq->tiers[i].cost = emu->tiers[i].cost; + } + + eq->unknown128 = 0; + + strcpy(eq->name, emu->name); + + FINISH_ENCODE(); + } + + ENCODE(OP_TributeItem) + { + ENCODE_LENGTH_EXACT(TributeItem_Struct); + SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct); + + eq->slot = ServerToRoF2Slot(emu->slot); + OUT(quantity); + OUT(tribute_master_id); + OUT(tribute_points); + + FINISH_ENCODE(); + } + + ENCODE(OP_VetRewardsAvaliable) + { + EQApplicationPacket *inapp = *p; + unsigned char * __emu_buffer = inapp->pBuffer; + + uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = nullptr; + + EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); + uchar *old_data = __emu_buffer; + uchar *data = outapp_create->pBuffer; + for (unsigned int i = 0; i < count; ++i) + { + structs::VeteranReward *vr = (structs::VeteranReward*)data; + InternalVeteranReward *ivr = (InternalVeteranReward*)old_data; + + vr->claim_count = ivr->claim_count; + vr->claim_id = ivr->claim_id; + vr->number_available = ivr->number_available; + for (int x = 0; x < 8; ++x) + { + vr->items[x].item_id = ivr->items[x].item_id; + strncpy(vr->items[x].item_name, ivr->items[x].item_name, sizeof(vr->items[x].item_name)); + vr->items[x].charges = ivr->items[x].charges; + } + + old_data += sizeof(InternalVeteranReward); + data += sizeof(structs::VeteranReward); + } + + dest->FastQueuePacket(&outapp_create); + delete inapp; + } + + ENCODE(OP_WearChange) + { + ENCODE_LENGTH_EXACT(WearChange_Struct); + SETUP_DIRECT_ENCODE(WearChange_Struct, structs::WearChange_Struct); + + OUT(spawn_id); + OUT(material); + OUT(unknown06); + OUT(elite_material); + OUT(hero_forge_model); + OUT(unknown18); + OUT(color.color); + OUT(wear_slot_id); + + FINISH_ENCODE(); + } + + ENCODE(OP_WhoAllResponse) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + char *InBuffer = (char *)in->pBuffer; + + WhoAllReturnStruct *wars = (WhoAllReturnStruct*)InBuffer; + + int Count = wars->playercount; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_WhoAllResponse, in->size + (Count * 4)); + + char *OutBuffer = (char *)outapp->pBuffer; + + // The struct fields were moved around a bit, so adjust values before copying + wars->unknown44[0] = Count; + wars->unknown52 = 0; + + memcpy(OutBuffer, InBuffer, sizeof(WhoAllReturnStruct)); + + OutBuffer += sizeof(WhoAllReturnStruct); + InBuffer += sizeof(WhoAllReturnStruct); + + for (int i = 0; i < Count; ++i) + { + uint32 x; + + x = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); + + InBuffer += 4; + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0xffffffff); + + char Name[64]; + + VARSTRUCT_DECODE_STRING(Name, InBuffer); // Char Name + VARSTRUCT_ENCODE_STRING(OutBuffer, Name); + + x = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); + + VARSTRUCT_DECODE_STRING(Name, InBuffer); // Guild Name + VARSTRUCT_ENCODE_STRING(OutBuffer, Name); + + for (int j = 0; j < 7; ++j) + { + x = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); + } + + VARSTRUCT_DECODE_STRING(Name, InBuffer); // Account + VARSTRUCT_ENCODE_STRING(OutBuffer, Name); + + x = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); + } + + //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + dest->FastQueuePacket(&outapp); + delete in; + } + + ENCODE(OP_ZoneChange) + { + ENCODE_LENGTH_EXACT(ZoneChange_Struct); + SETUP_DIRECT_ENCODE(ZoneChange_Struct, structs::ZoneChange_Struct); + + memcpy(eq->char_name, emu->char_name, sizeof(emu->char_name)); + OUT(zoneID); + OUT(instanceID); + OUT(y); + OUT(x); + OUT(z) + OUT(zone_reason); + OUT(success); + + FINISH_ENCODE(); + } + + ENCODE(OP_ZoneEntry) { ENCODE_FORWARD(OP_ZoneSpawns); } + + ENCODE(OP_ZonePlayerToBind) + { + ENCODE_LENGTH_ATLEAST(ZonePlayerToBind_Struct); + + ZonePlayerToBind_Struct *zps = (ZonePlayerToBind_Struct*)(*p)->pBuffer; + + std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); + + unsigned char *buffer1 = new unsigned char[sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name)]; + structs::ZonePlayerToBindHeader_Struct *zph = (structs::ZonePlayerToBindHeader_Struct*)buffer1; + unsigned char *buffer2 = new unsigned char[sizeof(structs::ZonePlayerToBindFooter_Struct)]; + structs::ZonePlayerToBindFooter_Struct *zpf = (structs::ZonePlayerToBindFooter_Struct*)buffer2; + + zph->x = zps->x; + zph->y = zps->y; + zph->z = zps->z; + zph->heading = zps->heading; + zph->bind_zone_id = 0; + zph->bind_instance_id = zps->bind_instance_id; + strncpy(zph->zone_name, zps->zone_name, sizeof(zph->zone_name)); + + zpf->unknown021 = 1; + zpf->unknown022 = 0; + zpf->unknown023 = 0; + zpf->unknown024 = 0; + + ss.write((const char*)buffer1, (sizeof(structs::ZonePlayerToBindHeader_Struct) + strlen(zps->zone_name))); + ss.write((const char*)buffer2, sizeof(structs::ZonePlayerToBindFooter_Struct)); + + delete[] buffer1; + delete[] buffer2; + delete[](*p)->pBuffer; + + (*p)->pBuffer = new unsigned char[ss.str().size()]; + (*p)->size = ss.str().size(); + + memcpy((*p)->pBuffer, ss.str().c_str(), ss.str().size()); + dest->FastQueuePacket(&(*p)); + } + + ENCODE(OP_ZoneServerInfo) + { + SETUP_DIRECT_ENCODE(ZoneServerInfo_Struct, ZoneServerInfo_Struct); + + OUT_str(ip); + OUT(port); + + FINISH_ENCODE(); + } + + ENCODE(OP_ZoneSpawns) + { + //consume the packet + EQApplicationPacket *in = *p; + *p = nullptr; + + //store away the emu struct + unsigned char *__emu_buffer = in->pBuffer; + Spawn_Struct *emu = (Spawn_Struct *)__emu_buffer; + + //determine and verify length + int entrycount = in->size / sizeof(Spawn_Struct); + if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { + _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + delete in; + return; + } + + //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); + + emu = (Spawn_Struct *)__emu_buffer; + + //_log(NET__STRUCTS, "Spawn packet size is %i, entries = %i", in->size, entrycount); + + char *Buffer = (char *)in->pBuffer, *BufferStart; + + int r; + int k; + for (r = 0; r < entrycount; r++, emu++) { + + int PacketSize = 206; + + PacketSize += strlen(emu->name); + PacketSize += strlen(emu->lastName); + + emu->title[0] = 0; + emu->suffix[0] = 0; + + if (strlen(emu->title)) + PacketSize += strlen(emu->title) + 1; + + if (strlen(emu->suffix)) + PacketSize += strlen(emu->suffix) + 1; + + bool ShowName = 1; + if (emu->bodytype >= 66) + { + emu->race = 127; + emu->bodytype = 11; + emu->gender = 0; + ShowName = 0; + } + + float SpawnSize = emu->size; + if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))) + { + PacketSize += 60; + + if (emu->size == 0) + { + emu->size = 6; + SpawnSize = 6; + } + } + else + PacketSize += 216; + + if (SpawnSize == 0) + { + SpawnSize = 3; + } + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ZoneEntry, PacketSize); + Buffer = (char *)outapp->pBuffer; + BufferStart = Buffer; + VARSTRUCT_ENCODE_STRING(Buffer, emu->name); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->spawnId); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); + VARSTRUCT_ENCODE_TYPE(float, Buffer, SpawnSize - 0.7); // Eye Height? + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + + structs::Spawn_Struct_Bitfields *Bitfields = (structs::Spawn_Struct_Bitfields*)Buffer; + + Bitfields->gender = emu->gender; + Bitfields->ispet = emu->is_pet; + Bitfields->afk = emu->afk; + Bitfields->anon = emu->anon; + Bitfields->gm = emu->gm; + Bitfields->sneak = 0; + Bitfields->lfg = emu->lfg; + Bitfields->invis = emu->invis; + Bitfields->linkdead = 0; + Bitfields->showhelm = emu->showhelm; + Bitfields->trader = 0; + Bitfields->targetable = 1; + Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); + Bitfields->showname = ShowName; + + // Not currently found + // Bitfields->statue = 0; + // Bitfields->buyer = 0; + + Buffer += sizeof(structs::Spawn_Struct_Bitfields); + + uint8 OtherData = 0; + + if (strlen(emu->title)) + OtherData = OtherData | 16; + + if (strlen(emu->suffix)) + OtherData = OtherData | 32; + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, OtherData); + + VARSTRUCT_ENCODE_TYPE(float, Buffer, -1); // unknown3 + VARSTRUCT_ENCODE_TYPE(float, Buffer, 0); // unknown4 + + // Setting this next field to zero will cause a crash. Looking at ShowEQ, if it is zero, the bodytype field is not + // present. Will sort that out later. + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 1); // This is a properties count field + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->bodytype); + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->curHp); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->haircolor); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beardcolor); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->eyecolor1); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->eyecolor2); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->hairstyle); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->beard); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->drakkin_heritage); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->drakkin_tattoo); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->drakkin_details); + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->equip_chest2); // unknown8 + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown9 + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown10 + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->helm); // unknown11 + + VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->size); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->face); + VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->walkspeed); + VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->runspeed); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->race); + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // ShowEQ calls this 'Holding' + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->deity); + if (emu->NPC) + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xFFFFFFFF); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0x00000000); + } + else + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->guildID); + + /* Translate older ranks to new values */ + switch (emu->guildrank) { + case 0: { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 5); break; } // GUILD_MEMBER 0 + case 1: { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 3); break; } // GUILD_OFFICER 1 + case 2: { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 1); break; } // GUILD_LEADER 2 + default: { VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->guildrank); break; } // + } + } + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->class_); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // pvp + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->StandState); // standstate + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->light); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->flymode); + + VARSTRUCT_ENCODE_STRING(Buffer, emu->lastName); + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // aatitle ?? + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC ? 0 : 1); // unknown - Must be 1 for guild name to be shown abover players head. + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->petOwnerId); + + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown13 + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown14 - Stance 64 = normal 4 = aggressive 40 = stun/mezzed + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown15 + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown16 + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // unknown17 + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18 + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19 + + if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)) + { + for (k = 0; k < 9; ++k) + { + { + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->colors[k].color); + } + } + + structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; + + for (k = 0; k < 9; k++) { + Equipment[k].equip0 = emu->equipment[k]; + Equipment[k].equip1 = 0; + Equipment[k].equip2 = 0; + Equipment[k].equip3 = 0; + Equipment[k].itemId = 0; + } + + Buffer += (sizeof(structs::EquipStruct) * 9); + } + else + { + 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, 0); + + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]); + 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]); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); + } + + structs::Spawn_Struct_Position *Position = (structs::Spawn_Struct_Position*)Buffer; + + Position->y = emu->y; + Position->deltaZ = emu->deltaZ; + Position->deltaX = emu->deltaX; + Position->x = emu->x; + Position->heading = emu->heading; + Position->deltaHeading = emu->deltaHeading; + Position->z = emu->z; + Position->animation = emu->animation; + Position->deltaY = emu->deltaY; + + Buffer += sizeof(structs::Spawn_Struct_Position); + + if (strlen(emu->title)) + { + VARSTRUCT_ENCODE_STRING(Buffer, emu->title); + } + + if (strlen(emu->suffix)) + { + VARSTRUCT_ENCODE_STRING(Buffer, emu->suffix); + } + + Buffer += 8; + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->IsMercenary); + VARSTRUCT_ENCODE_STRING(Buffer, "0000000000000000"); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); + // 29 zero bytes follow + Buffer += 29; + if (Buffer != (BufferStart + PacketSize)) + { + _log(NET__ERROR, "SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + } + //_log(NET__ERROR, "Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + dest->FastQueuePacket(&outapp, ack_req); + } + + delete in; + } + +// DECODE methods + DECODE(OP_AdventureMerchantSell) + { + DECODE_LENGTH_EXACT(structs::Adventure_Sell_Struct); + SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); + + IN(npcid); + emu->slot = RoF2ToServerMainInvSlot(eq->slot); + IN(charges); + IN(sell_price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_AltCurrencySell) + { + DECODE_LENGTH_EXACT(structs::AltCurrencySellItem_Struct); + SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); + + IN(merchant_entity_id); + emu->slot_id = RoF2ToServerSlot(eq->slot_id); + IN(charges); + IN(cost); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_AltCurrencySellSelection) + { + DECODE_LENGTH_EXACT(structs::AltCurrencySelectItem_Struct); + SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); + + IN(merchant_entity_id); + emu->slot_id = RoF2ToServerSlot(eq->slot_id); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ApplyPoison) + { + DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct); + SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); + + emu->inventorySlot = RoF2ToServerMainInvSlot(eq->inventorySlot); + IN(success); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_AugmentInfo) + { + DECODE_LENGTH_EXACT(structs::AugmentInfo_Struct); + SETUP_DIRECT_DECODE(AugmentInfo_Struct, structs::AugmentInfo_Struct); + + IN(itemid); + IN(window); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_AugmentItem) + { + DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); + SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); + + emu->container_slot = RoF2ToServerSlot(eq->container_slot); + emu->augment_slot = RoF2ToServerSlot(eq->augment_slot); + emu->container_index = eq->container_index; + emu->augment_index = eq->augment_index; + emu->dest_inst_id = eq->dest_inst_id; + emu->augment_action = eq->augment_action; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_BazaarSearch) + { + char *Buffer = (char *)__packet->pBuffer; + + uint8 SubAction = VARSTRUCT_DECODE_TYPE(uint8, Buffer); + + if ((SubAction != BazaarInspectItem) || (__packet->size != sizeof(structs::NewBazaarInspect_Struct))) + return; + + SETUP_DIRECT_DECODE(NewBazaarInspect_Struct, structs::NewBazaarInspect_Struct); + MEMSET_IN(structs::NewBazaarInspect_Struct); + + IN(Beginning.Action); + memcpy(emu->Name, eq->Name, sizeof(emu->Name)); + IN(SerialNumber); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_BlockedBuffs) + { + DECODE_LENGTH_EXACT(structs::BlockedBuffs_Struct); + SETUP_DIRECT_DECODE(BlockedBuffs_Struct, structs::BlockedBuffs_Struct); + + for (uint32 i = 0; i < BLOCKED_BUFF_COUNT; ++i) + emu->SpellID[i] = eq->SpellID[i]; + + IN(Count); + IN(Pet); + IN(Initialise); + IN(Flags); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_Buff) + { + DECODE_LENGTH_EXACT(structs::SpellBuffFade_Struct_Live); + SETUP_DIRECT_DECODE(SpellBuffFade_Struct, structs::SpellBuffFade_Struct_Live); + + IN(entityid); + //IN(slot); + IN(level); + IN(effect); + IN(spellid); + IN(duration); + IN(slotid); + IN(bufffade); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_BuffRemoveRequest) + { + // This is to cater for the fact that short buff box buffs start at 30 as opposed to 25 in prior clients. + // + DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct); + SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct); + + emu->SlotID = (eq->SlotID < 42) ? eq->SlotID : (eq->SlotID - 17); + + IN(EntityID); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_CastSpell) + { + DECODE_LENGTH_EXACT(structs::CastSpell_Struct); + SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); + + if (eq->slot == 13) + emu->slot = 10; + else + IN(slot); + + IN(spell_id); + emu->inventoryslot = RoF2ToServerSlot(eq->inventoryslot); + //IN(inventoryslot); + IN(target_id); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ChannelMessage) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + char *InBuffer = (char *)__eq_buffer; + + char Sender[64]; + char Target[64]; + + VARSTRUCT_DECODE_STRING(Sender, InBuffer); + VARSTRUCT_DECODE_STRING(Target, InBuffer); + + InBuffer += 4; + + uint32 Language = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + uint32 Channel = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + + InBuffer += 5; + + uint32 Skill = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); + + __packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + __packet->pBuffer = new unsigned char[__packet->size]; + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; + + strn0cpy(emu->targetname, Target, sizeof(emu->targetname)); + strn0cpy(emu->sender, Target, sizeof(emu->sender)); + emu->language = Language; + emu->chan_num = Channel; + emu->skill_in_language = Skill; + strcpy(emu->message, InBuffer); + + delete[] __eq_buffer; + } + + DECODE(OP_CharacterCreate) + { + DECODE_LENGTH_EXACT(structs::CharCreate_Struct); + SETUP_DIRECT_DECODE(CharCreate_Struct, structs::CharCreate_Struct); + + IN(gender); + IN(race); + IN(class_); + IN(deity); + IN(start_zone); + IN(haircolor); + IN(beard); + IN(beardcolor); + IN(hairstyle); + IN(face); + IN(eyecolor1); + IN(eyecolor2); + IN(drakkin_heritage); + IN(drakkin_tattoo); + IN(drakkin_details); + IN(STR); + IN(STA); + IN(AGI); + IN(DEX); + IN(WIS); + IN(INT); + IN(CHA); + IN(tutorial); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ClientUpdate) + { + // for some odd reason, there is an extra byte on the end of this on occasion.. + DECODE_LENGTH_ATLEAST(structs::PlayerPositionUpdateClient_Struct); + SETUP_DIRECT_DECODE(PlayerPositionUpdateClient_Struct, structs::PlayerPositionUpdateClient_Struct); + + IN(spawn_id); + IN(sequence); + IN(x_pos); + IN(y_pos); + IN(z_pos); + IN(heading); + IN(delta_x); + IN(delta_y); + IN(delta_z); + IN(delta_heading); + IN(animation); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_Consider) + { + DECODE_LENGTH_EXACT(structs::Consider_Struct); + SETUP_DIRECT_DECODE(Consider_Struct, structs::Consider_Struct); + + IN(playerid); + IN(targetid); + IN(faction); + IN(level); + //emu->cur_hp = 1; + //emu->max_hp = 2; + //emu->pvpcon = 0; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ConsiderCorpse) { DECODE_FORWARD(OP_Consider); } + + DECODE(OP_Consume) + { + DECODE_LENGTH_EXACT(structs::Consume_Struct); + SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct); + + emu->slot = RoF2ToServerSlot(eq->slot); + IN(auto_consumed); + IN(type); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_Damage) + { + DECODE_LENGTH_EXACT(structs::CombatDamage_Struct); + SETUP_DIRECT_DECODE(CombatDamage_Struct, structs::CombatDamage_Struct); + + IN(target); + IN(source); + IN(type); + IN(spellid); + IN(damage); + emu->sequence = eq->sequence; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_DeleteItem) + { + DECODE_LENGTH_EXACT(structs::DeleteItem_Struct); + SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct); + + emu->from_slot = RoF2ToServerSlot(eq->from_slot); + emu->to_slot = RoF2ToServerSlot(eq->to_slot); + IN(number_in_stack); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_EnvDamage) + { + DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); + SETUP_DIRECT_DECODE(EnvDamage2_Struct, structs::EnvDamage2_Struct); + + IN(id); + IN(damage); + IN(dmgtype); + emu->constant = 0xFFFF; + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_FaceChange) + { + DECODE_LENGTH_EXACT(structs::FaceChange_Struct); + SETUP_DIRECT_DECODE(FaceChange_Struct, structs::FaceChange_Struct); + + IN(haircolor); + IN(beardcolor); + IN(eyecolor1); + IN(eyecolor2); + IN(hairstyle); + IN(beard); + IN(face); + IN(drakkin_heritage); + IN(drakkin_tattoo); + IN(drakkin_details); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_FindPersonRequest) + { + DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct); + SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct); + + IN(npc_id); + IN(client_pos.x); + IN(client_pos.y); + IN(client_pos.z); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GMLastName) + { + DECODE_LENGTH_EXACT(structs::GMLastName_Struct); + SETUP_DIRECT_DECODE(GMLastName_Struct, structs::GMLastName_Struct); + + memcpy(emu->name, eq->name, sizeof(emu->name)); + memcpy(emu->gmname, eq->gmname, sizeof(emu->gmname)); + memcpy(emu->lastname, eq->lastname, sizeof(emu->lastname)); + for (int i = 0; i<4; i++) + { + emu->unknown[i] = eq->unknown[i]; + } + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupCancelInvite) + { + DECODE_LENGTH_EXACT(structs::GroupCancel_Struct); + SETUP_DIRECT_DECODE(GroupCancel_Struct, structs::GroupCancel_Struct); + + memcpy(emu->name1, eq->name1, sizeof(emu->name1)); + memcpy(emu->name2, eq->name2, sizeof(emu->name2)); + IN(toggle); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupDisband) + { + //EQApplicationPacket *in = __packet; + //_log(NET__ERROR, "Received incoming OP_Disband"); + //_hex(NET__ERROR, in->pBuffer, in->size); + DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); + SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); + + memcpy(emu->name1, eq->name1, sizeof(emu->name1)); + memcpy(emu->name2, eq->name2, sizeof(emu->name2)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupFollow) + { + //EQApplicationPacket *in = __packet; + //_log(NET__ERROR, "Received incoming OP_GroupFollow"); + //_hex(NET__ERROR, in->pBuffer, in->size); + DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); + SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); + + memcpy(emu->name1, eq->name1, sizeof(emu->name1)); + memcpy(emu->name2, eq->name2, sizeof(emu->name2)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupFollow2) + { + //EQApplicationPacket *in = __packet; + //_log(NET__ERROR, "Received incoming OP_GroupFollow2"); + //_hex(NET__ERROR, in->pBuffer, in->size); + DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); + SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); + + memcpy(emu->name1, eq->name1, sizeof(emu->name1)); + memcpy(emu->name2, eq->name2, sizeof(emu->name2)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupInvite) + { + //EQApplicationPacket *in = __packet; + //_log(NET__ERROR, "Received incoming OP_GroupInvite"); + //_hex(NET__ERROR, in->pBuffer, in->size); + DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); + SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); + + memcpy(emu->name1, eq->invitee_name, sizeof(emu->name1)); + memcpy(emu->name2, eq->inviter_name, sizeof(emu->name2)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GroupInvite2) + { + //_log(NET__ERROR, "Received incoming OP_GroupInvite2. Forwarding"); + DECODE_FORWARD(OP_GroupInvite); + } + + DECODE(OP_GuildDemote) + { + DECODE_LENGTH_EXACT(structs::GuildDemoteStruct); + SETUP_DIRECT_DECODE(GuildDemoteStruct, structs::GuildDemoteStruct); + + strn0cpy(emu->target, eq->target, sizeof(emu->target)); + strn0cpy(emu->name, eq->name, sizeof(emu->name)); + // IN(rank); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GuildRemove) + { + DECODE_LENGTH_EXACT(structs::GuildCommand_Struct); + SETUP_DIRECT_DECODE(GuildCommand_Struct, structs::GuildCommand_Struct); + + strn0cpy(emu->othername, eq->othername, sizeof(emu->othername)); + strn0cpy(emu->myname, eq->myname, sizeof(emu->myname)); + IN(guildeqid); + IN(officer); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_GuildStatus) + { + DECODE_LENGTH_EXACT(structs::GuildStatus_Struct); + SETUP_DIRECT_DECODE(GuildStatus_Struct, structs::GuildStatus_Struct); + + memcpy(emu->Name, eq->Name, sizeof(emu->Name)); + + FINISH_DIRECT_DECODE(); + } + + /*DECODE(OP_InspectAnswer) + { + DECODE_LENGTH_EXACT(structs::InspectResponse_Struct); + SETUP_DIRECT_DECODE(InspectResponse_Struct, structs::InspectResponse_Struct); + + IN(TargetID); + IN(playerid); + + int r; + for (r = 0; r < 21; r++) { + strn0cpy(emu->itemnames[r], eq->itemnames[r], sizeof(emu->itemnames[r])); + } + // Swap last 2 slots for Arrow and Power Source + strn0cpy(emu->itemnames[22], eq->itemnames[21], sizeof(emu->itemnames[22])); + strn0cpy(emu->itemnames[21], eq->unknown_zero, sizeof(emu->itemnames[21])); + strn0cpy(emu->unknown_zero, eq->unknown_zero, sizeof(emu->unknown_zero)); + + int k; + for (k = 0; k < 21; k++) { + IN(itemicons[k]); + } + // Swap last 2 slots for Arrow and Power Source + emu->itemicons[22] = eq->itemicons[21]; + emu->itemicons[21] = eq->unknown_zero2; + emu->unknown_zero2 = eq->unknown_zero2; + strn0cpy(emu->text, eq->text, sizeof(emu->text)); + //emu->unknown1772 = 0; + + FINISH_DIRECT_DECODE(); + }*/ + + DECODE(OP_InspectRequest) + { + DECODE_LENGTH_EXACT(structs::Inspect_Struct); + SETUP_DIRECT_DECODE(Inspect_Struct, structs::Inspect_Struct); + + IN(TargetID); + IN(PlayerID); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ItemLinkClick) + { + DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); + SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); + MEMSET_IN(ItemViewRequest_Struct); + + IN(item_id); + int r; + for (r = 0; r < 5; r++) { + IN(augments[r]); + } + // Max Augs is now 6, but no code to support that many yet + IN(link_hash); + IN(icon); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ItemVerifyRequest) + { + DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct); + SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct); + + emu->slot = RoF2ToServerSlot(eq->slot); + IN(target); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_LoadSpellSet) + { + DECODE_LENGTH_EXACT(structs::LoadSpellSet_Struct); + SETUP_DIRECT_DECODE(LoadSpellSet_Struct, structs::LoadSpellSet_Struct); + + for (unsigned int i = 0; i < MAX_PP_MEMSPELL; ++i) + { + if (eq->spell[i] == 0) + emu->spell[i] = 0xFFFFFFFF; + else + emu->spell[i] = eq->spell[i]; + } + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_LootItem) + { + DECODE_LENGTH_EXACT(structs::LootingItem_Struct); + SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct); + + IN(lootee); + IN(looter); + emu->slot_id = RoF2ToServerCorpseSlot(eq->slot_id); + IN(auto_loot); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_MoveItem) + { + DECODE_LENGTH_EXACT(structs::MoveItem_Struct); + SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); + + //_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + _log(NET__ERROR, "MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + emu->from_slot = RoF2ToServerSlot(eq->from_slot); + emu->to_slot = RoF2ToServerSlot(eq->to_slot); + IN(number_in_stack); + + _hex(NET__ERROR, eq, sizeof(structs::MoveItem_Struct)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_PetCommands) + { + DECODE_LENGTH_EXACT(structs::PetCommand_Struct); + SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); + + switch (eq->command) + { + case 0x00: + emu->command = 0x04; // Health + break; + case 0x01: + emu->command = 0x10; // Leader + break; + case 0x02: + emu->command = 0x07; // Attack + break; + case 0x04: + emu->command = 0x08; // Follow + break; + case 0x05: + emu->command = 0x05; // Guard + break; + case 0x06: + emu->command = 0x09; // Sit. Needs work. This appears to be a toggle between Sit/Stand now. + break; + case 0x0c: + emu->command = 0x0b; // Taunt + break; + case 0x0f: + emu->command = 0x0c; // Hold + break; + case 0x10: + emu->command = 0x1b; // Hold on + break; + case 0x11: + emu->command = 0x1c; // Hold off + break; + case 0x1c: + emu->command = 0x01; // Back + break; + case 0x1d: + emu->command = 0x02; // Leave/Go Away + break; + default: + emu->command = eq->command; + } + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_RaidInvite) + { + DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); + + // This is a switch on the RaidGeneral action + switch (*(uint32 *)__packet->pBuffer) { + case 35: { // raidMOTD + // we don't have a nice macro for this + structs::RaidMOTD_Struct *__eq_buffer = (structs::RaidMOTD_Struct *)__packet->pBuffer; + __eq_buffer->motd[1023] = '\0'; + size_t motd_size = strlen(__eq_buffer->motd) + 1; + __packet->size = sizeof(RaidMOTD_Struct) + motd_size; + __packet->pBuffer = new unsigned char[__packet->size]; + RaidMOTD_Struct *emu = (RaidMOTD_Struct *)__packet->pBuffer; + structs::RaidMOTD_Struct *eq = (structs::RaidMOTD_Struct *)__eq_buffer; + strn0cpy(emu->general.player_name, eq->general.player_name, 64); + strn0cpy(emu->motd, eq->motd, motd_size); + IN(general.action); + IN(general.parameter); + FINISH_DIRECT_DECODE(); + break; + } + case 36: { // raidPlayerNote unhandled + break; + } + default: { + DECODE_LENGTH_EXACT(structs::RaidGeneral_Struct); + SETUP_DIRECT_DECODE(RaidGeneral_Struct, structs::RaidGeneral_Struct); + strn0cpy(emu->leader_name, eq->leader_name, 64); + strn0cpy(emu->player_name, eq->player_name, 64); + IN(action); + IN(parameter); + FINISH_DIRECT_DECODE(); + break; + } + } + } + + DECODE(OP_ReadBook) + { + DECODE_LENGTH_EXACT(structs::BookRequest_Struct); + SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct); + + IN(type); + IN(invslot); + emu->window = (uint8)eq->window; + strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_RecipeAutoCombine) + { + DECODE_LENGTH_EXACT(structs::RecipeAutoCombine_Struct); + SETUP_DIRECT_DECODE(RecipeAutoCombine_Struct, structs::RecipeAutoCombine_Struct); + + IN(object_type); + IN(some_id); + emu->unknown1 = RoF2ToServerSlot(eq->container_slot); + IN(recipe_id); + IN(reply_code); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_RemoveBlockedBuffs) { DECODE_FORWARD(OP_BlockedBuffs); } + + DECODE(OP_RezzAnswer) + { + DECODE_LENGTH_EXACT(structs::Resurrect_Struct); + SETUP_DIRECT_DECODE(Resurrect_Struct, structs::Resurrect_Struct); + + IN(zone_id); + IN(instance_id); + IN(y); + IN(x); + IN(z); + memcpy(emu->your_name, eq->your_name, sizeof(emu->your_name)); + memcpy(emu->rezzer_name, eq->rezzer_name, sizeof(emu->rezzer_name)); + IN(spellid); + memcpy(emu->corpse_name, eq->corpse_name, sizeof(emu->corpse_name)); + IN(action); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_Save) + { + DECODE_LENGTH_EXACT(structs::Save_Struct); + SETUP_DIRECT_DECODE(Save_Struct, structs::Save_Struct); + + memcpy(emu->unknown00, eq->unknown00, sizeof(emu->unknown00)); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_SetServerFilter) + { + DECODE_LENGTH_EXACT(structs::SetServerFilter_Struct); + SETUP_DIRECT_DECODE(SetServerFilter_Struct, structs::SetServerFilter_Struct); + + int r; + for (r = 0; r < 29; r++) { + // Size 40 in RoF2 + IN(filters[r]); + } + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ShopPlayerBuy) + { + DECODE_LENGTH_EXACT(structs::Merchant_Sell_Struct); + SETUP_DIRECT_DECODE(Merchant_Sell_Struct, structs::Merchant_Sell_Struct); + + IN(npcid); + IN(playerid); + IN(itemslot); + IN(quantity); + IN(price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ShopPlayerSell) + { + DECODE_LENGTH_EXACT(structs::Merchant_Purchase_Struct); + SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); + + IN(npcid); + emu->itemslot = RoF2ToServerMainInvSlot(eq->itemslot); + //IN(itemslot); + IN(quantity); + IN(price); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ShopRequest) + { + DECODE_LENGTH_EXACT(structs::Merchant_Click_Struct); + SETUP_DIRECT_DECODE(Merchant_Click_Struct, structs::Merchant_Click_Struct); + + IN(npcid); + IN(playerid); + IN(command); + IN(rate); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_Trader) + { + uint32 psize = __packet->size; + if (psize == sizeof(structs::ClickTrader_Struct)) + { + DECODE_LENGTH_EXACT(structs::ClickTrader_Struct); + SETUP_DIRECT_DECODE(ClickTrader_Struct, structs::ClickTrader_Struct); + MEMSET_IN(ClickTrader_Struct); + + emu->Code = eq->Code; + // Live actually has 200 items now, but 80 is the most our internal struct supports + for (uint32 i = 0; i < 80; i++) + { + emu->SerialNumber[i] = 0; // eq->SerialNumber[i]; + emu->ItemCost[i] = eq->ItemCost[i]; + } + + FINISH_DIRECT_DECODE(); + } + else if (psize == sizeof(structs::Trader_ShowItems_Struct)) + { + DECODE_LENGTH_EXACT(structs::Trader_ShowItems_Struct); + SETUP_DIRECT_DECODE(Trader_ShowItems_Struct, structs::Trader_ShowItems_Struct); + MEMSET_IN(Trader_ShowItems_Struct); + + emu->Code = eq->Code; + emu->TraderID = eq->TraderID; + + FINISH_DIRECT_DECODE(); + } + else if (psize == sizeof(structs::TraderStatus_Struct)) + { + DECODE_LENGTH_EXACT(structs::TraderStatus_Struct); + SETUP_DIRECT_DECODE(TraderStatus_Struct, structs::TraderStatus_Struct); + MEMSET_IN(TraderStatus_Struct); + + emu->Code = eq->Code; + + FINISH_DIRECT_DECODE(); + } + } + + DECODE(OP_TraderBuy) + { + DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); + SETUP_DIRECT_DECODE(TraderBuy_Struct, structs::TraderBuy_Struct); + MEMSET_IN(TraderBuy_Struct); + + IN(Action); + IN(Price); + IN(TraderID); + memcpy(emu->ItemName, eq->ItemName, sizeof(emu->ItemName)); + IN(ItemID); + IN(Quantity); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_TradeSkillCombine) + { + DECODE_LENGTH_EXACT(structs::NewCombine_Struct); + SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); + + int16 slot_id = RoF2ToServerSlot(eq->container_slot); + if (slot_id == 4000) { + slot_id = legacy::SLOT_TRADESKILL; // 1000 + } + emu->container_slot = slot_id; + emu->guildtribute_slot = RoF2ToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented -U + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_TributeItem) + { + DECODE_LENGTH_EXACT(structs::TributeItem_Struct); + SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct); + + emu->slot = RoF2ToServerSlot(eq->slot); + IN(quantity); + IN(tribute_master_id); + IN(tribute_points); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_WhoAllRequest) + { + DECODE_LENGTH_EXACT(structs::Who_All_Struct); + SETUP_DIRECT_DECODE(Who_All_Struct, structs::Who_All_Struct); + + memcpy(emu->whom, eq->whom, sizeof(emu->whom)); + IN(wrace); + IN(wclass); + IN(lvllow); + IN(lvlhigh); + IN(gmlookup); + IN(guildid); + IN(type); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ZoneChange) + { + DECODE_LENGTH_EXACT(structs::ZoneChange_Struct); + SETUP_DIRECT_DECODE(ZoneChange_Struct, structs::ZoneChange_Struct); + + memcpy(emu->char_name, eq->char_name, sizeof(emu->char_name)); + IN(zoneID); + IN(instanceID); + IN(y); + IN(x); + IN(z) + IN(zone_reason); + IN(success); + + FINISH_DIRECT_DECODE(); + } + + DECODE(OP_ZoneEntry) + { + DECODE_LENGTH_EXACT(structs::ClientZoneEntry_Struct); + SETUP_DIRECT_DECODE(ClientZoneEntry_Struct, structs::ClientZoneEntry_Struct); + + memcpy(emu->char_name, eq->char_name, sizeof(emu->char_name)); + + FINISH_DIRECT_DECODE(); + } + +// file scope helper methods + uint32 NextItemInstSerialNumber = 1; + uint32 MaxInstances = 2000000000; + + static inline int32 GetNextItemInstSerialNumber() + { + if (NextItemInstSerialNumber >= MaxInstances) + NextItemInstSerialNumber = 1; + else + NextItemInstSerialNumber++; + + return NextItemInstSerialNumber; + } + + char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) + { + int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); + uint8 null_term = 0; + bool stackable = inst->IsStackable(); + uint32 merchant_slot = inst->GetMerchantSlot(); + uint32 charges = inst->GetCharges(); + if (!stackable && charges > 254) + charges = 0xFFFFFFFF; + + std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); + + const Item_Struct *item = inst->GetUnscaledItem(); + //_log(NET__ERROR, "Serialize called for: %s", item->Name); + + RoF2::structs::ItemSerializationHeader hdr; + + //sprintf(hdr.unknown000, "06e0002Y1W00"); + + snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%012d", item->ID); + + hdr.stacksize = stackable ? charges : 1; + hdr.unknown004 = 0; + + structs::ItemSlotStruct slot_id = ServerToRoF2Slot(slot_id_in); + + hdr.slot_type = (merchant_slot == 0) ? slot_id.SlotType : 9; // 9 is merchant 20 is reclaim items? + hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot; + hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff; + hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff; + //hdr.unknown013 = 0xffff; + hdr.price = inst->GetPrice(); + hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); + //hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff; + hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; + hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; + hdr.unknown028 = 0; + hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); + hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); + hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.unknown044 = 0; + hdr.unknown048 = 0; + hdr.unknown052 = 0; + hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; + ss.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader)); + + if (item->EvolvingLevel > 0) { + RoF2::structs::EvolvingItem evotop; + evotop.unknown001 = 0; + evotop.unknown002 = 0; + evotop.unknown003 = 0; + evotop.unknown004 = 0; + evotop.evoLevel = item->EvolvingLevel; + evotop.progress = 95.512; + evotop.Activated = 1; + evotop.evomaxlevel = 7; + ss.write((const char*)&evotop, sizeof(RoF2::structs::EvolvingItem)); + } + //ORNAMENT IDFILE / ICON + uint16 ornaIcon = 0; + if (inst->GetOrnamentationAug(ornamentationAugtype)) { + const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + //Mainhand + ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Offhand + ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Icon + ornaIcon = aug_weap->Icon; + } + else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { + char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); + //Mainhand + ss.write(tmp, strlen(tmp)); + ss.write((const char*)&null_term, sizeof(uint8)); + //Offhand + ss.write(tmp, strlen(tmp)); + ss.write((const char*)&null_term, sizeof(uint8)); + ornaIcon = inst->GetOrnamentationIcon(); + } + else { + ss.write((const char*)&null_term, sizeof(uint8)); //no mh + ss.write((const char*)&null_term, sizeof(uint8));//no of + } + + RoF2::structs::ItemSerializationHeaderFinish hdrf; + hdrf.ornamentIcon = ornaIcon; + hdrf.unknown061 = 0; + hdrf.unknown062 = 0; + hdrf.unknowna1 = 0xffffffff; + hdrf.unknowna2 = 0; + hdrf.unknown063 = 0; + hdrf.unknowna3 = 0; + hdrf.unknowna4 = 0xffffffff; + hdrf.unknowna5 = 0; + hdrf.ItemClass = item->ItemClass; + ss.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish)); + + if (strlen(item->Name) > 0) + { + ss.write(item->Name, strlen(item->Name)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + if (strlen(item->Lore) > 0) + { + ss.write(item->Lore, strlen(item->Lore)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + if (strlen(item->IDFile) > 0) + { + ss.write(item->IDFile, strlen(item->IDFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&null_term, sizeof(uint8)); + //_log(NET__ERROR, "ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); + RoF2::structs::ItemBodyStruct ibs; + memset(&ibs, 0, sizeof(RoF2::structs::ItemBodyStruct)); + + ibs.id = item->ID; + ibs.weight = item->Weight; + ibs.norent = item->NoRent; + ibs.nodrop = item->NoDrop; + ibs.attune = item->Attuneable; + ibs.size = item->Size; + ibs.slots = SwapBits21and22(item->Slots); + ibs.price = item->Price; + ibs.icon = item->Icon; + ibs.unknown1 = 1; + ibs.unknown2 = 1; + ibs.BenefitFlag = item->BenefitFlag; + ibs.tradeskills = item->Tradeskills; + ibs.CR = item->CR; + ibs.DR = item->DR; + ibs.PR = item->PR; + ibs.MR = item->MR; + ibs.FR = item->FR; + ibs.SVCorruption = item->SVCorruption; + ibs.AStr = item->AStr; + ibs.ASta = item->ASta; + ibs.AAgi = item->AAgi; + ibs.ADex = item->ADex; + ibs.ACha = item->ACha; + ibs.AInt = item->AInt; + ibs.AWis = item->AWis; + + ibs.HP = item->HP; + ibs.Mana = item->Mana; + ibs.Endur = item->Endur; + ibs.AC = item->AC; + ibs.regen = item->Regen; + ibs.mana_regen = item->ManaRegen; + ibs.end_regen = item->EnduranceRegen; + ibs.Classes = item->Classes; + ibs.Races = item->Races; + ibs.Deity = item->Deity; + ibs.SkillModValue = item->SkillModValue; + ibs.SkillModMax = 0xffffffff; + ibs.SkillModType = (int8)(item->SkillModType); + ibs.SkillModExtra = 0; + ibs.BaneDmgRace = item->BaneDmgRace; + ibs.BaneDmgBody = item->BaneDmgBody; + ibs.BaneDmgRaceAmt = item->BaneDmgRaceAmt; + ibs.BaneDmgAmt = item->BaneDmgAmt; + ibs.Magic = item->Magic; + ibs.CastTime_ = item->CastTime_; + ibs.ReqLevel = item->ReqLevel; + if (item->ReqLevel > 100) + ibs.ReqLevel = 100; + ibs.RecLevel = item->RecLevel; + if (item->RecLevel > 100) + ibs.RecLevel = 100; + ibs.RecSkill = item->RecSkill; + ibs.BardType = item->BardType; + ibs.BardValue = item->BardValue; + ibs.Light = item->Light; + ibs.Delay = item->Delay; + ibs.ElemDmgType = item->ElemDmgType; + ibs.ElemDmgAmt = item->ElemDmgAmt; + ibs.Range = item->Range; + ibs.Damage = item->Damage; + ibs.Color = item->Color; + ibs.Prestige = 0; + ibs.ItemType = item->ItemType; + ibs.Material = item->Material; + ibs.unknown7 = 0; + ibs.EliteMaterial = item->EliteMaterial; + ibs.unknown_RoF23 = 0; + ibs.unknown_RoF24 = 0; + ibs.SellRate = item->SellRate; + ibs.CombatEffects = item->CombatEffects; + ibs.Shielding = item->Shielding; + ibs.StunResist = item->StunResist; + ibs.StrikeThrough = item->StrikeThrough; + ibs.ExtraDmgSkill = item->ExtraDmgSkill; + ibs.ExtraDmgAmt = item->ExtraDmgAmt; + ibs.SpellShield = item->SpellShield; + ibs.Avoidance = item->Avoidance; + ibs.Accuracy = item->Accuracy; + ibs.CharmFileID = item->CharmFileID; + ibs.FactionAmt1 = item->FactionAmt1; + ibs.FactionMod1 = item->FactionMod1; + ibs.FactionAmt2 = item->FactionAmt2; + ibs.FactionMod2 = item->FactionMod2; + ibs.FactionAmt3 = item->FactionAmt3; + ibs.FactionMod3 = item->FactionMod3; + ibs.FactionAmt4 = item->FactionAmt4; + ibs.FactionMod4 = item->FactionMod4; + + ss.write((const char*)&ibs, sizeof(RoF2::structs::ItemBodyStruct)); + + //charm text + if (strlen(item->CharmFile) > 0) + { + ss.write((const char*)item->CharmFile, strlen(item->CharmFile)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + //_log(NET__ERROR, "ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + RoF2::structs::ItemSecondaryBodyStruct isbs; + memset(&isbs, 0, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + + isbs.augtype = item->AugType; + isbs.augdistiller = 65535; + isbs.augrestrict = item->AugRestrict; + + for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x) + { + isbs.augslots[x].type = item->AugSlotType[x]; + isbs.augslots[x].visible = item->AugSlotVisible[x]; + isbs.augslots[x].unknown = item->AugSlotUnk2[x]; + } + + // Increased to 6 max aug slots + isbs.augslots[5].type = 0; + isbs.augslots[5].visible = 1; + isbs.augslots[5].unknown = 0; + + isbs.ldonpoint_type = item->PointType; + isbs.ldontheme = item->LDoNTheme; + isbs.ldonprice = item->LDoNPrice; + isbs.ldonsellbackrate = item->LDoNSellBackRate; + isbs.ldonsold = item->LDoNSold; + + isbs.bagtype = item->BagType; + isbs.bagslots = item->BagSlots; + isbs.bagsize = item->BagSize; + isbs.wreduction = item->BagWR; + + isbs.book = item->Book; + isbs.booktype = item->BookType; + + ss.write((const char*)&isbs, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + + if (strlen(item->Filename) > 0) + { + ss.write((const char*)item->Filename, strlen(item->Filename)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + //_log(NET__ERROR, "ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + RoF2::structs::ItemTertiaryBodyStruct itbs; + memset(&itbs, 0, sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + + itbs.loregroup = item->LoreGroup; + itbs.artifact = item->ArtifactFlag; + itbs.summonedflag = item->SummonedFlag; + itbs.favor = item->Favor; + itbs.fvnodrop = item->FVNoDrop; + itbs.dotshield = item->DotShielding; + itbs.atk = item->Attack; + itbs.haste = item->Haste; + itbs.damage_shield = item->DamageShield; + itbs.guildfavor = item->GuildFavor; + itbs.augdistil = item->AugDistiller; + itbs.unknown3 = 0xffffffff; + itbs.unknown4 = 0; + itbs.no_pet = item->NoPet; + itbs.unknown5 = 0; + + itbs.potion_belt_enabled = item->PotionBelt; + itbs.potion_belt_slots = item->PotionBeltSlots; + itbs.stacksize = stackable ? item->StackSize : 0; + itbs.no_transfer = item->NoTransfer; + itbs.expendablearrow = item->ExpendableArrow; + + itbs.unknown8 = 0; + itbs.unknown9 = 0; + itbs.unknown10 = 0; + itbs.unknown11 = 0; + itbs.unknown12 = 0; + itbs.unknown13 = 0; + itbs.unknown14 = 0; + + ss.write((const char*)&itbs, sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + + // Effect Structures Broken down to allow variable length strings for effect names + int32 effect_unknown = 0; + + //_log(NET__ERROR, "ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); + RoF2::structs::ClickEffectStruct ices; + memset(&ices, 0, sizeof(RoF2::structs::ClickEffectStruct)); + + ices.effect = item->Click.Effect; + ices.level2 = item->Click.Level2; + ices.type = item->Click.Type; + ices.level = item->Click.Level; + ices.max_charges = item->MaxCharges; + ices.cast_time = item->CastTime; + ices.recast = item->RecastDelay; + ices.recast_type = item->RecastType; + + ss.write((const char*)&ices, sizeof(RoF2::structs::ClickEffectStruct)); + + if (strlen(item->ClickName) > 0) + { + ss.write((const char*)item->ClickName, strlen(item->ClickName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 + + //_log(NET__ERROR, "ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); + RoF2::structs::ProcEffectStruct ipes; + memset(&ipes, 0, sizeof(RoF2::structs::ProcEffectStruct)); + + ipes.effect = item->Proc.Effect; + ipes.level2 = item->Proc.Level2; + ipes.type = item->Proc.Type; + ipes.level = item->Proc.Level; + ipes.procrate = item->ProcRate; + + ss.write((const char*)&ipes, sizeof(RoF2::structs::ProcEffectStruct)); + + if (strlen(item->ProcName) > 0) + { + ss.write((const char*)item->ProcName, strlen(item->ProcName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 + + //_log(NET__ERROR, "ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); + RoF2::structs::WornEffectStruct iwes; + memset(&iwes, 0, sizeof(RoF2::structs::WornEffectStruct)); + + iwes.effect = item->Worn.Effect; + iwes.level2 = item->Worn.Level2; + iwes.type = item->Worn.Type; + iwes.level = item->Worn.Level; + + ss.write((const char*)&iwes, sizeof(RoF2::structs::WornEffectStruct)); + + if (strlen(item->WornName) > 0) + { + ss.write((const char*)item->WornName, strlen(item->WornName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 + + RoF2::structs::WornEffectStruct ifes; + memset(&ifes, 0, sizeof(RoF2::structs::WornEffectStruct)); + + ifes.effect = item->Focus.Effect; + ifes.level2 = item->Focus.Level2; + ifes.type = item->Focus.Type; + ifes.level = item->Focus.Level; + + ss.write((const char*)&ifes, sizeof(RoF2::structs::WornEffectStruct)); + + if (strlen(item->FocusName) > 0) + { + ss.write((const char*)item->FocusName, strlen(item->FocusName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 + + RoF2::structs::WornEffectStruct ises; + memset(&ises, 0, sizeof(RoF2::structs::WornEffectStruct)); + + ises.effect = item->Scroll.Effect; + ises.level2 = item->Scroll.Level2; + ises.type = item->Scroll.Type; + ises.level = item->Scroll.Level; + + ss.write((const char*)&ises, sizeof(RoF2::structs::WornEffectStruct)); + + if (strlen(item->ScrollName) > 0) + { + ss.write((const char*)item->ScrollName, strlen(item->ScrollName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else + { + ss.write((const char*)&null_term, sizeof(uint8)); + } + + ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 + + // Bard Effect? + RoF2::structs::WornEffectStruct ibes; + memset(&ibes, 0, sizeof(RoF2::structs::WornEffectStruct)); + + ibes.effect = 0xffffffff; + ibes.level2 = 0; + ibes.type = 0; + ibes.level = 0; + //ibes.unknown6 = 0xffffffff; + + ss.write((const char*)&ibes, sizeof(RoF2::structs::WornEffectStruct)); + + /* + if(strlen(item->BardName) > 0) + { + ss.write((const char*)item->BardName, strlen(item->BardName)); + ss.write((const char*)&null_term, sizeof(uint8)); + } + else */ + ss.write((const char*)&null_term, sizeof(uint8)); + + ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 + // End of Effects + + //_log(NET__ERROR, "ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + RoF2::structs::ItemQuaternaryBodyStruct iqbs; + memset(&iqbs, 0, sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + + iqbs.scriptfileid = item->ScriptFileID; + iqbs.quest_item = item->QuestItemFlag; + iqbs.Power = 0; + iqbs.Purity = item->Purity; + iqbs.unknown16 = 0; + iqbs.BackstabDmg = item->BackstabDmg; + iqbs.DSMitigation = item->DSMitigation; + iqbs.HeroicStr = item->HeroicStr; + iqbs.HeroicInt = item->HeroicInt; + iqbs.HeroicWis = item->HeroicWis; + iqbs.HeroicAgi = item->HeroicAgi; + iqbs.HeroicDex = item->HeroicDex; + iqbs.HeroicSta = item->HeroicSta; + iqbs.HeroicCha = item->HeroicCha; + iqbs.HeroicMR = item->HeroicMR; + iqbs.HeroicFR = item->HeroicFR; + iqbs.HeroicCR = item->HeroicCR; + iqbs.HeroicDR = item->HeroicDR; + iqbs.HeroicPR = item->HeroicPR; + iqbs.HeroicSVCorrup = item->HeroicSVCorrup; + iqbs.HealAmt = item->HealAmt; + iqbs.SpellDmg = item->SpellDmg; + iqbs.clairvoyance = item->Clairvoyance; + iqbs.unknown28 = 0; + + + // Begin RoF2 Test + iqbs.unknown_TEST1 = 0; + // End RoF2 Test + + iqbs.unknown30 = 0; + iqbs.unknown39 = 1; + + iqbs.subitem_count = 0; + + char *SubSerializations[10]; // + + uint32 SubLengths[10]; + + for (int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) { + + SubSerializations[x] = nullptr; + + const ItemInst* subitem = ((const ItemInst*)inst)->GetItem(x); + + if (subitem) { + + int SubSlotNumber; + + iqbs.subitem_count++; + + if (slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor? + //SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1); + SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1); + else if (slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END) + //SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1); + SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x); + else if (slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END) + //SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1); + SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x); + else + SubSlotNumber = slot_id_in; // ??????? + + /* + // TEST CODE: + SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); + */ + + SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); + } + } + + ss.write((const char*)&iqbs, sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + + for (int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) { + + if (SubSerializations[x]) { + + ss.write((const char*)&x, sizeof(uint32)); + + ss.write(SubSerializations[x], SubLengths[x]); + + safe_delete_array(SubSerializations[x]); + } + } + + char* item_serial = new char[ss.tellp()]; + memset(item_serial, 0, ss.tellp()); + memcpy(item_serial, ss.str().c_str(), ss.tellp()); + + *length = ss.tellp(); + return item_serial; + } + + static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot) + { + structs::ItemSlotStruct RoF2Slot; + RoF2Slot.SlotType = INVALID_INDEX; + RoF2Slot.Unknown02 = NOT_USED; + RoF2Slot.MainSlot = INVALID_INDEX; + RoF2Slot.SubSlot = INVALID_INDEX; + RoF2Slot.AugSlot = INVALID_INDEX; + RoF2Slot.Unknown01 = NOT_USED; + + uint32 TempSlot = 0; + + if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // Main Inventory and Cursor + RoF2Slot.SlotType = maps::MapPossessions; + RoF2Slot.MainSlot = ServerSlot; + + if (ServerSlot == MainPowerSource) + RoF2Slot.MainSlot = slots::MainPowerSource; + + else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory + RoF2Slot.MainSlot += 3; + + else if (ServerSlot >= MainAmmo) // (> 20) + RoF2Slot.MainSlot += 1; + } + + /*else if (ServerSlot < 51) { // Cursor Buffer + RoF2Slot.SlotType = maps::MapLimbo; + RoF2Slot.MainSlot = ServerSlot - 31; + }*/ + + else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341) + RoF2Slot.SlotType = maps::MapPossessions; + TempSlot = ServerSlot - 1; + RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2; + RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); + + if (RoF2Slot.MainSlot >= slots::MainGeneral9) // (> 30) + RoF2Slot.MainSlot = slots::MainCursor; + } + + else if (ServerSlot >= EmuConstants::TRIBUTE_BEGIN && ServerSlot <= EmuConstants::TRIBUTE_END) { // Tribute + RoF2Slot.SlotType = maps::MapTribute; + RoF2Slot.MainSlot = ServerSlot - EmuConstants::TRIBUTE_BEGIN; + } + + else if (ServerSlot >= EmuConstants::BANK_BEGIN && ServerSlot <= EmuConstants::BANK_BAGS_END) { + RoF2Slot.SlotType = maps::MapBank; + TempSlot = ServerSlot - EmuConstants::BANK_BEGIN; + RoF2Slot.MainSlot = TempSlot; + + if (TempSlot > 30) { // (> 30) + RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3; + RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE); + } + } + + else if (ServerSlot >= EmuConstants::SHARED_BANK_BEGIN && ServerSlot <= EmuConstants::SHARED_BANK_BAGS_END) { + RoF2Slot.SlotType = maps::MapSharedBank; + TempSlot = ServerSlot - EmuConstants::SHARED_BANK_BEGIN; + RoF2Slot.MainSlot = TempSlot; + + if (TempSlot > 30) { // (> 30) + RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3; + RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE); + } + } + + else if (ServerSlot >= EmuConstants::TRADE_BEGIN && ServerSlot <= EmuConstants::TRADE_BAGS_END) { + RoF2Slot.SlotType = maps::MapTrade; + TempSlot = ServerSlot - EmuConstants::TRADE_BEGIN; + RoF2Slot.MainSlot = TempSlot; + + if (TempSlot > 30) { + RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3; + RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE); + } + + /* + // OLD CODE: + if (TempSlot > 99) { + if (TempSlot > 100) + RoF2Slot.MainSlot = int((TempSlot - 100) / 10); + + else + RoF2Slot.MainSlot = 0; + + RoF2Slot.SubSlot = TempSlot - (100 + RoF2Slot.MainSlot); + } + */ + } + + else if (ServerSlot >= EmuConstants::WORLD_BEGIN && ServerSlot <= EmuConstants::WORLD_END) { + RoF2Slot.SlotType = maps::MapWorld; + TempSlot = ServerSlot - EmuConstants::WORLD_BEGIN; + RoF2Slot.MainSlot = TempSlot; + } + + _log(NET__ERROR, "Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + + return RoF2Slot; + } + + static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 ServerSlot) + { + structs::MainInvItemSlotStruct RoF2Slot; + RoF2Slot.MainSlot = INVALID_INDEX; + RoF2Slot.SubSlot = INVALID_INDEX; + RoF2Slot.AugSlot = INVALID_INDEX; + RoF2Slot.Unknown01 = NOT_USED; + + uint32 TempSlot = 0; + + if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // (< 52) + RoF2Slot.MainSlot = ServerSlot; + + if (ServerSlot == MainPowerSource) + RoF2Slot.MainSlot = slots::MainPowerSource; + + else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory + RoF2Slot.MainSlot += 3; + + else if (ServerSlot >= MainAmmo) // Ammo and Personl Inventory + RoF2Slot.MainSlot += 1; + + /*else if (ServerSlot >= MainCursor) { // Cursor + RoF2Slot.MainSlot = slots::MainCursor; + + if (ServerSlot > 30) + RoF2Slot.SubSlot = (ServerSlot + 3) - 33; + }*/ + } + + else if (ServerSlot >= EmuConstants::GENERAL_BAGS_BEGIN && ServerSlot <= EmuConstants::CURSOR_BAG_END) { + TempSlot = ServerSlot - 1; + RoF2Slot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2; + RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); + } + + _log(NET__ERROR, "Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + + return RoF2Slot; + } + + static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse) + { + //uint32 RoF2Corpse; + return (ServerCorpse + 1); + } + + static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot) + { + uint32 ServerSlot = INVALID_INDEX; + uint32 TempSlot = 0; + + if (RoF2Slot.SlotType == maps::MapPossessions && RoF2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51) + if (RoF2Slot.MainSlot == slots::MainPowerSource) + TempSlot = MainPowerSource; + + else if (RoF2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory + TempSlot = RoF2Slot.MainSlot - 3; + + /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory/corpse slots + // Need to figure out what to do when we get these + + // The slot range of 0 - client_max is cross-utilized between player inventory and corpse inventory. + // In the case of RoF2, player inventory is addressed as 0 - 33 and corpse inventory is addressed as 23 - 56. + // We 'could' assign the two new inventory slots as 9997 and 9998, and then work around their bag + // slot assignments, but doing so may disrupt our ability to utilize the corpse looting range properly. + + // For now, it's probably best to leave as-is and let this work itself out in the inventory rework. + }*/ + + else if (RoF2Slot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory + TempSlot = RoF2Slot.MainSlot - 1; + + else // Worn Slots + TempSlot = RoF2Slot.MainSlot; + + if (RoF2Slot.SubSlot >= SUB_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1; + + ServerSlot = TempSlot; + } + + else if (RoF2Slot.SlotType == maps::MapBank) { + TempSlot = EmuConstants::BANK_BEGIN; + + if (RoF2Slot.SubSlot >= SUB_BEGIN) + TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1; + + else + TempSlot += RoF2Slot.MainSlot; + + ServerSlot = TempSlot; + } + + else if (RoF2Slot.SlotType == maps::MapSharedBank) { + TempSlot = EmuConstants::SHARED_BANK_BEGIN; + + if (RoF2Slot.SubSlot >= SUB_BEGIN) + TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1; + + else + TempSlot += RoF2Slot.MainSlot; + + ServerSlot = TempSlot; + } + + else if (RoF2Slot.SlotType == maps::MapTrade) { + TempSlot = EmuConstants::TRADE_BEGIN; + + if (RoF2Slot.SubSlot >= SUB_BEGIN) + TempSlot += ((RoF2Slot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1; + // OLD CODE: + //TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot; + + else + TempSlot += RoF2Slot.MainSlot; + + ServerSlot = TempSlot; + } + + else if (RoF2Slot.SlotType == maps::MapWorld) { + TempSlot = EmuConstants::WORLD_BEGIN; + + if (RoF2Slot.MainSlot >= SUB_BEGIN) + TempSlot += RoF2Slot.MainSlot; + + ServerSlot = TempSlot; + } + + /*else if (RoF2Slot.SlotType == maps::MapLimbo) { // Cursor Buffer + TempSlot = 31; + + if (RoF2Slot.MainSlot >= 0) + TempSlot += RoF2Slot.MainSlot; + + ServerSlot = TempSlot; + }*/ + + else if (RoF2Slot.SlotType == maps::MapGuildTribute) { + ServerSlot = INVALID_INDEX; + } + + _log(NET__ERROR, "Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + + return ServerSlot; + } + + static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot) + { + uint32 ServerSlot = INVALID_INDEX; + uint32 TempSlot = 0; + + if (RoF2Slot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33) + if (RoF2Slot.MainSlot == slots::MainPowerSource) + TempSlot = MainPowerSource; + + else if (RoF2Slot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory + TempSlot = RoF2Slot.MainSlot - 3; + + /*else if (RoF2Slot.MainSlot == slots::MainGeneral9 || RoF2Slot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF2 inventory slots + // Need to figure out what to do when we get these + + // Same as above + }*/ + + else if (RoF2Slot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots + TempSlot = RoF2Slot.MainSlot - 1; + + else + TempSlot = RoF2Slot.MainSlot; + + if (RoF2Slot.SubSlot >= SUB_BEGIN) // Bag Slots + TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot + 1; + + ServerSlot = TempSlot; + } + + _log(NET__ERROR, "Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + + return ServerSlot; + } + + static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse) + { + //uint32 ServerCorpse; + return (RoF2Corpse - 1); + } +} +// end namespace RoF2 diff --git a/common/patches/rof2.h b/common/patches/rof2.h new file mode 100644 index 000000000..b39849048 --- /dev/null +++ b/common/patches/rof2.h @@ -0,0 +1,37 @@ +#ifndef RoF2_H_ +#define RoF2_H_ + +#include "../struct_strategy.h" + +class EQStreamIdentifier; + +namespace RoF2 { + + //these are the only public member of this namespace. + extern void Register(EQStreamIdentifier &into); + extern void Reload(); + + + + //you should not directly access anything below.. + //I just dont feel like making a seperate header for it. + + class Strategy : public StructStrategy { + public: + Strategy(); + + protected: + + virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; + + //magic macro to declare our opcode processors + #include "ss_declare.h" + #include "rof2_ops.h" + }; + +}; + + + +#endif /*RoF2_H_*/ diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h new file mode 100644 index 000000000..1f8ff1a52 --- /dev/null +++ b/common/patches/rof2_constants.h @@ -0,0 +1,216 @@ +/* +EQEMu: Everquest Server Emulator + +Copyright (C) 2001-2014 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 RoF2_CONSTANTS_H_ +#define RoF2_CONSTANTS_H_ + +#include "../types.h" + +namespace RoF2 { + namespace maps { + typedef enum : int16 { + MapPossessions = 0, + MapBank, + MapSharedBank, + MapTrade, + MapWorld, + MapLimbo, + MapTribute, + MapTrophyTribute, + MapGuildTribute, + MapMerchant, + MapDeleted, + MapCorpse, + MapBazaar, + MapInspect, + MapRealEstate, + MapViewMODPC, + MapViewMODBank, + MapViewMODSharedBank, + MapViewMODLimbo, + MapAltStorage, + MapArchived, + MapMail, + MapGuildTrophyTribute, + MapOther, + _MapCount + } InventoryMaps; + } + + namespace slots { + typedef enum : int16 { + MainCharm = 0, + MainEar1, + MainHead, + MainFace, + MainEar2, + MainNeck, + MainShoulders, + MainArms, + MainBack, + MainWrist1, + MainWrist2, + MainRange, + MainHands, + MainPrimary, + MainSecondary, + MainFinger1, + MainFinger2, + MainChest, + MainLegs, + MainFeet, + MainWaist, + MainPowerSource, + MainAmmo, + MainGeneral1, + MainGeneral2, + MainGeneral3, + MainGeneral4, + MainGeneral5, + MainGeneral6, + MainGeneral7, + MainGeneral8, + MainGeneral9, + MainGeneral10, + MainCursor, + _MainCount, + _MainEquipmentBegin = MainCharm, + _MainEquipmentEnd = MainAmmo, + _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), + _MainGeneralBegin = MainGeneral1, + _MainGeneralEnd = MainGeneral10, + _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) + } EquipmentSlots; + } + + namespace consts { + static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; + static const uint16 MAP_BANK_SIZE = 24; + static const uint16 MAP_SHARED_BANK_SIZE = 2; + static const uint16 MAP_TRADE_SIZE = 8; + static const uint16 MAP_WORLD_SIZE = 10; + static const uint16 MAP_LIMBO_SIZE = 36; + static const uint16 MAP_TRIBUTE_SIZE = 0; //? + static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; + static const uint16 MAP_MERCHANT_SIZE = 0; + static const uint16 MAP_DELETED_SIZE = 0; + static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; + static const uint16 MAP_BAZAAR_SIZE = 200; + static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; + static const uint16 MAP_REAL_ESTATE_SIZE = 0; + static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; + static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; + static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; + static const uint16 MAP_ALT_STORAGE_SIZE = 0; + static const uint16 MAP_ARCHIVED_SIZE = 0; + static const uint16 MAP_MAIL_SIZE = 0; + static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; + static const uint16 MAP_KRONO_SIZE = NOT_USED; + static const uint16 MAP_OTHER_SIZE = 0; + + // most of these definitions will go away with the structure-based system..this maintains compatibility for now + // (bag slots and main slots beyond Possessions are assigned for compatibility with current server coding) + static const int16 EQUIPMENT_BEGIN = slots::MainCharm; + static const int16 EQUIPMENT_END = slots::MainAmmo; + static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; + + static const int16 GENERAL_BEGIN = slots::MainGeneral1; + static const int16 GENERAL_END = slots::MainGeneral10; + static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; + static const int16 GENERAL_BAGS_BEGIN = 251; + static const int16 GENERAL_BAGS_END_OFFSET = 99; + static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; + + static const int16 CURSOR = slots::MainCursor; + static const int16 CURSOR_BAG_BEGIN = 351; + static const int16 CURSOR_BAG_END_OFFSET = 9; + static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; + + static const int16 BANK_BEGIN = 2000; + static const int16 BANK_END = 2023; + static const int16 BANK_BAGS_BEGIN = 2031; + static const int16 BANK_BAGS_END_OFFSET = 239; + static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; + + static const int16 SHARED_BANK_BEGIN = 2500; + static const int16 SHARED_BANK_END = 2501; + static const int16 SHARED_BANK_BAGS_BEGIN = 2531; + static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; + static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; + + static const int16 TRADE_BEGIN = 3000; + static const int16 TRADE_END = 3007; + static const int16 TRADE_NPC_END = 3003; + static const int16 TRADE_BAGS_BEGIN = 3031; + static const int16 TRADE_BAGS_END_OFFSET = 79; + static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; + + static const int16 WORLD_BEGIN = 4000; + static const int16 WORLD_END = 4009; + + static const int16 TRIBUTE_BEGIN = 400; + static const int16 TRIBUTE_END = 404; + + static const int16 CORPSE_BEGIN = slots::MainGeneral1; + static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; + + 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; + } + + namespace limits { + static const bool ALLOWS_EMPTY_BAG_IN_BAG = true; + static const bool ALLOWS_CLICK_CAST_FROM_BAG = true; + static const bool COIN_HAS_WEIGHT = false; + } + +}; //end namespace RoF2 + +#endif /*RoF2_CONSTANTS_H_*/ + +/* +RoF2 Notes: + ** Structure-based inventory ** +ok Possessions: ( 0, { 0 .. 33 }, -1, -1 ) (Corpse: { 23 .. 56 } [Offset 23]) +ok [Equipment: ( 0, { 0 .. 22 }, -1, -1 )] +ok [General: ( 0, { 23 .. 32 }, -1, -1 )] +ok [Cursor: ( 0, 33, -1, -1 )] + General Bags: ( 0, { 23 .. 32 }, { 0 .. (maxsize - 1) }, -1 ) + Cursor Bags: ( 0, 33, { 0 .. (maxsize - 1) }, -1 ) + + Bank: ( 1, { 0 .. 23 }, -1, -1 ) + Bank Bags: ( 1, { 0 .. 23 }, { 0 .. (maxsize - 1)}, -1 ) + + Shared Bank: ( 2, { 0 .. 1 }, -1, -1 ) + Shared Bank Bags: ( 2, { 0 .. 1 }, { 0 .. (maxsize - 1) }, -1 ) + + Trade: ( 3, { 0 .. 8 }, -1, -1 ) + (Trade Bags: 3031 - 3110 -- server values) + + World: ( 4, { 0 .. 10 }, -1, -1 ) + +*/ diff --git a/common/patches/rof2_itemfields.h b/common/patches/rof2_itemfields.h new file mode 100644 index 000000000..ccba333b5 --- /dev/null +++ b/common/patches/rof2_itemfields.h @@ -0,0 +1,439 @@ +/* + + +These fields must be in the order of how they are serialized! + + + +*/ +#define NEW_TRY +#ifdef NEW_TRY +//* 000 */ I(ItemClass) // Leave this one off on purpose +/* 001 */ S(Name) +/* 002 */ S(Lore) +//* 003 */ C("")//lorefile - Newly Added - Field is Null +/* 004 */ S(IDFile) +/* 005 */ I(ID) +/* 006 */ I(Weight) +/* 007 */ I(NoRent) +/* 008 */ I(NoDrop) +/* 009 */ I(Size) +/* 010 */ I(Slots) +/* 011 */ I(Price) +/* 012 */ I(Icon) +/* 013 */ C("0")//UNK013 +/* 014 */ C("0")//UNK014 +/* 015 */ I(BenefitFlag) +/* 016 */ I(Tradeskills) +/* 017 */ I(CR) +/* 018 */ I(DR) +/* 019 */ I(PR) +/* 020 */ I(MR) +/* 021 */ I(FR) +/* 022 */ C("0")//svcorruption - Newly Added +/* 023 */ I(AStr) +/* 024 */ I(ASta) +/* 025 */ I(AAgi) +/* 026 */ I(ADex) +/* 027 */ I(ACha) +/* 028 */ I(AInt) +/* 029 */ I(AWis) +/* 030 */ I(HP) +/* 031 */ I(Mana) +/* 032 */ I(Endur) //endur - Relocated +/* 033 */ I(AC) +/* 034 */ I(Classes)//classes - Relocated +/* 035 */ I(Races)//races - Relocated +/* 036 */ I(Deity) +/* 037 */ I(SkillModValue) +/* 038 */ C("0")//UNK038 - Default is 0 +/* 039 */ I(SkillModType) +/* 040 */ I(BaneDmgRace) +/* 041 */ I(BaneDmgBody)//banedmgbody - Relocated +/* 042 */ I(BaneDmgRaceAmt)//banedmgraceamt - Relocated +/* 043 */ I(BaneDmgAmt)//banedmgamt - Relocated +/* 044 */ I(Magic) +/* 045 */ I(CastTime_) +/* 046 */ I(ReqLevel) +/* 047 */ I(RecLevel)//reclevel - Relocated +/* 048 */ I(RecSkill)//recskill - Relocated +/* 049 */ I(BardType) +/* 050 */ I(BardValue) +/* 051 */ I(Light) +/* 052 */ I(Delay) +/* 053 */ I(ElemDmgType) +/* 054 */ I(ElemDmgAmt) +/* 055 */ I(Range) +/* 056 */ I(Damage) +/* 057 */ I(Color) +/* 058 */ I(ItemType) +/* 059 */ I(Material) +/* 060 */ C("0")//UNK060 - Default is 0 +/* 061 */ C("0")//UNK061 - Default is 0 +/* 062 */ F(SellRate) +/* 063 */ I(CombatEffects) +/* 064 */ I(Shielding) +/* 065 */ I(StunResist) +/* 066 */ I(StrikeThrough) +/* 067 */ I(ExtraDmgSkill) +/* 068 */ I(ExtraDmgAmt) +/* 069 */ I(SpellShield) +/* 070 */ I(Avoidance) +/* 071 */ I(Accuracy) +/* 072 */ I(CharmFileID) +/* 073 */ I(FactionMod1)//Swapped these so Faction Amt comes after each Faction Mod +/* 074 */ I(FactionAmt1)//Swapped these so Faction Amt comes after each Faction Mod +/* 075 */ I(FactionMod2)//Swapped these so Faction Amt comes after each Faction Mod +/* 076 */ I(FactionAmt2)//Swapped these so Faction Amt comes after each Faction Mod +/* 077 */ I(FactionMod3)//Swapped these so Faction Amt comes after each Faction Mod +/* 078 */ I(FactionAmt3)//Swapped these so Faction Amt comes after each Faction Mod +/* 079 */ I(FactionMod4)//Swapped these so Faction Amt comes after each Faction Mod +/* 080 */ I(FactionAmt4)//Swapped these so Faction Amt comes after each Faction Mod +/* 081 */ S(CharmFile) +/* 082 */ I(AugType) +/* 083 */ I(AugRestrict)//augrestrict - Relocated +/* 084 */ I(AugDistiller)//augdistiller - Relocated +/* 085 */ I(AugSlotType[0]) +/* 086 */ I(AugSlotVisible[0])//augslot1visible - Default 1 +/* 087 */ C("0")//augslot1unk2 - Newly Added - Default 0 +/* 088 */ I(AugSlotType[1]) +/* 089 */ I(AugSlotVisible[1]) +/* 090 */ C("0")//augslot2unk2 - Newly Added +/* 091 */ I(AugSlotType[2]) +/* 092 */ I(AugSlotVisible[2]) +/* 093 */ C("0")//augslot3unk2 - Newly Added +/* 094 */ I(AugSlotType[3]) +/* 095 */ I(AugSlotVisible[3]) +/* 096 */ C("0")//augslot4unk2 - Newly Added +/* 097 */ I(AugSlotType[4]) +/* 098 */ I(AugSlotVisible[4]) +/* 099 */ C("0")//augslot5unk2 - Newly Added +/* 100 */ I(PointType)//pointtype - Relocated +/* 101 */ I(LDoNTheme) +/* 102 */ I(LDoNPrice) +/* 103 */ C("70")//UNK098 - Newly Added - Default 70, but some are set to 0 +/* 104 */ I(LDoNSold) +/* 105 */ I(BagType) +/* 106 */ I(BagSlots) +/* 107 */ I(BagSize) +/* 108 */ I(BagWR) +/* 109 */ I(Book) +/* 110 */ I(BookType) +/* 111 */ S(Filename) +/* 112 */ I(LoreGroup) +/* 113 */ I(ArtifactFlag) +/* 114 */ C("0")//I(PendingLoreFlag)?//UNK109 - Default 0, but a few are 1 +/* 115 */ I(Favor) +/* 116 */ I(GuildFavor)//guildfavor - Relocated +/* 117 */ I(FVNoDrop) +/* 118 */ I(DotShielding) +/* 119 */ I(Attack) +/* 120 */ I(Regen) +/* 121 */ I(ManaRegen) +/* 122 */ I(EnduranceRegen) +/* 123 */ I(Haste) +/* 124 */ I(DamageShield) +/* 125 */ C("-1") //UNK120 - Default is -1 +/* 126 */ C("0") //UNK121 - Default is 0 +/* 127 */ I(Attuneable) +/* 128 */ I(NoPet) +/* 129 */ C("0") //UNK124 - Default 0, but a few are 1 +/* 130 */ I(PotionBelt) +/* 131 */ C("0") //potionbeltslots - Default 0, but a few are 1 +/* 132 */ I(StackSize) +/* 133 */ I(NoTransfer) +/* 134 */ I(Stackable)//UNK129 - Default is 0, but some are much higher +/* 135 */ I(QuestItemFlag)//questitemflag - Default is 0 (off), flag on = 1 +/* 136 */ C("0")//UNK131 - Default is 0, but there is an item set to 1 +/* 137 */ C("0")//UNK132 - Default is 0? 0000000000000000000? +/* 138 */ I(Click.Effect) +/* 139 */ I(Click.Type) +/* 140 */ I(Click.Level2) +/* 141 */ I(Click.Level) +/* 142 */ I(MaxCharges)//maxcharges - Relocated +/* 143 */ I(CastTime_)//casttime - Relocated - Note Duplicate Entries for CastTime_ and none for CastTime +/* 144 */ I(RecastDelay)//recastdelay - Relocated +/* 145 */ I(RecastType)//recasttype - Relocated +/* 146 */ C("0")//clickunk5 - Newly Added - Default is 0 +/* 147 */ C("")//clickname - Newly Added - Default is Null +/* 148 */ C("-1")//clickunk7 - Newly Added - Default is -1, but some set to 0 and some much higher +/* 149 */ I(Proc.Effect) +/* 150 */ I(Proc.Type) +/* 151 */ I(Proc.Level2) +/* 152 */ I(Proc.Level) +/* 153 */ C("0")//procunk1 - Newly Added - Default is 0, but some set to -1 and 1 +/* 154 */ C("0")//procunk2 - Newly Added - Default is 0 +/* 155 */ C("0")//procunk3 - Newly Added - Default is 0 +/* 156 */ C("0")//procunk4 - Newly Added - Default is 0 +/* 157 */ I(ProcRate)//procrate - Relocated +/* 158 */ C("")//procname - Newly Added - Default is Null +/* 159 */ C("-1")//procunk7 - Newly Added - Default is -1, but some set to 0 +/* 160 */ I(Worn.Effect) +/* 161 */ I(Worn.Type) +/* 162 */ I(Worn.Level2) +/* 163 */ I(Worn.Level) +/* 164 */ C("0")//wornunk1 - Newly Added - Default is 0 +/* 165 */ C("0")//wornunk2 - Newly Added - Default is 0 +/* 166 */ C("0")//wornunk3 - Newly Added - Default is 0 +/* 167 */ C("0")//wornunk4 - Newly Added - Default is 0 +/* 168 */ C("0")//wornunk5 - Newly Added - Default is 0 +/* 169 */ C("")//wornname - Newly Added - Default is Null +/* 170 */ C("-1")//wornunk7 - Newly Added - Default is -1, but some set to 0 +/* 171 */ I(Focus.Effect) +/* 172 */ I(Focus.Type) +/* 173 */ I(Focus.Level2) +/* 174 */ I(Focus.Level) +/* 175 */ C("0")//focusunk1 - Newly Added - Default is 0 +/* 176 */ C("0")//focusunk2 - Newly Added - Default is 0 +/* 177 */ C("0")//focusunk3 - Newly Added - Default is 0 +/* 178 */ C("0")//focusunk4 - Newly Added - Default is 0 +/* 179 */ C("0")//focusunk5 - Newly Added - Default is 0 +/* 180 */ C("")//focusname - Newly Added - Default is Null +/* 181 */ C("-1")//focusunk7 - Newly Added - Default is -1, but some set to 0 +/* 182 */ I(Scroll.Effect) +/* 183 */ I(Scroll.Type) +/* 184 */ I(Scroll.Level2) +/* 185 */ I(Scroll.Level) +/* 186 */ C("0")//scrollunk1 - Renumber this*** +/* 187 */ C("0")//scrollunk2 - Newly Added - Default is 0 +/* 188 */ C("0")//scrollunk3 - Newly Added - Default is 0 +/* 189 */ C("0")//scrollunk4 - Newly Added - Default is 0 +/* 190 */ C("0")//scrollunk5 - Newly Added - Default is 0 +/* 191 */ C("")//scrollname - Newly Added - Default is Null +/* 192 */ C("-1")//scrollunk7 - Newly Added - Default is -1, but some set to 0 +/* 193 */ C("0")//UNK193 - Default is 0 +/* 194 */ C("0")//purity - Newly Added - Default is 0, but some go up to 75 +/* 195 */ C("0")//dsmitigation - Newly Added - Default is 0, but some are up to 2 +/* 196 */ C("0")//heroic_str - Newly Added - Default is 0 +/* 197 */ C("0")//heroic_int - Newly Added - Default is 0 +/* 198 */ C("0")//heroic_wis - Newly Added - Default is 0 +/* 199 */ C("0")//heroic_agi - Newly Added - Default is 0 +/* 200 */ C("0")//heroic_dex - Newly Added - Default is 0 +/* 201 */ C("0")//heroic_sta - Newly Added - Default is 0 +/* 202 */ C("0")//heroic_cha - Newly Added - Default is 0 +/* 203 */ C("0")//HeroicSvPoison - Newly Added - Default is 0 +/* 204 */ C("0")//HeroicSvMagic - Newly Added - Default is 0 +/* 205 */ C("0")//HeroicSvFire - Newly Added - Default is 0 +/* 206 */ C("0")//HeroicSvDisease - Newly Added - Default is 0 +/* 207 */ C("0")//HeroicSvCold - Newly Added - Default is 0 +/* 208 */ C("0")//HeroicSvCorruption - Newly Added - Default is 0 +/* 209 */ C("0")//healamt - Newly Added - Default is 0, but some are up to 9 +/* 210 */ C("0")//spelldmg - Newly Added - Default is 0, but some are up to 9 +/* 211 */ C("0")//clairvoyance - Newly Added - Default is 0, but some are up to 10 +/* 212 */ C("0")//backstabdmg - Newly Added - Default is 0, but some are up to 65 +//* 213 */ C("0")//evolvinglevel - Newly Added - Default is 0, but some are up to 7 +//* 214 */ C("0")//MaxPower - Newly Added +//* 215 */ C("0")//Power - Newly Added + +//This doesn't appear to be used /* 102 */ S(verified)//verified +//This doesn't appear to be used /* 102 */ S(serialized)//created +//Unsure where this goes right now (or if it is even used) /* 108 */ I(SummonedFlag) + +#else +/* 000 */ //I(ItemClass) Leave this one off on purpose +/* 001 */ S(Name) +/* 002 */ S(Lore) +/* 003 */ C("") //LoreFile? +/* 003 */ S(IDFile) +/* 004 */ I(ID) +/* 005 */ I(Weight) +/* 006 */ I(NoRent) +/* 007 */ I(NoDrop) +/* 008 */ I(Size) +/* 009 */ I(Slots) +/* 010 */ I(Price) +/* 011 */ I(Icon) +/* 013 */ C("0") +/* 014 */ C("0") +/* 014 */ I(BenefitFlag) +/* 015 */ I(Tradeskills) +/* 016 */ I(CR) +/* 017 */ I(DR) +/* 018 */ I(PR) +/* 019 */ I(MR) +/* 020 */ I(FR) + C("0") //svcorruption +/* 021 */ I(AStr) +/* 022 */ I(ASta) +/* 023 */ I(AAgi) +/* 024 */ I(ADex) +/* 025 */ I(ACha) +/* 026 */ I(AInt) +/* 027 */ I(AWis) +/* 028 */ I(HP) +/* 029 */ I(Mana) + I(Endur) +/* 030 */ I(AC) +/* 052 */ I(Classes) +/* 053 */ I(Races) +/* 031 */ I(Deity) +/* 032 */ I(SkillModValue) +/* 033 */ C("0") +/* 034 */ I(SkillModType) +/* 035 */ I(BaneDmgRace) +/* 037 */ I(BaneDmgBody) +/* 036 */ I(BaneDmgRaceAmt) +/* 036 */ I(BaneDmgAmt) +/* 038 */ I(Magic) +/* 039 */ I(CastTime_) +/* 040 */ I(ReqLevel) +/* 045 */ I(RecLevel) +/* 046 */ I(RecSkill) +/* 041 */ I(BardType) +/* 042 */ I(BardValue) +/* 043 */ I(Light) +/* 044 */ I(Delay) +/* 047 */ I(ElemDmgType) +/* 048 */ I(ElemDmgAmt) +/* 049 */ I(Range) +/* 050 */ I(Damage) +/* 051 */ I(Color) +/* 056 */ I(ItemType) +/* 057 */ I(Material) +/* 060 */ C("0") +/* 061 */ C("0") +/* 058 */ F(SellRate) +/* 063 */ I(CombatEffects) +/* 064 */ I(Shielding) +/* 065 */ I(StunResist) +/* 059 */ //C("0") +/* 061 */ //C("0") +/* 066 */ I(StrikeThrough) +/* 067 */ I(ExtraDmgSkill) +/* 068 */ I(ExtraDmgAmt) +/* 069 */ I(SpellShield) +/* 070 */ I(Avoidance) +/* 071 */ I(Accuracy) +/* 072 */ I(CharmFileID) +/* 073 */ I(FactionMod1) +/* 077 */ I(FactionAmt1) +/* 074 */ I(FactionMod2) +/* 078 */ I(FactionAmt2) +/* 075 */ I(FactionMod3) +/* 079 */ I(FactionAmt3) +/* 076 */ I(FactionMod4) +/* 080 */ I(FactionAmt4) +/* 081 */ S(CharmFile) +/* 082 */ I(AugType) +/* 082 */ I(AugRestrict) +/* 082 */ I(AugDistiller) +/* 083 */ I(AugSlotType[0]) +/* 084 */ I(AugSlotVisible[0]) +/* 084 */ I(AugSlotUnk2[0]) +/* 085 */ I(AugSlotType[1]) +/* 086 */ I(AugSlotVisible[1]) +/* 086 */ I(AugSlotUnk2[1]) +/* 087 */ I(AugSlotType[2]) +/* 088 */ I(AugSlotVisible[2]) +/* 088 */ I(AugSlotUnk2[2]) +/* 089 */ I(AugSlotType[3]) +/* 090 */ I(AugSlotVisible[3]) +/* 090 */ I(AugSlotUnk2[3]) +/* 091 */ I(AugSlotType[4]) +/* 092 */ I(AugSlotVisible[4]) +/* 092 */ I(AugSlotUnk2[4]) +/* 093 */ I(PointType) +/* 093 */ I(LDoNTheme) +/* 094 */ I(LDoNPrice) +/* 094 */ C("0") +/* 095 */ I(LDoNSold) +/* 096 */ I(BagType) +/* 097 */ I(BagSlots) +/* 098 */ I(BagSize) +/* 099 */ I(BagWR) +/* 100 */ I(Book) +/* 101 */ I(BookType) +/* 102 */ S(Filename) +/* 105 */ I(LoreGroup) +/* 106 */ //I(PendingLoreFlag) +/* 107 */ I(ArtifactFlag) +/* 094 */ C("0") +/* 108 */ //I(SummonedFlag) +/* 109 */ I(Favor) +/* 121 */ I(GuildFavor) +/* 110 */ I(FVNoDrop) +/* 112 */ I(DotShielding) +/* 113 */ I(Attack) +/* 114 */ I(Regen) +/* 115 */ I(ManaRegen) +/* 116 */ I(EnduranceRegen) +/* 117 */ I(Haste) +/* 118 */ I(DamageShield) +/* 120 */ C("0") +/* 121 */ C("0") +/* 125 */ I(Attuneable) +/* 126 */ I(NoPet) +/* 124 */ C("0") +/* 129 */ I(PotionBelt) +/* 130 */ I(PotionBeltSlots) +/* 131 */ I(StackSize) +/* 132 */ I(NoTransfer) +/* 129 */ C("0") +/* 132 */ I(QuestItemFlag) +/* 131 */ C("0") +/* 132 */ C("00000000000000000000000000000000000000") +/* 134 */ I(Click.Effect) +/* 135 */ I(Click.Type) +/* 136 */ I(Click.Level2) +/* 137 */ I(Click.Level) +/* 055 */ I(MaxCharges) +/* 060 */ I(CastTime) +/* 119 */ I(RecastDelay) +/* 120 */ I(RecastType) +/* 138 */ C("0") //clickunk5 (prolly ProcRate) +/* 138 */ C("") //clickunk6 +/* 138 */ C("-1") //clickunk7 +/* 139 */ I(Proc.Effect) +/* 140 */ I(Proc.Type) +/* 141 */ I(Proc.Level2) +/* 142 */ I(Proc.Level) +/* 143 */ C("0") //procunk1 (prolly MaxCharges) +/* 143 */ C("0") //procunk2 (prolly CastTime) +/* 143 */ C("0") //procunk3 (prolly RecastDelay) +/* 143 */ C("0") //procunk4 (prolly RecastType) +/* 062 */ I(ProcRate) +/* 143 */ C("") //procunk6 +/* 143 */ C("-1") //procunk7 +/* 144 */ I(Worn.Effect) +/* 145 */ I(Worn.Type) +/* 146 */ I(Worn.Level2) +/* 147 */ I(Worn.Level) +/* 143 */ C("0") //wornunk1 (prolly MaxCharges) +/* 143 */ C("0") //wornunk2 (prolly CastTime) +/* 143 */ C("0") //wornunk3 (prolly RecastDelay) +/* 143 */ C("0") //wornunk4 (prolly RecastType) +/* 143 */ C("0") //wornunk5 (prolly ProcRate) +/* 143 */ C("") //wornunk6 +/* 143 */ C("-1") //wornunk7 +/* 149 */ I(Focus.Effect) +/* 150 */ I(Focus.Type) +/* 151 */ I(Focus.Level2) +/* 152 */ I(Focus.Level) +/* 143 */ C("0") //focusunk1 (prolly MaxCharges) +/* 143 */ C("0") //focusunk2 (prolly CastTime) +/* 143 */ C("0") //focusunk3 (prolly RecastDelay) +/* 143 */ C("0") //focusunk4 (prolly RecastType) +/* 143 */ C("0") //focusunk5 (prolly ProcRate) +/* 143 */ C("") //focusunk6 +/* 143 */ C("-1") //focusunk7 +/* 154 */ I(Scroll.Effect) +/* 155 */ I(Scroll.Type) +/* 156 */ I(Scroll.Level2) +/* 157 */ I(Scroll.Level) +/* 143 */ C("0") //scrollunk1 (prolly MaxCharges) +/* 143 */ C("0") //scrollunk2 (prolly CastTime) +/* 143 */ C("0") //scrollunk3 (prolly RecastDelay) +/* 143 */ C("0") //scrollunk4 (prolly RecastType) +/* 143 */ C("0") //scrollunk5 (prolly ProcRate) +/* 143 */ C("") //scrollunk6 +/* 143 */ C("-1") //scrollunk7 +/* 193 */ C("0") //Power Source Capacity +/* 194 */ C("0") //purity + +#endif + +#undef I +#undef C +#undef S +#undef F + diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h new file mode 100644 index 000000000..fbdd20575 --- /dev/null +++ b/common/patches/rof2_ops.h @@ -0,0 +1,173 @@ +// out-going packets that require an ENCODE translation: +// Begin RoF2 Encodes + +// incoming packets that require a DECODE translation: +// Begin RoF2 Decodes + + +// End RoF2 Encodes/Decodes + +// These require Encodes/Decodes for RoF, so they do for RoF2 as well +// Begin RoF Encodes +E(OP_Action) +E(OP_AdventureMerchantSell) +E(OP_AltCurrency) +E(OP_AltCurrencySell) +E(OP_Animation) +E(OP_ApplyPoison) +E(OP_AugmentInfo) +E(OP_Barter) +E(OP_BazaarSearch) +E(OP_BeginCast) +E(OP_BlockedBuffs) +E(OP_Buff) +E(OP_BuffCreate) +E(OP_CancelTrade) +E(OP_CastSpell) +E(OP_ChannelMessage) +E(OP_CharInventory) +E(OP_ClickObjectAction) +E(OP_ClientUpdate) +E(OP_Consider) +E(OP_Damage) +E(OP_DeleteCharge) +E(OP_DeleteItem) +E(OP_DeleteSpawn) +E(OP_DisciplineUpdate) +E(OP_DzCompass) +E(OP_DzExpeditionEndsWarning) +E(OP_DzExpeditionInfo) +E(OP_DzExpeditionList) +E(OP_DzJoinExpeditionConfirm) +E(OP_DzLeaderStatus) +E(OP_DzMemberList) +E(OP_ExpansionInfo) +E(OP_GMLastName) +E(OP_GMTrainSkillConfirm) +E(OP_GroundSpawn) +E(OP_GroupCancelInvite) +E(OP_GroupFollow) +E(OP_GroupFollow2) +E(OP_GroupInvite) +E(OP_GroupUpdate) +E(OP_GuildMemberList) +E(OP_GuildMemberUpdate) +E(OP_GuildsList) +E(OP_HPUpdate) +E(OP_Illusion) +E(OP_InspectBuffs) +E(OP_InspectRequest) +E(OP_InterruptCast) +E(OP_ItemLinkResponse) +E(OP_ItemPacket) +E(OP_ItemVerifyReply) +E(OP_LeadershipExpUpdate) +E(OP_LogServer) +E(OP_LootItem) +E(OP_ManaChange) +E(OP_MercenaryDataResponse) +E(OP_MercenaryDataUpdate) +E(OP_MoveItem) +E(OP_NewSpawn) +E(OP_NewZone) +E(OP_OnLevelMessage) +//E(OP_OpenNewTasksWindow) +E(OP_PetBuffWindow) +E(OP_PlayerProfile) +E(OP_RaidJoin) +E(OP_RaidUpdate) +E(OP_ReadBook) +E(OP_RecipeAutoCombine) +E(OP_RemoveBlockedBuffs) +E(OP_RequestClientZoneChange) +E(OP_RespondAA) +E(OP_RezzRequest) +E(OP_SendAATable) +E(OP_SendCharInfo) +E(OP_SendMembership) +E(OP_SendZonepoints) +E(OP_SetGuildRank) +E(OP_ShopPlayerBuy) +E(OP_ShopPlayerSell) +E(OP_ShopRequest) +E(OP_SkillUpdate) +E(OP_SomeItemPacketMaybe) +E(OP_SpawnAppearance) +E(OP_SpawnDoor) +E(OP_Stun) +E(OP_TargetBuffs) +E(OP_TaskDescription) +E(OP_TaskHistoryReply) +E(OP_Track) +E(OP_Trader) +E(OP_TraderBuy) +E(OP_TributeInfo) +E(OP_TributeItem) +E(OP_VetRewardsAvaliable) +E(OP_WearChange) +E(OP_WhoAllResponse) +E(OP_ZoneChange) +E(OP_ZoneEntry) +E(OP_ZonePlayerToBind) +E(OP_ZoneServerInfo) +E(OP_ZoneSpawns) +// Begin RoF Decodes +D(OP_AdventureMerchantSell) +D(OP_AltCurrencySell) +D(OP_AltCurrencySellSelection) +D(OP_ApplyPoison) +D(OP_AugmentInfo) +D(OP_AugmentItem) +D(OP_BazaarSearch) +D(OP_BlockedBuffs) +D(OP_Buff) +D(OP_BuffRemoveRequest) +D(OP_CastSpell) +D(OP_ChannelMessage) +D(OP_CharacterCreate) +D(OP_ClientUpdate) +D(OP_Consider) +D(OP_ConsiderCorpse) +D(OP_Consume) +D(OP_Damage) +D(OP_DeleteItem) +D(OP_EnvDamage) +D(OP_FaceChange) +D(OP_FindPersonRequest) +D(OP_GMLastName) +D(OP_GroupCancelInvite) +D(OP_GroupDisband) +D(OP_GroupFollow) +D(OP_GroupFollow2) +D(OP_GroupInvite) +D(OP_GroupInvite2) +D(OP_GuildDemote) +D(OP_GuildRemove) +D(OP_GuildStatus) +D(OP_InspectRequest) +D(OP_ItemLinkClick) +D(OP_ItemVerifyRequest) +D(OP_LoadSpellSet) +D(OP_LootItem) +D(OP_MoveItem) +D(OP_PetCommands) +D(OP_RaidInvite) +D(OP_ReadBook) +D(OP_RecipeAutoCombine) +D(OP_RemoveBlockedBuffs) +D(OP_RezzAnswer) +D(OP_Save) +D(OP_SetServerFilter) +D(OP_ShopPlayerBuy) +D(OP_ShopPlayerSell) +D(OP_ShopRequest) +D(OP_Trader) +D(OP_TraderBuy) +D(OP_TradeSkillCombine) +D(OP_TributeItem) +D(OP_WhoAllRequest) +D(OP_ZoneChange) +D(OP_ZoneEntry) +// End RoF Encodes/Decodes +#undef E +#undef D diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h new file mode 100644 index 000000000..b75faee91 --- /dev/null +++ b/common/patches/rof2_structs.h @@ -0,0 +1,4922 @@ +#ifndef RoF2_STRUCTS_H_ +#define RoF2_STRUCTS_H_ + +namespace RoF2 { + namespace structs { + +/* +** Compiler override to ensure +** byte aligned structures +*/ +#pragma pack(1) + +struct LoginInfo_Struct { +/*000*/ char login_info[64]; +/*064*/ uint8 unknown064[124]; +/*188*/ uint8 zoning; // 01 if zoning, 00 if not +/*189*/ uint8 unknown189[275]; +/*488*/ +}; + +struct EnterWorld_Struct { +/*000*/ char name[64]; +/*064*/ uint32 tutorial; // 01 on "Enter Tutorial", 00 if not +/*068*/ uint32 return_home; // 01 on "Return Home", 00 if not +}; + +//New For SoF +struct WorldObjectsSent_Struct { +}; + +// New for RoF2 - Size: 12 +struct ItemSlotStruct { +/*000*/ int16 SlotType; // Worn and Normal inventory = 0, Bank = 1, Shared Bank = 2, Delete Item = -1 +/*002*/ int16 Unknown02; +/*004*/ int16 MainSlot; +/*006*/ int16 SubSlot; +/*008*/ int16 AugSlot; // Guessing - Seen 0xffff +/*010*/ int16 Unknown01; // Normally 0 - Seen 13262 when deleting an item, but didn't match item ID +/*012*/ +}; + +// New for RoF2 - Used for Merchant_Purchase_Struct +// Can't sellfrom other than main inventory so Slot Type is not needed. +struct MainInvItemSlotStruct { +/*000*/ int16 MainSlot; +/*002*/ int16 SubSlot; +/*004*/ int16 AugSlot; +/*006*/ int16 Unknown01; +/*008*/ +}; + +/* Name Approval Struct */ +/* Len: */ +/* Opcode: 0x8B20*/ +struct NameApproval +{ + char name[64]; + uint32 race; + uint32 class_; + uint32 deity; +}; + +/* +** Entity identification struct +** Size: 4 bytes +** OPCodes: OP_DeleteSpawn, OP_Assist +*/ +struct EntityId_Struct +{ +/*00*/ uint32 entity_id; +/*04*/ +}; + +struct Duel_Struct +{ + uint32 duel_initiator; + uint32 duel_target; +}; + +struct DuelResponse_Struct +{ + uint32 target_id; + uint32 entity_id; + uint32 unknown; +}; + +//Adventure stuff,not a net one,just one for our use +static const uint32 ADVENTURE_COLLECT = 0; +static const uint32 ADVENTURE_MASSKILL = 1; +static const uint32 ADVENTURE_NAMED = 2; +static const uint32 ADVENTURE_RESCUE = 3; + +static const uint32 BUFF_COUNT = 42; // was 25 +static const uint32 BLOCKED_BUFF_COUNT = 30; // was 20 + +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); + +static const uint32 MAX_NUMBER_GUILDS = 1500; + +// Used primarily in the Player Profile: +static const uint32 MAX_PP_LANGUAGE = 32; // was 25 +static const uint32 MAX_PP_SPELLBOOK = 720; // was 480 +static const uint32 MAX_PP_MEMSPELL = 16; // was 12 +static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size +static const uint32 MAX_PP_AA_ARRAY = 300; +static const uint32 MAX_PP_DISCIPLINES = 200; // was 100 +static const uint32 MAX_GROUP_MEMBERS = 6; +static const uint32 MAX_RECAST_TYPES = 20; + +struct AdventureInfo { + uint32 QuestID; + uint32 NPCID; + bool in_use; + uint32 status; + bool ShowCompass; + uint32 Objetive;// can be item to collect,mobs to kill,boss to kill and someone to rescue. + uint32 ObjetiveValue;// number of items,or number of needed mob kills. + char text[512]; + uint8 type; + uint32 minutes; + uint32 points; + float x; + float y; + uint32 zoneid; + uint32 zonedungeonid; +}; +/////////////////////////////////////////////////////////////////////////////// + + +/* +** Color_Struct +** Size: 4 bytes +** Used for convenience +** Merth: Gave struct a name so gcc 2.96 would compile +** +*/ +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; + }; +}; + +struct CharSelectEquip { + //totally guessed; + uint32 equip0; + uint32 equip1; + uint32 equip2; + uint32 itemid; + uint32 equip3; + 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 +/*0000*/ uint32 LastLogin; +/*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 Membership_Entry_Struct +{ +/*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300 +/*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096 +/*008*/ +}; + +struct Membership_Setting_Struct +{ +/*000*/ uint32 setting_index; // 0, 1, or 2 +/*004*/ uint32 setting_id; // 0 to 21 +/*008*/ int32 setting_value; // All can be 0, 1, or -1 +/*012*/ +}; + +struct Membership_Details_Struct +{ +/*0000*/ uint32 membership_setting_count; // Seen 66 +/*0016*/ Membership_Setting_Struct settings[66]; +/*0012*/ uint32 race_entry_count; // Seen 15 +/*1044*/ Membership_Entry_Struct membership_races[15]; +/*0012*/ uint32 class_entry_count; // Seen 15 +/*1044*/ Membership_Entry_Struct membership_classes[15]; +/*1044*/ uint32 exit_url_length; // Length of the exit_url string (0 for none) +/*1048*/ //char exit_url[42]; // Upgrade to Silver or Gold Membership URL +/*1048*/ uint32 exit_url_length2; // Length of the exit_url2 string (0 for none) +/*0000*/ //char exit_url2[49]; // Upgrade to Gold Membership URL +}; + +struct Membership_Struct +{ +/*000*/ uint32 membership; // Seen 2 on Gold Account +/*004*/ uint32 races; // Seen ff ff 01 00 +/*008*/ uint32 classes; // Seen ff ff 01 01 +/*012*/ uint32 entrysize; // Seen 22 +/*016*/ int32 entries[22]; // Most -1, 1, and 0 for Gold Status +/*104*/ +}; + + +/* +* Visible equiptment. +* Size: 20 Octets +*/ +struct EquipStruct { +/*00*/ uint32 equip0; +/*04*/ uint32 equip1; +/*08*/ uint32 equip2; +/*12*/ uint32 itemId; +/*16*/ uint32 equip3; // Same as equip0? +/*20*/ +}; + + +/* +** Generic Spawn Struct +** Length: 897 Octets +** Used in: +** spawnZoneStruct +** dbSpawnStruct +** petStruct +** newSpawnStruct +*/ +/* +showeq -> eqemu +sed -e 's/_t//g' -e 's/seto_0xFF/set_to_0xFF/g' +*/ + +struct Spawn_Struct_Bitfields +{ +/*00*/ unsigned gender:2; // Gender (0=male, 1=female, 2=monster) +/*02*/ unsigned ispet:1; // Guessed based on observing live spawns +/*03*/ unsigned afk:1; // 0=no, 1=afk +/*04*/ unsigned anon:2; // 0=normal, 1=anon, 2=roleplay +/*06*/ unsigned gm:1; +/*06*/ unsigned sneak:1; +/*08*/ unsigned lfg:1; +/*09*/ unsigned unknown09:1; +/*10*/ unsigned invis:1; // May have invis & sneak the wrong way around ... not sure how to tell which is which +/*11*/ unsigned invis1:1; // GM Invis? Can only be seen with #gm on - same for the below +/*12*/ unsigned invis2:1; // This one also make the NPC/PC invis +/*13*/ unsigned invis3:1; // This one also make the NPC/PC invis +/*14*/ unsigned invis4:1; // This one also make the NPC/PC invis +/*15*/ unsigned invis6:1; // This one also make the NPC/PC invis +/*16*/ unsigned invis7:1; // This one also make the NPC/PC invis +/*17*/ unsigned invis8:1; // This one also make the NPC/PC invis +/*18*/ unsigned invis9:1; // This one also make the NPC/PC invis +/*19*/ unsigned invis10:1; // This one also make the NPC/PC invis +/*20*/ unsigned invis11:1; // This one also make the NPC/PC invis +/*21*/ unsigned invis12:1; // This one also make the NPC/PC invis +/*22*/ unsigned linkdead:1; // 1 Toggles LD on or off after name. Correct for RoF2 +/*23*/ unsigned showhelm:1; +/*24*/ unsigned unknown24:1; // Prefixes name with ! +/*25*/ unsigned trader:1; +/*26*/ unsigned unknown26:1; +/*27*/ unsigned targetable:1; +/*28*/ unsigned targetable_with_hotkey:1; +/*29*/ unsigned showname:1; +/*30*/ unsigned unknown30:1; +/*30*/ unsigned untargetable:1; // Untargetable with mouse + /* + // Unknown in RoF2 + unsigned betabuffed:1; + unsigned buyer:1; + unsigned buyer:1; + */ +}; + +/* +struct Spawn_Struct_Position +{ + signed padding0000:12; + signed y:19; + signed padding0001:1; + + signed deltaX:13; // change in x + signed deltaHeading:10;// change in heading + signed padding0008:9; + + signed deltaY:13; + signed z:19; + + signed x:19; + signed animation:10; // animation + signed padding0016:3; + + signed heading:12; + signed deltaZ:13; // change in z + signed padding0020:7; +}; +*/ + +struct Spawn_Struct_Position +{ + signed padding0000:12; + signed y:19; + signed padding0001:1; + + signed deltaZ:13; // change in z + signed deltaX:13; // change in x + signed padding0008:6; + + signed x:19; + signed heading:12; + signed padding0016:1; + + signed deltaHeading:10;// change in heading + signed z:19; + signed padding0020:3; + + signed animation:10; // animation + signed deltaY:13; + signed padding0023:9; +}; + +struct Spawn_Struct +{ +// Note this struct is not used as such, it is here for reference. As the struct is variable sized, the packets +// are constructed in Live.cpp +// +/*0000*/ char name[1]; //name[64]; +/*0000*/ //uint8 nullterm1; // hack to null terminate name +/*0064*/ uint32 spawnId; +/*0068*/ uint8 level; +/*0069*/ float unknown1; +/*0073*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse + Spawn_Struct_Bitfields Bitfields; +/*0000*/ uint8 otherData; // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable +/*0000*/ float unknown3; // seen -1 +/*0000*/ float unknown4; +/*0000*/ float size; +/*0000*/ uint8 face; +/*0000*/ float walkspeed; +/*0000*/ float runspeed; +/*0000*/ uint32 race; +/*0000*/ uint8 showname; // for body types - was charProperties +/*0000*/ uint32 bodytype; +/*0000*/ //uint32 bodytype2; // this is only present if charProperties==2 + // are there more than two possible properties? +/*0000*/ uint8 curHp; +/*0000*/ uint8 haircolor; +/*0000*/ uint8 beardcolor; +/*0000*/ uint8 eyecolor1; +/*0000*/ uint8 eyecolor2; +/*0000*/ uint8 hairstyle; +/*0000*/ uint8 beard; +/*0000*/ uint32 drakkin_heritage; +/*0000*/ uint32 drakkin_tattoo; +/*0000*/ uint32 drakkin_details; +/*0000*/ uint8 statue; // was holding +/*0000*/ uint32 deity; +/*0000*/ uint32 guildID; +/*0000*/ uint32 guildrank; // 0=member, 1=officer, 2=leader, -1=not guilded +/*0000*/ uint8 class_; +/*0000*/ uint8 pvp; // 0 = normal name color, 2 = PVP name color +/*0000*/ uint8 StandState; // stand state - 0x64 for normal animation +/*0000*/ uint8 light; +/*0000*/ uint8 flymode; +/*0000*/ uint8 equip_chest2; +/*0000*/ uint8 unknown9; +/*0000*/ uint8 unknown10; +/*0000*/ uint8 helm; +/*0000*/ char lastName[1]; +/*0000*/ //uint8 lastNameNull; //hack! +/*0000*/ uint32 aatitle; // 0=none, 1=general, 2=archtype, 3=class was AARank +/*0000*/ uint8 unknown12; +/*0000*/ uint32 petOwnerId; +/*0000*/ uint8 unknown13; +/*0000*/ uint32 unknown14; // Stance 64 = normal 4 = aggressive 40 = stun/mezzed +/*0000*/ uint32 unknown15; +/*0000*/ uint32 unknown16; +/*0000*/ uint32 unknown17; +/*0000*/ //uint8 unknownRoF23; +/*0000*/ uint32 unknown18; +/*0000*/ uint32 unknown19; + Spawn_Struct_Position Position; +/*0000*/ union + { + struct + { + /*0000*/ Color_Struct color_helmet; // Color of helmet item + /*0000*/ Color_Struct color_chest; // Color of chest item + /*0000*/ Color_Struct color_arms; // Color of arms item + /*0000*/ Color_Struct color_bracers; // Color of bracers item + /*0000*/ Color_Struct color_hands; // Color of hands item + /*0000*/ Color_Struct color_legs; // Color of legs item + /*0000*/ Color_Struct color_feet; // Color of feet item + /*0000*/ Color_Struct color_primary; // Color of primary item + /*0000*/ Color_Struct color_secondary; // Color of secondary item + } equipment_colors; + /*0000*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above + }; + +// skip these bytes if not a valid player race +/*0000*/ union + { + struct + { + /*0000*/ EquipStruct equip_helmet; // Equiptment: Helmet visual + /*0000*/ EquipStruct equip_chest; // Equiptment: Chest visual + /*0000*/ EquipStruct equip_arms; // Equiptment: Arms visual + /*0000*/ EquipStruct equip_bracers; // Equiptment: Wrist visual + /*0000*/ EquipStruct equip_hands; // Equiptment: Hands visual + /*0000*/ EquipStruct equip_legs; // Equiptment: Legs visual + /*0000*/ EquipStruct equip_feet; // Equiptment: Boots visual + /*0000*/ EquipStruct equip_primary; // Equiptment: Main visual + /*0000*/ EquipStruct equip_secondary; // Equiptment: Off visual + } equip; + /*0000*/ EquipStruct equipment[9]; + }; + +/*0000*/ //char title[0]; // only read if(hasTitleOrSuffix & 4) +/*0000*/ //char suffix[0]; // only read if(hasTitleOrSuffix & 8) + char unknown20[8]; + uint8 IsMercenary; // If NPC == 1 and this == 1, then the NPC name is Orange. +/*0000*/ char unknown21[55]; +}; + + +/* +** Generic Spawn Struct +** Fields from old struct not yet found: +** uint8 traptype; // 65 is disarmable trap, 66 and 67 are invis triggers/traps +** uint8 is_pet; // 0=no, 1=yes +** uint8 afk; // 0=no, 1=afk +** uint8 is_npc; // 0=no, 1=yes +** uint8 max_hp; // (name prolly wrong)takes on the value 100 for players, 100 or 110 for NPCs and 120 for PC corpses... +** uint8 guildrank; // 0=normal, 1=officer, 2=leader +** uint8 eyecolor2; //not sure, may be face +** uint8 aaitle; // 0=none, 1=general, 2=archtype, 3=class +*/ + +/* +** New Spawn +** Length: 176 Bytes +** OpCode: 4921 +*/ +struct NewSpawn_Struct +{ + struct Spawn_Struct spawn; // Spawn Information +}; + + +/* +** Client Zone Entry struct +** Length: 68 Octets +** OpCode: ZoneEntryCode (when direction == client) +*/ +struct ClientZoneEntry_Struct { +/*00*/ uint32 unknown00; // ***Placeholder +/*04*/ char char_name[64]; // Player firstname [32] +/*68*/ uint32 unknown68; +/*72*/ uint32 unknown72; +}; + + +/* +** Server Zone Entry Struct +** Length: 452 Bytes +** OPCodes: OP_ServerZoneEntry +** +*/ +struct ServerZoneEntry_Struct //Adjusted from SEQ Everquest.h Struct +{ + struct NewSpawn_Struct player; +}; + + +//New Zone Struct - Size: 948 +struct NewZone_Struct { +/*0000*/ char char_name[64]; // Character Name +/*0064*/ char zone_short_name[32]; // Zone Short Name +/*0096*/ char unknown0096[96]; +/*0192*/ char zone_long_name[278]; // Zone Long Name +/*0470*/ uint8 ztype; // Zone type (usually FF) +/*0471*/ uint8 fog_red[4]; // Zone fog (red) +/*0475*/ uint8 fog_green[4]; // Zone fog (green) +/*0479*/ uint8 fog_blue[4]; // Zone fog (blue) +/*0483*/ uint8 unknown323; +/*0484*/ float fog_minclip[4]; +/*0500*/ float fog_maxclip[4]; +/*0516*/ float gravity; +/*0520*/ uint8 time_type; +/*0521*/ uint8 rain_chance[4]; +/*0525*/ uint8 rain_duration[4]; +/*0529*/ uint8 snow_chance[4]; +/*0533*/ uint8 snow_duration[4]; +/*0537*/ uint8 unknown537[33]; +/*0570*/ uint8 sky; // Sky Type +/*0571*/ uint8 unknown571[13]; // ***Placeholder +/*0584*/ float zone_exp_multiplier; // Experience Multiplier +/*0588*/ float safe_y; // Zone Safe Y +/*0592*/ float safe_x; // Zone Safe X +/*0596*/ float safe_z; // Zone Safe Z +/*0600*/ float min_z; // Guessed - NEW - Seen 0 +/*0604*/ float max_z; // Guessed +/*0608*/ float underworld; // Underworld, min z (Not Sure?) +/*0612*/ float minclip; // Minimum View Distance +/*0616*/ float maxclip; // Maximum View DIstance +/*0620*/ uint8 unknown620[84]; // ***Placeholder +/*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version. +/*0800*/ int32 unknown800; //seen -1 +/*0804*/ char unknown804[40]; // +/*0844*/ int32 unknown844; //seen 600 +/*0848*/ int32 unknown848; +/*0852*/ uint16 zone_id; +/*0854*/ uint16 zone_instance; +/*0856*/ char unknown856[20]; +/*0876*/ uint32 SuspendBuffs; +/*0880*/ uint32 unknown880; // Seen 50 +/*0884*/ uint32 unknown884; // Seen 10 +/*0888*/ uint8 unknown888; // Seen 1 +/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj) +/*0890*/ uint8 unknown890; // Seen 1 +/*0891*/ uint8 unknown891; // Seen 0 +/*0892*/ uint8 unknown892; // Seen 0 +/*0893*/ uint8 unknown893; // Seen 0 - 00 +/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off +/*0895*/ uint8 unknown895; // Seen 0 - 00 +/*0896*/ uint32 unknown896; // Seen 180 +/*0900*/ uint32 unknown900; // Seen 180 +/*0904*/ uint32 unknown904; // Seen 180 +/*0908*/ uint32 unknown908; // Seen 2 +/*0912*/ uint32 unknown912; // Seen 2 +/*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16 +/*0920*/ uint32 unknown920; // Seen 0 +/*0924*/ uint32 unknown924; // Seen 0 +/*0928*/ uint32 unknown928; // Seen 0 +/*0932*/ int32 unknown932; // Seen -1 +/*0936*/ int32 unknown936; // Seen -1 +/*0940*/ uint32 unknown940; // Seen 0 +/*0944*/ float unknown944; // Seen 1.0 +/*0948*/ +}; + + +/* +** Memorize Spell Struct +** Length: 16 Bytes +** +*/ +struct MemorizeSpell_Struct { +uint32 slot; // Spot in the spell book/memorized slot +uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) +uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming +uint32 unknown12; +}; + +/* +** Make Charmed Pet +** Length: 12 Bytes +** +*/ +struct Charm_Struct { +/*00*/ uint32 owner_id; +/*04*/ uint32 pet_id; +/*08*/ uint32 command; // 1: make pet, 0: release pet +/*12*/ +}; + +struct InterruptCast_Struct +{ + uint32 spawnid; + uint32 messageid; + //char message[0]; +}; + +struct DeleteSpell_Struct +{ +/*000*/int16 spell_slot; +/*002*/uint8 unknowndss002[2]; +/*004*/uint8 success; +/*005*/uint8 unknowndss006[3]; +/*008*/ +}; + +struct ManaChange_Struct +{ + uint32 new_mana; // New Mana AMount + uint32 stamina; + uint32 spell_id; + uint32 unknown12; + uint32 unknown16; +}; + +struct SwapSpell_Struct +{ + uint32 from_slot; + uint32 to_slot; +}; + +struct BeginCast_Struct +{ +/*000*/ uint32 spell_id; +/*004*/ uint16 caster_id; +/*006*/ uint32 cast_time; // in miliseconds +/*010*/ +}; + +struct CastSpell_Struct +{ +/*00*/ uint32 slot; +/*04*/ uint32 spell_id; +/*08*/ ItemSlotStruct inventoryslot; // slot for clicky item, Seen unknown of 131 = normal cast +/*20*/ uint32 target_id; +/*24*/ uint32 cs_unknown[5]; +/*44*/ +}; + +/* +** SpawnAppearance_Struct +** Changes client appearance for all other clients in zone +** Size: 8 bytes +** Used in: OP_SpawnAppearance +** +*/ +struct SpawnAppearance_Struct +{ +/*0000*/ uint16 spawn_id; // ID of the spawn +/*0002*/ uint16 type; // Values associated with the type +/*0004*/ uint32 parameter; // Type of data sent +/*0008*/ +}; + +struct SpellBuff_Struct +{ +/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise +/*001*/ float unknown004; // Seen 1 for no buff +/*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages +/*009*/ uint32 unknown016; +/*013*/ uint8 bard_modifier; +/*014*/ uint32 duration; +/*018*/ uint8 level; +/*019*/ uint32 spellid; +/*023*/ uint32 counters; +/*027*/ uint8 unknown0028[53]; +/*080*/ +}; + +struct SpellBuff_Struct_Old +{ +/*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise +/*001*/ uint8 level; +/*002*/ uint8 bard_modifier; +/*003*/ uint8 effect; // not real +/*004*/ float unknown004; // Seen 1 for no buff +/*008*/ uint32 spellid; +/*012*/ uint32 duration; +/*016*/ uint32 unknown016; +/*020*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages +/*024*/ uint32 counters; +/*028*/ uint8 unknown0028[60]; +/*088*/ +}; + +// Not functional yet, but this is what the packet looks like on Live +struct SpellBuffFade_Struct_Live { +/*000*/ uint32 entityid; // Player id who cast the buff +/*004*/ uint8 unknown004; +/*005*/ uint8 level; +/*006*/ uint8 effect; +/*007*/ uint8 unknown007; +/*008*/ float unknown008; +/*012*/ uint32 spellid; +/*016*/ uint32 duration; +/*020*/ uint32 playerId; // Global player ID? +/*024*/ uint32 num_hits; +/*028*/ uint8 unknown0028[64]; +/*092*/ uint32 slotid; +/*096*/ uint32 bufffade; +/*100*/ +}; + +struct SpellBuffFade_Struct { +/*000*/ uint32 entityid; +/*004*/ uint8 slot; +/*005*/ uint8 level; +/*006*/ uint8 effect; +/*007*/ uint8 unknown7; +/*008*/ uint32 spellid; +/*012*/ uint32 duration; +/*016*/ uint32 num_hits; +/*020*/ uint32 unknown020; // Global player ID? +/*024*/ uint32 playerId; // Player id who cast the buff +/*028*/ uint32 slotid; +/*032*/ uint32 bufffade; +/*036*/ +}; + +struct BuffRemoveRequest_Struct +{ +/*00*/ uint32 SlotID; +/*04*/ uint32 EntityID; +/*08*/ +}; + +#if 0 +// not in use +struct BuffIconEntry_Struct { +/*000*/ uint32 buff_slot; +/*004*/ uint32 spell_id; +/*008*/ uint32 tics_remaining; +/*012*/ uint32 num_hits; +// char name[0]; caster name is also here sometimes +// uint8 unknownend; 1 when single, 0 when all opposite of all_buffs? +}; + +// not in use +struct BuffIcon_Struct { +/*000*/ uint32 entity_id; +/*004*/ uint32 unknown004; +/*008*/ uint8 all_buffs; // 1 when updating all buffs, 0 when doing one +/*009*/ uint16 count; +/*011*/ BuffIconEntry_Struct entires[0]; +}; +#endif + +struct GMTrainee_Struct +{ + /*000*/ uint32 npcid; + /*004*/ uint32 playerid; + /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; + /*408*/ uint8 unknown408[40]; + /*448*/ +}; + +struct GMTrainEnd_Struct +{ + /*000*/ uint32 npcid; + /*004*/ uint32 playerid; + /*008*/ +}; + +struct GMSkillChange_Struct { +/*000*/ uint16 npcid; +/*002*/ uint8 unknown1[2]; // something like PC_ID, but not really. stays the same thru the session though +/*002*/ uint16 skillbank; // 0 if normal skills, 1 if languages +/*002*/ uint8 unknown2[2]; +/*008*/ uint16 skill_id; +/*010*/ uint8 unknown3[2]; +/*012*/ +}; + +struct GMTrainSkillConfirm_Struct { // SoF+ only +/*000*/ uint32 SkillID; +/*004*/ uint32 Cost; +/*008*/ uint8 NewSkill; // Set to 1 for 'You have learned the basics' message. +/*009*/ char TrainerName[64]; +/*073*/ uint8 Unknown073[3]; +/*076*/ +}; + +struct ConsentResponse_Struct { + char grantname[64]; + char ownername[64]; + uint8 permission; + char zonename[64]; +}; + +/* +** Name Generator Struct +** Length: 72 bytes +** OpCode: 0x0290 +*/ +struct NameGeneration_Struct +{ +/*0000*/ uint32 race; +/*0004*/ uint32 gender; +/*0008*/ char name[64]; +/*0072*/ +}; + +/* +** Character Creation struct +** Length: 96 Bytes +*/ +struct CharCreate_Struct +{ +/*0000*/ uint32 gender; +/*0004*/ uint32 race; +/*0008*/ uint32 class_; +/*0012*/ uint32 deity; +/*0016*/ uint32 start_zone; +/*0020*/ uint32 haircolor; +/*0024*/ uint32 beard; +/*0028*/ uint32 beardcolor; +/*0032*/ uint32 hairstyle; +/*0036*/ uint32 face; +/*0040*/ uint32 eyecolor1; +/*0044*/ uint32 eyecolor2; +/*0048*/ uint32 drakkin_heritage; +/*0052*/ uint32 drakkin_tattoo; +/*0056*/ uint32 drakkin_details; +/*0060*/ uint32 STR; +/*0064*/ uint32 STA; +/*0068*/ uint32 AGI; +/*0073*/ uint32 DEX; +/*0076*/ uint32 WIS; +/*0080*/ uint32 INT; +/*0084*/ uint32 CHA; +/*0088*/ uint32 tutorial; +/*0092*/ uint32 unknown0092; +/*0096*/ +}; + +/* +** Character Creation struct +** Length: 0 Bytes +** OpCode: 0x +*/ +struct CharCreate_Struct_Temp //Size is now 0 +{ +}; + +/* + *Used in PlayerProfile + */ +struct AA_Array +{ + uint32 AA; + uint32 value; + uint32 unknown08; // Looks like AA_Array is now 12 bytes in Live +}; + +struct Disciplines_Struct { + uint32 values[MAX_PP_DISCIPLINES]; +}; + + + +struct Tribute_Struct { + uint32 tribute; + 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, + bandolierRange, + bandolierAmmo +}; +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 PotionBelt_Struct { + BandolierItem_Struct items[MAX_POTIONS_IN_BELT]; +}; + +struct GroupLeadershipAA_Struct { + union { + struct { + uint32 groupAAMarkNPC; + uint32 groupAANPCHealth; + uint32 groupAADelegateMainAssist; + uint32 groupAADelegateMarkNPC; + uint32 groupAA4; + uint32 groupAA5; + uint32 groupAAInspectBuffs; + uint32 groupAA7; + uint32 groupAASpellAwareness; + uint32 groupAAOffenseEnhancement; + uint32 groupAAManaEnhancement; + uint32 groupAAHealthEnhancement; + uint32 groupAAHealthRegeneration; + uint32 groupAAFindPathToPC; + uint32 groupAAHealthOfTargetsTarget; + uint32 groupAA15; + }; + uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct RaidLeadershipAA_Struct { + union { + struct { + uint32 raidAAMarkNPC; + uint32 raidAANPCHealth; + uint32 raidAADelegateMainAssist; + uint32 raidAADelegateMarkNPC; + uint32 raidAA4; + uint32 raidAA5; + uint32 raidAA6; + uint32 raidAASpellAwareness; + uint32 raidAAOffenseEnhancement; + uint32 raidAAManaEnhancement; + uint32 raidAAHealthEnhancement; + uint32 raidAAHealthRegeneration; + uint32 raidAAFindPathToPC; + uint32 raidAAHealthOfTargetsTarget; + uint32 raidAA14; + uint32 raidAA15; + }; + uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; + }; +}; + +struct LeadershipAA_Struct { + union { + struct { + GroupLeadershipAA_Struct group; + RaidLeadershipAA_Struct raid; + }; + uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; + }; +}; + + /** +* A bind point. +* Size: 20 Octets +*/ +struct BindStruct { + /*000*/ uint32 zoneId; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + /*020*/ +}; + + +// Player Profile - Variable Length as of Oct 12 2012 patch +struct PlayerProfile_Struct +{ +/*00000*/ uint32 checksum; // +/*00004*/ uint32 checksum_size; // Value = ( Packet Size - 9 ) +/*00008*/ uint8 checksum_byte; // +/*00009*/ uint8 unknown_rof1[3]; // +/*00012*/ uint32 unknown_rof2; // +/*00016*/ uint8 gender; // Player Gender - 0 Male, 1 Female +/*00017*/ uint32 race; // Player race +/*00021*/ uint8 class_; // Player class +/*00022*/ uint8 level; // Level of player +/*00023*/ uint8 level1; // Level of player (again?) +/*00024*/ uint32 bind_count; // Seen 5 +/*00028*/ BindStruct binds[5]; // Bind points (primary is first) 5 fields = 100 bytes +/*00128*/ uint32 deity; // deity +/*00132*/ uint32 unknown_rof3; // Maybe Drakkin Heritage? +/*00136*/ uint32 unknown4_count; // Seen 10 +/*00140*/ uint32 unknown_rof4[10]; // Seen all 0s +/*00180*/ uint32 equip_count; // Seen 22 +union +{ + struct + { + /*00184*/ EquipStruct equip_helmet; // Equiptment: Helmet visual + /*00204*/ EquipStruct equip_chest; // Equiptment: Chest visual + /*00224*/ EquipStruct equip_arms; // Equiptment: Arms visual + /*00244*/ EquipStruct equip_bracers; // Equiptment: Wrist visual + /*00264*/ EquipStruct equip_hands; // Equiptment: Hands visual + /*00284*/ EquipStruct equip_legs; // Equiptment: Legs visual + /*00304*/ EquipStruct equip_feet; // Equiptment: Boots visual + /*00324*/ EquipStruct equip_primary; // Equiptment: Main visual + /*00344*/ EquipStruct equip_secondary; // Equiptment: Off visual + // Below slots are just guesses, but all 0s anyway... + /*00364*/ EquipStruct equip_charm; // Equiptment: Non-visual + /*00384*/ EquipStruct equip_ear1; // Equiptment: Non-visual + /*00404*/ EquipStruct equip_ear2; // Equiptment: Non-visual + /*00424*/ EquipStruct equip_face; // Equiptment: Non-visual + /*00444*/ EquipStruct equip_neck; // Equiptment: Non-visual + /*00464*/ EquipStruct equip_shoulder; // Equiptment: Non-visual + /*00484*/ EquipStruct equip_bracer2; // Equiptment: Non-visual + /*00504*/ EquipStruct equip_range; // Equiptment: Non-visual + /*00524*/ EquipStruct equip_ring1; // Equiptment: Non-visual + /*00544*/ EquipStruct equip_ring2; // Equiptment: Non-visual + /*00564*/ EquipStruct equip_waist; // Equiptment: Non-visual + /*00584*/ EquipStruct equip_powersource; // Equiptment: Non-visual + /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual + } equip; + /*00184*/ EquipStruct equipment[22]; +}; +/*00624*/ uint32 equip2_count; // Seen 9 +/*00628*/ EquipStruct equipment2[9]; // Appears to be Visible slots, but all 0s +/*00808*/ uint32 tint_count; // Seen 9 +/*00812*/ Color_Struct item_tint[9]; // RR GG BB 00 +/*00848*/ uint32 tint_count2; // Seen 9 +/*00852*/ Color_Struct item_tint2[9]; // RR GG BB 00 +/*00888*/ uint8 haircolor; // Player hair color +/*00889*/ uint8 beardcolor; // Player beard color +/*00890*/ uint32 unknown_rof5; // +/*00894*/ uint8 eyecolor1; // Player left eye color +/*00895*/ uint8 eyecolor2; // Player right eye color +/*00896*/ uint8 hairstyle; // Player hair style +/*00897*/ uint8 beard; // Player beard type +/*00898*/ uint8 face; // Player face +/*00899*/ uint32 drakkin_heritage; // +/*00903*/ uint32 drakkin_tattoo; // +/*00907*/ uint32 drakkin_details; // +/*00911*/ uint8 unknown_rof6; // +/*00912*/ int8 unknown_rof7; // seen -1 +/*00913*/ uint8 unknown_rof8; // +/*00914*/ uint8 unknown_rof9; // +/*00915*/ uint8 unknown_rof10; // Seen 1 or 0 (on a female?) +/*00916*/ float height; // Seen 7.0 (barb), 5.0 (woodelf), 5.5 (halfelf) +/*00920*/ float unknown_rof11; // Seen 3.0 +/*00924*/ float unknown_rof12; // Seen 2.5 +/*00928*/ float unknown_rof13; // Seen 5.5 +/*00932*/ uint32 primary; // Seen 10528 +/*00936*/ uint32 secondary; // Seen 10006 +/*00940*/ uint32 points; // Unspent Practice points - RELOCATED??? +/*00944*/ uint32 mana; // Current mana +/*00948*/ uint32 cur_hp; // Current HP without +HP equipment +/*00952*/ uint32 STR; // Strength - 6e 00 00 00 - 110 +/*00956*/ uint32 STA; // Stamina - 73 00 00 00 - 115 +/*00960*/ uint32 CHA; // Charisma - 37 00 00 00 - 55 +/*00964*/ uint32 DEX; // Dexterity - 50 00 00 00 - 80 +/*00968*/ uint32 INT; // Intelligence - 3c 00 00 00 - 60 +/*00972*/ uint32 AGI; // Agility - 5f 00 00 00 - 95 +/*00976*/ uint32 WIS; // Wisdom - 46 00 00 00 - 70 +/*00980*/ uint32 unknown_rof14[7]; // Probably base resists? +/*01008*/ uint32 aa_count; // Seen 300 +/*01012*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [300] 3600 bytes - AAs 12 bytes each +/*04612*/ uint32 skill_count; // Seen 100 +/*04616*/ uint32 skills[MAX_PP_SKILL]; // [100] 400 bytes - List of skills +/*05016*/ uint32 unknown15_count; // Seen 25 +/*05020*/ uint32 unknown_rof15[25]; // Most are 255 or 0 +/*05120*/ uint32 discipline_count; // Seen 200 +/*05124*/ Disciplines_Struct disciplines; // [200] 800 bytes Known disciplines +/*05924*/ uint32 timestamp_count; // Seen 20 +/*05928*/ uint32 timestamps[20]; // Unknown Unix Timestamps - maybe recast related? +/*06008*/ uint32 recast_count; // Seen 20 +/*06012*/ uint32 recastTimers[MAX_RECAST_TYPES];// [20] 80 bytes - Timers (UNIX Time of last use) +/*06092*/ uint32 timestamp2_count; // Seen 100 +/*06096*/ uint32 timestamps2[100]; // Unknown Unix Timestamps - maybe Skill related? +/*06496*/ uint32 spell_book_count; // Seen 720 +/*06500*/ uint32 spell_book[MAX_PP_SPELLBOOK]; // List of the Spells in spellbook 720 = 90 pages [2880 bytes] +/*09380*/ uint32 mem_spell_count; // Seen 16 +/*09384*/ int32 mem_spells[MAX_PP_MEMSPELL]; // [16] List of spells memorized - First 12 are set or -1 and last 4 are 0s +/*09448*/ uint32 unknown16_count; // Seen 13 +/*09452*/ uint32 unknown_rof16[13]; // Possibly spell or buff related +/*09504*/ uint8 unknown_rof17; // Seen 0 or 8 +/*09505*/ uint32 buff_count; // Seen 42 +/*09509*/ SpellBuff_Struct buffs[BUFF_COUNT]; // [42] 3360 bytes - Buffs currently on the player (42 Max) - (Each Size 80) +/*12869*/ uint32 platinum; // Platinum Pieces on player +/*12873*/ uint32 gold; // Gold Pieces on player +/*12877*/ uint32 silver; // Silver Pieces on player +/*12881*/ uint32 copper; // Copper Pieces on player +/*12885*/ uint32 platinum_cursor; // Platinum Pieces on cursor +/*12889*/ uint32 gold_cursor; // Gold Pieces on cursor +/*12893*/ uint32 silver_cursor; // Silver Pieces on cursor +/*12897*/ uint32 copper_cursor; // Copper Pieces on cursor +/*12901*/ uint32 intoxication; // Alcohol level (in ticks till sober?) - Position Guessed +/*12905*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3) - Position Guessed +/*12909*/ uint32 unknown_rof19; // +/*12913*/ uint32 thirst_level; // Drink (ticks till next drink) - Position Guessed +/*12917*/ uint32 hunger_level; // Food (ticks till next eat) - Position Guessed +/*12921*/ uint32 aapoints_spent; // Number of spent AA points +/*12925*/ uint32 aapoint_count; // Seen 5 - Unsure what this is exactly +/*12929*/ uint32 aapoints_assigned; // Number of Assigned AA points - Seen 206 (total of the 4 fields below) +/*12933*/ uint32 aa_spent_general; // Seen 63 +/*12937*/ uint32 aa_spent_archetype; // Seen 40 +/*12941*/ uint32 aa_spent_class; // Seen 103 +/*12945*/ uint32 aa_spent_special; // Seen 0 +/*12949*/ uint32 aapoints; // Unspent AA points - Seen 1 +/*12953*/ uint16 unknown_rof20; // +/*12955*/ uint32 bandolier_count; // Seen 20 +/*12959*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; // [20] 740 bytes (Variable Name Sizes) - bandolier contents +/*13699*/ uint32 potionbelt_count; // Seen 5 +/*13703*/ PotionBelt_Struct potionbelt; // [5] 45 bytes potion belt - (Variable Name Sizes) +/*13748*/ int32 unknown_rof21; // Seen -1 +/*13752*/ int32 hp_total; // Guessed - Seen 20 on level 1 new mage +/*13756*/ int32 endurance_total; // Guessed - Seen 20 on level 1 new mage +/*13760*/ int32 mana_total; // Guessed - Only seen on casters so far - Matches above field if caster +/*13764*/ uint32 unknown_rof22[12]; // Same for all seen PPs - 48 bytes: +/* +19 00 00 00 19 00 00 00 19 00 00 00 0f 00 00 00 +0f 00 00 00 0f 00 00 00 0f 00 00 00 1f 85 eb 3e +33 33 33 3f 08 00 00 00 02 00 00 00 01 00 00 00 +*/ +/*13812*/ uint32 unknown_rof23; // Seen 5, 19, and 20 in examples +/*13816*/ uint32 unknown_rof24[4]; // +/*13832*/ uint32 unknown_rof25[2]; // Seen random numbers from 0 to 2165037 +/*13840*/ uint32 unknown_rof26; // Seen 106 +//END SUB-STRUCT used for shrouding. +/*13844*/ uint32 name_str_len; // Seen 64 +/*13848*/ char name[64]; // Name of player - 19960 for Live 1180 difference +/*13912*/ uint32 last_name_str_len; // Seen 32 +/*13916*/ char last_name[32]; // Last name of player +/*13948*/ uint32 birthday; // character birthday +/*13952*/ uint32 account_startdate; // Date the Account was started +/*13956*/ uint32 lastlogin; // character last save time +/*13960*/ uint32 timePlayedMin; // time character played +/*13964*/ uint32 timeentitledonaccount; +/*13968*/ uint32 expansions; // Bitmask for expansions ff 7f 00 00 - SoD +/*13972*/ uint32 language_count; // Seen 32 +/*13976*/ uint8 languages[MAX_PP_LANGUAGE]; // [32] 32 bytes - List of languages +/*14008*/ uint16 zone_id; // see zones.h +/*14010*/ uint16 zoneInstance; // Instance id +/*14012*/ float y; // Players y position (NOT positive about this switch) +/*14016*/ float x; // Players x position +/*14020*/ float z; // Players z position +/*14024*/ float heading; // Players heading +/*14028*/ uint32 air_remaining; // Air supply (seconds) +/*14032*/ int32 unknown_rof28; // Seen -1 +/*14036*/ uint8 unknown_rof29[10]; // +/*14046*/ uint32 unknown_rof30; // Random large number or 0 +/*14050*/ uint32 unknown_rof31; // +/*14054*/ uint32 unknown32_count; // Seen 5 +/*14058*/ uint8 unknown_rof32[29]; // +/*14087*/ uint32 unknown33_count; // Seen 32 for melee/hybrid and 21 for druid, 34 for mage +/*14091*/ uint32 unknown_rof33[64]; // Struct contains 2 ints, so double 32 count (Variable Sized) +// Position Varies after this point - Really starts varying at Bandolier names, but if no names set it starts here +/*00000*/ int32 unknown_rof34; // Seen -1 +/*00000*/ int32 unknown_rof35; // Seen -1 +/*00000*/ uint8 unknown_rof36[18]; // +/*00000*/ uint32 unknown37_count; // Seen 5 +/*00000*/ int32 unknown_rof37[10]; // Alternates -1 and 0 - Struct contains 2 ints +/*00000*/ uint32 unknown38_count; // Seen 10 +/*00000*/ int32 unknown_rof38[20]; // Alternates -1 and 0 - Struct contains 2 ints +/*00000*/ uint8 unknown_rof39[137]; // +/*00000*/ float unknown_rof40; // Seen 1.0 +/*00000*/ uint32 unknown_rof41[9]; // +/*00000*/ uint32 unknown_rof42; // Seen 0 or 1 +/*00000*/ uint32 unknown_string1_count; // Seen 64 +/*00000*/ char unknown_string1[64]; // +/*00000*/ uint8 unknown_rof43[30]; // +/*00000*/ uint32 unknown_string2_count; // Seen 64 +/*00000*/ char unknown_string2[64]; // +/*00000*/ uint32 unknown_string3_count; // Seen 64 +/*00000*/ char unknown_string3[64]; // +/*00000*/ uint32 unknown_rof44; // Seen 0 or 50 +/*00000*/ uint8 unknown_rof45[663]; // +/*00000*/ uint32 char_id; // Guessed based on char creation date and values +/*00000*/ uint8 unknown_rof46; // Seen 0 or 1 +/*00000*/ uint32 unknown_rof47; // Seen 6 +/*00000*/ uint32 unknown_rof48[13]; // Seen all 0s or some mix of ints and float? +/*00000*/ uint32 unknown_rof49; // Seen 64 +/*00000*/ uint8 unknown_rof50[256]; // Seen mostly 0s, but one example had a 2 in the middle +/*00000*/ uint32 unknown_rof51; // Seen 100 or 0 +/*00000*/ uint8 unknown_rof52[82]; // +/*00000*/ uint32 unknown_rof53; // Seen 50 + +uint8 unknown_rof54[1325]; // Unknown Section + +// Bottom of Struct: +/*00000*/ uint8 groupAutoconsent; // 0=off, 1=on +/*00000*/ uint8 raidAutoconsent; // 0=off, 1=on +/*00000*/ uint8 guildAutoconsent; // 0=off, 1=on +/*00000*/ uint8 unknown_rof55; // Seen 1 +/*00000*/ uint32 level3; // SoF looks at the level here to determine how many leadership AA you can bank. +/*00000*/ uint32 showhelm; // 0=no, 1=yes +/*00000*/ uint32 RestTimer; +/*00000*/ uint8 unknown_rof56; +/*00000*/ uint32 unknown_rof57; // Seen 49 +/*00000*/ uint8 unknown_rof58[1045]; // Seen all 0s + +/* +///////////////////// - Haven't identified the below fields in the PP yet +uint8 pvp; // 1=pvp, 0=not pvp +uint8 anon; // 2=roleplay, 1=anon, 0=not anon +uint8 gm; // 0=no, 1=yes (guessing!) +uint32 guild_id; // guildid +uint8 guildrank; // 0=member, 1=officer, 2=guildleader -1=no guild +uint32 guildbanker; +uint32 available_slots; +uint32 endurance; // Current endurance +uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; // Refresh time (millis) - 4 bytes Each * 16 = 64 bytes +uint32 abilitySlotRefresh; +/////////////////////// + +uint32 platinum_bank; // Platinum Pieces in Bank +uint32 gold_bank; // Gold Pieces in Bank +uint32 silver_bank; // Silver Pieces in Bank +uint32 copper_bank; // Copper Pieces in Bank +uint32 platinum_shared; // Shared platinum pieces + +uint32 autosplit; // 0 = off, 1 = on + +char groupMembers[MAX_GROUP_MEMBERS][64];// 384 all the members in group, including self +char groupLeader[64]; // Leader of the group ? +uint32 entityid; + +uint32 leadAAActive; // 0 = leader AA off, 1 = leader AA on +int32 ldon_points_guk; // Earned GUK points +int32 ldon_points_mir; // Earned MIR points +int32 ldon_points_mmc; // Earned MMC points +int32 ldon_points_ruj; // Earned RUJ points +int32 ldon_points_tak; // Earned TAK points +int32 ldon_points_available;// Available LDON points +float tribute_time_remaining;// Time remaining on tribute (millisecs) +uint32 career_tribute_points;// Total favor points for this char +uint32 tribute_points; // Current tribute points +uint32 tribute_active; // 0 = off, 1=on +Tribute_Struct tributes[MAX_PLAYER_TRIBUTES]; // [40] Current tribute loadout +double group_leadership_exp; // Current group lead exp points +double raid_leadership_exp; // Current raid lead AA exp points +uint32 group_leadership_points; // Unspent group lead AA points +uint32 raid_leadership_points; // Unspent raid lead AA points +LeadershipAA_Struct leader_abilities; // [128]Leader AA ranks 19332 + +uint32 PVPKills; +uint32 PVPDeaths; +uint32 PVPCurrentPoints; +uint32 PVPCareerPoints; +uint32 PVPBestKillStreak; +uint32 PVPWorstDeathStreak; +uint32 PVPCurrentKillStreak; +PVPStatsEntry_Struct PVPLastKill; // size 88 +PVPStatsEntry_Struct PVPLastDeath; // size 88 +uint32 PVPNumberOfKillsInLast24Hours; +PVPStatsEntry_Struct PVPRecentKills[50]; // size 4400 - 88 each +uint32 expAA; // Exp earned in current AA point +uint32 currentRadCrystals; // Current count of radiant crystals +uint32 careerRadCrystals; // Total count of radiant crystals ever +uint32 currentEbonCrystals; // Current count of ebon crystals +uint32 careerEbonCrystals; // Total count of ebon crystals ever +*/ + +}; + +/* +** Client Target Struct +** Length: 2 Bytes +** OpCode: 6221 +*/ +struct ClientTarget_Struct { +/*000*/ uint32 new_target; // Target ID +}; + +/* +** Target Rejection Struct +** Length: 12 Bytes +** OpCode: OP_TargetReject +*/ +struct TargetReject_Struct { +/*00*/ uint8 unknown00[12]; +}; + +struct PetCommand_Struct { +/*00*/ uint32 command; +/*04*/ uint32 unknown04; +/*08*/ uint32 unknown08; +}; + +/* +** Delete Spawn +** Length: 5 Bytes +** OpCode: OP_DeleteSpawn +*/ +struct DeleteSpawn_Struct +{ +/*00*/ uint32 spawn_id; // Spawn ID to delete +/*04*/ uint8 unknown04; // Seen 1 +/*05*/ +}; + +/* +** Channel Message received or sent +** Length: 144 Bytes + Variable Length + 1 +** OpCode: OP_ChannelMessage +** +*/ +struct ChannelMessage_Struct +{ +/*000*/ char targetname[64]; // Tell recipient +/*064*/ char sender[64]; // The senders name (len might be wrong) +/*128*/ uint32 language; // Language +/*132*/ uint32 chan_num; // Channel +/*136*/ uint32 cm_unknown4[2]; // ***Placeholder +/*144*/ uint32 skill_in_language; // The players skill in this language? might be wrong +/*148*/ char message[0]; // Variable length message +}; + +/* +** Special Message +** Length: 4 Bytes + Variable Text Length + 1 +** OpCode: OP_SpecialMesg +** +*/ +/* + Theres something wrong with this... example live packet: +Server->Client: [ Opcode: OP_SpecialMesg (0x0fab) Size: 244 ] + 0: 01 02 00 0A 00 00 00 09 - 05 00 00 42 61 72 73 74 | ...........Barst + 16: 72 65 20 53 6F 6E 67 77 - 65 61 76 65 72 00 7C F9 | re Songweaver.|. + 32: FF FF 84 FF FF FF 03 00 - 00 00 47 72 65 65 74 69 | ..........Greeti + +*/ +struct SpecialMesg_Struct +{ +/*00*/ char header[3]; // 04 04 00 <-- for #emote style msg +/*03*/ uint32 msg_type; // Color of text (see MT_*** below) +/*07*/ uint32 target_spawn_id; // Who is it being said to? +/*11*/ char sayer[1]; // Who is the source of the info - Was 1 +/*12*/ uint8 unknown12[12]; +/*24*/ char message[128]; // What is being said? - was 128 +}; + +/* +** When somebody changes what they're wearing +** or give a pet a weapon (model changes) +** Length: 19 Bytes +*/ +struct WearChange_Struct{ +/*000*/ uint16 spawn_id; +/*002*/ uint32 material; +/*006*/ uint32 unknown06; +/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material +/*014*/ uint32 hero_forge_model; // New to VoA +/*018*/ uint32 unknown18; // New to RoF2 +/*022*/ Color_Struct color; +/*026*/ uint8 wear_slot_id; +/*027*/ +}; + +/* +** Type: Bind Wound Structure +** Length: 8 Bytes +*/ +//Fixed for 7-14-04 patch +struct BindWound_Struct +{ +/*000*/ uint16 to; // TargetID +/*002*/ uint16 unknown2; // ***Placeholder +/*004*/ uint16 type; +/*006*/ uint16 unknown6; +}; + + +/* +** Type: Zone Change Request (before hand) +** Length: 88 bytes +** OpCode: a320 +*/ + +struct ZoneChange_Struct { +/*000*/ char char_name[64]; // Character Name +/*064*/ uint16 zoneID; +/*066*/ uint16 instanceID; +/*068*/ uint32 Unknown068; +/*072*/ uint32 Unknown072; +/*076*/ float y; +/*080*/ float x; +/*084*/ float z; +/*088*/ uint32 zone_reason; //0x0A == death, I think +/*092*/ int32 success; // =0 client->server, =1 server->client, -X=specific error +/*096*/ uint32 Unknown096; // Not sure the extra 4 bytes goes here or earlier in the struct. +/*100*/ +}; + +struct RequestClientZoneChange_Struct { +/*000*/ uint16 zone_id; +/*002*/ uint16 instance_id; +/*004*/ uint32 unknown004; +/*008*/ float y; +/*012*/ float x; +/*016*/ float z; +/*020*/ float heading; +/*024*/ uint32 type; //unknown... values +/*032*/ uint8 unknown032[144]; +/*172*/ uint32 unknown172; +/*176*/ +}; + +struct Animation_Struct { +/*00*/ uint16 spawnid; +/*02*/ uint8 value; +/*03*/ uint8 action; +/*04*/ +}; + +// solar: this is what causes the caster to animate and the target to +// get the particle effects around them when a spell is cast +// also causes a buff icon +struct Action_Struct +{ +/*00*/ uint16 target; // id of target +/*02*/ uint16 source; // id of caster +/*04*/ uint16 level; // level of caster - Seen 0 +/*06*/ uint32 unknown06; +/*10*/ float instrument_mod; +/*14*/ uint32 bard_focus_id; // seen 0 +/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again +/*22*/ uint32 unknown22; +/*26*/ uint8 type; +/*27*/ uint32 damage; +/*31*/ uint16 unknown31; +/*33*/ uint32 spell; // spell id being cast +/*37*/ uint8 level2; // level of caster again? Or maybe the castee +/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time? +/*39*/ +}; + +// Starting with 2/21/2006, OP_Actions seem to come in pairs, duplicating +// themselves, with the second one with slightly more information. Maybe this +// has to do with buff blocking?? +struct ActionAlt_Struct +{ +/*00*/ uint16 target; // id of target +/*02*/ uint16 source; // id of caster +/*04*/ uint16 level; // level of caster - Seen 0 +/*06*/ uint32 unknown06; +/*10*/ float instrument_mod; +/*14*/ uint32 bard_focus_id; // seen 0 +/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again +/*22*/ uint32 unknown22; +/*26*/ uint8 type; +/*27*/ uint32 damage; +/*31*/ uint16 unknown31; +/*33*/ uint32 spell; // spell id being cast +/*37*/ uint8 level2; // level of caster again? Or maybe the castee +/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time? +/*39*/ uint32 unknown39; // New field to Underfoot - Seen 14 +/*43*/ uint8 unknown43; // New field to Underfoot - Seen 0 +/*44*/ uint8 unknown44; // New field to Underfoot - Seen 17 +/*45*/ uint8 unknown45; // New field to Underfoot - Seen 0 +/*46*/ int32 unknown46; // New field to Underfoot - Seen -1 +/*50*/ uint32 unknown50; // New field to Underfoot - Seen 0 +/*54*/ uint16 unknown54; // New field to Underfoot - Seen 0 +/*56*/ +}; + +// solar: this is what prints the You have been struck. and the regular +// melee messages like You try to pierce, etc. It's basically the melee +// and spell damage message +struct CombatDamage_Struct +{ +/* 00 */ uint16 target; +/* 02 */ uint16 source; +/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells +/* 05 */ uint32 spellid; +/* 09 */ int32 damage; +/* 13 */ float unknown11; // cd cc cc 3d +/* 17 */ float sequence; // see above notes in Action_Struct +/* 21 */ uint8 unknown19[9]; // was [9] +/* 30 */ +}; + + +/* +** Consider Struct +** Length: 20 Bytes +*/ +struct Consider_Struct{ +/*000*/ uint32 playerid; // PlayerID +/*004*/ uint32 targetid; // TargetID +/*008*/ uint32 faction; // Faction +/*012*/ uint32 level; // Level +/*016*/ uint8 pvpcon; // Pvp con flag 0/1 +/*017*/ uint8 unknown017[3]; // +/*020*/ +}; + +/* +** Spawn Death Blow +** Length: 32 Bytes +** OpCode: 0114 +*/ +struct Death_Struct +{ +/*000*/ uint32 spawn_id; +/*004*/ uint32 killer_id; +/*008*/ uint32 corpseid; // was corpseid +/*012*/ uint32 attack_skill; // was type +/*016*/ uint32 spell_id; +/*020*/ uint32 bindzoneid; //bindzoneid? +/*024*/ uint32 damage; +/*028*/ uint32 unknown028; +}; + +struct BecomeCorpse_Struct { + uint32 spawn_id; + float y; + float x; + float z; +}; + +struct ZonePlayerToBind_Struct { +/*000*/ uint16 bind_zone_id; +/*002*/ uint16 bind_instance_id; +/*004*/ float x; +/*008*/ float y; +/*012*/ float z; +/*016*/ float heading; +/*020*/ char zone_name[1]; // Or "Bind Location" +/*000*/ uint8 unknown021; // Seen 1 - Maybe 0 would be to force a rezone and 1 is just respawn +/*000*/ uint32 unknown022; // Seen 32 or 59 +/*000*/ uint32 unknown023; // Seen 0 +/*000*/ uint32 unknown024; // Seen 21 or 43 +}; + +struct ZonePlayerToBindHeader_Struct +{ + /*000*/ uint16 bind_zone_id; + /*002*/ uint16 bind_instance_id; + /*004*/ float x; + /*008*/ float y; + /*012*/ float z; + /*016*/ float heading; + /*020*/ char zone_name[1]; // Or "Bind Location" +}; + +struct ZonePlayerToBindFooter_Struct +{ + /*000*/ uint8 unknown021; // Seen 1 - Maybe 0 would be to force a rezone and 1 is just respawn + /*000*/ uint32 unknown022; // Seen 32 or 59 + /*000*/ uint32 unknown023; // Seen 0 + /*000*/ uint32 unknown024; // Seen 21 or 43 +}; + +typedef struct { +/*000*/ uint32 bind_number; // Number of this bind in the iteration +/*004*/ uint32 bind_zone_id; // ID of the zone for this bind point or resurect point +/*008*/ float x; // X loc for this bind point +/*012*/ float y; // Y loc for this bind point +/*016*/ float z; // Z loc for this bind point +/*020*/ float heading; // Heading for this bind point +/*024*/ char bind_zone_name[1]; // Or "Bind Location" or "Resurrect" +/*000*/ uint8 validity; // 0 = valid choice, 1 = not a valid choice at this time (resurrection) +} RespawnOptions_Struct; + +struct RespawnWindow_Struct { +/*000*/ uint32 unknown000; // Seen 0 +/*004*/ uint32 time_remaining; // Total time before respawn in milliseconds +/*008*/ uint32 unknown008; // Seen 0 +/*012*/ uint32 total_binds; // Total Bind Point Options? - Seen 2 +/*016*/ RespawnOptions_Struct bind_points; +// First bind point is "Bind Location" and the last one is "Ressurect" +}; + + +/* +** Spawn position update - Size: 22 +** Struct sent from server->client to update position of +** another spawn's position update in zone (whether NPC or PC) +** +*/ +struct PlayerPositionUpdateServer_Struct +{ + uint16 spawn_id; + uint16 spawnId2; + signed padding0004:12; + signed y_pos:19; // y coord + unsigned padding:1; + signed delta_z:13; // change in z + signed delta_x:13; // change in x + signed padding0008:6; + signed x_pos:19; // x coord + unsigned heading:12; // heading + signed padding0016:1; + signed delta_heading:10; // change in heading + signed z_pos:19; // z coord + signed padding0020:3; + signed animation:10; // animation + signed delta_y:13; // change in y + signed padding0024:9; +}; + +/* +** Player position update - Size: 40 +** Struct sent from client->server to update +** player position on server +** +*/ +struct PlayerPositionUpdateClient_Struct +{ + uint16 sequence; // increments one each packet - Verified + uint16 spawn_id; // Player's spawn id + uint8 unknown0004[6]; // ***Placeholder + float delta_x; // Change in x + unsigned heading:12; // Directional heading + unsigned padding0040:20; // ***Placeholder + float x_pos; // x coord (2nd loc value) + float delta_z; // Change in z + float z_pos; // z coord (3rd loc value) + float y_pos; // y coord (1st loc value) + unsigned animation:10; // ***Placeholder + unsigned padding0024:22; // animation + float delta_y; // Change in y + signed delta_heading:10; // change in heading + unsigned padding0041:22; // ***Placeholder +}; + +/* +** Spawn HP Update +** Length: 10 Bytes +** OpCode: OP_HPUpdate +*/ +struct SpawnHPUpdate_Struct +{ +/*00*/ int16 spawn_id; +/*02*/ uint32 cur_hp; +/*06*/ int32 max_hp; +/*10*/ +}; + +/* +** SendExpZonein +** Length: 152 Bytes +** OpCode: OP_SendExpZonein +*/ +struct SendExpZonein_Struct +{ +/*0000*/ uint16 spawn_id; // ID of the spawn +/*0002*/ uint16 type; // Values associated with the type +/*0004*/ uint32 parameter; // Type of data sent +/*0008*/ uint32 exp; // Current experience ratio from 0 to 330 +/*0012*/ uint32 expAA; +/*0016*/ uint8 unknown0016[4]; +/*0020*/ char name[64]; +/*0084*/ char last_name[64]; +/*00148*/ uint32 unknown132; +/*00152*/ +}; + +/* +** SendExpZonein +** Length: 0 Bytes +** OpCode: OP_SendExpZonein +*/ +//struct SendExpZonein_Struct {}; + +struct SpawnHPUpdate_Struct2 +{ +/*01*/ int16 spawn_id; +/*00*/ uint8 hp; +}; +/* +** Stamina +** Length: 8 Bytes +** OpCode: 5721 +*/ +struct Stamina_Struct { +/*00*/ uint32 food; // (low more hungry 127-0) +/*02*/ uint32 water; // (low more thirsty 127-0) +}; + +/* +** Level Update +** Length: 12 Bytes +*/ +struct LevelUpdate_Struct +{ +/*00*/ uint32 level; // New level +/*04*/ uint32 level_old; // Old level +/*08*/ uint32 exp; // Current Experience +}; + +/* +** Experience Update +** Length: 14 Bytes +** OpCode: 9921 +*/ +struct ExpUpdate_Struct +{ +/*0000*/ uint32 exp; // Current experience ratio from 0 to 330 +/*0004*/ uint32 aaxp; // @BP ?? +}; + +/* +** Item Packet Struct - Works on a variety of opcodes +** Packet Types: See ItemPacketType enum +** +*/ +enum ItemPacketType +{ + ItemPacketViewLink = 0x00, + ItemPacketTradeView = 0x65, + ItemPacketLoot = 0x66, + ItemPacketTrade = 0x67, + ItemPacketCharInventory = 0x69, + ItemPacketSummonItem = 0x6A, + ItemPacketTributeItem = 0x6C, + ItemPacketMerchant = 0x64, + ItemPacketWorldContainer = 0x6B +}; +struct ItemPacket_Struct +{ +/*00*/ ItemPacketType PacketType; +/*04*/ char SerializedItem[1]; //was 1 +/*xx*/ +}; + +struct BulkItemPacket_Struct +{ +/*00*/ char SerializedItem[0]; +/*xx*/ +}; + +struct Consume_Struct +{ +/*000*/ ItemSlotStruct slot; +/*012*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click +/*016*/ uint32 type; // 0x01=Food 0x02=Water +/*020*/ uint32 c_unknown1; // Seen 2 +/*024*/ +}; + +struct ItemNamePacket_Struct { +/*000*/ uint32 item_id; +/*004*/ uint32 unkown004; +/*008*/ char name[64]; +/*072*/ +}; + +// Length: 16 +struct ItemProperties_Struct_Old { + +/*000*/ uint8 unknown01[2]; +/*002*/ uint8 charges; +/*003*/ uint8 unknown02[13]; +/*016*/ +}; + +// Length: 8 +struct ItemProperties_Struct { + +/*000*/ uint8 unknown01[4]; +/*004*/ uint8 charges; +/*005*/ uint8 unknown02[3]; +/*008*/ +}; + +struct DeleteItem_Struct { +/*0000*/ ItemSlotStruct from_slot; +/*0012*/ ItemSlotStruct to_slot; +/*0024*/ uint32 number_in_stack; +/*0028*/ +}; + +struct MoveItem_Struct { +/*0000*/ ItemSlotStruct from_slot; +/*0012*/ ItemSlotStruct to_slot; +/*0024*/ uint32 number_in_stack; +/*0028*/ +}; + +// +// from_slot/to_slot +// -1 - destroy +// 0 - cursor +// 1 - inventory +// 2 - bank +// 3 - trade +// 4 - shared bank +// +// cointype +// 0 - copeer +// 1 - silver +// 2 - gold +// 3 - platinum +// +static const uint32 COINTYPE_PP = 3; +static const uint32 COINTYPE_GP = 2; +static const uint32 COINTYPE_SP = 1; +static const uint32 COINTYPE_CP = 0; + +struct MoveCoin_Struct +{ + int32 from_slot; + int32 to_slot; + int32 cointype1; + int32 cointype2; + int32 amount; +}; +struct TradeCoin_Struct{ + uint32 trader; + uint8 slot; + uint16 unknown5; + uint8 unknown7; + uint32 amount; +}; +struct TradeMoneyUpdate_Struct{ + uint32 trader; + uint32 type; + uint32 amount; +}; +/* +** Surname struct +** Size: 100 bytes +*/ +struct Surname_Struct +{ +/*0000*/ char name[64]; +/*0064*/ uint32 unknown0064; +/*0068*/ char lastname[32]; +/*0100*/ +}; + +struct GuildsListEntry_Struct { + char name[64]; +}; + +struct GuildsList_Struct { + uint8 head[64]; // First on guild list seems to be empty... + GuildsListEntry_Struct Guilds[MAX_NUMBER_GUILDS]; +}; + +struct GuildUpdate_Struct { + uint32 guildID; + GuildsListEntry_Struct entry; +}; + +/* +** Money Loot +** Length: 22 Bytes +** OpCode: 5020 +*/ +struct moneyOnCorpseStruct { +/*0000*/ uint8 response; // 0 = someone else is, 1 = OK, 2 = not at this time +/*0001*/ uint8 unknown1; // = 0x5a +/*0002*/ uint8 unknown2; // = 0x40 +/*0003*/ uint8 unknown3; // = 0 +/*0004*/ uint32 platinum; // Platinum Pieces +/*0008*/ uint32 gold; // Gold Pieces + +/*0012*/ uint32 silver; // Silver Pieces +/*0016*/ uint32 copper; // Copper Pieces +}; + +struct LootingItem_Struct { +/*000*/ uint32 lootee; +/*004*/ uint32 looter; +/*008*/ uint16 slot_id; +/*010*/ uint16 unknown10; +/*012*/ uint32 auto_loot; +/*016*/ uint32 unknown16; +/*020*/ +}; + +struct GuildManageStatus_Struct{ + uint32 guildid; + uint32 oldrank; + uint32 newrank; + char name[64]; +}; +// Guild invite, remove +struct GuildJoin_Struct{ +/*000*/ uint32 guild_id; +/*004*/ uint32 unknown04; +/*008*/ uint32 level; +/*012*/ uint32 class_; +/*016*/ uint32 rank;//0 member, 1 officer, 2 leader +/*020*/ uint32 zoneid; +/*024*/ uint32 unknown24; +/*028*/ char name[64]; +/*092*/ +}; +struct GuildInviteAccept_Struct { + char inviter[64]; + char newmember[64]; + uint32 response; + uint32 guildeqid; +}; +struct GuildManageRemove_Struct { + uint32 guildeqid; + char member[64]; +}; +struct GuildCommand_Struct { +/*000*/ char othername[64]; +/*064*/ char myname[64]; +/*128*/ uint16 guildeqid; +/*130*/ uint8 unknown[2]; // for guildinvite all 0's, for remove 0=0x56, 2=0x02 +/*132*/ uint32 officer; +/*136*/ uint32 unknown136; // New in RoF2 +/*140*/ +}; + +// Opcode OP_GMZoneRequest +// Size = 88 bytes +struct GMZoneRequest_Struct { +/*0000*/ char charname[64]; +/*0064*/ uint32 zone_id; +/*0068*/ float x; +/*0072*/ float y; +/*0076*/ float z; +/*0080*/ char unknown0080[4]; +/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded? +/*0088*/ +// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error +// /*073*/ uint8 unknown0073[3]; // =0 ok, =ffffff error +}; + +struct GMSummon_Struct { +/* 0*/ char charname[64]; +/* 30*/ char gmname[64]; +/* 60*/ uint32 success; +/* 61*/ uint32 zoneID; +/*92*/ int32 y; +/*96*/ int32 x; +/*100*/ int32 z; +/*104*/ uint32 unknown2; // E0 E0 56 00 +}; + +struct GMGoto_Struct { // x,y is swapped as compared to summon and makes sense as own packet +/* 0*/ char charname[64]; + +/* 64*/ char gmname[64]; +/* 128*/ uint32 success; +/* 132*/ uint32 zoneID; + +/*136*/ int32 y; +/*140*/ int32 x; +/*144*/ int32 z; +/*148*/ uint32 unknown2; // E0 E0 56 00 +}; + +struct GMLastName_Struct { +/*000*/ char name[64]; +/*064*/ char gmname[64]; +/*128*/ char lastname[64]; +/*192*/ uint16 unknown[4]; // 0x00, 0x00, 0x01, 0x00 = Update the clients +/*200*/ uint32 unknown200[8]; +/*232*/ +}; + +struct OnLevelMessage_Struct { +/*0000*/ uint32 Title_Count; +/*0000*/ char Title[128]; +/*0000*/ uint32 Text_Count; +/*0000*/ char Text[4096]; +/*0000*/ uint32 ButtonName0_Count; +/*0000*/ char ButtonName0[25]; // If Buttons = 1, these two are the text for the left and right buttons respectively +/*0000*/ uint32 ButtonName1_Count; +/*0000*/ char ButtonName1[25]; +/*0000*/ uint8 Buttons; +/*0000*/ uint8 Unknown4275; // Something to do with audio controls +/*0000*/ uint32 Duration; +/*0000*/ uint32 PopupID; // If none zero, a response packet with 00 00 00 00 is returned on clicking the left button +/*0000*/ uint32 NegativeID; // If none zero, a response packet with 01 00 00 00 is returned on clicking the right button +/*0000*/ uint32 Unknown4288; +/*0000*/ uint8 Unknown4276; +/*0000*/ uint8 Unknown4277; +/*0000*/ +}; + +//Combat Abilities +struct CombatAbility_Struct { + uint32 m_target; //the ID of the target mob + uint32 m_atk; + uint32 m_skill; +}; + +//Instill Doubt +struct Instill_Doubt_Struct { + uint8 i_id; + uint8 ia_unknown; + uint8 ib_unknown; + uint8 ic_unknown; + uint8 i_atk; + + uint8 id_unknown; + uint8 ie_unknown; + uint8 if_unknown; + uint8 i_type; + uint8 ig_unknown; + uint8 ih_unknown; + uint8 ii_unknown; +}; + +struct GiveItem_Struct { + uint16 to_entity; + int16 to_equipSlot; + uint16 from_entity; + int16 from_equipSlot; +}; + +struct RandomReq_Struct { + uint32 low; + uint32 high; +}; + +/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +struct RandomReply_Struct { +/* 00 */ uint32 low; +/* 04 */ uint32 high; +/* 08 */ uint32 result; +/* 12 */ char name[64]; +/* 76 */ +}; + +/* +** LFG_Appearance_Struct +** Packet sent to clients to notify when someone in zone toggles LFG flag +** Size: 8 bytes +** Used in: OP_LFGAppearance +** +*/ +struct LFG_Appearance_Struct +{ +/*0000*/ uint32 spawn_id; // ID of the client +/*0004*/ uint8 lfg; // 1=LFG, 0=Not LFG +/*0005*/ char unknown0005[3]; // +/*0008*/ +}; + + +// EverQuest Time Information: +// 72 minutes per EQ Day +// 3 minutes per EQ Hour +// 6 seconds per EQ Tick (2 minutes EQ Time) +// 3 seconds per EQ Minute + +struct TimeOfDay_Struct { + uint8 hour; + uint8 minute; + uint8 day; + uint8 month; + uint16 year; +/*0006*/ uint16 unknown0016; // Placeholder +/*0008*/ +}; + +// Darvik: shopkeeper structs +struct Merchant_Click_Struct { +/*000*/ uint32 npcid; // Merchant NPC's entity id +/*004*/ uint32 playerid; +/*008*/ uint32 command; // 1=open, 0=cancel/close +/*012*/ float rate; // cost multiplier, dosent work anymore +/*016*/ int32 unknown01; // Seen 3 from Server or -1 from Client +/*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client +/*024*/ +}; +/* +Unknowns: +0 is e7 from 01 to // MAYBE SLOT IN PURCHASE +1 is 03 +2 is 00 +3 is 00 +4 is ?? +5 is ?? +6 is 00 from a0 to +7 is 00 from 3f to */ +/* +0 is F6 to 01 +1 is CE CE +4A 4A +00 00 +00 E0 +00 CB +00 90 +00 3F +*/ + +struct Merchant_Sell_Struct { +/*000*/ uint32 npcid; // Merchant NPC's entity id +/*004*/ uint32 playerid; // Player's entity id +/*008*/ uint32 itemslot; // Merchant Slot / Item Instance ID +/*012*/ uint32 unknown12; +/*016*/ uint32 quantity; // Already sold +/*020*/ uint32 unknown20; +/*024*/ uint32 price; +/*028*/ uint32 unknown28; // Normally 0, but seen 84 c5 63 00 as well +/*032*/ +}; + +struct Merchant_Purchase_Struct { +/*000*/ uint32 npcid; // Merchant NPC's entity id +/*004*/ MainInvItemSlotStruct itemslot; +/*012*/ uint32 quantity; +/*016*/ uint32 price; +/*020*/ +}; + +struct Merchant_DelItem_Struct{ +/*000*/ uint32 npcid; // Merchant NPC's entity id +/*004*/ uint32 playerid; // Player's entity id +/*008*/ uint32 itemslot; +}; + +struct AltCurrencyDefinition_Struct { + uint32 id; + uint32 item_id; +}; + +//One packet i didn't include here is the alt currency merchant window. +//it works much like the adventure merchant window +//it is formated like: dbstringid|1|dbstringid|count +//ex for a blank crowns window you would send: +//999999|1|999999|0 +//any items come after in much the same way adventure merchant items do except there is no theme included + +//Server -> Client +//Populates the initial Alternate Currency Window +struct AltCurrencyPopulateEntry_Struct +{ +/*000*/ uint32 currency_number; // corresponds to a dbstr id as well, the string matches what shows up in the "alternate currency" tab. +/*004*/ uint32 unknown00; // always 1 +/*008*/ uint32 currency_number2; // always same as currency number +/*012*/ uint32 item_id; // appears to be the item id +/*016*/ uint32 item_icon; // actual icon +/*020*/ uint32 stack_size; // most are set to 1000, the stack size for the item; should match db i think or there will be problems. +/*024*/ uint8 display; // If set to 0, will not display by default. +/*025*/ +}; + +struct AltCurrencyPopulate_Struct { +/*000*/ uint32 opcode; // 8 for populate +/*004*/ uint32 count; // number of entries +/*008*/ AltCurrencyPopulateEntry_Struct entries[0]; +}; + +//Server -> Client +//Updates the value of a specific Alternate Currency +struct AltCurrencyUpdate_Struct { +/*000*/ uint32 opcode; //7 for update +/*004*/ char name[64]; //name of client (who knows why just do it) +/*068*/ uint32 currency_number; //matches currency_number from populate entry +/*072*/ uint32 unknown072; //always 1 +/*076*/ uint32 amount; //new amount +/*080*/ uint32 unknown080; //seen 0 +/*084*/ uint32 unknown084; //seen 0 +}; + +//Client -> Server +//When an item is selected while the alt currency merchant window is open +struct AltCurrencySelectItem_Struct { +/*000*/ uint32 merchant_entity_id; +/*004*/ //uint32 slot_id; + ItemSlotStruct slot_id; +/*008*/ uint32 unknown008; +/*012*/ uint32 unknown012; +/*016*/ uint32 unknown016; +/*020*/ uint32 unknown020; +/*024*/ uint32 unknown024; +/*028*/ uint32 unknown028; +/*032*/ uint32 unknown032; +/*036*/ uint32 unknown036; +/*040*/ uint32 unknown040; +/*044*/ uint32 unknown044; +/*048*/ uint32 unknown048; +/*052*/ uint32 unknown052; +/*056*/ uint32 unknown056; +/*060*/ uint32 unknown060; +/*064*/ uint32 unknown064; +/*068*/ uint32 unknown068; +/*072*/ uint32 unknown072; +/*076*/ uint32 unknown076; +}; + +//Server -> Client +//As setup it makes it so that item can't be sold to the merchant. +//eg: "I will give you no doubloons for a cloth cap." +//Probably also sends amounts somewhere +struct AltCurrencySelectItemReply_Struct { +/*000*/ uint32 unknown000; +/*004*/ uint8 unknown004; //0xff +/*005*/ uint8 unknown005; //0xff +/*006*/ uint8 unknown006; //0xff +/*007*/ uint8 unknown007; //0xff +/*008*/ char item_name[64]; +/*072*/ uint32 unknown074; +/*076*/ uint32 cost; +/*080*/ uint32 unknown080; +/*084*/ uint32 unknown084; +}; + +//Client -> Server +//Requests purchase of a specific item from the vendor +struct AltCurrencyPurchaseItem_Struct { +/*000*/ uint32 merchant_entity_id; +/*004*/ uint32 item_id; +/*008*/ uint32 unknown008; //1 +}; + +//Client -> Server +//Reclaims / Create currency button pushed. +struct AltCurrencyReclaim_Struct { +/*000*/ uint32 currency_id; +/*004*/ uint32 unknown004; +/*008*/ uint32 count; +/*012*/ uint32 reclaim_flag; //1 = this is reclaim +}; + +struct AltCurrencySellItem_Struct { +/*000*/ uint32 merchant_entity_id; +/*004*/ //uint32 slot_id; + ItemSlotStruct slot_id; +/*008*/ uint32 charges; +/*012*/ uint32 cost; +}; + +struct Adventure_Purchase_Struct { +/*000*/ uint32 some_flag; //set to 1 generally... +/*004*/ uint32 npcid; +/*008*/ uint32 itemid; +/*012*/ uint32 variable; +}; + +struct Adventure_Sell_Struct { +/*000*/ uint32 unknown000; //0x01 - Stack Size/Charges? +/*004*/ uint32 npcid; +/*008*/ MainInvItemSlotStruct slot; +/*016*/ uint32 charges; +/*020*/ uint32 sell_price; +/*024*/ +}; + +struct AdventurePoints_Update_Struct { +/*000*/ uint32 ldon_available_points; // Total available points +/*004*/ uint8 unkown_apu004[20]; +/*024*/ uint32 ldon_guk_points; // Earned Deepest Guk points +/*028*/ uint32 ldon_mirugal_points; // Earned Mirugal' Mebagerie points +/*032*/ uint32 ldon_mistmoore_points; // Earned Mismoore Catacombs Points +/*036*/ uint32 ldon_rujarkian_points; // Earned Rujarkian Hills points +/*040*/ uint32 ldon_takish_points; // Earned Takish points +/*044*/ uint8 unknown_apu042[216]; +}; + + +struct AdventureFinish_Struct{ + uint32 win_lose;//Cofruben: 00 is a lose,01 is win. + uint32 points; +}; +//OP_AdventureRequest +struct AdventureRequest_Struct{ + uint32 risk;//1 normal,2 hard. + uint32 entity_id; +}; +struct AdventureRequestResponse_Struct{ + uint32 unknown000; + char text[2048]; + uint32 timetoenter; + uint32 timeleft; + uint32 risk; + float x; + float y; + float z; + uint32 showcompass; + uint32 unknown2080; +}; + +//this is mostly right but something is off that causes the client to crash sometimes +//I don't really care enough about the feature to work on it anymore though. +struct AdventureLeaderboardEntry_Struct +{ +/*004*/ char name[64]; +/*008*/ uint32 success; +/*012*/ uint32 failure; +/*016*/ +}; + +struct AdventureLeaderboard_Struct +{ +/*000*/ uint32 unknown000; +/*004*/ uint32 unknown004; +/*008*/ uint32 success; +/*012*/ uint32 failure; +/*016*/ uint32 our_rank; +/*020*/ +}; + +/*struct Item_Shop_Struct { + uint16 merchantid; + uint8 itemtype; + Item_Struct item; + uint8 iss_unknown001[6]; +};*/ + +struct Illusion_Struct { // Was size: 336 +/*000*/ uint32 spawnid; +/*004*/ char charname[64]; +/*068*/ uint16 race; +/*070*/ char unknown006[2]; // Weird green name +/*072*/ uint8 gender; +/*073*/ uint8 texture; +/*074*/ uint8 unknown074; +/*075*/ uint8 unknown075; +/*076*/ uint8 helmtexture; +/*077*/ uint8 unknown077; +/*078*/ uint8 unknown078; +/*079*/ uint8 unknown079; +/*080*/ uint32 face; +/*084*/ uint8 hairstyle; // Some Races don't change Hair Style Properly in SoF +/*085*/ uint8 haircolor; +/*086*/ uint8 beard; +/*087*/ uint8 beardcolor; +/*088*/ float size; +/*092*/ uint8 unknown092[148]; +/*240*/ uint32 unknown240; // Removes armor? +/*244*/ uint32 drakkin_heritage; +/*248*/ uint32 drakkin_tattoo; +/*252*/ uint32 drakkin_details; +/*256*/ uint8 unknown256[60]; // This and below are new to RoF2 +/*316*/ int32 unknown316; // Seen -1 +/*320*/ uint8 unknown320[16]; +/*336*/ +}; + +struct ZonePoint_Entry { //32 octets +/*0000*/ uint32 iterator; +/*0004*/ float y; +/*0008*/ float x; +/*0012*/ float z; +/*0016*/ float heading; +/*0020*/ uint16 zoneid; +/*0022*/ uint16 zoneinstance; // LDoN instance +/*0024*/ uint32 unknown024; +/*0028*/ uint32 unknown028; +/*0032*/ +}; + +struct ZonePoints { +/*0000*/ uint32 count; +/*0004*/ struct ZonePoint_Entry zpe[0]; // Always add one extra to the end after all zonepoints +//*0xxx*/ uint8 unknown0xxx[24]; //New from SEQ +}; + +struct SkillUpdate_Struct { +/*00*/ uint32 skillId; +/*04*/ uint32 value; +/*08*/ uint8 unknown08; // Seen 1 +/*09*/ uint8 unknown09; // Seen 80 +/*10*/ uint8 unknown10; // Seen 136 +/*11*/ uint8 unknown11; // Seen 54 +/*12*/ +}; + +struct ZoneUnavail_Struct { + //This actually varies, but... + char zonename[16]; + int16 unknown[4]; +}; + +struct GroupInvite_Struct { +/*0000*/ char invitee_name[64]; +/*0064*/ char inviter_name[64]; +/*0128*/ uint32 unknown0128; +/*0132*/ uint32 unknown0132; +/*0136*/ uint32 unknown0136; +/*0140*/ uint32 unknown0140; +/*0144*/ uint32 unknown0144; +/*0148*/ +}; + +struct GroupGeneric_Struct { +/*0000*/ char name1[64]; +/*0064*/ char name2[64]; +/*0128*/ uint32 unknown0128; +/*0132*/ uint32 unknown0132; +/*0136*/ uint32 unknown0136; +/*0140*/ uint32 unknown0140; +/*0144*/ uint32 unknown0144; +/*0148*/ +}; + +struct GroupCancel_Struct { +/*000*/ char name1[64]; +/*064*/ char name2[64]; +/*128*/ uint8 unknown128[20]; +/*148*/ uint32 toggle; +/*152*/ +}; + +struct GroupUpdate_Struct { +/*0000*/ uint32 action; +/*0004*/ char yourname[64]; +/*0068*/ char membername[5][64]; +/*0388*/ char leadersname[64]; +/*0452*/ +}; + +struct GroupUpdate2_Struct { +/*0000*/ uint32 action; +/*0004*/ char yourname[64]; +/*0068*/ char membername[5][64]; +/*0388*/ char leadersname[64]; +/*0452*/ GroupLeadershipAA_Struct leader_aas; +/*0516*/ uint8 unknown[252]; // Titanium uses [188] here +/*0768*/ +}; + +struct GroupUpdate_Struct_Live { // New for Live +/*0000*/ uint32 groupid; // Guess - Matches unknown0136 from GroupFollow_Struct +/*0004*/ uint32 totalmembers; // Guess +/*0000*/ //uint32 leadersname[0]; // Group Leader Name Null Terminated +/*0008*/ //GroupMembers_Struct groupmembers; +}; + +struct GroupMembers_Struct { // New for Live +/*0000*/ uint32 membernumber; // Guess - number of member in the group (0 to 5?) +/*0000*/ //char membername[0]; // Member Name Null Terminated +/*0000*/ uint8 unknown001[3]; // Seen 0 +/*0000*/ uint32 memberlevel; // Guess +/*0000*/ uint8 unknown002[11]; // Seen 0 +}; + +struct GroupJoin_Struct_Live { // New for Live +/*0000*/ uint32 unknown0000; // Matches unknown0136 from GroupFollow_Struct +/*0004*/ uint32 action; +/*0008*/ uint8 unknown0008[5]; // Seen 0 +/*0013*/ //char membername[0]; // Null Terminated? +/*0000*/ uint8 unknown0013[3]; // Seen 0 +/*0000*/ uint32 unknown0016; // Matches unknown0132 from GroupFollow_Struct +/*0000*/ uint8 unknown0020[11]; // Seen 0 +}; + +struct GroupJoin_Struct { +/*000*/ char unknown000[64]; +/*064*/ char membername[64]; +/*128*/ uint8 unknown128[20]; // Leadership AA ? +/*148*/ +}; + +struct GroupFollow_Struct { // Live Follow Struct +/*0000*/ char name1[64]; // inviter +/*0064*/ char name2[64]; // invitee +/*0128*/ uint32 unknown0128; // Seen 0 +/*0132*/ uint32 unknown0132; // Group ID or member level? +/*0136*/ uint32 unknown0136; // Maybe Voice Chat Channel or Group ID? +/*0140*/ uint32 unknown0140; // Seen 0 +/*0144*/ uint32 unknown0144; // Seen 0 +/*0148*/ uint32 unknown0148; +/*0152*/ +}; + +struct InspectBuffs_Struct { +/*000*/ uint32 spell_id[BUFF_COUNT]; +/*168*/ uint32 tics_remaining[BUFF_COUNT]; +}; + +struct LFG_Struct { +/*000*/ uint32 unknown000; +/*004*/ uint32 value; // 0x00 = off 0x01 = on +/*008*/ uint32 unknown008; +/*012*/ uint32 unknown012; +/*016*/ char name[64]; +}; + +struct FaceChange_Struct { +/*000*/ uint8 haircolor; +/*001*/ uint8 beardcolor; +/*002*/ uint8 eyecolor1; +/*003*/ uint8 eyecolor2; +/*004*/ uint8 hairstyle; +/*005*/ uint8 beard; +/*006*/ uint8 face; +/*007*/ uint8 unknown007; +/*008*/ uint32 drakkin_heritage; +/*012*/ uint32 drakkin_tattoo; +/*016*/ uint32 drakkin_details; +/*020*/ uint32 unknown020; +/*024*/ +}; +//there are only 10 faces for barbs changing woad just +//increase the face value by ten so if there were 8 woad +//designs then there would be 80 barb faces + +/* +** Trade request from one client to another +** Used to initiate a trade +** Size: 8 bytes +** Used in: OP_TradeRequest +*/ +struct TradeRequest_Struct { +/*00*/ uint32 to_mob_id; +/*04*/ uint32 from_mob_id; +/*08*/ +}; + +struct TradeAccept_Struct { +/*00*/ uint32 from_mob_id; +/*04*/ uint32 unknown4; //seems to be garbage +/*08*/ +}; + +/* +** Cancel Trade struct +** Sent when a player cancels a trade +** Size: 8 bytes +** Used In: OP_CancelTrade +** +*/ +struct CancelTrade_Struct { +/*00*/ uint32 fromid; +/*04*/ uint32 action; +/*08*/ +}; + +struct PetitionUpdate_Struct { + uint32 petnumber; // Petition Number + uint32 color; // 0x00 = green, 0x01 = yellow, 0x02 = red + uint32 status; + time_t senttime; // 4 has to be 0x1F + char accountid[32]; + char gmsenttoo[64]; + int32 quetotal; + char charname[64]; +}; + +struct Petition_Struct { + uint32 petnumber; + uint32 urgency; + char accountid[32]; + char lastgm[32]; + uint32 zone; + //char zone[32]; + char charname[64]; + uint32 charlevel; + uint32 charclass; + uint32 charrace; + uint32 unknown; + //time_t senttime; // Time? + uint32 checkouts; + uint32 unavail; + //uint8 unknown5[4]; + time_t senttime; + uint32 unknown2; + char petitiontext[1024]; + char gmtext[1024]; +}; + + +struct Who_All_Struct { // 156 length total +/*000*/ char whom[64]; +/*088*/ uint8 unknown088[64]; +/*064*/ uint32 wrace; // FF FF = no race +/*068*/ uint32 wclass; // FF FF = no class +/*072*/ uint32 lvllow; // FF FF = no numbers +/*076*/ uint32 lvlhigh; // FF FF = no numbers +/*080*/ uint32 gmlookup; // FF FF = not doing /who all gm +/*084*/ uint32 guildid; // Also used for Buyer/Trader/LFG +/*152*/ uint32 type; // 0 = /who 3 = /who all +/*156*/ +}; + +struct Stun_Struct { // 8 bytes total +/*000*/ uint32 duration; // Duration of stun +/*004*/ uint8 unknown004; // seen 0 +/*005*/ uint8 unknown005; // seen 163 +/*006*/ uint8 unknown006; // seen 67 +/*007*/ uint8 unknown007; // seen 0 +/*008*/ +}; + +struct AugmentItem_Struct { +/*00*/ uint32 dest_inst_id; // The unique serial number for the item instance that is being augmented +/*04*/ uint32 container_index; // Seen 0 +/*08*/ ItemSlotStruct container_slot; // Slot of the item being augmented +/*20*/ uint32 augment_index; // Seen 0 +/*24*/ ItemSlotStruct augment_slot; // Slot of the distiller to use (if one applies) +/*36*/ int32 augment_action; // Guessed - 0 = augment, 1 = remove with distiller, 3 = delete aug +/*36*/ //int32 augment_slot; +/*40*/ +}; + +// OP_Emote +struct Emote_Struct { +/*0000*/ uint32 unknown01; +/*0004*/ char message[1024]; // was 1024 +/*1028*/ +}; + +// Inspect +struct Inspect_Struct { + uint32 TargetID; + uint32 PlayerID; +}; + +//OP_InspectAnswer - Size: 1860 +struct InspectResponse_Struct{ +/*000*/ uint32 TargetID; +/*004*/ uint32 playerid; +/*008*/ char itemnames[23][64]; +/*1480*/uint32 itemicons[23]; +/*1572*/char text[288]; // Max number of chars in Inspect Window appears to be 254 +/*1860*/ +}; + +//OP_SetDataRate +struct SetDataRate_Struct { + float newdatarate; +}; + +//OP_SetServerFilter +struct SetServerFilter_Struct { + uint32 filters[35]; //see enum eqFilterType [31] +}; + +//Op_SetServerFilterAck +struct SetServerFilterAck_Struct { + uint8 blank[8]; +}; +struct IncreaseStat_Struct{ + /*0000*/ uint8 unknown0; + /*0001*/ uint8 str; + /*0002*/ uint8 sta; + /*0003*/ uint8 agi; + /*0004*/ uint8 dex; + /*0005*/ uint8 int_; + /*0006*/ uint8 wis; + /*0007*/ uint8 cha; + /*0008*/ uint8 fire; + /*0009*/ uint8 cold; + /*0010*/ uint8 magic; + /*0011*/ uint8 poison; + /*0012*/ uint8 disease; + /*0013*/ char unknown13[116]; + /*0129*/ uint8 str2; + /*0130*/ uint8 sta2; + /*0131*/ uint8 agi2; + /*0132*/ uint8 dex2; + /*0133*/ uint8 int_2; + /*0134*/ uint8 wis2; + /*0135*/ uint8 cha2; + /*0136*/ uint8 fire2; + /*0137*/ uint8 cold2; + /*0138*/ uint8 magic2; + /*0139*/ uint8 poison2; + /*0140*/ uint8 disease2; +}; + +struct GMName_Struct { + char oldname[64]; + char gmname[64]; + char newname[64]; + uint8 badname; + uint8 unknown[3]; +}; + +struct GMDelCorpse_Struct { + char corpsename[64]; + char gmname[64]; + uint8 unknown; +}; + +struct GMKick_Struct { + char name[64]; + char gmname[64]; + uint8 unknown; +}; + + +struct GMKill_Struct { + char name[64]; + char gmname[64]; + uint8 unknown; +}; + + +struct GMEmoteZone_Struct { + char text[512]; +}; + +// The BookText_Struct is not used in SoF and later clients. +// The BookRequest_Struct is used instead for both request and reply. +// +struct BookText_Struct { + uint8 window; // where to display the text (0xFF means new window) + uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly + char booktext[1]; // Variable Length - was 1 +}; +// This is the request to read a book. +// This is just a "text file" on the server +// or in our case, the 'name' column in our books table. +struct BookRequest_Struct { +/*0000*/ uint32 window; // where to display the text (0xFFFFFFFF means new window). +/*0004*/ uint16 invslot; // Is the slot, but the RoF2 conversion causes it to fail. Turned to 0 since it isnt required anyway. +/*0008*/ uint32 unknown006; // Seen FFFFFFFF +/*0010*/ uint16 unknown008; // seen 0000 +/*0012*/ uint32 type; // 0 = Scroll, 1 = Book, 2 = Item Info. Possibly others +/*0016*/ uint32 unknown0012; +/*0020*/ uint16 unknown0016; +/*0022*/ char txtfile[8194]; +}; + +/* +** Object/Ground Spawn struct +** Used for Forges, Ovens, ground spawns, items dropped to ground, etc +** Size: Variable +** OpCodes: OP_CreateObject +** +*/ +struct Object_Struct { +/*00*/ uint32 object_count; // Iteration count in the object list +/*00*/ char object_name[1]; // Name of object, usually something like IT63_ACTORDEF +/*00*/ uint16 zone_id; // Redudant, but: Zone the object appears in +/*00*/ uint16 zone_instance; // +/*00*/ uint32 drop_id; // Unique object id for zone +/*00*/ uint32 unknown024; // 53 9e f9 7e - same for all objects in the zone? +/*00*/ float heading; // heading +/*00*/ float unknown032[2]; // 00 00 00 00 00 00 00 00 +/*00*/ float size; // Size - default 1 +/*00*/ float z; // z coord +/*00*/ float x; // x coord +/*00*/ float y; // y coord +/*00*/ int32 object_type; // Type of object, not directly translated to OP_OpenObject +}; +// object_type - 01 = generic drop, 02 = armor, 19 = weapon +// 0xff seems to be indicative of the tradeskill/openable items that end up returning the old style item type in the OP_OpenObject + +/* +** Click Object Struct +** Client clicking on zone object (forge, groundspawn, etc) +** Size: 8 bytes +** Last Updated: Oct-17-2003 +** +*/ +struct ClickObject_Struct { +/*00*/ uint32 drop_id; // Appears to use the Object Count field now +/*04*/ uint32 player_id; +/*08*/ +}; + +struct Shielding_Struct { + uint32 target_id; +}; + +/* +** Click Object Acknowledgement Struct +** Response to client clicking on a World Container (ie, forge) +** +*/ +struct ClickObjectAction_Struct { +/*00*/ //uint32 player_id; // Appears to have been removed +/*00*/ uint32 drop_id; // Appears to use the object_count field now +/*04*/ int32 unknown04; // Seen -1 +/*08*/ int32 unknown08; // Seen -1 +/*08*/ //uint32 open; // 1=opening, 0=closing - Removed? +/*12*/ uint32 type; // See object.h, "Object Types" +/*16*/ uint32 unknown16; // +/*20*/ uint32 icon; // Icon to display for tradeskill containers +/*24*/ uint32 unknown24; // +/*28*/ char object_name[64]; // Object name to display +/*92*/ +}; + +/* +** This is different now, mostly unknown +** +*/ +struct CloseContainer_Struct { +/*00*/ uint32 player_id; // Entity Id of player who clicked object +/*04*/ uint32 drop_id; // Zone-specified unique object identifier +/*08*/ uint32 open; // 1=opening, 0=closing +/*12*/ uint32 unknown12[12]; +}; + +/* +** Generic Door Struct +** Length: 52 Octets +** Used in: +** cDoorSpawnsStruct(f721) +** +*/ +struct Door_Struct +{ +/*0000*/ char name[32]; // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade +/*0032*/ float yPos; // y loc +/*0036*/ float xPos; // x loc +/*0040*/ float zPos; // z loc +/*0044*/ float heading; +/*0048*/ uint32 incline; // rotates the whole door +/*0052*/ uint32 size; // 100 is normal, smaller number = smaller model +/*0054*/ uint8 unknown0054[4]; // 00 00 00 00 +/*0060*/ uint8 doorId; // door's id # +/*0061*/ uint8 opentype; +/*0062*/ uint8 state_at_spawn; +/*0063*/ uint8 invert_state; // if this is 1, the door is normally open +/*0064*/ uint32 door_param; // normally ff ff ff ff (-1) +/*0068*/ uint32 unknown0068; // 00 00 00 00 +/*0072*/ uint32 unknown0072; // 00 00 00 00 +/*0076*/ uint8 unknown0076[4]; // New for RoF2 +/*0080*/ uint8 unknown0080; // seen 1 or 0 +/*0081*/ uint8 unknown0081; // seen 1 (always?) +/*0082*/ uint8 unknown0082; // seen 0 (always?) +/*0083*/ uint8 unknown0083; // seen 1 (always?) +/*0084*/ uint8 unknown0084; // seen 0 (always?) +/*0085*/ uint8 unknown0085; // seen 1 or 0 or rarely 2C or 90 or ED or 2D or A1 +/*0086*/ uint8 unknown0086; // seen 0 or rarely FF or FE or 10 or 5A or 82 +/*0087*/ uint8 unknown0087; // seen 0 or rarely 02 or 7C +/*0088*/ uint8 unknown0088[8]; // mostly 0s, the last 3 bytes are something tho +/*0096*/ +}; + +struct DoorSpawns_Struct { + struct Door_Struct doors[0]; +}; + +/* + OP Code: Op_ClickDoor + Size: 16 +*/ +struct ClickDoor_Struct { +/*000*/ uint8 doorid; +/*001*/ uint8 unknown001; // This may be some type of action setting +/*002*/ uint8 unknown002; // This is sometimes set after a lever is closed +/*003*/ uint8 unknown003; // Seen 0 +/*004*/ uint8 picklockskill; +/*005*/ uint8 unknown005[3]; +/*008*/ uint32 item_id; +/*012*/ uint16 player_id; +/*014*/ uint8 unknown014[2]; +/*016*/ +}; + +struct MoveDoor_Struct { + uint8 doorid; + uint8 action; +}; + + +struct BecomeNPC_Struct { + uint32 id; + int32 maxlevel; +}; + +struct Underworld_Struct { + float speed; + float y; + float x; + float z; +}; + +struct Resurrect_Struct +{ +/*000*/ uint32 unknown000; +/*004*/ uint16 zone_id; +/*006*/ uint16 instance_id; +/*008*/ float y; +/*012*/ float x; +/*016*/ float z; +/*020*/ uint32 unknown020; +/*024*/ char your_name[64]; +/*088*/ uint32 unknown088; +/*092*/ char rezzer_name[64]; +/*156*/ uint32 spellid; +/*160*/ char corpse_name[64]; +/*224*/ uint32 action; +/*228*/ uint32 unknown228; +/*232*/ +}; + +struct SetRunMode_Struct { + uint8 mode; //01=run 00=walk + uint8 unknown[3]; +}; + +// EnvDamage is EnvDamage2 without a few bytes at the end. +// Size: 37 bytes +struct EnvDamage2_Struct { +/*0000*/ uint32 id; +/*0004*/ uint16 unknown4; +/*0006*/ uint32 damage; +/*0010*/ float unknown10; // New to Underfoot - Seen 1 +/*0014*/ uint8 unknown14[12]; +/*0026*/ uint8 dmgtype; // FA = Lava; FC = Falling +/*0027*/ uint8 unknown27[4]; +/*0031*/ uint16 unknown31; // New to Underfoot - Seen 66 +/*0033*/ uint16 constant; // Always FFFF +/*0035*/ uint16 unknown35; +/*0037*/ +}; + +//Bazaar Stuff + +enum { + BazaarTrader_StartTraderMode = 1, + BazaarTrader_EndTraderMode = 2, + BazaarTrader_UpdatePrice = 3, + BazaarTrader_EndTransaction = 4, + BazaarSearchResults = 7, + BazaarWelcome = 9, + BazaarBuyItem = 10, + BazaarTrader_ShowItems = 11, + BazaarSearchDone = 12, + BazaarTrader_CustomerBrowsing = 13, + BazaarInspectItem = 18, + BazaarSearchDone2 = 19, + BazaarTrader_StartTraderMode2 = 22 +}; + +enum { + BazaarPriceChange_Fail = 0, + BazaarPriceChange_UpdatePrice = 1, + BazaarPriceChange_RemoveItem = 2, + BazaarPriceChange_AddItem = 3 +}; + +struct BazaarWindowStart_Struct { + uint8 Action; + uint8 Unknown001; + uint16 Unknown002; +}; + + +struct BazaarWelcome_Struct { + BazaarWindowStart_Struct Beginning; + uint32 Traders; + uint32 Items; + uint8 Unknown012[8]; +}; + +struct BazaarSearch_Struct { + BazaarWindowStart_Struct Beginning; + uint32 TraderID; + uint32 Class_; + uint32 Race; + uint32 ItemStat; + uint32 Slot; + uint32 Type; + char Name[64]; + uint32 MinPrice; + uint32 MaxPrice; + uint32 Minlevel; + uint32 MaxLlevel; +}; +struct BazaarInspect_Struct{ + uint32 ItemID; + uint32 Unknown004; + char Name[64]; +}; + +struct NewBazaarInspect_Struct { +/*000*/ BazaarWindowStart_Struct Beginning; +/*004*/ char Name[64]; +/*068*/ uint32 Unknown068; +/*072*/ int32 SerialNumber; +/*076*/ uint32 Unknown076; +/*080*/ uint32 SellerID; +/*084*/ uint32 Unknown084; +}; + +struct BazaarReturnDone_Struct{ + uint32 Type; + uint32 TraderID; + uint32 Unknown008; + uint32 Unknown012; + uint32 Unknown016; +}; + +struct BazaarSearchResults_Struct { +/*000*/ BazaarWindowStart_Struct Beginning; +/*004*/ uint32 SellerID; +/*008*/ char SellerName[64]; +/*072*/ uint32 NumItems; +/*076*/ uint32 ItemID; +/*080*/ uint32 SerialNumber; +/*084*/ uint32 Unknown084; +/*088*/ char ItemName[64]; +/*152*/ uint32 Cost; +/*156*/ uint32 ItemStat; +/*160*/ +}; + +struct ServerSideFilters_Struct { +uint8 clientattackfilters; // 0) No, 1) All (players) but self, 2) All (players) but group +uint8 npcattackfilters; // 0) No, 1) Ignore NPC misses (all), 2) Ignore NPC Misses + Attacks (all but self), 3) Ignores NPC Misses + Attacks (all but group) +uint8 clientcastfilters; // 0) No, 1) Ignore PC Casts (all), 2) Ignore PC Casts (not directed towards self) +uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts (not directed towards self) +}; + +/* +** Client requesting item statistics +** Size: 52 bytes +** Used In: OP_ItemLinkClick +** Last Updated: 01/03/2012 +** +*/ +struct ItemViewRequest_Struct { +/*000*/ uint32 item_id; +/*004*/ uint32 augments[6]; +/*028*/ uint32 link_hash; +/*032*/ uint32 unknown028; //seems to always be 4 on SoF client +/*036*/ char unknown032[12]; //probably includes loregroup & evolving info. see Client::MakeItemLink() in zone/inventory.cpp:469 +/*048*/ uint16 icon; +/*050*/ char unknown046[2]; +/*052*/ +}; + +/* + * Client to server packet + */ +struct PickPocket_Struct { +// Size 18 + uint32 to; + uint32 from; + uint16 myskill; + uint8 type; // -1 you are being picked, 0 failed , 1 = plat, 2 = gold, 3 = silver, 4 = copper, 5 = item + uint8 unknown1; // 0 for response, unknown for input + uint32 coin; + uint8 lastsix[2]; +}; +/* + * Server to client packet + */ + +struct sPickPocket_Struct { + // Size 28 = coin/fail + uint32 to; + uint32 from; + uint32 myskill; + uint32 type; + uint32 coin; + char itemname[64]; +}; + + +struct LogServer_Struct { +// Op_Code OP_LOGSERVER +/*000*/ uint32 unknown000; +/*004*/ uint8 enable_pvp; +/*005*/ uint8 unknown005; +/*006*/ uint8 unknown006; +/*007*/ uint8 unknown007; +/*008*/ uint8 enable_FV; +/*009*/ uint8 unknown009; +/*010*/ uint8 unknown010; +/*011*/ uint8 unknown011; +/*012*/ uint32 unknown012; // htonl(1) on live +/*016*/ uint32 unknown016; // htonl(1) on live +/*020*/ uint8 unknown020[12]; +/*032*/ uint32 unknown032; +/*036*/ char worldshortname[32]; +/*068*/ uint8 unknown068[181]; +/*249*/ uint8 unknown249[27]; +/*276*/ float unknown276[7]; +/*304*/ uint8 unknown304[256]; +/*560*/ + +/* Currently lost + uint8 enablevoicemacros; + uint8 enablemail; +*/ +}; + +struct ApproveWorld_Struct { +// Size 544 +// Op_Code OP_ApproveWorld + uint8 unknown544[544]; +}; + +struct ClientError_Struct +{ +/*00001*/ char type; +/*00001*/ char unknown0001[69]; +/*00069*/ char character_name[64]; +/*00134*/ char unknown134[192]; +/*00133*/ char message[31994]; +/*32136*/ +}; + +struct MobHealth +{ + /*0000*/ uint8 hp; //health percent + /*0001*/ uint16 id;//mobs id +}; + +struct Track_Struct { + uint16 entityid; + uint16 y; + uint16 x; + uint16 z; +}; + +struct Tracking_Struct { + Track_Struct Entrys[0]; +}; + +// Looks like new tracking structures - Opcode: 0x57a7 +struct Tracking_Struct_New { + uint16 totalcount; // Total Count of mobs within tracking range + Track_Struct Entrys[0]; +}; + +struct Track_Struct_New { + uint16 entityid; // Entity ID + uint16 unknown002; // 00 00 + uint32 unknown004; // + uint8 level; // level of mob + uint8 unknown009; // 01 maybe type of mob? player/npc? + char name[1]; // name of mob +}; + + +/* +** ZoneServerInfo_Struct +** Zone server information +** Size: 130 bytes +** Used In: OP_ZoneServerInfo +** +*/ +struct ZoneServerInfo_Struct +{ +/*0000*/ char ip[128]; +/*0128*/ uint16 port; +}; + +struct WhoAllPlayer{ + uint32 formatstring; + uint32 pidstring; + int32 unknown64; // Seen -1 + char* name; + uint32 rankstring; + char* guild; + uint32 unknown80[2]; + uint32 zonestring; + uint32 zone; + uint32 class_; + uint32 level; + uint32 race; + char* account; + uint32 unknown100; +}; + +struct WhoAllReturnStruct { + uint32 id; + uint32 playerineqstring; + char line[27]; + uint8 unknown35; // 0A + uint32 unknown36; // Seen 208243456 + uint32 playersinzonestring; + uint32 unknown52; // Same as playercount? + uint32 unknown44[2]; // 0s + uint32 unknown56; // Same as playercount? + uint32 playercount; // Player Count in the who list + struct WhoAllPlayer player[0]; +}; + +// The following four structs are the WhoAllPlayer struct above broken down +// for use in World ClientList::SendFriendsWho to accomodate the user of variable +// length strings within the struct above. + +struct WhoAllPlayerPart1 { + uint32 FormatMSGID; + uint32 Unknown04; + uint32 Unknown08; + char Name[1]; +}; + +struct WhoAllPlayerPart2 { + uint32 RankMSGID; + char Guild[1]; +}; + +struct WhoAllPlayerPart3 { + uint32 Unknown80[2]; + uint32 ZoneMSGID; + uint32 Zone; + uint32 Class_; + uint32 Level; + uint32 Race; + char Account[1]; +}; + +struct WhoAllPlayerPart4 { + uint32 Unknown100; +}; + +struct TraderItemSerial_Struct { + char SerialNumber[17]; + uint8 Unknown18; +}; + +struct Trader_Struct { +/*0000*/ uint32 Code; +/*0004*/ TraderItemSerial_Struct items[200]; +/*3604*/ uint32 ItemCost[200]; +/*4404*/ +}; + +struct ClickTrader_Struct { +/*0000*/ uint32 Code; +/*0004*/ TraderItemSerial_Struct items[200]; +/*3604*/ uint32 ItemCost[200]; +/*4404*/ +}; + +struct GetItems_Struct { + uint32 items[200]; +}; + +struct BecomeTrader_Struct { + uint32 id; + uint32 code; +}; + +struct Trader_ShowItems_Struct { +/*000*/ uint32 Code; +/*004*/ char SerialNumber[17]; +/*021*/ uint8 Unknown21; +/*022*/ uint16 TraderID; +/*026*/ uint32 Stacksize; +/*030*/ uint32 Price; +/*032*/ +}; + +struct TraderStatus_Struct { +/*000*/ uint32 Code; +/*004*/ uint32 Uknown04; +/*008*/ uint32 Uknown08; +/*012*/ +}; + +struct TraderBuy_Struct { +/*000*/ uint32 Action; +/*004*/ uint32 Unknown004; +/*008*/ uint32 Price; +/*012*/ uint32 Unknown008; // Probably high order bits of a 64 bit price. +/*016*/ uint32 TraderID; +/*020*/ char ItemName[64]; +/*084*/ uint32 Unknown076; +/*088*/ uint32 ItemID; +/*092*/ uint32 AlreadySold; +/*096*/ uint32 Quantity; +/*100*/ uint32 Unknown092; +/*104*/ +}; + +struct TraderItemUpdate_Struct{ + uint32 unknown0; + uint32 traderid; + uint8 fromslot; + uint8 toslot; //7? + uint16 charges; +}; + +struct MoneyUpdate_Struct{ + int32 platinum; + int32 gold; + int32 silver; + int32 copper; +}; + +//struct MoneyUpdate_Struct +//{ +//*0000*/ uint32 spawn_id; // ***Placeholder +//*0004*/ uint32 cointype; // Coin Type +//*0008*/ uint32 amount; // Amount +//*0012*/ +//}; + + +struct TraderDelItem_Struct{ + uint32 slotid; + uint32 quantity; + uint32 unknown; +}; + +struct TraderClick_Struct{ + uint32 traderid; + uint32 unknown4[2]; + uint32 approval; +}; + +struct FormattedMessage_Struct{ + uint32 unknown0; + uint32 string_id; + uint32 type; + char message[0]; +//*0???*/ uint8 unknown0[8]; // ***Placeholder +}; +struct SimpleMessage_Struct{ + uint32 string_id; + uint32 color; + uint32 unknown8; +}; + +// Size: 52 + strings +// Other than the strings, all of this packet is network byte order (reverse from normal) +struct GuildMemberEntry_Struct { + char name[1]; // variable length + uint32 level; + uint32 banker; // 1=yes, 0=no + uint32 class_; + uint32 rank; + uint32 time_last_on; + uint32 tribute_enable; + uint32 unknown01; // Seen 0 + uint32 total_tribute; // total guild tribute donated, network byte order + uint32 last_tribute; // unix timestamp + uint32 unknown_one; // unknown, set to 1 + char public_note[1]; // variable length. + uint16 zoneinstance; // Seen 0s or -1 in RoF2 + uint16 zone_id; // Seen 0s or -1 in RoF2 + uint32 unknown_one2; // unknown, set to 1 + uint32 unknown04; // Seen 0 +}; + +//just for display purposes, this is not actually used in the message encoding other than for size. +struct GuildMembers_Struct { + char player_name[1]; // variable length. + uint32 guildid; // Was unknown02 - network byte order + uint32 count; // network byte order + GuildMemberEntry_Struct member[0]; +}; + +struct GuildMOTD_Struct{ +/*0000*/ uint32 unknown0; +/*0004*/ char name[64]; +/*0068*/ char setby_name[64]; +/*0132*/ uint32 unknown132; +/*0136*/ char motd[0]; //was 512 +}; + +struct GuildURL_Struct{ +/*0000*/ uint32 unknown0; //index? seen server send 0 w/ the Guild URL, followed by 1 with nothing. +/*0004*/ uint32 unknown4; +/*0008*/ uint32 unknown8; //seen 7 +/*0012*/ char setby_name[64]; +/*0076*/ uint32 unknown132; //seen 0xc7de +/*0136*/ char url[4040]; +}; + +struct GuildStatus_Struct +{ +/*000*/ char Name[64]; +/*064*/ uint8 Unknown064[76]; +}; + +struct GuildMemberUpdate_Struct { +/*00*/ uint32 GuildID; +/*04*/ char MemberName[64]; +/*68*/ uint16 ZoneID; +/*70*/ uint16 InstanceID; //speculated +/*72*/ uint32 LastSeen; //unix timestamp +/*76*/ uint32 Unknown76; +/*80*/ +}; + +struct GuildMemberLevelUpdate_Struct { +/*00*/ uint32 guild_id; +/*04*/ char member_name[64]; +/*68*/ uint32 level; //not sure +}; + +struct GuildUpdate_PublicNote { + uint32 unknown0; + char name[64]; + char target[64]; + char note[100]; //we are cutting this off at 100, actually around 252 +}; + +struct GuildDemoteStruct { +/*000*/ char name[64]; +/*064*/ char target[64]; +/*128*/ uint32 rank; // New in RoF2 +/*132*/ +}; + +struct GuildRemoveStruct { +/*000*/ char target[64]; +/*064*/ char name[64]; +/*128*/ uint32 GuildID; // Was unknown128 +/*132*/ uint32 leaderstatus; +/*136*/ uint32 unknown136; // New in RoF2 +/*140*/ +}; + +struct GuildMakeLeader { + char name[64]; + char target[64]; +}; + +// Server -> Client +// Update a guild members rank and banker status +struct GuildSetRank_Struct +{ +/*00*/ uint32 GuildID; // Was Unknown00 +/*04*/ uint32 Rank; +/*08*/ char MemberName[64]; +/*72*/ uint32 Banker; +/*76*/ uint32 Unknown76; // Seen 1 - Maybe Banker? +/*80*/ +}; + +struct BugStruct{ +/*0000*/ char chartype[64]; +/*0064*/ char name[96]; +/*0160*/ char ui[128]; +/*0288*/ float x; +/*0292*/ float y; +/*0296*/ float z; +/*0300*/ float heading; +/*0304*/ uint32 unknown304; +/*0308*/ uint32 type; +/*0312*/ char unknown312[2144]; +/*2456*/ char bug[1024]; +/*3480*/ char placeholder[2]; +/*3482*/ char system_info[4098]; +}; +struct Make_Pet_Struct { //Simple struct for getting pet info + uint8 level; + uint8 class_; + uint16 race; + uint8 texture; + uint8 pettype; + float size; + uint8 type; + uint32 min_dmg; + uint32 max_dmg; +}; +struct Ground_Spawn{ + float max_x; + float max_y; + float min_x; + float min_y; + float max_z; + float heading; + char name[16]; + uint32 item; + uint32 max_allowed; + uint32 respawntimer; +}; +struct Ground_Spawns { + struct Ground_Spawn spawn[50]; //Assigned max number to allow +}; +struct PetitionBug_Struct{ + uint32 petition_number; + uint32 unknown4; + char accountname[64]; + uint32 zoneid; + char name[64]; + uint32 level; + uint32 class_; + uint32 race; + uint32 unknown152[3]; + uint32 time; + uint32 unknown168; + char text[1028]; +}; + +struct DyeStruct +{ + union + { + struct + { + struct Color_Struct head; + struct Color_Struct chest; + struct Color_Struct arms; + struct Color_Struct wrists; + struct Color_Struct hands; + struct Color_Struct legs; + struct Color_Struct feet; + struct Color_Struct primary; // you can't actually dye this + struct Color_Struct secondary; // or this + } + dyes; + struct Color_Struct dye[9]; + }; +}; + +struct ApproveZone_Struct { + char name[64]; + uint32 zoneid; + uint32 approve; +}; +struct ZoneInSendName_Struct { + uint32 unknown0; + char name[64]; + char name2[64]; + uint32 unknown132; +}; +struct ZoneInSendName_Struct2 { + uint32 unknown0; + char name[64]; + uint32 unknown68[145]; +}; + +struct StartTribute_Struct { + uint32 client_id; + uint32 tribute_master_id; + uint32 response; +}; + +struct TributeLevel_Struct { + uint32 level; //backwards byte order! + uint32 tribute_item_id; //backwards byte order! + uint32 cost; //backwards byte order! +}; + +struct TributeAbility_Struct { +/*000*/ uint32 tribute_id; //backwards byte order! +/*004*/ uint32 tier_count; //backwards byte order! +/*008*/ TributeLevel_Struct tiers[MAX_TRIBUTE_TIERS]; +/*128*/ uint32 unknown128; // New to RoF2 +/*132*/ char name[0]; +}; + +struct GuildTributeAbility_Struct { + uint32 guild_id; + TributeAbility_Struct ability; +}; + +struct SelectTributeReq_Struct { + uint32 client_id; //? maybe action ID? + uint32 tribute_id; + uint32 unknown8; //seen E3 00 00 00 +}; + +struct SelectTributeReply_Struct { + uint32 client_id; //echoed from request. + uint32 tribute_id; + char desc[0]; +}; + +struct TributeInfo_Struct { + uint32 active; //0 == inactive, 1 == active + uint32 tributes[MAX_PLAYER_TRIBUTES]; //-1 == NONE + uint32 tiers[MAX_PLAYER_TRIBUTES]; //all 00's + uint32 tribute_master_id; +}; + +struct TributeItem_Struct +{ +/*00*/ ItemSlotStruct slot; +/*12*/ uint32 quantity; +/*16*/ uint32 tribute_master_id; +/*20*/ int32 tribute_points; +/*24*/ +}; + +struct TributePoint_Struct { + int32 tribute_points; + uint32 unknown04; + int32 career_tribute_points; + uint32 unknown12; +}; + +struct TributeMoney_Struct { + uint32 platinum; + uint32 tribute_master_id; + int32 tribute_points; +}; + + +struct Split_Struct +{ + uint32 platinum; + uint32 gold; + uint32 silver; + uint32 copper; +}; + + +/* +** New Combine Struct +** Client requesting to perform a tradeskill combine +** Size: 24 bytes +** Used In: OP_TradeSkillCombine +** Last Updated: 01-05-2013 +*/ +struct NewCombine_Struct { +/*00*/ ItemSlotStruct container_slot; +/*12*/ ItemSlotStruct guildtribute_slot; // Slot type is 8? (MapGuildTribute = 8 -U) +/*24*/ +}; + + +//client requesting favorite recipies +struct TradeskillFavorites_Struct { + uint32 object_type; + uint32 some_id; + uint32 favorite_recipes[500]; +}; + +//search request +struct RecipesSearch_Struct { + uint32 object_type; //same as in favorites + uint32 some_id; //same as in favorites + uint32 mintrivial; + uint32 maxtrivial; + char query[56]; + uint32 unknown4; //is set to 00 03 00 00 + uint32 unknown5; //is set to 4C DD 12 00 +/*80*/ +}; + +//one sent for each item, from server in reply to favorites or search +struct RecipeReply_Struct { + uint32 object_type; + uint32 some_id; //same as in favorites + uint32 component_count; + uint32 recipe_id; + uint32 trivial; + char recipe_name[64]; +/*84*/ +}; + +//received and sent back as an ACK with different reply_code +struct RecipeAutoCombine_Struct { +/*00*/ uint32 object_type; +/*04*/ uint32 some_id; +/*08*/ ItemSlotStruct container_slot; //echoed in reply - Was uint32 unknown1 +/*20*/ ItemSlotStruct unknown_slot; //echoed in reply +/*32*/ uint32 recipe_id; +/*36*/ uint32 reply_code; +/*40*/ +}; + +struct LevelAppearance_Struct { //Sends a little graphic on level up + uint32 spawn_id; + uint32 parm1; + uint32 value1a; + uint32 value1b; + uint32 parm2; + uint32 value2a; + uint32 value2b; + uint32 parm3; + uint32 value3a; + uint32 value3b; + uint32 parm4; + uint32 value4a; + uint32 value4b; + uint32 parm5; + uint32 value5a; + uint32 value5b; +/*64*/ +}; +struct MerchantList{ + uint32 id; + uint32 slot; + uint32 item; +}; +struct TempMerchantList{ + uint32 npcid; + uint32 slot; + uint32 item; + uint32 charges; //charges/quantity + uint32 origslot; +}; + + +struct FindPerson_Point { + float y; + float x; + float z; +}; + +struct FindPersonRequest_Struct { +/*00*/ uint32 unknown00; +/*04*/ uint32 npc_id; +/*08*/ uint32 unknown08; +/*12*/ uint32 unknown12; +/*16*/ FindPerson_Point client_pos; +/*28*/ uint32 unknown28; +/*32*/ uint32 unknown32; +/*36*/ uint32 unknown36; +}; + +//variable length packet of points +struct FindPersonResult_Struct { + FindPerson_Point dest; + FindPerson_Point path[0]; //last element must be the same as dest +}; + +struct MobRename_Struct { +/*000*/ char old_name[64]; +/*064*/ char old_name_again[64]; //not sure what the difference is +/*128*/ char new_name[64]; +/*192*/ uint32 unknown192; //set to 0 +/*196*/ uint32 unknown196; //set to 1 +/*200*/ +}; + +struct PlayMP3_Struct { + char filename[0]; +}; + +//this is for custom title display in the skill window +struct TitleEntry_Struct { + uint32 skill_id; + uint32 skill_value; + char title[1]; +}; + +struct Titles_Struct { + uint32 title_count; + TitleEntry_Struct titles[0]; +}; + +//this is for title selection by the client +struct TitleListEntry_Struct { + uint32 unknown0; //title ID + char prefix[1]; //variable length, null terminated + char postfix[1]; //variable length, null terminated +}; + +struct TitleList_Struct { + uint32 title_count; + TitleListEntry_Struct titles[0]; //list of title structs + //uint32 unknown_ending; seen 0x7265, 0 +}; + +struct SetTitle_Struct { + uint32 is_suffix; //guessed: 0 = prefix, 1 = suffix + uint32 title_id; +}; + +struct SetTitleReply_Struct { + uint32 is_suffix; //guessed: 0 = prefix, 1 = suffix + char title[32]; + uint32 entity_id; +}; + + +#if 0 +// Old struct not used by Task System implementation but left for reference +struct TaskDescription_Struct { +/*000*/ uint32 activity_count; //not right. +/*004*/ uint32 taskid; +/*008*/ uint8 unk; +/*009*/ uint32 id3; +/*013*/ uint32 unknown13; +/*017*/ char name[1]; //variable length, 0 terminated +/*018*/ uint32 unknown18; +/*022*/ uint32 unknown22; +/*026*/ uint32 unknown26; +/*030*/ char desc[1]; //variable length, 0 terminated +/*031*/ uint32 reward_count; //not sure +/*035*/ uint8 unknown31; +/*036*/ uint32 unknown31; +/*040*/ uint32 unknown35; +/*044*/ uint16 unknown39; +/*046*/ char reward_link[1]; //variable length, 0 terminated +/*047*/ uint32 unknown43; //maybe crystal count? +/*051*/ +}; +#endif + +struct TaskMemberList_Struct { +/*00*/ uint32 gopher_id; +/*04*/ uint32 unknown04; +/*08*/ uint32 member_count; //1 less than the number of members +/*12*/ char list_pointer[0]; +/* list is of the form: + char member_name[1] //null terminated string + uint8 task_leader //boolean flag +*/ +}; + +#if 0 +// Struct not used by Task System implentation but left for reference (current for RoF2) +struct TaskActivity_Struct { +/*000*/ uint32 TaskSequenceNumber; +/*004*/ uint32 unknown2; +/*008*/ uint32 TaskID; +/*012*/ uint32 ActivityID; +/*016*/ uint32 unknown3; +/*020*/ uint32 ActivityType; +/*024*/ uint32 Optional; +/*028*/ uint8 unknown5; +/*032*/ char Text1[1]; // Variable length - Null terminated +/*000*/ uint32 Text2Len; // Lenth of the following string +/*000*/ char Text2[1]; // Variable length - not Null terminated +/*000*/ uint32 GoalCount; +/*000*/ uint32 String1Len; // Lenth of the following string - Seen 2 +/*000*/ char String1[1]; // Numeric String - Seen "-1" - not Null terminated +/*000*/ uint32 String2Len; // Lenth of the following string - Seen 2 +/*000*/ char String2[1]; // Numeric String - Seen "-1" - not Null terminated +/*000*/ char ZoneIDString1[1]; // Numeric String - Seen "398" - Null terminated +/*000*/ uint32 unknown7; // Seen 0 +/*000*/ char Text3[1]; // Variable length - Null terminated +/*000*/ uint32 DoneCount; +/*000*/ uint8 unknown9; // Seen 1 +/*000*/ char ZoneIDString2[1]; // Numeric String - Seen "398" - Null terminated +}; + +struct TaskHistoryEntry_Struct { + uint32 task_id; + char name[1]; + uint32 completed_time; +}; +struct TaskHistory_Struct { + uint32 completed_count; + TaskHistoryEntry_Struct entries[0]; +}; +#endif + +struct AcceptNewTask_Struct { + uint32 unknown00; + uint32 task_id; //set to 0 for 'decline' + uint32 task_master_id; //entity ID +}; + +//was all 0's from client, server replied with same op, all 0's +struct CancelTask_Struct { + uint32 SequenceNumber; + uint32 unknown4; // Only seen 0x00000002 +}; + +#if 0 +// old struct, not used by Task System implementation but left for reference. +struct AvaliableTask_Struct { + uint32 task_index; //no idea, seen 0x1 + uint32 task_master_id; //entity ID + uint32 task_id; + uint32 unknown012; + uint32 activity_count; //not sure, seen 2 + char desc[1]; //variable length, 0 terminated + uint32 reward_platinum;//not sure on these + uint32 reward_gold; + uint32 reward_silver; + uint32 reward_copper; + char some_name[1]; //variable length, 0 terminated + uint8 unknown1; + uint32 unknown2; //0xFFFFFFFF + uint32 unknown3; //0xFFFFFFFF + uint32 unknown4; //seen 0x16 + uint8 unknown5; +}; +#endif + + +// Many of the Task System packets contain variable length strings, as well as variable numbers +// of records, hence splitting them into multiple structs (header, middle, trailer) etc. +// +struct AvailableTaskHeader_Struct { + uint32 TaskCount; + uint32 unknown1; + uint32 TaskGiver; +}; + +struct AvailableTaskData1_Struct { + uint32 TaskID; + uint32 unknown1; + uint32 TimeLimit; + uint32 unknown2; +}; + +struct AvailableTaskData2_Struct { + uint32 unknown1,unknown2,unknown3,unknown4; +}; + +struct AvailableTaskTrailer_Struct { + uint32 ItemCount; + uint32 unknown1, unknown2; + uint32 StartZone; +}; + +struct TaskDescriptionHeader_Struct { + uint32 SequenceNumber; // The order the tasks appear in the journal. 0 for first task, 1 for second, etc. + uint32 TaskID; + uint32 unknown2; + uint32 unknown3; + uint8 unknown4; +}; + +struct TaskDescriptionData1_Struct { + uint32 Duration; + uint32 unknown2; + uint32 StartTime; +}; + +struct TaskDescriptionData2_Struct { + uint32 RewardCount; // ?? + uint32 unknown1; + uint32 unknown2; + uint16 unknown3; + //uint8 unknown4; +}; + +struct TaskDescriptionTrailer_Struct { + //uint16 unknown1; // 0x0012 + uint32 Points; +}; + +struct TaskActivityHeader_Struct { + uint32 TaskSequenceNumber; + uint32 unknown2; // Seen 0x00000002 + uint32 TaskID; + uint32 ActivityID; + uint32 unknown3; + uint32 ActivityType; + uint32 Optional; + uint32 unknown5; +}; + +struct TaskActivityData1_Struct { + uint32 GoalCount; + uint32 unknown1; // 0xffffffff + uint32 unknown2; // 0xffffffff + uint32 ZoneID; // seen 0x36 + uint32 unknown3; +}; + +struct TaskActivityTrailer_Struct { + uint32 DoneCount; + uint32 unknown1; // Seen 1 +}; + +// The Short_Struct is sent for tasks that are hidden and act as a placeholder +struct TaskActivityShort_Struct { + uint32 TaskSequenceNumber; + uint32 unknown2; // Seen 0x00000002 + uint32 TaskID; + uint32 ActivityID; + uint32 unknown3; + uint32 ActivityType; // 0xffffffff for the short packet + uint32 unknown4; +}; + +struct TaskActivityComplete_Struct { + uint32 TaskIndex; + uint32 unknown2; // 0x00000002 + uint32 unknown3; + uint32 ActivityID; + uint32 unknown4; // 0x00000001 + uint32 unknown5; // 0x00000001 +}; + +#if 0 +// This is a dupe of the CancelTask struct +struct TaskComplete_Struct { + uint32 unknown00; // 0x00000000 + uint32 unknown04; // 0x00000002 +}; +#endif + +struct TaskHistoryRequest_Struct { + uint32 TaskIndex; // This is the sequence the task was sent in the Completed Tasks packet. +}; + +struct TaskHistoryReplyHeader_Struct { + uint32 TaskID; + uint32 ActivityCount; +}; + +struct TaskHistoryReplyData1_Struct { + uint32 ActivityType; +}; + +struct TaskHistoryReplyData2_Struct { + uint32 GoalCount; + uint32 unknown04; // 0xffffffff + uint32 unknown08; // 0xffffffff + uint32 ZoneID; + uint32 unknown16; +}; + +struct BankerChange_Struct { +/*00*/ uint32 platinum; +/*04*/ uint32 gold; +/*08*/ uint32 silver; +/*12*/ uint32 copper; +/*16*/ uint32 platinum_bank; +/*20*/ uint32 gold_bank; +/*24*/ uint32 silver_bank; +/*28*/ uint32 copper_bank; +/*32*/ +}; + +struct LeadershipExpUpdate_Struct { +/*00*/ double group_leadership_exp; +/*08*/ uint32 group_leadership_points; +/*12*/ uint32 Unknown12; +/*16*/ double raid_leadership_exp; +/*24*/ uint32 raid_leadership_points; +}; + +struct UpdateLeadershipAA_Struct { +/*00*/ uint32 ability_id; +/*04*/ uint32 new_rank; +/*08*/ uint32 unknown08; +/*12*/ +}; + +/** +* Leadership AA update +* Length: 32 Octets +* OpCode: LeadExpUpdate +*/ +struct leadExpUpdateStruct { + /*0000*/ uint32 unknown0000; // All zeroes? + /*0004*/ uint32 group_leadership_exp; // Group leadership exp value + /*0008*/ uint32 group_leadership_points; // Unspent group points + /*0012*/ uint32 unknown0012; // Type? + /*0016*/ uint32 unknown0016; // All zeroes? + /*0020*/ uint32 raid_leadership_exp; // Raid leadership exp value + /*0024*/ uint32 raid_leadership_points; // Unspent raid points + /*0028*/ uint32 unknown0028; +}; + +struct RaidGeneral_Struct { +/*00*/ uint32 action; +/*04*/ char player_name[64]; +/*68*/ uint32 unknown68; +/*72*/ char leader_name[64]; +/*136*/ uint32 parameter; +}; + +struct RaidAddMember_Struct { +/*000*/ RaidGeneral_Struct raidGen; //param = (group num-1); 0xFFFFFFFF = no group +/*136*/ uint8 _class; +/*137*/ uint8 level; +/*138*/ uint8 isGroupLeader; +/*139*/ uint8 flags[5]; //no idea if these are needed... +}; + +struct RaidMOTD_Struct { +/*000*/ RaidGeneral_Struct general; // leader_name and action only used +/*140*/ char motd[0]; // max size 1024, but reply is variable +}; + +struct RaidLeadershipUpdate_Struct { +/*000*/ uint32 action; +/*004*/ char player_name[64]; +/*068*/ uint32 Unknown068; +/*072*/ char leader_name[64]; +/*136*/ GroupLeadershipAA_Struct group; //unneeded +/*200*/ RaidLeadershipAA_Struct raid; +/*264*/ char Unknown264[128]; +}; + +struct RaidAdd_Struct { +/*000*/ uint32 action; //=0 +/*004*/ char player_name[64]; //should both be the player's name +/*068*/ char leader_name[64]; +/*132*/ uint8 _class; +/*133*/ uint8 level; +/*134*/ uint8 has_group; +/*135*/ uint8 unknown135; //seems to be 0x42 or 0 +}; + +struct RaidCreate_Struct { +/*00*/ uint32 action; //=8 +/*04*/ char leader_name[64]; +/*68*/ uint32 leader_id; +}; + +struct RaidMemberInfo_Struct { +/*00*/ uint8 group_number; +/*01*/ char member_name[1]; //dyanmic length, null terminated '\0' +/*00*/ uint8 unknown00; +/*01*/ uint8 _class; +/*02*/ uint8 level; +/*03*/ uint8 is_raid_leader; +/*04*/ uint8 is_group_leader; +/*05*/ uint8 main_tank; //not sure +/*06*/ uint8 unknown06[5]; //prolly more flags +}; + +struct RaidDetails_Struct { +/*000*/ uint32 action; //=6,20 +/*004*/ char leader_name[64]; +/*068*/ uint32 unknown68[4]; +/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order +/*128*/ uint8 unknown128[142]; +/*354*/ uint32 leader_id; +}; + +struct RaidMembers_Struct { +/*000*/ RaidDetails_Struct details; +/*358*/ uint32 member_count; //including leader +/*362*/ RaidMemberInfo_Struct members[1]; +/*...*/ RaidMemberInfo_Struct empty; //seem to have an extra member with a 0 length name on the end +}; + +struct DynamicWall_Struct { +/*00*/ char name[32]; +/*32*/ float y; +/*36*/ float x; +/*40*/ float z; +/*44*/ uint32 something; +/*48*/ uint32 unknown48; //0 +/*52*/ uint32 one_hundred; //0x64 +/*56*/ uint32 unknown56; //0 +/*60*/ uint32 something2; +/*64*/ int32 unknown64; //-1 +/*68*/ uint32 unknown68; //0 +/*72*/ uint32 unknown72; //0 +/*76*/ uint32 unknown76; //0x100 +/*80*/ +}; + +enum { //bandolier actions + BandolierCreate = 0, + BandolierRemove = 1, + BandolierSet = 2 +}; + +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 BandolierSet_Struct { +/*00*/ uint32 action; +/*04*/ uint8 number; +/*05*/ uint8 unknown05[35]; +}; + +struct Arrow_Struct { +/*000*/ float src_y; +/*004*/ float src_x; +/*008*/ float src_z; +/*012*/ uint8 unknown012[12]; +/*024*/ float velocity; //4 is normal, 20 is quite fast +/*028*/ float launch_angle; //0-450ish, not sure the units, 140ish is straight +/*032*/ float tilt; //on the order of 125 +/*036*/ uint8 unknown036[8]; +/*044*/ float arc; +/*048*/ uint32 source_id; +/*052*/ uint32 target_id; //entity ID +/*056*/ uint32 item_id; +/*060*/ uint32 unknown060; +/*064*/ uint32 unknown064; +/*068*/ uint8 unknown068; +/*069*/ uint8 unknown069; +/*070*/ uint8 unknown070; +/*071*/ uint8 item_type; +/*072*/ uint8 skill; +/*073*/ uint8 unknown073[16]; +/*089*/ char model_name[27]; +/*116*/ +}; + +//made a bunch of trivial structs for stuff for opcode finder to use +struct Consent_Struct { + char name[1]; //always at least a null - was 1 +}; + +struct AdventureMerchant_Struct { + uint32 unknown_flag; //seems to be 1 + uint32 entity_id; +}; + +// OP_Save - Size: 484 +struct Save_Struct { +/*000*/ uint8 unknown00[192]; +/*192*/ uint8 unknown0192[176]; +/*368*/ uint8 unknown0368[116]; +/*484*/ +}; + +struct GMToggle_Struct { + uint8 unknown0[64]; + uint32 toggle; +}; + +struct ColoredText_Struct { + uint32 color; + char msg[1]; //was 1 +/*0???*/ uint8 paddingXXX[3]; // always 0's +}; + +struct UseAA_Struct { + uint32 begin; + uint32 ability; + uint32 end; +}; + +struct AA_Ability { +/*00*/ uint32 skill_id; +/*04*/ uint32 base1; +/*08*/ uint32 base2; +/*12*/ uint32 slot; +/*16*/ +}; + +struct SendAA_Struct { +/*0000*/ uint32 id; +/*0004*/ uint8 unknown004; // uint32 unknown004; set to 1. +/*0005*/ int32 hotkey_sid; +/*0009*/ int32 hotkey_sid2; +/*0013*/ uint32 title_sid; +/*0017*/ uint32 desc_sid; +/*0021*/ uint32 class_type; +/*0025*/ uint32 cost; +/*0029*/ uint32 seq; +/*0033*/ uint32 current_level; //1s, MQ2 calls this AARankRequired +/*0037*/ uint32 unknown037; // Introduced during HoT +/*0041*/ uint32 prereq_skill; //is < 0, abs() is category # +/*0045*/ uint32 unknown045; // New Mar 21 2012 - Seen 1 +/*0049*/ uint32 prereq_minpoints; //min points in the prereq +/*0053*/ uint32 type; +/*0057*/ uint32 spellid; +/*0061*/ uint32 unknown057; // Introduced during HoT - Seen 1 - Maybe account status or enable/disable AA? +/*0065*/ uint32 spell_type; +/*0069*/ uint32 spell_refresh; +/*0073*/ uint16 classes; +/*0075*/ uint16 berserker; //seems to be 1 if its a berserker ability +/*0077*/ uint32 max_level; +/*0081*/ uint32 last_id; +/*0085*/ uint32 next_id; +/*0089*/ uint32 cost2; +/*0093*/ uint8 unknown80[7]; +/*0100*/ uint32 aa_expansion; +/*0104*/ uint32 special_category; +/*0108*/ uint32 unknown0096; +/*0112*/ uint32 total_abilities; +/*0116*/ AA_Ability abilities[0]; +}; + +struct AA_List { + SendAA_Struct* aa[0]; +}; + +struct AA_Action { +/*00*/ uint32 action; +/*04*/ uint32 ability; +/*08*/ uint32 unknown08; +/*12*/ uint32 exp_value; +/*16*/ +}; + +struct AA_Skills { //this should be removed and changed to AA_Array +/*00*/ uint32 aa_skill; // Total AAs Spent +/*04*/ uint32 aa_value; +/*08*/ uint32 unknown08; +/*12*/ +}; + +struct AAExpUpdate_Struct { +/*00*/ uint32 unknown00; //seems to be a value from AA_Action.ability +/*04*/ uint32 aapoints_unspent; +/*08*/ uint8 aaxp_percent; //% of exp that goes to AAs +/*09*/ uint8 unknown09[3]; //live doesn't always zero these, so they arnt part of aaxp_percent +/*12*/ +}; + +struct AltAdvStats_Struct { +/*000*/ uint32 experience; +/*004*/ uint16 unspent; +/*006*/ uint16 unknown006; +/*008*/ uint8 percentage; +/*009*/ uint8 unknown009[3]; +/*012*/ +}; + +struct PlayerAA_Struct { // Is this still used? + AA_Skills aa_list[MAX_PP_AA_ARRAY]; +}; + +struct AA_Values { +/*00*/ uint32 aa_skill; +/*04*/ uint32 aa_value; +/*08*/ uint32 unknown08; +/*12*/ +}; + +struct AATable_Struct { +/*00*/ uint32 aa_spent; // Total AAs Spent +/*04*/ uint32 aapoints_assigned; // Number of Assigned AA points - Seen 206 (total of the 4 fields below) +/*08*/ uint32 aa_spent_general; // Seen 63 +/*12*/ uint32 aa_spent_archetype; // Seen 40 +/*16*/ uint32 aa_spent_class; // Seen 103 +/*20*/ uint32 aa_spent_special; // Seen 0 +/*24*/ AA_Values aa_list[MAX_PP_AA_ARRAY]; +}; + +struct Weather_Struct { + uint32 val1; //generall 0x000000FF + uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal + uint32 mode; +}; + +struct ZoneInUnknown_Struct { + uint32 val1; + uint32 val2; + uint32 val3; +}; + +struct MobHealth_Struct { + uint16 entity_id; + uint8 hp; +}; + +struct AnnoyingZoneUnknown_Struct { + uint32 entity_id; + uint32 value; //always 4 +}; + +struct LoadSpellSet_Struct { + uint8 spell[12]; // 0xFFFFFFFF if no action, slot number if to unmem starting at 0 + uint32 unknown; //Seen 12 - Maybe a gem count? +}; + +struct BlockedBuffs_Struct +{ +/*000*/ int32 SpellID[BLOCKED_BUFF_COUNT]; +/*120*/ uint32 Count; +/*124*/ uint8 Pet; +/*125*/ uint8 Initialise; +/*126*/ uint16 Flags; +}; + +//Size 24 Bytes +struct WorldObfuscator_Struct { +/*000*/ uint32 var1; +/*004*/ uint32 Unknown1; +/*008*/ uint32 Unknown2; +/*012*/ uint32 Unknown3; +/*016*/ uint32 var2; +/*020*/ uint32 Unknown4; +/*024*/ +}; + +struct ExpansionInfo_Struct { +/*000*/ char Unknown000[64]; +/*064*/ uint32 Expansions; +}; + +struct ApplyPoison_Struct { + MainInvItemSlotStruct inventorySlot; + uint32 success; +}; + +struct ItemVerifyRequest_Struct { +/*000*/ ItemSlotStruct slot; +/*012*/ uint32 target; // Target Entity ID +/*016*/ +}; + +struct ItemVerifyReply_Struct { +/*000*/ ItemSlotStruct slot; +/*012*/ uint32 spell; // Spell ID to cast if different than item effect +/*016*/ uint32 target; // Target Entity ID +/*020*/ +}; + + +struct RoF2SlotStruct +{ + uint8 Bank; + uint16 MainSlot; + uint16 SubSlot; +}; + +struct ItemSerializationHeader +{ +/*000*/ char unknown000[13]; // New for HoT. Looks like a string. +/*017*/ uint32 stacksize; +/*021*/ uint32 unknown004; +/*025*/ uint8 slot_type; // 0 = normal, 1 = bank, 2 = shared bank, 9 = merchant, 20 = ? +/*026*/ uint16 main_slot; +/*028*/ uint16 sub_slot; +/*030*/ uint16 unknown013; // 0xffff +/*032*/ uint32 price; +/*036*/ uint32 merchant_slot; //1 if not a merchant item +/*040*/ uint32 scaled_value; //0 +/*044*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot +/*048*/ uint32 unknown028; //0 +/*052*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 +/*056*/ uint32 charges; //Total Charges an item has (-1 for unlimited) +/*060*/ uint32 inst_nodrop; // 1 if the item is no drop (attuned items) +/*064*/ uint32 unknown044; // 0 +/*068*/ uint32 unknown048; // 0 +/*072*/ uint32 unknown052; // 0 + uint8 isEvolving; +}; + +struct EvolvingItem { + uint8 unknown001; + uint8 unknown002; + uint8 unknown003; + uint8 unknown004; + int32 evoLevel; + double progress; + uint8 Activated; + int32 evomaxlevel; + uint8 unknown005[4]; +}; + +struct ItemSerializationHeaderFinish +{ + uint16 ornamentIcon; +/*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? +/*082*/ uint8 unknown062; // 0 +/*083*/ uint32 unknowna1; // 0xffffffff +/*087*/ uint32 unknowna2; // 0 +/*091*/ uint8 unknown063; // 0 +/*092*/ uint32 unknowna3; // 0 +/*096*/ uint32 unknowna4; // 0xffffffff +/*100*/ uint32 unknowna5; // 0 +/*104*/ uint8 ItemClass; //0, 1, or 2 +/*105*/ +}; + +struct ItemBodyStruct +{ + uint32 id; + int32 weight; // Seen an item on Live with -0.1 weight + uint8 norent; + uint8 nodrop; + uint8 attune; + uint8 size; + uint32 slots; + uint32 price; + uint32 icon; + uint8 unknown1; + uint8 unknown2; + uint32 BenefitFlag; + uint8 tradeskills; + int8 CR; + int8 DR; + int8 PR; + int8 MR; + int8 FR; + int8 SVCorruption; + int8 AStr; + int8 ASta; + int8 AAgi; + int8 ADex; + int8 ACha; + int8 AInt; + int8 AWis; + int32 HP; + int32 Mana; + uint32 Endur; + int32 AC; + int32 regen; + int32 mana_regen; + int32 end_regen; + uint32 Classes; + uint32 Races; + uint32 Deity; + int32 SkillModValue; + int32 SkillModMax; // Max skill point modification + int32 SkillModType; + uint32 SkillModExtra; // Adds a "+value" after the mod percentage + uint32 BaneDmgRace; + uint32 BaneDmgBody; + uint32 BaneDmgRaceAmt; + int32 BaneDmgAmt; + uint8 Magic; + int32 CastTime_; + uint32 ReqLevel; + uint32 RecLevel; + uint32 RecSkill; + uint32 BardType; + int32 BardValue; + uint8 Light; + uint8 Delay; + uint8 ElemDmgType; + uint8 ElemDmgAmt; + uint8 Range; + uint32 Damage; + uint32 Color; + uint32 Prestige; // New to March 21 2012 client + uint8 ItemType; + uint32 Material; + uint32 unknown7; + uint32 EliteMaterial; + uint32 unknown_RoF23; // New to March 21 2012 client + uint32 unknown_RoF24; // New to December 10th 2012 client - NEW + float SellRate; + int32 CombatEffects; + int32 Shielding; + int32 StunResist; + int32 StrikeThrough; + int32 ExtraDmgSkill; + int32 ExtraDmgAmt; + int32 SpellShield; + int32 Avoidance; + int32 Accuracy; + uint32 CharmFileID; + uint32 FactionMod1; + int32 FactionAmt1; + uint32 FactionMod2; + int32 FactionAmt2; + uint32 FactionMod3; + int32 FactionAmt3; + uint32 FactionMod4; + int32 FactionAmt4; +}; + +struct AugSlotStruct +{ + uint32 type; + uint8 visible; + uint8 unknown; +}; + +struct ItemSecondaryBodyStruct +{ + uint32 augtype; + // swapped augrestrict and augdistiller positions + // (this swap does show the proper augment restrictions in Item Information window now) + // unsure what the purpose of augdistiller is at this time -U 3/17/2014 + uint32 augdistiller; // New to December 10th 2012 client - NEW + uint32 augrestrict; + AugSlotStruct augslots[6]; + + uint32 ldonpoint_type; + uint32 ldontheme; + uint32 ldonprice; + uint32 ldonsellbackrate; + uint32 ldonsold; + + uint8 bagtype; + uint8 bagslots; + uint8 bagsize; + uint8 wreduction; + + uint8 book; + uint8 booktype; + //int32 filename; filename is either 0xffffffff/0x00000000 or the null term string ex: CREWizardNote\0 +}; + +struct ItemTertiaryBodyStruct +{ + int32 loregroup; + uint8 artifact; + uint8 summonedflag; + uint32 favor; + uint8 fvnodrop; + int32 dotshield; + int32 atk; + int32 haste; + int32 damage_shield; + uint32 guildfavor; + uint32 augdistil; + int32 unknown3; // 0xffffffff + uint32 unknown4; + uint8 no_pet; + uint8 unknown5; + + uint8 potion_belt_enabled; + uint32 potion_belt_slots; + + uint32 stacksize; + uint8 no_transfer; + uint16 expendablearrow; + + uint32 unknown8; + uint32 unknown9; + uint32 unknown10; + uint32 unknown11; + uint8 unknown12; + uint8 unknown13; + uint8 unknown14; +}; + +struct ClickEffectStruct +{ + int32 effect; + uint8 level2; + uint32 type; + uint8 level; + int32 max_charges; + int32 cast_time; + uint32 recast; + int32 recast_type; + uint32 clickunk5; + //uint8 effect_string; + //int32 clickunk7; +}; + +struct ProcEffectStruct +{ + uint32 effect; + uint8 level2; + uint32 type; + uint8 level; + uint32 unknown1; // poison? + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 procrate; + //uint8 effect_string; + //uint32 unknown5; +}; + +struct WornEffectStruct //worn, focus and scroll effect +{ + uint32 effect; + uint8 level2; + uint32 type; + uint8 level; + uint32 unknown1; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 unknown5; + //uint8 effect_string; + //uint32 unknown6; +}; + +struct ItemQuaternaryBodyStruct +{ + uint32 scriptfileid; + uint8 quest_item; + uint32 Power; // Enables "Power" percentage field used by Power Sources + uint32 Purity; + uint8 unknown16; // RoF2 + uint32 BackstabDmg; + uint32 DSMitigation; + int32 HeroicStr; + int32 HeroicInt; + int32 HeroicWis; + int32 HeroicAgi; + int32 HeroicDex; + int32 HeroicSta; + int32 HeroicCha; + int32 HeroicMR; + int32 HeroicFR; + int32 HeroicCR; + int32 HeroicDR; + int32 HeroicPR; + int32 HeroicSVCorrup; + int32 HealAmt; + int32 SpellDmg; + int32 clairvoyance; + uint8 unknown18; //Power Source Capacity or evolve filename? + uint32 evolve_string; // Some String, but being evolution related is just a guess + uint8 unknown19; + uint32 unknown20; // Bard Stuff? + //uint32 unknown21; + uint8 unknown22; + uint32 unknown23; + uint32 unknown24; + uint32 unknown25; + float unknown26; + float unknown27; + uint32 unknown_RoF26; // 0 New to March 21 2012 client + uint32 unknown28; // 0xffffffff + uint16 unknown29; + uint32 unknown30; // 0xffffffff + uint16 unknown31; + uint32 unknown32; + float unknown33; + uint32 unknown34; + uint32 unknown35; + uint32 unknown36; + uint32 unknown37; + uint32 unknown_RoF27; + uint32 unknown_RoF28; + + // Begin RoF2 Test + uint8 unknown_TEST1; + // End RoF2 Test + + uint8 unknown38; // 0 + uint8 unknown39; // 1 + uint32 subitem_count; +}; + +struct AugmentInfo_Struct +{ +/*000*/ uint32 itemid; // id of the solvent needed +/*004*/ uint32 window; // window to display the information in +/*008*/ char augment_info[64]; // total packet length 76, all the rest were always 00 +/*072*/ uint32 unknown072; +}; + +struct VeteranRewardItem +{ +/*000*/ uint32 item_id; +/*004*/ uint32 charges; +/*008*/ char item_name[64]; +}; + +struct VeteranReward +{ +/*000*/ uint32 claim_id; +/*004*/ uint32 number_available; +/*008*/ uint32 claim_count; +/*012*/ VeteranRewardItem items[8]; +}; + +struct ExpeditionEntryHeader_Struct +{ +/*000*/ uint32 unknown000; +/*000*/ uint32 number_of_entries; +}; + +struct ExpeditionJoinPrompt_Struct +{ +/*000*/ uint32 clientid; +/*004*/ uint32 unknown004; +/*008*/ char player_name[64]; +/*072*/ char expedition_name[64]; +}; + +struct ExpeditionExpireWarning +{ +/*000*/ uint32 clientid; +/*004*/ uint32 unknown004; +/*008*/ uint32 minutes_remaining; +}; + +struct ExpeditionInfo_Struct +{ +/*000*/ uint32 clientid; +/*004*/ uint32 unknown004; +/*008*/ uint32 unknown008; +/*012*/ uint32 max_players; +/*016*/ char expedition_name[128]; +/*142*/ char leader_name[64]; +}; + +struct ExpeditionCompassEntry_Struct +{ +/*000*/ float unknown000; //seen *((uint32*)) = 1584791871 +/*004*/ uint32 enabled; //guess +/*008*/ uint32 unknown008; //seen 1019 +/*012*/ float y; +/*016*/ float x; +/*020*/ float z; +}; + +struct ExpeditionCompass_Struct +{ +/*000*/ uint32 clientid; +/*004*/ uint32 count; +/*008*/ ExpeditionCompassEntry_Struct entries[0]; +}; + +struct MaxCharacters_Struct +{ +/*000*/ uint32 max_chars; // Seen 4 on Silver Account (4 chars max) +/*004*/ uint32 unknown004; // Seen 0 +/*008*/ uint32 unknown008; // Seen 0 +}; + +// Used by MercenaryListEntry_Struct +struct MercenaryStance_Struct { +/*0000*/ uint32 StanceIndex; // Index of this stance (sometimes reverse reverse order - 3, 2, 1, 0 for 4 stances etc) +/*0004*/ uint32 Stance; // From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc +}; +// Used by MercenaryMerchantList_Struct +struct MercenaryListEntry_Struct { +/*0000*/ uint32 MercID; // ID unique to each type of mercenary (probably a DB id) +/*0004*/ uint32 MercType; // From dbstr_us.txt - Apprentice (330000100), Journeyman (330000200), Master (330000300) +/*0008*/ uint32 MercSubType; // From dbstr_us.txt - 330020105^23^Race: Guktan
Type: Healer
Confidence: High
Proficiency: Apprentice, Tier V... +/*0012*/ uint32 PurchaseCost; // Purchase Cost (in gold) +/*0016*/ uint32 UpkeepCost; // Upkeep Cost (in gold) +/*0020*/ uint32 Status; // Required Account Status (Free = 0, Silver = 1, Gold = 2) at merchants - Seen 0 (suspended) or 1 (unsuspended) on hired mercs ? +/*0024*/ uint32 AltCurrencyCost; // Alternate Currency Purchase Cost? (all seen costs show N/A Bayle Mark) - Seen 0 +/*0028*/ uint32 AltCurrencyUpkeep; // Alternate Currency Upkeep Cost? (all seen costs show 1 Bayle Mark) - Seen 1 +/*0032*/ uint32 AltCurrencyType; // Alternate Currency Type? - 19^17^Bayle Mark^0 - Seen 19 +/*0036*/ uint8 MercUnk01; // Unknown (always see 0) +/*0037*/ int32 TimeLeft; // Unknown (always see -1 at merchant) - Seen 900000 (15 minutes in ms for newly hired merc) +/*0041*/ uint32 MerchantSlot; // Merchant Slot? Increments, but not always by 1 - May be for Merc Window Options (Seen 5, 36, 1 for active mercs)? +/*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) +/*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen +/*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 +/*0057*/ uint8 MercUnk04; // Seen 1 +/*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) +/*0000*/ MercenaryStance_Struct Stances[1]; // Count Varies - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc +}; + +// Sent by the server when browsing the Mercenary Merchant +struct MercenaryMerchantList_Struct { +/*0000*/ uint32 MercTypeCount; // Number of Merc Types to follow +/*0004*/ uint32 MercTypes[1]; // Count varies, but hard set to 3 max for now - From dbstr_us.txt - Apprentice (330000100), Journeyman (330000200), Master (330000300) +/*0016*/ uint32 MercCount; // Number of MercenaryInfo_Struct to follow +/*0020*/ MercenaryListEntry_Struct Mercs[0]; // Data for individual mercenaries in the Merchant List +}; + +// OP_MercenaryDataRequest +// Right clicking merchant - shop request +struct MercenaryMerchantShopRequest_Struct { +/*0000*/ uint32 MercMerchantID; // Entity ID of the Mercenary Merchant +/*0004*/ +}; + +// Used by MercenaryDataUpdate_Struct +struct MercenaryData_Struct { +/*0000*/ uint32 MercID; // ID unique to each type of mercenary (probably a DB id) - (if 1, do not send MercenaryData_Struct - No merc hired) +/*0004*/ uint32 MercType; // From dbstr_us.txt - Apprentice (330000100), Journeyman (330000200), Master (330000300) +/*0008*/ uint32 MercSubType; // From dbstr_us.txt - 330020105^23^Race: Guktan
Type: Healer
Confidence: High
Proficiency: Apprentice, Tier V... +/*0012*/ uint32 PurchaseCost; // Purchase Cost (in gold) +/*0016*/ uint32 UpkeepCost; // Upkeep Cost (in gold) +/*0020*/ uint32 Status; // Required Account Status (Free = 0, Silver = 1, Gold = 2) at merchants - Seen 0 (suspended) or 1 (unsuspended) on hired mercs ? +/*0024*/ uint32 AltCurrencyCost; // Alternate Currency Purchase Cost? (all seen costs show N/A Bayle Mark) - Seen 0 +/*0028*/ uint32 AltCurrencyUpkeep; // Alternate Currency Upkeep Cost? (all seen costs show 1 Bayle Mark) - Seen 1 +/*0032*/ uint32 AltCurrencyType; // Alternate Currency Type? - 19^17^Bayle Mark^0 - Seen 19 +/*0036*/ uint8 MercUnk01; // Unknown (always see 0) +/*0037*/ int32 TimeLeft; // Unknown (always see -1 at merchant) - Seen 900000 (15 minutes in ms for newly hired merc) +/*0041*/ uint32 MerchantSlot; // Merchant Slot? Increments, but not always by 1 - May be for Merc Window Options (Seen 5, 36, 1 for active mercs)? +/*0045*/ uint32 MercUnk02; // Unknown (normally see 1, but sometimes 2 or 0) +/*0049*/ uint32 StanceCount; // Iterations of MercenaryStance_Struct - Normally 2 to 4 seen +/*0053*/ int32 MercUnk03; // Unknown (always 0 at merchant) - Seen on active merc: 93 a4 03 77, b8 ed 2f 26, 88 d5 8b c3, and 93 a4 ad 77 +/*0057*/ uint8 MercUnk04; // Seen 1 +/*0058*/ char MercName[1]; // Null Terminated Mercenary Name (00 at merchants) +/*0000*/ MercenaryStance_Struct Stances[1]; // Count Varies, but hard set to 2 for now - From dbstr_us.txt - 1^24^Passive^0, 2^24^Balanced^0, etc (1 to 9 as of April 2012) +/*0000*/ uint32 MercUnk05; // Seen 1 - Extra Merc Data field that differs from MercenaryListEntry_Struct +// MercUnk05 may be a field that is at the end of the packet only, even if multiple mercs are listed (haven't seen examples of multiple mercs owned at once) +}; + +// Should be named OP_MercenaryDataResponse, but the current opcode using that name should be renamed first +// Size varies if mercenary is hired or if browsing Mercenary Merchant +// This may also be the response for Client->Server 0x0327 (size 0) packet On Live as of April 2 2012 +struct MercenaryDataUpdate_Struct { +/*0000*/ int32 MercStatus; // Seen 0 with merc and -1 with no merc hired +/*0004*/ uint32 MercCount; // Seen 1 with 1 merc hired and 0 with no merc hired +/*0008*/ MercenaryData_Struct MercData[0]; // Data for individual mercenaries in the Merchant List +}; + +// Size 12 and sent on Zone-In if no mercenary is currently hired and when merc is dismissed +// (Same packet as MercAssign_Struct?) +struct NoMercenaryHired_Struct { +/*0000*/ int32 MercStatus; // Seen -1 with no merc hired +/*0004*/ uint32 MercCount; // Seen 0 with no merc hired +/*0008*/ uint32 MercID; // Seen 1 when no merc is hired - ID unique to each type of mercenary +/*0012*/ +}; + +// OP_MercenaryAssign (Same packet as NoMercenaryHired_Struct?) +// Not actually Merc related - This is actually a weapon equp packet +struct MercenaryAssign_Struct { +/*0000*/ uint32 MercEntityID; // Seen 0 (no merc spawned) or 615843841 and 22779137 +/*0004*/ uint32 MercUnk01; // +/*0008*/ uint32 MercUnk02; // +/*0012*/ +}; + +// OP_MercenaryTimer +// Sent on Zone-In, or after Dismissing, Suspending, or Unsuspending Mercs +struct MercenaryStatus_Struct { +/*0000*/ uint32 MercEntityID; // Seen 0 (no merc spawned) or 615843841 and 22779137 +/*0004*/ uint32 UpdateInterval; // Seen 900000 - Matches from 0x6537 packet (15 minutes in ms?) +/*0008*/ uint32 MercUnk01; // Seen 180000 - 3 minutes in milleseconds? Maybe next update interval? +/*0012*/ uint32 MercState; // Seen 5 (normal) or 1 (suspended) +/*0016*/ uint32 SuspendedTime; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp +/*0020*/ +}; + +// Sent from the client when using the Mercenary Window +struct MercenaryCommand_Struct { +/*0000*/ uint32 MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 36 (zone in with merc) +/*0004*/ int32 Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance) +/*0008*/ +}; + +// Requesting to suspend or unsuspend merc +struct SuspendMercenary_Struct { +/*0000*/ uint8 SuspendMerc; // Seen 30 (48) for suspending or unsuspending +/*0001*/ +}; + +// Response to suspend merc with timestamp +struct SuspendMercenaryResponse_Struct { +/*0000*/ uint32 SuspendTime; // Unix Timestamp - Seen a9 11 78 4f +/*0004*/ +}; + +// Sent by client when requesting to view Mercenary info or Hire a Mercenary +struct MercenaryMerchantRequest_Struct { +/*0000*/ uint32 MercID; // Seen 399 and 400 for merc ID +/*0004*/ uint32 MercUnk01; // Seen 1 +/*0008*/ uint32 MercMerchantID; // Entity ID for Mercenary Merchant +/*0012*/ uint32 MercUnk02; // Seen 65302016 (00 6e e4 03) - (probably actually individual uint8 fields), but seen as DWORD in Seeds client. +/*0016*/ +}; + +// Sent by Server in response to requesting to view Mercenary info or Hire a Mercenary +struct MercenaryMerchantResponse_Struct { +/*0000*/ uint32 ResponseType; +/*0004*/ +}; + + }; //end namespace structs +}; //end namespace RoF2 + +#endif /*RoF2_STRUCTS_H_*/ diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf new file mode 100644 index 000000000..589c47468 --- /dev/null +++ b/utils/patches/patch_RoF2.conf @@ -0,0 +1,660 @@ +# ShowEQ Import Notes: +# ZERO THE FILE first +# perl -pi -e 's/0x[0-9a-fA-F]{4}/0x0000/g' opcodes.conf +# Unknown Mapping: +# OP_Action2 -> OP_Damage +# OP_EnvDamage -> OP_Damage ---> might have been a one time mistake +# Name Differences: +# OP_CancelInvite -> OP_GroupCancelInvite +# OP_GMFind -> OP_FindPersonRequest +# OP_CommonMessage -> OP_ChannelMessage + +OP_Unknown=0x0000 +OP_ExploreUnknown=0x0000 # used for unknown explorer + +# world packets +# Required to reach Char Select: +OP_SendLoginInfo=0x7a09 +OP_ApproveWorld=0x7499 +OP_LogServer=0x7ceb +OP_SendCharInfo=0x00d2 +OP_ExpansionInfo=0x590d +OP_GuildsList=0x0000 +OP_EnterWorld=0x578f +OP_PostEnterWorld=0x6259 +OP_World_Client_CRC1=0x12cc +OP_World_Client_CRC2=0x0f13 +OP_SendSpellChecksum=0x0000 +OP_SendSkillCapsChecksum=0x0000 + +# Character Select Related: +OP_SendMaxCharacters=0x5475 +OP_SendMembership=0x7acc +OP_SendMembershipDetails=0x057b +OP_CharacterCreateRequest=0x6773 +OP_CharacterCreate=0x6bbf +OP_DeleteCharacter=0x1808 +OP_RandomNameGenerator=0x5954 +OP_ApproveName=0x56a2 +OP_MOTD=0x0c22 +OP_SetChatServer=0x1bc5 +OP_SetChatServer2=0x7eec +OP_ZoneServerInfo=0x4c44 +OP_WorldComplete=0x4493 +OP_WorldUnknown001=0x2301 +OP_FloatListThing=0x46c6 + +# Reasons for Disconnect: +OP_ZoneUnavail=0x4cb4 +OP_WorldClientReady=0x23c1 +OP_CharacterStillInZone=0x0000 +OP_WorldChecksumFailure=0x0000 +OP_WorldLoginFailed=0x0000 +OP_WorldLogout=0x0000 +OP_WorldLevelTooHigh=0x0000 +OP_CharInacessable=0x0000 +OP_UserCompInfo=0x0000 +OP_SendExeChecksum=0x0000 +OP_SendBaseDataChecksum=0x0000 + +# Zone in opcodes +OP_AckPacket=0x471d +OP_ZoneEntry=0x5089 +OP_ReqNewZone=0x7887 +OP_NewZone=0x1795 +OP_ZoneSpawns=0x5237 +OP_PlayerProfile=0x6506 +OP_TimeOfDay=0x5070 +OP_LevelUpdate=0x1eec +OP_Stamina=0x2a79 +OP_RequestClientZoneChange=0x3fcf +OP_ZoneChange=0x2d18 +OP_LockoutTimerInfo=0x0000 +OP_ZoneServerReady=0x0000 +OP_ZoneInUnknown=0x0000 +OP_LogoutReply=0x0000 +OP_PreLogoutReply=0x0000 + +# Required to fully log in +OP_SpawnAppearance=0x0971 +OP_ChangeSize=0x4707 +OP_TributeUpdate=0x5961 +OP_TributeTimer=0x073d +OP_SendTributes=0x729b +OP_SendGuildTributes=0x1877 +OP_TributeInfo=0x4254 +OP_Weather=0x661e +OP_ReqClientSpawn=0x35fa +OP_SpawnDoor=0x7291 +OP_GroundSpawn=0x6fca +OP_SendZonepoints=0x69a4 +OP_BlockedBuffs=0x3033 +OP_RemoveBlockedBuffs=0x0de7 +OP_ClearBlockedBuffs=0x34cb +OP_WorldObjectsSent=0x5ae2 +OP_SendExpZonein=0x5f8e +OP_SendAATable=0x66b5 +OP_RespondAA=0x7a27 +OP_UpdateAA=0x66f0 +OP_SendAAStats=0x43c8 +OP_AAExpUpdate=0x7d14 +OP_ExpUpdate=0x20ed +OP_HPUpdate=0x2828 +OP_ManaChange=0x43af +OP_TGB=0x0876 +OP_SpecialMesg=0x0083 +OP_GuildMemberList=0x12a6 +OP_GuildMOTD=0x3e13 +OP_CharInventory=0x5ca6 +OP_WearChange=0x7994 +OP_ClientUpdate=0x7dfc +OP_ClientReady=0x345d +OP_SetServerFilter=0x444d + +# Guild Opcodes - Disabled until crashes are resolved in RoF +OP_GetGuildMOTD=0x36e0 +OP_GetGuildMOTDReply=0x4f1f +OP_GuildMemberUpdate=0x69b9 +OP_GuildInvite=0x7099 +OP_GuildRemove=0x1444 +OP_GuildPeace=0x67e3 +OP_SetGuildMOTD=0x0b0b +OP_GuildList=0x507a +OP_GuildWar=0x1ffb +OP_GuildLeader=0x7e09 +OP_GuildDelete=0x3708 +OP_GuildInviteAccept=0x7053 +OP_GuildDemote=0x2d4e +OP_GuildPromote=0x0000 +OP_GuildPublicNote=0x5053 +OP_GuildManageBanker=0x748f +OP_GuildBank=0x5134 +OP_SetGuildRank=0x0b9c +OP_GuildUpdateURLAndChannel=0x2958 +OP_GuildStatus=0x7326 +OP_GuildCreate=0x1dc8 +OP_GuildMemberLevelUpdate=0x0000 # Unused? +OP_ZoneGuildList=0x0000 # Unused? +OP_GetGuildsList=0x0000 # Unused? +OP_LFGuild=0x0000 +OP_GuildManageRemove=0x0000 +OP_GuildManageAdd=0x0000 +OP_GuildManageStatus=0x0000 + +# GM/Guide Opcodes +OP_GMServers=0x08c1 +OP_GMBecomeNPC=0x3ae1 +OP_GMZoneRequest=0x62ac +OP_GMZoneRequest2=0x7e1a +OP_GMGoto=0x7d8e +OP_GMSearchCorpse=0x357c +OP_GMHideMe=0x79c5 +OP_GMDelCorpse=0x607e +OP_GMApproval=0x6db5 +OP_GMToggle=0x2097 +OP_GMSummon=0x486f +OP_GMEmoteZone=0x1cfd +OP_GMEmoteWorld=0x458e +OP_GMFind=0x4a8f +OP_GMKick=0x26a7 +OP_GMKill=0x51d3 +OP_GMNameChange=0x035f +OP_GMLastName=0x46ce + +# Misc Opcodes +OP_InspectRequest=0x57bc +OP_InspectAnswer=0x71ac +OP_InspectMessageUpdate=0x4d25 +OP_BeginCast=0x318f +OP_ColoredText=0x0000 +OP_ConsentResponse=0x384a +OP_MemorizeSpell=0x217c +OP_SwapSpell=0x0efa +OP_CastSpell=0x1287 +OP_Consider=0x742b +OP_FormattedMessage=0x1024 +OP_SimpleMessage=0x213f +OP_Buff=0x659c +OP_Illusion=0x312a +OP_MoneyOnCorpse=0x5f44 +OP_RandomReply=0x106b +OP_DenyResponse=0x2382 +OP_SkillUpdate=0x004c +OP_GMTrainSkillConfirm=0x66dd +OP_RandomReq=0x7b10 +OP_Death=0x6517 +OP_GMTraining=0x1966 +OP_GMEndTraining=0x4d6b +OP_GMTrainSkill=0x2a85 +OP_Animation=0x7177 +OP_Begging=0x6703 +OP_Consent=0x1fd1 +OP_ConsentDeny=0x7a45 +OP_AutoFire=0x241e +OP_PetCommands=0x0159 +OP_DeleteSpell=0x52e5 +OP_Surname=0x0423 +OP_ClearSurname=0x7d23 +OP_FaceChange=0x5578 +OP_SenseHeading=0x260a +OP_Action=0x744c +OP_ConsiderCorpse=0x5204 +OP_HideCorpse=0x49e1 +OP_CorpseDrag=0x0904 +OP_CorpseDrop=0x7037 +OP_Bug=0x73f4 +OP_Feedback=0x5602 +OP_Report=0x1414 +OP_Damage=0x6f15 +OP_ChannelMessage=0x2b2d +OP_Assist=0x4478 +OP_AssistGroup=0x27f8 +OP_MoveCoin=0x0bcf +OP_ZonePlayerToBind=0x0ecb +OP_KeyRing=0x6857 +OP_WhoAllRequest=0x65ab +OP_WhoAllResponse=0x7c88 +OP_FriendsWho=0x3956 +OP_ConfirmDelete=0x43a3 +OP_Logout=0x4ac6 +OP_Rewind=0x1745 +OP_TargetCommand=0x58e2 +OP_Hide=0x67fe +OP_Jump=0x2060 +OP_Camp=0x28ec +OP_Emote=0x373b +OP_SetRunMode=0x009f +OP_BankerChange=0x383c +OP_TargetMouse=0x075d +OP_MobHealth=0x37b1 +OP_InitialMobHealth=0x0000 # Unused? +OP_TargetHoTT=0x0272 +OP_XTargetResponse=0x672f +OP_XTargetRequest=0x45be +OP_XTargetAutoAddHaters=0x792c +OP_TargetBuffs=0x4f4b +OP_BuffCreate=0x3377 +OP_BuffRemoveRequest=0x64f2 +OP_DeleteSpawn=0x7280 +OP_AutoAttack=0x109d +OP_AutoAttack2=0x3526 +OP_Consume=0x4b70 +OP_MoveItem=0x32ee +OP_DeleteItem=0x18ad +OP_DeleteCharge=0x01b8 +OP_ItemPacket=0x368e +OP_ItemLinkResponse=0x633c +OP_ItemLinkClick=0x4cef +OP_ItemPreview=0x6b5c +OP_NewSpawn=0x6097 +OP_Track=0x17e5 +OP_TrackTarget=0x0029 +OP_TrackUnknown=0x4577 +OP_ClickDoor=0x3a8f +OP_MoveDoor=0x08e8 +OP_RemoveAllDoors=0x700c +OP_EnvDamage=0x51fd +OP_BoardBoat=0x4211 +OP_Forage=0x5306 +OP_LeaveBoat=0x7617 +OP_ControlBoat=0x0ae7 +OP_SafeFallSuccess=0x2219 +OP_RezzComplete=0x760d +OP_RezzRequest=0x3c21 +OP_RezzAnswer=0x701c +OP_Shielding=0x48c1 +OP_RequestDuel=0x3af1 +OP_MobRename=0x2c57 +OP_AugmentItem=0x661b +OP_WeaponEquip1=0x34a7 +OP_WeaponEquip2=0x559a +OP_WeaponUnequip2=0x2d25 +OP_ApplyPoison=0x31e6 +OP_Save=0x4a39 +OP_TestBuff=0x7cb8 +OP_CustomTitles=0x100e +OP_Split=0x3a54 +OP_YellForHelp=0x4e56 +OP_LoadSpellSet=0x261d +OP_Bandolier=0x7677 +OP_PotionBelt=0x1a3e +OP_DuelResponse=0x6a46 +OP_DuelResponse2=0x68d3 +OP_SaveOnZoneReq=0x600d +OP_ReadBook=0x72df +OP_Dye=0x23b9 +OP_InterruptCast=0x048c +OP_AAAction=0x424e +OP_LeadershipExpToggle=0x6c55 +OP_LeadershipExpUpdate=0x2797 +OP_PurchaseLeadershipAA=0x0026 +OP_UpdateLeadershipAA=0x026 +OP_MarkNPC=0x5a58 +OP_MarkRaidNPC=0x74bd #unimplemented +OP_ClearNPCMarks=0x2003 +OP_ClearRaidNPCMarks=0x20d3 #unimplemented +OP_DelegateAbility=0x76b8 +OP_SetGroupTarget=0x2814 +OP_Charm=0x5d92 +OP_Stun=0x36a4 +OP_SendFindableNPCs=0x3897 +OP_FindPersonRequest=0x5cea +OP_FindPersonReply=0x7e58 +OP_Sound=0x1a30 +OP_PetBuffWindow=0x5882 +OP_LevelAppearance=0x3bc9 +OP_Translocate=0x6580 +OP_Sacrifice=0x1821 +OP_PopupResponse=0x214a +OP_OnLevelMessage=0x4fd0 +OP_AugmentInfo=0x0afb +OP_Petition=0x5f03 +OP_SomeItemPacketMaybe=0x747c +OP_PVPStats=0x6f4b +OP_PVPLeaderBoardRequest=0x3707 +OP_PVPLeaderBoardReply=0x25b7 +OP_PVPLeaderBoardDetailsRequest=0x15a9 +OP_PVPLeaderBoardDetailsReply=0x04aa +OP_RestState=0x00f +OP_RespawnWindow=0x28bc +OP_LDoNButton=0x5327 +OP_SetStartCity=0x6326 +OP_VoiceMacroIn=0x17fd +OP_VoiceMacroOut=0x409a +OP_ItemViewUnknown=0x2289 +OP_VetRewardsAvaliable=0x590e +OP_VetClaimRequest=0x1126 +OP_VetClaimReply=0x16d4 +OP_DisciplineUpdate=0x759e +OP_DisciplineTimer=0x6989 +OP_BecomeCorpse=0x0000 # Unused? +OP_Action2=0x0000 # Unused? +OP_MobUpdate=0x2c84 +OP_NPCMoveUpdate=0x189c +OP_CameraEffect=0x127f +OP_SpellEffect=0x5936 +OP_RemoveNimbusEffect=0xc693 +OP_AltCurrency=0x7121 +OP_AltCurrencyMerchantRequest=0x6b6d +OP_AltCurrencyMerchantReply=0x74ec +OP_AltCurrencyPurchase=0x61cb +OP_AltCurrencySell=0x0165 +OP_AltCurrencySellSelection=0x5409 +OP_AltCurrencyReclaim=0x532a +OP_CrystalCountUpdate=0x467f +OP_CrystalCreate=0x7aee +OP_CrystalReclaim=0x2439 +OP_Untargetable=0x053c +OP_IncreaseStats=0x70a3 +OP_Weblink=0x18d3 +OP_OpenContainer=0x0000 +OP_Marquee=0x0000 +OP_ItemRecastDelay=0x08a6 +#OP_OpenInventory=0x0000 # Likely does not exist in RoF -U + +OP_DzQuit=0xb2e3 +OP_DzListTimers=0x7b68 +OP_DzAddPlayer=0x4701 +OP_DzRemovePlayer=0x1abc +OP_DzSwapPlayer=0x405b +OP_DzMakeLeader=0x543d +OP_DzPlayerList=0x14c6 +OP_DzJoinExpeditionConfirm=0x7f4b +OP_DzJoinExpeditionReply=0x1950 +OP_DzExpeditionInfo=0x9119 +OP_DzExpeditionList=0x205f +OP_DzMemberStatus=0x32f0 +OP_DzLeaderStatus=0x3de9 +OP_DzExpeditionEndsWarning=0x5189 +OP_DzMemberList=0x5ae4 +OP_DzCompass=0x3e0e +OP_DzChooseZone=0x0000 + +# New Opcodes +OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ? +OP_ManaUpdate=0x3791 +OP_EnduranceUpdate=0x5f42 +OP_MobManaUpdate=0x2404 +OP_MobEnduranceUpdate=0x1c81 + +# Mercenary Opcodes +OP_MercenaryDataUpdateRequest=0x7b89 +OP_MercenaryDataUpdate=0x61a4 +OP_MercenaryDataRequest=0x11c1 +OP_MercenaryDataResponse=0x72ce +OP_MercenaryHire=0x7169 +OP_MercenaryDismiss=0x6e83 +OP_MercenaryTimerRequest=0x31e4 +OP_MercenaryTimer=0x0763 +OP_MercenaryUnknown1=0x5d26 +OP_MercenaryCommand=0x27f2 +OP_MercenarySuspendRequest=0x4407 +OP_MercenarySuspendResponse=0x6f03 +OP_MercenaryUnsuspendResponse=0x27a0 + +# Looting +OP_LootRequest=0x0adf +OP_EndLootRequest=0x30f7 +OP_LootItem=0x4dc9 +OP_LootComplete=0x55c4 + +# bazaar trader stuff: +OP_BazaarSearch=0x39d6 +OP_TraderDelItem=0x0000 +OP_BecomeTrader=0x61b3 +OP_TraderShop=0x31df +OP_Trader=0x4ef5 +OP_TraderBuy=0x0000 +OP_Barter=0x243a +OP_ShopItem=0x0000 +OP_BazaarInspect=0x0000 +OP_Bazaar=0x0000 +OP_TraderItemUpdate=0x0000 + +# pc/npc trading +OP_TradeRequest=0x77b5 +OP_TradeAcceptClick=0x69e2 +OP_TradeRequestAck=0x14bf +OP_TradeCoins=0x4206 +OP_FinishTrade=0x3993 +OP_CancelTrade=0x354c +OP_TradeMoneyUpdate=0x68c2 +OP_MoneyUpdate=0x640c +OP_TradeBusy=0x5505 + +# Sent after canceling trade or after closing tradeskill object +OP_FinishWindow=0x7349 +OP_FinishWindow2=0x40ef + +# Sent on Live for what seems to be item existance verification +# Ex. Before Right Click Effect happens from items +OP_ItemVerifyRequest=0x097b +OP_ItemVerifyReply=0x2115 + +# merchant stuff +OP_ShopPlayerSell=0x1901 +OP_ShopRequest=0x4fed +OP_ShopEnd=0x30a8 +OP_ShopEndConfirm=0x3196 +OP_ShopPlayerBuy=0x04c +OP_ShopDelItem=0x724f + +# tradeskill stuff: +OP_ClickObject=0x4aa1 +OP_ClickObjectAction=0x0c1e +OP_ClearObject=0x7a11 +OP_RecipeDetails=0x40d7 +OP_RecipesFavorite=0x5c74 +OP_RecipesSearch=0x1db6 +OP_RecipeReply=0x6e02 +OP_RecipeAutoCombine=0x6261 +OP_TradeSkillCombine=0x579a + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x378d +OP_OpenTributeMaster=0x7666 +OP_SelectTribute=0x79fc +OP_TributeItem=0x4f3e +OP_TributeMoney=0x58fb +OP_TributeToggle=0x241d +OP_TributePointUpdate=0x5300 +OP_TributeNPC=0x0000 +OP_GuildTributeInfo=0x0000 +OP_OpenTributeReply=0x0000 +OP_GuildTributeStatus=0x0000 + +# Adventure packets: +OP_LeaveAdventure=0x5d18 +OP_AdventureFinish=0x400f +OP_AdventureInfoRequest=0x3cb0 +OP_AdventureInfo=0x4c54 +OP_AdventureRequest=0x2c6c +OP_AdventureDetails=0x5648 +OP_AdventureData=0x7171 +OP_AdventureUpdate=0x1b01 +OP_AdventureMerchantRequest=0x6922 +OP_AdventureMerchantResponse=0x3e47 +OP_AdventureMerchantPurchase=0x5b72 +OP_AdventureMerchantSell=0x2f9b +OP_AdventurePointsUpdate=0x65c3 +OP_AdventureStatsRequest=0x5a62 +OP_AdventureStatsReply=0x2370 +OP_AdventureLeaderboardRequest=0x7093 +OP_AdventureLeaderboardReply=0x7f79 + +# Group Opcodes +OP_GroupDisband=0x4c10 +OP_GroupInvite=0x1649 +OP_GroupFollow=0x05ce +OP_GroupUpdate=0x3abb +OP_GroupUpdateB=0x6194 +OP_GroupCancelInvite=0x0000 +OP_GroupAcknowledge=0x7323 +OP_GroupDelete=0x0f6c +OP_CancelInvite=0x32c2 +OP_GroupFollow2=0x2a50 +OP_GroupInvite2=0x6c65 +OP_GroupDisbandYou=0x1ae5 +OP_GroupDisbandOther=0x74da +OP_GroupLeaderChange=0x21b4 +OP_GroupRoles=0x70e2 +OP_GroupMakeLeader=0x4229 +OP_DoGroupLeadershipAbility=0x1fb5 +OP_GroupLeadershipAAUpdate=0x02cf +OP_GroupMentor=0x5892 +OP_InspectBuffs=0x486c + +# LFG/LFP Opcodes +OP_LFGCommand=0x6060 +OP_LFGGetMatchesRequest=0x0340 +OP_LFGGetMatchesResponse=0x5048 +OP_LFPGetMatchesRequest=0x4d7d +OP_LFPGetMatchesResponse=0x22c6 +OP_LFPCommand=0x49a9 +OP_LFGAppearance=0x0000 +OP_LFGResponse=0x0000 + +# Raid Opcodes +OP_RaidInvite=0x55ac +OP_RaidUpdate=0x3973 +OP_RaidJoin=0x0000 + +# Button-push commands +OP_Taunt=0x2703 +OP_CombatAbility=0x3eba +OP_SenseTraps=0x02af +OP_PickPocket=0x39e8 +OP_DisarmTraps=0x78bf +OP_Disarm=0x5ec8 +OP_Sneak=0x5d55 +OP_Fishing=0x1e2a +OP_InstillDoubt=0x640e +OP_FeignDeath=0x52fa +OP_Mend=0x0ecf +OP_Bind_Wound=0x0386 +OP_LDoNOpen=0x3d5c + +# Task packets +OP_TaskDescription=0x083 +OP_TaskActivity=0x3714 +OP_CompletedTasks=0x4eba +OP_TaskActivityComplete=0x5e19 +OP_AcceptNewTask=0x0a23 +OP_CancelTask=0x08d3 +OP_TaskMemberList=0x5727 +OP_OpenNewTasksWindow=0x48a2 +OP_AvaliableTask=0x36e8 +OP_TaskHistoryRequest=0x5f1c +OP_TaskHistoryReply=0x3d05 +OP_DeclineAllTasks=0x0000 + +# Title opcodes +OP_NewTitlesAvailable=0x0d32 +OP_RequestTitles=0x6344 +OP_SendTitleList=0x2d08 +OP_SetTitle=0x6527 +OP_SetTitleReply=0x4c21 + +# mail opcodes +OP_Command=0x0000 +OP_MailboxHeader=0x0000 +OP_MailHeader=0x0000 +OP_MailBody=0x0000 +OP_NewMail=0x0000 +OP_SentConfirm=0x0000 + +########### Below this point should not be needed ########### + +# This section are all unknown in Titanium +OP_ForceFindPerson=0x0000 +OP_LocInfo=0x0000 +OP_ReloadUI=0x0000 +OP_ItemName=0x0000 +OP_ItemLinkText=0x0000 +OP_MultiLineMsg=0x0000 +OP_MendHPUpdate=0x0000 +OP_TargetReject=0x0000 +OP_SafePoint=0x0000 +OP_ApproveZone=0x0000 +OP_ZoneComplete=0x0000 +OP_ClientError=0x0000 +OP_DumpName=0x0000 +OP_Heartbeat=0x0000 +OP_CrashDump=0x0000 +OP_LoginComplete=0x0000 + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 +OP_PlayMP3=0x0000 +OP_ReclaimCrystals=0x0000 +OP_DynamicWall=0x0000 +OP_OpenDiscordMerchant=0x0000 +OP_DiscordMerchantInventory=0x0000 +OP_GiveMoney=0x0000 +OP_RequestKnowledgeBase=0x0000 +OP_KnowledgeBase=0x0000 +OP_SlashAdventure=0x0000 # /adventure +OP_BecomePVPPrompt=0x0000 +OP_MoveLogRequest=0x0000 # gone I think +OP_MoveLogDisregard=0x0000 # gone I think + +# named unknowns, to make looking for real unknown easier +OP_AnnoyingZoneUnknown=0x0000 +OP_Some6ByteHPUpdate=0x0000 seems to happen when you target group members +OP_QueryResponseThing=0x0000 + + +# realityincarnate: these are just here to stop annoying several thousand byte packet dumps +#OP_LoginUnknown1=0x46d3 # OP_SendSpellChecksum +#OP_LoginUnknown2=0x040b # OP_SendSkillCapsChecksum + +# Petition Opcodes +OP_PetitionSearch=0x0000 search term for petition +OP_PetitionSearchResults=0x0000 (list of?) matches from search +OP_PetitionSearchText=0x0000 text results of search + +OP_PetitionUpdate=0x0000 +OP_PetitionCheckout=0x0000 +OP_PetitionCheckIn=0x0000 +OP_PetitionQue=0x0000 +OP_PetitionUnCheckout=0x0000 +OP_PetitionDelete=0x0000 +OP_DeletePetition=0x0000 +OP_PetitionResolve=0x0000 +OP_PDeletePetition=0x0000 +OP_PetitionBug=0x0000 +OP_PetitionRefresh=0x0000 +OP_PetitionCheckout2=0x0000 +OP_PetitionViewPetition=0x0000 + +# Login opcodes +OP_SessionReady=0x0000 +OP_Login=0x0000 +OP_ServerListRequest=0x0000 +OP_PlayEverquestRequest=0x0000 +OP_PlayEverquestResponse=0x0000 +OP_ChatMessage=0x0000 +OP_LoginAccepted=0x0000 +OP_ServerListResponse=0x0000 +OP_Poll=0x0000 +OP_EnterChat=0x0000 +OP_PollResponse=0x0000 + +# raw opcodes +OP_RAWSessionRequest=0x0000 +OP_RAWSessionResponse=0x0000 +OP_RAWCombined=0x0000 +OP_RAWSessionDisconnect=0x0000 +OP_RAWKeepAlive=0x0000 +OP_RAWSessionStatRequest=0x0000 +OP_RAWSessionStatResponse=0x0000 +OP_RAWPacket=0x0000 +OP_RAWFragment=0x0000 +OP_RAWOutOfOrderAck=0x0000 +OP_RAWAck=0x0000 +OP_RAWAppCombined=0x0000 +OP_RAWOutOfSession=0x0000 + +# we need to document the differences between these packets to make identifying them easier +OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs +OP_InitialHPUpdate=0x0000 \ No newline at end of file diff --git a/utils/scripts/opcode_scripts/conf_to_oplist.pl b/utils/scripts/opcode_scripts/conf_to_oplist.pl new file mode 100644 index 000000000..f79de1093 --- /dev/null +++ b/utils/scripts/opcode_scripts/conf_to_oplist.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +# File Name: conf_to_oplist.pl +# Converts a Patch File into the Opcode List with Opcode Names for the Spreadsheet. + +# Directions to use this script: +# 1. Paste the contents of the current patch file in the patch_OLD.conf file. +# 2. Run this script using "perl conf_to_oplist.pl" +# 3. This updates the opcodelist.txt with the values from the Patch File. + + +$stopmessage = "Failed to open file"; +open OpcodeFile, "<", "opcodelist.txt" or die $stopmessage; +open PatchFile, "<", "patch_OLD.conf" or die $stopmessage; + +my @OpcodeList = ; +my @PatchFile = ; +my %PatchHash = (); + +foreach $line (@PatchFile) +{ + @equalssplit = split(/=/, $line); + $ArraySize = @equalssplit; + if ($ArraySize > 1) + { + @OpcodeArray = split(//, $equalssplit[1]); + $CurOpcode = $OpcodeArray[0].$OpcodeArray[1].$OpcodeArray[2].$OpcodeArray[3].$OpcodeArray[4].$OpcodeArray[5]; + $CurOpcode = lc($CurOpcode); + # Opcode Name => Opcode + $PatchHash{ $CurOpcode } = $equalssplit[0]; + } +} + +close(OpcodeFile); +close(PatchFile); + +# Clear out file contents +open OpcodeResultFile, ">", "opcodelist.txt" or die $stopmessage; +print OpcodeResultFile ""; +close(OpcodeResultFile); + +open OpcodeResultFile, ">>", "opcodelist.txt" or die $stopmessage; + +while( my ($k, $v) = each %$PatchFile ) +{ + #print OpcodeResultFile "key: $k, value: $v.\n"; +} + + +$TabSpace = " "; # Tab +foreach $line (@OpcodeList) +{ + @LineSplit = split(//, $line); + $CurOpcode = $LineSplit[0].$LineSplit[1].$LineSplit[2].$LineSplit[3].$LineSplit[4].$LineSplit[5]; + $CurOpcode = lc($CurOpcode); + $OpcodeName = ""; # Tab + if ($PatchHash{$CurOpcode}) + { + $NameKey = $PatchHash{$CurOpcode}; + $OpcodeName = $NameKey; + } + $CurLine = $CurOpcode.$TabSpace.$OpcodeName."\n"; + print OpcodeResultFile $CurLine; +} + +close(OpcodeResultFile); diff --git a/utils/scripts/opcode_scripts/opcodelist.txt b/utils/scripts/opcode_scripts/opcodelist.txt new file mode 100644 index 000000000..6ef0916f9 --- /dev/null +++ b/utils/scripts/opcode_scripts/opcodelist.txt @@ -0,0 +1,1671 @@ +RoF2 Built May 10 2013 23:30:08 +0x04d6 +0x5efd +0x0cc1 +0x2c3d +0x7b25 +0x4f44 +0x7592 +0x2b1c +0x1fd1 OP_Consent +0x15a5 +0x3c7e +0x6262 +0x471d OP_AckPacket +0x64a8 +0x7c06 +0x2c5e +0x24ab +0x19b5 +0x72fa +0x0770 +0x4cef OP_ItemLinkClick +0x08c1 OP_GMServers +0x318f OP_BeginCast +0x5ec8 OP_Disarm +0x6ae3 +0x2b2d OP_ChannelMessage +0x1cb1 +0x5070 OP_TimeOfDay +0x7dfc OP_ClientUpdate +0x35ea +0x3b9a +0x148d +0x345d OP_ClientReady +0x5ae2 OP_WorldObjectsSent +0x03a4 +0x69e2 OP_TradeAcceptClick +0x354c OP_CancelTrade +0x3993 OP_FinishTrade +0x165b +0x2b95 +0x6fe2 +0x42fd +0x25d7 +0x7436 +0x4206 OP_TradeCoins +0x14bf OP_TradeRequestAck +0x7349 OP_FinishWindow +0x71fd +0x0b9c OP_SetGuildRank +0x0f7d +0x1bd3 +0x5053 OP_GuildPublicNote +0x01f9 +0x2c84 OP_MobUpdate +0x279d +0x5a94 +0x579a OP_TradeSkillCombine +0x56b1 +0x0f25 +0x3c14 +0x0c16 +0x4a8f OP_GMFind +0x2ad6 +0x0160 +0x7852 +0x41bf +0x40dd +0x3ec6 +0x6af4 +0x6d9d +0x2538 +0x0017 +0x017 +0x691a +0x0520 +0x200f +0x65ab OP_WhoAllRequest +0x674b +0x6a02 +0x0e48 +0x12a6 OP_GuildMemberList +0x0eae +0x2921 +0x7056 +0x507a OP_GuildList +0x6279 +0x5a26 +0x5b51 +0x0bad +0x59ad +0x2264 +0x004c OP_SkillUpdate +0x04c OP_ShopPlayerBuy +0x0ddd +0x4101 +0x5f03 OP_Petition +0x3de3 +0x1901 OP_ShopPlayerSell +0x791b +0x3a5d +0x7013 +0x47f1 +0x6506 OP_PlayerProfile +0x30a8 OP_ShopEnd +0x724f OP_ShopDelItem +0x5829 +0x1ce1 +0x47d6 +0x07cf +0x40c9 +0x38d4 +0x7eb9 +0x1e2c +0x3ae1 OP_GMBecomeNPC +0x4849 +0x376b +0x1e2a OP_Fishing +0x1eec OP_LevelUpdate +0x4958 +0x20ed OP_ExpUpdate +0x3ed4 +0x701c OP_RezzAnswer +0x640e OP_InstillDoubt +0x0ecf OP_Mend +0x09d3 +0x70a3 OP_IncreaseStats +0x178e +0x27e8 +0x61f8 +0x4322 +0x3f84 +0x40ef OP_FinishWindow2 +0x166c +0x106b OP_RandomReply +0x5bfd +0x11c8 +0x1753 +0x009f OP_SetRunMode +0x09f +0x4ae6 +0x3dbf +0x0399 +0x5c89 +0x012c +0x381c +0x4b36 +0x36d5 +0x5f21 +0x56f7 +0x46b1 +0x357c OP_GMSearchCorpse +0x2422 +0x084e +0x67e3 OP_GuildPeace +0x0f83 +0x4577 OP_TrackUnknown +0x5d55 OP_Sneak +0x67fe OP_Hide +0x12e5 +0x2c7a +0x600d OP_SaveOnZoneReq +0x16ce +0x46ce OP_GMLastName +0x1ffb OP_GuildWar +0x6718 +0x2f3e +0x7e09 OP_GuildLeader +0x5ce4 +0x5bcc +0x551d +0x6dbc +0x2219 OP_SafeFallSuccess +0x2686 +0x2022 +0x1c53 +0x33a2 +0x3541 +0x582e +0x3cba +0x190c +0x5067 +0x46d2 +0x49cf +0x1b0c + +0x31e6 OP_ApplyPoison +0x4211 OP_BoardBoat +0x7617 OP_LeaveBoat +0x4466 +0x1287 OP_CastSpell +0x5467 OP_ManaChange +0x43af OP_ManaChange +0x6a0d +0x217c OP_MemorizeSpell +0x260a OP_SenseHeading +0x5886 +0x7e8c +0x1a37 +0x0b6f +0x62ca +0x34a4 +0x6c83 +0x5d10 +0x21a0 +0x3537 +0x2acd +0x7c6d +0x6618 + + + +0x6c65 OP_GroupInvite2 +0x32c2 OP_CancelInvite +0x2a50 OP_GroupFollow2 +0x2060 OP_Jump +0x31f4 +0x4420 +0x1256 +0x4d38 +0x50f5 +0x79c5 OP_GMHideMe +0x2fab +0x57a5 +0x32a4 +0x590d OP_ExpansionInfo +0x6f15 OP_Damage +0x42ea +0x3091 +0x6b5a +0x3234 +0x30b4 +0x51fd OP_EnvDamage +0x15f4 +0x1808 OP_DeleteCharacter +0x1795 OP_NewZone +0x7887 OP_ReqNewZone +0x2414 +0x2eb3 +0x3db3 +0x4008 + +0x373b OP_Emote +0x7280 OP_DeleteSpawn +0x4bc2 +0x15bb +0x4fed OP_ShopRequest +0x0c2f +0x4aa1 OP_ClickObject +0x6fca OP_GroundSpawn +0x1045 +0x2a9e +0x2523 +0x6213 +0x4a39 OP_Save +0x0797 +0x35fa OP_ReqClientSpawn +0x5f8e OP_SendExpZonein +0x4c10 OP_GroupDisband +0x747c OP_SomeItemPacketMaybe +0x744c OP_Action +0x00d2 OP_SendCharInfo +0x0d2 +0x11d4 +0x6bbf OP_CharacterCreate +0x6517 OP_Death +0x19f6 +0x360f +0x1951 +0x51d3 OP_GMKill +0x26a7 OP_GMKick +0x7d8e OP_GMGoto +0x475e +0x5253 +0x3c79 +0x5065 +0x0337 +0x2ded +0x777b +0x4434 +0x0e90 +0x57da +0x150e +0x1ba8 +0x70eb +0x0adf OP_LootRequest +0x30f7 OP_EndLootRequest +0x5f44 OP_MoneyOnCorpse +0x3d54 +0x482d +0x58b2 +0x7361 +0x604f +0x3d87 +0x6909 +0x4f73 +0x0a0f +0x56a2 OP_ApproveName +0x69e6 +0x3a8f OP_ClickDoor +0x08e8 OP_MoveDoor +0x7dd1 +0x5c66 +0x312a OP_Illusion +0x2807 +0x4fe2 +0x2f2e +0x5824 +0x6661 +0x4742 +0x4d02 +0x2105 +0x19e9 +0x2268 +0x7994 OP_WearChange +0x0386 OP_Bind_Wound +0x5306 OP_Forage +0x0971 OP_SpawnAppearance +0x7099 OP_GuildInvite +0x7053 OP_GuildInviteAccept +0x1444 OP_GuildRemove +0x3708 OP_GuildDelete +0x7b22 +0x610f +0x324a +0x2889 +0x6f2a +0x2998 +0x700c OP_RemoveAllDoors +0x1966 OP_GMTraining +0x4d6b OP_GMEndTraining +0x6e8d +0x2b41 +0x4dc9 OP_LootItem +0x7177 OP_Animation +0x650e +0x2d18 OP_ZoneChange +0x707b +0x0803 +0x3fc3 +0x7326 OP_GuildStatus +0x0804 +0x3f86 +0x6d20 +0x04a3 +0x4714 +0x6703 OP_Begging +0x0ae7 OP_ControlBoat +0x27d7 +0x3c21 OP_RezzRequest +0x6f22 +0x32ee OP_MoveItem +0x0bcf OP_MoveCoin +0x2452 +0x0186 +0x0522 +0x3a54 OP_Split +0x659c OP_Buff +0x225b + +0x12cc OP_World_Client_CRC1 +0x661e OP_Weather +0x742b OP_Consider +0x102e +0x0f13 OP_World_Client_CRC2 +0x6944 +0x2703 OP_Taunt +0x5602 OP_Feedback +0x68c2 OP_TradeMoneyUpdate +0x07f7 +0x3fe7 +0x43a0 +0x314c +0x4b70 OP_Consume +0x2a79 OP_Stamina +0x402e +0x750e +0x0927 +0x36a4 OP_Stun +0x2b03 +0x68d3 OP_DuelResponse2 +0x6a46 OP_DuelResponse +0x5237 OP_ZoneSpawns +0x3eba OP_CombatAbility +0x109d OP_AutoAttack +0x075d OP_TargetMouse +0x05d2 +0x2a85 OP_GMTrainSkill +0x43a3 OP_ConfirmDelete +0x6c57 +0x3906 +0x55c4 OP_LootComplete +0x3196 OP_ShopEndConfirm +0x18ad OP_DeleteItem +0x01b8 OP_DeleteCharge +0x01d7 +0x4d28 +0x4fd9 +0x02c6 +0x3e30 +0x3fcf OP_RequestClientZoneChange +0x4e0e +0x1dee +0x62ac OP_GMZoneRequest +0x4ac6 OP_Logout +0x3526 OP_AutoAttack2 +0x7ceb OP_LogServer +0x0423 OP_Surname +0x3956 OP_FriendsWho +0x45dc +0x35e0 +0x173e +0x4853 +0x393b +0x0efa OP_SwapSpell +0x3588 +0x26e9 +0x4e56 OP_YellForHelp +0x2551 +0x38c8 +0x7499 OP_ApproveWorld +0x603a +0x7b10 OP_RandomReq +0x208f +0x607e OP_GMDelCorpse +0x1821 OP_Sacrifice +0x30d6 +0x760d OP_RezzComplete +0x4dd5 +0x0fe8 +0x6e5c +0x2228 +0x21bc +0x78c3 +0x3e57 +0x69d0 +0x1e3a +0x1a30 OP_Sound +0x61a0 +0x048c OP_InterruptCast +0x6e80 +0x3d29 +0x5d92 OP_Charm +0x0159 OP_PetCommands +0x486e +0x579e +0x49b3 +0x6db5 OP_GMApproval +0x4759 +0x0c22 OP_MOTD +0x2097 OP_GMToggle +0x72f7 +0x640c OP_MoneyUpdate +0x51e5 +0x1802 +0x5de1 +0x2e0c +0x58e2 OP_TargetCommand +0x444d OP_SetServerFilter +0x4478 OP_Assist +0x2a21 +0x7e59 +0x0b0b OP_SetGuildMOTD +0x3e13 OP_GuildMOTD +0x7a11 OP_ClearObject +0x6580 OP_Translocate +0x28ec OP_Camp +0x61b3 OP_BecomeTrader +0x31af +0x0876 OP_TGB +0x4ee1 +0x7e92 +0x7d14 OP_AAExpUpdate + +0x5578 OP_FaceChange +0x1a80 +0x42ff +0x7c2d +0x2c57 OP_MobRename +0x6dab +0x4568 +0x7776 +0x5029 +0x696c +0x23b9 OP_Dye +0x5204 OP_ConsiderCorpse +0x213f OP_SimpleMessage +0x1024 OP_FormattedMessage +0x2ce5 +0x5cc9 +0x3358 +0x52e5 OP_DeleteSpell +0x48c1 OP_Shielding +0x6f14 +0x1414 OP_Report +0x0e1c +0x1219 +0x6857 OP_KeyRing +0x55ac OP_RaidInvite +0x3973 OP_RaidUpdate +0x56fe +0x7f2d +0x31df OP_TraderShop +0x4ef5 OP_Trader +0x735d +0x019b +0x5930 +0x2d73 +0x39d6 OP_BazaarSearch +0x6a96 +0x424e OP_AAAction +0x7a27 OP_RespondAA +0x5eca +0x70c6 +0x0dd4 +0x4598 +0x19b6 +0x728a +0x5232 +0x77bd +0x70c0 +0x633c OP_ItemLinkResponse +0x63eb +0x4765 +0x6290 +0x1db6 OP_RecipesSearch +0x6e02 OP_RecipeReply +0x40d7 OP_RecipeDetails +0x6261 OP_RecipeAutoCombine +0x4015 OP_SetGroupLeadershipAbilities +0x6eae OP_SetRaidLeadershipAbilities +0x1fb5 OP_DoGroupLeadershipAbility +0x5a58 OP_MarkNPC +0x74bd OP_MarkRaidNPC +0x6c55 OP_LeadershipExpToggle +0x0026 OP_PurchaseLeadershipAA +0x026 OP_UpdateLeadershipAA +0x2814 OP_SetGroupTarget +0x4c9d OP_SetRaidTarget +0x76b8 OP_DelegateAbility +0x2b33 OP_DelegateRaidAbility +0x4786 OP_SenseNPCData +0x0eb4 OP_DelegateFailed +0x486c OP_InspectBuffs +0x0272 OP_TargetHoTT +0x2003 OP_ClearNPCMarks +0x20d3 OP_ClearRaidNPCMarks +0x1c89 +0x4ee2 +0x2797 OP_LeadershipExpUpdate +0x6da5 OP_ClearLeadershipAbilities +0x0ca6 +0x7717 +0x509d +0x6bee +0x0b04 +0x6097 OP_NewSpawn +0x758c +0x2b10 +0x4d09 +0x0083 OP_SpecialMesg +0x083 OP_TaskDescription +0x3714 OP_TaskActivity +0x08d3 OP_CancelTask +0x39f0 +0x5f7a OP_ItemScriptAdjustment +0x006a +0x06a +0x7465 +0x31c0 +0x14ba +0x25e0 +0x62a0 +0x407a +0x7c88 OP_WhoAllResponse +0x51b8 +0x578c +0x1197 +0x2dd3 +0x333a +0x2925 +0x37b1 OP_MobHealth +0x7314 +0x2404 OP_MobManaUpdate +0x5f5e +0x1c81 OP_MobEnduranceUpdate +0x4a78 +0x37a2 +0x5565 +0x2d09 +0x3141 +0x695e +0x0029 OP_TrackTarget +0x029 +0x1612 +0x3e69 +0x5c59 +0x7e1a OP_GMZoneRequest2 +0x24d9 +0x5089 OP_ZoneEntry +0x61db +0x542f +0x2006 +0x52fa OP_FeignDeath +0x39e8 OP_PickPocket +0x7c2e +0x2cdd +0x5e3a +0x4214 +0x2828 OP_HPUpdate +0x14b8 +0x3791 OP_ManaUpdate +0x0698 +0x5f42 OP_EnduranceUpdate +0x7eb5 +0x73f4 OP_Bug +0x69a4 OP_SendZonepoints +0x57bc OP_InspectRequest +0x71ac OP_InspectAnswer +0x4229 OP_GroupMakeLeader +0x54f7 +0x322b +0x3264 +0x202c +0x29ae +0x7a09 OP_SendLoginInfo +0x5206 +0x7fd2 +0x6259 OP_PostEnterWorld +0x0f70 +0x00d1 +0x0d1 +0x1eac +0x1b54 +0x5e23 +0x7910 +0x152e +0x7555 +0x05ce OP_GroupFollow +0x1649 OP_GroupInvite +0x6110 +0x0641 +0x578f OP_EnterWorld +0x6cb8 +0x6ef5 +0x4c44 OP_ZoneServerInfo +0x4cb4 OP_ZoneUnavail +0x74fb +0xbe6b +0x5ac7 +0x6281 +0x1bc5 OP_SetChatServer +0x48c8 +0x677b +0x6820 +0x2623 +0x69b9 OP_GuildMemberUpdate +0x2dcb +0x5e04 +0x1d3c +0x6060 OP_LFGCommand +0x0340 OP_LFGGetMatchesRequest +0x49a9 OP_LFPCommand +0x4d7d OP_LFPGetMatchesRequest +0x5048 OP_LFGGetMatchesResponse +0x22c6 OP_LFPGetMatchesResponse +0x499e +0x2d4e OP_GuildDemote +0x2009 +0x3b26 +0x69d4 +0x40b1 +0x587d +0x3747 +0x7a66 +0x2f03 +0x01ed +0x36e0 OP_GetGuildMOTD +0x4f1f OP_GetGuildMOTDReply +0x6087 +0x5f92 +0x439a +0x4334 +0x13c2 +0x7cb8 OP_TestBuff +0x17e5 OP_Track +0x5265 +0x1440 +0x7a4b +0x0648 +0x2529 +0x486f OP_GMSummon +0x458e OP_GMEmoteWorld +0x2549 +0x1cfd OP_GMEmoteZone +0x5ca6 OP_CharInventory +0x2710 +0x7291 OP_SpawnDoor +0x7afc +0x1f65 +0x3ddd +0x85fc +0x72df OP_ReadBook +0x3af1 OP_RequestDuel +0x52f7 +0x77b5 OP_TradeRequest +0x70f2 +0x207d +0x384a OP_ConsentResponse +0x5505 OP_TradeBusy +0x0c1e OP_ClickObjectAction +0x51eb +0x466b +0x41a3 +0x0682 +0x1242 +0x261d OP_LoadSpellSet +0x32a6 +0x2c6c OP_AdventureRequest +0x39e5 +0x5648 OP_AdventureDetails +0x5327 OP_LDoNButton +0x4524 +0x5954 OP_RandomNameGenerator +0x327d +0x2945 +0x33d7 +0x2651 +0x3b86 +0x0c6c +0x24d4 +0x4441 +0x4e42 +0x50d8 +0x1afb +0x6bd4 +0x3cb0 OP_AdventureInfoRequest +0x4c54 OP_AdventureInfo +0x7171 OP_AdventureData +0x35e8 +0x7d49 +0x1848 +0x2599 +0x0dab +0x6493 +0x34f2 +0x7d40 +0x0e00 +0x1cf3 +0x71f4 +0x5d18 OP_LeaveAdventure +0x4e25 +0x50c2 +0x400f OP_AdventureFinish +0x6368 +0x6192 +0x3aa4 +0x502e +0x1b01 OP_AdventureUpdate +0x0f24 +0x1015 +0x23a6 +0x5a74 +0x037a +0x7a45 OP_ConsentDeny +0x71bc +0x2382 OP_DenyResponse +0x02a0 +0x1126 OP_VetClaimRequest +0x0668 +0x16d4 OP_VetClaimReply +0x5cea OP_FindPersonRequest +0x0cc3 +0x7e58 OP_FindPersonReply +0x9be3 OP_PickLock +0x0438 +0x3d5c OP_LDoNOpen +0x15e7 +0x368e OP_ItemPacket +0x7331 +0x4936 +0x2c4e +0x78bf OP_DisarmTraps +0x02af OP_SenseTraps +0x65c3 OP_AdventurePointsUpdate +0x0dcb +0x661b OP_AugmentItem +0x5f68 +0x5278 +0x6b53 +0x5dd1 +0x559a OP_WeaponEquip2 +0x2d25 OP_WeaponUnequip2 +0x23c1 OP_WorldClientReady +0x5a62 OP_AdventureStatsRequest +0x7093 OP_AdventureLeaderboardRequest +0x2370 OP_AdventureStatsReply +0x7f79 OP_AdventureLeaderboardReply +0x4eb3 +0x3377 OP_BuffCreate +0x5882 OP_PetBuffWindow +0x4f4b OP_TargetBuffs +0x5961 OP_TributeUpdate +0x4f3e OP_TributeItem +0x5300 OP_TributePointUpdate +0x729b OP_SendTributes +0x4254 OP_TributeInfo +0x79fc OP_SelectTribute +0x073d OP_TributeTimer +0x08bf +0x7697 +0x4b65 +0x51ae +0x51a9 +0x7666 OP_OpenTributeMaster +0x4290 +0x759e OP_DisciplineUpdate +0x01c6 +0x6989 OP_DisciplineTimer +0x58fb OP_TributeMoney +0x7422 +0x0d25 +0x4de1 +0x46d0 +0x4f50 +0x2ddc +0x7441 +0x6a12 +0x29a8 +0x3f7f +0x150b +0x11e3 +0x1ad3 +0x59ca +0x4701 OP_DzAddPlayer +0x1abc OP_DzRemovePlayer +0x405b OP_DzSwapPlayer +0x543d OP_DzMakeLeader +0x14c6 OP_DzPlayerList +0x7f4b OP_DzJoinExpeditionConfirm +0x1950 OP_DzJoinExpeditionReply +0x64b5 +0x0398 +0x7b68 OP_DzListTimers +0x4f7e +0x9119 OP_DzExpeditionInfo +0x205f OP_DzExpeditionList +0xb2e3 OP_DzQuit +0x32f0 OP_DzMemberStatus +0x3de9 OP_DzLeaderStatus +0x5ae4 OP_DzMemberList +0x4d6e +0x4fd0 OP_OnLevelMessage +0x575b +0x7e94 +0x5189 OP_DzExpeditionEndsWarning +0x383c OP_BankerChange +0x791e +0x5c74 OP_RecipesFavorite +0x71b1 +0x20ab +0x025f +0x214a OP_PopupResponse +0x08a6 OP_ItemRecastDelay +0x15a9 OP_PVPLeaderBoardDetailsRequest +0x3707 OP_PVPLeaderBoardRequest +0x04aa OP_PVPLeaderBoardDetailsReply +0x25b7 OP_PVPLeaderBoardReply +0x071f +0x2dee +0x4e62 +0x0c91 +0x18d3 OP_Weblink +0x6f4b OP_PVPStats +0x4b15 +0x6755 +0x5c32 +0x5770 +0x7425 +0x5eed +0x574e +0x11b4 +0x4ed6 +0x0d9f +0x7d23 OP_ClearSurname +0x3fb0 +0xc693 OP_RemoveNimbusEffect +0x7b1e +0x20ae +0x0727 +0x3771 +0x7fe0 +0x4d5e +0x1877 OP_SendGuildTributes +0x649f +0x5f3f +0x5bcb +0x43d2 +0x49ea +0x378d OP_OpenGuildTributeMaster +0x7f8e +0x02bc +0x7dd2 +0x7c1d +0x7a41 +0x7db5 +0x7eec OP_SetChatServer2 +0x0904 OP_CorpseDrag +0x7037 OP_CorpseDrop +0x5e19 OP_TaskActivityComplete +0x4e32 +0x241d OP_TributeToggle +0x756a +0x7745 +0x039d +0x0f50 + +0x66b5 OP_SendAATable +0x0afb OP_AugmentInfo +0x10f6 +0x1013 + +0x6344 OP_RequestTitles +0x2d08 OP_SendTitleList +0x3719 +0x7a48 +0x0a23 OP_AcceptNewTask +0x705b +0x3bc9 OP_LevelAppearance +0x60ef +0x1619 +0x17fd OP_VoiceMacroIn +0x409a OP_VoiceMacroOut +0x4493 OP_WorldComplete +0x6527 OP_SetTitle +0x4c21 OP_SetTitleReply +0x127f OP_CameraEffect +0x0d32 OP_NewTitlesAvailable +0x34a7 OP_WeaponEquip1 +0x34cd +0x5936 OP_SpellEffect +0x241e OP_AutoFire +0x66f0 OP_UpdateAA +0x100e OP_CustomTitles +0x6b65 +0x12f5 +0x7677 OP_Bandolier +0x688f +0x7adf +0x0ed4 +0x243a OP_Barter +0x1a6a +0x5623 +0x43c8 OP_SendAAStats +0x655e +0x1a3e OP_PotionBelt +0x6326 OP_SetStartCity +0x7485 +0x5416 +0x3282 +0x3752 +0x425b +0x27c8 +0x2b19 +0x70ce +0x3165 +0x786b +0x0f26 +0x3500 +0x3d04 +0x5134 OP_GuildBank +0x0521 +0x7850 +0x108b +0x5671 +0x6d2b +0x732f +0x748f OP_GuildManageBanker +0x6858 +0x5e74 +0x3f35 +0x35e9 +0x2056 +0x6922 OP_AdventureMerchantRequest +0x5b72 OP_AdventureMerchantPurchase +0x2f9b OP_AdventureMerchantSell +0x3e47 OP_AdventureMerchantResponse +0x0b7d +0x2818 +0x35bd +0x51df +0x1ff7 +0x3926 +0x6265 +0x4ab0 +0x5e6c +0x1350 +0x6288 +0x7348 +0x48a2 OP_OpenNewTasksWindow +0x3010 +0x45db +0x36e8 OP_AvaliableTask +0x4865 +0x322e +0x7582 +0x5727 OP_TaskMemberList +0x6646 +0x37f2 +0x3444 +0x5ffc +0x5cb5 +0x0119 +0x35b5 +0x6cc6 +0x4926 +0x1b1d +0x7299 +0x0bf1 +0x08b4 +0x7f7a +0x3dab +0x1e7d +0x610a +0x04c8 +0x4811 +0x609e +0x65f0 +0x467f OP_CrystalCountUpdate +0x7aee OP_CrystalCreate +0x2439 OP_CrystalReclaim +0x39c1 +0x555e +0x7c9c +0x2c94 +0x2fc2 +0x2067 +0x059e +0x7f74 +0x68b2 +0x6f2b +0x01d6 +0x5182 +0x1da2 +0x5147 +0x51f8 +0x11f3 +0x0d07 +0x272f +0x413f +0x5968 +0x3e0e OP_DzCompass +0x282a +0x035f OP_GMNameChange +0x4013 +0x0e2f +0x099e +0x4eba OP_CompletedTasks +0x5f1c OP_TaskHistoryRequest +0x3d05 OP_TaskHistoryReply +0x2b8e +0x66d6 +0x0143 +0x6a5d +0x6e61 +0x2b0f +0x46c6 OP_FloatListThing +0x3a8d +0x15e5 +0x7d89 +0x4085 +0x1507 +0x5d93 +0x1669 +0x4664 +0x312d +0x2215 +0x1745 OP_Rewind +0x0cf1 +0x6567 +0x4405 +0x72d8 +0xaaba +0x27f8 OP_AssistGroup +0x7cfb +0x1a32 +0x14fd +0x77bb +0x36d1 +0x6193 +0x184c +0x3c47 +0x4e0b +0x7c15 +0x2ec3 OP_ShroudSelectionWindow +0x2b37 OP_ShroudRequestStats +0x6c04 OP_ShroudRespondStats +0x1cd0 OP_ShroudSelect +0x79da +0x7806 +0x541d OP_ShroudProgress +0x3823 +0x6562 OP_Shroud +0x4b25 +0x2507 +0x3acc +0x006e +0x06e +0x0728 +0x66cd +0x3c54 +0x2e8d +0x4eea +0x5a67 +0x3d20 +0x649c +0x21a6 +0x28bc OP_RespawnWindow +0x0ecb OP_ZonePlayerToBind +0x08d8 +0x7b71 +0x1115 +0x18cb +0x34f4 +0x5f08 +0x5bd2 +0x5052 +0x5e69 +0x2ccc +0x655c +0x6773 OP_CharacterCreateRequest +0x590e OP_VetRewardsAvaliable +0x6b0b +0x555a +0x7786 +0x67e8 +0x6381 +0x5628 +0xb52f +0x6084 +0x2958 OP_GuildUpdateURLAndChannel +0x2301 OP_WorldUnknown001 +0x610b +0x6f8b +0x4d25 OP_InspectMessageUpdate +0x3033 OP_BlockedBuffs +0x0de7 OP_RemoveBlockedBuffs +0x30e5 +0x618c +0x58e6 +0x1456 +0x053c OP_Untargetable +0x71da +0x333f +0x49bc +0x64f2 OP_BuffRemoveRequest +0x6b3d +0x34cb OP_ClearBlockedBuffs +0x5646 +0x7d13 +0x15e0 +0x5710 +0x172b +0x1888 +0x2956 +0x6a68 +0x7631 +0x298e +0x003c +0x03c +0x0b0f +0x5a72 +0x0767 +0x2f1a +0x6c7a +0x1660 +0x344f +0x028b +0x6eea +0x7707 +0x3fb2 +0x289e +0x3342 +0x5892 OP_GroupMentor +0x189c OP_NPCMoveUpdate +0x097b OP_ItemVerifyRequest +0x2115 OP_ItemVerifyReply +0x6411 +0x6471 +0x134a +0x1304 +0x5a79 +0x2dde +0x7d50 +0x1d47 +0x10ec +0x000f +0x00f OP_RestState +0x0f +0x465b +0x2289 OP_ItemViewUnknown +0x023b +0x4223 +0x7261 +0x2af9 +0x19aa +0x66dd OP_GMTrainSkillConfirm +0x4b64 +0x319e +0x1af3 +0x449c +0x8582 #OP_LoginUnknown1 +0x4b8d #OP_LoginUnknown2 +0x298d +0x06c8 +0x4f93 +0x412d +0x001f +0x01f +0x60f6 +0x1a9e +0x798e +0x17b7 +0x3042 +0x61bd +0x1f6e +0x65a6 +0x740d +0x48da +0x20d9 +0x5258 +0x1b5d +0x49f4 +0x7aa9 +0xb350 +0x6e2a +0x5d4e +0x6e4d +0x4ffc +0x1d15 +0x6f23 +0x2296 +0x765b +0x2e01 +0x26dd +0x72d3 +0x6981 +0x3b30 +0x14ac +0x0d92 +0x0001 +0x001 +0x01 +0x09bb +0x9e18 +0x0d9d +0x7f2b +0x3651 +0x645d +0x3af2 +0x4377 +0x39c9 +0x4924 +0x1e50 +0x4683 +0x0276 +0x6dec +0x56c9 +0x3ee6 +0x7121 OP_AltCurrency +0x62ab +0x5d88 +0x05f0 OP_MercenaryAssign +0x6b6d OP_AltCurrencyMerchantRequest +0x61cb OP_AltCurrencyPurchase +0x0165 OP_AltCurrencySell +0x74ec OP_AltCurrencyMerchantReply +0x5409 OP_AltCurrencySellSelection +0x3788 +0x40b6 +0x27a2 +0x532a OP_AltCurrencyReclaim +0x3899 +0x7567 +0x4820 +0x0339 +0x0c12 +0x074d +0x47ba +0x55c8 +0x4c89 +0x18b7 +0x2950 +0x44cb +0x4477 +0x6146 +0x40cf +0x2405 +0x49e2 +0x2aff +0x0bfa +0x26c0 +0x7d39 +0x259f +0x086b +0x6dc1 +0x6f80 +0x042e +0x2ad4 +0x317b +0x73ac +0x18d7 +0x5b8b +0x5c83 +0x1f51 +0x62f7 +0x1c46 +0x2a44 +0x3e7a +0x4374 +0x3b23 +0x1df4 +0x3ed8 +0x4b50 +0x36eb +0x65c7 +0x5620 +0x587e +0x3897 OP_SendFindableNPCs +0x7e62 +0x67ae +0x74f4 +0x4613 +0x2a92 +0x6d6e +0x2c01 +0x1243 +0x133e +0x67fc +0x49e1 OP_HideCorpse +0x0e44 +0x239a +0x1a0a +0x398f +0x1ff4 +0x88a1 +0x74da OP_GroupDisbandOther +0x21b4 OP_GroupLeaderChange +0x62b7 +0x4ced +0x3abb OP_GroupUpdate +0x0f6c OP_GroupDelete +0x0cbc +0x6194 OP_GroupUpdateB +0x7fe6 +0x04d0 +0x7323 OP_GroupAcknowledge +0x1ae5 OP_GroupDisbandYou +0x4d9f +0x70e2 OP_GroupRoles +0x6875 +0x6298 +0x02cf OP_GroupLeadershipAAUpdate +0x22b8 OP_MercenarySuspend2 +0x7bff +0x5512 +0x2b57 +0x1380 +0x2bcb +0x7b89 OP_MercenaryDataUpdateRequest +0x61a4 OP_MercenaryDataUpdate +0x11c1 OP_MercenaryDataRequest +0x72ce OP_MercenaryDataResponse +0x7169 OP_MercenaryHire +0x6e83 OP_MercenaryDismiss +0x31e4 OP_MercenaryTimerRequest +0x0763 OP_MercenaryTimer +0x78f6 +0x1b37 +0x27f2 OP_MercenaryCommand +0x5df8 +0x4333 +0x69ca +0x6e9f +0x4407 OP_MercenarySuspendRequest +0x6f03 OP_MercenarySuspendResponse +0x27a0 OP_MercenaryUnsuspendResponse +0x5f88 +0x2749 +0x038f +0x0e52 +0x20b9 +0x5d26 OP_MercenaryUnknown1 +0x69e7 +0x66b9 +0x0b72 +0x7e6f +0x29ec +0x6248 +0x702b +0x2b4f +0x6e6d +0x1e9f +0x5bd5 +0x4b7f +0x1490 +0x075e +0x4263 +0x1eba +0x4a74 +0x0a37 +0x3289 +0x3171 +0x0114 +0x5148 +0x76c3 +0x09bf +0x356f +0x77a7 +0x479a +0x209f +0x54e6 +0x6c3e +0xee80 +0x40e5 +0x76d9 +0x1dc8 OP_GuildCreate +0x794a +0x35c5 +0x137d +0x004a +0x04a +0x29b4 +0x18f1 +0x17fc +0x4707 OP_ChangeSize +0x3e15 +0x7248 +0x57c6 +0x7679 +0x6c8b +0x14c3 +0x3a02 +0x7900 +0x5688 +0x3a58 +0x75dd +0x39e1 +0x47cb +0x171e +0xdab0 +0x618f +0x27b1 +0x3d0c +0x0d2a +0x8c30 +0x2b42 +0x17f8 +0x1665 +0x059d +0x72c9 +0x675d +0x28e0 +0x61df +0x3ef8 +0x4d59 +0x3763 +0x672f OP_XTargetResponse +0x45be OP_XTargetRequest +0x792c OP_XTargetAutoAddHaters +0x66bf +0x66df +0x2aa7 +0x76c6 +0x6032 +0x3e00 +0x0c13 +0x0a59 +0x393a +0x45ed +0x507f +0x68ba +0x5a63 +0x6fd0 +0x63fd +0x4f09 +0x485d +0x3968 +0x69e1 +0x3d94 +0x0351 +0x5f0a +0x36be +0x59f9 +0x7075 +0x6ee6 +0x2691 +0x3c8b +0x01df +0x218c +0x233b +0x2cf7 +0x1097 +0x1baf +0x6f35 +0x1228 +0x1cef +0x7d28 +0x087f +0x1967 +0x6917 +0x613d +0x37d9 +0x58c7 +0x21ec +0x3424 +0x2036 +0x7ad1 +0x01c3 +0x626e +0x711a +0x5b41 +0x21ba +0x2933 +0x050c +0x51e3 +0x64a3 +0x3146 +0x2aa6 +0x16df +0x2698 +0x21ea +0x796c +0x7bb1 +0x6af6 +0x499a +0x3c44 +0x3cbc +0x6561 +0x12f7 +0x6292 +0x3de0 +0x1409 +0x4604 +0x0ca1 +0x754e +0x4f2b +0x6995 +0x3745 +0x789b +0xcadf +0x4abe +0x6014 +0x7fff +0x6228 +0x10e0 +0x7452 +0x6d9f +0x7f80 +0xb07f +0x6b5c OP_ItemPreview +0x02b4 +0x3bd3 +0x3036 +0x5c3f +0x433d +0x78e2 +0x543f +0x58b4 +0x2563 +0x1820 +0x40be +0x62d6 +0x0d68 +0x6d10 +0x3a32 +0x2fed +0x1303 +0x49df +0x3e24 +0x2b35 +0x0910 +0x3849 +0x6873 +0x15e2 +0x2d85 +0x39bb +0x42e9 +0x6860 +0x15a8 +0x52b5 +0x3311 +0x58df +0x2a7f +0x6573 +0x7a4d +0x7497 +0x1fcc +0x7c23 +0x2d28 +0x5dab +0x005a +0x05a +0x4506 +0x046d +0x36db +0x5a40 +0x4cd9 +0x63d7 +0x48d4 +0x035d +0x11f5 +0x7b84 +0x4f05 +0x7369 +0x7b32 +0x4fe6 +0x6cd0 +0x6770 +0x5c24 +0x063a +0x0d93 +0x4c2a +0x2235 +0x7b95 +0x6a1f +0x46f0 +0x2de2 +0xadd7 +0x2cc6 +0x7db7 +0x7588 +0x4957 +0x6a98 + +0x057b OP_SendMembershipDetails +0x7acc OP_SendMembership +0x431f +0x42c4 +0x05a8 +0x5475 OP_SendMaxCharacters +0x4ad2 +0x03d9 +0x771e +0x2a34 +0x7273 +0x1c9e +0x5f17 +0x37a9 +0x6530 +0x3157 +0x1f5e +0x2bc8 +0x593a +0x1643 +0x16bc +0x1781 +0x53d3 +0x5369 +0x25b3 +0x2fa0 +0x73a9 +0x1595 +0x6b6f +0x65f2 +0x3562 +0x309d +0x4efa +0x1da9 +0x6678 +0x16e8 diff --git a/utils/scripts/opcode_scripts/oplist_to_conf.pl b/utils/scripts/opcode_scripts/oplist_to_conf.pl new file mode 100644 index 000000000..0d808707d --- /dev/null +++ b/utils/scripts/opcode_scripts/oplist_to_conf.pl @@ -0,0 +1,88 @@ +#!/usr/bin/perl + +# File Name: oplist_to_conf.pl +# Converts the Opcode List with Opcode Names from the Spreadsheet into a Patch File. + +# Directions to use this script: +# 1. Copy the opcodes and opcode names columns from the opcode spreadsheet +# for the columns you want to create a new .conf file from into the file. +# 2. Remove the header row entries in the newly created text file and save it. +# 3. Paste the contents of the current patch file in the patch_OLD.conf file. +# 4. Run this script using "perl oplist_to_conf.pl" +# 5. This creates a new .conf file named patch_NEW.conf +# 6. Rename patch_NEW.conf to the desired name and you are all done + + +$stopmessage = "Failed to open file"; +# Open the text file that contains the opcode and opcode name rows for a single client from the opcode list spreadsheet +open OpcodeFile, "<", "opcodelist.txt" or die $stopmessage; +# Open the .conf file to copy from +open PatchFile, "<", "patch_OLD.conf" or die $stopmessage; + +# Read these files into arrays for looping and close the files +my @OpcodeList = ; +my @PatchFile = ; +close(OpcodeFile); +close(PatchFile); + +# Open the new/destination .conf file and clear out file contents +open OpcodeResultFile, ">", "patch_NEW.conf" or die $stopmessage; +print OpcodeResultFile ""; +# Close out the newly cleared .conf file +close(OpcodeResultFile); + +# Open the new/destination .conf file again for appending +open OpcodeResultFile, ">>", "patch_NEW.conf" or die $stopmessage; + +my %PatchHash = (); + +foreach $line (@OpcodeList) +{ + @equalssplit = split(/ /, $line); + $ArraySize = @equalssplit; + if ($ArraySize > 1) + { + my $CurOpcode = ""; + my $CurOpcodeName = ""; + @OpcodeArray = split(//, $equalssplit[0]); + if ($equalssplit[1] =~ /^OP_(.*)/i) + { + $CurOpcodeName = "OP_".$1; + } + foreach $Letter (@OpcodeArray) + { + if ($Letter =~ /[A-Za-z0-9]/) + { + $CurOpcode .= $Letter; + } + } + if ($CurOpcode && $CurOpcodeName) + { + $CurOpcode = lc($CurOpcode); + $PatchHash{ $CurOpcodeName } = $CurOpcode; + #print $CurOpcodeName."=". $CurOpcode."\n"; + } + } +} + +$TabSpace = " "; # Tab +foreach $line (@PatchFile) +{ + $CurLine = $line; + if ($line =~ /^OP_([^\=]+)=([^\s]+)(.*)/i) + { + $NewOpcode = "0x0000"; + $OpcodeName = "OP_".$1; + + if ($PatchHash{$OpcodeName}) + { + $NewOpcode = $PatchHash{$OpcodeName}; + } + + $CurLine = $OpcodeName."=".$NewOpcode.$3."\n"; + } + print OpcodeResultFile $CurLine; +} + + +close(OpcodeResultFile); diff --git a/utils/scripts/opcode_scripts/patch_NEW.conf b/utils/scripts/opcode_scripts/patch_NEW.conf new file mode 100644 index 000000000..148d00ba9 --- /dev/null +++ b/utils/scripts/opcode_scripts/patch_NEW.conf @@ -0,0 +1,661 @@ +# ShowEQ Import Notes: +# ZERO THE FILE first +# perl -pi -e 's/0x[0-9a-fA-F]{4}/0x0000/g' opcodes.conf +# Unknown Mapping: +# OP_Action2 -> OP_Damage +# OP_EnvDamage -> OP_Damage ---> might have been a one time mistake +# Name Differences: +# OP_CancelInvite -> OP_GroupCancelInvite +# OP_GMFind -> OP_FindPersonRequest +# OP_CommonMessage -> OP_ChannelMessage + +OP_Unknown=0x0000 +OP_ExploreUnknown=0x0000 used for unknown explorer + +# world packets +# Required to reach Char Select: +OP_SendLoginInfo=0x7a09 +OP_ApproveWorld=0x7499 +OP_LogServer=0x7ceb +OP_SendCharInfo=0x00d2 +OP_ExpansionInfo=0x590d +OP_GuildsList=0x0000 +OP_EnterWorld=0x578f +OP_PostEnterWorld=0x6259 +OP_World_Client_CRC1=0x12cc +OP_World_Client_CRC2=0x0f13 +OP_SendSpellChecksum=0x0000 +OP_SendSkillCapsChecksum=0x0000 + +# Character Select Related: +OP_SendMaxCharacters=0x5475 +OP_SendMembership=0x7acc +OP_SendMembershipDetails=0x057b +OP_CharacterCreateRequest=0x6773 +OP_CharacterCreate=0x6bbf +OP_DeleteCharacter=0x1808 +OP_RandomNameGenerator=0x5954 +OP_ApproveName=0x56a2 +OP_MOTD=0x0c22 +OP_SetChatServer=0x1bc5 +OP_SetChatServer2=0x7eec +OP_ZoneServerInfo=0x4c44 +OP_WorldComplete=0x4493 +OP_WorldUnknown001=0x2301 +OP_FloatListThing=0x46c6 + +# Reasons for Disconnect: +OP_ZoneUnavail=0x4cb4 +OP_WorldClientReady=0x23c1 +OP_CharacterStillInZone=0x0000 +OP_WorldChecksumFailure=0x0000 +OP_WorldLoginFailed=0x0000 +OP_WorldLogout=0x0000 +OP_WorldLevelTooHigh=0x0000 +OP_CharInacessable=0x0000 +OP_UserCompInfo=0x0000 +OP_SendExeChecksum=0x0000 +OP_SendBaseDataChecksum=0x0000 + +# Zone in opcodes +OP_AckPacket=0x471d +OP_ZoneEntry=0x5089 +OP_ReqNewZone=0x7887 +OP_NewZone=0x1795 +OP_ZoneSpawns=0x5237 +OP_PlayerProfile=0x6506 +OP_TimeOfDay=0x5070 +OP_LevelUpdate=0x1eec +OP_Stamina=0x2a79 +OP_RequestClientZoneChange=0x3fcf +OP_ZoneChange=0x2d18 +OP_LockoutTimerInfo=0x0000 +OP_ZoneServerReady=0x0000 +OP_ZoneInUnknown=0x0000 +OP_LogoutReply=0x0000 +OP_PreLogoutReply=0x0000 + +# Required to fully log in +OP_SpawnAppearance=0x0971 +OP_ChangeSize=0x4707 +OP_TributeUpdate=0x5961 +OP_TributeTimer=0x073d +OP_SendTributes=0x729b +OP_SendGuildTributes=0x1877 +OP_TributeInfo=0x4254 +OP_Weather=0x661e +OP_ReqClientSpawn=0x35fa +OP_SpawnDoor=0x7291 +OP_GroundSpawn=0x6fca +OP_SendZonepoints=0x69a4 +OP_BlockedBuffs=0x3033 +OP_RemoveBlockedBuffs=0x0de7 +OP_ClearBlockedBuffs=0x34cb +OP_WorldObjectsSent=0x5ae2 +OP_SendExpZonein=0x5f8e +OP_SendAATable=0x66b5 +OP_RespondAA=0x7a27 +OP_UpdateAA=0x66f0 +OP_SendAAStats=0x43c8 +OP_AAExpUpdate=0x7d14 +OP_ExpUpdate=0x20ed +OP_HPUpdate=0x2828 +OP_ManaChange=0x43af +OP_TGB=0x0876 +OP_SpecialMesg=0x0083 +OP_GuildMemberList=0x12a6 +OP_GuildMOTD=0x3e13 +OP_CharInventory=0x5ca6 +OP_WearChange=0x7994 +OP_ClientUpdate=0x7dfc +OP_ClientReady=0x345d # 0x422d +OP_SetServerFilter=0x444d + +# Guild Opcodes - Disabled until crashes are resolved in RoF +OP_GetGuildMOTD=0x36e0 # Was 0x35dc +OP_GetGuildMOTDReply=0x4f1f # Was 0x4586 +OP_GuildMemberUpdate=0x69b9 # Was 0x5643 +OP_GuildInvite=0x7099 +OP_GuildRemove=0x1444 +OP_GuildPeace=0x67e3 +OP_SetGuildMOTD=0x0b0b +OP_GuildList=0x507a +OP_GuildWar=0x1ffb +OP_GuildLeader=0x7e09 +OP_GuildDelete=0x3708 +OP_GuildInviteAccept=0x7053 +OP_GuildDemote=0x2d4e +OP_GuildPromote=0x0000 +OP_GuildPublicNote=0x5053 +OP_GuildManageBanker=0x748f # Was 0x0737 +OP_GuildBank=0x5134 # Was 0x10c3 +OP_SetGuildRank=0x0b9c +OP_GuildUpdateURLAndChannel=0x2958 +OP_GuildStatus=0x7326 +OP_GuildCreate=0x1dc8 # or maybe 0x086e +OP_GuildMemberLevelUpdate=0x0000 # Unused? +OP_ZoneGuildList=0x0000 # Unused? +OP_GetGuildsList=0x0000 # Unused? +OP_LFGuild=0x0000 +OP_GuildManageRemove=0x0000 +OP_GuildManageAdd=0x0000 +OP_GuildManageStatus=0x0000 + +# GM/Guide Opcodes +OP_GMServers=0x08c1 +OP_GMBecomeNPC=0x3ae1 +OP_GMZoneRequest=0x62ac +OP_GMZoneRequest2=0x7e1a +OP_GMGoto=0x7d8e +OP_GMSearchCorpse=0x357c +OP_GMHideMe=0x79c5 +OP_GMDelCorpse=0x607e +OP_GMApproval=0x6db5 +OP_GMToggle=0x2097 +OP_GMSummon=0x486f # Was 0x684f +OP_GMEmoteZone=0x1cfd # Was 0x0655 +OP_GMEmoteWorld=0x458e # Was 0x1935 +OP_GMFind=0x4a8f +OP_GMKick=0x26a7 +OP_GMKill=0x51d3 +OP_GMNameChange=0x035f # Was 0x4434 +OP_GMLastName=0x46ce # Was 0x3077 + +# Misc Opcodes +OP_InspectRequest=0x57bc +OP_InspectAnswer=0x71ac +OP_InspectMessageUpdate=0x4d25 +OP_BeginCast=0x318f +OP_ColoredText=0x0000 +OP_ConsentResponse=0x384a +OP_MemorizeSpell=0x217c +OP_SwapSpell=0x0efa +OP_CastSpell=0x1287 +OP_Consider=0x742b +OP_FormattedMessage=0x1024 +OP_SimpleMessage=0x213f +OP_Buff=0x659c +OP_Illusion=0x312a +OP_MoneyOnCorpse=0x5f44 +OP_RandomReply=0x106b +OP_DenyResponse=0x2382 +OP_SkillUpdate=0x004c +OP_GMTrainSkillConfirm=0x66dd # 0x3960 +OP_RandomReq=0x7b10 +OP_Death=0x6517 +OP_GMTraining=0x1966 +OP_GMEndTraining=0x4d6b +OP_GMTrainSkill=0x2a85 +OP_Animation=0x7177 +OP_Begging=0x6703 +OP_Consent=0x1fd1 +OP_ConsentDeny=0x7a45 +OP_AutoFire=0x241e +OP_PetCommands=0x0159 +OP_DeleteSpell=0x52e5 +OP_Surname=0x0423 +OP_ClearSurname=0x7d23 +OP_FaceChange=0x5578 +OP_SenseHeading=0x260a +OP_Action=0x744c +OP_ConsiderCorpse=0x5204 +OP_HideCorpse=0x49e1 +OP_CorpseDrag=0x0904 +OP_CorpseDrop=0x7037 +OP_Bug=0x73f4 +OP_Feedback=0x5602 +OP_Report=0x1414 +OP_Damage=0x6f15 +OP_ChannelMessage=0x2b2d +OP_Assist=0x4478 +OP_AssistGroup=0x27f8 +OP_MoveCoin=0x0bcf +OP_ZonePlayerToBind=0x0ecb +OP_KeyRing=0x6857 +OP_WhoAllRequest=0x65ab +OP_WhoAllResponse=0x7c88 +OP_FriendsWho=0x3956 +OP_ConfirmDelete=0x43a3 +OP_Logout=0x4ac6 +OP_Rewind=0x1745 +OP_TargetCommand=0x58e2 +OP_Hide=0x67fe +OP_Jump=0x2060 +OP_Camp=0x28ec +OP_Emote=0x373b +OP_SetRunMode=0x009f +OP_BankerChange=0x383c +OP_TargetMouse=0x075d +OP_MobHealth=0x37b1 +OP_InitialMobHealth=0x0000 # Unused? +OP_TargetHoTT=0x0272 +OP_XTargetResponse=0x672f +OP_XTargetRequest=0x45be +OP_XTargetAutoAddHaters=0x792c +OP_TargetBuffs=0x4f4b +OP_BuffCreate=0x3377 +OP_BuffRemoveRequest=0x64f2 +OP_DeleteSpawn=0x7280 +OP_AutoAttack=0x109d +OP_AutoAttack2=0x3526 +OP_Consume=0x4b70 +OP_MoveItem=0x32ee +OP_DeleteItem=0x18ad +OP_DeleteCharge=0x01b8 +OP_ItemPacket=0x368e +OP_ItemLinkResponse=0x633c +OP_ItemLinkClick=0x4cef +OP_ItemPreview=0x6b5c +OP_NewSpawn=0x6097 +OP_Track=0x17e5 +OP_TrackTarget=0x0029 +OP_TrackUnknown=0x4577 +OP_ClickDoor=0x3a8f +OP_MoveDoor=0x08e8 +OP_RemoveAllDoors=0x700c +OP_EnvDamage=0x51fd +OP_BoardBoat=0x4211 +OP_Forage=0x5306 +OP_LeaveBoat=0x7617 +OP_ControlBoat=0x0ae7 +OP_SafeFallSuccess=0x2219 +OP_RezzComplete=0x760d +OP_RezzRequest=0x3c21 +OP_RezzAnswer=0x701c +OP_Shielding=0x48c1 +OP_RequestDuel=0x3af1 +OP_MobRename=0x2c57 +OP_AugmentItem=0x661b # Was 0x37cb +OP_WeaponEquip1=0x34a7 +OP_WeaponEquip2=0x559a # Was 0x6022 +OP_WeaponUnequip2=0x2d25 # Was 0x0110 +OP_ApplyPoison=0x31e6 +OP_Save=0x4a39 +OP_TestBuff=0x7cb8 # Was 0x3772 +OP_CustomTitles=0x100e +OP_Split=0x3a54 +OP_YellForHelp=0x4e56 +OP_LoadSpellSet=0x261d +OP_Bandolier=0x7677 +OP_PotionBelt=0x1a3e # Was 0x4d3b +OP_DuelResponse=0x6a46 +OP_DuelResponse2=0x68d3 +OP_SaveOnZoneReq=0x600d +OP_ReadBook=0x72df +OP_Dye=0x23b9 +OP_InterruptCast=0x048c +OP_AAAction=0x424e +OP_LeadershipExpToggle=0x6c55 +OP_LeadershipExpUpdate=0x2797 +OP_PurchaseLeadershipAA=0x0026 +OP_UpdateLeadershipAA=0x026 +OP_MarkNPC=0x5a58 +OP_MarkRaidNPC=0x74bd #unimplemented +OP_ClearNPCMarks=0x2003 +OP_ClearRaidNPCMarks=0x20d3 #unimplemented +OP_DelegateAbility=0x76b8 +OP_SetGroupTarget=0x2814 +OP_Charm=0x5d92 +OP_Stun=0x36a4 +OP_SendFindableNPCs=0x3897 +OP_FindPersonRequest=0x5cea +OP_FindPersonReply=0x7e58 +OP_Sound=0x1a30 +OP_PetBuffWindow=0x5882 +OP_LevelAppearance=0x3bc9 +OP_Translocate=0x6580 +OP_Sacrifice=0x1821 +OP_PopupResponse=0x214a +OP_OnLevelMessage=0x4fd0 +OP_AugmentInfo=0x0afb +OP_Petition=0x5f03 +OP_SomeItemPacketMaybe=0x747c +OP_PVPStats=0x6f4b # Unsure +OP_PVPLeaderBoardRequest=0x3707 +OP_PVPLeaderBoardReply=0x25b7 +OP_PVPLeaderBoardDetailsRequest=0x15a9 +OP_PVPLeaderBoardDetailsReply=0x04aa +OP_RestState=0x00f +OP_RespawnWindow=0x28bc +OP_LDoNButton=0x5327 +OP_SetStartCity=0x6326 # Was 0x2d1b +OP_VoiceMacroIn=0x17fd +OP_VoiceMacroOut=0x409a +OP_ItemViewUnknown=0x2289 +OP_VetRewardsAvaliable=0x590e +OP_VetClaimRequest=0x1126 +OP_VetClaimReply=0x16d4 +OP_DisciplineUpdate=0x759e # Was 0x2f05 +OP_DisciplineTimer=0x6989 # Was 0x5e3f +OP_BecomeCorpse=0x0000 # Unused? +OP_Action2=0x0000 # Unused? +OP_MobUpdate=0x2c84 +OP_NPCMoveUpdate=0x189c +OP_CameraEffect=0x127f +OP_SpellEffect=0x5936 +OP_RemoveNimbusEffect=0xc693 +OP_AltCurrency=0x7121 +OP_AltCurrencyMerchantRequest=0x6b6d +OP_AltCurrencyMerchantReply=0x74ec +OP_AltCurrencyPurchase=0x61cb +OP_AltCurrencySell=0x0165 +OP_AltCurrencySellSelection=0x5409 +OP_AltCurrencyReclaim=0x532a +OP_CrystalCountUpdate=0x467f # Was 0x3f60 +OP_CrystalCreate=0x7aee # Was 0x5a82 +OP_CrystalReclaim=0x2439 # Was 0x7616 +OP_Untargetable=0x053c +OP_IncreaseStats=0x70a3 +OP_Weblink=0x18d3 +#OP_OpenInventory=0x0000 # Likely does not exist in RoF -U +OP_OpenContainer=0x0000 +OP_Marquee=0x0000 + +OP_DzQuit=0xb2e3 +OP_DzListTimers=0x7b68 +OP_DzAddPlayer=0x4701 +OP_DzRemovePlayer=0x1abc +OP_DzSwapPlayer=0x405b +OP_DzMakeLeader=0x543d +OP_DzPlayerList=0x14c6 +OP_DzJoinExpeditionConfirm=0x7f4b +OP_DzJoinExpeditionReply=0x1950 +OP_DzExpeditionInfo=0x9119 +OP_DzExpeditionList=0x205f +OP_DzMemberStatus=0x32f0 +OP_DzLeaderStatus=0x3de9 +OP_DzExpeditionEndsWarning=0x5189 +OP_DzMemberList=0x5ae4 +OP_DzCompass=0x3e0e # Was 0x4f09 +OP_DzChooseZone=0x0000 # Maybe 0x29d6 + +# New Opcodes +OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ? +OP_ManaUpdate=0x3791 +OP_EnduranceUpdate=0x5f42 +OP_MobManaUpdate=0x2404 +OP_MobEnduranceUpdate=0x1c81 + +# Mercenary Opcodes +OP_MercenaryDataUpdateRequest=0x7b89 +OP_MercenaryDataUpdate=0x61a4 +OP_MercenaryDataRequest=0x11c1 +OP_MercenaryDataResponse=0x72ce +OP_MercenaryHire=0x7169 +OP_MercenaryDismiss=0x6e83 +OP_MercenaryTimerRequest=0x31e4 +OP_MercenaryTimer=0x0763 +OP_MercenaryUnknown1=0x5d26 +OP_MercenaryCommand=0x27f2 +OP_MercenarySuspendRequest=0x4407 +OP_MercenarySuspendResponse=0x6f03 +OP_MercenaryUnsuspendResponse=0x27a0 + +# Looting +OP_LootRequest=0x0adf +OP_EndLootRequest=0x30f7 +OP_LootItem=0x4dc9 +OP_LootComplete=0x55c4 + +# bazaar trader stuff: +OP_BazaarSearch=0x39d6 +OP_TraderDelItem=0x0000 +OP_BecomeTrader=0x61b3 +OP_TraderShop=0x31df +OP_Trader=0x4ef5 # Was 0x6790 +OP_TraderBuy=0x0000 +OP_Barter=0x243a +OP_ShopItem=0x0000 +OP_BazaarInspect=0x0000 +OP_Bazaar=0x0000 +OP_TraderItemUpdate=0x0000 + +# pc/npc trading +OP_TradeRequest=0x77b5 +OP_TradeAcceptClick=0x69e2 +OP_TradeRequestAck=0x14bf +OP_TradeCoins=0x4206 +OP_FinishTrade=0x3993 +OP_CancelTrade=0x354c +OP_TradeMoneyUpdate=0x68c2 +OP_MoneyUpdate=0x640c +OP_TradeBusy=0x5505 + +# Sent after canceling trade or after closing tradeskill object +OP_FinishWindow=0x7349 +OP_FinishWindow2=0x40ef + +# Sent on Live for what seems to be item existance verification +# Ex. Before Right Click Effect happens from items +OP_ItemVerifyRequest=0x097b +OP_ItemVerifyReply=0x2115 + +# merchant stuff +OP_ShopPlayerSell=0x1901 +OP_ShopRequest=0x4fed +OP_ShopEnd=0x30a8 +OP_ShopEndConfirm=0x3196 +OP_ShopPlayerBuy=0x04c +OP_ShopDelItem=0x724f + +# tradeskill stuff: +OP_ClickObject=0x4aa1 +OP_ClickObjectAction=0x0c1e +OP_ClearObject=0x7a11 +OP_RecipeDetails=0x40d7 +OP_RecipesFavorite=0x5c74 +OP_RecipesSearch=0x1db6 +OP_RecipeReply=0x6e02 +OP_RecipeAutoCombine=0x6261 +OP_TradeSkillCombine=0x579a + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x378d +OP_OpenTributeMaster=0x7666 # Was 0x40f5 +OP_SelectTribute=0x79fc +OP_TributeItem=0x4f3e +OP_TributeMoney=0x58fb # Was 0x6fed +OP_TributeToggle=0x241d +OP_TributePointUpdate=0x5300 +OP_TributeNPC=0x0000 +OP_GuildTributeInfo=0x0000 +OP_OpenTributeReply=0x0000 +OP_GuildTributeStatus=0x0000 + +# Adventure packets: +OP_LeaveAdventure=0x5d18 +OP_AdventureFinish=0x400f +OP_AdventureInfoRequest=0x3cb0 +OP_AdventureInfo=0x4c54 +OP_AdventureRequest=0x2c6c +OP_AdventureDetails=0x5648 +OP_AdventureData=0x7171 +OP_AdventureUpdate=0x1b01 +OP_AdventureMerchantRequest=0x6922 # Was 654d +OP_AdventureMerchantResponse=0x3e47 # Was 7949 +OP_AdventureMerchantPurchase=0x5b72 # Was 155a +OP_AdventureMerchantSell=0x2f9b # Was 389c +OP_AdventurePointsUpdate=0x65c3 # Was 7589 +OP_AdventureStatsRequest=0x5a62 +OP_AdventureStatsReply=0x2370 +OP_AdventureLeaderboardRequest=0x7093 +OP_AdventureLeaderboardReply=0x7f79 + +# Group Opcodes +OP_GroupDisband=0x4c10 +OP_GroupInvite=0x1649 +OP_GroupFollow=0x05ce +OP_GroupUpdate=0x3abb +OP_GroupUpdateB=0x6194 +OP_GroupCancelInvite=0x0000 +OP_GroupAcknowledge=0x7323 +OP_GroupDelete=0x0f6c +OP_CancelInvite=0x32c2 +OP_GroupFollow2=0x2a50 +OP_GroupInvite2=0x6c65 +OP_GroupDisbandYou=0x1ae5 +OP_GroupDisbandOther=0x74da +OP_GroupLeaderChange=0x21b4 +OP_GroupRoles=0x70e2 +OP_GroupMakeLeader=0x4229 +OP_DoGroupLeadershipAbility=0x1fb5 +OP_GroupLeadershipAAUpdate=0x02cf +OP_GroupMentor=0x5892 +OP_InspectBuffs=0x486c + +# LFG/LFP Opcodes +OP_LFGCommand=0x6060 +OP_LFGGetMatchesRequest=0x0340 +OP_LFGGetMatchesResponse=0x5048 +OP_LFPGetMatchesRequest=0x4d7d +OP_LFPGetMatchesResponse=0x22c6 +OP_LFPCommand=0x49a9 +OP_LFGAppearance=0x0000 +OP_LFGResponse=0x0000 + +# Raid Opcodes +OP_RaidInvite=0x55ac +OP_RaidUpdate=0x3973 +OP_RaidJoin=0x0000 + +# Button-push commands +OP_Taunt=0x2703 +OP_CombatAbility=0x3eba +OP_SenseTraps=0x02af # Was 0x2ee0 +OP_PickPocket=0x39e8 +OP_DisarmTraps=0x78bf +OP_Disarm=0x5ec8 +OP_Sneak=0x5d55 +OP_Fishing=0x1e2a +OP_InstillDoubt=0x640e +OP_FeignDeath=0x52fa +OP_Mend=0x0ecf +OP_Bind_Wound=0x0386 +OP_LDoNOpen=0x3d5c + +# Task packets +OP_TaskDescription=0x083 +OP_TaskActivity=0x3714 +OP_CompletedTasks=0x4eba +OP_TaskActivityComplete=0x5e19 +OP_AcceptNewTask=0x0a23 +OP_CancelTask=0x08d3 +OP_TaskMemberList=0x5727 # Was 0x1656 +OP_OpenNewTasksWindow=0x48a2 # Was 0x11de +OP_AvaliableTask=0x36e8 # Was 0x2377 +OP_TaskHistoryRequest=0x5f1c +OP_TaskHistoryReply=0x3d05 +OP_DeclineAllTasks=0x0000 + +# Title opcodes +OP_NewTitlesAvailable=0x0d32 +OP_RequestTitles=0x6344 +OP_SendTitleList=0x2d08 +OP_SetTitle=0x6527 +OP_SetTitleReply=0x4c21 + +# mail opcodes +OP_Command=0x0000 +OP_MailboxHeader=0x0000 +OP_MailHeader=0x0000 +OP_MailBody=0x0000 +OP_NewMail=0x0000 +OP_SentConfirm=0x0000 + +########### Below this point should not be needed ########### + +# This section are all unknown in Titanium +OP_ForceFindPerson=0x0000 +OP_LocInfo=0x0000 +OP_ReloadUI=0x0000 +OP_ItemName=0x0000 +OP_ItemLinkText=0x0000 +OP_MultiLineMsg=0x0000 +OP_MendHPUpdate=0x0000 +OP_TargetReject=0x0000 +OP_SafePoint=0x0000 +OP_ApproveZone=0x0000 +OP_ZoneComplete=0x0000 +OP_ClientError=0x0000 +OP_DumpName=0x0000 +OP_Heartbeat=0x0000 +OP_CrashDump=0x0000 +OP_LoginComplete=0x0000 + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 +OP_PlayMP3=0x0000 +OP_ReclaimCrystals=0x0000 +OP_DynamicWall=0x0000 +OP_OpenDiscordMerchant=0x0000 +OP_DiscordMerchantInventory=0x0000 +OP_GiveMoney=0x0000 +OP_RequestKnowledgeBase=0x0000 +OP_KnowledgeBase=0x0000 +OP_SlashAdventure=0x0000 # /adventure +OP_BecomePVPPrompt=0x0000 +OP_MoveLogRequest=0x0000 # gone I think +OP_MoveLogDisregard=0x0000 # gone I think + +# named unknowns, to make looking for real unknown easier +OP_AnnoyingZoneUnknown=0x0000 +OP_Some6ByteHPUpdate=0x0000 seems to happen when you target group members +OP_QueryResponseThing=0x0000 + + +# realityincarnate: these are just here to stop annoying several thousand byte packet dumps +#OP_LoginUnknown1=0x46d3 # OP_SendSpellChecksum +#OP_LoginUnknown2=0x040b # OP_SendSkillCapsChecksum + +# Petition Opcodes +OP_PetitionSearch=0x0000 search term for petition +OP_PetitionSearchResults=0x0000 (list of?) matches from search +OP_PetitionSearchText=0x0000 text results of search + +OP_PetitionUpdate=0x0000 +OP_PetitionCheckout=0x0000 +OP_PetitionCheckIn=0x0000 +OP_PetitionQue=0x0000 +OP_PetitionUnCheckout=0x0000 +OP_PetitionDelete=0x0000 +OP_DeletePetition=0x0000 +OP_PetitionResolve=0x0000 +OP_PDeletePetition=0x0000 +OP_PetitionBug=0x0000 +OP_PetitionRefresh=0x0000 +OP_PetitionCheckout2=0x0000 +OP_PetitionViewPetition=0x0000 + +# Login opcodes +OP_SessionReady=0x0000 +OP_Login=0x0000 +OP_ServerListRequest=0x0000 +OP_PlayEverquestRequest=0x0000 +OP_PlayEverquestResponse=0x0000 +OP_ChatMessage=0x0000 +OP_LoginAccepted=0x0000 +OP_ServerListResponse=0x0000 +OP_Poll=0x0000 +OP_EnterChat=0x0000 +OP_PollResponse=0x0000 + +# raw opcodes +OP_RAWSessionRequest=0x0000 +OP_RAWSessionResponse=0x0000 +OP_RAWCombined=0x0000 +OP_RAWSessionDisconnect=0x0000 +OP_RAWKeepAlive=0x0000 +OP_RAWSessionStatRequest=0x0000 +OP_RAWSessionStatResponse=0x0000 +OP_RAWPacket=0x0000 +OP_RAWFragment=0x0000 +OP_RAWOutOfOrderAck=0x0000 +OP_RAWAck=0x0000 +OP_RAWAppCombined=0x0000 +OP_RAWOutOfSession=0x0000 + +# we need to document the differences between these packets to make identifying them easier +OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs +OP_InitialHPUpdate=0x0000 + +OP_ItemRecastDelay=0x08a6 diff --git a/utils/scripts/opcode_scripts/patch_OLD.conf b/utils/scripts/opcode_scripts/patch_OLD.conf new file mode 100644 index 000000000..4bc1f9097 --- /dev/null +++ b/utils/scripts/opcode_scripts/patch_OLD.conf @@ -0,0 +1,661 @@ +# ShowEQ Import Notes: +# ZERO THE FILE first +# perl -pi -e 's/0x[0-9a-fA-F]{4}/0x0000/g' opcodes.conf +# Unknown Mapping: +# OP_Action2 -> OP_Damage +# OP_EnvDamage -> OP_Damage ---> might have been a one time mistake +# Name Differences: +# OP_CancelInvite -> OP_GroupCancelInvite +# OP_GMFind -> OP_FindPersonRequest +# OP_CommonMessage -> OP_ChannelMessage + +OP_Unknown=0x0000 +OP_ExploreUnknown=0x0000 used for unknown explorer + +# world packets +# Required to reach Char Select: +OP_SendLoginInfo=0x7a09 +OP_ApproveWorld=0x7499 +OP_LogServer=0x7ceb +OP_SendCharInfo=0x00d2 +OP_ExpansionInfo=0x590d +OP_GuildsList=0x7056 +OP_EnterWorld=0x0641 +OP_PostEnterWorld=0x6259 +OP_World_Client_CRC1=0x12cc +OP_World_Client_CRC2=0x0f13 +OP_SendSpellChecksum=0x0000 +OP_SendSkillCapsChecksum=0x0000 + +# Character Select Related: +OP_SendMaxCharacters=0x05a8 +OP_SendMembership=0x057b +OP_SendMembershipDetails=0x6a98 +OP_CharacterCreateRequest=0x655c +OP_CharacterCreate=0x6bbf +OP_DeleteCharacter=0x1808 +OP_RandomNameGenerator=0x5954 +OP_ApproveName=0x56a2 +OP_MOTD=0x0c22 +OP_SetChatServer=0x1bc5 +OP_SetChatServer2=0x7db5 +OP_ZoneServerInfo=0x6ef5 +OP_WorldComplete=0x4493 +OP_WorldUnknown001=0x2958 +OP_FloatListThing=0x46c6 + +# Reasons for Disconnect: +OP_ZoneUnavail=0x4c44 +OP_WorldClientReady=0x23c1 +OP_CharacterStillInZone=0x0000 +OP_WorldChecksumFailure=0x0000 +OP_WorldLoginFailed=0x0000 +OP_WorldLogout=0x0000 +OP_WorldLevelTooHigh=0x0000 +OP_CharInacessable=0x0000 +OP_UserCompInfo=0x0000 +OP_SendExeChecksum=0x0000 +OP_SendBaseDataChecksum=0x0000 + +# Zone in opcodes +OP_AckPacket=0x471d +OP_ZoneEntry=0x5089 +OP_ReqNewZone=0x7887 +OP_NewZone=0x1795 +OP_ZoneSpawns=0x5237 +OP_PlayerProfile=0x6506 +OP_TimeOfDay=0x5070 +OP_LevelUpdate=0x1eec +OP_Stamina=0x2a79 +OP_RequestClientZoneChange=0x3fcf +OP_ZoneChange=0x2d18 +OP_LockoutTimerInfo=0x0000 +OP_ZoneServerReady=0x0000 +OP_ZoneInUnknown=0x0000 +OP_LogoutReply=0x0000 +OP_PreLogoutReply=0x0000 + +# Required to fully log in +OP_SpawnAppearance=0x0971 +OP_ChangeSize=0x4707 +OP_TributeUpdate=0x5961 +OP_TributeTimer=0x073d +OP_SendTributes=0x729b +OP_SendGuildTributes=0x4d5e +OP_TributeInfo=0x4254 +OP_Weather=0x661e +OP_ReqClientSpawn=0x35fa +OP_SpawnDoor=0x7291 +OP_GroundSpawn=0x6fca +OP_SendZonepoints=0x69a4 +OP_BlockedBuffs=0x4d25 +OP_RemoveBlockedBuffs=0x3033 +OP_ClearBlockedBuffs=0x6b3d +OP_WorldObjectsSent=0x5ae2 +OP_SendExpZonein=0x5f8e +OP_SendAATable=0x66b5 +OP_RespondAA=0x7a27 +OP_UpdateAA=0x66f0 +OP_SendAAStats=0x43c8 +OP_AAExpUpdate=0x7e92 +OP_ExpUpdate=0x20ed +OP_HPUpdate=0x2828 +OP_ManaChange=0x1287 +OP_TGB=0x0000 +OP_SpecialMesg=0x0000 +OP_GuildMemberList=0x0e48 +OP_GuildMOTD=0x3e13 +OP_CharInventory=0x5ca6 +OP_WearChange=0x7994 +OP_ClientUpdate=0x7dfc +OP_ClientReady=0x345d # 0x422d +OP_SetServerFilter=0x444d + +# Guild Opcodes - Disabled until crashes are resolved in RoF +OP_GetGuildMOTD=0x36e0 # Was 0x35dc +OP_GetGuildMOTDReply=0x4f1f # Was 0x4586 +OP_GuildMemberUpdate=0x69b9 # Was 0x5643 +OP_GuildInvite=0x7099 +OP_GuildRemove=0x1444 +OP_GuildPeace=0x084e +OP_SetGuildMOTD=0x0b0b +OP_GuildList=0x0000 +OP_GuildWar=0x46ce +OP_GuildLeader=0x2f3e +OP_GuildDelete=0x3708 +OP_GuildInviteAccept=0x7053 +OP_GuildDemote=0x2d4e +OP_GuildPromote=0x0000 +OP_GuildPublicNote=0x5053 +OP_GuildManageBanker=0x748f # Was 0x0737 +OP_GuildBank=0x5134 # Was 0x10c3 +OP_SetGuildRank=0x0b9c +OP_GuildUpdateURLAndChannel=0x6084 +OP_GuildStatus=0x7326 +OP_GuildCreate=0x1dc8 # or maybe 0x086e +OP_GuildMemberLevelUpdate=0x0000 # Unused? +OP_ZoneGuildList=0x0000 # Unused? +OP_GetGuildsList=0x0000 # Unused? +OP_LFGuild=0x0000 +OP_GuildManageRemove=0x0000 +OP_GuildManageAdd=0x0000 +OP_GuildManageStatus=0x0000 + +# GM/Guide Opcodes +OP_GMServers=0x08c1 +OP_GMBecomeNPC=0x3ae1 +OP_GMZoneRequest=0x62ac +OP_GMZoneRequest2=0x7e1a +OP_GMGoto=0x7d8e +OP_GMSearchCorpse=0x46b1 +OP_GMHideMe=0x79c5 +OP_GMDelCorpse=0x607e +OP_GMApproval=0x6db5 +OP_GMToggle=0x2097 +OP_GMSummon=0x486f # Was 0x684f +OP_GMEmoteZone=0x1cfd # Was 0x0655 +OP_GMEmoteWorld=0x458e # Was 0x1935 +OP_GMFind=0x4a8f +OP_GMKick=0x26a7 +OP_GMKill=0x51d3 +OP_GMNameChange=0x035f # Was 0x4434 +OP_GMLastName=0x16ce # Was 0x3077 + +# Misc Opcodes +OP_InspectRequest=0x57bc +OP_InspectAnswer=0x71ac +OP_InspectMessageUpdate=0x6f8b +OP_BeginCast=0x318f +OP_ColoredText=0x0000 +OP_ConsentResponse=0x384a +OP_MemorizeSpell=0x6a0d +OP_SwapSpell=0x0efa +OP_CastSpell=0x4466 +OP_Consider=0x742b +OP_FormattedMessage=0x1024 +OP_SimpleMessage=0x213f +OP_Buff=0x3a54 +OP_Illusion=0x312a +OP_MoneyOnCorpse=0x5f44 +OP_RandomReply=0x106b +OP_DenyResponse=0x2382 +OP_SkillUpdate=0x2264 +OP_GMTrainSkillConfirm=0x19aa # 0x3960 +OP_RandomReq=0x7b10 +OP_Death=0x6517 +OP_GMTraining=0x1966 +OP_GMEndTraining=0x4d6b +OP_GMTrainSkill=0x2a85 +OP_Animation=0x7177 +OP_Begging=0x6703 +OP_Consent=0x1fd1 +OP_ConsentDeny=0x7a45 +OP_AutoFire=0x241e +OP_PetCommands=0x0159 +OP_DeleteSpell=0x52e5 +OP_Surname=0x0423 +OP_ClearSurname=0x7d23 +OP_FaceChange=0x5578 +OP_SenseHeading=0x217c +OP_Action=0x744c +OP_ConsiderCorpse=0x5204 +OP_HideCorpse=0x67fc +OP_CorpseDrag=0x7eec +OP_CorpseDrop=0x0904 +OP_Bug=0x73f4 +OP_Feedback=0x5602 +OP_Report=0x1414 +OP_Damage=0x6f15 +OP_ChannelMessage=0x2b2d +OP_Assist=0x4478 +OP_AssistGroup=0x27f8 +OP_MoveCoin=0x0bcf +OP_ZonePlayerToBind=0x0ecb +OP_KeyRing=0x6857 +OP_WhoAllRequest=0x65ab +OP_WhoAllResponse=0x407a +OP_FriendsWho=0x3956 +OP_ConfirmDelete=0x43a3 +OP_Logout=0x4ac6 +OP_Rewind=0x1745 +OP_TargetCommand=0x58e2 +OP_Hide=0x5d55 +OP_Jump=0x2060 +OP_Camp=0x28ec +OP_Emote=0x373b +OP_SetRunMode=0x009f +OP_BankerChange=0x383c +OP_TargetMouse=0x075d +OP_MobHealth=0x2dd3 +OP_InitialMobHealth=0x0000 # Unused? +OP_TargetHoTT=0x486c +OP_XTargetResponse=0x4d59 +OP_XTargetRequest=0x3763 +OP_XTargetAutoAddHaters=0x672f +OP_TargetBuffs=0x4f4b +OP_BuffCreate=0x3377 +OP_BuffRemoveRequest=0x49bc +OP_DeleteSpawn=0x7280 +OP_AutoAttack=0x109d +OP_AutoAttack2=0x3526 +OP_Consume=0x4b70 +OP_MoveItem=0x32ee +OP_DeleteItem=0x18ad +OP_DeleteCharge=0x01b8 +OP_ItemPacket=0x368e +OP_ItemLinkResponse=0x70c0 +OP_ItemLinkClick=0x4cef +OP_ItemPreview=0x7f80 +OP_NewSpawn=0x0b04 +OP_Track=0x17e5 +OP_TrackTarget=0x0029 +OP_TrackUnknown=0x0f83 +OP_ClickDoor=0x3a8f +OP_MoveDoor=0x08e8 +OP_RemoveAllDoors=0x700c +OP_EnvDamage=0x51fd +OP_BoardBoat=0x31e6 +OP_Forage=0x5306 +OP_LeaveBoat=0x4211 +OP_ControlBoat=0x0ae7 +OP_SafeFallSuccess=0x6dbc +OP_RezzComplete=0x760d +OP_RezzRequest=0x3c21 +OP_RezzAnswer=0x701c +OP_Shielding=0x48c1 +OP_RequestDuel=0x3af1 +OP_MobRename=0x2c57 +OP_AugmentItem=0x661b # Was 0x37cb +OP_WeaponEquip1=0x34a7 +OP_WeaponEquip2=0x559a # Was 0x6022 +OP_WeaponUnequip2=0x2d25 # Was 0x0110 +OP_ApplyPoison=0x1b0c +OP_Save=0x4a39 +OP_TestBuff=0x7cb8 # Was 0x3772 +OP_CustomTitles=0x100e +OP_Split=0x0522 +OP_YellForHelp=0x4e56 +OP_LoadSpellSet=0x261d +OP_Bandolier=0x7677 +OP_PotionBelt=0x1a3e # Was 0x4d3b +OP_DuelResponse=0x6a46 +OP_DuelResponse2=0x68d3 +OP_SaveOnZoneReq=0x2c7a +OP_ReadBook=0x72df +OP_Dye=0x23b9 +OP_InterruptCast=0x048c +OP_AAAction=0x424e +OP_LeadershipExpToggle=0x74bd +OP_LeadershipExpUpdate=0x4ee2 +OP_PurchaseLeadershipAA=0x6c55 +OP_UpdateLeadershipAA=0x0026 +OP_MarkNPC=0x5a58 +OP_MarkRaidNPC=0x0000 #unimplemented +OP_ClearNPCMarks=0x0272 +OP_ClearRaidNPCMarks=0x0000 #unimplemented +OP_DelegateAbility=0x4c9d +OP_SetGroupTarget=0x026 +OP_Charm=0x5d92 +OP_Stun=0x36a4 +OP_SendFindableNPCs=0x587e +OP_FindPersonRequest=0x5cea +OP_FindPersonReply=0x7e58 +OP_Sound=0x1a30 +OP_PetBuffWindow=0x5882 +OP_LevelAppearance=0x3bc9 +OP_Translocate=0x6580 +OP_Sacrifice=0x1821 +OP_PopupResponse=0x214a +OP_OnLevelMessage=0x4fd0 +OP_AugmentInfo=0x0afb +OP_Petition=0x4101 +OP_SomeItemPacketMaybe=0x747c +OP_PVPStats=0x6f4b # Unsure +OP_PVPLeaderBoardRequest=0x3707 +OP_PVPLeaderBoardReply=0x25b7 +OP_PVPLeaderBoardDetailsRequest=0x15a9 +OP_PVPLeaderBoardDetailsReply=0x04aa +OP_RestState=0x000f +OP_RespawnWindow=0x28bc +OP_LDoNButton=0x5327 +OP_SetStartCity=0x6326 # Was 0x2d1b +OP_VoiceMacroIn=0x17fd +OP_VoiceMacroOut=0x409a +OP_ItemViewUnknown=0x465b +OP_VetRewardsAvaliable=0x6773 +OP_VetClaimRequest=0x1126 +OP_VetClaimReply=0x16d4 +OP_DisciplineUpdate=0x759e # Was 0x2f05 +OP_DisciplineTimer=0x6989 # Was 0x5e3f +OP_BecomeCorpse=0x0000 # Unused? +OP_Action2=0x0000 # Unused? +OP_MobUpdate=0x2c84 +OP_NPCMoveUpdate=0x5892 +OP_CameraEffect=0x127f +OP_SpellEffect=0x5936 +OP_RemoveNimbusEffect=0xc693 +OP_AltCurrency=0x3ee6 +OP_AltCurrencyMerchantRequest=0x05f0 +OP_AltCurrencyMerchantReply=0x0165 +OP_AltCurrencyPurchase=0x6b6d +OP_AltCurrencySell=0x61cb +OP_AltCurrencySellSelection=0x74ec +OP_AltCurrencyReclaim=0x27a2 +OP_CrystalCountUpdate=0x467f # Was 0x3f60 +OP_CrystalCreate=0x7aee # Was 0x5a82 +OP_CrystalReclaim=0x2439 # Was 0x7616 +OP_Untargetable=0x1456 +OP_IncreaseStats=0x70a3 +OP_Weblink=0x18d3 +#OP_OpenInventory=0x0000 # Likely does not exist in RoF -U +OP_OpenContainer=0x0000 +OP_Marquee=0x0000 + +OP_DzQuit=0xb2e3 +OP_DzListTimers=0x7b68 +OP_DzAddPlayer=0x4701 +OP_DzRemovePlayer=0x1abc +OP_DzSwapPlayer=0x405b +OP_DzMakeLeader=0x543d +OP_DzPlayerList=0x14c6 +OP_DzJoinExpeditionConfirm=0x7f4b +OP_DzJoinExpeditionReply=0x1950 +OP_DzExpeditionInfo=0x9119 +OP_DzExpeditionList=0x205f +OP_DzMemberStatus=0x32f0 +OP_DzLeaderStatus=0x3de9 +OP_DzExpeditionEndsWarning=0x5189 +OP_DzMemberList=0x0000 +OP_DzCompass=0x3e0e # Was 0x4f09 +OP_DzChooseZone=0x0000 # Maybe 0x29d6 + +# New Opcodes +OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ? +OP_ManaUpdate=0x3791 +OP_EnduranceUpdate=0x5f42 +OP_MobManaUpdate=0x2925 +OP_MobEnduranceUpdate=0x7314 + +# Mercenary Opcodes +OP_MercenaryDataUpdateRequest=0x2bcb +OP_MercenaryDataUpdate=0x7b89 +OP_MercenaryDataRequest=0x61a4 +OP_MercenaryDataResponse=0x11c1 +OP_MercenaryHire=0x72ce +OP_MercenaryDismiss=0x7169 +OP_MercenaryTimerRequest=0x6e83 +OP_MercenaryTimer=0x31e4 +OP_MercenaryUnknown1=0x20b9 +OP_MercenaryCommand=0x1b37 +OP_MercenarySuspendRequest=0x6e9f +OP_MercenarySuspendResponse=0x4407 +OP_MercenaryUnsuspendResponse=0x6f03 + +# Looting +OP_LootRequest=0x0adf +OP_EndLootRequest=0x30f7 +OP_LootItem=0x4dc9 +OP_LootComplete=0x55c4 + +# bazaar trader stuff: +OP_BazaarSearch=0x39d6 +OP_TraderDelItem=0x0000 +OP_BecomeTrader=0x61b3 +OP_TraderShop=0x5eca +OP_Trader=0x4ef5 # Was 0x6790 +OP_TraderBuy=0x0000 +OP_Barter=0x243a +OP_ShopItem=0x0000 +OP_BazaarInspect=0x0000 +OP_Bazaar=0x0000 +OP_TraderItemUpdate=0x0000 + +# pc/npc trading +OP_TradeRequest=0x77b5 +OP_TradeAcceptClick=0x69e2 +OP_TradeRequestAck=0x14bf +OP_TradeCoins=0x4206 +OP_FinishTrade=0x3993 +OP_CancelTrade=0x354c +OP_TradeMoneyUpdate=0x68c2 +OP_MoneyUpdate=0x640c +OP_TradeBusy=0x5505 + +# Sent after canceling trade or after closing tradeskill object +OP_FinishWindow=0x7349 +OP_FinishWindow2=0x40ef + +# Sent on Live for what seems to be item existance verification +# Ex. Before Right Click Effect happens from items +OP_ItemVerifyRequest=0x189c +OP_ItemVerifyReply=0x097b + +# merchant stuff +OP_ShopPlayerSell=0x3de3 +OP_ShopRequest=0x4fed +OP_ShopEnd=0x30a8 +OP_ShopEndConfirm=0x3196 +OP_ShopPlayerBuy=0x004c +OP_ShopDelItem=0x724f + +# tradeskill stuff: +OP_ClickObject=0x4aa1 +OP_ClickObjectAction=0x0c1e +OP_ClearObject=0x7a11 +OP_RecipeDetails=0x6e02 +OP_RecipesFavorite=0x5c74 +OP_RecipesSearch=0x6290 +OP_RecipeReply=0x1db6 +OP_RecipeAutoCombine=0x40d7 +OP_TradeSkillCombine=0x579a + +# Tribute Packets: +OP_OpenGuildTributeMaster=0x49ea +OP_OpenTributeMaster=0x7666 # Was 0x40f5 +OP_SelectTribute=0x79fc +OP_TributeItem=0x4f3e +OP_TributeMoney=0x58fb # Was 0x6fed +OP_TributeToggle=0x4e32 +OP_TributePointUpdate=0x5300 +OP_TributeNPC=0x0000 +OP_GuildTributeInfo=0x0000 +OP_OpenTributeReply=0x0000 +OP_GuildTributeStatus=0x0000 + +# Adventure packets: +OP_LeaveAdventure=0x5d18 +OP_AdventureFinish=0x400f +OP_AdventureInfoRequest=0x3cb0 +OP_AdventureInfo=0x4c54 +OP_AdventureRequest=0x2c6c +OP_AdventureDetails=0x5648 +OP_AdventureData=0x7171 +OP_AdventureUpdate=0x1b01 +OP_AdventureMerchantRequest=0x6922 # Was 654d +OP_AdventureMerchantResponse=0x3e47 # Was 7949 +OP_AdventureMerchantPurchase=0x5b72 # Was 155a +OP_AdventureMerchantSell=0x2f9b # Was 389c +OP_AdventurePointsUpdate=0x65c3 # Was 7589 +OP_AdventureStatsRequest=0x5a62 +OP_AdventureStatsReply=0x2370 +OP_AdventureLeaderboardRequest=0x7093 +OP_AdventureLeaderboardReply=0x7f79 + +# Group Opcodes +OP_GroupDisband=0x4c10 +OP_GroupInvite=0x1649 +OP_GroupFollow=0x05ce +OP_GroupUpdate=0x4ced +OP_GroupUpdateB=0x0cbc +OP_GroupCancelInvite=0x0000 +OP_GroupAcknowledge=0x04d0 +OP_GroupDelete=0x3abb +OP_CancelInvite=0x32c2 +OP_GroupFollow2=0x2a50 +OP_GroupInvite2=0x6c65 +OP_GroupDisbandYou=0x7323 +OP_GroupDisbandOther=0x88a1 +OP_GroupLeaderChange=0x74da +OP_GroupRoles=0x4d9f +OP_GroupMakeLeader=0x4229 +OP_DoGroupLeadershipAbility=0x6eae +OP_GroupLeadershipAAUpdate=0x6298 +OP_GroupMentor=0x3342 +OP_InspectBuffs=0x0000 + +# LFG/LFP Opcodes +OP_LFGCommand=0x6060 +OP_LFGGetMatchesRequest=0x0340 +OP_LFGGetMatchesResponse=0x5048 +OP_LFPGetMatchesRequest=0x4d7d +OP_LFPGetMatchesResponse=0x22c6 +OP_LFPCommand=0x49a9 +OP_LFGAppearance=0x0000 +OP_LFGResponse=0x0000 + +# Raid Opcodes +OP_RaidInvite=0x3973 +OP_RaidUpdate=0x56fe +OP_RaidJoin=0x0000 + +# Button-push commands +OP_Taunt=0x2703 +OP_CombatAbility=0x3eba +OP_SenseTraps=0x02af # Was 0x2ee0 +OP_PickPocket=0x39e8 +OP_DisarmTraps=0x0000 +OP_Disarm=0x5ec8 +OP_Sneak=0x4577 +OP_Fishing=0x1e2a +OP_InstillDoubt=0x640e +OP_FeignDeath=0x52fa +OP_Mend=0x0ecf +OP_Bind_Wound=0x0386 +OP_LDoNOpen=0x3d5c + +# Task packets +OP_TaskDescription=0x0083 +OP_TaskActivity=0x083 +OP_CompletedTasks=0x4eba +OP_TaskActivityComplete=0x7037 +OP_AcceptNewTask=0x0a23 +OP_CancelTask=0x3714 +OP_TaskMemberList=0x5727 # Was 0x1656 +OP_OpenNewTasksWindow=0x48a2 # Was 0x11de +OP_AvaliableTask=0x36e8 # Was 0x2377 +OP_TaskHistoryRequest=0x5f1c +OP_TaskHistoryReply=0x3d05 +OP_DeclineAllTasks=0x0000 + +# Title opcodes +OP_NewTitlesAvailable=0x0d32 +OP_RequestTitles=0x6344 +OP_SendTitleList=0x2d08 +OP_SetTitle=0x6527 +OP_SetTitleReply=0x4c21 + +# mail opcodes +OP_Command=0x0000 +OP_MailboxHeader=0x0000 +OP_MailHeader=0x0000 +OP_MailBody=0x0000 +OP_NewMail=0x0000 +OP_SentConfirm=0x0000 + +########### Below this point should not be needed ########### + +# This section are all unknown in Titanium +OP_ForceFindPerson=0x0000 +OP_LocInfo=0x0000 +OP_ReloadUI=0x0000 +OP_ItemName=0x0000 +OP_ItemLinkText=0x0000 +OP_MultiLineMsg=0x0000 +OP_MendHPUpdate=0x0000 +OP_TargetReject=0x0000 +OP_SafePoint=0x0000 +OP_ApproveZone=0x0000 +OP_ZoneComplete=0x0000 +OP_ClientError=0x0000 +OP_DumpName=0x0000 +OP_Heartbeat=0x0000 +OP_CrashDump=0x0000 +OP_LoginComplete=0x0000 + +# discovered opcodes not yet used: +OP_PickLockSuccess=0x0000 +OP_PlayMP3=0x0000 +OP_ReclaimCrystals=0x0000 +OP_DynamicWall=0x0000 +OP_OpenDiscordMerchant=0x0000 +OP_DiscordMerchantInventory=0x0000 +OP_GiveMoney=0x0000 +OP_RequestKnowledgeBase=0x0000 +OP_KnowledgeBase=0x0000 +OP_SlashAdventure=0x0000 # /adventure +OP_BecomePVPPrompt=0x0000 +OP_MoveLogRequest=0x0000 # gone I think +OP_MoveLogDisregard=0x0000 # gone I think + +# named unknowns, to make looking for real unknown easier +OP_AnnoyingZoneUnknown=0x0000 +OP_Some6ByteHPUpdate=0x0000 seems to happen when you target group members +OP_QueryResponseThing=0x0000 + + +# realityincarnate: these are just here to stop annoying several thousand byte packet dumps +#OP_LoginUnknown1=0x46d3 # OP_SendSpellChecksum +#OP_LoginUnknown2=0x040b # OP_SendSkillCapsChecksum + +# Petition Opcodes +OP_PetitionSearch=0x0000 search term for petition +OP_PetitionSearchResults=0x0000 (list of?) matches from search +OP_PetitionSearchText=0x0000 text results of search + +OP_PetitionUpdate=0x0000 +OP_PetitionCheckout=0x0000 +OP_PetitionCheckIn=0x0000 +OP_PetitionQue=0x0000 +OP_PetitionUnCheckout=0x0000 +OP_PetitionDelete=0x0000 +OP_DeletePetition=0x0000 +OP_PetitionResolve=0x0000 +OP_PDeletePetition=0x0000 +OP_PetitionBug=0x0000 +OP_PetitionRefresh=0x0000 +OP_PetitionCheckout2=0x0000 +OP_PetitionViewPetition=0x0000 + +# Login opcodes +OP_SessionReady=0x0000 +OP_Login=0x0000 +OP_ServerListRequest=0x0000 +OP_PlayEverquestRequest=0x0000 +OP_PlayEverquestResponse=0x0000 +OP_ChatMessage=0x0000 +OP_LoginAccepted=0x0000 +OP_ServerListResponse=0x0000 +OP_Poll=0x0000 +OP_EnterChat=0x0000 +OP_PollResponse=0x0000 + +# raw opcodes +OP_RAWSessionRequest=0x0000 +OP_RAWSessionResponse=0x0000 +OP_RAWCombined=0x0000 +OP_RAWSessionDisconnect=0x0000 +OP_RAWKeepAlive=0x0000 +OP_RAWSessionStatRequest=0x0000 +OP_RAWSessionStatResponse=0x0000 +OP_RAWPacket=0x0000 +OP_RAWFragment=0x0000 +OP_RAWOutOfOrderAck=0x0000 +OP_RAWAck=0x0000 +OP_RAWAppCombined=0x0000 +OP_RAWOutOfSession=0x0000 + +# we need to document the differences between these packets to make identifying them easier +OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs +OP_InitialHPUpdate=0x0000 + +OP_ItemRecastDelay=0x08a6 From 36c945a77c29cf4c5d9ec71c9fa1edd14cddcaab Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 4 Dec 2014 23:06:43 -0600 Subject: [PATCH 0502/1883] Updated a large number of RoF2 opcodes. --- common/eq_dictionary.cpp | 66 ++++++------ utils/patches/patch_RoF2.conf | 130 ++++++++++++------------ utils/scripts/opcode_scripts/.gitignore | 3 + 3 files changed, 101 insertions(+), 98 deletions(-) create mode 100644 utils/scripts/opcode_scripts/.gitignore diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index f85d3110f..3756ca8fe 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -539,7 +539,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*Underfoot*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*RoF*/ EmuConstants::MAP_POSSESSIONS_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*NPC*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*Merc*/ EmuConstants::MAP_POSSESSIONS_SIZE, @@ -554,7 +554,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_BANK_SIZE, /*Underfoot*/ EmuConstants::MAP_BANK_SIZE, /*RoF*/ EmuConstants::MAP_BANK_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_BANK_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -569,7 +569,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*Underfoot*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*RoF*/ EmuConstants::MAP_SHARED_BANK_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -584,7 +584,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_TRADE_SIZE, /*Underfoot*/ EmuConstants::MAP_TRADE_SIZE, /*RoF*/ EmuConstants::MAP_TRADE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_TRADE_SIZE, /*NPC*/ 4, /*Merc*/ 4, @@ -599,7 +599,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_WORLD_SIZE, /*Underfoot*/ EmuConstants::MAP_WORLD_SIZE, /*RoF*/ EmuConstants::MAP_WORLD_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_WORLD_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -614,7 +614,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_LIMBO_SIZE, /*Underfoot*/ EmuConstants::MAP_LIMBO_SIZE, /*RoF*/ EmuConstants::MAP_LIMBO_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_LIMBO_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -629,7 +629,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE, /*Underfoot*/ EmuConstants::MAP_TRIBUTE_SIZE, /*RoF*/ EmuConstants::MAP_TRIBUTE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_TRIBUTE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -644,7 +644,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -659,7 +659,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -674,7 +674,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_MERCHANT_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_MERCHANT_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -689,7 +689,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_DELETED_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_DELETED_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -704,7 +704,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ SoD::consts::MAP_CORPSE_SIZE, /*Underfoot*/ Underfoot::consts::MAP_CORPSE_SIZE, /*RoF*/ RoF::consts::MAP_CORPSE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ RoF2::consts::MAP_CORPSE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -719,7 +719,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ EmuConstants::MAP_BAZAAR_SIZE, /*Underfoot*/ EmuConstants::MAP_BAZAAR_SIZE, /*RoF*/ EmuConstants::MAP_BAZAAR_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_BAZAAR_SIZE, /*NPC*/ 0, // this may need to be 'EmuConstants::MAP_BAZAAR_SIZE' if offline client traders respawn as an npc /*Merc*/ 0, @@ -734,7 +734,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ SoD::consts::MAP_INSPECT_SIZE, /*Underfoot*/ Underfoot::consts::MAP_INSPECT_SIZE, /*RoF*/ RoF::consts::MAP_INSPECT_SIZE, -/*RoF2*/ 0, +/*RoF2*/ RoF2::consts::MAP_INSPECT_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -749,7 +749,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_REAL_ESTATE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_REAL_ESTATE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -764,7 +764,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -779,7 +779,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -794,7 +794,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -809,7 +809,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -824,7 +824,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_ALT_STORAGE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_ALT_STORAGE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -839,7 +839,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_ARCHIVED_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_ARCHIVED_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -854,7 +854,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_MAIL_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_MAIL_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -869,7 +869,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -884,7 +884,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ NOT_USED, /*Underfoot*/ NOT_USED, /*RoF*/ EmuConstants::MAP_KRONO_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_KRONO_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -899,7 +899,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { /*SoD*/ 0, /*Underfoot*/ 0, /*RoF*/ EmuConstants::MAP_OTHER_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::MAP_OTHER_SIZE, /*NPC*/ 0, /*Merc*/ 0, @@ -1012,7 +1012,7 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { /*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*Underfoot*/ Underfoot::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, -/*RoF2*/ false, +/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*NPC*/ false, /*Merc*/ false, @@ -1033,7 +1033,7 @@ bool EQLimits::AllowsClickCastFromBag(uint32 version) { /*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*Underfoot*/ Underfoot::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*RoF2*/ false, +/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*NPC*/ false, /*Merc*/ false, @@ -1054,7 +1054,7 @@ uint16 EQLimits::ItemCommonSize(uint32 version) { /*SoD*/ EmuConstants::ITEM_COMMON_SIZE, /*Underfoot*/ EmuConstants::ITEM_COMMON_SIZE, /*RoF*/ EmuConstants::ITEM_COMMON_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::ITEM_COMMON_SIZE, /*NPC*/ EmuConstants::ITEM_COMMON_SIZE, /*Merc*/ EmuConstants::ITEM_COMMON_SIZE, @@ -1074,7 +1074,7 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { /*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE, /*Underfoot*/ EmuConstants::ITEM_CONTAINER_SIZE, /*RoF*/ EmuConstants::ITEM_CONTAINER_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::ITEM_CONTAINER_SIZE, /*NPC*/ EmuConstants::ITEM_CONTAINER_SIZE, /*Merc*/ EmuConstants::ITEM_CONTAINER_SIZE, @@ -1094,7 +1094,7 @@ bool EQLimits::CoinHasWeight(uint32 version) { /*SoD*/ SoD::limits::COIN_HAS_WEIGHT, /*Underfoot*/ Underfoot::limits::COIN_HAS_WEIGHT, /*RoF*/ RoF::limits::COIN_HAS_WEIGHT, -/*RoF2*/ true, +/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT, /*NPC*/ true, /*Merc*/ true, @@ -1114,7 +1114,7 @@ uint32 EQLimits::BandoliersCount(uint32 version) { /*SoD*/ EmuConstants::BANDOLIERS_COUNT, /*Underfoot*/ EmuConstants::BANDOLIERS_COUNT, /*RoF*/ EmuConstants::BANDOLIERS_COUNT, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::BANDOLIERS_COUNT, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -1134,7 +1134,7 @@ uint32 EQLimits::BandolierSize(uint32 version) { /*SoD*/ EmuConstants::BANDOLIER_SIZE, /*Underfoot*/ EmuConstants::BANDOLIER_SIZE, /*RoF*/ EmuConstants::BANDOLIER_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::BANDOLIER_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, @@ -1154,7 +1154,7 @@ uint32 EQLimits::PotionBeltSize(uint32 version) { /*SoD*/ EmuConstants::POTION_BELT_SIZE, /*Underfoot*/ EmuConstants::POTION_BELT_SIZE, /*RoF*/ EmuConstants::POTION_BELT_SIZE, -/*RoF2*/ 0, +/*RoF2*/ EmuConstants::POTION_BELT_SIZE, /*NPC*/ NOT_USED, /*Merc*/ NOT_USED, diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 589c47468..8c15c59c6 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -100,9 +100,9 @@ OP_SendAAStats=0x43c8 OP_AAExpUpdate=0x7d14 OP_ExpUpdate=0x20ed OP_HPUpdate=0x2828 -OP_ManaChange=0x43af +OP_ManaChange=0x5467 OP_TGB=0x0876 -OP_SpecialMesg=0x0083 +OP_SpecialMesg=0x083 OP_GuildMemberList=0x12a6 OP_GuildMOTD=0x3e13 OP_CharInventory=0x5ca6 @@ -119,7 +119,7 @@ OP_GuildInvite=0x7099 OP_GuildRemove=0x1444 OP_GuildPeace=0x67e3 OP_SetGuildMOTD=0x0b0b -OP_GuildList=0x507a +OP_GuildList=0x6279 OP_GuildWar=0x1ffb OP_GuildLeader=0x7e09 OP_GuildDelete=0x3708 @@ -132,7 +132,7 @@ OP_GuildBank=0x5134 OP_SetGuildRank=0x0b9c OP_GuildUpdateURLAndChannel=0x2958 OP_GuildStatus=0x7326 -OP_GuildCreate=0x1dc8 +OP_GuildCreate=0x76d9 OP_GuildMemberLevelUpdate=0x0000 # Unused? OP_ZoneGuildList=0x0000 # Unused? OP_GetGuildsList=0x0000 # Unused? @@ -166,7 +166,7 @@ OP_InspectRequest=0x57bc OP_InspectAnswer=0x71ac OP_InspectMessageUpdate=0x4d25 OP_BeginCast=0x318f -OP_ColoredText=0x0000 +OP_ColoredText=0x43af OP_ConsentResponse=0x384a OP_MemorizeSpell=0x217c OP_SwapSpell=0x0efa @@ -179,8 +179,8 @@ OP_Illusion=0x312a OP_MoneyOnCorpse=0x5f44 OP_RandomReply=0x106b OP_DenyResponse=0x2382 -OP_SkillUpdate=0x004c -OP_GMTrainSkillConfirm=0x66dd +OP_SkillUpdate=0x04c +OP_GMTrainSkillConfirm=0x4b64 OP_RandomReq=0x7b10 OP_Death=0x6517 OP_GMTraining=0x1966 @@ -194,7 +194,7 @@ OP_AutoFire=0x241e OP_PetCommands=0x0159 OP_DeleteSpell=0x52e5 OP_Surname=0x0423 -OP_ClearSurname=0x7d23 +OP_ClearSurname=0x3fb0 OP_FaceChange=0x5578 OP_SenseHeading=0x260a OP_Action=0x744c @@ -212,19 +212,19 @@ OP_AssistGroup=0x27f8 OP_MoveCoin=0x0bcf OP_ZonePlayerToBind=0x0ecb OP_KeyRing=0x6857 -OP_WhoAllRequest=0x65ab -OP_WhoAllResponse=0x7c88 +OP_WhoAllRequest=0x674b +OP_WhoAllResponse=0x51b8 OP_FriendsWho=0x3956 OP_ConfirmDelete=0x43a3 OP_Logout=0x4ac6 OP_Rewind=0x1745 OP_TargetCommand=0x58e2 OP_Hide=0x67fe -OP_Jump=0x2060 +OP_Jump=0x31f4 OP_Camp=0x28ec OP_Emote=0x373b OP_SetRunMode=0x009f -OP_BankerChange=0x383c +OP_BankerChange=0x791e OP_TargetMouse=0x075d OP_MobHealth=0x37b1 OP_InitialMobHealth=0x0000 # Unused? @@ -243,7 +243,7 @@ OP_MoveItem=0x32ee OP_DeleteItem=0x18ad OP_DeleteCharge=0x01b8 OP_ItemPacket=0x368e -OP_ItemLinkResponse=0x633c +OP_ItemLinkResponse=0x70c0 OP_ItemLinkClick=0x4cef OP_ItemPreview=0x6b5c OP_NewSpawn=0x6097 @@ -297,7 +297,7 @@ OP_DelegateAbility=0x76b8 OP_SetGroupTarget=0x2814 OP_Charm=0x5d92 OP_Stun=0x36a4 -OP_SendFindableNPCs=0x3897 +OP_SendFindableNPCs=0x7e62 OP_FindPersonRequest=0x5cea OP_FindPersonReply=0x7e58 OP_Sound=0x1a30 @@ -305,23 +305,23 @@ OP_PetBuffWindow=0x5882 OP_LevelAppearance=0x3bc9 OP_Translocate=0x6580 OP_Sacrifice=0x1821 -OP_PopupResponse=0x214a -OP_OnLevelMessage=0x4fd0 +OP_PopupResponse=0x08a6 +OP_OnLevelMessage=0x4d6e OP_AugmentInfo=0x0afb -OP_Petition=0x5f03 +OP_Petition=0x3de3 OP_SomeItemPacketMaybe=0x747c -OP_PVPStats=0x6f4b -OP_PVPLeaderBoardRequest=0x3707 -OP_PVPLeaderBoardReply=0x25b7 -OP_PVPLeaderBoardDetailsRequest=0x15a9 -OP_PVPLeaderBoardDetailsReply=0x04aa -OP_RestState=0x00f +OP_PVPStats=0x4b15 +OP_PVPLeaderBoardRequest=0x04aa +OP_PVPLeaderBoardReply=0x071f +OP_PVPLeaderBoardDetailsRequest=0x3707 +OP_PVPLeaderBoardDetailsReply=0x25b7 +OP_RestState=0x000f OP_RespawnWindow=0x28bc OP_LDoNButton=0x5327 OP_SetStartCity=0x6326 OP_VoiceMacroIn=0x17fd OP_VoiceMacroOut=0x409a -OP_ItemViewUnknown=0x2289 +OP_ItemViewUnknown=0x465b OP_VetRewardsAvaliable=0x590e OP_VetClaimRequest=0x1126 OP_VetClaimReply=0x16d4 @@ -330,43 +330,43 @@ OP_DisciplineTimer=0x6989 OP_BecomeCorpse=0x0000 # Unused? OP_Action2=0x0000 # Unused? OP_MobUpdate=0x2c84 -OP_NPCMoveUpdate=0x189c +OP_NPCMoveUpdate=0x5892 OP_CameraEffect=0x127f OP_SpellEffect=0x5936 -OP_RemoveNimbusEffect=0xc693 -OP_AltCurrency=0x7121 -OP_AltCurrencyMerchantRequest=0x6b6d -OP_AltCurrencyMerchantReply=0x74ec -OP_AltCurrencyPurchase=0x61cb -OP_AltCurrencySell=0x0165 -OP_AltCurrencySellSelection=0x5409 -OP_AltCurrencyReclaim=0x532a +OP_RemoveNimbusEffect=0x7b1e +OP_AltCurrency=0x62ab +OP_AltCurrencyMerchantRequest=0x61cb +OP_AltCurrencyMerchantReply=0x5409 +OP_AltCurrencyPurchase=0x0165 +OP_AltCurrencySell=0x74ec +OP_AltCurrencySellSelection=0x3788 +OP_AltCurrencyReclaim=0x3899 OP_CrystalCountUpdate=0x467f OP_CrystalCreate=0x7aee OP_CrystalReclaim=0x2439 OP_Untargetable=0x053c OP_IncreaseStats=0x70a3 -OP_Weblink=0x18d3 +OP_Weblink=0x6f4b OP_OpenContainer=0x0000 OP_Marquee=0x0000 -OP_ItemRecastDelay=0x08a6 +OP_ItemRecastDelay=0x15a9 #OP_OpenInventory=0x0000 # Likely does not exist in RoF -U -OP_DzQuit=0xb2e3 -OP_DzListTimers=0x7b68 -OP_DzAddPlayer=0x4701 -OP_DzRemovePlayer=0x1abc -OP_DzSwapPlayer=0x405b -OP_DzMakeLeader=0x543d -OP_DzPlayerList=0x14c6 -OP_DzJoinExpeditionConfirm=0x7f4b -OP_DzJoinExpeditionReply=0x1950 -OP_DzExpeditionInfo=0x9119 -OP_DzExpeditionList=0x205f -OP_DzMemberStatus=0x32f0 -OP_DzLeaderStatus=0x3de9 -OP_DzExpeditionEndsWarning=0x5189 -OP_DzMemberList=0x5ae4 +OP_DzQuit=0x205f +OP_DzListTimers=0x0398 +OP_DzAddPlayer=0x59ca +OP_DzRemovePlayer=0x4701 +OP_DzSwapPlayer=0x1abc +OP_DzMakeLeader=0x405b +OP_DzPlayerList=0x543d +OP_DzJoinExpeditionConfirm=0x14c6 +OP_DzJoinExpeditionReply=0x7f4b +OP_DzExpeditionInfo=0x4f7e +OP_DzExpeditionList=0x9119 +OP_DzMemberStatus=0xb2e3 +OP_DzLeaderStatus=0x32f0 +OP_DzExpeditionEndsWarning=0x7e94 +OP_DzMemberList=0x3de9 OP_DzCompass=0x3e0e OP_DzChooseZone=0x0000 @@ -428,15 +428,15 @@ OP_FinishWindow2=0x40ef # Sent on Live for what seems to be item existance verification # Ex. Before Right Click Effect happens from items -OP_ItemVerifyRequest=0x097b -OP_ItemVerifyReply=0x2115 +OP_ItemVerifyRequest=0x189c +OP_ItemVerifyReply=0x097b # merchant stuff -OP_ShopPlayerSell=0x1901 +OP_ShopPlayerSell=0x0000 OP_ShopRequest=0x4fed OP_ShopEnd=0x30a8 OP_ShopEndConfirm=0x3196 -OP_ShopPlayerBuy=0x04c +OP_ShopPlayerBuy=0x0ddd OP_ShopDelItem=0x724f # tradeskill stuff: @@ -444,7 +444,7 @@ OP_ClickObject=0x4aa1 OP_ClickObjectAction=0x0c1e OP_ClearObject=0x7a11 OP_RecipeDetails=0x40d7 -OP_RecipesFavorite=0x5c74 +OP_RecipesFavorite=0x71b1 OP_RecipesSearch=0x1db6 OP_RecipeReply=0x6e02 OP_RecipeAutoCombine=0x6261 @@ -484,16 +484,16 @@ OP_AdventureLeaderboardReply=0x7f79 # Group Opcodes OP_GroupDisband=0x4c10 -OP_GroupInvite=0x1649 -OP_GroupFollow=0x05ce +OP_GroupInvite=0x6110 +OP_GroupFollow=0x1649 OP_GroupUpdate=0x3abb OP_GroupUpdateB=0x6194 OP_GroupCancelInvite=0x0000 OP_GroupAcknowledge=0x7323 OP_GroupDelete=0x0f6c -OP_CancelInvite=0x32c2 -OP_GroupFollow2=0x2a50 -OP_GroupInvite2=0x6c65 +OP_CancelInvite=0x2a50 +OP_GroupFollow2=0x2060 +OP_GroupInvite2=0x32c2 OP_GroupDisbandYou=0x1ae5 OP_GroupDisbandOther=0x74da OP_GroupLeaderChange=0x21b4 @@ -501,7 +501,7 @@ OP_GroupRoles=0x70e2 OP_GroupMakeLeader=0x4229 OP_DoGroupLeadershipAbility=0x1fb5 OP_GroupLeadershipAAUpdate=0x02cf -OP_GroupMentor=0x5892 +OP_GroupMentor=0x3342 OP_InspectBuffs=0x486c # LFG/LFP Opcodes @@ -535,12 +535,12 @@ OP_Bind_Wound=0x0386 OP_LDoNOpen=0x3d5c # Task packets -OP_TaskDescription=0x083 -OP_TaskActivity=0x3714 +OP_TaskDescription=0x3714 +OP_TaskActivity=0x08d3 OP_CompletedTasks=0x4eba OP_TaskActivityComplete=0x5e19 OP_AcceptNewTask=0x0a23 -OP_CancelTask=0x08d3 +OP_CancelTask=0x39f0 OP_TaskMemberList=0x5727 OP_OpenNewTasksWindow=0x48a2 OP_AvaliableTask=0x36e8 @@ -657,4 +657,4 @@ OP_RAWOutOfSession=0x0000 # we need to document the differences between these packets to make identifying them easier OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs -OP_InitialHPUpdate=0x0000 \ No newline at end of file +OP_InitialHPUpdate=0x0000 diff --git a/utils/scripts/opcode_scripts/.gitignore b/utils/scripts/opcode_scripts/.gitignore new file mode 100644 index 000000000..4104a1572 --- /dev/null +++ b/utils/scripts/opcode_scripts/.gitignore @@ -0,0 +1,3 @@ +# Input and Output txt and conf files. +*.txt +*.conf From 48be7c508db94da6aa4d8b0081a8ead7c4878e8e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 02:48:54 -0500 Subject: [PATCH 0503/1883] OP_PlayMP3 for SoF --- utils/patches/patch_SoF.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index fc0c716e1..17765b77f 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -544,7 +544,7 @@ OP_PickLockSuccess=0x0000 # OP_VetRewardsAvaliable=0x044b # OP_VetClaimRequest=0x7503 OP_VetClaimReply=0x01e1 -OP_PlayMP3=0x0000 # +OP_PlayMP3=0x0d1c # OP_ReclaimCrystals=0x0000 # OP_CrystalCountUpdate=0x64C1 # OP_DynamicWall=0x0000 # From 921433f998ed924c25713d127e4768fcb72c7174 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 5 Dec 2014 03:47:41 -0500 Subject: [PATCH 0504/1883] Range attack clean up, prevent possible nullptr checks. --- zone/special_attacks.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index e3721a6a0..928353149 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -676,7 +676,8 @@ void Mob::RogueAssassinate(Mob* other) void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //conditions to use an attack checked before we are called - + if (!other) + return; //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { @@ -716,7 +717,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { return; } - mlog(COMBAT__RANGED, "Shooting %s with bow %s (%d) and arrow %s (%d)", GetTarget()->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + mlog(COMBAT__RANGED, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -766,17 +767,18 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - if(DistNoRoot(*GetTarget()) > range) { - mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", DistNoRootNoZ(*GetTarget()), range); + float dist = DistNoRoot(*other); + if(dist > range) { + mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } - else if(DistNoRoot(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ + else if(dist < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ Message_StringID(15,RANGED_TOO_CLOSE);//Client enforces range and sends the message, this is a backup just incase. return; } - if(!IsAttackAllowed(GetTarget()) || + if(!IsAttackAllowed(other) || IsCasting() || IsSitting() || (DivineAura() && !GetGM()) || @@ -788,7 +790,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { } //Shoots projectile and/or applies the archery damage - DoArcheryAttackDmg(GetTarget(), RangeWeapon, Ammo,0,0,0,0,0,0, AmmoItem, ammo_slot); + DoArcheryAttackDmg(other, RangeWeapon, Ammo,0,0,0,0,0,0, AmmoItem, ammo_slot); //EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow. int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile; @@ -1322,7 +1324,8 @@ uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //conditions to use an attack checked before we are called - + if (!other) + return; //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { @@ -1348,7 +1351,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 return; } - mlog(COMBAT__RANGED, "Throwing %s (%d) at %s", item->Name, item->ID, GetTarget()->GetName()); + mlog(COMBAT__RANGED, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1370,19 +1373,20 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 } } - float range = item->Range + GetRangeDistTargetSizeMod(GetTarget()); + float range = item->Range + GetRangeDistTargetSizeMod(other); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - if(DistNoRoot(*GetTarget()) > range) { - mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", DistNoRootNoZ(*GetTarget()), range); + float dist = DistNoRoot(*other); + if(dist > range) { + mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } - else if(DistNoRoot(*GetTarget()) < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ + else if(dist < (RuleI(Combat, MinRangedAttackDist)*RuleI(Combat, MinRangedAttackDist))){ Message_StringID(15,RANGED_TOO_CLOSE);//Client enforces range and sends the message, this is a backup just incase. } - if(!IsAttackAllowed(GetTarget()) || + if(!IsAttackAllowed(other) || IsCasting() || IsSitting() || (DivineAura() && !GetGM()) || @@ -1393,7 +1397,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 return; } - DoThrowingAttackDmg(GetTarget(), RangeWeapon, item); + DoThrowingAttackDmg(other, RangeWeapon, item); //consume ammo DeleteItemInInventory(ammo_slot, 1, true); From f6bddb9502747efbde62a3fef4944be8ec32e4ea Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 13:23:37 -0500 Subject: [PATCH 0505/1883] OP_IncreaseStats for SoF --- utils/patches/patch_SoD.conf | 1 - utils/patches/patch_SoF.conf | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index 338ee82e7..764d93a4d 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -580,7 +580,6 @@ OP_MultiLineMsg=0x0000 # OP_MendHPUpdate=0x0000 # OP_TargetReject=0x0000 # OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # OP_ApproveZone=0x0000 # OP_ZoneComplete=0x0000 # OP_ClientError=0x0000 # diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 17765b77f..1380540e5 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -530,7 +530,7 @@ OP_MultiLineMsg=0x0000 # OP_MendHPUpdate=0x0000 # OP_TargetReject=0x0000 # OP_SafePoint=0x0000 # -OP_IncreaseStats=0x0000 # +OP_IncreaseStats=0x5ecb # OP_ApproveZone=0x0000 # OP_ZoneComplete=0x0000 # OP_ClientError=0x0000 # From e65bf63e513282de88ea1c8d5f5941185628656c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 13:56:20 -0500 Subject: [PATCH 0506/1883] Fix OP_GMEmoteWorld for SoD --- utils/patches/patch_SoD.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index 764d93a4d..e700939a0 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -158,7 +158,7 @@ OP_GMApproval=0x72fa # C OP_GMToggle=0x7566 # C OP_GMSummon=0x596d # C OP_GMEmoteZone=0x3e7c # C -OP_GMEmoteWorld=0x3e7c # C +OP_GMEmoteWorld=0x5298 # C OP_GMFind=0x6e27 # C OP_GMKick=0x799c # C OP_GMKill=0x6685 # C From 26589835e524138b484e8cad01764b720896399a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 14:00:51 -0500 Subject: [PATCH 0507/1883] OP_PVPStats for Underfoot --- utils/patches/patch_Underfoot.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 56838da65..adaf5fc05 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -315,7 +315,7 @@ OP_OnLevelMessage=0x24cb # C OP_AugmentInfo=0x31b1 # C OP_Petition=0x31d1 # C OP_SomeItemPacketMaybe=0x2c27 # C -OP_PVPStats=0x0000 # +OP_PVPStats=0x5272 # OP_PVPLeaderBoardRequest=0x4973 # C OP_PVPLeaderBoardReply=0x3842 # C OP_PVPLeaderBoardDetailsRequest=0x6c75 # C From e2bc79401b456385630b208b95f898503293ac0b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 14:13:05 -0500 Subject: [PATCH 0508/1883] OP_ShroudClearAA for RoF, UF, and SoF This should actually be usable to just straight clear AA data --- utils/patches/patch_RoF.conf | 1 + utils/patches/patch_SoF.conf | 1 + utils/patches/patch_Underfoot.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 027eac161..0866bf073 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -94,6 +94,7 @@ OP_ClearBlockedBuffs=0x5d3c OP_WorldObjectsSent=0x7fa8 OP_SendExpZonein=0x25ab OP_SendAATable=0x7791 +OP_ShroudClearAA=0x422e OP_RespondAA=0x379d OP_UpdateAA=0x504f OP_SendAAStats=0x3d1c diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 1380540e5..7da699a75 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -85,6 +85,7 @@ OP_TaskActivity=0x2E60 #SEQ 12/04/08 OP_CompletedTasks=0x75AC #Derision 2009 OP_Weather=0x70A5 #SEQ 12/04/08 OP_SendAATable=0x6F05 #Trevius 12/20/08 +OP_ShroudClearAA=0x71b9 OP_UpdateAA=0x45D2 #Trevius 12/20/08 OP_RespondAA=0x4426 #Trevius 12/20/08 OP_ReqClientSpawn=0x014C #SEQ 12/04/08 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index adaf5fc05..736d0a576 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -88,6 +88,7 @@ OP_TaskActivity=0x31f3 # C OP_CompletedTasks=0x687f # C OP_Weather=0x4658 # V OP_SendAATable=0x6ef9 # V +OP_ShroudClearAA=0x2cd4 OP_UpdateAA=0x7bf6 # V OP_RespondAA=0x1fbd # C 0x2bad OP_ReqClientSpawn=0x69cd # V From 7cb1a2e7e42800ab4b7d486f328a8ff6333228d9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 14:29:54 -0500 Subject: [PATCH 0509/1883] OP_DzChooseZone for RoF and UF --- utils/patches/patch_RoF.conf | 2 +- utils/patches/patch_SoD.conf | 2 +- utils/patches/patch_Underfoot.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 0866bf073..16973c202 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -368,7 +368,7 @@ OP_DzLeaderStatus=0x4021 OP_DzExpeditionEndsWarning=0x32eb OP_DzMemberList=0x348f OP_DzCompass=0x0e01 # Was 0x4f09 -OP_DzChooseZone=0x0000 # Maybe 0x29d6 +OP_DzChooseZone=0x6e5e # Maybe 0x29d6 # New Opcodes OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ? diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index e700939a0..f42231238 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -369,7 +369,7 @@ OP_DzExpeditionEndsWarning=0x1879 OP_DzExpeditionList=0x3657 OP_DzMemberList=0x74e4 OP_DzCompass=0x35d3 -OP_DzChooseZone=0xd8a +OP_DzChooseZone=0x0d8a #0x1d99 was grouped with these too but I don't really know it's purpose. # New Opcodes diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 736d0a576..842f5a259 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -374,7 +374,7 @@ OP_DzExpeditionEndsWarning=0x6ac2 OP_DzExpeditionList=0x70d8 OP_DzMemberList=0x15c4 OP_DzCompass=0x01cb -OP_DzChooseZone=0x0000 +OP_DzChooseZone=0x65e1 # New Opcodes OP_SpawnPositionUpdate=0x4656 # C From 4e257d43b2999e1884ac0791be43ded3a3bea303 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 14:40:41 -0500 Subject: [PATCH 0510/1883] OP_CrystalCreate and OP_CrystalReclaim for SoF --- utils/patches/patch_SoF.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 7da699a75..9e434bb65 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -548,6 +548,8 @@ OP_VetClaimReply=0x01e1 OP_PlayMP3=0x0d1c # OP_ReclaimCrystals=0x0000 # OP_CrystalCountUpdate=0x64C1 # +OP_CrystalCreate=0x65e2 +OP_CrystalReclaim=0x0730 OP_DynamicWall=0x0000 # OP_OpenDiscordMerchant=0x0000 # OP_DiscordMerchantInventory=0x0000 # From 2d070ff1c0bdec2e6d0ec7ef8d07c0e2916a494e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 15:59:03 -0500 Subject: [PATCH 0511/1883] OP_Untargetable for SoF --- utils/patches/patch_SoF.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 9e434bb65..7b0c41ad2 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -332,6 +332,7 @@ OP_InspectMessageUpdate=0x67e9 # C OP_OpenInventory=0x66c8 OP_OpenContainer=0x10e3 OP_Marquee=0x2f75 +OP_Untargetable=0x3e36 #expedition OP_DzQuit=0x20d6 From a201a3e837ee4fd49384892bac29cab83aea7409 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 16:26:55 -0500 Subject: [PATCH 0512/1883] Added Shroud ops for UF --- utils/patches/patch_Underfoot.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 842f5a259..2b1c41dd9 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -376,6 +376,16 @@ OP_DzMemberList=0x15c4 OP_DzCompass=0x01cb OP_DzChooseZone=0x65e1 +#shroud +OP_ShroudSelectionWindow=0x72ad +OP_ShroudRequestStats=0x488b +OP_ShroudRespondStats=0x1910 +OP_ShroudSelect=0x45d7 +OP_ShroudSelectCancel=0x666d +OP_ShroudProgress=0x6016 # This clears current progress and sets +OP_ShroudProgress2=0x66b4 # This just sets progress +OP_Shroud=0x1643 + # New Opcodes OP_SpawnPositionUpdate=0x4656 # C OP_ManaUpdate=0x0433 # C From 60563aead61198050b3f569f534310ebc3fc9373 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 5 Dec 2014 19:33:25 -0500 Subject: [PATCH 0513/1883] Added MapKrono entry to RoF2::InventoryMaps enumeration --- common/patches/rof2_constants.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index 1f8ff1a52..596ffa7e7 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -50,6 +50,7 @@ namespace RoF2 { MapArchived, MapMail, MapGuildTrophyTribute, + MapKrono, MapOther, _MapCount } InventoryMaps; From 100eca203f29dcfa508e9c37bc50419c3da85af3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Fri, 5 Dec 2014 17:57:07 -0800 Subject: [PATCH 0514/1883] GetClosestZonePoint converted to xyz_location --- zone/zone.cpp | 20 ++++++++------------ zone/zone.h | 2 +- zone/zoning.cpp | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 5b9910441..a4d746506 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1528,7 +1528,7 @@ void Zone::SetTime(uint8 hour, uint8 minute) } } -ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Client* client, float max_distance) { +ZonePoint* Zone::GetClosestZonePoint(const xyz_location& location, uint32 to, Client* client, float max_distance) { LinkedListIterator iterator(zone_point_list); ZonePoint* closest_zp = 0; float closest_dist = FLT_MAX; @@ -1546,14 +1546,10 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien if (zp->target_zone_id == to) { - float delta_x = zp->x - x; - float delta_y = zp->y - y; - if(zp->x == 999999 || zp->x == -999999) - delta_x = 0; - if(zp->y == 999999 || zp->y == -999999) - delta_y = 0; + auto dist = Distance(xy_location(zp->x,zp->y), location); + if ((zp->x == 999999 || zp->x == -999999) && (zp->y == 999999 || zp->y == -999999)) + dist = 0; - float dist = sqrt(delta_x * delta_x + delta_y * delta_y); if (dist < closest_dist) { closest_zp = zp; @@ -1566,16 +1562,16 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien if(closest_dist > 400.0f && closest_dist < max_distance2) { if(client) - client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone + client->CheatDetected(MQZoneUnknownDest, location.m_X, location.m_Y, location.m_Z); // Someone is trying to use /zone LogFile->write(EQEMuLog::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - LogFile->write(EQEMuLog::Status, ". %f x %f y %f z ", x, y, z); + LogFile->write(EQEMuLog::Status, ". %s", to_string(location).c_str()); } if(closest_dist > max_distance2) closest_zp = nullptr; if(!closest_zp) - closest_zp = GetClosestZonePointWithoutZone(x, y, z, client); + closest_zp = GetClosestZonePointWithoutZone(location.m_X, location.m_Y, location.m_Z, client); return closest_zp; } @@ -1583,7 +1579,7 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien ZonePoint* Zone::GetClosestZonePoint(const xyz_location& location, const char* to_name, Client* client, float max_distance) { if(to_name == nullptr) return GetClosestZonePointWithoutZone(location.m_X, location.m_Y, location.m_Z, client, max_distance); - return GetClosestZonePoint(location.m_X, location.m_Y, location.m_Z, database.GetZoneID(to_name), client, max_distance); + return GetClosestZonePoint(location, database.GetZoneID(to_name), client, max_distance); } ZonePoint* Zone::GetClosestZonePointWithoutZone(float x, float y, float z, Client* client, float max_distance) { diff --git a/zone/zone.h b/zone/zone.h index 4716b3757..b4adf09f2 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -128,7 +128,7 @@ public: uint32 CountSpawn2(); ZonePoint* GetClosestZonePoint(const xyz_location& location, const char* to_name, Client *client, float max_distance = 40000.0f); - ZonePoint* GetClosestZonePoint(float x, float y, float z, uint32 to, Client *client, float max_distance = 40000.0f); + ZonePoint* GetClosestZonePoint(const xyz_location& location, uint32 to, Client *client, float max_distance = 40000.0f); ZonePoint* GetClosestZonePointWithoutZone(float x, float y, float z, Client *client, float max_distance = 40000.0f); SpawnGroupList spawn_group_list; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 4a22746c8..1f83ca76d 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -121,7 +121,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { return; } - zone_point = zone->GetClosestZonePoint(GetX(), GetY(), GetZ(), target_zone_id, this, ZONEPOINT_ZONE_RANGE); + zone_point = zone->GetClosestZonePoint(GetPosition(), target_zone_id, this, ZONEPOINT_ZONE_RANGE); //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { From 57a196a50c96d3d7f3a5c52665c872fcd5b8a4b4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 22:26:01 -0500 Subject: [PATCH 0515/1883] Rename OP_ShroudClearAA to OP_ClearAA --- utils/patches/patch_RoF.conf | 2 +- utils/patches/patch_SoD.conf | 2 +- utils/patches/patch_SoF.conf | 2 +- utils/patches/patch_Underfoot.conf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 16973c202..db0e2dbba 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -94,7 +94,7 @@ OP_ClearBlockedBuffs=0x5d3c OP_WorldObjectsSent=0x7fa8 OP_SendExpZonein=0x25ab OP_SendAATable=0x7791 -OP_ShroudClearAA=0x422e +OP_ClearAA=0x422e OP_RespondAA=0x379d OP_UpdateAA=0x504f OP_SendAAStats=0x3d1c diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index f42231238..fca095db7 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -531,7 +531,7 @@ OP_Shroud=0x6d1f OP_ShroudRemove=0x17f6 OP_ShroudUnknown1=0x169a OP_ShroudUnknown2=0x4292 -OP_ShroudClearAA=0x3bef +OP_ClearAA=0x3bef OP_ShroudSelectionWindow=0x4d79 OP_ShroudRequestStats=0x28ce OP_ShroudRespondStats=0x33f2 diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 7b0c41ad2..8b8629d7c 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -85,7 +85,7 @@ OP_TaskActivity=0x2E60 #SEQ 12/04/08 OP_CompletedTasks=0x75AC #Derision 2009 OP_Weather=0x70A5 #SEQ 12/04/08 OP_SendAATable=0x6F05 #Trevius 12/20/08 -OP_ShroudClearAA=0x71b9 +OP_ClearAA=0x71b9 OP_UpdateAA=0x45D2 #Trevius 12/20/08 OP_RespondAA=0x4426 #Trevius 12/20/08 OP_ReqClientSpawn=0x014C #SEQ 12/04/08 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 2b1c41dd9..190554c64 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -88,7 +88,7 @@ OP_TaskActivity=0x31f3 # C OP_CompletedTasks=0x687f # C OP_Weather=0x4658 # V OP_SendAATable=0x6ef9 # V -OP_ShroudClearAA=0x2cd4 +OP_ClearAA=0x2cd4 OP_UpdateAA=0x7bf6 # V OP_RespondAA=0x1fbd # C 0x2bad OP_ReqClientSpawn=0x69cd # V From 1ac92c603ef8820be49a0b371ec9fb8a45ea1510 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 22:27:39 -0500 Subject: [PATCH 0516/1883] Add OP_ClearLeadershipAbilties --- utils/patches/patch_RoF.conf | 1 + utils/patches/patch_SoD.conf | 1 + utils/patches/patch_SoF.conf | 1 + utils/patches/patch_Underfoot.conf | 1 + 4 files changed, 4 insertions(+) diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index db0e2dbba..05a3a4a76 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -95,6 +95,7 @@ OP_WorldObjectsSent=0x7fa8 OP_SendExpZonein=0x25ab OP_SendAATable=0x7791 OP_ClearAA=0x422e +OP_ClearLeadershipAbilities=0xb978 OP_RespondAA=0x379d OP_UpdateAA=0x504f OP_SendAAStats=0x3d1c diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index fca095db7..a5dee668c 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -532,6 +532,7 @@ OP_ShroudRemove=0x17f6 OP_ShroudUnknown1=0x169a OP_ShroudUnknown2=0x4292 OP_ClearAA=0x3bef +OP_ClearLeadershipAbilities=0x6e58 OP_ShroudSelectionWindow=0x4d79 OP_ShroudRequestStats=0x28ce OP_ShroudRespondStats=0x33f2 diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 8b8629d7c..80aee8bdc 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -86,6 +86,7 @@ OP_CompletedTasks=0x75AC #Derision 2009 OP_Weather=0x70A5 #SEQ 12/04/08 OP_SendAATable=0x6F05 #Trevius 12/20/08 OP_ClearAA=0x71b9 +OP_ClearLeadershipAbilities=0x74e5 OP_UpdateAA=0x45D2 #Trevius 12/20/08 OP_RespondAA=0x4426 #Trevius 12/20/08 OP_ReqClientSpawn=0x014C #SEQ 12/04/08 diff --git a/utils/patches/patch_Underfoot.conf b/utils/patches/patch_Underfoot.conf index 190554c64..09c6a8252 100644 --- a/utils/patches/patch_Underfoot.conf +++ b/utils/patches/patch_Underfoot.conf @@ -89,6 +89,7 @@ OP_CompletedTasks=0x687f # C OP_Weather=0x4658 # V OP_SendAATable=0x6ef9 # V OP_ClearAA=0x2cd4 +OP_ClearLeadershipAbilities=0x7b77 OP_UpdateAA=0x7bf6 # V OP_RespondAA=0x1fbd # C 0x2bad OP_ReqClientSpawn=0x69cd # V From 51b997aa27661620b6d8fc4044e8b21f7bcd3dcc Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 22:29:41 -0500 Subject: [PATCH 0517/1883] Implement OP_ClearAA and OP_ClearLeadershipAbilities for SoF+ This is nice since #resetaa will no longer require a kick --- common/emu_oplist.h | 2 ++ zone/aa.cpp | 28 +++++++++++++++++++++------- zone/client.h | 1 + 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/common/emu_oplist.h b/common/emu_oplist.h index e8ce3b986..62978655a 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -74,7 +74,9 @@ N(OP_CharacterCreateRequest), N(OP_CharInventory), N(OP_Charm), N(OP_ChatMessage), +N(OP_ClearAA), N(OP_ClearBlockedBuffs), +N(OP_ClearLeadershipAbilities), N(OP_ClearNPCMarks), N(OP_ClearObject), N(OP_ClearSurname), diff --git a/zone/aa.cpp b/zone/aa.cpp index a8c6ff3d0..65062b7bc 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1471,21 +1471,22 @@ bool ZoneDatabase::LoadAAEffects2() { return true; } + void Client::ResetAA(){ - RefundAA(); + RefundAA(); uint32 i; - for(i=0;iAA = 0; aa[i]->value = 0; m_pp.aa_array[MAX_PP_AA_ARRAY].AA = 0; - m_pp.aa_array[MAX_PP_AA_ARRAY].value = 0; + m_pp.aa_array[MAX_PP_AA_ARRAY].value = 0; } std::map::iterator itr; - for(itr=aa_points.begin();itr!=aa_points.end();++itr) + for(itr = aa_points.begin(); itr != aa_points.end(); ++itr) aa_points[itr->first] = 0; - for(int i = 0; i < _maxLeaderAA; ++i) + for(int i = 0; i < _maxLeaderAA; ++i) m_pp.leader_abilities.ranks[i] = 0; m_pp.group_leadership_points = 0; @@ -1494,10 +1495,23 @@ void Client::ResetAA(){ m_pp.raid_leadership_exp = 0; database.DeleteCharacterAAs(this->CharacterID()); - SaveAA(); + SaveAA(); + SendClearAA(); + SendAAList(); SendAATable(); + SendAAStats(); database.DeleteCharacterLeadershipAAs(this->CharacterID()); - Kick(); + // undefined for these clients + if (GetClientVersionBit & BIT_TitaniumAndEarlier) + Kick(); +} + +void Client::SendClearAA() +{ + EQApplicationPacket *outapp = new EQApplicationPacket(OP_ClearLeadershipAbilities, 0); + FastQueuePacket(&outapp); + outapp = new EQApplicationPacket(OP_ClearAA, 0); + FastQueuePacket(&outapp); } int Client::GroupLeadershipAAHealthEnhancement() diff --git a/zone/client.h b/zone/client.h index 4c69917fd..a63f37b2f 100644 --- a/zone/client.h +++ b/zone/client.h @@ -755,6 +755,7 @@ public: //AA Methods void SendAAList(); void ResetAA(); + void SendClearAA(); void SendAA(uint32 id, int seq=1); void SendPreviousAA(uint32 id, int seq=1); void BuyAA(AA_Action* action); From ce7a995223314de05917b39e62cf19b6004a021b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Dec 2014 22:31:36 -0500 Subject: [PATCH 0518/1883] Fix previous commit --- zone/aa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 65062b7bc..ba61c9005 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1502,7 +1502,7 @@ void Client::ResetAA(){ SendAAStats(); database.DeleteCharacterLeadershipAAs(this->CharacterID()); // undefined for these clients - if (GetClientVersionBit & BIT_TitaniumAndEarlier) + if (GetClientVersionBit() & BIT_TitaniumAndEarlier) Kick(); } From 97a34b5793718c67a45ddd8136eb293a1eaec940 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 6 Dec 2014 14:38:34 -0600 Subject: [PATCH 0519/1883] The RoF2 client is now enabled by default. It is almost caught up to RoF Client compatibility. --- common/patches/patches.cpp | 6 ++--- common/patches/rof2.cpp | 20 ++++++++--------- common/patches/rof2_structs.h | 6 ++--- utils/patches/patch_RoF2.conf | 22 +++++++++---------- utils/scripts/opcode_scripts/.gitignore | 2 +- .../scripts/opcode_scripts/oplist_to_conf.pl | 11 +++++----- world/client.cpp | 2 +- zone/inventory.cpp | 20 ++++++++++++++++- zone/questmgr.cpp | 14 +++++++----- 9 files changed, 61 insertions(+), 42 deletions(-) diff --git a/common/patches/patches.cpp b/common/patches/patches.cpp index d35ded9ba..50d77a43f 100644 --- a/common/patches/patches.cpp +++ b/common/patches/patches.cpp @@ -17,8 +17,7 @@ void RegisterAllPatches(EQStreamIdentifier &into) { SoD::Register(into); Underfoot::Register(into); RoF::Register(into); - // Uncomment the line below to enable RoF2 Client - //RoF2::Register(into); + RoF2::Register(into); } void ReloadAllPatches() { @@ -28,6 +27,5 @@ void ReloadAllPatches() { SoD::Reload(); Underfoot::Reload(); RoF::Reload(); - // Uncomment the line below to enable RoF2 Client - //RoF2::Reload(); + RoF2::Reload(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 372da9b07..869fef666 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2045,15 +2045,6 @@ namespace RoF2 outapp->WriteUInt32(emu->skills[r]); } - // deprecated - // Write zeroes for the rest of the skills - /* - for(uint32 r = 0; r < structs::MAX_PP_SKILL - MAX_PP_SKILL; r++) - { - outapp->WriteUInt32(emu->skills[r]); - } - */ - outapp->WriteUInt32(25); // Unknown count for (uint32 r = 0; r < 25; r++) @@ -2334,7 +2325,6 @@ namespace RoF2 outapp->WriteUInt8(emu->pvp); outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(emu->gm); - outapp->WriteUInt32(emu->guild_id); outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. outapp->WriteUInt32(0); // Unknown - observed 1 in a live packet. @@ -2349,6 +2339,7 @@ namespace RoF2 outapp->WriteUInt32(emu->silver_bank); outapp->WriteUInt32(emu->copper_bank); + // Commenting out for RoF Test outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown @@ -2396,6 +2387,13 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + /* + + // Begin RoF2 Test + for (uint32 r = 0; r < 1000; r++) + outapp->WriteUInt8(0); // Unknown + // End RoF2 Test + // Block of 121 unknown bytes for (uint32 r = 0; r < 121; r++) outapp->WriteUInt8(0); // Unknown @@ -2537,6 +2535,8 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + */ + outapp->WriteUInt8(emu->groupAutoconsent); outapp->WriteUInt8(emu->raidAutoconsent); outapp->WriteUInt8(emu->guildAutoconsent); diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index b75faee91..4bc9a9bb3 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -1205,7 +1205,7 @@ union /*00000*/ uint8 unknown_rof52[82]; // /*00000*/ uint32 unknown_rof53; // Seen 50 -uint8 unknown_rof54[1325]; // Unknown Section +/*00000*/ uint8 unknown_rof54[1325]; // Unknown Section // Bottom of Struct: /*00000*/ uint8 groupAutoconsent; // 0=off, 1=on @@ -2833,8 +2833,8 @@ struct Door_Struct /*0085*/ uint8 unknown0085; // seen 1 or 0 or rarely 2C or 90 or ED or 2D or A1 /*0086*/ uint8 unknown0086; // seen 0 or rarely FF or FE or 10 or 5A or 82 /*0087*/ uint8 unknown0087; // seen 0 or rarely 02 or 7C -/*0088*/ uint8 unknown0088[8]; // mostly 0s, the last 3 bytes are something tho -/*0096*/ +/*0088*/ uint8 unknown0088[12]; // mostly 0s, the last 3 bytes are something tho +/*0100*/ }; struct DoorSpawns_Struct { diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 8c15c59c6..5ab89f001 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -297,7 +297,7 @@ OP_DelegateAbility=0x76b8 OP_SetGroupTarget=0x2814 OP_Charm=0x5d92 OP_Stun=0x36a4 -OP_SendFindableNPCs=0x7e62 +OP_SendFindableNPCs=0x4613 OP_FindPersonRequest=0x5cea OP_FindPersonReply=0x7e58 OP_Sound=0x1a30 @@ -308,7 +308,7 @@ OP_Sacrifice=0x1821 OP_PopupResponse=0x08a6 OP_OnLevelMessage=0x4d6e OP_AugmentInfo=0x0afb -OP_Petition=0x3de3 +OP_Petition=0x1901 OP_SomeItemPacketMaybe=0x747c OP_PVPStats=0x4b15 OP_PVPLeaderBoardRequest=0x04aa @@ -334,13 +334,13 @@ OP_NPCMoveUpdate=0x5892 OP_CameraEffect=0x127f OP_SpellEffect=0x5936 OP_RemoveNimbusEffect=0x7b1e -OP_AltCurrency=0x62ab -OP_AltCurrencyMerchantRequest=0x61cb -OP_AltCurrencyMerchantReply=0x5409 -OP_AltCurrencyPurchase=0x0165 -OP_AltCurrencySell=0x74ec -OP_AltCurrencySellSelection=0x3788 -OP_AltCurrencyReclaim=0x3899 +OP_AltCurrency=0x6b6d +OP_AltCurrencyMerchantRequest=0x5409 +OP_AltCurrencyMerchantReply=0x27a2 +OP_AltCurrencyPurchase=0x3788 +OP_AltCurrencySell=0x40b6 +OP_AltCurrencySellSelection=0x532a +OP_AltCurrencyReclaim=0x0339 OP_CrystalCountUpdate=0x467f OP_CrystalCreate=0x7aee OP_CrystalReclaim=0x2439 @@ -368,7 +368,7 @@ OP_DzLeaderStatus=0x32f0 OP_DzExpeditionEndsWarning=0x7e94 OP_DzMemberList=0x3de9 OP_DzCompass=0x3e0e -OP_DzChooseZone=0x0000 +OP_DzChooseZone=0x0b7d # New Opcodes OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ? @@ -585,7 +585,7 @@ OP_LoginComplete=0x0000 # discovered opcodes not yet used: OP_PickLockSuccess=0x0000 -OP_PlayMP3=0x0000 +OP_PlayMP3=0x5770 OP_ReclaimCrystals=0x0000 OP_DynamicWall=0x0000 OP_OpenDiscordMerchant=0x0000 diff --git a/utils/scripts/opcode_scripts/.gitignore b/utils/scripts/opcode_scripts/.gitignore index 4104a1572..0227fe923 100644 --- a/utils/scripts/opcode_scripts/.gitignore +++ b/utils/scripts/opcode_scripts/.gitignore @@ -1,3 +1,3 @@ -# Input and Output txt and conf files. +# Input and Output txt and conf files *.txt *.conf diff --git a/utils/scripts/opcode_scripts/oplist_to_conf.pl b/utils/scripts/opcode_scripts/oplist_to_conf.pl index 0d808707d..0a3088dd6 100644 --- a/utils/scripts/opcode_scripts/oplist_to_conf.pl +++ b/utils/scripts/opcode_scripts/oplist_to_conf.pl @@ -6,11 +6,12 @@ # Directions to use this script: # 1. Copy the opcodes and opcode names columns from the opcode spreadsheet # for the columns you want to create a new .conf file from into the file. -# 2. Remove the header row entries in the newly created text file and save it. -# 3. Paste the contents of the current patch file in the patch_OLD.conf file. -# 4. Run this script using "perl oplist_to_conf.pl" -# 5. This creates a new .conf file named patch_NEW.conf -# 6. Rename patch_NEW.conf to the desired name and you are all done +# 2. Remove the header row entries in the text file. +# 3. Find/Replace all Tabs " " with 2 spaces " " and save the file. +# 4. Paste the contents of the current patch file in the patch_OLD.conf file. +# 5. Run this script using "perl oplist_to_conf.pl" +# 6. This creates a new .conf file named patch_NEW.conf +# 7. Rename patch_NEW.conf to the desired name and you are all done $stopmessage = "Failed to open file"; diff --git a/world/client.cpp b/world/client.cpp index 0f9b92abf..e37015e19 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -223,7 +223,7 @@ void Client::SendMembership() { mc->entries[1] = 0xffffffff; // Max Level Restriction mc->entries[2] = 0xffffffff; // Max Char Slots per Account (not used by client?) mc->entries[3] = 0xffffffff; // 1 for Silver - mc->entries[4] = 8; // Main Inventory Size (0xffffffff on Live for Gold, but limitting to 8 until 10 is supported) + mc->entries[4] = 8; // Main Inventory Size (0xffffffff on Live for Gold, but limiting to 8 until 10 is supported) mc->entries[5] = 0xffffffff; // Max Platinum per level mc->entries[6] = 1; // 0 for Silver mc->entries[7] = 1; // 0 for Silver diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 6b7a0b297..bb9802e1c 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1032,7 +1032,25 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { uint8 evolvedlevel = 0; int hash = 0; //int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= EQClientRoF2) + { + MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%1X" "%04X" "%1X" "%05X" "%08X", + 0, + item->ID, + inst->GetAugmentItemID(0), + inst->GetAugmentItemID(1), + inst->GetAugmentItemID(2), + inst->GetAugmentItemID(3), + inst->GetAugmentItemID(4), + inst->GetAugmentItemID(5), + evolving, + loregroup, + evolvedlevel, + 0, + hash + ); + } + else if (GetClientVersion() >= EQClientRoF) { MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 2ce1dbc37..38f40142d 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2658,14 +2658,16 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam char linktext[250]; if (initiator) { - if (initiator->GetClientVersion() >= EQClientRoF) - sprintf(linktext,"%c%06X%s%s%c",0x12,sayid,"0000000000000000000000000000000000000000000000000",LinkName,0x12); + if (initiator->GetClientVersion() >= EQClientRoF2) + sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000000000", LinkName, 0x12); + else if (initiator->GetClientVersion() >= EQClientRoF) + sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "0000000000000000000000000000000000000000000000000", LinkName, 0x12); else if (initiator->GetClientVersion() >= EQClientSoF) - sprintf(linktext,"%c%06X%s%s%c",0x12,sayid,"00000000000000000000000000000000000000000000",LinkName,0x12); + sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000", LinkName, 0x12); else - sprintf(linktext,"%c%06X%s%s%c",0x12,sayid,"000000000000000000000000000000000000000",LinkName,0x12); - } else { // If no initiator, create an RoF saylink, since older clients handle RoF ones better than RoF handles older ones. - sprintf(linktext,"%c%06X%s%s%c",0x12,sayid,"0000000000000000000000000000000000000000000000000",LinkName,0x12); + sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "000000000000000000000000000000000000000", LinkName, 0x12); + } else { // If no initiator, create an RoF2 saylink, since older clients handle RoF2 ones better than RoF2 handles older ones. + sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000000000", LinkName, 0x12); } strcpy(Phrase,linktext); From 4138e6f82ca380c06642bd627f456514fc024fc5 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 6 Dec 2014 14:53:05 -0600 Subject: [PATCH 0520/1883] More RoF2 Opcodes identified. --- utils/patches/patch_RoF2.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 5ab89f001..7837c2966 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -102,7 +102,7 @@ OP_ExpUpdate=0x20ed OP_HPUpdate=0x2828 OP_ManaChange=0x5467 OP_TGB=0x0876 -OP_SpecialMesg=0x083 +OP_SpecialMesg=0x0083 OP_GuildMemberList=0x12a6 OP_GuildMOTD=0x3e13 OP_CharInventory=0x5ca6 @@ -213,7 +213,7 @@ OP_MoveCoin=0x0bcf OP_ZonePlayerToBind=0x0ecb OP_KeyRing=0x6857 OP_WhoAllRequest=0x674b -OP_WhoAllResponse=0x51b8 +OP_WhoAllResponse=0x578c OP_FriendsWho=0x3956 OP_ConfirmDelete=0x43a3 OP_Logout=0x4ac6 @@ -306,7 +306,7 @@ OP_LevelAppearance=0x3bc9 OP_Translocate=0x6580 OP_Sacrifice=0x1821 OP_PopupResponse=0x08a6 -OP_OnLevelMessage=0x4d6e +OP_OnLevelMessage=0x575b OP_AugmentInfo=0x0afb OP_Petition=0x1901 OP_SomeItemPacketMaybe=0x747c @@ -348,7 +348,7 @@ OP_Untargetable=0x053c OP_IncreaseStats=0x70a3 OP_Weblink=0x6f4b OP_OpenContainer=0x0000 -OP_Marquee=0x0000 +OP_Marquee=0x502e OP_ItemRecastDelay=0x15a9 #OP_OpenInventory=0x0000 # Likely does not exist in RoF -U From 5713dc2de1b60b8dce4d9070d558bdf165ae2e7e Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 6 Dec 2014 18:18:49 -0600 Subject: [PATCH 0521/1883] Guild Names now display properly in RoF2. --- common/patches/rof2.cpp | 4 ++++ utils/patches/patch_RoF2.conf | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 869fef666..4d403253f 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3781,6 +3781,10 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->light); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->flymode); + //VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 100); // LiveUnknown1 12/06/14 (possibly mana percent?) + //VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 10); // LiveUnknown2 12/06/14 + //VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // LiveUnknown3 12/06/14 + VARSTRUCT_ENCODE_STRING(Buffer, emu->lastName); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); // aatitle ?? diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 7837c2966..351b147c4 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -19,7 +19,7 @@ OP_ApproveWorld=0x7499 OP_LogServer=0x7ceb OP_SendCharInfo=0x00d2 OP_ExpansionInfo=0x590d -OP_GuildsList=0x0000 +OP_GuildsList=0x507a OP_EnterWorld=0x578f OP_PostEnterWorld=0x6259 OP_World_Client_CRC1=0x12cc From 6b9a408b463c3a130896af83f31f67c5e0887706 Mon Sep 17 00:00:00 2001 From: Natedog2012 Date: Tue, 23 Sep 2014 19:10:52 -0700 Subject: [PATCH 0522/1883] Don't allow AA to be bought that you cant use --- zone/aa.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index ba61c9005..9cb6cf43f 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -988,13 +988,20 @@ void Client::BuyAA(AA_Action* action) } uint32 real_cost; + uint8 req_level; std::map::iterator RequiredLevel = AARequiredLevelAndCost.find(action->ability); if(RequiredLevel != AARequiredLevelAndCost.end()) { real_cost = RequiredLevel->second.Cost; + req_level = RequiredLevel->second.Level; } - else + else { real_cost = aa2->cost + (aa2->cost_inc * cur_level); + req_level = aa2->class_type + (aa2->level_inc * cur_level); + } + + if (req_level > GetLevel()) + return; //Cheater trying to Buy AA... if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); From eed666c8c2124464fc6b40b626bfd5157f5647dd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 6 Dec 2014 20:12:19 -0500 Subject: [PATCH 0523/1883] OP_ClearAA and OP_ClearLeadershipAbilities for RoF2 --- utils/patches/patch_RoF2.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 351b147c4..d2ed7f651 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -94,6 +94,8 @@ OP_ClearBlockedBuffs=0x34cb OP_WorldObjectsSent=0x5ae2 OP_SendExpZonein=0x5f8e OP_SendAATable=0x66b5 +OP_ClearAA=0x0f50 +OP_ClearLeadershipAbilities=0x6da5 OP_RespondAA=0x7a27 OP_UpdateAA=0x66f0 OP_SendAAStats=0x43c8 From 3e73df2c723530b84a6ec3381d0fec2347c61eaa Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 6 Dec 2014 21:56:14 -0500 Subject: [PATCH 0524/1883] Clean up common/misc_functions.h --- common/misc_functions.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/misc_functions.h b/common/misc_functions.h index abc9747b5..a013423ff 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -92,8 +92,6 @@ int32 filesize(FILE* fp); uint32 ResolveIP(const char* hostname, char* errbuf = 0); bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf = 0); void CoutTimestamp(bool ms = true); -int MakeRandomInt(int low, int high); -double MakeRandomFloat(double low, double high); float EQ13toFloat(int d); float NewEQ13toFloat(int d); float EQ19toFloat(int d); From afd3b9acdc796ae153dd1c98b69d27c990cbada6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 7 Dec 2014 03:02:57 -0600 Subject: [PATCH 0525/1883] Header and code cleanup of debug.cpp --- common/debug.cpp | 395 ++++++++++++++++++++++++----------------------- 1 file changed, 204 insertions(+), 191 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 228d57631..3b283240a 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -1,7 +1,5 @@ #include #include -#include -#include #ifdef _WINDOWS #include @@ -12,14 +10,13 @@ #define strcasecmp _stricmp #else - + #include #include #endif #include "debug.h" -#include "string_util.h" #include "misc_functions.h" #include "platform.h" @@ -34,34 +31,37 @@ EQEMuLog *LogFile = &realLogFile; static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; -EQEMuLog::EQEMuLog() { - for (int i=0; i= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) - return false; - LockMutex lock(&MLog[id]); - if (!logFileValid) - return false; //check again for threading race reasons (to avoid two mutexes) - - time_t aclock; - struct tm *newtime; - - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - - if (dofile) -#ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); -#else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); -#endif - - va_list argptr, tmpargptr; - va_start(argptr, fmt); - if (dofile) { - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } - if(logCallbackFmt[id]) { - msgCallbackFmt p = logCallbackFmt[id]; - va_copy(tmpargptr, argptr); - p(id, fmt, tmpargptr ); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] ", LogNames[id]); - vfprintf( stderr, fmt, argptr ); - } - else { - fprintf(stdout, "[%s] ", LogNames[id]); - vfprintf( stdout, fmt, argptr ); - } - } - va_end(argptr); - if (dofile) - fprintf(fp[id], "\n"); - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "\n"); - fflush(stderr); - } else { - fprintf(stdout, "\n"); - fflush(stdout); - } - } - if(dofile) - fflush(fp[id]); - return true; -} - -//write with Prefix and a VA_list -bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) { +bool EQEMuLog::write(LogIDs id, const char *fmt, ...) +{ if (!logFileValid) { return false; } @@ -198,56 +128,61 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list return false; } LockMutex lock(&MLog[id]); - if (!logFileValid) - return false; //check again for threading race reasons (to avoid two mutexes) - + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } time_t aclock; struct tm *newtime; - time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ - - va_list tmpargptr; - + if (dofile) + #ifndef NO_PIDLOG + fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); + #else + fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); + #endif + va_list argptr, tmpargptr; + va_start(argptr, fmt); if (dofile) { -#ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); -#else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); -#endif va_copy(tmpargptr, argptr); vfprintf( fp[id], fmt, tmpargptr ); } - if(logCallbackPva[id]) { - msgCallbackPva p = logCallbackPva[id]; + if (logCallbackFmt[id]) { + msgCallbackFmt p = logCallbackFmt[id]; va_copy(tmpargptr, argptr); - p(id, prefix, fmt, tmpargptr ); + p(id, fmt, tmpargptr ); } if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] %s", LogNames[id], prefix); + fprintf(stderr, "[%s] ", LogNames[id]); vfprintf( stderr, fmt, argptr ); - } - else { - fprintf(stdout, "[%s] %s", LogNames[id], prefix); + } else { + fprintf(stdout, "[%s] ", LogNames[id]); vfprintf( stdout, fmt, argptr ); } } va_end(argptr); - if (dofile) + if (dofile) { fprintf(fp[id], "\n"); - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) - fprintf(stderr, "\n"); - else - fprintf(stdout, "\n"); } - if(dofile) + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + fprintf(stderr, "\n"); + fflush(stderr); + } else { + fprintf(stdout, "\n"); + fflush(stdout); + } + } + if (dofile) { fflush(fp[id]); + } return true; } -bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { +//write with Prefix and a VA_list +bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) +{ if (!logFileValid) { return false; } @@ -258,30 +193,92 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { if (pLogStatus[id] & 1) { dofile = open(id); } - if (!(dofile || pLogStatus[id] & 2)) + if (!(dofile || pLogStatus[id] & 2)) { return false; + } LockMutex lock(&MLog[id]); - if (!logFileValid) - return false; //check again for threading race reasons (to avoid two mutexes) - + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } time_t aclock; struct tm *newtime; - time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ + va_list tmpargptr; + if (dofile) { + #ifndef NO_PIDLOG + fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); + #else + fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); + #endif + va_copy(tmpargptr, argptr); + vfprintf( fp[id], fmt, tmpargptr ); + } + if (logCallbackPva[id]) { + msgCallbackPva p = logCallbackPva[id]; + va_copy(tmpargptr, argptr); + p(id, prefix, fmt, tmpargptr ); + } + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + fprintf(stderr, "[%s] %s", LogNames[id], prefix); + vfprintf( stderr, fmt, argptr ); + } else { + fprintf(stdout, "[%s] %s", LogNames[id], prefix); + vfprintf( stdout, fmt, argptr ); + } + } + va_end(argptr); + if (dofile) { + fprintf(fp[id], "\n"); + } + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + fprintf(stderr, "\n"); + } else { + fprintf(stdout, "\n"); + } + } + if (dofile) { + fflush(fp[id]); + } + return true; +} +bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) +{ + if (!logFileValid) { + return false; + } + if (id >= MaxLogID) { + return false; + } + bool dofile = false; + if (pLogStatus[id] & 1) { + dofile = open(id); + } + if (!(dofile || pLogStatus[id] & 2)) { + return false; + } + LockMutex lock(&MLog[id]); + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } + time_t aclock; + struct tm *newtime; + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ if (dofile) -#ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); -#else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); -#endif - + #ifndef NO_PIDLOG + fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); + #else + fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); + #endif if (dofile) { fwrite(buf, size, count, fp[id]); fprintf(fp[id], "\n"); } - if(logCallbackBuf[id]) { + if (logCallbackBuf[id]) { msgCallbackBuf p = logCallbackBuf[id]; p(id, buf, size, count); } @@ -296,12 +293,14 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { fprintf(stdout, "\n"); } } - if(dofile) + if (dofile) { fflush(fp[id]); + } return true; } -bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { +bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) +{ va_list argptr, tmpargptr; va_start(argptr, fmt); if (dofile) { @@ -309,132 +308,146 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { vfprintf( fp[id], fmt, tmpargptr ); } if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) + if (pLogStatus[id] & 8) { vfprintf( stderr, fmt, argptr ); - else + } else { vfprintf( stdout, fmt, argptr ); + } } va_end(argptr); return true; }; -bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) { +bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) +{ if (!logFileValid) { -#if EQDEBUG >= 10 - std::cerr << "Error: Dump() from null pointer" << std::endl; -#endif + #if EQDEBUG >= 10 + std::cerr << "Error: Dump() from null pointer" << std::endl; + #endif return false; } - if (size == 0) + if (size == 0) { return true; - if (!LogFile) + } + if (!LogFile) { return false; - if (id >= MaxLogID) + } + if (id >= MaxLogID) { return false; + } bool dofile = false; if (pLogStatus[id] & 1) { dofile = open(id); } - if (!(dofile || pLogStatus[id] & 2)) + if (!(dofile || pLogStatus[id] & 2)) { return false; + } LockMutex lock(&MLog[id]); - if (!logFileValid) - return false; //check again for threading race reasons (to avoid two mutexes) - + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } write(id, "Dumping Packet: %i", size); // Output as HEX - - int beginningOfLineOffset = 0; + int beginningOfLineOffset = 0; uint32 indexInData; std::string asciiOutput; - - for(indexInData=skip; indexInData= 32 && data[indexInData] < 127) - { + if (data[indexInData] >= 32 && data[indexInData] < 127) { // According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx - // Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long + // Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long // version. asciiOutput.append(std::to_string((long long)data[indexInData])); - } - else - { + } else { asciiOutput.append("."); } } - uint32 k = ((indexInData-skip)-1)%cols; - if (k < 8) + uint32 k = ((indexInData - skip) - 1) % cols; + if (k < 8) { writeNTS(id, dofile, " "); - for (uint32 h = k+1; h < cols; h++) { + } + for (uint32 h = k + 1; h < cols; h++) { writeNTS(id, dofile, " "); } writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); - if (dofile) + if (dofile) { fflush(fp[id]); + } return true; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) { - if (!logFileValid) +void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) +{ + if (!logFileValid) { return; + } if (id >= MaxLogID) { return; } logCallbackFmt[id] = proc; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) { - if (!logFileValid) +void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) +{ + if (!logFileValid) { return; + } if (id >= MaxLogID) { return; } logCallbackBuf[id] = proc; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) { - if (!logFileValid) +void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) +{ + if (!logFileValid) { return; + } if (id >= MaxLogID) { return; } logCallbackPva[id] = proc; } -void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) { - if (!logFileValid) +void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) +{ + if (!logFileValid) { return; + } int r; - for(r = Status; r < MaxLogID; r++) { + for (r = Status; r < MaxLogID; r++) { SetCallback((LogIDs)r, proc); } } -void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) { - if (!logFileValid) +void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) +{ + if (!logFileValid) { return; + } int r; - for(r = Status; r < MaxLogID; r++) { + for (r = Status; r < MaxLogID; r++) { SetCallback((LogIDs)r, proc); } } -void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) { - if (!logFileValid) +void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) +{ + if (!logFileValid) { return; + } int r; - for(r = Status; r < MaxLogID; r++) { + for (r = Status; r < MaxLogID; r++) { SetCallback((LogIDs)r, proc); } } From f81f62670e224e544a7bf5c35bbbc04a9c65d818 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 7 Dec 2014 03:08:27 -0600 Subject: [PATCH 0526/1883] Header cleanup of aggro.cpp --- zone/aggro.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index a904b9707..dc9aa50ec 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -15,18 +15,22 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include -#include -#include "masterentity.h" #include "../common/faction.h" -#include "map.h" -#include "../common/spdat.h" -#include "../common/skills.h" -#include "../common/misc_functions.h" #include "../common/rulesys.h" -#include "string_ids.h" -#include +#include "../common/spdat.h" + +#include "client.h" +#include "corpse.h" +#include "entity.h" +#include "mob.h" + +#ifdef BOTS +#include "bot.h" +#endif + +#include "map.h" extern Zone* zone; //#define LOSDEBUG 6 From 70f570dbd9fb7837a6879bed39011665d5105e76 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 8 Dec 2014 01:22:01 -0500 Subject: [PATCH 0527/1883] Implemented support for allowing most focus effects to now be usable by NPCs (ie Heal/Damage focus, cast time, spell range ect) from both spell buffs and items. Rule for enabling spell focus is TRUE by default Rule for enabling item focus is FALSE by default. Consilidated a number of redundant client / mob functions to use the same pathway for calculating effect values. --- common/ruletypes.h | 2 + zone/aa.cpp | 3 +- zone/aggro.cpp | 6 +- zone/attack.cpp | 16 ---- zone/bonuses.cpp | 7 ++ zone/client.h | 6 -- zone/effects.cpp | 187 ++++++++++++++++------------------------- zone/merc.cpp | 147 -------------------------------- zone/merc.h | 2 - zone/mob.cpp | 9 +- zone/mob.h | 10 ++- zone/npc.h | 6 +- zone/pets.cpp | 2 +- zone/spell_effects.cpp | 177 +++++++++++++++++++++++++++++--------- zone/spells.cpp | 31 +++---- 15 files changed, 250 insertions(+), 361 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 8ff077809..9874e4002 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -325,6 +325,8 @@ RULE_INT ( Spells, AI_IdleBeneficialChance, 100) // Chance while idle to do a be RULE_BOOL ( Spells, SHDProcIDOffByOne, true) // pre June 2009 SHD spell procs were off by 1, they stopped doing this in June 2009 (so UF+ spell files need this false) RULE_BOOL ( Spells, Jun182014HundredHandsRevamp, false) // this should be true for if you import a spell file newer than June 18, 2014 RULE_BOOL ( Spells, SwarmPetTargetLock, false) // Use old method of swarm pets target locking till target dies then despawning. +RULE_BOOL ( Spells, NPC_UseFocusFromSpells, true) // Allow npcs to use most spell derived focus effects. +RULE_BOOL ( Spells, NPC_UseFocusFromItems, false) // Allow npcs to use most item derived focus effects. RULE_CATEGORY_END() RULE_CATEGORY( Combat ) diff --git a/zone/aa.cpp b/zone/aa.cpp index 9cb6cf43f..28c4f60d7 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -519,8 +519,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u } } - if(IsClient()) - pet.duration += (CastToClient()->GetFocusEffect(focusSwarmPetDuration, spell_id) / 1000); + pet.duration += GetFocusEffect(focusSwarmPetDuration, spell_id) / 1000; pet.npc_id = record.npc_type; diff --git a/zone/aggro.cpp b/zone/aggro.cpp index dc9aa50ec..3e833aad9 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -1128,8 +1128,7 @@ int32 Mob::CheckAggroAmount(uint16 spell_id, bool isproc) int HateMod = RuleI(Aggro, SpellAggroMod); - if (IsClient()) - HateMod += CastToClient()->GetFocusEffect(focusSpellHateMod, spell_id); + HateMod += GetFocusEffect(focusSpellHateMod, spell_id); AggroAmount = (AggroAmount * HateMod) / 100; @@ -1178,8 +1177,7 @@ int32 Mob::CheckHealAggroAmount(uint16 spell_id, uint32 heal_possible) if (AggroAmount > 0) { int HateMod = RuleI(Aggro, SpellAggroMod); - if (IsClient()) - HateMod += CastToClient()->GetFocusEffect(focusSpellHateMod, spell_id); + HateMod += GetFocusEffect(focusSpellHateMod, spell_id); //Live AA - Spell casting subtlety HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod; diff --git a/zone/attack.cpp b/zone/attack.cpp index 825e90b58..b8c0a11ed 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1386,15 +1386,6 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att if(spell_id==0) spell_id = SPELL_UNKNOWN; - if(spell_id!=0 && spell_id != SPELL_UNKNOWN && other && damage > 0) - { - if(other->IsNPC() && !other->IsPet()) - { - float npcspellscale = other->CastToNPC()->GetSpellScale(); - damage = ((float)damage * npcspellscale) / (float)100; - } - } - // cut all PVP spell damage to 2/3 -solar // Blasting ourselfs is considered PvP //Don't do PvP mitigation if the caster is damaging himself @@ -3806,13 +3797,6 @@ void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) int32 curhp = GetHP(); uint32 acthealed = 0; - if (caster && amount > 0) { - if (caster->IsNPC() && !caster->IsPet()) { - float npchealscale = caster->CastToNPC()->GetHealScale(); - amount = (static_cast(amount) * npchealscale) / 100.0f; - } - } - if (amount > (maxhp - curhp)) acthealed = (maxhp - curhp); else diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 7944c8ba6..ac9602a67 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -3050,6 +3050,13 @@ void NPC::CalcItemBonuses(StatBonuses *newbon) if (cur->Worn.Effect>0 && (cur->Worn.Type == ET_WornEffect)) { // latent effects ApplySpellsBonuses(cur->Worn.Effect, cur->Worn.Level, newbon); } + + if (RuleB(Spells, NPC_UseFocusFromItems)){ + if (cur->Focus.Effect>0 && (cur->Focus.Type == ET_Focus)){ // focus effects + ApplySpellsBonuses(cur->Focus.Effect, cur->Focus.Level, newbon, 0, true); + } + } + if (cur->Haste > newbon->haste) newbon->haste = cur->Haste; } diff --git a/zone/client.h b/zone/client.h index a63f37b2f..7cbddfdb2 100644 --- a/zone/client.h +++ b/zone/client.h @@ -485,14 +485,8 @@ public: inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } - float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); - int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); - int32 GetActSpellHealing(uint16 spell_id, int32 value, Mob* target = nullptr); int32 GetActSpellCost(uint16 spell_id, int32); - int32 GetActSpellDuration(uint16 spell_id, int32); int32 GetActSpellCasttime(uint16 spell_id, int32); - int32 GetDotFocus(uint16 spell_id, int32 value); - int32 GetActDoTDamage(uint16 spell_id, int32 value, Mob* target = nullptr); virtual bool CheckFizzle(uint16 spell_id); virtual bool CheckSpellLevelRestriction(uint16 spell_id); virtual int GetCurrentBuffSlots() const; diff --git a/zone/effects.cpp b/zone/effects.cpp index 5c542d16d..54e206e85 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -30,7 +30,7 @@ #include "string_ids.h" #include "npc_ai.h" -float Client::GetActSpellRange(uint16 spell_id, float range, bool IsBard) +float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard) { float extrange = 100; @@ -39,94 +39,58 @@ float Client::GetActSpellRange(uint16 spell_id, float range, bool IsBard) return (range * extrange) / 100; } - -int32 NPC::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { - - //Quest scale all NPC spell damage via $npc->SetSpellFocusDMG(value) - //DoT Damage - Mob::DoBuffTic [spell_effects.cpp] / Direct Damage Mob::SpellEffect [spell_effects.cpp] - - int32 dmg = value; - - if (target) { - value += dmg*target->GetVulnerability(this, spell_id, 0)/100; - - if (spells[spell_id].buffduration == 0) - value -= target->GetFcDamageAmtIncoming(this, spell_id); - else - value -= target->GetFcDamageAmtIncoming(this, spell_id)/spells[spell_id].buffduration; - } - - value += dmg*GetSpellFocusDMG()/100; - - if (AI_HasSpellsEffects()){ - int16 chance = 0; - int ratio = 0; - - if (spells[spell_id].buffduration == 0) { - chance += spellbonuses.CriticalSpellChance + spellbonuses.FrenziedDevastation; - - if (chance && zone->random.Roll(chance)) { - ratio += spellbonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncNoStack; - value += (value*ratio)/100; - entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_BLAST, GetCleanName(), itoa(-value)); - } - } - else { - chance += spellbonuses.CriticalDoTChance; - if (chance && zone->random.Roll(chance)) { - ratio += spellbonuses.DotCritDmgIncrease; - value += (value*ratio)/100; - } - } - } - - return value; -} - -int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { +int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if (spells[spell_id].targettype == ST_Self) return value; + if (IsNPC()) + value += value*CastToNPC()->GetSpellFocusDMG()/100; + bool Critical = false; int32 value_BaseEffect = 0; + int chance = 0; value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); // Need to scale HT damage differently after level 40! It no longer scales by the constant value in the spell file. It scales differently, instead of 10 more damage per level, it does 30 more damage per level. So we multiply the level minus 40 times 20 if they are over level 40. - if ( (spell_id == SPELL_HARM_TOUCH || spell_id == SPELL_HARM_TOUCH2 || spell_id == SPELL_IMP_HARM_TOUCH ) && GetLevel() > 40) + if ((spell_id == SPELL_HARM_TOUCH || spell_id == SPELL_HARM_TOUCH2 || spell_id == SPELL_IMP_HARM_TOUCH ) && GetLevel() > 40) value -= (GetLevel() - 40) * 20; //This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch. - if (spell_id == SPELL_IMP_HARM_TOUCH) //Improved Harm Touch + if (spell_id == SPELL_IMP_HARM_TOUCH && IsClient()) //Improved Harm Touch value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch - int chance = RuleI(Spells, BaseCritChance); //Wizard base critical chance is 2% (Does not scale with level) + chance = RuleI(Spells, BaseCritChance); //Wizard base critical chance is 2% (Does not scale with level) chance += itembonuses.CriticalSpellChance + spellbonuses.CriticalSpellChance + aabonuses.CriticalSpellChance; - chance += itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation; - if (chance > 0 || (GetClass() == WIZARD && GetLevel() >= RuleI(Spells, WizCritLevel))) { + //Crtical Hit Calculation pathway + if (chance > 0 || (IsClient() && GetClass() == WIZARD && GetLevel() >= RuleI(Spells, WizCritLevel))) { int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals. //Improved Harm Touch is a guaranteed crit if you have at least one level of SCF. - if (spell_id == SPELL_IMP_HARM_TOUCH && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0)) + if (spell_id == SPELL_IMP_HARM_TOUCH && IsClient() && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0)) chance = 100; - if (zone->random.Roll(chance)) { + if (zone->random.Roll(chance)) { Critical = true; ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; } - else if (GetClass() == WIZARD && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Roll(RuleI(Spells, WizCritChance)))) { - ratio += zone->random.Int(20,70); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. (20-70 is parse confirmed) - Critical = true; + else if ((IsClient() && GetClass() == WIZARD) || (IsMerc() && GetClass() == CASTERDPS)) { + if ((GetLevel() >= RuleI(Spells, WizCritLevel)) && zone->random.Roll(RuleI(Spells, WizCritChance))){ + //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. (20-70 is parse confirmed) + ratio += zone->random.Int(20,70); + Critical = true; + } } - ratio += RuleI(Spells, WizCritRatio); //Default is zero - + if (IsClient() && GetClass() == WIZARD) + ratio += RuleI(Spells, WizCritRatio); //Default is zero + if (Critical){ value = value_BaseEffect*ratio/100; @@ -147,14 +111,19 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100; + else if (IsNPC() && CastToNPC()->GetSpellScale()) + value = int(static_cast(value) * CastToNPC()->GetSpellScale() / 100.0f); + entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_BLAST, GetName(), itoa(-value)); - Message_StringID(MT_SpellCrits, YOU_CRIT_BLAST, itoa(-value)); + + if (IsClient()) + Message_StringID(MT_SpellCrits, YOU_CRIT_BLAST, itoa(-value)); return value; } } - + //Non Crtical Hit Calculation pathway value = value_BaseEffect; value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; @@ -173,14 +142,20 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); + if (IsNPC() && CastToNPC()->GetSpellScale()) + value = int(static_cast(value) * CastToNPC()->GetSpellScale() / 100.0f); + return value; } -int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { +int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { if (target == nullptr) return value; + if (IsNPC()) + value += value*CastToNPC()->GetSpellFocusDMG()/100; + int32 value_BaseEffect = 0; int32 extra_dmg = 0; int16 chance = 0; @@ -209,25 +184,28 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { } value -= extra_dmg; + } + else { - return value; + value = value_BaseEffect; + value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; + value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; + value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; + extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) + + GetFocusEffect(focusFcDamageAmtCrit, spell_id) + + GetFocusEffect(focusFcDamageAmt, spell_id); + + if (extra_dmg) { + int duration = CalcBuffDuration(this, this, spell_id); + if (duration > 0) + extra_dmg /= duration; + } + + value -= extra_dmg; } - value = value_BaseEffect; - value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; - value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; - value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; - extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) + - GetFocusEffect(focusFcDamageAmtCrit, spell_id) + - GetFocusEffect(focusFcDamageAmt, spell_id); - - if (extra_dmg) { - int duration = CalcBuffDuration(this, this, spell_id); - if (duration > 0) - extra_dmg /= duration; - } - - value -= extra_dmg; + if (IsNPC() && CastToNPC()->GetSpellScale()) + value = int(static_cast(value) * CastToNPC()->GetSpellScale() / 100.0f); return value; } @@ -254,39 +232,14 @@ int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_s return extra_spell_amt; } - -int32 NPC::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { - - //Scale all NPC spell healing via SetSpellFocusHeal(value) - - value += value*GetSpellFocusHeal()/100; - - if (target) { - value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); - value += value*target->GetHealRate(spell_id, this)/100; - } - - //Allow for critical heal chance if NPC is loading spell effect bonuses. - if (AI_HasSpellsEffects()){ - if(spells[spell_id].buffduration < 1) { - if(spellbonuses.CriticalHealChance && (zone->random.Roll(spellbonuses.CriticalHealChance))) { - value = value*2; - entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_HEAL, GetCleanName(), itoa(value)); - } - } - else if(spellbonuses.CriticalHealOverTime && (zone->random.Roll(spellbonuses.CriticalHealOverTime))) { - value = value*2; - } - } - - return value; -} - -int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { +int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (target == nullptr) target = this; + if (IsNPC()) + value += value*CastToNPC()->GetSpellFocusHeal()/100; + int32 value_BaseEffect = 0; int16 chance = 0; int8 modifier = 1; @@ -323,10 +276,15 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { value += value*target->GetHealRate(spell_id, this)/100; + if (IsNPC() && CastToNPC()->GetHealScale()) + value = int(static_cast(value) * CastToNPC()->GetHealScale() / 100.0f); + if (Critical) { entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits, OTHER_CRIT_HEAL, GetName(), itoa(value)); - Message_StringID(MT_SpellCrits, YOU_CRIT_HEAL, itoa(value)); + + if (IsClient()) + Message_StringID(MT_SpellCrits, YOU_CRIT_HEAL, itoa(value)); } return value; @@ -343,9 +301,12 @@ int32 Client::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); if(chance && zone->random.Roll(chance)) - return (value * 2); + value *= 2; } + if (IsNPC() && CastToNPC()->GetHealScale()) + value = int(static_cast(value) * CastToNPC()->GetHealScale() / 100.0f); + return value; } @@ -359,9 +320,9 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) cost *= 2; // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell - if(this->itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) + if(itembonuses.Clairvoyance && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) { - int16 mana_back = this->itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; + int16 mana_back = itembonuses.Clairvoyance * zone->random.Int(1, 100) / 100; // Doesnt generate mana, so best case is a free spell if(mana_back > cost) mana_back = cost; @@ -451,7 +412,7 @@ int32 Client::GetActSpellCost(uint16 spell_id, int32 cost) return cost; } -int32 Client::GetActSpellDuration(uint16 spell_id, int32 duration) +int32 Mob::GetActSpellDuration(uint16 spell_id, int32 duration) { if (spells[spell_id].not_extendable) return duration; @@ -463,7 +424,7 @@ int32 Client::GetActSpellDuration(uint16 spell_id, int32 duration) // Only need this for clients, since the change was for bard songs, I assume we should keep non bard songs getting +1 // However if its bard or not and is mez, charm or fear, we need to add 1 so that client is in sync - if (!(IsShortDurationBuff(spell_id) && IsBardSong(spell_id)) || + if (IsClient() && !(IsShortDurationBuff(spell_id) && IsBardSong(spell_id)) || IsFearSpell(spell_id) || IsCharmSpell(spell_id) || IsMezSpell(spell_id) || @@ -664,7 +625,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { if(spell.recast_time > 0) { uint32 reduced_recast = spell.recast_time / 1000; - reduced_recast -= CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id); + reduced_recast -= GetFocusEffect(focusReduceRecastTime, spell_id); if(reduced_recast <= 0){ reduced_recast = 0; if (GetPTimers().Enabled((uint32)DiscTimer)) diff --git a/zone/merc.cpp b/zone/merc.cpp index 437790588..1c4165c1e 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2656,153 +2656,6 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2 + realTotal3; } - -int32 Merc::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { - - if (spells[spell_id].targettype == ST_Self) - return value; - - bool Critical = false; - int32 value_BaseEffect = 0; - - value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); - - int chance = RuleI(Spells, BaseCritChance); - chance += itembonuses.CriticalSpellChance + spellbonuses.CriticalSpellChance + aabonuses.CriticalSpellChance; - - if (chance > 0){ - - int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals. - - if (zone->random.Roll(chance)) { - Critical = true; - ratio += itembonuses.SpellCritDmgIncrease + spellbonuses.SpellCritDmgIncrease + aabonuses.SpellCritDmgIncrease; - ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack; - } - - else if (GetClass() == CASTERDPS && (GetLevel() >= RuleI(Spells, WizCritLevel)) && (zone->random.Roll(RuleI(Spells, WizCritChance)))) { - ratio = zone->random.Int(1,100); //Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. - Critical = true; - } - - ratio += RuleI(Spells, WizCritRatio); //Default is zero - - if (Critical){ - - value = value_BaseEffect*ratio/100; - - value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; - - value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100; - - if (target) { - value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100; - value -= target->GetFcDamageAmtIncoming(this, spell_id); - } - - value -= GetFocusEffect(focusFcDamageAmtCrit, spell_id)*ratio/100; - - value -= GetFocusEffect(focusFcDamageAmt, spell_id); - - if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) - value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value)*ratio/100; - - value = (value * GetSpellScale() / 100); - - entity_list.MessageClose_StringID(this, false, 100, MT_SpellCrits, - OTHER_CRIT_BLAST, GetName(), itoa(-value)); - - return value; - } - } - - value = value_BaseEffect; - - value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100; - - value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100; - - if (target) { - value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100; - value -= target->GetFcDamageAmtIncoming(this, spell_id); - } - - value -= GetFocusEffect(focusFcDamageAmtCrit, spell_id); - - value -= GetFocusEffect(focusFcDamageAmt, spell_id); - - if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) - value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value); - - value = (value * GetSpellScale() / 100); - - return value; -} - -int32 Merc::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { - - if (target == nullptr) - target = this; - - int32 value_BaseEffect = 0; - int16 chance = 0; - int8 modifier = 1; - bool Critical = false; - - value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100); - - value = value_BaseEffect; - - value += int(value_BaseEffect*GetFocusEffect(focusImprovedHeal, spell_id)/100); - - // Instant Heals - if(spells[spell_id].buffduration < 1) { - - chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance; - - chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); - - if (spellbonuses.CriticalHealDecay) - chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay); - - if(chance && zone->random.Roll(chance)) { - Critical = true; - modifier = 2; //At present time no critical heal amount modifier SPA exists. - } - - value *= modifier; - value += GetFocusEffect(focusFcHealAmtCrit, spell_id) * modifier; - value += GetFocusEffect(focusFcHealAmt, spell_id); - value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id); - - if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5) - value += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier; - - value += value*target->GetHealRate(spell_id, this)/100; - - if (Critical) - entity_list.MessageClose(this, false, 100, MT_SpellCrits, "%s performs an exceptional heal! (%d)", GetName(), value); - - return value; - } - - //Heal over time spells. [Heal Rate and Additional Healing effects do not increase this value] - else { - - chance = itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime; - - chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id); - - if (spellbonuses.CriticalRegenDecay) - chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay); - - if(chance && zone->random.Roll(chance)) - return (value * 2); - } - - return value; -} - int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost) { // Formula = Unknown exact, based off a random percent chance up to mana cost(after focuses) of the cast spell diff --git a/zone/merc.h b/zone/merc.h index fdcdbec49..167fe70d6 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -83,8 +83,6 @@ public: Corpse* GetGroupMemberCorpse(); // Merc Spell Casting Methods - virtual int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); - virtual int32 GetActSpellHealing(uint16 spell_id, int32 value, Mob* target = nullptr); virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); virtual int32 GetActSpellCost(uint16 spell_id, int32 cost); int8 GetChanceToCastBySpellType(int16 spellType); diff --git a/zone/mob.cpp b/zone/mob.cpp index 13a2eb06b..f7193fbed 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2926,6 +2926,10 @@ uint32 Mob::GetLevelHP(uint8 tlevel) } int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime) { + + int32 cast_reducer = 0; + cast_reducer += GetFocusEffect(focusSpellHaste, spell_id); + if (level >= 60 && casttime > 1000) { casttime = casttime / 2; @@ -2938,6 +2942,8 @@ int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime) { else casttime -= cast_deduction; } + + casttime = (casttime*(100 - cast_reducer)/100); return(casttime); } @@ -2973,8 +2979,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { bool twinproc = false; int32 twinproc_chance = 0; - if(IsClient()) - twinproc_chance = CastToClient()->GetFocusEffect(focusTwincast, spell_id); + twinproc_chance = GetFocusEffect(focusTwincast, spell_id); if(twinproc_chance && zone->random.Roll(twinproc_chance)) twinproc = true; diff --git a/zone/mob.h b/zone/mob.h index 6135c6571..dddce98f8 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -198,11 +198,12 @@ public: bool item_bonus = false, uint32 ticsremaining = 0, int buffslot = -1, bool IsAISpellEffect = false, uint16 effect_id = 0, int32 se_base = 0, int32 se_limit = 0, int32 se_max = 0); void NegateSpellsBonuses(uint16 spell_id); - virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false) { return range;} - virtual int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr) { return value; } - virtual int32 GetActSpellHealing(uint16 spell_id, int32 value, Mob* target = nullptr) { return value; } + virtual float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); + virtual int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); + virtual int32 GetActDoTDamage(uint16 spell_id, int32 value, Mob* target); + virtual int32 GetActSpellHealing(uint16 spell_id, int32 value, Mob* target = nullptr); virtual int32 GetActSpellCost(uint16 spell_id, int32 cost){ return cost;} - virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;} + virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration); virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false, int resist_override = 0, bool CharismaCheck = false, bool CharmTick = false, bool IsRoot = false); @@ -1044,6 +1045,7 @@ protected: int GetKickDamage(); int GetBashDamage(); virtual void ApplySpecialAttackMod(SkillUseTypes skill, int32 &dmg, int32 &mindmg); + virtual int16 GetFocusEffect(focusType type, uint16 spell_id) { return 0; } void CalculateNewFearpoint(); float FindGroundZ(float new_x, float new_y, float z_offset=0.0); Map::Vertex UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChange, bool &NodeReached); diff --git a/zone/npc.h b/zone/npc.h index cccf3ecf0..d4f3bfa64 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -135,9 +135,6 @@ public: void CalcNPCRegen(); void CalcNPCDamage(); - int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); - int32 GetActSpellHealing(uint16 spell_id, int32 value, Mob* target = nullptr); - virtual void SetTarget(Mob* mob); virtual uint16 GetSkill(SkillUseTypes skill_num) const { if (skill_num <= HIGHEST_SKILL) { return skills[skill_num]; } return 0; } @@ -406,6 +403,8 @@ public: bool IsRaidTarget() const { return raid_target; }; + int16 GetFocusEffect(focusType type, uint16 spell_id); + protected: const NPCType* NPCTypedata; @@ -446,6 +445,7 @@ protected: virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0); AISpellsVar_Struct AISpellVar; + uint32 npc_spells_effects_id; std::vector AIspellsEffects; bool HasAISpellEffects; diff --git a/zone/pets.cpp b/zone/pets.cpp index 052a44bea..5c2bda36d 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -230,7 +230,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, int16 act_power = 0; // The actual pet power we'll use. if (petpower == -1) { if (this->IsClient()) { - act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id); + act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id);//Client only act_power = CastToClient()->mod_pet_power(act_power, spell_id); } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 59526fbbc..9e7d87503 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -179,11 +179,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int numhit = spells[spell_id].numhits; - if (caster && caster->IsClient()){ - numhit += numhit*caster->CastToClient()->GetFocusEffect(focusFcLimitUse, spell_id)/100; - numhit += caster->CastToClient()->GetFocusEffect(focusIncreaseNumHits, spell_id); - } - + numhit += numhit*caster->GetFocusEffect(focusFcLimitUse, spell_id)/100; + numhit += caster->GetFocusEffect(focusIncreaseNumHits, spell_id); buffs[buffslot].numhits = numhit; } @@ -714,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) - effect_value += effect_value*caster->CastToClient()->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; + effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; Stun(effect_value); } else { @@ -2265,8 +2262,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) int16 focus = 0; int ReuseTime = spells[spell_id].recast_time + spells[spell_id].recovery_time; - if(caster->IsClient()) - focus = caster->CastToClient()->GetFocusEffect(focusFcBaseEffects, spell_id); + focus = caster->GetFocusEffect(focusFcBaseEffects, spell_id); switch(spells[spell_id].skill) { @@ -3469,30 +3465,18 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste { effect_value = CalcSpellEffectValue(spell_id, i, caster_level, caster, ticsremaining); //Handle client cast DOTs here. - if (caster && caster->IsClient() && IsDetrimentalSpell(spell_id) && effect_value < 0) { - - effect_value = caster->CastToClient()->GetActDoTDamage(spell_id, effect_value, this); - - if (!caster->CastToClient()->GetFeigned()) - AddToHateList(caster, -effect_value); - } - - if(effect_value < 0) - { - if(caster) - { - if(!caster->IsClient()){ - - if (!IsClient()) //Allow NPC's to generate hate if casted on other NPC's. - AddToHateList(caster, -effect_value); - } - - if(caster->IsNPC()) - effect_value = caster->CastToNPC()->GetActSpellDamage(spell_id, effect_value, this); - - caster->ResourceTap(-effect_value, spell_id); + if (caster && effect_value < 0 && IsDetrimentalSpell(spell_id)){ + + if (caster->IsClient()){ + if (!caster->CastToClient()->GetFeigned()) + AddToHateList(caster, -effect_value); } + else if (!IsClient()) //Allow NPC's to generate hate if casted on other NPC's. + AddToHateList(caster, -effect_value); + effect_value = caster->GetActDoTDamage(spell_id, effect_value, this); + + caster->ResourceTap(-effect_value, spell_id); effect_value = -effect_value; Damage(caster, effect_value, spell_id, spell.skill, false, i, true); } else if(effect_value > 0) { @@ -5318,11 +5302,8 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { //Improved Healing, Damage & Mana Reduction are handled differently in that some are random percentages //In these cases we need to find the most powerful effect, so that each piece of gear wont get its own chance - if((type == focusManaCost || type == focusImprovedHeal || type == focusImprovedDamage) - && RuleB(Spells, LiveLikeFocusEffects)) - { + if(RuleB(Spells, LiveLikeFocusEffects) && (type == focusManaCost || type == focusImprovedHeal || type == focusImprovedDamage)) rand_effectiveness = true; - } //Check if item focus effect exists for the client. if (itembonuses.FocusEffects[type]){ @@ -5540,6 +5521,122 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2 + realTotal3; } +int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { + + int16 realTotal = 0; + int16 realTotal2 = 0; + bool rand_effectiveness = false; + + //Improved Healing, Damage & Mana Reduction are handled differently in that some are random percentages + //In these cases we need to find the most powerful effect, so that each piece of gear wont get its own chance + if(RuleB(Spells, LiveLikeFocusEffects) && (type == focusManaCost || type == focusImprovedHeal || type == focusImprovedDamage)) + rand_effectiveness = true; + + if (RuleB(Spells, NPC_UseFocusFromItems) && itembonuses.FocusEffects[type]){ + + const Item_Struct* TempItem = 0; + const Item_Struct* UsedItem = 0; + uint16 UsedFocusID = 0; + int16 Total = 0; + int16 focus_max = 0; + int16 focus_max_real = 0; + + //item focus + for(int i = 0; i < EmuConstants::EQUIPMENT_SIZE; i++){ + const Item_Struct *cur = database.GetItem(equipment[i]); + + if(!cur) + continue; + + TempItem = cur; + + if (TempItem && TempItem->Focus.Effect > 0 && TempItem->Focus.Effect != SPELL_UNKNOWN) { + if(rand_effectiveness) { + focus_max = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id, true); + if (focus_max > 0 && focus_max_real >= 0 && focus_max > focus_max_real) { + focus_max_real = focus_max; + UsedItem = TempItem; + UsedFocusID = TempItem->Focus.Effect; + } else if (focus_max < 0 && focus_max < focus_max_real) { + focus_max_real = focus_max; + UsedItem = TempItem; + UsedFocusID = TempItem->Focus.Effect; + } + } + else { + Total = CalcFocusEffect(type, TempItem->Focus.Effect, spell_id); + if (Total > 0 && realTotal >= 0 && Total > realTotal) { + realTotal = Total; + UsedItem = TempItem; + UsedFocusID = TempItem->Focus.Effect; + } else if (Total < 0 && Total < realTotal) { + realTotal = Total; + UsedItem = TempItem; + UsedFocusID = TempItem->Focus.Effect; + } + } + } + } + + if(UsedItem && rand_effectiveness && focus_max_real != 0) + realTotal = CalcFocusEffect(type, UsedFocusID, spell_id); + } + + if (RuleB(Spells, NPC_UseFocusFromSpells) && spellbonuses.FocusEffects[type]){ + + //Spell Focus + int16 Total2 = 0; + int16 focus_max2 = 0; + int16 focus_max_real2 = 0; + + int buff_tracker = -1; + int buff_slot = 0; + uint16 focusspellid = 0; + uint16 focusspell_tracker = 0; + int buff_max = GetMaxTotalSlots(); + for (buff_slot = 0; buff_slot < buff_max; buff_slot++) { + focusspellid = buffs[buff_slot].spellid; + if (focusspellid == 0 || focusspellid >= SPDAT_RECORDS) + continue; + + if(rand_effectiveness) { + focus_max2 = CalcFocusEffect(type, focusspellid, spell_id, true); + if (focus_max2 > 0 && focus_max_real2 >= 0 && focus_max2 > focus_max_real2) { + focus_max_real2 = focus_max2; + buff_tracker = buff_slot; + focusspell_tracker = focusspellid; + } else if (focus_max2 < 0 && focus_max2 < focus_max_real2) { + focus_max_real2 = focus_max2; + buff_tracker = buff_slot; + focusspell_tracker = focusspellid; + } + } + else { + Total2 = CalcFocusEffect(type, focusspellid, spell_id); + if (Total2 > 0 && realTotal2 >= 0 && Total2 > realTotal2) { + realTotal2 = Total2; + buff_tracker = buff_slot; + focusspell_tracker = focusspellid; + } else if (Total2 < 0 && Total2 < realTotal2) { + realTotal2 = Total2; + buff_tracker = buff_slot; + focusspell_tracker = focusspellid; + } + } + } + + if(focusspell_tracker && rand_effectiveness && focus_max_real2 != 0) + realTotal2 = CalcFocusEffect(type, focusspell_tracker, spell_id); + + // For effects like gift of mana that only fire once, save the spellid into an array that consists of all available buff slots. + if(buff_tracker >= 0 && buffs[buff_tracker].numhits > 0) { + m_spellHitsLeft[buff_tracker] = focusspell_tracker; + } + } + + return realTotal + realTotal2; +} + void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) { /* @@ -5946,15 +6043,13 @@ int32 Mob::ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, boo if (!caster) return value; - if (caster->IsClient()){ - int16 focus = caster->CastToClient()->GetFocusEffect(focusFcBaseEffects, spell_id); + int16 focus = GetFocusEffect(focusFcBaseEffects, spell_id); - if (IsBard) - value += focus; + if (IsBard) + value += focus; + else + value += value*focus/100; - else - value += value*focus/100; - } return value; } diff --git a/zone/spells.cpp b/zone/spells.cpp index b051dfdca..baae446c8 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -176,7 +176,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, BuffFadeByEffect(SE_Sanctuary); if(IsClient()){ - int chance = CastToClient()->GetFocusEffect(focusFcMute, spell_id); + int chance = CastToClient()->GetFocusEffect(focusFcMute, spell_id);//Client only if (zone->random.Roll(chance)) { Message_StringID(13, SILENCED_STRING); @@ -1043,7 +1043,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // Check for consumables and Reagent focus items // first check for component reduction if(IsClient()) { - int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id); + int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { mlog(SPELLS__CASTING, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { @@ -2237,7 +2237,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 { recast -= GetAA(aaTouchoftheWicked) * 420; } - int reduction = CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id); + int reduction = CastToClient()->GetFocusEffect(focusReduceRecastTime, spell_id);//Client only if(reduction) recast -= reduction; @@ -4189,14 +4189,8 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get resist modifier and adjust it based on focus 2 resist about eq to 1% resist chance int resist_modifier = (use_resist_override) ? resist_override : spells[spell_id].ResistDiff; - if(caster->IsClient()) - { - if(IsValidSpell(spell_id)) - { - int focus_resist = caster->CastToClient()->GetFocusEffect(focusResistRate, spell_id); - resist_modifier -= 2 * focus_resist; - } - } + int focus_resist = caster->GetFocusEffect(focusResistRate, spell_id); + resist_modifier -= 2 * focus_resist; //Check for fear resist bool IsFear = false; @@ -4580,17 +4574,14 @@ float Mob::GetAOERange(uint16 spell_id) { if(range == 0) range = 10; //something.... - if (IsClient()) { - - if(IsBardSong(spell_id) && IsBeneficialSpell(spell_id)) { - //Live AA - Extended Notes, SionachiesCrescendo - float song_bonus = static_cast(aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange); - range += range*song_bonus /100.0f; - } - - range = CastToClient()->GetActSpellRange(spell_id, range); + if(IsBardSong(spell_id) && IsBeneficialSpell(spell_id)) { + //Live AA - Extended Notes, SionachiesCrescendo + float song_bonus = static_cast(aabonuses.SongRange + spellbonuses.SongRange + itembonuses.SongRange); + range += range*song_bonus /100.0f; } + range = GetActSpellRange(spell_id, range); + return(range); } From a4df155219d95d03799f7449d1775f6b6dd6b708 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 8 Dec 2014 01:47:29 -0500 Subject: [PATCH 0528/1883] update --- zone/npc.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zone/npc.h b/zone/npc.h index d4f3bfa64..d374f4950 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -402,9 +402,7 @@ public: void AISpellsList(Client *c); bool IsRaidTarget() const { return raid_target; }; - - int16 GetFocusEffect(focusType type, uint16 spell_id); - + protected: const NPCType* NPCTypedata; @@ -444,6 +442,7 @@ protected: virtual bool AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes); virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0); AISpellsVar_Struct AISpellVar; + int16 GetFocusEffect(focusType type, uint16 spell_id); uint32 npc_spells_effects_id; From 9db39b5eec80ab4b89c3b73471c21118b98ca3b6 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Mon, 8 Dec 2014 05:46:10 -0500 Subject: [PATCH 0529/1883] Added a feature that allows an EQ client to log in directly to World without having to enter the LoginServer, provided the 'password' field is set in WorldServer. Mainly used for administration purposes. A DLL hack is needed to utilize this feature, and the DLL itself will be posted (source included) on the EQEmulator forums. It uses Microsoft Detours 1.5. Up to you guys if you want to add the source to this program here. --- changelog.txt | 3 +++ world/client.cpp | 7 ++++++- world/clientlist.cpp | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index e24dcd59d..25e6f2e54 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/08/2014 == +Secrets: Added a feature that allows an EQ client to log in directly to World without having to enter the LoginServer, provided the 'password' field is set in WorldServer. + == 12/04/2014 == Kayen: Ranged attacks will now more accurately check MAX firing range, fixing the issue where you would hit ranged attack and nothing would happpen due to incorrect server side range checks. diff --git a/world/client.cpp b/world/client.cpp index e37015e19..decb98f9a 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -397,6 +397,11 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else if(strncasecmp(name, "LS#", 3) == 0) id=atoi(&name[3]); + else if(database.GetAccountIDByName(name)){ + int16 status = 0; + uint32 lsid = 0; + id = database.GetAccountIDByName(name, &status, &lsid); + } else id=atoi(name); #ifdef IPBASED_AUTH_HACK @@ -406,7 +411,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { clog(WORLD__CLIENT_ERR,"Error: Login server login while not connected to login server."); return false; } - if ((minilogin && (cle = client_list.CheckAuth(id,password,ip))) || (cle = client_list.CheckAuth(id, password))) + if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 6de17d176..c33822d93 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -424,11 +424,13 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) } int16 tmpadmin; - _log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword); + //_log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword); uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin); if (accid) { - ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), accid, iName, tmpMD5, tmpadmin); + uint32 lsid = 0; + database.GetAccountIDByName(iName, &tmpadmin, &lsid); + ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0); clientlist.Append(tmp); return tmp; } From 8df6e7e26be8d4154d93fde71bd2d00cff84023d Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 8 Dec 2014 18:44:37 -0500 Subject: [PATCH 0530/1883] ADD FD check before adding projectile generated hate. --- zone/special_attacks.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 928353149..d5b6aef6d 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -979,7 +979,9 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (HeadShot) entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FATAL_BOW_SHOT, GetName()); - other->AddToHateList(this, hate, 0, false); + if (IsClient() && !CastToClient()->GetFeigned()) + other->AddToHateList(this, hate, 0, false); + other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillArchery); //Skill Proc Success @@ -1513,7 +1515,9 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else TotalDmg = -5; - other->AddToHateList(this, 2*WDmg, 0, false); + if (IsClient() && !CastToClient()->GetFeigned()) + other->AddToHateList(this, 2*WDmg, 0, false); + other->Damage(this, TotalDmg, SPELL_UNKNOWN, SkillThrowing); if (TotalDmg > 0 && HasSkillProcSuccess() && other && !other->HasDied()){ From ba2aefc5729bacdd900993243f8d0a39317d3a43 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Mon, 8 Dec 2014 18:55:23 -0500 Subject: [PATCH 0531/1883] NPC Focus Effects Optional Rules SQL --- utils/sql/git/optional/2014_12_8_NPC_FocusEffectRules.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 utils/sql/git/optional/2014_12_8_NPC_FocusEffectRules.sql diff --git a/utils/sql/git/optional/2014_12_8_NPC_FocusEffectRules.sql b/utils/sql/git/optional/2014_12_8_NPC_FocusEffectRules.sql new file mode 100644 index 000000000..7cbbb36b1 --- /dev/null +++ b/utils/sql/git/optional/2014_12_8_NPC_FocusEffectRules.sql @@ -0,0 +1,2 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:NPC_UseFocusFromSpells', 'true', 'Allow npcs to use most spell buff derived focus effects.'); +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:NPC_UseFocusFromItems', 'false', 'Allow npcs to use most item derived focus effects.'); From 7e7ec8e3d289867508a4eb9944176324b6d7d849 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 8 Dec 2014 20:58:49 -0500 Subject: [PATCH 0532/1883] Be more explicit about what we are checking (This removes a crap ton of clang warnings) --- common/seperator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/seperator.h b/common/seperator.h index 2524748d9..62054d137 100644 --- a/common/seperator.h +++ b/common/seperator.h @@ -126,7 +126,7 @@ public: if (check[i] == '.' && !SeenDec) { SeenDec = true; } - else if (i == 0 && (check[i] == '-' || check[i] == '+') && !check[i+1] == 0) { + else if (i == 0 && (check[i] == '-' || check[i] == '+') && check[i + 1] != '\0') { // this is ok, do nothin } else { From 4047c70de111e2be1bda91c5f2d49b5f1f6a9add Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 9 Dec 2014 00:38:20 -0500 Subject: [PATCH 0533/1883] Fix for completely broken skill proc function. --- zone/attack.cpp | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index b8c0a11ed..9b5f420a8 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4505,17 +4505,23 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && (!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e]))) { - base_spell_id = spellbonuses.SkillProc[e]; - base_spell_id = 0; + + if (Success) + base_spell_id = spellbonuses.SkillProcSuccess[e]; + else + base_spell_id = spellbonuses.SkillProc[e]; + + proc_spell_id = 0; ProcMod = 0; for (int i = 0; i < EFFECT_COUNT; i++) { - if (spells[base_spell_id].effectid[i] == SE_SkillProc) { + + if (spells[base_spell_id].effectid[i] == SE_SkillProc || spells[base_spell_id].effectid[i] == SE_SkillProcSuccess) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); } - else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].effectid[i] <= HIGHEST_SKILL) { + else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= HIGHEST_SKILL) { if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); @@ -4528,6 +4534,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui } } else { + //Reset and check for proc in sequence proc_spell_id = 0; ProcMod = 0; } @@ -4542,17 +4549,22 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && (!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e]))) { - base_spell_id = itembonuses.SkillProc[e]; - base_spell_id = 0; + + if (Success) + base_spell_id = itembonuses.SkillProcSuccess[e]; + else + base_spell_id = itembonuses.SkillProc[e]; + + proc_spell_id = 0; ProcMod = 0; for (int i = 0; i < EFFECT_COUNT; i++) { - if (spells[base_spell_id].effectid[i] == SE_SkillProc) { + if (spells[base_spell_id].effectid[i] == SE_SkillProc || spells[base_spell_id].effectid[i] == SE_SkillProcSuccess) { proc_spell_id = spells[base_spell_id].base[i]; ProcMod = static_cast(spells[base_spell_id].base2[i]); } - else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].effectid[i] <= HIGHEST_SKILL) { + else if (spells[base_spell_id].effectid[i] == SE_LimitToSkill && spells[base_spell_id].base[i] <= HIGHEST_SKILL) { if (CanProc && spells[base_spell_id].base[i] == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); @@ -4584,8 +4596,14 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (CanProc && (!Success && aabonuses.SkillProc[e]) || (Success && aabonuses.SkillProcSuccess[e])){ - int aaid = aabonuses.SkillProc[e]; - base_spell_id = 0; + int aaid = 0; + + if (Success) + base_spell_id = aabonuses.SkillProcSuccess[e]; + else + base_spell_id = aabonuses.SkillProc[e]; + + proc_spell_id = 0; ProcMod = 0; std::map >::const_iterator find_iter = aa_effects.find(aaid); @@ -4598,12 +4616,12 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui base2 = iter->second.base2; slot = iter->second.slot; - if (effect == SE_SkillProc) { + if (effect == SE_SkillProc || effect == SE_SkillProcSuccess) { proc_spell_id = base1; ProcMod = static_cast(base2); } - else if (effect == SE_LimitToSkill && effect <= HIGHEST_SKILL) { + else if (effect == SE_LimitToSkill && base1 <= HIGHEST_SKILL) { if (CanProc && base1 == skill && IsValidSpell(proc_spell_id)) { float final_chance = chance * (ProcMod / 100.0f); From 37951d09c73693bb22e57cbc8409ee5042947ab4 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 9 Dec 2014 21:18:56 -0600 Subject: [PATCH 0534/1883] (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example). --- changelog.txt | 3 + common/eq_packet_structs.h | 57 +++++-- common/item_fieldlist.h | 1 + common/item_struct.h | 3 +- common/patches/client62.cpp | 7 +- common/patches/rof.cpp | 32 ++-- common/patches/rof2.cpp | 34 ++-- common/patches/rof2_structs.h | 97 ++++++------ common/patches/rof_structs.h | 27 ++-- common/patches/sod.cpp | 24 +-- common/patches/sod_structs.h | 12 +- common/patches/sof.cpp | 20 +-- common/patches/sof_structs.h | 13 +- common/patches/titanium.cpp | 6 +- common/patches/underfoot.cpp | 24 +-- common/patches/underfoot_structs.h | 13 +- common/shareddb.cpp | 21 ++- utils/sql/db_update_manifest.txt | 1 + .../2014_12_09_items_table_update.sql | 1 + world/worlddb.cpp | 8 +- zone/bot.cpp | 121 ++++----------- zone/client.cpp | 145 +++++++++++------- zone/client_packet.cpp | 2 +- zone/command.cpp | 12 +- zone/merc.cpp | 24 ++- zone/mob.cpp | 73 +++++++-- zone/mob.h | 3 +- zone/perl_mob.cpp | 10 +- 28 files changed, 444 insertions(+), 350 deletions(-) create mode 100644 utils/sql/git/required/2014_12_09_items_table_update.sql diff --git a/changelog.txt b/changelog.txt index 25e6f2e54..2fe60ee70 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/09/2014 == +Trevius: (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example). + == 12/08/2014 == Secrets: Added a feature that allows an EQ client to log in directly to World without having to enter the LoginServer, provided the 'password' field is set in WorldServer. diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 62a166c67..cffe4e354 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -145,6 +145,28 @@ struct Color_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*/ +}; + +struct CharSelectEquip { + uint32 material; + uint32 unknown1; + uint32 elitematerial; + uint32 heroforgemodel; + uint32 material2; + Color_Struct color; +}; + /* ** Character Selection Struct ** Length: 1704 Bytes @@ -152,10 +174,11 @@ struct Color_Struct */ struct CharacterSelect_Struct { /*0000*/ uint32 race[10]; // Characters Race -/*0040*/ Color_Struct cs_colors[10][9]; // Characters Equipment Colors +/*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) +/*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 @@ -258,21 +281,21 @@ struct Spawn_Struct { /*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader /*0194*/ uint8 unknown0194[3]; /*0197*/ union - { - struct - { - /*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual - /*0201*/ uint32 equip_chest; // Equipment: Chest Visual - /*0205*/ uint32 equip_arms; // Equipment: Arms Visual - /*0209*/ uint32 equip_bracers; // Equipment: Bracers Visual - /*0213*/ uint32 equip_hands; // Equipment: Hands Visual - /*0217*/ uint32 equip_legs; // Equipment: Legs Visual - /*0221*/ uint32 equip_feet; // Equipment: Feet Visual - /*0225*/ uint32 equip_primary; // Equipment: Primary Visual - /*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual - } equip; - /*0197*/ uint32 equipment[_MaterialCount]; // Array elements correspond to struct equipment above - }; +{ + struct + { + /*0000*/ EquipStruct equip_helmet; // Equipment: Helmet visual + /*0000*/ EquipStruct equip_chest; // Equipment: Chest visual + /*0000*/ EquipStruct equip_arms; // Equipment: Arms visual + /*0000*/ EquipStruct equip_bracers; // Equipment: Wrist visual + /*0000*/ EquipStruct equip_hands; // Equipment: Hands visual + /*0000*/ EquipStruct equip_legs; // Equipment: Legs visual + /*0000*/ EquipStruct equip_feet; // Equipment: Boots visual + /*0000*/ EquipStruct equip_primary; // Equipment: Main visual + /*0000*/ EquipStruct equip_secondary; // Equipment: Off visual + } equip; + /*0000*/ EquipStruct equipment[_MaterialCount]; +}; /*0233*/ float runspeed; // Speed when running /*0036*/ uint8 afk; // 0=no, 1=afk /*0238*/ uint32 guildID; // Current guild diff --git a/common/item_fieldlist.h b/common/item_fieldlist.h index fb3e4b41e..42ec12554 100644 --- a/common/item_fieldlist.h +++ b/common/item_fieldlist.h @@ -65,6 +65,7 @@ F(UNK054) F(maxcharges) F(itemtype) F(material) +F(herosforgemodel) F(sellrate) F(UNK059) F(casttime) diff --git a/common/item_struct.h b/common/item_struct.h index 26d3623bd..66af3d0c6 100644 --- a/common/item_struct.h +++ b/common/item_struct.h @@ -143,7 +143,7 @@ struct Item_Struct { uint8 Delay; // Delay * 10 uint8 RecLevel; // Recommended level to use item uint8 RecSkill; // Recommended skill to use item (refers to primary skill of item) - uint8 ElemDmgType; // Elemental Damage Type (1=magic, 2=fire) + uint8 ElemDmgType; // Elemental Damage Type (1=magic, 2=fire) uint8 ElemDmgAmt; // Elemental Damage uint8 Range; // Range of item uint32 Damage; // Delay between item usage (in 0.1 sec increments) @@ -154,6 +154,7 @@ struct Item_Struct { int16 MaxCharges; // Maximum charges items can hold: -1 if not a chargeable item uint8 ItemType; // Item Type/Skill (itemClass* from above) uint8 Material; // Item material type + uint32 HerosForgeModel;// Hero's Forge Armor Model Type (2-13?) float SellRate; // Sell rate //uint32 Unk059; union { diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index c291d2bc4..f3681721e 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -546,6 +546,7 @@ namespace Client62 for (r = 0; r < 9; r++) { OUT(item_material[r]); OUT(item_tint[r].color); + } for (r = 0; r < structs::MAX_PP_AA_ARRAY; r++) { OUT(aa_array[r].AA); @@ -785,8 +786,8 @@ namespace Client62 OUT(beard[r]); int k; for (k = 0; k < 9; k++) { - OUT(equip[r][k]); - OUT(cs_colors[r][k].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]); @@ -934,7 +935,7 @@ namespace Client62 eq->petOwnerId = emu->petOwnerId; eq->guildrank = emu->guildrank; for (k = 0; k < 9; k++) { - eq->equipment[k] = emu->equipment[k]; + eq->equipment[k] = emu->equipment[k].material; eq->colors[k].color = emu->colors[k].color; } for (k = 0; k < 8; k++) { diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index c7efe0264..43b411dca 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2874,12 +2874,12 @@ namespace RoF eq2->face = emu->face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].equip0 = emu->equip[r][k]; - eq2->equip[k].equip1 = 0; - eq2->equip[k].equip2 = 0; - eq2->equip[k].itemid = 0; - eq2->equip[k].equip3 = emu->equip[r][k]; - eq2->equip[k].color.color = emu->cs_colors[r][k].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; @@ -3809,11 +3809,11 @@ namespace RoF structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].equip0 = emu->equipment[k]; - Equipment[k].equip1 = 0; - Equipment[k].equip2 = 0; - Equipment[k].equip3 = 0; - Equipment[k].itemId = 0; + Equipment[k].material = emu->equipment[k].material; + Equipment[k].unknown1 = emu->equipment[k].unknown1; + Equipment[k].elitematerial = emu->equipment[k].elitematerial; + Equipment[k].material2 = emu->equipment[k].heroforgemodel; + Equipment[k].elitematerial = emu->equipment[k].material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -3826,13 +3826,13 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]); + 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]); + 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); @@ -5017,10 +5017,10 @@ namespace RoF ibs.Prestige = 0; ibs.ItemType = item->ItemType; ibs.Material = item->Material; - ibs.unknown7 = 0; + ibs.MaterialUnknown1 = 0; ibs.EliteMaterial = item->EliteMaterial; - ibs.unknown_RoF3 = 0; - ibs.unknown_RoF4 = 0; + ibs.HerosForgeModel = item->HerosForgeModel; + ibs.MaterialUnknown2 = 0; ibs.SellRate = item->SellRate; ibs.CombatEffects = item->CombatEffects; ibs.Shielding = item->Shielding; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4d403253f..a22d2d4c5 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2874,12 +2874,12 @@ namespace RoF2 eq2->face = emu->face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].equip0 = emu->equip[r][k]; - eq2->equip[k].equip1 = 0; - eq2->equip[k].equip2 = 0; - eq2->equip[k].itemid = 0; - eq2->equip[k].equip3 = emu->equip[r][k]; - eq2->equip[k].color.color = emu->cs_colors[r][k].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; @@ -3813,11 +3813,11 @@ namespace RoF2 structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].equip0 = emu->equipment[k]; - Equipment[k].equip1 = 0; - Equipment[k].equip2 = 0; - Equipment[k].equip3 = 0; - Equipment[k].itemId = 0; + Equipment[k].material = emu->equipment[k].material; + Equipment[k].unknown1 = emu->equipment[k].unknown1; + Equipment[k].elitematerial = emu->equipment[k].elitematerial; + Equipment[k].material2 = emu->equipment[k].heroforgemodel; + Equipment[k].elitematerial = emu->equipment[k].material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -3830,13 +3830,13 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]); + 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]); + 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); @@ -4919,7 +4919,7 @@ namespace RoF2 hdrf.unknowna5 = 0; hdrf.ItemClass = item->ItemClass; ss.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish)); - + if (strlen(item->Name) > 0) { ss.write(item->Name, strlen(item->Name)); @@ -5021,10 +5021,10 @@ namespace RoF2 ibs.Prestige = 0; ibs.ItemType = item->ItemType; ibs.Material = item->Material; - ibs.unknown7 = 0; + ibs.MaterialUnknown1 = 0; ibs.EliteMaterial = item->EliteMaterial; - ibs.unknown_RoF23 = 0; - ibs.unknown_RoF24 = 0; + ibs.HerosForgeModel = item->HerosForgeModel; + ibs.MaterialUnknown2 = 0; ibs.SellRate = item->SellRate; ibs.CombatEffects = item->CombatEffects; ibs.Shielding = item->Shielding; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 4bc9a9bb3..572a5a0f0 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -160,13 +160,25 @@ struct Color_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*/ +}; + struct CharSelectEquip { - //totally guessed; - uint32 equip0; - uint32 equip1; - uint32 equip2; - uint32 itemid; - uint32 equip3; + uint32 material; + uint32 unknown1; + uint32 elitematerial; + uint32 heroforgemodel; + uint32 material2; Color_Struct color; }; @@ -252,21 +264,6 @@ struct Membership_Struct /*104*/ }; - -/* -* Visible equiptment. -* Size: 20 Octets -*/ -struct EquipStruct { -/*00*/ uint32 equip0; -/*04*/ uint32 equip1; -/*08*/ uint32 equip2; -/*12*/ uint32 itemId; -/*16*/ uint32 equip3; // Same as equip0? -/*20*/ -}; - - /* ** Generic Spawn Struct ** Length: 897 Octets @@ -1018,38 +1015,38 @@ union { struct { - /*00184*/ EquipStruct equip_helmet; // Equiptment: Helmet visual - /*00204*/ EquipStruct equip_chest; // Equiptment: Chest visual - /*00224*/ EquipStruct equip_arms; // Equiptment: Arms visual - /*00244*/ EquipStruct equip_bracers; // Equiptment: Wrist visual - /*00264*/ EquipStruct equip_hands; // Equiptment: Hands visual - /*00284*/ EquipStruct equip_legs; // Equiptment: Legs visual - /*00304*/ EquipStruct equip_feet; // Equiptment: Boots visual - /*00324*/ EquipStruct equip_primary; // Equiptment: Main visual - /*00344*/ EquipStruct equip_secondary; // Equiptment: Off visual + /*00184*/ EquipStruct equip_helmet; // Equipment: Helmet visual + /*00204*/ EquipStruct equip_chest; // Equipment: Chest visual + /*00224*/ EquipStruct equip_arms; // Equipment: Arms visual + /*00244*/ EquipStruct equip_bracers; // Equipment: Wrist visual + /*00264*/ EquipStruct equip_hands; // Equipment: Hands visual + /*00284*/ EquipStruct equip_legs; // Equipment: Legs visual + /*00304*/ EquipStruct equip_feet; // Equipment: Boots visual + /*00324*/ EquipStruct equip_primary; // Equipment: Main visual + /*00344*/ EquipStruct equip_secondary; // Equipment: Off visual // Below slots are just guesses, but all 0s anyway... - /*00364*/ EquipStruct equip_charm; // Equiptment: Non-visual - /*00384*/ EquipStruct equip_ear1; // Equiptment: Non-visual - /*00404*/ EquipStruct equip_ear2; // Equiptment: Non-visual - /*00424*/ EquipStruct equip_face; // Equiptment: Non-visual - /*00444*/ EquipStruct equip_neck; // Equiptment: Non-visual - /*00464*/ EquipStruct equip_shoulder; // Equiptment: Non-visual - /*00484*/ EquipStruct equip_bracer2; // Equiptment: Non-visual - /*00504*/ EquipStruct equip_range; // Equiptment: Non-visual - /*00524*/ EquipStruct equip_ring1; // Equiptment: Non-visual - /*00544*/ EquipStruct equip_ring2; // Equiptment: Non-visual - /*00564*/ EquipStruct equip_waist; // Equiptment: Non-visual - /*00584*/ EquipStruct equip_powersource; // Equiptment: Non-visual - /*00604*/ EquipStruct equip_ammo; // Equiptment: Non-visual + /*00364*/ EquipStruct equip_charm; // Equipment: Non-visual + /*00384*/ EquipStruct equip_ear1; // Equipment: Non-visual + /*00404*/ EquipStruct equip_ear2; // Equipment: Non-visual + /*00424*/ EquipStruct equip_face; // Equipment: Non-visual + /*00444*/ EquipStruct equip_neck; // Equipment: Non-visual + /*00464*/ EquipStruct equip_shoulder; // Equipment: Non-visual + /*00484*/ EquipStruct equip_bracer2; // Equipment: Non-visual + /*00504*/ EquipStruct equip_range; // Equipment: Non-visual + /*00524*/ EquipStruct equip_ring1; // Equipment: Non-visual + /*00544*/ EquipStruct equip_ring2; // Equipment: Non-visual + /*00564*/ EquipStruct equip_waist; // Equipment: Non-visual + /*00584*/ EquipStruct equip_powersource;// Equipment: Non-visual + /*00604*/ EquipStruct equip_ammo; // Equipment: Non-visual } equip; - /*00184*/ EquipStruct equipment[22]; + /*00184*/ EquipStruct equipment[22]; // Total Slots }; /*00624*/ uint32 equip2_count; // Seen 9 -/*00628*/ EquipStruct equipment2[9]; // Appears to be Visible slots, but all 0s +/*00628*/ EquipStruct equipment2[_MaterialCount]; // Appears to be Visible slots, but all 0s /*00808*/ uint32 tint_count; // Seen 9 -/*00812*/ Color_Struct item_tint[9]; // RR GG BB 00 +/*00812*/ Color_Struct item_tint[_MaterialCount]; // RR GG BB 00 /*00848*/ uint32 tint_count2; // Seen 9 -/*00852*/ Color_Struct item_tint2[9]; // RR GG BB 00 +/*00852*/ Color_Struct item_tint2[_MaterialCount]; // RR GG BB 00 /*00888*/ uint8 haircolor; // Player hair color /*00889*/ uint8 beardcolor; // Player beard color /*00890*/ uint32 unknown_rof5; // @@ -4504,10 +4501,10 @@ struct ItemBodyStruct uint32 Prestige; // New to March 21 2012 client uint8 ItemType; uint32 Material; - uint32 unknown7; + uint32 MaterialUnknown1; uint32 EliteMaterial; - uint32 unknown_RoF23; // New to March 21 2012 client - uint32 unknown_RoF24; // New to December 10th 2012 client - NEW + uint32 HerosForgeModel; // New to March 21 2012 client + uint32 MaterialUnknown2; // New to December 10th 2012 client - NEW float SellRate; int32 CombatEffects; int32 Shielding; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 075e6633b..285b15675 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -161,12 +161,11 @@ struct Color_Struct }; struct CharSelectEquip { - //totally guessed; - uint32 equip0; - uint32 equip1; - uint32 equip2; - uint32 itemid; - uint32 equip3; + uint32 material; + uint32 unknown1; + uint32 elitematerial; + uint32 heroforgemodel; + uint32 material2; Color_Struct color; }; @@ -258,11 +257,11 @@ struct Membership_Struct * Size: 20 Octets */ struct EquipStruct { -/*00*/ uint32 equip0; -/*04*/ uint32 equip1; -/*08*/ uint32 equip2; -/*12*/ uint32 itemId; -/*16*/ uint32 equip3; // Same as equip0? +/*00*/ uint32 material; +/*04*/ uint32 unknown1; +/*08*/ uint32 elitematerial; +/*12*/ uint32 heroforgemodel; +/*16*/ uint32 material2; // Same as material? /*20*/ }; @@ -4499,10 +4498,10 @@ struct ItemBodyStruct uint32 Prestige; // New to March 21 2012 client uint8 ItemType; uint32 Material; - uint32 unknown7; + uint32 MaterialUnknown1; uint32 EliteMaterial; - uint32 unknown_RoF3; // New to March 21 2012 client - uint32 unknown_RoF4; // New to December 10th 2012 client - NEW + uint32 HerosForgeModel; // New to March 21 2012 client + uint32 MaterialUnknown2; // New to December 10th 2012 client - NEW float SellRate; int32 CombatEffects; int32 Shielding; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 54dd33841..498058e19 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1429,9 +1429,9 @@ namespace SoD OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].equip0 = emu->item_material[r]; - eq->equipment[r].equip1 = 0; - eq->equipment[r].itemId = 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++) { @@ -1825,10 +1825,10 @@ namespace SoD eq2->face = emu->face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].equip0 = emu->equip[r][k]; - eq2->equip[k].equip1 = 0; - eq2->equip[k].itemid = 0; - eq2->equip[k].color.color = emu->cs_colors[r][k].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]; @@ -2548,11 +2548,11 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]); + 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]); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); } @@ -2563,9 +2563,9 @@ namespace SoD structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].equip0 = emu->equipment[k]; - Equipment[k].equip1 = 0; - Equipment[k].itemId = 0; + 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); diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 47b228cb7..7ec101fd3 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -118,9 +118,9 @@ struct Color_Struct struct CharSelectEquip { //totally guessed; - uint32 equip0; - uint32 equip1; - uint32 itemid; + uint32 material; + uint32 unknown1; + uint32 elitematerial; Color_Struct color; }; @@ -169,9 +169,9 @@ struct CharacterSelect_Struct { * Size: 12 Octets */ struct EquipStruct { -/*00*/ uint32 equip0; -/*04*/ uint32 equip1; -/*08*/ uint32 itemId; +/*00*/ uint32 material; +/*04*/ uint32 unknown1; +/*08*/ uint32 elitematerial; /*12*/ }; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 629395cd1..2d2fff48d 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1087,9 +1087,9 @@ namespace SoF OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].equip0 = emu->item_material[r]; - eq->equipment[r].equip1 = 0; - eq->equipment[r].itemId = 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++) { @@ -1484,10 +1484,10 @@ namespace SoF eq2->face = emu->face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].equip0 = emu->equip[r][k]; - eq2->equip[k].equip1 = 0; - eq2->equip[k].itemid = 0; - eq2->equip[k].color.color = emu->cs_colors[r][k].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]; @@ -1840,9 +1840,9 @@ namespace SoF eq->drakkin_heritage = emu->drakkin_heritage; eq->gender = emu->gender; for (k = 0; k < 9; k++) { - eq->equipment[k].equip0 = emu->equipment[k]; - eq->equipment[k].equip1 = 0; - eq->equipment[k].itemId = 0; + 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; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 9c3238f73..385fd8b46 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -117,10 +117,9 @@ struct Color_Struct }; struct CharSelectEquip { - //totally guessed; - uint32 equip0; - uint32 equip1; - uint32 itemid; + uint32 material; + uint32 unknown1; + uint32 elitematerial; Color_Struct color; }; @@ -167,9 +166,9 @@ struct CharacterSelect_Struct { * Size: 12 Octets */ struct EquipStruct { -/*00*/ uint32 equip0; -/*04*/ uint32 equip1; -/*08*/ uint32 itemId; +/*00*/ uint32 material; +/*04*/ uint32 unknown1; +/*08*/ uint32 elitematerial; /*12*/ }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 4d400c9b7..0fc9d5e75 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1042,8 +1042,8 @@ namespace Titanium OUT(beard[r]); int k; for (k = 0; k < 9; k++) { - OUT(equip[r][k]); - OUT(cs_colors[r][k].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]); @@ -1270,7 +1270,7 @@ namespace Titanium eq->guildrank = emu->guildrank; // eq->unknown0194[3] = emu->unknown0194[3]; for (k = 0; k < 9; k++) { - eq->equipment[k] = emu->equipment[k]; + eq->equipment[k] = emu->equipment[k].material; eq->colors[k].color = emu->colors[k].color; } for (k = 0; k < 8; k++) { diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index c9d726a25..6da577be6 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1702,9 +1702,9 @@ namespace Underfoot OUT(beard); // OUT(unknown00178[10]); for (r = 0; r < 9; r++) { - eq->equipment[r].equip0 = emu->item_material[r]; - eq->equipment[r].equip1 = 0; - eq->equipment[r].itemId = 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++) { @@ -2132,10 +2132,10 @@ namespace Underfoot eq2->face = emu->face[r]; int k; for (k = 0; k < _MaterialCount; k++) { - eq2->equip[k].equip0 = emu->equip[r][k]; - eq2->equip[k].equip1 = 0; - eq2->equip[k].itemid = 0; - eq2->equip[k].color.color = emu->cs_colors[r][k].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]; @@ -2832,11 +2832,11 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialPrimary]); + 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]); + VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment[MaterialSecondary].material); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0); } @@ -2846,9 +2846,9 @@ namespace Underfoot structs::EquipStruct *Equipment = (structs::EquipStruct *)Buffer; for (k = 0; k < 9; k++) { - Equipment[k].equip0 = emu->equipment[k]; - Equipment[k].equip1 = 0; - Equipment[k].itemId = 0; + 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); diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 45c47875d..378665db1 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -117,10 +117,9 @@ struct Color_Struct }; struct CharSelectEquip { - //totally guessed; - uint32 equip0; - uint32 equip1; - uint32 itemid; + uint32 material; + uint32 unknown1; + uint32 elitematerial; Color_Struct color; }; @@ -169,9 +168,9 @@ struct CharacterSelect_Struct { * Size: 12 Octets */ struct EquipStruct { -/*00*/ uint32 equip0; -/*04*/ uint32 equip1; -/*08*/ uint32 itemId; +/*00*/ uint32 material; +/*04*/ uint32 unknown1; +/*08*/ uint32 elitematerial; /*12*/ }; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 05c7b6962..6bf1cb52f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -852,9 +852,26 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ item.MaxCharges = (int16)atoi(row[ItemField::maxcharges]); item.ItemType = (uint8)atoi(row[ItemField::itemtype]); - item.Material = (uint8)atoi(row[ItemField::material]); + item.Material = (uint8)atoi(row[ItemField::material]); + item.HerosForgeModel = (uint32)atoi(row[ItemField::herosforgemodel]); + if (item.HerosForgeModel > 0) + { + item.HerosForgeModel *= 100; + uint32 HeroSlot = 0; + switch (item.Slots) + { + case 4: { HeroSlot = 0; break; } // Head + case 131072: { HeroSlot = 1; break; } // Chest + case 128: { HeroSlot = 2; break; } // Arms + case 1536: { HeroSlot = 3; break; } // Bracers + case 4096: { HeroSlot = 4; break; } // Hands + case 262144: { HeroSlot = 5; break; } // Legs + case 524288: { HeroSlot = 6; break; } // Feet + default: { HeroSlot = 1; break; } // Chest + } + item.HerosForgeModel += HeroSlot; + } item.SellRate = (float)atof(row[ItemField::sellrate]); - item.CastTime = (uint32)atoul(row[ItemField::casttime]); item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); item.ProcRate = (int32)atoi(row[ItemField::procrate]); diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 2af5e6e90..a06a9d94e 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -313,6 +313,7 @@ 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty| 9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| 9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| +9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_09_items_table_update.sql b/utils/sql/git/required/2014_12_09_items_table_update.sql new file mode 100644 index 000000000..82866a3a3 --- /dev/null +++ b/utils/sql/git/required/2014_12_09_items_table_update.sql @@ -0,0 +1 @@ +ALTER TABLE `items` ADD `herosforgemodel` int( 11 ) NOT NULL DEFAULT '0' AFTER `material`; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 458025349..7d70fd71d 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -182,12 +182,16 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* if (item == 0) continue; - cs->equip[char_num][material] = item->GetItem()->Material; + cs->equip[char_num][material].material = item->GetItem()->Material; + cs->equip[char_num][material].material = 0; + cs->equip[char_num][material].elitematerial = item->GetItem()->EliteMaterial; + cs->equip[char_num][material].heroforgemodel = item->GetItem()->HerosForgeModel; + cs->equip[char_num][material].material2 = item->GetItem()->Material; if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; } else{ color = item->GetItem()->Color; } - cs->cs_colors[char_num][material].color = color; + cs->equip[char_num][material].color.color = color; /* Weapons are handled a bit differently */ if ((material == MaterialPrimary) || (material == MaterialSecondary)) { diff --git a/zone/bot.cpp b/zone/bot.cpp index 9ae33318a..bb4c53210 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4361,7 +4361,8 @@ void Bot::SetLevel(uint8 in_level, bool command) { } void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { - if(ns) { + if(ns) + { Mob::FillSpawnStruct(ns, ForWho); ns->spawn.afk = 0; @@ -4389,98 +4390,34 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); - inst = GetBotItem(MainHands); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialHands] = item->Material; - ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands); - } - } + for (i = 0; i < _MaterialCount; i++) + { + inst = GetBotItem(i); + if (inst) + { + 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; + if (armor_tint[i]) + { + ns->spawn.colors[i].color = armor_tint[i]; - inst = GetBotItem(MainHead); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialHead] = item->Material; - ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead); - } - } - - inst = GetBotItem(MainArms); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialArms] = item->Material; - ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms); - } - } - - inst = GetBotItem(MainWrist1); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialWrist] = item->Material; - ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist); - } - } - - /* - // non-live behavior - inst = GetBotItem(MainWrist2); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialWrist] = item->Material; - ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist); - } - } - */ - - inst = GetBotItem(MainChest); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialChest] = item->Material; - ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest); - } - } - - inst = GetBotItem(MainLegs); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialLegs] = item->Material; - ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs); - } - } - - inst = GetBotItem(MainFeet); - if(inst) { - item = inst->GetItem(); - if(item) { - ns->spawn.equipment[MaterialFeet] = item->Material; - ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet); - } - } - - inst = GetBotItem(MainPrimary); - if(inst) { - item = inst->GetItem(); - if(item) { - if(strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); - ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary); - } - } - - inst = GetBotItem(MainSecondary); - if(inst) { - item = inst->GetItem(); - if(item) { - if(strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); - ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary); + } + else + { + ns->spawn.colors[i].color = item->Color; + } + } + else + { + if (armor_tint[i]) + { + ns->spawn.colors[i].color = armor_tint[i]; + } + } } } } diff --git a/zone/client.cpp b/zone/client.cpp index f67328ae9..014d4f0bb 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1823,80 +1823,113 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) // (update: i think pp should do it, as this holds LoY dye - plus, this is ugly code with Inventory!) const Item_Struct* item = nullptr; const ItemInst* inst = nullptr; - if ((inst = m_inv[MainHands]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialHands] = item->Material; - ns->spawn.colors[MaterialHands].color = GetEquipmentColor(MaterialHands); - } - if ((inst = m_inv[MainHead]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialHead] = item->Material; - ns->spawn.colors[MaterialHead].color = GetEquipmentColor(MaterialHead); - } - if ((inst = m_inv[MainArms]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialArms] = item->Material; - ns->spawn.colors[MaterialArms].color = GetEquipmentColor(MaterialArms); - } - if ((inst = m_inv[MainWrist1]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialWrist]= item->Material; - ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist); - } - /* - // non-live behavior - if ((inst = m_inv[SLOT_BRACER02]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialWrist]= item->Material; - ns->spawn.colors[MaterialWrist].color = GetEquipmentColor(MaterialWrist); - } - */ + // Only Player Races Wear Armor + if (IsPlayerRace(race)) + { + if ((inst = m_inv[MainHands]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialHands].material = item->Material; + ns->spawn.equipment[MaterialHands].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialHands].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialHands].color = m_pp.item_tint[MaterialHands].rgb.use_tint ? m_pp.item_tint[MaterialHands].color : item->Color; + } + if ((inst = m_inv[MainHead]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialHead].material = item->Material; + ns->spawn.equipment[MaterialHead].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialHead].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialHead].color = m_pp.item_tint[MaterialHead].rgb.use_tint ? m_pp.item_tint[MaterialHead].color : item->Color; + } + if ((inst = m_inv[MainArms]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialArms].material = item->Material; + ns->spawn.equipment[MaterialArms].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialArms].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialArms].color = m_pp.item_tint[MaterialArms].rgb.use_tint ? m_pp.item_tint[MaterialArms].color : item->Color; + } + if ((inst = m_inv[MainWrist1]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialWrist].material = item->Material; + ns->spawn.equipment[MaterialWrist].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialWrist].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialWrist].color = m_pp.item_tint[MaterialWrist].rgb.use_tint ? m_pp.item_tint[MaterialWrist].color : item->Color; + } - if ((inst = m_inv[MainChest]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialChest] = item->Material; - ns->spawn.colors[MaterialChest].color = GetEquipmentColor(MaterialChest); - } - if ((inst = m_inv[MainLegs]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialLegs] = item->Material; - ns->spawn.colors[MaterialLegs].color = GetEquipmentColor(MaterialLegs); - } - if ((inst = m_inv[MainFeet]) && inst->IsType(ItemClassCommon)) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialFeet] = item->Material; - ns->spawn.colors[MaterialFeet].color = GetEquipmentColor(MaterialFeet); + if ((inst = m_inv[MainChest]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialChest].material = item->Material; + ns->spawn.equipment[MaterialChest].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialChest].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialChest].color = m_pp.item_tint[MaterialChest].rgb.use_tint ? m_pp.item_tint[MaterialChest].color : item->Color; + } + if ((inst = m_inv[MainLegs]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialLegs].material = item->Material; + ns->spawn.equipment[MaterialLegs].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialLegs].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialLegs].color = m_pp.item_tint[MaterialLegs].rgb.use_tint ? m_pp.item_tint[MaterialLegs].color : item->Color; + } + if ((inst = m_inv[MainFeet]) && inst->IsType(ItemClassCommon)) + { + item = inst->GetItem(); + ns->spawn.equipment[MaterialFeet].material = item->Material; + ns->spawn.equipment[MaterialFeet].elitematerial = item->EliteMaterial; + ns->spawn.equipment[MaterialFeet].heroforgemodel = item->HerosForgeModel; + ns->spawn.colors[MaterialFeet].color = m_pp.item_tint[MaterialFeet].rgb.use_tint ? m_pp.item_tint[MaterialFeet].color : item->Color; + } } int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon)) { - if (inst->GetOrnamentationAug(ornamentationAugtype)) { + if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon)) + { + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + { + ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); + } } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - ns->spawn.equipment[MaterialPrimary] = inst->GetOrnamentationIDFile(); + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) + { + ns->spawn.equipment[MaterialPrimary].material = inst->GetOrnamentationIDFile(); } - else { + else + { item = inst->GetItem(); if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + { + ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); + } } } - if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon)) { - if (inst->GetOrnamentationAug(ornamentationAugtype)) { + if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon)) + { + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + { + ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); + } } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - ns->spawn.equipment[MaterialSecondary] = inst->GetOrnamentationIDFile(); + else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) + { + ns->spawn.equipment[MaterialSecondary].material = inst->GetOrnamentationIDFile(); } - else { + else + { item = inst->GetItem(); if (strlen(item->IDFile) > 2) - ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + { + ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); + } } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6ff76e346..c68434109 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8341,7 +8341,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) outapp->WriteUInt32(item->Material); outapp->WriteUInt32(0); //unknown outapp->WriteUInt32(item->EliteMaterial); - outapp->WriteUInt32(0); // unknown + outapp->WriteUInt32(item->HerosForgeModel); outapp->WriteUInt32(0); // unknown outapp->WriteUInt32(0); //This is unknown057 from lucy for (spacer = 0; spacer < 77; spacer++) { //More Item stats, but some seem to be off based on packet check diff --git a/zone/command.cpp b/zone/command.cpp index f4c2c8e91..59a786a19 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5598,7 +5598,11 @@ void command_itemsearch(Client *c, const Seperator *sep) if (Seperator::IsNumber(search_criteria)) { item = database.GetItem(atoi(search_criteria)); if (item) - if (c->GetClientVersion() >= EQClientRoF) + if (c->GetClientVersion() >= EQClientRoF2) + { + c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (int)item->ID, 0x12, item->ID, item->Name, 0x12); + } + else if (c->GetClientVersion() >= EQClientRoF) { c->Message(0, " %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); } @@ -5627,7 +5631,11 @@ void command_itemsearch(Client *c, const Seperator *sep) strupr(sName); pdest = strstr(sName, sCriteria); if (pdest != nullptr) { - if (c->GetClientVersion() >= EQClientRoF) + if (c->GetClientVersion() >= EQClientRoF2) + { + c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (int)item->ID, 0x12, item->ID, item->Name, 0x12); + } + else if (c->GetClientVersion() >= EQClientRoF) { c->Message(0, " %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); } diff --git a/zone/merc.cpp b/zone/merc.cpp index 1c4165c1e..2641e7cb4 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1196,18 +1196,32 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { ns->spawn.NPC = 1; // 0=player,1=npc,2=pc corpse,3=npc corpse ns->spawn.IsMercenary = 1; + /* + // Wear Slots are not setup for Mercs yet unsigned int i; - //should not include 21 (SLOT_AMMO) - for (i = 0; i < MainAmmo; i++) { - if(equipment[i] == 0) + for (i = 0; i < _MaterialCount; i++) + { + if (equipment[i] == 0) + { continue; + } const Item_Struct* item = database.GetItem(equipment[i]); if(item) { - ns->spawn.equipment[i] = item->Material; - ns->spawn.colors[i].color = item->Color; + 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]; + } + else + { + ns->spawn.colors[i].color = item->Color; + } } } + */ } } diff --git a/zone/mob.cpp b/zone/mob.cpp index f7193fbed..e501862a2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -963,22 +963,44 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.flymode = FindType(SE_Levitate) ? 2 : 0; } else + { ns->spawn.flymode = flymode; + } ns->spawn.lastName[0] = '\0'; strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); - for(i = 0; i < _MaterialCount; i++) + const Item_Struct *item; + + for (i = 0; i < _MaterialCount; i++) { - ns->spawn.equipment[i] = GetEquipmentMaterial(i); - if (armor_tint[i]) + // Only Player Races Wear Armor + if (IsPlayerRace(race) || i > 6) { - ns->spawn.colors[i].color = armor_tint[i]; - } - else - { - ns->spawn.colors[i].color = GetEquipmentColor(i); + ns->spawn.equipment[i].material = GetEquipmentMaterial(i); + + item = database.GetItem(GetEquipment(i)); + if (item != 0) + { + 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]; + } + else + { + ns->spawn.colors[i].color = item->Color; + } + } + else + { + if (armor_tint[i]) + { + ns->spawn.colors[i].color = armor_tint[i]; + } + } } } @@ -2601,8 +2623,20 @@ void Mob::SendWearChange(uint8 material_slot) wc->spawn_id = GetID(); wc->material = GetEquipmentMaterial(material_slot); - wc->elite_material = IsEliteMaterialItem(material_slot); - wc->color.color = GetEquipmentColor(material_slot); + const Item_Struct *item; + item = database.GetItem(GetEquipment(material_slot)); + if (item != 0) + { + wc->elite_material = item->EliteMaterial; + wc->hero_forge_model = item->HerosForgeModel; + wc->color.color = item->Color; + } + else + { + wc->elite_material = 0; + wc->hero_forge_model = 0; + wc->color.color = 0; + } wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); @@ -2646,6 +2680,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 = GetHeroForgeModel(material_slot); wc->color.color = color; wc->wear_slot_id = material_slot; @@ -2653,7 +2688,7 @@ void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uin safe_delete(outapp); } -void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color) +void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 hero_forge_model) { armor_tint[material_slot] = color; @@ -2662,6 +2697,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color) wc->spawn_id = this->GetID(); wc->material = texture; + wc->hero_forge_model = hero_forge_model; wc->color.color = color; wc->wear_slot_id = material_slot; @@ -2741,6 +2777,19 @@ uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const return 0; } +uint32 Mob::GetHeroForgeModel(uint8 material_slot) const +{ + const Item_Struct *item; + + item = database.GetItem(GetEquipment(material_slot)); + if (item != 0) + { + return item->HerosForgeModel; + } + + return 0; +} + // works just like a printf void Mob::Say(const char *format, ...) { @@ -3797,6 +3846,8 @@ int32 Mob::GetItemStat(uint32 itemid, const char *identifier) stat = int32(item->CastTime); if (id == "elitematerial") stat = int32(item->EliteMaterial); + if (id == "herosforgemodel") + stat = int32(item->HerosForgeModel); if (id == "procrate") stat = int32(item->ProcRate); if (id == "combateffects") diff --git a/zone/mob.h b/zone/mob.h index dddce98f8..ada3c5df9 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -171,7 +171,7 @@ public: virtual void SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model = 0, uint32 elite_material = 0, uint32 unknown06 = 0, uint32 unknown18 = 0); virtual void SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uint8 blue_tint); - virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color); + virtual void WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 hero_forge_model = 0); void DoAnim(const int animnum, int type=0, bool ackreq = true, eqFilterType filter = FilterNone); void ProjectileAnimation(Mob* to, int item_id, bool IsArrow = false, float speed = 0, float angle = 0, float tilt = 0, float arc = 0, const char *IDFile = nullptr, SkillUseTypes skillInUse = SkillArchery); @@ -314,6 +314,7 @@ public: virtual int32 GetEquipmentMaterial(uint8 material_slot) const; virtual uint32 GetEquipmentColor(uint8 material_slot) const; virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; + virtual uint32 GetHeroForgeModel(uint8 material_slot) const; bool AffectedBySpellExcludingSlot(int slot, int effect); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) = 0; virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index c47b463d3..4351fb89f 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -7460,12 +7460,13 @@ XS(XS_Mob_WearChange) { dXSARGS; if (items < 3 || items > 4) - Perl_croak(aTHX_ "Usage: Mob::WearChange(THIS, material_slot, texture, color)"); + Perl_croak(aTHX_ "Usage: Mob::WearChange(THIS, material_slot, texture, [color, hero_forge_model])"); { Mob * THIS; uint8 material_slot = (uint8)SvIV(ST(1)); uint16 texture = (uint16)SvUV(ST(2)); uint32 color = 0; + uint32 hero_forge_model = 0; if (sv_derived_from(ST(0), "Mob")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -7479,8 +7480,11 @@ XS(XS_Mob_WearChange) if (items > 3) { color = (uint32)SvUV(ST(3)); } + if (items > 4) { + hero_forge_model = (uint32)SvUV(ST(3)); + } - THIS->WearChange(material_slot, texture, color); + THIS->WearChange(material_slot, texture, color, hero_forge_model); } XSRETURN_EMPTY; } @@ -8614,7 +8618,7 @@ XS(boot_Mob) newXSproto(strcpy(buf, "TarGlobal"), XS_Mob_TarGlobal, file, "$$$$$$$"); newXSproto(strcpy(buf, "DelGlobal"), XS_Mob_DelGlobal, file, "$$"); newXSproto(strcpy(buf, "SetSlotTint"), XS_Mob_SetSlotTint, file, "$$$$$"); - newXSproto(strcpy(buf, "WearChange"), XS_Mob_WearChange, file, "$$$;$"); + newXSproto(strcpy(buf, "WearChange"), XS_Mob_WearChange, file, "$$$;$$"); newXSproto(strcpy(buf, "DoKnockback"), XS_Mob_DoKnockback, file, "$$$$"); newXSproto(strcpy(buf, "RemoveNimbusEffect"), XS_Mob_RemoveNimbusEffect, file, "$$"); newXSproto(strcpy(buf, "IsRunning"), XS_Mob_IsRunning, file, "$"); From 362bfc79d60e270a432e750aa8721b7cf2f327b1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 9 Dec 2014 22:33:09 -0500 Subject: [PATCH 0535/1883] Fix compile error --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index bb4c53210..11bbf44c7 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4390,7 +4390,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); - for (i = 0; i < _MaterialCount; i++) + for (int i = 0; i < _MaterialCount; i++) { inst = GetBotItem(i); if (inst) From 4c9befee22680219e8029289a64bb2f58d9d8597 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 9 Dec 2014 23:41:19 -0500 Subject: [PATCH 0536/1883] Some clean ups due thanks to clang's warnings --- common/eq_stream_factory.cpp | 2 +- common/spdat.cpp | 2 +- world/clientlist.cpp | 2 +- zone/aa.cpp | 6 +- zone/aa.h | 3 +- zone/attack.cpp | 197 +++++++++++++++-------------------- 6 files changed, 94 insertions(+), 118 deletions(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index bc3e2e2ba..12828b28c 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -291,7 +291,7 @@ Timer DecayTimer(20); //bullshit checking, to see if this is really happening, GDB seems to think so... if(stream_itr->second == nullptr) { - fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i", stream_itr->first.first, stream_itr->first.second); + fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i", stream_itr->first.first, stream_itr->first.second); continue; } diff --git a/common/spdat.cpp b/common/spdat.cpp index 1ff8f2696..3f8ae4849 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -896,7 +896,7 @@ bool IsHealOverTimeSpell(uint16 spell_id) bool IsCompleteHealSpell(uint16 spell_id) { if (spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) || - IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)) + (IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id))) return true; return false; diff --git a/world/clientlist.cpp b/world/clientlist.cpp index c33822d93..a18a9cafc 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -547,7 +547,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S if(totalusers<=20 || admin>=100) totallength=totallength+strlen(countcle->name())+strlen(countcle->AccountName())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5; } - else if((countcle->Anon()>0 && admin<=countcle->Admin()) || countcle->Anon()==0 && !countcle->GetGM()){ + else if((countcle->Anon()>0 && admin<=countcle->Admin()) || (countcle->Anon()==0 && !countcle->GetGM())) { totalusers++; if(totalusers<=20 || admin>=100) totallength=totallength+strlen(countcle->name())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5; diff --git a/zone/aa.cpp b/zone/aa.cpp index 28c4f60d7..27229cb89 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -893,7 +893,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) //turn on an AA effect //duration == 0 means no time limit, used for one-shot deals, etc.. void Client::EnableAAEffect(aaEffectType type, uint32 duration) { - if(type > 32) + if(type > _maxaaEffectType) return; //for now, special logic needed. m_epp.aa_effects |= 1 << (type-1); @@ -905,7 +905,7 @@ void Client::EnableAAEffect(aaEffectType type, uint32 duration) { } void Client::DisableAAEffect(aaEffectType type) { - if(type > 32) + if(type > _maxaaEffectType) return; //for now, special logic needed. uint32 bit = 1 << (type-1); if(m_epp.aa_effects & bit) { @@ -919,7 +919,7 @@ By default an AA effect is a one shot deal, unless a duration timer is set. */ bool Client::CheckAAEffect(aaEffectType type) { - if(type > 32) + if(type > _maxaaEffectType) return(false); //for now, special logic needed. if(m_epp.aa_effects & (1 << (type-1))) { //is effect enabled? //has our timer expired? diff --git a/zone/aa.h b/zone/aa.h index 00f74e8c6..e2e0749d1 100644 --- a/zone/aa.h +++ b/zone/aa.h @@ -51,7 +51,8 @@ typedef enum { //AA Effect IDs aaEffectFrostArrows, aaEffectWarcry, aaEffectLeechTouch, - aaEffectProjectIllusion // unused - Handled via spell effect + aaEffectProjectIllusion, // unused - Handled via spell effect + _maxaaEffectType = 32 } aaEffectType; diff --git a/zone/attack.cpp b/zone/attack.cpp index 9b5f420a8..68e088b02 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -197,7 +197,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c pvpmode = true; if (chance_mod >= 10000) - return true; + return true; float avoidanceBonus = 0; float hitBonus = 0; @@ -268,21 +268,21 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c } //Avoidance Bonuses on defender decreases baseline hit chance by percent. - avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + - defender->itembonuses.AvoidMeleeChanceEffect + + avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + + defender->itembonuses.AvoidMeleeChanceEffect + defender->aabonuses.AvoidMeleeChanceEffect + (defender->itembonuses.AvoidMeleeChance / 10.0f); //Item Mod 'Avoidence' Mob *owner = nullptr; - if (defender->IsPet()) + if (defender->IsPet()) owner = defender->GetOwner(); else if ((defender->IsNPC() && defender->CastToNPC()->GetSwarmOwner())) owner = entity_list.GetMobID(defender->CastToNPC()->GetSwarmOwner()); - + if (owner) avoidanceBonus += owner->aabonuses.PetAvoidance + owner->spellbonuses.PetAvoidance + owner->itembonuses.PetAvoidance; - if(defender->IsNPC()) + if(defender->IsNPC()) avoidanceBonus += (defender->CastToNPC()->GetAvoidanceRating() / 10.0f); //Modifier from database //Hit Chance Bonuses on attacker increases baseline hit chance by percent. @@ -293,7 +293,6 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] + attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]; - //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + @@ -306,7 +305,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC()) hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database - + if(skillinuse == SkillArchery) hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); @@ -326,11 +325,10 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c else if(chancetohit < RuleR(Combat,MinChancetoHit)) { chancetohit = RuleR(Combat,MinChancetoHit); } - + //I dont know the best way to handle a garunteed hit discipline being used //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - #if EQDEBUG>=11 LogFile->write(EQEMuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); #endif @@ -346,7 +344,6 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c return(tohit_roll <= chancetohit); } - bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) { /* solar: called when a mob is attacked, does the checks to see if it's a hit @@ -562,7 +559,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac armor = (armor / RuleR(Combat, NPCACFactor)); Mob *owner = nullptr; - if (IsPet()) + if (IsPet()) owner = GetOwner(); else if ((CastToNPC()->GetSwarmOwner())) owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner()); @@ -1164,7 +1161,6 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if (GetFeigned()) return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code. - ItemInst* weapon; if (Hand == MainSecondary){ // Kaiyodo - Pick weapon from the attacking hand weapon = GetInv().GetItem(MainSecondary); @@ -1225,7 +1221,6 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b CheckIncreaseSkill(skillinuse, other, -15); CheckIncreaseSkill(SkillOffense, other, -15); - // *************************************************************** // *** Calculate the damage bonus, if applicable, for this hit *** // *************************************************************** @@ -1419,7 +1414,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(dead) return false; //cant die more than once... - if(!spell) + if(!spell) spell = SPELL_UNKNOWN; char buffer[48] = { 0 }; @@ -1444,7 +1439,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att #1: Send death packet to everyone */ uint8 killed_level = GetLevel(); - + SendLogoutPackets(); /* Make self become corpse packet */ @@ -1522,7 +1517,6 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att hate_list.RemoveEnt(this); RemoveAutoXTargets(); - //remove ourself from all proximities ClearAllProximities(); @@ -1598,7 +1592,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att else UnmemSpellAll(false); - if(RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel) || RuleB(Character, LeaveNakedCorpses)) + if((RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) || RuleB(Character, LeaveNakedCorpses)) { // creating the corpse takes the cash/items off the player too Corpse *new_corpse = new Corpse(this, exploss); @@ -1657,8 +1651,8 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(LeftCorpse && (GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover)) { - ClearDraggedCorpses(); - RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000); + ClearDraggedCorpses(); + RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000); SendRespawnBinds(); } else @@ -1675,19 +1669,19 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att if(r) r->MemberZoned(this); - dead_timer.Start(5000, true); + dead_timer.Start(5000, true); m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zoneInstance = m_pp.binds[0].instance_id; - database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); - Save(); + database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); + Save(); GoToDeath(); } /* QS: PlayerLogDeaths */ if (RuleB(QueryServ, PlayerLogDeaths)){ const char * killer_name = ""; - if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); } - std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); + if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); } + std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); QServ->PlayerLogEvent(Player_Log_Deaths, this->CharacterID(), event_desc); } @@ -1836,7 +1830,6 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool else damage = zone->random.Int((min_dmg+eleBane),(max_dmg+eleBane)); - //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); @@ -1846,7 +1839,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } - + damage = mod_npc_damage(damage, skillinuse, Hand, weapon, other); int32 hate = damage; @@ -1925,7 +1918,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool return false; MeleeLifeTap(damage); - + CommonBreakInvisible(); //I doubt this works... @@ -1934,15 +1927,15 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(!bRiposte && !other->HasDied()) { TryWeaponProc(nullptr, weapon, other, Hand); //no weapon - + if (!other->HasDied()) TrySpellProc(nullptr, weapon, other, Hand); - + if (damage > 0 && HasSkillProcSuccess() && !other->HasDied()) TrySkillProc(other, skillinuse, 0, true, Hand); } - if(GetHP() > 0 && !other->HasDied()) + if(GetHP() > 0 && !other->HasDied()) TriggerDefensiveProcs(nullptr, other, Hand, damage); // now check ripostes @@ -2002,7 +1995,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); - + Mob *oos = nullptr; if(killerMob) { oos = killerMob->GetOwnerOrSelf(); @@ -2057,7 +2050,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if(p_depop == true) return false; - + HasAISpellEffects = false; BuffFadeAll(); uint8 killed_level = GetLevel(); @@ -2118,8 +2111,8 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack Group *kg = entity_list.GetGroupByClient(give_exp_client); Raid *kr = entity_list.GetRaidByClient(give_exp_client); - int32 finalxp = EXP_FORMULA; - finalxp = give_exp_client->mod_client_xp(finalxp, this); + int32 finalxp = EXP_FORMULA; + finalxp = give_exp_client->mod_client_xp(finalxp, this); if(kr) { @@ -2230,7 +2223,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0); if(RuleB(NPC, EnableMeritBasedFaction)) - give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), + give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), give_exp_client->GetBaseRace(), give_exp_client->GetDeity()); mod_npc_killed_merit(give_exp_client); @@ -2392,9 +2385,9 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { - + assert(other != nullptr); - + if (other == this) return; @@ -2411,12 +2404,12 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if(other){ AddRampage(other); int hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod; - + int32 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod; if (shieldhatemod && other->HasShieldEquiped()) hatemod += shieldhatemod; - + if(hatemod < 1) hatemod = 1; hate = ((hate * (hatemod))/100); @@ -2433,7 +2426,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0)) TryTriggerOnValueAmount(false, false, false, true); - + if(IsClient() && !IsAIControlled()) return; @@ -2475,9 +2468,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if(damage > GetHP()) damage = GetHP(); - if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0]) + if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0]) && other && (buffs[spellbonuses.ImprovedTaunt[2]].casterid != other->GetID())) - hate = (hate*spellbonuses.ImprovedTaunt[1])/100; + hate = (hate*spellbonuses.ImprovedTaunt[1])/100; hate_list.Add(other, hate, damage, bFrenzy, !iBuffTic); @@ -2497,7 +2490,6 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, } #endif //BOTS - // if other is a merc, add the merc client to the hate list if(other->IsMerc()) { if(other->CastToMerc()->GetMercOwner() && other->CastToMerc()->GetMercOwner()->CastToClient()->GetFeigned()) { @@ -2636,7 +2628,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) // This function calculates and returns the damage bonus for the weapon identified by the parameter "Weapon". // Modified 9/21/2008 by Cantus - // Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the // weapon in the primary slot. Be sure to check that Hand == MainPrimary before calling. @@ -2648,7 +2639,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) // Assert: This function should not be called unless the player is a melee class, as casters do not receive a damage bonus. - if( Weapon == nullptr || Weapon->ItemType == ItemType1HSlash || Weapon->ItemType == ItemType1HBlunt || Weapon->ItemType == ItemTypeMartial || Weapon->ItemType == ItemType1HPiercing ) { // The weapon in the player's main (primary) hand is a one-handed weapon, or there is no item equipped at all. @@ -2676,7 +2666,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) // as I suspect, then please feel free to delete the following line, and replace all occurences of "ucPlayerLevel" with "GetLevel()". uint8 ucPlayerLevel = (uint8) GetLevel(); - // The following may look cleaner, and would certainly be easier to understand, if it was // a simple 53x150 cell matrix. // @@ -2694,7 +2683,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) // lookup table. In cases where a formula is the best bet, I use a formula. In other places // where a formula would be ugly, I use a lookup table in the interests of speed. - if( Weapon->Delay <= 27 ) { // Damage Bonuses for all 2H weapons with delays of 27 or less are identical. @@ -2706,7 +2694,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) return (ucPlayerLevel - 22) / 3; } - if( ucPlayerLevel == 65 && Weapon->Delay <= 59 ) { // Consider these two facts: @@ -2725,7 +2712,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) return ucLevel65DamageBonusesForDelays28to59[Weapon->Delay-28]; } - if( ucPlayerLevel > 65 ) { if( ucPlayerLevel > 80 ) @@ -2864,7 +2850,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon ) } } - // If we've gotten to this point in the function without hitting a return statement, // we know that the character's level is between 28 and 65, and that the 2H weapon's // delay is 28 or higher. @@ -3110,7 +3095,6 @@ int Mob::GetMonkHandToHandDelay(void) } } - int32 Mob::ReduceDamage(int32 damage) { if(damage <= 0) @@ -3123,7 +3107,7 @@ int32 Mob::ReduceDamage(int32 damage) slot = spellbonuses.NegateAttacks[1]; if(slot >= 0) { if(--buffs[slot].numhits == 0) { - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot , true); } @@ -3138,8 +3122,8 @@ int32 Mob::ReduceDamage(int32 damage) //Only mitigate if damage is above the minimium specified. if (spellbonuses.MeleeThresholdGuard[0]){ slot = spellbonuses.MeleeThresholdGuard[1]; - - if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) + + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) { DisableMeleeRune = true; int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; @@ -3161,7 +3145,6 @@ int32 Mob::ReduceDamage(int32 damage) } } - if (spellbonuses.MitigateMeleeRune[0] && !DisableMeleeRune){ slot = spellbonuses.MitigateMeleeRune[1]; if(slot >= 0) @@ -3170,7 +3153,7 @@ int32 Mob::ReduceDamage(int32 damage) if (spellbonuses.MitigateMeleeRune[2] && (damage_to_reduce > spellbonuses.MitigateMeleeRune[2])) damage_to_reduce = spellbonuses.MitigateMeleeRune[2]; - + if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" @@ -3183,10 +3166,10 @@ int32 Mob::ReduceDamage(int32 damage) { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); - + if (spellbonuses.MitigateMeleeRune[3]) buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3217,7 +3200,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi slot = spellbonuses.NegateAttacks[1]; if(slot >= 0) { if(--buffs[slot].numhits == 0) { - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot , true); } @@ -3231,8 +3214,8 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi // If this is a DoT, use DoT Shielding... if(iBuffTic) { - damage -= (damage * itembonuses.DoTShielding / 100); - + damage -= (damage * itembonuses.DoTShielding / 100); + if (spellbonuses.MitigateDotRune[0]){ slot = spellbonuses.MitigateDotRune[1]; if(slot >= 0) @@ -3252,7 +3235,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi { if (spellbonuses.MitigateDotRune[3]) buffs[slot].dot_rune = (buffs[slot].dot_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3265,12 +3248,11 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi // Reduce damage by the Spell Shielding first so that the runes don't take the raw damage. damage -= (damage * itembonuses.SpellShield / 100); - //Only mitigate if damage is above the minimium specified. if (spellbonuses.SpellThresholdGuard[0]){ slot = spellbonuses.SpellThresholdGuard[1]; - - if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) + + if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) { DisableSpellRune = true; int damage_to_reduce = damage * spellbonuses.SpellThresholdGuard[0] / 100; @@ -3287,8 +3269,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } } } - - + // Do runes now. if (spellbonuses.MitigateSpellRune[0] && !DisableSpellRune){ slot = spellbonuses.MitigateSpellRune[1]; @@ -3311,10 +3292,10 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi { mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); - + if (spellbonuses.MitigateSpellRune[3]) buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce); - + damage -= damage_to_reduce; } } @@ -3322,14 +3303,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(damage < 1) return 0; - + //Regular runes absorb spell damage (except dots) - Confirmed on live. if (spellbonuses.MeleeRune[0] && spellbonuses.MeleeRune[1] >= 0) - damage = RuneAbsorb(damage, SE_Rune); + damage = RuneAbsorb(damage, SE_Rune); if (spellbonuses.AbsorbMagicAtt[0] && spellbonuses.AbsorbMagicAtt[1] >= 0) damage = RuneAbsorb(damage, SE_AbsorbMagicAtt); - + if(damage < 1) return 0; } @@ -3349,7 +3330,7 @@ int32 Mob::ReduceAllDamage(int32 damage) TryTriggerOnValueAmount(false, true); } } - + CheckNumHitsRemaining(NUMHIT_IncomingDamage); return(damage); @@ -3556,7 +3537,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons attacker->CastToClient()->sneaking = false; attacker->SendAppearancePacket(AT_Sneak, 0); } - + //final damage has been determined. SetHP(GetHP() - damage); @@ -3588,7 +3569,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); - } + } //check stun chances if bashing if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) { @@ -3721,18 +3702,15 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //if the attacker is a client, try them with the correct filter if(attacker && attacker->IsClient()) { - if (((spell_id != SPELL_UNKNOWN)||(FromDamageShield)) && damage>0) { + if ((spell_id != SPELL_UNKNOWN || FromDamageShield) && damage > 0) { //special crap for spell damage, looks hackish to me - char val1[20]={0}; - if (FromDamageShield) - { - if(!attacker->CastToClient()->GetFilter(FilterDamageShields) == FilterHide) - { - attacker->Message_StringID(MT_DS,OTHER_HIT_NONMELEE,GetCleanName(),ConvertArray(damage,val1)); - } - } - else - entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1)); + char val1[20] = {0}; + if (FromDamageShield) { + if (attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide) + attacker->Message_StringID(MT_DS,OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1)); + } else { + entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee, HIT_NON_MELEE, attacker->GetCleanName(), GetCleanName(), ConvertArray(damage, val1)); + } } else { if(damage > 0) { if(spell_id != SPELL_UNKNOWN) @@ -3790,7 +3768,6 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } - void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) { int32 maxhp = GetMaxHP(); @@ -3879,7 +3856,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) } float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand, Mob* on) { - + if (!on) return ProcChance; @@ -3935,7 +3912,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } - + if (!IsAttackAllowed(on)) { mlog(COMBAT__PROCS, "Preventing procing off of unattackable things."); return; @@ -3962,7 +3939,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand) { - + if (!weapon) return; uint16 skillinuse = 28; @@ -4123,7 +4100,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 skillinuse = 28; if (weapon) skillinuse = GetSkillByItemType(weapon->ItemType); - + TrySkillProc(on, skillinuse, 0, false, hand); } @@ -4190,7 +4167,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack // decided to branch this into it's own function since it's going to be duplicating a lot of the // code in here, but could lead to some confusion otherwise - if (IsPet() && GetOwner()->IsClient() || (IsNPC() && CastToNPC()->GetSwarmOwner())) { + if ((IsPet() && GetOwner()->IsClient()) || (IsNPC() && CastToNPC()->GetSwarmOwner())) { TryPetCriticalHit(defender,skill,damage); return; } @@ -4234,7 +4211,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack //are defined you will have an innate chance to hit at Level 1 regardless of bonuses. //Warning: Do not define these rules if you want live like critical hits. critChance += RuleI(Combat, MeleeBaseCritChance); - + if (IsClient()) { critChance += RuleI(Combat, ClientBaseCritChance); @@ -4335,7 +4312,6 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack } } - bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) { if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){ @@ -4484,8 +4460,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!spellbonuses.LimitToSkill[skill] && !itembonuses.LimitToSkill[skill] && !aabonuses.LimitToSkill[skill]) return; - /*Allow one proc from each (Spell/Item/AA) - Kayen: Due to limited avialability of effects on live it is too difficult + /*Allow one proc from each (Spell/Item/AA) + Kayen: Due to limited avialability of effects on live it is too difficult to confirm how they stack at this time, will adjust formula when more data is avialablle to test.*/ bool CanProc = true; @@ -4503,9 +4479,9 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui for(int e = 0; e < MAX_SKILL_PROCS; e++){ if (CanProc && - (!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) - || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e]))) { - + ((!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) + || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e])))) { + if (Success) base_spell_id = spellbonuses.SkillProcSuccess[e]; else @@ -4547,8 +4523,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui CanProc = true; for(int e = 0; e < MAX_SKILL_PROCS; e++){ if (CanProc && - (!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) - || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e]))) { + ((!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) + || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e])))) { if (Success) base_spell_id = itembonuses.SkillProcSuccess[e]; @@ -4589,15 +4565,15 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui CanProc = true; uint32 effect = 0; int32 base1 = 0; - int32 base2 = 0; + int32 base2 = 0; uint32 slot = 0; for(int e = 0; e < MAX_SKILL_PROCS; e++){ if (CanProc && - (!Success && aabonuses.SkillProc[e]) - || (Success && aabonuses.SkillProcSuccess[e])){ + ((!Success && aabonuses.SkillProc[e]) + || (Success && aabonuses.SkillProcSuccess[e]))) { int aaid = 0; - + if (Success) base_spell_id = aabonuses.SkillProcSuccess[e]; else @@ -4670,7 +4646,7 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { General Mechanics - Check buffslot to make sure damage from a root does not cancel the root - - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. + - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. - Only roots on determental spells can be broken by damage. - Root break chance values obtained from live parses. */ @@ -4731,7 +4707,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) { if(melee_rune_left > 0) damage -= melee_rune_left; - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot); } @@ -4739,7 +4715,6 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) } } - else{ for(uint32 slot = 0; slot < buff_max; slot++) { if(slot == spellbonuses.AbsorbMagicAtt[1] && spellbonuses.AbsorbMagicAtt[0] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)){ @@ -4755,7 +4730,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) { if(magic_rune_left > 0) damage -= magic_rune_left; - + if(!TryFadeEffect(slot)) BuffFadeBySlot(slot); } @@ -4768,7 +4743,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type) void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse) { - if (!defender) + if (!defender) return; ApplyMeleeDamageBonus(skillInUse, damage); From 2d1999c9618e23e9c0822c074a4c1bd7500669ff Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 10 Dec 2014 00:59:54 -0500 Subject: [PATCH 0537/1883] Update version too --- common/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/version.h b/common/version.h index 43b4f8b10..78aa9fcf0 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9059 +#define CURRENT_BINARY_DATABASE_VERSION 9060 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 From 820f99067d8fa144444640ab67d01429a445e067 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 10 Dec 2014 01:19:44 -0500 Subject: [PATCH 0538/1883] Make use of the targetable_with_hotkey flag for SoF+ --- changelog.txt | 1 + common/eq_packet_structs.h | 1 + common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/underfoot.cpp | 2 +- zone/aa.cpp | 9 +++++++++ zone/merc.cpp | 1 + zone/mob.cpp | 3 ++- zone/npc.h | 2 +- 11 files changed, 20 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2fe60ee70..842d66f9a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/09/2014 == Trevius: (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example). +demonstar55: SoF+ swarm pets will no longer be F8able (without a hack!) == 12/08/2014 == Secrets: Added a feature that allows an EQ client to log in directly to World without having to enter the LoginServer, provided the 'password' field is set in WorldServer. diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index cffe4e354..930b76843 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -363,6 +363,7 @@ union uint32 DestructibleUnk7; uint8 DestructibleUnk8; uint32 DestructibleUnk9; + bool targetable_with_hotkey; }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 43b411dca..fc35e36cd 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3706,7 +3706,7 @@ namespace RoF Bitfields->showhelm = emu->showhelm; Bitfields->trader = 0; Bitfields->targetable = 1; - Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); + Bitfields->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; Bitfields->showname = ShowName; // Not currently found diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index a22d2d4c5..32a3fc592 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3706,7 +3706,7 @@ namespace RoF2 Bitfields->showhelm = emu->showhelm; Bitfields->trader = 0; Bitfields->targetable = 1; - Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); + Bitfields->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; Bitfields->showname = ShowName; // Not currently found diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 498058e19..baca905a2 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2383,7 +2383,7 @@ namespace SoD Bitfields->anon = emu->anon; Bitfields->showhelm = emu->showhelm; Bitfields->targetable = 1; - Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); + Bitfields->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; Bitfields->statue = 0; Bitfields->trader = 0; Bitfields->buyer = 0; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 2d2fff48d..8430a51bb 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1889,7 +1889,7 @@ namespace SoF eq->beard = emu->beard; eq->targetable = 1; //New Field - Toggle Targetable on or off - 0 = off, 1 = on eq->NPC = emu->NPC; - eq->targetable_with_hotkey = 1;//New Field - Toggle Targetable on or off - 0 = off, 1 = on + eq->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; //New Field - Toggle Targetable on or off - 0 = off, 1 = on eq->x = emu->x; eq->deltaX = emu->deltaX; eq->deltaY = emu->deltaY; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 6da577be6..16095faa9 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2668,7 +2668,7 @@ namespace Underfoot Bitfields->anon = emu->anon; Bitfields->showhelm = emu->showhelm; Bitfields->targetable = 1; - Bitfields->targetable_with_hotkey = (emu->IsMercenary ? 0 : 1); + Bitfields->targetable_with_hotkey = emu->targetable_with_hotkey ? 1 : 0; Bitfields->statue = 0; Bitfields->trader = 0; Bitfields->buyer = 0; diff --git a/zone/aa.cpp b/zone/aa.cpp index 27229cb89..61cf56db9 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -600,6 +600,9 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u if(npc_dup != nullptr) npca->GiveNPCTypeData(npc_dup); + if (IsClient()) + npca->no_target_hotkey = 1; + entity_list.AddNPC(npca, true, true); summon_count--; } @@ -696,6 +699,9 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid if(npc_dup != nullptr) npca->GiveNPCTypeData(npc_dup); + if (IsClient()) + npca->no_target_hotkey = 1; + entity_list.AddNPC(npca, true, true); summon_count--; } @@ -883,6 +889,9 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) if(make_npc != nullptr) npca->GiveNPCTypeData(make_npc); + if (IsClient()) + npca->no_target_hotkey = 1; + entity_list.AddNPC(npca, true, true); //the target of these swarm pets will take offense to being cast on... diff --git a/zone/merc.cpp b/zone/merc.cpp index 2641e7cb4..f86ed7faf 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4772,6 +4772,7 @@ Merc* Merc::LoadMerc(Client *c, MercTemplate* merc_template, uint32 merchant_id, npc_type->npc_id = 0; //NPC ID has to be 0, otherwise db gets all confuzzled. npc_type->class_ = merc_template->ClassID; npc_type->maxlevel = 0; //We should hard-set this to override scalerate's functionality in the NPC class when it is constructed. + npc_type->no_target_hotkey = 1; Merc* merc = new Merc(npc_type, c->GetX(), c->GetY(), c->GetZ(), 0); diff --git a/zone/mob.cpp b/zone/mob.cpp index e501862a2..c30cc6d2b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -923,7 +923,8 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players ns->spawn.NPC = IsClient() ? 0 : 1; - ns->spawn.IsMercenary = (IsMerc() || no_target_hotkey) ? 1 : 0; + ns->spawn.IsMercenary = IsMerc() ? 1 : 0; + ns->spawn.targetable_with_hotkey = no_target_hotkey ? 0 : 1; // opposite logic! ns->spawn.petOwnerId = ownerid; diff --git a/zone/npc.h b/zone/npc.h index d374f4950..081fca514 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -269,7 +269,7 @@ public: void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); virtual void DoClassAttacks(Mob *target); void CheckSignal(); - inline bool IsTargetableWithHotkey() const { return no_target_hotkey; } + inline bool IsNotTargetableWithHotkey() const { return no_target_hotkey; } int32 GetNPCHPRegen() const { return hp_regen + itembonuses.HPRegen + spellbonuses.HPRegen; } inline const char* GetAmmoIDfile() const { return ammo_idfile; } From d9a1bcb3fd59ab6b1add560608209440f19c49be Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 10 Dec 2014 02:15:15 -0500 Subject: [PATCH 0539/1883] Clean up SoF+ swarm pet F8 hack --- common/ruletypes.h | 1 - zone/aa.cpp | 9 --------- zone/npc.cpp | 13 ++++++------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 9874e4002..c5a4bb562 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -136,7 +136,6 @@ RULE_CATEGORY_END() RULE_CATEGORY( Pets ) RULE_REAL( Pets, AttackCommandRange, 150 ) RULE_BOOL( Pets, UnTargetableSwarmPet, false ) -RULE_BOOL( Pets, SwarmPetNotTargetableWithHotKey, false ) //On SOF+ clients this a semi-hack to make swarm pets not F8 targetable. RULE_CATEGORY_END() RULE_CATEGORY( GM ) diff --git a/zone/aa.cpp b/zone/aa.cpp index 61cf56db9..27229cb89 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -600,9 +600,6 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u if(npc_dup != nullptr) npca->GiveNPCTypeData(npc_dup); - if (IsClient()) - npca->no_target_hotkey = 1; - entity_list.AddNPC(npca, true, true); summon_count--; } @@ -699,9 +696,6 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid if(npc_dup != nullptr) npca->GiveNPCTypeData(npc_dup); - if (IsClient()) - npca->no_target_hotkey = 1; - entity_list.AddNPC(npca, true, true); summon_count--; } @@ -889,9 +883,6 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) if(make_npc != nullptr) npca->GiveNPCTypeData(make_npc); - if (IsClient()) - npca->no_target_hotkey = 1; - entity_list.AddNPC(npca, true, true); //the target of these swarm pets will take offense to being cast on... diff --git a/zone/npc.cpp b/zone/npc.cpp index 034be8f75..0c49f0388 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1854,27 +1854,26 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) { swarmOwner = entity_list.GetMobID(GetSwarmOwner()); } - + if (swarmOwner != nullptr) { if(swarmOwner->IsClient()) { SetPetOwnerClient(true); //Simple flag to determine if pet belongs to a client SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client. - //This is a hack to allow CLIENT swarm pets NOT to be targeted with F8. Warning: Will turn name 'Yellow'! - if (RuleB(Pets, SwarmPetNotTargetableWithHotKey)) - ns->spawn.IsMercenary = 1; + //This will allow CLIENT swarm pets NOT to be targeted with F8. + ns->spawn.targetable_with_hotkey = 0; } else { //NPC cast swarm pets should still be targetable with F8. - ns->spawn.IsMercenary = 0; + ns->spawn.targetable_with_hotkey = 1; } SetTempPet(true); //Simple mob flag for checking if temp pet swarmOwner->SetTempPetsActive(true); //Necessary fail safe flag set if mob ever had a swarm pet to ensure they are removed. swarmOwner->SetTempPetCount(swarmOwner->GetTempPetCount() + 1); - + //Not recommended if using above (However, this will work better on older clients). if (RuleB(Pets, UnTargetableSwarmPet)) { @@ -1882,7 +1881,7 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) if(!IsCharmed() && swarmOwner->IsClient()) sprintf(ns->spawn.lastName, "%s's Pet", swarmOwner->GetName()); } - } + } else if(GetOwnerID()) { ns->spawn.is_pet = 1; From 0e54019fd505eca4925c83a0f0e641ea818d0586 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 10 Dec 2014 02:18:57 -0500 Subject: [PATCH 0540/1883] Set the no_target_hotkey data as well --- zone/npc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/npc.cpp b/zone/npc.cpp index 0c49f0388..af8b9c544 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1863,11 +1863,13 @@ void NPC::PetOnSpawn(NewSpawn_Struct* ns) SetAllowBeneficial(1);//Allow temp pets to receive buffs and heals if owner is client. //This will allow CLIENT swarm pets NOT to be targeted with F8. ns->spawn.targetable_with_hotkey = 0; + no_target_hotkey = 1; } else { //NPC cast swarm pets should still be targetable with F8. ns->spawn.targetable_with_hotkey = 1; + no_target_hotkey = 0; } SetTempPet(true); //Simple mob flag for checking if temp pet From 118d58706487df73f9157120a6dcbde74c52ee75 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 12 Dec 2014 18:55:43 -0500 Subject: [PATCH 0541/1883] Implement IGNORE_ROOT_AGGRO_RULES (special attack 42) This allows you to have a mob be rooted but still try to attack the target with the most amount of hate instead of attacking the closest --- changelog.txt | 3 +++ zone/common.h | 4 ++-- zone/mob_ai.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 842d66f9a..c71b72c38 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/12/2014 == +demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest) + == 12/09/2014 == Trevius: (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example). demonstar55: SoF+ swarm pets will no longer be F8able (without a hack!) diff --git a/zone/common.h b/zone/common.h index 477d5b876..aa24964fd 100644 --- a/zone/common.h +++ b/zone/common.h @@ -134,8 +134,8 @@ enum { DISABLE_MELEE = 39, NPC_CHASE_DISTANCE = 40, ALLOW_TO_TANK = 41, - MAX_SPECIAL_ATTACK = 42 - + IGNORE_ROOT_AGGRO_RULES = 42, + MAX_SPECIAL_ATTACK = 43 }; typedef enum { //fear states diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d041ac884..81c5f510c 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1088,7 +1088,7 @@ void Mob::AI_Process() { { // we are prevented from getting here if we are blind and don't have a target in range // from above, so no extra blind checks needed - if (IsRooted() || IsBlind()) + if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind()) SetTarget(hate_list.GetClosest(this)); else { From 80a67f9ebc159072c67c290606179f53fddb0bdf Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 13 Dec 2014 03:18:30 -0500 Subject: [PATCH 0542/1883] Fix guild rank spam --- changelog.txt | 3 +++ zone/client_packet.cpp | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index c71b72c38..3b30d17e3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/13/2014 == +demonstar55: Fix guild rank spam on zone (needed to be in OP_PP) + == 12/12/2014 == demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c68434109..574220e97 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1483,9 +1483,28 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) m_pp.gm = 0; /* Load Guild */ - if (!IsInAGuild()) { m_pp.guild_id = GUILD_NONE; } - else { + if (!IsInAGuild()) { + m_pp.guild_id = GUILD_NONE; + } else { m_pp.guild_id = GuildID(); + uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); + // FIXME: RoF guild rank + if (GetClientVersion() >= EQClientRoF) { + switch (rank) { + case 0: + rank = 5; + break; + case 1: + rank = 3; + break; + case 2: + rank = 1; + break; + default: + break; + } + } + m_pp.guildrank = rank; if (zone->GetZoneID() == RuleI(World, GuildBankZoneID)) GuildBanker = (guild_mgr.IsGuildLeader(GuildID(), CharacterID()) || guild_mgr.GetBankerFlag(CharacterID())); } From 9056008342cc519d608b4f8eb376c12de92b9192 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 13 Dec 2014 13:53:55 -0600 Subject: [PATCH 0543/1883] (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table. (RoF+) Added command #heromodel (#hm for short) - Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63) --- changelog.txt | 5 +- common/item.cpp | 83 +++++++++++-- common/item.h | 14 ++- common/patches/rof.cpp | 28 +++-- common/patches/rof2.cpp | 35 ++++-- common/patches/rof2_structs.h | 8 +- common/patches/rof_structs.h | 8 +- common/shareddb.cpp | 56 ++++----- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + world/worlddb.cpp | 96 ++++++++------- zone/bot.cpp | 34 +++++- zone/client.cpp | 201 ++++++------------------------- zone/client.h | 2 +- zone/client_packet.cpp | 21 ++-- zone/command.cpp | 43 +++++++ zone/command.h | 1 + zone/corpse.cpp | 2 +- zone/inventory.cpp | 21 ++-- zone/mob.cpp | 174 +++++++++++++------------- zone/mob.h | 2 +- zone/npc.cpp | 13 +- 22 files changed, 457 insertions(+), 393 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3b30d17e3..3baa02623 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/13/2014 == -demonstar55: Fix guild rank spam on zone (needed to be in OP_PP) +demonstar55: Fix guild rank spam on zone (needed to be in OP_PP). +Trevius: (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table. +Trevius: (RoF+) Added command #heromodel (#hm for short) - Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63) + == 12/12/2014 == demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest) diff --git a/common/item.cpp b/common/item.cpp index f92bc6a67..8af7f8b06 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -24,6 +24,7 @@ #include "races.h" #include "shareddb.h" #include "classes.h" +#include "rulesys.h" #include @@ -1125,10 +1126,12 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) m_trade[slot_id] = inst; result = slot_id; } - else { + else + { // Slot must be within a bag ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); // Get parent bag - if (baginst && baginst->IsType(ItemClassContainer)) { + if (baginst && baginst->IsType(ItemClassContainer)) + { baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); result = slot_id; } @@ -1414,6 +1417,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) { m_scaling = false; m_ornamenticon = 0; m_ornamentidfile = 0; + m_ornament_hero_model = 0; } ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { @@ -1438,6 +1442,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_scaling = false; m_ornamenticon = 0; m_ornamentidfile = 0; + m_ornament_hero_model = 0; } ItemInst::ItemInst(ItemInstTypes use_type) { @@ -1457,6 +1462,7 @@ ItemInst::ItemInst(ItemInstTypes use_type) { m_scaling = false; m_ornamenticon = 0; m_ornamentidfile = 0; + m_ornament_hero_model = 0; } // Make a copy of an ItemInst object @@ -1509,6 +1515,7 @@ ItemInst::ItemInst(const ItemInst& copy) m_scaling = copy.m_scaling; m_ornamenticon = copy.m_ornamenticon; m_ornamentidfile = copy.m_ornamentidfile; + m_ornament_hero_model = copy.m_ornament_hero_model; } // Clean up container contents @@ -1782,21 +1789,79 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const return nullptr; } -ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const +ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const { - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { - const char *item_IDFile = GetAugment(i)->GetItem()->IDFile; - if (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0) - continue; - + if (ornamentationAugtype > 0) + { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) + { + if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) + { + const char *item_IDFile = GetAugment(i)->GetItem()->IDFile; + if ( + (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 + || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0) + && GetAugment(i)->GetItem()->HerosForgeModel == 0 + ) + { + continue; + } return this->GetAugment(i); + } } } return nullptr; } +uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const { + uint32 HeroModel = 0; + if (m_ornament_hero_model > 0) + { + HeroModel = m_ornament_hero_model; + if (material_slot >= 0) + { + HeroModel = (m_ornament_hero_model * 100) + material_slot; + } + } + return HeroModel; +} + +bool ItemInst::UpdateOrnamentationInfo() { + bool ornamentSet = false; + + if (IsType(ItemClassCommon)) + { + int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); + if (GetOrnamentationAug(ornamentationAugtype)) + { + const Item_Struct* ornamentItem; + ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem(); + if (ornamentItem != nullptr) + { + SetOrnamentIcon(ornamentItem->Icon); + SetOrnamentHeroModel(ornamentItem->HerosForgeModel); + if (strlen(ornamentItem->IDFile) > 2) + { + SetOrnamentationIDFile(atoi(&ornamentItem->IDFile[2])); + } + else + { + SetOrnamentationIDFile(0); + } + ornamentSet = true; + } + } + else + { + SetOrnamentIcon(0); + SetOrnamentHeroModel(0); + SetOrnamentationIDFile(0); + } + } + return ornamentSet; +} + bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll) { if (!ItemToTry || !Container) return false; diff --git a/common/item.h b/common/item.h index cce166eb0..4827f042b 100644 --- a/common/item.h +++ b/common/item.h @@ -329,7 +329,8 @@ public: void DeleteAugment(uint8 slot); ItemInst* RemoveAugment(uint8 index); bool IsAugmented(); - ItemInst* GetOrnamentationAug(int ornamentationAugtype) const; + ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const; + bool UpdateOrnamentationInfo(); static bool CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll = false); // Has attack/delay? @@ -393,10 +394,12 @@ public: void SetActivated(bool activated) { m_activated = activated; } int8 GetEvolveLvl() const { return m_evolveLvl; } void SetScaling(bool v) { m_scaling = v; } - uint32 GetOrnamentationIcon() const { return m_ornamenticon; } - void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; } - uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; } - void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; } + uint32 GetOrnamentationIcon() const { return m_ornamenticon; } + void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; } + uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; } + void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; } + uint32 GetOrnamentHeroModel(int32 material_slot = -1) const; + void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; } void Initialize(SharedDatabase *db = nullptr); void ScaleItem(); @@ -443,6 +446,7 @@ protected: bool m_scaling; uint32 m_ornamenticon; uint32 m_ornamentidfile; + uint32 m_ornament_hero_model; // // Items inside of this item (augs or contents); diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index fc35e36cd..202d4f090 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3812,8 +3812,8 @@ namespace RoF Equipment[k].material = emu->equipment[k].material; Equipment[k].unknown1 = emu->equipment[k].unknown1; Equipment[k].elitematerial = emu->equipment[k].elitematerial; - Equipment[k].material2 = emu->equipment[k].heroforgemodel; - Equipment[k].elitematerial = emu->equipment[k].material2; + Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel; + Equipment[k].material2 = emu->equipment[k].material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -4847,7 +4847,6 @@ namespace RoF hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot; hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff; hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff; - //hdr.unknown013 = 0xffff; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); //hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff; @@ -4877,6 +4876,8 @@ namespace RoF } //ORNAMENT IDFILE / ICON uint16 ornaIcon = 0; + int32 heroModel = 0; + /* if (inst->GetOrnamentationAug(ornamentationAugtype)) { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); //Mainhand @@ -4887,8 +4888,16 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); //Icon ornaIcon = aug_weap->Icon; + if (aug_weap->HerosForgeModel > 0) + { + heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in); + } } - else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { + else + */ + + if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) + { char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); //Mainhand ss.write(tmp, strlen(tmp)); @@ -4897,10 +4906,12 @@ namespace RoF ss.write(tmp, strlen(tmp)); ss.write((const char*)&null_term, sizeof(uint8)); ornaIcon = inst->GetOrnamentationIcon(); + heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); } - else { - ss.write((const char*)&null_term, sizeof(uint8)); //no mh - ss.write((const char*)&null_term, sizeof(uint8));//no of + else + { + ss.write((const char*)&null_term, sizeof(uint8)); // no main hand Ornamentation + ss.write((const char*)&null_term, sizeof(uint8)); // no off hand Ornamentation } RoF::structs::ItemSerializationHeaderFinish hdrf; @@ -4908,12 +4919,13 @@ namespace RoF hdrf.unknown061 = 0; hdrf.unknown062 = 0; hdrf.unknowna1 = 0xffffffff; - hdrf.unknowna2 = 0; + hdrf.ornamentHeroModel = heroModel; hdrf.unknown063 = 0; hdrf.unknowna3 = 0; hdrf.unknowna4 = 0xffffffff; hdrf.unknowna5 = 0; hdrf.ItemClass = item->ItemClass; + ss.write((const char*)&hdrf, sizeof(RoF::structs::ItemSerializationHeaderFinish)); if (strlen(item->Name) > 0) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 32a3fc592..531aa8c4d 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3816,8 +3816,8 @@ namespace RoF2 Equipment[k].material = emu->equipment[k].material; Equipment[k].unknown1 = emu->equipment[k].unknown1; Equipment[k].elitematerial = emu->equipment[k].elitematerial; - Equipment[k].material2 = emu->equipment[k].heroforgemodel; - Equipment[k].elitematerial = emu->equipment[k].material2; + Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel; + Equipment[k].material2 = emu->equipment[k].material2; } Buffer += (sizeof(structs::EquipStruct) * 9); @@ -4851,7 +4851,6 @@ namespace RoF2 hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot; hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff; hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff; - //hdr.unknown013 = 0xffff; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); //hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff; @@ -4862,8 +4861,8 @@ namespace RoF2 hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; hdr.unknown044 = 0; - hdr.unknown048 = 0; - hdr.unknown052 = 0; + hdr.unknown048 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; + hdr.unknown052 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; ss.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader)); @@ -4881,7 +4880,10 @@ namespace RoF2 } //ORNAMENT IDFILE / ICON uint16 ornaIcon = 0; - if (inst->GetOrnamentationAug(ornamentationAugtype)) { + int32 heroModel = 0; + /* + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); //Mainhand ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); @@ -4891,8 +4893,16 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); //Icon ornaIcon = aug_weap->Icon; + if (aug_weap->HerosForgeModel > 0) + { + heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in); + } } - else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { + else + */ + + if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) + { char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); //Mainhand ss.write(tmp, strlen(tmp)); @@ -4901,10 +4911,12 @@ namespace RoF2 ss.write(tmp, strlen(tmp)); ss.write((const char*)&null_term, sizeof(uint8)); ornaIcon = inst->GetOrnamentationIcon(); + heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in)); } - else { - ss.write((const char*)&null_term, sizeof(uint8)); //no mh - ss.write((const char*)&null_term, sizeof(uint8));//no of + else + { + ss.write((const char*)&null_term, sizeof(uint8)); // no main hand Ornamentation + ss.write((const char*)&null_term, sizeof(uint8)); // no off hand Ornamentation } RoF2::structs::ItemSerializationHeaderFinish hdrf; @@ -4912,12 +4924,13 @@ namespace RoF2 hdrf.unknown061 = 0; hdrf.unknown062 = 0; hdrf.unknowna1 = 0xffffffff; - hdrf.unknowna2 = 0; + hdrf.ornamentHeroModel = heroModel; hdrf.unknown063 = 0; hdrf.unknowna3 = 0; hdrf.unknowna4 = 0xffffffff; hdrf.unknowna5 = 0; hdrf.ItemClass = item->ItemClass; + ss.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish)); if (strlen(item->Name) > 0) diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 572a5a0f0..90ea4f287 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4425,14 +4425,14 @@ struct EvolvingItem { struct ItemSerializationHeaderFinish { - uint16 ornamentIcon; +/*079*/ uint16 ornamentIcon; /*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? /*082*/ uint8 unknown062; // 0 -/*083*/ uint32 unknowna1; // 0xffffffff -/*087*/ uint32 unknowna2; // 0 +/*083*/ int32 unknowna1; // 0xffffffff +/*087*/ uint32 ornamentHeroModel; // 0 /*091*/ uint8 unknown063; // 0 /*092*/ uint32 unknowna3; // 0 -/*096*/ uint32 unknowna4; // 0xffffffff +/*096*/ int32 unknowna4; // 0xffffffff /*100*/ uint32 unknowna5; // 0 /*104*/ uint8 ItemClass; //0, 1, or 2 /*105*/ diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 285b15675..a7b494d0d 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4422,14 +4422,14 @@ struct EvolvingItem { struct ItemSerializationHeaderFinish { - uint16 ornamentIcon; +/*079*/ uint16 ornamentIcon; /*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? /*082*/ uint8 unknown062; // 0 -/*083*/ uint32 unknowna1; // 0xffffffff -/*087*/ uint32 unknowna2; // 0 +/*083*/ int32 unknowna1; // 0xffffffff +/*087*/ uint32 ornamentHeroModel; // 0 /*091*/ uint8 unknown063; // 0 /*092*/ uint32 unknowna3; // 0 -/*096*/ uint32 unknowna4; // 0xffffffff +/*096*/ int32 unknowna4; // 0xffffffff /*100*/ uint32 unknowna5; // 0 /*104*/ uint8 ItemClass; //0, 1, or 2 /*105*/ diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 6bf1cb52f..8f99ac03d 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -199,14 +199,15 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i // Update/Insert item std::string query = StringFormat("REPLACE INTO inventory " "(charid, slotid, itemid, charges, instnodrop, custom_data, color, " - "augslot1, augslot2, augslot3, augslot4, augslot5, ornamenticon, ornamentidfile) " + "augslot1, augslot2, augslot3, augslot4, augslot5, ornamenticon, ornamentidfile, ornament_hero_model) " "VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, " - "%lu, %lu, %lu, %lu, %lu, %lu, %lu)", + "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)", (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, (unsigned long)(inst->IsInstNoDrop()? 1: 0), inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(), (unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2], - (unsigned long)augslot[3],(unsigned long)augslot[4], (unsigned long)inst->GetOrnamentationIcon(), (unsigned long)inst->GetOrnamentationIDFile()); + (unsigned long)augslot[3],(unsigned long)augslot[4], (unsigned long)inst->GetOrnamentationIcon(), + (unsigned long)inst->GetOrnamentationIDFile(), (unsigned long)inst->GetOrnamentHeroModel()); auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents @@ -488,7 +489,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -515,6 +516,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { uint32 ornament_icon = (uint32)atoul(row[11]); uint32 ornament_idfile = (uint32)atoul(row[12]); + uint32 ornament_hero_model = (uint32)atoul(row[13]); const Item_Struct* item = GetItem(item_id); @@ -552,11 +554,10 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { value.push_back(v); } } - if (ornament_icon > 0) - inst->SetOrnamentIcon(ornament_icon); - if (ornament_idfile > 0) - inst->SetOrnamentationIDFile(ornament_idfile); + inst->SetOrnamentIcon(ornament_icon); + inst->SetOrnamentationIDFile(ornament_idfile); + inst->SetOrnamentHeroModel(ornament_hero_model); if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) inst->SetInstNoDrop(true); @@ -599,7 +600,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile " + "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " "FROM inventory INNER JOIN character_data ch " "ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid", name, account_id); @@ -627,6 +628,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; uint32 ornament_icon = (uint32)atoul(row[11]); uint32 ornament_idfile = (uint32)atoul(row[12]); + uint32 ornament_hero_model = (uint32)atoul(row[13]); const Item_Struct* item = GetItem(item_id); int16 put_slot_id = INVALID_INDEX; @@ -663,11 +665,9 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) } } - if (ornament_icon > 0) - inst->SetOrnamentIcon(ornament_icon); - - if (ornament_idfile > 0) - inst->SetOrnamentationIDFile(ornament_idfile); + inst->SetOrnamentIcon(ornament_icon); + inst->SetOrnamentationIDFile(ornament_idfile); + inst->SetOrnamentHeroModel(ornament_hero_model); if (color > 0) inst->SetColor(color); @@ -854,23 +854,6 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ item.ItemType = (uint8)atoi(row[ItemField::itemtype]); item.Material = (uint8)atoi(row[ItemField::material]); item.HerosForgeModel = (uint32)atoi(row[ItemField::herosforgemodel]); - if (item.HerosForgeModel > 0) - { - item.HerosForgeModel *= 100; - uint32 HeroSlot = 0; - switch (item.Slots) - { - case 4: { HeroSlot = 0; break; } // Head - case 131072: { HeroSlot = 1; break; } // Chest - case 128: { HeroSlot = 2; break; } // Arms - case 1536: { HeroSlot = 3; break; } // Bracers - case 4096: { HeroSlot = 4; break; } // Hands - case 262144: { HeroSlot = 5; break; } // Legs - case 524288: { HeroSlot = 6; break; } // Feet - default: { HeroSlot = 1; break; } // Chest - } - item.HerosForgeModel += HeroSlot; - } item.SellRate = (float)atof(row[ItemField::sellrate]); item.CastTime = (uint32)atoul(row[ItemField::casttime]); item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]); @@ -1024,11 +1007,18 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ } const Item_Struct* SharedDatabase::GetItem(uint32 id) { - if(!items_hash || id > items_hash->max_key()) { + if (id == 0) + { return nullptr; } - if(items_hash->exists(id)) { + if(!items_hash || id > items_hash->max_key()) + { + return nullptr; + } + + if(items_hash->exists(id)) + { return &(items_hash->at(id)); } diff --git a/common/version.h b/common/version.h index 78aa9fcf0..e223fe606 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9060 +#define CURRENT_BINARY_DATABASE_VERSION 9061 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index a06a9d94e..61806f625 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -314,6 +314,7 @@ 9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| 9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| 9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| +9061|2014_12_11_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 7d70fd71d..d9315e80e 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -154,18 +154,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } /* Bind End */ - /* - Character's equipped items - @merth: Haven't done bracer01/bracer02 yet. - Also: this needs a second look after items are a little more solid - NOTE: items don't have a color, players MAY have a tint, if the - use_tint part is set. otherwise use the regular color - */ - /* 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]); @@ -175,53 +168,70 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* /* Load Inventory */ inv = new Inventory; - if (GetInventory(account_id, cs->name[char_num], inv)) { - for (uint8 material = 0; material <= 8; material++) { - uint32 color = 0; - ItemInst *item = inv->GetItem(Inventory::CalcSlotFromMaterial(material)); - if (item == 0) - continue; + if (GetInventory(account_id, cs->name[char_num], inv)) + { + const Item_Struct* item = nullptr; + const ItemInst* inst = nullptr; + int16 invslot = 0; - cs->equip[char_num][material].material = item->GetItem()->Material; - cs->equip[char_num][material].material = 0; - cs->equip[char_num][material].elitematerial = item->GetItem()->EliteMaterial; - cs->equip[char_num][material].heroforgemodel = item->GetItem()->HerosForgeModel; - cs->equip[char_num][material].material2 = item->GetItem()->Material; + for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) + { + invslot = Inventory::CalcSlotFromMaterial(matslot); + if (invslot == INVALID_INDEX) { continue; } - if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; } - else{ color = item->GetItem()->Color; } + inst = inv->GetItem(invslot); + if (inst == nullptr) { continue; } - cs->equip[char_num][material].color.color = color; + item = inst->GetItem(); + if (item == nullptr) { continue; } - /* Weapons are handled a bit differently */ - if ((material == MaterialPrimary) || (material == MaterialSecondary)) { - if (strlen(item->GetItem()->IDFile) > 2) { - int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - uint32 idfile; - if (item->GetOrnamentationAug(ornamentationAugtype)) { - idfile = atoi(&item->GetOrnamentationAug(ornamentationAugtype)->GetItem()->IDFile[2]); - } - else if (item->GetOrnamentationIcon() && item->GetOrnamentationIDFile()) { - idfile = item->GetOrnamentationIDFile(); - } - else { - idfile = atoi(&item->GetItem()->IDFile[2]); - } - - if (material == MaterialPrimary) - cs->primary[char_num] = idfile; - else - cs->secondary[char_num] = idfile; + 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 + { + // 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 = inst->GetColor(); } } } - else { + else + { printf("Error loading inventory for %s\n", cs->name[char_num]); } + safe_delete(inv); + if (++char_num > 10) + { break; + } } return; diff --git a/zone/bot.cpp b/zone/bot.cpp index 11bbf44c7..a79c45880 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4390,7 +4390,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { uint32 spawnedbotid = 0; spawnedbotid = this->GetBotID(); - for (int i = 0; i < _MaterialCount; i++) + for (int i = 0; i < MaterialPrimary; i++) { inst = GetBotItem(i); if (inst) @@ -4420,6 +4420,34 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { } } } + + inst = GetBotItem(MainPrimary); + if(inst) + { + item = inst->GetItem(); + if(item) + { + if(strlen(item->IDFile) > 2) + { + ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + } + ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary); + } + } + + inst = GetBotItem(MainSecondary); + if(inst) + { + item = inst->GetItem(); + if(item) + { + if(strlen(item->IDFile) > 2) + { + ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + } + ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary); + } + } } } @@ -16007,11 +16035,13 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) { uint32 Bot::GetEquipmentColor(uint8 material_slot) const { //Bot tints - uint32 slotid = 0; + int16 slotid = 0; uint32 botid = this->GetBotID(); //Translate code slot # to DB slot # slotid = Inventory::CalcSlotFromMaterial(material_slot); + if(invslot == INVALID_INDEX) + return 0; //read from db std::string query = StringFormat("SELECT color FROM botinventory " diff --git a/zone/client.cpp b/zone/client.cpp index 014d4f0bb..d2349e02a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1819,129 +1819,43 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.runspeed = (gmspeed == 0) ? runspeed : 3.125f; if (!m_pp.showhelm) ns->spawn.showhelm = 0; - // pp also hold this info; should we pull from there or inventory? - // (update: i think pp should do it, as this holds LoY dye - plus, this is ugly code with Inventory!) + /* + // Equipment/Weapons already set from Mob::FillSpawnStruct + // Commenting this out for now const Item_Struct* item = nullptr; const ItemInst* inst = nullptr; + int16 invslot; - // Only Player Races Wear Armor - if (IsPlayerRace(race)) + for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) { - if ((inst = m_inv[MainHands]) && inst->IsType(ItemClassCommon)) + // Only Player Races Wear Armor + if (IsPlayerRace(race) || matslot > 6) { - item = inst->GetItem(); - ns->spawn.equipment[MaterialHands].material = item->Material; - ns->spawn.equipment[MaterialHands].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialHands].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialHands].color = m_pp.item_tint[MaterialHands].rgb.use_tint ? m_pp.item_tint[MaterialHands].color : item->Color; - } - if ((inst = m_inv[MainHead]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialHead].material = item->Material; - ns->spawn.equipment[MaterialHead].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialHead].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialHead].color = m_pp.item_tint[MaterialHead].rgb.use_tint ? m_pp.item_tint[MaterialHead].color : item->Color; - } - if ((inst = m_inv[MainArms]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialArms].material = item->Material; - ns->spawn.equipment[MaterialArms].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialArms].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialArms].color = m_pp.item_tint[MaterialArms].rgb.use_tint ? m_pp.item_tint[MaterialArms].color : item->Color; - } - if ((inst = m_inv[MainWrist1]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialWrist].material = item->Material; - ns->spawn.equipment[MaterialWrist].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialWrist].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialWrist].color = m_pp.item_tint[MaterialWrist].rgb.use_tint ? m_pp.item_tint[MaterialWrist].color : item->Color; - } + invslot = Inventory::CalcSlotFromMaterial(matslot); + if (invslot == INVALID_INDEX) + continue; - if ((inst = m_inv[MainChest]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialChest].material = item->Material; - ns->spawn.equipment[MaterialChest].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialChest].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialChest].color = m_pp.item_tint[MaterialChest].rgb.use_tint ? m_pp.item_tint[MaterialChest].color : item->Color; - } - if ((inst = m_inv[MainLegs]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialLegs].material = item->Material; - ns->spawn.equipment[MaterialLegs].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialLegs].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialLegs].color = m_pp.item_tint[MaterialLegs].rgb.use_tint ? m_pp.item_tint[MaterialLegs].color : item->Color; - } - if ((inst = m_inv[MainFeet]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - ns->spawn.equipment[MaterialFeet].material = item->Material; - ns->spawn.equipment[MaterialFeet].elitematerial = item->EliteMaterial; - ns->spawn.equipment[MaterialFeet].heroforgemodel = item->HerosForgeModel; - ns->spawn.colors[MaterialFeet].color = m_pp.item_tint[MaterialFeet].rgb.use_tint ? m_pp.item_tint[MaterialFeet].color : item->Color; - } - } - int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon)) - { - if (inst->GetOrnamentationAug(ornamentationAugtype)) - { - item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - if (strlen(item->IDFile) > 2) + if ((inst = m_inv[invslot]) && inst->IsType(ItemClassCommon)) { - ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); - } - } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) - { - ns->spawn.equipment[MaterialPrimary].material = inst->GetOrnamentationIDFile(); - } - else - { - item = inst->GetItem(); - if (strlen(item->IDFile) > 2) - { - ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); + item = inst->GetItem(); + + if (matslot > 6) + { + // Weapon Models + ns->spawn.equipment[matslot].material = GetEquipmentMaterial(matslot); + } + else + { + // Armor Materials/Models + ns->spawn.equipment[matslot].material = item->Material; + ns->spawn.equipment[matslot].elitematerial = item->EliteMaterial; + ns->spawn.equipment[matslot].heroforgemodel = GetHerosForgeModel(matslot); + ns->spawn.colors[matslot].color = m_pp.item_tint[matslot].rgb.use_tint ? m_pp.item_tint[matslot].color : item->Color; + } } } } - if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon)) - { - if (inst->GetOrnamentationAug(ornamentationAugtype)) - { - item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - if (strlen(item->IDFile) > 2) - { - ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); - } - } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) - { - ns->spawn.equipment[MaterialSecondary].material = inst->GetOrnamentationIDFile(); - } - else - { - item = inst->GetItem(); - if (strlen(item->IDFile) > 2) - { - ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); - } - } - } - - //these two may be related to ns->spawn.texture - /* - ns->spawn.npc_armor_graphic = texture; - ns->spawn.npc_helm_graphic = helmtexture; */ - - //filling in some unknowns to make the client happy -// ns->spawn.unknown0002[2] = 3; - } bool Client::GMHideMe(Client* client) { @@ -2769,48 +2683,10 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){ void Client::SetMaterial(int16 in_slot, uint32 item_id) { const Item_Struct* item = database.GetItem(item_id); - int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - if (item && (item->ItemClass==ItemClassCommon)) { - if (in_slot==MainHead) - m_pp.item_material[MaterialHead] = item->Material; - else if (in_slot==MainChest) - m_pp.item_material[MaterialChest] = item->Material; - else if (in_slot==MainArms) - m_pp.item_material[MaterialArms] = item->Material; - else if (in_slot==MainWrist1) - m_pp.item_material[MaterialWrist] = item->Material; - else if (in_slot==MainHands) - m_pp.item_material[MaterialHands] = item->Material; - else if (in_slot==MainLegs) - m_pp.item_material[MaterialLegs] = item->Material; - else if (in_slot==MainFeet) - m_pp.item_material[MaterialFeet] = item->Material; - else if (in_slot == MainPrimary) { - const ItemInst* inst = m_inv[MainPrimary]; - if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); - } - else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - m_pp.item_material[MaterialPrimary] = inst->GetOrnamentationIDFile(); - } - else { - m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2); - } - } - else if (in_slot == MainSecondary) { - const ItemInst* inst = m_inv[MainSecondary]; - if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); - } - else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - m_pp.item_material[MaterialSecondary] = inst->GetOrnamentationIDFile(); - } - else { - m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2); - } - } + if (item && (item->ItemClass==ItemClassCommon)) + { + uint32 matslot = Inventory::CalcMaterialFromSlot(in_slot); + m_pp.item_material[matslot] = GetEquipmentMaterial(matslot); } } @@ -5859,17 +5735,18 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) { if(inst) { item = inst->GetItem(); if(item) { - if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - strcpy(insr->itemnames[L], item->Name); - insr->itemicons[L] = aug_weap->Icon; + strcpy(insr->itemnames[L], item->Name); + if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) + { + const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + insr->itemicons[L] = aug_item->Icon; } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - strcpy(insr->itemnames[L], item->Name); + else if (inst && inst->GetOrnamentationIcon()) + { insr->itemicons[L] = inst->GetOrnamentationIcon(); } - else { - strcpy(insr->itemnames[L], item->Name); + else + { insr->itemicons[L] = item->Icon; } } diff --git a/zone/client.h b/zone/client.h index 7cbddfdb2..b5f414052 100644 --- a/zone/client.h +++ b/zone/client.h @@ -805,7 +805,7 @@ public: void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 574220e97..db209317b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3085,7 +3085,6 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) uint16 slot_id = in_augment->container_slot; uint16 aug_slot_id = in_augment->augment_slot; - //Message(13, "%i AugSlot", aug_slot_id); if (slot_id == INVALID_INDEX || aug_slot_id == INVALID_INDEX) { Message(13, "Error: Invalid Aug Index."); @@ -3101,6 +3100,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) (tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots))) { tobe_auged->PutAugment(in_augment->augment_index, *auged_with); + tobe_auged->UpdateOrnamentationInfo(); ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_index); if (aug) { @@ -3123,15 +3123,16 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { DeleteItemInInventory(slot_id, 0, true); DeleteItemInInventory(MainCursor, 0, true); + if (PutItemInInventory(slot_id, *itemOneToPush, true)) { CalcBonuses(); - //Message(13, "Sucessfully added an augment to your item!"); + // Successfully added an augment to the item return; } else { - Message(13, "Error: No available slot for end result. Please free up some bag space."); + Message(13, "Error: No available slot for end result. Please free up the augment slot."); } } else @@ -3185,6 +3186,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) return; } old_aug = tobe_auged->RemoveAugment(in_augment->augment_index); + tobe_auged->UpdateOrnamentationInfo(); itemOneToPush = tobe_auged->Clone(); if (old_aug) @@ -3193,9 +3195,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { DeleteItemInInventory(slot_id, 0, true); DeleteItemInInventory(aug_slot_id, auged_with->IsStackable() ? 1 : 0, true); + if (!PutItemInInventory(slot_id, *itemOneToPush, true)) { - Message(15, "Shouldn't happen, contact an admin!"); + Message(15, "Failed to remove augment properly!"); } if (PutItemInInventory(MainCursor, *itemTwoToPush, true)) @@ -8031,17 +8034,15 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) item = inst ? inst->GetItem() : nullptr; if (item) { + strcpy(insr->itemnames[L], item->Name); if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - strcpy(insr->itemnames[L], item->Name); - insr->itemicons[L] = aug_weap->Icon; + const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + insr->itemicons[L] = aug_item->Icon; } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - strcpy(insr->itemnames[L], item->Name); + else if (inst->GetOrnamentationIcon()) { insr->itemicons[L] = inst->GetOrnamentationIcon(); } else { - strcpy(insr->itemnames[L], item->Name); insr->itemicons[L] = item->Icon; } } diff --git a/zone/command.cpp b/zone/command.cpp index 59a786a19..3876d90de 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -153,6 +153,8 @@ int command_init(void) { command_add("version","- Display current version of EQEmu server",0,command_version) || command_add("setfaction","[faction number] - Sets targeted NPC's faction in the database",170,command_setfaction) || command_add("wc","[wear slot] [material] - Sends an OP_WearChange for your target",200,command_wc) || + command_add("heromodel", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.", 200, command_heromodel) || + command_add("hm", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.)", 200, command_heromodel) || command_add("setanim","[animnum] - Set target's appearance to animnum",200,command_setanim) || command_add("connectworldserver","- Make zone attempt to connect to worldserver",200,command_connectworldserver) || command_add("connectworld",nullptr,0,command_connectworldserver) || @@ -787,6 +789,47 @@ void command_wc(Client *c, const Seperator *sep) } } +void command_heromodel(Client *c, const Seperator *sep) +{ + if (sep->argnum < 1) + { + c->Message(0, "Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63)"); + } + else if (c->GetTarget() == nullptr) + { + c->Message(13, "You must have a target to do a wear change for Hero's Forge Models."); + } + else + { + uint32 hero_forge_model = atoi(sep->arg[1]); + + if (sep->argnum > 1) + { + uint8 wearslot = (uint8)atoi(sep->arg[2]); + c->GetTarget()->SendTextureWC(wearslot, 0, hero_forge_model, 0, 0, 0); + } + else + { + if (hero_forge_model > 0) + { + // Conversion to simplify the command arguments + // Hero's Forge model is actually model * 1000 + texture * 100 + wearslot + // Hero's Forge Model slot 7 is actually for Robes, but it still needs to use wearslot 1 in the packet + hero_forge_model *= 100; + + for (uint8 wearslot = 0; wearslot < 7; wearslot++) + { + c->GetTarget()->SendTextureWC(wearslot, 0, (hero_forge_model + wearslot), 0, 0, 0); + } + } + else + { + c->Message(13, "Hero's Forge Model must be greater than 0."); + } + } + } +} + void command_setanim(Client *c, const Seperator *sep) { if (c->GetTarget() && sep->IsNumber(1)) { diff --git a/zone/command.h b/zone/command.h index 72ee5c06a..68e956166 100644 --- a/zone/command.h +++ b/zone/command.h @@ -76,6 +76,7 @@ void command_serversidename(Client *c, const Seperator *sep); void command_testspawnkill(Client *c, const Seperator *sep); void command_testspawn(Client *c, const Seperator *sep); void command_wc(Client *c, const Seperator *sep); +void command_heromodel(Client *c, const Seperator *sep); void command_numauths(Client *c, const Seperator *sep); void command_setanim(Client *c, const Seperator *sep); void command_connectworldserver(Client *c, const Seperator *sep); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 40ecccf80..d61fc02c9 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1428,7 +1428,7 @@ void Corpse::Spawn() { } uint32 Corpse::GetEquipment(uint8 material_slot) const { - int invslot; + int16 invslot; if(material_slot > EmuConstants::MATERIAL_END) { return NO_ITEM; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index bb9802e1c..08a7ceb29 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -189,7 +189,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) { return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != INVALID_INDEX); } -bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile) { +bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) { this->EVENT_ITEM_ScriptStopReturn(); // TODO: update calling methods and script apis to handle a failure return @@ -548,10 +548,9 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(attuned && inst->GetItem()->Attuneable) inst->SetInstNoDrop(true); - if(ornament_icon > 0 && ornament_idfile > 0) { - inst->SetOrnamentIcon(ornament_icon); - inst->SetOrnamentationIDFile(ornament_idfile); - } + inst->SetOrnamentIcon(ornament_icon); + inst->SetOrnamentationIDFile(ornament_idfile); + inst->SetOrnamentHeroModel(ornament_hero_model); // check to see if item is usable in requested slot if(enforceusable && (((to_slot >= MainCharm) && (to_slot <= MainAmmo)) || (to_slot == MainPowerSource))) { @@ -581,11 +580,13 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if((RuleB(Character, EnableDiscoveredItems)) && !GetGM()) { if(!IsDiscovered(item_id)) DiscoverItem(item_id); - + /* + // Augments should have been discovered prior to being placed on an item. for (int iter = AUG_BEGIN; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) { if(augments[iter] && !IsDiscovered(augments[iter])) DiscoverItem(augments[iter]); } + */ } return true; @@ -819,7 +820,11 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client m_inv.PutItem(slot_id, inst); if (client_update) + { SendItemPacket(slot_id, &inst, ((slot_id == MainCursor) ? ItemPacketSummonItem : ItemPacketTrade)); + //SendWearChange(Inventory::CalcMaterialFromSlot(slot_id)); + } + if (slot_id == MainCursor) { std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); @@ -2292,7 +2297,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { // these functions operate with a material slot, which is from 0 to 8 uint32 Client::GetEquipment(uint8 material_slot) const { - int invslot; + int16 invslot; const ItemInst *item; if(material_slot > EmuConstants::MATERIAL_END) @@ -2301,7 +2306,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const } invslot = Inventory::CalcSlotFromMaterial(material_slot); - if(invslot == -1) + if (invslot == INVALID_INDEX) { return 0; } diff --git a/zone/mob.cpp b/zone/mob.cpp index c30cc6d2b..73e356efb 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -972,36 +972,15 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); - const Item_Struct *item; - for (i = 0; i < _MaterialCount; i++) { // Only Player Races Wear Armor - if (IsPlayerRace(race) || i > 6) + if (Mob::IsPlayerRace(race) || i > 6) { ns->spawn.equipment[i].material = GetEquipmentMaterial(i); - - item = database.GetItem(GetEquipment(i)); - if (item != 0) - { - 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]; - } - else - { - ns->spawn.colors[i].color = item->Color; - } - } - else - { - if (armor_tint[i]) - { - ns->spawn.colors[i].color = armor_tint[i]; - } - } + ns->spawn.equipment[i].elitematerial = IsEliteMaterialItem(i); + ns->spawn.equipment[i].heroforgemodel = GetHerosForgeModel(i); + ns->spawn.colors[i].color = GetEquipmentColor(i); } } @@ -1023,7 +1002,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) //ns->spawn.DestructibleAppearance = static_cast(_appearance); // #appearance 44 1 makes it jump but no visible damage // #appearance 44 2 makes it look completely broken but still visible - // #appearnace 44 3 makes it jump but not visible difference to 3 + // #appearance 44 3 makes it jump but not visible difference to 3 // #appearance 44 4 makes it disappear altogether // #appearance 44 5 makes the client crash. @@ -2611,8 +2590,8 @@ uint32 NPC::GetEquipment(uint8 material_slot) const { if(material_slot > 8) return 0; - int invslot = Inventory::CalcSlotFromMaterial(material_slot); - if (invslot == -1) + int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + if (invslot == INVALID_INDEX) return 0; return equipment[invslot]; } @@ -2624,20 +2603,9 @@ void Mob::SendWearChange(uint8 material_slot) wc->spawn_id = GetID(); wc->material = GetEquipmentMaterial(material_slot); - const Item_Struct *item; - item = database.GetItem(GetEquipment(material_slot)); - if (item != 0) - { - wc->elite_material = item->EliteMaterial; - wc->hero_forge_model = item->HerosForgeModel; - wc->color.color = item->Color; - } - else - { - wc->elite_material = 0; - wc->hero_forge_model = 0; - wc->color.color = 0; - } + wc->elite_material = IsEliteMaterialItem(material_slot); + wc->hero_forge_model = GetHerosForgeModel(material_slot); + wc->color.color = GetEquipmentColor(material_slot); wc->wear_slot_id = material_slot; entity_list.QueueClients(this, outapp); @@ -2681,7 +2649,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 = GetHeroForgeModel(material_slot); + wc->hero_forge_model = GetHerosForgeModel(material_slot); wc->color.color = color; wc->wear_slot_id = material_slot; @@ -2708,48 +2676,99 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h int32 Mob::GetEquipmentMaterial(uint8 material_slot) const { + uint32 equipmaterial = 0; + int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); const Item_Struct *item; - int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); item = database.GetItem(GetEquipment(material_slot)); - if(item != 0) + + if (item != 0) { - if // for primary and secondary we need the model, not the material - ( - material_slot == MaterialPrimary || - material_slot == MaterialSecondary - ) + // For primary and secondary we need the model, not the material + if (material_slot == MaterialPrimary || material_slot == MaterialSecondary) { - if (this->IsClient()){ - int currMatslot = MaterialPrimary == material_slot ? MainPrimary : MainSecondary; - const ItemInst* inst = CastToClient()->m_inv[currMatslot]; - if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) { - item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - return atoi(&item->IDFile[2]); + if (this->IsClient()) + { + int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + if (invslot == INVALID_INDEX) + { + return 0; } - else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) { - return inst->GetOrnamentationIDFile(); - } - else { - if (strlen(item->IDFile) > 2) - return atoi(&item->IDFile[2]); - else //may as well try this, since were going to 0 anyways - return item->Material; + const ItemInst* inst = CastToClient()->m_inv[invslot]; + if (inst) + { + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + if (item && strlen(item->IDFile) > 2) + { + equipmaterial = atoi(&item->IDFile[2]); + } + } + else if (inst->GetOrnamentationIDFile()) + { + equipmaterial = inst->GetOrnamentationIDFile(); + } } } - else { - if (strlen(item->IDFile) > 2) - return atoi(&item->IDFile[2]); - else //may as well try this, since were going to 0 anyways - return item->Material; + + if (equipmaterial == 0 && strlen(item->IDFile) > 2) + { + equipmaterial = atoi(&item->IDFile[2]); } } else { - return item->Material; + equipmaterial = item->Material; } } - return 0; + return equipmaterial; +} + +int32 Mob::GetHerosForgeModel(uint8 material_slot) const +{ + + uint32 HeroModel = 0; + if (material_slot >= 0 && material_slot < MaterialPrimary) + { + uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); + const Item_Struct *item; + item = database.GetItem(GetEquipment(material_slot)); + int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + + if (item != 0 && invslot != INVALID_INDEX) + { + if (this->IsClient()) + { + const ItemInst* inst = CastToClient()->m_inv[invslot]; + if (inst) + { + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { + item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); + HeroModel = item->HerosForgeModel; + } + else if (inst->GetOrnamentHeroModel()) + { + HeroModel = inst->GetOrnamentHeroModel(); + } + } + } + + if (HeroModel == 0) + { + HeroModel = item->HerosForgeModel; + } + } + } + + if (HeroModel > 0) + { + HeroModel *= 100; + HeroModel += material_slot; + } + + return HeroModel; } uint32 Mob::GetEquipmentColor(uint8 material_slot) const @@ -2778,19 +2797,6 @@ uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const return 0; } -uint32 Mob::GetHeroForgeModel(uint8 material_slot) const -{ - const Item_Struct *item; - - item = database.GetItem(GetEquipment(material_slot)); - if (item != 0) - { - return item->HerosForgeModel; - } - - return 0; -} - // works just like a printf void Mob::Say(const char *format, ...) { diff --git a/zone/mob.h b/zone/mob.h index ada3c5df9..e0a969fc4 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -312,9 +312,9 @@ public: virtual uint16 GetSkill(SkillUseTypes skill_num) const { return 0; } virtual uint32 GetEquipment(uint8 material_slot) const { return(0); } virtual int32 GetEquipmentMaterial(uint8 material_slot) const; + virtual int32 GetHerosForgeModel(uint8 material_slot) const; virtual uint32 GetEquipmentColor(uint8 material_slot) const; virtual uint32 IsEliteMaterialItem(uint8 material_slot) const; - virtual uint32 GetHeroForgeModel(uint8 material_slot) const; bool AffectedBySpellExcludingSlot(int slot, int effect); virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) = 0; virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, diff --git a/zone/npc.cpp b/zone/npc.cpp index af8b9c544..6fdab645c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1322,11 +1322,14 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const if (material_slot >= _MaterialCount) return 0; - int inv_slot = Inventory::CalcSlotFromMaterial(material_slot); - if (inv_slot == -1) + int16 invslot = Inventory::CalcSlotFromMaterial(material_slot); + if (invslot == INVALID_INDEX) return 0; - if(equipment[inv_slot] == 0) { - switch(material_slot) { + + if (equipment[invslot] == 0) + { + switch(material_slot) + { case MaterialHead: return helmtexture; case MaterialChest: @@ -1342,7 +1345,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const } //they have some loot item in this slot, pass it up to the default handler - return(Mob::GetEquipmentMaterial(material_slot)); + return (Mob::GetEquipmentMaterial(material_slot)); } uint32 NPC::GetMaxDamage(uint8 tlevel) From 250ad310385a4d86fc9b2e475e4ef321fe513227 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 13 Dec 2014 14:01:12 -0600 Subject: [PATCH 0544/1883] Added required SQL. Without it, there will be item loss using the last commit! --- changelog.txt | 2 ++ utils/sql/git/required/2014_12_13_inventory_table_update.sql | 1 + 2 files changed, 3 insertions(+) create mode 100644 utils/sql/git/required/2014_12_13_inventory_table_update.sql diff --git a/changelog.txt b/changelog.txt index 3baa02623..ae004543f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,8 @@ demonstar55: Fix guild rank spam on zone (needed to be in OP_PP). Trevius: (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table. Trevius: (RoF+) Added command #heromodel (#hm for short) - Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63) +Be sure to run this or there will be item loss: +Required SQL: utils/sql/git/required/2014_12_13_inventory_table_update.sql == 12/12/2014 == demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest) diff --git a/utils/sql/git/required/2014_12_13_inventory_table_update.sql b/utils/sql/git/required/2014_12_13_inventory_table_update.sql new file mode 100644 index 000000000..97a07b6ee --- /dev/null +++ b/utils/sql/git/required/2014_12_13_inventory_table_update.sql @@ -0,0 +1 @@ +ALTER TABLE `inventory` ADD `ornament_hero_model` int( 11 ) NOT NULL DEFAULT '0' AFTER `ornamentidfile`; \ No newline at end of file From c85cbb2f087fd3d8757415a1de8c74890413e452 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 13 Dec 2014 14:09:44 -0600 Subject: [PATCH 0545/1883] Fixed bots build. --- zone/bot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index a79c45880..266c8565e 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4429,7 +4429,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { { if(strlen(item->IDFile) > 2) { - ns->spawn.equipment[MaterialPrimary] = atoi(&item->IDFile[2]); + ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]); } ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary); } @@ -4443,7 +4443,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) { { if(strlen(item->IDFile) > 2) { - ns->spawn.equipment[MaterialSecondary] = atoi(&item->IDFile[2]); + ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]); } ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary); } @@ -16040,7 +16040,7 @@ uint32 Bot::GetEquipmentColor(uint8 material_slot) const //Translate code slot # to DB slot # slotid = Inventory::CalcSlotFromMaterial(material_slot); - if(invslot == INVALID_INDEX) + if (slotid == INVALID_INDEX) return 0; //read from db From 026d5e71fae1f88baff3d941b8951b2da90ebdc9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 14 Dec 2014 19:38:23 -0500 Subject: [PATCH 0546/1883] Adjust common/random.h based on N3551 --- common/random.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/common/random.h b/common/random.h index ef2b3ef73..514c483e1 100644 --- a/common/random.h +++ b/common/random.h @@ -33,31 +33,31 @@ namespace EQEmu { class Random { public: // AKA old MakeRandomInt - const int Int(int low, int high) + int Int(int low, int high) { if (low > high) std::swap(low, high); - return std::uniform_int_distribution(low, high)(m_gen); // [low, high] + return int_dist(m_gen, int_param_t(low, high)); // [low, high] } // AKA old MakeRandomFloat - const double Real(double low, double high) + double Real(double low, double high) { if (low > high) std::swap(low, high); - return std::uniform_real_distribution(low, high)(m_gen); // [low, high) + return real_dist(m_gen, real_param_t(low, high)); // [low, high) } // example Roll(50) would have a 50% success rate // Roll(100) 100%, etc // valid values 0-100 (well, higher works too but ...) - const bool Roll(const int required) + bool Roll(const int required) { return Int(0, 99) < required; } // valid values 0.0 - 1.0 - const bool Roll(const double required) + bool Roll(const double required) { return Real(0.0, 1.0) <= required; } @@ -76,7 +76,11 @@ namespace EQEmu { } private: + typedef std::uniform_int_distribution::param_type int_param_t; + typedef std::uniform_real_distribution::param_type real_param_t; std::mt19937 m_gen; + std::uniform_int_distribution int_dist; + std::uniform_real_distribution real_dist; }; } From 62181ff08c3336feb225cccac43fbbb4ab2842ea Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 15 Dec 2014 02:53:58 -0500 Subject: [PATCH 0547/1883] Add Random::Shuffle This is just a wrapper to std::shuffle since it requires a random engine and ours lives in a class Must pass random access iterators (array, vector, deque, etc) ex: std::vector v; /* init ... */ random.Shuffle(v.begin(), v.end()); --- common/random.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/random.h b/common/random.h index 514c483e1..44be53e98 100644 --- a/common/random.h +++ b/common/random.h @@ -21,6 +21,9 @@ #include #include +#include +#include +#include /* This uses mt19937 seeded with the std::random_device * The idea is to have this be included as a member of another class @@ -62,6 +65,16 @@ namespace EQEmu { return Real(0.0, 1.0) <= required; } + // std::shuffle requires a RNG engine passed to it, so lets provide a wrapper to use our engine + template + void Shuffle(RandomAccessIterator first, RandomAccessIterator last) + { + static_assert(std::is_same::iterator_category>::value, + "EQEmu::Random::Shuffle requires random access iterators"); + std::shuffle(first, last, m_gen); + } + void Reseed() { // We could do the seed_seq thing here too if we need better seeding From 123da175e13b316055de01fe90ccb37c8638abb1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 04:49:45 -0600 Subject: [PATCH 0548/1883] aa.cpp/.h cleanup --- zone/aa.cpp | 1 - zone/aa.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 27229cb89..fc640ff92 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -19,7 +19,6 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) #include "../common/classes.h" #include "../common/debug.h" #include "../common/eq_packet_structs.h" -#include "../common/packet_dump.h" #include "../common/races.h" #include "../common/spdat.h" #include "../common/string_util.h" diff --git a/zone/aa.h b/zone/aa.h index e2e0749d1..ce6f9ea68 100644 --- a/zone/aa.h +++ b/zone/aa.h @@ -5,6 +5,7 @@ struct AA_Ability; struct SendAA_Struct; + #define MANA_BURN 664 #include From ee4935566b32d9162ed8fad28efbe01ae0634b50 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 04:56:01 -0600 Subject: [PATCH 0549/1883] beacon.h/cpp header cleanup --- zone/beacon.cpp | 14 ++++++++++++-- zone/beacon.h | 5 ++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/zone/beacon.cpp b/zone/beacon.cpp index 9b88dd524..f21a3b512 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -23,7 +23,7 @@ target to center around. */ -#include "../common/debug.h" +class Zone; #ifdef _WINDOWS #define snprintf _snprintf @@ -32,7 +32,17 @@ target to center around. #define strcasecmp _stricmp #endif -#include "masterentity.h" +#include "../common/races.h" +#include "beacon.h" +#include "entity.h" +#include "mob.h" + + +#ifdef BOTS +#include "bot.h" +#endif + + #include "../common/spdat.h" extern EntityList entity_list; diff --git a/zone/beacon.h b/zone/beacon.h index 0aad56e21..f7845e91d 100644 --- a/zone/beacon.h +++ b/zone/beacon.h @@ -19,11 +19,14 @@ #ifndef BEACON_H #define BEACON_H -#include "entity.h" #include "mob.h" #include "../common/types.h" #include "../common/timer.h" +class Group; +class Raid; +struct ExtraAttackOptions; + class Beacon : public Mob { public: From ed63c92839c80c7d23604ee8333a3eb4c6485541 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 04:58:53 -0600 Subject: [PATCH 0550/1883] bonuses.cpp header cleanup --- zone/bonuses.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index ac9602a67..aa89856a1 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -15,27 +15,29 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "../common/spdat.h" -#include "masterentity.h" -#include "../common/packet_dump.h" -#include "../common/moremath.h" -#include "../common/item.h" -#include "worldserver.h" -#include "../common/skills.h" -#include "../common/bodytypes.h" #include "../common/classes.h" +#include "../common/debug.h" +#include "../common/item.h" #include "../common/rulesys.h" +#include "../common/skills.h" +#include "../common/spdat.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" + +#ifdef BOTS +#include "bot.h" +#endif + #include "quest_parser_collection.h" -#include -#include -#include + + #ifndef WIN32 #include #include "../common/unix.h" #endif -#include "string_ids.h" void Mob::CalcBonuses() { From 0fd87d344c252ff046adddec55f3c2e8326cde6e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 05:13:45 -0600 Subject: [PATCH 0551/1883] client.h cleanup --- zone/client.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/zone/client.h b/zone/client.h index b5f414052..737d354cc 100644 --- a/zone/client.h +++ b/zone/client.h @@ -17,7 +17,17 @@ */ #ifndef CLIENT_H #define CLIENT_H + class Client; +class EQApplicationPacket; +class EQStream; +class Group; +class NPC; +class Object; +class Raid; +class Seperator; +class ServerPacket; +struct Item_Struct; #include "../common/timer.h" #include "../common/ptimer.h" @@ -28,25 +38,21 @@ class Client; #include "../common/eq_packet.h" #include "../common/linked_list.h" #include "../common/extprofile.h" -#include "../common/classes.h" #include "../common/races.h" -#include "../common/deity.h" #include "../common/seperator.h" #include "../common/item.h" #include "../common/guilds.h" #include "../common/item_struct.h" #include "../common/clientversions.h" -#include "common.h" -#include "zonedb.h" -#include "errno.h" -#include "mob.h" -#include "npc.h" -#include "merc.h" -#include "zone.h" #include "aa.h" -#include "questmgr.h" +#include "common.h" +#include "merc.h" +#include "mob.h" #include "qglobals.h" +#include "questmgr.h" +#include "zone.h" +#include "zonedb.h" #ifdef _WINDOWS // since windows defines these within windef.h (which windows.h include) @@ -57,7 +63,6 @@ class Client; #include #include -#include #include From 905961d2784b16aa203914c5bab7f588d4157bb9 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 15 Dec 2014 11:06:53 -0500 Subject: [PATCH 0552/1883] Linux fix for Mob type in AA_SwarmPetInfo. --- zone/aa.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/aa.h b/zone/aa.h index ce6f9ea68..ad41fc3ae 100644 --- a/zone/aa.h +++ b/zone/aa.h @@ -2156,6 +2156,7 @@ enum { //values of AA_Action.action }; class Timer; +class Mob; class AA_SwarmPetInfo { public: AA_SwarmPetInfo(); From d20c9c9ac6a71685ab4a1260e0bc99d2e1680a71 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 16:39:01 -0600 Subject: [PATCH 0553/1883] client_logs.cpp header cleanup --- zone/client_logs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_logs.h b/zone/client_logs.h index 9ce477f8c..e3d5350b5 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -18,11 +18,11 @@ #ifndef CLIENT_LOGS_H #define CLIENT_LOGS_H + #include "../common/debug.h" #include "../common/features.h" #ifdef CLIENT_LOGS -#include "../common/eq_packet_structs.h" #define CLIENT_LOG_CHANNEL MT_Chat10Echo From b90897c513b031412fb072ab06670391adbafc97 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 16:41:04 -0600 Subject: [PATCH 0554/1883] client_mods.cpp header cleanup --- zone/client_mods.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 55b522378..2db70e8a3 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -15,18 +15,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include "../common/debug.h" #include "../common/logsys.h" -#include "../common/spdat.h" #include "../common/rulesys.h" -#include "masterentity.h" -#include "npc_ai.h" -#include "petitions.h" -#include "string_ids.h" -#include "worldserver.h" -#include "zonedb.h" +#include "../common/spdat.h" + +#include "client.h" +#include "mob.h" + +#ifdef BOTS +#include "bot.h" +#endif + +#include int32 Client::GetMaxStat() const { From 5b6eb885a0f700ef8bcbe9d5ae2cc6a11ed6c3d1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 16:50:02 -0600 Subject: [PATCH 0555/1883] corpse.cpp & .h header cleanup & forward declarations --- zone/corpse.cpp | 29 ++++++++++++++++++----------- zone/corpse.h | 7 +++++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index d61fc02c9..b6504c88f 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -20,12 +20,7 @@ New class for handeling corpses and everything associated with them. Child of the Mob class. -Quagmire */ -#include "../common/debug.h" -#include -#include -#include -#include -#include + #ifdef _WINDOWS #define snprintf _snprintf #define vsnprintf _vsnprintf @@ -33,14 +28,26 @@ Child of the Mob class. #define strcasecmp _stricmp #endif -#include "masterentity.h" -#include "../common/packet_functions.h" +#include "../common/debug.h" +#include "../common/rulesys.h" #include "../common/string_util.h" -#include "../common/crc32.h" + +#include "client.h" +#include "corpse.h" +#include "entity.h" +#include "groups.h" +#include "mob.h" +#include "raids.h" + +#ifdef BOTS +#include "bot.h" +#endif + +#include "quest_parser_collection.h" #include "string_ids.h" #include "worldserver.h" -#include "../common/rulesys.h" -#include "quest_parser_collection.h" +#include + extern EntityList entity_list; extern Zone* zone; diff --git a/zone/corpse.h b/zone/corpse.h index 3a3d2bce9..7488a572e 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -22,7 +22,14 @@ #include "mob.h" class Client; +class EQApplicationPacket; +class Group; +class ItemInst; class NPC; +class Raid; + +struct ExtraAttackOptions; +struct NPCType; #define MAX_LOOTERS 72 From 1c7acbdbd9ca640a267800ef76004dd8753f847e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 16:53:53 -0600 Subject: [PATCH 0556/1883] doors.cpp & .h header cleanup & forward declaration --- zone/doors.cpp | 21 ++++++++++++--------- zone/doors.h | 12 ++++++++---- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 4af1d3eae..50f1e8eaa 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -15,18 +15,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include -#include -#include -#include "masterentity.h" -#include "worldserver.h" -#include "string_ids.h" -#include "zonedb.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" #include "../common/string_util.h" + +#include "client.h" +#include "doors.h" +#include "entity.h" #include "guild_mgr.h" +#include "mob.h" +#include "string_ids.h" +#include "worldserver.h" +#include "zonedb.h" + +#include +#include #define OPEN_DOOR 0x02 #define CLOSE_DOOR 0x03 diff --git a/zone/doors.h b/zone/doors.h index 59fe394c8..545834d88 100644 --- a/zone/doors.h +++ b/zone/doors.h @@ -1,14 +1,18 @@ #ifndef DOORS_H #define DOORS_H -#include "../common/types.h" -#include "../common/linked_list.h" -#include "../common/timer.h" + #include "../common/emu_opcodes.h" #include "../common/eq_packet_structs.h" -#include "entity.h" +#include "../common/linked_list.h" + #include "mob.h" #include "zonedump.h" +class Client; +class Mob; +class NPC; +struct Door; + class Doors : public Entity { public: From c5d23c5f1b758a8e202cbe2587e3f6b6f015d5d8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:02:26 -0600 Subject: [PATCH 0557/1883] effects.cpp header cleanup --- zone/effects.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 54e206e85..c236fb942 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -15,20 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include "masterentity.h" +#include "../common/spdat.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" + +#include "string_ids.h" #include "worldserver.h" #include "zonedb.h" -#include "../common/spdat.h" -#include "../common/packet_dump.h" -#include "../common/packet_functions.h" -#include "petitions.h" -#include "../common/serverinfo.h" -#include "../common/zone_numbers.h" -#include "../common/moremath.h" -#include "../common/guilds.h" -#include "string_ids.h" -#include "npc_ai.h" float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard) { From 4be92db77a9fa49b39534d736988cada2924945b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:04:31 -0600 Subject: [PATCH 0558/1883] embparser_api.cpp header org --- zone/embparser_api.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 62fa1dd70..e0866083b 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -23,12 +23,13 @@ #include "../common/debug.h" #include "../common/misc_functions.h" + #include "embparser.h" -#include "questmgr.h" #include "embxs.h" #include "entity.h" -#include "zone.h" #include "queryserv.h" +#include "questmgr.h" +#include "zone.h" extern Zone* zone; extern QueryServ* QServ; From 9cbaedc64f977c29692949f3db88bc25f2a7b333 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:19:49 -0600 Subject: [PATCH 0559/1883] entity.cpp & .h header cleanup & forward declare --- zone/entity.cpp | 2 +- zone/entity.h | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 1283f4be5..fa029dd0f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -31,7 +31,7 @@ #include "../common/features.h" #include "../common/guilds.h" -#include "../common/spdat.h" + #include "guild_mgr.h" #include "net.h" #include "petitions.h" diff --git a/zone/entity.h b/zone/entity.h index 486f1d49f..fd4f0b5a8 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -17,6 +17,7 @@ */ #ifndef ENTITY_H #define ENTITY_H + #include #include @@ -26,26 +27,30 @@ #include "../common/bodytypes.h" #include "../common/eq_constants.h" -#include "zonedb.h" #include "zonedump.h" -#include "qglobals.h" -class EQApplicationPacket; - -class Client; -class Mob; -class NPC; -class Merc; -class Corpse; class Beacon; -class Petition; -class Object; -class Group; -class Raid; +class Client; +class Corpse; class Doors; -class Trap; +class EQApplicationPacket; class Entity; class EntityList; +class Group; +class Merc; +class Mob; +class NPC; +class Object; +class Petition; +class Raid; +class Spawn2; +class Trap; + +struct GuildBankItemUpdate_Struct; +struct NewSpawn_Struct; +struct QGlobal; +struct UseAA_Struct; +struct Who_All_Struct; #ifdef BOTS class Bot; From 430f04775b0f4752e8631e7dcbea9d4a93068175 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:22:13 -0600 Subject: [PATCH 0560/1883] exp.cpp header cleanup --- zone/exp.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zone/exp.cpp b/zone/exp.cpp index 0e01a4c0e..c30ea1918 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -15,14 +15,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include "../common/features.h" -#include "masterentity.h" -#include "string_ids.h" -#include "../common/string_util.h" #include "../common/rulesys.h" -#include "quest_parser_collection.h" +#include "../common/string_util.h" + +#include "client.h" +#include "groups.h" +#include "mob.h" +#include "raids.h" + #include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" extern QueryServ* QServ; From 494e2505143dad404fa299a6e8bfb15416084ca3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:23:13 -0600 Subject: [PATCH 0561/1883] fearpath.cpp header cleanup --- zone/fearpath.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 25d514cfe..89b34c444 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -16,17 +16,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include -#include -#include -#include - #include "../common/rulesys.h" -#include "../common/misc_functions.h" + #include "map.h" -#include "zone.h" #include "pathing.h" +#include "zone.h" + #ifdef _WINDOWS #define snprintf _snprintf #endif From 756e5ee1393c332378bc00cc709f28a280be6180 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:26:51 -0600 Subject: [PATCH 0562/1883] groups.cpp & .h header cleanup and forward declare --- zone/groups.cpp | 1 + zone/groups.h | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 3180e51f1..3395833bf 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -22,6 +22,7 @@ #include "../common/packet_dump.h" #include "../common/string_util.h" #include "worldserver.h" + extern EntityList entity_list; extern WorldServer worldserver; diff --git a/zone/groups.h b/zone/groups.h index a0b17229b..909a9dd53 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -18,14 +18,14 @@ #ifndef GROUPS_H #define GROUPS_H -#include "../common/types.h" -#include "../common/linked_list.h" -#include "../common/emu_opcodes.h" #include "../common/eq_packet_structs.h" -#include "entity.h" +#include "../common/types.h" + #include "mob.h" -#include "../common/features.h" -#include "../common/servertalk.h" + +class Client; +class EQApplicationPacket; +class Mob; #define MAX_MARKED_NPCS 3 From 1fcb8235c529bf103220f8bc66999b6f227fefb6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:28:04 -0600 Subject: [PATCH 0563/1883] guild_mgr.cpp header cleanup --- zone/guild_mgr.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index bad060aef..5d42846e4 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -15,14 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "guild_mgr.h" -#include "zonedb.h" -#include "worldserver.h" + #include "../common/servertalk.h" #include "../common/string_util.h" + #include "client.h" #include "entity.h" +#include "guild_mgr.h" +#include "worldserver.h" +#include "zonedb.h" ZoneGuildManager guild_mgr; GuildBankManager *GuildBanks; From b733e96aea39531145b21e78dcb43dc644805241 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:34:19 -0600 Subject: [PATCH 0564/1883] masterentity.h header order cleanup hate_list.cpp & .h header cleanup and forward declare --- zone/hate_list.cpp | 17 ++++++++++------- zone/hate_list.h | 6 ++++++ zone/masterentity.h | 14 +++++++------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 2e64f092f..c8c1308aa 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -16,19 +16,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include -#include -#include -#include -#include "masterentity.h" +#include "client.h" +#include "entity.h" +#include "groups.h" +#include "mob.h" +#include "raids.h" + #include "../common/rulesys.h" -#include "../common/misc_functions.h" + #include "hate_list.h" #include "quest_parser_collection.h" #include "zone.h" #include "water_map.h" +#include +#include + extern Zone *zone; HateList::HateList() diff --git a/zone/hate_list.h b/zone/hate_list.h index 4ea8d0bd6..97f16f9d7 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -19,6 +19,12 @@ #ifndef HATELIST_H #define HATELIST_H +class Client; +class Group; +class Mob; +class Raid; +struct ExtraAttackOptions; + struct tHateEntry { Mob *ent; diff --git a/zone/masterentity.h b/zone/masterentity.h index 8c238ed34..72cf0b162 100644 --- a/zone/masterentity.h +++ b/zone/masterentity.h @@ -1,17 +1,17 @@ //Trumpcard: EntityLists are composed of multiple list types. This is the //master that includes all types. When entity.h is required, many of these are as well. -#include "entity.h" -#include "groups.h" -#include "raids.h" +#include "beacon.h" #include "client.h" -#include "object.h" #include "corpse.h" #include "doors.h" -#include "mob.h" -#include "trap.h" -#include "beacon.h" +#include "entity.h" +#include "groups.h" #include "horse.h" +#include "mob.h" +#include "object.h" +#include "raids.h" +#include "trap.h" #ifdef BOTS #include "bot.h" From abe471af64c2b015085578efd3374048dd6f216b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:39:16 -0600 Subject: [PATCH 0565/1883] horse.cpp & .h header cleanup and forward declare --- zone/horse.cpp | 10 +++++----- zone/horse.h | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/zone/horse.cpp b/zone/horse.cpp index df7c7e7c1..9a4e5240c 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -17,13 +17,13 @@ */ #include "../common/debug.h" -#include "masterentity.h" -#include "../common/item.h" #include "../common/linked_list.h" #include "../common/string_util.h" -#include -#include -#include "worldserver.h" + +#include "client.h" +#include "entity.h" +#include "horse.h" +#include "mob.h" std::map Horse::horse_types; LinkedList horses_auto_delete; diff --git a/zone/horse.h b/zone/horse.h index dd58007eb..0965a2b69 100644 --- a/zone/horse.h +++ b/zone/horse.h @@ -18,11 +18,15 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #ifndef HORSES_H #define HORSES_H -#include "../common/debug.h" #include "npc.h" #include +class Client; +class Mob; +struct NPCType; +struct NewSpawn_Struct; + class Horse : public NPC { public: Horse(Client *owner, uint16 spell_id, float x, float y, float z, float heading); From 95c95525babe7998a0a027b6522952c76619be98 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:41:14 -0600 Subject: [PATCH 0566/1883] loottables.cpp & .h header include cleanup and forward declare --- zone/loottables.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zone/loottables.cpp b/zone/loottables.cpp index c5fda890e..341a7b83c 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -15,15 +15,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include -#include -#include -#include "npc.h" -#include "masterentity.h" -#include "zonedb.h" #include "../common/loottable.h" #include "../common/misc_functions.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" +#include "npc.h" +#include "zonedb.h" + +#include +#include + #ifdef _WINDOWS #define snprintf _snprintf #endif From 85b7cc63301dbd92260a142eabc328ed3be09496 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:44:46 -0600 Subject: [PATCH 0567/1883] map.cpp & .h header cleanup --- zone/map.cpp | 8 ++++---- zone/map.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/zone/map.cpp b/zone/map.cpp index a023cc125..b6f4de2b5 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -1,15 +1,15 @@ #include "../common/debug.h" #include "../common/misc_functions.h" + #include "map.h" #include "raycast_mesh.h" #include "zone.h" -#include + #include -#include -#include +#include #include #include -#include +#include #include uint32 InflateData(const char* buffer, uint32 len, char* out_buffer, uint32 out_len_max) { diff --git a/zone/map.h b/zone/map.h index 224e30c73..dc03d8ac0 100644 --- a/zone/map.h +++ b/zone/map.h @@ -23,7 +23,6 @@ #define ZONE_MAP_H #include -#include #define BEST_Z_INVALID -99999 From 8584895427d055ae54f1e5c04ac0c3bd8e312e6f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:47:52 -0600 Subject: [PATCH 0568/1883] merc.h header cleanup and forward declare --- zone/merc.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zone/merc.h b/zone/merc.h index 167fe70d6..f604d485c 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -1,9 +1,18 @@ #ifndef MERC_H #define MERC_H -#include "mob.h" -#include "zonedb.h" + #include "npc.h" +class Client; +class Corpse; +class Group; +class Mob; +class Raid; +struct Item_Struct; +struct MercTemplate; +struct NPCType; +struct NewSpawn_Struct; + #define MERC_DEBUG 0 #define MAXMERCS 1 #define TANK 1 From 55b495826c3c25c147dff487b7b84b917ce613af Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:48:18 -0600 Subject: [PATCH 0569/1883] masterentity.h include order revert for linux --- zone/masterentity.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zone/masterentity.h b/zone/masterentity.h index 72cf0b162..8c238ed34 100644 --- a/zone/masterentity.h +++ b/zone/masterentity.h @@ -1,17 +1,17 @@ //Trumpcard: EntityLists are composed of multiple list types. This is the //master that includes all types. When entity.h is required, many of these are as well. -#include "beacon.h" -#include "client.h" -#include "corpse.h" -#include "doors.h" #include "entity.h" #include "groups.h" -#include "horse.h" -#include "mob.h" -#include "object.h" #include "raids.h" +#include "client.h" +#include "object.h" +#include "corpse.h" +#include "doors.h" +#include "mob.h" #include "trap.h" +#include "beacon.h" +#include "horse.h" #ifdef BOTS #include "bot.h" From 782b6fee9429e4e09f8302bf67ab4b3e42789fe3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:54:23 -0600 Subject: [PATCH 0570/1883] merc.cpp header include cleanup --- zone/merc.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index f86ed7faf..76167382f 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1,18 +1,21 @@ + #include "merc.h" -#include "masterentity.h" -#include "npc_ai.h" -#include "../common/packet_dump.h" +#include "client.h" +#include "corpse.h" +#include "entity.h" +#include "groups.h" +#include "mob.h" + #include "../common/eq_packet_structs.h" #include "../common/eq_constants.h" #include "../common/skills.h" #include "../common/spdat.h" + #include "zone.h" #include "string_ids.h" -#include "../common/misc_functions.h" + #include "../common/string_util.h" #include "../common/rulesys.h" -#include "quest_parser_collection.h" -#include "water_map.h" extern volatile bool ZoneLoaded; From 200027bf89ea3ef75a3abea1e03e77b7d80fa369 Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 15 Dec 2014 17:55:23 -0600 Subject: [PATCH 0571/1883] (RoF+) Implemented the 6th Augment Slot for Items. Player Corpses now saved attuned settings for Items. Renamed IsInstNoDrop() and SetInstNoDrop() to IsAttuned() and SetAttuned() respectively. --- changelog.txt | 6 + common/database.cpp | 33 ++++-- common/database.h | 2 + common/eq_dictionary.h | 4 +- common/eq_packet_structs.h | 8 +- common/item.cpp | 8 +- common/item.h | 8 +- common/item_fieldlist.h | 2 + common/item_struct.h | 6 +- common/patches/client62.cpp | 2 +- common/patches/rof.cpp | 12 +- common/patches/rof2.cpp | 13 +-- common/patches/rof2_itemfields.h | 3 + common/patches/rof_itemfields.h | 3 + common/patches/sod.cpp | 4 +- common/patches/sof.cpp | 4 +- common/patches/titanium.cpp | 2 +- common/patches/underfoot.cpp | 4 +- common/shareddb.cpp | 103 ++++++++++-------- common/shareddb.h | 4 +- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../optional/2014_12_15_heromodelCommand.sql | 2 + .../2014_12_15_multiple_table_updates.sql | 16 +++ zone/bot.cpp | 4 +- zone/client.h | 2 +- zone/client_packet.cpp | 8 +- zone/command.cpp | 40 ++++--- zone/corpse.cpp | 12 +- zone/corpse.h | 2 +- zone/embparser.cpp | 2 +- zone/inventory.cpp | 68 ++++++------ zone/loottables.cpp | 2 + zone/lua_client.cpp | 4 +- zone/lua_iteminst.cpp | 4 +- zone/perl_client.cpp | 2 +- zone/perl_questitem.cpp | 2 +- zone/tradeskills.cpp | 4 +- zone/trading.cpp | 4 +- zone/zonedb.cpp | 38 ++++--- zone/zonedump.h | 2 + 41 files changed, 263 insertions(+), 189 deletions(-) create mode 100644 utils/sql/git/optional/2014_12_15_heromodelCommand.sql create mode 100644 utils/sql/git/required/2014_12_15_multiple_table_updates.sql diff --git a/changelog.txt b/changelog.txt index ae004543f..1a0be1590 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/15/2014 == +Trevius: (RoF+) Implemented the 6th Augment Slot for Items. +Trevius: Player Corpses now saved attuned settings for Items. + +Required SQL: utils/sql/git/required/2014_12_15_multiple_table_updates.sql + == 12/13/2014 == demonstar55: Fix guild rank spam on zone (needed to be in OP_PP). Trevius: (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table. diff --git a/common/database.cpp b/common/database.cpp index 4cafc56d1..80ff355d7 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2099,6 +2099,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ "`aug_3` int(11) unsigned DEFAULT '0', " "`aug_4` int(11) unsigned DEFAULT '0', " "`aug_5` int(11) unsigned DEFAULT '0', " + "`aug_6` int(11) unsigned DEFAULT '0', " "`attuned` smallint(5) NOT NULL DEFAULT '0', " "PRIMARY KEY(`corpse_id`, `equip_slot`) " ") ENGINE = InnoDB DEFAULT CHARSET = latin1; " @@ -2276,8 +2277,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ for (unsigned int i = 0; i < dbpc->itemcount; i++) { if (first_entry != 1){ scquery = StringFormat("REPLACE INTO `character_corpse_items` \n" - " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" - " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", atoi(row2[0]), dbpc->items[i].equipSlot, dbpc->items[i].item_id, @@ -2286,12 +2287,14 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ dbpc->items[i].aug2, dbpc->items[i].aug3, dbpc->items[i].aug4, - dbpc->items[i].aug5 + dbpc->items[i].aug5, + dbpc->items[i].aug6, + dbpc->items[i].attuned ); first_entry = 1; } else{ - scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", atoi(row2[0]), dbpc->items[i].equipSlot, dbpc->items[i].item_id, @@ -2300,7 +2303,9 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ dbpc->items[i].aug2, dbpc->items[i].aug3, dbpc->items[i].aug4, - dbpc->items[i].aug5 + dbpc->items[i].aug5, + dbpc->items[i].aug6, + dbpc->items[i].attuned ); } } @@ -2310,7 +2315,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ /* Classic Converter */ scquery = StringFormat("UPDATE `character_corpses` SET \n" "`is_locked` = %d,\n" - "`exp` = %u,\n" + "`exp` = %u,\n" "`size` = %f,\n" "`level` = %u,\n" "`race` = %u,\n" @@ -2338,7 +2343,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ "`wc_6` = %u,\n" "`wc_7` = %u,\n" "`wc_8` = %u,\n" - "`wc_9` = %u \n" + "`wc_9` = %u \n" "WHERE `id` = %u \n", dbpc_c->locked, dbpc_c->exp, @@ -2381,8 +2386,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ for (unsigned int i = 0; i < dbpc_c->itemcount; i++) { if (first_entry != 1){ scquery = StringFormat("REPLACE INTO `character_corpse_items` \n" - " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" - " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", atoi(row2[0]), dbpc_c->items[i].equipSlot, dbpc_c->items[i].item_id, @@ -2391,12 +2396,14 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ dbpc_c->items[i].aug2, dbpc_c->items[i].aug3, dbpc_c->items[i].aug4, - dbpc_c->items[i].aug5 + dbpc_c->items[i].aug5, + dbpc_c->items[i].aug6, + dbpc_c->items[i].attuned ); first_entry = 1; } else{ - scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", atoi(row2[0]), dbpc_c->items[i].equipSlot, dbpc_c->items[i].item_id, @@ -2405,7 +2412,9 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ dbpc_c->items[i].aug2, dbpc_c->items[i].aug3, dbpc_c->items[i].aug4, - dbpc_c->items[i].aug5 + dbpc_c->items[i].aug5, + dbpc_c->items[i].aug6, + dbpc_c->items[i].attuned ); } } diff --git a/common/database.h b/common/database.h index 6325b4e3d..8f5d7430c 100644 --- a/common/database.h +++ b/common/database.h @@ -426,6 +426,8 @@ namespace Convert { uint32 aug3; uint32 aug4; uint32 aug5; + uint32 aug6; + uint8 attuned; }; } diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 8ef38c77c..a17ade924 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -138,8 +138,8 @@ public: // items // common and container sizes will not increase until the new 'location' struct is implemented - static const uint16 ITEM_COMMON_SIZE = Underfoot::consts::ITEM_COMMON_SIZE; - static const uint16 ITEM_CONTAINER_SIZE = Underfoot::consts::ITEM_CONTAINER_SIZE; + 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 diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 930b76843..ed62bb183 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2919,7 +2919,7 @@ uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts */ struct ItemViewRequest_Struct { /*000*/ uint32 item_id; -/*004*/ uint32 augments[5]; +/*004*/ uint32 augments[6]; /*024*/ uint32 link_hash; /*028*/ uint32 unknown028; /*032*/ char unknown032[12]; //probably includes loregroup & evolving info. see Client::MakeItemLink() in zone/inventory.cpp:469 @@ -5242,8 +5242,10 @@ struct ServerLootItem_Struct { uint32 aug_3; // uint32 aug_3; uint32 aug_4; // uint32 aug_4; uint32 aug_5; // uint32 aug_5; - uint8 min_level; // - uint8 max_level; // + uint32 aug_6; // uint32 aug_5; + uint8 attuned; + uint8 min_level; + uint8 max_level; }; //Found in client near a ref to the string: diff --git a/common/item.cpp b/common/item.cpp index 8af7f8b06..df4997470 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1400,7 +1400,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) { m_item = item; m_charges = charges; m_price = 0; - m_instnodrop = false; + m_attuned = false; m_merchantslot = 0; if(m_item &&m_item->ItemClass == ItemClassCommon) m_color = m_item->Color; @@ -1426,7 +1426,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { m_charges = charges; m_price = 0; m_merchantslot = 0; - m_instnodrop=false; + m_attuned=false; if(m_item && m_item->ItemClass == ItemClassCommon) m_color = m_item->Color; else @@ -1450,7 +1450,7 @@ ItemInst::ItemInst(ItemInstTypes use_type) { m_item = nullptr; m_charges = 0; m_price = 0; - m_instnodrop = false; + m_attuned = false; m_merchantslot = 0; m_color = 0; @@ -1475,7 +1475,7 @@ ItemInst::ItemInst(const ItemInst& copy) m_color=copy.m_color; m_merchantslot=copy.m_merchantslot; m_currentslot=copy.m_currentslot; - m_instnodrop=copy.m_instnodrop; + m_attuned=copy.m_attuned; m_merchantcount=copy.m_merchantcount; // Copy container contents iter_contents it; diff --git a/common/item.h b/common/item.h index 4827f042b..995f121d6 100644 --- a/common/item.h +++ b/common/item.h @@ -294,7 +294,7 @@ public: // // Augements // - inline bool IsAugmentable() const { return m_item->AugSlotType[0]!=0 || m_item->AugSlotType[1]!=0 || m_item->AugSlotType[2]!=0 || m_item->AugSlotType[3]!=0 || m_item->AugSlotType[4]!=0; } + inline bool IsAugmentable() const { return m_item->AugSlotType[0] != 0 || m_item->AugSlotType[1] != 0 || m_item->AugSlotType[2] != 0 || m_item->AugSlotType[3] != 0 || m_item->AugSlotType[4] != 0 || m_item->AugSlotType[5] != 0; } bool AvailableWearSlot(uint32 aug_wear_slots) const; int8 AvailableAugmentSlot(int32 augtype) const; bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; @@ -362,8 +362,8 @@ public: void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } // Is this item already attuned? - bool IsInstNoDrop() const { return m_instnodrop; } - void SetInstNoDrop(bool flag) { m_instnodrop=flag; } + bool IsAttuned() const { return m_attuned; } + void SetAttuned(bool flag) { m_attuned=flag; } std::string GetCustomDataString() const; std::string GetCustomData(std::string identifier); @@ -435,7 +435,7 @@ protected: uint32 m_color; uint32 m_merchantslot; int16 m_currentslot; - bool m_instnodrop; + bool m_attuned; int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar. uint32 m_exp; diff --git a/common/item_fieldlist.h b/common/item_fieldlist.h index 42ec12554..1b3fe0cb0 100644 --- a/common/item_fieldlist.h +++ b/common/item_fieldlist.h @@ -101,6 +101,8 @@ F(augslot4type) F(augslot4visible) F(augslot5type) F(augslot5visible) +F(augslot6type) +F(augslot6visible) F(ldontheme) F(ldonprice) F(ldonsold) diff --git a/common/item_struct.h b/common/item_struct.h index 66af3d0c6..3ef26db94 100644 --- a/common/item_struct.h +++ b/common/item_struct.h @@ -183,9 +183,9 @@ struct Item_Struct { int32 FactionAmt4; // Faction Amt 4 char CharmFile[32]; // ? uint32 AugType; - uint8 AugSlotType[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Type - uint8 AugSlotVisible[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Visible - uint8 AugSlotUnk2[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Unknown + uint8 AugSlotType[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type + uint8 AugSlotVisible[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible + uint8 AugSlotUnk2[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown uint32 LDoNTheme; uint32 LDoNPrice; uint32 LDoNSold; diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp index f3681721e..102414b16 100644 --- a/common/patches/client62.cpp +++ b/common/patches/client62.cpp @@ -1249,7 +1249,7 @@ namespace Client62 //merchant_slot, //instance ID, bullshit for now // The 'Merchant Slot' needs to be some unique id for bazaar to work properly (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, - inst->IsInstNoDrop() ? 1 : 0, //not sure where this field is + inst->IsAttuned() ? 1 : 0, //not sure where this field is (stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? charges : 0) : charges), 0 ); diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 202d4f090..1659dbd1c 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4406,7 +4406,7 @@ namespace RoF IN(item_id); int r; - for (r = 0; r < 5; r++) { + for (r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) { IN(augments[r]); } // Max Augs is now 6, but no code to support that many yet @@ -4855,7 +4855,7 @@ namespace RoF hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); - hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; @@ -5074,7 +5074,7 @@ namespace RoF isbs.augdistiller = 65535; isbs.augrestrict = item->AugRestrict; - for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x) + for (int x = AUG_BEGIN; x < consts::ITEM_COMMON_SIZE; x++) { isbs.augslots[x].type = item->AugSlotType[x]; isbs.augslots[x].visible = item->AugSlotVisible[x]; @@ -5082,9 +5082,9 @@ namespace RoF } // Increased to 6 max aug slots - isbs.augslots[5].type = 0; - isbs.augslots[5].visible = 1; - isbs.augslots[5].unknown = 0; + //isbs.augslots[5].type = 0; + //isbs.augslots[5].visible = 1; + //isbs.augslots[5].unknown = 0; isbs.ldonpoint_type = item->PointType; isbs.ldontheme = item->LDoNTheme; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 531aa8c4d..fbbceda2c 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4410,10 +4410,9 @@ namespace RoF2 IN(item_id); int r; - for (r = 0; r < 5; r++) { + for (r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) { IN(augments[r]); } - // Max Augs is now 6, but no code to support that many yet IN(link_hash); IN(icon); @@ -4859,7 +4858,7 @@ namespace RoF2 hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); - hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; hdr.unknown048 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; hdr.unknown052 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; @@ -5079,7 +5078,7 @@ namespace RoF2 isbs.augdistiller = 65535; isbs.augrestrict = item->AugRestrict; - for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x) + for (int x = AUG_BEGIN; x < consts::ITEM_COMMON_SIZE; x++) { isbs.augslots[x].type = item->AugSlotType[x]; isbs.augslots[x].visible = item->AugSlotVisible[x]; @@ -5087,9 +5086,9 @@ namespace RoF2 } // Increased to 6 max aug slots - isbs.augslots[5].type = 0; - isbs.augslots[5].visible = 1; - isbs.augslots[5].unknown = 0; + //isbs.augslots[5].type = 0; + //isbs.augslots[5].visible = 1; + //isbs.augslots[5].unknown = 0; isbs.ldonpoint_type = item->PointType; isbs.ldontheme = item->LDoNTheme; diff --git a/common/patches/rof2_itemfields.h b/common/patches/rof2_itemfields.h index ccba333b5..b7b2223d3 100644 --- a/common/patches/rof2_itemfields.h +++ b/common/patches/rof2_itemfields.h @@ -332,6 +332,9 @@ These fields must be in the order of how they are serialized! /* 091 */ I(AugSlotType[4]) /* 092 */ I(AugSlotVisible[4]) /* 092 */ I(AugSlotUnk2[4]) +/* 091 */ I(AugSlotType[5]) +/* 092 */ I(AugSlotVisible[5]) +/* 092 */ I(AugSlotUnk2[5]) /* 093 */ I(PointType) /* 093 */ I(LDoNTheme) /* 094 */ I(LDoNPrice) diff --git a/common/patches/rof_itemfields.h b/common/patches/rof_itemfields.h index ccba333b5..b7b2223d3 100644 --- a/common/patches/rof_itemfields.h +++ b/common/patches/rof_itemfields.h @@ -332,6 +332,9 @@ These fields must be in the order of how they are serialized! /* 091 */ I(AugSlotType[4]) /* 092 */ I(AugSlotVisible[4]) /* 092 */ I(AugSlotUnk2[4]) +/* 091 */ I(AugSlotType[5]) +/* 092 */ I(AugSlotVisible[5]) +/* 092 */ I(AugSlotUnk2[5]) /* 093 */ I(PointType) /* 093 */ I(LDoNTheme) /* 094 */ I(LDoNPrice) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index baca905a2..50d787472 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3223,7 +3223,7 @@ namespace SoD hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); - hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; @@ -3370,7 +3370,7 @@ namespace SoD isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int x = 0; x < 5; ++x) + for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++) { isbs.augslots[x].type = item->AugSlotType[x]; isbs.augslots[x].visible = item->AugSlotVisible[x]; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 8430a51bb..f7d35d403 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2547,7 +2547,7 @@ namespace SoF hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); - hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; @@ -2693,7 +2693,7 @@ namespace SoF isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int x = 0; x < 5; ++x) + for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++) { isbs.augslots[x].type = item->AugSlotType[x]; isbs.augslots[x].visible = item->AugSlotVisible[x]; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 0fc9d5e75..26ab0f531 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1678,7 +1678,7 @@ namespace Titanium (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, 0, // item recast timer timestamp field (aka..last_cast_time field in SoF+ clients) (stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges), - inst->IsInstNoDrop() ? 1 : 0, + inst->IsAttuned() ? 1 : 0, 0 ); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 16095faa9..3ddfeafd0 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3637,7 +3637,7 @@ namespace Underfoot hdr.unknown028 = 0; hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0); hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); - hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0; + hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; hdr.unknown048 = 0; hdr.unknown052 = 0; @@ -3817,7 +3817,7 @@ namespace Underfoot isbs.augtype = item->AugType; isbs.augrestrict = item->AugRestrict; - for (int x = 0; x < 5; ++x) + for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++) { isbs.augslots[x].type = item->AugSlotType[x]; isbs.augslots[x].visible = item->AugSlotVisible[x]; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 8f99ac03d..4ba16b441 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -183,7 +183,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { - uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; if (inst->IsType(ItemClassCommon)) for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { ItemInst *auginst=inst->GetItem(i); @@ -199,14 +199,14 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i // Update/Insert item std::string query = StringFormat("REPLACE INTO inventory " "(charid, slotid, itemid, charges, instnodrop, custom_data, color, " - "augslot1, augslot2, augslot3, augslot4, augslot5, ornamenticon, ornamentidfile, ornament_hero_model) " + "augslot1, augslot2, augslot3, augslot4, augslot5, augslot6, ornamenticon, ornamentidfile, ornament_hero_model) " "VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, " - "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)", + "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)", (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, - (unsigned long)charges, (unsigned long)(inst->IsInstNoDrop()? 1: 0), + (unsigned long)charges, (unsigned long)(inst->IsAttuned()? 1: 0), inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(), (unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2], - (unsigned long)augslot[3],(unsigned long)augslot[4], (unsigned long)inst->GetOrnamentationIcon(), + (unsigned long)augslot[3], (unsigned long)augslot[4], (unsigned long)augslot[5], (unsigned long)inst->GetOrnamentationIcon(), (unsigned long)inst->GetOrnamentationIDFile(), (unsigned long)inst->GetOrnamentHeroModel()); auto results = QueryDatabase(query); @@ -227,7 +227,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { - uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; if (inst->IsType(ItemClassCommon)) for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { ItemInst *auginst=inst->GetItem(i); @@ -244,12 +244,13 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, std::string query = StringFormat("REPLACE INTO sharedbank " "(acctid, slotid, itemid, charges, custom_data, " - "augslot1, augslot2, augslot3, augslot4, augslot5) " + "augslot1, augslot2, augslot3, augslot4, augslot5, augslot6) " "VALUES( %lu, %lu, %lu, %lu, '%s', " - "%lu, %lu, %lu, %lu, %lu)", + "%lu, %lu, %lu, %lu, %lu, %lu)", (unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, (unsigned long)charges, inst->GetCustomDataString().c_str(), (unsigned long)augslot[0], - (unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]); + (unsigned long)augslot[1], (unsigned long)augslot[2], (unsigned long)augslot[3], (unsigned long)augslot[4], + (unsigned long)augslot[5]); auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents @@ -395,13 +396,13 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (is_charid) query = StringFormat("SELECT sb.slotid, sb.itemid, sb.charges, " "sb.augslot1, sb.augslot2, sb.augslot3, " - "sb.augslot4, sb.augslot5, sb.custom_data " + "sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data " "FROM sharedbank sb INNER JOIN character_data ch " "ON ch.account_id=sb.acctid WHERE ch.id = %i", id); else query = StringFormat("SELECT slotid, itemid, charges, " "augslot1, augslot2, augslot3, " - "augslot4, augslot5, custom_data " + "augslot4, augslot5, augslot6, custom_data " "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -415,11 +416,12 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { int8 charges = (int8)atoi(row[2]); uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoi(row[3]); - aug[1] = (uint32)atoi(row[4]); - aug[2] = (uint32)atoi(row[5]); - aug[3] = (uint32)atoi(row[6]); - aug[4] = (uint32)atoi(row[7]); + aug[0] = (uint32)atoi(row[3]); + aug[1] = (uint32)atoi(row[4]); + aug[2] = (uint32)atoi(row[5]); + aug[3] = (uint32)atoi(row[6]); + aug[4] = (uint32)atoi(row[7]); + aug[5] = (uint32)atoi(row[8]); const Item_Struct* item = GetItem(item_id); @@ -441,10 +443,10 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { } } - if(!row[8]) + if(!row[9]) continue; - std::string data_str(row[8]); + std::string data_str(row[9]); std::string idAsString; std::string value; bool use_id = true; @@ -489,7 +491,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " + "augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -506,17 +508,18 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoul(row[4]); - aug[1] = (uint32)atoul(row[5]); - aug[2] = (uint32)atoul(row[6]); - aug[3] = (uint32)atoul(row[7]); - aug[4] = (uint32)atoul(row[8]); + aug[0] = (uint32)atoul(row[4]); + aug[1] = (uint32)atoul(row[5]); + aug[2] = (uint32)atoul(row[6]); + aug[3] = (uint32)atoul(row[7]); + aug[4] = (uint32)atoul(row[8]); + aug[5] = (uint32)atoul(row[9]); - bool instnodrop = (row[9] && (uint16)atoi(row[9]))? true: false; + bool instnodrop = (row[10] && (uint16)atoi(row[10]))? true: false; - uint32 ornament_icon = (uint32)atoul(row[11]); - uint32 ornament_idfile = (uint32)atoul(row[12]); - uint32 ornament_hero_model = (uint32)atoul(row[13]); + uint32 ornament_icon = (uint32)atoul(row[12]); + uint32 ornament_idfile = (uint32)atoul(row[13]); + uint32 ornament_hero_model = (uint32)atoul(row[14]); const Item_Struct* item = GetItem(item_id); @@ -529,8 +532,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { ItemInst* inst = CreateBaseItem(item, charges); - if(row[10]) { - std::string data_str(row[10]); + if(row[11]) { + std::string data_str(row[11]); std::string idAsString; std::string value; bool use_id = true; @@ -560,7 +563,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { inst->SetOrnamentHeroModel(ornament_hero_model); if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) - inst->SetInstNoDrop(true); + inst->SetAttuned(true); if (color > 0) inst->SetColor(color); @@ -600,7 +603,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) { // Retrieve character inventory std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, " - "augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " + "augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model " "FROM inventory INNER JOIN character_data ch " "ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid", name, account_id); @@ -619,16 +622,17 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) uint32 color = atoul(row[3]); uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoi(row[4]); - aug[1] = (uint32)atoi(row[5]); - aug[2] = (uint32)atoi(row[6]); - aug[3] = (uint32)atoi(row[7]); - aug[4] = (uint32)atoi(row[8]); + aug[0] = (uint32)atoi(row[4]); + aug[1] = (uint32)atoi(row[5]); + aug[2] = (uint32)atoi(row[6]); + aug[3] = (uint32)atoi(row[7]); + aug[4] = (uint32)atoi(row[8]); + aug[5] = (uint32)atoi(row[9]); - bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false; - uint32 ornament_icon = (uint32)atoul(row[11]); - uint32 ornament_idfile = (uint32)atoul(row[12]); - uint32 ornament_hero_model = (uint32)atoul(row[13]); + bool instnodrop = (row[10] && (uint16)atoi(row[10])) ? true : false; + uint32 ornament_icon = (uint32)atoul(row[12]); + uint32 ornament_idfile = (uint32)atoul(row[13]); + uint32 ornament_hero_model = (uint32)atoul(row[14]); const Item_Struct* item = GetItem(item_id); int16 put_slot_id = INVALID_INDEX; @@ -636,10 +640,10 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) continue; ItemInst* inst = CreateBaseItem(item, charges); - inst->SetInstNoDrop(instnodrop); + inst->SetAttuned(instnodrop); - if(row[10]) { - std::string data_str(row[10]); + if(row[11]) { + std::string data_str(row[11]); std::string idAsString; std::string value; bool use_id = true; @@ -895,6 +899,9 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]); item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]); item.AugSlotUnk2[4] = 0; + item.AugSlotType[5] = (uint8)atoi(row[ItemField::augslot6type]); + item.AugSlotVisible[5] = (uint8)atoi(row[ItemField::augslot6visible]); + item.AugSlotUnk2[5] = 0; item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]); item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]); @@ -1187,7 +1194,7 @@ bool SharedDatabase::LoadNPCFactionLists() { } // Create appropriate ItemInst class -ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) +ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { const Item_Struct* item = nullptr; ItemInst* inst = nullptr; @@ -1199,6 +1206,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst->PutAugment(this, 2, aug3); inst->PutAugment(this, 3, aug4); inst->PutAugment(this, 4, aug5); + inst->PutAugment(this, 5, aug6); + inst->SetAttuned(attuned); } return inst; @@ -1206,7 +1215,7 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, // Create appropriate ItemInst class -ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) +ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { ItemInst* inst = nullptr; if (item) { @@ -1216,6 +1225,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst->PutAugment(this, 2, aug3); inst->PutAugment(this, 3, aug4); inst->PutAugment(this, 4, aug5); + inst->PutAugment(this, 5, aug6); + inst->SetAttuned(attuned); } return inst; diff --git a/common/shareddb.h b/common/shareddb.h index 0b0dcf839..5f0707054 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -71,8 +71,8 @@ public: /* * Item Methods */ - ItemInst* CreateItem(uint32 item_id, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); - ItemInst* CreateItem(const Item_Struct* item, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); + ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + ItemInst* CreateItem(const Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges=0); /* diff --git a/common/version.h b/common/version.h index e223fe606..461c26e23 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9061 +#define CURRENT_BINARY_DATABASE_VERSION 9062 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 61806f625..19246c290 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -315,6 +315,7 @@ 9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| 9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| 9061|2014_12_11_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| +9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `inventory` LIKE 'augslot6type'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/optional/2014_12_15_heromodelCommand.sql b/utils/sql/git/optional/2014_12_15_heromodelCommand.sql new file mode 100644 index 000000000..4ded6664d --- /dev/null +++ b/utils/sql/git/optional/2014_12_15_heromodelCommand.sql @@ -0,0 +1,2 @@ +INSERT INTO `commands` (`command`, `access`) VALUES ('heromodel', 80); +INSERT INTO `commands` (`command`, `access`) VALUES ('hm', 80); \ No newline at end of file diff --git a/utils/sql/git/required/2014_12_15_multiple_table_updates.sql b/utils/sql/git/required/2014_12_15_multiple_table_updates.sql new file mode 100644 index 000000000..de652e570 --- /dev/null +++ b/utils/sql/git/required/2014_12_15_multiple_table_updates.sql @@ -0,0 +1,16 @@ +/* Add the new Aug Slot 6 Fields to the items table */ +ALTER TABLE `items` ADD `augslot6type` tinyint( 3 ) NOT NULL DEFAULT '0' AFTER `augslot5visible`; +ALTER TABLE `items` ADD `augslot6visible` tinyint( 3 ) NOT NULL DEFAULT '0' AFTER `augslot6type`; +ALTER TABLE `items` ADD `augslot6unk2` int( 11 ) NOT NULL DEFAULT '0' AFTER `augslot5unk2`; + +/* Add the new Aug Slot 6 Field to the inventory table */ +ALTER TABLE `inventory` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`; + +/* Add the new Aug Slot 6 Field to the sharedbank table */ +ALTER TABLE `sharedbank` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`; + +/* Add the new Aug Slot 6 Field to the object_contents table */ +ALTER TABLE `object_contents` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`; + +/* Add the new Aug Slot 6 Field to the sharedbank table */ +ALTER TABLE `character_corpse_items` ADD `aug_6` int( 11 ) NOT NULL DEFAULT '0' AFTER `aug_5`; \ No newline at end of file diff --git a/zone/bot.cpp b/zone/bot.cpp index 266c8565e..33d36d284 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4173,7 +4173,7 @@ void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, s "augslot1, augslot2, augslot3, augslot4, augslot5) " "VALUES(%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)", (unsigned long)this->GetBotID(), (unsigned long)slotID, (unsigned long)itemID, - (unsigned long)inst->GetCharges(), (unsigned long)(inst->IsInstNoDrop()? 1: 0), + (unsigned long)inst->GetCharges(), (unsigned long)(inst->IsAttuned()? 1: 0), (unsigned long)inst->GetColor(), (unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2], (unsigned long)augslot[3], (unsigned long)augslot[4]); auto results = database.QueryDatabase(query); @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { int16 put_slot_id = INVALID_INDEX; if (instnodrop || ((slot_id >= EmuConstants::EQUIPMENT_BEGIN) && (slot_id <= EmuConstants::EQUIPMENT_END) && inst->GetItem()->Attuneable)) - inst->SetInstNoDrop(true); + inst->SetAttuned(true); if (color > 0) inst->SetColor(color); diff --git a/zone/client.h b/zone/client.h index 737d354cc..be503fccc 100644 --- a/zone/client.h +++ b/zone/client.h @@ -810,7 +810,7 @@ public: void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index db209317b..f0528501a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2742,7 +2742,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app) SetAlternateCurrencyValue(reclaim->currency_id, 0); } else { - SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, false, MainCursor); + SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, MainCursor); AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count)); } /* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */ @@ -6968,7 +6968,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) const Item_Struct* CursorItem = CursorItemInst->GetItem(); - if (!CursorItem->NoDrop || CursorItemInst->IsInstNoDrop()) + if (!CursorItem->NoDrop || CursorItemInst->IsAttuned()) { Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); @@ -8213,7 +8213,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) } - ItemInst* inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4]); + ItemInst* inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4], ivrs->augments[5]); if (inst) { SendItemPacket(0, inst, ItemPacketViewLink); safe_delete(inst); @@ -8369,7 +8369,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app) } outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF outapp->WriteUInt32(0); //Unknown - for (spacer = 0; spacer < 5; spacer++) { //Augment stuff + for (spacer = 0; spacer < 6; spacer++) { //Augment stuff outapp->WriteUInt32(item->AugSlotType[spacer]); outapp->WriteUInt8(item->AugSlotVisible[spacer]); outapp->WriteUInt8(item->AugSlotUnk2[spacer]); diff --git a/zone/command.cpp b/zone/command.cpp index 3876d90de..d5d781e02 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5556,18 +5556,20 @@ void command_summonitem(Client *c, const Seperator *sep) if (item_status > c->Admin()) c->Message(13, "Error: Insufficient status to summon this item."); - else if (sep->argnum==2 && sep->IsNumber(2)) { - c->SummonItem(itemid, atoi(sep->arg[2]) ); - } else if (sep->argnum==3) { - c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]) ); - } else if (sep->argnum==4) - c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]) ); + else if (sep->argnum==2 && sep->IsNumber(2)) + c->SummonItem(itemid, atoi(sep->arg[2])); + else if (sep->argnum==3) + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3])); + else if (sep->argnum==4) + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); else if (sep->argnum==5) - c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]) ); + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5])); else if (sep->argnum==6) - c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]) ); + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6])); else if (sep->argnum==7) - c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]) ); + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7])); + else if (sep->argnum==8) + c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]), atoi(sep->arg[8])); else { c->SummonItem(itemid); } @@ -5593,18 +5595,20 @@ void command_giveitem(Client *c, const Seperator *sep) if (item_status > c->Admin()) c->Message(13, "Error: Insufficient status to summon this item."); - else if (sep->argnum==2 && sep->IsNumber(2)) { - t->SummonItem(itemid, atoi(sep->arg[2]) ); - } else if (sep->argnum==3) { - t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]) ); - } else if (sep->argnum==4) - t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]) ); + else if (sep->argnum==2 && sep->IsNumber(2)) + t->SummonItem(itemid, atoi(sep->arg[2])); + else if (sep->argnum==3) + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3])); + else if (sep->argnum==4) + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); else if (sep->argnum==5) - t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]) ); + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5])); else if (sep->argnum==6) - t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]) ); + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6])); else if (sep->argnum==7) - t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]) ); + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7])); + else if (sep->argnum == 7) + t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]), atoi(sep->arg[8])); else { t->SummonItem(itemid); } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index b6504c88f..1e3bdcafb 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -452,7 +452,7 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 ItemInst *interior_item; std::list returnlist; - AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4)); + AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4), item->GetAugmentItemID(5), item->IsAttuned()); returnlist.push_back(equipslot); // Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea. @@ -463,7 +463,7 @@ std::list Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16 interior_item = client->GetInv().GetItem(interior_slot); if (interior_item) { - AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4)); + AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4), interior_item->GetAugmentItemID(5), item->IsAttuned()); returnlist.push_back(Inventory::CalcSlotId(equipslot, bagindex)); client->DeleteItemInInventory(interior_slot, 0, true, false); } @@ -688,7 +688,7 @@ uint32 Corpse::CountItems() { return itemlist.size(); } -void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) { +void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) { if (!database.GetItem(itemnum)) return; @@ -705,6 +705,8 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui item->aug_3=aug3; item->aug_4=aug4; item->aug_5=aug5; + item->aug_6=aug6; + item->attuned=attuned; itemlist.push_back(item); } @@ -1048,7 +1050,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a if(i < corpselootlimit) { item = database.GetItem(item_data->item_id); if(client && item) { - ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); + ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); if(inst) { // MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot); @@ -1163,7 +1165,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { if (item != 0) { if (item_data){ - inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5); + inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned); } else { inst = database.CreateItem(item); diff --git a/zone/corpse.h b/zone/corpse.h index 7488a572e..9c898976c 100644 --- a/zone/corpse.h +++ b/zone/corpse.h @@ -86,7 +86,7 @@ class Corpse : public Mob { int32 GetPlayerKillItem() { return player_kill_item; } void RemoveItem(uint16 lootslot); void RemoveItem(ServerLootItem_Struct* item_data); - void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0); + void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); /* Corpse: Coin */ void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum); diff --git a/zone/embparser.cpp b/zone/embparser.cpp index c7a67c388..3a27fc42f 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -1146,7 +1146,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID temp_var_name = var_name; temp_var_name += "_attuned"; - ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->IsInstNoDrop()); + ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->IsAttuned()); } else { ExportVar(package_name.c_str(), var_name.c_str(), 0); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 08a7ceb29..343f6e337 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -189,7 +189,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) { return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != INVALID_INDEX); } -bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) { +bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) { this->EVENT_ITEM_ScriptStopReturn(); // TODO: update calling methods and script apis to handle a failure return @@ -199,8 +199,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -212,10 +212,10 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, return false; } // check to make sure we are augmenting an augmentable item - else if(((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5)) { + else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -228,14 +228,14 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", - GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, item->MinStatus); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; } */ - uint32 augments[EmuConstants::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5 }; + uint32 augments[EmuConstants::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5, aug6 }; uint32 classes = item->Classes; uint32 races = item->Races; @@ -251,8 +251,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -268,8 +268,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", - GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, item->MinStatus); + GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; } @@ -291,16 +291,16 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -476,8 +476,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -487,8 +487,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -496,8 +496,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -505,8 +505,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -532,8 +532,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - LogFile->write(EQEMuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5); + LogFile->write(EQEMuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; } @@ -546,7 +546,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // attune item if(attuned && inst->GetItem()->Attuneable) - inst->SetInstNoDrop(true); + inst->SetAttuned(true); inst->SetOrnamentIcon(ornament_icon); inst->SetOrnamentationIDFile(ornament_idfile); @@ -558,8 +558,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n", - GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5); + mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; } @@ -858,7 +858,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI { if(bag_item_data[i] == nullptr) continue; - const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5); + const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); @@ -1622,13 +1622,13 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Not dealing with charges - just do direct swap if(src_inst && (dst_slot_id <= EmuConstants::EQUIPMENT_END || dst_slot_id == MainPowerSource) && dst_slot_id >= EmuConstants::EQUIPMENT_BEGIN) { if (src_inst->GetItem()->Attuneable) { - src_inst->SetInstNoDrop(true); + src_inst->SetAttuned(true); } if (src_inst->IsAugmented()) { for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { if (src_inst->GetAugment(i)) { if (src_inst->GetAugment(i)->GetItem()->Attuneable) { - src_inst->GetAugment(i)->SetInstNoDrop(true); + src_inst->GetAugment(i)->SetAttuned(true); } } } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index c5fda890e..ec2960579 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -201,6 +201,8 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge item->aug_3 = 0; item->aug_4 = 0; item->aug_5 = 0; + item->aug_6 = 0; + item->attuned = 0; item->min_level = minlevel; item->max_level = maxlevel; if (equipit) { diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 22e38b21d..0f560d1bd 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -703,13 +703,13 @@ void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned) { Lua_Safe_Call_Void(); - self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned); + self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned); } void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, int to_slot) { Lua_Safe_Call_Void(); - self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned, to_slot); + self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot); } void Lua_Client::SetStats(int type, int value) { diff --git a/zone/lua_iteminst.cpp b/zone/lua_iteminst.cpp index c774c332e..4ebc6908f 100644 --- a/zone/lua_iteminst.cpp +++ b/zone/lua_iteminst.cpp @@ -166,12 +166,12 @@ uint32 Lua_ItemInst::GetColor() { bool Lua_ItemInst::IsInstNoDrop() { Lua_Safe_Call_Bool(); - return self->IsInstNoDrop(); + return self->IsAttuned(); } void Lua_ItemInst::SetInstNoDrop(bool flag) { Lua_Safe_Call_Void(); - return self->SetInstNoDrop(flag); + return self->SetAttuned(flag); } std::string Lua_ItemInst::GetCustomDataString() { diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 2a0c055af..e2dae6f35 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -3134,7 +3134,7 @@ XS(XS_Client_SummonItem) slot_id = (uint16)SvUV(ST(9)); } - THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attune, slot_id); + THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune, slot_id); } XSRETURN_EMPTY; } diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 7738b12fb..4c93d8839 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -160,7 +160,7 @@ XS(XS_QuestItem_IsAttuned) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->IsInstNoDrop(); + RETVAL = THIS->IsAttuned(); ST(0) = boolSV(RETVAL); sv_2mortal(ST(0)); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 58774f4b1..522de616a 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -287,7 +287,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const Item_Struct* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); - user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->IsInstNoDrop(), MainCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, container->GetItem()->Icon, atoi(container->GetItem()->IDFile + 2)); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); if (RuleB(Inventory, DeleteTransformationMold)) user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -307,7 +307,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob const Item_Struct* new_weapon = inst->GetItem(); user->DeleteItemInInventory(Inventory::CalcSlotId(in_combine->container_slot, 0), 0, true); container->Clear(); - user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->IsInstNoDrop(), MainCursor, 0, 0); + user->SummonItem(new_weapon->ID, inst->GetCharges(), inst->GetAugmentItemID(0), inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, 0, 0); user->Message_StringID(4, TRANSFORM_COMPLETE, inst->GetItem()->Name); } else if (inst) { diff --git a/zone/trading.cpp b/zone/trading.cpp index 738e763ed..240aa23b1 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -878,14 +878,14 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const Item_Struct* item = inst->GetItem(); if(item && quest_npc == false) { // if it was not a NO DROP or Attuned item (or if a GM is trading), let the NPC have it - if(GetGM() || (item->NoDrop != 0 && inst->IsInstNoDrop() == false)) { + if(GetGM() || (item->NoDrop != 0 && inst->IsAttuned() == false)) { // pets need to look inside bags and try to equip items found there if(item->ItemClass == ItemClassContainer && item->BagSlots > 0) { for(int16 bslot = SUB_BEGIN; bslot < item->BagSlots; bslot++) { const ItemInst* baginst = inst->GetItem(bslot); if (baginst) { const Item_Struct* bagitem = baginst->GetItem(); - if (bagitem && (GetGM() || (bagitem->NoDrop != 0 && baginst->IsInstNoDrop() == false))) { + if (bagitem && (GetGM() || (bagitem->NoDrop != 0 && baginst->IsAttuned() == false))) { tradingWith->CastToNPC()->AddLootDrop(bagitem, &tradingWith->CastToNPC()->itemlist, baginst->GetCharges(), 1, 127, true, true); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 17b5ff508..b56bd9a1b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -427,7 +427,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) return; } - std::string query = StringFormat("SELECT bagidx, itemid, charges, augslot1, augslot2, augslot3, augslot4, augslot5 " + std::string query = StringFormat("SELECT bagidx, itemid, charges, augslot1, augslot2, augslot3, augslot4, augslot5, augslot6 " "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { @@ -440,11 +440,12 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) uint32 item_id = (uint32)atoi(row[1]); int8 charges = (int8)atoi(row[2]); uint32 aug[EmuConstants::ITEM_COMMON_SIZE]; - aug[0] = (uint32)atoi(row[3]); - aug[1] = (uint32)atoi(row[4]); - aug[2] = (uint32)atoi(row[5]); - aug[3] = (uint32)atoi(row[6]); - aug[4] = (uint32)atoi(row[7]); + aug[0] = (uint32)atoi(row[3]); + aug[1] = (uint32)atoi(row[4]); + aug[2] = (uint32)atoi(row[5]); + aug[3] = (uint32)atoi(row[6]); + aug[4] = (uint32)atoi(row[7]); + aug[5] = (uint32)atoi(row[8]); ItemInst* inst = database.CreateItem(item_id, charges); if (inst && inst->GetItem()->ItemClass == ItemClassCommon) { @@ -478,7 +479,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It continue; uint32 item_id = inst->GetItem()->ID; - uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; + uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; if (inst->IsType(ItemClassCommon)) { for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { @@ -489,10 +490,10 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It std::string query = StringFormat("REPLACE INTO object_contents " "(zoneid, parentid, bagidx, itemid, charges, " - "augslot1, augslot2, augslot3, augslot4, augslot5, droptime) " - "VALUES (%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, now())", + "augslot1, augslot2, augslot3, augslot4, augslot5, augslot6, droptime) " + "VALUES (%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, now())", zone_id, parent_id, index, item_id, inst->GetCharges(), - augslot[0], augslot[1], augslot[2], augslot[3], augslot[4]); + augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); @@ -3568,8 +3569,8 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui for (unsigned int i = 0; i < dbpc->itemcount; i++) { if (first_entry != 1){ query = StringFormat("REPLACE INTO `character_corpse_items` \n" - " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n" - " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + " (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n" + " VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", last_insert_id, dbpc->items[i].equip_slot, dbpc->items[i].item_id, @@ -3578,12 +3579,14 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui dbpc->items[i].aug_2, dbpc->items[i].aug_3, dbpc->items[i].aug_4, - dbpc->items[i].aug_5 + dbpc->items[i].aug_5, + dbpc->items[i].aug_6, + dbpc->items[i].attuned ); first_entry = 1; } else{ - query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n", + query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n", last_insert_id, dbpc->items[i].equip_slot, dbpc->items[i].item_id, @@ -3592,7 +3595,9 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui dbpc->items[i].aug_2, dbpc->items[i].aug_3, dbpc->items[i].aug_4, - dbpc->items[i].aug_5 + dbpc->items[i].aug_5, + dbpc->items[i].aug_6, + dbpc->items[i].attuned ); } } @@ -3743,6 +3748,7 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct "aug_3, \n" "aug_4, \n" "aug_5, \n" + "aug_6, \n" "attuned \n" "FROM \n" "character_corpse_items \n" @@ -3765,6 +3771,8 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct pcs->items[i].aug_3 = atoi(row[r++]); // aug_3, pcs->items[i].aug_4 = atoi(row[r++]); // aug_4, pcs->items[i].aug_5 = atoi(row[r++]); // aug_5, + pcs->items[i].aug_6 = atoi(row[r++]); // aug_6, + pcs->items[i].attuned = atoi(row[r++]); // attuned, r = 0; i++; } diff --git a/zone/zonedump.h b/zone/zonedump.h index 6d7e67b04..deebf9b19 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -139,6 +139,8 @@ namespace player_lootitem { uint32 aug_3; uint32 aug_4; uint32 aug_5; + uint32 aug_6; + int8 attuned; uint8 min_level; // uint8 max_level; // }; From ec43a9248b94aed6c9354bc85b7144eb4b1b99ec Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 17:57:03 -0600 Subject: [PATCH 0572/1883] mob_ai.cpp header cleanup --- zone/mob_ai.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 81c5f510c..dbd6d4e2d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -15,25 +15,25 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include -#include -#include -#include -#include -#include "npc.h" -#include "masterentity.h" -#include "npc_ai.h" -#include "map.h" -#include "../common/moremath.h" -#include "string_ids.h" -#include "../common/misc_functions.h" -#include "../common/string_util.h" -#include "../common/rulesys.h" #include "../common/features.h" +#include "../common/rulesys.h" +#include "../common/string_util.h" + +#include "client.h" +#include "entity.h" +#include "map.h" +#include "mob.h" +#include "npc.h" #include "quest_parser_collection.h" +#include "string_ids.h" #include "water_map.h" +#include +#include +#include + extern EntityList entity_list; extern Zone *zone; From d44e982eaf9655c74e2a459c0c9bc8ae9e85a38b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:03:33 -0600 Subject: [PATCH 0573/1883] object.cpp & .h header cleanup --- zone/object.cpp | 18 ++++++++---------- zone/object.h | 15 +++++++-------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/zone/object.cpp b/zone/object.cpp index b1acc53c9..fa7598d39 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -17,19 +17,17 @@ */ #include "../common/debug.h" -#include -#include - -#include "masterentity.h" -#include "zonedb.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" -#include "../common/misc_functions.h" #include "../common/string_util.h" -#include "../common/features.h" -#include "string_ids.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" +#include "object.h" #include "quest_parser_collection.h" +#include "zonedb.h" + +#include const char DEFAULT_OBJECT_NAME[] = "IT63_ACTORDEF"; const char DEFAULT_OBJECT_NAME_SUFFIX[] = "_ACTORDEF"; diff --git a/zone/object.h b/zone/object.h index 9f5cb8cb3..9e8fae05d 100644 --- a/zone/object.h +++ b/zone/object.h @@ -21,16 +21,15 @@ // Object Class: // Represents Zone Objects (forges, ovens, brew barrels, items dropped to ground, etc) -#include "../common/types.h" -#include "../common/linked_list.h" -#include "../common/emu_opcodes.h" #include "../common/eq_packet_structs.h" -#include "../common/item.h" -#include "client.h" -#include "mob.h" -#include "npc.h" -#include "entity.h" #include "../common/timer.h" +#include "../common/types.h" + +#include "entity.h" + +class Client; +class EQApplicationPacket; +class ItemInst; /* item icon numbers (showeq) From c1baade00f9467d1e0b742d607b69a1c904cf81f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 15 Dec 2014 19:06:38 -0500 Subject: [PATCH 0574/1883] Fix build failure --- zone/pathing.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/pathing.h b/zone/pathing.h index 833a6ef96..9d3212fcf 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -8,6 +8,7 @@ #include class Client; +class Mob; #define PATHNODENEIGHBOURS 50 From 631d8cb0154f409d287b0ce5aa66dc50d29290c4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:10:45 -0600 Subject: [PATCH 0575/1883] pathing.cpp & .h header include cleanup --- zone/pathing.cpp | 20 ++++++++++---------- zone/pathing.h | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 3bf02115e..5501ad2ca 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -1,22 +1,22 @@ #include "../common/debug.h" -#include -#include -#include -#include -#include -#include + +#include "client.h" +#include "doors.h" #include "pathing.h" #include "water_map.h" -#include "../common/misc_functions.h" -#include "doors.h" -#include "client.h" #include "zone.h" +#include +#include +#include +#include +#include + #ifdef _WINDOWS #define snprintf _snprintf #endif -//#define PATHDEBUG +//#define PATHDEBUG #define ABS(x) ((x)<0?-(x):(x)) extern Zone *zone; diff --git a/zone/pathing.h b/zone/pathing.h index 9d3212fcf..c01cb6853 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -1,11 +1,9 @@ #ifndef PATHING_H #define PATHING_H -#include + #include "map.h" -#include "../common/timer.h" + #include -#include -#include class Client; class Mob; From 250d9d1fb5cbe5128228d8f9ccc04b3c505d7de1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:14:39 -0600 Subject: [PATCH 0576/1883] pets.cpp & .h include header cleanup --- zone/pets.cpp | 2 -- zone/pets.h | 45 ++++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/zone/pets.cpp b/zone/pets.cpp index 5c2bda36d..5c1f4e0cd 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -17,7 +17,6 @@ */ #include "../common/debug.h" -#include "../common/misc_functions.h" #include "../common/spdat.h" #include "../common/string_util.h" #include "../common/types.h" @@ -27,7 +26,6 @@ #include "mob.h" #include "pets.h" -#include "worldserver.h" #include "zonedb.h" #ifndef WIN32 diff --git a/zone/pets.h b/zone/pets.h index 14e5cb722..db78accea 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -1,28 +1,31 @@ #ifndef PETS_H #define PETS_H - #define PET_BACKOFF 1 - #define PET_GETLOST 2 - #define PET_HEALTHREPORT 4 - #define PET_GUARDHERE 5 - #define PET_GUARDME 6 - #define PET_ATTACK 7 - #define PET_FOLLOWME 8 - #define PET_SITDOWN 9 - #define PET_STANDUP 10 - #define PET_TAUNT 11 - #define PET_HOLD 12 - #define PET_NOTAUNT 14 - #define PET_LEADER 16 - #define PET_SLUMBER 17 - #define PET_NOCAST 18 - #define PET_FOCUS 19 - #define PET_FOCUS_ON 25 - #define PET_FOCUS_OFF 26 - #define PET_HOLD_ON 27 - #define PET_HOLD_OFF 28 +#define PET_BACKOFF 1 +#define PET_GETLOST 2 +#define PET_HEALTHREPORT 4 +#define PET_GUARDHERE 5 +#define PET_GUARDME 6 +#define PET_ATTACK 7 +#define PET_FOLLOWME 8 +#define PET_SITDOWN 9 +#define PET_STANDUP 10 +#define PET_TAUNT 11 +#define PET_HOLD 12 +#define PET_NOTAUNT 14 +#define PET_LEADER 16 +#define PET_SLUMBER 17 +#define PET_NOCAST 18 +#define PET_FOCUS 19 +#define PET_FOCUS_ON 25 +#define PET_FOCUS_OFF 26 +#define PET_HOLD_ON 27 +#define PET_HOLD_OFF 28 - class Pet : public NPC { +class Mob; +struct NPCType; + +class Pet : public NPC { public: Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power); From 24503bd0ee5f8720a2c3748ea1c57cfa257971fb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:14:56 -0600 Subject: [PATCH 0577/1883] petitions.cpp & .h header include cleanup --- zone/petitions.cpp | 1 + zone/petitions.h | 1 + 2 files changed, 2 insertions(+) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index ad38bc04d..76f902a9d 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -33,6 +33,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/eq_packet_structs.h" #include "../common/servertalk.h" #include "../common/string_util.h" + #include "entity.h" #include "petitions.h" #include "worldserver.h" diff --git a/zone/petitions.h b/zone/petitions.h index 604d4ddcc..057169d45 100644 --- a/zone/petitions.h +++ b/zone/petitions.h @@ -22,6 +22,7 @@ #include "../common/misc_functions.h" #include "../common/mutex.h" #include "../common/types.h" + #include "client.h" #include "zonedb.h" From 7dc69b7755342ab4c353c3c9d168472bea19d054 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:22:27 -0600 Subject: [PATCH 0578/1883] qglobals.cpp & .h include header cleanup --- zone/qglobals.cpp | 5 ++--- zone/qglobals.h | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/zone/qglobals.cpp b/zone/qglobals.cpp index bc7bf680e..0dced7cb0 100644 --- a/zone/qglobals.cpp +++ b/zone/qglobals.cpp @@ -1,9 +1,8 @@ -#include "../common/debug.h" #include "../common/string_util.h" + #include "qglobals.h" -#include "masterentity.h" +#include "client.h" #include "zone.h" -#include "zonedb.h" void QGlobalCache::AddGlobal(uint32 id, QGlobal global) { diff --git a/zone/qglobals.h b/zone/qglobals.h index 5f0938a20..a4dccd2d2 100644 --- a/zone/qglobals.h +++ b/zone/qglobals.h @@ -2,9 +2,6 @@ #define __QGLOBALS__H #include -#include -#include -#include "../common/timer.h" class NPC; class Client; From e7911df8512f42a69ff2e29e0c3abfd12af6403d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:33:23 -0600 Subject: [PATCH 0579/1883] quest_parser_collection.cpp & .h header include cleanup --- zone/quest_parser_collection.cpp | 3 +-- zone/quest_parser_collection.h | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index 10703c299..c0680b43f 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -19,14 +19,13 @@ #include "../common/debug.h" #include "../common/misc_functions.h" #include "../common/features.h" + #include "quest_parser_collection.h" #include "quest_interface.h" #include "zone.h" #include "questmgr.h" #include -#include -#include extern Zone* zone; extern void MapOpcodes(); diff --git a/zone/quest_parser_collection.h b/zone/quest_parser_collection.h index 006bcfe24..62cb034dc 100644 --- a/zone/quest_parser_collection.h +++ b/zone/quest_parser_collection.h @@ -20,19 +20,32 @@ #define _EQE_QUESTPARSERCOLLECTION_H #include "../common/types.h" -#include "../common/item.h" -#include "masterentity.h" +#include "beacon.h" +#include "client.h" +#include "corpse.h" +#include "doors.h" +#include "groups.h" +#include "mob.h" +#include "object.h" +#include "raids.h" +#include "trap.h" + #include "quest_interface.h" -#include -#include #include #include #define QuestFailedToLoad 0xFFFFFFFF #define QuestUnloaded 0x00 +class Client; +class ItemInst; +class Mob; +class NPC; +class QuestInterface; +namespace EQEmu { class Any; } + class QuestParserCollection { public: QuestParserCollection(); From 87fd99a3e7d7202b0c6d64864822ea9581892aff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:33:39 -0600 Subject: [PATCH 0580/1883] queryserv.cpp header cleanup --- zone/queryserv.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/queryserv.cpp b/zone/queryserv.cpp index ad7de0424..1186aa241 100644 --- a/zone/queryserv.cpp +++ b/zone/queryserv.cpp @@ -23,7 +23,6 @@ Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) #include "worldserver.h" #include "net.h" -#include extern WorldServer worldserver; extern QueryServ* QServ; From c43377100e3e0c962a5f056923066337ae20a3ee Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:35:27 -0600 Subject: [PATCH 0581/1883] questmgr.cpp & .h include cleanup --- zone/questmgr.cpp | 5 +++-- zone/questmgr.h | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 38f40142d..ab68f8361 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -22,18 +22,19 @@ #include "../common/skills.h" #include "../common/spdat.h" #include "../common/string_util.h" + #include "entity.h" #include "event_codes.h" #include "guild_mgr.h" -#include "net.h" #include "qglobals.h" #include "queryserv.h" -#include "questmgr.h" #include "quest_parser_collection.h" +#include "questmgr.h" #include "spawn2.h" #include "worldserver.h" #include "zone.h" #include "zonedb.h" + #include #include #include diff --git a/zone/questmgr.h b/zone/questmgr.h index dd471d74f..4749599ad 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -21,7 +21,6 @@ #include "../common/timer.h" #include "tasks.h" -#include #include #include From 34ce09afd14c87c3dc5cc0bf66388fda46b625f4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:38:54 -0600 Subject: [PATCH 0582/1883] raids.cpp & .h header include cleanup and forward declare --- zone/raids.cpp | 14 +++++++++----- zone/raids.h | 5 +---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index d1e8db464..31d2b63c9 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -15,13 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "masterentity.h" -#include "npc_ai.h" -#include "../common/packet_functions.h" -#include "../common/packet_dump.h" + #include "../common/string_util.h" + +#include "client.h" +#include "entity.h" +#include "groups.h" +#include "mob.h" +#include "raids.h" + #include "worldserver.h" + extern EntityList entity_list; extern WorldServer worldserver; diff --git a/zone/raids.h b/zone/raids.h index 7c3561cd2..ca5d0ff9b 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -19,14 +19,11 @@ #define RAIDS_H #include "../common/types.h" -#include "../common/linked_list.h" #include "groups.h" -#include -#include -#include class Client; class EQApplicationPacket; +class Mob; enum { //raid packet types: raidAdd = 0, From c25e17f3bc6dd87fef6a760262a7c5951f84f67d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:42:14 -0600 Subject: [PATCH 0583/1883] spawn2.cpp & .h header include cleanup --- zone/spawn2.cpp | 11 ++++++----- zone/spawn2.h | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index bf7192107..eae93c8c7 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -15,16 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include "../common/string_util.h" -#include -#include "spawn2.h" + +#include "client.h" #include "entity.h" -#include "masterentity.h" -#include "zone.h" +#include "spawn2.h" #include "spawngroup.h" -#include "zonedb.h" #include "worldserver.h" +#include "zone.h" +#include "zonedb.h" extern EntityList entity_list; extern Zone* zone; diff --git a/zone/spawn2.h b/zone/spawn2.h index e529bb65e..a626b7084 100644 --- a/zone/spawn2.h +++ b/zone/spawn2.h @@ -21,8 +21,6 @@ #include "../common/timer.h" #include "npc.h" -#include - #define SC_AlwaysEnabled 0 class SpawnCondition; From 24f9e8d1811c21dc712034e1df19456cd463be2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:44:36 -0600 Subject: [PATCH 0584/1883] spawngroup.cpp & .h header include cleanup --- zone/spawngroup.cpp | 14 ++++++-------- zone/spawngroup.h | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 6943d9349..487e66a6d 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -15,17 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include "spawngroup.h" -#include "entity.h" -#include -#include -#include -#include "../common/types.h" -#include "zonedb.h" -#include "../common/misc_functions.h" #include "../common/string_util.h" +#include "../common/types.h" + +#include "entity.h" +#include "spawngroup.h" #include "zone.h" +#include "zonedb.h" extern EntityList entity_list; extern Zone* zone; diff --git a/zone/spawngroup.h b/zone/spawngroup.h index bec6389be..b5f6d18cf 100644 --- a/zone/spawngroup.h +++ b/zone/spawngroup.h @@ -18,7 +18,6 @@ #ifndef SPAWNGROUP_H #define SPAWNGROUP_H -#include "../common/linked_list.h" #include "../common/types.h" #include From b945729d1a7aae3b1c8adea697831c0b024dab09 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:46:41 -0600 Subject: [PATCH 0585/1883] special_attacks.cpp header cleanup --- zone/special_attacks.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index d5b6aef6d..282eeb11e 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -16,15 +16,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -#include "../common/debug.h" -#include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" -#include "masterentity.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" #include "string_ids.h" -#include + #include From 020dfbf5384514fb1c40cee02ec03ff91a56f3a6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:47:22 -0600 Subject: [PATCH 0586/1883] spell_effects header include cleanup --- zone/spell_effects.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 9e7d87503..56611024b 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -23,9 +23,11 @@ #include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" + #include "quest_parser_collection.h" #include "string_ids.h" #include "worldserver.h" + #include #ifndef WIN32 From 1ec2ce7e2622c7b5dbbd8301240c1582c0f743e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:48:42 -0600 Subject: [PATCH 0587/1883] spells.cpp header include cleanup --- zone/spells.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index baae446c8..ad8db3e5b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -74,9 +74,11 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/skills.h" #include "../common/spdat.h" #include "../common/string_util.h" + #include "quest_parser_collection.h" #include "string_ids.h" #include "worldserver.h" + #include #include From 856eadc628cdebe370b696489a792568695c817b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:54:23 -0600 Subject: [PATCH 0588/1883] tasks.cpp & .h header include cleanup --- zone/tasks.cpp | 11 ++++++----- zone/tasks.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 924d3770b..f8f3ba9b2 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -21,20 +21,21 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) #include "tasks.h" #include -#include #ifdef _WINDOWS #define strcasecmp _stricmp #endif #include "../common/misc_functions.h" -#include "../common/string_util.h" #include "../common/rulesys.h" -#include "masterentity.h" -#include "../common/features.h" -#include "quest_parser_collection.h" +#include "../common/string_util.h" + +#include "client.h" +#include "entity.h" #include "mob.h" + #include "queryserv.h" +#include "quest_parser_collection.h" extern QueryServ* QServ; diff --git a/zone/tasks.h b/zone/tasks.h index d92d6d17f..6298fcb5c 100644 --- a/zone/tasks.h +++ b/zone/tasks.h @@ -21,9 +21,8 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) #define TASKS_H #include "../common/types.h" -#include "mob.h" + #include -#include #define MAXTASKS 10000 #define MAXTASKSETS 1000 @@ -44,6 +43,7 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) #define RELOADTASKSETS 3 class Client; +class Mob; struct TaskGoalList_Struct { int ListID; From e218ebb92f0f3003251ab4ac9af812e52c239316 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:56:23 -0600 Subject: [PATCH 0589/1883] titles.cpp & .h header cleanup and forward declare --- zone/titles.cpp | 10 +++++++--- zone/titles.h | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index eeae38b8a..a9e8454f1 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -15,11 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" + #include "../common/eq_packet_structs.h" -#include "masterentity.h" -#include "titles.h" #include "../common/string_util.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" + +#include "titles.h" #include "worldserver.h" extern WorldServer worldserver; diff --git a/zone/titles.h b/zone/titles.h index 51d29d4d6..a942a5688 100644 --- a/zone/titles.h +++ b/zone/titles.h @@ -18,9 +18,7 @@ #ifndef TITLES_H #define TITLES_H -#include "../common/types.h" #include -#include class Client; class EQApplicationPacket; From c5c33f6f49d1b11b04e185d0ab6a3818a4dea7c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:57:09 -0600 Subject: [PATCH 0590/1883] tradeskills.cpp header include cleanup --- zone/tradeskills.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 522de616a..f6112b560 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" + #include #include @@ -24,9 +25,9 @@ #include //for htonl #endif -#include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" + #include "queryserv.h" #include "quest_parser_collection.h" #include "string_ids.h" From a9226c00d8b07f8a16044577c2cfb7a3feac32d2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 18:59:21 -0600 Subject: [PATCH 0591/1883] trading.cpp header include cleanup --- zone/trading.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zone/trading.cpp b/zone/trading.cpp index 240aa23b1..b9b582bfe 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -15,14 +15,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" -#include "masterentity.h" -#include "string_ids.h" -#include "../common/string_util.h" #include "../common/rulesys.h" +#include "../common/string_util.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" + #include "quest_parser_collection.h" +#include "string_ids.h" #include "worldserver.h" -#include "queryserv.h" + +class QueryServ; extern WorldServer worldserver; extern QueryServ* QServ; From 537af79c8edf141be92b29483a9cd577a8cde2ab Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:01:54 -0600 Subject: [PATCH 0592/1883] trap.cpp & .h header include cleanup and forward declare --- zone/trap.cpp | 12 +++++++----- zone/trap.h | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/zone/trap.cpp b/zone/trap.cpp index 7d412d7cb..27b12c26d 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -15,13 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include "../common/types.h" -#include "entity.h" -#include "masterentity.h" + #include "../common/spdat.h" -#include "../common/misc_functions.h" #include "../common/string_util.h" +#include "../common/types.h" + +#include "client.h" +#include "entity.h" +#include "mob.h" +#include "trap.h" /* diff --git a/zone/trap.h b/zone/trap.h index ad2e2171a..59a1a3685 100644 --- a/zone/trap.h +++ b/zone/trap.h @@ -18,10 +18,11 @@ #ifndef _TRAP_H #define _TRAP_H -#include "../common/debug.h" - #include "entity.h" +class Mob; +class NPC; + //ID of the NPC type to spawn when a trap is set off, to do the damage #define TRAP_NPC_TYPE 1586 From 8ebfa36f00510bb5eff79a3d51ac47607ea73342 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:03:24 -0600 Subject: [PATCH 0593/1883] tribute.cpp header include cleanup --- zone/tribute.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 08bbf4662..bbe8c1ef9 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -15,13 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include "../common/eq_packet_structs.h" #include "../common/features.h" -#include "masterentity.h" -#include "../common/packet_dump.h" -#include "../common/misc_functions.h" -#include + +#include "client.h" + #include #ifdef _WINDOWS From 6fd2c2915a516574e9df589e322e9cfb0a1e19c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:05:52 -0600 Subject: [PATCH 0594/1883] water_map.cpp header include cleanup --- zone/water_map.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/water_map.cpp b/zone/water_map.cpp index 694035815..604875ed6 100644 --- a/zone/water_map.cpp +++ b/zone/water_map.cpp @@ -1,14 +1,14 @@ -#include "../common/debug.h" -#include -#include -#include -#include -#include + #include "water_map.h" #include "water_map_v1.h" #include "water_map_v2.h" +#include +#include +#include +#include + WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) { std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower); From 6a6e91abc5dc761ffd1ee0c10bd75cb27cca54da Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:07:31 -0600 Subject: [PATCH 0595/1883] waypoints.cpp header include cleanup --- zone/waypoints.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 410e76f3f..87a0d5e7e 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -21,13 +21,14 @@ #endif #include "../common/features.h" -#include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" + #include "map.h" #include "npc.h" #include "quest_parser_collection.h" #include "water_map.h" + #include #include From b5c60d8123c4ae3780db8a924a7d3b7afba6cfe0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 15 Dec 2014 20:08:46 -0500 Subject: [PATCH 0596/1883] Bot compile fix --- zone/attack.cpp | 4 ++++ zone/client_packet.cpp | 4 ++++ zone/entity.cpp | 4 ++++ zone/exp.cpp | 4 ++++ zone/mob.cpp | 4 ++++ zone/spells.cpp | 4 ++++ zone/zoning.cpp | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/zone/attack.cpp b/zone/attack.cpp index 68e088b02..4661a83e3 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -38,6 +38,10 @@ #include #include +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern WorldServer worldserver; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f0528501a..be7d559e5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -58,6 +58,10 @@ #include "worldserver.h" #include "zone.h" +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern Zone* zone; extern volatile bool ZoneLoaded; diff --git a/zone/entity.cpp b/zone/entity.cpp index fa029dd0f..369e1503a 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -46,6 +46,10 @@ #define strcasecmp _stricmp #endif +#ifdef BOTS +#include "bot.h" +#endif + extern Zone *zone; extern volatile bool ZoneLoaded; extern WorldServer worldserver; diff --git a/zone/exp.cpp b/zone/exp.cpp index c30ea1918..1aafb8a3f 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -30,6 +30,10 @@ #include "quest_parser_collection.h" #include "string_ids.h" +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; diff --git a/zone/mob.cpp b/zone/mob.cpp index 73e356efb..e497ed05e 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -27,6 +27,10 @@ #include #include +#ifdef BOTS +#include "bot.h" +#endif + extern EntityList entity_list; extern Zone* zone; diff --git a/zone/spells.cpp b/zone/spells.cpp index baae446c8..01f2f4209 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -89,6 +89,10 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/packet_dump_file.h" #endif +#ifdef BOTS +#include "bot.h" +#endif + extern Zone* zone; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 71ea65dc8..354ad2b33 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -25,6 +25,10 @@ #include "worldserver.h" #include "zone.h" +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern WorldServer worldserver; extern Zone* zone; From de243cd5d719846efaa984f425468cf9f2274eb6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:12:04 -0600 Subject: [PATCH 0597/1883] worldserver.cpp header include cleanup --- zone/worldserver.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d51cb0904..b0d958e7c 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -15,13 +15,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include #include #include #include -#include -#include #include #ifdef _WINDOWS @@ -32,25 +31,24 @@ #define strcasecmp _stricmp #endif -#include "../common/servertalk.h" -#include "worldserver.h" #include "../common/eq_packet_structs.h" -#include "../common/packet_dump.h" #include "../common/misc_functions.h" -#include "zonedb.h" -#include "zone.h" +#include "../common/rulesys.h" +#include "../common/servertalk.h" + +#include "client.h" +#include "corpse.h" #include "entity.h" -#include "masterentity.h" +#include "guild_mgr.h" +#include "mob.h" #include "net.h" #include "petitions.h" -#include "../common/packet_functions.h" -#include "../common/md5.h" -#include "zone_config.h" +#include "raids.h" #include "string_ids.h" -#include "guild_mgr.h" -#include "../common/rulesys.h" #include "titles.h" -#include "qglobals.h" +#include "worldserver.h" +#include "zone.h" +#include "zone_config.h" extern EntityList entity_list; From c646a6c43a50a10d2d2269fdcd69b08f13a0165b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:14:41 -0600 Subject: [PATCH 0598/1883] zone.cpp & .h include header cleanup --- zone/zone.cpp | 3 ++- zone/zone.h | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 257d8e5a7..49e7a7dee 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -35,6 +35,7 @@ #include "../common/rulesys.h" #include "../common/seperator.h" #include "../common/string_util.h" + #include "client_logs.h" #include "guild_mgr.h" #include "map.h" @@ -48,8 +49,8 @@ #include "spawngroup.h" #include "water_map.h" #include "worldserver.h" -#include "zone_config.h" #include "zone.h" +#include "zone_config.h" #ifdef _WINDOWS #define snprintf _snprintf diff --git a/zone/zone.h b/zone/zone.h index 40c3a8d11..bbf273069 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -67,10 +67,14 @@ struct item_tick_struct { std::string qglobal; }; +class Client; class Map; -class WaterMap; +class Mob; class PathManager; +class WaterMap; extern EntityList entity_list; +struct NPCType; +struct ServerZoneIncommingClient_Struct; class Zone { From def95b65842e6653871d9e22491098d59a0966cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:16:53 -0600 Subject: [PATCH 0599/1883] zone_config structure clean --- zone/zone_config.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zone/zone_config.cpp b/zone/zone_config.cpp index 3775f1e4b..21c396fd5 100644 --- a/zone/zone_config.cpp +++ b/zone/zone_config.cpp @@ -15,8 +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 */ -#include "../common/debug.h" + #include "zone_config.h" -ZoneConfig *ZoneConfig::_zone_config = nullptr; - +ZoneConfig *ZoneConfig::_zone_config = nullptr; \ No newline at end of file From 7f1ba17894eb729742f8dc0cb270c2e931a5b5c7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:17:07 -0600 Subject: [PATCH 0600/1883] zone_logsys structure clean --- zone/zone_logsys.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/zone_logsys.cpp b/zone/zone_logsys.cpp index 59b4755dc..c9ea6255d 100644 --- a/zone/zone_logsys.cpp +++ b/zone/zone_logsys.cpp @@ -19,9 +19,10 @@ #include "../common/debug.h" #include "../common/logsys.h" #include "../common/base_packet.h" + #include "mob.h" + #include -#include void log_message_mob(LogType type, Mob *who, const char *fmt, ...) { if(!who->IsLoggingEnabled()) From a3a1f0571808374771bc42b8be5a6930ffec3d23 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:17:31 -0600 Subject: [PATCH 0601/1883] zonedb and zoning header spacing --- zone/zonedb.cpp | 3 +++ zone/zoning.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index b56bd9a1b..deff17e91 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1,14 +1,17 @@ + #include "../common/extprofile.h" #include "../common/item.h" #include "../common/rulesys.h" #include "../common/string_util.h" + #include "client.h" #include "corpse.h" #include "groups.h" #include "merc.h" #include "zone.h" #include "zonedb.h" + #include #include diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 354ad2b33..55d4d3366 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -19,6 +19,7 @@ #include "../common/debug.h" #include "../common/rulesys.h" #include "../common/string_util.h" + #include "queryserv.h" #include "quest_parser_collection.h" #include "string_ids.h" From 53b9f8d0fd8b7880728444f9a374b70ae9c1d04e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:30:18 -0600 Subject: [PATCH 0602/1883] base_packet.cpp & .h header cleanup --- common/base_packet.cpp | 3 +-- common/base_packet.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/common/base_packet.cpp b/common/base_packet.cpp index 44b3643b5..e871ea71f 100644 --- a/common/base_packet.cpp +++ b/common/base_packet.cpp @@ -15,13 +15,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "debug.h" #include "base_packet.h" #include "misc.h" #include "packet_dump.h" - - BasePacket::BasePacket(const unsigned char *buf, uint32 len) { this->pBuffer=nullptr; diff --git a/common/base_packet.h b/common/base_packet.h index 4952e29d2..facd98809 100644 --- a/common/base_packet.h +++ b/common/base_packet.h @@ -21,7 +21,6 @@ #include "types.h" #include #include -#include #ifdef WIN32 #include From 00d145199b3089cea5eadf211b234f2a48da002c Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 15 Dec 2014 19:34:42 -0600 Subject: [PATCH 0603/1883] Corrected check in db_update_manifest.txt --- utils/sql/db_update_manifest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 19246c290..54c82c8d9 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -315,7 +315,7 @@ 9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| 9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| 9061|2014_12_11_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| -9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `inventory` LIKE 'augslot6type'|empty| +9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not From 3edda155c69f5ab3dfce6ee448807363310dddd5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:47:08 -0600 Subject: [PATCH 0604/1883] Linux build fix --- zone/waypoints.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 87a0d5e7e..e2604a3af 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -23,6 +23,7 @@ #include "../common/features.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "../common/misc_functions.h" #include "map.h" #include "npc.h" From 5af34a92454d3c1e11132f9574431d1fdbc017d9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:49:12 -0600 Subject: [PATCH 0605/1883] classes.cpp header include cleanup --- common/classes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/classes.cpp b/common/classes.cpp index f33d0354a..6270656f4 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -14,7 +14,7 @@ You 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 -*/ + */ #include "../common/debug.h" #include "../common/classes.h" From e5f300baaffe3d107955dc7429a8a110b37d2270 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 19:49:49 -0600 Subject: [PATCH 0606/1883] condition.cpp header include cleanup --- common/condition.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/condition.cpp b/common/condition.cpp index 2dc90b26d..334ce5d45 100644 --- a/common/condition.cpp +++ b/common/condition.cpp @@ -16,7 +16,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" #include "condition.h" #ifdef _WINDOWS From b1623cf696cacf36b7823eaf64c523146cea9f09 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:02:55 -0600 Subject: [PATCH 0607/1883] database.cpp & .h header include cleanup and forward declaration --- common/database.cpp | 6 +++--- common/database.h | 23 ++--------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 80ff355d7..3de2a308b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -15,13 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include "../common/rulesys.h" -#include + #include #include #include -#include #include #include #include @@ -42,8 +42,8 @@ #include "database.h" #include "eq_packet_structs.h" -#include "string_util.h" #include "extprofile.h" +#include "string_util.h" extern Client client; diff --git a/common/database.h b/common/database.h index 8f5d7430c..1cfb88e71 100644 --- a/common/database.h +++ b/common/database.h @@ -33,23 +33,9 @@ //atoi is not uint32 or uint32 safe!!!! #define atoul(str) strtoul(str, nullptr, 10) -//class Spawn; -class Corpse; -class Spawn2; -class NPC; -class SpawnGroupList; -class Petition; -class Client; -class Merc; -class MySQLRequestResult; -struct Combine_Struct; -//struct Faction; -//struct FactionMods; -//struct FactionValue; -struct ZonePoint; -struct NPCType; class Inventory; -class ItemInst; +class MySQLRequestResult; +class Client; struct EventLogDetails_Struct { uint32 id; @@ -81,11 +67,6 @@ struct VarCache_Struct { char value[0]; }; -struct PlayerProfile_Struct; -struct GuildRankLevel_Struct; -struct GuildRanks_Struct; -struct ExtendedProfile_Struct; -struct GuildMember_Struct; class PTimerList; #pragma pack(1) From 359bbb8df1461f6bea1847c5e49f42bf4976a51c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:04:49 -0600 Subject: [PATCH 0608/1883] dbcore.cpp * .h header include cleanup --- common/dbcore.cpp | 12 +++++------- common/dbcore.h | 11 ++++------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 84d2528f0..7570fd01e 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -1,18 +1,16 @@ -#include "../common/debug.h" - #ifdef _WINDOWS #include #endif +#include "../common/misc_functions.h" + +#include "dbcore.h" + +#include #include #include -#include #include -#include -#include "dbcore.h" #include -#include "../common/misc_functions.h" -#include #ifdef _WINDOWS #define snprintf _snprintf diff --git a/common/dbcore.h b/common/dbcore.h index 0cdceb61b..b23d58a9e 100644 --- a/common/dbcore.h +++ b/common/dbcore.h @@ -6,15 +6,12 @@ #include #endif +#include "../common/mutex.h" +#include "../common/mysql_request_result.h" +#include "../common/types.h" + #include #include -#include "../common/types.h" -#include "../common/mutex.h" -#include "../common/linked_list.h" -#include "../common/queue.h" -#include "../common/timer.h" -#include "../common/condition.h" -#include "../common/mysql_request_result.h" class DBcore { public: From 41f6349804a2f5304f7e8c827813f4809a4b7203 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:09:36 -0600 Subject: [PATCH 0609/1883] linux build fix --- common/database.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/database.h b/common/database.h index 1cfb88e71..5be342482 100644 --- a/common/database.h +++ b/common/database.h @@ -26,6 +26,8 @@ #include "dbcore.h" #include "linked_list.h" #include "eq_packet_structs.h" + +#include #include #include #include From 677c6b57502140a0c3aa76323f7839dfa6559660 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:21:54 -0600 Subject: [PATCH 0610/1883] emu_tcp_connection.cpp & .h include header cleanup and forward declare --- common/emu_tcp_connection.cpp | 3 --- common/emu_tcp_connection.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/common/emu_tcp_connection.cpp b/common/emu_tcp_connection.cpp index 41a39d3ab..805b4b333 100644 --- a/common/emu_tcp_connection.cpp +++ b/common/emu_tcp_connection.cpp @@ -27,13 +27,10 @@ tremendously. #include #include -#include -#include #include "emu_tcp_connection.h" #include "emu_tcp_server.h" #include "../common/servertalk.h" -#include "../common/packet_dump.h" #ifdef FREEBSD //Timothy Whitman - January 7, 2003 #define MSG_NOSIGNAL 0 diff --git a/common/emu_tcp_connection.h b/common/emu_tcp_connection.h index c7d88965d..7f4d0710b 100644 --- a/common/emu_tcp_connection.h +++ b/common/emu_tcp_connection.h @@ -26,6 +26,7 @@ struct SPackSendQueue; class EmuTCPServer; +class ServerPacket; class EmuTCPConnection : public TCPConnection { public: From 1a6a50c81006e1b8029ba992ad38a8beb412dff0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:24:38 -0600 Subject: [PATCH 0611/1883] eq_packet.cpp & .h header include cleanup --- common/eq_packet.cpp | 11 +++++++---- common/eq_packet.h | 5 ----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/common/eq_packet.cpp b/common/eq_packet.cpp index 3ea622040..60d892c23 100644 --- a/common/eq_packet.cpp +++ b/common/eq_packet.cpp @@ -15,18 +15,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "crc16.h" #include "debug.h" -#include -#include -#include #include "eq_packet.h" #include "misc.h" #include "op_codes.h" -#include "crc16.h" #include "platform.h" +#include +#include +#include + #ifndef STATIC_OPCODE #include "opcodemgr.h" #endif + #include "packet_dump.h" #include "packet_functions.h" #include diff --git a/common/eq_packet.h b/common/eq_packet.h index 04418f733..dcd3747a0 100644 --- a/common/eq_packet.h +++ b/common/eq_packet.h @@ -19,8 +19,6 @@ #define _EQPACKET_H #include "base_packet.h" -#include "eq_stream_type.h" -#include "op_codes.h" #include "platform.h" #ifdef STATIC_OPCODE @@ -30,9 +28,6 @@ #include "emu_opcodes.h" #endif -class EQStream; -class EQStreamPair; - class EQPacket : public BasePacket { friend class EQStream; public: From 5e31b8f96e818ccf8ec9b1bbaf9a41026bed26de Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:28:27 -0600 Subject: [PATCH 0612/1883] eq_stream.cpp & .h include header cleanup --- common/eq_stream.cpp | 3 --- common/eq_stream.h | 17 ++++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 7b69decc2..879d57664 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -19,15 +19,12 @@ #include "debug.h" #include "eq_packet.h" #include "eq_stream.h" -#include "misc.h" -#include "mutex.h" #include "op_codes.h" #include "crc16.h" #include "platform.h" #include #include -#include #include #include diff --git a/common/eq_stream.h b/common/eq_stream.h index 5a637c46e..ee797021f 100644 --- a/common/eq_stream.h +++ b/common/eq_stream.h @@ -1,22 +1,26 @@ #ifndef _EQSTREAM_H #define _EQSTREAM_H -#include #include #include #include #include + #ifndef WIN32 #include #endif -#include "eq_stream_type.h" + +#include "../common/misc.h" +#include "../common/opcodemgr.h" +#include "../common/timer.h" + #include "eq_packet.h" #include "eq_stream_intf.h" +#include "eq_stream_type.h" #include "mutex.h" -#include "../common/opcodemgr.h" -#include "../common/misc.h" -#include "../common/condition.h" -#include "../common/timer.h" + +class EQApplicationPacket; +class EQProtocolPacket; #define FLAG_COMPRESSED 0x01 #define FLAG_ENCODED 0x04 @@ -78,7 +82,6 @@ struct SessionStats { #pragma pack() class OpcodeManager; -class EQStreamPair; class EQRawApplicationPacket; class EQStream : public EQStreamInterface { From 968b0adc1d747b266350029c984375722c9fc87f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:30:53 -0600 Subject: [PATCH 0613/1883] eq_stream_factory.cpp & .h header include cleanup/forward declare --- common/eq_stream_factory.cpp | 6 +++--- common/eq_stream_factory.h | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 12828b28c..5f76a28ee 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -1,5 +1,6 @@ #include "debug.h" #include "eq_stream_factory.h" + #ifdef _WINDOWS #include #include @@ -13,11 +14,10 @@ #include #include #endif -#include + #include + #include "op_codes.h" -#include "eq_stream.h" -#include "logsys.h" ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) { diff --git a/common/eq_stream_factory.h b/common/eq_stream_factory.h index 7aa5d66ac..58fddaa40 100644 --- a/common/eq_stream_factory.h +++ b/common/eq_stream_factory.h @@ -4,11 +4,13 @@ #include #include + #include "../common/eq_stream.h" #include "../common/condition.h" #include "../common/timeoutmgr.h" -#include "../common/opcodemgr.h" -#include "../common/timer.h" + +class EQStream; +class Timer; class EQStreamFactory : private Timeoutable { private: From e048c5cf17f707971e08c52d0bbb1d5e99428941 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 20:32:03 -0600 Subject: [PATCH 0614/1883] eq_stream_ident.h header include cleanup --- common/eq_stream_ident.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/eq_stream_ident.h b/common/eq_stream_ident.h index c038daf26..2020c85cf 100644 --- a/common/eq_stream_ident.h +++ b/common/eq_stream_ident.h @@ -4,13 +4,13 @@ #include "eq_stream.h" #include "timer.h" #include -#include #include #define STREAM_IDENT_WAIT_MS 10000 class OpcodeManager; class StructStrategy; +class EQStreamInterface; class EQStreamIdentifier { public: From bbea7f4f53093342788c447e1263dbe53153a115 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:01:52 -0600 Subject: [PATCH 0615/1883] eqemu_config.cpp & .h header cleanup, code style cleanup of eqemu_config.h --- common/eqemu_config.cpp | 2 + common/eqemu_config.h | 328 ++++++++++++++++++++-------------------- 2 files changed, 162 insertions(+), 168 deletions(-) diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp index 165b0786f..abeac70c5 100644 --- a/common/eqemu_config.cpp +++ b/common/eqemu_config.cpp @@ -15,9 +15,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include "eqemu_config.h" #include "misc_functions.h" + #include #include diff --git a/common/eqemu_config.h b/common/eqemu_config.h index 9fa21bea6..908d66aa1 100644 --- a/common/eqemu_config.h +++ b/common/eqemu_config.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -28,200 +28,192 @@ struct LoginConfig { uint16 LoginPort; }; -class EQEmuConfig : public XMLParser { -public: - virtual std::string GetByName(const std::string &var_name) const; +class EQEmuConfig : public XMLParser +{ + public: + virtual std::string GetByName(const std::string &var_name) const; - // From - std::string ShortName; - std::string LongName; - std::string WorldAddress; - std::string LocalAddress; - std::string LoginHost; - std::string LoginAccount; - std::string LoginPassword; - uint16 LoginPort; - uint32 LoginCount; - LinkedList loginlist; - bool Locked; - uint16 WorldTCPPort; - std::string WorldIP; - bool TelnetEnabled; - int32 MaxClients; - bool WorldHTTPEnabled; - uint16 WorldHTTPPort; - std::string WorldHTTPMimeFile; - std::string SharedKey; + // From + std::string ShortName; + std::string LongName; + std::string WorldAddress; + std::string LocalAddress; + std::string LoginHost; + std::string LoginAccount; + std::string LoginPassword; + uint16 LoginPort; + uint32 LoginCount; + LinkedList loginlist; + bool Locked; + uint16 WorldTCPPort; + std::string WorldIP; + bool TelnetEnabled; + int32 MaxClients; + bool WorldHTTPEnabled; + uint16 WorldHTTPPort; + std::string WorldHTTPMimeFile; + std::string SharedKey; - // From - std::string ChatHost; - uint16 ChatPort; + // From + std::string ChatHost; + uint16 ChatPort; - // From - std::string MailHost; - uint16 MailPort; + // From + std::string MailHost; + uint16 MailPort; - // From - std::string DatabaseHost; - std::string DatabaseUsername; - std::string DatabasePassword; - std::string DatabaseDB; - uint16 DatabasePort; + // From + std::string DatabaseHost; + std::string DatabaseUsername; + std::string DatabasePassword; + std::string DatabaseDB; + uint16 DatabasePort; - // From // QueryServ - std::string QSDatabaseHost; - std::string QSDatabaseUsername; - std::string QSDatabasePassword; - std::string QSDatabaseDB; - uint16 QSDatabasePort; + // From // QueryServ + std::string QSDatabaseHost; + std::string QSDatabaseUsername; + std::string QSDatabasePassword; + std::string QSDatabaseDB; + uint16 QSDatabasePort; - // From - std::string SpellsFile; - std::string OpCodesFile; - std::string EQTimeFile; - std::string LogSettingsFile; + // From + std::string SpellsFile; + std::string OpCodesFile; + std::string EQTimeFile; + std::string LogSettingsFile; - // From - std::string MapDir; - std::string QuestDir; - std::string PluginDir; + // From + std::string MapDir; + std::string QuestDir; + std::string PluginDir; - // From - std::string LogPrefix; - std::string LogSuffix; - std::string ZoneExe; - uint32 RestartWait; - uint32 TerminateWait; - uint32 InitialBootWait; - uint32 ZoneBootInterval; + // From + std::string LogPrefix; + std::string LogSuffix; + std::string ZoneExe; + uint32 RestartWait; + uint32 TerminateWait; + uint32 InitialBootWait; + uint32 ZoneBootInterval; - // From - uint16 ZonePortLow; - uint16 ZonePortHigh; - uint8 DefaultStatus; + // From + uint16 ZonePortLow; + uint16 ZonePortHigh; + uint8 DefaultStatus; // uint16 DynamicCount; // map StaticZones; -protected: + protected: - static EQEmuConfig *_config; + static EQEmuConfig *_config; - static std::string ConfigFile; + static std::string ConfigFile; #define ELEMENT(name) \ void do_##name(TiXmlElement *ele); - #include "eqemu_config_elements.h" +#include "eqemu_config_elements.h" - EQEmuConfig() { - // import the needed handler prototypes + EQEmuConfig() + { + // import the needed handler prototypes #define ELEMENT(name) \ - Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name; - #include "eqemu_config_elements.h" + Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name; +#include "eqemu_config_elements.h" + // Set sane defaults + // Login server + LoginHost = "eqemulator.net"; + LoginPort = 5998; + // World + Locked = false; + WorldTCPPort = 9000; + TelnetEnabled = false; + WorldHTTPEnabled = false; + WorldHTTPPort = 9080; + WorldHTTPMimeFile = "mime.types"; + SharedKey = ""; //blank disables authentication + // Mail + ChatHost = "eqchat.eqemulator.net"; + ChatPort = 7778; + // Mail + MailHost = "eqmail.eqemulator.net"; + MailPort = 7779; + // Mysql + DatabaseHost = "localhost"; + DatabasePort = 3306; + DatabaseUsername = "eq"; + DatabasePassword = "eq"; + DatabaseDB = "eq"; + // QueryServ Database + QSDatabaseHost = "localhost"; + QSDatabasePort = 3306; + QSDatabaseUsername = "eq"; + QSDatabasePassword = "eq"; + QSDatabaseDB = "eq"; + // Files + SpellsFile = "spells_us.txt"; + OpCodesFile = "opcodes.conf"; + EQTimeFile = "eqtime.cfg"; + LogSettingsFile = "log.ini"; + // Dirs + MapDir = "Maps"; + QuestDir = "quests"; + PluginDir = "plugins"; + // Launcher + LogPrefix = "logs/zone-"; + LogSuffix = ".log"; + RestartWait = 10000; //milliseconds + TerminateWait = 10000; //milliseconds + InitialBootWait = 20000; //milliseconds + ZoneBootInterval = 2000; //milliseconds + #ifdef WIN32 + ZoneExe = "zone.exe"; + #else + ZoneExe = "./zone"; + #endif + // Zones + ZonePortLow = 7000; + ZonePortHigh = 7999; + DefaultStatus = 0; + // For where zones need to connect to. + WorldIP = "127.0.0.1"; + // Dynamics to start + //DynamicCount=5; + MaxClients = -1; + LoginCount = 0; + } + virtual ~EQEmuConfig() {} - // Set sane defaults + public: - // Login server - LoginHost="eqemulator.net"; - LoginPort=5998; + // Produce a const singleton + static const EQEmuConfig *get() + { + if (_config == nullptr) { + LoadConfig(); + } + return (_config); + } - // World - Locked=false; - WorldTCPPort=9000; - TelnetEnabled=false; - WorldHTTPEnabled=false; - WorldHTTPPort=9080; - WorldHTTPMimeFile="mime.types"; - SharedKey = ""; //blank disables authentication + // Allow the use to set the conf file to be used. + static void SetConfigFile(std::string file) + { + EQEmuConfig::ConfigFile = file; + } - // Mail - ChatHost="eqchat.eqemulator.net"; - ChatPort=7778; + // Load the config + static bool LoadConfig() + { + if (_config != nullptr) { + delete _config; + } + _config = new EQEmuConfig; + return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server"); + } - // Mail - MailHost="eqmail.eqemulator.net"; - MailPort=7779; - - // Mysql - DatabaseHost="localhost"; - DatabasePort=3306; - DatabaseUsername="eq"; - DatabasePassword="eq"; - DatabaseDB="eq"; - - // QueryServ Database - QSDatabaseHost="localhost"; - QSDatabasePort=3306; - QSDatabaseUsername="eq"; - QSDatabasePassword="eq"; - QSDatabaseDB="eq"; - - // Files - SpellsFile="spells_us.txt"; - OpCodesFile="opcodes.conf"; - EQTimeFile="eqtime.cfg"; - LogSettingsFile="log.ini"; - - // Dirs - MapDir="Maps"; - QuestDir="quests"; - PluginDir="plugins"; - - // Launcher - LogPrefix = "logs/zone-"; - LogSuffix = ".log"; - RestartWait = 10000; //milliseconds - TerminateWait = 10000; //milliseconds - InitialBootWait = 20000; //milliseconds - ZoneBootInterval = 2000; //milliseconds -#ifdef WIN32 - ZoneExe = "zone.exe"; -#else - ZoneExe = "./zone"; -#endif - - // Zones - ZonePortLow=7000; - ZonePortHigh=7999; - DefaultStatus=0; - - // For where zones need to connect to. - WorldIP="127.0.0.1"; - - // Dynamics to start - //DynamicCount=5; - - MaxClients=-1; - - LoginCount=0; - - } - virtual ~EQEmuConfig() {} - -public: - - // Produce a const singleton - static const EQEmuConfig *get() { - if (_config == nullptr) - LoadConfig(); - return(_config); - } - - // Allow the use to set the conf file to be used. - static void SetConfigFile(std::string file) { EQEmuConfig::ConfigFile = file; } - - // Load the config - static bool LoadConfig() { - if (_config != nullptr) - delete _config; - _config=new EQEmuConfig; - - return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(),"server"); - } - - void Dump() const; + void Dump() const; }; #endif From 6f747c3678d66f44472c304c7c6ac62ebfed262a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:03:09 -0600 Subject: [PATCH 0616/1883] eqemu_config.cpp code structure cleanup --- common/eqemu_config.cpp | 631 +++++++++++++++++++++------------------- 1 file changed, 338 insertions(+), 293 deletions(-) diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp index abeac70c5..2fe10ee9d 100644 --- a/common/eqemu_config.cpp +++ b/common/eqemu_config.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net) This program is free software; you can redistribute it and/or modify @@ -26,53 +26,54 @@ std::string EQEmuConfig::ConfigFile = "eqemu_config.xml"; EQEmuConfig *EQEmuConfig::_config = nullptr; -void EQEmuConfig::do_world(TiXmlElement *ele) { +void EQEmuConfig::do_world(TiXmlElement *ele) +{ const char *text; TiXmlElement * sub_ele;; - - text= ParseTextBlock(ele,"shortname"); - if (text) - ShortName=text; - - text = ParseTextBlock(ele,"longname"); - if (text) - LongName=text; - - text = ParseTextBlock(ele,"address",true); - if (text) - WorldAddress=text; - - text = ParseTextBlock(ele,"localaddress",true); - if (text) - LocalAddress=text; - - text = ParseTextBlock(ele,"maxclients",true); - if (text) - MaxClients=atoi(text); - + text = ParseTextBlock(ele, "shortname"); + if (text) { + ShortName = text; + } + text = ParseTextBlock(ele, "longname"); + if (text) { + LongName = text; + } + text = ParseTextBlock(ele, "address", true); + if (text) { + WorldAddress = text; + } + text = ParseTextBlock(ele, "localaddress", true); + if (text) { + LocalAddress = text; + } + text = ParseTextBlock(ele, "maxclients", true); + if (text) { + MaxClients = atoi(text); + } // Get the element - text = ParseTextBlock(ele,"key",true); - if (text) - SharedKey=text; - + text = ParseTextBlock(ele, "key", true); + if (text) { + SharedKey = text; + } // Get the element sub_ele = ele->FirstChildElement("loginserver"); if (sub_ele) { - text=ParseTextBlock(sub_ele,"host",true); - if (text) - LoginHost=text; - - text=ParseTextBlock(sub_ele,"port",true); - if (text) - LoginPort=atoi(text); - - text=ParseTextBlock(sub_ele,"account",true); - if (text) - LoginAccount=text; - - text=ParseTextBlock(sub_ele,"password",true); - if (text) - LoginPassword=text; + text = ParseTextBlock(sub_ele, "host", true); + if (text) { + LoginHost = text; + } + text = ParseTextBlock(sub_ele, "port", true); + if (text) { + LoginPort = atoi(text); + } + text = ParseTextBlock(sub_ele, "account", true); + if (text) { + LoginAccount = text; + } + text = ParseTextBlock(sub_ele, "password", true); + if (text) { + LoginPassword = text; + } } else { char str[32]; do { @@ -80,329 +81,373 @@ void EQEmuConfig::do_world(TiXmlElement *ele) { sub_ele = ele->FirstChildElement(str); if (sub_ele) { LoginConfig* loginconfig = new LoginConfig; - text=ParseTextBlock(sub_ele,"host",true); - if (text) - loginconfig->LoginHost=text; - - text=ParseTextBlock(sub_ele,"port",true); - if (text) - loginconfig->LoginPort=atoi(text); - - text=ParseTextBlock(sub_ele,"account",true); - if (text) - loginconfig->LoginAccount=text; - - text=ParseTextBlock(sub_ele,"password",true); - if (text) - loginconfig->LoginPassword=text; + text = ParseTextBlock(sub_ele, "host", true); + if (text) { + loginconfig->LoginHost = text; + } + text = ParseTextBlock(sub_ele, "port", true); + if (text) { + loginconfig->LoginPort = atoi(text); + } + text = ParseTextBlock(sub_ele, "account", true); + if (text) { + loginconfig->LoginAccount = text; + } + text = ParseTextBlock(sub_ele, "password", true); + if (text) { + loginconfig->LoginPassword = text; + } loginlist.Insert(loginconfig); } - } while(sub_ele); + } while (sub_ele); } - // Check for locked sub_ele = ele->FirstChildElement("locked"); - if (sub_ele != nullptr) - Locked=true; - + if (sub_ele != nullptr) { + Locked = true; + } // Get the element sub_ele = ele->FirstChildElement("tcp"); - if(sub_ele != nullptr) { - + if (sub_ele != nullptr) { text = sub_ele->Attribute("ip"); - if (text) - WorldIP=text; - + if (text) { + WorldIP = text; + } text = sub_ele->Attribute("port"); - if (text) - WorldTCPPort=atoi(text); - + if (text) { + WorldTCPPort = atoi(text); + } text = sub_ele->Attribute("telnet"); - if (text && !strcasecmp(text,"enabled")) - TelnetEnabled=true; - + if (text && !strcasecmp(text, "enabled")) { + TelnetEnabled = true; + } } - // Get the element sub_ele = ele->FirstChildElement("http"); - if(sub_ele != nullptr) { - + if (sub_ele != nullptr) { // text = sub_ele->Attribute("ip"); // if (text) // WorldIP=text; - text = sub_ele->Attribute("mimefile"); - if (text) - WorldHTTPMimeFile=text; - + if (text) { + WorldHTTPMimeFile = text; + } text = sub_ele->Attribute("port"); - if (text) - WorldHTTPPort=atoi(text); - + if (text) { + WorldHTTPPort = atoi(text); + } text = sub_ele->Attribute("enabled"); - if (text && !strcasecmp(text,"true")) - WorldHTTPEnabled=true; - + if (text && !strcasecmp(text, "true")) { + WorldHTTPEnabled = true; + } } } -void EQEmuConfig::do_chatserver(TiXmlElement *ele) { +void EQEmuConfig::do_chatserver(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"host",true); - if (text) - ChatHost=text; - - text=ParseTextBlock(ele,"port",true); - if (text) - ChatPort=atoi(text); + text = ParseTextBlock(ele, "host", true); + if (text) { + ChatHost = text; + } + text = ParseTextBlock(ele, "port", true); + if (text) { + ChatPort = atoi(text); + } } -void EQEmuConfig::do_mailserver(TiXmlElement *ele) { +void EQEmuConfig::do_mailserver(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"host",true); - if (text) - MailHost=text; - - text=ParseTextBlock(ele,"port",true); - if (text) - MailPort=atoi(text); + text = ParseTextBlock(ele, "host", true); + if (text) { + MailHost = text; + } + text = ParseTextBlock(ele, "port", true); + if (text) { + MailPort = atoi(text); + } } -void EQEmuConfig::do_database(TiXmlElement *ele) { +void EQEmuConfig::do_database(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"host",true); - if (text) - DatabaseHost=text; - - text=ParseTextBlock(ele,"port",true); - if (text) - DatabasePort=atoi(text); - - text=ParseTextBlock(ele,"username",true); - if (text) - DatabaseUsername=text; - - text=ParseTextBlock(ele,"password",true); - if (text) - DatabasePassword=text; - - text=ParseTextBlock(ele,"db",true); - if (text) - DatabaseDB=text; + text = ParseTextBlock(ele, "host", true); + if (text) { + DatabaseHost = text; + } + text = ParseTextBlock(ele, "port", true); + if (text) { + DatabasePort = atoi(text); + } + text = ParseTextBlock(ele, "username", true); + if (text) { + DatabaseUsername = text; + } + text = ParseTextBlock(ele, "password", true); + if (text) { + DatabasePassword = text; + } + text = ParseTextBlock(ele, "db", true); + if (text) { + DatabaseDB = text; + } } -void EQEmuConfig::do_qsdatabase(TiXmlElement *ele) { +void EQEmuConfig::do_qsdatabase(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"host",true); - if (text) - QSDatabaseHost=text; - - text=ParseTextBlock(ele,"port",true); - if (text) - QSDatabasePort=atoi(text); - - text=ParseTextBlock(ele,"username",true); - if (text) - QSDatabaseUsername=text; - - text=ParseTextBlock(ele,"password",true); - if (text) - QSDatabasePassword=text; - - text=ParseTextBlock(ele,"db",true); - if (text) - QSDatabaseDB=text; + text = ParseTextBlock(ele, "host", true); + if (text) { + QSDatabaseHost = text; + } + text = ParseTextBlock(ele, "port", true); + if (text) { + QSDatabasePort = atoi(text); + } + text = ParseTextBlock(ele, "username", true); + if (text) { + QSDatabaseUsername = text; + } + text = ParseTextBlock(ele, "password", true); + if (text) { + QSDatabasePassword = text; + } + text = ParseTextBlock(ele, "db", true); + if (text) { + QSDatabaseDB = text; + } } -void EQEmuConfig::do_zones(TiXmlElement *ele) { +void EQEmuConfig::do_zones(TiXmlElement *ele) +{ const char *text; TiXmlElement *sub_ele; // TiXmlNode *node,*sub_node; - - text=ParseTextBlock(ele,"defaultstatus",true); - if (text) - DefaultStatus=atoi(text); - + text = ParseTextBlock(ele, "defaultstatus", true); + if (text) { + DefaultStatus = atoi(text); + } // Get the element sub_ele = ele->FirstChildElement("ports"); - if(sub_ele != nullptr) { - + if (sub_ele != nullptr) { text = sub_ele->Attribute("low"); - if (text) - ZonePortLow=atoi(text);; - + if (text) { + ZonePortLow = atoi(text); + }; text = sub_ele->Attribute("high"); - if (text) - ZonePortHigh=atoi(text); + if (text) { + ZonePortHigh = atoi(text); + } } } -void EQEmuConfig::do_files(TiXmlElement *ele) { +void EQEmuConfig::do_files(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"spells",true); - if (text) - SpellsFile=text; - - text=ParseTextBlock(ele,"opcodes",true); - if (text) - OpCodesFile=text; - - text=ParseTextBlock(ele,"logsettings",true); - if (text) - LogSettingsFile=text; - - text=ParseTextBlock(ele,"eqtime",true); - if (text) - EQTimeFile=text; + text = ParseTextBlock(ele, "spells", true); + if (text) { + SpellsFile = text; + } + text = ParseTextBlock(ele, "opcodes", true); + if (text) { + OpCodesFile = text; + } + text = ParseTextBlock(ele, "logsettings", true); + if (text) { + LogSettingsFile = text; + } + text = ParseTextBlock(ele, "eqtime", true); + if (text) { + EQTimeFile = text; + } } -void EQEmuConfig::do_directories(TiXmlElement *ele) { +void EQEmuConfig::do_directories(TiXmlElement *ele) +{ const char *text; - - text=ParseTextBlock(ele,"maps",true); - if (text) - MapDir=text; - - text=ParseTextBlock(ele,"quests",true); - if (text) - QuestDir=text; - - text=ParseTextBlock(ele,"plugins",true); - if (text) - PluginDir=text; - + text = ParseTextBlock(ele, "maps", true); + if (text) { + MapDir = text; + } + text = ParseTextBlock(ele, "quests", true); + if (text) { + QuestDir = text; + } + text = ParseTextBlock(ele, "plugins", true); + if (text) { + PluginDir = text; + } } -void EQEmuConfig::do_launcher(TiXmlElement *ele) { +void EQEmuConfig::do_launcher(TiXmlElement *ele) +{ const char *text; TiXmlElement *sub_ele; - - text=ParseTextBlock(ele,"logprefix",true); - if (text) + text = ParseTextBlock(ele, "logprefix", true); + if (text) { LogPrefix = text; - - text=ParseTextBlock(ele,"logsuffix",true); - if (text) + } + text = ParseTextBlock(ele, "logsuffix", true); + if (text) { LogSuffix = text; - + } // Get the element - text = ParseTextBlock(ele,"exe",true); - if (text) + text = ParseTextBlock(ele, "exe", true); + if (text) { ZoneExe = text; - + } // Get the element sub_ele = ele->FirstChildElement("timers"); - if(sub_ele != nullptr) { + if (sub_ele != nullptr) { text = sub_ele->Attribute("restart"); - if (text) + if (text) { RestartWait = atoi(text); - + } text = sub_ele->Attribute("reterminate"); - if (text) + if (text) { TerminateWait = atoi(text); - + } text = sub_ele->Attribute("initial"); - if (text) + if (text) { InitialBootWait = atoi(text); - + } text = sub_ele->Attribute("interval"); - if (text) + if (text) { ZoneBootInterval = atoi(text); + } } } -std::string EQEmuConfig::GetByName(const std::string &var_name) const { - if(var_name == "ShortName") - return(ShortName); - if(var_name == "LongName") - return(LongName); - if(var_name == "WorldAddress") - return(WorldAddress); - if(var_name == "LoginHost") - return(LoginHost); - if(var_name == "LoginAccount") - return(LoginAccount); - if(var_name == "LoginPassword") - return(LoginPassword); - if(var_name == "LoginPort") - return(itoa(LoginPort)); - if(var_name == "Locked") - return(Locked?"true":"false"); - if(var_name == "WorldTCPPort") - return(itoa(WorldTCPPort)); - if(var_name == "WorldIP") - return(WorldIP); - if(var_name == "TelnetEnabled") - return(TelnetEnabled?"true":"false"); - if(var_name == "WorldHTTPPort") - return(itoa(WorldHTTPPort)); - if(var_name == "WorldHTTPMimeFile") - return(WorldHTTPMimeFile); - if(var_name == "WorldHTTPEnabled") - return(WorldHTTPEnabled?"true":"false"); - if(var_name == "ChatHost") - return(ChatHost); - if(var_name == "ChatPort") - return(itoa(ChatPort)); - if(var_name == "MailHost") - return(MailHost); - if(var_name == "MailPort") - return(itoa(MailPort)); - if(var_name == "DatabaseHost") - return(DatabaseHost); - if(var_name == "DatabaseUsername") - return(DatabaseUsername); - if(var_name == "DatabasePassword") - return(DatabasePassword); - if(var_name == "DatabaseDB") - return(DatabaseDB); - if(var_name == "DatabasePort") - return(itoa(DatabasePort)); - if(var_name == "QSDatabaseHost") - return(QSDatabaseHost); - if(var_name == "QSDatabaseUsername") - return(QSDatabaseUsername); - if(var_name == "QSDatabasePassword") - return(QSDatabasePassword); - if(var_name == "QSDatabaseDB") - return(QSDatabaseDB); - if(var_name == "QSDatabasePort") - return(itoa(QSDatabasePort)); - if(var_name == "SpellsFile") - return(SpellsFile); - if(var_name == "OpCodesFile") - return(OpCodesFile); - if(var_name == "EQTimeFile") - return(EQTimeFile); - if(var_name == "LogSettingsFile") - return(LogSettingsFile); - if(var_name == "MapDir") - return(MapDir); - if(var_name == "QuestDir") - return(QuestDir); - if(var_name == "PluginDir") - return(PluginDir); - if(var_name == "LogPrefix") - return(LogPrefix); - if(var_name == "LogSuffix") - return(LogSuffix); - if(var_name == "ZoneExe") - return(ZoneExe); - if(var_name == "ZonePortLow") - return(itoa(ZonePortLow)); - if(var_name == "ZonePortHigh") - return(itoa(ZonePortHigh)); - if(var_name == "DefaultStatus") - return(itoa(DefaultStatus)); +std::string EQEmuConfig::GetByName(const std::string &var_name) const +{ + if (var_name == "ShortName") { + return (ShortName); + } + if (var_name == "LongName") { + return (LongName); + } + if (var_name == "WorldAddress") { + return (WorldAddress); + } + if (var_name == "LoginHost") { + return (LoginHost); + } + if (var_name == "LoginAccount") { + return (LoginAccount); + } + if (var_name == "LoginPassword") { + return (LoginPassword); + } + if (var_name == "LoginPort") { + return (itoa(LoginPort)); + } + if (var_name == "Locked") { + return (Locked ? "true" : "false"); + } + if (var_name == "WorldTCPPort") { + return (itoa(WorldTCPPort)); + } + if (var_name == "WorldIP") { + return (WorldIP); + } + if (var_name == "TelnetEnabled") { + return (TelnetEnabled ? "true" : "false"); + } + if (var_name == "WorldHTTPPort") { + return (itoa(WorldHTTPPort)); + } + if (var_name == "WorldHTTPMimeFile") { + return (WorldHTTPMimeFile); + } + if (var_name == "WorldHTTPEnabled") { + return (WorldHTTPEnabled ? "true" : "false"); + } + if (var_name == "ChatHost") { + return (ChatHost); + } + if (var_name == "ChatPort") { + return (itoa(ChatPort)); + } + if (var_name == "MailHost") { + return (MailHost); + } + if (var_name == "MailPort") { + return (itoa(MailPort)); + } + if (var_name == "DatabaseHost") { + return (DatabaseHost); + } + if (var_name == "DatabaseUsername") { + return (DatabaseUsername); + } + if (var_name == "DatabasePassword") { + return (DatabasePassword); + } + if (var_name == "DatabaseDB") { + return (DatabaseDB); + } + if (var_name == "DatabasePort") { + return (itoa(DatabasePort)); + } + if (var_name == "QSDatabaseHost") { + return (QSDatabaseHost); + } + if (var_name == "QSDatabaseUsername") { + return (QSDatabaseUsername); + } + if (var_name == "QSDatabasePassword") { + return (QSDatabasePassword); + } + if (var_name == "QSDatabaseDB") { + return (QSDatabaseDB); + } + if (var_name == "QSDatabasePort") { + return (itoa(QSDatabasePort)); + } + if (var_name == "SpellsFile") { + return (SpellsFile); + } + if (var_name == "OpCodesFile") { + return (OpCodesFile); + } + if (var_name == "EQTimeFile") { + return (EQTimeFile); + } + if (var_name == "LogSettingsFile") { + return (LogSettingsFile); + } + if (var_name == "MapDir") { + return (MapDir); + } + if (var_name == "QuestDir") { + return (QuestDir); + } + if (var_name == "PluginDir") { + return (PluginDir); + } + if (var_name == "LogPrefix") { + return (LogPrefix); + } + if (var_name == "LogSuffix") { + return (LogSuffix); + } + if (var_name == "ZoneExe") { + return (ZoneExe); + } + if (var_name == "ZonePortLow") { + return (itoa(ZonePortLow)); + } + if (var_name == "ZonePortHigh") { + return (itoa(ZonePortHigh)); + } + if (var_name == "DefaultStatus") { + return (itoa(DefaultStatus)); + } // if(var_name == "DynamicCount") // return(itoa(DynamicCount)); - return(""); + return (""); } void EQEmuConfig::Dump() const From a612f289e7c48a7c6fd85b68dba0aeacae3ac89d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:05:35 -0600 Subject: [PATCH 0617/1883] Another Linux fix --- common/eq_stream_factory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 5f76a28ee..0b940c18f 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -16,6 +16,7 @@ #endif #include +#include #include "op_codes.h" From 3d8777084cafc4bd88d33abab57af96172213e53 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:10:14 -0600 Subject: [PATCH 0618/1883] db_update_manifest.txt fix --- utils/sql/db_update_manifest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 54c82c8d9..432d97183 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -314,7 +314,7 @@ 9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty| 9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty| 9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| -9061|2014_12_11_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| +9061|2014_12_13_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| 9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty| # Upgrade conditions: From 0c21f56ff39f8c187360ca32b2fc0702b85e3ecd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:57:07 -0600 Subject: [PATCH 0619/1883] faction.cpp & .h header include cleanup and faction.cpp code structure style change --- common/faction.cpp | 199 +++++++++++++++++++++++++-------------------- common/faction.h | 1 - 2 files changed, 113 insertions(+), 87 deletions(-) diff --git a/common/faction.cpp b/common/faction.cpp index 576971ec5..65524f623 100644 --- a/common/faction.cpp +++ b/common/faction.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) This program is free software; you can redistribute it and/or modify @@ -15,34 +15,35 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" + #include "faction.h" #include "races.h" -const char *FactionValueToString(FACTION_VALUE fv) { - switch(fv) { - case FACTION_ALLY: - return("Ally"); - case FACTION_WARMLY: - return("Warmly"); - case FACTION_KINDLY: - return("Kindly"); - case FACTION_AMIABLE: - return("Amiable"); - case FACTION_INDIFFERENT: - return("Indifferent"); - case FACTION_APPREHENSIVE: - return("Apprehensive"); - case FACTION_DUBIOUS: - return("Dubious"); - case FACTION_THREATENLY: - return("Threatenly"); - case FACTION_SCOWLS: - return("Scowls, ready to attack."); - default: - break; +const char *FactionValueToString(FACTION_VALUE fv) +{ + switch (fv) { + case FACTION_ALLY: + return ("Ally"); + case FACTION_WARMLY: + return ("Warmly"); + case FACTION_KINDLY: + return ("Kindly"); + case FACTION_AMIABLE: + return ("Amiable"); + case FACTION_INDIFFERENT: + return ("Indifferent"); + case FACTION_APPREHENSIVE: + return ("Apprehensive"); + case FACTION_DUBIOUS: + return ("Dubious"); + case FACTION_THREATENLY: + return ("Threatenly"); + case FACTION_SCOWLS: + return ("Scowls, ready to attack."); + default: + break; } - return("Unknown Faction Con"); + return ("Unknown Faction Con"); } @@ -55,35 +56,56 @@ const char *FactionValueToString(FACTION_VALUE fv) { FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value) { int32 character_value = tmpCharacter_value; - if (fm) + if (fm) { character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod; - if(character_value >= 1101) return FACTION_ALLY; - if(character_value >= 701 && character_value <= 1100) return FACTION_WARMLY; - if(character_value >= 401 && character_value <= 700) return FACTION_KINDLY; - if(character_value >= 101 && character_value <= 400) return FACTION_AMIABLE; - if(character_value >= 0 && character_value <= 100) return FACTION_INDIFFERENT; - if(character_value >= -100 && character_value <= -1) return FACTION_APPREHENSIVE; - if(character_value >= -700 && character_value <= -101) return FACTION_DUBIOUS; - if(character_value >= -999 && character_value <= -701) return FACTION_THREATENLY; - if(character_value <= -1000) return FACTION_SCOWLS; + } + if (character_value >= 1101) { + return FACTION_ALLY; + } + if (character_value >= 701 && character_value <= 1100) { + return FACTION_WARMLY; + } + if (character_value >= 401 && character_value <= 700) { + return FACTION_KINDLY; + } + if (character_value >= 101 && character_value <= 400) { + return FACTION_AMIABLE; + } + if (character_value >= 0 && character_value <= 100) { + return FACTION_INDIFFERENT; + } + if (character_value >= -100 && character_value <= -1) { + return FACTION_APPREHENSIVE; + } + if (character_value >= -700 && character_value <= -101) { + return FACTION_DUBIOUS; + } + if (character_value >= -999 && character_value <= -701) { + return FACTION_THREATENLY; + } + if (character_value <= -1000) { + return FACTION_SCOWLS; + } return FACTION_INDIFFERENT; } // this function should check if some races have more than one race define bool IsOfEqualRace(int r1, int r2) { - if (r1 == r2) + if (r1 == r2) { return true; + } // TODO: add more values - switch(r1) - { - case DARK_ELF: - if (r2 == 77) - return true; - break; - case BARBARIAN: - if (r2 == 90) - return true; + switch (r1) { + case DARK_ELF: + if (r2 == 77) { + return true; + } + break; + case BARBARIAN: + if (r2 == 90) { + return true; + } } return false; } @@ -91,50 +113,55 @@ bool IsOfEqualRace(int r1, int r2) // trolls endure ogres, dark elves, ... bool IsOfIndiffRace(int r1, int r2) { - if (r1 == r2) + if (r1 == r2) { return true; + } // TODO: add more values - switch(r1) - { - case DARK_ELF: - case OGRE: - case TROLL: - if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) + switch (r1) { + case DARK_ELF: + case OGRE: + case TROLL: + if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) { + return true; + } + break; + case HUMAN: + case BARBARIAN: + case HALF_ELF: + case GNOME: + case HALFLING: + case WOOD_ELF: + if (r2 == HUMAN || + r2 == BARBARIAN || + r2 == ERUDITE || + r2 == HALF_ELF || + r2 == GNOME || + r2 == HALFLING || + r2 == DWARF || + r2 == HIGH_ELF || + r2 == WOOD_ELF) { + return true; + } + break; + case ERUDITE: + if (r2 == HUMAN || r2 == HALF_ELF) { + return true; + } + break; + case DWARF: + if (r2 == HALFLING || r2 == GNOME) { + return true; + } + break; + case HIGH_ELF: + if (r2 == WOOD_ELF) { + return true; + } + break; + case VAHSHIR: return true; - break; - case HUMAN: - case BARBARIAN: - case HALF_ELF: - case GNOME: - case HALFLING: - case WOOD_ELF: - if (r2 == HUMAN || - r2 == BARBARIAN || - r2 == ERUDITE || - r2 == HALF_ELF || - r2 == GNOME || - r2 == HALFLING || - r2 == DWARF || - r2 == HIGH_ELF || - r2 == WOOD_ELF) - return true; - break; - case ERUDITE: - if (r2 == HUMAN || r2 == HALF_ELF) - return true; - break; - case DWARF: - if (r2 == HALFLING || r2 == GNOME) - return true; - break; - case HIGH_ELF: - if (r2 == WOOD_ELF) - return true; - break; - case VAHSHIR: - return true; - case IKSAR: - return false; + case IKSAR: + return false; } return false; } diff --git a/common/faction.h b/common/faction.h index c98fc0916..a455b81e6 100644 --- a/common/faction.h +++ b/common/faction.h @@ -21,7 +21,6 @@ #include "types.h" #include "features.h" #include -#include enum FACTION_VALUE { FACTION_ALLY = 1, From 20200fd028c6a6fd9632e47e6645e89f76b6ed08 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 21:59:23 -0600 Subject: [PATCH 0620/1883] guild_base.cpp & .h include header cleanup --- common/guild_base.cpp | 1 - common/guild_base.h | 230 ++++++++++++++++++++++-------------------- 2 files changed, 118 insertions(+), 113 deletions(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index e6df92569..06e108534 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -16,7 +16,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" #include "guild_base.h" #include "database.h" #include "logsys.h" diff --git a/common/guild_base.h b/common/guild_base.h index b59244480..bfe14205e 100644 --- a/common/guild_base.h +++ b/common/guild_base.h @@ -3,146 +3,152 @@ #include "guilds.h" #include -#include #include class Database; -class CharGuildInfo { -public: - //fields from `characer_` - uint32 char_id; - std::string char_name; - uint8 class_; - uint16 level; - uint32 time_last_on; - uint32 zone_id; +class CharGuildInfo +{ + public: + //fields from `characer_` + uint32 char_id; + std::string char_name; + uint8 class_; + uint16 level; + uint32 time_last_on; + uint32 zone_id; - //fields from `guild_members` - uint32 guild_id; - uint8 rank; - bool tribute_enable; - uint32 total_tribute; - uint32 last_tribute; //timestamp - bool banker; - bool alt; - std::string public_note; + //fields from `guild_members` + uint32 guild_id; + uint8 rank; + bool tribute_enable; + uint32 total_tribute; + uint32 last_tribute; //timestamp + bool banker; + bool alt; + std::string public_note; }; //this object holds guild functionality shared between world and zone. -class BaseGuildManager { -public: - BaseGuildManager(); - virtual ~BaseGuildManager(); +class BaseGuildManager +{ + public: + BaseGuildManager(); + virtual ~BaseGuildManager(); - //this must be called before doing anything else with this object - void SetDatabase(Database *db) { m_db = db; } + //this must be called before doing anything else with this object + void SetDatabase(Database *db) + { + m_db = db; + } - bool LoadGuilds(); - bool RefreshGuild(uint32 guild_id); + bool LoadGuilds(); + bool RefreshGuild(uint32 guild_id); - //guild edit actions. - uint32 CreateGuild(const char* name, uint32 leader_char_id); - bool DeleteGuild(uint32 guild_id); - bool RenameGuild(uint32 guild_id, const char* name); - bool SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); - bool SetGuildURL(uint32 GuildID, const char* URL); - bool SetGuildChannel(uint32 GuildID, const char* Channel); + //guild edit actions. + uint32 CreateGuild(const char* name, uint32 leader_char_id); + bool DeleteGuild(uint32 guild_id); + bool RenameGuild(uint32 guild_id, const char* name); + bool SetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); + bool SetGuildURL(uint32 GuildID, const char* URL); + bool SetGuildChannel(uint32 GuildID, const char* Channel); - //character edit actions - bool SetGuildLeader(uint32 guild_id, uint32 leader_char_id); - bool SetGuild(uint32 charid, uint32 guild_id, uint8 rank); - bool SetGuildRank(uint32 charid, uint8 rank); - bool SetBankerFlag(uint32 charid, bool is_banker); - bool ForceRankUpdate(uint32 charid); - bool GetAltFlag(uint32 CharID); - bool SetAltFlag(uint32 charid, bool is_alt); - bool GetBankerFlag(uint32 CharID); - bool SetTributeFlag(uint32 charid, bool enabled); - bool SetPublicNote(uint32 charid, const char *note); + //character edit actions + bool SetGuildLeader(uint32 guild_id, uint32 leader_char_id); + bool SetGuild(uint32 charid, uint32 guild_id, uint8 rank); + bool SetGuildRank(uint32 charid, uint8 rank); + bool SetBankerFlag(uint32 charid, bool is_banker); + bool ForceRankUpdate(uint32 charid); + bool GetAltFlag(uint32 CharID); + bool SetAltFlag(uint32 charid, bool is_alt); + bool GetBankerFlag(uint32 CharID); + bool SetTributeFlag(uint32 charid, bool enabled); + bool SetPublicNote(uint32 charid, const char *note); - //queries - bool GetCharInfo(const char *char_name, CharGuildInfo &into); - bool GetCharInfo(uint32 char_id, CharGuildInfo &into); - bool GetEntireGuild(uint32 guild_id, std::vector &members); //caller is responsible for deleting each pointer in the resulting vector. - bool GuildExists(uint32 guild_id) const; - bool GetGuildMOTD(uint32 guild_id, char *motd_buffer, char *setter_buffer) const; - bool GetGuildURL(uint32 GuildID, char *URLBuffer) const; - bool GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const; - const char *GetRankName(uint32 guild_id, uint8 rank) const; - const char *GetGuildName(uint32 guild_id) const; - bool GetGuildNameByID(uint32 guild_id, std::string &into) const; - uint32 GetGuildIDByName(const char *GuildName); - bool IsGuildLeader(uint32 guild_id, uint32 char_id) const; - uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const; - bool CheckGMStatus(uint32 guild_id, uint8 status) const; - bool CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const; + //queries + bool GetCharInfo(const char *char_name, CharGuildInfo &into); + bool GetCharInfo(uint32 char_id, CharGuildInfo &into); + bool GetEntireGuild(uint32 guild_id, std::vector &members); //caller is responsible for deleting each pointer in the resulting vector. + bool GuildExists(uint32 guild_id) const; + bool GetGuildMOTD(uint32 guild_id, char *motd_buffer, char *setter_buffer) const; + bool GetGuildURL(uint32 GuildID, char *URLBuffer) const; + bool GetGuildChannel(uint32 GuildID, char *ChannelBuffer) const; + const char *GetRankName(uint32 guild_id, uint8 rank) const; + const char *GetGuildName(uint32 guild_id) const; + bool GetGuildNameByID(uint32 guild_id, std::string &into) const; + uint32 GetGuildIDByName(const char *GuildName); + bool IsGuildLeader(uint32 guild_id, uint32 char_id) const; + uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const; + bool CheckGMStatus(uint32 guild_id, uint8 status) const; + bool CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const; // uint32 Getguild_id(uint32 eqid); - uint32 FindGuildByLeader(uint32 leader) const; + uint32 FindGuildByLeader(uint32 leader) const; // void GetGuildMembers(uint32 guild_id,GuildMember_Struct* gms); - uint32 NumberInGuild(uint32 guild_id); + uint32 NumberInGuild(uint32 guild_id); // bool GetGuildRanks(uint32 guildeqid, GuildRanks_Struct* gr); // bool EditGuild(uint32 guild_id, uint8 ranknum, GuildRankLevel_Struct* grl); - uint8 *MakeGuildList(const char *head_name, uint32 &length) const; //make a guild list packet, returns ownership of the buffer. + uint8 *MakeGuildList(const char *head_name, uint32 &length) const; //make a guild list packet, returns ownership of the buffer. - static const char *const GuildActionNames[_MaxGuildAction]; - uint32 DoesAccountContainAGuildLeader(uint32 AccountID); + static const char *const GuildActionNames[_MaxGuildAction]; + uint32 DoesAccountContainAGuildLeader(uint32 AccountID); -protected: - //the methods which must be defined by base classes. - virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) = 0; - virtual void SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) = 0; - virtual void SendRankUpdate(uint32 CharID) = 0; - virtual void SendGuildDelete(uint32 guild_id) = 0; + protected: + //the methods which must be defined by base classes. + virtual void SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) = 0; + virtual void SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) = 0; + virtual void SendRankUpdate(uint32 CharID) = 0; + virtual void SendGuildDelete(uint32 guild_id) = 0; - uint32 DBCreateGuild(const char* name, uint32 leader_char_id); - bool DBDeleteGuild(uint32 guild_id); - bool DBRenameGuild(uint32 guild_id, const char* name); - bool DBSetGuildLeader(uint32 guild_id, uint32 leader_char_id); - bool DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); - bool DBSetGuildURL(uint32 GuildID, const char* URL); - bool DBSetGuildChannel(uint32 GuildID, const char* Channel); - bool DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank); - bool DBSetGuildRank(uint32 charid, uint8 rank); - bool DBSetBankerFlag(uint32 charid, bool is_banker); - bool DBSetAltFlag(uint32 charid, bool is_alt); - bool DBSetTributeFlag(uint32 charid, bool enabled); - bool DBSetPublicNote(uint32 charid, const char *note); - bool QueryWithLogging(std::string query, const char *errmsg); + uint32 DBCreateGuild(const char* name, uint32 leader_char_id); + bool DBDeleteGuild(uint32 guild_id); + bool DBRenameGuild(uint32 guild_id, const char* name); + bool DBSetGuildLeader(uint32 guild_id, uint32 leader_char_id); + bool DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter); + bool DBSetGuildURL(uint32 GuildID, const char* URL); + bool DBSetGuildChannel(uint32 GuildID, const char* Channel); + bool DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank); + bool DBSetGuildRank(uint32 charid, uint8 rank); + bool DBSetBankerFlag(uint32 charid, bool is_banker); + bool DBSetAltFlag(uint32 charid, bool is_alt); + bool DBSetTributeFlag(uint32 charid, bool enabled); + bool DBSetPublicNote(uint32 charid, const char *note); + bool QueryWithLogging(std::string query, const char *errmsg); // void DBSetPublicNote(uint32 guild_id,char* charname, char* note); - bool LocalDeleteGuild(uint32 guild_id); + bool LocalDeleteGuild(uint32 guild_id); - class RankInfo { - public: - RankInfo(); - std::string name; - bool permissions[_MaxGuildAction]; - }; - class GuildInfo { - public: - GuildInfo(); - std::string name; - std::string motd; - std::string motd_setter; - std::string url; - std::string channel; + class RankInfo + { + public: + RankInfo(); + std::string name; + bool permissions[_MaxGuildAction]; + }; + class GuildInfo + { + public: + GuildInfo(); + std::string name; + std::string motd; + std::string motd_setter; + std::string url; + std::string channel; - uint32 leader_char_id; - uint8 minstatus; - //tribute is not in here on purpose, since it is only valid in world! - RankInfo ranks[GUILD_MAX_RANK+1]; - }; + uint32 leader_char_id; + uint8 minstatus; + //tribute is not in here on purpose, since it is only valid in world! + RankInfo ranks[GUILD_MAX_RANK + 1]; + }; - std::map m_guilds; //we own the pointers in this map - void ClearGuilds(); //clears internal structure + std::map m_guilds; //we own the pointers in this map + void ClearGuilds(); //clears internal structure - Database *m_db; //we do not own this + Database *m_db; //we do not own this - bool _StoreGuildDB(uint32 guild_id); - GuildInfo *_CreateGuild(uint32 guild_id, const char *guild_name, uint32 account_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL); - uint32 _GetFreeGuildID(); + bool _StoreGuildDB(uint32 guild_id); + GuildInfo *_CreateGuild(uint32 guild_id, const char *guild_name, uint32 account_id, uint8 minstatus, const char *guild_motd, const char *motd_setter, const char *Channel, const char *URL); + uint32 _GetFreeGuildID(); }; From edec2ad24cf23be050e1fa2ef62cae91216b350e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:04:39 -0600 Subject: [PATCH 0621/1883] faction.cpp linux build fix --- common/faction.cpp | 2 ++ common/guilds.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/common/faction.cpp b/common/faction.cpp index 65524f623..c387f8453 100644 --- a/common/faction.cpp +++ b/common/faction.cpp @@ -19,6 +19,8 @@ #include "faction.h" #include "races.h" +#include + const char *FactionValueToString(FACTION_VALUE fv) { switch (fv) { diff --git a/common/guilds.cpp b/common/guilds.cpp index ddd5d9a59..6098c2e1b 100644 --- a/common/guilds.cpp +++ b/common/guilds.cpp @@ -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 */ + #include "../common/debug.h" #include "misc_functions.h" #include "guilds.h" From 6d0b44d69e3d90794ba75c3f6f158baabe6f6e51 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:10:06 -0600 Subject: [PATCH 0622/1883] item.cpp & .h header include cleanup --- common/item.cpp | 13 +++++-------- common/item.h | 11 +++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index df4997470..1b99ad779 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -16,19 +16,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" -#include "string_util.h" -#include "item.h" -#include "database.h" -#include "misc.h" -#include "races.h" -#include "shareddb.h" #include "classes.h" +#include "debug.h" +#include "item.h" +#include "races.h" #include "rulesys.h" +#include "shareddb.h" +#include "string_util.h" #include -#include #include std::list dirty_inst; diff --git a/common/item.h b/common/item.h index 995f121d6..b0aa06466 100644 --- a/common/item.h +++ b/common/item.h @@ -23,21 +23,16 @@ #ifndef __ITEM_H #define __ITEM_H -class ItemInst; // Item belonging to a client (contains info on item, dye, augments, charges, etc) -class ItemInstQueue; // Queue of ItemInst objects (i.e., cursor) -class Inventory; // Character inventory class ItemParse; // Parses item packets class EvolveInfo; // Stores information about an evolving item family -#include -#include -#include -#include -#include "../common/eq_packet_structs.h" #include "../common/eq_constants.h" #include "../common/item_struct.h" #include "../common/timer.h" +#include +#include + // Helper typedefs typedef std::list::const_iterator iter_queue; typedef std::map::const_iterator iter_inst; From 7887511589dc5fbb305c652860ba0cd38dab6806 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:12:56 -0600 Subject: [PATCH 0623/1883] faction linux build fix for real --- common/faction.cpp | 2 -- common/faction.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/common/faction.cpp b/common/faction.cpp index c387f8453..65524f623 100644 --- a/common/faction.cpp +++ b/common/faction.cpp @@ -19,8 +19,6 @@ #include "faction.h" #include "races.h" -#include - const char *FactionValueToString(FACTION_VALUE fv) { switch (fv) { diff --git a/common/faction.h b/common/faction.h index a455b81e6..c98fc0916 100644 --- a/common/faction.h +++ b/common/faction.h @@ -21,6 +21,7 @@ #include "types.h" #include "features.h" #include +#include enum FACTION_VALUE { FACTION_ALLY = 1, From e9b72e0f7d227a18bf1326879228cb8fe7fcb1ac Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:15:17 -0600 Subject: [PATCH 0624/1883] logsys_eqemu .cpp & .h include cleanup --- common/logsys.cpp | 7 ++++--- common/logsys_eqemu.cpp | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/common/logsys.cpp b/common/logsys.cpp index 2b90c8b4a..c01baf04e 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -16,13 +16,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "logsys.h" #include "debug.h" +#include "eq_packet.h" +#include "logsys.h" +#include "misc.h" + #include #include #include -#include "misc.h" -#include "eq_packet.h" #define LOG_CATEGORY(category) #category , diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp index b5f846b4a..e16de1055 100644 --- a/common/logsys_eqemu.cpp +++ b/common/logsys_eqemu.cpp @@ -21,9 +21,6 @@ #include "string_util.h" #include -#include - -#include void log_message(LogType type, const char *fmt, ...) { va_list args; From de32970d6ff0bc2bd6286edbfd5a057df3ca6561 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:16:30 -0600 Subject: [PATCH 0625/1883] add back in for linux --- common/guild_base.h | 1 + common/logsys_eqemu.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/common/guild_base.h b/common/guild_base.h index bfe14205e..ac8b1a895 100644 --- a/common/guild_base.h +++ b/common/guild_base.h @@ -3,6 +3,7 @@ #include "guilds.h" #include +#include #include class Database; diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp index e16de1055..b5f846b4a 100644 --- a/common/logsys_eqemu.cpp +++ b/common/logsys_eqemu.cpp @@ -21,6 +21,9 @@ #include "string_util.h" #include +#include + +#include void log_message(LogType type, const char *fmt, ...) { va_list args; From f8a182584587c1d4330958a45c23e77dc3bdf032 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:21:44 -0600 Subject: [PATCH 0626/1883] misc_functions cleanup --- common/misc_functions.cpp | 4 +++- common/misc_functions.h | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/misc_functions.cpp b/common/misc_functions.cpp index 81fc2434b..18171c0a8 100644 --- a/common/misc_functions.cpp +++ b/common/misc_functions.cpp @@ -15,11 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + #include "../common/debug.h" #include "misc_functions.h" #include #include -#include + #ifndef WIN32 #include #include diff --git a/common/misc_functions.h b/common/misc_functions.h index a013423ff..610a86b04 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -19,8 +19,6 @@ #define MISCFUNCTIONS_H #include "types.h" -#include -#include #include #include From c1e5d8b7dc37a4bc63769e36bd20b95f118adae4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:21:57 -0600 Subject: [PATCH 0627/1883] misc cleanup --- common/misc.cpp | 3 ++- common/mysql_request_result.h | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/common/misc.cpp b/common/misc.cpp index b2e80e3bd..61ac556f5 100644 --- a/common/misc.cpp +++ b/common/misc.cpp @@ -9,13 +9,14 @@ #include #include #include + #ifndef WIN32 #include #endif + #include #include "misc.h" #include "types.h" -#include #include #define ENC(c) (((c) & 0x3f) + ' ') diff --git a/common/mysql_request_result.h b/common/mysql_request_result.h index ab84eeb18..b2d6fe3d1 100644 --- a/common/mysql_request_result.h +++ b/common/mysql_request_result.h @@ -9,9 +9,6 @@ #include #include "types.h" #include "mysql_request_row.h" -#include -#include -#include class MySQLRequestResult { private: From ffe447859a24d536016c42f1ef02a0ed46b7b8d3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:23:49 -0600 Subject: [PATCH 0628/1883] opcode_map.cpp readability --- common/opcode_map.cpp | 590 +++++++++++++++++++++--------------------- 1 file changed, 295 insertions(+), 295 deletions(-) diff --git a/common/opcode_map.cpp b/common/opcode_map.cpp index edb6ba64c..fdaaf3fa1 100644 --- a/common/opcode_map.cpp +++ b/common/opcode_map.cpp @@ -6,302 +6,302 @@ std::map opcode_map; std::string get_opcode_name(unsigned long opcode) { -std::map::iterator itr;; - - return (itr=opcode_map.find(opcode))!=opcode_map.end() ? itr->second : "OP_Unknown"; + std::map::iterator itr;; + return (itr = opcode_map.find(opcode)) != opcode_map.end() ? itr->second : "OP_Unknown"; } + void load_opcode_names() { - opcode_map[0x0176]="LiveOP_Heartbeat"; - opcode_map[0x02d7]="LiveOP_ReloadUI"; - opcode_map[0x01eb]="LiveOP_IncreaseStats"; - opcode_map[0x0134]="LiveOP_ApproveZone"; - opcode_map[0x01d5]="LiveOP_Dye"; - opcode_map[0x0168]="LiveOP_Stamina"; - opcode_map[0x014d]="LiveOP_ControlBoat"; - opcode_map[0x003e]="LiveOP_MobUpdate"; - opcode_map[0x0027]="LiveOP_ClientUpdate"; - opcode_map[0x0024]="LiveOP_ChannelMessage"; - opcode_map[0x01d7]="LiveOP_SimpleMessage"; - opcode_map[0x01d8]="LiveOP_FormattedMessage"; - opcode_map[0x01c6]="LiveOP_TGB"; - opcode_map[0x0285]="LiveOP_TestBuff"; - opcode_map[0x012d]="LiveOP_Bind_Wound"; - opcode_map[0x01ab]="LiveOP_Charm"; - opcode_map[0x014c]="LiveOP_Begging"; - opcode_map[0x0152]="LiveOP_MoveCoin"; - opcode_map[0x0292]="LiveOP_SpawnDoor"; - opcode_map[0x009d]="LiveOP_Sneak"; - opcode_map[0x0079]="LiveOP_ExpUpdate"; - opcode_map[0x027d]="LiveOP_DumpName"; - opcode_map[0x01ea]="LiveOP_RespondAA"; - opcode_map[0x01c9]="LiveOP_SendAAStats"; - opcode_map[0x0366]="LiveOP_SendAATable"; - opcode_map[0x01e9]="LiveOP_AAAction"; - opcode_map[0x00bb]="LiveOP_BoardBoat"; - opcode_map[0x00bc]="LiveOP_LeaveBoat"; - opcode_map[0x02b8]="LiveOP_AdventureInfoRequest"; - opcode_map[0x02b9]="LiveOP_AdventureInfo"; - opcode_map[0x02a6]="LiveOP_AdventureRequest"; - opcode_map[0x02a8]="LiveOP_AdventureDetails"; - opcode_map[0x02a9]="LiveOP_LDoNButton"; - opcode_map[0x02ba]="LiveOP_AdventureData"; - opcode_map[0x02c9]="LiveOP_AdventureFinish"; - opcode_map[0x02c6]="LiveOP_LeaveAdventure"; - opcode_map[0x02ce]="LiveOP_AdventureUpdate"; - opcode_map[0x002b]="LiveOP_SendExpZonein"; - opcode_map[0x01e4]="LiveOP_ZoneInSendName"; - opcode_map[0x01bf]="LiveOP_GuildLeader"; - opcode_map[0x009a]="LiveOP_GuildPeace"; - opcode_map[0x0132]="LiveOP_GuildRemove"; - opcode_map[0x0059]="LiveOP_GuildMemberList"; - opcode_map[0x026e]="LiveOP_GuildMemberUpdate"; - opcode_map[0x0130]="LiveOP_GuildInvite"; - opcode_map[0x01c0]="LiveOP_GuildMOTD"; - opcode_map[0x003c]="LiveOP_GuildPublicNote"; - opcode_map[0x027e]="LiveOP_GetGuildMOTD"; - opcode_map[0x0277]="LiveOP_GuildDemote"; - opcode_map[0x0131]="LiveOP_GuildInviteAccept"; - opcode_map[0x00a4]="LiveOP_GuildWar"; - opcode_map[0x0133]="LiveOP_GuildDelete"; - opcode_map[0x0233]="LiveOP_GuildManageRemove"; - opcode_map[0x022d]="LiveOP_GuildManageAdd"; - opcode_map[0x0039]="LiveOP_GuildManageStatus"; - opcode_map[0x01e8]="LiveOP_Trader"; - opcode_map[0x01e7]="LiveOP_Bazaar"; - opcode_map[0x01c4]="LiveOP_BecomeTrader"; - opcode_map[0x01f4]="LiveOP_BazaarInspect"; - opcode_map[0x006e]="LiveOP_TraderItemUpdate"; - opcode_map[0x017c]="LiveOP_TraderDelItem"; - opcode_map[0x01eb]="LiveOP_TraderShop"; - opcode_map[0x01ca]="LiveOP_TraderBuy"; - opcode_map[0x01ac]="LiveOP_PetCommands"; - opcode_map[0x0042]="LiveOP_TradeSkillCombine"; - opcode_map[0x02e5]="LiveOP_AugmentItem"; - opcode_map[0x0367]="LiveOP_ItemName"; - opcode_map[0x02cd]="LiveOP_ShopItem"; - opcode_map[0x0065]="LiveOP_ShopPlayerBuy"; - opcode_map[0x006a]="LiveOP_ShopPlayerSell"; - opcode_map[0x006d]="LiveOP_ShopDelItem"; - opcode_map[0x0f6d]="LiveOP_ShopEndConfirm"; - opcode_map[0x00f7]="LiveOP_ShopRequest"; - opcode_map[0x006c]="LiveOP_ShopEnd"; - opcode_map[0x02d1]="LiveOP_AdventureMerchantRequest"; - opcode_map[0x02d2]="LiveOP_AdventureMerchantResponse"; - opcode_map[0x02d3]="LiveOP_AdventureMerchantPurchase"; - opcode_map[0x02e3]="LiveOP_AdventurePointsUpdate"; - opcode_map[0x0270]="LiveOP_LFGCommand"; - opcode_map[0x01d0]="LiveOP_LFGAppearance"; - opcode_map[0x01b5]="LiveOP_MoneyUpdate"; - opcode_map[0x0721]="LiveOP_GroupDelete"; - opcode_map[0x0272]="LiveOP_GroupAcknowledge"; - opcode_map[0x024a]="LiveOP_GroupUpdate"; - opcode_map[0x025f]="LiveOP_GroupInvite"; - opcode_map[0x00ff]="LiveOP_GroupDisband"; - opcode_map[0x00d5]="LiveOP_GroupInvite2"; - opcode_map[0x025e]="LiveOP_GroupFollow"; - opcode_map[0x00d7]="LiveOP_GroupFollow2"; - opcode_map[0x00d6]="LiveOP_GroupCancelInvite"; - opcode_map[0x0156]="LiveOP_Split"; - opcode_map[0x00d8]="LiveOP_Jump"; - opcode_map[0x01d6]="LiveOP_ConsiderCorpse"; - opcode_map[0x0064]="LiveOP_SkillUpdate"; - opcode_map[0x0178]="LiveOP_GMEndTrainingResponse"; - opcode_map[0x013c]="LiveOP_GMEndTraining"; - opcode_map[0x0175]="LiveOP_GMTrainSkill"; - opcode_map[0x013b]="LiveOP_GMTraining"; - opcode_map[0x017b]="LiveOP_ConsumeAmmo"; - opcode_map[0x0171]="LiveOP_CombatAbility"; - opcode_map[0x009c]="LiveOP_TrackUnknown"; - opcode_map[0x0234]="LiveOP_TrackTarget"; - opcode_map[0x0286]="LiveOP_Track"; - opcode_map[0x0297]="LiveOP_ReadBook"; - opcode_map[0x001f]="LiveOP_ItemLinkClick"; - opcode_map[0x01f4]="LiveOP_ItemLinkResponse"; - opcode_map[0x01d9]="LiveOP_ItemLinkText"; - opcode_map[0x0a41]="LiveOP_RezzRequest"; - opcode_map[0x00e5]="LiveOP_RezzAnswer"; - opcode_map[0x019b]="LiveOP_RezzComplete"; - opcode_map[0x0128]="LiveOP_MoveDoor"; - opcode_map[0x0127]="LiveOP_ClickDoor"; - opcode_map[0x0247]="LiveOP_SendZonepoints"; - opcode_map[0x008c]="LiveOP_SetRunMode"; - opcode_map[0x0248]="LiveOP_InspectRequest"; - opcode_map[0x0249]="LiveOP_InspectAnswer"; - opcode_map[0x0187]="LiveOP_SenseTraps"; - opcode_map[0x018e]="LiveOP_DisarmTraps"; - opcode_map[0x01bc]="LiveOP_Assist"; - opcode_map[0x0240]="LiveOP_PickPocket"; - opcode_map[0x0119]="LiveOP_LootRequest"; - opcode_map[0x011a]="LiveOP_EndLootRequest"; - opcode_map[0x011b]="LiveOP_MoneyOnCorpse"; - opcode_map[0x0179]="LiveOP_LootComplete"; - opcode_map[0x013f]="LiveOP_LootItem"; - opcode_map[0x0151]="LiveOP_MoveItem"; - opcode_map[0x0056]="LiveOP_WhoAllRequest"; - opcode_map[0x0229]="LiveOP_WhoAllResponse"; - opcode_map[0x0167]="LiveOP_Consume"; - opcode_map[0x0172]="LiveOP_AutoAttack"; - opcode_map[0x0186]="LiveOP_AutoAttack2"; - opcode_map[0x0173]="LiveOP_TargetMouse"; - opcode_map[0x01ba]="LiveOP_TargetCommand"; - opcode_map[0x01d8]="LiveOP_TargetReject"; - opcode_map[0x009e]="LiveOP_Hide"; - opcode_map[0x012e]="LiveOP_Forage"; - opcode_map[0x0077]="LiveOP_Fishing"; - opcode_map[0x0246]="LiveOP_Bug"; - opcode_map[0x00f2]="LiveOP_Emote"; - opcode_map[0x0140]="LiveOP_EmoteAnim"; - opcode_map[0x015c]="LiveOP_Consider"; - opcode_map[0x01cb]="LiveOP_FaceChange"; - opcode_map[0x0197]="LiveOP_RandomReq"; - opcode_map[0x0087]="LiveOP_RandomReply"; - opcode_map[0x01c3]="LiveOP_Camp"; - opcode_map[0x0192]="LiveOP_YellForHelp"; - opcode_map[0x00ef]="LiveOP_SafePoint"; - opcode_map[0x0157]="LiveOP_Buff"; - opcode_map[0x00c0]="LiveOP_ColoredText"; - opcode_map[0x0440]="LiveOP_MultiLineMsg"; - opcode_map[0x021c]="LiveOP_SpecialMesg"; - opcode_map[0x0013]="LiveOP_Consent"; - opcode_map[0x029d]="LiveOP_ConsentResponse"; - opcode_map[0x02d4]="LiveOP_Deny"; - opcode_map[0x016c]="LiveOP_Stun"; - opcode_map[0x0021]="LiveOP_BeginCast"; - opcode_map[0x00be]="LiveOP_CastSpell"; - opcode_map[0x01a8]="LiveOP_InterruptCast"; - opcode_map[0x0105]="LiveOP_Death"; - opcode_map[0x023f]="LiveOP_FeignDeath"; - opcode_map[0x012b]="LiveOP_Illusion"; - opcode_map[0x0078]="LiveOP_LevelUpdate"; - opcode_map[0x0371]="LiveOP_LevelAppearance"; - opcode_map[0x00c2]="LiveOP_MemorizeSpell"; - opcode_map[0x0244]="LiveOP_HPUpdate"; - opcode_map[0x022e]="LiveOP_SendHPTarget"; - opcode_map[0x007d]="LiveOP_Mend"; - opcode_map[0x0160]="LiveOP_Taunt"; - opcode_map[0x0199]="LiveOP_GMDelCorpse"; - opcode_map[0x0047]="LiveOP_GMFind"; - opcode_map[0x0020]="LiveOP_GMServers"; - opcode_map[0x010b]="LiveOP_GMGoto"; - opcode_map[0x028c]="LiveOP_GMSummon"; - opcode_map[0x010a]="LiveOP_GMKick"; - opcode_map[0x0109]="LiveOP_GMKill"; - opcode_map[0x0b40]="LiveOP_GMNameChange"; - opcode_map[0x00a3]="LiveOP_GMLastName"; - opcode_map[0x01b3]="LiveOP_GMToggle"; - opcode_map[0x028f]="LiveOP_GMEmoteZone"; - opcode_map[0x0074]="LiveOP_GMBecomeNPC"; - opcode_map[0x00de]="LiveOP_GMHideMe"; - opcode_map[0x0184]="LiveOP_GMZoneRequest"; - opcode_map[0x0239]="LiveOP_GMZoneRequest2"; - opcode_map[0x0068]="LiveOP_Petition"; - opcode_map[0x0085]="LiveOP_PetitionRefresh"; - opcode_map[0x01ee]="LiveOP_PDeletePetition"; - opcode_map[0x0092]="LiveOP_PetitionBug"; - opcode_map[0x0069]="LiveOP_PetitionUpdate"; - opcode_map[0x0076]="LiveOP_PetitionCheckout"; - opcode_map[0x0056]="LiveOP_PetitionCheckout2"; - opcode_map[0x0091]="LiveOP_PetitionDelete"; - opcode_map[0x02b4]="LiveOP_PetitionResolve"; - opcode_map[0x007e]="LiveOP_PetitionCheckIn"; - opcode_map[0x0090]="LiveOP_PetitionUnCheckout"; - opcode_map[0x01ec]="LiveOP_PetitionQue"; - opcode_map[0x01bb]="LiveOP_SetServerFilter"; - opcode_map[0x0218]="LiveOP_NewSpawn"; - opcode_map[0x0140]="LiveOP_Animation"; - opcode_map[0x0142]="LiveOP_ZoneChange"; - opcode_map[0x00f3]="LiveOP_DeleteSpawn"; - opcode_map[0x0265]="LiveOP_CrashDump"; - opcode_map[0x00e8]="LiveOP_EnvDamage"; - opcode_map[0x0101]="LiveOP_Action"; - opcode_map[0x00e2]="LiveOP_Damage"; - opcode_map[0x00bf]="LiveOP_ManaChange"; - opcode_map[0x027c]="LiveOP_ClientError"; - opcode_map[0x00fb]="LiveOP_Save"; - opcode_map[0x0316]="LiveOP_LocInfo"; - opcode_map[0x0188]="LiveOP_Surname"; - opcode_map[0x018f]="LiveOP_SwapSpell"; - opcode_map[0x01db]="LiveOP_DeleteSpell"; - opcode_map[0x029f]="LiveOP_CloseContainer"; - opcode_map[0x029f]="LiveOP_ClickObjectAck"; - opcode_map[0x00fa]="LiveOP_CreateObject"; - opcode_map[0x00f9]="LiveOP_ClickObject"; - opcode_map[0x01c1]="LiveOP_ClearObject"; - opcode_map[0x0265]="LiveOP_ZoneUnavail"; - opcode_map[0x02e0]="LiveOP_ItemPacket"; - opcode_map[0x029a]="LiveOP_TradeRequest"; - opcode_map[0x0037]="LiveOP_TradeRequestAck"; - opcode_map[0x002d]="LiveOP_TradeAcceptClick"; - opcode_map[0x0162]="LiveOP_TradeMoneyUpdate"; - opcode_map[0x0036]="LiveOP_TradeCoins"; - opcode_map[0x002e]="LiveOP_CancelTrade"; - opcode_map[0x002f]="LiveOP_FinishTrade"; - opcode_map[0x00a1]="LiveOP_SaveOnZoneReq"; - opcode_map[0x0185]="LiveOP_Logout"; - opcode_map[0x0298]="LiveOP_RequestDuel"; - opcode_map[0x0a5d]="LiveOP_DuelResponse"; - opcode_map[0x016e]="LiveOP_DuelResponse2"; - opcode_map[0x007c]="LiveOP_InstillDoubt"; - opcode_map[0x00ac]="LiveOP_SafeFallSuccess"; - opcode_map[0x02fb]="LiveOP_DisciplineUpdate"; - opcode_map[0x02f2]="LiveOP_TributeUpdate"; - opcode_map[0x02f3]="LiveOP_TributeItem"; - opcode_map[0x02f4]="LiveOP_TributePointUpdate"; - opcode_map[0x02f5]="LiveOP_SendTributes"; - opcode_map[0x02f6]="LiveOP_TributeInfo"; - opcode_map[0x02f7]="LiveOP_SelectTribute"; - opcode_map[0x02f8]="LiveOP_TributeTimer"; - opcode_map[0x02f9]="LiveOP_StartTribute"; - opcode_map[0x02fa]="LiveOP_TributeNPC"; - opcode_map[0x02fe]="LiveOP_TributeMoney"; - opcode_map[0x0364]="LiveOP_TributeToggle"; - opcode_map[0x0322]="LiveOP_RecipesFavorite"; - opcode_map[0x01f9]="LiveOP_RecipesSearch"; - opcode_map[0x01fa]="LiveOP_RecipeReply"; - opcode_map[0x01fb]="LiveOP_RecipeDetails"; - opcode_map[0x01fc]="LiveOP_RecipeAutoCombine"; - opcode_map[0x02db]="LiveOP_FindPersonRequest"; - opcode_map[0x02dc]="LiveOP_FindPersonReply"; - opcode_map[0x01dd]="LiveOP_Shielding"; - opcode_map[0x0198]="LiveOP_SetDataRate"; - opcode_map[0x023b]="LiveOP_ZoneEntry"; - opcode_map[0x006b]="LiveOP_PlayerProfile"; - opcode_map[0x0291]="LiveOP_CharInventory"; - opcode_map[0x0170]="LiveOP_ZoneSpawns"; - opcode_map[0x0026]="LiveOP_TimeOfDay"; - opcode_map[0x015b]="LiveOP_Weather"; - opcode_map[0x00ec]="LiveOP_ReqNewZone"; - opcode_map[0x00eb]="LiveOP_NewZone"; - opcode_map[0x00fd]="LiveOP_ReqClientSpawn"; - opcode_map[0x012F]="LiveOP_SpawnAppearance"; - opcode_map[0x0086]="LiveOP_ClientReady"; - opcode_map[0x0086]="LiveOP_ZoneComplete"; - opcode_map[0x02db]="LiveOP_LoginComplete"; - opcode_map[0x0195]="LiveOP_ApproveWorld"; - opcode_map[0x035f]="LiveOP_LogServer"; - opcode_map[0x01b2]="LiveOP_MOTD"; - opcode_map[0x0251]="LiveOP_SendLoginInfo"; - opcode_map[0x00ea]="LiveOP_DeleteCharacter"; - opcode_map[0x0102]="LiveOP_SendCharInfo"; - opcode_map[0x00e1]="LiveOP_ExpansionInfo"; - opcode_map[0x0104]="LiveOP_CharacterCreate"; - opcode_map[0x02ab]="LiveOP_RandomNameGenerator"; - opcode_map[0x005d]="LiveOP_GuildsList"; - opcode_map[0x0125]="LiveOP_ApproveName"; - opcode_map[0x0261]="LiveOP_EnterWorld"; - opcode_map[0x015a]="LiveOP_World_Client_CRC1"; - opcode_map[0x015e]="LiveOP_World_Client_CRC2"; - opcode_map[0x0269]="LiveOP_SetChatServer"; - opcode_map[0x0264]="LiveOP_ZoneServerInfo"; - opcode_map[0x0017]="LiveOP_AckPacket"; - opcode_map[0x012c]="LiveOP_WearChange"; - opcode_map[0x1FA1]="LiveOP_WorldObjectsSent"; - opcode_map[0x39C4]="LiveOP_BlockedBuffs"; - opcode_map[0x4656]="LiveOP_SpawnPositionUpdate"; - opcode_map[0x4b61]="LiveOP_ManaUpdate"; - opcode_map[0x02d6]="LiveOP_EnduranceUpdate"; - opcode_map[0x2ac1]="LiveOP_MobManaUpdate"; - opcode_map[0x6c5f]="LiveOP_MobEnduranceUpdate"; - opcode_map[0x73a8]="LiveOP_SendMaxCharacters"; + opcode_map[0x0176] = "LiveOP_Heartbeat"; + opcode_map[0x02d7] = "LiveOP_ReloadUI"; + opcode_map[0x01eb] = "LiveOP_IncreaseStats"; + opcode_map[0x0134] = "LiveOP_ApproveZone"; + opcode_map[0x01d5] = "LiveOP_Dye"; + opcode_map[0x0168] = "LiveOP_Stamina"; + opcode_map[0x014d] = "LiveOP_ControlBoat"; + opcode_map[0x003e] = "LiveOP_MobUpdate"; + opcode_map[0x0027] = "LiveOP_ClientUpdate"; + opcode_map[0x0024] = "LiveOP_ChannelMessage"; + opcode_map[0x01d7] = "LiveOP_SimpleMessage"; + opcode_map[0x01d8] = "LiveOP_FormattedMessage"; + opcode_map[0x01c6] = "LiveOP_TGB"; + opcode_map[0x0285] = "LiveOP_TestBuff"; + opcode_map[0x012d] = "LiveOP_Bind_Wound"; + opcode_map[0x01ab] = "LiveOP_Charm"; + opcode_map[0x014c] = "LiveOP_Begging"; + opcode_map[0x0152] = "LiveOP_MoveCoin"; + opcode_map[0x0292] = "LiveOP_SpawnDoor"; + opcode_map[0x009d] = "LiveOP_Sneak"; + opcode_map[0x0079] = "LiveOP_ExpUpdate"; + opcode_map[0x027d] = "LiveOP_DumpName"; + opcode_map[0x01ea] = "LiveOP_RespondAA"; + opcode_map[0x01c9] = "LiveOP_SendAAStats"; + opcode_map[0x0366] = "LiveOP_SendAATable"; + opcode_map[0x01e9] = "LiveOP_AAAction"; + opcode_map[0x00bb] = "LiveOP_BoardBoat"; + opcode_map[0x00bc] = "LiveOP_LeaveBoat"; + opcode_map[0x02b8] = "LiveOP_AdventureInfoRequest"; + opcode_map[0x02b9] = "LiveOP_AdventureInfo"; + opcode_map[0x02a6] = "LiveOP_AdventureRequest"; + opcode_map[0x02a8] = "LiveOP_AdventureDetails"; + opcode_map[0x02a9] = "LiveOP_LDoNButton"; + opcode_map[0x02ba] = "LiveOP_AdventureData"; + opcode_map[0x02c9] = "LiveOP_AdventureFinish"; + opcode_map[0x02c6] = "LiveOP_LeaveAdventure"; + opcode_map[0x02ce] = "LiveOP_AdventureUpdate"; + opcode_map[0x002b] = "LiveOP_SendExpZonein"; + opcode_map[0x01e4] = "LiveOP_ZoneInSendName"; + opcode_map[0x01bf] = "LiveOP_GuildLeader"; + opcode_map[0x009a] = "LiveOP_GuildPeace"; + opcode_map[0x0132] = "LiveOP_GuildRemove"; + opcode_map[0x0059] = "LiveOP_GuildMemberList"; + opcode_map[0x026e] = "LiveOP_GuildMemberUpdate"; + opcode_map[0x0130] = "LiveOP_GuildInvite"; + opcode_map[0x01c0] = "LiveOP_GuildMOTD"; + opcode_map[0x003c] = "LiveOP_GuildPublicNote"; + opcode_map[0x027e] = "LiveOP_GetGuildMOTD"; + opcode_map[0x0277] = "LiveOP_GuildDemote"; + opcode_map[0x0131] = "LiveOP_GuildInviteAccept"; + opcode_map[0x00a4] = "LiveOP_GuildWar"; + opcode_map[0x0133] = "LiveOP_GuildDelete"; + opcode_map[0x0233] = "LiveOP_GuildManageRemove"; + opcode_map[0x022d] = "LiveOP_GuildManageAdd"; + opcode_map[0x0039] = "LiveOP_GuildManageStatus"; + opcode_map[0x01e8] = "LiveOP_Trader"; + opcode_map[0x01e7] = "LiveOP_Bazaar"; + opcode_map[0x01c4] = "LiveOP_BecomeTrader"; + opcode_map[0x01f4] = "LiveOP_BazaarInspect"; + opcode_map[0x006e] = "LiveOP_TraderItemUpdate"; + opcode_map[0x017c] = "LiveOP_TraderDelItem"; + opcode_map[0x01eb] = "LiveOP_TraderShop"; + opcode_map[0x01ca] = "LiveOP_TraderBuy"; + opcode_map[0x01ac] = "LiveOP_PetCommands"; + opcode_map[0x0042] = "LiveOP_TradeSkillCombine"; + opcode_map[0x02e5] = "LiveOP_AugmentItem"; + opcode_map[0x0367] = "LiveOP_ItemName"; + opcode_map[0x02cd] = "LiveOP_ShopItem"; + opcode_map[0x0065] = "LiveOP_ShopPlayerBuy"; + opcode_map[0x006a] = "LiveOP_ShopPlayerSell"; + opcode_map[0x006d] = "LiveOP_ShopDelItem"; + opcode_map[0x0f6d] = "LiveOP_ShopEndConfirm"; + opcode_map[0x00f7] = "LiveOP_ShopRequest"; + opcode_map[0x006c] = "LiveOP_ShopEnd"; + opcode_map[0x02d1] = "LiveOP_AdventureMerchantRequest"; + opcode_map[0x02d2] = "LiveOP_AdventureMerchantResponse"; + opcode_map[0x02d3] = "LiveOP_AdventureMerchantPurchase"; + opcode_map[0x02e3] = "LiveOP_AdventurePointsUpdate"; + opcode_map[0x0270] = "LiveOP_LFGCommand"; + opcode_map[0x01d0] = "LiveOP_LFGAppearance"; + opcode_map[0x01b5] = "LiveOP_MoneyUpdate"; + opcode_map[0x0721] = "LiveOP_GroupDelete"; + opcode_map[0x0272] = "LiveOP_GroupAcknowledge"; + opcode_map[0x024a] = "LiveOP_GroupUpdate"; + opcode_map[0x025f] = "LiveOP_GroupInvite"; + opcode_map[0x00ff] = "LiveOP_GroupDisband"; + opcode_map[0x00d5] = "LiveOP_GroupInvite2"; + opcode_map[0x025e] = "LiveOP_GroupFollow"; + opcode_map[0x00d7] = "LiveOP_GroupFollow2"; + opcode_map[0x00d6] = "LiveOP_GroupCancelInvite"; + opcode_map[0x0156] = "LiveOP_Split"; + opcode_map[0x00d8] = "LiveOP_Jump"; + opcode_map[0x01d6] = "LiveOP_ConsiderCorpse"; + opcode_map[0x0064] = "LiveOP_SkillUpdate"; + opcode_map[0x0178] = "LiveOP_GMEndTrainingResponse"; + opcode_map[0x013c] = "LiveOP_GMEndTraining"; + opcode_map[0x0175] = "LiveOP_GMTrainSkill"; + opcode_map[0x013b] = "LiveOP_GMTraining"; + opcode_map[0x017b] = "LiveOP_ConsumeAmmo"; + opcode_map[0x0171] = "LiveOP_CombatAbility"; + opcode_map[0x009c] = "LiveOP_TrackUnknown"; + opcode_map[0x0234] = "LiveOP_TrackTarget"; + opcode_map[0x0286] = "LiveOP_Track"; + opcode_map[0x0297] = "LiveOP_ReadBook"; + opcode_map[0x001f] = "LiveOP_ItemLinkClick"; + opcode_map[0x01f4] = "LiveOP_ItemLinkResponse"; + opcode_map[0x01d9] = "LiveOP_ItemLinkText"; + opcode_map[0x0a41] = "LiveOP_RezzRequest"; + opcode_map[0x00e5] = "LiveOP_RezzAnswer"; + opcode_map[0x019b] = "LiveOP_RezzComplete"; + opcode_map[0x0128] = "LiveOP_MoveDoor"; + opcode_map[0x0127] = "LiveOP_ClickDoor"; + opcode_map[0x0247] = "LiveOP_SendZonepoints"; + opcode_map[0x008c] = "LiveOP_SetRunMode"; + opcode_map[0x0248] = "LiveOP_InspectRequest"; + opcode_map[0x0249] = "LiveOP_InspectAnswer"; + opcode_map[0x0187] = "LiveOP_SenseTraps"; + opcode_map[0x018e] = "LiveOP_DisarmTraps"; + opcode_map[0x01bc] = "LiveOP_Assist"; + opcode_map[0x0240] = "LiveOP_PickPocket"; + opcode_map[0x0119] = "LiveOP_LootRequest"; + opcode_map[0x011a] = "LiveOP_EndLootRequest"; + opcode_map[0x011b] = "LiveOP_MoneyOnCorpse"; + opcode_map[0x0179] = "LiveOP_LootComplete"; + opcode_map[0x013f] = "LiveOP_LootItem"; + opcode_map[0x0151] = "LiveOP_MoveItem"; + opcode_map[0x0056] = "LiveOP_WhoAllRequest"; + opcode_map[0x0229] = "LiveOP_WhoAllResponse"; + opcode_map[0x0167] = "LiveOP_Consume"; + opcode_map[0x0172] = "LiveOP_AutoAttack"; + opcode_map[0x0186] = "LiveOP_AutoAttack2"; + opcode_map[0x0173] = "LiveOP_TargetMouse"; + opcode_map[0x01ba] = "LiveOP_TargetCommand"; + opcode_map[0x01d8] = "LiveOP_TargetReject"; + opcode_map[0x009e] = "LiveOP_Hide"; + opcode_map[0x012e] = "LiveOP_Forage"; + opcode_map[0x0077] = "LiveOP_Fishing"; + opcode_map[0x0246] = "LiveOP_Bug"; + opcode_map[0x00f2] = "LiveOP_Emote"; + opcode_map[0x0140] = "LiveOP_EmoteAnim"; + opcode_map[0x015c] = "LiveOP_Consider"; + opcode_map[0x01cb] = "LiveOP_FaceChange"; + opcode_map[0x0197] = "LiveOP_RandomReq"; + opcode_map[0x0087] = "LiveOP_RandomReply"; + opcode_map[0x01c3] = "LiveOP_Camp"; + opcode_map[0x0192] = "LiveOP_YellForHelp"; + opcode_map[0x00ef] = "LiveOP_SafePoint"; + opcode_map[0x0157] = "LiveOP_Buff"; + opcode_map[0x00c0] = "LiveOP_ColoredText"; + opcode_map[0x0440] = "LiveOP_MultiLineMsg"; + opcode_map[0x021c] = "LiveOP_SpecialMesg"; + opcode_map[0x0013] = "LiveOP_Consent"; + opcode_map[0x029d] = "LiveOP_ConsentResponse"; + opcode_map[0x02d4] = "LiveOP_Deny"; + opcode_map[0x016c] = "LiveOP_Stun"; + opcode_map[0x0021] = "LiveOP_BeginCast"; + opcode_map[0x00be] = "LiveOP_CastSpell"; + opcode_map[0x01a8] = "LiveOP_InterruptCast"; + opcode_map[0x0105] = "LiveOP_Death"; + opcode_map[0x023f] = "LiveOP_FeignDeath"; + opcode_map[0x012b] = "LiveOP_Illusion"; + opcode_map[0x0078] = "LiveOP_LevelUpdate"; + opcode_map[0x0371] = "LiveOP_LevelAppearance"; + opcode_map[0x00c2] = "LiveOP_MemorizeSpell"; + opcode_map[0x0244] = "LiveOP_HPUpdate"; + opcode_map[0x022e] = "LiveOP_SendHPTarget"; + opcode_map[0x007d] = "LiveOP_Mend"; + opcode_map[0x0160] = "LiveOP_Taunt"; + opcode_map[0x0199] = "LiveOP_GMDelCorpse"; + opcode_map[0x0047] = "LiveOP_GMFind"; + opcode_map[0x0020] = "LiveOP_GMServers"; + opcode_map[0x010b] = "LiveOP_GMGoto"; + opcode_map[0x028c] = "LiveOP_GMSummon"; + opcode_map[0x010a] = "LiveOP_GMKick"; + opcode_map[0x0109] = "LiveOP_GMKill"; + opcode_map[0x0b40] = "LiveOP_GMNameChange"; + opcode_map[0x00a3] = "LiveOP_GMLastName"; + opcode_map[0x01b3] = "LiveOP_GMToggle"; + opcode_map[0x028f] = "LiveOP_GMEmoteZone"; + opcode_map[0x0074] = "LiveOP_GMBecomeNPC"; + opcode_map[0x00de] = "LiveOP_GMHideMe"; + opcode_map[0x0184] = "LiveOP_GMZoneRequest"; + opcode_map[0x0239] = "LiveOP_GMZoneRequest2"; + opcode_map[0x0068] = "LiveOP_Petition"; + opcode_map[0x0085] = "LiveOP_PetitionRefresh"; + opcode_map[0x01ee] = "LiveOP_PDeletePetition"; + opcode_map[0x0092] = "LiveOP_PetitionBug"; + opcode_map[0x0069] = "LiveOP_PetitionUpdate"; + opcode_map[0x0076] = "LiveOP_PetitionCheckout"; + opcode_map[0x0056] = "LiveOP_PetitionCheckout2"; + opcode_map[0x0091] = "LiveOP_PetitionDelete"; + opcode_map[0x02b4] = "LiveOP_PetitionResolve"; + opcode_map[0x007e] = "LiveOP_PetitionCheckIn"; + opcode_map[0x0090] = "LiveOP_PetitionUnCheckout"; + opcode_map[0x01ec] = "LiveOP_PetitionQue"; + opcode_map[0x01bb] = "LiveOP_SetServerFilter"; + opcode_map[0x0218] = "LiveOP_NewSpawn"; + opcode_map[0x0140] = "LiveOP_Animation"; + opcode_map[0x0142] = "LiveOP_ZoneChange"; + opcode_map[0x00f3] = "LiveOP_DeleteSpawn"; + opcode_map[0x0265] = "LiveOP_CrashDump"; + opcode_map[0x00e8] = "LiveOP_EnvDamage"; + opcode_map[0x0101] = "LiveOP_Action"; + opcode_map[0x00e2] = "LiveOP_Damage"; + opcode_map[0x00bf] = "LiveOP_ManaChange"; + opcode_map[0x027c] = "LiveOP_ClientError"; + opcode_map[0x00fb] = "LiveOP_Save"; + opcode_map[0x0316] = "LiveOP_LocInfo"; + opcode_map[0x0188] = "LiveOP_Surname"; + opcode_map[0x018f] = "LiveOP_SwapSpell"; + opcode_map[0x01db] = "LiveOP_DeleteSpell"; + opcode_map[0x029f] = "LiveOP_CloseContainer"; + opcode_map[0x029f] = "LiveOP_ClickObjectAck"; + opcode_map[0x00fa] = "LiveOP_CreateObject"; + opcode_map[0x00f9] = "LiveOP_ClickObject"; + opcode_map[0x01c1] = "LiveOP_ClearObject"; + opcode_map[0x0265] = "LiveOP_ZoneUnavail"; + opcode_map[0x02e0] = "LiveOP_ItemPacket"; + opcode_map[0x029a] = "LiveOP_TradeRequest"; + opcode_map[0x0037] = "LiveOP_TradeRequestAck"; + opcode_map[0x002d] = "LiveOP_TradeAcceptClick"; + opcode_map[0x0162] = "LiveOP_TradeMoneyUpdate"; + opcode_map[0x0036] = "LiveOP_TradeCoins"; + opcode_map[0x002e] = "LiveOP_CancelTrade"; + opcode_map[0x002f] = "LiveOP_FinishTrade"; + opcode_map[0x00a1] = "LiveOP_SaveOnZoneReq"; + opcode_map[0x0185] = "LiveOP_Logout"; + opcode_map[0x0298] = "LiveOP_RequestDuel"; + opcode_map[0x0a5d] = "LiveOP_DuelResponse"; + opcode_map[0x016e] = "LiveOP_DuelResponse2"; + opcode_map[0x007c] = "LiveOP_InstillDoubt"; + opcode_map[0x00ac] = "LiveOP_SafeFallSuccess"; + opcode_map[0x02fb] = "LiveOP_DisciplineUpdate"; + opcode_map[0x02f2] = "LiveOP_TributeUpdate"; + opcode_map[0x02f3] = "LiveOP_TributeItem"; + opcode_map[0x02f4] = "LiveOP_TributePointUpdate"; + opcode_map[0x02f5] = "LiveOP_SendTributes"; + opcode_map[0x02f6] = "LiveOP_TributeInfo"; + opcode_map[0x02f7] = "LiveOP_SelectTribute"; + opcode_map[0x02f8] = "LiveOP_TributeTimer"; + opcode_map[0x02f9] = "LiveOP_StartTribute"; + opcode_map[0x02fa] = "LiveOP_TributeNPC"; + opcode_map[0x02fe] = "LiveOP_TributeMoney"; + opcode_map[0x0364] = "LiveOP_TributeToggle"; + opcode_map[0x0322] = "LiveOP_RecipesFavorite"; + opcode_map[0x01f9] = "LiveOP_RecipesSearch"; + opcode_map[0x01fa] = "LiveOP_RecipeReply"; + opcode_map[0x01fb] = "LiveOP_RecipeDetails"; + opcode_map[0x01fc] = "LiveOP_RecipeAutoCombine"; + opcode_map[0x02db] = "LiveOP_FindPersonRequest"; + opcode_map[0x02dc] = "LiveOP_FindPersonReply"; + opcode_map[0x01dd] = "LiveOP_Shielding"; + opcode_map[0x0198] = "LiveOP_SetDataRate"; + opcode_map[0x023b] = "LiveOP_ZoneEntry"; + opcode_map[0x006b] = "LiveOP_PlayerProfile"; + opcode_map[0x0291] = "LiveOP_CharInventory"; + opcode_map[0x0170] = "LiveOP_ZoneSpawns"; + opcode_map[0x0026] = "LiveOP_TimeOfDay"; + opcode_map[0x015b] = "LiveOP_Weather"; + opcode_map[0x00ec] = "LiveOP_ReqNewZone"; + opcode_map[0x00eb] = "LiveOP_NewZone"; + opcode_map[0x00fd] = "LiveOP_ReqClientSpawn"; + opcode_map[0x012F] = "LiveOP_SpawnAppearance"; + opcode_map[0x0086] = "LiveOP_ClientReady"; + opcode_map[0x0086] = "LiveOP_ZoneComplete"; + opcode_map[0x02db] = "LiveOP_LoginComplete"; + opcode_map[0x0195] = "LiveOP_ApproveWorld"; + opcode_map[0x035f] = "LiveOP_LogServer"; + opcode_map[0x01b2] = "LiveOP_MOTD"; + opcode_map[0x0251] = "LiveOP_SendLoginInfo"; + opcode_map[0x00ea] = "LiveOP_DeleteCharacter"; + opcode_map[0x0102] = "LiveOP_SendCharInfo"; + opcode_map[0x00e1] = "LiveOP_ExpansionInfo"; + opcode_map[0x0104] = "LiveOP_CharacterCreate"; + opcode_map[0x02ab] = "LiveOP_RandomNameGenerator"; + opcode_map[0x005d] = "LiveOP_GuildsList"; + opcode_map[0x0125] = "LiveOP_ApproveName"; + opcode_map[0x0261] = "LiveOP_EnterWorld"; + opcode_map[0x015a] = "LiveOP_World_Client_CRC1"; + opcode_map[0x015e] = "LiveOP_World_Client_CRC2"; + opcode_map[0x0269] = "LiveOP_SetChatServer"; + opcode_map[0x0264] = "LiveOP_ZoneServerInfo"; + opcode_map[0x0017] = "LiveOP_AckPacket"; + opcode_map[0x012c] = "LiveOP_WearChange"; + opcode_map[0x1FA1] = "LiveOP_WorldObjectsSent"; + opcode_map[0x39C4] = "LiveOP_BlockedBuffs"; + opcode_map[0x4656] = "LiveOP_SpawnPositionUpdate"; + opcode_map[0x4b61] = "LiveOP_ManaUpdate"; + opcode_map[0x02d6] = "LiveOP_EnduranceUpdate"; + opcode_map[0x2ac1] = "LiveOP_MobManaUpdate"; + opcode_map[0x6c5f] = "LiveOP_MobEnduranceUpdate"; + opcode_map[0x73a8] = "LiveOP_SendMaxCharacters"; } From 5c903c6ee343b104adb1bcd9c41b808ccac260b9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:25:46 -0600 Subject: [PATCH 0629/1883] opcodemgr.cpp cleanup --- common/opcodemgr.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/common/opcodemgr.cpp b/common/opcodemgr.cpp index 6e524bfa5..f7a6ad3bf 100644 --- a/common/opcodemgr.cpp +++ b/common/opcodemgr.cpp @@ -15,15 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" -#include -#include "opcodemgr.h" -#include "debug.h" -#include "emu_opcodes.h" -#include -#include +#include "emu_opcodes.h" +#include "opcodemgr.h" + +#include #include +#include #include OpcodeManager::OpcodeManager() { From 1c665653eacd2565eef64053cc475eee19793d58 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:26:58 -0600 Subject: [PATCH 0630/1883] packet_dump cleanup --- common/packet_dump.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/packet_dump.cpp b/common/packet_dump.cpp index 6bb412f6b..3c9dfab4f 100644 --- a/common/packet_dump.cpp +++ b/common/packet_dump.cpp @@ -15,13 +15,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" + #include #include #include #include "packet_dump.h" -#include "eq_packet.h" #include "../common/servertalk.h" void DumpPacketAscii(const uchar* buf, uint32 size, uint32 cols, uint32 skip) { From fab6b602a82c886e3a0f5e37f92ac7c3d1094f62 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:28:15 -0600 Subject: [PATCH 0631/1883] packet_dump_file cleanup --- common/packet_dump_file.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/packet_dump_file.cpp b/common/packet_dump_file.cpp index 32aa7d984..95a72bb60 100644 --- a/common/packet_dump_file.cpp +++ b/common/packet_dump_file.cpp @@ -15,16 +15,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include + #include "../common/debug.h" + +#include +#include +#include #include + //#ifdef _CRTDBG_MAP_ALLOC // #undef new // #define new new(_NORMAL_BLOCK, __FILE__, __LINE__) //#endif -#include #include #ifdef _WINDOWS From 62d8fb538b22e1827e0c39f6c7fd812657da0d7a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:42:19 -0600 Subject: [PATCH 0632/1883] ptimer.cpp header include cleanup --- common/ptimer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/ptimer.cpp b/common/ptimer.cpp index c9b25b1a5..b39f37a04 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -15,15 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "debug.h" #include "timer.h" #include "ptimer.h" #include "database.h" #include "string_util.h" -#include -#include -#include #ifdef _WINDOWS #include From 689f95b430b2f7ae229c10c5d2cb9698455cf02f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:42:34 -0600 Subject: [PATCH 0633/1883] shareddb.cpp & .h header include cleanup --- common/shareddb.cpp | 20 ++--- common/shareddb.h | 194 +++++++++++++++++++++++--------------------- 2 files changed, 109 insertions(+), 105 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 4ba16b441..d0f89658a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -3,22 +3,20 @@ #include #include -#include "shareddb.h" -#include "mysql.h" -#include "item.h" #include "classes.h" -#include "rulesys.h" -#include "seperator.h" -#include "string_util.h" #include "eq_packet_structs.h" -#include "guilds.h" -#include "extprofile.h" -#include "memory_mapped_file.h" -#include "ipc_mutex.h" #include "eqemu_exception.h" -#include "loottable.h" #include "faction.h" #include "features.h" +#include "guilds.h" +#include "ipc_mutex.h" +#include "item.h" +#include "loottable.h" +#include "memory_mapped_file.h" +#include "mysql.h" +#include "rulesys.h" +#include "shareddb.h" +#include "string_util.h" SharedDatabase::SharedDatabase() : Database(), skill_caps_mmf(nullptr), items_mmf(nullptr), items_hash(nullptr), faction_mmf(nullptr), faction_hash(nullptr), diff --git a/common/shareddb.h b/common/shareddb.h index 5f0707054..073c385e8 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -6,128 +6,134 @@ #include "database.h" #include "skills.h" #include "spdat.h" -#include "item.h" #include "base_data.h" #include "fixed_memory_hash_set.h" #include "fixed_memory_variable_hash_set.h" #include - +class EvolveInfo; +class Inventory; +class ItemInst; +struct BaseDataStruct; +struct InspectMessage_Struct; +struct PlayerProfile_Struct; +struct SPDat_Spell_Struct; struct Item_Struct; struct NPCFactionList; -struct Faction; struct LootTable_Struct; struct LootDrop_Struct; -namespace EQEmu { +namespace EQEmu +{ class MemoryMappedFile; } /* - * This object is inherited by world and zone's DB object, - * and is mainly here to facilitate shared memory, and other - * things which only world and zone need. - */ -class SharedDatabase : public Database { -public: - SharedDatabase(); - SharedDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port); - virtual ~SharedDatabase(); + This object is inherited by world and zone's DB object, + and is mainly here to facilitate shared memory, and other + things which only world and zone need. +*/ +class SharedDatabase : public Database +{ + public: + SharedDatabase(); + SharedDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port); + virtual ~SharedDatabase(); - /* - * General Character Related Stuff - */ - bool SetGMSpeed(uint32 account_id, uint8 gmspeed); - uint8 GetGMSpeed(uint32 account_id); - bool SetHideMe(uint32 account_id, uint8 hideme); - int32 DeleteStalePlayerCorpses(); - void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message); - void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message); - void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message); - void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message); - bool GetCommandSettings(std::map &commands); - uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID); + /* + General Character Related Stuff + */ + bool SetGMSpeed(uint32 account_id, uint8 gmspeed); + uint8 GetGMSpeed(uint32 account_id); + bool SetHideMe(uint32 account_id, uint8 hideme); + int32 DeleteStalePlayerCorpses(); + void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message); + void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message); + void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message); + void SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message); + bool GetCommandSettings(std::map &commands); + uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID); - /* - * Character Inventory - */ - bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); - bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id); - bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id); - bool DeleteInventorySlot(uint32 char_id, int16 slot_id); - bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id); - bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id); - bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); - bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); - int32 GetSharedPlatinum(uint32 account_id); - bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); - bool GetInventory(uint32 char_id, Inventory* inv); - bool GetInventory(uint32 account_id, char* name, Inventory* inv); - bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); + /* + Character Inventory + */ + bool SaveCursor(uint32 char_id, std::list::const_iterator &start, std::list::const_iterator &end); + bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id); + bool DeleteInventorySlot(uint32 char_id, int16 slot_id); + bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id); + bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst); + bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid); + int32 GetSharedPlatinum(uint32 account_id); + bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); + bool GetInventory(uint32 char_id, Inventory* inv); + bool GetInventory(uint32 account_id, char* name, Inventory* inv); + bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin); - std::string GetBook(const char *txtfile); + std::string GetBook(const char *txtfile); - /* - * Item Methods - */ - ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateItem(const Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); - ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges=0); + /* + Item Methods + */ + ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + ItemInst* CreateItem(const Item_Struct* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0); + ItemInst* CreateBaseItem(const Item_Struct* item, int16 charges = 0); - /* - * Shared Memory crap - */ + /* + Shared Memory crap + */ - //items - void GetItemsCount(int32 &item_count, uint32 &max_id); - void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); - bool LoadItems(); - const Item_Struct* IterateItems(uint32* id); - const Item_Struct* GetItem(uint32 id); - const EvolveInfo* GetEvolveInfo(uint32 loregroup); + //items + void GetItemsCount(int32 &item_count, uint32 &max_id); + void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id); + bool LoadItems(); + const Item_Struct* IterateItems(uint32* id); + const Item_Struct* GetItem(uint32 id); + const EvolveInfo* GetEvolveInfo(uint32 loregroup); - //faction lists - void GetFactionListInfo(uint32 &list_count, uint32 &max_lists); - const NPCFactionList* GetNPCFactionEntry(uint32 id); - void LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists); - bool LoadNPCFactionLists(); + //faction lists + void GetFactionListInfo(uint32 &list_count, uint32 &max_lists); + const NPCFactionList* GetNPCFactionEntry(uint32 id); + void LoadNPCFactionLists(void *data, uint32 size, uint32 list_count, uint32 max_lists); + bool LoadNPCFactionLists(); - //loot - void GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries); - void GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries); - void LoadLootTables(void *data, uint32 size); - void LoadLootDrops(void *data, uint32 size); - bool LoadLoot(); - const LootTable_Struct* GetLootTable(uint32 loottable_id); - const LootDrop_Struct* GetLootDrop(uint32 lootdrop_id); + //loot + void GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot_table, uint32 &loot_table_entries); + void GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries); + void LoadLootTables(void *data, uint32 size); + void LoadLootDrops(void *data, uint32 size); + bool LoadLoot(); + const LootTable_Struct* GetLootTable(uint32 loottable_id); + const LootDrop_Struct* GetLootDrop(uint32 lootdrop_id); - void LoadSkillCaps(void *data); - bool LoadSkillCaps(); - uint16 GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Level); - uint8 GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Level); + void LoadSkillCaps(void *data); + bool LoadSkillCaps(); + uint16 GetSkillCap(uint8 Class_, SkillUseTypes Skill, uint8 Level); + uint8 GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Level); - int GetMaxSpellID(); - void LoadSpells(void *data, int max_spells); - void LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID); + int GetMaxSpellID(); + void LoadSpells(void *data, int max_spells); + void LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID); - int GetMaxBaseDataLevel(); - bool LoadBaseData(); - void LoadBaseData(void *data, int max_level); - const BaseDataStruct* GetBaseData(int lvl, int cl); + int GetMaxBaseDataLevel(); + bool LoadBaseData(); + void LoadBaseData(void *data, int max_level); + const BaseDataStruct* GetBaseData(int lvl, int cl); -protected: + protected: - EQEmu::MemoryMappedFile *skill_caps_mmf; - EQEmu::MemoryMappedFile *items_mmf; - EQEmu::FixedMemoryHashSet *items_hash; - EQEmu::MemoryMappedFile *faction_mmf; - EQEmu::FixedMemoryHashSet *faction_hash; - EQEmu::MemoryMappedFile *loot_table_mmf; - EQEmu::FixedMemoryVariableHashSet *loot_table_hash; - EQEmu::MemoryMappedFile *loot_drop_mmf; - EQEmu::FixedMemoryVariableHashSet *loot_drop_hash; - EQEmu::MemoryMappedFile *base_data_mmf; + EQEmu::MemoryMappedFile *skill_caps_mmf; + EQEmu::MemoryMappedFile *items_mmf; + EQEmu::FixedMemoryHashSet *items_hash; + EQEmu::MemoryMappedFile *faction_mmf; + EQEmu::FixedMemoryHashSet *faction_hash; + EQEmu::MemoryMappedFile *loot_table_mmf; + EQEmu::FixedMemoryVariableHashSet *loot_table_hash; + EQEmu::MemoryMappedFile *loot_drop_mmf; + EQEmu::FixedMemoryVariableHashSet *loot_drop_hash; + EQEmu::MemoryMappedFile *base_data_mmf; }; #endif /*SHAREDDB_H_*/ From 12206c0e501c31c0f37b6b150a9d377e651f2f35 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:42:44 -0600 Subject: [PATCH 0634/1883] races.cpp header include cleanup --- common/races.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/races.cpp b/common/races.cpp index d088ce185..6322b50af 100644 --- a/common/races.cpp +++ b/common/races.cpp @@ -15,8 +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 */ -#include "../common/debug.h" -#include "../common/eq_packet_structs.h" + #include "../common/races.h" const char* GetRaceName(uint16 race) { From f3ebb2e5d8afafae99546c90ae464c1f54e39039 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:42:59 -0600 Subject: [PATCH 0635/1883] rdtsc.cpp header include cleanup --- common/rdtsc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/rdtsc.cpp b/common/rdtsc.cpp index 1d66c0254..53962f1d5 100644 --- a/common/rdtsc.cpp +++ b/common/rdtsc.cpp @@ -15,10 +15,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" + #include "rdtsc.h" #include "types.h" -#include #ifdef _WINDOWS #include From b687fb2439729b26d08816921eea3ce1ad315849 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:43:58 -0600 Subject: [PATCH 0636/1883] shareddb.cpp header include cleanup --- common/shareddb.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d0f89658a..cd8fd49e0 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1,14 +1,11 @@ #include #include -#include -#include #include "classes.h" #include "eq_packet_structs.h" #include "eqemu_exception.h" #include "faction.h" #include "features.h" -#include "guilds.h" #include "ipc_mutex.h" #include "item.h" #include "loottable.h" From a55b2ca5577543f85342fe49b12626447a158641 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:45:37 -0600 Subject: [PATCH 0637/1883] spdat.cpp header include cleanup --- common/spdat.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/spdat.cpp b/common/spdat.cpp index 3f8ae4849..8bceec249 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -70,15 +70,12 @@ */ -#include "debug.h" -#include "spdat.h" -#include "packet_dump.h" -#include "moremath.h" -#include "item.h" -#include "skills.h" -#include "bodytypes.h" +#include "../common/logsys.h" +#include "../common/logtypes.h" + #include "classes.h" -#include +#include "spdat.h" + #ifndef WIN32 #include #include "unix.h" From 40377447acf06db3af2122cef986330ebb06c0d5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:47:48 -0600 Subject: [PATCH 0638/1883] string_util.cpp & .h header include cleanup --- common/skills.cpp | 1 + common/string_util.cpp | 3 --- common/string_util.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/common/skills.cpp b/common/skills.cpp index 24a32196e..ceb726d8c 100644 --- a/common/skills.cpp +++ b/common/skills.cpp @@ -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 */ + #include "types.h" #include "skills.h" diff --git a/common/string_util.cpp b/common/string_util.cpp index 2fcb59e05..63da1b08c 100644 --- a/common/string_util.cpp +++ b/common/string_util.cpp @@ -16,9 +16,6 @@ #include "string_util.h" -#include // for strncpy -#include - #ifdef _WINDOWS #include diff --git a/common/string_util.h b/common/string_util.h index 34f08b5e2..31ba4c587 100644 --- a/common/string_util.h +++ b/common/string_util.h @@ -19,7 +19,6 @@ #include #include #include -#include #include "types.h" From 6b485273d19b1ed8114437aa020a1774ca49da2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:50:33 -0600 Subject: [PATCH 0639/1883] tcp_connection.cpp & .h header include cleanup --- common/tcp_connection.cpp | 5 +---- common/tcp_connection.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index ea57a6301..890a46adc 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -15,17 +15,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../common/debug.h" #include #include -#include #include #include "tcp_connection.h" -#include "../common/servertalk.h" -#include "../common/timer.h" -#include "../common/packet_dump.h" #ifdef FREEBSD //Timothy Whitman - January 7, 2003 #define MSG_NOSIGNAL 0 diff --git a/common/tcp_connection.h b/common/tcp_connection.h index 2e5b7e883..db38c941b 100644 --- a/common/tcp_connection.h +++ b/common/tcp_connection.h @@ -48,8 +48,6 @@ #include "queue.h" #include "misc_functions.h" -class BaseTCPServer; -class ServerPacket; #define TCPConnection_ErrorBufferSize 1024 #define MaxTCPReceiveBuffferSize 524288 From f4609101d50c3c1d5cd51769287cfb09b500070c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:52:03 -0600 Subject: [PATCH 0640/1883] tcp_server.cpp include header cleanup --- common/tcp_server.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index 415f76fa1..e424947d2 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -1,8 +1,6 @@ #include "debug.h" #include "tcp_server.h" #include -#include -#include #ifdef _WINDOWS #include From ef3d4ae51a7d1a6fdb719188542a940f696c47a7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:56:29 -0600 Subject: [PATCH 0641/1883] string_util linux build fix --- common/string_util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/string_util.h b/common/string_util.h index 31ba4c587..70e888bdf 100644 --- a/common/string_util.h +++ b/common/string_util.h @@ -17,8 +17,10 @@ #define _STRINGUTIL_H_ #include +#include #include #include + #include "types.h" From 25ee643aeb364b2ac4a5c599cab47b8d1ccb7f43 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:56:44 -0600 Subject: [PATCH 0642/1883] timer.cpp include header cleanup --- common/timer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/timer.cpp b/common/timer.cpp index eb6a081c2..c1c94a7f6 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -15,7 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" + + // Disgrace: for windows compile #ifndef WIN32 #include @@ -23,8 +24,6 @@ #include #endif -#include - #include "timer.h" uint32 current_time = 0; From 5b49ecf07244ee7b5c9e53695af42d397c08bca3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 22:56:55 -0600 Subject: [PATCH 0643/1883] worldconn.cpp header include cleanup --- common/worldconn.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/common/worldconn.cpp b/common/worldconn.cpp index 73946d6f5..d43009b23 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -17,18 +17,11 @@ */ #include "../common/debug.h" -#include -#include -#include #include -#include -#include -#include #include "worldconn.h" #include "eqemu_config.h" #include "md5.h" -#include "database.h" #include "servertalk.h" WorldConnection::WorldConnection(EmuTCPConnection::ePacketMode mode, const char *password) From 0b89c95ab2eaea9ee9ff32d8c9ddd05735a2fb74 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 23:00:29 -0600 Subject: [PATCH 0644/1883] tcp_server.cpp linux build fix for not fake --- common/tcp_server.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index e424947d2..f99fb256d 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -1,6 +1,9 @@ #include "debug.h" #include "tcp_server.h" + #include +#include +#include #ifdef _WINDOWS #include From ad8e834fe8bd3aadd4a9c3de50d4c0b1733c040f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 15 Dec 2014 23:14:55 -0600 Subject: [PATCH 0645/1883] Dropping client 6.2 support --- common/CMakeLists.txt | 12 - common/eq_dictionary.cpp | 7 - common/eq_dictionary.h | 1 - common/patches/client62.cpp | 1341 ----------- common/patches/client62.h | 37 - common/patches/client62_constants.h | 212 -- common/patches/client62_itemfields.h | 166 -- common/patches/client62_ops.h | 54 - common/patches/client62_structs.h | 3163 -------------------------- common/patches/patches.cpp | 3 - utils/patches/patch_6.2.conf | 539 ----- world/clientlist.cpp | 6 +- zone/lua_general.cpp | 1 - zone/tasks.cpp | 14 - 14 files changed, 2 insertions(+), 5554 deletions(-) delete mode 100644 common/patches/client62.cpp delete mode 100644 common/patches/client62.h delete mode 100644 common/patches/client62_constants.h delete mode 100644 common/patches/client62_itemfields.h delete mode 100644 common/patches/client62_ops.h delete mode 100644 common/patches/client62_structs.h delete mode 100644 utils/patches/patch_6.2.conf diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 06547f418..d547c4c88 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -67,7 +67,6 @@ SET(common_sources worldconn.cpp xml_parser.cpp platform.cpp - patches/client62.cpp patches/patches.cpp patches/sod.cpp patches/sof.cpp @@ -193,11 +192,6 @@ SET(common_headers worldconn.h xml_parser.h zone_numbers.h - patches/client62.h - patches/client62_constants.h - patches/client62_itemfields.h - patches/client62_ops.h - patches/client62_structs.h patches/patches.h patches/sod.h patches/sod_constants.h @@ -251,11 +245,6 @@ SET(common_headers ) SOURCE_GROUP(Patches FILES - patches/client62.h - patches/client62_itemfields.h - patches/client62_ops.h - patches/client62_constants.h - patches/client62_structs.h patches/patches.h patches/sod.h patches/sod_itemfields.h @@ -291,7 +280,6 @@ SOURCE_GROUP(Patches FILES patches/underfoot_ops.h patches/underfoot_constants.h patches/underfoot_structs.h - patches/client62.cpp patches/patches.cpp patches/sod.cpp patches/sof.cpp diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 3756ca8fe..37414853e 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -548,7 +548,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBank] /*Unknown*/ NOT_USED, -/*62*/ Client62::consts::MAP_BANK_SIZE, /*Titanium*/ Titanium::consts::MAP_BANK_SIZE, /*SoF*/ EmuConstants::MAP_BANK_SIZE, /*SoD*/ EmuConstants::MAP_BANK_SIZE, @@ -698,7 +697,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapCorpse] /*Unknown*/ NOT_USED, -/*62*/ Client62::consts::MAP_CORPSE_SIZE, /*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE, /*SoF*/ SoF::consts::MAP_CORPSE_SIZE, /*SoD*/ SoD::consts::MAP_CORPSE_SIZE, @@ -728,7 +726,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapInspect] /*Unknown*/ NOT_USED, -/*62*/ Client62::consts::MAP_INSPECT_SIZE, /*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE, /*SoF*/ SoF::consts::MAP_INSPECT_SIZE, /*SoD*/ SoD::consts::MAP_INSPECT_SIZE, @@ -1006,7 +1003,6 @@ uint64 EQLimits::CursorBitmask(uint32 version) { bool EQLimits::AllowsEmptyBagInBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, -/*62*/ Client62::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, @@ -1027,8 +1023,6 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { bool EQLimits::AllowsClickCastFromBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, -/*62*/ Client62::limits::ALLOWS_CLICK_CAST_FROM_BAG, -/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*Underfoot*/ Underfoot::limits::ALLOWS_CLICK_CAST_FROM_BAG, @@ -1088,7 +1082,6 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { bool EQLimits::CoinHasWeight(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ true, -/*62*/ Client62::limits::COIN_HAS_WEIGHT, /*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, /*SoF*/ SoF::limits::COIN_HAS_WEIGHT, /*SoD*/ SoD::limits::COIN_HAS_WEIGHT, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index a17ade924..43511072f 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "eq_constants.h" #include "clientversions.h" #include -#include "../common/patches/client62_constants.h" #include "../common/patches/titanium_constants.h" #include "../common/patches/sof_constants.h" #include "../common/patches/sod_constants.h" diff --git a/common/patches/client62.cpp b/common/patches/client62.cpp deleted file mode 100644 index 102414b16..000000000 --- a/common/patches/client62.cpp +++ /dev/null @@ -1,1341 +0,0 @@ -#include "../debug.h" -#include "client62.h" -#include "../opcodemgr.h" -#include "../logsys.h" -#include "../eq_stream_ident.h" -#include "../crc32.h" - -#include "../eq_packet_structs.h" -#include "../misc_functions.h" -#include "../string_util.h" -#include "../item.h" -#include "../clientversions.h" -#include "client62_structs.h" - -namespace Client62 -{ - static const char *name = "6.2"; - static OpcodeManager *opcodes = nullptr; - static Strategy struct_strategy; - - char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth); - - // server to client inventory location converters - static inline int16 ServerToClient62Slot(uint32 ServerSlot); - static inline int16 ServerToClient62CorpseSlot(uint32 ServerCorpse); - - // client to server inventory location converters - static inline uint32 Client62ToServerSlot(int16 Client62Slot); - static inline uint32 Client62ToServerCorpseSlot(int16 Client62Corpse); - - void Register(EQStreamIdentifier &into) - { - //create our opcode manager if we havent already - if (opcodes == nullptr) { - //TODO: get this file name from the config file - std::string opfile = "patch_"; - opfile += name; - opfile += ".conf"; - //load up the opcode manager. - //TODO: figure out how to support shared memory with multiple patches... - opcodes = new RegularOpcodeManager(); - if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); - return; - } - } - - //ok, now we have what we need to register. - - EQStream::Signature signature; - std::string pname; - - //register our world signature. - pname = std::string(name) + "_world"; - signature.ignore_eq_opcode = 0; - signature.first_length = sizeof(structs::LoginInfo_Struct); - signature.first_eq_opcode = opcodes->EmuToEQ(OP_SendLoginInfo); - into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - //register our zone signature. - pname = std::string(name) + "_zone"; - signature.ignore_eq_opcode = opcodes->EmuToEQ(OP_AckPacket); - signature.first_length = sizeof(structs::ClientZoneEntry_Struct); - signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); - into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - _log(NET__IDENTIFY, "Registered patch %s", name); - } - - void Reload() - { - //we have a big problem to solve here when we switch back to shared memory - //opcode managers because we need to change the manager pointer, which means - //we need to go to every stream and replace it's manager. - - if (opcodes != nullptr) { - //TODO: get this file name from the config file - std::string opfile = "patch_"; - opfile += name; - opfile += ".conf"; - if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); - return; - } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); - } - } - - Strategy::Strategy() : StructStrategy() - { - //all opcodes default to passthrough. -#include "ss_register.h" -#include "client62_ops.h" - } - - std::string Strategy::Describe() const - { - std::string r; - r += "Patch "; - r += name; - return(r); - } - - const EQClientVersion Strategy::ClientVersion() const - { - return EQClient62; - } - -#include "ss_define.h" - -// ENCODE methods - EAT_ENCODE(OP_GuildMemberLevelUpdate); // added ; - - EAT_ENCODE(OP_ZoneServerReady); // added ; - - ENCODE(OP_Action) - { - ENCODE_LENGTH_EXACT(Action_Struct); - SETUP_DIRECT_ENCODE(Action_Struct, structs::Action_Struct); - - OUT(target); - OUT(source); - OUT(level); - OUT(instrument_mod); - OUT(sequence); - OUT(type); - //OUT(damage); - OUT(spell); - OUT(buff_unknown); // if this is 4, a buff icon is made - - FINISH_ENCODE(); - } - - ENCODE(OP_AdventureMerchantSell) - { - ENCODE_LENGTH_EXACT(Adventure_Sell_Struct); - SETUP_DIRECT_ENCODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); - - eq->unknown000 = 1; - OUT(npcid); - eq->slot = ServerToClient62Slot(emu->slot); - OUT(charges); - OUT(sell_price); - - FINISH_ENCODE(); - } - - ENCODE(OP_ApplyPoison) - { - ENCODE_LENGTH_EXACT(ApplyPoison_Struct); - SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); - - eq->inventorySlot = ServerToClient62Slot(emu->inventorySlot); - OUT(success); - - FINISH_ENCODE(); - } - - ENCODE(OP_BazaarSearch) - { - EQApplicationPacket *in = *p; - *p = nullptr; - - char *Buffer = (char *)in->pBuffer; - - uint8 SubAction = VARSTRUCT_DECODE_TYPE(uint8, Buffer); - - if (SubAction != BazaarSearchResults) - { - dest->FastQueuePacket(&in, ack_req); - - return; - } - - unsigned char *__emu_buffer = in->pBuffer; - - BazaarSearchResults_Struct *emu = (BazaarSearchResults_Struct *)__emu_buffer; - - int EntryCount = in->size / sizeof(BazaarSearchResults_Struct); - - if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) - { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); - delete in; - return; - } - in->size = EntryCount * sizeof(structs::BazaarSearchResults_Struct); - - in->pBuffer = new unsigned char[in->size]; - - memset(in->pBuffer, 0, in->size); - - structs::BazaarSearchResults_Struct *eq = (structs::BazaarSearchResults_Struct *)in->pBuffer; - - for (int i = 0; i < EntryCount; ++i, ++emu, ++eq) - { - OUT(Beginning.Action); - OUT(NumItems); - OUT(SerialNumber); - OUT(SellerID); - OUT(Cost); - OUT(ItemStat); - memcpy(eq->ItemName, emu->ItemName, sizeof(eq->ItemName)); - } - - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_BecomeTrader) - { - ENCODE_LENGTH_EXACT(BecomeTrader_Struct); - SETUP_DIRECT_ENCODE(BecomeTrader_Struct, structs::BecomeTrader_Struct); - - OUT(ID); - OUT(Code); - - FINISH_ENCODE(); - } - - ENCODE(OP_CharInventory) - { - //consume the packet - EQApplicationPacket *in = *p; - *p = nullptr; - - //store away the emu struct - unsigned char *__emu_buffer = in->pBuffer; - - int itemcount = in->size / sizeof(InternalSerializedItem_Struct); - if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); - delete in; - return; - } - InternalSerializedItem_Struct *eq = (InternalSerializedItem_Struct *)in->pBuffer; - - //do the transform... - int r; - std::string serial_string; - for (r = 0; r < itemcount; r++, eq++) { - uint32 length; - char *serialized = SerializeItem((ItemInst*)eq->inst, eq->slot_id, &length, 0); - if (serialized) { - serial_string.append(serialized, length + 1); - safe_delete_array(serialized); - } - else { - _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); - } - - } - - in->size = serial_string.length(); - in->pBuffer = new unsigned char[in->size]; - memcpy(in->pBuffer, serial_string.c_str(), serial_string.length()); - - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_DeleteCharge) { ENCODE_FORWARD(OP_MoveItem); } - - ENCODE(OP_DeleteItem) - { - ENCODE_LENGTH_EXACT(DeleteItem_Struct); - SETUP_DIRECT_ENCODE(DeleteItem_Struct, structs::DeleteItem_Struct); - - eq->from_slot = ServerToClient62Slot(emu->from_slot); - eq->to_slot = ServerToClient62Slot(emu->to_slot); - OUT(number_in_stack); - - FINISH_ENCODE(); - } - - ENCODE(OP_DeleteSpawn) - { - SETUP_DIRECT_ENCODE(DeleteSpawn_Struct, structs::DeleteSpawn_Struct); - - OUT(spawn_id); - - FINISH_ENCODE(); - } - - ENCODE(OP_GuildMemberList) - { - //consume the packet - EQApplicationPacket *in = *p; - *p = nullptr; - - //store away the emu struct - unsigned char *__emu_buffer = in->pBuffer; - Internal_GuildMembers_Struct *emu = (Internal_GuildMembers_Struct *)in->pBuffer; - - //make a new EQ buffer. - uint32 pnl = strlen(emu->player_name); - uint32 length = sizeof(structs::GuildMembers_Struct) + pnl + - emu->count * sizeof(structs::GuildMemberEntry_Struct) - + emu->name_length + emu->note_length; - in->pBuffer = new uint8[length]; - in->size = length; - //no memset since we fill every byte. - - uint8 *buffer; - buffer = in->pBuffer; - - //easier way to setup GuildMembers_Struct - //set prefix name - strcpy((char *)buffer, emu->player_name); - buffer += pnl; - *buffer = '\0'; - buffer++; - - //add member count. - *((uint32 *)buffer) = htonl(emu->count); - buffer += sizeof(uint32); - - if (emu->count > 0) { - Internal_GuildMemberEntry_Struct *emu_e = emu->member; - const char *emu_name = (const char *)(__emu_buffer + - sizeof(Internal_GuildMembers_Struct)+ //skip header - emu->count * sizeof(Internal_GuildMemberEntry_Struct) //skip static length member data - ); - const char *emu_note = (emu_name + - emu->name_length + //skip name contents - emu->count //skip string terminators - ); - - structs::GuildMemberEntry_Struct *e = (structs::GuildMemberEntry_Struct *) buffer; - - uint32 r; - for (r = 0; r < emu->count; r++, emu_e++) { - - //the order we set things here must match the struct - - //nice helper macro - /*#define SlideStructString(field, str) \ - strcpy(e->field, str.c_str()); \ - e = (GuildMemberEntry_Struct *) ( ((uint8 *)e) + str.length() )*/ -#define SlideStructString(field, str) \ - { \ - int sl = strlen(str); \ - memcpy(e->field, str, sl+1); \ - e = (structs::GuildMemberEntry_Struct *) ( ((uint8 *)e) + sl ); \ - str += sl + 1; \ - } -#define PutFieldN(field) e->field = htonl(emu_e->field) - - SlideStructString(name, emu_name); - PutFieldN(level); - PutFieldN(banker); - PutFieldN(class_); - PutFieldN(rank); - PutFieldN(time_last_on); - PutFieldN(tribute_enable); - PutFieldN(total_tribute); - PutFieldN(last_tribute); - SlideStructString(public_note, emu_note); - e->zoneinstance = 0; - e->zone_id = htons(emu_e->zone_id); -#undef SlideStructString -#undef PutFieldN - - e++; - } - } - - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_Illusion) - { - ENCODE_LENGTH_EXACT(Illusion_Struct); - SETUP_DIRECT_ENCODE(Illusion_Struct, structs::Illusion_Struct); - - OUT(spawnid); - OUT_str(charname); - - if (emu->race > 473) - eq->race = 1; - else - OUT(race); - - OUT(gender); - OUT(texture); - OUT(helmtexture); - OUT(face); - OUT(hairstyle); - OUT(haircolor); - OUT(beard); - OUT(beardcolor); - OUT(size); - - FINISH_ENCODE(); - } - - ENCODE(OP_ItemLinkResponse) { ENCODE_FORWARD(OP_ItemPacket); } - - ENCODE(OP_ItemPacket) - { - //consume the packet - EQApplicationPacket *in = *p; - *p = nullptr; - - //store away the emu struct - unsigned char *__emu_buffer = in->pBuffer; - ItemPacket_Struct *old_item_pkt = (ItemPacket_Struct *)__emu_buffer; - InternalSerializedItem_Struct *int_struct = (InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); - - uint32 length; - char *serialized = SerializeItem((const ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); - - if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); - delete in; - return; - } - in->size = length + 5; // ItemPacketType + Serialization + \0 - in->pBuffer = new unsigned char[in->size]; - ItemPacket_Struct *new_item_pkt = (ItemPacket_Struct *)in->pBuffer; - new_item_pkt->PacketType = old_item_pkt->PacketType; - memcpy(new_item_pkt->SerializedItem, serialized, length + 1); - - delete[] __emu_buffer; - safe_delete_array(serialized); - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_LeadershipExpUpdate) - { - SETUP_DIRECT_ENCODE(LeadershipExpUpdate_Struct, structs::LeadershipExpUpdate_Struct); - - OUT(group_leadership_exp); - OUT(group_leadership_points); - OUT(raid_leadership_exp); - OUT(raid_leadership_points); - - FINISH_ENCODE(); - } - - ENCODE(OP_LootItem) - { - ENCODE_LENGTH_EXACT(LootingItem_Struct); - SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct); - - OUT(lootee); - OUT(looter); - eq->slot_id = ServerToClient62CorpseSlot(emu->slot_id); - OUT(auto_loot); - - FINISH_ENCODE(); - } - - ENCODE(OP_MoveItem) - { - ENCODE_LENGTH_EXACT(MoveItem_Struct); - SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct); - - eq->from_slot = ServerToClient62Slot(emu->from_slot); - eq->to_slot = ServerToClient62Slot(emu->to_slot); - OUT(number_in_stack); - - FINISH_ENCODE(); - } - - ENCODE(OP_NewSpawn) { ENCODE_FORWARD(OP_ZoneSpawns); } - - ENCODE(OP_OnLevelMessage) - { - ENCODE_LENGTH_EXACT(OnLevelMessage_Struct); - SETUP_DIRECT_ENCODE(OnLevelMessage_Struct, structs::OnLevelMessage_Struct); - - OUT_str(Title); - OUT_str(Text); - OUT(Buttons); - OUT(Duration); - OUT(PopupID); - - eq->unknown4236 = 0x00000000; - eq->unknown4240 = 0xffffffff; - - FINISH_ENCODE(); - } - - ENCODE(OP_PetBuffWindow) - { - ENCODE_LENGTH_EXACT(PetBuff_Struct); - SETUP_DIRECT_ENCODE(PetBuff_Struct, PetBuff_Struct); - - OUT(petid); - OUT(buffcount); - - int EQBuffSlot = 0; - - for (uint32 EmuBuffSlot = 0; EmuBuffSlot < BUFF_COUNT; ++EmuBuffSlot) - { - if (emu->spellid[EmuBuffSlot]) - { - eq->spellid[EQBuffSlot] = emu->spellid[EmuBuffSlot]; - eq->ticsremaining[EQBuffSlot++] = emu->ticsremaining[EmuBuffSlot]; - } - } - - FINISH_ENCODE(); - } - - ENCODE(OP_PlayerProfile) - { - SETUP_DIRECT_ENCODE(PlayerProfile_Struct, structs::PlayerProfile_Struct); - - uint32 r; - - memset(eq->unknown3224, 0xff, 448); - memset(eq->unknown3704, 0xff, 32); - - // OUT(checksum); - OUT(gender); - OUT(race); - OUT(class_); - OUT(level); - eq->level2 = emu->level; - - eq->bind_zone_id = emu->binds[0].zoneId; - eq->bind_x[0] = emu->binds[0].x; - eq->bind_y[0] = emu->binds[0].y; - eq->bind_z[0] = emu->binds[0].z; - eq->bind_heading[0] = emu->binds[0].heading; - //just making this up base on organization of struct: - eq->zone_safe_x = emu->binds[4].x; - eq->zone_safe_y = emu->binds[4].y; - eq->zone_safe_z = emu->binds[4].z; - eq->zone_safe_heading = emu->binds[4].heading; - - OUT(deity); - OUT(intoxication); - OUT_array(spellSlotRefresh, structs::MAX_PP_MEMSPELL); - OUT(abilitySlotRefresh); - // OUT(unknown0166[4]); - OUT(haircolor); - OUT(beardcolor); - OUT(eyecolor1); - OUT(eyecolor2); - OUT(hairstyle); - OUT(beard); - for (r = 0; r < 9; r++) { - OUT(item_material[r]); - OUT(item_tint[r].color); - - } - for (r = 0; r < structs::MAX_PP_AA_ARRAY; r++) { - OUT(aa_array[r].AA); - OUT(aa_array[r].value); - } - OUT(points); - OUT(mana); - OUT(cur_hp); - OUT(STR); - OUT(STA); - OUT(CHA); - OUT(DEX); - OUT(INT); - OUT(AGI); - OUT(WIS); - OUT(face); - OUT_array(spell_book, structs::MAX_PP_SPELLBOOK); - OUT_array(mem_spells, structs::MAX_PP_MEMSPELL); - OUT(platinum); - OUT(gold); - OUT(silver); - OUT(copper); - OUT(platinum_cursor); - OUT(gold_cursor); - OUT(silver_cursor); - OUT(copper_cursor); - - OUT_array(skills, structs::MAX_PP_SKILL); // 1:1 direct copy (100 dword) - - OUT(toxicity); - OUT(thirst_level); - OUT(hunger_level); - for (r = 0; r < structs::BUFF_COUNT; r++) { - OUT(buffs[r].slotid); - OUT(buffs[r].level); - OUT(buffs[r].bard_modifier); - OUT(buffs[r].effect); - OUT(buffs[r].spellid); - OUT(buffs[r].duration); - OUT(buffs[r].counters); - // OUT(buffs[r].player_id); - } - for (r = 0; r < structs::MAX_PP_DISCIPLINES; r++) { - OUT(disciplines.values[r]); - } - // OUT_array(recastTimers, structs::MAX_RECAST_TYPES); - OUT(endurance); - OUT(aapoints_spent); - OUT(aapoints); - for (r = 0; r < structs::MAX_PLAYER_BANDOLIER; r++) { - 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); - } - } - 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(available_slots); - OUT_str(name); - OUT_str(last_name); - OUT(guild_id); - OUT(birthday); - OUT(lastlogin); - OUT(timePlayedMin); - OUT(pvp); - OUT(anon); - OUT(gm); - OUT(guildrank); - OUT(exp); - OUT_array(languages, structs::MAX_PP_LANGUAGE); - OUT(x); - OUT(y); - OUT(z); - OUT(heading); - OUT(platinum_bank); - OUT(gold_bank); - OUT(silver_bank); - OUT(copper_bank); - OUT(platinum_shared); - OUT(expansions); - OUT(autosplit); - OUT(zone_id); - OUT(zoneInstance); - for (r = 0; r < structs::MAX_GROUP_MEMBERS; r++) { - OUT_str(groupMembers[r]); - } - // OUT_str(groupLeader); //this is prolly right after groupMembers, but I dont feel like checking. - // OUT(leadAAActive); - OUT(ldon_points_guk); - OUT(ldon_points_mir); - OUT(ldon_points_mmc); - OUT(ldon_points_ruj); - OUT(ldon_points_tak); - OUT(ldon_points_available); - OUT(tribute_time_remaining); - OUT(career_tribute_points); - OUT(tribute_points); - OUT(tribute_active); - for (r = 0; r < structs::MAX_PLAYER_TRIBUTES; r++) { - OUT(tributes[r].tribute); - OUT(tributes[r].tier); - } - OUT(group_leadership_exp); - OUT(raid_leadership_exp); - OUT(group_leadership_points); - OUT(raid_leadership_points); - OUT_array(leader_abilities.ranks, structs::MAX_LEADERSHIP_AA_ARRAY); - OUT(air_remaining); - OUT(entityid); - OUT(leadAAActive); - OUT(expAA); - OUT(currentRadCrystals); - OUT(careerRadCrystals); - OUT(currentEbonCrystals); - OUT(careerEbonCrystals); - OUT(groupAutoconsent); - OUT(raidAutoconsent); - OUT(guildAutoconsent); - // OUT(showhelm); - - //set the checksum... - CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4); - - FINISH_ENCODE(); - } - - ENCODE(OP_ReadBook) - { - // no apparent slot translation needed -U - EQApplicationPacket *in = *p; - *p = nullptr; - - unsigned char *__emu_buffer = in->pBuffer; - - BookText_Struct *emu_BookText_Struct = (BookText_Struct *)__emu_buffer; - - in->size = sizeof(structs::BookText_Struct) + strlen(emu_BookText_Struct->booktext); - - in->pBuffer = new unsigned char[in->size]; - - structs::BookText_Struct *eq_BookText_Struct = (structs::BookText_Struct*)in->pBuffer; - - eq_BookText_Struct->window = emu_BookText_Struct->window; - eq_BookText_Struct->type = emu_BookText_Struct->type; - strcpy(eq_BookText_Struct->booktext, emu_BookText_Struct->booktext); - - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_RespondAA) - { - ENCODE_LENGTH_EXACT(AATable_Struct); - SETUP_DIRECT_ENCODE(AATable_Struct, structs::AATable_Struct); - - unsigned int r; - for (r = 0; r < MAX_PP_AA_ARRAY; r++) { - OUT(aa_list[r].aa_skill); - OUT(aa_list[r].aa_value); - } - - FINISH_ENCODE(); - } - - ENCODE(OP_SendAATable) - { - ENCODE_LENGTH_ATLEAST(SendAA_Struct); - - SETUP_VAR_ENCODE(SendAA_Struct); - ALLOC_VAR_ENCODE(structs::SendAA_Struct, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - - // Check clientver field to verify this AA should be sent for SoF - // clientver 1 is for all clients and 2 is for 6.2 - if (emu->clientver <= 2) - { - OUT(id); - OUT(hotkey_sid); - OUT(hotkey_sid2); - OUT(title_sid); - OUT(desc_sid); - OUT(class_type); - OUT(cost); - OUT(seq); - OUT(current_level); - OUT(prereq_skill); - OUT(prereq_minpoints); - OUT(type); - OUT(spellid); - OUT(spell_type); - OUT(spell_refresh); - OUT(classes); - OUT(berserker); - OUT(max_level); - OUT(last_id); - OUT(next_id); - OUT(cost2); - OUT(unknown80[0]); - OUT(unknown80[1]); - OUT(total_abilities); - unsigned int r; - for (r = 0; r < emu->total_abilities; r++) { - OUT(abilities[r].skill_id); - OUT(abilities[r].base1); - OUT(abilities[r].base2); - OUT(abilities[r].slot); - } - } - - FINISH_ENCODE(); - } - - ENCODE(OP_SendCharInfo) - { - ENCODE_LENGTH_EXACT(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]); - OUT(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; - } - OUT(haircolor[r]); - OUT(gohome[r]); - OUT(deity[r]); - OUT(beardcolor[r]); - } - - FINISH_ENCODE(); - } - - ENCODE(OP_ShopPlayerSell) - { - ENCODE_LENGTH_EXACT(Merchant_Purchase_Struct); - SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); - - OUT(npcid); - eq->itemslot = ServerToClient62Slot(emu->itemslot); - OUT(quantity); - OUT(price); - - FINISH_ENCODE(); - } - - ENCODE(OP_Track) - { - EQApplicationPacket *in = *p; - *p = nullptr; - - unsigned char *__emu_buffer = in->pBuffer; - Track_Struct *emu = (Track_Struct *)__emu_buffer; - - int EntryCount = in->size / sizeof(Track_Struct); - - if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) - { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); - delete in; - return; - } - - in->size = sizeof(structs::Track_Struct) * EntryCount; - in->pBuffer = new unsigned char[in->size]; - structs::Track_Struct *eq = (structs::Track_Struct *) in->pBuffer; - - for (int i = 0; i < EntryCount; ++i, ++eq, ++emu) - { - OUT(entityid); - OUT(padding002); - OUT(distance); - } - - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - - ENCODE(OP_TributeItem) - { - ENCODE_LENGTH_EXACT(TributeItem_Struct); - SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct); - - eq->slot = ServerToClient62Slot(emu->slot); - OUT(quantity); - OUT(tribute_master_id); - OUT(tribute_points); - - FINISH_ENCODE(); - } - - ENCODE(OP_WearChange) - { - ENCODE_LENGTH_EXACT(WearChange_Struct); - SETUP_DIRECT_ENCODE(WearChange_Struct, structs::WearChange_Struct); - - OUT(spawn_id); - OUT(material); - OUT(color.color); - OUT(wear_slot_id); - - FINISH_ENCODE(); - } - - ENCODE(OP_ZoneEntry) { ENCODE_FORWARD(OP_ZoneSpawns); } - - ENCODE(OP_ZoneSpawns) - { - //consume the packet - EQApplicationPacket *in = *p; - *p = nullptr; - - //store away the emu struct - unsigned char *__emu_buffer = in->pBuffer; - Spawn_Struct *emu = (Spawn_Struct *)__emu_buffer; - - //determine and verify length - int entrycount = in->size / sizeof(Spawn_Struct); - if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); - delete in; - return; - } - - //make the EQ struct. - in->size = sizeof(structs::Spawn_Struct)*entrycount; - in->pBuffer = new unsigned char[in->size]; - structs::Spawn_Struct *eq = (structs::Spawn_Struct *) in->pBuffer; - - //zero out the packet. We could avoid this memset by setting all fields (including unknowns) - //in the loop. - memset(in->pBuffer, 0, in->size); - - //do the transform... - int r; - int k; - for (r = 0; r < entrycount; r++, eq++, emu++) { - eq->gm = emu->gm; - eq->aaitle = emu->aaitle; - eq->anon = emu->anon; - eq->face = emu->face; - strcpy(eq->name, emu->name); - eq->deity = emu->deity; - eq->size = emu->size; - eq->NPC = emu->NPC; - eq->invis = emu->invis; - eq->haircolor = emu->haircolor; - eq->curHp = emu->curHp; - eq->max_hp = emu->max_hp; - eq->findable = emu->findable; - eq->deltaHeading = emu->deltaHeading; - eq->x = emu->x; - eq->y = emu->y; - eq->animation = emu->animation; - eq->z = emu->z; - eq->deltaY = emu->deltaY; - eq->deltaX = emu->deltaX; - eq->heading = emu->heading; - eq->deltaZ = emu->deltaZ; - eq->eyecolor1 = emu->eyecolor1; - // eq->showhelm = emu->showhelm; - eq->is_npc = emu->is_npc; - eq->hairstyle = emu->hairstyle; - eq->beard = emu->beard; - eq->level = emu->level; - eq->beardcolor = emu->beardcolor; - strcpy(eq->suffix, emu->suffix); - eq->petOwnerId = emu->petOwnerId; - eq->guildrank = emu->guildrank; - for (k = 0; k < 9; k++) { - 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; - } - eq->runspeed = emu->runspeed; - eq->afk = emu->afk; - eq->guildID = emu->guildID; - strcpy(eq->title, emu->title); - eq->helm = emu->helm; - eq->race = emu->race; - strcpy(eq->lastName, emu->lastName); - eq->walkspeed = emu->walkspeed; - eq->is_pet = emu->is_pet; - eq->light = emu->light; - eq->class_ = emu->class_; - eq->eyecolor2 = emu->eyecolor2; - eq->gender = emu->gender; - eq->bodytype = emu->bodytype; - eq->equip_chest2 = emu->equip_chest2; - eq->spawnId = emu->spawnId; - eq->lfg = emu->lfg; - eq->flymode = emu->flymode; - } - - //kill off the emu structure and send the eq packet. - delete[] __emu_buffer; - dest->FastQueuePacket(&in, ack_req); - } - -// DECODE methods - DECODE(OP_AdventureMerchantSell) - { - DECODE_LENGTH_EXACT(structs::Adventure_Sell_Struct); - SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct); - - IN(npcid); - emu->slot = Client62ToServerSlot(eq->slot); - IN(charges); - IN(sell_price); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_ApplyPoison) - { - DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct); - SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct); - - emu->inventorySlot = Client62ToServerSlot(eq->inventorySlot); - IN(success); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_AugmentItem) - { - DECODE_LENGTH_EXACT(structs::AugmentItem_Struct); - SETUP_DIRECT_DECODE(AugmentItem_Struct, structs::AugmentItem_Struct); - - emu->container_slot = Client62ToServerSlot(eq->container_slot); - emu->augment_slot = eq->augment_slot; - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_CastSpell) - { - DECODE_LENGTH_EXACT(structs::CastSpell_Struct); - SETUP_DIRECT_DECODE(CastSpell_Struct, structs::CastSpell_Struct); - - IN(slot); - IN(spell_id); - emu->inventoryslot = Client62ToServerSlot(eq->inventoryslot); - IN(target_id); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_CharacterCreate) - { - DECODE_LENGTH_EXACT(structs::CharCreate_Struct); - SETUP_DIRECT_DECODE(CharCreate_Struct, structs::CharCreate_Struct); - - IN(class_); - IN(beardcolor); - IN(beard); - IN(haircolor); - IN(gender); - IN(race); - IN(start_zone); - IN(hairstyle); - IN(deity); - IN(STR); - IN(STA); - IN(AGI); - IN(DEX); - IN(WIS); - IN(INT); - IN(CHA); - IN(face); - IN(eyecolor1); - IN(eyecolor2); - IN(tutorial); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_Consume) - { - DECODE_LENGTH_EXACT(structs::Consume_Struct); - SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct); - - emu->slot = Client62ToServerSlot(eq->slot); - IN(auto_consumed); - IN(type); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_DeleteItem) - { - DECODE_LENGTH_EXACT(structs::DeleteItem_Struct); - SETUP_DIRECT_DECODE(DeleteItem_Struct, structs::DeleteItem_Struct); - - emu->from_slot = Client62ToServerSlot(eq->from_slot); - emu->to_slot = Client62ToServerSlot(eq->to_slot); - IN(number_in_stack); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_FaceChange) - { - DECODE_LENGTH_EXACT(structs::FaceChange_Struct); - SETUP_DIRECT_DECODE(FaceChange_Struct, structs::FaceChange_Struct); - - IN(haircolor); - IN(beardcolor); - IN(eyecolor1); - IN(eyecolor2); - IN(hairstyle); - IN(beard); - IN(face); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_ItemLinkClick) - { - DECODE_LENGTH_EXACT(structs::ItemViewRequest_Struct); - SETUP_DIRECT_DECODE(ItemViewRequest_Struct, structs::ItemViewRequest_Struct); - MEMSET_IN(ItemViewRequest_Struct); - - IN(item_id); - int r; - for (r = 0; r < 5; r++) { - IN(augments[r]); - } - IN(link_hash); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_LootItem) - { - DECODE_LENGTH_EXACT(structs::LootingItem_Struct); - SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct); - - IN(lootee); - IN(looter); - emu->slot_id = Client62ToServerCorpseSlot(eq->slot_id); - IN(auto_loot); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_MoveItem) - { - DECODE_LENGTH_EXACT(structs::MoveItem_Struct); - SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - - _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); - - emu->from_slot = Client62ToServerSlot(eq->from_slot); - emu->to_slot = Client62ToServerSlot(eq->to_slot); - IN(number_in_stack); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_ReadBook) - { - // no apparent slot translation needed -U - DECODE_LENGTH_ATLEAST(structs::BookRequest_Struct); - SETUP_DIRECT_DECODE(BookRequest_Struct, structs::BookRequest_Struct); - - IN(window); - IN(type); - strn0cpy(emu->txtfile, eq->txtfile, sizeof(emu->txtfile)); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_SetServerFilter) - { - DECODE_LENGTH_EXACT(structs::SetServerFilter_Struct); - SETUP_DIRECT_DECODE(SetServerFilter_Struct, structs::SetServerFilter_Struct); - - int r; - for (r = 0; r < 25; r++) { - IN(filters[r]); - } - emu->filters[25] = 1; - emu->filters[26] = 1; - emu->filters[27] = 1; - emu->filters[28] = 1; - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_ShopPlayerSell) - { - DECODE_LENGTH_EXACT(structs::Merchant_Purchase_Struct); - SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct); - - IN(npcid); - emu->itemslot = Client62ToServerSlot(eq->itemslot); - IN(quantity); - IN(price); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_TradeSkillCombine) - { - DECODE_LENGTH_EXACT(structs::NewCombine_Struct); - SETUP_DIRECT_DECODE(NewCombine_Struct, structs::NewCombine_Struct); - - emu->container_slot = Client62ToServerSlot(eq->container_slot); - IN(guildtribute_slot); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_TributeItem) - { - DECODE_LENGTH_EXACT(structs::TributeItem_Struct); - SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct); - - emu->slot = Client62ToServerSlot(eq->slot); - IN(quantity); - IN(tribute_master_id); - IN(tribute_points); - - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_WearChange) - { - DECODE_LENGTH_EXACT(structs::WearChange_Struct); - SETUP_DIRECT_DECODE(WearChange_Struct, structs::WearChange_Struct); - IN(spawn_id); - IN(material); - IN(color.color); - IN(wear_slot_id); - FINISH_DIRECT_DECODE(); - } - - DECODE(OP_WhoAllRequest) - { - DECODE_LENGTH_EXACT(structs::Who_All_Struct); - SETUP_DIRECT_DECODE(Who_All_Struct, structs::Who_All_Struct); - - memcpy(emu->whom, eq->whom, sizeof(emu->whom)); - IN(wrace); - IN(wclass); - IN(lvllow); - IN(lvlhigh); - IN(gmlookup); - emu->type = 3; - - FINISH_DIRECT_DECODE(); - } - -// file scope helper methods - char *SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) - { - char *serialization = nullptr; - char *instance = nullptr; - const char *protection = (const char *)"\\\\\\\\\\"; - char *sub_items[10] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; - bool stackable = inst->IsStackable(); - int16 slot_id = ServerToClient62Slot(slot_id_in); - uint32 merchant_slot = inst->GetMerchantSlot(); - int16 charges = inst->GetCharges(); - const Item_Struct *item = inst->GetUnscaledItem(); - int i; - uint32 sub_length; - - // not sure if 6.2 has a recast timer timestamp field..but, something seems amiss between this and Ti's ordering - MakeAnyLenString(&instance, - "%i|%i|%i|%i|%i|%i|%i|%i|%i|%i|", - stackable ? charges : 1, - 0, - //(merchant_slot == 0) ? slot_id : merchant_slot, // change when translator activated - (merchant_slot == 0) ? slot_id_in : merchant_slot, - inst->GetPrice(), - (merchant_slot == 0) ? 1 : inst->GetMerchantCount(), - inst->IsScaling() ? inst->GetExp() / 100 : 0, - //merchant_slot, //instance ID, bullshit for now - // The 'Merchant Slot' needs to be some unique id for bazaar to work properly - (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot, - inst->IsAttuned() ? 1 : 0, //not sure where this field is - (stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? charges : 0) : charges), - 0 - ); - - for (i = 0; i<10; i++) { - ItemInst *sub = inst->GetItem(i); - if (sub) { - sub_items[i] = SerializeItem(sub, 0, &sub_length, depth + 1); - } - } - - - *length = MakeAnyLenString(&serialization, - "%.*s%s" // For leading quotes (and protection) if a subitem; - "%s" // Instance data - "%.*s\"" // Quotes (and protection, if needed) around static data - "%i" // item->ItemClass so we can do |%s instead of %s| -#define I(field) "|%i" -#define C(field) "|%s" -#define S(field) "|%s" -#define F(field) "|%f" -#include "client62_itemfields.h" - "%.*s\"" // Quotes (and protection, if needed) around static data - "|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s" // Sub items - "%.*s%s" // For trailing quotes (and protection) if a subitem; - , depth ? depth - 1 : 0, protection, (depth) ? "\"" : "" - , instance - , depth, protection - , item->ItemClass -#define I(field) ,item->field -#define C(field) ,field -#define S(field) ,item->field -#define F(field) ,item->field -#include "client62_itemfields.h" - , depth, protection - , sub_items[0] ? sub_items[0] : "" - , sub_items[1] ? sub_items[1] : "" - , sub_items[2] ? sub_items[2] : "" - , sub_items[3] ? sub_items[3] : "" - , sub_items[4] ? sub_items[4] : "" - , sub_items[5] ? sub_items[5] : "" - , sub_items[6] ? sub_items[6] : "" - , sub_items[7] ? sub_items[7] : "" - , sub_items[8] ? sub_items[8] : "" - , sub_items[9] ? sub_items[9] : "" - , (depth) ? depth - 1 : 0, protection, (depth) ? "\"" : "" - ); - - for (i = 0; i < 10; i++) { - if (sub_items[i]) - safe_delete_array(sub_items[i]); - } - - safe_delete_array(instance); - - return serialization; - } - - static inline int16 ServerToClient62Slot(uint32 ServerSlot) - { - //int16 Client62Slot; - if (ServerSlot == INVALID_INDEX) - return INVALID_INDEX; - - return ServerSlot; // deprecated - } - - static inline int16 ServerToClient62CorpseSlot(uint32 ServerCorpse) - { - //int16 Client62Corpse; - return ServerCorpse; - } - - static inline uint32 Client62ToServerSlot(int16 Client62Slot) - { - //uint32 ServerSlot; - if (Client62Slot == INVALID_INDEX) - return INVALID_INDEX; - - return Client62Slot; // deprecated - } - - static inline uint32 Client62ToServerCorpseSlot(int16 Client62Corpse) - { - //uint32 ServerCorpse; - return Client62Corpse; - } -} -// end namespace Client62 diff --git a/common/patches/client62.h b/common/patches/client62.h deleted file mode 100644 index 08d1a9716..000000000 --- a/common/patches/client62.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CLIENT62_H_ -#define CLIENT62_H_ - -#include "../struct_strategy.h" -#include "../item.h" - -class EQStreamIdentifier; - -namespace Client62 { - - //these are the only public member of this namespace. - extern void Register(EQStreamIdentifier &into); - extern void Reload(); - - - - //you should not directly access anything below.. - //I just dont feel like making a seperate header for it. - - class Strategy : public StructStrategy { - public: - Strategy(); - - protected: - - virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; - - //magic macro to declare our opcode processors - #include "ss_declare.h" - #include "client62_ops.h" - - }; - -}; - -#endif /*CLIENT62_H_*/ diff --git a/common/patches/client62_constants.h b/common/patches/client62_constants.h deleted file mode 100644 index 0e672a5de..000000000 --- a/common/patches/client62_constants.h +++ /dev/null @@ -1,212 +0,0 @@ -/* -EQEMu: Everquest Server Emulator - -Copyright (C) 2001-2014 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 CLIENT62_CONSTANTS_H_ -#define CLIENT62_CONSTANTS_H_ - -#include "../types.h" - -namespace Client62 { - namespace maps { - typedef enum : int16 { - // this needs work to match actual client equivilents - MapPossessions = 0, - MapBank, - MapSharedBank, - MapTrade, - MapWorld, - MapLimbo, - MapTribute, - MapTrophyTribute, - MapGuildTribute, - MapMerchant, - MapDeleted, - MapCorpse, - MapBazaar, - MapInspect, - MapRealEstate, - MapViewMODPC, - MapViewMODBank, - MapViewMODSharedBank, - MapViewMODLimbo, - MapAltStorage, - MapArchived, - MapMail, - MapGuildTrophyTribute, - MapOther, - _MapCount - } InventoryMaps; - } - - namespace slots { - typedef enum : int16 { - MainCharm = 0, - MainEar1, - MainHead, - MainFace, - MainEar2, - MainNeck, - MainShoulders, - MainArms, - MainBack, - MainWrist1, - MainWrist2, - MainRange, - MainHands, - MainPrimary, - MainSecondary, - MainFinger1, - MainFinger2, - MainChest, - MainLegs, - MainFeet, - MainWaist, - MainAmmo, - MainGeneral1, - MainGeneral2, - MainGeneral3, - MainGeneral4, - MainGeneral5, - MainGeneral6, - MainGeneral7, - MainGeneral8, - MainCursor, - _MainCount, - _MainEquipmentBegin = MainCharm, - _MainEquipmentEnd = MainAmmo, - _MainEquipmentCount = (_MainEquipmentEnd - _MainEquipmentBegin + 1), - _MainGeneralBegin = MainGeneral1, - _MainGeneralEnd = MainGeneral8, - _MainGeneralCount = (_MainGeneralEnd - _MainGeneralBegin + 1) - } EquipmentSlots; - } - - namespace consts { - static const uint16 MAP_POSSESSIONS_SIZE = slots::_MainCount; - static const uint16 MAP_BANK_SIZE = 16; - static const uint16 MAP_SHARED_BANK_SIZE = 2; - static const uint16 MAP_TRADE_SIZE = 8; - static const uint16 MAP_WORLD_SIZE = 10; - static const uint16 MAP_LIMBO_SIZE = 36; - static const uint16 MAP_TRIBUTE_SIZE = 0; //? - static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0; - static const uint16 MAP_MERCHANT_SIZE = 0; - static const uint16 MAP_DELETED_SIZE = 0; - static const uint16 MAP_CORPSE_SIZE = slots::_MainCount; - static const uint16 MAP_BAZAAR_SIZE = 80; - static const uint16 MAP_INSPECT_SIZE = slots::_MainEquipmentCount; - static const uint16 MAP_REAL_ESTATE_SIZE = 0; - static const uint16 MAP_VIEW_MOD_PC_SIZE = MAP_POSSESSIONS_SIZE; - static const uint16 MAP_VIEW_MOD_BANK_SIZE = MAP_BANK_SIZE; - static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = MAP_SHARED_BANK_SIZE; - static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = MAP_LIMBO_SIZE; - static const uint16 MAP_ALT_STORAGE_SIZE = 0; - static const uint16 MAP_ARCHIVED_SIZE = 0; - static const uint16 MAP_MAIL_SIZE = 0; - static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0; - static const uint16 MAP_KRONO_SIZE = NOT_USED; - static const uint16 MAP_OTHER_SIZE = 0; - - static const int16 EQUIPMENT_BEGIN = slots::MainCharm; - static const int16 EQUIPMENT_END = slots::MainAmmo; - static const uint16 EQUIPMENT_SIZE = slots::_MainEquipmentCount; - - static const int16 GENERAL_BEGIN = slots::MainGeneral1; - static const int16 GENERAL_END = slots::MainGeneral8; - static const uint16 GENERAL_SIZE = slots::_MainGeneralCount; - static const int16 GENERAL_BAGS_BEGIN = 251; - static const int16 GENERAL_BAGS_END_OFFSET = 79; - static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET; - - static const int16 CURSOR = slots::MainCursor; - static const int16 CURSOR_BAG_BEGIN = 331; - static const int16 CURSOR_BAG_END_OFFSET = 9; - static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET; - - static const int16 BANK_BEGIN = 2000; - static const int16 BANK_END = 2015; - static const int16 BANK_BAGS_BEGIN = 2031; - static const int16 BANK_BAGS_END_OFFSET = 159; - static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET; - - static const int16 SHARED_BANK_BEGIN = 2500; - static const int16 SHARED_BANK_END = 2501; - static const int16 SHARED_BANK_BAGS_BEGIN = 2531; - static const int16 SHARED_BANK_BAGS_END_OFFSET = 19; - static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET; - - static const int16 TRADE_BEGIN = 3000; - static const int16 TRADE_END = 3007; - static const int16 TRADE_NPC_END = 3003; - static const int16 TRADE_BAGS_BEGIN = 3031; - static const int16 TRADE_BAGS_END_OFFSET = 79; - static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET; - - static const int16 WORLD_BEGIN = 4000; - static const int16 WORLD_END = 4009; - - static const int16 TRIBUTE_BEGIN = 400; - static const int16 TRIBUTE_END = 404; - - static const int16 CORPSE_BEGIN = slots::MainGeneral1; - static const int16 CORPSE_END = slots::MainGeneral1 + slots::MainCursor; - - 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; - } - - namespace limits { - static const bool ALLOWS_EMPTY_BAG_IN_BAG = false; - static const bool ALLOWS_CLICK_CAST_FROM_BAG = false; - static const bool COIN_HAS_WEIGHT = true; - } - -}; //end namespace Client62 - -#endif /*CLIENT62_CONSTANTS_H_*/ - -/* -Client62 Notes: - ** Integer-based inventory ** -ok Possessions: 0 - 30 (Corpse: 22 - 52 [Offset 22]) -ok [Equipment: 0 - 21] -ok [General: 22 - 29] -ok [Cursor: 30] -ok General Bags: 251 - 330 -ok Cursor Bags: 331 - 340 - -ok Bank: 2000 - 2015 -ok Bank Bags: 2031 - 2190 - -ok Shared Bank: 2500 - 2501 -ok Shared Bank Bags: 2531 - 2550 - - Trade: 3000 - 3007 - (Trade Bags: 3031 - 3110 -- server values) - - World: 4000 - 4009 - -*/ diff --git a/common/patches/client62_itemfields.h b/common/patches/client62_itemfields.h deleted file mode 100644 index 22419208b..000000000 --- a/common/patches/client62_itemfields.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - - -These fields must be in the order of how they are serialized! - - - -*/ - - -/* 000 */ //I(ItemClass) Leave this one off on purpose -/* 001 */ S(Name) -/* 002 */ S(Lore) -/* 003 */ S(IDFile) -/* 004 */ I(ID) -/* 005 */ I(Weight) -/* 006 */ I(NoRent) -/* 007 */ I(NoDrop) -/* 008 */ I(Size) -/* 009 */ I(Slots) -/* 010 */ I(Price) -/* 011 */ I(Icon) -/* 012 */ C("0") -/* 013 */ C("0") -/* 014 */ I(BenefitFlag) -/* 015 */ I(Tradeskills) -/* 016 */ I(CR) -/* 017 */ I(DR) -/* 018 */ I(PR) -/* 019 */ I(MR) -/* 020 */ I(FR) -/* 021 */ I(AStr) -/* 022 */ I(ASta) -/* 023 */ I(AAgi) -/* 024 */ I(ADex) -/* 025 */ I(ACha) -/* 026 */ I(AInt) -/* 027 */ I(AWis) -/* 028 */ I(HP) -/* 029 */ I(Mana) -/* 030 */ I(AC) -/* 031 */ I(Deity) -/* 032 */ C("0") -/* 033 */ I(SkillModValue) -/* 034 */ I(SkillModType) -/* 035 */ I(BaneDmgRace) -/* 036 */ I(BaneDmgAmt) -/* 037 */ I(BaneDmgBody) -/* 038 */ I(Magic) -/* 039 */ I(CastTime_) -/* 040 */ I(ReqLevel) -/* 041 */ I(BardType) -/* 042 */ I(BardValue) -/* 043 */ I(Light) -/* 044 */ I(Delay) -/* 045 */ I(RecLevel) -/* 046 */ I(RecSkill) -/* 047 */ I(ElemDmgType) -/* 048 */ I(ElemDmgAmt) -/* 049 */ I(Range) -/* 050 */ I(Damage) -/* 051 */ I(Color) -/* 052 */ I(Classes) -/* 053 */ I(Races) -/* 054 */ C("0") -/* 055 */ I(MaxCharges) -/* 056 */ I(ItemType) -/* 057 */ I(Material) -/* 058 */ F(SellRate) -/* 059 */ C("0") -/* 060 */ I(CastTime_) -/* 061 */ C("0") -/* 062 */ I(ProcRate) -/* 063 */ I(CombatEffects) -/* 064 */ I(Shielding) -/* 065 */ I(StunResist) -/* 066 */ I(StrikeThrough) -/* 067 */ I(ExtraDmgSkill) -/* 068 */ I(ExtraDmgAmt) -/* 069 */ I(SpellShield) -/* 070 */ I(Avoidance) -/* 071 */ I(Accuracy) -/* 072 */ I(CharmFileID) -/* 073 */ I(FactionMod1) -/* 074 */ I(FactionMod2) -/* 075 */ I(FactionMod3) -/* 076 */ I(FactionMod4) -/* 077 */ I(FactionAmt1) -/* 078 */ I(FactionAmt2) -/* 079 */ I(FactionAmt3) -/* 080 */ I(FactionAmt4) -/* 081 */ S(CharmFile) -/* 082 */ I(AugType) -/* 083 */ I(AugSlotType[0]) -/* 084 */ I(AugSlotType[1]) -/* 085 */ I(AugSlotType[2]) -/* 086 */ I(AugSlotType[3]) -/* 087 */ I(AugSlotType[4]) -/* 088 */ I(LDoNTheme) -/* 089 */ I(LDoNPrice) -/* 090 */ I(LDoNSold) -/* 091 */ I(BagType) -/* 092 */ I(BagSlots) -/* 093 */ I(BagSize) -/* 094 */ I(BagWR) -/* 095 */ I(Book) -/* 096 */ I(BookType) -/* 097 */ S(Filename) -/* 098 */ I(BaneDmgRaceAmt) -/* 099 */ I(AugRestrict) -/* 100 */ I(LoreFlag) -/* 101 */ I(PendingLoreFlag) -/* 102 */ I(ArtifactFlag) -/* 103 */ I(SummonedFlag) -/* 104 */ I(Favor) -/* 105 */ I(FVNoDrop) -/* 106 */ I(Endur) -/* 107 */ I(DotShielding) -/* 108 */ I(Attack) -/* 109 */ I(Regen) -/* 110 */ I(ManaRegen) -/* 111 */ I(Haste) -/* 112 */ I(DamageShield) -/* 113 */ I(RecastDelay) -/* 114 */ I(RecastType) -/* 115 */ I(GuildFavor) -/* 116 */ I(AugDistiller) -/* 117 */ C("0") -/* 118 */ C("0") -/* 119 */ I(Attuneable) -/* 120 */ I(NoPet) -/* 121 */ C("0") -/* 122 */ I(PointType) -/* 123 */ I(PotionBelt) -/* 124 */ I(PotionBeltSlots) -/* 125 */ I(StackSize) -/* 126 */ I(Click.Effect) -/* 127 */ I(Click.Type) -/* 128 */ I(Click.Level2) -/* 129 */ I(Click.Level) -/* 130 */ C("0") -/* 131 */ I(Proc.Effect) -/* 132 */ I(Proc.Type) -/* 133 */ I(Proc.Level2) -/* 134 */ I(Proc.Level) -/* 135 */ C("0") -/* 136 */ I(Worn.Effect) -/* 137 */ I(Worn.Type) -/* 138 */ I(Worn.Level2) -/* 139 */ I(Worn.Level) -/* 140 */ C("0") -/* 141 */ I(Focus.Effect) -/* 142 */ I(Focus.Type) -/* 143 */ I(Focus.Level2) -/* 144 */ I(Focus.Level) -/* 145 */ C("0") -/* 146 */ I(Scroll.Effect) -/* 147 */ I(Scroll.Type) -/* 148 */ I(Scroll.Level2) -/* 149 */ I(Scroll.Level) -/* 150 */ C("0") -#undef I -#undef C -#undef S -#undef F - diff --git a/common/patches/client62_ops.h b/common/patches/client62_ops.h deleted file mode 100644 index eb7ff2205..000000000 --- a/common/patches/client62_ops.h +++ /dev/null @@ -1,54 +0,0 @@ -// out-going packets that require an ENCODE translation: -E(OP_Action) -E(OP_AdventureMerchantSell) -E(OP_ApplyPoison) -E(OP_BazaarSearch) -E(OP_BecomeTrader) -E(OP_CharInventory) -E(OP_DeleteCharge) -E(OP_DeleteItem) -E(OP_DeleteSpawn) -E(OP_GuildMemberLevelUpdate) -E(OP_GuildMemberList) -E(OP_Illusion) -E(OP_ItemLinkResponse) -E(OP_ItemPacket) -E(OP_LeadershipExpUpdate) -E(OP_LootItem) -E(OP_MoveItem) -E(OP_NewSpawn) -E(OP_OnLevelMessage) -E(OP_PetBuffWindow) -E(OP_PlayerProfile) -E(OP_ReadBook) -E(OP_RespondAA) -E(OP_SendAATable) -E(OP_SendCharInfo) -E(OP_ShopPlayerSell) -E(OP_Track) -E(OP_TributeItem) -E(OP_WearChange) -E(OP_ZoneEntry) -E(OP_ZoneServerReady) -E(OP_ZoneSpawns) -// incoming packets that require a DECODE translation: -D(OP_AdventureMerchantSell) -D(OP_ApplyPoison) -D(OP_AugmentItem) -D(OP_CastSpell) -D(OP_CharacterCreate) -D(OP_Consume) -D(OP_DeleteItem) -D(OP_FaceChange) -D(OP_ItemLinkClick) -D(OP_LootItem) -D(OP_MoveItem) -D(OP_ReadBook) -D(OP_SetServerFilter) -D(OP_ShopPlayerSell) -D(OP_TradeSkillCombine) -D(OP_TributeItem) -D(OP_WearChange) -D(OP_WhoAllRequest) -#undef E -#undef D diff --git a/common/patches/client62_structs.h b/common/patches/client62_structs.h deleted file mode 100644 index 691eeba21..000000000 --- a/common/patches/client62_structs.h +++ /dev/null @@ -1,3163 +0,0 @@ -#ifndef CLIENT62_STRUCTS_H_ -#define CLIENT62_STRUCTS_H_ - -namespace Client62 { - namespace structs { - - -static const uint32 BUFF_COUNT = 25; -/* -** Compiler override to ensure -** byte aligned structures -*/ -#pragma pack(1) - -struct LoginInfo_Struct { -/*000*/ char login_info[64]; -/*064*/ uint8 unknown064[124]; -/*188*/ uint8 zoning; // 01 if zoning, 00 if not -/*189*/ uint8 unknown189[275]; -/*488*/ -}; - -struct EnterWorld_Struct { -/*000*/ char name[64]; -/*064*/ uint32 tutorial; // 01 on "Enter Tutorial", 00 if not -/*068*/ uint32 return_home; // 01 on "Return Home", 00 if not -}; - -/* Name Approval Struct */ -/* Len: */ -/* Opcode: 0x8B20*/ -struct NameApproval -{ - char name[64]; - uint32 race; - uint32 class_; - uint32 deity; -}; - -/* -** Entity identification struct -** Size: 4 bytes -** OPCodes: OP_DeleteSpawn, OP_Assist -*/ -struct EntityId_Struct -{ -/*00*/ uint32 entity_id; -/*04*/ -}; - -struct Duel_Struct -{ - uint32 duel_initiator; - uint32 duel_target; -}; - -struct DuelResponse_Struct -{ - uint32 target_id; - uint32 entity_id; - uint32 unknown; -}; -/* - Cofruben: - Adventure stuff,not a net one,just one for our use -*/ -static const uint32 ADVENTURE_COLLECT = 0; -static const uint32 ADVENTURE_MASSKILL = 1; -static const uint32 ADVENTURE_NAMED = 2; -static const uint32 ADVENTURE_RESCUE = 3; - -struct AdventureInfo { - uint32 QuestID; - uint32 NPCID; - bool in_use; - uint32 status; - bool ShowCompass; - uint32 Objetive;// can be item to collect,mobs to kill,boss to kill and someone to rescue. - uint32 ObjetiveValue;// number of items,or number of needed mob kills. - char text[512]; - uint8 type; - uint32 minutes; - uint32 points; - float x; - float y; - uint32 zoneid; - uint32 zonedungeonid; -}; -/////////////////////////////////////////////////////////////////////////////// - - -/* -** Color_Struct -** Size: 4 bytes -** Used for convenience -** Merth: Gave struct a name so gcc 2.96 would compile -** -*/ -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; - }; -}; - -/* -** Character Selection Struct -** Length: 1676 Bytes -** -*/ -struct CharacterSelect_Struct { -/*0000*/ uint32 zone[10]; // Characters Current Zone -/*0040*/ uint8 eyecolor1[10]; // Characters Eye Color -/*0050*/ uint8 eyecolor2[10]; // Characters Eye 2 Color -/*0060*/ uint8 hairstyle[10]; // Characters hair style -/*0070*/ uint8 unknown0070[2]; -/*0072*/ uint32 primary[10]; // Characters primary IDFile number -/*0112*/ uint32 race[10]; // Characters Race -/*0152*/ uint8 class_[10]; // Characters Classes -/*0162*/ char name[10][64]; // Characters Names -/*0802*/ uint8 gender[10]; // Characters Gender -/*0812*/ uint8 level[10]; // Characters Levels -/*0822*/ uint8 unknown0822[2]; -/*0824*/ uint32 secondary[10]; // Characters secondary IDFile number -/*0864*/ uint8 face[10]; // Characters Face Type -/*0874*/ uint8 beard[10]; // Characters Beard Type -/*0884*/ 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) -/*1244*/ uint8 haircolor[10]; // Characters Hair Color -/*1254*/ uint8 gohome[10]; // 1=Go Home available, 0=not -/*1264*/ Color_Struct cs_colors[10][9]; // Characters Equipment Colors -/*1624*/ uint32 deity[10]; // Characters Deity -/*1664*/ uint8 beardcolor[10]; // Characters beard Color -/*1674*/ uint8 unknown1674[2]; -/*1676*/ -}; - -/* -** Generic Spawn Struct -** Length: 257 Bytes -** Fields from old struct not yet found: -** float size; -** float walkspeed; // probably one of the ff 33 33 33 3f -** float runspeed; // probably one of the ff 33 33 33 3f -** uint8 traptype; // 65 is disarmable trap, 66 and 67 are invis triggers/traps -** uint8 npc_armor_graphic; // 0xFF=Player, 0=none, 1=leather, 2=chain, 3=steelplate -** uint8 npc_helm_graphic; // 0xFF=Player, 0=none, 1=leather, 2=chain, 3=steelplate -** -*/ - -/* -** Generic Spawn Struct -** Length: 383 Octets -** Used in: -** spawnZoneStruct -** dbSpawnStruct -** petStruct -** newSpawnStruct -*/ -struct Spawn_Struct -{ -/*0000*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse,a -/*0001*/ uint8 set_to_0xFF[8]; // ***Placeholder (all ff) -/*0009*/ uint8 curHp; // Current hp -/*0010*/ char lastName[32]; // Player's Lastname -/*0042*/ uint8 bodytype; // Bodytype -/*0043*/ uint8 unknown0042[7]; -/*0050*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner -/*0054*/ signed deltaHeading:10;// change in heading - signed x:19; // x coord - signed padding0054:3; // ***Placeholder -/*0058*/ signed y:19; // y coord - signed animation:10; // ***Placeholder (seems like speed) - signed padding0058:3; // animation -/*0062*/ signed z:19; // z coord - signed deltaY:13; // change in y -/*0066*/ signed deltaX:13; // change in x - unsigned heading:12; // heading - signed padding0066:7; // ***Placeholder -/*0070*/ signed deltaZ:13; // change in z - signed padding0070:19; // ***Placeholder -/*0074*/ uint16 deity; // Player's Deity -/*0076*/ uint8 unknown[2]; -/*0078*/ union - { - struct - { - /*0078*/ uint32 equip_helmet; // Equipment: Helmet Visual - /*0082*/ uint32 equip_chest; // Equipment: Chest Visual - /*0086*/ uint32 equip_arms; // Equipment: Arms Visual - /*0090*/ uint32 equip_bracers; // Equipment: Bracers Visual - /*0094*/ uint32 equip_hands; // Equipment: Hands Visual - /*0098*/ uint32 equip_legs; // Equipment: Legs Visual - /*0102*/ uint32 equip_feet; // Equipment: Feet Visual - /*0106*/ uint32 equip_primary; // Equipment: Primary Visual - /*0110*/ uint32 equip_secondary; // Equipment: Secondary Visual - } equip; - /*0078*/ uint32 equipment[9]; // Array elements correspond to struct equipment above - }; -/*0114*/ uint8 unknown0114[5]; -/*0119*/ uint8 afk; // 0=no, 1=afk -/*0120*/ uint32 spawnId; // Spawn Id -/*0124*/ uint8 is_pet; // 0=no, 1=yes -/*0125*/ uint8 gm; // 0=no, 1=gm -/*0126*/ uint8 unknown0126[4]; -/*0130*/ uint8 aaitle; // 0=none, 1=general, 2=archtype, 3=class -/*0131*/ uint8 unknown0132[24]; -/*0155*/ uint8 anon; // 0=normal, 1=anon, 2=roleplay -/*0156*/ uint8 unknown0156; -/*0157*/ uint8 face; // Face id for players -/*0159*/ uint8 helm; -/*0159*/ uint8 unknown0159; -/*0160*/ float runspeed; // Speed when running -/*0164*/ uint8 eyecolor1; // Player's left eye color -/*0165*/ uint8 beard; //not 100% verified, but slightly verified -/*0166*/ uint8 is_npc; // 0=no, 1=yes -/*0167*/ uint8 flymode; //seems to be 3 for 'useable' npc classes -/*0168*/ uint32 guildID; // Current guild -/*0172*/ union - { - struct - { - /*0172*/ Color_Struct color_helmet; // Color of helmet item - /*0176*/ Color_Struct color_chest; // Color of chest item - /*0180*/ Color_Struct color_arms; // Color of arms item - /*0184*/ Color_Struct color_bracers; // Color of bracers item - /*0188*/ Color_Struct color_hands; // Color of hands item - /*0192*/ Color_Struct color_legs; // Color of legs item - /*0196*/ Color_Struct color_feet; // Color of feet item - /*0200*/ Color_Struct color_primary; // Color of primary item - /*0204*/ Color_Struct color_secondary; // Color of secondary item - } equipment_colors; - /*0172*/ Color_Struct colors[9]; // Array elements correspond to struct equipment_colors above - }; -/*0208*/ uint8 hairstyle; -/*0209*/ float walkspeed; // Speed when walking -/*0213*/ uint8 unknown0213[3]; -/*0216*/ uint8 class_; // Player's class -/*0217*/ uint8 beardcolor; // Beard color -/*0218*/ float size; // Model size -/*0222*/ uint8 findable; // 0=can't be found, 1=can be found -/*0223*/ float unknown_float; -/*0227*/ char suffix[32]; // Player's suffix (of Veeshan, etc.) -/*0259*/ uint8 unknown0259[4]; //[0] is sometimes 100 -/*0263*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader -/*0264*/ uint8 unknown0264[3]; -union -{ -/*0267*/ uint8 equip_chest2; // Second place in packet for chest texture (usually 0xFF in live packets) - // Not sure why there are 2 of them, but it effects chest texture! -/*0267*/ uint8 mount_color; // drogmor: 0=white, 1=black, 2=green, 3=red - // horse: 0=brown, 1=white, 2=black, 3=tan -}; -/*0268*/ uint32 race; // Spawn race -/*0272*/ uint8 invis; // Invis (0=not, 1=invis) -/*0273*/ uint8 unknown0276[5]; -/*0278*/ uint8 lfg; // 0=off, 1=lfg on -/*0279*/ uint8 level; // Spawn Level -/*0280*/ uint8 haircolor; // Hair color -/*0281*/ uint8 max_hp; //(name prolly wrong)takes on the value 100 for players, 100 or 110 for NPCs and 120 for PC corpses... -/*0282*/ uint8 light; // Spawn's lightsource -/*0283*/ uint8 gender; // Gender (0=male, 1=female) -/*0284*/ char name[64]; // Player's Name -/*0348*/ uint8 eyecolor2; // Left eye color -/*0349*/ char title[32]; // Title -/*0381*/ uint8 unknown0381[2]; -}; /*0383*/ - -/* -** New Spawn -** Length: 176 Bytes -** OpCode: 4921 -*/ -struct NewSpawn_Struct -{ - struct Spawn_Struct spawn; // Spawn Information -}; - -struct ClientZoneEntry_Struct { -/*0000*/ uint32 unknown00; -/*0004*/ char char_name[64]; // Character Name -}; - -/* -** Server Zone Entry Struct -** Length: 452 Bytes -** OPCodes: OP_ServerZoneEntry -** -*/ -struct ServerZoneEntry_Struct -{ - struct NewSpawn_Struct player; -}; - -struct NewZone_Struct { -/*0000*/ char char_name[64]; // Character Name -/*0064*/ char zone_short_name[32]; // Zone Short Name -/*0096*/ char zone_long_name[278]; // Zone Long Name -/*0374*/ uint8 ztype; // Zone type (usually FF) -/*0375*/ uint8 fog_red[4]; // Zone fog (red) -/*0379*/ uint8 fog_green[4]; // Zone fog (green) -/*0383*/ uint8 fog_blue[4]; // Zone fog (blue) -/*0387*/ uint8 unknown323; -/*0388*/ float fog_minclip[4]; -/*0404*/ float fog_maxclip[4]; -/*0420*/ float gravity; -/*0424*/ uint8 time_type; -/*0425*/ uint8 rain_chance[4]; -/*0429*/ uint8 rain_duration[4]; -/*0433*/ uint8 snow_chance[4]; -/*0437*/ uint8 snow_duration[4]; -/*0441*/ uint8 unknown360[33]; -/*0474*/ uint8 sky; // Sky Type -/*0475*/ uint8 unknown331[13]; // ***Placeholder -/*0488*/ float zone_exp_multiplier; // Experience Multiplier -/*0492*/ float safe_y; // Zone Safe Y -/*0496*/ float safe_x; // Zone Safe X -/*0500*/ float safe_z; // Zone Safe Z -/*0504*/ float max_z; // Guessed -/*0508*/ float underworld; // Underworld, min z (Not Sure?) -/*0512*/ float minclip; // Minimum View Distance -/*0516*/ float maxclip; // Maximum View DIstance -/*0520*/ uint8 unknown_end[84]; // ***Placeholder -/*0604*/ char zone_short_name2[68]; -/*0672*/ char unknown672[12]; -/*0684*/ uint16 zone_id; -/*0686*/ uint16 zone_instance; -/*0688*/ uint32 unknown688; -/*0682*/ uint8 unknown692[4]; -}; - -/* -** Memorize Spell Struct -** Length: 12 Bytes -** -*/ -struct MemorizeSpell_Struct { -uint32 slot; // Spot in the spell book/memorized slot -uint32 spell_id; // Spell id (200 or c8 is minor healing, etc) -uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming -uint32 unknown12; -}; - -/* -** Make Charmed Pet -** Length: 12 Bytes -** -*/ -struct Charm_Struct { -/*00*/ uint32 owner_id; -/*04*/ uint32 pet_id; -/*08*/ uint32 command; // 1: make pet, 0: release pet -/*12*/ -}; - -struct InterruptCast_Struct -{ - uint32 spawnid; - uint32 messageid; - char message[0]; -}; - -struct DeleteSpell_Struct -{ -/*000*/int16 spell_slot; -/*002*/uint8 unknowndss002[2]; -/*004*/uint8 success; -/*005*/uint8 unknowndss006[3]; -/*008*/ -}; - -struct ManaChange_Struct -{ - uint32 new_mana; // New Mana AMount - uint32 stamina; - uint32 spell_id; - uint32 unknown12; -}; - -struct SwapSpell_Struct -{ - uint32 from_slot; - uint32 to_slot; - - -}; - -struct BeginCast_Struct -{ - // len = 8 -/*000*/ uint16 caster_id; -/*002*/ uint16 spell_id; -/*004*/ uint32 cast_time; // in miliseconds -}; - -struct CastSpell_Struct -{ - uint32 slot; - uint32 spell_id; - uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast - uint32 target_id; - uint8 cs_unknown[4]; -}; - -/* -** SpawnAppearance_Struct -** Changes client appearance for all other clients in zone -** Size: 8 bytes -** Used in: OP_SpawnAppearance -** -*/ -struct SpawnAppearance_Struct -{ -/*0000*/ uint16 spawn_id; // ID of the spawn -/*0002*/ uint16 type; // Values associated with the type -/*0004*/ uint32 parameter; // Type of data sent -/*0008*/ -}; - - -// solar: this is used inside profile -struct SpellBuff_Struct -{ -/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise -/*001*/ uint8 level; -/*002*/ uint8 bard_modifier; -/*003*/ uint8 effect; //not real -/*004*/ uint32 spellid; -/*008*/ uint32 duration; -/*012*/ uint32 counters; -/*014*/ uint8 Unknown012[4]; -}; - -struct SpellBuffFade_Struct { -/*000*/ uint32 entityid; -/*004*/ uint8 slot; -/*005*/ uint8 level; -/*006*/ uint8 effect; -/*007*/ uint8 unknown7; -/*008*/ uint32 spellid; -/*012*/ uint32 duration; -/*016*/ uint32 unknown016; -/*020*/ uint32 unknown020; //prolly global player ID -/*024*/ uint32 slotid; -/*028*/ uint32 bufffade; -/*032*/ -}; - -struct ItemNamePacket_Struct { -/*000*/ uint32 item_id; -/*004*/ uint32 unkown004; -/*008*/ char name[64]; -/*072*/ -}; - -// Length: 10 -struct ItemProperties_Struct { - -uint8 unknown01[2]; -uint8 charges; -uint8 unknown02[13]; -}; - -struct GMTrainee_Struct -{ - /*000*/ uint32 npcid; - /*004*/ uint32 playerid; - /*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE]; - /*408*/ uint8 unknown408[40]; - /*448*/ -}; - -struct GMTrainEnd_Struct -{ - /*000*/ uint32 npcid; - /*004*/ uint32 playerid; - /*008*/ -}; - -struct GMSkillChange_Struct { -/*000*/ uint16 npcid; -/*002*/ uint8 unknown1[2]; // something like PC_ID, but not really. stays the same thru the session though -/*002*/ uint16 skillbank; // 0 if normal skills, 1 if languages -/*002*/ uint8 unknown2[2]; -/*008*/ uint16 skill_id; -/*010*/ uint8 unknown3[2]; -}; -struct ConsentResponse_Struct { - char grantname[64]; - char ownername[64]; - uint8 permission; - char zonename[32]; -}; - -/* -** Name Generator Struct -** Length: 72 bytes -** OpCode: 0x0290 -*/ -struct NameGeneration_Struct -{ -/*0000*/ uint32 race; -/*0004*/ uint32 gender; -/*0008*/ char name[64]; -/*0072*/ -}; - -/* -** Character Creation struct -** Length: 140 Bytes -** OpCode: 0x0113 -*/ -struct CharCreate_Struct -{ - /*0000*/ uint32 class_; //guess - /*0004*/ char name[64]; - /*0068*/ uint32 beardcolor; // credit goes to vesuvias for appearance stuff - /*0072*/ uint32 beard; - /*0076*/ uint32 haircolor; - /*0080*/ int32 gender; - /*0084*/ int32 race; - /*0088*/ int32 start_zone; - /*0092*/ int32 hairstyle; - /*0096*/ uint32 deity; - ///*0072*/ int32 deity; - - - // 0 = odus - // 1 = qeynos - // 2 = halas - // 3 = rivervale - // 4 = freeport - // 5 = neriak - // 6 = gukta/grobb - // 7 = ogguk - // 8 = kaladim - // 9 = gfay - // 10 = felwithe - // 11 = akanon - // 12 = cabalis - // 13 = shar vahl - - -/*0100*/ int32 STR; -/*0104*/ int32 STA; -/*0108*/ int32 AGI; -/*0112*/ int32 DEX; -/*0116*/ int32 WIS; -/*0120*/ int32 INT; -/*0124*/ int32 CHA; -/*0128*/ uint32 face; -/*0132*/ uint32 eyecolor1; //its possiable we could have these switched -/*0136*/ uint32 eyecolor2; //since setting one sets the other we really can't check -/*0140*/ uint32 tutorial; //assumptions are bad! But guessed -}; - -/* - *Used in PlayerProfile - */ -struct AA_Array -{ - uint32 AA; - uint32 value; -}; - - -static const uint32 MAX_PP_DISCIPLINES = 100; - -struct Disciplines_Struct { - uint32 values[MAX_PP_DISCIPLINES]; -}; - -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; - 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, - bandolierRange, - bandolierAmmo -}; -struct Bandolier_Struct { - char name[32]; - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; -}; -struct PotionBelt_Struct { - BandolierItem_Struct items[MAX_PLAYER_BANDOLIER_ITEMS]; -}; - -static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16; -static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16; -static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY); -struct GroupLeadershipAA_Struct { - union { - struct { - uint32 groupAAMarkNPC; - uint32 groupAANPCHealth; - uint32 groupAADelegateMainAssist; - uint32 groupAADelegateMarkNPC; - uint32 groupAA4; - uint32 groupAA5; - uint32 groupAAInspectBuffs; - uint32 groupAA7; - uint32 groupAASpellAwareness; - uint32 groupAAOffenseEnhancement; - uint32 groupAAManaEnhancement; - uint32 groupAAHealthEnhancement; - uint32 groupAAHealthRegeneration; - uint32 groupAAFindPathToPC; - uint32 groupAAHealthOfTargetsTarget; - uint32 groupAA15; - }; - uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY]; - }; -}; - -struct RaidLeadershipAA_Struct { - union { - struct { - uint32 raidAAMarkNPC; - uint32 raidAANPCHealth; - uint32 raidAADelegateMainAssist; - uint32 raidAADelegateMarkNPC; - uint32 raidAA4; - uint32 raidAA5; - uint32 raidAA6; - uint32 raidAASpellAwareness; - uint32 raidAAOffenseEnhancement; - uint32 raidAAManaEnhancement; - uint32 raidAAHealthEnhancement; - uint32 raidAAHealthRegeneration; - uint32 raidAAFindPathToPC; - uint32 raidAAHealthOfTargetsTarget; - uint32 raidAA14; - uint32 raidAA15; - }; - uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY]; - }; -}; - -struct LeadershipAA_Struct { - union { - struct { - GroupLeadershipAA_Struct group; - RaidLeadershipAA_Struct raid; - }; - uint32 ranks[MAX_LEADERSHIP_AA_ARRAY]; - }; -}; - -/* -** Player Profile -** -** Length: 4308 bytes -** OpCode: 0x006a - */ -static const uint32 MAX_PP_LANGUAGE = 28; -static const uint32 MAX_PP_SPELLBOOK = 400; -static const uint32 MAX_PP_MEMSPELL = 9; -static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size -static const uint32 MAX_PP_AA_ARRAY = 240; -static const uint32 MAX_GROUP_MEMBERS = 6; -struct PlayerProfile_Struct -{ -/*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum -/*0004*/ char name[64]; // Name of player sizes not right -/*0068*/ char last_name[32]; // Last name of player sizes not right -/*0100*/ uint32 gender; // Player Gender - 0 Male, 1 Female -/*0104*/ uint32 race; // Player race -/*0108*/ uint32 class_; // Player class -/*0112*/ uint32 unknown0112; // -/*0116*/ uint32 level; // Level of player (might be one byte) -/*0120*/ uint32 bind_zone_id; // Zone player is bound in -/*0124*/ uint32 unknown0124[4]; -/*0140*/ float bind_x[4]; // Bind loc x coord -/*0156*/ float zone_safe_x; -/*0160*/ float bind_y[4]; // Bind loc y coord -/*0176*/ float zone_safe_y; -/*0180*/ float bind_z[4]; // Bind loc z coord -/*0196*/ float zone_safe_z; -/*0200*/ float bind_heading[4]; // -/*0216*/ float zone_safe_heading; -/*0220*/ uint32 deity; // deity -/*0224*/ uint32 guild_id; -/*0228*/ uint32 birthday; // characters bday -/*0232*/ uint32 lastlogin; // last login or zone time -/*0236*/ uint32 timePlayedMin; // in minutes -/*0240*/ uint8 pvp; -/*0241*/ uint8 level2; //no idea why this is here, but thats how it is on live -/*0242*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon -/*0243*/ uint8 gm; -/*0244*/ uint8 guildrank; -/*0245*/ uint8 unknown0245[7]; // -/*0252*/ uint32 intoxication; -/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms -/*0292*/ uint32 abilitySlotRefresh; -/*0296*/ uint8 haircolor; // Player hair color -/*0297*/ uint8 beardcolor; // Player beard color -/*0298*/ uint8 eyecolor1; // Player left eye color -/*0299*/ uint8 eyecolor2; // Player right eye color -/*0300*/ uint8 hairstyle; // Player hair style -/*0301*/ uint8 beard; // Beard type -/*0302*/ uint8 ability_time_seconds; //The following four spots are unknown right now..... -/*0303*/ uint8 ability_number; //ability used -/*0304*/ uint8 ability_time_minutes; -/*0305*/ uint8 ability_time_hours;//place holder -/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag? -/*0312*/ uint32 item_material[9]; // Item texture/material of worn/held items -/*0348*/ uint8 unknown0256[44]; -/*0396*/ Color_Struct item_tint[9]; -/*0432*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; -/*2348*/ float unknown2348; //seen ~128, ~47 -/*2352*/ char servername[32]; // length probably not right -/*2384*/ char title[32]; //length might be wrong -/*2416*/ char suffix[32]; //length might be wrong -/*2448*/ uint32 guildid2; // -/*2452*/ uint32 exp; // Current Experience -/*2456*/ uint32 unknown1496; -/*2460*/ uint32 points; // Unspent Practice points -/*2464*/ uint32 mana; // current mana -/*2468*/ uint32 cur_hp; // current hp -/*2472*/ uint32 unknown1512; // 0x05 -/*2476*/ uint32 STR; // Strength -/*2480*/ uint32 STA; // Stamina -/*2484*/ uint32 CHA; // Charisma -/*2488*/ uint32 DEX; // Dexterity -/*2492*/ uint32 INT; // Intelligence -/*2496*/ uint32 AGI; // Agility -/*2500*/ uint32 WIS; // Wisdom -/*2504*/ uint8 face; // Player face -/*2505*/ uint8 unknown1545[47]; // ? -/*2552*/ uint8 languages[MAX_PP_LANGUAGE]; -/*2580*/ uint8 unknown1620[4]; -/*2584*/ uint32 spell_book[MAX_PP_SPELLBOOK]; -/*4184*/ uint8 unknown3224[448]; // all 0xff -/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL]; -/*4668*/ uint8 unknown3704[32]; // -/*4700*/ float y; // Player y position -/*4704*/ float x; // Player x position -/*4708*/ float z; // Player z position -/*4712*/ float heading; // Direction player is facing -/*4716*/ uint8 unknown3756[4]; // -/*4720*/ int32 platinum; // Platinum Pieces on player -/*4724*/ int32 gold; // Gold Pieces on player -/*4728*/ int32 silver; // Silver Pieces on player -/*4732*/ int32 copper; // Copper Pieces on player -/*4736*/ int32 platinum_bank; // Platinum Pieces in Bank -/*4740*/ int32 gold_bank; // Gold Pieces in Bank -/*4744*/ int32 silver_bank; // Silver Pieces in Bank -/*4748*/ int32 copper_bank; // Copper Pieces in Bank -/*4752*/ int32 platinum_cursor; // Platinum on cursor -/*4756*/ int32 gold_cursor; // Gold on cursor -/*4760*/ int32 silver_cursor; // Silver on cursor -/*4764*/ int32 copper_cursor; // Copper on cursor -/*4768*/ int32 platinum_shared; // Platinum shared between characters -/*4772*/ uint8 unknown3812[24]; -/*4796*/ uint32 skills[MAX_PP_SKILL]; // 100 dword buffer -/*5196*/ uint8 unknown5096[184]; -/*5380*/ uint32 pvp2; // -/*5384*/ uint32 unknown4420; // -/*5388*/ uint32 pvptype; // -/*5392*/ uint32 unknown4428; // -/*5396*/ uint32 ability_down; // Doodman - Guessing -/*5400*/ uint8 unknown4436[8]; // -/*5408*/ uint32 autosplit; //not used right now -/*5412*/ uint8 unknown4448[8]; -/*5420*/ uint32 zone_change_count; // Number of times user has zoned in their career (guessing) -/*5424*/ uint8 unknown4460[28]; // -/*5452*/ uint32 expansions; // expansion setting, bit field of expansions avaliable -/*5456*/ int32 toxicity; //from drinking potions, seems to increase by 3 each time you drink -/*5460*/ char unknown4496[16]; // -/*5476*/ int32 hunger_level; -/*5480*/ int32 thirst_level; -/*5484*/ uint32 ability_up; -/*5488*/ char unknown4524[16]; -/*5504*/ uint16 zone_id; // Current zone of the player -/*5506*/ uint16 zoneInstance; // Instance ID -/*5508*/ SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player -/*6008*/ char groupMembers[6][64]; // -/*6392*/ char unknown6392[656]; -/*7048*/ uint32 entityid; -/*7052*/ uint32 leadAAActive; -/*7056*/ uint32 unknown7056; -/*7060*/ int32 ldon_points_guk; //client uses these as signed -/*7064*/ int32 ldon_points_mir; -/*7068*/ int32 ldon_points_mmc; -/*7072*/ int32 ldon_points_ruj; -/*7076*/ int32 ldon_points_tak; -/*7080*/ int32 ldon_points_available; -/*7084*/ uint8 unknown5940[112]; -/*7196*/ uint32 tribute_time_remaining; //in miliseconds -/*7200*/ uint32 unknown6048; -/*7204*/ uint32 career_tribute_points; -/*7208*/ uint32 unknown6056; -/*7212*/ uint32 tribute_points; -/*7216*/ uint32 unknown6064; -/*7220*/ uint32 tribute_active; //1=active -/*7224*/ Tribute_Struct tributes[MAX_PLAYER_TRIBUTES]; -/*7264*/ Disciplines_Struct disciplines; //fathernitwit: 10-06-04 -/*7664*/ char unknown7464[240]; -/*7904*/ uint32 endurance; -/*7908*/ uint32 group_leadership_exp; //0-1000 -/*7912*/ uint32 raid_leadership_exp; //0-2000 -/*7916*/ uint32 group_leadership_points; -/*7920*/ uint32 raid_leadership_points; -/*7924*/ LeadershipAA_Struct leader_abilities; -/*8052*/ uint8 unknown8052[132]; -/*8184*/ uint32 air_remaining; -/*8188*/ uint8 unknown8188[4608]; -/*12796*/ uint32 aapoints_spent; -/*12800*/ uint32 expAA; -/*12804*/ uint32 aapoints; //avaliable, unspent -/*12808*/ uint8 unknown12808[36]; -/*12844*/ Bandolier_Struct bandoliers[MAX_PLAYER_BANDOLIER]; -/*14124*/ uint8 unknown14124[5120]; -/*19244*/ PotionBelt_Struct potionbelt; //there should be 3 more of these -/*19532*/ uint8 unknown19532[8]; -/*19540*/ uint32 currentRadCrystals; // Current count of radiant crystals -/*19544*/ uint32 careerRadCrystals; // Total count of radiant crystals ever -/*19548*/ uint32 currentEbonCrystals; // Current count of ebon crystals -/*19552*/ uint32 careerEbonCrystals; // Total count of ebon crystals ever -/*19556*/ uint8 groupAutoconsent; // 0=off, 1=on -/*19557*/ uint8 raidAutoconsent; // 0=off, 1=on -/*19558*/ uint8 guildAutoconsent; // 0=off, 1=on -/*19559*/ uint8 unknown19559[5]; // ***Placeholder (6/29/2005) -/*19564*/ uint32 unknown15964; -/*19568*/ -}; - -/* -** Client Target Struct -** Length: 2 Bytes -** OpCode: 6221 -*/ -struct ClientTarget_Struct { -/*000*/ uint32 new_target; // Target ID -}; - -/* -** Target Rejection Struct -** Length: 12 Bytes -** OpCode: OP_TargetReject -*/ -struct TargetReject_Struct { -/*00*/ uint8 unknown00[12]; -}; - -struct PetCommand_Struct { -/*000*/ uint32 command; -/*004*/ uint32 unknown; -}; - -/* -** Delete Spawn -** Length: 4 Bytes -** OpCode: OP_DeleteSpawn -*/ -struct DeleteSpawn_Struct -{ -/*00*/ uint32 spawn_id; // Spawn ID to delete -/*04*/ -}; - -/* -** Channel Message received or sent -** Length: 144 Bytes + Variable Length + 1 -** OpCode: OP_ChannelMessage -** -*/ -struct ChannelMessage_Struct -{ -/*000*/ char targetname[64]; // Tell recipient -/*064*/ char sender[64]; // The senders name (len might be wrong) -/*128*/ uint32 language; // Language -/*132*/ uint32 chan_num; // Channel -/*136*/ uint32 cm_unknown4[2]; // ***Placeholder -/*144*/ uint32 skill_in_language; // The players skill in this language? might be wrong -/*148*/ char message[0]; // Variable length message -}; - -/* -** Special Message -** Length: 4 Bytes + Variable Text Length + 1 -** OpCode: OP_SpecialMesg -** -*/ -/* - Theres something wrong with this... example live packet: -Server->Client: [ Opcode: OP_SpecialMesg (0x0fab) Size: 244 ] - 0: 01 02 00 0A 00 00 00 09 - 05 00 00 42 61 72 73 74 | ...........Barst - 16: 72 65 20 53 6F 6E 67 77 - 65 61 76 65 72 00 7C F9 | re Songweaver.|. - 32: FF FF 84 FF FF FF 03 00 - 00 00 47 72 65 65 74 69 | ..........Greeti - -*/ -struct SpecialMesg_Struct -{ -/*00*/ char header[3]; // 04 04 00 <-- for #emote style msg -/*03*/ uint32 msg_type; // Color of text (see MT_*** below) -/*07*/ uint32 target_spawn_id; // Who is it being said to? -/*11*/ char sayer[1]; // Who is the source of the info -/*12*/ uint8 unknown12[12]; -/*24*/ char message[1]; // What is being said? -}; - -/* -** When somebody changes what they're wearing -** or give a pet a weapon (model changes) -** Length: 16 Bytes -** Opcode: 9220 -*/ -struct WearChange_Struct{ -/*000*/ uint16 spawn_id; -/*002*/ uint16 material; -/*004*/ Color_Struct color; -/*009*/ uint8 wear_slot_id; -}; - -/* -** Type: Bind Wound Structure -** Length: 8 Bytes -*/ -//Fixed for 7-14-04 patch -struct BindWound_Struct -{ -/*002*/ uint16 to; // TargetID -/*004*/ uint16 unknown2; // ***Placeholder -/*006*/ uint16 type; -/*008*/ uint16 unknown6; -}; - - -/* -** Type: Zone Change Request (before hand) -** Length: 88 bytes -** OpCode: a320 -*/ - -struct ZoneChange_Struct { -/*000*/ char char_name[64]; // Character Name -/*064*/ uint16 zoneID; -/*066*/ uint16 instanceID; -/*068*/ float y; -/*072*/ float x; -/*076*/ float z; -/*080*/ uint32 zone_reason; //0x0A == death, I think -/*084*/ int32 success; // =0 client->server, =1 server->client, -X=specific error -/*088*/ -}; - -struct RequestClientZoneChange_Struct { -/*00*/ uint16 zone_id; -/*02*/ uint16 instance_id; -/*04*/ float y; -/*08*/ float x; -/*12*/ float z; -/*16*/ float heading; -/*20*/ uint32 type; //unknown... values -}; - -struct Animation_Struct { -/*00*/ uint16 spawnid; -/*02*/ uint8 action; -/*03*/ uint8 value; -/*04*/ -}; - -// solar: this is what causes the caster to animate and the target to -// get the particle effects around them when a spell is cast -// also causes a buff icon -struct Action_Struct -{ - /* 00 */ uint16 target; // id of target - /* 02 */ uint16 source; // id of caster - /* 04 */ uint16 level; // level of caster - /* 06 */ uint16 instrument_mod; - /* 08 */ uint32 unknown08; - /* 12 */ uint16 unknown16; -// some kind of sequence that's the same in both actions -// as well as the combat damage, to tie em together? - /* 14 */ uint32 sequence; - /* 18 */ uint32 unknown18; - /* 22 */ uint8 type; // 231 (0xE7) for spells - /* 23 */ uint32 unknown23; - /* 27 */ uint16 spell; // spell id being cast - /* 29 */ uint8 unknown29; -// this field seems to be some sort of success flag, if it's 4 - /* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made - /* 31 */ -}; - -// solar: this is what prints the You have been struck. and the regular -// melee messages like You try to pierce, etc. It's basically the melee -// and spell damage message -struct CombatDamage_Struct -{ -/* 00 */ uint16 target; -/* 02 */ uint16 source; -/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells -/* 05 */ uint16 spellid; -/* 07 */ uint32 damage; -/* 11 */ uint32 unknown11; -/* 15 */ uint32 sequence; // see above notes in Action_Struct -/* 19 */ uint32 unknown19; -/* 23 */ -}; - -/* -** Consider Struct -** Length: 24 Bytes -** OpCode: 3721 -*/ -struct Consider_Struct{ -/*000*/ uint32 playerid; // PlayerID -/*004*/ uint32 targetid; // TargetID -/*008*/ uint32 faction; // Faction -/*0012*/ uint32 level; // Level -/*016*/ int32 cur_hp; // Current Hitpoints -/*020*/ int32 max_hp; // Maximum Hitpoints -/*024*/ uint8 pvpcon; // Pvp con flag 0/1 -/*025*/ uint8 unknown3[3]; -}; - -/* -** Spawn Death Blow -** Length: 32 Bytes -** OpCode: 0114 -*/ -struct Death_Struct -{ -/*000*/ uint32 spawn_id; -/*004*/ uint32 killer_id; -/*008*/ uint32 corpseid; // was corpseid -/*012*/ uint32 attack_skill; // was type -/*016*/ uint32 spell_id; -/*020*/ uint32 bindzoneid; //bindzoneid? -/*024*/ uint32 damage; -/*028*/ uint32 unknown028; -}; - -struct BecomeCorpse_Struct { - uint32 spawn_id; - float y; - float x; - float z; -}; - -/* -** Spawn position update -** Struct sent from server->client to update position of -** another spawn's position update in zone (whether NPC or PC) -** -*/ -struct PlayerPositionUpdateServer_Struct -{ -/*0000*/ uint16 spawn_id; -/*0002*/ int32 delta_heading:10, // change in heading - x_pos:19, // x coord - padding0002:3; // ***Placeholder -/*0006*/ int32 y_pos:19, // y coord - animation:10, // animation - padding0006:3; // ***Placeholder -/*0010*/ int32 z_pos:19, // z coord - delta_y:13; // change in y -/*0014*/ int32 delta_x:13, // change in x - heading:12, // heading - padding0014:7; // ***Placeholder -/*0018*/ int32 delta_z:13, // change in z - padding0018:19; // ***Placeholder -/*0022*/ -}; - -/* -** Player position update -** Struct sent from client->server to update -** player position on server -** -*/ -struct PlayerPositionUpdateClient_Struct -{ -/*0000*/ uint16 spawn_id; -/*0022*/ uint16 sequence; //increments one each packet -/*0004*/ float y_pos; // y coord -/*0008*/ float delta_z; // Change in z -/*0016*/ float delta_x; // Change in x -/*0012*/ float delta_y; // Change in y -/*0020*/ int32 animation:10, // animation - delta_heading:10, // change in heading - padding0020:12; // ***Placeholder (mostly 1) -/*0024*/ float x_pos; // x coord -/*0028*/ float z_pos; // z coord -/*0034*/ uint16 heading:12, // Directional heading - padding0004:4; // ***Placeholder -/*0032*/ uint8 unknown0006[2]; // ***Placeholder -/*0036*/ -}; - -/* -** Spawn HP Update -** Length: 10 Bytes -** OpCode: OP_HPUpdate -*/ -struct SpawnHPUpdate_Struct -{ -/*00*/ uint32 cur_hp; // Id of spawn to update -/*04*/ int32 max_hp; // Maximum hp of spawn -/*08*/ int16 spawn_id; // Current hp of spawn -/*10*/ -}; -struct SpawnHPUpdate_Struct2 -{ -/*01*/ int16 spawn_id; -/*00*/ uint8 hp; -}; -/* -** Stamina -** Length: 8 Bytes -** OpCode: 5721 -*/ -struct Stamina_Struct { -/*00*/ uint32 food; // (low more hungry 127-0) -/*02*/ uint32 water; // (low more thirsty 127-0) -}; - -/* -** Level Update -** Length: 12 Bytes -*/ -struct LevelUpdate_Struct -{ -/*00*/ uint32 level; // New level -/*04*/ uint32 level_old; // Old level -/*08*/ uint32 exp; // Current Experience -}; - -/* -** Experience Update -** Length: 14 Bytes -** OpCode: 9921 -*/ -struct ExpUpdate_Struct -{ -/*0000*/ uint32 exp; // Current experience ratio from 0 to 330 -/*0004*/ uint32 aaxp; // @BP ?? -}; - -/* -** Item Packet Struct - Works on a variety of opcodes -** Packet Types: See ItemPacketType enum -** -*/ -enum ItemPacketType -{ - ItemPacketViewLink = 0x00, - ItemPacketTradeView = 0x65, - ItemPacketLoot = 0x66, - ItemPacketTrade = 0x67, - ItemPacketCharInventory = 0x69, - ItemPacketSummonItem = 0x6A, - ItemPacketTributeItem = 0x6C, - ItemPacketMerchant = 0x64, - ItemPacketWorldContainer = 0x6B -}; -struct ItemPacket_Struct -{ -/*00*/ ItemPacketType PacketType; -/*04*/ char SerializedItem[1]; -/*xx*/ -}; - -struct BulkItemPacket_Struct -{ -/*00*/ char SerializedItem[0]; -/*xx*/ -}; - -struct Consume_Struct -{ -/*0000*/ uint32 slot; -/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click -/*0008*/ uint8 c_unknown1[4]; -/*0012*/ uint8 type; // 0x01=Food 0x02=Water -/*0013*/ uint8 unknown13[3]; -}; - -struct DeleteItem_Struct -{ -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; -/*0012*/ -}; - -struct MoveItem_Struct -{ -/*0000*/ uint32 from_slot; -/*0004*/ uint32 to_slot; -/*0008*/ uint32 number_in_stack; -/*0012*/ -}; - -// -// from_slot/to_slot -// -1 - destroy -// 0 - cursor -// 1 - inventory -// 2 - bank -// 3 - trade -// 4 - shared bank -// -// cointype -// 0 - copeer -// 1 - silver -// 2 - gold -// 3 - platinum -// -static const uint32 COINTYPE_PP = 3; -static const uint32 COINTYPE_GP = 2; -static const uint32 COINTYPE_SP = 1; -static const uint32 COINTYPE_CP = 0; - -struct MoveCoin_Struct -{ - int32 from_slot; - int32 to_slot; - int32 cointype1; - int32 cointype2; - int32 amount; -}; -struct TradeCoin_Struct{ - uint32 trader; - uint8 slot; - uint16 unknown5; - uint8 unknown7; - uint32 amount; -}; -struct TradeMoneyUpdate_Struct{ - uint32 trader; - uint32 type; - uint32 amount; -}; -/* -** Surname struct -** Size: 100 bytes -*/ -struct Surname_Struct -{ -/*0000*/ char name[64]; -/*0064*/ uint32 unknown0064; -/*0068*/ char lastname[32]; -/*0100*/ -}; - -struct GuildsListEntry_Struct { - char name[64]; -}; - -static const uint32 MAX_NUMBER_GUILDS = 1500; -struct GuildsList_Struct { - uint8 head[64]; // First on guild list seems to be empty... - GuildsListEntry_Struct Guilds[MAX_NUMBER_GUILDS]; -}; - -struct GuildUpdate_Struct { - uint32 guildID; - GuildsListEntry_Struct entry; -}; - -/* -** Money Loot -** Length: 22 Bytes -** OpCode: 5020 -*/ -struct moneyOnCorpseStruct { -/*0000*/ uint8 response; // 0 = someone else is, 1 = OK, 2 = not at this time -/*0001*/ uint8 unknown1; // = 0x5a -/*0002*/ uint8 unknown2; // = 0x40 -/*0003*/ uint8 unknown3; // = 0 -/*0004*/ uint32 platinum; // Platinum Pieces -/*0008*/ uint32 gold; // Gold Pieces - -/*0012*/ uint32 silver; // Silver Pieces -/*0016*/ uint32 copper; // Copper Pieces -}; - -//opcode = 0x5220 -// size 292 - - -struct LootingItem_Struct { -/*000*/ uint32 lootee; -/*002*/ uint32 looter; -/*004*/ uint16 slot_id; -/*006*/ uint8 unknown3[2]; -/*008*/ uint32 auto_loot; -}; - -struct GuildManageStatus_Struct{ - uint32 guildid; - uint32 oldrank; - uint32 newrank; - char name[64]; -}; -// Guild invite, remove -struct GuildJoin_Struct{ -/*000*/ uint32 guildid; -/*004*/ uint32 unknown04; -/*008*/ uint32 level; -/*012*/ uint32 class_; -/*016*/ uint32 rank;//0 member, 1 officer, 2 leader -/*020*/ uint32 zoneid; -/*024*/ uint32 unknown24; -/*028*/ char name[64]; -/*092*/ -}; -struct GuildInviteAccept_Struct { - char inviter[64]; - char newmember[64]; - uint32 response; - uint32 guildeqid; -}; -struct GuildManageRemove_Struct { - uint32 guildeqid; - char member[64]; -}; -struct GuildCommand_Struct { - char othername[64]; - char myname[64]; - uint16 guildeqid; - uint8 unknown[2]; // for guildinvite all 0's, for remove 0=0x56, 2=0x02 - uint32 officer; -}; - -// 4244 bytes. Is not really an 'OnLevelMessage', it causes a popup box to display in the client -// Text looks like HTML. -struct OnLevelMessage_Struct { -/*0000*/ char Title[128]; -/*0128*/ char Text[4096]; -/*4224*/ uint32 Buttons; -/*4228*/ uint32 Duration; -/*4232*/ uint32 PopupID; -/*4236*/ uint32 unknown4236; -/*4240*/ uint32 unknown4240; -/*4244*/ -}; - -// Opcode OP_GMZoneRequest -// Size = 88 bytes -struct GMZoneRequest_Struct { -/*0000*/ char charname[64]; -/*0064*/ uint32 zone_id; -/*0068*/ float x; -/*0072*/ float y; -/*0076*/ float z; -/*0080*/ char unknown0080[4]; -/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded? -/*0088*/ -// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error -// /*073*/ uint8 unknown0073[3]; // =0 ok, =ffffff error -}; - -struct GMSummon_Struct { -/* 0*/ char charname[64]; -/* 30*/ char gmname[64]; -/* 60*/ uint32 success; -/* 61*/ uint32 zoneID; -/*92*/ int32 y; -/*96*/ int32 x; -/*100*/ int32 z; -/*104*/ uint32 unknown2; // E0 E0 56 00 -}; - -struct GMGoto_Struct { // x,y is swapped as compared to summon and makes sense as own packet -/* 0*/ char charname[64]; - -/* 64*/ char gmname[64]; -/* 128*/ uint32 success; -/* 132*/ uint32 zoneID; - -/*136*/ int32 y; -/*140*/ int32 x; -/*144*/ int32 z; -/*148*/ uint32 unknown2; // E0 E0 56 00 -}; - -struct GMLastName_Struct { - char name[64]; - char gmname[64]; - char lastname[64]; - uint16 unknown[4]; // 0x00, 0x00 - // 0x01, 0x00 = Update the clients -}; - -//Combat Abilities -struct CombatAbility_Struct { - uint32 m_target; //the ID of the target mob - uint32 m_atk; - uint32 m_skill; -}; - -//Instill Doubt -struct Instill_Doubt_Struct { - uint8 i_id; - uint8 ia_unknown; - uint8 ib_unknown; - uint8 ic_unknown; - uint8 i_atk; - - uint8 id_unknown; - uint8 ie_unknown; - uint8 if_unknown; - uint8 i_type; - uint8 ig_unknown; - uint8 ih_unknown; - uint8 ii_unknown; -}; - -struct GiveItem_Struct { - uint16 to_entity; - int16 to_equipSlot; - uint16 from_entity; - int16 from_equipSlot; -}; - -struct RandomReq_Struct { - uint32 low; - uint32 high; -}; - -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ -struct RandomReply_Struct { -/* 00 */ uint32 low; -/* 04 */ uint32 high; -/* 08 */ uint32 result; -/* 12 */ char name[64]; -/* 76 */ -}; - -struct LFG_Struct { -/* -Wrong size on OP_LFG. Got: 80, Expected: 68 - 0: 00 00 00 00 01 00 00 00 - 00 00 00 00 64 00 00 00 | ............d... - 16: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 32: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 48: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 64: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ -Wrong size on OP_LFG. Got: 80, Expected: 68 - 0: 00 00 00 00 01 00 00 00 - 3F 00 00 00 41 00 00 00 | ........?...A... - 16: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 32: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 48: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 64: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ -Wrong size on OP_LFG. Got: 80, Expected: 68 - 0: 00 00 00 00 01 00 00 00 - 3F 00 00 00 41 00 00 00 | ........?...A... - 16: 46 72 75 62 20 66 72 75 - 62 20 66 72 75 62 00 00 | Frub frub frub.. - 32: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 48: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ - 64: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 | ................ -*/ -/*000*/ uint32 unknown000; -/*004*/ uint32 value; // 0x00 = off 0x01 = on -/*008*/ uint32 unknown008; -/*012*/ uint32 unknown012; -/*016*/ char name[64]; -}; - -/* -** LFG_Appearance_Struct -** Packet sent to clients to notify when someone in zone toggles LFG flag -** Size: 8 bytes -** Used in: OP_LFGAppearance -** -*/ -struct LFG_Appearance_Struct -{ -/*0000*/ uint32 spawn_id; // ID of the client -/*0004*/ uint8 lfg; // 1=LFG, 0=Not LFG -/*0005*/ char unknown0005[3]; // -/*0008*/ -}; - - -// EverQuest Time Information: -// 72 minutes per EQ Day -// 3 minutes per EQ Hour -// 6 seconds per EQ Tick (2 minutes EQ Time) -// 3 seconds per EQ Minute - -struct TimeOfDay_Struct { - uint8 hour; - uint8 minute; - uint8 day; - uint8 month; - uint32 year; -}; - -// Darvik: shopkeeper structs -struct Merchant_Click_Struct { -/*000*/ uint32 npcid; // Merchant NPC's entity id -/*004*/ uint32 playerid; -/*008*/ uint32 command; //1=open, 0=cancel/close -/*012*/ float rate; //cost multiplier, dosent work anymore -}; -/* -Unknowns: -0 is e7 from 01 to // MAYBE SLOT IN PURCHASE -1 is 03 -2 is 00 -3 is 00 -4 is ?? -5 is ?? -6 is 00 from a0 to -7 is 00 from 3f to */ -/* -0 is F6 to 01 -1 is CE CE -4A 4A -00 00 -00 E0 -00 CB -00 90 -00 3F -*/ - - - -struct Merchant_Sell_Struct { -/*000*/ uint32 npcid; // Merchant NPC's entity id -/*004*/ uint32 playerid; // Player's entity id -/*008*/ uint32 itemslot; - uint32 unknown12; -/*016*/ uint8 quantity; // Already sold -/*017*/ uint8 Unknown016[3]; -/*020*/ uint32 price; -}; -struct Merchant_Purchase_Struct { -/*000*/ uint32 npcid; // Merchant NPC's entity id -/*004*/ uint32 itemslot; // Player's entity id -/*008*/ uint32 quantity; -/*012*/ uint32 price; -}; -struct Merchant_DelItem_Struct{ -/*000*/ uint32 npcid; // Merchant NPC's entity id -/*004*/ uint32 playerid; // Player's entity id -/*008*/ uint32 itemslot; -}; -struct Adventure_Purchase_Struct { -/*000*/ uint32 some_flag; //set to 1 generally... -/*000*/ uint32 npcid; -/*004*/ uint32 itemid; -/*008*/ uint32 variable; -}; - -struct Adventure_Sell_Struct { -/*000*/ uint32 unknown000; //0x01 -/*004*/ uint32 npcid; -/*008*/ uint32 slot; -/*012*/ uint32 charges; -/*016*/ uint32 sell_price; -}; - -struct AdventurePoints_Update_Struct { -/*000*/ uint32 ldon_available_points; // Total available points -/*004*/ uint8 unkown_apu004[20]; -/*024*/ uint32 ldon_guk_points; // Earned Deepest Guk points -/*028*/ uint32 ldon_mirugal_points; // Earned Mirugal' Mebagerie points -/*032*/ uint32 ldon_mistmoore_points; // Earned Mismoore Catacombs Points -/*036*/ uint32 ldon_rujarkian_points; // Earned Rujarkian Hills points -/*040*/ uint32 ldon_takish_points; // Earned Takish points -/*044*/ uint8 unknown_apu042[216]; -}; - - -struct AdventureFinish_Struct{ - uint32 win_lose;//Cofruben: 00 is a lose,01 is win. - uint32 points; -}; -//OP_AdventureRequest -struct AdventureRequest_Struct{ - uint32 risk;//1 normal,2 hard. - uint32 entity_id; -}; -struct AdventureRequestResponse_Struct{ - uint32 unknown000; - char text[2048]; - uint32 timetoenter; - uint32 timeleft; - uint32 risk; - float x; - float y; - float z; - uint32 showcompass; - uint32 unknown2080; -}; - - - -/*struct Item_Shop_Struct { - uint16 merchantid; - uint8 itemtype; - Item_Struct item; - uint8 iss_unknown001[6]; -};*/ - -/* -** Illusion_Struct -** Changes client visible features -** Size: 168 bytes -** Used In: OP_Illusion, #face, Mob::SendIllusionPacket() -** Fields from the deprecated struct: -** uint8 unknown_26; //Always 26 -** uint8 haircolor; -** uint8 beardcolor; -** uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye? -** uint8 eyecolor2; -** uint8 hairstyle; -** uint8 aa_title; -** uint8 luclinface; // and beard -** Updated by Father Nitwit for 7-14-04 patch -** -*/ - -struct Illusion_Struct { -/*000*/ uint32 spawnid; -/*004*/ char charname[64]; -/*068*/ uint16 race; -/*070*/ char unknown070[2]; -/*072*/ uint8 gender; -/*073*/ uint8 texture; -/*074*/ uint8 helmtexture; -/*075*/ uint8 unknown075; -/*076*/ uint32 face; -/*080*/ uint8 hairstyle; -/*081*/ uint8 haircolor; -/*082*/ uint8 beard; -/*083*/ uint8 beardcolor; -/*084*/ float size; -/*088*/ char unknown084[80]; -/*168*/ -}; - - -struct ZonePoint_Entry { -/*0000*/ uint32 iterator; -/*0004*/ float y; -/*0008*/ float x; -/*0012*/ float z; -/*0016*/ float heading; -/*0020*/ uint16 zoneid; -/*0022*/ uint16 zoneinstance; // LDoN instance -}; - -struct ZonePoints { -/*0000*/ uint32 count; -/*0004*/ struct ZonePoint_Entry zpe[0]; // Always add one extra to the end after all zonepoints -}; - -struct SkillUpdate_Struct { -/*00*/ uint32 skillId; -/*04*/ uint32 value; -/*08*/ -}; - -struct ZoneUnavail_Struct { - //This actually varies, but... - char zonename[16]; - int16 unknown[4]; -}; - -struct GroupGeneric_Struct { - char name1[64]; - char name2[64]; -}; - -struct GroupCancel_Struct { - char name1[64]; - char name2[64]; - uint8 toggle; -}; - -struct GroupUpdate_Struct { -/*0000*/ uint32 action; -/*0004*/ char yourname[64]; -/*0068*/ char membername[5][64]; -/*0388*/ char leadersname[64]; -}; - -struct GroupUpdate2_Struct { -/*0000*/ uint32 action; -/*0004*/ char yourname[64]; -/*0068*/ char membername[5][64]; -/*0388*/ char leadersname[64]; -/*0452*/ GroupLeadershipAA_Struct leader_aas; -/*0580*/ uint8 unknown[188]; -/*0768*/ -}; -struct GroupJoin_Struct { -/*0000*/ uint32 action; -/*0004*/ char yourname[64]; -/*0068*/ char membername[64]; -/*0132*/ uint8 unknown[84]; -}; - -struct FaceChange_Struct { -/*000*/ uint8 haircolor; -/*001*/ uint8 beardcolor; -/*002*/ uint8 eyecolor1; // the eyecolors always seem to be the same, maybe left and right eye? -/*003*/ uint8 eyecolor2; -/*004*/ uint8 hairstyle; -/*005*/ uint8 beard; // vesuvias -/*006*/ uint8 face; -//vesuvias: -//there are only 10 faces for barbs changing woad just -//increase the face value by ten so if there were 8 woad -//designs then there would be 80 barb faces -}; - -/* -** Trade request from one client to another -** Used to initiate a trade -** Size: 8 bytes -** Used in: OP_TradeRequest -*/ -struct TradeRequest_Struct { -/*00*/ uint32 to_mob_id; -/*04*/ uint32 from_mob_id; -/*08*/ -}; - -struct TradeAccept_Struct { -/*00*/ uint32 from_mob_id; -/*04*/ uint32 unknown4; //seems to be garbage -/*08*/ -}; - -/* -** Cancel Trade struct -** Sent when a player cancels a trade -** Size: 8 bytes -** Used In: OP_CancelTrade -** -*/ -struct CancelTrade_Struct { -/*00*/ uint32 fromid; -/*04*/ uint32 action; -/*08*/ -}; - -struct PetitionUpdate_Struct { - uint32 petnumber; // Petition Number - uint32 color; // 0x00 = green, 0x01 = yellow, 0x02 = red - uint32 status; - uint32 senttime; // 4 has to be 0x1F - char accountid[32]; - char gmsenttoo[64]; - int32 quetotal; - char charname[64]; -}; - -struct Petition_Struct { - uint32 petnumber; - uint32 urgency; - char accountid[32]; - char lastgm[32]; - uint32 zone; - //char zone[32]; - char charname[64]; - uint32 charlevel; - uint32 charclass; - uint32 charrace; - uint32 unknown; - //time_t senttime; // Time? - uint32 checkouts; - uint32 unavail; - //uint8 unknown5[4]; - uint32 senttime; - uint32 unknown2; - char petitiontext[1024]; - char gmtext[1024]; -}; - - -struct Who_All_Struct { // 76 length total -/*000*/ char whom[64]; -/*064*/ uint32 wrace; // FF FF = no race - -/*066*/ uint32 wclass; // FF FF = no class -/*068*/ uint32 lvllow; // FF FF = no numbers -/*070*/ uint32 lvlhigh; // FF FF = no numbers -/*072*/ uint32 gmlookup; // FF FF = not doing /who all gm -/*074*/ uint32 unknown074; -/*076*/ uint8 unknown076[64]; -/*140*/ -}; - -struct Stun_Struct { // 4 bytes total - uint32 duration; // Duration of stun -}; - -struct AugmentItem_Struct { -/*00*/ int16 container_slot; -/*02*/ char unknown02[2]; -/*04*/ int32 augment_slot; -/*08*/ -}; - -// OP_Emote -struct Emote_Struct { -/*0000*/ uint32 unknown01; -/*0004*/ char message[1024]; -/*1028*/ -}; - -// Inspect -struct Inspect_Struct { - uint16 TargetID; - uint16 PlayerID; -}; -//OP_InspectAnswer -struct InspectResponse_Struct{//Cofruben:need to send two of this for the inspect response. -/*000*/ uint32 TargetID; -/*004*/ uint32 playerid; -/*008*/ char itemnames[21][64]; -/*1352*/char unknown_zero[64];//fill with zero's. -/*1416*/uint32 itemicons[21]; -/*1500*/uint32 unknown_zero2; -/*1504*/char text[288]; -}; - -//OP_SetDataRate -struct SetDataRate_Struct { - float newdatarate; -}; - -//OP_SetServerFilter -struct SetServerFilter_Struct { - uint32 filters[25]; //see enum eqFilterType -}; - -//Op_SetServerFilterAck -struct SetServerFilterAck_Struct { - uint8 blank[8]; -}; -struct IncreaseStat_Struct{ - /*0000*/ uint8 unknown0; - /*0001*/ uint8 str; - /*0002*/ uint8 sta; - /*0003*/ uint8 agi; - /*0004*/ uint8 dex; - /*0005*/ uint8 int_; - /*0006*/ uint8 wis; - /*0007*/ uint8 cha; - /*0008*/ uint8 fire; - /*0009*/ uint8 cold; - /*0010*/ uint8 magic; - /*0011*/ uint8 poison; - /*0012*/ uint8 disease; - /*0013*/ char unknown13[116]; - /*0129*/ uint8 str2; - /*0130*/ uint8 sta2; - /*0131*/ uint8 agi2; - /*0132*/ uint8 dex2; - /*0133*/ uint8 int_2; - /*0134*/ uint8 wis2; - /*0135*/ uint8 cha2; - /*0136*/ uint8 fire2; - /*0137*/ uint8 cold2; - /*0138*/ uint8 magic2; - /*0139*/ uint8 poison2; - /*0140*/ uint8 disease2; -}; - -struct GMName_Struct { - char oldname[64]; - char gmname[64]; - char newname[64]; - uint8 badname; - uint8 unknown[3]; -}; - -struct GMDelCorpse_Struct { - char corpsename[64]; - char gmname[64]; - uint8 unknown; -}; - -struct GMKick_Struct { - char name[64]; - char gmname[64]; - uint8 unknown; -}; - - -struct GMKill_Struct { - char name[64]; - char gmname[64]; - uint8 unknown; -}; - - -struct GMEmoteZone_Struct { - char text[512]; -}; - -// This is where the Text is sent to the client. -// Use ` as a newline character in the text. -// Variable length. -struct BookText_Struct { - uint8 window; // where to display the text (0xFF means new window) - uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. - char booktext[1]; // Variable Length -}; -// This is the request to read a book. -// This is just a "text file" on the server -// or in our case, the 'name' column in our books table. -struct BookRequest_Struct { - uint8 window; // where to display the text (0xFF means new window) - uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others. - char txtfile[1]; // Variable Length -}; - -/* -** Object/Ground Spawn struct -** Used for Forges, Ovens, ground spawns, items dropped to ground, etc -** Size: 92 bytes -** OpCodes: OP_CreateObject -** Last Updated: Oct-17-2003 -** -*/ -struct Object_Struct { -/*00*/ uint32 linked_list_addr[2];// They are, get this, prev and next, ala linked list -/*08*/ uint16 unknown008[2]; // -/*12*/ uint32 drop_id; // Unique object id for zone -/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in -/*18*/ uint16 zone_instance; // -/*20*/ uint32 unknown020; // -/*24*/ uint32 unknown024; // -/*28*/ float heading; // heading -/*32*/ float z; // z coord -/*36*/ float x; // x coord -/*40*/ float y; // y coord -/*44*/ char object_name[20]; // Name of object, usually something like IT63_ACTORDEF -/*64*/ float unknown064; // seems like coords, not always valid, all 0 on most world objects -/*68*/ float unknown068; // seems like coords, not always valid, all 0 on most world objects -/*72*/ float unknown072; // seems like coords, not always valid, all 0 on most world objects -/*76*/ uint32 unknown076; // -/*80*/ uint32 object_type; // Type of object, not directly translated to OP_OpenObject -/*84*/ uint32 unknown084; //set to 0xFF -/*88*/ uint32 spawn_id; // Spawn Id of client interacting with object -/*92*/ -}; -// 01 = generic drop, 02 = armor, 19 = weapon -//[13:40] and 0xff seems to be indicative of the tradeskill/openable items that end up returning the old style item type in the OP_OpenObject - -/* -** Click Object Struct -** Client clicking on zone object (forge, groundspawn, etc) -** Size: 8 bytes -** Last Updated: Oct-17-2003 -** -*/ -struct ClickObject_Struct { -/*00*/ uint32 drop_id; -/*04*/ uint32 player_id; -/*08*/ -}; - -struct Shielding_Struct { - uint32 target_id; -}; - -/* -** Click Object Acknowledgement Struct -** Response to client clicking on a World Container (ie, forge) -** -*/ -struct ClickObjectAck_Struct { -/*00*/ uint32 player_id; // Entity Id of player who clicked object -/*04*/ uint32 drop_id; // Zone-specified unique object identifier -/*08*/ uint32 open; // 1=opening, 0=closing -/*12*/ uint32 type; // See object.h, "Object Types" -/*16*/ uint32 unknown16; // -/*20*/ uint32 icon; // Icon to display for tradeskill containers -/*24*/ uint32 unknown24; // -/*28*/ char object_name[64]; // Object name to display -/*92*/ -}; - -/* -** This is different now, mostly unknown -** -*/ -struct CloseContainer_Struct { -/*00*/ uint32 player_id; // Entity Id of player who clicked object -/*04*/ uint32 drop_id; // Zone-specified unique object identifier -/*08*/ uint32 open; // 1=opening, 0=closing -/*12*/ uint32 unknown12[12]; -}; - -/* -** Generic Door Struct -** Length: 52 Octets -** Used in: -** cDoorSpawnsStruct(f721) -** -*/ -struct Door_Struct -{ -/*0000*/ char name[32]; // Filename of Door // Was 10char long before... added the 6 in the next unknown to it: Daeken M. BlackBlade -/*0032*/ float yPos; // y loc -/*0036*/ float xPos; // x loc -/*0040*/ float zPos; // z loc -/*0044*/ float heading; -/*0048*/ uint32 incline; // rotates the whole door -/*0052*/ uint16 size; // 100 is normal, smaller number = smaller model -/*0054*/ uint8 unknown0038[6]; -/*0060*/ uint8 doorId; // door's id # -/*0061*/ uint8 opentype; -/* - * Open types: - * 66 = PORT1414 (Qeynos) - * 55 = BBBOARD (Qeynos) - * 100 = QEYLAMP (Qeynos) - * 56 = CHEST1 (Qeynos) - * 5 = DOOR1 (Qeynos) - */ -/*0062*/ uint8 state_at_spawn; -/*0063*/ uint8 invert_state; // if this is 1, the door is normally open -/*0064*/ uint32 door_param; //this may index zone_points, representing the destination -/*0068*/ uint8 unknown0052[12]; // mostly 0s, the last 3 bytes are something tho -/*0080*/ -}; - - - -struct DoorSpawns_Struct { - struct Door_Struct doors[0]; -}; - -/* - OP Code: Op_ClickDoor - Size: 16 -*/ -struct ClickDoor_Struct { -/*000*/ uint8 doorid; -/*001*/ uint8 unknown001; // This may be some type of action setting -/*002*/ uint8 unknown002; // This is sometimes set after a lever is closed -/*003*/ uint8 unknown003; // Seen 0 -/*004*/ uint8 picklockskill; -/*005*/ uint8 unknown005[3]; -/*008*/ uint32 item_id; -/*012*/ uint16 player_id; -/*014*/ uint8 unknown014[2]; -/*016*/ -}; - -struct MoveDoor_Struct { - uint8 doorid; - uint8 action; -}; - - -struct BecomeNPC_Struct { - uint32 id; - int32 maxlevel; -}; - -struct Underworld_Struct { - float speed; - float y; - float x; - float z; -}; - -struct Resurrect_Struct { - uint32 unknown00; - uint16 zone_id; - uint16 instance_id; - float y; - float x; - float z; - char your_name[64]; - uint32 unknown88; - char rezzer_name[64]; - uint32 spellid; - char corpse_name[64]; - uint32 action; -/* 228 */ -}; - -struct SetRunMode_Struct { - uint8 mode; - uint8 unknown[3]; -}; - -//EnvDamage is EnvDamage2 without a few bytes at the end. - -struct EnvDamage2_Struct { -/*0000*/ uint32 id; -/*0004*/ uint16 unknown4; -/*0006*/ uint32 damage; -/*0010*/ uint8 unknown10[12]; -/*0022*/ uint8 dmgtype; //FA = Lava; FC = Falling -/*0023*/ uint8 unknown2[4]; -/*0027*/ uint16 constant; //Always FFFF -/*0029*/ uint16 unknown29; -}; - -//Bazaar Stuff =D - -struct BazaarWindowStart_Struct { - uint8 Action; - uint8 Unknown001; - uint16 Unknown002; -}; - - -struct BazaarWelcome_Struct { - BazaarWindowStart_Struct beginning; - uint32 traders; - uint32 items; - uint8 unknown1[8]; -}; - -struct BazaarSearch_Struct { - BazaarWindowStart_Struct beginning; - uint32 traderid; - uint32 class_; - uint32 race; - uint32 stat; - uint32 slot; - uint32 type; - char name[64]; - uint32 minprice; - uint32 maxprice; -}; -struct BazaarInspect_Struct{ - uint32 item_id; - uint32 unknown; - char name[64]; -}; -struct BazaarReturnDone_Struct{ - uint32 type; - uint32 traderid; - uint32 unknown8; - uint32 unknown12; - uint32 unknown16; -}; - -struct BazaarSearchResults_Struct { -/*000*/ BazaarWindowStart_Struct Beginning; -/*004*/ uint32 NumItems; -/*008*/ uint32 SerialNumber; -/*012*/ uint32 SellerID; -/*016*/ uint32 Cost; -/*020*/ uint32 ItemStat; -/*024*/ char ItemName[64]; -/*088*/ -}; - -struct ServerSideFilters_Struct { -uint8 clientattackfilters; // 0) No, 1) All (players) but self, 2) All (players) but group -uint8 npcattackfilters; // 0) No, 1) Ignore NPC misses (all), 2) Ignore NPC Misses + Attacks (all but self), 3) Ignores NPC Misses + Attacks (all but group) -uint8 clientcastfilters; // 0) No, 1) Ignore PC Casts (all), 2) Ignore PC Casts (not directed towards self) -uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts (not directed towards self) -}; - -/* -** Client requesting item statistics -** Size: 32 bytes -** Used In: OP_ItemLinkClick -** Last Updated: 2/15/2009 -** -*/ -struct ItemViewRequest_Struct { -/*000*/ uint32 item_id; -/*004*/ uint32 augments[5]; -/*024*/ uint32 link_hash; -/*028*/ char unknown028[4]; -/*032*/ -}; - - -/* - * Client to server packet - */ -struct PickPocket_Struct { -// Size 18 - uint32 to; - uint32 from; - uint16 myskill; - uint8 type; // -1 you are being picked, 0 failed , 1 = plat, 2 = gold, 3 = silver, 4 = copper, 5 = item - uint8 unknown1; // 0 for response, unknown for input - uint32 coin; - uint8 lastsix[2]; -}; -/* - * Server to client packet - */ - -struct sPickPocket_Struct { - // Size 28 = coin/fail - uint32 to; - uint32 from; - uint32 myskill; - uint32 type; - uint32 coin; - char itemname[64]; -}; - -struct LogServer_Struct { -// Op_Code OP_LOGSERVER -/*000*/ uint32 unknown000; -/*004*/ uint32 unknown004; -/*008*/ uint32 unknown008; -/*012*/ uint32 unknown012; // htonl(1) on live -/*016*/ uint32 unknown016; // htonl(1) on live -/*020*/ uint8 unknown020[12]; -/*032*/ char worldshortname[32]; -/*064*/ uint8 unknown064[32]; -/*096*/ char unknown096[16]; // 'pacman' on live -/*112*/ char unknown112[16]; // '64.37,148,36' on live -/*126*/ uint8 unknown128[48]; -/*176*/ uint32 unknown176; // htonl(0x00002695) -/*180*/ char unknown180[80]; // 'eqdataexceptions@mail.station.sony.com' on live -/*260*/ uint8 unknown260; // 0x01 on live -/*261*/ uint8 unknown261; // 0x01 on live -/*262*/ uint8 unknown262[2]; -/*264*/ -}; - -struct ApproveWorld_Struct { -// Size 544 -// Op_Code OP_ApproveWorld - uint8 unknown544[544]; -}; - -struct ClientError_Struct -{ -/*00001*/ char type; -/*00001*/ char unknown0001[69]; -/*00069*/ char character_name[64]; -/*00134*/ char unknown134[192]; -/*00133*/ char message[31994]; -/*32136*/ -}; - -struct MobHealth -{ - /*0000*/ uint8 hp; //health percent - /*0001*/ uint16 id;//mobs id -}; - -struct Track_Struct { - uint16 entityid; - uint16 padding002; - float distance; -}; - -struct Tracking_Struct { - Track_Struct Entrys[0]; -}; - -/* -** ZoneServerInfo_Struct -** Zone server information -** Size: 130 bytes -** Used In: OP_ZoneServerInfo -** -*/ -struct ZoneServerInfo_Struct -{ -/*0000*/ char ip[128]; -/*0128*/ uint16 port; -}; - -struct WhoAllPlayer{ - uint32 formatstring; - uint32 pidstring; - char* name; - uint32 rankstring; - char* guild; - uint32 unknown80[2]; - uint32 zonestring; - uint32 zone; - uint32 class_; - uint32 level; - uint32 race; - char* account; - uint32 unknown100; -}; - -struct WhoAllReturnStruct { - uint32 id; - uint32 playerineqstring; - char line[27]; - uint8 unknown35; //0A - uint32 unknown36;//0s - uint32 playersinzonestring; - uint32 unknown44[2]; //0s - uint32 unknown52;//1 - uint32 unknown56;//1 - uint32 playercount;//1 - struct WhoAllPlayer player[0]; -}; - -struct Trader_Struct { - uint32 code; - uint32 itemid[160]; - uint32 unknown; - uint32 itemcost[80]; -}; - -struct ClickTrader_Struct { - uint32 code; - uint32 unknown[161];//damn soe this is totally pointless :/ but at least your finally using memset! Good job :) -LE - uint32 itemcost[80]; -}; - -struct GetItems_Struct{ - uint32 items[80]; -}; - -struct BecomeTrader_Struct -{ - uint32 ID; - uint32 Code; -}; - -struct Trader_ShowItems_Struct{ - uint32 code; - uint32 traderid; - uint32 unknown08[3]; -}; - -struct TraderBuy_Struct{ - uint32 unknown0; - uint32 traderid; - uint32 itemid; - uint32 unknown8; - uint32 price; - uint32 quantity; - uint32 slot_num; - char itemname[60]; -}; - -struct TraderItemUpdate_Struct{ - uint32 unknown0; - uint32 traderid; - uint8 fromslot; - uint8 toslot; //7? - uint16 charges; -}; - -struct MoneyUpdate_Struct{ - int32 platinum; - int32 gold; - int32 silver; - int32 copper; -}; - -struct TraderDelItem_Struct{ - uint32 slotid; - uint32 quantity; - uint32 unknown; -}; - -struct TraderClick_Struct{ - uint32 traderid; - uint32 unknown4[2]; - uint32 approval; -}; - -struct FormattedMessage_Struct{ - uint32 unknown0; - uint32 string_id; - uint32 type; - char message[0]; -}; -struct SimpleMessage_Struct{ - uint32 string_id; - uint32 color; - uint32 unknown8; -}; - -struct GuildMemberEntry_Struct { - char name[1]; //variable length - uint32 level; //network byte order - uint32 banker; //1=yes, 0=no, network byte order - uint32 class_; //network byte order - uint32 rank; //network byte order - uint32 time_last_on; //network byte order - uint32 tribute_enable; //network byte order - uint32 total_tribute; //total guild tribute donated, network byte order - uint32 last_tribute; //unix timestamp - char public_note[1]; //variable length. - uint16 zoneinstance; //network byte order - uint16 zone_id; //network byte order -/* 38 + strings */ -}; - -struct GuildMembers_Struct { //just for display purposes, this is not actually used in the message encoding. - char player_name[1]; //variable length. - uint32 count; //network byte order - GuildMemberEntry_Struct member[0]; -}; - -struct GuildMOTD_Struct{ -/*0000*/ uint32 unknown0; -/*0004*/ char name[64]; -/*0068*/ char setby_name[64]; -/*0132*/ uint32 unknown132; -/*0136*/ char motd[512]; -}; -struct GuildUpdate_PublicNote{ - uint32 unknown0; - char name[64]; - char target[64]; - char note[100]; //we are cutting this off at 100, actually around 252 -}; -struct GuildDemoteStruct{ - char name[64]; - char target[64]; -}; -struct GuildRemoveStruct{ - char target[64]; - char name[64]; - uint32 unknown128; - uint32 leaderstatus; //? -}; -struct GuildMakeLeader{ - char name[64]; - char target[64]; -}; -struct BugStruct{ -/*0000*/ char chartype[64]; -/*0064*/ char name[96]; -/*0160*/ char ui[128]; -/*0288*/ float x; -/*0292*/ float y; -/*0296*/ float z; -/*0300*/ float heading; -/*0304*/ uint32 unknown304; -/*0308*/ uint32 type; -/*0312*/ char unknown312[2144]; -/*2456*/ char bug[1024]; -/*3480*/ char placeholder[2]; -/*3482*/ char system_info[4098]; -}; - -struct Ground_Spawn{ - float max_x; - float max_y; - float min_x; - float min_y; - float max_z; - float heading; - char name[16]; - uint32 item; - uint32 max_allowed; - uint32 respawntimer; -}; -struct Ground_Spawns { - struct Ground_Spawn spawn[50]; //Assigned max number to allow -}; -struct PetitionBug_Struct{ - uint32 petition_number; - uint32 unknown4; - char accountname[64]; - uint32 zoneid; - char name[64]; - uint32 level; - uint32 class_; - uint32 race; - uint32 unknown152[3]; - uint32 time; - uint32 unknown168; - char text[1028]; -}; - -struct DyeStruct -{ - union - { - struct - { - struct Color_Struct head; - struct Color_Struct chest; - struct Color_Struct arms; - struct Color_Struct wrists; - struct Color_Struct hands; - struct Color_Struct legs; - struct Color_Struct feet; - struct Color_Struct primary; // you can't actually dye this - struct Color_Struct secondary; // or this - } - dyes; - struct Color_Struct dye[9]; - }; -}; - -struct ApproveZone_Struct { - char name[64]; - uint32 zoneid; - uint32 approve; -}; -struct ZoneInSendName_Struct { - uint32 unknown0; - char name[64]; - char name2[64]; - uint32 unknown132; -}; -struct ZoneInSendName_Struct2 { - uint32 unknown0; - char name[64]; - uint32 unknown68[145]; -}; - -static const uint32 MAX_TRIBUTE_TIERS = 10; - -struct StartTribute_Struct { - uint32 client_id; - uint32 tribute_master_id; - uint32 response; -}; - -struct TributeLevel_Struct { - uint32 level; //backwards byte order! - uint32 tribute_item_id; //backwards byte order! - uint32 cost; //backwards byte order! -}; - -struct TributeAbility_Struct { - uint32 tribute_id; //backwards byte order! - uint32 tier_count; //backwards byte order! - TributeLevel_Struct tiers[MAX_TRIBUTE_TIERS]; - char name[0]; -}; - -struct GuildTributeAbility_Struct { - uint32 guild_id; - TributeAbility_Struct ability; -}; - -struct SelectTributeReq_Struct { - uint32 client_id; //? maybe action ID? - uint32 tribute_id; - uint32 unknown8; //seen E3 00 00 00 -}; - -struct SelectTributeReply_Struct { - uint32 client_id; //echoed from request. - uint32 tribute_id; - char desc[0]; -}; - -struct TributeInfo_Struct { - uint32 active; //0 == inactive, 1 == active - uint32 tributes[MAX_PLAYER_TRIBUTES]; //-1 == NONE - uint32 tiers[MAX_PLAYER_TRIBUTES]; //all 00's - uint32 tribute_master_id; -}; - -struct TributeItem_Struct { - uint32 slot; - uint32 quantity; - uint32 tribute_master_id; - int32 tribute_points; -}; - -struct TributePoint_Struct { - int32 tribute_points; - uint32 unknown04; - int32 career_tribute_points; - uint32 unknown12; -}; - -struct TributeMoney_Struct { - uint32 platinum; - uint32 tribute_master_id; - int32 tribute_points; -}; - - -struct Split_Struct -{ - uint32 platinum; - uint32 gold; - uint32 silver; - uint32 copper; -}; - - -/* -** New Combine Struct -** Client requesting to perform a tradeskill combine -** Size: 4 bytes -** Used In: OP_TradeSkillCombine -** Last Updated: Oct-15-2003 -** -*/ -struct NewCombine_Struct { -/*00*/ int16 container_slot; -/*02*/ int16 guildtribute_slot; -/*04*/ -}; - - -//client requesting favorite recipies -struct TradeskillFavorites_Struct { - uint32 object_type; - uint32 some_id; - uint32 favorite_recipes[500]; -}; - -//search request -struct RecipesSearch_Struct { - uint32 object_type; //same as in favorites - uint32 some_id; //same as in favorites - uint32 mintrivial; - uint32 maxtrivial; - char query[56]; - uint32 unknown4; //is set to 00 03 00 00 - uint32 unknown5; //is set to 4C DD 12 00 -/*80*/ -}; - -//one sent for each item, from server in reply to favorites or search -struct RecipeReply_Struct { - uint32 object_type; - uint32 some_id; //same as in favorites - uint32 component_count; - uint32 recipe_id; - uint32 trivial; - char recipe_name[64]; -/*84*/ -}; - -//received and sent back as an ACK with different reply_code -struct RecipeAutoCombine_Struct { - uint32 object_type; - uint32 some_id; - uint32 unknown1; //echoed in reply - uint32 recipe_id; - uint32 reply_code; // 93 64 e1 00 (junk) in request - // 00 00 00 00 in successful reply - // f5 ff ff ff in 'you dont have all the stuff' reply -}; - -struct LevelAppearance_Struct { //Sends a little graphic on level up - uint32 spawn_id; - uint32 parm1; - uint32 value1a; - uint32 value1b; - uint32 parm2; - uint32 value2a; - uint32 value2b; - uint32 parm3; - uint32 value3a; - uint32 value3b; - uint32 parm4; - uint32 value4a; - uint32 value4b; - uint32 parm5; - uint32 value5a; - uint32 value5b; -/*64*/ -}; -struct MerchantList{ - uint32 id; - uint32 slot; - uint32 item; -}; -struct TempMerchantList{ - uint32 npcid; - uint32 slot; - uint32 item; - uint32 charges; //charges/quantity - uint32 origslot; -}; - - -struct FindPerson_Point { - float y; - float x; - float z; -}; - -struct FindPersonRequest_Struct { - uint32 npc_id; - FindPerson_Point client_pos; -}; - -//variable length packet of points -struct FindPersonResult_Struct { - FindPerson_Point dest; - FindPerson_Point path[0]; //last element must be the same as dest -}; - -struct MobRename_Struct { -/*000*/ char old_name[64]; -/*064*/ char old_name_again[64]; //not sure what the difference is -/*128*/ char new_name[64]; -/*192*/ uint32 unknown192; //set to 0 -/*196*/ uint32 unknown196; //set to 1 -/*200*/ -}; - -struct PlayMP3_Struct { - char filename[0]; -}; - -//this is for custom title display in the skill window -struct TitleEntry_Struct { - uint32 skill_id; - uint32 skill_value; - char title[1]; -}; - -struct Titles_Struct { - uint32 title_count; - TitleEntry_Struct titles[0]; -}; - -//this is for title selection by the client -struct TitleListEntry_Struct { - uint32 unknown0; //title ID - char prefix[1]; //variable length, null terminated - char postfix[1]; //variable length, null terminated -}; - -struct TitleList_Struct { - uint32 title_count; - TitleListEntry_Struct titles[0]; //list of title structs - //uint32 unknown_ending; seen 0x7265, 0 -}; - -struct SetTitle_Struct { - uint32 is_suffix; //guessed: 0 = prefix, 1 = suffix - uint32 title_id; -}; - -struct SetTitleReply_Struct { - uint32 is_suffix; //guessed: 0 = prefix, 1 = suffix - char title[32]; - uint32 entity_id; -}; - -struct TaskDescription_Struct { -/*000*/ uint32 activity_count; //not right. -/*004*/ uint32 taskid; -/*008*/ uint8 unk; -/*009*/ uint32 id3; -/*013*/ uint32 unknown13; -/*017*/ char name[1]; //variable length, 0 terminated -/*018*/ uint32 unknown18; -/*022*/ uint32 unknown22; -/*026*/ char desc[1]; //variable length, 0 terminated -/*027*/ uint32 reward_count; //not sure -/*031*/ uint32 unknown31; -/*035*/ uint32 unknown35; -/*039*/ uint16 unknown39; -/*041*/ char reward_link[1]; //variable length, 0 terminated -/*042*/ uint32 unknown43; //maybe crystal count? -}; - -struct TaskMemberList_Struct { -/*00*/ uint32 gopher_id; -/*04*/ uint32 unknown04; -/*08*/ uint32 member_count; //1 less than the number of members -/*12*/ char list_pointer[0]; -/* list is of the form: - char member_name[1] //null terminated string - uint8 task_leader //boolean flag -*/ -}; - - -struct TaskActivity_Struct { -/*000*/ uint32 activity_count; //not right -/*004*/ uint32 id3; -/*008*/ uint32 taskid; -/*012*/ uint32 activity_id; -/*016*/ uint32 unknown016; -/*020*/ uint32 activity_type; -/*024*/ uint32 unknown024; -/*028*/ uint32 unknown28; -/*032*/ char mob_name[1]; //variable length, 0 terminated -/*033*/ char item_name[1]; //variable length, 0 terminated -/*034*/ uint32 goal_count; -/*038*/ uint32 unknown38; //0xFFFFFFFF -/*042*/ uint32 unknown42; //0xFFFFFFFF -/*046*/ uint32 unknown46; //saw 0x151,0x156 -/*050*/ uint32 unknown50; //saw 0x404,0 -/*054*/ char activity_name[1]; //variable length, 0 terminated... commonly empty -/*055*/ uint32 done_count; -/*059*/ uint32 unknown59; //=1 except on unknown and terminal activities? -/*063*/ -}; - -struct TaskHistoryEntry_Struct { - uint32 task_id; - char name[1]; - uint32 completed_time; -}; -struct TaskHistory_Struct { - uint32 completed_count; - TaskHistoryEntry_Struct entries[0]; -}; - -struct AcceptNewTask_Struct { - uint32 task_id; //set to 0 for 'decline' - uint32 task_master_id; //entity ID -}; - -//was all 0's from client, server replied with same op, all 0's -struct CancelTask_Struct { - uint32 unknown0; - uint32 unknown4; -}; - -struct AvaliableTask_Struct { - uint32 task_index; //no idea, seen 0x1 - uint32 task_master_id; //entity ID - uint32 task_id; - uint32 unknown012; - uint32 activity_count; //not sure, seen 2 - char desc[1]; //variable length, 0 terminated - uint32 reward_platinum;//not sure on these - uint32 reward_gold; - uint32 reward_silver; - uint32 reward_copper; - char some_name[1]; //variable length, 0 terminated - uint8 unknown1; - uint32 unknown2; //0xFFFFFFFF - uint32 unknown3; //0xFFFFFFFF - uint32 unknown4; //seen 0x16 - uint8 unknown5; -}; - - -struct BankerChange_Struct { - uint32 platinum; - uint32 gold; - uint32 silver; - uint32 copper; - uint32 platinum_bank; - uint32 gold_bank; - uint32 silver_bank; - uint32 copper_bank; -}; - -struct LeadershipExpUpdate_Struct { -/*00*/ uint32 group_leadership_exp; -/*04*/ uint32 group_leadership_points; -/*08*/ uint32 raid_leadership_exp; -/*12*/ uint32 raid_leadership_points; -}; - -struct UpdateLeadershipAA_Struct { -/*00*/ uint32 ability_id; -/*04*/ uint32 new_rank; -/*08*/ uint32 pointsleft; -/*12*/ -}; - - -struct RaidGeneral_Struct { -/*00*/ uint32 action; //=10 -/*04*/ char player_name[64]; //should both be the player's name -/*04*/ char leader_name[64]; -/*132*/ uint32 parameter; -}; - -struct RaidAdd_Struct { -/*000*/ uint32 action; //=0 -/*004*/ char player_name[64]; //should both be the player's name -/*068*/ char leader_name[64]; -/*132*/ uint8 _class; -/*133*/ uint8 level; -/*134*/ uint8 has_group; -/*135*/ uint8 unknown135; //seems to be 0x42 or 0 -}; - -struct RaidCreate_Struct { -/*00*/ uint32 action; //=8 -/*04*/ char leader_name[64]; -/*68*/ uint32 leader_id; -}; - -struct RaidMemberInfo_Struct { -/*00*/ uint8 group_number; -/*01*/ char member_name[1]; //dyanmic length, null terminated '\0' -/*00*/ uint8 unknown00; -/*01*/ uint8 _class; -/*02*/ uint8 level; -/*03*/ uint8 is_raid_leader; -/*04*/ uint8 is_group_leader; -/*05*/ uint8 main_tank; //not sure -/*06*/ uint8 unknown06[5]; //prolly more flags -}; - -struct RaidDetails_Struct { -/*000*/ uint32 action; //=6,20 -/*004*/ char leader_name[64]; -/*068*/ uint32 unknown68[4]; -/*084*/ LeadershipAA_Struct abilities; //ranks in backwards byte order -/*128*/ uint8 unknown128[142]; -/*354*/ uint32 leader_id; -}; - -struct RaidMembers_Struct { -/*000*/ RaidDetails_Struct details; -/*358*/ uint32 member_count; //including leader -/*362*/ RaidMemberInfo_Struct members[1]; -/*...*/ RaidMemberInfo_Struct empty; //seem to have an extra member with a 0 length name on the end -}; - -struct DynamicWall_Struct { -/*00*/ char name[32]; -/*32*/ float y; -/*36*/ float x; -/*40*/ float z; -/*44*/ uint32 something; -/*48*/ uint32 unknown48; //0 -/*52*/ uint32 one_hundred; //0x64 -/*56*/ uint32 unknown56; //0 -/*60*/ uint32 something2; -/*64*/ int32 unknown64; //-1 -/*68*/ uint32 unknown68; //0 -/*72*/ uint32 unknown72; //0 -/*76*/ uint32 unknown76; //0x100 -/*80*/ -}; - -enum { //bandolier actions - BandolierCreate = 0, - BandolierRemove = 1, - BandolierSet = 2 -}; - -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 BandolierSet_Struct { -/*00*/ uint32 action; -/*04*/ uint8 number; -/*05*/ uint8 unknown05[35]; -}; - -struct Arrow_Struct { -/*000*/ uint32 type; //unsure on name, seems to be 0x1, dosent matter -/*005*/ uint8 unknown004[12]; -/*016*/ float src_y; -/*020*/ float src_x; -/*024*/ float src_z; -/*028*/ uint8 unknown028[12]; -/*040*/ float velocity; //4 is normal, 20 is quite fast -/*044*/ float launch_angle; //0-450ish, not sure the units, 140ish is straight -/*048*/ float tilt; //on the order of 125 -/*052*/ uint8 unknown052[8]; -/*060*/ float arc; -/*064*/ uint8 unknown064[12]; -/*076*/ uint32 source_id; -/*080*/ uint32 target_id; //entity ID -/*084*/ uint32 item_id; //1 to about 150ish -/*088*/ uint32 unknown088; //seen 125, dosent seem to change anything.. -/*092*/ uint32 unknown092; //seen 16, dosent seem to change anything -/*096*/ uint8 unknown096[5]; -/*101*/ char model_name[16]; -/*117*/ uint8 unknown117[19]; -}; - -//made a bunch of trivial structs for stuff for opcode finder to use -struct Consent_Struct { - char name[1]; //always at least a null -}; - -struct AdventureMerchant_Struct { - uint32 unknown_flag; //seems to be 1 - uint32 entity_id; -}; - -struct Save_Struct { - uint8 unknown00[192]; -}; - -struct GMToggle_Struct { - uint8 unknown0[64]; - uint32 toggle; -}; - -struct GroupInvite_Struct { - char invitee_name[64]; - char inviter_name[64]; -// uint8 unknown128[65]; -}; - -struct ColoredText_Struct { - uint32 color; - char msg[1]; -}; - -struct UseAA_Struct { - uint32 begin; - uint32 ability; - uint32 end; -}; - -struct AA_Ability { -/*00*/ uint32 skill_id; -/*04*/ uint32 base1; -/*08*/ uint32 base2; -/*12*/ uint32 slot; -}; - -struct SendAA_Struct { -/*0000*/ uint32 id; -/*0004*/ uint32 hotkey_sid; -/*0008*/ uint32 hotkey_sid2; -/*0012*/ uint32 title_sid; -/*0016*/ uint32 desc_sid; -/*0020*/ uint32 class_type; -/*0024*/ uint32 cost; -/*0028*/ uint32 seq; -/*0032*/ uint32 current_level; //1s, MQ2 calls this AARankRequired -/*0036*/ uint32 prereq_skill; //is < 0, abs() is category # -/*0040*/ uint32 prereq_minpoints; //min points in the prereq -/*0044*/ uint32 type; -/*0048*/ uint32 spellid; -/*0052*/ uint32 spell_type; -/*0056*/ uint32 spell_refresh; -/*0060*/ uint16 classes; -/*0062*/ uint16 berserker; //seems to be 1 if its a berserker ability -/*0064*/ uint32 max_level; -/*0068*/ uint32 last_id; -/*0072*/ uint32 next_id; -/*0076*/ uint32 cost2; -/*0080*/ uint32 unknown80[2]; //0s -/*0084*/ uint32 total_abilities; -/*0088*/ AA_Ability abilities[0]; -}; - -struct AA_List { - SendAA_Struct* aa[0]; -}; - -struct AA_Action { -/*00*/ uint32 action; -/*04*/ uint32 ability; -/*08*/ uint32 unknown08; -/*12*/ uint32 exp_value; -}; - -struct AA_Skills { //this should be removed and changed to AA_Array -/*00*/ uint32 aa_skill; -/*04*/ uint32 aa_value; -}; - -struct AAExpUpdate_Struct { -/*00*/ uint32 unknown00; //seems to be a value from AA_Action.ability -/*04*/ uint32 aapoints_unspent; -/*08*/ uint8 aaxp_percent; //% of exp that goes to AAs -/*09*/ uint8 unknown09[3]; //live dosent always zero these, so they arnt part of aaxp_percent -}; - - -struct AltAdvStats_Struct { -/*000*/ uint32 experience; -/*004*/ uint16 unspent; -/*006*/ uint16 unknown006; -/*008*/ uint8 percentage; -/*009*/ uint8 unknown009[3]; -}; - -struct PlayerAA_Struct { - AA_Skills aa_list[MAX_PP_AA_ARRAY]; -}; - -struct AATable_Struct { - AA_Skills aa_list[MAX_PP_AA_ARRAY]; -}; - -struct Weather_Struct { - uint32 val1; //generall 0x000000FF - uint32 type; //0x31=rain, 0x02=snow(i think), 0 = normal - uint32 mode; -}; - -struct ZoneInUnknown_Struct { - uint32 val1; - uint32 val2; - uint32 val3; -}; - -struct MobHealth_Struct { - uint16 entity_id; - uint8 hp; -}; - -struct AnnoyingZoneUnknown_Struct { - uint32 entity_id; - uint32 value; //always 4 -}; - -struct ApplyPoison_Struct { - uint32 inventorySlot; - uint32 success; -}; - -struct GuildMemberUpdate_Struct { -/*00*/ uint32 guild_id; //not sure -/*04*/ char member_name[64]; -/*68*/ uint16 zone_id; -/*70*/ uint16 instance_id; -/*72*/ uint32 unknown072; -}; - - }; //end namespace structs -}; //end namespace Client62 - -#endif /*CLIENT62_STRUCTS_H_*/ - - - - - - - - - - diff --git a/common/patches/patches.cpp b/common/patches/patches.cpp index 50d77a43f..b993b57dd 100644 --- a/common/patches/patches.cpp +++ b/common/patches/patches.cpp @@ -2,7 +2,6 @@ #include "../debug.h" #include "patches.h" -#include "client62.h" #include "titanium.h" #include "underfoot.h" #include "sof.h" @@ -11,7 +10,6 @@ #include "rof2.h" void RegisterAllPatches(EQStreamIdentifier &into) { - Client62::Register(into); Titanium::Register(into); SoF::Register(into); SoD::Register(into); @@ -21,7 +19,6 @@ void RegisterAllPatches(EQStreamIdentifier &into) { } void ReloadAllPatches() { - Client62::Reload(); Titanium::Reload(); SoF::Reload(); SoD::Reload(); diff --git a/utils/patches/patch_6.2.conf b/utils/patches/patch_6.2.conf deleted file mode 100644 index 8eca3dd4e..000000000 --- a/utils/patches/patch_6.2.conf +++ /dev/null @@ -1,539 +0,0 @@ -#ShowEQ Import Notes: -# ZERO THE FILE first -# sed 's/0x[0-9a-fA-F]{4}/0x0000/g' -#Unknown Mapping: -#OP_Action2 -> OP_Damage -#OP_EnvDamage -> OP_Damage ---> might have been a one time mistake -#Name Differences: -#OP_CancelInvite -> OP_GroupCancelInvite -#OP_GMFind -> OP_FindPersonRequest - -OP_Unknown=0x0000 -OP_ExploreUnknown=0x0292 #used for unknown explorer -#world packets -OP_ApproveWorld=0x41b1 # ShowEQ 06/29/05 -OP_LogServer=0x4668 # EQEmu 06/29/05 -OP_MOTD=0x7fea # EQEmu 06/29/05 -OP_SendLoginInfo=0x2792 # EQEmu 06/29/05 -OP_DeleteCharacter=0x0920 # ShowEQ 06/29/05 -OP_SendCharInfo=0x732c # EQEmu 06/29/05 -OP_ExpansionInfo=0x5c78 # EQEmu 06/29/05 -OP_CharacterCreate=0x6160 # EQEmu 06/29/05 -OP_RandomNameGenerator=0x23d4 # ShowEQ 06/29/05 -OP_GuildsList=0x6957 # ShowEQ 06/29/05 -OP_ApproveName=0x46b1 # EQEmu 06/29/05 -OP_EnterWorld=0x7262 # EQEmu 06/29/05 -OP_PostEnterWorld=0x0df0 # EQEmu 06/29/05 -OP_World_Client_CRC1=0x254d # ShowEQ 06/29/05 -OP_World_Client_CRC2=0x16c9 # ShowEQ 06/29/05 -OP_SetChatServer=0x6238 # EQEmu 06/29/05 -OP_SetChatServer2=0x6536 # EQEmu 06/29/05 -OP_ZoneServerInfo=0x407c # EQEmu 06/29/05 -OP_WorldComplete=0x509d # EQEmu 06/29/05 -OP_WorldClientReady=0x5e99 # EQEmu 06/29/05 (Guess - Doodman) -OP_WorldUnknown001=0x7510 # EQEmu 06/29/05 (New to 6/29) -OP_SendSystemStats=0x681b # anonymous system stats reporting -OP_WorldLogout=0x7186 -OP_ZoneUnavail=0x6d95 -OP_WorldLevelTooHigh=0x583b # world->client. Cancels zone in. -OP_CharInacessable=0x28aa # world->client. Cancels zone in. -#OP_InvalidLoginPassword=0x52A4 - -#Zone in opcodes -OP_ZoneEntry=0x2ec9 # ShowEQ 06/29/05 -OP_ZoneInUnknown=0x0000 -OP_AckPacket=0x7752 # ShowEQ 06/29/05 -OP_NewZone=0x7ac5 # ShowEQ 06/29/05 -OP_ReqClientSpawn=0x0e76 # ShowEQ 06/29/05 -OP_ZoneSpawns=0x5ee8 # ShowEQ 06/29/05 -OP_CharInventory=0x15ff # EQEmu 06/29/05 -OP_SetServerFilter=0x7709 # ShowEQ 06/29/05 -OP_LockoutTimerInfo=0x7c12 # EQEmu 06/29/05 -OP_SendZonepoints=0x775d # EQEmu 06/29/05 -OP_SpawnDoor=0x4c24 # ShowEQ 06/29/05 -OP_ReqNewZone=0x47c9 # ShowEQ 06/29/05 -OP_PlayerProfile=0x75df # ShowEQ 06/29/05 -OP_TimeOfDay=0x1580 # ShowEQ 06/29/05 -OP_SendAATable=0x367d # ShowEQ 06/29/05 -OP_ZoneServerReady=0x0000 #dosent exist in this version - - -OP_Logout=0x0701 # EQEmu 06/29/05 -OP_LogoutReply=0x48c2 # ShowEQ 06/29/05 (OP_Logout) -OP_PreLogoutReply=0x711e #0 len packet sent during logout/zoning -OP_LevelUpdate=0x6d44 # ShowEQ 06/29/05 -OP_MobUpdate=0x0000 -OP_Stamina=0x74ab # ShowEQ 06/29/05 - -#Petition Opcodes -OP_PetitionSearch=0x2aec #search term for petition -OP_PetitionSearchResults=0x2aec #(list of?) matches from search -OP_PetitionSearchText=0x0000 #text results of search -OP_Petition=0x251f #0x73cb -OP_PetitionUpdate=0x3813 #guess -OP_PetitionCheckout=0x0000 -OP_PetitionCheckIn=0x0000 -OP_PetitionQue=0x0000 -OP_PetitionUnCheckout=0x0000 -OP_PetitionDelete=0x0000 -OP_DeletePetition=0x0000 -OP_PetitionResolve=0x6ea9 #0x688f # ShowEQ 5/11/05 -OP_PDeletePetition=0x0000 -OP_PetitionBug=0x0000 -OP_PetitionRefresh=0x0000 -OP_PetitionCheckout2=0x0000 -OP_PetitionViewPetition=0x0000 - -#Guild Opcodes -OP_ZoneGuildList=0x68AC -OP_GuildMemberList=0x147d # ShowEQ 06/29/05 -OP_GuildMemberUpdate=0x4cc7 # ShowEQ 06/29/05 -OP_GuildMemberLevelUpdate=0x0000 #dosent exist in this version. -OP_GuildRemove=0x6cce # EQEmu - Doodman (found 8/26/05 -OP_GuildPeace=0x0e37 # EQEmu - Doodman (found 8/26/05 -OP_GuildWar=0x186d # EQEmu - Doodman (found 8/26/05 -OP_GuildLeader=0x1ef1 # EQEmu - Doodman (found 8/26/05) -OP_GuildDemote=0x1f46 # EQEmu - Doodman (found 8/26/05) -OP_GuildMOTD=0x21ed # ShowEQ 06/29/05 -OP_SetGuildMOTD=0x475a # EQEmu - Doodman (found 8/26/05) -OP_GetGuildsList=0x7fec # ShowEQ 06/29/05 -OP_GuildInvite=0x61d0 # EQEmu - Doodman (found 8/26/05) -OP_GuildPublicNote=0x17a2 # EQEmu - Doodman (found 8/26/05) -OP_GuildDelete=0x5a4d # EQEmu - Doodman (found 8/26/05 -OP_GuildInviteAccept=0x0179 # EQEmu - Doodman (found 8/26/05) -OP_GetGuildMOTD=0x3246 -OP_GetGuildMOTDReply=0x5B14 -OP_GuildManageBanker=0x3d1e -OP_GuildBank=0x0000 -#guild opcodes: 549F (clear guild?), 0x0695, 0x0AC0, 0x1864, 0x32cf, 0x4cc7, -# 0x461A, 0x6966, 0x7085 - - -#GM/guide opcodes -OP_GMServers=0x3387 #/servers -OP_GMBecomeNPC=0x7864 #/becomenpc -OP_GMZoneRequest=0x61ff #/zone -OP_GMSearchCorpse=0x7f3e #/searchcorpse -OP_GMHideMe=0x0581 #/hideme -OP_GMGoto=0x69c8 #/goto -OP_GMDelCorpse=0x727a #/delcorpse -OP_GMApproval=0x0000 -OP_GMToggle=0x5ce2 #/toggle -OP_GMZoneRequest2=0x0000 -OP_GMSummon=0x3383 #/summon -OP_GMEmoteZone=0x3905 #/emotezone -OP_GMFind=0x5e6a #/find -OP_GMKick=0x1cee #/kick -OP_GMNameChange=0x0000 - -OP_SafePoint=0x0000 -OP_Bind_Wound=0x4796 -OP_GMTraining=0x613d -OP_GMEndTraining=0x181c -OP_GMTrainSkill=0x3838 -OP_GMEndTrainingResponse=0x0a94 -OP_Animation=0x0b71 # EQEmu 06/29/05 -OP_Taunt=0x5306 -OP_Stun=0x7DCF -OP_MoneyUpdate=0x425c -OP_SendAAStats=0x5966 # EQEmu 06/29/05 -OP_SendExpZonein=0x0587 # ShowEQ 06/29/05 -OP_RespondAA=0x35e8 -OP_UpdateAA=0x0000 -OP_IncreaseStats=0x0000 -OP_ReadBook=0x1496 -OP_CombatAbility=0x5e55 -OP_Dye=0x773f # ShowEQ 06/29/05 -OP_Consume=0x7a83 # ShowEQ 06/29/05 -OP_Begging=0x2c81 # ShowEQ 06/29/05 -OP_InspectRequest=0x2403 -OP_Action2=0x0000 # ShowEQ 06/29/05 -OP_BeginCast=0x3990 # ShowEQ 06/29/05 -OP_WhoAllRequest=0x5cdd # ShowEQ 06/29/05 -OP_ColoredText=0x4bc6 # ShowEQ 06/29/05 -OP_Consent=0x1081 # ShowEQ 06/29/05 -OP_LFGCommand=0x022f # ShowEQ 06/29/05 -OP_LFGGetMatchesRequest=0x6f82 # ShowEQ 06/29/05 -OP_LFGAppearance=0x024d -OP_LFGResponse=0x1fe1 # ShowEQ 5/11/05 -OP_LFGGetMatchesResponse=0x06c5 # ShowEQ 06/29/05 -OP_LootItem=0x2acf # ShowEQ 06/29/05 -OP_Bug=0x3eba # ShowEQ 06/29/05 -OP_BoardBoat=0x67c9 # ShowEQ 06/29/05 -OP_Save=0x6d9b # ShowEQ 06/29/05 -OP_Camp=0x2844 # ShowEQ 06/29/05 -OP_EndLootRequest=0x7fe4 # ShowEQ 06/29/05 -OP_LoadSpellSet=0x403e # ShowEQ 06/29/05 -OP_AutoAttack=0x6c47 # ShowEQ 06/29/05 -OP_AutoFire=0x6c53 -OP_Consider=0x2717 # ShowEQ 06/29/05 -OP_Emote=0x55bc # ShowEQ 06/29/05 -OP_PetCommands=0x58b2 # ShowEQ 06/29/05 -OP_PetBuffWindow=0x4e31 -OP_SpawnAppearance=0x18b7 # ShowEQ 06/29/05 -OP_DeleteSpawn=0x1a64 # ShowEQ 06/29/05 -OP_FormattedMessage=0x42cd # ShowEQ 06/29/05 -OP_WhoAllResponse=0x6686 # ShowEQ 06/29/05 -OP_AutoAttack2=0x0fa6 # ShowEQ 06/29/05 -OP_SetRunMode=0x0342 # ShowEQ 06/29/05 -OP_SimpleMessage=0x5a48 # ShowEQ 06/29/05 -OP_SaveOnZoneReq=0x2baf # ShowEQ 06/29/05 -OP_MoveDoor=0x0ef7 # ShowEQ 06/29/05 -OP_SenseHeading=0x5666 # ShowEQ 06/29/05 -OP_Buff=0x33dc # ShowEQ 06/29/05 -OP_LootComplete=0x20b2 # ShowEQ 06/29/05 -OP_EnvDamage=0x0990 -OP_Split=0x6a53 # ShowEQ 06/29/05 -OP_Surname=0x48fe # ShowEQ 06/29/05 -OP_ClearSurname=0x0000 -OP_MoveItem=0x7657 # ShowEQ 06/29/05 -OP_FaceChange=0x763b # ShowEQ 06/29/05 -OP_ItemPacket=0x3397 # ShowEQ 06/29/05 -OP_ItemLinkResponse=0x1d43 # ShowEQ 06/29/05 -OP_ClientReady=0x5e20 # ShowEQ 06/29/05 -OP_ZoneChange=0x60ef # ShowEQ 06/29/05 -OP_MemorizeSpell=0x05ac # ShowEQ 06/29/05 -OP_ItemLinkClick=0x53e5 # ShowEQ 06/29/05 -OP_SwapSpell=0x36b2 # ShowEQ 06/29/05 -OP_Forage=0x7c32 # ShowEQ 06/29/05 -OP_ConsentResponse=0x6380 # ShowEQ 06/29/05 -OP_BazaarSearch=0x524e # ShowEQ 06/29/05 -OP_NewSpawn=0x4f11 # ShowEQ 06/29/05 -OP_WearChange=0x601d # ShowEQ 06/29/05 -OP_Action=0x4513 # ShowEQ 06/29/05 -OP_SpecialMesg=0x5ef7 # ShowEQ 06/29/05 -OP_Bazaar=0x0000 -OP_LeaveBoat=0x7187 # ShowEQ 06/29/05 -OP_Weather=0x65ca # ShowEQ 06/29/05 -OP_LFPGetMatchesRequest=0x45d0 # ShowEQ 06/29/05 -OP_Illusion=0x7441 # ShowEQ 06/29/05 -OP_TargetMouse=0x2274 # ShowEQ 06/29/05 -OP_InspectAnswer=0x2dd6 # ShowEQ 06/29/05 -OP_GMKill=0x692c # ShowEQ 06/29/05 -OP_MoneyOnCorpse=0x2fca # ShowEQ 06/29/05 -OP_ClickDoor=0x700d # ShowEQ 06/29/05 -OP_LootRequest=0x2316 # ShowEQ 06/29/05 -OP_YellForHelp=0x2e20 # ShowEQ 06/29/05 -OP_ManaChange=0x0b2d # ShowEQ 06/29/05 -OP_ConsentDeny=0x4e8c # ShowEQ 06/29/05 -OP_LFPCommand=0x35a6 # ShowEQ 06/29/05 -OP_RandomReply=0x6cd5 # ShowEQ 06/29/05 -OP_DenyResponse=0x7c66 # ShowEQ 06/29/05 -OP_ConsiderCorpse=0x673c # ShowEQ 06/29/05 -OP_CorpseDrag=0x50c0 # -OP_CorpseDrop=0x7c7c # -OP_ConfirmDelete=0x28f2 # ShowEQ 06/29/05 -OP_MobHealth=0x3d2d # ShowEQ 06/29/05 -OP_SkillUpdate=0x6a93 # ShowEQ 06/29/05 -OP_RandomReq=0x21e0 # ShowEQ 06/29/05 -OP_CastSpell=0x4839 # ShowEQ 06/29/05 -OP_ClientUpdate=0x14cb # ShowEQ 06/29/05 -OP_MobUpdate=0x0000 #not used anymore, here for backwards compat -OP_Report=0x0375 # ShowEQ 06/29/05 -OP_GroundSpawn=0x736b # ShowEQ 06/29/05 -OP_TargetCommand=0x6563 #0x0dfe # ShowEQ 06/29/05 -OP_TargetHoTT=0x3ef6 -OP_LFPGetMatchesResponse=0x63fe # ShowEQ 06/29/05 -OP_Jump=0x4dbc # ShowEQ 06/29/05 -OP_ExpUpdate=0x5ecd # ShowEQ 06/29/05 -OP_AAAction=0x3af4 # ShowEQ 06/29/05 -OP_Death=0x5188 # ShowEQ 06/29/05 -OP_BecomeCorpse=0x128c -OP_GMLastName=0x0c81 # ShowEQ 06/29/05 -OP_InitialMobHealth=0x2ecc # ShowEQ 06/29/05 -OP_Mend=0x14ef # ShowEQ 06/29/05 -OP_MendHPUpdate=0x1ffa # ShowEQ 5/11/05 -OP_Feedback=0x224d # ShowEQ 06/29/05 -OP_TGB=0x5e51 # ShowEQ 06/29/05 -OP_InterruptCast=0x0db3 -OP_Damage=0x1848 # ShowEQ 06/29/05 (OP_Action2) -OP_ChannelMessage=0x1004 # ShowEQ 06/29/05 (OP_CommonMessage) -OP_LevelAppearance=0x358e -OP_MultiLineMsg=0x0000 -OP_Charm=0x10a1 -OP_DeleteSpell=0x3fe6 -OP_ApproveZone=0x0000 -OP_Assist=0x5D02 -OP_AugmentItem=0x539b -OP_BazaarInspect=0x0000 -OP_AAExpUpdate=0x6dd8 # ShowEQ 06/29/05 -OP_ClientError=0x0000 -OP_DeleteItem=0x1c4a -OP_DeleteCharge=0x0841 -OP_ControlBoat=0x0000 -OP_DumpName=0x0000 -OP_FeignDeath=0x2ad8 -OP_Fishing=0x0b36 -OP_Heartbeat=0x0000 -OP_InstillDoubt=0x389e -OP_ItemName=0x0000 -OP_LDoNButton=0x0000 -OP_LDoNOpen=0x083b -OP_MoveCoin=0x1dd9 -OP_ReloadUI=0x0000 -OP_ZonePlayerToBind=0x385e # FNW Discovered on Feb 9, 2007 -OP_Translocate=0x78c1 -OP_Sacrifice=0x5f62 -OP_ApplyPoison=0x4298 - -#bazaar trader stuff stuff: -#become and buy from -#Server->Client: [ Opcode: OP_Unknown (0x2403) Size: 8 ] -# 0: 46 01 00 00 39 01 00 00 | F...9... -OP_TraderDelItem=0x0da9 -OP_BecomeTrader=0x66f9 -OP_TraderShop=0x19d8 -OP_TraderItemUpdate=0x0000 -OP_Trader=0x0681 -OP_ShopItem=0x0000 -OP_TraderBuy=0x0f8e # ShowEQ 06/29/05 -OP_Barter=0x7460 - -#pc/npc trading -OP_TradeRequest=0x372f # ShowEQ 06/29/05 -OP_TradeAcceptClick=0x0065 # ShowEQ 06/29/05 -OP_TradeRequestAck=0x4048 # ShowEQ 06/29/05 -OP_TradeCoins=0x34c1 -OP_FinishTrade=0x6014 -OP_CancelTrade=0x2dc1 # ShowEQ 06/29/05 -OP_TradeMoneyUpdate=0x3e63 #not sure - -#merchant crap -OP_ShopPlayerSell=0x0e13 # ShowEQ 06/29/05 -OP_ShopEnd=0x7e03 # ShowEQ 06/29/05 -OP_ShopEndConfirm=0x0000 -OP_ShopPlayerBuy=0x221e -OP_ShopRequest=0x3c4b # ShowEQ 06/29/05 -OP_ShopDelItem=0x0000 #0x0da9 maybe, 16 bytes though - -#tradeskill stuff: -OP_ClickObject=0x0f47 # ShowEQ 06/29/05 -OP_ClickObjectAction=0x6937 # EQEMu 06/29/05 -OP_RecipeDetails=0x0353 # EQEMu 06/29/05 -OP_RecipesFavorite=0x23f0 -OP_RecipesSearch=0x31f8 # EQEmu 06/29/05 -OP_RecipeReply=0x4ea2 # EQEmu 06/29/05 -OP_RecipeAutoCombine=0x7822 -OP_TradeSkillCombine=0x0b40 # ShowEQ 06/29/05 - -OP_RequestDuel=0x28e1 -OP_DuelResponse=0x2e78 -OP_DuelResponse2=0x3bad #when accepted - -OP_RezzComplete=0x60fa -OP_RezzRequest=0x417a -OP_RezzAnswer=0x6219 -OP_SafeFallSuccess=0x5309 -OP_Shielding=0x0000 -OP_TargetReject=0x0000 -OP_TestBuff=0x0000 -OP_Track=0x5205 # ShowEQ 06/29/05 -OP_TrackTarget=0x71ae -OP_TrackUnknown=0x74e1 #size 0 right after OP_Track - -#Tribute Packets: -OP_OpenGuildTributeMaster=0x60b6 #open guild tribute master window -OP_OpenTributeMaster=0x512e #open tribute master window -OP_OpenTributeReply=0x0000 #reply to open request -OP_SelectTribute=0x625d #clicking on a tribute, and text reply -OP_TributeItem=0x6f6c #donating an item -OP_TributeMoney=0x27b3 #donating money -OP_TributeNPC=0x0000 #seems to be missing now -OP_TributeToggle=0x2688 #activating/deactivating tribute -OP_TributeTimer=0x4665 #a 4 byte tier update, 10 minutes for seconds -OP_TributePointUpdate=0x6463 #16 byte point packet -OP_TributeUpdate=0x5639 # ShowEQ 06/29/05 -OP_GuildTributeInfo=0x5e3d # EQEmu 06/29/05 -OP_TributeInfo=0x152d # EQEmu 06/29/05 -OP_SendGuildTributes=0x5e3a # request packet, 4 bytes -OP_SendTributes=0x067a # request packet, 4 bytes, migth be backwards -OP_CloseTributeMaster=0x7f25 #sent by client when they close window - -#Adventure packets: -OP_LeaveAdventure=0x0c0d -OP_AdventureFinish=0x3906 -OP_AdventureInfoRequest=0x2aaf #right click adventure recruiter -OP_AdventureInfo=0x1db5 #text reply to right click -OP_AdventureRequest=0x43fd -OP_AdventureDetails=0x3f26 -OP_AdventureData=0x0677 -OP_AdventureUpdate=0x64ac -OP_AdventureMerchantRequest=0x0950 -OP_AdventureMerchantResponse=0x4416 -OP_AdventureMerchantPurchase=0x413d -OP_AdventureMerchantSell=0x0097 -OP_AdventurePointsUpdate=0x420a #not sure, followed purchase -OP_AdventureStatsRequest=0x5fc7 -OP_AdventureStatsReply=0x56cd -OP_AdventureLeaderboardRequest=0x230a -OP_AdventureLeaderboardReply=0x0d0f -# request stats: 0x5fc7, reply 0x56cd -# request leaderboard: 0x230a, reply 0x0d0f - -#Group Opcodes -OP_GroupDisband=0x4033 # ShowEQ 06/29/05 -OP_GroupInvite=0x3853 # ShowEQ 06/29/05 -OP_GroupFollow=0x1b48 # ShowEQ 06/29/05 -OP_GroupUpdate=0x66ba # ShowEQ 06/29/05 -OP_GroupAcknowledge=0x0797 -OP_GroupCancelInvite=0x42c9 # ShowEQ 06/29/05 -OP_GroupDelete=0x0000 -OP_GroupFollow2=0x0000 #used with GroupInvite2 -OP_GroupInvite2=0x1f27 #this is sometimes sent instead of OP_GroupInvite -OP_CancelInvite=0x0000 - -OP_RaidJoin=0x0000 # ShowEQ 06/29/05 -OP_RaidInvite=0x1f21 # ShowEQ 06/29/05 -OP_RaidUpdate=0x1974 # EQEmu 06/29/05 - - -OP_ZoneComplete=0x0000 -OP_ItemLinkText=0x0000 -OP_ClearObject=0x8258 -OP_DisciplineUpdate=0x7180 -OP_DisciplineTimer=0x53df -OP_LocInfo=0x0000 -OP_FindPersonRequest=0x3c41 # ShowEQ 06/29/05 -OP_FindPersonReply=0x5711 -OP_ForceFindPerson=0x0000 -OP_LoginComplete=0x0000 -OP_Sound=0x4a1d -#OP_Zone_MissingName01=0x0000 #remove on recompile -OP_MobRename=0x3230 -OP_BankerChange=0x6a5b - -#Rogue packets -OP_SenseTraps=0x24ab # ShowEQ 06/29/05 -OP_PickPocket=0x4a2a -OP_DisarmTraps=0x0000 -OP_Disarm=0x17d9 -OP_Hide=0x6f64 # ShowEQ 06/29/05 -OP_Sneak=0x4312 # ShowEQ 06/29/05 - -#Task packets -#task complete related: 0x54eb (24 bytes), 0x4c8c (8 bytes), 0x6a1d (4 bytes) -OP_TaskActivityComplete=0x54eb -OP_CompletedTasks=0x53c4 # ShowEQ 06/29/05 -OP_TaskDescription=0x682d # ShowEQ 06/29/05 -OP_TaskActivity=0x3ba8 # ShowEQ 06/29/05 -OP_TaskMemberList=0x09b6 #not sure -OP_OpenNewTasksWindow=0x5e7c #combined with OP_AvaliableTask I think -OP_AvaliableTask=0x0000 -OP_AcceptNewTask=0x207f -OP_TaskHistoryRequest=0x3274 -OP_TaskHistoryReply=0x009c -OP_CancelTask=0x4c8c -OP_DeclineAllTasks=0x207f #not sure, 12 bytes - - -OP_RequestClientZoneChange=0x1235 -OP_PurchaseLeadershipAA=0x07f1 -OP_UpdateLeadershipAA=0x3eec -OP_LeadershipExpUpdate=0x7416 -OP_LeadershipExpToggle=0x17bf -OP_GroupUpdateLeaderAA=0x4c3f -OP_MarkNPC=0x5b37 -OP_ClearNPCMarks=0x1794 -OP_DoGroupLeadershipAbility=0x4ffe -OP_DelegateAbility=0x56eb - -#The following 4 Opcodes are for SoF only: -OP_FinishWindow=0x0000 #Trevius 03/15/09 -OP_FinishWindow2=0x0000 #Trevius 03/15/09 -OP_ItemVerifyRequest=0x0000 #Trevius 03/15/09 -OP_ItemVerifyReply=0x0000 #Trevius 03/15/09 - -#discovered opcodes not yet used: -OP_CrashDump=0x6d5d -OP_PlayMP3=0x0000 -OP_FriendsWho=0x41db -OP_MoveLogRequest=0x78e8 #gone I think -OP_MoveLogDisregard=0x0000 #gone I think -OP_ReclaimCrystals=0x12fd -OP_CrystalCountUpdate=0x0000 -OP_DynamicWall=0x0000 -OP_CustomTitles=0x2a28 # ShowEQ 06/29/05 -OP_RequestTitles=0x5eba # EQEmu 06/29/05 -OP_SendTitleList=0x3e89 # EQEmu 06/29/05 -OP_SetTitle=0x1f22 # EQEmu 06/29/05 -OP_SetTitleReply=0x5eab # EQEmu 06/29/05 -OP_Bandolier=0x6f0c -OP_PotionBelt=0x0719 -OP_OpenDiscordMerchant=0x0000 #8 bytes -OP_DiscordMerchantInventory=0x0000 #long item packet -OP_GiveMoney=0x56d4 #16 bytes, pp, gp, sp, cp. -OP_OnLevelMessage=0x1dde -OP_PopupResponse=0x3816 -OP_RequestKnowledgeBase=0x7584 -OP_KnowledgeBase=0x4a52 -OP_PlayerUnderWorld=0x46d9 -OP_PVPStats=0x5cc0 -OP_PVPLeaderBoardRequest=0x61d2 -OP_PVPLeaderBoardReply=0x1a59 -OP_PVPLeaderBoardDetailsRequest=0x06a2 -OP_PVPLeaderBoardDetailsReply=0x246a -OP_WeaponEquip1=0x6c5e -OP_WeaponEquip2=0x63da -OP_WeaponUnequip2=0x381d -OP_VoiceMacroIn=0x2866 -OP_VoiceMacroOut=0x2ec6 - -#named unknowns, to make looking for real unknown easier -OP_AnnoyingZoneUnknown=0x0000 # EQEmu 06/29/05 -OP_Some6ByteHPUpdate=0x0000 #seems to happen when you target group members -OP_SomeItemPacketMaybe=0x497c # EQEmu 06/29/05 -OP_QueryResponseThing=0x6379 -OP_FloatListThing=0x7510 # EQEmu 06/29/05 - -#Login opcodes -OP_SessionReady=0x0001 -OP_Login=0x0002 -OP_ServerListRequest=0x0004 -OP_PlayEverquestRequest=0x000d -OP_PlayEverquestResponse=0x0021 -OP_ChatMessage=0x0016 -OP_LoginAccepted=0x0017 -OP_ServerListResponse=0x0018 -OP_Poll=0x0029 -OP_EnterChat=0x000f -OP_PollResponse=0x0011 - -#raw opcodes -OP_RAWSessionRequest=0x0000 -OP_RAWSessionResponse=0x0000 -OP_RAWCombined=0x0000 -OP_RAWSessionDisconnect=0x0000 -OP_RAWKeepAlive=0x0000 -OP_RAWSessionStatRequest=0x0000 -OP_RAWSessionStatResponse=0x0000 -OP_RAWPacket=0x0000 -OP_RAWFragment=0x0000 -OP_RAWOutOfOrderAck=0x0000 -OP_RAWAck=0x0000 -OP_RAWAppCombined=0x0000 -OP_RAWOutOfSession=0x0000 - -#mail opcodes -OP_Command=0x0000 -OP_MailboxHeader=0x0000 -OP_MailHeader=0x0000 -OP_MailBody=0x0000 -OP_NewMail=0x0000 -OP_SentConfirm=0x0000 - - -#we need to document the differences between these packets to make identifying them easier -OP_MobHealth=0x3d2d # ShowEQ 06/29/05 -OP_HPUpdate=0x217b # ShowEQ 06/29/05 -OP_Some3ByteHPUpdate=0x0000 #initial HP update for mobs -OP_InitialHPUpdate=0x7ac2 # ShowEQ 06/29/05 - -#remove these -#junk -OP_0x0193=0x0000 -OP_0x0347=0x0000 -OP_ConsumeAmmo=0x0000 -OP_EmoteAnim=0x0000 -OP_Deny=0x0000 -OP_SetDataRate=0x0000 - diff --git a/world/clientlist.cpp b/world/clientlist.cpp index a18a9cafc..d0b90a266 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -1296,7 +1296,6 @@ void ClientList::GetClients(const char *zone_name, std::vector(EQClientUnknown)), - luabind::value("62", static_cast(EQClient62)), luabind::value("Titanium", static_cast(EQClientTitanium)), luabind::value("SoF", static_cast(EQClientSoF)), luabind::value("SoD", static_cast(EQClientSoD)), diff --git a/zone/tasks.cpp b/zone/tasks.cpp index f8f3ba9b2..1e73e3150 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2773,13 +2773,6 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN if(strlen(Tasks[TaskID]->Reward) != 0) { switch(c->GetClientVersion()) { - - case EQClient62: - { - MakeAnyLenString(&RewardTmp, "%c%07i-00001-00001-00001-00001-000013E0ABA6B%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); - break; - } case EQClientTitanium: { MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", @@ -2807,13 +2800,6 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN if(Item) { switch(c->GetClientVersion()) { - - case EQClient62: - { - MakeAnyLenString(&RewardTmp, "%c%07i-00001-00001-00001-00001-000013E0ABA6B%s%c", - 0x12, ItemID, Item->Name,0x12); - break; - } case EQClientTitanium: { MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", From 7d39ea59e8fecb5fbb7e89fdebba0db7f0b4c93b Mon Sep 17 00:00:00 2001 From: Leere Date: Wed, 17 Dec 2014 00:24:47 +0100 Subject: [PATCH 0646/1883] Fix for stackable items being unmoveable when charges=0 --- common/shareddb.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index cd8fd49e0..7dff17b43 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -565,7 +565,9 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { if(charges==0x7FFF) inst->SetCharges(-1); - else + else if (charges == 0 && inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable. + inst->SetCharges(1); + else inst->SetCharges(charges); if (item->ItemClass == ItemClassCommon) @@ -1234,6 +1236,9 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) // set it to 1 charge so that it is usable on creation if (charges == 0 && item->MaxCharges == -1) charges = 1; + // Stackable items need a minimum charge of 1 to remain moveable. + if(charges <= 0 && item->Stackable) + charges = 1; inst = new ItemInst(item, charges); From fc306bbc1d64ee796fdc2038f9fc02aa03159b14 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 16 Dec 2014 18:53:15 -0500 Subject: [PATCH 0647/1883] Fix for special attack NPC_CHASE_DISTANCE to now work correctly Perl export: NPC GetAttackDelay Perl export: NPC GetAvoidanceRating Perl export: NPC AddMeleeProc Special Attacks will no longer be able to hit immune to melee / bane only flagged NPCs. --- zone/mob.cpp | 166 ++++++++++++++++++++------------------- zone/npc.cpp | 1 + zone/npc.h | 1 + zone/perl_npc.cpp | 80 +++++++++++++++++++ zone/special_attacks.cpp | 3 + 5 files changed, 169 insertions(+), 82 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index e497ed05e..03f845184 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -542,6 +542,8 @@ float Mob::_GetMovementSpeed(int mod) const // http://everquest.allakhazam.com/db/item.html?item=1721;page=1;howmany=50#m10822246245352 if (IsRooted()) return 0.0f; + else if (IsPseudoRooted()) + return 0.000001f; float speed_mod = runspeed; @@ -5307,98 +5309,98 @@ int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot) } if (slot < 16){ - if (id == "classes") {stat = spells[spell_id].classes[slot]; } - else if (id == "dieties") {stat = spells[spell_id].deities[slot];} + if (id == "classes") {return spells[spell_id].classes[slot]; } + else if (id == "dieties") {return spells[spell_id].deities[slot];} } if (slot < 12){ - if (id == "base") {stat = spells[spell_id].base[slot];} - else if (id == "base2") {stat = spells[spell_id].base2[slot];} - else if (id == "max") {stat = spells[spell_id].max[slot];} - else if (id == "formula") {spells[spell_id].formula[slot];} - else if (id == "effectid") {spells[spell_id].effectid[slot];} + if (id == "base") {return spells[spell_id].base[slot];} + else if (id == "base2") {return spells[spell_id].base2[slot];} + else if (id == "max") {return spells[spell_id].max[slot];} + else if (id == "formula") {return spells[spell_id].formula[slot];} + else if (id == "effectid") {return spells[spell_id].effectid[slot];} } if (slot < 4){ - if (id == "components") { spells[spell_id].components[slot];} - else if (id == "component_counts") {spells[spell_id].component_counts[slot];} - else if (id == "NoexpendReagent") {spells[spell_id].NoexpendReagent[slot];} + if (id == "components") { return spells[spell_id].components[slot];} + else if (id == "component_counts") { return spells[spell_id].component_counts[slot];} + else if (id == "NoexpendReagent") {return spells[spell_id].NoexpendReagent[slot];} } - if (id == "range") {stat = static_cast(spells[spell_id].range); } - else if (id == "aoerange") {stat = static_cast(spells[spell_id].aoerange);} - else if (id == "pushback") {stat = static_cast(spells[spell_id].pushback);} - else if (id == "pushup") {stat = static_cast(spells[spell_id].pushup);} - else if (id == "cast_time") {stat = spells[spell_id].cast_time;} - else if (id == "recovery_time") {stat = spells[spell_id].recovery_time;} - else if (id == "recast_time") {stat = spells[spell_id].recast_time;} - else if (id == "buffdurationformula") {stat = spells[spell_id].buffdurationformula;} - else if (id == "buffduration") {stat = spells[spell_id].buffduration;} - else if (id == "AEDuration") {stat = spells[spell_id].AEDuration;} - else if (id == "mana") {stat = spells[spell_id].mana;} + if (id == "range") {return static_cast(spells[spell_id].range); } + else if (id == "aoerange") {return static_cast(spells[spell_id].aoerange);} + else if (id == "pushback") {return static_cast(spells[spell_id].pushback);} + else if (id == "pushup") {return static_cast(spells[spell_id].pushup);} + else if (id == "cast_time") {return spells[spell_id].cast_time;} + else if (id == "recovery_time") {return spells[spell_id].recovery_time;} + else if (id == "recast_time") {return spells[spell_id].recast_time;} + else if (id == "buffdurationformula") {return spells[spell_id].buffdurationformula;} + else if (id == "buffduration") {return spells[spell_id].buffduration;} + else if (id == "AEDuration") {return spells[spell_id].AEDuration;} + else if (id == "mana") {return spells[spell_id].mana;} //else if (id == "LightType") {stat = spells[spell_id].LightType;} - Not implemented - else if (id == "goodEffect") {stat = spells[spell_id].goodEffect;} - else if (id == "Activated") {stat = spells[spell_id].Activated;} - else if (id == "resisttype") {stat = spells[spell_id].resisttype;} - else if (id == "targettype") {stat = spells[spell_id].targettype;} - else if (id == "basedeiff") {stat = spells[spell_id].basediff;} - else if (id == "skill") {stat = spells[spell_id].skill;} - else if (id == "zonetype") {stat = spells[spell_id].zonetype;} - else if (id == "EnvironmentType") {stat = spells[spell_id].EnvironmentType;} - else if (id == "TimeOfDay") {stat = spells[spell_id].TimeOfDay;} - else if (id == "CastingAnim") {stat = spells[spell_id].CastingAnim;} - else if (id == "SpellAffectIndex") {stat = spells[spell_id].SpellAffectIndex; } - else if (id == "disallow_sit") {stat = spells[spell_id].disallow_sit; } + else if (id == "goodEffect") {return spells[spell_id].goodEffect;} + else if (id == "Activated") {return spells[spell_id].Activated;} + else if (id == "resisttype") {return spells[spell_id].resisttype;} + else if (id == "targettype") {return spells[spell_id].targettype;} + else if (id == "basedeiff") {return spells[spell_id].basediff;} + else if (id == "skill") {return spells[spell_id].skill;} + else if (id == "zonetype") {return spells[spell_id].zonetype;} + else if (id == "EnvironmentType") {return spells[spell_id].EnvironmentType;} + else if (id == "TimeOfDay") {return spells[spell_id].TimeOfDay;} + else if (id == "CastingAnim") {return spells[spell_id].CastingAnim;} + else if (id == "SpellAffectIndex") {return spells[spell_id].SpellAffectIndex; } + else if (id == "disallow_sit") {return spells[spell_id].disallow_sit; } //else if (id == "spellanim") {stat = spells[spell_id].spellanim; } - Not implemented - else if (id == "uninterruptable") {stat = spells[spell_id].uninterruptable; } - else if (id == "ResistDiff") {stat = spells[spell_id].ResistDiff; } - else if (id == "dot_stacking_exemp") {stat = spells[spell_id].dot_stacking_exempt; } - else if (id == "RecourseLink") {stat = spells[spell_id].RecourseLink; } - else if (id == "no_partial_resist") {stat = spells[spell_id].no_partial_resist; } - else if (id == "short_buff_box") {stat = spells[spell_id].short_buff_box; } - else if (id == "descnum") {stat = spells[spell_id].descnum; } - else if (id == "effectdescnum") {stat = spells[spell_id].effectdescnum; } - else if (id == "npc_no_los") {stat = spells[spell_id].npc_no_los; } - else if (id == "reflectable") {stat = spells[spell_id].reflectable; } - else if (id == "bonushate") {stat = spells[spell_id].bonushate; } - else if (id == "EndurCost") {stat = spells[spell_id].EndurCost; } - else if (id == "EndurTimerIndex") {stat = spells[spell_id].EndurTimerIndex; } - else if (id == "IsDisciplineBuf") {stat = spells[spell_id].IsDisciplineBuff; } - else if (id == "HateAdded") {stat = spells[spell_id].HateAdded; } - else if (id == "EndurUpkeep") {stat = spells[spell_id].EndurUpkeep; } - else if (id == "numhitstype") {stat = spells[spell_id].numhitstype; } - else if (id == "numhits") {stat = spells[spell_id].numhits; } - else if (id == "pvpresistbase") {stat = spells[spell_id].pvpresistbase; } - else if (id == "pvpresistcalc") {stat = spells[spell_id].pvpresistcalc; } - else if (id == "pvpresistcap") {stat = spells[spell_id].pvpresistcap; } - else if (id == "spell_category") {stat = spells[spell_id].spell_category; } - else if (id == "can_mgb") {stat = spells[spell_id].can_mgb; } - else if (id == "dispel_flag") {stat = spells[spell_id].dispel_flag; } - else if (id == "MinResist") {stat = spells[spell_id].MinResist; } - else if (id == "MaxResist") {stat = spells[spell_id].MaxResist; } - else if (id == "viral_targets") {stat = spells[spell_id].viral_targets; } - else if (id == "viral_timer") {stat = spells[spell_id].viral_timer; } - else if (id == "NimbusEffect") {stat = spells[spell_id].NimbusEffect; } - else if (id == "directional_start") {stat = static_cast(spells[spell_id].directional_start); } - else if (id == "directional_end") {stat = static_cast(spells[spell_id].directional_end); } - else if (id == "not_extendable") {stat = spells[spell_id].not_extendable; } - else if (id == "suspendable") {stat = spells[spell_id].suspendable; } - else if (id == "viral_range") {stat = spells[spell_id].viral_range; } - else if (id == "spellgroup") {stat = spells[spell_id].spellgroup; } - else if (id == "rank") {stat = spells[spell_id].rank; } - else if (id == "powerful_flag") {stat = spells[spell_id].powerful_flag; } - else if (id == "CastRestriction") {stat = spells[spell_id].CastRestriction; } - else if (id == "AllowRest") {stat = spells[spell_id].AllowRest; } - else if (id == "InCombat") {stat = spells[spell_id].InCombat; } - else if (id == "OutofCombat") {stat = spells[spell_id].OutofCombat; } - else if (id == "aemaxtargets") {stat = spells[spell_id].aemaxtargets; } - else if (id == "maxtargets") {stat = spells[spell_id].maxtargets; } - else if (id == "persistdeath") {stat = spells[spell_id].persistdeath; } - else if (id == "min_dist") {stat = static_cast(spells[spell_id].min_dist); } - else if (id == "min_dist_mod") {stat = static_cast(spells[spell_id].min_dist_mod); } - else if (id == "max_dist") {stat = static_cast(spells[spell_id].max_dist); } - else if (id == "min_range") {stat = static_cast(spells[spell_id].min_range); } - else if (id == "DamageShieldType") {stat = spells[spell_id].DamageShieldType; } + else if (id == "uninterruptable") {return spells[spell_id].uninterruptable; } + else if (id == "ResistDiff") {return spells[spell_id].ResistDiff; } + else if (id == "dot_stacking_exemp") {return spells[spell_id].dot_stacking_exempt; } + else if (id == "RecourseLink") {return spells[spell_id].RecourseLink; } + else if (id == "no_partial_resist") {return spells[spell_id].no_partial_resist; } + else if (id == "short_buff_box") {return spells[spell_id].short_buff_box; } + else if (id == "descnum") {return spells[spell_id].descnum; } + else if (id == "effectdescnum") {return spells[spell_id].effectdescnum; } + else if (id == "npc_no_los") {return spells[spell_id].npc_no_los; } + else if (id == "reflectable") {return spells[spell_id].reflectable; } + else if (id == "bonushate") {return spells[spell_id].bonushate; } + else if (id == "EndurCost") {return spells[spell_id].EndurCost; } + else if (id == "EndurTimerIndex") {return spells[spell_id].EndurTimerIndex; } + else if (id == "IsDisciplineBuf") {return spells[spell_id].IsDisciplineBuff; } + else if (id == "HateAdded") {return spells[spell_id].HateAdded; } + else if (id == "EndurUpkeep") {return spells[spell_id].EndurUpkeep; } + else if (id == "numhitstype") {return spells[spell_id].numhitstype; } + else if (id == "numhits") {return spells[spell_id].numhits; } + else if (id == "pvpresistbase") {return spells[spell_id].pvpresistbase; } + else if (id == "pvpresistcalc") {return spells[spell_id].pvpresistcalc; } + else if (id == "pvpresistcap") {return spells[spell_id].pvpresistcap; } + else if (id == "spell_category") {return spells[spell_id].spell_category; } + else if (id == "can_mgb") {return spells[spell_id].can_mgb; } + else if (id == "dispel_flag") {return spells[spell_id].dispel_flag; } + else if (id == "MinResist") {return spells[spell_id].MinResist; } + else if (id == "MaxResist") {return spells[spell_id].MaxResist; } + else if (id == "viral_targets") {return spells[spell_id].viral_targets; } + else if (id == "viral_timer") {return spells[spell_id].viral_timer; } + else if (id == "NimbusEffect") {return spells[spell_id].NimbusEffect; } + else if (id == "directional_start") {return static_cast(spells[spell_id].directional_start); } + else if (id == "directional_end") {return static_cast(spells[spell_id].directional_end); } + else if (id == "not_extendable") {return spells[spell_id].not_extendable; } + else if (id == "suspendable") {return spells[spell_id].suspendable; } + else if (id == "viral_range") {return spells[spell_id].viral_range; } + else if (id == "spellgroup") {return spells[spell_id].spellgroup; } + else if (id == "rank") {return spells[spell_id].rank; } + else if (id == "powerful_flag") {return spells[spell_id].powerful_flag; } + else if (id == "CastRestriction") {return spells[spell_id].CastRestriction; } + else if (id == "AllowRest") {return spells[spell_id].AllowRest; } + else if (id == "InCombat") {return spells[spell_id].InCombat; } + else if (id == "OutofCombat") {return spells[spell_id].OutofCombat; } + else if (id == "aemaxtargets") {return spells[spell_id].aemaxtargets; } + else if (id == "maxtargets") {return spells[spell_id].maxtargets; } + else if (id == "persistdeath") {return spells[spell_id].persistdeath; } + else if (id == "min_dist") {return static_cast(spells[spell_id].min_dist); } + else if (id == "min_dist_mod") {return static_cast(spells[spell_id].min_dist_mod); } + else if (id == "max_dist") {return static_cast(spells[spell_id].max_dist); } + else if (id == "min_range") {return static_cast(spells[spell_id].min_range); } + else if (id == "DamageShieldType") {return spells[spell_id].DamageShieldType; } return stat; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 6fdab645c..d9833d856 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1942,6 +1942,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) else if(id == "special_attacks") { NPCSpecialAttacks(val.c_str(), 0, 1); return; } else if(id == "special_abilities") { ProcessSpecialAbilities(val.c_str()); return; } else if(id == "attack_speed") { attack_speed = (float)atof(val.c_str()); CalcBonuses(); return; } + else if(id == "attack_delay") { attack_delay = atoi(val.c_str()); CalcBonuses(); return; } else if(id == "atk") { ATK = atoi(val.c_str()); return; } else if(id == "accuracy") { accuracy_rating = atoi(val.c_str()); return; } else if(id == "avoidance") { avoidance_rating = atoi(val.c_str()); return; } diff --git a/zone/npc.h b/zone/npc.h index 081fca514..1e378d2ad 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -259,6 +259,7 @@ public: uint32 GetMinDMG() const {return min_dmg;} int16 GetSlowMitigation() const {return slow_mitigation;} float GetAttackSpeed() const {return attack_speed;} + uint8 GetAttackDelay() const {return attack_delay;} bool IsAnimal() const { return(bodytype == BT_Animal); } uint16 GetPetSpellID() const {return pet_spell_id;} void SetPetSpellID(uint16 amt) {pet_spell_id = amt;} diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index c1f8d8828..736db9565 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -2119,6 +2119,32 @@ XS(XS_NPC_GetAttackSpeed) XSRETURN(1); } +XS(XS_NPC_GetAttackDelay); /* prototype to pass -Wmissing-prototypes */ +XS(XS_NPC_GetAttackDelay) +{ + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: NPC::GetAttackDelay(THIS)"); + { + NPC * THIS; + float RETVAL; + dXSTARG; + + if (sv_derived_from(ST(0), "NPC")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(NPC *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type NPC"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetAttackDelay(); + XSprePUSH; PUSHn((double)RETVAL); + } + XSRETURN(1); +} + XS(XS_NPC_GetAccuracyRating); /* prototype to pass -Wmissing-prototypes */ XS(XS_NPC_GetAccuracyRating) { @@ -2145,6 +2171,32 @@ XS(XS_NPC_GetAccuracyRating) XSRETURN(1); } +XS(XS_NPC_GetAvoidanceRating); /* prototype to pass -Wmissing-prototypes */ +XS(XS_NPC_GetAvoidanceRating) +{ + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: NPC::GetAvoidanceyRating(THIS)"); + { + NPC * THIS; + int32 RETVAL; + dXSTARG; + + if (sv_derived_from(ST(0), "NPC")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(NPC *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type NPC"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetAvoidanceRating(); + XSprePUSH; PUSHu((UV)RETVAL); + } + XSRETURN(1); +} + XS(XS_NPC_GetSpawnKillCount); /* prototype to pass -Wmissing-prototypes */ XS(XS_NPC_GetSpawnKillCount) { @@ -2245,6 +2297,31 @@ XS(XS_NPC_GetMerchantProbability) { XSRETURN(1); } +XS(XS_NPC_AddMeleeProc); +XS(XS_NPC_AddMeleeProc) { + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: NPC::AddMeleePro(THIS,spellid,chance)"); + { + NPC * THIS; + int spell_id = (int)SvIV(ST(1)); + int chance = (int)SvIV(ST(2)); + dXSTARG; + + if (sv_derived_from(ST(0), "NPC")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(NPC *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type NPC"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->AddProcToWeapon(spell_id, true, chance); + } + XSRETURN_EMPTY; +} + #ifdef __cplusplus extern "C" #endif @@ -2342,11 +2419,14 @@ XS(boot_NPC) newXSproto(strcpy(buf, "GetSpellFocusHeal"), XS_NPC_GetSpellFocusHeal, file, "$"); newXSproto(strcpy(buf, "GetSlowMitigation"), XS_NPC_GetSlowMitigation, file, "$"); newXSproto(strcpy(buf, "GetAttackSpeed"), XS_NPC_GetAttackSpeed, file, "$"); + newXSproto(strcpy(buf, "GetAttackDelay"), XS_NPC_GetAttackDelay, file, "$"); newXSproto(strcpy(buf, "GetAccuracyRating"), XS_NPC_GetAccuracyRating, file, "$"); + newXSproto(strcpy(buf, "GetAvoidanceRating"), XS_NPC_GetAvoidanceRating, file, "$"); newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$"); newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$"); newXSproto(strcpy(buf, "SetMerchantProbability"), XS_NPC_SetMerchantProbability, file, "$$"); newXSproto(strcpy(buf, "GetMerchantProbability"), XS_NPC_GetMerchantProbability, file, "$"); + newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$"); XSRETURN_YES; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 282eeb11e..0f57a7147 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -103,6 +103,9 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if (!who) return; + if(who->GetInvul() || who->GetSpecialAbility(IMMUNE_MELEE) || who->GetSpecialAbility(IMMUNE_MELEE_EXCEPT_BANE)) + return; //-5? + int32 hate = max_damage; if(hate_override > -1) hate = hate_override; From ab5d0ad43f7b68ddbec02ab4a92869cc2a11967c Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 16 Dec 2014 20:20:22 -0500 Subject: [PATCH 0648/1883] Fix for NPC ranged procs --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index dbd6d4e2d..e289f41d2 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2731,7 +2731,7 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) { npc_spells_cache[iDBSpellsID]->attack_proc = tmpattack_proc; npc_spells_cache[iDBSpellsID]->proc_chance = tmpproc_chance; npc_spells_cache[iDBSpellsID]->range_proc = tmprange_proc; - npc_spells_cache[iDBSpellsID]->rproc_chance = tmpdproc_chance; + npc_spells_cache[iDBSpellsID]->rproc_chance = tmprproc_chance; npc_spells_cache[iDBSpellsID]->defensive_proc = tmpdefensive_proc; npc_spells_cache[iDBSpellsID]->dproc_chance = tmpdproc_chance; npc_spells_cache[iDBSpellsID]->fail_recast = tmppfail_recast; From a14f8058dae53d2f1dc4f0b83dbe146a38f3666b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 17 Dec 2014 01:52:00 -0500 Subject: [PATCH 0649/1883] Switch path stuff to vectors This should be more CPU cache friendly compared to lists so should be faster. (profiling looked promising) --- changelog.txt | 3 +++ zone/client_packet.cpp | 4 +-- zone/entity.cpp | 2 +- zone/fearpath.cpp | 2 +- zone/mob.h | 2 +- zone/pathing.cpp | 58 ++++++++++++++++++++---------------------- zone/pathing.h | 6 ++--- 7 files changed, 39 insertions(+), 38 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1a0be1590..d1184037d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/17/2014 == +demonstar55: Use vectors for route stuff, should be more CPU cache friendly so faster + == 12/15/2014 == Trevius: (RoF+) Implemented the 6th Augment Slot for Items. Trevius: Player Corpses now saved attuned settings for Items. diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index be7d559e5..82147ca43 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5714,7 +5714,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) } else { - std::list pathlist = zone->pathing->FindRoute(Start, End); + std::vector pathlist = zone->pathing->FindRoute(Start, End); if (pathlist.size() == 0) { @@ -5753,7 +5753,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) p.z = GetZ(); points.push_back(p); - for (std::list::iterator Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator) + for (auto Iterator = pathlist.begin(); Iterator != pathlist.end(); ++Iterator) { if ((*Iterator) == -1) // Teleporter { diff --git a/zone/entity.cpp b/zone/entity.cpp index 369e1503a..c7a980f3d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2636,7 +2636,7 @@ void EntityList::FindPathsToAllNPCs() while (it != npc_list.end()) { Map::Vertex Node0 = zone->pathing->GetPathNodeCoordinates(0, false); Map::Vertex Dest(it->second->GetX(), it->second->GetY(), it->second->GetZ()); - std::list Route = zone->pathing->FindRoute(Node0, Dest); + std::vector Route = zone->pathing->FindRoute(Node0, Dest); if (Route.size() == 0) printf("Unable to find a route to %s\n", it->second->GetName()); else diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 89b34c444..2e8e146aa 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -158,7 +158,7 @@ void Mob::CalculateNewFearpoint() Map::Vertex CurrentPosition(GetX(), GetY(), GetZ()); - std::list Route = zone->pathing->FindRoute(CurrentPosition, Loc); + std::vector Route = zone->pathing->FindRoute(CurrentPosition, Loc); if(Route.size() > 0) { diff --git a/zone/mob.h b/zone/mob.h index e0a969fc4..cb7b82948 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1225,7 +1225,7 @@ protected: Map::Vertex PathingLastPosition; int PathingLoopCount; int PathingLastNodeVisited; - std::list Route; + std::vector Route; LOSType PathingLOSState; Timer *PathingLOSCheckTimer; Timer *PathingRouteUpdateTimerShort; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 5501ad2ca..309d6c0ed 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -205,15 +205,15 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) } -std::list PathManager::FindRoute(int startID, int endID) +std::vector PathManager::FindRoute(int startID, int endID) { _log(PATHING__DEBUG, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); - std::list OpenList, ClosedList; + std::vector OpenList, ClosedList; - std::listRoute; + std::vectorRoute; AStarNode AStarEntry, CurrentNode; @@ -235,7 +235,7 @@ std::list PathManager::FindRoute(int startID, int endID) ClosedListFlag[CurrentNode.PathNodeID] = true; - OpenList.pop_front(); + OpenList.erase(OpenList.begin()); for(int i = 0; i < PATHNODENEIGHBOURS; ++i) { @@ -251,7 +251,7 @@ std::list PathManager::FindRoute(int startID, int endID) Route.push_back(endID); - std::list::iterator RouteIterator; + std::vector::iterator RouteIterator; while(CurrentNode.PathNodeID != startID) { @@ -300,7 +300,7 @@ std::list PathManager::FindRoute(int startID, int endID) bool AlreadyInOpenList = false; - std::list::iterator OpenListIterator, InsertionPoint = OpenList.end(); + std::vector::iterator OpenListIterator, InsertionPoint = OpenList.end(); for(OpenListIterator = OpenList.begin(); OpenListIterator != OpenList.end(); ++OpenListIterator) { @@ -350,11 +350,11 @@ bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2) return n1.Distance < n2.Distance; } -std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) +std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); - std::list noderoute; + std::vector noderoute; float CandidateNodeRangeXY = RuleR(Pathing, CandidateNodeRangeXY); @@ -365,7 +365,7 @@ std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) // int ClosestPathNodeToStart = -1; - std::list SortedByDistance; + std::vector SortedByDistance; PathNodeSortStruct TempNode; @@ -382,9 +382,9 @@ std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } } - SortedByDistance.sort(SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); - for(std::list::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) + for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { _log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); @@ -420,9 +420,9 @@ std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } } - SortedByDistance.sort(SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); - for(std::list::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) + for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { _log(PATHING__DEBUG, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); _log(PATHING__DEBUG, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", @@ -456,7 +456,7 @@ std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::list::iterator First, Second; + std::vector::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -487,7 +487,7 @@ std::list PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::list::iterator First, Second; + std::vector::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -611,7 +611,7 @@ void PathManager::MeshTest() if(j == i) continue; - std::list Route = FindRoute(PathNodes[i].id, PathNodes[j].id); + std::vector Route = FindRoute(PathNodes[i].id, PathNodes[j].id); if(Route.size() == 0) { @@ -638,7 +638,7 @@ void PathManager::SimpleMeshTest() for(uint32 j = 1; j < Head.PathNodeCount; ++j) { - std::list Route = FindRoute(PathNodes[0].id, PathNodes[j].id); + std::vector Route = FindRoute(PathNodes[0].id, PathNodes[j].id); if(Route.size() == 0) { @@ -695,7 +695,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Route.pop_front(); + Route.erase(Route.begin()); ++PathingTraversedNodes; @@ -784,7 +784,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } // We are on the same route, no LOS (or not checking this time, so pop off the node we just reached // - Route.pop_front(); + Route.erase(Route.begin()); ++PathingTraversedNodes; @@ -798,7 +798,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.pop_front(); + Route.erase(Route.begin()); if(Route.size() == 0) { @@ -814,7 +814,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.pop_front(); + Route.erase(Route.begin()); if(Route.size() == 0) return To; @@ -962,7 +962,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLastNodeVisited = Route.front(); - Route.pop_front(); + Route.erase(Route.begin()); ++PathingTraversedNodes; @@ -975,7 +975,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.pop_front(); + Route.erase(Route.begin()); if(Route.size() == 0) { @@ -991,7 +991,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.pop_front(); + Route.erase(Route.begin()); if(Route.size() == 0) return To; @@ -1103,7 +1103,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) int ClosestPathNodeToStart = -1; - std::list SortedByDistance; + std::vector SortedByDistance; PathNodeSortStruct TempNode; @@ -1120,9 +1120,9 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } } - SortedByDistance.sort(SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); - for(std::list::iterator Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) + for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { _log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); @@ -1262,9 +1262,7 @@ void Mob::PrintRoute() printf("Route is : "); - std::list::iterator Iterator; - - for(Iterator = Route.begin(); Iterator !=Route.end(); ++Iterator) + for(auto Iterator = Route.begin(); Iterator !=Route.end(); ++Iterator) { printf("%i, ", (*Iterator)); } diff --git a/zone/pathing.h b/zone/pathing.h index c01cb6853..8c131dbc3 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -3,7 +3,7 @@ #include "map.h" -#include +#include class Client; class Mob; @@ -60,8 +60,8 @@ public: static PathManager *LoadPathFile(const char *ZoneName); bool loadPaths(FILE *fp); void PrintPathing(); - std::list FindRoute(Map::Vertex Start, Map::Vertex End); - std::list FindRoute(int startID, int endID); + std::vector FindRoute(Map::Vertex Start, Map::Vertex End); + std::vector FindRoute(int startID, int endID); Map::Vertex GetPathNodeCoordinates(int NodeNumber, bool BestZ = true); bool CheckLosFN(Map::Vertex a, Map::Vertex b); From ad61eda7e0d4dee0680456aba35c2090df94fb30 Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 17 Dec 2014 01:27:30 -0600 Subject: [PATCH 0650/1883] RoF2 fix for being unable to close bags by right clicking or open multiple bags. --- common/eq_packet_structs.h | 10 +- common/patches/rof.cpp | 3 +- common/patches/rof2.cpp | 27 ++--- common/patches/rof2_structs.h | 201 +++++++++++++++++----------------- utils/patches/patch_RoF2.conf | 2 +- 5 files changed, 119 insertions(+), 124 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index ed62bb183..cec29178d 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -1380,19 +1380,19 @@ struct PlayerPositionUpdateServer_Struct struct PlayerPositionUpdateClient_Struct { /*0000*/ uint16 spawn_id; -/*0022*/ uint16 sequence; //increments one each packet +/*0002*/ uint16 sequence; //increments one each packet /*0004*/ float y_pos; // y coord /*0008*/ float delta_z; // Change in z -/*0016*/ float delta_x; // Change in x -/*0012*/ float delta_y; // Change in y +/*0012*/ float delta_x; // Change in x +/*0016*/ float delta_y; // Change in y /*0020*/ int32 animation:10, // animation delta_heading:10, // change in heading padding0020:12; // ***Placeholder (mostly 1) /*0024*/ float x_pos; // x coord /*0028*/ float z_pos; // z coord -/*0034*/ uint16 heading:12, // Directional heading +/*0032*/ uint16 heading:12, // Directional heading padding0004:4; // ***Placeholder -/*0032*/ uint8 unknown0006[2]; // ***Placeholder +/*0034*/ uint8 unknown0006[2]; // ***Placeholder /*0036*/ }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 1659dbd1c..890fa88aa 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4878,7 +4878,8 @@ namespace RoF uint16 ornaIcon = 0; int32 heroModel = 0; /* - if (inst->GetOrnamentationAug(ornamentationAugtype)) { + if (inst->GetOrnamentationAug(ornamentationAugtype)) + { const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); //Mainhand ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index fbbceda2c..0f66184ee 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1696,6 +1696,8 @@ namespace RoF2 eq->unknown932 = -1; // Set from PoK Example eq->unknown936 = -1; // Set from PoK Example eq->unknown944 = 1.0; // Set from PoK Example + eq->unknown948 = 0; // New on Live as of Dec 15 2014 + eq->unknown952 = 100; // New on Live as of Dec 15 2014 FINISH_ENCODE(); } @@ -2339,7 +2341,6 @@ namespace RoF2 outapp->WriteUInt32(emu->silver_bank); outapp->WriteUInt32(emu->copper_bank); - // Commenting out for RoF Test outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown @@ -2387,12 +2388,7 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - /* - - // Begin RoF2 Test - for (uint32 r = 0; r < 1000; r++) - outapp->WriteUInt8(0); // Unknown - // End RoF2 Test + // Block of 121 unknown bytes for (uint32 r = 0; r < 121; r++) @@ -2408,6 +2404,11 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + // Begin RoF2 Test + //for (uint32 r = 0; r < 8000; r++) + //outapp->WriteUInt8(0); // Unknown + // End RoF2 Test + // Unknown String ? outapp->WriteUInt32(64); // Unknown for (uint32 r = 0; r < 64; r++) @@ -2535,7 +2536,6 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - */ outapp->WriteUInt8(emu->groupAutoconsent); outapp->WriteUInt8(emu->raidAutoconsent); @@ -4860,8 +4860,8 @@ namespace RoF2 hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges); hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0; hdr.unknown044 = 0; - hdr.unknown048 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; - hdr.unknown052 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0; + hdr.unknown048 = 0; + hdr.unknown052 = 0; hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0; ss.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader)); @@ -5325,13 +5325,8 @@ namespace RoF2 iqbs.SpellDmg = item->SpellDmg; iqbs.clairvoyance = item->Clairvoyance; iqbs.unknown28 = 0; - - - // Begin RoF2 Test - iqbs.unknown_TEST1 = 0; - // End RoF2 Test - iqbs.unknown30 = 0; + iqbs.unknown37a = 0; iqbs.unknown39 = 1; iqbs.subitem_count = 0; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 90ea4f287..efd80d0e8 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -520,72 +520,73 @@ struct ServerZoneEntry_Struct //Adjusted from SEQ Everquest.h Struct //New Zone Struct - Size: 948 struct NewZone_Struct { -/*0000*/ char char_name[64]; // Character Name -/*0064*/ char zone_short_name[32]; // Zone Short Name -/*0096*/ char unknown0096[96]; -/*0192*/ char zone_long_name[278]; // Zone Long Name -/*0470*/ uint8 ztype; // Zone type (usually FF) -/*0471*/ uint8 fog_red[4]; // Zone fog (red) -/*0475*/ uint8 fog_green[4]; // Zone fog (green) -/*0479*/ uint8 fog_blue[4]; // Zone fog (blue) -/*0483*/ uint8 unknown323; -/*0484*/ float fog_minclip[4]; -/*0500*/ float fog_maxclip[4]; -/*0516*/ float gravity; -/*0520*/ uint8 time_type; -/*0521*/ uint8 rain_chance[4]; -/*0525*/ uint8 rain_duration[4]; -/*0529*/ uint8 snow_chance[4]; -/*0533*/ uint8 snow_duration[4]; -/*0537*/ uint8 unknown537[33]; -/*0570*/ uint8 sky; // Sky Type -/*0571*/ uint8 unknown571[13]; // ***Placeholder -/*0584*/ float zone_exp_multiplier; // Experience Multiplier -/*0588*/ float safe_y; // Zone Safe Y -/*0592*/ float safe_x; // Zone Safe X -/*0596*/ float safe_z; // Zone Safe Z -/*0600*/ float min_z; // Guessed - NEW - Seen 0 -/*0604*/ float max_z; // Guessed -/*0608*/ float underworld; // Underworld, min z (Not Sure?) -/*0612*/ float minclip; // Minimum View Distance -/*0616*/ float maxclip; // Maximum View DIstance -/*0620*/ uint8 unknown620[84]; // ***Placeholder -/*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version. -/*0800*/ int32 unknown800; //seen -1 -/*0804*/ char unknown804[40]; // -/*0844*/ int32 unknown844; //seen 600 -/*0848*/ int32 unknown848; -/*0852*/ uint16 zone_id; -/*0854*/ uint16 zone_instance; -/*0856*/ char unknown856[20]; -/*0876*/ uint32 SuspendBuffs; -/*0880*/ uint32 unknown880; // Seen 50 -/*0884*/ uint32 unknown884; // Seen 10 -/*0888*/ uint8 unknown888; // Seen 1 -/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj) -/*0890*/ uint8 unknown890; // Seen 1 -/*0891*/ uint8 unknown891; // Seen 0 -/*0892*/ uint8 unknown892; // Seen 0 -/*0893*/ uint8 unknown893; // Seen 0 - 00 -/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off -/*0895*/ uint8 unknown895; // Seen 0 - 00 -/*0896*/ uint32 unknown896; // Seen 180 -/*0900*/ uint32 unknown900; // Seen 180 -/*0904*/ uint32 unknown904; // Seen 180 -/*0908*/ uint32 unknown908; // Seen 2 -/*0912*/ uint32 unknown912; // Seen 2 -/*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16 -/*0920*/ uint32 unknown920; // Seen 0 -/*0924*/ uint32 unknown924; // Seen 0 -/*0928*/ uint32 unknown928; // Seen 0 -/*0932*/ int32 unknown932; // Seen -1 -/*0936*/ int32 unknown936; // Seen -1 -/*0940*/ uint32 unknown940; // Seen 0 -/*0944*/ float unknown944; // Seen 1.0 -/*0948*/ + /*0000*/ char char_name[64]; // Character Name + /*0064*/ char zone_short_name[32]; // Zone Short Name + /*0096*/ char unknown0096[96]; + /*0192*/ char zone_long_name[278]; // Zone Long Name + /*0470*/ uint8 ztype; // Zone type (usually FF) + /*0471*/ uint8 fog_red[4]; // Zone fog (red) + /*0475*/ uint8 fog_green[4]; // Zone fog (green) + /*0479*/ uint8 fog_blue[4]; // Zone fog (blue) + /*0483*/ uint8 unknown323; + /*0484*/ float fog_minclip[4]; + /*0500*/ float fog_maxclip[4]; + /*0516*/ float gravity; + /*0520*/ uint8 time_type; + /*0521*/ uint8 rain_chance[4]; + /*0525*/ uint8 rain_duration[4]; + /*0529*/ uint8 snow_chance[4]; + /*0533*/ uint8 snow_duration[4]; + /*0537*/ uint8 unknown537[33]; + /*0570*/ uint8 sky; // Sky Type + /*0571*/ uint8 unknown571[13]; // ***Placeholder + /*0584*/ float zone_exp_multiplier; // Experience Multiplier + /*0588*/ float safe_y; // Zone Safe Y + /*0592*/ float safe_x; // Zone Safe X + /*0596*/ float safe_z; // Zone Safe Z + /*0600*/ float min_z; // Guessed - NEW - Seen 0 + /*0604*/ float max_z; // Guessed + /*0608*/ float underworld; // Underworld, min z (Not Sure?) + /*0612*/ float minclip; // Minimum View Distance + /*0616*/ float maxclip; // Maximum View DIstance + /*0620*/ uint8 unknown620[84]; // ***Placeholder + /*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version. + /*0800*/ int32 unknown800; //seen -1 + /*0804*/ char unknown804[40]; // + /*0844*/ int32 unknown844; //seen 600 + /*0848*/ int32 unknown848; + /*0852*/ uint16 zone_id; + /*0854*/ uint16 zone_instance; + /*0856*/ char unknown856[20]; + /*0876*/ uint32 SuspendBuffs; + /*0880*/ uint32 unknown880; // Seen 50 + /*0884*/ uint32 unknown884; // Seen 10 + /*0888*/ uint8 unknown888; // Seen 1 + /*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj) + /*0890*/ uint8 unknown890; // Seen 1 + /*0891*/ uint8 unknown891; // Seen 0 + /*0892*/ uint8 unknown892; // Seen 0 + /*0893*/ uint8 unknown893; // Seen 0 - 00 + /*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off + /*0895*/ uint8 unknown895; // Seen 0 - 00 + /*0896*/ uint32 unknown896; // Seen 180 + /*0900*/ uint32 unknown900; // Seen 180 + /*0904*/ uint32 unknown904; // Seen 180 + /*0908*/ uint32 unknown908; // Seen 2 + /*0912*/ uint32 unknown912; // Seen 2 + /*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16 + /*0920*/ uint32 unknown920; // Seen 0 + /*0924*/ uint32 unknown924; // Seen 0 + /*0928*/ uint32 unknown928; // Seen 0 + /*0932*/ int32 unknown932; // Seen -1 + /*0936*/ int32 unknown936; // Seen -1 + /*0940*/ uint32 unknown940; // Seen 0 + /*0944*/ float unknown944; // Seen 1.0 + /*0948*/ uint32 unknown948; // Seen 0 - New on Live as of Dec 15 2014 + /*0952*/ uint32 unknown952; // Seen 100 - New on Live as of Dec 15 2014 + /*0956*/ }; - /* ** Memorize Spell Struct ** Length: 16 Bytes @@ -1598,23 +1599,24 @@ struct RespawnWindow_Struct { */ struct PlayerPositionUpdateServer_Struct { - uint16 spawn_id; - uint16 spawnId2; - signed padding0004:12; - signed y_pos:19; // y coord - unsigned padding:1; - signed delta_z:13; // change in z - signed delta_x:13; // change in x - signed padding0008:6; - signed x_pos:19; // x coord - unsigned heading:12; // heading - signed padding0016:1; - signed delta_heading:10; // change in heading - signed z_pos:19; // z coord - signed padding0020:3; - signed animation:10; // animation - signed delta_y:13; // change in y - signed padding0024:9; + /*0000*/ uint16 spawn_id; + /*0002*/ uint16 spawnId2; + /*0004*/ signed padding0004 : 12; + signed y_pos : 19; // y coord + unsigned padding : 1; + /*0008*/ signed delta_z : 13; // change in z + signed delta_x : 13; // change in x + signed padding0008 : 6; + /*0012*/ signed x_pos : 19; // x coord + unsigned heading : 12; // heading + signed padding0016 : 1; + /*0016*/ signed delta_heading : 10; // change in heading + signed z_pos : 19; // z coord + signed padding0020 : 3; + /*0020*/ signed animation : 10; // animation + signed delta_y : 13; // change in y + signed padding0024 : 9; + /*0024*/ }; /* @@ -1625,21 +1627,22 @@ struct PlayerPositionUpdateServer_Struct */ struct PlayerPositionUpdateClient_Struct { - uint16 sequence; // increments one each packet - Verified - uint16 spawn_id; // Player's spawn id - uint8 unknown0004[6]; // ***Placeholder - float delta_x; // Change in x - unsigned heading:12; // Directional heading - unsigned padding0040:20; // ***Placeholder - float x_pos; // x coord (2nd loc value) - float delta_z; // Change in z - float z_pos; // z coord (3rd loc value) - float y_pos; // y coord (1st loc value) - unsigned animation:10; // ***Placeholder - unsigned padding0024:22; // animation - float delta_y; // Change in y - signed delta_heading:10; // change in heading - unsigned padding0041:22; // ***Placeholder + /*0000*/ uint16 sequence; // increments one each packet - Verified + /*0002*/ uint16 spawn_id; // Player's spawn id + /*0004*/ uint8 unknown0004[6]; // ***Placeholder + /*0010*/ float delta_x; // Change in x + /*0014*/ unsigned heading : 12; // Directional heading + unsigned padding0040 : 20; // ***Placeholder + /*0018*/ float x_pos; // x coord (2nd loc value) + /*0022*/ float delta_z; // Change in z + /*0026*/ float z_pos; // z coord (3rd loc value) + /*0030*/ float y_pos; // y coord (1st loc value) + /*0034*/ unsigned animation : 10; // ***Placeholder + unsigned padding0024 : 22; // animation + /*0038*/ float delta_y; // Change in y + /*0042*/ signed delta_heading : 10; // change in heading + unsigned padding0041 : 22; // ***Placeholder + /*0046*/ }; /* @@ -4687,11 +4690,7 @@ struct ItemQuaternaryBodyStruct uint32 unknown37; uint32 unknown_RoF27; uint32 unknown_RoF28; - - // Begin RoF2 Test - uint8 unknown_TEST1; - // End RoF2 Test - + uint8 unknown37a; // (guessed position) New to RoF2 uint8 unknown38; // 0 uint8 unknown39; // 1 uint32 subitem_count; diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index d2ed7f651..6bc63253e 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -257,9 +257,9 @@ OP_MoveDoor=0x08e8 OP_RemoveAllDoors=0x700c OP_EnvDamage=0x51fd OP_BoardBoat=0x4211 -OP_Forage=0x5306 OP_LeaveBoat=0x7617 OP_ControlBoat=0x0ae7 +OP_Forage=0x5306 OP_SafeFallSuccess=0x2219 OP_RezzComplete=0x760d OP_RezzRequest=0x3c21 From d69552d4df58507c86ae7b814cc818028b094056 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 17 Dec 2014 05:57:16 -0500 Subject: [PATCH 0651/1883] Perl: NPC AddRangedProc(spellid, chance) Perl: NPC AddDefensiveProc(spellid, chance) --- zone/perl_npc.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 736db9565..279b64330 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -2301,7 +2301,57 @@ XS(XS_NPC_AddMeleeProc); XS(XS_NPC_AddMeleeProc) { dXSARGS; if (items != 3) - Perl_croak(aTHX_ "Usage: NPC::AddMeleePro(THIS,spellid,chance)"); + Perl_croak(aTHX_ "Usage: NPC::AddMeleeProc(THIS,spellid,chance)"); + { + NPC * THIS; + int spell_id = (int)SvIV(ST(1)); + int chance = (int)SvIV(ST(2)); + dXSTARG; + + if (sv_derived_from(ST(0), "NPC")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(NPC *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type NPC"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->AddProcToWeapon(spell_id, true, chance); + } + XSRETURN_EMPTY; +} + +XS(XS_NPC_AddRangedProc); +XS(XS_NPC_AddRangedProc) { + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: NPC::AddRangedProc(THIS,spellid,chance)"); + { + NPC * THIS; + int spell_id = (int)SvIV(ST(1)); + int chance = (int)SvIV(ST(2)); + dXSTARG; + + if (sv_derived_from(ST(0), "NPC")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(NPC *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type NPC"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->AddDefensiveProc(spell_id,chance); + } + XSRETURN_EMPTY; +} + +XS(XS_NPC_AddDefensiveProc); +XS(XS_NPC_AddDefensiveProc) { + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: NPC::AddDefensiveProc(THIS,spellid,chance)"); { NPC * THIS; int spell_id = (int)SvIV(ST(1)); @@ -2427,6 +2477,8 @@ XS(boot_NPC) newXSproto(strcpy(buf, "SetMerchantProbability"), XS_NPC_SetMerchantProbability, file, "$$"); newXSproto(strcpy(buf, "GetMerchantProbability"), XS_NPC_GetMerchantProbability, file, "$"); newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$"); + newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$"); + newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$"); XSRETURN_YES; } From 29ef1527e7b3ad15a5bdffe002ce97ad0f636859 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 17 Dec 2014 06:09:04 -0500 Subject: [PATCH 0652/1883] update --- zone/mob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 03f845184..af7c5a8c7 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -543,7 +543,7 @@ float Mob::_GetMovementSpeed(int mod) const if (IsRooted()) return 0.0f; else if (IsPseudoRooted()) - return 0.000001f; + return 0.00001f; float speed_mod = runspeed; From cd33307975df11b85aca34cc9fc8105b2a47f6f4 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 17 Dec 2014 10:59:23 -0500 Subject: [PATCH 0653/1883] NPC ranged attack projectiles will now do damage on impact. Uses same rule as the client version. --- zone/npc.h | 1 + zone/special_attacks.cpp | 186 ++++++++++++++++++++++----------------- 2 files changed, 105 insertions(+), 82 deletions(-) diff --git a/zone/npc.h b/zone/npc.h index 1e378d2ad..59fbcc3fd 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -155,6 +155,7 @@ public: virtual void RangedAttack(Mob* other); virtual void ThrowingAttack(Mob* other) { } int32 GetNumberOfAttacks() const { return attack_count; } + void DoRangedAttackDmg(Mob* other, bool Launch=true, int16 damage_mod=0, int16 chance_mod=0, SkillUseTypes skill=SkillArchery, float speed=4.0f, const char *IDFile = nullptr); bool DatabaseCastAccepted(int spell_id); bool IsFactionListAlly(uint32 other_faction); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 0f57a7147..f74949a0b 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1062,8 +1062,8 @@ bool Mob::TryProjectileAttack(Mob* other, const Item_Struct *item, SkillUseTypes if(item) SendItemAnimation(other, item, skillInUse, speed); - else if (IsNPC()) - ProjectileAnimation(other, 0,false,speed,0,0,0,CastToNPC()->GetAmmoIDfile(),skillInUse); + //else if (IsNPC()) + //ProjectileAnimation(other, 0,false,speed,0,0,0,CastToNPC()->GetAmmoIDfile(),skillInUse); return true; } @@ -1100,12 +1100,19 @@ void Mob::ProjectileAttack() if (ProjectileAtk[i].hit_increment <= ProjectileAtk[i].increment){ if (target){ - if (ProjectileAtk[i].skill == SkillArchery) - DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); - else if (ProjectileAtk[i].skill == SkillThrowing) - DoThrowingAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0, ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_slot); - else if (ProjectileAtk[i].skill == SkillConjuration && IsValidSpell(ProjectileAtk[i].wpn_dmg)) - SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); + + if (IsNPC()) + CastToNPC()->DoRangedAttackDmg(target, false, ProjectileAtk[i].wpn_dmg,0, static_cast(ProjectileAtk[i].skill)); + + else + { + if (ProjectileAtk[i].skill == SkillArchery) + DoArcheryAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0,ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_id, nullptr, ProjectileAtk[i].ammo_slot); + else if (ProjectileAtk[i].skill == SkillThrowing) + DoThrowingAttackDmg(target, nullptr, nullptr,ProjectileAtk[i].wpn_dmg,0,0,0, ProjectileAtk[i].ranged_id, ProjectileAtk[i].ammo_slot); + else if (ProjectileAtk[i].skill == SkillConjuration && IsValidSpell(ProjectileAtk[i].wpn_dmg)) + SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); + } } ProjectileAtk[i].increment = 0; @@ -1190,14 +1197,8 @@ void NPC::RangedAttack(Mob* other) attacks = attacks > 0 ? attacks : 1; for(int i = 0; i < attacks; ++i) { - //if we have SPECATK_RANGED_ATK set then we range attack without weapon or ammo - const Item_Struct* weapon = nullptr; - const Item_Struct* ammo = nullptr; if(!GetSpecialAbility(SPECATK_RANGED_ATK)) - { - //find our bow and ammo return if we can't find them... return; - } int sa_min_range = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 4); //Min Range of NPC attack int sa_max_range = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 1); //Max Range of NPC attack @@ -1211,16 +1212,11 @@ void NPC::RangedAttack(Mob* other) if (sa_min_range) min_range = static_cast(sa_min_range); - mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", max_range); max_range *= max_range; - if(DistNoRootNoZ(*other) > max_range) { - mlog(COMBAT__RANGED, "Ranged attack out of range...%.2f vs %.2f", DistNoRootNoZ(*other), max_range); - //target is out of range, client does a message + if(DistNoRoot(*other) > max_range) return; - } - else if(DistNoRootNoZ(*other) < (min_range * min_range)) + else if(DistNoRoot(*other) < (min_range * min_range)) return; - if(!other || !IsAttackAllowed(other) || IsCasting() || @@ -1232,74 +1228,100 @@ void NPC::RangedAttack(Mob* other) return; } - SkillUseTypes skillinuse = SkillArchery; - skillinuse = static_cast(GetRangedSkill()); - - if(!ammo && !GetAmmoIDfile()) - ammo = database.GetItem(8005); - - if(ammo) - SendItemAnimation(other, ammo, SkillArchery); - else - ProjectileAnimation(other, 0,false,0,0,0,0,GetAmmoIDfile(),skillinuse); - FaceTarget(other); - if (!other->CheckHitChance(this, skillinuse, MainRange, GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2))) - { - mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); - other->Damage(this, 0, SPELL_UNKNOWN, skillinuse); - } - else - { - int16 WDmg = GetWeaponDamage(other, weapon); - int16 ADmg = GetWeaponDamage(other, ammo); - int32 TotalDmg = 0; - if(WDmg > 0 || ADmg > 0) - { - mlog(COMBAT__RANGED, "Ranged attack hit %s.", other->GetName()); - - int32 MaxDmg = max_dmg * RuleR(Combat, ArcheryNPCMultiplier); // should add a field to npc_types - int32 MinDmg = min_dmg * RuleR(Combat, ArcheryNPCMultiplier); - - if(RuleB(Combat, UseIntervalAC)) - TotalDmg = MaxDmg; - else - TotalDmg = zone->random.Int(MinDmg, MaxDmg); - - TotalDmg += TotalDmg * GetSpecialAbilityParam(SPECATK_RANGED_ATK, 3) / 100; //Damage modifier - - other->AvoidDamage(this, TotalDmg, false); - other->MeleeMitigation(this, TotalDmg, MinDmg); - if (TotalDmg > 0) - CommonOutgoingHitSuccess(other, TotalDmg, skillinuse); - } - - else - TotalDmg = -5; - - if (TotalDmg > 0) - other->AddToHateList(this, TotalDmg, 0, false); - else - other->AddToHateList(this, 0, 0, false); - - other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillinuse); - - if (TotalDmg > 0 && HasSkillProcSuccess() && GetTarget() && !other->HasDied()) - TrySkillProc(other, skillinuse, 0, true, MainRange); - } - - //try proc on hits and misses - if(other && !other->HasDied()) - TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, MainRange); - - if (HasSkillProcs() && other && !other->HasDied()) - TrySkillProc(other, skillinuse, 0, false, MainRange); + DoRangedAttackDmg(other); CommonBreakInvisible(); } } +void NPC::DoRangedAttackDmg(Mob* other, bool Launch, int16 damage_mod, int16 chance_mod, SkillUseTypes skill, float speed, const char *IDFile) { + + if ((other == nullptr || + (other->HasDied())) || + HasDied() || + (!IsAttackAllowed(other)) || + (other->GetInvul() || + other->GetSpecialAbility(IMMUNE_MELEE))) + { + return; + } + + SkillUseTypes skillInUse = static_cast(GetRangedSkill()); + + if (skill != skillInUse) + skillInUse = skill; + + if (Launch) + { + const char *ammo = "IT10"; + + if (IDFile != nullptr) + ammo = IDFile; + else if (GetAmmoIDfile()) + ammo = GetAmmoIDfile(); + + ProjectileAnimation(other, 0,false,speed,0,0,0,ammo,skillInUse); + + if (RuleB(Combat, ProjectileDmgOnImpact)) + { + TryProjectileAttack(other, nullptr, skillInUse, damage_mod, nullptr, nullptr, 0, speed); + return; + } + } + + if (!chance_mod) + chance_mod = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 2); + + if (!other->CheckHitChance(this, skillInUse, MainRange, chance_mod)) + { + other->Damage(this, 0, SPELL_UNKNOWN, skillInUse); + } + else + { + int32 TotalDmg = 0; + int32 MaxDmg = max_dmg * RuleR(Combat, ArcheryNPCMultiplier); // should add a field to npc_types + int32 MinDmg = min_dmg * RuleR(Combat, ArcheryNPCMultiplier); + + if(RuleB(Combat, UseIntervalAC)) + TotalDmg = MaxDmg; + else + TotalDmg = zone->random.Int(MinDmg, MaxDmg); + + + if (!damage_mod) + damage_mod = GetSpecialAbilityParam(SPECATK_RANGED_ATK, 3);//Damage modifier + + TotalDmg += TotalDmg * damage_mod / 100; + + other->AvoidDamage(this, TotalDmg, false); + other->MeleeMitigation(this, TotalDmg, MinDmg); + + if (TotalDmg > 0) + CommonOutgoingHitSuccess(other, TotalDmg, skillInUse); + else + TotalDmg = -5; + + if (TotalDmg > 0) + other->AddToHateList(this, TotalDmg, 0, false); + else + other->AddToHateList(this, 0, 0, false); + + other->Damage(this, TotalDmg, SPELL_UNKNOWN, skillInUse); + + if (TotalDmg > 0 && HasSkillProcSuccess() && !other->HasDied()) + TrySkillProc(other, skillInUse, 0, true, MainRange); + } + + //try proc on hits and misses + if(other && !other->HasDied()) + TrySpellProc(nullptr, (const Item_Struct*)nullptr, other, MainRange); + + if (HasSkillProcs() && other && !other->HasDied()) + TrySkillProc(other, skillInUse, 0, false, MainRange); +} + uint16 Mob::GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg) { uint16 MaxDmg = (((2 * wDmg) * GetDamageTable(SkillThrowing)) / 100); From d721580c9f103f77fb77a930bf0c277c943404d9 Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Wed, 17 Dec 2014 17:55:21 -0500 Subject: [PATCH 0654/1883] EQStream changes as recommended by a community member in private. --- changelog.txt | 1 + common/eq_stream.cpp | 28 +++++++++++++++++++--------- common/eq_stream.h | 14 ++++++++++++-- common/eq_stream_ident.cpp | 3 +++ 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index d1184037d..8c2630b6f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/17/2014 == demonstar55: Use vectors for route stuff, should be more CPU cache friendly so faster +Secrets: EQStream changes as recommended by a community member in private. == 12/15/2014 == Trevius: (RoF+) Implemented the 6th Augment Slot for Items. diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 879d57664..594f3b5bc 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -47,7 +47,13 @@ uint16 EQStream::MaxWindowSize=2048; -void EQStream::init() { +void EQStream::init(bool resetSession) { + // we only reset these statistics if it is a 'new' connection + if ( resetSession ) + { + streamactive = false; + sessionAttempts = 0; + } active_users = 0; Session=0; Key=0; @@ -313,18 +319,22 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - _log(NET__ERROR, _L "Received OP_SessionRequest in ESTABLISHED state (%d)" __L, GetState()); + _log(NET__ERROR, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); - /*RemoveData(); - init(); - State=UNESTABLISHED;*/ - _SendDisconnect(); - SetState(CLOSED); - break; + // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case + // streamactive means we identified the opcode for the stream, we cannot re-establish this connection + if ( streamactive || ( sessionAttempts > MAX_SESSION_RETRIES ) ) + { + _SendDisconnect(); + SetState(CLOSED); + break; + } } #endif //std::cout << "Got OP_SessionRequest" << std::endl; - init(); + sessionAttempts++; + // we set established below, so statistics will not be reset for session attempts/stream active. + init(GetState()!=ESTABLISHED); OutboundQueueClear(); SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); diff --git a/common/eq_stream.h b/common/eq_stream.h index ee797021f..bcbb548e9 100644 --- a/common/eq_stream.h +++ b/common/eq_stream.h @@ -49,6 +49,10 @@ class EQProtocolPacket; #define RETRANSMIT_ACKED_PACKETS true #endif +#ifndef MAX_SESSION_RETRIES +#define MAX_SESSION_RETRIES 30 +#endif + #pragma pack(1) struct SessionRequest { uint32 UnknownA; @@ -104,6 +108,9 @@ class EQStream : public EQStreamInterface { uint32 retransmittimer; uint32 retransmittimeout; + uint16 sessionAttempts; + bool streamactive; + //uint32 buffer_len; uint32 Session, Key; @@ -197,9 +204,9 @@ class EQStream : public EQStreamInterface { void _SendDisconnect(); - void init(); + void init(bool resetSession=true); public: - EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); } + EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); sessionAttempts = 0; streamactive=false; } EQStream(sockaddr_in addr) { init(); remote_ip=addr.sin_addr.s_addr; remote_port=addr.sin_port; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); } virtual ~EQStream() { RemoveData(); SetState(CLOSED); } void SetMaxLen(uint32 length) { MaxLen=length; } @@ -224,6 +231,9 @@ class EQStream : public EQStreamInterface { void SetLastPacketTime(uint32 t) {LastPacket=t;} void Write(int eq_fd); + // whether or not the stream has been assigned (we passed our stream match) + void SetActive(bool val) { streamactive = val; } + // inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; } inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); } diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index b60ac28d0..97fdd2c48 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -110,6 +110,9 @@ void EQStreamIdentifier::Process() { _log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further + r->stream->SetActive(true); + //might want to do something less-specific here... some day.. EQStreamInterface *s = new EQStreamProxy(r->stream, p->structs, p->opcodes); m_identified.push(s); From 7dad77c0805da0c75843a8f0e5c68d9f61719a71 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 17 Dec 2014 20:09:41 -0500 Subject: [PATCH 0655/1883] Clients will now receive exp / faction from their swarm pets kills ect. --- zone/attack.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zone/attack.cpp b/zone/attack.cpp index 4661a83e3..9ecfaa8a3 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2103,6 +2103,18 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack #endif //BOTS } + if(give_exp && give_exp->IsTempPet() && give_exp->IsPetOwnerClient()) { + + if (give_exp->IsNPC() && give_exp->CastToNPC()->GetSwarmOwner()){ + Mob* temp_owner = nullptr; + temp_owner = entity_list.GetMobID(give_exp->CastToNPC()->GetSwarmOwner()); + + if (temp_owner) + give_exp = temp_owner; + } + } + + int PlayerCount = 0; // QueryServ Player Counting Client *give_exp_client = nullptr; From fe4872c92167baedba854bcfe0df987b0688750b Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 17 Dec 2014 20:09:53 -0500 Subject: [PATCH 0656/1883] Debug >= 11 compile fail fix --- zone/bonuses.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index aa89856a1..b9f35c9ff 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -538,9 +538,9 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu } void Client::CalcEdibleBonuses(StatBonuses* newbon) { -#if EQDEBUG >= 11 - std::cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"<= 11 +// std::cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"< Date: Thu, 18 Dec 2014 02:20:03 -0500 Subject: [PATCH 0657/1883] std::deque is a much better fit, should have bit better performance --- zone/client_packet.cpp | 2 +- zone/entity.cpp | 2 +- zone/fearpath.cpp | 2 +- zone/mob.h | 2 +- zone/pathing.cpp | 42 +++++++++++++++++++++--------------------- zone/pathing.h | 6 +++--- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 82147ca43..fa6b4f249 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5714,7 +5714,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) } else { - std::vector pathlist = zone->pathing->FindRoute(Start, End); + std::deque pathlist = zone->pathing->FindRoute(Start, End); if (pathlist.size() == 0) { diff --git a/zone/entity.cpp b/zone/entity.cpp index c7a980f3d..b2951407b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2636,7 +2636,7 @@ void EntityList::FindPathsToAllNPCs() while (it != npc_list.end()) { Map::Vertex Node0 = zone->pathing->GetPathNodeCoordinates(0, false); Map::Vertex Dest(it->second->GetX(), it->second->GetY(), it->second->GetZ()); - std::vector Route = zone->pathing->FindRoute(Node0, Dest); + std::deque Route = zone->pathing->FindRoute(Node0, Dest); if (Route.size() == 0) printf("Unable to find a route to %s\n", it->second->GetName()); else diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 2e8e146aa..f4354e709 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -158,7 +158,7 @@ void Mob::CalculateNewFearpoint() Map::Vertex CurrentPosition(GetX(), GetY(), GetZ()); - std::vector Route = zone->pathing->FindRoute(CurrentPosition, Loc); + std::deque Route = zone->pathing->FindRoute(CurrentPosition, Loc); if(Route.size() > 0) { diff --git a/zone/mob.h b/zone/mob.h index cb7b82948..431b3ac31 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1225,7 +1225,7 @@ protected: Map::Vertex PathingLastPosition; int PathingLoopCount; int PathingLastNodeVisited; - std::vector Route; + std::deque Route; LOSType PathingLOSState; Timer *PathingLOSCheckTimer; Timer *PathingRouteUpdateTimerShort; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 309d6c0ed..2ddd7d94b 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -205,15 +205,15 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) } -std::vector PathManager::FindRoute(int startID, int endID) +std::deque PathManager::FindRoute(int startID, int endID) { _log(PATHING__DEBUG, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); - std::vector OpenList, ClosedList; + std::deque OpenList, ClosedList; - std::vectorRoute; + std::dequeRoute; AStarNode AStarEntry, CurrentNode; @@ -235,7 +235,7 @@ std::vector PathManager::FindRoute(int startID, int endID) ClosedListFlag[CurrentNode.PathNodeID] = true; - OpenList.erase(OpenList.begin()); + OpenList.pop_front(); for(int i = 0; i < PATHNODENEIGHBOURS; ++i) { @@ -251,7 +251,7 @@ std::vector PathManager::FindRoute(int startID, int endID) Route.push_back(endID); - std::vector::iterator RouteIterator; + std::deque::iterator RouteIterator; while(CurrentNode.PathNodeID != startID) { @@ -300,7 +300,7 @@ std::vector PathManager::FindRoute(int startID, int endID) bool AlreadyInOpenList = false; - std::vector::iterator OpenListIterator, InsertionPoint = OpenList.end(); + std::deque::iterator OpenListIterator, InsertionPoint = OpenList.end(); for(OpenListIterator = OpenList.begin(); OpenListIterator != OpenList.end(); ++OpenListIterator) { @@ -350,11 +350,11 @@ bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2) return n1.Distance < n2.Distance; } -std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) +std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); - std::vector noderoute; + std::deque noderoute; float CandidateNodeRangeXY = RuleR(Pathing, CandidateNodeRangeXY); @@ -365,7 +365,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) // int ClosestPathNodeToStart = -1; - std::vector SortedByDistance; + std::deque SortedByDistance; PathNodeSortStruct TempNode; @@ -456,7 +456,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::vector::iterator First, Second; + std::deque::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -487,7 +487,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::vector::iterator First, Second; + std::deque::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -611,7 +611,7 @@ void PathManager::MeshTest() if(j == i) continue; - std::vector Route = FindRoute(PathNodes[i].id, PathNodes[j].id); + std::deque Route = FindRoute(PathNodes[i].id, PathNodes[j].id); if(Route.size() == 0) { @@ -638,7 +638,7 @@ void PathManager::SimpleMeshTest() for(uint32 j = 1; j < Head.PathNodeCount; ++j) { - std::vector Route = FindRoute(PathNodes[0].id, PathNodes[j].id); + std::deque Route = FindRoute(PathNodes[0].id, PathNodes[j].id); if(Route.size() == 0) { @@ -695,7 +695,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -784,7 +784,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } // We are on the same route, no LOS (or not checking this time, so pop off the node we just reached // - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -798,7 +798,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) { @@ -814,7 +814,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) return To; @@ -962,7 +962,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLastNodeVisited = Route.front(); - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -975,7 +975,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) { @@ -991,7 +991,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) return To; @@ -1103,7 +1103,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) int ClosestPathNodeToStart = -1; - std::vector SortedByDistance; + std::deque SortedByDistance; PathNodeSortStruct TempNode; diff --git a/zone/pathing.h b/zone/pathing.h index 8c131dbc3..8848547b2 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -3,7 +3,7 @@ #include "map.h" -#include +#include class Client; class Mob; @@ -60,8 +60,8 @@ public: static PathManager *LoadPathFile(const char *ZoneName); bool loadPaths(FILE *fp); void PrintPathing(); - std::vector FindRoute(Map::Vertex Start, Map::Vertex End); - std::vector FindRoute(int startID, int endID); + std::deque FindRoute(Map::Vertex Start, Map::Vertex End); + std::deque FindRoute(int startID, int endID); Map::Vertex GetPathNodeCoordinates(int NodeNumber, bool BestZ = true); bool CheckLosFN(Map::Vertex a, Map::Vertex b); From ba5e5058f96dfa30f9e8c56c5223523318935962 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 18 Dec 2014 13:13:03 -0600 Subject: [PATCH 0658/1883] Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. --- changelog.txt | 3 ++ common/patches/rof.cpp | 21 ----------- common/patches/rof2.cpp | 80 ++++++++++++++++++----------------------- 3 files changed, 38 insertions(+), 66 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8c2630b6f..9086075f0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/18/2014 == +Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. + == 12/17/2014 == demonstar55: Use vectors for route stuff, should be more CPU cache friendly so faster Secrets: EQStream changes as recommended by a community member in private. diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 890fa88aa..5fa44c743 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2045,15 +2045,6 @@ namespace RoF outapp->WriteUInt32(emu->skills[r]); } - // deprecated - // Write zeroes for the rest of the skills - /* - for(uint32 r = 0; r < structs::MAX_PP_SKILL - MAX_PP_SKILL; r++) - { - outapp->WriteUInt32(emu->skills[r]); - } - */ - outapp->WriteUInt32(25); // Unknown count for (uint32 r = 0; r < 25; r++) @@ -2130,18 +2121,6 @@ namespace RoF outapp->WriteUInt32(structs::BUFF_COUNT); - //*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise - //*001*/ float unknown004; // Seen 1 for no buff - //*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages - //*009*/ uint32 unknown016; - //*013*/ uint8 bard_modifier; - //*014*/ uint32 duration; - //*018*/ uint8 level; - //*019*/ uint32 spellid; - //*023*/ uint32 counters; - //*027*/ uint8 unknown0028[53]; - //*080*/ - for (uint32 r = 0; r < BUFF_COUNT; r++) { float instrument_mod = 0.0f; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 0f66184ee..fff449379 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2123,18 +2123,6 @@ namespace RoF2 outapp->WriteUInt32(structs::BUFF_COUNT); - //*000*/ uint8 slotid; // badly named... seems to be 2 for a real buff, 0 otherwise - //*001*/ float unknown004; // Seen 1 for no buff - //*005*/ uint32 player_id; // 'global' ID of the caster, for wearoff messages - //*009*/ uint32 unknown016; - //*013*/ uint8 bard_modifier; - //*014*/ uint32 duration; - //*018*/ uint8 level; - //*019*/ uint32 spellid; - //*023*/ uint32 counters; - //*027*/ uint8 unknown0028[53]; - //*080*/ - for (uint32 r = 0; r < BUFF_COUNT; r++) { float instrument_mod = 0.0f; @@ -2174,7 +2162,6 @@ namespace RoF2 // 80 bytes of zeroes for (uint32 j = 0; j < 20; ++j) outapp->WriteUInt32(0); - } outapp->WriteUInt32(emu->platinum); @@ -2199,8 +2186,8 @@ namespace RoF2 outapp->WriteUInt32(emu->aapoints_spent); - outapp->WriteUInt32(5); // AA Points count ?? - outapp->WriteUInt32(1234); // AA Points assigned + outapp->WriteUInt32(5); // AA Window Tab Count + outapp->WriteUInt32(0); // AA Points assigned ? outapp->WriteUInt32(0); // AA Points in General ? outapp->WriteUInt32(0); // AA Points in Class ? outapp->WriteUInt32(0); // AA Points in Archetype ? @@ -2328,13 +2315,15 @@ namespace RoF2 outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(emu->gm); outapp->WriteUInt32(emu->guild_id); - outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. - outapp->WriteUInt32(0); // Unknown - observed 1 in a live packet. - outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. + + outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt8(0); // Unknown outapp->WriteUInt32(0); // Unknown - outapp->WriteUInt64(emu->exp); - outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt64(emu->exp); // int32 in client + + outapp->WriteUInt8(0); // Unknown - Seen 5 on Live outapp->WriteUInt32(emu->platinum_bank); outapp->WriteUInt32(emu->gold_bank); @@ -2346,17 +2335,11 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - outapp->WriteUInt32(42); // The meaning of life ? - - for (uint32 r = 0; r < 42; r++) - { - outapp->WriteUInt32(0); // Unknown - outapp->WriteUInt32(0); // Unknown - } - - outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + outapp->WriteSInt32(-1); // Unknown + outapp->WriteSInt32(-1); // Unknown + outapp->WriteUInt32(emu->career_tribute_points); outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(emu->tribute_points); @@ -2387,13 +2370,12 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - - - // Block of 121 unknown bytes - for (uint32 r = 0; r < 121; r++) + for (uint32 r = 0; r < 125; r++) + { outapp->WriteUInt8(0); // Unknown - + } + outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(emu->currentRadCrystals); @@ -2404,15 +2386,12 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - // Begin RoF2 Test - //for (uint32 r = 0; r < 8000; r++) - //outapp->WriteUInt8(0); // Unknown - // End RoF2 Test - // Unknown String ? outapp->WriteUInt32(64); // Unknown for (uint32 r = 0; r < 64; r++) + { outapp->WriteUInt8(0); // Unknown + } outapp->WriteUInt8(0); // Unknown outapp->WriteUInt8(0); // Unknown @@ -2440,22 +2419,30 @@ namespace RoF2 // Unknown String ? outapp->WriteUInt32(64); // Unknown for (uint32 r = 0; r < 64; r++) + { outapp->WriteUInt8(0); // Unknown + } // Unknown String ? outapp->WriteUInt32(64); // Unknown for (uint32 r = 0; r < 64; r++) + { outapp->WriteUInt8(0); // Unknown + } outapp->WriteUInt32(0); // Unknown // Block of 320 unknown bytes for (uint32 r = 0; r < 320; r++) + { outapp->WriteUInt8(0); // Unknown + } // Block of 343 unknown bytes for (uint32 r = 0; r < 343; r++) + { outapp->WriteUInt8(0); // Unknown + } outapp->WriteUInt32(0); // Unknown @@ -2480,10 +2467,14 @@ namespace RoF2 outapp->WriteUInt32(64); // Group of 64 int32s follow Group/Raid Leadership abilities ? for (uint32 r = 0; r < MAX_LEADERSHIP_AA_ARRAY; r++) + { outapp->WriteUInt32(emu->leader_abilities.ranks[r]); + } for (uint32 r = 0; r < 64 - MAX_LEADERSHIP_AA_ARRAY; r++) + { outapp->WriteUInt32(0); // Unused/unsupported Leadership abilities + } outapp->WriteUInt32(emu->air_remaining); // ? @@ -2536,7 +2527,6 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - outapp->WriteUInt8(emu->groupAutoconsent); outapp->WriteUInt8(emu->raidAutoconsent); outapp->WriteUInt8(emu->guildAutoconsent); @@ -2551,18 +2541,18 @@ namespace RoF2 outapp->WriteUInt32(1024); // Unknown Count - // Block of 1024 unknown bytes + outapp->WriteUInt8(31); // Unknown - for (uint32 r = 0; r < 1023; r++) + // Block of 1024 unknown bytes + for (uint32 r = 0; r < 1024; r++) + { outapp->WriteUInt8(0); // Unknown + } outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown - // Think we need 1 byte of padding at the end - - outapp->WriteUInt8(0); // Unknown _log(NET__STRUCTS, "Player Profile Packet is %i bytes", outapp->GetWritePosition()); From 8aea6da7dfa9778d7d02085f0a1479070254e9a3 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 18 Dec 2014 17:48:15 -0600 Subject: [PATCH 0659/1883] Fixed zoning after death for RoF2. --- changelog.txt | 1 + utils/patches/patch_RoF2.conf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9086075f0..5eec1f8af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. +Trevius: Fixed zoning after death for RoF2. == 12/17/2014 == demonstar55: Use vectors for route stuff, should be more CPU cache friendly so faster diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 6bc63253e..2692481a9 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -212,7 +212,7 @@ OP_ChannelMessage=0x2b2d OP_Assist=0x4478 OP_AssistGroup=0x27f8 OP_MoveCoin=0x0bcf -OP_ZonePlayerToBind=0x0ecb +OP_ZonePlayerToBind=0x08d8 OP_KeyRing=0x6857 OP_WhoAllRequest=0x674b OP_WhoAllResponse=0x578c @@ -318,7 +318,7 @@ OP_PVPLeaderBoardReply=0x071f OP_PVPLeaderBoardDetailsRequest=0x3707 OP_PVPLeaderBoardDetailsReply=0x25b7 OP_RestState=0x000f -OP_RespawnWindow=0x28bc +OP_RespawnWindow=0x0ecb OP_LDoNButton=0x5327 OP_SetStartCity=0x6326 OP_VoiceMacroIn=0x17fd From 1261aac03681c186c6090dc931403911d988b697 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 18 Dec 2014 18:49:57 -0500 Subject: [PATCH 0660/1883] Check DivineAura in TryWeaponProc, should resolve #321 --- zone/attack.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zone/attack.cpp b/zone/attack.cpp index 9ecfaa8a3..2bd3a0247 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3934,6 +3934,11 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { return; } + if (DivineAura()) { + mlog(COMBAT__PROCS, "Procs canceled, Divine Aura is in effect."); + return; + } + if(!weapon_g) { TrySpellProc(nullptr, (const Item_Struct*)nullptr, on); return; From fce52d7186356f23cf55ae0a15402ccd0eeeacd2 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 19 Dec 2014 02:02:31 -0600 Subject: [PATCH 0661/1883] (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. --- changelog.txt | 3 +++ common/patches/rof2.cpp | 1 + common/patches/rof2_ops.h | 1 - utils/patches/patch_RoF2.conf | 29 ++++++++++++++--------------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5eec1f8af..a866613ee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/19/2014 == +Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. + == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. Trevius: Fixed zoning after death for RoF2. diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index fff449379..c857eaccf 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3877,6 +3877,7 @@ namespace RoF2 } // DECODE methods + DECODE(OP_AdventureMerchantSell) { DECODE_LENGTH_EXACT(structs::Adventure_Sell_Struct); diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index fbdd20575..19519212a 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -4,7 +4,6 @@ // incoming packets that require a DECODE translation: // Begin RoF2 Decodes - // End RoF2 Encodes/Decodes // These require Encodes/Decodes for RoF, so they do for RoF2 as well diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 2692481a9..60b94e87d 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -113,7 +113,7 @@ OP_ClientUpdate=0x7dfc OP_ClientReady=0x345d OP_SetServerFilter=0x444d -# Guild Opcodes - Disabled until crashes are resolved in RoF +# Guild Opcodes OP_GetGuildMOTD=0x36e0 OP_GetGuildMOTDReply=0x4f1f OP_GuildMemberUpdate=0x69b9 @@ -121,7 +121,6 @@ OP_GuildInvite=0x7099 OP_GuildRemove=0x1444 OP_GuildPeace=0x67e3 OP_SetGuildMOTD=0x0b0b -OP_GuildList=0x6279 OP_GuildWar=0x1ffb OP_GuildLeader=0x7e09 OP_GuildDelete=0x3708 @@ -287,16 +286,16 @@ OP_ReadBook=0x72df OP_Dye=0x23b9 OP_InterruptCast=0x048c OP_AAAction=0x424e -OP_LeadershipExpToggle=0x6c55 +OP_LeadershipExpToggle=0x74bd OP_LeadershipExpUpdate=0x2797 -OP_PurchaseLeadershipAA=0x0026 -OP_UpdateLeadershipAA=0x026 -OP_MarkNPC=0x5a58 -OP_MarkRaidNPC=0x74bd #unimplemented +OP_PurchaseLeadershipAA=0x6c55 +OP_UpdateLeadershipAA=0x0026 +OP_MarkNPC=0x1fb5 +OP_MarkRaidNPC=0x5a58 #unimplemented OP_ClearNPCMarks=0x2003 OP_ClearRaidNPCMarks=0x20d3 #unimplemented -OP_DelegateAbility=0x76b8 -OP_SetGroupTarget=0x2814 +OP_DelegateAbility=0x4c9d +OP_SetGroupTarget=0x026 OP_Charm=0x5d92 OP_Stun=0x36a4 OP_SendFindableNPCs=0x4613 @@ -367,7 +366,7 @@ OP_DzExpeditionInfo=0x4f7e OP_DzExpeditionList=0x9119 OP_DzMemberStatus=0xb2e3 OP_DzLeaderStatus=0x32f0 -OP_DzExpeditionEndsWarning=0x7e94 +OP_DzExpeditionEndsWarning=0x383c OP_DzMemberList=0x3de9 OP_DzCompass=0x3e0e OP_DzChooseZone=0x0b7d @@ -445,11 +444,11 @@ OP_ShopDelItem=0x724f OP_ClickObject=0x4aa1 OP_ClickObjectAction=0x0c1e OP_ClearObject=0x7a11 -OP_RecipeDetails=0x40d7 +OP_RecipeDetails=0x6e02 OP_RecipesFavorite=0x71b1 -OP_RecipesSearch=0x1db6 -OP_RecipeReply=0x6e02 -OP_RecipeAutoCombine=0x6261 +OP_RecipesSearch=0x6290 +OP_RecipeReply=0x1db6 +OP_RecipeAutoCombine=0x40d7 OP_TradeSkillCombine=0x579a # Tribute Packets: @@ -501,7 +500,7 @@ OP_GroupDisbandOther=0x74da OP_GroupLeaderChange=0x21b4 OP_GroupRoles=0x70e2 OP_GroupMakeLeader=0x4229 -OP_DoGroupLeadershipAbility=0x1fb5 +OP_DoGroupLeadershipAbility=0x6eae OP_GroupLeadershipAAUpdate=0x02cf OP_GroupMentor=0x3342 OP_InspectBuffs=0x486c From ef287bc857cbca1c92a42aa4f6f06e380f563238 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 19 Dec 2014 15:46:01 -0600 Subject: [PATCH 0662/1883] Fixed Armor Tinting (players and NPCs) that was broken during a previous update. --- changelog.txt | 1 + common/patches/rof.cpp | 5 ----- common/patches/rof2.cpp | 5 ----- world/worlddb.cpp | 12 +++++++++++- zone/bot.cpp | 2 +- zone/client.cpp | 38 ++++++++++++-------------------------- zone/client_packet.cpp | 8 ++++++-- zone/mob.cpp | 13 ++++++++++--- zone/npc.cpp | 2 +- 9 files changed, 42 insertions(+), 44 deletions(-) diff --git a/changelog.txt b/changelog.txt index a866613ee..2ef94660d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/19/2014 == Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. +Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 5fa44c743..8218f1f22 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5061,11 +5061,6 @@ namespace RoF isbs.augslots[x].unknown = item->AugSlotUnk2[x]; } - // Increased to 6 max aug slots - //isbs.augslots[5].type = 0; - //isbs.augslots[5].visible = 1; - //isbs.augslots[5].unknown = 0; - isbs.ldonpoint_type = item->PointType; isbs.ldontheme = item->LDoNTheme; isbs.ldonprice = item->LDoNPrice; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index c857eaccf..f1a3d8836 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5076,11 +5076,6 @@ namespace RoF2 isbs.augslots[x].unknown = item->AugSlotUnk2[x]; } - // Increased to 6 max aug slots - //isbs.augslots[5].type = 0; - //isbs.augslots[5].visible = 1; - //isbs.augslots[5].unknown = 0; - isbs.ldonpoint_type = item->PointType; isbs.ldontheme = item->LDoNTheme; isbs.ldonprice = item->LDoNPrice; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index d9315e80e..e65a3a338 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -213,11 +213,21 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* } else { + uint32 color = 0; + if (pp.item_tint[matslot].rgb.use_tint) + { + 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 = inst->GetColor(); + cs->equip[char_num][matslot].color.color = color; } } } diff --git a/zone/bot.cpp b/zone/bot.cpp index 33d36d284..ef40e1bcb 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -11276,7 +11276,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { if(!results.Success()) return; - int slotmaterial = Inventory::CalcMaterialFromSlot(setslot); + uint8 slotmaterial = Inventory::CalcMaterialFromSlot(setslot); c->GetTarget()->CastToBot()->SendWearChange(slotmaterial); } else { diff --git a/zone/client.cpp b/zone/client.cpp index d2349e02a..181589bf5 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2685,8 +2685,11 @@ void Client::SetMaterial(int16 in_slot, uint32 item_id) { const Item_Struct* item = database.GetItem(item_id); if (item && (item->ItemClass==ItemClassCommon)) { - uint32 matslot = Inventory::CalcMaterialFromSlot(in_slot); - m_pp.item_material[matslot] = GetEquipmentMaterial(matslot); + uint8 matslot = Inventory::CalcMaterialFromSlot(in_slot); + if (matslot != _MaterialInvalid) + { + m_pp.item_material[matslot] = GetEquipmentMaterial(matslot); + } } } @@ -3016,31 +3019,14 @@ void Client::SetTint(int16 in_slot, uint32 color) { // Still need to reconcile bracer01 versus bracer02 void Client::SetTint(int16 in_slot, Color_Struct& color) { - if (in_slot==MainHead) - m_pp.item_tint[MaterialHead].color=color.color; - else if (in_slot==MainArms) - m_pp.item_tint[MaterialArms].color=color.color; - else if (in_slot==MainWrist1) - m_pp.item_tint[MaterialWrist].color=color.color; - /* - // non-live behavior - else if (in_slot==SLOT_BRACER02) - m_pp.item_tint[MaterialWrist].color=color.color; - */ - else if (in_slot==MainHands) - m_pp.item_tint[MaterialHands].color=color.color; - else if (in_slot==MainPrimary) - m_pp.item_tint[MaterialPrimary].color=color.color; - else if (in_slot==MainSecondary) - m_pp.item_tint[MaterialSecondary].color=color.color; - else if (in_slot==MainChest) - m_pp.item_tint[MaterialChest].color=color.color; - else if (in_slot==MainLegs) - m_pp.item_tint[MaterialLegs].color=color.color; - else if (in_slot==MainFeet) - m_pp.item_tint[MaterialFeet].color=color.color; - database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.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); + } + } void Client::SetHideMe(bool flag) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fa6b4f249..6d032fed2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1425,8 +1425,12 @@ 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) - m_pp.item_tint[i].rgb.use_tint = 0xFF; + { + if (m_pp.item_tint[i].rgb.use_tint == 1 || m_pp.item_tint[i].rgb.use_tint == 255) + { + m_pp.item_tint[i].rgb.use_tint = 0xFF; + } + } if (level){ level = m_pp.level; } diff --git a/zone/mob.cpp b/zone/mob.cpp index af7c5a8c7..d031564dd 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2781,10 +2781,17 @@ uint32 Mob::GetEquipmentColor(uint8 material_slot) const { const Item_Struct *item; - item = database.GetItem(GetEquipment(material_slot)); - if(item != 0) + if (armor_tint[material_slot]) { - return item->Color; + return armor_tint[material_slot]; + } + else + { + item = database.GetItem(GetEquipment(material_slot)); + if (item != 0) + { + return item->Color; + } } return 0; diff --git a/zone/npc.cpp b/zone/npc.cpp index d9833d856..ddfd1b243 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -476,7 +476,7 @@ void NPC::CheckMinMaxLevel(Mob *them) if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level) { material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot); - if(material != 0xFF) + if (material != _MaterialInvalid) SendWearChange(material); cur = itemlist.erase(cur); From dabe55096698b378c9ee049599c12977811c58b9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 19 Dec 2014 17:22:05 -0500 Subject: [PATCH 0663/1883] Fix eq_dictionary.cpp from 62 removal Note: 62 references in clientversion.h need to be cleaned up before we can remove them from other files --- common/eq_dictionary.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 37414853e..46c8f4ff1 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -548,6 +548,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBank] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_BANK_SIZE, /*SoF*/ EmuConstants::MAP_BANK_SIZE, /*SoD*/ EmuConstants::MAP_BANK_SIZE, @@ -697,6 +698,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapCorpse] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE, /*SoF*/ SoF::consts::MAP_CORPSE_SIZE, /*SoD*/ SoD::consts::MAP_CORPSE_SIZE, @@ -726,6 +728,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapInspect] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE, /*SoF*/ SoF::consts::MAP_INSPECT_SIZE, /*SoD*/ SoD::consts::MAP_INSPECT_SIZE, @@ -1003,6 +1006,7 @@ uint64 EQLimits::CursorBitmask(uint32 version) { bool EQLimits::AllowsEmptyBagInBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, +/*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, @@ -1023,6 +1027,8 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { bool EQLimits::AllowsClickCastFromBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, +/*62*/ false, +/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*Underfoot*/ Underfoot::limits::ALLOWS_CLICK_CAST_FROM_BAG, @@ -1082,6 +1088,7 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { bool EQLimits::CoinHasWeight(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ true, +/*62*/ true, /*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, /*SoF*/ SoF::limits::COIN_HAS_WEIGHT, /*SoD*/ SoD::limits::COIN_HAS_WEIGHT, From da75007b0f92deb5615ebaa1addef5dd67be27f9 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 19 Dec 2014 19:42:55 -0600 Subject: [PATCH 0664/1883] (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP. --- changelog.txt | 1 + common/patches/rof2.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index 2ef94660d..e4d25c545 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 12/19/2014 == Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. +Trevius: (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP. == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index f1a3d8836..f175c3edc 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2527,23 +2527,21 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Unknown + outapp->WriteUInt32(0); // Krono - itemid 88888 Hard coded in client? + outapp->WriteUInt8(emu->groupAutoconsent); outapp->WriteUInt8(emu->raidAutoconsent); outapp->WriteUInt8(emu->guildAutoconsent); - outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt32(emu->level); // Level3 ? + outapp->WriteUInt32(emu->level); // Level3 ? outapp->WriteUInt8(emu->showhelm); outapp->WriteUInt32(emu->RestTimer); outapp->WriteUInt32(1024); // Unknown Count - - - outapp->WriteUInt8(31); // Unknown - // Block of 1024 unknown bytes for (uint32 r = 0; r < 1024; r++) { From d4506363b8b1d3e136f122b066d87494a6c8fdc0 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 19 Dec 2014 21:25:44 -0500 Subject: [PATCH 0665/1883] Cleared clientversions.h and eq_dictionary files of Client6.2 references --- changelog.txt | 1 + common/clientversions.h | 3 --- common/eq_dictionary.cpp | 37 ------------------------------------- common/eq_dictionary.h | 2 +- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/changelog.txt b/changelog.txt index e4d25c545..f4f756b83 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. Trevius: (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP. +Uleat: Cleaned out clientversions.h and eq_dictionary files of 6.2 references == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. diff --git a/common/clientversions.h b/common/clientversions.h index ee70d481c..81e12450e 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -20,7 +20,6 @@ static const uint32 BIT_AllClients = 0xFFFFFFFF; typedef enum { EQClientUnknown = 0, - EQClient62, // Build: 'Aug 4 2005 15:40:59' EQClientTitanium, // Build: 'Oct 31 2005 10:33:37' EQClientSoF, // Build: 'Sep 7 2007 09:11:49' EQClientSoD, // Build: 'Dec 19 2008 15:22:49' @@ -46,8 +45,6 @@ static const char* EQClientVersionName(EQClientVersion version) { case EQClientUnknown: return "EQClientUnknown"; - case EQClient62: - return "EQClient62"; case EQClientTitanium: return "EQClientTitanium"; case EQClientSoF: diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 46c8f4ff1..e3de89c76 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -533,7 +533,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { // for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations { // local[MainPossessions] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*Titanium*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*SoF*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE, @@ -548,7 +547,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBank] /*Unknown*/ NOT_USED, -/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_BANK_SIZE, /*SoF*/ EmuConstants::MAP_BANK_SIZE, /*SoD*/ EmuConstants::MAP_BANK_SIZE, @@ -563,7 +561,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapSharedBank] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*Titanium*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*SoF*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE, @@ -578,7 +575,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTrade] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_TRADE_SIZE, /*Titanium*/ EmuConstants::MAP_TRADE_SIZE, /*SoF*/ EmuConstants::MAP_TRADE_SIZE, /*SoD*/ EmuConstants::MAP_TRADE_SIZE, @@ -593,7 +589,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapWorld] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_WORLD_SIZE, /*Titanium*/ EmuConstants::MAP_WORLD_SIZE, /*SoF*/ EmuConstants::MAP_WORLD_SIZE, /*SoD*/ EmuConstants::MAP_WORLD_SIZE, @@ -608,7 +603,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapLimbo] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_LIMBO_SIZE, /*Titanium*/ EmuConstants::MAP_LIMBO_SIZE, /*SoF*/ EmuConstants::MAP_LIMBO_SIZE, /*SoD*/ EmuConstants::MAP_LIMBO_SIZE, @@ -623,7 +617,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTribute] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_TRIBUTE_SIZE, /*Titanium*/ EmuConstants::MAP_TRIBUTE_SIZE, /*SoF*/ EmuConstants::MAP_TRIBUTE_SIZE, /*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE, @@ -638,7 +631,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTrophyTribute] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -653,7 +645,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapGuildTribute] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -668,7 +659,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapMerchant] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -683,7 +673,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapDeleted] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -698,7 +687,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapCorpse] /*Unknown*/ NOT_USED, -/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE, /*SoF*/ SoF::consts::MAP_CORPSE_SIZE, /*SoD*/ SoD::consts::MAP_CORPSE_SIZE, @@ -713,7 +701,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBazaar] /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::MAP_BAZAAR_SIZE, /*Titanium*/ EmuConstants::MAP_BAZAAR_SIZE, /*SoF*/ EmuConstants::MAP_BAZAAR_SIZE, /*SoD*/ EmuConstants::MAP_BAZAAR_SIZE, @@ -728,7 +715,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapInspect] /*Unknown*/ NOT_USED, -/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE, /*SoF*/ SoF::consts::MAP_INSPECT_SIZE, /*SoD*/ SoD::consts::MAP_INSPECT_SIZE, @@ -743,7 +729,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapRealEstate] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -758,7 +743,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODPC] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -773,7 +757,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODBank] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -788,7 +771,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODSharedBank] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -803,7 +785,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODLimbo] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -818,7 +799,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapAltStorage] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -833,7 +813,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapArchived] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -848,7 +827,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapMail] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -863,7 +841,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapGuildTrophyTribute] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -878,7 +855,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapKrono] /*Unknown*/ NOT_USED, -/*62*/ NOT_USED, /*Titanium*/ NOT_USED, /*SoF*/ NOT_USED, /*SoD*/ NOT_USED, @@ -893,7 +869,6 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapOther] /*Unknown*/ NOT_USED, -/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -922,7 +897,6 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 0x000000027FDFFFFF, /*Titanium*/ 0x000000027FDFFFFF, /*SoF*/ 0x000000027FFFFFFF, /*SoD*/ 0x000000027FFFFFFF, @@ -943,7 +917,6 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { uint64 EQLimits::EquipmentBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 0x00000000005FFFFF, /*Titanium*/ 0x00000000005FFFFF, /*SoF*/ 0x00000000007FFFFF, /*SoD*/ 0x00000000007FFFFF, @@ -964,7 +937,6 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) { uint64 EQLimits::GeneralBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 0x000000007F800000, /*Titanium*/ 0x000000007F800000, /*SoF*/ 0x000000007F800000, /*SoD*/ 0x000000007F800000, @@ -985,7 +957,6 @@ uint64 EQLimits::GeneralBitmask(uint32 version) { uint64 EQLimits::CursorBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ 0x0000000200000000, /*Titanium*/ 0x0000000200000000, /*SoF*/ 0x0000000200000000, /*SoD*/ 0x0000000200000000, @@ -1006,7 +977,6 @@ uint64 EQLimits::CursorBitmask(uint32 version) { bool EQLimits::AllowsEmptyBagInBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, -/*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, @@ -1027,7 +997,6 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { bool EQLimits::AllowsClickCastFromBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, -/*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, @@ -1048,7 +1017,6 @@ bool EQLimits::AllowsClickCastFromBag(uint32 version) { uint16 EQLimits::ItemCommonSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::ITEM_COMMON_SIZE, /*Titanium*/ EmuConstants::ITEM_COMMON_SIZE, /*SoF*/ EmuConstants::ITEM_COMMON_SIZE, /*SoD*/ EmuConstants::ITEM_COMMON_SIZE, @@ -1068,7 +1036,6 @@ uint16 EQLimits::ItemCommonSize(uint32 version) { uint16 EQLimits::ItemContainerSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::ITEM_CONTAINER_SIZE, /*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE, /*SoF*/ EmuConstants::ITEM_CONTAINER_SIZE, /*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE, @@ -1088,7 +1055,6 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { bool EQLimits::CoinHasWeight(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ true, -/*62*/ true, /*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, /*SoF*/ SoF::limits::COIN_HAS_WEIGHT, /*SoD*/ SoD::limits::COIN_HAS_WEIGHT, @@ -1108,7 +1074,6 @@ bool EQLimits::CoinHasWeight(uint32 version) { uint32 EQLimits::BandoliersCount(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIERS_COUNT, /*Titanium*/ EmuConstants::BANDOLIERS_COUNT, /*SoF*/ EmuConstants::BANDOLIERS_COUNT, /*SoD*/ EmuConstants::BANDOLIERS_COUNT, @@ -1128,7 +1093,6 @@ uint32 EQLimits::BandoliersCount(uint32 version) { uint32 EQLimits::BandolierSize(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::BANDOLIER_SIZE, /*Titanium*/ EmuConstants::BANDOLIER_SIZE, /*SoF*/ EmuConstants::BANDOLIER_SIZE, /*SoD*/ EmuConstants::BANDOLIER_SIZE, @@ -1148,7 +1112,6 @@ uint32 EQLimits::BandolierSize(uint32 version) { uint32 EQLimits::PotionBeltSize(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, -/*62*/ EmuConstants::POTION_BELT_SIZE, /*Titanium*/ EmuConstants::POTION_BELT_SIZE, /*SoF*/ EmuConstants::POTION_BELT_SIZE, /*SoD*/ EmuConstants::POTION_BELT_SIZE, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 43511072f..370c1f253 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -46,7 +46,7 @@ class EmuConstants { // an immutable value is required to initialize arrays, etc... use this class as a repository for those public: // database - static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client + static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF2; // adjust according to starting item placement and target client // inventory static uint16 InventoryMapSize(int16 map); From cedec3d8722f60da6e680aefe4b5a44c10ad6589 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 19 Dec 2014 23:08:44 -0500 Subject: [PATCH 0666/1883] Revert "Cleared clientversions.h and eq_dictionary files of Client6.2 references" This reverts commit d4506363b8b1d3e136f122b066d87494a6c8fdc0. --- changelog.txt | 1 - common/clientversions.h | 3 +++ common/eq_dictionary.cpp | 37 +++++++++++++++++++++++++++++++++++++ common/eq_dictionary.h | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index f4f756b83..e4d25c545 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,7 +4,6 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. Trevius: (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP. -Uleat: Cleaned out clientversions.h and eq_dictionary files of 6.2 references == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. diff --git a/common/clientversions.h b/common/clientversions.h index 81e12450e..ee70d481c 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -20,6 +20,7 @@ static const uint32 BIT_AllClients = 0xFFFFFFFF; typedef enum { EQClientUnknown = 0, + EQClient62, // Build: 'Aug 4 2005 15:40:59' EQClientTitanium, // Build: 'Oct 31 2005 10:33:37' EQClientSoF, // Build: 'Sep 7 2007 09:11:49' EQClientSoD, // Build: 'Dec 19 2008 15:22:49' @@ -45,6 +46,8 @@ static const char* EQClientVersionName(EQClientVersion version) { case EQClientUnknown: return "EQClientUnknown"; + case EQClient62: + return "EQClient62"; case EQClientTitanium: return "EQClientTitanium"; case EQClientSoF: diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index e3de89c76..46c8f4ff1 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -533,6 +533,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { // for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations { // local[MainPossessions] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*Titanium*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*SoF*/ EmuConstants::MAP_POSSESSIONS_SIZE, /*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE, @@ -547,6 +548,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBank] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_BANK_SIZE, /*SoF*/ EmuConstants::MAP_BANK_SIZE, /*SoD*/ EmuConstants::MAP_BANK_SIZE, @@ -561,6 +563,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapSharedBank] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*Titanium*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*SoF*/ EmuConstants::MAP_SHARED_BANK_SIZE, /*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE, @@ -575,6 +578,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTrade] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_TRADE_SIZE, /*Titanium*/ EmuConstants::MAP_TRADE_SIZE, /*SoF*/ EmuConstants::MAP_TRADE_SIZE, /*SoD*/ EmuConstants::MAP_TRADE_SIZE, @@ -589,6 +593,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapWorld] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_WORLD_SIZE, /*Titanium*/ EmuConstants::MAP_WORLD_SIZE, /*SoF*/ EmuConstants::MAP_WORLD_SIZE, /*SoD*/ EmuConstants::MAP_WORLD_SIZE, @@ -603,6 +608,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapLimbo] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_LIMBO_SIZE, /*Titanium*/ EmuConstants::MAP_LIMBO_SIZE, /*SoF*/ EmuConstants::MAP_LIMBO_SIZE, /*SoD*/ EmuConstants::MAP_LIMBO_SIZE, @@ -617,6 +623,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTribute] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_TRIBUTE_SIZE, /*Titanium*/ EmuConstants::MAP_TRIBUTE_SIZE, /*SoF*/ EmuConstants::MAP_TRIBUTE_SIZE, /*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE, @@ -631,6 +638,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapTrophyTribute] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -645,6 +653,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapGuildTribute] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -659,6 +668,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapMerchant] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -673,6 +683,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapDeleted] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -687,6 +698,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapCorpse] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE, /*SoF*/ SoF::consts::MAP_CORPSE_SIZE, /*SoD*/ SoD::consts::MAP_CORPSE_SIZE, @@ -701,6 +713,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapBazaar] /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::MAP_BAZAAR_SIZE, /*Titanium*/ EmuConstants::MAP_BAZAAR_SIZE, /*SoF*/ EmuConstants::MAP_BAZAAR_SIZE, /*SoD*/ EmuConstants::MAP_BAZAAR_SIZE, @@ -715,6 +728,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapInspect] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE, /*SoF*/ SoF::consts::MAP_INSPECT_SIZE, /*SoD*/ SoD::consts::MAP_INSPECT_SIZE, @@ -729,6 +743,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapRealEstate] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -743,6 +758,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODPC] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -757,6 +773,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODBank] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -771,6 +788,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODSharedBank] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -785,6 +803,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapViewMODLimbo] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -799,6 +818,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapAltStorage] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -813,6 +833,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapArchived] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -827,6 +848,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapMail] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -841,6 +863,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapGuildTrophyTribute] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -855,6 +878,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapKrono] /*Unknown*/ NOT_USED, +/*62*/ NOT_USED, /*Titanium*/ NOT_USED, /*SoF*/ NOT_USED, /*SoD*/ NOT_USED, @@ -869,6 +893,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { }, { // local[MapOther] /*Unknown*/ NOT_USED, +/*62*/ 0, /*Titanium*/ 0, /*SoF*/ 0, /*SoD*/ 0, @@ -897,6 +922,7 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ 0x000000027FDFFFFF, /*Titanium*/ 0x000000027FDFFFFF, /*SoF*/ 0x000000027FFFFFFF, /*SoD*/ 0x000000027FFFFFFF, @@ -917,6 +943,7 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { uint64 EQLimits::EquipmentBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ 0x00000000005FFFFF, /*Titanium*/ 0x00000000005FFFFF, /*SoF*/ 0x00000000007FFFFF, /*SoD*/ 0x00000000007FFFFF, @@ -937,6 +964,7 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) { uint64 EQLimits::GeneralBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ 0x000000007F800000, /*Titanium*/ 0x000000007F800000, /*SoF*/ 0x000000007F800000, /*SoD*/ 0x000000007F800000, @@ -957,6 +985,7 @@ uint64 EQLimits::GeneralBitmask(uint32 version) { uint64 EQLimits::CursorBitmask(uint32 version) { static const uint64 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ 0x0000000200000000, /*Titanium*/ 0x0000000200000000, /*SoF*/ 0x0000000200000000, /*SoD*/ 0x0000000200000000, @@ -977,6 +1006,7 @@ uint64 EQLimits::CursorBitmask(uint32 version) { bool EQLimits::AllowsEmptyBagInBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, +/*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG, /*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG, @@ -997,6 +1027,7 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { bool EQLimits::AllowsClickCastFromBag(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ false, +/*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG, /*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG, @@ -1017,6 +1048,7 @@ bool EQLimits::AllowsClickCastFromBag(uint32 version) { uint16 EQLimits::ItemCommonSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::ITEM_COMMON_SIZE, /*Titanium*/ EmuConstants::ITEM_COMMON_SIZE, /*SoF*/ EmuConstants::ITEM_COMMON_SIZE, /*SoD*/ EmuConstants::ITEM_COMMON_SIZE, @@ -1036,6 +1068,7 @@ uint16 EQLimits::ItemCommonSize(uint32 version) { uint16 EQLimits::ItemContainerSize(uint32 version) { static const uint16 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::ITEM_CONTAINER_SIZE, /*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE, /*SoF*/ EmuConstants::ITEM_CONTAINER_SIZE, /*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE, @@ -1055,6 +1088,7 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { bool EQLimits::CoinHasWeight(uint32 version) { static const bool local[_EmuClientCount] = { /*Unknown*/ true, +/*62*/ true, /*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, /*SoF*/ SoF::limits::COIN_HAS_WEIGHT, /*SoD*/ SoD::limits::COIN_HAS_WEIGHT, @@ -1074,6 +1108,7 @@ bool EQLimits::CoinHasWeight(uint32 version) { uint32 EQLimits::BandoliersCount(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::BANDOLIERS_COUNT, /*Titanium*/ EmuConstants::BANDOLIERS_COUNT, /*SoF*/ EmuConstants::BANDOLIERS_COUNT, /*SoD*/ EmuConstants::BANDOLIERS_COUNT, @@ -1093,6 +1128,7 @@ uint32 EQLimits::BandoliersCount(uint32 version) { uint32 EQLimits::BandolierSize(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::BANDOLIER_SIZE, /*Titanium*/ EmuConstants::BANDOLIER_SIZE, /*SoF*/ EmuConstants::BANDOLIER_SIZE, /*SoD*/ EmuConstants::BANDOLIER_SIZE, @@ -1112,6 +1148,7 @@ uint32 EQLimits::BandolierSize(uint32 version) { uint32 EQLimits::PotionBeltSize(uint32 version) { static const uint32 local[_EmuClientCount] = { /*Unknown*/ NOT_USED, +/*62*/ EmuConstants::POTION_BELT_SIZE, /*Titanium*/ EmuConstants::POTION_BELT_SIZE, /*SoF*/ EmuConstants::POTION_BELT_SIZE, /*SoD*/ EmuConstants::POTION_BELT_SIZE, diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 370c1f253..43511072f 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -46,7 +46,7 @@ class EmuConstants { // an immutable value is required to initialize arrays, etc... use this class as a repository for those public: // database - static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF2; // adjust according to starting item placement and target client + static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client // inventory static uint16 InventoryMapSize(int16 map); From 4ef3c7a9f40e523103991f4970a61a69da712061 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 19 Dec 2014 23:20:10 -0600 Subject: [PATCH 0667/1883] Fixed Selling for Alternate Currency Merchants for RoF and RoF2. --- changelog.txt | 1 + common/patches/rof.cpp | 6 +++--- common/patches/rof2.cpp | 6 +++--- common/patches/rof2_structs.h | 24 ++++++++++++------------ common/patches/rof_structs.h | 6 ++---- common/patches/underfoot_structs.h | 4 ++-- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/changelog.txt b/changelog.txt index e4d25c545..e9e0946d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. Trevius: (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP. +Trevius: Fixed Selling for Alternate Currency Merchants for RoF and RoF2. == 12/18/2014 == Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now. diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 8218f1f22..ad6fb95d6 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -205,7 +205,7 @@ namespace RoF SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); OUT(merchant_entity_id); - eq->slot_id = ServerToRoFSlot(emu->slot_id); + eq->slot_id = ServerToRoFMainInvSlot(emu->slot_id); OUT(charges); OUT(cost); @@ -3881,7 +3881,7 @@ namespace RoF SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); IN(merchant_entity_id); - emu->slot_id = RoFToServerSlot(eq->slot_id); + emu->slot_id = RoFToServerMainInvSlot(eq->slot_id); IN(charges); IN(cost); @@ -3894,7 +3894,7 @@ namespace RoF SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); IN(merchant_entity_id); - emu->slot_id = RoFToServerSlot(eq->slot_id); + emu->slot_id = RoFToServerMainInvSlot(eq->slot_id); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index f175c3edc..d49f00253 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -205,7 +205,7 @@ namespace RoF2 SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); OUT(merchant_entity_id); - eq->slot_id = ServerToRoF2Slot(emu->slot_id); + eq->slot_id = ServerToRoF2MainInvSlot(emu->slot_id); OUT(charges); OUT(cost); @@ -3895,7 +3895,7 @@ namespace RoF2 SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct); IN(merchant_entity_id); - emu->slot_id = RoF2ToServerSlot(eq->slot_id); + emu->slot_id = RoF2ToServerMainInvSlot(eq->slot_id); IN(charges); IN(cost); @@ -3908,7 +3908,7 @@ namespace RoF2 SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct); IN(merchant_entity_id); - emu->slot_id = RoF2ToServerSlot(eq->slot_id); + emu->slot_id = RoF2ToServerMainInvSlot(eq->slot_id); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index efd80d0e8..6776ff0e7 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -2180,8 +2180,8 @@ struct AltCurrencyUpdate_Struct { //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; +/*004*/ MainInvItemSlotStruct slot_id; /*004*/ //uint32 slot_id; - ItemSlotStruct slot_id; /*008*/ uint32 unknown008; /*012*/ uint32 unknown012; /*016*/ uint32 unknown016; @@ -2238,10 +2238,10 @@ struct AltCurrencyReclaim_Struct { struct AltCurrencySellItem_Struct { /*000*/ uint32 merchant_entity_id; +/*004*/ MainInvItemSlotStruct slot_id; /*004*/ //uint32 slot_id; - ItemSlotStruct slot_id; -/*008*/ uint32 charges; -/*012*/ uint32 cost; +/*016*/ uint32 charges; +/*020*/ uint32 cost; }; struct Adventure_Purchase_Struct { @@ -2261,14 +2261,14 @@ struct Adventure_Sell_Struct { }; struct AdventurePoints_Update_Struct { -/*000*/ uint32 ldon_available_points; // Total available points -/*004*/ uint8 unkown_apu004[20]; -/*024*/ uint32 ldon_guk_points; // Earned Deepest Guk points -/*028*/ uint32 ldon_mirugal_points; // Earned Mirugal' Mebagerie points -/*032*/ uint32 ldon_mistmoore_points; // Earned Mismoore Catacombs Points -/*036*/ uint32 ldon_rujarkian_points; // Earned Rujarkian Hills points -/*040*/ uint32 ldon_takish_points; // Earned Takish points -/*044*/ uint8 unknown_apu042[216]; +/*000*/ uint32 ldon_available_points; // Total available points +/*004*/ uint8 unkown_apu004[20]; +/*024*/ uint32 ldon_guk_points; // Earned Deepest Guk points +/*028*/ uint32 ldon_mirugal_points; // Earned Mirugal' Mebagerie points +/*032*/ uint32 ldon_mistmoore_points; // Earned Mismoore Catacombs Points +/*036*/ uint32 ldon_rujarkian_points; // Earned Rujarkian Hills points +/*040*/ uint32 ldon_takish_points; // Earned Takish points +/*044*/ uint8 unknown_apu042[216]; }; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index a7b494d0d..c84a670a9 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -2174,8 +2174,7 @@ struct AltCurrencyUpdate_Struct { //When an item is selected while the alt currency merchant window is open struct AltCurrencySelectItem_Struct { /*000*/ uint32 merchant_entity_id; -/*004*/ //uint32 slot_id; - ItemSlotStruct slot_id; +/*004*/ MainInvItemSlotStruct slot_id; /*008*/ uint32 unknown008; /*012*/ uint32 unknown012; /*016*/ uint32 unknown016; @@ -2232,8 +2231,7 @@ struct AltCurrencyReclaim_Struct { struct AltCurrencySellItem_Struct { /*000*/ uint32 merchant_entity_id; -/*004*/ //uint32 slot_id; - ItemSlotStruct slot_id; +/*004*/ MainInvItemSlotStruct slot_id; /*008*/ uint32 charges; /*012*/ uint32 cost; }; diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 378665db1..3a63a8c0f 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4365,8 +4365,8 @@ struct AltCurrencySelectItem_Struct { struct AltCurrencySellItem_Struct { /*000*/ uint32 merchant_entity_id; /*004*/ uint32 slot_id; -/*006*/ uint32 charges; -/*010*/ uint32 cost; +/*008*/ uint32 charges; +/*012*/ uint32 cost; }; struct AltCurrencyPopulateEntry_Struct From 812ad530d1fd4595bb6e8ca4906c110f4cd7bf68 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 20 Dec 2014 00:49:14 -0600 Subject: [PATCH 0668/1883] Updated #cvs to display RoF2 Client Stream count --- changelog.txt | 3 +++ world/clientlist.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index e9e0946d8..ca32db0d7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/20/2014 == +Akkadius: Updated #cvs to display RoF2 Client Stream count + == 12/19/2014 == Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes. Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update. diff --git a/world/clientlist.cpp b/world/clientlist.cpp index d0b90a266..6ef730990 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -1301,6 +1301,8 @@ void ClientList::SendClientVersionSummary(const char *Name) uint32 ClientSoDCount = 0; uint32 ClientUnderfootCount = 0; uint32 ClientRoFCount = 0; + uint32 ClientRoF2Count = 0; + LinkedListIterator Iterator(clientlist); @@ -1343,6 +1345,11 @@ void ClientList::SendClientVersionSummary(const char *Name) ++ClientRoFCount; break; } + case 7: + { + ++ClientRoF2Count; + break; + } default: break; } @@ -1352,7 +1359,7 @@ void ClientList::SendClientVersionSummary(const char *Name) } - zoneserver_list.SendEmoteMessage(Name, 0, 0, 13, "There are %i Titanium, %i SoF, %i SoD, %i UF, %i RoF clients currently connected.", - ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount); + zoneserver_list.SendEmoteMessage(Name, 0, 0, 13, "There are %i Titanium, %i SoF, %i SoD, %i UF, %i RoF, %i RoF2 clients currently connected.", + ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount, ClientRoF2Count); } From b682a2f97a6848253f2cc8b68188d594fd6575d7 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 20 Dec 2014 17:34:47 -0600 Subject: [PATCH 0669/1883] Potential fix for RoF2 random crashes during zoning. --- common/patches/rof2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index d49f00253..a750d2abb 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2551,6 +2551,8 @@ namespace RoF2 outapp->WriteUInt32(0); // Unknown outapp->WriteUInt32(0); // Unknown + // Think we need 1 byte of padding at the end + outapp->WriteUInt8(0); // Unknown _log(NET__STRUCTS, "Player Profile Packet is %i bytes", outapp->GetWritePosition()); From 7d95f3f58261d8fd011af8841d257d85f0ed42b1 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 21 Dec 2014 00:32:01 -0600 Subject: [PATCH 0670/1883] Fix for RoF2 Selling to Merchant. --- utils/patches/patch_RoF2.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 60b94e87d..e6b0fef4c 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -309,7 +309,7 @@ OP_Sacrifice=0x1821 OP_PopupResponse=0x08a6 OP_OnLevelMessage=0x575b OP_AugmentInfo=0x0afb -OP_Petition=0x1901 +OP_Petition=0x3de3 OP_SomeItemPacketMaybe=0x747c OP_PVPStats=0x4b15 OP_PVPLeaderBoardRequest=0x04aa @@ -433,7 +433,7 @@ OP_ItemVerifyRequest=0x189c OP_ItemVerifyReply=0x097b # merchant stuff -OP_ShopPlayerSell=0x0000 +OP_ShopPlayerSell=0x791b OP_ShopRequest=0x4fed OP_ShopEnd=0x30a8 OP_ShopEndConfirm=0x3196 From f588c54d5258175236a82623b621eb713071ec53 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 21 Dec 2014 12:23:11 -0600 Subject: [PATCH 0671/1883] (RoF2) Fixed Extended Targets Window by correcting opcodes. --- changelog.txt | 3 +++ utils/patches/patch_RoF2.conf | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index ca32db0d7..01ddc4625 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/21/2014 == +Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. + == 12/20/2014 == Akkadius: Updated #cvs to display RoF2 Client Stream count diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index e6b0fef4c..88ae7ab31 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -230,10 +230,10 @@ OP_TargetMouse=0x075d OP_MobHealth=0x37b1 OP_InitialMobHealth=0x0000 # Unused? OP_TargetHoTT=0x0272 -OP_XTargetResponse=0x672f -OP_XTargetRequest=0x45be -OP_XTargetAutoAddHaters=0x792c OP_TargetBuffs=0x4f4b +OP_XTargetResponse=0x4d59 +OP_XTargetRequest=0x3763 +OP_XTargetAutoAddHaters=0x672f OP_BuffCreate=0x3377 OP_BuffRemoveRequest=0x64f2 OP_DeleteSpawn=0x7280 @@ -601,7 +601,7 @@ OP_MoveLogDisregard=0x0000 # gone I think # named unknowns, to make looking for real unknown easier OP_AnnoyingZoneUnknown=0x0000 -OP_Some6ByteHPUpdate=0x0000 seems to happen when you target group members +OP_Some6ByteHPUpdate=0x0000 #seems to happen when you target group members OP_QueryResponseThing=0x0000 @@ -610,9 +610,9 @@ OP_QueryResponseThing=0x0000 #OP_LoginUnknown2=0x040b # OP_SendSkillCapsChecksum # Petition Opcodes -OP_PetitionSearch=0x0000 search term for petition -OP_PetitionSearchResults=0x0000 (list of?) matches from search -OP_PetitionSearchText=0x0000 text results of search +OP_PetitionSearch=0x0000 #search term for petition +OP_PetitionSearchResults=0x0000 #(list of?) matches from search +OP_PetitionSearchText=0x0000 #text results of search OP_PetitionUpdate=0x0000 OP_PetitionCheckout=0x0000 From cee7a9a0fd32eb76556d32b4d3fe2766ac1342aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 21 Dec 2014 21:39:04 -0600 Subject: [PATCH 0672/1883] variable rename, readability --- zone/bonuses.cpp | 892 +++++++++++++++++++++++------------------------ 1 file changed, 446 insertions(+), 446 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index b9f35c9ff..a47c1f38b 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1420,7 +1420,7 @@ void Mob::CalcSpellBonuses(StatBonuses* newbon) if (GetClass() == BARD) newbon->ManaRegen = 0; // Bards do not get mana regen from spells. } -void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* newbon, uint16 casterId, bool item_bonus, uint32 ticsremaining, int buffslot, +void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* new_bonus, uint16 casterId, bool item_bonus, uint32 ticsremaining, int buffslot, bool IsAISpellEffect, uint16 effect_id, int32 se_base, int32 se_limit, int32 se_max) { int i, effect_value, base2, max, effectid; @@ -1443,7 +1443,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne uint8 focus = IsFocusEffect(spell_id, i); if (focus) { - newbon->FocusEffects[focus] = spells[spell_id].effectid[i]; + new_bonus->FocusEffects[focus] = spells[spell_id].effectid[i]; continue; } @@ -1466,20 +1466,20 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { case SE_CurrentHP: //regens if(effect_value > 0) { - newbon->HPRegen += effect_value; + new_bonus->HPRegen += effect_value; } break; case SE_CurrentEndurance: - newbon->EnduranceRegen += effect_value; + new_bonus->EnduranceRegen += effect_value; break; case SE_ChangeFrenzyRad: { // redundant to have level check here - if(newbon->AggroRange == -1 || effect_value < newbon->AggroRange) + if(new_bonus->AggroRange == -1 || effect_value < new_bonus->AggroRange) { - newbon->AggroRange = static_cast(effect_value); + new_bonus->AggroRange = static_cast(effect_value); } break; } @@ -1489,9 +1489,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne // Harmony effect as buff - kinda tricky // harmony could stack with a lull spell, which has better aggro range // take the one with less range in any case - if(newbon->AssistRange == -1 || effect_value < newbon->AssistRange) + if(new_bonus->AssistRange == -1 || effect_value < new_bonus->AssistRange) { - newbon->AssistRange = static_cast(effect_value); + new_bonus->AssistRange = static_cast(effect_value); } break; } @@ -1499,16 +1499,16 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_AttackSpeed: { if ((effect_value - 100) > 0) { // Haste - if (newbon->haste < 0) break; // Slowed - Don't apply haste - if ((effect_value - 100) > newbon->haste) { - newbon->haste = effect_value - 100; + if (new_bonus->haste < 0) break; // Slowed - Don't apply haste + if ((effect_value - 100) > new_bonus->haste) { + new_bonus->haste = effect_value - 100; } } else if ((effect_value - 100) < 0) { // Slow int real_slow_value = (100 - effect_value) * -1; real_slow_value -= ((real_slow_value * GetSlowMitigation()/100)); - if (real_slow_value < newbon->haste) - newbon->haste = real_slow_value; + if (real_slow_value < new_bonus->haste) + new_bonus->haste = real_slow_value; } break; } @@ -1516,16 +1516,16 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_AttackSpeed2: { if ((effect_value - 100) > 0) { // Haste V2 - Stacks with V1 but does not Overcap - if (newbon->hastetype2 < 0) break; //Slowed - Don't apply haste2 - if ((effect_value - 100) > newbon->hastetype2) { - newbon->hastetype2 = effect_value - 100; + if (new_bonus->hastetype2 < 0) break; //Slowed - Don't apply haste2 + if ((effect_value - 100) > new_bonus->hastetype2) { + new_bonus->hastetype2 = effect_value - 100; } } else if ((effect_value - 100) < 0) { // Slow int real_slow_value = (100 - effect_value) * -1; real_slow_value -= ((real_slow_value * GetSlowMitigation()/100)); - if (real_slow_value < newbon->hastetype2) - newbon->hastetype2 = real_slow_value; + if (real_slow_value < new_bonus->hastetype2) + new_bonus->hastetype2 = real_slow_value; } break; } @@ -1534,13 +1534,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { if (effect_value < 0){ //Slow effect_value -= ((effect_value * GetSlowMitigation()/100)); - if (effect_value < newbon->hastetype3) - newbon->hastetype3 = effect_value; + if (effect_value < new_bonus->hastetype3) + new_bonus->hastetype3 = effect_value; } else if (effect_value > 0) { // Haste V3 - Stacks and Overcaps - if (effect_value > newbon->hastetype3) { - newbon->hastetype3 = effect_value; + if (effect_value > new_bonus->hastetype3) { + new_bonus->hastetype3 = effect_value; } } break; @@ -1556,10 +1556,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne if (effect_value < 0) //A few spells use negative values(Descriptions all indicate it should be a slow) effect_value = effect_value * -1; - if (effect_value > 0 && effect_value > newbon->inhibitmelee) { + if (effect_value > 0 && effect_value > new_bonus->inhibitmelee) { effect_value -= ((effect_value * GetSlowMitigation()/100)); - if (effect_value > newbon->inhibitmelee) - newbon->inhibitmelee = effect_value; + if (effect_value > new_bonus->inhibitmelee) + new_bonus->inhibitmelee = effect_value; } break; @@ -1567,141 +1567,141 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_TotalHP: { - newbon->HP += effect_value; + new_bonus->HP += effect_value; break; } case SE_ManaRegen_v2: case SE_CurrentMana: { - newbon->ManaRegen += effect_value; + new_bonus->ManaRegen += effect_value; break; } case SE_ManaPool: { - newbon->Mana += effect_value; + new_bonus->Mana += effect_value; break; } case SE_Stamina: { - newbon->EnduranceReduction += effect_value; + new_bonus->EnduranceReduction += effect_value; break; } case SE_ACv2: case SE_ArmorClass: { - newbon->AC += effect_value; + new_bonus->AC += effect_value; break; } case SE_ATK: { - newbon->ATK += effect_value; + new_bonus->ATK += effect_value; break; } case SE_STR: { - newbon->STR += effect_value; + new_bonus->STR += effect_value; break; } case SE_DEX: { - newbon->DEX += effect_value; + new_bonus->DEX += effect_value; break; } case SE_AGI: { - newbon->AGI += effect_value; + new_bonus->AGI += effect_value; break; } case SE_STA: { - newbon->STA += effect_value; + new_bonus->STA += effect_value; break; } case SE_INT: { - newbon->INT += effect_value; + new_bonus->INT += effect_value; break; } case SE_WIS: { - newbon->WIS += effect_value; + new_bonus->WIS += effect_value; break; } case SE_CHA: { if (spells[spell_id].base[i] != 0) { - newbon->CHA += effect_value; + new_bonus->CHA += effect_value; } break; } case SE_AllStats: { - newbon->STR += effect_value; - newbon->DEX += effect_value; - newbon->AGI += effect_value; - newbon->STA += effect_value; - newbon->INT += effect_value; - newbon->WIS += effect_value; - newbon->CHA += effect_value; + new_bonus->STR += effect_value; + new_bonus->DEX += effect_value; + new_bonus->AGI += effect_value; + new_bonus->STA += effect_value; + new_bonus->INT += effect_value; + new_bonus->WIS += effect_value; + new_bonus->CHA += effect_value; break; } case SE_ResistFire: { - newbon->FR += effect_value; + new_bonus->FR += effect_value; break; } case SE_ResistCold: { - newbon->CR += effect_value; + new_bonus->CR += effect_value; break; } case SE_ResistPoison: { - newbon->PR += effect_value; + new_bonus->PR += effect_value; break; } case SE_ResistDisease: { - newbon->DR += effect_value; + new_bonus->DR += effect_value; break; } case SE_ResistMagic: { - newbon->MR += effect_value; + new_bonus->MR += effect_value; break; } case SE_ResistAll: { - newbon->MR += effect_value; - newbon->DR += effect_value; - newbon->PR += effect_value; - newbon->CR += effect_value; - newbon->FR += effect_value; + new_bonus->MR += effect_value; + new_bonus->DR += effect_value; + new_bonus->PR += effect_value; + new_bonus->CR += effect_value; + new_bonus->FR += effect_value; break; } case SE_ResistCorruption: { - newbon->Corrup += effect_value; + new_bonus->Corrup += effect_value; break; } @@ -1711,43 +1711,43 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { //are these #define'd somewhere? case 0: //str - newbon->STRCapMod += effect_value; + new_bonus->STRCapMod += effect_value; break; case 1: //sta - newbon->STACapMod += effect_value; + new_bonus->STACapMod += effect_value; break; case 2: //agi - newbon->AGICapMod += effect_value; + new_bonus->AGICapMod += effect_value; break; case 3: //dex - newbon->DEXCapMod += effect_value; + new_bonus->DEXCapMod += effect_value; break; case 4: //wis - newbon->WISCapMod += effect_value; + new_bonus->WISCapMod += effect_value; break; case 5: //int - newbon->INTCapMod += effect_value; + new_bonus->INTCapMod += effect_value; break; case 6: //cha - newbon->CHACapMod += effect_value; + new_bonus->CHACapMod += effect_value; break; case 7: //mr - newbon->MRCapMod += effect_value; + new_bonus->MRCapMod += effect_value; break; case 8: //cr - newbon->CRCapMod += effect_value; + new_bonus->CRCapMod += effect_value; break; case 9: //fr - newbon->FRCapMod += effect_value; + new_bonus->FRCapMod += effect_value; break; case 10: //pr - newbon->PRCapMod += effect_value; + new_bonus->PRCapMod += effect_value; break; case 11: //dr - newbon->DRCapMod += effect_value; + new_bonus->DRCapMod += effect_value; break; case 12: // corruption - newbon->CorrupCapMod += effect_value; + new_bonus->CorrupCapMod += effect_value; break; } break; @@ -1756,82 +1756,82 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_CastingLevel2: case SE_CastingLevel: // Brilliance of Ro { - newbon->effective_casting_level += effect_value; + new_bonus->effective_casting_level += effect_value; break; } case SE_MovementSpeed: - newbon->movementspeed += effect_value; + new_bonus->movementspeed += effect_value; break; case SE_SpellDamageShield: - newbon->SpellDamageShield += effect_value; + new_bonus->SpellDamageShield += effect_value; break; case SE_DamageShield: { - newbon->DamageShield += effect_value; - newbon->DamageShieldSpellID = spell_id; + new_bonus->DamageShield += effect_value; + new_bonus->DamageShieldSpellID = spell_id; //When using npc_spells_effects MAX value can be set to determine DS Type if (IsAISpellEffect && max) - newbon->DamageShieldType = GetDamageShieldType(spell_id, max); + new_bonus->DamageShieldType = GetDamageShieldType(spell_id, max); else - newbon->DamageShieldType = GetDamageShieldType(spell_id); + new_bonus->DamageShieldType = GetDamageShieldType(spell_id); break; } case SE_ReverseDS: { - newbon->ReverseDamageShield += effect_value; - newbon->ReverseDamageShieldSpellID = spell_id; + new_bonus->ReverseDamageShield += effect_value; + new_bonus->ReverseDamageShieldSpellID = spell_id; if (IsAISpellEffect && max) - newbon->ReverseDamageShieldType = GetDamageShieldType(spell_id, max); + new_bonus->ReverseDamageShieldType = GetDamageShieldType(spell_id, max); else - newbon->ReverseDamageShieldType = GetDamageShieldType(spell_id); + new_bonus->ReverseDamageShieldType = GetDamageShieldType(spell_id); break; } case SE_Reflect: - newbon->reflect_chance += effect_value; + new_bonus->reflect_chance += effect_value; break; case SE_Amplification: - newbon->Amplification += effect_value; + new_bonus->Amplification += effect_value; break; case SE_ChangeAggro: - newbon->hatemod += effect_value; + new_bonus->hatemod += effect_value; break; case SE_MeleeMitigation: //for some reason... this value is negative for increased mitigation - newbon->MeleeMitigationEffect -= effect_value; + new_bonus->MeleeMitigationEffect -= effect_value; break; case SE_CriticalHitChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) { if(base2 == -1) - newbon->CriticalHitChance[HIGHEST_SKILL+1] += effect_value; + new_bonus->CriticalHitChance[HIGHEST_SKILL+1] += effect_value; else - newbon->CriticalHitChance[base2] += effect_value; + new_bonus->CriticalHitChance[base2] += effect_value; } else if(effect_value < 0) { - if(base2 == -1 && newbon->CriticalHitChance[HIGHEST_SKILL+1] > effect_value) - newbon->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; - else if(base2 != -1 && newbon->CriticalHitChance[base2] > effect_value) - newbon->CriticalHitChance[base2] = effect_value; + if(base2 == -1 && new_bonus->CriticalHitChance[HIGHEST_SKILL+1] > effect_value) + new_bonus->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; + else if(base2 != -1 && new_bonus->CriticalHitChance[base2] > effect_value) + new_bonus->CriticalHitChance[base2] = effect_value; } - else if(base2 == -1 && newbon->CriticalHitChance[HIGHEST_SKILL+1] < effect_value) - newbon->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; - else if(base2 != -1 && newbon->CriticalHitChance[base2] < effect_value) - newbon->CriticalHitChance[base2] = effect_value; + else if(base2 == -1 && new_bonus->CriticalHitChance[HIGHEST_SKILL+1] < effect_value) + new_bonus->CriticalHitChance[HIGHEST_SKILL+1] = effect_value; + else if(base2 != -1 && new_bonus->CriticalHitChance[base2] < effect_value) + new_bonus->CriticalHitChance[base2] = effect_value; break; } @@ -1839,13 +1839,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_CrippBlowChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->CrippBlowChance += effect_value; + new_bonus->CrippBlowChance += effect_value; - else if((effect_value < 0) && (newbon->CrippBlowChance > effect_value)) - newbon->CrippBlowChance = effect_value; + else if((effect_value < 0) && (new_bonus->CrippBlowChance > effect_value)) + new_bonus->CrippBlowChance = effect_value; - else if(newbon->CrippBlowChance < effect_value) - newbon->CrippBlowChance = effect_value; + else if(new_bonus->CrippBlowChance < effect_value) + new_bonus->CrippBlowChance = effect_value; break; } @@ -1853,65 +1853,65 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_AvoidMeleeChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->AvoidMeleeChanceEffect += effect_value; + new_bonus->AvoidMeleeChanceEffect += effect_value; - else if((effect_value < 0) && (newbon->AvoidMeleeChanceEffect > effect_value)) - newbon->AvoidMeleeChanceEffect = effect_value; + else if((effect_value < 0) && (new_bonus->AvoidMeleeChanceEffect > effect_value)) + new_bonus->AvoidMeleeChanceEffect = effect_value; - else if(newbon->AvoidMeleeChanceEffect < effect_value) - newbon->AvoidMeleeChanceEffect = effect_value; + else if(new_bonus->AvoidMeleeChanceEffect < effect_value) + new_bonus->AvoidMeleeChanceEffect = effect_value; break; } case SE_RiposteChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->RiposteChance += effect_value; + new_bonus->RiposteChance += effect_value; - else if((effect_value < 0) && (newbon->RiposteChance > effect_value)) - newbon->RiposteChance = effect_value; + else if((effect_value < 0) && (new_bonus->RiposteChance > effect_value)) + new_bonus->RiposteChance = effect_value; - else if(newbon->RiposteChance < effect_value) - newbon->RiposteChance = effect_value; + else if(new_bonus->RiposteChance < effect_value) + new_bonus->RiposteChance = effect_value; break; } case SE_DodgeChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->DodgeChance += effect_value; + new_bonus->DodgeChance += effect_value; - else if((effect_value < 0) && (newbon->DodgeChance > effect_value)) - newbon->DodgeChance = effect_value; + else if((effect_value < 0) && (new_bonus->DodgeChance > effect_value)) + new_bonus->DodgeChance = effect_value; - if(newbon->DodgeChance < effect_value) - newbon->DodgeChance = effect_value; + if(new_bonus->DodgeChance < effect_value) + new_bonus->DodgeChance = effect_value; break; } case SE_ParryChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->ParryChance += effect_value; + new_bonus->ParryChance += effect_value; - else if((effect_value < 0) && (newbon->ParryChance > effect_value)) - newbon->ParryChance = effect_value; + else if((effect_value < 0) && (new_bonus->ParryChance > effect_value)) + new_bonus->ParryChance = effect_value; - if(newbon->ParryChance < effect_value) - newbon->ParryChance = effect_value; + if(new_bonus->ParryChance < effect_value) + new_bonus->ParryChance = effect_value; break; } case SE_DualWieldChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->DualWieldChance += effect_value; + new_bonus->DualWieldChance += effect_value; - else if((effect_value < 0) && (newbon->DualWieldChance > effect_value)) - newbon->DualWieldChance = effect_value; + else if((effect_value < 0) && (new_bonus->DualWieldChance > effect_value)) + new_bonus->DualWieldChance = effect_value; - if(newbon->DualWieldChance < effect_value) - newbon->DualWieldChance = effect_value; + if(new_bonus->DualWieldChance < effect_value) + new_bonus->DualWieldChance = effect_value; break; } @@ -1919,13 +1919,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->DoubleAttackChance += effect_value; + new_bonus->DoubleAttackChance += effect_value; - else if((effect_value < 0) && (newbon->DoubleAttackChance > effect_value)) - newbon->DoubleAttackChance = effect_value; + else if((effect_value < 0) && (new_bonus->DoubleAttackChance > effect_value)) + new_bonus->DoubleAttackChance = effect_value; - if(newbon->DoubleAttackChance < effect_value) - newbon->DoubleAttackChance = effect_value; + if(new_bonus->DoubleAttackChance < effect_value) + new_bonus->DoubleAttackChance = effect_value; break; } @@ -1933,82 +1933,82 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->TripleAttackChance += effect_value; + new_bonus->TripleAttackChance += effect_value; - else if((effect_value < 0) && (newbon->TripleAttackChance > effect_value)) - newbon->TripleAttackChance = effect_value; + else if((effect_value < 0) && (new_bonus->TripleAttackChance > effect_value)) + new_bonus->TripleAttackChance = effect_value; - if(newbon->TripleAttackChance < effect_value) - newbon->TripleAttackChance = effect_value; + if(new_bonus->TripleAttackChance < effect_value) + new_bonus->TripleAttackChance = effect_value; break; } case SE_MeleeLifetap: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->MeleeLifetap += spells[spell_id].base[i]; + new_bonus->MeleeLifetap += spells[spell_id].base[i]; - else if((effect_value < 0) && (newbon->MeleeLifetap > effect_value)) - newbon->MeleeLifetap = effect_value; + else if((effect_value < 0) && (new_bonus->MeleeLifetap > effect_value)) + new_bonus->MeleeLifetap = effect_value; - else if(newbon->MeleeLifetap < effect_value) - newbon->MeleeLifetap = effect_value; + else if(new_bonus->MeleeLifetap < effect_value) + new_bonus->MeleeLifetap = effect_value; break; } case SE_Vampirism: - newbon->Vampirism += effect_value; + new_bonus->Vampirism += effect_value; break; case SE_AllInstrumentMod: { - if(effect_value > newbon->singingMod) - newbon->singingMod = effect_value; - if(effect_value > newbon->brassMod) - newbon->brassMod = effect_value; - if(effect_value > newbon->percussionMod) - newbon->percussionMod = effect_value; - if(effect_value > newbon->windMod) - newbon->windMod = effect_value; - if(effect_value > newbon->stringedMod) - newbon->stringedMod = effect_value; + if(effect_value > new_bonus->singingMod) + new_bonus->singingMod = effect_value; + if(effect_value > new_bonus->brassMod) + new_bonus->brassMod = effect_value; + if(effect_value > new_bonus->percussionMod) + new_bonus->percussionMod = effect_value; + if(effect_value > new_bonus->windMod) + new_bonus->windMod = effect_value; + if(effect_value > new_bonus->stringedMod) + new_bonus->stringedMod = effect_value; break; } case SE_ResistSpellChance: - newbon->ResistSpellChance += effect_value; + new_bonus->ResistSpellChance += effect_value; break; case SE_ResistFearChance: { if(effect_value == 100) // If we reach 100% in a single spell/item then we should be immune to negative fear resist effects until our immunity is over - newbon->Fearless = true; + new_bonus->Fearless = true; - newbon->ResistFearChance += effect_value; // these should stack + new_bonus->ResistFearChance += effect_value; // these should stack break; } case SE_Fearless: - newbon->Fearless = true; + new_bonus->Fearless = true; break; case SE_HundredHands: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->HundredHands += effect_value; + new_bonus->HundredHands += effect_value; - if (effect_value > 0 && effect_value > newbon->HundredHands) - newbon->HundredHands = effect_value; //Increase Weapon Delay - else if (effect_value < 0 && effect_value < newbon->HundredHands) - newbon->HundredHands = effect_value; //Decrease Weapon Delay + if (effect_value > 0 && effect_value > new_bonus->HundredHands) + new_bonus->HundredHands = effect_value; //Increase Weapon Delay + else if (effect_value < 0 && effect_value < new_bonus->HundredHands) + new_bonus->HundredHands = effect_value; //Decrease Weapon Delay break; } case SE_MeleeSkillCheck: { - if(newbon->MeleeSkillCheck < effect_value) { - newbon->MeleeSkillCheck = effect_value; - newbon->MeleeSkillCheckSkill = base2==-1?255:base2; + if(new_bonus->MeleeSkillCheck < effect_value) { + new_bonus->MeleeSkillCheck = effect_value; + new_bonus->MeleeSkillCheckSkill = base2==-1?255:base2; } break; } @@ -2018,29 +2018,29 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne if (RuleB(Spells, AdditiveBonusValues) && item_bonus){ if(base2 == -1) - newbon->HitChanceEffect[HIGHEST_SKILL+1] += effect_value; + new_bonus->HitChanceEffect[HIGHEST_SKILL+1] += effect_value; else - newbon->HitChanceEffect[base2] += effect_value; + new_bonus->HitChanceEffect[base2] += effect_value; } else if(base2 == -1){ - if ((effect_value < 0) && (newbon->HitChanceEffect[HIGHEST_SKILL+1] > effect_value)) - newbon->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; + if ((effect_value < 0) && (new_bonus->HitChanceEffect[HIGHEST_SKILL+1] > effect_value)) + new_bonus->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; - else if (!newbon->HitChanceEffect[HIGHEST_SKILL+1] || - ((newbon->HitChanceEffect[HIGHEST_SKILL+1] > 0) && (newbon->HitChanceEffect[HIGHEST_SKILL+1] < effect_value))) - newbon->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; + else if (!new_bonus->HitChanceEffect[HIGHEST_SKILL+1] || + ((new_bonus->HitChanceEffect[HIGHEST_SKILL+1] > 0) && (new_bonus->HitChanceEffect[HIGHEST_SKILL+1] < effect_value))) + new_bonus->HitChanceEffect[HIGHEST_SKILL+1] = effect_value; } else { - if ((effect_value < 0) && (newbon->HitChanceEffect[base2] > effect_value)) - newbon->HitChanceEffect[base2] = effect_value; + if ((effect_value < 0) && (new_bonus->HitChanceEffect[base2] > effect_value)) + new_bonus->HitChanceEffect[base2] = effect_value; - else if (!newbon->HitChanceEffect[base2] || - ((newbon->HitChanceEffect[base2] > 0) && (newbon->HitChanceEffect[base2] < effect_value))) - newbon->HitChanceEffect[base2] = effect_value; + else if (!new_bonus->HitChanceEffect[base2] || + ((new_bonus->HitChanceEffect[base2] > 0) && (new_bonus->HitChanceEffect[base2] < effect_value))) + new_bonus->HitChanceEffect[base2] = effect_value; } break; @@ -2050,71 +2050,71 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_DamageModifier: { if(base2 == -1) - newbon->DamageModifier[HIGHEST_SKILL+1] += effect_value; + new_bonus->DamageModifier[HIGHEST_SKILL+1] += effect_value; else - newbon->DamageModifier[base2] += effect_value; + new_bonus->DamageModifier[base2] += effect_value; break; } case SE_DamageModifier2: { if(base2 == -1) - newbon->DamageModifier2[HIGHEST_SKILL+1] += effect_value; + new_bonus->DamageModifier2[HIGHEST_SKILL+1] += effect_value; else - newbon->DamageModifier2[base2] += effect_value; + new_bonus->DamageModifier2[base2] += effect_value; break; } case SE_MinDamageModifier: { if(base2 == -1) - newbon->MinDamageModifier[HIGHEST_SKILL+1] += effect_value; + new_bonus->MinDamageModifier[HIGHEST_SKILL+1] += effect_value; else - newbon->MinDamageModifier[base2] += effect_value; + new_bonus->MinDamageModifier[base2] += effect_value; break; } case SE_StunResist: { - if(newbon->StunResist < effect_value) - newbon->StunResist = effect_value; + if(new_bonus->StunResist < effect_value) + new_bonus->StunResist = effect_value; break; } case SE_ProcChance: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) - newbon->ProcChanceSPA += effect_value; + new_bonus->ProcChanceSPA += effect_value; - else if((effect_value < 0) && (newbon->ProcChanceSPA > effect_value)) - newbon->ProcChanceSPA = effect_value; + else if((effect_value < 0) && (new_bonus->ProcChanceSPA > effect_value)) + new_bonus->ProcChanceSPA = effect_value; - if(newbon->ProcChanceSPA < effect_value) - newbon->ProcChanceSPA = effect_value; + if(new_bonus->ProcChanceSPA < effect_value) + new_bonus->ProcChanceSPA = effect_value; break; } case SE_ExtraAttackChance: - newbon->ExtraAttackChance += effect_value; + new_bonus->ExtraAttackChance += effect_value; break; case SE_PercentXPIncrease: { - if(newbon->XPRateMod < effect_value) - newbon->XPRateMod = effect_value; + if(new_bonus->XPRateMod < effect_value) + new_bonus->XPRateMod = effect_value; break; } case SE_DeathSave: { - if(newbon->DeathSave[0] < effect_value) + if(new_bonus->DeathSave[0] < effect_value) { - newbon->DeathSave[0] = effect_value; //1='Partial' 2='Full' - newbon->DeathSave[1] = buffslot; + new_bonus->DeathSave[0] = effect_value; //1='Partial' 2='Full' + new_bonus->DeathSave[1] = buffslot; //These are used in later expansion spell effects. - newbon->DeathSave[2] = base2;//Min level for HealAmt - newbon->DeathSave[3] = max;//HealAmt + new_bonus->DeathSave[2] = base2;//Min level for HealAmt + new_bonus->DeathSave[3] = max;//HealAmt } break; } @@ -2122,44 +2122,44 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_DivineSave: { if (RuleB(Spells, AdditiveBonusValues) && item_bonus) { - newbon->DivineSaveChance[0] += effect_value; - newbon->DivineSaveChance[1] = 0; + new_bonus->DivineSaveChance[0] += effect_value; + new_bonus->DivineSaveChance[1] = 0; } - else if(newbon->DivineSaveChance[0] < effect_value) + else if(new_bonus->DivineSaveChance[0] < effect_value) { - newbon->DivineSaveChance[0] = effect_value; - newbon->DivineSaveChance[1] = base2; + new_bonus->DivineSaveChance[0] = effect_value; + new_bonus->DivineSaveChance[1] = base2; //SetDeathSaveChance(true); } break; } case SE_Flurry: - newbon->FlurryChance += effect_value; + new_bonus->FlurryChance += effect_value; break; case SE_Accuracy: { - if ((effect_value < 0) && (newbon->Accuracy[HIGHEST_SKILL+1] > effect_value)) - newbon->Accuracy[HIGHEST_SKILL+1] = effect_value; + if ((effect_value < 0) && (new_bonus->Accuracy[HIGHEST_SKILL+1] > effect_value)) + new_bonus->Accuracy[HIGHEST_SKILL+1] = effect_value; - else if (!newbon->Accuracy[HIGHEST_SKILL+1] || - ((newbon->Accuracy[HIGHEST_SKILL+1] > 0) && (newbon->Accuracy[HIGHEST_SKILL+1] < effect_value))) - newbon->Accuracy[HIGHEST_SKILL+1] = effect_value; + else if (!new_bonus->Accuracy[HIGHEST_SKILL+1] || + ((new_bonus->Accuracy[HIGHEST_SKILL+1] > 0) && (new_bonus->Accuracy[HIGHEST_SKILL+1] < effect_value))) + new_bonus->Accuracy[HIGHEST_SKILL+1] = effect_value; break; } case SE_MaxHPChange: - newbon->MaxHPChange += effect_value; + new_bonus->MaxHPChange += effect_value; break; case SE_EndurancePool: - newbon->Endurance += effect_value; + new_bonus->Endurance += effect_value; break; case SE_HealRate: - newbon->HealRate += effect_value; + new_bonus->HealRate += effect_value; break; case SE_SkillDamageTaken: @@ -2174,9 +2174,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne else { if(base2 == -1) - newbon->SkillDmgTaken[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDmgTaken[HIGHEST_SKILL+1] += effect_value; else - newbon->SkillDmgTaken[base2] += effect_value; + new_bonus->SkillDmgTaken[base2] += effect_value; } break; @@ -2186,9 +2186,9 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { for(int e = 0; e < MAX_SPELL_TRIGGER; e++) { - if(!newbon->SpellTriggers[e]) + if(!new_bonus->SpellTriggers[e]) { - newbon->SpellTriggers[e] = spell_id; + new_bonus->SpellTriggers[e] = spell_id; break; } } @@ -2196,44 +2196,44 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne } case SE_SpellCritChance: - newbon->CriticalSpellChance += effect_value; + new_bonus->CriticalSpellChance += effect_value; break; case SE_CriticalSpellChance: { - newbon->CriticalSpellChance += effect_value; + new_bonus->CriticalSpellChance += effect_value; - if (base2 > newbon->SpellCritDmgIncNoStack) - newbon->SpellCritDmgIncNoStack = base2; + if (base2 > new_bonus->SpellCritDmgIncNoStack) + new_bonus->SpellCritDmgIncNoStack = base2; break; } case SE_SpellCritDmgIncrease: - newbon->SpellCritDmgIncrease += effect_value; + new_bonus->SpellCritDmgIncrease += effect_value; break; case SE_DotCritDmgIncrease: - newbon->DotCritDmgIncrease += effect_value; + new_bonus->DotCritDmgIncrease += effect_value; break; case SE_CriticalHealChance: - newbon->CriticalHealChance += effect_value; + new_bonus->CriticalHealChance += effect_value; break; case SE_CriticalHealOverTime: - newbon->CriticalHealOverTime += effect_value; + new_bonus->CriticalHealOverTime += effect_value; break; case SE_CriticalHealDecay: - newbon->CriticalHealDecay = true; + new_bonus->CriticalHealDecay = true; break; case SE_CriticalRegenDecay: - newbon->CriticalRegenDecay = true; + new_bonus->CriticalRegenDecay = true; break; case SE_CriticalDotDecay: - newbon->CriticalDotDecay = true; + new_bonus->CriticalDotDecay = true; break; case SE_MitigateDamageShield: @@ -2241,24 +2241,24 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne if (effect_value < 0) effect_value = effect_value*-1; - newbon->DSMitigationOffHand += effect_value; + new_bonus->DSMitigationOffHand += effect_value; break; } case SE_CriticalDoTChance: - newbon->CriticalDoTChance += effect_value; + new_bonus->CriticalDoTChance += effect_value; break; case SE_ProcOnKillShot: { for(int e = 0; e < MAX_SPELL_TRIGGER*3; e+=3) { - if(!newbon->SpellOnKill[e]) + if(!new_bonus->SpellOnKill[e]) { // Base2 = Spell to fire | Base1 = % chance | Base3 = min level - newbon->SpellOnKill[e] = base2; - newbon->SpellOnKill[e+1] = effect_value; - newbon->SpellOnKill[e+2] = max; + new_bonus->SpellOnKill[e] = base2; + new_bonus->SpellOnKill[e+1] = effect_value; + new_bonus->SpellOnKill[e+2] = max; break; } } @@ -2269,11 +2269,11 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne { for(int e = 0; e < MAX_SPELL_TRIGGER; e+=2) { - if(!newbon->SpellOnDeath[e]) + if(!new_bonus->SpellOnDeath[e]) { // Base2 = Spell to fire | Base1 = % chance - newbon->SpellOnDeath[e] = base2; - newbon->SpellOnDeath[e+1] = effect_value; + new_bonus->SpellOnDeath[e] = base2; + new_bonus->SpellOnDeath[e+1] = effect_value; break; } } @@ -2283,151 +2283,151 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_CriticalDamageMob: { if(base2 == -1) - newbon->CritDmgMob[HIGHEST_SKILL+1] += effect_value; + new_bonus->CritDmgMob[HIGHEST_SKILL+1] += effect_value; else - newbon->CritDmgMob[base2] += effect_value; + new_bonus->CritDmgMob[base2] += effect_value; break; } case SE_ReduceSkillTimer: { - if(newbon->SkillReuseTime[base2] < effect_value) - newbon->SkillReuseTime[base2] = effect_value; + if(new_bonus->SkillReuseTime[base2] < effect_value) + new_bonus->SkillReuseTime[base2] = effect_value; break; } case SE_SkillDamageAmount: { if(base2 == -1) - newbon->SkillDamageAmount[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDamageAmount[HIGHEST_SKILL+1] += effect_value; else - newbon->SkillDamageAmount[base2] += effect_value; + new_bonus->SkillDamageAmount[base2] += effect_value; break; } case SE_GravityEffect: - newbon->GravityEffect = 1; + new_bonus->GravityEffect = 1; break; case SE_AntiGate: - newbon->AntiGate = true; + new_bonus->AntiGate = true; break; case SE_MagicWeapon: - newbon->MagicWeapon = true; + new_bonus->MagicWeapon = true; break; case SE_IncreaseBlockChance: - newbon->IncreaseBlockChance += effect_value; + new_bonus->IncreaseBlockChance += effect_value; break; case SE_PersistantCasting: - newbon->PersistantCasting += effect_value; + new_bonus->PersistantCasting += effect_value; break; case SE_LimitHPPercent: { - if(newbon->HPPercCap[0] != 0 && newbon->HPPercCap[0] > effect_value){ - newbon->HPPercCap[0] = effect_value; - newbon->HPPercCap[1] = base2; + if(new_bonus->HPPercCap[0] != 0 && new_bonus->HPPercCap[0] > effect_value){ + new_bonus->HPPercCap[0] = effect_value; + new_bonus->HPPercCap[1] = base2; } - else if(newbon->HPPercCap[0] == 0){ - newbon->HPPercCap[0] = effect_value; - newbon->HPPercCap[1] = base2; + else if(new_bonus->HPPercCap[0] == 0){ + new_bonus->HPPercCap[0] = effect_value; + new_bonus->HPPercCap[1] = base2; } break; } case SE_LimitManaPercent: { - if(newbon->ManaPercCap[0] != 0 && newbon->ManaPercCap[0] > effect_value){ - newbon->ManaPercCap[0] = effect_value; - newbon->ManaPercCap[1] = base2; + if(new_bonus->ManaPercCap[0] != 0 && new_bonus->ManaPercCap[0] > effect_value){ + new_bonus->ManaPercCap[0] = effect_value; + new_bonus->ManaPercCap[1] = base2; } - else if(newbon->ManaPercCap[0] == 0) { - newbon->ManaPercCap[0] = effect_value; - newbon->ManaPercCap[1] = base2; + else if(new_bonus->ManaPercCap[0] == 0) { + new_bonus->ManaPercCap[0] = effect_value; + new_bonus->ManaPercCap[1] = base2; } break; } case SE_LimitEndPercent: { - if(newbon->EndPercCap[0] != 0 && newbon->EndPercCap[0] > effect_value) { - newbon->EndPercCap[0] = effect_value; - newbon->EndPercCap[1] = base2; + if(new_bonus->EndPercCap[0] != 0 && new_bonus->EndPercCap[0] > effect_value) { + new_bonus->EndPercCap[0] = effect_value; + new_bonus->EndPercCap[1] = base2; } - else if(newbon->EndPercCap[0] == 0){ - newbon->EndPercCap[0] = effect_value; - newbon->EndPercCap[1] = base2; + else if(new_bonus->EndPercCap[0] == 0){ + new_bonus->EndPercCap[0] = effect_value; + new_bonus->EndPercCap[1] = base2; } break; } case SE_BlockNextSpellFocus: - newbon->BlockNextSpell = true; + new_bonus->BlockNextSpell = true; break; case SE_NegateSpellEffect: - newbon->NegateEffects = true; + new_bonus->NegateEffects = true; break; case SE_ImmuneFleeing: - newbon->ImmuneToFlee = true; + new_bonus->ImmuneToFlee = true; break; case SE_DelayDeath: - newbon->DelayDeath += effect_value; + new_bonus->DelayDeath += effect_value; break; case SE_SpellProcChance: - newbon->SpellProcChance += effect_value; + new_bonus->SpellProcChance += effect_value; break; case SE_CharmBreakChance: - newbon->CharmBreakChance += effect_value; + new_bonus->CharmBreakChance += effect_value; break; case SE_BardSongRange: - newbon->SongRange += effect_value; + new_bonus->SongRange += effect_value; break; case SE_HPToMana: { //Lower the ratio the more favorable - if((!newbon->HPToManaConvert) || (newbon->HPToManaConvert >= effect_value)) - newbon->HPToManaConvert = spells[spell_id].base[i]; + if((!new_bonus->HPToManaConvert) || (new_bonus->HPToManaConvert >= effect_value)) + new_bonus->HPToManaConvert = spells[spell_id].base[i]; break; } case SE_SkillDamageAmount2: { if(base2 == -1) - newbon->SkillDamageAmount2[HIGHEST_SKILL+1] += effect_value; + new_bonus->SkillDamageAmount2[HIGHEST_SKILL+1] += effect_value; else - newbon->SkillDamageAmount2[base2] += effect_value; + new_bonus->SkillDamageAmount2[base2] += effect_value; break; } case SE_NegateAttacks: { - if (!newbon->NegateAttacks[0] || - ((newbon->NegateAttacks[0] && newbon->NegateAttacks[2]) && (newbon->NegateAttacks[2] < max))){ - newbon->NegateAttacks[0] = 1; - newbon->NegateAttacks[1] = buffslot; - newbon->NegateAttacks[2] = max; + if (!new_bonus->NegateAttacks[0] || + ((new_bonus->NegateAttacks[0] && new_bonus->NegateAttacks[2]) && (new_bonus->NegateAttacks[2] < max))){ + new_bonus->NegateAttacks[0] = 1; + new_bonus->NegateAttacks[1] = buffslot; + new_bonus->NegateAttacks[2] = max; } break; } case SE_MitigateMeleeDamage: { - if (newbon->MitigateMeleeRune[0] < effect_value){ - newbon->MitigateMeleeRune[0] = effect_value; - newbon->MitigateMeleeRune[1] = buffslot; - newbon->MitigateMeleeRune[2] = base2; - newbon->MitigateMeleeRune[3] = max; + if (new_bonus->MitigateMeleeRune[0] < effect_value){ + new_bonus->MitigateMeleeRune[0] = effect_value; + new_bonus->MitigateMeleeRune[1] = buffslot; + new_bonus->MitigateMeleeRune[2] = base2; + new_bonus->MitigateMeleeRune[3] = max; } break; } @@ -2435,268 +2435,268 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_MeleeThresholdGuard: { - if (newbon->MeleeThresholdGuard[0] < effect_value){ - newbon->MeleeThresholdGuard[0] = effect_value; - newbon->MeleeThresholdGuard[1] = buffslot; - newbon->MeleeThresholdGuard[2] = base2; + if (new_bonus->MeleeThresholdGuard[0] < effect_value){ + new_bonus->MeleeThresholdGuard[0] = effect_value; + new_bonus->MeleeThresholdGuard[1] = buffslot; + new_bonus->MeleeThresholdGuard[2] = base2; } break; } case SE_SpellThresholdGuard: { - if (newbon->SpellThresholdGuard[0] < effect_value){ - newbon->SpellThresholdGuard[0] = effect_value; - newbon->SpellThresholdGuard[1] = buffslot; - newbon->SpellThresholdGuard[2] = base2; + if (new_bonus->SpellThresholdGuard[0] < effect_value){ + new_bonus->SpellThresholdGuard[0] = effect_value; + new_bonus->SpellThresholdGuard[1] = buffslot; + new_bonus->SpellThresholdGuard[2] = base2; } break; } case SE_MitigateSpellDamage: { - if (newbon->MitigateSpellRune[0] < effect_value){ - newbon->MitigateSpellRune[0] = effect_value; - newbon->MitigateSpellRune[1] = buffslot; - newbon->MitigateSpellRune[2] = base2; - newbon->MitigateSpellRune[3] = max; + if (new_bonus->MitigateSpellRune[0] < effect_value){ + new_bonus->MitigateSpellRune[0] = effect_value; + new_bonus->MitigateSpellRune[1] = buffslot; + new_bonus->MitigateSpellRune[2] = base2; + new_bonus->MitigateSpellRune[3] = max; } break; } case SE_MitigateDotDamage: { - if (newbon->MitigateDotRune[0] < effect_value){ - newbon->MitigateDotRune[0] = effect_value; - newbon->MitigateDotRune[1] = buffslot; - newbon->MitigateDotRune[2] = base2; - newbon->MitigateDotRune[3] = max; + if (new_bonus->MitigateDotRune[0] < effect_value){ + new_bonus->MitigateDotRune[0] = effect_value; + new_bonus->MitigateDotRune[1] = buffslot; + new_bonus->MitigateDotRune[2] = base2; + new_bonus->MitigateDotRune[3] = max; } break; } case SE_ManaAbsorbPercentDamage: { - if (newbon->ManaAbsorbPercentDamage[0] < effect_value){ - newbon->ManaAbsorbPercentDamage[0] = effect_value; - newbon->ManaAbsorbPercentDamage[1] = buffslot; + if (new_bonus->ManaAbsorbPercentDamage[0] < effect_value){ + new_bonus->ManaAbsorbPercentDamage[0] = effect_value; + new_bonus->ManaAbsorbPercentDamage[1] = buffslot; } break; } case SE_TriggerMeleeThreshold: - newbon->TriggerMeleeThreshold = true; + new_bonus->TriggerMeleeThreshold = true; break; case SE_TriggerSpellThreshold: - newbon->TriggerSpellThreshold = true; + new_bonus->TriggerSpellThreshold = true; break; case SE_ShieldBlock: - newbon->ShieldBlock += effect_value; + new_bonus->ShieldBlock += effect_value; break; case SE_ShieldEquipHateMod: - newbon->ShieldEquipHateMod += effect_value; + new_bonus->ShieldEquipHateMod += effect_value; break; case SE_ShieldEquipDmgMod: - newbon->ShieldEquipDmgMod[0] += effect_value; - newbon->ShieldEquipDmgMod[1] += base2; + new_bonus->ShieldEquipDmgMod[0] += effect_value; + new_bonus->ShieldEquipDmgMod[1] += base2; break; case SE_BlockBehind: - newbon->BlockBehind += effect_value; + new_bonus->BlockBehind += effect_value; break; case SE_Blind: - newbon->IsBlind = true; + new_bonus->IsBlind = true; break; case SE_Fear: - newbon->IsFeared = true; + new_bonus->IsFeared = true; break; //AA bonuses - implemented broadly into spell/item effects case SE_FrontalStunResist: - newbon->FrontalStunResist += effect_value; + new_bonus->FrontalStunResist += effect_value; break; case SE_ImprovedBindWound: - newbon->BindWound += effect_value; + new_bonus->BindWound += effect_value; break; case SE_MaxBindWound: - newbon->MaxBindWound += effect_value; + new_bonus->MaxBindWound += effect_value; break; case SE_BaseMovementSpeed: - newbon->BaseMovementSpeed += effect_value; + new_bonus->BaseMovementSpeed += effect_value; break; case SE_IncreaseRunSpeedCap: - newbon->IncreaseRunSpeedCap += effect_value; + new_bonus->IncreaseRunSpeedCap += effect_value; break; case SE_DoubleSpecialAttack: - newbon->DoubleSpecialAttack += effect_value; + new_bonus->DoubleSpecialAttack += effect_value; break; case SE_TripleBackstab: - newbon->TripleBackstab += effect_value; + new_bonus->TripleBackstab += effect_value; break; case SE_FrontalBackstabMinDmg: - newbon->FrontalBackstabMinDmg = true; + new_bonus->FrontalBackstabMinDmg = true; break; case SE_FrontalBackstabChance: - newbon->FrontalBackstabChance += effect_value; + new_bonus->FrontalBackstabChance += effect_value; break; case SE_ConsumeProjectile: - newbon->ConsumeProjectile += effect_value; + new_bonus->ConsumeProjectile += effect_value; break; case SE_ForageAdditionalItems: - newbon->ForageAdditionalItems += effect_value; + new_bonus->ForageAdditionalItems += effect_value; break; case SE_Salvage: - newbon->SalvageChance += effect_value; + new_bonus->SalvageChance += effect_value; break; case SE_ArcheryDamageModifier: - newbon->ArcheryDamageModifier += effect_value; + new_bonus->ArcheryDamageModifier += effect_value; break; case SE_DoubleRangedAttack: - newbon->DoubleRangedAttack += effect_value; + new_bonus->DoubleRangedAttack += effect_value; break; case SE_SecondaryDmgInc: - newbon->SecondaryDmgInc = true; + new_bonus->SecondaryDmgInc = true; break; case SE_StrikeThrough: case SE_StrikeThrough2: - newbon->StrikeThrough += effect_value; + new_bonus->StrikeThrough += effect_value; break; case SE_GiveDoubleAttack: - newbon->GiveDoubleAttack += effect_value; + new_bonus->GiveDoubleAttack += effect_value; break; case SE_PetCriticalHit: - newbon->PetCriticalHit += effect_value; + new_bonus->PetCriticalHit += effect_value; break; case SE_CombatStability: - newbon->CombatStability += effect_value; + new_bonus->CombatStability += effect_value; break; case SE_AddSingingMod: switch (base2) { case ItemTypeWindInstrument: - newbon->windMod += effect_value; + new_bonus->windMod += effect_value; break; case ItemTypeStringedInstrument: - newbon->stringedMod += effect_value; + new_bonus->stringedMod += effect_value; break; case ItemTypeBrassInstrument: - newbon->brassMod += effect_value; + new_bonus->brassMod += effect_value; break; case ItemTypePercussionInstrument: - newbon->percussionMod += effect_value; + new_bonus->percussionMod += effect_value; break; case ItemTypeSinging: - newbon->singingMod += effect_value; + new_bonus->singingMod += effect_value; break; } break; case SE_SongModCap: - newbon->songModCap += effect_value; + new_bonus->songModCap += effect_value; break; case SE_PetAvoidance: - newbon->PetAvoidance += effect_value; + new_bonus->PetAvoidance += effect_value; break; case SE_Ambidexterity: - newbon->Ambidexterity += effect_value; + new_bonus->Ambidexterity += effect_value; break; case SE_PetMaxHP: - newbon->PetMaxHP += effect_value; + new_bonus->PetMaxHP += effect_value; break; case SE_PetFlurry: - newbon->PetFlurry += effect_value; + new_bonus->PetFlurry += effect_value; break; case SE_GivePetGroupTarget: - newbon->GivePetGroupTarget = true; + new_bonus->GivePetGroupTarget = true; break; case SE_RootBreakChance: - newbon->RootBreakChance += effect_value; + new_bonus->RootBreakChance += effect_value; break; case SE_ChannelChanceItems: - newbon->ChannelChanceItems += effect_value; + new_bonus->ChannelChanceItems += effect_value; break; case SE_ChannelChanceSpells: - newbon->ChannelChanceSpells += effect_value; + new_bonus->ChannelChanceSpells += effect_value; break; case SE_UnfailingDivinity: - newbon->UnfailingDivinity += effect_value; + new_bonus->UnfailingDivinity += effect_value; break; case SE_ItemHPRegenCapIncrease: - newbon->ItemHPRegenCap += effect_value; + new_bonus->ItemHPRegenCap += effect_value; break; case SE_OffhandRiposteFail: - newbon->OffhandRiposteFail += effect_value; + new_bonus->OffhandRiposteFail += effect_value; break; case SE_ItemAttackCapIncrease: - newbon->ItemATKCap += effect_value; + new_bonus->ItemATKCap += effect_value; break; case SE_TwoHandBluntBlock: - newbon->TwoHandBluntBlock += effect_value; + new_bonus->TwoHandBluntBlock += effect_value; break; case SE_StunBashChance: - newbon->StunBashChance += effect_value; + new_bonus->StunBashChance += effect_value; break; case SE_IncreaseChanceMemwipe: - newbon->IncreaseChanceMemwipe += effect_value; + new_bonus->IncreaseChanceMemwipe += effect_value; break; case SE_CriticalMend: - newbon->CriticalMend += effect_value; + new_bonus->CriticalMend += effect_value; break; case SE_SpellEffectResistChance: { for(int e = 0; e < MAX_RESISTABLE_EFFECTS*2; e+=2) { - if(newbon->SEResist[e+1] && (newbon->SEResist[e] == base2) && (newbon->SEResist[e+1] < effect_value)){ - newbon->SEResist[e] = base2; //Spell Effect ID - newbon->SEResist[e+1] = effect_value; //Resist Chance + if(new_bonus->SEResist[e+1] && (new_bonus->SEResist[e] == base2) && (new_bonus->SEResist[e+1] < effect_value)){ + new_bonus->SEResist[e] = base2; //Spell Effect ID + new_bonus->SEResist[e+1] = effect_value; //Resist Chance break; } - else if (!newbon->SEResist[e+1]){ - newbon->SEResist[e] = base2; //Spell Effect ID - newbon->SEResist[e+1] = effect_value; //Resist Chance + else if (!new_bonus->SEResist[e+1]){ + new_bonus->SEResist[e] = base2; //Spell Effect ID + new_bonus->SEResist[e+1] = effect_value; //Resist Chance break; } } @@ -2705,110 +2705,110 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_MasteryofPast: { - if(newbon->MasteryofPast < effect_value) - newbon->MasteryofPast = effect_value; + if(new_bonus->MasteryofPast < effect_value) + new_bonus->MasteryofPast = effect_value; break; } case SE_DoubleRiposte: { - newbon->DoubleRiposte += effect_value; + new_bonus->DoubleRiposte += effect_value; } case SE_GiveDoubleRiposte: { //Only allow for regular double riposte chance. - if(newbon->GiveDoubleRiposte[base2] == 0){ - if(newbon->GiveDoubleRiposte[0] < effect_value) - newbon->GiveDoubleRiposte[0] = effect_value; + if(new_bonus->GiveDoubleRiposte[base2] == 0){ + if(new_bonus->GiveDoubleRiposte[0] < effect_value) + new_bonus->GiveDoubleRiposte[0] = effect_value; } break; } case SE_SlayUndead: { - if(newbon->SlayUndead[1] < effect_value) - newbon->SlayUndead[0] = effect_value; // Rate - newbon->SlayUndead[1] = base2; // Damage Modifier + if(new_bonus->SlayUndead[1] < effect_value) + new_bonus->SlayUndead[0] = effect_value; // Rate + new_bonus->SlayUndead[1] = base2; // Damage Modifier break; } case SE_TriggerOnReqTarget: case SE_TriggerOnReqCaster: - newbon->TriggerOnValueAmount = true; + new_bonus->TriggerOnValueAmount = true; break; case SE_DivineAura: - newbon->DivineAura = true; + new_bonus->DivineAura = true; break; case SE_ImprovedTaunt: - if (newbon->ImprovedTaunt[0] < effect_value) { - newbon->ImprovedTaunt[0] = effect_value; - newbon->ImprovedTaunt[1] = base2; - newbon->ImprovedTaunt[2] = buffslot; + if (new_bonus->ImprovedTaunt[0] < effect_value) { + new_bonus->ImprovedTaunt[0] = effect_value; + new_bonus->ImprovedTaunt[1] = base2; + new_bonus->ImprovedTaunt[2] = buffslot; } break; case SE_DistanceRemoval: - newbon->DistanceRemoval = true; + new_bonus->DistanceRemoval = true; break; case SE_FrenziedDevastation: - newbon->FrenziedDevastation += base2; + new_bonus->FrenziedDevastation += base2; break; case SE_Root: - if (newbon->Root[0] && (newbon->Root[1] > buffslot)){ - newbon->Root[0] = 1; - newbon->Root[1] = buffslot; + if (new_bonus->Root[0] && (new_bonus->Root[1] > buffslot)){ + new_bonus->Root[0] = 1; + new_bonus->Root[1] = buffslot; } - else if (!newbon->Root[0]){ - newbon->Root[0] = 1; - newbon->Root[1] = buffslot; + else if (!new_bonus->Root[0]){ + new_bonus->Root[0] = 1; + new_bonus->Root[1] = buffslot; } break; case SE_Rune: - if (newbon->MeleeRune[0] && (newbon->MeleeRune[1] > buffslot)){ + if (new_bonus->MeleeRune[0] && (new_bonus->MeleeRune[1] > buffslot)){ - newbon->MeleeRune[0] = effect_value; - newbon->MeleeRune[1] = buffslot; + new_bonus->MeleeRune[0] = effect_value; + new_bonus->MeleeRune[1] = buffslot; } - else if (!newbon->MeleeRune[0]){ - newbon->MeleeRune[0] = effect_value; - newbon->MeleeRune[1] = buffslot; + else if (!new_bonus->MeleeRune[0]){ + new_bonus->MeleeRune[0] = effect_value; + new_bonus->MeleeRune[1] = buffslot; } break; case SE_AbsorbMagicAtt: - if (newbon->AbsorbMagicAtt[0] && (newbon->AbsorbMagicAtt[1] > buffslot)){ - newbon->AbsorbMagicAtt[0] = effect_value; - newbon->AbsorbMagicAtt[1] = buffslot; + if (new_bonus->AbsorbMagicAtt[0] && (new_bonus->AbsorbMagicAtt[1] > buffslot)){ + new_bonus->AbsorbMagicAtt[0] = effect_value; + new_bonus->AbsorbMagicAtt[1] = buffslot; } - else if (!newbon->AbsorbMagicAtt[0]){ - newbon->AbsorbMagicAtt[0] = effect_value; - newbon->AbsorbMagicAtt[1] = buffslot; + else if (!new_bonus->AbsorbMagicAtt[0]){ + new_bonus->AbsorbMagicAtt[0] = effect_value; + new_bonus->AbsorbMagicAtt[1] = buffslot; } break; case SE_NegateIfCombat: - newbon->NegateIfCombat = true; + new_bonus->NegateIfCombat = true; break; case SE_Screech: - newbon->Screech = effect_value; + new_bonus->Screech = effect_value; break; case SE_AlterNPCLevel: if (IsNPC()){ - if (!newbon->AlterNPCLevel - || ((effect_value < 0) && (newbon->AlterNPCLevel > effect_value)) - || ((effect_value > 0) && (newbon->AlterNPCLevel < effect_value))) { + if (!new_bonus->AlterNPCLevel + || ((effect_value < 0) && (new_bonus->AlterNPCLevel > effect_value)) + || ((effect_value > 0) && (new_bonus->AlterNPCLevel < effect_value))) { int tmp_lv = GetOrigLevel() + effect_value; if (tmp_lv < 1) @@ -2816,7 +2816,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne else if (tmp_lv > 255) tmp_lv = 255; if ((GetLevel() != tmp_lv)){ - newbon->AlterNPCLevel = effect_value; + new_bonus->AlterNPCLevel = effect_value; SetLevel(tmp_lv); } } @@ -2824,82 +2824,82 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne break; case SE_AStacker: - newbon->AStacker[0] = 1; - newbon->AStacker[1] = effect_value; + new_bonus->AStacker[0] = 1; + new_bonus->AStacker[1] = effect_value; break; case SE_BStacker: - newbon->BStacker[0] = 1; - newbon->BStacker[1] = effect_value; + new_bonus->BStacker[0] = 1; + new_bonus->BStacker[1] = effect_value; break; case SE_CStacker: - newbon->CStacker[0] = 1; - newbon->CStacker[1] = effect_value; + new_bonus->CStacker[0] = 1; + new_bonus->CStacker[1] = effect_value; break; case SE_DStacker: - newbon->DStacker[0] = 1; - newbon->DStacker[1] = effect_value; + new_bonus->DStacker[0] = 1; + new_bonus->DStacker[1] = effect_value; break; case SE_Berserk: - newbon->BerserkSPA = true; + new_bonus->BerserkSPA = true; break; case SE_Metabolism: - newbon->Metabolism += effect_value; + new_bonus->Metabolism += effect_value; break; case SE_ImprovedReclaimEnergy: { - if((effect_value < 0) && (newbon->ImprovedReclaimEnergy > effect_value)) - newbon->ImprovedReclaimEnergy = effect_value; + if((effect_value < 0) && (new_bonus->ImprovedReclaimEnergy > effect_value)) + new_bonus->ImprovedReclaimEnergy = effect_value; - else if(newbon->ImprovedReclaimEnergy < effect_value) - newbon->ImprovedReclaimEnergy = effect_value; + else if(new_bonus->ImprovedReclaimEnergy < effect_value) + new_bonus->ImprovedReclaimEnergy = effect_value; break; } case SE_HeadShot: { - if(newbon->HeadShot[1] < base2){ - newbon->HeadShot[0] = effect_value; - newbon->HeadShot[1] = base2; + if(new_bonus->HeadShot[1] < base2){ + new_bonus->HeadShot[0] = effect_value; + new_bonus->HeadShot[1] = base2; } break; } case SE_HeadShotLevel: { - if(newbon->HSLevel < effect_value) - newbon->HSLevel = effect_value; + if(new_bonus->HSLevel < effect_value) + new_bonus->HSLevel = effect_value; break; } case SE_Assassinate: { - if(newbon->Assassinate[1] < base2){ - newbon->Assassinate[0] = effect_value; - newbon->Assassinate[1] = base2; + if(new_bonus->Assassinate[1] < base2){ + new_bonus->Assassinate[0] = effect_value; + new_bonus->Assassinate[1] = base2; } break; } case SE_AssassinateLevel: { - if(newbon->AssassinateLevel < effect_value) - newbon->AssassinateLevel = effect_value; + if(new_bonus->AssassinateLevel < effect_value) + new_bonus->AssassinateLevel = effect_value; break; } case SE_FinishingBlow: { //base1 = chance, base2 = damage - if (newbon->FinishingBlow[1] < base2){ - newbon->FinishingBlow[0] = effect_value; - newbon->FinishingBlow[1] = base2; + if (new_bonus->FinishingBlow[1] < base2){ + new_bonus->FinishingBlow[0] = effect_value; + new_bonus->FinishingBlow[1] = base2; } break; } @@ -2907,42 +2907,42 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_FinishingBlowLvl: { //base1 = level, base2 = ??? (Set to 200 in AA data, possible proc rate mod?) - if (newbon->FinishingBlowLvl[0] < effect_value){ - newbon->FinishingBlowLvl[0] = effect_value; - newbon->FinishingBlowLvl[1] = base2; + if (new_bonus->FinishingBlowLvl[0] < effect_value){ + new_bonus->FinishingBlowLvl[0] = effect_value; + new_bonus->FinishingBlowLvl[1] = base2; } break; } case SE_PetMeleeMitigation: - newbon->PetMeleeMitigation += effect_value; + new_bonus->PetMeleeMitigation += effect_value; break; case SE_MeleeVulnerability: - newbon->MeleeVulnerability += effect_value; + new_bonus->MeleeVulnerability += effect_value; break; case SE_Sanctuary: - newbon->Sanctuary = true; + new_bonus->Sanctuary = true; break; case SE_FactionModPct: { - if((effect_value < 0) && (newbon->FactionModPct > effect_value)) - newbon->FactionModPct = effect_value; + if((effect_value < 0) && (new_bonus->FactionModPct > effect_value)) + new_bonus->FactionModPct = effect_value; - else if(newbon->FactionModPct < effect_value) - newbon->FactionModPct = effect_value; + else if(new_bonus->FactionModPct < effect_value) + new_bonus->FactionModPct = effect_value; break; } case SE_IllusionPersistence: - newbon->IllusionPersistence = true; + new_bonus->IllusionPersistence = true; break; case SE_LimitToSkill:{ if (effect_value <= HIGHEST_SKILL){ - newbon->LimitToSkill[effect_value] = true; + new_bonus->LimitToSkill[effect_value] = true; } break; } @@ -2951,11 +2951,11 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne for(int e = 0; e < MAX_SKILL_PROCS; e++) { - if(newbon->SkillProc[e] && newbon->SkillProc[e] == spell_id) + if(new_bonus->SkillProc[e] && new_bonus->SkillProc[e] == spell_id) break; //Do not use the same spell id more than once. - else if(!newbon->SkillProc[e]){ - newbon->SkillProc[e] = spell_id; + else if(!new_bonus->SkillProc[e]){ + new_bonus->SkillProc[e] = spell_id; break; } } @@ -2966,11 +2966,11 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne for(int e = 0; e < MAX_SKILL_PROCS; e++) { - if(newbon->SkillProcSuccess[e] && newbon->SkillProcSuccess[e] == spell_id) + if(new_bonus->SkillProcSuccess[e] && new_bonus->SkillProcSuccess[e] == spell_id) break; //Do not use the same spell id more than once. - else if(!newbon->SkillProcSuccess[e]){ - newbon->SkillProcSuccess[e] = spell_id; + else if(!new_bonus->SkillProcSuccess[e]){ + new_bonus->SkillProcSuccess[e] = spell_id; break; } } From de3f9f72761ce157dab17c17c46425631aed17d9 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 21 Dec 2014 23:48:18 -0500 Subject: [PATCH 0673/1883] Fix missing {} in SE_*Counter bonus processing --- zone/spell_effects.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 56611024b..9fe45fbee 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1897,10 +1897,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (CalculatePoisonCounters(buffs[j].spellid) == 0) continue; if (effect_value >= static_cast(buffs[j].counters)) { - if (caster) + if (caster) { caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); CastOnCure(buffs[j].spellid); + } effect_value -= buffs[j].counters; buffs[j].counters = 0; BuffFadeBySlot(j); @@ -1930,10 +1931,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) continue; if (effect_value >= static_cast(buffs[j].counters)) { - if (caster) + if (caster) { caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); CastOnCure(buffs[j].spellid); + } effect_value -= buffs[j].counters; buffs[j].counters = 0; BuffFadeBySlot(j); @@ -1965,10 +1967,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) continue; if (effect_value >= static_cast(buffs[j].counters)) { - if (caster) + if (caster) { caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); CastOnCure(buffs[j].spellid); + } effect_value -= buffs[j].counters; buffs[j].counters = 0; BuffFadeBySlot(j); @@ -1999,10 +2002,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (CalculateCorruptionCounters(buffs[j].spellid) == 0) continue; if (effect_value >= static_cast(buffs[j].counters)) { - if (caster) + if (caster) { caster->Message(MT_Spells,"You have cured your target of %s!",spells[buffs[j].spellid].name); caster->CastOnCurer(buffs[j].spellid); CastOnCure(buffs[j].spellid); + } effect_value -= buffs[j].counters; buffs[j].counters = 0; BuffFadeBySlot(j); From a7cdb4c0af015fda856a858828e7a6592e070243 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 21 Dec 2014 23:53:02 -0500 Subject: [PATCH 0674/1883] Add a few missing bonus recalcs --- zone/spells.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/spells.cpp b/zone/spells.cpp index 0828d6388..a7ee31f2c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3896,6 +3896,8 @@ void Mob::BuffFadeDetrimental() { BuffFadeBySlot(j, false); } } + //we tell BuffFadeBySlot not to recalc, so we can do it only once when were done + CalcBonuses(); } void Mob::BuffFadeDetrimentalByCaster(Mob *caster) @@ -3916,6 +3918,8 @@ void Mob::BuffFadeDetrimentalByCaster(Mob *caster) } } } + //we tell BuffFadeBySlot not to recalc, so we can do it only once when were done + CalcBonuses(); } void Mob::BuffFadeBySitModifier() From b9fab9bc1b6a01f42112518f31910064ee606039 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 21 Dec 2014 23:00:06 -0600 Subject: [PATCH 0675/1883] (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone. --- changelog.txt | 1 + common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 01ddc4625..54ba7acdc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/21/2014 == Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. +Trevius: (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone. == 12/20/2014 == Akkadius: Updated #cvs to display RoF2 Client Stream count diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index ad6fb95d6..1884a8019 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2315,7 +2315,7 @@ namespace RoF outapp->WriteUInt8(emu->gm); outapp->WriteUInt32(emu->guild_id); - outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. + outapp->WriteUInt8(emu->guildrank); // guildrank outapp->WriteUInt32(0); // Unknown - observed 1 in a live packet. outapp->WriteUInt8(0); // Unknown - observed 1 in a live packet. outapp->WriteUInt32(0); // Unknown diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index a750d2abb..3198b587b 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2316,7 +2316,7 @@ namespace RoF2 outapp->WriteUInt8(emu->gm); outapp->WriteUInt32(emu->guild_id); - outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(emu->guildrank); // guildrank outapp->WriteUInt32(0); // Unknown outapp->WriteUInt8(0); // Unknown outapp->WriteUInt32(0); // Unknown From 18fb86a5607e3bc5e3c1cb38a5796f8eb15f54ec Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 22 Dec 2014 01:58:54 -0500 Subject: [PATCH 0676/1883] Force changing the timer_time for attack timers Should fix issues with waiting for a slow timer after a cure --- common/timer.cpp | 4 +++- common/timer.h | 2 +- zone/attack.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/timer.cpp b/common/timer.cpp index c1c94a7f6..d5a90a0f2 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -141,11 +141,13 @@ uint32 Timer::GetRemainingTime() { } } -void Timer::SetAtTrigger(uint32 in_set_at_trigger, bool iEnableIfDisabled) { +void Timer::SetAtTrigger(uint32 in_set_at_trigger, bool iEnableIfDisabled, bool ChangeTimerTime) { set_at_trigger = in_set_at_trigger; if (!Enabled() && iEnableIfDisabled) { Enable(); } + if (ChangeTimerTime) + timer_time = set_at_trigger; } void Timer::Trigger() diff --git a/common/timer.h b/common/timer.h index 1e3ab97e0..c4d89fe11 100644 --- a/common/timer.h +++ b/common/timer.h @@ -43,7 +43,7 @@ public: inline const uint32& GetTimerTime() { return timer_time; } inline const uint32& GetSetAtTrigger() { return set_at_trigger; } void Trigger(); - void SetAtTrigger(uint32 set_at_trigger, bool iEnableIfDisabled = false); + void SetAtTrigger(uint32 set_at_trigger, bool iEnableIfDisabled = false, bool ChangeTimerTime = false); inline bool Enabled() { return enabled; } inline uint32 GetStartTime() { return(start_time); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 2bd3a0247..5f4835395 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4932,7 +4932,7 @@ void Client::SetAttackTimer() // this is probably wrong if (quiver_haste > 0) speed *= quiver_haste; - TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); + TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true); if (i == MainPrimary) PrimaryWeapon = ItemToUse; @@ -4980,6 +4980,6 @@ void NPC::SetAttackTimer() } } - TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); + TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true); } } From a4febbb648d49912794b088c4f04c8c29155df22 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Mon, 22 Dec 2014 04:39:41 -0500 Subject: [PATCH 0677/1883] Modified #reloadworld. Example: #reloadworld 1 - repops globally and reloads quests globally. #reloadworld or #reloadworld 0 - reloads quests globally. --- zone/command.cpp | 17 +++++++---------- zone/zone.cpp | 5 ++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index d5d781e02..bb935b7e5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -247,7 +247,7 @@ int command_init(void) { command_add("reloadstatic","- Reload Static Zone Data",150,command_reloadstatic) || command_add("reloadquest"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || command_add("reloadqst"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || - command_add("reloadworld",nullptr,255,command_reloadworld) || + command_add("reloadworld","[0|1] - Clear quest cache (0 - no repop, 1 - repop)",255,command_reloadworld) || command_add("reloadlevelmods",nullptr,255,command_reloadlevelmods) || command_add("reloadzonepoints","- Reload zone points from database",150,command_reloadzps) || command_add("reloadzps",nullptr,0,command_reloadzps) || @@ -3096,15 +3096,12 @@ void command_reloadqst(Client *c, const Seperator *sep) void command_reloadworld(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0) - { - c->Message(0, "Reloading quest cache and repopping zones worldwide."); - ServerPacket* pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); - ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; - RW->Option = 1; - worldserver.SendPacket(pack); - safe_delete(pack); - } + c->Message(0, "Reloading quest cache and repopping zones worldwide."); + ServerPacket* pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); + ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; + RW->Option = ((atoi(sep->arg[1]) == 1) ? 1 : 0); + worldserver.SendPacket(pack); + safe_delete(pack); } void command_reloadlevelmods(Client *c, const Seperator *sep) diff --git a/zone/zone.cpp b/zone/zone.cpp index 49e7a7dee..13f480332 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2232,7 +2232,10 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) } void Zone::ReloadWorld(uint32 Option){ - if(Option == 1){ + if (Option == 0) { + entity_list.ClearAreas(); + parse->ReloadQuests(); + } else if(Option == 1) { zone->Repop(0); entity_list.ClearAreas(); parse->ReloadQuests(); From 62ae7ba1de6b24e12ad251fa397647440814b440 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 22 Dec 2014 13:42:22 -0500 Subject: [PATCH 0678/1883] Fix RoF2 rez response --- common/patches/rof2_structs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 6776ff0e7..b7fb2656e 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -2892,7 +2892,8 @@ struct Resurrect_Struct /*160*/ char corpse_name[64]; /*224*/ uint32 action; /*228*/ uint32 unknown228; -/*232*/ +/*232*/ uint32 unknown232; +/*236*/ }; struct SetRunMode_Struct { From ce3d513ca0f40892d6b0029399c339f291b9b28c Mon Sep 17 00:00:00 2001 From: akkadius Date: Mon, 22 Dec 2014 14:12:26 -0600 Subject: [PATCH 0679/1883] Script used to parse crashes in logs folder and give an ordered summary --- utils/scripts/parse_crashes.pl | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 utils/scripts/parse_crashes.pl diff --git a/utils/scripts/parse_crashes.pl b/utils/scripts/parse_crashes.pl new file mode 100644 index 000000000..667a19b81 --- /dev/null +++ b/utils/scripts/parse_crashes.pl @@ -0,0 +1,39 @@ +opendir my $dir, "logs" or die "Cannot open directory: $!"; +my @files = readdir $dir; +closedir $dir; +$inc = 0; +foreach my $val (@files){ + if($val=~/crash_zone/i){ + $stl = 0; + $crash[$inc] = ""; + my $file = "logs/" . $val; + open my $info, $file or die "Could not open $file: $!"; + while( my $line = <$info>) { + if($line=~/CRTStartup/i){ $stl = 0; } + @data = split(']', $line); + if($stl == 1){ $crash[$inc] .= $data[1]; } + if($line=~/dbghelp.dll/i){ $stl = 1; } + } + close $info; + $inc++; + } +} + +#::: Count Crash Occurrence first +$i = 0; +while($crash[$i]){ + $crash_count[length($crash[$i])]++; + $unique_crash[length($crash[$i])] = $crash[$i]; + $i++; +} + +$i = 0; +while($crash[$i]){ + if($unique_crash_tracker[length($crash[$i])] != 1){ + print "Crash Occurrence " . $crash_count[length($crash[$i])] . " Time(s) Length (" . length($crash[$i]) . ") \n\n"; + print $crash[$i] . "\n"; + print "=========================================\n"; + } + $unique_crash_tracker[length($crash[$i])] = 1; + $i++; +} \ No newline at end of file From 6e192b179406b7fb8d155c0745e51a8f1322172b Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 22 Dec 2014 16:09:11 -0600 Subject: [PATCH 0680/1883] (RoF2) Fixed Tracking. --- changelog.txt | 3 +++ common/eq_packet_structs.h | 8 ++++---- common/patches/rof.cpp | 4 ++-- common/patches/rof2.cpp | 7 ++++--- common/patches/rof2_structs.h | 29 ++++++++++++----------------- common/patches/rof_structs.h | 29 +++++++++++------------------ common/patches/sod.cpp | 4 ++-- common/patches/sof.cpp | 2 +- common/patches/sof_structs.h | 4 ++-- common/patches/titanium.cpp | 2 +- common/patches/titanium_structs.h | 4 ++-- common/patches/underfoot.cpp | 4 ++-- utils/patches/patch_RoF2.conf | 2 +- zone/entity.cpp | 12 ++++-------- 14 files changed, 51 insertions(+), 63 deletions(-) diff --git a/changelog.txt b/changelog.txt index 54ba7acdc..ec9d830c6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/22/2014 == +Trevius: (RoF2) Fixed Tracking. + == 12/21/2014 == Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. Trevius: (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone. diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index cec29178d..a0d9eb59a 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -3015,14 +3015,14 @@ struct ClientError_Struct }; struct Track_Struct { - uint16 entityid; - uint16 padding002; + uint32 entityid; float distance; // Fields for SoD and later uint8 level; - uint8 NPC; - uint8 GroupMember; + uint8 is_npc; char name[64]; + uint8 is_pet; + uint8 is_merc; }; struct Tracking_Struct { diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 1884a8019..71e462ba3 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3294,9 +3294,9 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->entityid); VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->distance); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_npc); VARSTRUCT_ENCODE_STRING(Buffer, emu->name); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->GroupMember); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_merc); } delete[] __emu_buffer; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 3198b587b..1d8c03cfc 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3289,7 +3289,7 @@ namespace RoF2 int PacketSize = 2; for (int i = 0; i < EntryCount; ++i, ++emu) - PacketSize += (12 + strlen(emu->name)); + PacketSize += (13 + strlen(emu->name)); emu = (Track_Struct *)__emu_buffer; @@ -3305,9 +3305,10 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->entityid); VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->distance); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_npc); VARSTRUCT_ENCODE_STRING(Buffer, emu->name); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->GroupMember); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_pet); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_merc); } delete[] __emu_buffer; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index b7fb2656e..dc2ff2336 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -3112,29 +3112,24 @@ struct MobHealth }; struct Track_Struct { - uint16 entityid; - uint16 y; - uint16 x; - uint16 z; + uint32 entityid; + float distance; + // Fields for SoD and later + uint8 level; + uint8 is_npc; + char name[64]; + uint8 is_pet; + uint8 is_merc; }; struct Tracking_Struct { + uint16 entry_count; Track_Struct Entrys[0]; }; -// Looks like new tracking structures - Opcode: 0x57a7 -struct Tracking_Struct_New { - uint16 totalcount; // Total Count of mobs within tracking range - Track_Struct Entrys[0]; -}; - -struct Track_Struct_New { - uint16 entityid; // Entity ID - uint16 unknown002; // 00 00 - uint32 unknown004; // - uint8 level; // level of mob - uint8 unknown009; // 01 maybe type of mob? player/npc? - char name[1]; // name of mob +struct TrackTarget_Struct +{ + uint32 EntityID; }; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index c84a670a9..787a4b786 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -3103,32 +3103,25 @@ struct MobHealth }; struct Track_Struct { - uint16 entityid; - uint16 y; - uint16 x; - uint16 z; + uint32 entityid; + float distance; + // Fields for SoD and later + uint8 level; + uint8 is_npc; + char name[64]; + uint8 is_merc; }; struct Tracking_Struct { + uint16 entry_count; Track_Struct Entrys[0]; }; -// Looks like new tracking structures - Opcode: 0x57a7 -struct Tracking_Struct_New { - uint16 totalcount; // Total Count of mobs within tracking range - Track_Struct Entrys[0]; +struct TrackTarget_Struct +{ + uint32 EntityID; }; -struct Track_Struct_New { - uint16 entityid; // Entity ID - uint16 unknown002; // 00 00 - uint32 unknown004; // - uint8 level; // level of mob - uint8 unknown009; // 01 maybe type of mob? player/npc? - char name[1]; // name of mob -}; - - /* ** ZoneServerInfo_Struct ** Zone server information diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 50d787472..e9c5430fb 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2058,9 +2058,9 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->entityid); VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->distance); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_npc); VARSTRUCT_ENCODE_STRING(Buffer, emu->name); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->GroupMember); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_merc); } delete[] __emu_buffer; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index f7d35d403..93114e7ab 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1645,7 +1645,7 @@ namespace SoF for (int i = 0; i < EntryCount; ++i, ++eq, ++emu) { OUT(entityid); - OUT(padding002); + //OUT(padding002); OUT(distance); } diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 385fd8b46..51f41a590 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -2624,8 +2624,8 @@ struct MobHealth }; struct Track_Struct { - uint16 entityid; - uint16 padding002; + uint32 entityid; + //uint16 padding002; float distance; }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 26ab0f531..f9ad6a4ff 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1094,7 +1094,7 @@ namespace Titanium for (int i = 0; i < EntryCount; ++i, ++eq, ++emu) { OUT(entityid); - OUT(padding002); + //OUT(padding002); OUT(distance); } diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index b9d299ab9..0b5b1ec25 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -2319,8 +2319,8 @@ struct MobHealth }; struct Track_Struct { - uint16 entityid; - uint16 padding002; + uint32 entityid; + //uint16 padding002; float distance; }; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 3ddfeafd0..0b9d527a6 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2348,9 +2348,9 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->entityid); VARSTRUCT_ENCODE_TYPE(float, Buffer, emu->distance); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->level); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->NPC); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_npc); VARSTRUCT_ENCODE_STRING(Buffer, emu->name); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->GroupMember); + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->is_merc); } delete[] __emu_buffer; diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 88ae7ab31..b2a4db698 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -249,7 +249,7 @@ OP_ItemLinkClick=0x4cef OP_ItemPreview=0x6b5c OP_NewSpawn=0x6097 OP_Track=0x17e5 -OP_TrackTarget=0x0029 +OP_TrackTarget=0x695e OP_TrackUnknown=0x4577 OP_ClickDoor=0x3a8f OP_MoveDoor=0x08e8 diff --git a/zone/entity.cpp b/zone/entity.cpp index b2951407b..293cfddef 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2957,8 +2957,6 @@ bool EntityList::MakeTrackPacket(Client *client) if (distance < 300) distance = 300; - Group *g = client->GetGroup(); - for (auto it = mob_list.cbegin(); it != mob_list.cend(); ++it) { if (!it->second || it->second == client || !it->second->IsTrackable() || it->second->IsInvisible(client)) @@ -2979,15 +2977,13 @@ bool EntityList::MakeTrackPacket(Client *client) int index = 0; for (auto it = tracking_list.cbegin(); it != tracking_list.cend(); ++it, ++index) { Mob *cur_entity = it->first; - outtrack->Entrys[index].entityid = cur_entity->GetID(); + outtrack->Entrys[index].entityid = (uint32)cur_entity->GetID(); outtrack->Entrys[index].distance = it->second; outtrack->Entrys[index].level = cur_entity->GetLevel(); - outtrack->Entrys[index].NPC = !cur_entity->IsClient(); - if (g && cur_entity->IsClient() && g->IsGroupMember(cur_entity->CastToMob())) - outtrack->Entrys[index].GroupMember = 1; - else - outtrack->Entrys[index].GroupMember = 0; + outtrack->Entrys[index].is_npc = !cur_entity->IsClient(); strn0cpy(outtrack->Entrys[index].name, cur_entity->GetName(), sizeof(outtrack->Entrys[index].name)); + outtrack->Entrys[index].is_pet = cur_entity->IsPet(); + outtrack->Entrys[index].is_merc = cur_entity->IsMerc(); } client->QueuePacket(outapp); From 36c1f50e1b37f1339025ead196c0aa5eb526f4e0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 22 Dec 2014 17:51:59 -0500 Subject: [PATCH 0681/1883] Use lambda expression for compare instead --- zone/entity.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 293cfddef..3bc191715 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2935,11 +2935,6 @@ void EntityList::SignalMobsByNPCID(uint32 snpc, int signal_id) } } -bool tracking_compare(const std::pair &a, const std::pair &b) -{ - return a.first->GetSpawnTimeStamp() > b.first->GetSpawnTimeStamp(); -} - bool EntityList::MakeTrackPacket(Client *client) { std::list > tracking_list; @@ -2969,7 +2964,10 @@ bool EntityList::MakeTrackPacket(Client *client) tracking_list.push_back(std::make_pair(it->second, MobDistance)); } - tracking_list.sort(tracking_compare); + tracking_list.sort( + [](const std::pair &a, const std::pair &b) { + return a.first->GetSpawnTimeStamp() > b.first->GetSpawnTimeStamp(); + }); EQApplicationPacket *outapp = new EQApplicationPacket(OP_Track, sizeof(Track_Struct) * tracking_list.size()); Tracking_Struct *outtrack = (Tracking_Struct *)outapp->pBuffer; outapp->priority = 6; From d454763cd139526c02358a716635769455fbd696 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 20 Dec 2014 01:52:58 -0600 Subject: [PATCH 0682/1883] RoF+ Cursor Buffer SummonItem Initial Test Change --- common/item.cpp | 5 +++++ common/item.h | 2 ++ zone/client.h | 1 + zone/client_packet.cpp | 4 ++-- zone/inventory.cpp | 50 +++++++++++++++++++++++++++++++++++------- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/common/item.cpp b/common/item.cpp index 1b99ad779..d066f74cb 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -259,6 +259,11 @@ int16 Inventory::PushCursor(const ItemInst& inst) return MainCursor; } +ItemInst* Inventory::PopCursor() +{ + return m_cursor.pop(); +} + // Swap items in inventory bool Inventory::SwapItem(int16 slot_a, int16 slot_b) { diff --git a/common/item.h b/common/item.h index b0aa06466..93ac21788 100644 --- a/common/item.h +++ b/common/item.h @@ -151,6 +151,8 @@ public: // Add item to cursor queue int16 PushCursor(const ItemInst& inst); + // Remove item from cursor queue + ItemInst* PopCursor(); // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); diff --git a/zone/client.h b/zone/client.h index be503fccc..ac668f32a 100644 --- a/zone/client.h +++ b/zone/client.h @@ -804,6 +804,7 @@ public: int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); + void SummonCursorBuffer(); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); bool SwapItem(MoveItem_Struct* move_in); void SwapItemResync(MoveItem_Struct* move_slots); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6d032fed2..cc767dc6a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9771,7 +9771,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } } - // Illegal bagslot useage checks. Currently, user only receives a message if this check is triggered. + // Illegal bagslot usage checks. Currently, user only receives a message if this check is triggered. bool mi_hack = false; if (mi->from_slot >= EmuConstants::GENERAL_BAGS_BEGIN && mi->from_slot <= EmuConstants::CURSOR_BAG_END) { @@ -9794,7 +9794,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } } - if (mi_hack) { Message(15, "Caution: Illegal use of inaccessable bag slots!"); } + if (mi_hack) { Message(15, "Caution: Illegal use of inaccessible bag slots!"); } if (!SwapItem(mi) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot)) { SwapItemResync(mi); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 343f6e337..1b681ccf6 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -678,6 +678,23 @@ int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { return INVALID_ID; } +void Client::SummonCursorBuffer() { + // Temporary work-around for the RoF+ Client Buffer + // Instead of letting the client move items around in cursor buffer, + // we can just delete an item from the buffer and summon it to the cursor. + if (GetClientVersion() > EQClientRoF) + { + if (!GetInv().CursorEmpty()) + { + const ItemInst* inst = GetInv().PopCursor(); + SummonItem(inst->GetID(), inst->GetCharges(), inst->GetAugmentItemID(0), + inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), + inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, + inst->GetOrnamentationIcon(), inst->GetOrnamentationIDFile(), inst->GetOrnamentHeroModel()); + } + } +} + // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) @@ -794,10 +811,6 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd } } -// Puts an item into the person's inventory -// Any items already there will be removed from user's inventory -// (Also saves changes back to the database: this may be optimized in the future) -// client_update: Sends packet to client bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { mlog(INVENTORY__SLOTS, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); @@ -811,6 +824,10 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) return database.SaveCursor(CharacterID(), s, e); } +// Puts an item into the person's inventory +// Any items already there will be removed from user's inventory +// (Also saves changes back to the database: this may be optimized in the future) +// client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { mlog(INVENTORY__SLOTS, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); @@ -1299,7 +1316,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // This could be expounded upon at some point to let the server know that // the client has moved a buffered cursor item onto the active cursor -U - if (move_in->from_slot == move_in->to_slot) { // Item summon, no further proccessing needed + if (move_in->from_slot == move_in->to_slot) { // Item summon, no further processing needed if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit return true; } @@ -1315,13 +1332,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } DeleteItemInInventory(move_in->from_slot); + SummonCursorBuffer(); + return true; // Item destroyed by client } else { mlog(INVENTORY__SLOTS, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); - return true; // Item deletetion + return true; // Item deletion } } if(auto_attack && (move_in->from_slot == MainPrimary || move_in->from_slot == MainSecondary || move_in->from_slot == MainRange)) @@ -1363,7 +1382,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) { - Message(13,"Error: Insufficent number in stack."); + Message(13,"Error: Insufficient number in stack."); return false; } } @@ -1521,7 +1540,11 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { safe_delete(world_inst); if (src_slot_id == MainCursor) { - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + if (dstitemid == 0) + { + SummonCursorBuffer(); + } database.SaveCursor(character_id, s, e); } else database.SaveInventory(character_id, m_inv[src_slot_id], src_slot_id); @@ -1551,6 +1574,10 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit trade->AddEntity(dst_slot_id, move_in->number_in_stack); + if (dstitemid == 0) + { + SummonCursorBuffer(); + } return true; } else { @@ -1563,6 +1590,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } + bool all_to_stack = false; // Step 5: Swap (or stack) items if (move_in->number_in_stack > 0) { // Determine if charged items can stack @@ -1593,6 +1621,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { mlog(INVENTORY__SLOTS, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); + all_to_stack = true; } else { mlog(INVENTORY__SLOTS, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } @@ -1666,6 +1695,11 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Step 7: Save change to the database if (src_slot_id == MainCursor){ + // If not swapping another item to cursor and stacking items were depleted + if (dstitemid == 0 || all_to_stack == true) + { + SummonCursorBuffer(); + } std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); database.SaveCursor(character_id, s, e); } else From cba68645a8a9956d631e1fe7aa6a113432eacfcb Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 21 Dec 2014 12:14:37 -0600 Subject: [PATCH 0683/1883] More work on RoF+ Cursor Buffer. --- zone/inventory.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 1b681ccf6..c0ef3d6cb 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -682,7 +682,7 @@ void Client::SummonCursorBuffer() { // Temporary work-around for the RoF+ Client Buffer // Instead of letting the client move items around in cursor buffer, // we can just delete an item from the buffer and summon it to the cursor. - if (GetClientVersion() > EQClientRoF) + if (GetClientVersion() >= EQClientRoF) { if (!GetInv().CursorEmpty()) { @@ -1539,15 +1539,19 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } safe_delete(world_inst); - if (src_slot_id == MainCursor) { - std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + if (src_slot_id == MainCursor) + { if (dstitemid == 0) { SummonCursorBuffer(); } + std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); - } else + } + else + { database.SaveInventory(character_id, m_inv[src_slot_id], src_slot_id); + } if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in, true); } // QS Audit From ed257b0ef37bd8d8e0f806cec4a23bdacdcfef10 Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 22 Dec 2014 20:51:56 -0600 Subject: [PATCH 0684/1883] (RoF+) Added a work-around for the cursor buffer issue. --- changelog.txt | 1 + common/item.cpp | 15 +++++++++++++-- common/item.h | 6 ++++-- zone/client.h | 2 +- zone/inventory.cpp | 25 +++++++++++++------------ 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/changelog.txt b/changelog.txt index ec9d830c6..d7ce432cb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/22/2014 == Trevius: (RoF2) Fixed Tracking. +Trevius: (RoF+) Added a work-around for the cursor buffer issue. == 12/21/2014 == Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. diff --git a/common/item.cpp b/common/item.cpp index d066f74cb..583cfdcb4 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -89,6 +89,17 @@ ItemInst* ItemInstQueue::pop() return inst; } +// Remove item from back of queue +ItemInst* ItemInstQueue::pop_back() +{ + if (m_list.size() == 0) + return nullptr; + + ItemInst* inst = m_list.back(); + m_list.pop_back(); + return inst; +} + // Look at item at front of queue ItemInst* ItemInstQueue::peek_front() const { @@ -259,9 +270,9 @@ int16 Inventory::PushCursor(const ItemInst& inst) return MainCursor; } -ItemInst* Inventory::PopCursor() +ItemInst* Inventory::GetCursorItem() { - return m_cursor.pop(); + return m_cursor.peek_front(); } // Swap items in inventory diff --git a/common/item.h b/common/item.h index 93ac21788..03182e4dd 100644 --- a/common/item.h +++ b/common/item.h @@ -93,6 +93,7 @@ public: void push(ItemInst* inst); void push_front(ItemInst* inst); ItemInst* pop(); + ItemInst* pop_back(); ItemInst* peek_front() const; inline int size() { return static_cast(m_list.size()); } @@ -151,8 +152,9 @@ public: // Add item to cursor queue int16 PushCursor(const ItemInst& inst); - // Remove item from cursor queue - ItemInst* PopCursor(); + + // Get cursor item in front of queue + ItemInst* GetCursorItem(); // Swap items in inventory bool SwapItem(int16 slot_a, int16 slot_b); diff --git a/zone/client.h b/zone/client.h index ac668f32a..b9a2c6d30 100644 --- a/zone/client.h +++ b/zone/client.h @@ -804,7 +804,7 @@ public: int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); - void SummonCursorBuffer(); + void SendCursorBuffer(); void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); bool SwapItem(MoveItem_Struct* move_in); void SwapItemResync(MoveItem_Struct* move_slots); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index c0ef3d6cb..3afb2806b 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -617,6 +617,7 @@ void Client::DropItem(int16 slot_id) // Save client inventory change to database if (slot_id == MainCursor) { + SendCursorBuffer(); std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); database.SaveCursor(CharacterID(), s, e); } else { @@ -678,19 +679,19 @@ int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { return INVALID_ID; } -void Client::SummonCursorBuffer() { +void Client::SendCursorBuffer() { // Temporary work-around for the RoF+ Client Buffer - // Instead of letting the client move items around in cursor buffer, - // we can just delete an item from the buffer and summon it to the cursor. + // Instead of dealing with client moving items in cursor buffer, + // we can just send the next item in the cursor buffer to the cursor. if (GetClientVersion() >= EQClientRoF) { if (!GetInv().CursorEmpty()) { - const ItemInst* inst = GetInv().PopCursor(); - SummonItem(inst->GetID(), inst->GetCharges(), inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), inst->GetAugmentItemID(5), inst->IsAttuned(), MainCursor, - inst->GetOrnamentationIcon(), inst->GetOrnamentationIDFile(), inst->GetOrnamentHeroModel()); + const ItemInst* inst = GetInv().GetCursorItem(); + if (inst) + { + SendItemPacket(MainCursor, inst, ItemPacketSummonItem); + } } } } @@ -1332,7 +1333,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } DeleteItemInInventory(move_in->from_slot); - SummonCursorBuffer(); + SendCursorBuffer(); return true; // Item destroyed by client } @@ -1543,7 +1544,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { { if (dstitemid == 0) { - SummonCursorBuffer(); + SendCursorBuffer(); } std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); @@ -1580,7 +1581,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { trade->AddEntity(dst_slot_id, move_in->number_in_stack); if (dstitemid == 0) { - SummonCursorBuffer(); + SendCursorBuffer(); } return true; @@ -1702,7 +1703,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // If not swapping another item to cursor and stacking items were depleted if (dstitemid == 0 || all_to_stack == true) { - SummonCursorBuffer(); + SendCursorBuffer(); } std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); database.SaveCursor(character_id, s, e); From 34ab3e10f53cda9e944adcfdecb3794afb95078c Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 23 Dec 2014 10:14:45 -0500 Subject: [PATCH 0685/1883] Added some nullptr checks for ItemInst* in a few places (tradeskills.cpp - particularly augments - needs a better review) --- changelog.txt | 3 +++ common/item.cpp | 18 ++++++++------ common/shareddb.cpp | 29 +++++++++++++++++++++- zone/attack.cpp | 1 + zone/client_packet.cpp | 42 +++++++++++++++++++------------- zone/embparser.cpp | 10 ++++++++ zone/forage.cpp | 2 +- zone/inventory.cpp | 8 +++--- zone/lua_parser.cpp | 5 ++++ zone/quest_parser_collection.cpp | 5 ++++ zone/questmgr.cpp | 4 ++- zone/spells.cpp | 35 +++++++++++++++----------- zone/tradeskills.cpp | 4 ++- zone/trading.cpp | 3 +++ 14 files changed, 123 insertions(+), 46 deletions(-) diff --git a/changelog.txt b/changelog.txt index d7ce432cb..3f98e6c37 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/23/2014 == +Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. + == 12/22/2014 == Trevius: (RoF2) Fixed Tracking. Trevius: (RoF+) Added a work-around for the cursor buffer issue. diff --git a/common/item.cpp b/common/item.cpp index 583cfdcb4..e5a788879 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1186,13 +1186,13 @@ int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, ui for (itb = inst->_begin(); itb != inst->_end(); ++itb) { ItemInst* baginst = itb->second; - if (baginst->GetID() == item_id) { + if (baginst && baginst->GetID() == item_id) { quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); if (quantity_found >= quantity) return Inventory::CalcSlotId(it->first, itb->first); } for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst && baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; // Only one augment per slot. } } @@ -1230,13 +1230,13 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) for (itb = inst->_begin(); itb != inst->_end(); ++itb) { ItemInst* baginst = itb->second; - if (baginst->GetID() == item_id) { + if (baginst && baginst->GetID() == item_id) { quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); if (quantity_found >= quantity) return Inventory::CalcSlotId(MainCursor, itb->first); } for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (baginst->GetAugmentItemID(i) == item_id && quantity <= 1) + if (baginst && baginst->GetAugmentItemID(i) == item_id && quantity <= 1) return legacy::SLOT_AUGMENT; // Only one augment per slot. } @@ -1330,7 +1330,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 if (inst->GetItem()->LoreGroup == loregroup) return it->first; - ItemInst* Aug; + ItemInst* Aug = nullptr; for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { Aug = inst->GetAugment(i); if (Aug && Aug->GetItem()->LoreGroup == loregroup) @@ -1345,7 +1345,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->LoreGroup == loregroup) return Inventory::CalcSlotId(it->first, itb->first); - ItemInst* Aug2; + ItemInst* Aug2 = nullptr; for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { Aug2 = baginst->GetAugment(i); if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup) @@ -1373,7 +1373,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) if (inst->GetItem()->LoreGroup == loregroup) return MainCursor; - ItemInst* Aug; + ItemInst* Aug = nullptr; for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { Aug = inst->GetAugment(i); if (Aug && Aug->GetItem()->LoreGroup == loregroup) @@ -1389,7 +1389,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) return Inventory::CalcSlotId(MainCursor, itb->first); - ItemInst* Aug2; + ItemInst* Aug2 = nullptr; for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { Aug2 = baginst->GetAugment(i); if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup) @@ -1719,6 +1719,8 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) end = m_contents.end(); for (; cur != end;) { ItemInst* inst = cur->second; + if (inst == nullptr) + continue; const Item_Struct* item = inst->GetItem(); del = cur; ++cur; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 7dff17b43..07eb5e84b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -177,6 +177,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s } bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { + // need to check 'inst' argument for valid pointer uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; if (inst->IsType(ItemClassCommon)) @@ -221,6 +222,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) { + // need to check 'inst' argument for valid pointer uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; if (inst->IsType(ItemClassCommon)) @@ -430,7 +432,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { int16 put_slot_id = INVALID_INDEX; ItemInst* inst = CreateBaseItem(item, charges); - if (item->ItemClass == ItemClassCommon) { + if (inst && item->ItemClass == ItemClassCommon) { for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { if (aug[i]) { inst->PutAugment(this, i, aug[i]); @@ -527,6 +529,9 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { ItemInst* inst = CreateBaseItem(item, charges); + if (inst == nullptr) + continue; + if(row[11]) { std::string data_str(row[11]); std::string idAsString; @@ -637,6 +642,10 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) continue; ItemInst* inst = CreateBaseItem(item, charges); + + if (inst == nullptr) + continue; + inst->SetAttuned(instnodrop); if(row[11]) { @@ -1195,9 +1204,16 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, { const Item_Struct* item = nullptr; ItemInst* inst = nullptr; + item = GetItem(item_id); if (item) { inst = CreateBaseItem(item, charges); + + if (inst == nullptr) { + LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + return nullptr; + } + inst->PutAugment(this, 0, aug1); inst->PutAugment(this, 1, aug2); inst->PutAugment(this, 2, aug3); @@ -1217,6 +1233,12 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin ItemInst* inst = nullptr; if (item) { inst = CreateBaseItem(item, charges); + + if (inst == nullptr) { + LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + return nullptr; + } + inst->PutAugment(this, 0, aug1); inst->PutAugment(this, 1, aug2); inst->PutAugment(this, 2, aug3); @@ -1242,6 +1264,11 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); + if (inst == nullptr) { + LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + return nullptr; + } + if(item->CharmFileID != 0 || (item->LoreGroup >= 1000 && item->LoreGroup != -1)) { inst->Initialize(this); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 5f4835395..deb0daf61 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3890,6 +3890,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h return ProcChance; } +// argument 'weapon' not used void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cc767dc6a..a6830d74b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3087,7 +3087,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) // Adding augment if (in_augment->augment_action == 0) { - ItemInst *tobe_auged, *auged_with = nullptr; + ItemInst *tobe_auged = nullptr, *auged_with = nullptr; int8 slot = -1; Inventory& user_inv = GetInv(); @@ -3157,7 +3157,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) } else if (in_augment->augment_action == 1) { - ItemInst *tobe_auged, *auged_with = nullptr; + ItemInst *tobe_auged = nullptr, *auged_with = nullptr; int8 slot = -1; Inventory& user_inv = GetInv(); @@ -12330,22 +12330,30 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) int freeslot = 0; if (charges > 0 && (freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(), itemid, charges, true)) > 0){ ItemInst* inst2 = inst->Clone(); - if (RuleB(Merchant, UsePriceMod)){ - inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(vendor, false)); + + while (true) { + if (inst2 == nullptr) + break; + + if (RuleB(Merchant, UsePriceMod)){ + inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate*Client::CalcPriceMod(vendor, false)); + } + else + inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate); + inst2->SetMerchantSlot(freeslot); + + uint32 MerchantQuantity = zone->GetTempMerchantQuantity(vendor->GetNPCTypeID(), freeslot); + + if (inst2->IsStackable()) { + inst2->SetCharges(MerchantQuantity); + } + inst2->SetMerchantCount(MerchantQuantity); + + SendItemPacket(freeslot - 1, inst2, ItemPacketMerchant); + safe_delete(inst2); + + break; } - else - inst2->SetPrice(item->Price*(RuleR(Merchant, SellCostMod))*item->SellRate); - inst2->SetMerchantSlot(freeslot); - - uint32 MerchantQuantity = zone->GetTempMerchantQuantity(vendor->GetNPCTypeID(), freeslot); - - if (inst2->IsStackable()) { - inst2->SetCharges(MerchantQuantity); - } - inst2->SetMerchantCount(MerchantQuantity); - - SendItemPacket(freeslot - 1, inst2, ItemPacketMerchant); - safe_delete(inst2); } // start QS code diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 3a27fc42f..bfac13660 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -232,6 +232,7 @@ int PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::stri int PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { + // needs pointer validation on 'item' argument return EventCommon(evt, item->GetID(), nullptr, nullptr, item, client, extra_data, false, extra_pointers); } @@ -335,6 +336,9 @@ bool PerlembParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { if(!perl) return false; + if (itm == nullptr) + return false; + if(evt >= _LargestEventID) return false; @@ -449,6 +453,9 @@ void PerlembParser::LoadGlobalPlayerScript(std::string filename) { } void PerlembParser::LoadItemScript(std::string filename, ItemInst *item) { + if (item == nullptr) + return; + std::stringstream package_name; package_name << "qst_item_" << item->GetID(); @@ -855,6 +862,7 @@ void PerlembParser::GetQuestPackageName(bool &isPlayerQuest, bool &isGlobalPlaye } } else if(isItemQuest) { + // need a valid ItemInst pointer check here..unsure how to cancel this process -U const Item_Struct* item = iteminst->GetItem(); package_name = "qst_item_"; package_name += itoa(item->ID); @@ -1292,6 +1300,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID case EVENT_SCALE_CALC: case EVENT_ITEM_ENTER_ZONE: { + // need a valid ItemInst pointer check here..unsure how to cancel this process -U ExportVar(package_name.c_str(), "itemid", objid); ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); break; @@ -1299,6 +1308,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID case EVENT_ITEM_CLICK_CAST: case EVENT_ITEM_CLICK: { + // need a valid ItemInst pointer check here..unsure how to cancel this process -U ExportVar(package_name.c_str(), "itemid", objid); ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name); ExportVar(package_name.c_str(), "slotid", extradata); diff --git a/zone/forage.cpp b/zone/forage.cpp index 7e2f7d457..8476ceaad 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -249,7 +249,7 @@ void Client::GoFish() Bait = m_inv.GetItem(bslot); //if the bait isnt equipped, need to add its skill bonus - if(bslot >= EmuConstants::GENERAL_BEGIN && Bait->GetItem()->SkillModType == SkillFishing) { + if(bslot >= EmuConstants::GENERAL_BEGIN && Bait != nullptr && Bait->GetItem()->SkillModType == SkillFishing) { fishing_skill += Bait->GetItem()->SkillModValue; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 3afb2806b..e6f4b00b6 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2007,7 +2007,7 @@ void Client::DyeArmor(DyeStruct* dye){ bool Client::DecreaseByID(uint32 type, uint8 amt) { const Item_Struct* TempItem = 0; - ItemInst* ins; + ItemInst* ins = nullptr; int x; int num = 0; for(x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::GENERAL_BAGS_END; x++) @@ -2143,6 +2143,7 @@ void Client::RemoveNoRent(bool client_update) { std::list::iterator iter = local.begin(); while (iter != local.end()) { inst = *iter; + // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else @@ -2268,6 +2269,7 @@ void Client::RemoveDuplicateLore(bool client_update) { std::list::iterator iter = local.begin(); while (iter != local.end()) { inst = *iter; + // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); @@ -2470,8 +2472,8 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { _log(INVENTORY__BANDOLIER, "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; - const Item_Struct *BaseItem; + const ItemInst* InvItem = nullptr; + const Item_Struct *BaseItem = nullptr; int16 WeaponSlot; for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) { diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index b05e7619f..1b1bfb8e8 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -695,6 +695,9 @@ bool LuaParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { } bool LuaParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { + if (itm == nullptr) { + return false; + } evt = ConvertLuaEvent(evt); if(evt >= _LargestEventID) { return false; @@ -738,6 +741,8 @@ void LuaParser::LoadGlobalPlayerScript(std::string filename) { } void LuaParser::LoadItemScript(std::string filename, ItemInst *item) { + if (item == nullptr) + return; std::string package_name = "item_"; package_name += std::to_string(static_cast(item->GetID())); diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index c0680b43f..d3bde0d5b 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -200,6 +200,9 @@ bool QuestParserCollection::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) } bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { + if (itm == nullptr) + return false; + std::string item_script; if(itm->GetItem()->ScriptFileID != 0) { item_script = "script_"; @@ -350,6 +353,8 @@ int QuestParserCollection::EventPlayerGlobal(QuestEventID evt, Client *client, s int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *mob, std::string data, uint32 extra_data, std::vector *extra_pointers) { + // needs pointer validation check on 'item' argument + std::string item_script; if(item->GetItem()->ScriptFileID != 0) { item_script = "script_"; diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index ab68f8361..eb901d92d 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1229,6 +1229,8 @@ void QuestManager::itemlink(int item_id) { if (initiator) { const ItemInst* inst = database.CreateItem(item_id); char* link = 0; + if (inst == nullptr) + return; if (initiator->MakeItemLink(link, inst)) initiator->Message(0, "%s tells you, %c%s%s%c", owner->GetCleanName(), 0x12, link, inst->GetItem()->Name, 0x12); @@ -2336,7 +2338,7 @@ int QuestManager::collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove) { QuestManagerCurrentQuestVars(); - ItemInst *item; + ItemInst *item = nullptr; int quantity = 0; item = initiator->GetInv().GetItem(slot_id); diff --git a/zone/spells.cpp b/zone/spells.cpp index a7ee31f2c..02e99490d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1195,22 +1195,29 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint32 recastdelay = 0; uint32 recasttype = 0; - for (int r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) { - const ItemInst* aug_i = inst->GetAugment(r); - - if(!aug_i) - continue; - const Item_Struct* aug = aug_i->GetItem(); - if(!aug) - continue; - - if ( aug->Click.Effect == spell_id ) - { - recastdelay = aug_i->GetItem()->RecastDelay; - recasttype = aug_i->GetItem()->RecastType; - fromaug = true; + while (true) { + if (inst == nullptr) break; + + for (int r = AUG_BEGIN; r < EmuConstants::ITEM_COMMON_SIZE; r++) { + const ItemInst* aug_i = inst->GetAugment(r); + + if (!aug_i) + continue; + const Item_Struct* aug = aug_i->GetItem(); + if (!aug) + continue; + + if (aug->Click.Effect == spell_id) + { + recastdelay = aug_i->GetItem()->RecastDelay; + recasttype = aug_i->GetItem()->RecastType; + fromaug = true; + break; + } } + + break; } //Test the aug recast delay diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index f6112b560..453a8474b 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -94,7 +94,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme return; } - ItemInst *tobe_auged, *auged_with = nullptr; + ItemInst *tobe_auged = nullptr, *auged_with = nullptr; int8 slot=-1; // Verify 2 items in the augmentation device @@ -1185,6 +1185,8 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec) { + if (container == nullptr) + return false; std::string containers;// make where clause segment for container(s) if (some_id == 0) diff --git a/zone/trading.cpp b/zone/trading.cpp index b9b582bfe..7d66adb30 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -159,6 +159,9 @@ Mob* Trade::With() // Private Method: Send item data for trade item to other person involved in trade void Trade::SendItemData(const ItemInst* inst, int16 dest_slot_id) { + if (inst == nullptr) + return; + // @merth: This needs to be redone with new item classes Mob* mob = With(); if (!mob->IsClient()) From cdd624e7a841bed973352516d07b26edb600efd7 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 23 Dec 2014 10:22:03 -0500 Subject: [PATCH 0686/1883] Hack fix for zone shutdown crashes involving HateList::GetTop() --- zone/hate_list.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index c8c1308aa..55def09fb 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -279,6 +279,10 @@ int HateList::SummonedPetCount(Mob *hater) { Mob *HateList::GetTop(Mob *center) { + // hack fix for zone shutdown crashes on some servers + if (!zone->IsLoaded()) + return nullptr; + Mob* top = nullptr; int32 hate = -1; From c10bccebdb6775cb749f5f11e56776da3c416d82 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Tue, 23 Dec 2014 22:10:35 -0500 Subject: [PATCH 0687/1883] Two bot crash fixes (#bot bardoutofcombat and #bot setinspectmessage). --- zone/bot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index ef40e1bcb..99bf4a488 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -15474,7 +15474,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { else { Mob *target = c->GetTarget(); - if(target->IsBot() && (c == target->GetOwner()->CastToClient())) { + if(target && target->IsBot() && (c == target->GetOwner()->CastToClient())) { const InspectMessage_Struct& playermessage = c->GetInspectMessage(); InspectMessage_Struct& botmessage = target->CastToBot()->GetInspectMessage(); @@ -15504,7 +15504,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { Mob *target = c->GetTarget(); - if(target->IsBot() && (c == target->GetOwner()->CastToClient())) { + if(target && target->IsBot() && (c == target->GetOwner()->CastToClient())) { Bot* bardBot = target->CastToBot(); if(bardBot) { From 7742892377ba3a3370b34381e5b0cfedd462fe1c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 23 Dec 2014 22:26:22 -0500 Subject: [PATCH 0688/1883] Fix issue with Mob::MakeNewPositionAndSendUpdate --- zone/waypoints.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index e2604a3af..889848723 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -694,7 +694,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b { Map::Vertex dest(x_pos, y_pos, z_pos); - float newz = zone->zonemap->FindBestZ(dest, nullptr); + 2.0f; + float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); From a0c99647fa22c63cc13d5d9595b7137503e44afe Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 23 Dec 2014 23:01:59 -0500 Subject: [PATCH 0689/1883] Added item information to logfile writes for failed ItemInst creations --- common/shareddb.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 07eb5e84b..4e67487c6 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1211,6 +1211,7 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, if (inst == nullptr) { LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1236,6 +1237,7 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin if (inst == nullptr) { LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1266,6 +1268,7 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) if (inst == nullptr) { LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } From 27fe90d02dde34496643c81fde600ef128074937 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 23 Dec 2014 12:10:54 -0600 Subject: [PATCH 0690/1883] (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc. --- common/patches/rof2.cpp | 7 ++++ common/patches/rof2_structs.h | 65 ++++++----------------------------- zone/client_packet.cpp | 11 +----- zone/mob.cpp | 5 ++- 4 files changed, 23 insertions(+), 65 deletions(-) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 1d8c03cfc..355a23383 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1676,8 +1676,15 @@ namespace RoF2 eq->FogDensity = emu->fog_density; /*fill in some unknowns with observed values, hopefully it will help */ + eq->unknown569 = 0; + eq->unknown571 = 0; + eq->unknown572 = 4; + eq->unknown576 = 2; + eq->unknown580 = 0; + eq->unknown800 = -1; eq->unknown844 = 600; + eq->unknown848 = 2008; // Guild Lobby observed value eq->unknown880 = 50; eq->unknown884 = 10; eq->unknown888 = 1; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index dc2ff2336..f7a2844b1 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -243,11 +243,11 @@ struct Membership_Setting_Struct struct Membership_Details_Struct { /*0000*/ uint32 membership_setting_count; // Seen 66 -/*0016*/ Membership_Setting_Struct settings[66]; +/*0016*/ Membership_Setting_Struct settings[66]; // 792 Bytes /*0012*/ uint32 race_entry_count; // Seen 15 -/*1044*/ Membership_Entry_Struct membership_races[15]; +/*1044*/ Membership_Entry_Struct membership_races[15]; // 120 Bytes /*0012*/ uint32 class_entry_count; // Seen 15 -/*1044*/ Membership_Entry_Struct membership_classes[15]; +/*1044*/ Membership_Entry_Struct membership_classes[15]; // 120 Bytes /*1044*/ uint32 exit_url_length; // Length of the exit_url string (0 for none) /*1048*/ //char exit_url[42]; // Upgrade to Silver or Gold Membership URL /*1048*/ uint32 exit_url_length2; // Length of the exit_url2 string (0 for none) @@ -537,9 +537,13 @@ struct NewZone_Struct { /*0525*/ uint8 rain_duration[4]; /*0529*/ uint8 snow_chance[4]; /*0533*/ uint8 snow_duration[4]; - /*0537*/ uint8 unknown537[33]; + /*0537*/ uint8 unknown537[32]; // Seen all 0xff + /*0569*/ uint8 unknown569; // Unknown - Seen 0 /*0570*/ uint8 sky; // Sky Type - /*0571*/ uint8 unknown571[13]; // ***Placeholder + /*0571*/ uint8 unknown571; // Unknown - Seen 0 + /*0572*/ uint32 unknown572; // Unknown - Seen 4 in Guild Lobby + /*0576*/ uint32 unknown576; // Unknown - Seen 2 in Guild Lobby + /*0580*/ uint32 unknown580; // Unknown - Seen 0 in Guild Lobby /*0584*/ float zone_exp_multiplier; // Experience Multiplier /*0588*/ float safe_y; // Zone Safe Y /*0592*/ float safe_x; // Zone Safe X @@ -554,7 +558,7 @@ struct NewZone_Struct { /*0800*/ int32 unknown800; //seen -1 /*0804*/ char unknown804[40]; // /*0844*/ int32 unknown844; //seen 600 - /*0848*/ int32 unknown848; + /*0848*/ int32 unknown848; //seen 2008 /*0852*/ uint16 zone_id; /*0854*/ uint16 zone_instance; /*0856*/ char unknown856[20]; @@ -581,7 +585,7 @@ struct NewZone_Struct { /*0932*/ int32 unknown932; // Seen -1 /*0936*/ int32 unknown936; // Seen -1 /*0940*/ uint32 unknown940; // Seen 0 - /*0944*/ float unknown944; // Seen 1.0 + /*0944*/ float unknown944; // Seen 1.0 in PoK, and 0.25 in Guild Lobby /*0948*/ uint32 unknown948; // Seen 0 - New on Live as of Dec 15 2014 /*0952*/ uint32 unknown952; // Seen 100 - New on Live as of Dec 15 2014 /*0956*/ @@ -1219,64 +1223,17 @@ union /* ///////////////////// - Haven't identified the below fields in the PP yet -uint8 pvp; // 1=pvp, 0=not pvp uint8 anon; // 2=roleplay, 1=anon, 0=not anon -uint8 gm; // 0=no, 1=yes (guessing!) -uint32 guild_id; // guildid -uint8 guildrank; // 0=member, 1=officer, 2=guildleader -1=no guild -uint32 guildbanker; uint32 available_slots; -uint32 endurance; // Current endurance uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; // Refresh time (millis) - 4 bytes Each * 16 = 64 bytes uint32 abilitySlotRefresh; /////////////////////// -uint32 platinum_bank; // Platinum Pieces in Bank -uint32 gold_bank; // Gold Pieces in Bank -uint32 silver_bank; // Silver Pieces in Bank -uint32 copper_bank; // Copper Pieces in Bank uint32 platinum_shared; // Shared platinum pieces - uint32 autosplit; // 0 = off, 1 = on - char groupMembers[MAX_GROUP_MEMBERS][64];// 384 all the members in group, including self char groupLeader[64]; // Leader of the group ? uint32 entityid; - -uint32 leadAAActive; // 0 = leader AA off, 1 = leader AA on -int32 ldon_points_guk; // Earned GUK points -int32 ldon_points_mir; // Earned MIR points -int32 ldon_points_mmc; // Earned MMC points -int32 ldon_points_ruj; // Earned RUJ points -int32 ldon_points_tak; // Earned TAK points -int32 ldon_points_available;// Available LDON points -float tribute_time_remaining;// Time remaining on tribute (millisecs) -uint32 career_tribute_points;// Total favor points for this char -uint32 tribute_points; // Current tribute points -uint32 tribute_active; // 0 = off, 1=on -Tribute_Struct tributes[MAX_PLAYER_TRIBUTES]; // [40] Current tribute loadout -double group_leadership_exp; // Current group lead exp points -double raid_leadership_exp; // Current raid lead AA exp points -uint32 group_leadership_points; // Unspent group lead AA points -uint32 raid_leadership_points; // Unspent raid lead AA points -LeadershipAA_Struct leader_abilities; // [128]Leader AA ranks 19332 - -uint32 PVPKills; -uint32 PVPDeaths; -uint32 PVPCurrentPoints; -uint32 PVPCareerPoints; -uint32 PVPBestKillStreak; -uint32 PVPWorstDeathStreak; -uint32 PVPCurrentKillStreak; -PVPStatsEntry_Struct PVPLastKill; // size 88 -PVPStatsEntry_Struct PVPLastDeath; // size 88 -uint32 PVPNumberOfKillsInLast24Hours; -PVPStatsEntry_Struct PVPRecentKills[50]; // size 4400 - 88 each -uint32 expAA; // Exp earned in current AA point -uint32 currentRadCrystals; // Current count of radiant crystals -uint32 careerRadCrystals; // Total count of radiant crystals ever -uint32 currentEbonCrystals; // Current count of ebon crystals -uint32 careerEbonCrystals; // Total count of ebon crystals ever */ }; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cc767dc6a..3778c0dcb 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6978,37 +6978,28 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!CursorItem->NoDrop || CursorItemInst->IsAttuned()) { - Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - Allowed = false; } else if (CursorItemInst->IsNoneEmptyContainer()) { - Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - Allowed = false; } else if (CursorItemInst->IsAugmented()) { - Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - Allowed = false; } else if (CursorItem->NoRent == 0) { - Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - Allowed = false; } else if (CursorItem->LoreFlag && GuildBanks->HasItem(GuildID(), CursorItem->ID)) { - Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - Allowed = false; } if (!Allowed) { + Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); GuildBankDepositAck(true); return; diff --git a/zone/mob.cpp b/zone/mob.cpp index d031564dd..2f66cf51d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2768,7 +2768,10 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const } } - if (HeroModel > 0) + // Auto-Convert Hero Model to match the slot + // Otherwise, use the exact Model if model is > 999 + // Robes for example are 11607 to 12107 in RoF + if (HeroModel > 0 && HeroModel < 1000) { HeroModel *= 100; HeroModel += material_slot; From a0972e7564434e730c636d54bad7c160876d4749 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 23 Dec 2014 23:15:05 -0600 Subject: [PATCH 0691/1883] Updated changelog.txt --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 3f98e6c37..0a85c5259 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/23/2014 == Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. +Trevius: (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc. == 12/22/2014 == Trevius: (RoF2) Fixed Tracking. From 3bb816ad1dd44042046392f152648a9fc4235be7 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 23 Dec 2014 23:18:59 -0600 Subject: [PATCH 0692/1883] Clean up of RoF+ Item Packets. --- common/patches/rof.cpp | 25 ++----------------------- common/patches/rof2.cpp | 27 +++------------------------ common/patches/rof2_structs.h | 4 +--- common/patches/rof_structs.h | 4 +--- 4 files changed, 7 insertions(+), 53 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 71e462ba3..148c9662b 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4854,27 +4854,8 @@ namespace RoF ss.write((const char*)&evotop, sizeof(RoF::structs::EvolvingItem)); } //ORNAMENT IDFILE / ICON - uint16 ornaIcon = 0; - int32 heroModel = 0; - /* - if (inst->GetOrnamentationAug(ornamentationAugtype)) - { - const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - //Mainhand - ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); - ss.write((const char*)&null_term, sizeof(uint8)); - //Offhand - ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); - ss.write((const char*)&null_term, sizeof(uint8)); - //Icon - ornaIcon = aug_weap->Icon; - if (aug_weap->HerosForgeModel > 0) - { - heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in); - } - } - else - */ + uint32 ornaIcon = 0; + uint32 heroModel = 0; if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { @@ -4896,8 +4877,6 @@ namespace RoF RoF::structs::ItemSerializationHeaderFinish hdrf; hdrf.ornamentIcon = ornaIcon; - hdrf.unknown061 = 0; - hdrf.unknown062 = 0; hdrf.unknowna1 = 0xffffffff; hdrf.ornamentHeroModel = heroModel; hdrf.unknown063 = 0; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 355a23383..8a998b94a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4877,28 +4877,9 @@ namespace RoF2 ss.write((const char*)&evotop, sizeof(RoF2::structs::EvolvingItem)); } //ORNAMENT IDFILE / ICON - uint16 ornaIcon = 0; - int32 heroModel = 0; - /* - if (inst->GetOrnamentationAug(ornamentationAugtype)) - { - const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem(); - //Mainhand - ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); - ss.write((const char*)&null_term, sizeof(uint8)); - //Offhand - ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile)); - ss.write((const char*)&null_term, sizeof(uint8)); - //Icon - ornaIcon = aug_weap->Icon; - if (aug_weap->HerosForgeModel > 0) - { - heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in); - } - } - else - */ - + uint32 ornaIcon = 0; + uint32 heroModel = 0; + if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) { char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile()); @@ -4919,8 +4900,6 @@ namespace RoF2 RoF2::structs::ItemSerializationHeaderFinish hdrf; hdrf.ornamentIcon = ornaIcon; - hdrf.unknown061 = 0; - hdrf.unknown062 = 0; hdrf.unknowna1 = 0xffffffff; hdrf.ornamentHeroModel = heroModel; hdrf.unknown063 = 0; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index f7a2844b1..a9011c4d7 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4381,9 +4381,7 @@ struct EvolvingItem { struct ItemSerializationHeaderFinish { -/*079*/ uint16 ornamentIcon; -/*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? -/*082*/ uint8 unknown062; // 0 +/*079*/ uint32 ornamentIcon; /*083*/ int32 unknowna1; // 0xffffffff /*087*/ uint32 ornamentHeroModel; // 0 /*091*/ uint8 unknown063; // 0 diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 787a4b786..fb2f09615 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4413,9 +4413,7 @@ struct EvolvingItem { struct ItemSerializationHeaderFinish { -/*079*/ uint16 ornamentIcon; -/*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0? -/*082*/ uint8 unknown062; // 0 +/*079*/ uint32 ornamentIcon; /*083*/ int32 unknowna1; // 0xffffffff /*087*/ uint32 ornamentHeroModel; // 0 /*091*/ uint8 unknown063; // 0 From 1329a2f9baded8ffba53060fc091dbfa5ea53733 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Wed, 24 Dec 2014 01:26:07 -0500 Subject: [PATCH 0693/1883] Update npc_types table. - d_meele_texture1 -> d_melee_texture1 - d_meele_texture2 -> d_melee_texture2 - Required SQL: 2014_12_24_npc_types_update.sql --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../required/2014_12_24_npc_types_update.sql | 2 ++ zone/aa.cpp | 4 ++-- zone/bot.cpp | 8 +++---- zone/client.cpp | 4 ++-- zone/command.cpp | 4 ++-- zone/loottables.cpp | 2 +- zone/lua_general.cpp | 4 ++-- zone/merc.h | 4 ++-- zone/npc.cpp | 22 +++++++++---------- zone/npc.h | 4 ++-- zone/pathing.cpp | 12 +++++----- zone/trap.cpp | 4 ++-- zone/zonedb.cpp | 14 ++++++------ zone/zonedump.h | 4 ++-- 16 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 utils/sql/git/required/2014_12_24_npc_types_update.sql diff --git a/common/version.h b/common/version.h index 461c26e23..dc6e0d720 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9062 +#define CURRENT_BINARY_DATABASE_VERSION 9063 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 432d97183..ad6de4298 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -316,6 +316,7 @@ 9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty| 9061|2014_12_13_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| 9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty| +9063|2014_12_24_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'd_melee_texture1'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_24_npc_types_update.sql b/utils/sql/git/required/2014_12_24_npc_types_update.sql new file mode 100644 index 000000000..a44d15c2d --- /dev/null +++ b/utils/sql/git/required/2014_12_24_npc_types_update.sql @@ -0,0 +1,2 @@ +ALTER TABLE `npc_types` CHANGE `d_meele_texture1` `d_melee_texture1` INT(11) DEFAULT NULL; +ALTER TABLE `npc_types` CHANGE `d_meele_texture2` `d_melee_texture2` INT(11) DEFAULT NULL; \ No newline at end of file diff --git a/zone/aa.cpp b/zone/aa.cpp index fc640ff92..f5da4c284 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -844,8 +844,8 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) make_npc->loottable_id = 0; make_npc->merchanttype = 0; - make_npc->d_meele_texture1 = 0; - make_npc->d_meele_texture2 = 0; + make_npc->d_melee_texture1 = 0; + make_npc->d_melee_texture2 = 0; NPC* npca = new NPC(make_npc, 0, GetX(), GetY(), GetZ(), GetHeading(), FlyMode3); diff --git a/zone/bot.cpp b/zone/bot.cpp index 99bf4a488..158e22a4a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -386,8 +386,8 @@ NPCType Bot::FillNPCTypeStruct(uint32 botSpellsID, std::string botName, std::str BotNPCType.npc_id = 0; BotNPCType.texture = 0; - BotNPCType.d_meele_texture1 = 0; - BotNPCType.d_meele_texture2 = 0; + BotNPCType.d_melee_texture1 = 0; + BotNPCType.d_melee_texture2 = 0; BotNPCType.qglobal = false; BotNPCType.attack_speed = 0; BotNPCType.runspeed = 1.25; @@ -431,8 +431,8 @@ NPCType Bot::CreateDefaultNPCTypeStructForBot(std::string botName, std::string b Result.hp_regen = 1; Result.mana_regen = 1; Result.texture = 0; - Result.d_meele_texture1 = 0; - Result.d_meele_texture2 = 0; + Result.d_melee_texture1 = 0; + Result.d_melee_texture2 = 0; Result.qglobal = false; Result.npc_spells_id = 0; Result.attack_speed = 0; diff --git a/zone/client.cpp b/zone/client.cpp index 181589bf5..32f64abfb 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6305,8 +6305,8 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->drakkin_heritage = GetDrakkinHeritage(); made_npc->drakkin_tattoo = GetDrakkinTattoo(); made_npc->drakkin_details = GetDrakkinDetails(); - made_npc->d_meele_texture1 = GetEquipmentMaterial(MaterialPrimary); - made_npc->d_meele_texture2 = GetEquipmentMaterial(MaterialSecondary); + made_npc->d_melee_texture1 = GetEquipmentMaterial(MaterialPrimary); + made_npc->d_melee_texture2 = GetEquipmentMaterial(MaterialSecondary); for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++) { made_npc->armor_tint[i] = GetEquipmentColor(i); } diff --git a/zone/command.cpp b/zone/command.cpp index bb935b7e5..b048fb89a 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6732,7 +6732,7 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(15,"NPCID %u will have item graphic %i set to his primary on repop.", npcTypeID, atoi(sep->arg[2])); - std::string query = StringFormat("UPDATE npc_types SET d_meele_texture1 = %i WHERE id = %i", + std::string query = StringFormat("UPDATE npc_types SET d_melee_texture1 = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); @@ -6743,7 +6743,7 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(15,"NPCID %u will have item graphic %i set to his secondary on repop.", npcTypeID, atoi(sep->arg[2])); - std::string query = StringFormat("UPDATE npc_types SET d_meele_texture2 = %i WHERE id = %i", + std::string query = StringFormat("UPDATE npc_types SET d_melee_texture2 = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); diff --git a/zone/loottables.cpp b/zone/loottables.cpp index b6a2c8092..000bb9bb1 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -324,7 +324,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge what was this about??? if (((npc->GetRace()==127) && (npc->CastToMob()->GetOwnerID()!=0)) && (item2->Slots==24576) || (item2->Slots==8192) || (item2->Slots==16384)){ - npc->d_meele_texture2=atoi(newid); + npc->d_melee_texture2=atoi(newid); wc->wear_slot_id=8; if (item2->Material >0) wc->material=item2->Material; diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 83c07e604..9975995d9 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1354,8 +1354,8 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float LuaCreateNPCParse(max_dmg, uint32, 4); LuaCreateNPCParse(attack_count, int16, 0); LuaCreateNPCParseString(special_abilities, 512, ""); - LuaCreateNPCParse(d_meele_texture1, uint16, 0); - LuaCreateNPCParse(d_meele_texture2, uint16, 0); + LuaCreateNPCParse(d_melee_texture1, uint16, 0); + LuaCreateNPCParse(d_melee_texture2, uint16, 0); LuaCreateNPCParseString(ammo_idfile, 32, ""); LuaCreateNPCParse(prim_melee_type, uint8, 0); LuaCreateNPCParse(sec_melee_type, uint8, 0); diff --git a/zone/merc.h b/zone/merc.h index f604d485c..3d181a82e 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -287,8 +287,8 @@ protected: uint16 skills[HIGHEST_SKILL+1]; uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs - uint16 d_meele_texture1; //this is an item Material value - uint16 d_meele_texture2; //this is an item Material value (offhand) + uint16 d_melee_texture1; //this is an item Material value + uint16 d_melee_texture2; //this is an item Material value (offhand) uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation diff --git a/zone/npc.cpp b/zone/npc.cpp index ddfd1b243..e57f70208 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -261,8 +261,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float if(!IsMerc()) AI_Start(); - d_meele_texture1 = d->d_meele_texture1; - d_meele_texture2 = d->d_meele_texture2; + d_melee_texture1 = d->d_melee_texture1; + d_melee_texture2 = d->d_melee_texture2; ammo_idfile = d->ammo_idfile; memset(equipment, 0, sizeof(equipment)); prim_melee_type = d->prim_melee_type; @@ -270,9 +270,9 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float ranged_type = d->ranged_type; // If Melee Textures are not set, set attack type to Hand to Hand as default - if(!d_meele_texture1) + if(!d_melee_texture1) prim_melee_type = 28; - if(!d_meele_texture2) + if(!d_melee_texture2) sec_melee_type = 28; //give NPCs skill values... @@ -924,8 +924,8 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, npc_type->texture = atoi(sep.arg[3]); npc_type->light = 0; npc_type->runspeed = 1.25; - npc_type->d_meele_texture1 = atoi(sep.arg[7]); - npc_type->d_meele_texture2 = atoi(sep.arg[8]); + npc_type->d_melee_texture1 = atoi(sep.arg[7]); + npc_type->d_melee_texture2 = atoi(sep.arg[8]); npc_type->merchanttype = atoi(sep.arg[9]); npc_type->bodytype = atoi(sep.arg[10]); @@ -957,7 +957,7 @@ NPC* NPC::SpawnNPC(const char* spawncommand, float in_x, float in_y, float in_z, client->Message(0, "Current/Max HP: %i", npc->max_hp); client->Message(0, "Gender: %u", npc->gender); client->Message(0, "Class: %u", npc->class_); - client->Message(0, "Weapon Item Number: %u/%u", npc->d_meele_texture1, npc->d_meele_texture2); + client->Message(0, "Weapon Item Number: %u/%u", npc->d_melee_texture1, npc->d_melee_texture2); client->Message(0, "MerchantID: %u", npc->MerchantType); client->Message(0, "Bodytype: %u", npc->bodytype); } @@ -1335,9 +1335,9 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const case MaterialChest: return texture; case MaterialPrimary: - return d_meele_texture1; + return d_melee_texture1; case MaterialSecondary: - return d_meele_texture2; + return d_melee_texture2; default: //they have nothing in the slot, and its not a special slot... they get nothing. return(0); @@ -2136,10 +2136,10 @@ uint32 NPC::GetSpawnPointID() const void NPC::NPCSlotTexture(uint8 slot, uint16 texture) { if (slot == 7) { - d_meele_texture1 = texture; + d_melee_texture1 = texture; } else if (slot == 8) { - d_meele_texture2 = texture; + d_melee_texture2 = texture; } else if (slot < 6) { // Reserved for texturing individual armor slots diff --git a/zone/npc.h b/zone/npc.h index 59fbcc3fd..b8a948800 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -492,8 +492,8 @@ protected: uint16 skills[HIGHEST_SKILL+1]; uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs - uint16 d_meele_texture1; //this is an item Material value - uint16 d_meele_texture2; //this is an item Material value (offhand) + uint16 d_melee_texture1; //this is an item Material value + uint16 d_melee_texture2; //this is an item Material value (offhand) const char* ammo_idfile; //this determines projectile graphic "IT###" (see item field 'idfile') uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 2ddd7d94b..cb5434321 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -573,8 +573,8 @@ void PathManager::SpawnPathNodes() npc_type->texture = 1; npc_type->light = 0; npc_type->runspeed = 0; - npc_type->d_meele_texture1 = 1; - npc_type->d_meele_texture2 = 1; + npc_type->d_melee_texture1 = 1; + npc_type->d_melee_texture2 = 1; npc_type->merchanttype = 1; npc_type->bodytype = 1; @@ -1561,8 +1561,8 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->texture = 1; npc_type->light = 0; npc_type->runspeed = 0; - npc_type->d_meele_texture1 = 1; - npc_type->d_meele_texture2 = 1; + npc_type->d_melee_texture1 = 1; + npc_type->d_melee_texture2 = 1; npc_type->merchanttype = 1; npc_type->bodytype = 1; npc_type->STR = 150; @@ -1621,8 +1621,8 @@ int32 PathManager::AddNode(float x, float y, float z, float best_z, int32 reques npc_type->texture = 1; npc_type->light = 0; npc_type->runspeed = 0; - npc_type->d_meele_texture1 = 1; - npc_type->d_meele_texture2 = 1; + npc_type->d_melee_texture1 = 1; + npc_type->d_melee_texture2 = 1; npc_type->merchanttype = 1; npc_type->bodytype = 1; npc_type->STR = 150; diff --git a/zone/trap.cpp b/zone/trap.cpp index 27b12c26d..182cc8915 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -315,8 +315,8 @@ void Trap::CreateHiddenTrigger() make_npc->gender = 0; make_npc->loottable_id = 0; make_npc->npc_spells_id = 0; - make_npc->d_meele_texture1 = 0; - make_npc->d_meele_texture2 = 0; + make_npc->d_melee_texture1 = 0; + make_npc->d_melee_texture2 = 0; make_npc->trackable = 0; make_npc->level = level; strcpy(make_npc->special_abilities, "19,1^20,1^24,1^25,1"); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index deff17e91..bf2f5841b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1747,8 +1747,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.WIS, npc_types.CHA, npc_types.MR, npc_types.CR, npc_types.DR, " "npc_types.FR, npc_types.PR, npc_types.Corrup, npc_types.PhR," "npc_types.mindmg, npc_types.maxdmg, npc_types.attack_count, npc_types.special_abilities," - "npc_types.npc_spells_id, npc_types.npc_spells_effects_id, npc_types.d_meele_texture1," - "npc_types.d_meele_texture2, npc_types.ammo_idfile, npc_types.prim_melee_type," + "npc_types.npc_spells_id, npc_types.npc_spells_effects_id, npc_types.d_melee_texture1," + "npc_types.d_melee_texture2, npc_types.ammo_idfile, npc_types.prim_melee_type," "npc_types.sec_melee_type, npc_types.ranged_type, npc_types.runspeed, npc_types.findable," "npc_types.trackable, npc_types.hp_regen_rate, npc_types.mana_regen_rate, " "npc_types.aggroradius, npc_types.assistradius, npc_types.bodytype, npc_types.npc_faction_id, " @@ -1822,8 +1822,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->npc_spells_id = atoi(row[35]); tmpNPCType->npc_spells_effects_id = atoi(row[36]); - tmpNPCType->d_meele_texture1 = atoi(row[37]); - tmpNPCType->d_meele_texture2 = atoi(row[38]); + tmpNPCType->d_melee_texture1 = atoi(row[37]); + tmpNPCType->d_melee_texture2 = atoi(row[38]); strn0cpy(tmpNPCType->ammo_idfile, row[39], 30); tmpNPCType->prim_melee_type = atoi(row[40]); tmpNPCType->sec_melee_type = atoi(row[41]); @@ -1968,7 +1968,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client "vwMercNpcTypes.CR, vwMercNpcTypes.DR, vwMercNpcTypes.FR, vwMercNpcTypes.PR, " "vwMercNpcTypes.Corrup, vwMercNpcTypes.mindmg, vwMercNpcTypes.maxdmg, " "vwMercNpcTypes.attack_count, vwMercNpcTypes.special_abilities, " - "vwMercNpcTypes.d_meele_texture1, vwMercNpcTypes.d_meele_texture2, " + "vwMercNpcTypes.d_melee_texture1, vwMercNpcTypes.d_melee_texture2, " "vwMercNpcTypes.prim_melee_type, vwMercNpcTypes.sec_melee_type, " "vwMercNpcTypes.runspeed, vwMercNpcTypes.hp_regen_rate, vwMercNpcTypes.mana_regen_rate, " "vwMercNpcTypes.bodytype, vwMercNpcTypes.armortint_id, " @@ -2027,8 +2027,8 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client else tmpNPCType->special_abilities[0] = '\0'; - tmpNPCType->d_meele_texture1 = atoi(row[28]); - tmpNPCType->d_meele_texture2 = atoi(row[29]); + tmpNPCType->d_melee_texture1 = atoi(row[28]); + tmpNPCType->d_melee_texture2 = atoi(row[29]); tmpNPCType->prim_melee_type = atoi(row[30]); tmpNPCType->sec_melee_type = atoi(row[31]); tmpNPCType->runspeed= atof(row[32]); diff --git a/zone/zonedump.h b/zone/zonedump.h index deebf9b19..36a53df9c 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -90,8 +90,8 @@ struct NPCType uint32 max_dmg; int16 attack_count; char special_abilities[512]; - uint16 d_meele_texture1; - uint16 d_meele_texture2; + uint16 d_melee_texture1; + uint16 d_melee_texture2; char ammo_idfile[30]; uint8 prim_melee_type; uint8 sec_melee_type; From c48d2d9888234b8bcda5288309e69e6cb99e0de3 Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 24 Dec 2014 02:31:37 -0600 Subject: [PATCH 0694/1883] (RoF+) Added herosforgemodel field to the npc_types table. Not fully functional yet for NPCs (currently only displays helm correctly). (RoF2) Updated item links from #npcstat command output. --- changelog.txt | 4 + common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../2014_12_24_npc_types_table_update.sql | 1 + zone/mob.cpp | 16 +- zone/npc.cpp | 8 +- zone/npc.h | 5 + zone/pets.cpp | 1 + zone/zonedb.cpp | 163 +++++++++--------- zone/zonedump.h | 1 + 10 files changed, 116 insertions(+), 86 deletions(-) create mode 100644 utils/sql/git/required/2014_12_24_npc_types_table_update.sql diff --git a/changelog.txt b/changelog.txt index 0a85c5259..60a1e4b9d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/24/2014 == +Trevius: (RoF+) Added herosforgemodel field to the npc_types table. Not fully functional yet for NPCs (currently only displays helm correctly). +Trevius: (RoF2) Updated item links from #npcstat command output. + == 12/23/2014 == Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. Trevius: (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc. diff --git a/common/version.h b/common/version.h index dc6e0d720..f1218e73f 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9063 +#define CURRENT_BINARY_DATABASE_VERSION 9064 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index ad6de4298..61ab5e3d9 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -317,6 +317,7 @@ 9061|2014_12_13_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty| 9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty| 9063|2014_12_24_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'd_melee_texture1'|empty| +9064|2014_12_24_npc_types_table_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'herosforgemodel'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_24_npc_types_table_update.sql b/utils/sql/git/required/2014_12_24_npc_types_table_update.sql new file mode 100644 index 000000000..c65749b36 --- /dev/null +++ b/utils/sql/git/required/2014_12_24_npc_types_table_update.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_types` ADD `herosforgemodel` int( 11 ) NOT NULL DEFAULT '0' AFTER `helmtexture`; \ No newline at end of file diff --git a/zone/mob.cpp b/zone/mob.cpp index 2f66cf51d..455a1c4ef 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -978,7 +978,8 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); - for (i = 0; i < _MaterialCount; i++) + //for (i = 0; i < _MaterialCount; i++) + for (i = 0; i < 9; i++) { // Only Player Races Wear Armor if (Mob::IsPlayerRace(race) || i > 6) @@ -2733,7 +2734,6 @@ int32 Mob::GetEquipmentMaterial(uint8 material_slot) const int32 Mob::GetHerosForgeModel(uint8 material_slot) const { - uint32 HeroModel = 0; if (material_slot >= 0 && material_slot < MaterialPrimary) { @@ -2744,7 +2744,7 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const if (item != 0 && invslot != INVALID_INDEX) { - if (this->IsClient()) + if (IsClient()) { const ItemInst* inst = CastToClient()->m_inv[invslot]; if (inst) @@ -2766,6 +2766,16 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const HeroModel = item->HerosForgeModel; } } + + if (IsNPC()) + { + HeroModel = CastToNPC()->GetHeroForgeModel(); + // Robes require full model number, and should only be sent to chest slot + if (HeroModel > 1000 && material_slot != 1) + { + HeroModel = 0; + } + } } // Auto-Convert Hero Model to match the slot diff --git a/zone/npc.cpp b/zone/npc.cpp index e57f70208..d52365f72 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -263,6 +263,8 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float d_melee_texture1 = d->d_melee_texture1; d_melee_texture2 = d->d_melee_texture2; + herosforgemodel = d->herosforgemodel; + ammo_idfile = d->ammo_idfile; memset(equipment, 0, sizeof(equipment)); prim_melee_type = d->prim_melee_type; @@ -508,7 +510,11 @@ void NPC::QueryLoot(Client* to) { for(; cur != end; ++cur) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item) - if (to->GetClientVersion() >= EQClientRoF) + if (to->GetClientVersion() >= EQClientRoF2) + { + to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (*cur)->min_level, (*cur)->max_level, (int)item->ID, 0x12, item->ID, item->Name, 0x12); + } + else if (to->GetClientVersion() >= EQClientRoF) { to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); } diff --git a/zone/npc.h b/zone/npc.h index b8a948800..72395622b 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -403,6 +403,9 @@ public: void mod_npc_killed(Mob* oos); void AISpellsList(Client *c); + uint32 GetHeroForgeModel() const { return herosforgemodel; } + void SetHeroForgeModel(uint32 model) { herosforgemodel = model; } + bool IsRaidTarget() const { return raid_target; }; protected: @@ -492,6 +495,8 @@ protected: uint16 skills[HIGHEST_SKILL+1]; uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs + + uint32 herosforgemodel; //this is the Hero Forge Armor Model (i.e 63 or 84 or 203) uint16 d_melee_texture1; //this is an item Material value uint16 d_melee_texture2; //this is an item Material value (offhand) const char* ammo_idfile; //this determines projectile graphic "IT###" (see item field 'idfile') diff --git a/zone/pets.cpp b/zone/pets.cpp index 5c1f4e0cd..6bd92cdca 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -393,6 +393,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->gender = monster->gender; npc_type->luclinface = monster->luclinface; npc_type->helmtexture = monster->helmtexture; + npc_type->herosforgemodel = monster->herosforgemodel; } else LogFile->write(EQEMuLog::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index bf2f5841b..8d5bc1dd0 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1740,7 +1740,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { // according to spawn2. std::string query = StringFormat("SELECT npc_types.id, npc_types.name, npc_types.level, npc_types.race, " "npc_types.class, npc_types.hp, npc_types.mana, npc_types.gender, " - "npc_types.texture, npc_types.helmtexture, npc_types.size, " + "npc_types.texture, npc_types.helmtexture, npc_types.herosforgemodel, npc_types.size, " "npc_types.loottable_id, npc_types.merchant_id, npc_types.alt_currency_id, " "npc_types.adventure_template_id, npc_types.trap_template, npc_types.attack_speed, " "npc_types.STR, npc_types.STA, npc_types.DEX, npc_types.AGI, npc_types._INT, " @@ -1790,82 +1790,83 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->gender = atoi(row[7]); tmpNPCType->texture = atoi(row[8]); tmpNPCType->helmtexture = atoi(row[9]); - tmpNPCType->size = atof(row[10]); - tmpNPCType->loottable_id = atoi(row[11]); - tmpNPCType->merchanttype = atoi(row[12]); - tmpNPCType->alt_currency_type = atoi(row[13]); - tmpNPCType->adventure_template = atoi(row[14]); - tmpNPCType->trap_template = atoi(row[15]); - tmpNPCType->attack_speed = atof(row[16]); - tmpNPCType->STR = atoi(row[17]); - tmpNPCType->STA = atoi(row[18]); - tmpNPCType->DEX = atoi(row[19]); - tmpNPCType->AGI = atoi(row[20]); - tmpNPCType->INT = atoi(row[21]); - tmpNPCType->WIS = atoi(row[22]); - tmpNPCType->CHA = atoi(row[23]); - tmpNPCType->MR = atoi(row[24]); - tmpNPCType->CR = atoi(row[25]); - tmpNPCType->DR = atoi(row[26]); - tmpNPCType->FR = atoi(row[27]); - tmpNPCType->PR = atoi(row[28]); - tmpNPCType->Corrup = atoi(row[29]); - tmpNPCType->PhR = atoi(row[30]); - tmpNPCType->min_dmg = atoi(row[31]); - tmpNPCType->max_dmg = atoi(row[32]); - tmpNPCType->attack_count = atoi(row[33]); + tmpNPCType->herosforgemodel = atoi(row[10]); + tmpNPCType->size = atof(row[11]); + tmpNPCType->loottable_id = atoi(row[12]); + tmpNPCType->merchanttype = atoi(row[13]); + tmpNPCType->alt_currency_type = atoi(row[14]); + tmpNPCType->adventure_template = atoi(row[15]); + tmpNPCType->trap_template = atoi(row[16]); + tmpNPCType->attack_speed = atof(row[17]); + tmpNPCType->STR = atoi(row[18]); + tmpNPCType->STA = atoi(row[19]); + tmpNPCType->DEX = atoi(row[20]); + tmpNPCType->AGI = atoi(row[21]); + tmpNPCType->INT = atoi(row[22]); + tmpNPCType->WIS = atoi(row[23]); + tmpNPCType->CHA = atoi(row[24]); + tmpNPCType->MR = atoi(row[25]); + tmpNPCType->CR = atoi(row[26]); + tmpNPCType->DR = atoi(row[27]); + tmpNPCType->FR = atoi(row[28]); + tmpNPCType->PR = atoi(row[29]); + tmpNPCType->Corrup = atoi(row[30]); + tmpNPCType->PhR = atoi(row[31]); + tmpNPCType->min_dmg = atoi(row[32]); + tmpNPCType->max_dmg = atoi(row[33]); + tmpNPCType->attack_count = atoi(row[34]); if (row[34] != nullptr) - strn0cpy(tmpNPCType->special_abilities, row[34], 512); + strn0cpy(tmpNPCType->special_abilities, row[35], 512); else tmpNPCType->special_abilities[0] = '\0'; - tmpNPCType->npc_spells_id = atoi(row[35]); - tmpNPCType->npc_spells_effects_id = atoi(row[36]); - tmpNPCType->d_melee_texture1 = atoi(row[37]); - tmpNPCType->d_melee_texture2 = atoi(row[38]); - strn0cpy(tmpNPCType->ammo_idfile, row[39], 30); - tmpNPCType->prim_melee_type = atoi(row[40]); - tmpNPCType->sec_melee_type = atoi(row[41]); - tmpNPCType->ranged_type = atoi(row[42]); - tmpNPCType->runspeed= atof(row[43]); - tmpNPCType->findable = atoi(row[44]) == 0? false : true; - tmpNPCType->trackable = atoi(row[45]) == 0? false : true; - tmpNPCType->hp_regen = atoi(row[46]); - tmpNPCType->mana_regen = atoi(row[47]); + tmpNPCType->npc_spells_id = atoi(row[36]); + tmpNPCType->npc_spells_effects_id = atoi(row[37]); + tmpNPCType->d_melee_texture1 = atoi(row[38]); + tmpNPCType->d_melee_texture2 = atoi(row[39]); + strn0cpy(tmpNPCType->ammo_idfile, row[40], 30); + tmpNPCType->prim_melee_type = atoi(row[41]); + tmpNPCType->sec_melee_type = atoi(row[42]); + tmpNPCType->ranged_type = atoi(row[43]); + tmpNPCType->runspeed= atof(row[44]); + tmpNPCType->findable = atoi(row[45]) == 0? false : true; + tmpNPCType->trackable = atoi(row[46]) == 0? false : true; + tmpNPCType->hp_regen = atoi(row[47]); + tmpNPCType->mana_regen = atoi(row[48]); // set defaultvalue for aggroradius - tmpNPCType->aggroradius = (int32)atoi(row[48]); + tmpNPCType->aggroradius = (int32)atoi(row[49]); if (tmpNPCType->aggroradius <= 0) tmpNPCType->aggroradius = 70; - tmpNPCType->assistradius = (int32)atoi(row[49]); + tmpNPCType->assistradius = (int32)atoi(row[50]); if (tmpNPCType->assistradius <= 0) tmpNPCType->assistradius = tmpNPCType->aggroradius; if (row[50] && strlen(row[50])) - tmpNPCType->bodytype = (uint8)atoi(row[50]); + tmpNPCType->bodytype = (uint8)atoi(row[51]); else tmpNPCType->bodytype = 0; - tmpNPCType->npc_faction_id = atoi(row[51]); + tmpNPCType->npc_faction_id = atoi(row[52]); - tmpNPCType->luclinface = atoi(row[52]); - tmpNPCType->hairstyle = atoi(row[53]); - tmpNPCType->haircolor = atoi(row[54]); - tmpNPCType->eyecolor1 = atoi(row[55]); - tmpNPCType->eyecolor2 = atoi(row[56]); - tmpNPCType->beardcolor = atoi(row[57]); - tmpNPCType->beard = atoi(row[58]); - tmpNPCType->drakkin_heritage = atoi(row[59]); - tmpNPCType->drakkin_tattoo = atoi(row[60]); - tmpNPCType->drakkin_details = atoi(row[61]); + tmpNPCType->luclinface = atoi(row[53]); + tmpNPCType->hairstyle = atoi(row[54]); + tmpNPCType->haircolor = atoi(row[55]); + tmpNPCType->eyecolor1 = atoi(row[56]); + tmpNPCType->eyecolor2 = atoi(row[57]); + tmpNPCType->beardcolor = atoi(row[58]); + tmpNPCType->beard = atoi(row[59]); + tmpNPCType->drakkin_heritage = atoi(row[60]); + tmpNPCType->drakkin_tattoo = atoi(row[61]); + tmpNPCType->drakkin_details = atoi(row[62]); - uint32 armor_tint_id = atoi(row[62]); + uint32 armor_tint_id = atoi(row[63]); - tmpNPCType->armor_tint[0] = (atoi(row[63]) & 0xFF) << 16; - tmpNPCType->armor_tint[0] |= (atoi(row[64]) & 0xFF) << 8; - tmpNPCType->armor_tint[0] |= (atoi(row[65]) & 0xFF); + tmpNPCType->armor_tint[0] = (atoi(row[64]) & 0xFF) << 16; + tmpNPCType->armor_tint[0] |= (atoi(row[65]) & 0xFF) << 8; + tmpNPCType->armor_tint[0] |= (atoi(row[66]) & 0xFF); tmpNPCType->armor_tint[0] |= (tmpNPCType->armor_tint[0]) ? (0xFF << 24) : 0; if (armor_tint_id == 0) @@ -1900,32 +1901,32 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { } else armor_tint_id = 0; - tmpNPCType->see_invis = atoi(row[66]); - tmpNPCType->see_invis_undead = atoi(row[67]) == 0? false: true; // Set see_invis_undead flag + tmpNPCType->see_invis = atoi(row[67]); + tmpNPCType->see_invis_undead = atoi(row[68]) == 0? false: true; // Set see_invis_undead flag if (row[68] != nullptr) - strn0cpy(tmpNPCType->lastname, row[68], 32); + strn0cpy(tmpNPCType->lastname, row[69], 32); - tmpNPCType->qglobal = atoi(row[69]) == 0? false: true; // qglobal - tmpNPCType->AC = atoi(row[70]); - tmpNPCType->npc_aggro = atoi(row[71]) == 0? false: true; - tmpNPCType->spawn_limit = atoi(row[72]); - tmpNPCType->see_hide = atoi(row[73]) == 0? false: true; - tmpNPCType->see_improved_hide = atoi(row[74]) == 0? false: true; - tmpNPCType->ATK = atoi(row[75]); - tmpNPCType->accuracy_rating = atoi(row[76]); - tmpNPCType->avoidance_rating = atoi(row[77]); - tmpNPCType->slow_mitigation = atoi(row[78]); - tmpNPCType->maxlevel = atoi(row[79]); - tmpNPCType->scalerate = atoi(row[80]); - tmpNPCType->private_corpse = atoi(row[81]) == 1 ? true: false; - tmpNPCType->unique_spawn_by_name = atoi(row[82]) == 1 ? true: false; - tmpNPCType->underwater = atoi(row[83]) == 1 ? true: false; - tmpNPCType->emoteid = atoi(row[84]); - tmpNPCType->spellscale = atoi(row[85]); - tmpNPCType->healscale = atoi(row[86]); - tmpNPCType->no_target_hotkey = atoi(row[87]) == 1 ? true: false; - tmpNPCType->raid_target = atoi(row[88]) == 0 ? false: true; - tmpNPCType->attack_delay = atoi(row[89]); + tmpNPCType->qglobal = atoi(row[70]) == 0? false: true; // qglobal + tmpNPCType->AC = atoi(row[71]); + tmpNPCType->npc_aggro = atoi(row[72]) == 0? false: true; + tmpNPCType->spawn_limit = atoi(row[73]); + tmpNPCType->see_hide = atoi(row[74]) == 0? false: true; + tmpNPCType->see_improved_hide = atoi(row[75]) == 0? false: true; + tmpNPCType->ATK = atoi(row[76]); + tmpNPCType->accuracy_rating = atoi(row[77]); + tmpNPCType->avoidance_rating = atoi(row[78]); + tmpNPCType->slow_mitigation = atoi(row[79]); + tmpNPCType->maxlevel = atoi(row[80]); + tmpNPCType->scalerate = atoi(row[81]); + tmpNPCType->private_corpse = atoi(row[82]) == 1 ? true: false; + tmpNPCType->unique_spawn_by_name = atoi(row[83]) == 1 ? true: false; + tmpNPCType->underwater = atoi(row[84]) == 1 ? true: false; + tmpNPCType->emoteid = atoi(row[85]); + tmpNPCType->spellscale = atoi(row[86]); + tmpNPCType->healscale = atoi(row[87]); + tmpNPCType->no_target_hotkey = atoi(row[88]) == 1 ? true: false; + tmpNPCType->raid_target = atoi(row[89]) == 0 ? false: true; + tmpNPCType->attack_delay = atoi(row[90]); // If NPC with duplicate NPC id already in table, // free item we attempted to add. diff --git a/zone/zonedump.h b/zone/zonedump.h index 36a53df9c..3dd6d4569 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -49,6 +49,7 @@ struct NPCType uint32 npc_id; uint8 texture; uint8 helmtexture; + uint32 herosforgemodel; uint32 loottable_id; uint32 npc_spells_id; uint32 npc_spells_effects_id; From 13a334961407a5be2afa8f63ade3bc1f5dce2e30 Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Wed, 24 Dec 2014 04:46:00 -0500 Subject: [PATCH 0695/1883] Edited #npcedit to include more options and changed a few to be multiple arguments rather than separate commands. - #npcedit wep1/#npcedit wep2 is now #npcedit weapon [primary] [secondary] - #npcedit mindmg/#npcedit maxdmg is now #npcedit damage [minimum] [maximum] - #npcedit meleetype [primary] [secondary] - #npcedit rangedtype - #npcedit ammoidfile - #npcedit trackable - #npcedit attackcount - #npcedit avoidance - #npcedit walkspeed - #npcedit armtexture - #npcedit bracertexture - #npcedit handtexture - #npcedit legtexture - #npcedit feettexture - #npcedit herosforgemodel - #npcedit slow_mitigation --- zone/command.cpp | 628 ++++++++++++++++++++++------------------------- 1 file changed, 292 insertions(+), 336 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index b048fb89a..1d8f99694 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2280,7 +2280,7 @@ void command_castspell(Client *c, const Seperator *sep) void command_setlanguage(Client *c, const Seperator *sep) { - if ( strcasecmp( sep->arg[1], "list" ) == 0 ) + if (strcasecmp(sep->arg[1], "list" ) == 0 ) { c->Message(0, "Languages:"); c->Message(0, "(0) Common Tongue"); @@ -6090,7 +6090,7 @@ void command_npcedit(Client *c, const Seperator *sep) return; } - if ( strcasecmp( sep->arg[1], "help" ) == 0 ) { + if (strcasecmp(sep->arg[1], "help") == 0) { c->Message(0, "Help File for #npcedit. Syntax for commands are:"); c->Message(0, "#npcedit Name - Sets an NPC's name"); @@ -6103,7 +6103,13 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit HP - Sets an NPC's hitpoints"); c->Message(0, "#npcedit Gender - Sets an NPC's gender"); c->Message(0, "#npcedit Texture - Sets an NPC's texture"); - c->Message(0, "#npcedit Helmtexture - Sets an NPC's helmtexture"); + c->Message(0, "#npcedit Helmtexture - Sets an NPC's helmet texture"); + c->Message(0, "#npcedit Armtexture - Sets an NPC's arm texture"); + c->Message(0, "#npcedit Bracertexture - Sets an NPC's bracer texture"); + c->Message(0, "#npcedit Handtexture - Sets an NPC's hand texture"); + c->Message(0, "#npcedit Legtexture - Sets an NPC's leg texture"); + c->Message(0, "#npcedit Feettexture - Sets an NPC's feettexture"); + c->Message(0, "#npcedit Herosforgemodel - Sets an NPC's Hero's Forge Model"); c->Message(0, "#npcedit Size - Sets an NPC's size"); c->Message(0, "#npcedit Hpregen - Sets an NPC's hitpoint regen rate per tick"); c->Message(0, "#npcedit Manaregen - Sets an NPC's mana regen rate per tick"); @@ -6116,12 +6122,15 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit special_abilities - Sets the NPC's Special Abilities"); c->Message(0, "#npcedit Spell - Sets the npc spells list ID for an NPC"); c->Message(0, "#npcedit Faction - Sets the NPC's faction id"); - c->Message(0, "#npcedit Mindmg - Sets an NPC's minimum damage"); - c->Message(0, "#npcedit Maxdmg - Sets an NPC's maximum damage"); + c->Message(0, "#npcedit Damage - Sets an NPC's damage"); + c->Message(0, "#npcedit Meleetype - Sets an NPC's melee types"); + c->Message(0, "#npcedit Rangedtype - Sets an NPC's ranged type"); + c->Message(0, "#npcedit Ammoidfile - Sets an NPC's ammo id file"); c->Message(0, "#npcedit Aggroradius - Sets an NPC's aggro radius"); c->Message(0, "#npcedit Assistradius - Sets an NPC's assist radius"); c->Message(0, "#npcedit Social - Set to 1 if an NPC should assist others on its faction"); c->Message(0, "#npcedit Runspeed - Sets an NPC's run speed"); + c->Message(0, "#npcedit Walkspeed - Sets an NPC's walk speed"); c->Message(0, "#npcedit AGI - Sets an NPC's Agility"); c->Message(0, "#npcedit CHA - Sets an NPC's Charisma"); c->Message(0, "#npcedit DEX - Sets an NPC's Dexterity"); @@ -6133,7 +6142,7 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit PR - Sets an NPC's Poison Resistance"); c->Message(0, "#npcedit DR - Sets an NPC's Disease Resistance"); c->Message(0, "#npcedit FR - Sets an NPC's Fire Resistance"); - c->Message(0, "#npcedit CR - Sets an NPC's cold resistance"); + c->Message(0, "#npcedit CR - Sets an NPC's Cold Resistance"); c->Message(0, "#npcedit Corrup - Sets an NPC's Corruption Resistance"); c->Message(0, "#npcedit PhR - Sets and NPC's Physical Resistance"); c->Message(0, "#npcedit Seeinvis - Sets an NPC's ability to see invis"); @@ -6143,14 +6152,16 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit AC - Sets an NPC's Armor Class"); c->Message(0, "#npcedit ATK - Sets an NPC's Attack"); c->Message(0, "#npcedit Accuracy - Sets an NPC's Accuracy"); + c->Message(0, "#npcedit Avoidance - Sets an NPC's Avoidance"); c->Message(0, "#npcedit npcaggro - Sets an NPC's npc_aggro flag"); c->Message(0, "#npcedit qglobal - Sets an NPC's quest global flag"); - c->Message(0, "#npcedit limit - Sets an NPC's spawn limit counter"); + c->Message(0, "#npcedit spawn_limit - Sets an NPC's spawn limit counter"); c->Message(0, "#npcedit Attackspeed - Sets an NPC's attack speed modifier"); c->Message(0, "#npcedit Attackdelay - Sets an NPC's attack delay"); + c->Message(0, "#npcedit Attackcount - Sets an NPC's attack count"); c->Message(0, "#npcedit findable - Sets an NPC's findable flag"); - c->Message(0, "#npcedit wep1 - Sets an NPC's primary weapon model"); - c->Message(0, "#npcedit wep2 - Sets an NPC's secondary weapon model"); + c->Message(0, "#npcedit trackable - Sets an NPC's trackable flag"); + c->Message(0, "#npcedit weapon - Sets an NPC's primary and secondary weapon model"); c->Message(0, "#npcedit featuresave - Saves all current facial features to the database"); c->Message(0, "#npcedit color - Sets an NPC's red, green, and blue armor tint"); c->Message(0, "#npcedit armortint_id - Set an NPC's Armor tint ID"); @@ -6160,602 +6171,566 @@ void command_npcedit(Client *c, const Seperator *sep) c->Message(0, "#npcedit spellscale - Set an NPC's spell scaling rate"); c->Message(0, "#npcedit no_target - Set an NPC's ability to be targeted with the target hotkey"); c->Message(0, "#npcedit version - Set an NPC's version"); + c->Message(0, "#npcedit slow_mitigation - Set an NPC's slow mitigation"); } uint32 npcTypeID = c->GetTarget()->CastToNPC()->GetNPCTypeID(); - - if ( strcasecmp( sep->arg[1], "name" ) == 0 ) { + if (strcasecmp(sep->arg[1], "name") == 0) { c->Message(15,"NPCID %u now has the name %s.",npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET name = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET name = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "lastname" ) == 0 ) { + if (strcasecmp(sep->arg[1], "lastname") == 0) { c->Message(15,"NPCID %u now has the lastname %s.",npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET lastname = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET lastname = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "race" ) == 0 ) { + if (strcasecmp(sep->arg[1], "race") == 0) { c->Message(15,"NPCID %u now has the race %i.",npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET race = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET race = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "class" ) == 0 ) { + if (strcasecmp(sep->arg[1], "class") == 0) { c->Message(15,"NPCID %u is now class %i.",npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET class = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET class = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "bodytype" ) == 0 ) { + if (strcasecmp(sep->arg[1], "bodytype") == 0) { c->Message(15,"NPCID %u now has type %i bodytype.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET bodytype = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET bodytype = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "hp" ) == 0 ) { + if (strcasecmp(sep->arg[1], "hp") == 0) { c->Message(15,"NPCID %u now has %i Hitpoints.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET hp = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET hp = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "gender" ) == 0 ) { + if (strcasecmp(sep->arg[1], "gender") == 0) { c->Message(15,"NPCID %u is now gender %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET gender = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET gender = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "texture" ) == 0 ) { + if (strcasecmp(sep->arg[1], "texture") == 0) { c->Message(15,"NPCID %u now uses texture %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET texture = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET texture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "helmtexture" ) == 0 ) { + if (strcasecmp(sep->arg[1], "helmtexture") == 0) { c->Message(15,"NPCID %u now uses helmtexture %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET helmtexture = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET helmtexture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "size" ) == 0 ) { + if (strcasecmp(sep->arg[1], "armtexture") == 0) { + c->Message(15,"NPCID %u now uses armtexture %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET armtexture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "bracertexture") == 0) { + c->Message(15,"NPCID %u now uses bracertexture %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET bracertexture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "handtexture") == 0) { + c->Message(15,"NPCID %u now uses handtexture %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET handtexture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "legtexture") == 0) { + c->Message(15,"NPCID %u now uses legtexture %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET legtexture = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "feettexture") == 0) { + c->Message(15,"NPCID %u now uses feettexture %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET feettexture = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "herosforgemodel") == 0) { + c->Message(15,"NPCID %u now uses herosforgemodel %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET herosforgemodel = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "size") == 0) { c->Message(15,"NPCID %u is now size %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET size = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET size = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "hpregen" ) == 0 ) { + if (strcasecmp(sep->arg[1], "hpregen") == 0) { c->Message(15,"NPCID %u now regens %i hitpoints per tick.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET hp_regen_rate = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET hp_regen_rate = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "manaregen" ) == 0 ) { + if (strcasecmp(sep->arg[1], "manaregen") == 0) { c->Message(15,"NPCID %u now regens %i mana per tick.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET mana_regen_rate = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET mana_regen_rate = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "loottable" ) == 0 ) { + if (strcasecmp(sep->arg[1], "loottable") == 0) { c->Message(15,"NPCID %u is now on loottable_id %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET loottable_id = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET loottable_id = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "merchantid" ) == 0 ) { + if (strcasecmp(sep->arg[1], "merchantid") == 0) { c->Message(15,"NPCID %u is now merchant_id %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET merchant_id = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET merchant_id = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "alt_currency_id" ) == 0 ) { + if (strcasecmp(sep->arg[1], "alt_currency_id") == 0) { c->Message(15,"NPCID %u now has field 'alt_currency_id' set to %s.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET alt_currency_id = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET alt_currency_id = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "npc_spells_effects_id" ) == 0 ) { + if (strcasecmp(sep->arg[1], "npc_spells_effects_id") == 0) { c->Message(15,"NPCID %u now has field 'npc_spells_effects_id' set to %s.", npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET npc_spells_effects_id = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET npc_spells_effects_id = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "adventure_template_id" ) == 0 ) { + if (strcasecmp(sep->arg[1], "adventure_template_id") == 0) { c->Message(15,"NPCID %u now has field 'adventure_template_id' set to %s.", npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET adventure_template_id = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET adventure_template_id = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "trap_template" ) == 0 ) { + if (strcasecmp(sep->arg[1], "trap_template") == 0) { c->Message(15,"NPCID %u now has field 'trap_template' set to %s.", npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET trap_template = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET trap_template = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "special_abilities" ) == 0 ) { + if (strcasecmp(sep->arg[1], "special_abilities") == 0) { c->Message(15,"NPCID %u now has field 'special_abilities' set to %s.", npcTypeID, sep->argplus[2]); - - std::string query = StringFormat("UPDATE npc_types SET special_abilities = '%s' WHERE id = %i", - sep->argplus[2],npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET special_abilities = '%s' WHERE id = %i", sep->argplus[2],npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "spell" ) == 0 ) { + if (strcasecmp(sep->arg[1], "spell") == 0) { c->Message(15,"NPCID %u now uses spell list %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET npc_spells_id = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET npc_spells_id = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "faction" ) == 0 ) { + if (strcasecmp(sep->arg[1], "faction") == 0) { c->Message(15,"NPCID %u is now faction %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET npc_faction_id = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET npc_faction_id = %i WHERE id = %i", atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "mindmg" ) == 0 ) { - c->Message(15,"NPCID %u now hits for a min of %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET mindmg = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); + if (strcasecmp(sep->arg[1], "damage") == 0) { + c->Message(15,"NPCID %u now hits from %i to %i", npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3])); + std::string query = StringFormat("UPDATE npc_types SET mindmg = %i, maxdmg = %i WHERE id = %i", atoi(sep->arg[2]), atoi(sep->arg[3]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "meleetype") == 0) { + c->Message(15,"NPCID %u now has a primary melee type of %i and a secondary melee type of %i.", npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3])); + std::string query = StringFormat("UPDATE npc_types SET prim_melee_type = %i, sec_melee_type = %i WHERE id = %i", atoi(sep->arg[2]), atoi(sep->arg[3]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "rangedtype") == 0) { + c->Message(15,"NPCID %u now has a ranged type of %i.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET rangedtype = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "ammoidfile") == 0) { + c->Message(15,"NPCID %u's ammo id file is now %i", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET ammoidfile = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "maxdmg" ) == 0 ) { - c->Message(15,"NPCID %u now hits for a max of %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET maxdmg = %i WHERE id = %i", - atoi(sep->argplus[2]),npcTypeID); - database.QueryDatabase(query); - c->LogSQL(query.c_str()); - return; - } - - if ( strcasecmp( sep->arg[1], "aggroradius" ) == 0 ) { + if (strcasecmp(sep->arg[1], "aggroradius") == 0) { c->Message(15,"NPCID %u now has an aggro radius of %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET aggroradius = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET aggroradius = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "assistradius" ) == 0 ) { + if (strcasecmp(sep->arg[1], "assistradius") == 0) { c->Message(15,"NPCID %u now has an assist radius of %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET assistradius = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET assistradius = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "social" ) == 0 ) { + if (strcasecmp(sep->arg[1], "social") == 0) { c->Message(15,"NPCID %u social status is now %i", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET social = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET social = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "runspeed" ) == 0 ) { + if (strcasecmp(sep->arg[1], "runspeed") == 0) { c->Message(15,"NPCID %u now runs at %f", npcTypeID, atof(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET runspeed = %f WHERE id = %i", - atof(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET runspeed = %f WHERE id = %i", atof(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "walkspeed") == 0) { + c->Message(15,"NPCID %u now walks at %f", npcTypeID, atof(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET walkspeed = %f WHERE id = %i", atof(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "AGI" ) == 0 ) { + if (strcasecmp(sep->arg[1], "AGI") == 0) { c->Message(15,"NPCID %u now has %i Agility.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET AGI = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET AGI = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "CHA" ) == 0 ) { + if (strcasecmp(sep->arg[1], "CHA") == 0) { c->Message(15,"NPCID %u now has %i Charisma.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET CHA = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET CHA = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "DEX" ) == 0 ) { + if (strcasecmp(sep->arg[1], "DEX") == 0) { c->Message(15,"NPCID %u now has %i Dexterity.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET DEX = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET DEX = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "INT" ) == 0 ) { + if (strcasecmp(sep->arg[1], "INT") == 0) { c->Message(15,"NPCID %u now has %i Intelligence.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET _INT = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET _INT = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "STA" ) == 0 ) { + if (strcasecmp(sep->arg[1], "STA") == 0) { c->Message(15,"NPCID %u now has %i Stamina.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET STA = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET STA = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "STR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "STR") == 0) { c->Message(15,"NPCID %u now has %i Strength.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET STR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET STR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "WIS" ) == 0 ) { + if (strcasecmp(sep->arg[1], "WIS") == 0) { c->Message(15,"NPCID %u now has a Magic Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET WIS = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET WIS = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "MR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "MR") == 0) { c->Message(15,"NPCID %u now has a Magic Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET MR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET MR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "DR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "DR") == 0) { c->Message(15,"NPCID %u now has a Disease Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET DR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET DR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "CR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "CR") == 0) { c->Message(15,"NPCID %u now has a Cold Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET CR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET CR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "FR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "FR") == 0) { c->Message(15,"NPCID %u now has a Fire Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET FR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET FR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "PR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "PR") == 0) { c->Message(15,"NPCID %u now has a Poison Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET PR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET PR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "Corrup" ) == 0 ) { + if (strcasecmp(sep->arg[1], "Corrup") == 0) { c->Message(15,"NPCID %u now has a Corruption Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET corrup = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET corrup = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "PhR" ) == 0 ) { + if (strcasecmp(sep->arg[1], "PhR") == 0) { c->Message(15,"NPCID %u now has a Physical Resistance of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET PhR = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET PhR = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "seeinvis" ) == 0 ) { + if (strcasecmp(sep->arg[1], "seeinvis") == 0) { c->Message(15,"NPCID %u now has seeinvis set to %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET see_invis = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET see_invis = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "seeinvisundead" ) == 0 ) { + if (strcasecmp(sep->arg[1], "seeinvisundead") == 0) { c->Message(15,"NPCID %u now has seeinvisundead set to %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET see_invis_undead = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET see_invis_undead = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "seehide" ) == 0 ) { + if (strcasecmp(sep->arg[1], "seehide") == 0) { c->Message(15,"NPCID %u now has seehide set to %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET see_hide = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET see_hide = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "seeimprovedhide" ) == 0 ) { + if (strcasecmp(sep->arg[1], "seeimprovedhide") == 0) { c->Message(15,"NPCID %u now has seeimprovedhide set to %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET see_improved_hide = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET see_improved_hide = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "AC" ) == 0 ) { + if (strcasecmp(sep->arg[1], "AC") == 0) { c->Message(15,"NPCID %u now has %i Armor Class.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET ac = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET ac = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "ATK" ) == 0 ) { + if (strcasecmp(sep->arg[1], "ATK") == 0) { c->Message(15,"NPCID %u now has %i Attack.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET atk = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET atk = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "Accuracy" ) == 0 ) { + if (strcasecmp(sep->arg[1], "Accuracy") == 0) { c->Message(15,"NPCID %u now has %i Accuracy.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET accuracy = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET accuracy = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "Avoidance") == 0) { + c->Message(15,"NPCID %u now has %i Avoidance.", npcTypeID, atoi(sep->argplus[2])); + std::string query = StringFormat("UPDATE npc_types SET avoidance = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "level" ) == 0 ) { + if (strcasecmp(sep->arg[1], "level") == 0) { c->Message(15,"NPCID %u is now level %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET level = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET level = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "maxlevel" ) == 0 ) { + if (strcasecmp(sep->arg[1], "maxlevel") == 0) { c->Message(15,"NPCID %u now has a maximum level of %i.", npcTypeID, atoi(sep->argplus[2])); - - std::string query = StringFormat("UPDATE npc_types SET maxlevel = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET maxlevel = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "qglobal" ) == 0 ) { - c->Message(15,"Quest globals have been %s for NPCID %u", - atoi(sep->arg[2]) == 0 ? "disabled" : "enabled", npcTypeID); - - std::string query = StringFormat("UPDATE npc_types SET qglobal = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "qglobal") == 0) { + c->Message(15,"Quest globals have been %s for NPCID %u", atoi(sep->arg[2]) == 0 ? "disabled" : "enabled", npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET qglobal = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "npcaggro" ) == 0 ) { - c->Message(15,"NPCID %u will now %s other NPCs with negative faction npc_value", - npcTypeID, atoi(sep->arg[2]) == 0? "not aggro": "aggro"); - - std::string query = StringFormat("UPDATE npc_types SET npc_aggro = %i WHERE id = %i", - atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); + if (strcasecmp(sep->arg[1], "npcaggro") == 0) { + c->Message(15,"NPCID %u will now %s other NPCs with negative faction npc_value", npcTypeID, atoi(sep->arg[2]) == 0? "not aggro": "aggro"); + std::string query = StringFormat("UPDATE npc_types SET npc_aggro = %i WHERE id = %i", atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "limit" ) == 0 ) { - c->Message(15,"NPCID %u now has a spawn limit of %i", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET limit = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "spawn_limit") == 0) { + c->Message(15,"NPCID %u now has a spawn limit of %i", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET spawn_limit = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "Attackspeed" ) == 0 ) { - c->Message(15,"NPCID %u now has attack_speed set to %f", - npcTypeID, atof(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET attack_speed = %f WHERE id = %i", - atof(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "Attackspeed") == 0) { + c->Message(15,"NPCID %u now has attack_speed set to %f", npcTypeID, atof(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET attack_speed = %f WHERE id = %i", atof(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "Attackdelay" ) == 0 ) { + if (strcasecmp(sep->arg[1], "Attackdelay") == 0) { c->Message(15,"NPCID %u now has attack_delay set to %i",npcTypeID,atoi(sep->arg[2])); - std::string query = StringFormat("UPDATE npc_types SET attack_delay = %i WHERE id = %i",atoi(sep->argplus[2]),npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } + + if (strcasecmp(sep->arg[1], "Attackcount") == 0) { + c->Message(15,"NPCID %u now has attack_count set to %i",npcTypeID,atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET attack_count = %i WHERE id = %i",atoi(sep->argplus[2]),npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } - if ( strcasecmp( sep->arg[1], "findable" ) == 0 ) { + if (strcasecmp(sep->arg[1], "findable") == 0) { c->Message(15,"NPCID %u is now %s", npcTypeID, atoi(sep->arg[2]) == 0? "not findable": "findable"); - - std::string query = StringFormat("UPDATE npc_types SET findable = %i WHERE id = %i", - atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); + std::string query = StringFormat("UPDATE npc_types SET findable = %i WHERE id = %i", atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "wep1" ) == 0 ) { - c->Message(15,"NPCID %u will have item graphic %i set to his primary on repop.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET d_melee_texture1 = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "trackable") == 0) { + c->Message(15,"NPCID %u is now %s", npcTypeID, atoi(sep->arg[2]) == 0? "not trackable": "trackable"); + std::string query = StringFormat("UPDATE npc_types SET trackable = %i WHERE id = %i", atoi(sep->argplus[2]) == 0? 0: 1, npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "wep2" ) == 0 ) { - c->Message(15,"NPCID %u will have item graphic %i set to his secondary on repop.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET d_melee_texture2 = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "weapon") == 0) { + c->Message(15,"NPCID %u will have item graphic %i set to his primary and item graphic %i set to his secondary on repop.", npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3])); + std::string query = StringFormat("UPDATE npc_types SET d_melee_texture1 = %i, d_melee_texture2 = %i WHERE id = %i", atoi(sep->arg[2]), atoi(sep->arg[3]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "featuresave" ) == 0 ) { - c->Message(15,"NPCID %u saved with all current facial feature settings", - npcTypeID); - + if (strcasecmp(sep->arg[1], "featuresave") == 0) { + c->Message(15,"NPCID %u saved with all current facial feature settings", npcTypeID); Mob* target = c->GetTarget(); - std::string query = StringFormat("UPDATE npc_types " "SET luclin_haircolor = %i, luclin_beardcolor = %i, " "luclin_hairstyle = %i, luclin_beard = %i, " @@ -6772,45 +6747,36 @@ void command_npcedit(Client *c, const Seperator *sep) return; } - if ( strcasecmp( sep->arg[1], "color" ) == 0 ) { - c->Message(15,"NPCID %u now has %i red, %i green, and %i blue tinting on their armor.", - npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); - - std::string query = StringFormat("UPDATE npc_types " - "SET armortint_red = %i, armortint_green = %i, armortint_blue = %i " - "WHERE id = %i", - atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), npcTypeID); + if (strcasecmp(sep->arg[1], "color") == 0) { + c->Message(15,"NPCID %u now has %i red, %i green, and %i blue tinting on their armor.", npcTypeID, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4])); + std::string query = StringFormat("UPDATE npc_types SET armortint_red = %i, armortint_green = %i, armortint_blue = %i WHERE id = %i", atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "armortint_id" ) == 0 ) { - c->Message(15,"NPCID %u now has field 'armortint_id' set to %s", - npcTypeID, sep->arg[2]); - - std::string query = StringFormat("UPDATE npc_types SET armortint_id = '%s' WHERE id = %i", - sep->argplus[2], npcTypeID); + if (strcasecmp(sep->arg[1], "armortint_id") == 0) { + c->Message(15,"NPCID %u now has field 'armortint_id' set to %s", npcTypeID, sep->arg[2]); + std::string query = StringFormat("UPDATE npc_types SET armortint_id = '%s' WHERE id = %i", sep->argplus[2], npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "setanimation" ) == 0 ) { + if (strcasecmp(sep->arg[1], "setanimation") == 0) { int animation = 0; if(sep->arg[2] && atoi(sep->arg[2]) <= 4) { - if((strcasecmp( sep->arg[2], "stand" ) == 0) || atoi(sep->arg[2]) == 0) + if((strcasecmp(sep->arg[2], "stand" ) == 0) || atoi(sep->arg[2]) == 0) animation = 0; //Stand - if((strcasecmp( sep->arg[2], "sit" ) == 0) || atoi(sep->arg[2]) == 1) + if((strcasecmp(sep->arg[2], "sit" ) == 0) || atoi(sep->arg[2]) == 1) animation = 1; //Sit - if((strcasecmp( sep->arg[2], "crouch" ) == 0) || atoi(sep->arg[2]) == 2) + if((strcasecmp(sep->arg[2], "crouch" ) == 0) || atoi(sep->arg[2]) == 2) animation = 2; //Crouch - if((strcasecmp( sep->arg[2], "dead" ) == 0) || atoi(sep->arg[2]) == 3) + if((strcasecmp(sep->arg[2], "dead" ) == 0) || atoi(sep->arg[2]) == 3) animation = 3; //Dead - if((strcasecmp( sep->arg[2], "loot" ) == 0) || atoi(sep->arg[2]) == 4) + if((strcasecmp(sep->arg[2], "loot" ) == 0) || atoi(sep->arg[2]) == 4) animation = 4; //Looting Animation - } - else { + } else { c->Message(0, "You must specifiy an animation stand, sit, crouch, dead, loot (0-4)"); c->Message(0, "Example: #npcedit setanimation sit"); c->Message(0, "Example: #npcedit setanimation 0"); @@ -6818,10 +6784,7 @@ void command_npcedit(Client *c, const Seperator *sep) } c->Message(15,"NPCID %u now has the animation set to %i on spawn with spawngroup %i", npcTypeID, animation, c->GetTarget()->CastToNPC()->GetSp2() ); - - std::string query = StringFormat("UPDATE spawn2 SET animation = %i " - "WHERE spawngroupID = %i", - animation, c->GetTarget()->CastToNPC()->GetSp2()); + std::string query = StringFormat("UPDATE spawn2 SET animation = %i " "WHERE spawngroupID = %i", animation, c->GetTarget()->CastToNPC()->GetSp2()); database.QueryDatabase(query); c->LogSQL(query.c_str()); @@ -6829,56 +6792,49 @@ void command_npcedit(Client *c, const Seperator *sep) return; } - if ( strcasecmp( sep->arg[1], "scalerate" ) == 0 ) { - c->Message(15,"NPCID %u now has a scaling rate of %i.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET scalerate = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "scalerate") == 0) { + c->Message(15,"NPCID %u now has a scaling rate of %i.", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET scalerate = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "healscale" ) == 0 ) { - c->Message(15, "NPCID %u now has a heal scaling rate of %i.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET healscale = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "healscale") == 0) { + c->Message(15, "NPCID %u now has a heal scaling rate of %i.", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET healscale = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "spellscale" ) == 0 ) { - c->Message(15, "NPCID %u now has a spell scaling rate of %i.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET spellscale = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "spellscale") == 0) { + c->Message(15, "NPCID %u now has a spell scaling rate of %i.", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET spellscale = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "no_target" ) == 0 ) { - c->Message(15, "NPCID %u is now %s.", - npcTypeID, atoi(sep->arg[2]) == 0? "targetable": "untargetable"); - - std::string query = StringFormat("UPDATE npc_types SET no_target_hotkey = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "no_target") == 0) { + c->Message(15, "NPCID %u is now %s.", npcTypeID, atoi(sep->arg[2]) == 0? "targetable": "untargetable"); + std::string query = StringFormat("UPDATE npc_types SET no_target_hotkey = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; } - if ( strcasecmp( sep->arg[1], "version" ) == 0 ) { - c->Message(15, "NPCID %u is now version %i.", - npcTypeID, atoi(sep->arg[2])); - - std::string query = StringFormat("UPDATE npc_types SET version = %i WHERE id = %i", - atoi(sep->argplus[2]), npcTypeID); + if (strcasecmp(sep->arg[1], "version") == 0) { + c->Message(15, "NPCID %u is now version %i.", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET version = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); + database.QueryDatabase(query); + c->LogSQL(query.c_str()); + return; + } + + if (strcasecmp(sep->arg[1], "slow_mitigation") == 0) { + c->Message(15, "NPCID %u's slow mitigation limit is now %i.", npcTypeID, atoi(sep->arg[2])); + std::string query = StringFormat("UPDATE npc_types SET slow_mitigation = %i WHERE id = %i", atoi(sep->argplus[2]), npcTypeID); database.QueryDatabase(query); c->LogSQL(query.c_str()); return; @@ -6910,14 +6866,14 @@ void command_profilereset(Client *c, const Seperator *sep) { #endif void command_opcode(Client *c, const Seperator *sep) { - if(!strcasecmp( sep->arg[1], "reload" )) { + if(!strcasecmp(sep->arg[1], "reload" )) { ReloadAllPatches(); c->Message(0, "Opcodes for all patches have been reloaded"); } } void command_logsql(Client *c, const Seperator *sep) { - if(!strcasecmp( sep->arg[1], "off" )) { + if(!strcasecmp(sep->arg[1], "off" )) { c->ChangeSQLLog(nullptr); } else if(sep->arg[1][0] != '\0') { c->ChangeSQLLog(sep->argplus[1]); @@ -6934,17 +6890,17 @@ void command_logs(Client *c, const Seperator *sep) t = c->GetTarget()->CastToClient(); } - if(!strcasecmp( sep->arg[1], "status" ) ) + if(!strcasecmp(sep->arg[1], "status" ) ) client_logs.subscribe(EQEMuLog::Status, t); - else if(!strcasecmp( sep->arg[1], "normal" ) ) + else if(!strcasecmp(sep->arg[1], "normal" ) ) client_logs.subscribe(EQEMuLog::Normal, t); - else if(!strcasecmp( sep->arg[1], "error" ) ) + else if(!strcasecmp(sep->arg[1], "error" ) ) client_logs.subscribe(EQEMuLog::Error, t); - else if(!strcasecmp( sep->arg[1], "debug" ) ) + else if(!strcasecmp(sep->arg[1], "debug" ) ) client_logs.subscribe(EQEMuLog::Debug, t); - else if(!strcasecmp( sep->arg[1], "quest" ) ) + else if(!strcasecmp(sep->arg[1], "quest" ) ) client_logs.subscribe(EQEMuLog::Quest, t); - else if(!strcasecmp( sep->arg[1], "all" ) ) + else if(!strcasecmp(sep->arg[1], "all" ) ) client_logs.subscribeAll(t); else { c->Message(0, "Usage: #logs [status|normal|error|debug|quest|all]"); @@ -6966,17 +6922,17 @@ void command_nologs(Client *c, const Seperator *sep) t = c; } - if(!strcasecmp( sep->arg[1], "status" ) ) + if(!strcasecmp(sep->arg[1], "status" ) ) client_logs.unsubscribe(EQEMuLog::Status, t); - else if(!strcasecmp( sep->arg[1], "normal" ) ) + else if(!strcasecmp(sep->arg[1], "normal" ) ) client_logs.unsubscribe(EQEMuLog::Normal, t); - else if(!strcasecmp( sep->arg[1], "error" ) ) + else if(!strcasecmp(sep->arg[1], "error" ) ) client_logs.unsubscribe(EQEMuLog::Error, t); - else if(!strcasecmp( sep->arg[1], "debug" ) ) + else if(!strcasecmp(sep->arg[1], "debug" ) ) client_logs.unsubscribe(EQEMuLog::Debug, t); - else if(!strcasecmp( sep->arg[1], "quest" ) ) + else if(!strcasecmp(sep->arg[1], "quest" ) ) client_logs.unsubscribe(EQEMuLog::Quest, t); - else if(!strcasecmp( sep->arg[1], "all" ) ) + else if(!strcasecmp(sep->arg[1], "all" ) ) client_logs.unsubscribeAll(t); else { c->Message(0, "Usage: #logs [status|normal|error|debug|quest|all]"); @@ -10502,7 +10458,7 @@ void command_mysql(Client *c, const Seperator *sep) return; } - if ( strcasecmp( sep->arg[1], "help" ) == 0 ) { + if (strcasecmp(sep->arg[1], "help") == 0) { c->Message(0, "MYSQL In-Game CLI Interface:"); c->Message(0, "Example: #mysql query \"Query goes here quoted\" -s -h"); c->Message(0, "To use 'like \"%%something%%\" replace the %% with #"); @@ -10512,7 +10468,7 @@ void command_mysql(Client *c, const Seperator *sep) return; } - if ( strcasecmp( sep->arg[1], "query" ) == 0 ) { + if (strcasecmp(sep->arg[1], "query") == 0) { ///Parse switches here int argnum = 3; bool optionS = false; From baf2f23ce6f924d4a5f41f5bc49d27421769efd4 Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 24 Dec 2014 12:02:30 -0600 Subject: [PATCH 0696/1883] (RoF+) Implemented Hero's Forge Armor for NPCs. Set the herosforgemodel field in npc_types table to the model (example: 84 for full set, or 12107 for robe). (RoF+) Hero's Forge Armor now overrides NPC texture settings. To display Hero's Forge Armor Helms, set helmtexture field to anything other than 0. Fixed some NPC loading from the database that was incorrect after adding herosforgemodel. --- changelog.txt | 4 +++- common/patches/rof2.cpp | 2 +- zone/mob.cpp | 10 +++++----- zone/zonedb.cpp | 36 ++++++++++++++++++++++-------------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/changelog.txt b/changelog.txt index 60a1e4b9d..0c9bed583 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/24/2014 == -Trevius: (RoF+) Added herosforgemodel field to the npc_types table. Not fully functional yet for NPCs (currently only displays helm correctly). +Trevius: (RoF+) Added herosforgemodel field to the npc_types table. Trevius: (RoF2) Updated item links from #npcstat command output. +Trevius: (RoF+) Implemented Hero's Forge Armor for NPCs. Set the herosforgemodel field in npc_types table to the model (example: 84 for full set, or 12107 for robe). +Trevius: (RoF+) Hero's Forge Armor now overrides NPC texture settings. To display Hero's Forge Armor Helms, set helmtexture field to anything other than 0. == 12/23/2014 == Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 8a998b94a..c57266f0a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3742,7 +3742,7 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->drakkin_tattoo); VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->drakkin_details); - VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->equip_chest2); // unknown8 + VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->equip_chest2); VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown9 VARSTRUCT_ENCODE_TYPE(uint8, Buffer, 0); // unknown10 VARSTRUCT_ENCODE_TYPE(uint8, Buffer, emu->helm); // unknown11 diff --git a/zone/mob.cpp b/zone/mob.cpp index 455a1c4ef..8baf361bd 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -925,7 +925,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.animation = 0; ns->spawn.findable = findable?1:0; ns->spawn.light = light; - ns->spawn.showhelm = 1; + ns->spawn.showhelm = (helmtexture && helmtexture != 0xFF) ? 1 : 0; ns->spawn.invis = (invisible || hidden) ? 1 : 0; // TODO: load this before spawning players ns->spawn.NPC = IsClient() ? 0 : 1; @@ -945,11 +945,11 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.drakkin_heritage = drakkin_heritage; ns->spawn.drakkin_tattoo = drakkin_tattoo; ns->spawn.drakkin_details = drakkin_details; - ns->spawn.equip_chest2 = texture; + ns->spawn.equip_chest2 = GetHerosForgeModel(1) != 0 ? 0xff : texture; // ns->spawn.invis2 = 0xff;//this used to be labeled beard.. if its not FF it will turn mob invis - if(helmtexture && helmtexture != 0xFF) + if (helmtexture && helmtexture != 0xFF && GetHerosForgeModel(0) == 0) { ns->spawn.helm=helmtexture; } else { @@ -2770,8 +2770,8 @@ int32 Mob::GetHerosForgeModel(uint8 material_slot) const if (IsNPC()) { HeroModel = CastToNPC()->GetHeroForgeModel(); - // Robes require full model number, and should only be sent to chest slot - if (HeroModel > 1000 && material_slot != 1) + // Robes require full model number, and should only be sent to chest, arms, wrists, and legs slots + if (HeroModel > 1000 && material_slot != 1 && material_slot != 2 && material_slot != 3 && material_slot != 5) { HeroModel = 0; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8d5bc1dd0..d067411e6 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1790,7 +1790,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->gender = atoi(row[7]); tmpNPCType->texture = atoi(row[8]); tmpNPCType->helmtexture = atoi(row[9]); - tmpNPCType->herosforgemodel = atoi(row[10]); + tmpNPCType->herosforgemodel = atoul(row[10]); tmpNPCType->size = atof(row[11]); tmpNPCType->loottable_id = atoi(row[12]); tmpNPCType->merchanttype = atoi(row[13]); @@ -1816,7 +1816,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->max_dmg = atoi(row[33]); tmpNPCType->attack_count = atoi(row[34]); - if (row[34] != nullptr) + if (row[35] != nullptr) strn0cpy(tmpNPCType->special_abilities, row[35], 512); else tmpNPCType->special_abilities[0] = '\0'; @@ -1835,7 +1835,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->hp_regen = atoi(row[47]); tmpNPCType->mana_regen = atoi(row[48]); - // set defaultvalue for aggroradius + // set default value for aggroradius tmpNPCType->aggroradius = (int32)atoi(row[49]); if (tmpNPCType->aggroradius <= 0) tmpNPCType->aggroradius = 70; @@ -1844,7 +1844,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { if (tmpNPCType->assistradius <= 0) tmpNPCType->assistradius = tmpNPCType->aggroradius; - if (row[50] && strlen(row[50])) + if (row[51] && strlen(row[51])) tmpNPCType->bodytype = (uint8)atoi(row[51]); else tmpNPCType->bodytype = 0; @@ -1869,10 +1869,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->armor_tint[0] |= (atoi(row[66]) & 0xFF); tmpNPCType->armor_tint[0] |= (tmpNPCType->armor_tint[0]) ? (0xFF << 24) : 0; - if (armor_tint_id == 0) - for (int index = MaterialChest; index <= EmuConstants::MATERIAL_END; index++) - tmpNPCType->armor_tint[index] = tmpNPCType->armor_tint[0]; - else if (tmpNPCType->armor_tint[0] == 0) + if (armor_tint_id != 0) { std::string armortint_query = StringFormat("SELECT red1h, grn1h, blu1h, " "red2c, grn2c, blu2c, " @@ -1887,23 +1884,34 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { armor_tint_id); auto armortint_results = QueryDatabase(armortint_query); if (!armortint_results.Success() || armortint_results.RowCount() == 0) - armor_tint_id = 0; - else { + { + armor_tint_id = 0; + } + else + { auto armorTint_row = armortint_results.begin(); - for (int index = EmuConstants::MATERIAL_BEGIN; index <= EmuConstants::MATERIAL_END; index++) { + for (int index = EmuConstants::MATERIAL_BEGIN; index <= EmuConstants::MATERIAL_END; index++) + { tmpNPCType->armor_tint[index] = atoi(armorTint_row[index * 3]) << 16; tmpNPCType->armor_tint[index] |= atoi(armorTint_row[index * 3 + 1]) << 8; tmpNPCType->armor_tint[index] |= atoi(armorTint_row[index * 3 + 2]); tmpNPCType->armor_tint[index] |= (tmpNPCType->armor_tint[index]) ? (0xFF << 24) : 0; } } - } else - armor_tint_id = 0; + } + // Try loading npc_types tint fields if armor tint is 0 or query failed to get results + if (armor_tint_id == 0) + { + for (int index = MaterialChest; index < _MaterialCount; index++) + { + tmpNPCType->armor_tint[index] = tmpNPCType->armor_tint[0]; + } + } tmpNPCType->see_invis = atoi(row[67]); tmpNPCType->see_invis_undead = atoi(row[68]) == 0? false: true; // Set see_invis_undead flag - if (row[68] != nullptr) + if (row[69] != nullptr) strn0cpy(tmpNPCType->lastname, row[69], 32); tmpNPCType->qglobal = atoi(row[70]) == 0? false: true; // qglobal From 811872c17fb31c15f3d4fe94d3d6a68977c23d33 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 24 Dec 2014 17:42:35 -0500 Subject: [PATCH 0697/1883] Rework Bot::GetBotArcheryRange --- zone/bot.cpp | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 158e22a4a..4cb5c0dc5 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -234,45 +234,28 @@ void Bot::SetBotSpellID(uint32 newSpellID) { this->npc_spells_id = newSpellID; } -uint32 Bot::GetBotArcheryRange() { - uint32 result = 0; +uint32 Bot::GetBotArcheryRange() +{ + const ItemInst *range_inst = GetBotItem(MainRange); + const ItemInst *ammo_inst = GetBotItem(MainAmmo); - ItemInst* rangeItem = GetBotItem(MainRange); - - if(!rangeItem) + // empty slots + if (!range_inst || !ammo_inst) return 0; - const Item_Struct* botweapon = rangeItem->GetItem(); + const Item_Struct *range_item = range_inst->GetItem(); + const Item_Struct *ammo_item = ammo_inst->GetItem(); - uint32 archeryMaterial; - uint32 archeryColor; - uint32 archeryBowID; - uint32 archeryAmmoID; + // no item struct for whatever reason + if (!range_item || !ammo_item) + return 0; - if(botweapon && botweapon->ItemType == ItemTypeBow) { - uint32 range = 0; + // bad item types + if (range_item->ItemType != ItemTypeBow || ammo_item->ItemType != ItemTypeArrow) + return 0; - archeryMaterial = atoi(botweapon->IDFile + 2); - archeryBowID = botweapon->ID; - archeryColor = botweapon->Color; - range =+ botweapon->Range; - - rangeItem = GetBotItem(MainAmmo); - if(rangeItem) - botweapon = rangeItem->GetItem(); - - if(!botweapon || (botweapon->ItemType != ItemTypeArrow)) { - return 0; - } - - range += botweapon->Range; - - archeryAmmoID = botweapon->ID; - - result = range; - } - - return result; + // everything is good! + return range_item->Range + ammo_item->Range; } void Bot::ChangeBotArcherWeapons(bool isArcher) { @@ -14364,8 +14347,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { return; } - std::list::iterator botGroupItr = botGroup.begin(); - for(botGroupItr; botGroupItr != botGroup.end(); ++botGroupItr) { + for(auto botGroupItr = botGroup.begin(); botGroupItr != botGroup.end(); ++botGroupItr) { // Don't try to re-spawn the botgroup's leader. if(botGroupItr->BotID == botGroupLeader->GetBotID()) { continue; } From 8522542ae219c9a89801340c63c91d1cfe22a014 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 24 Dec 2014 18:29:23 -0500 Subject: [PATCH 0698/1883] Use lambdas in sort functions (for zone at least) --- zone/merc.cpp | 11 +++-------- zone/mob_ai.cpp | 10 +++------- zone/pathing.cpp | 12 ++++++------ zone/waypoints.cpp | 4 +++- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 76167382f..d56d5873d 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4644,13 +4644,6 @@ const char* Merc::GetRandomName(){ return name; } -bool Compare_Merc_Spells(MercSpell i, MercSpell j); - -bool Compare_Merc_Spells(MercSpell i, MercSpell j) -{ - return(i.slot > j.slot); -} - bool Merc::LoadMercSpells() { // loads mercs spells into list merc_spells.clear(); @@ -4683,7 +4676,9 @@ bool Merc::LoadMercSpells() { AddProcToWeapon(mercSpellEntryItr->spellid, true, mercSpellEntryItr->proc_chance); } } - std::sort(merc_spells.begin(), merc_spells.end(), Compare_Merc_Spells); + std::sort(merc_spells.begin(), merc_spells.end(), [](const MercSpell& a, const MercSpell& b) { + return a.slot > b.slot; + }); if (merc_spells.size() == 0) AIautocastspell_timer->Disable(); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e289f41d2..9f4e8db7f 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2334,7 +2334,6 @@ create table npc_spells_entries ( bool IsSpellInList(DBnpcspells_Struct* spell_list, int16 iSpellID); bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSpellEffectID, int32 base, int32 limit, int32 max); -bool Compare_AI_Spells(AISpells_Struct i, AISpells_Struct j); bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) { // ok, this function should load the list, and the parent list then shove them into the struct and sort @@ -2459,7 +2458,9 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) { spell_list->entries[i].resist_adjust); } } - std::sort(AIspells.begin(), AIspells.end(), Compare_AI_Spells); + std::sort(AIspells.begin(), AIspells.end(), [](const AISpells_Struct& a, const AISpells_Struct& b) { + return a.priority > b.priority; + }); if (IsValidSpell(attack_proc_spell)) AddProcToWeapon(attack_proc_spell, true, proc_chance); @@ -2599,11 +2600,6 @@ bool IsSpellInList(DBnpcspells_Struct* spell_list, int16 iSpellID) { return false; } -bool Compare_AI_Spells(AISpells_Struct i, AISpells_Struct j) -{ - return(i.priority > j.priority); -} - // adds a spell to the list, taking into account priority and resorting list as needed. void NPC::AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint16 iType, int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust) diff --git a/zone/pathing.cpp b/zone/pathing.cpp index cb5434321..b58e4ae2e 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -345,10 +345,10 @@ bool CheckLOSBetweenPoints(Map::Vertex start, Map::Vertex end) { return true; } -bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2) +auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) { - return n1.Distance < n2.Distance; -} + return a.Distance < b.Distance; +}; std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { @@ -382,7 +382,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } } - std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare); for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { @@ -420,7 +420,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } } - std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare); for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { @@ -1120,7 +1120,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } } - std::sort(SortedByDistance.begin(), SortedByDistance.end(), SortPathNodesByDistance); + std::sort(SortedByDistance.begin(), SortedByDistance.end(), path_compare); for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 889848723..72172a53c 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -391,7 +391,9 @@ void NPC::GetClosestWaypoint(std::list &wp_list, int count, float m_x, f w_dist.index = i; distances.push_back(w_dist); } - distances.sort(wp_distance_pred); + distances.sort([](const wp_distance& a, const wp_distance& b) { + return a.dist < b.dist; + }); std::list::iterator iter = distances.begin(); for(int i = 0; i < count; ++i) From 15fbb722eb64dbbf514062a0d25e09bc17c5c553 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 25 Dec 2014 00:00:57 -0500 Subject: [PATCH 0699/1883] Added a new Client::MakeItemLink() method that uses Item_Struct instead of ItemInst. Changed the way that NPC::QueryLoot() builds its links. --- zone/client.h | 1 + zone/inventory.cpp | 83 ++++++++++++++++++++++++++++------------------ zone/npc.cpp | 42 ++++++++++------------- 3 files changed, 68 insertions(+), 58 deletions(-) diff --git a/zone/client.h b/zone/client.h index b9a2c6d30..5730cae86 100644 --- a/zone/client.h +++ b/zone/client.h @@ -815,6 +815,7 @@ public: void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); + bool MakeItemLink(char* &ret_link, const Item_Struct* item, uint32 aug0=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); bool MakeItemLink(char* &ret_link, const ItemInst* inst); int GetItemLinkHash(const ItemInst* inst); void SendItemLink(const ItemInst* inst, bool sendtoall=false); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index e6f4b00b6..80d48309c 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1027,23 +1027,22 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) } } -bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { +bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) { //we're sending back the entire "link", minus the null characters & item name //that way, we can use it for regular links & Task links //note: initiator needs to pass us ret_link -/* + /* --- Usage --- Chat: "%c" "%s" "%s" "%c", 0x12, ret_link, inst->GetItem()->name, 0x12 Task: "" "%s" "", ret_link, inst->GetItem()->name - Master's Book of Wood Elven Culture - http://eqitems.13th-floor.org/phpBB2/viewtopic.php?p=510#510 -*/ + Master's Book of Wood Elven Culture + http://eqitems.13th-floor.org/phpBB2/viewtopic.php?p=510#510 + */ - if (!inst) //have to have an item to make the link + if (!item) //have to have an item to make the link return false; - const Item_Struct* item = inst->GetItem(); //format: //0 itemid aug1 aug2 aug3 aug4 aug5 evolving? loregroup evolved level hash //0 00000 00000 00000 00000 00000 00000 0 0000 0 00000000 @@ -1057,16 +1056,18 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { //int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead if (GetClientVersion() >= EQClientRoF2) { - MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%1X" "%04X" "%1X" "%05X" "%08X", + MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, - inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), - inst->GetAugmentItemID(2), - inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), - inst->GetAugmentItemID(5), + aug0, + aug1, + aug2, + aug3, + aug4, + aug5, + //0, this, or below, needs to be activated..not sure which yet evolving, + //0, this, or above, needs to be activated..not sure which yet loregroup, evolvedlevel, 0, @@ -1078,56 +1079,72 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, - inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), - inst->GetAugmentItemID(2), - inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), - inst->GetAugmentItemID(5), + aug0, + aug1, + aug2, + aug3, + aug4, + aug5, evolving, loregroup, evolvedlevel, 0, hash - ); + ); } else if (GetClientVersion() >= EQClientSoF) { MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, - inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), - inst->GetAugmentItemID(2), - inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), + aug0, + aug1, + aug2, + aug3, + aug4, evolving, loregroup, evolvedlevel, 0, hash - ); + ); } else { MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", 0, item->ID, - inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), - inst->GetAugmentItemID(2), - inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), + aug0, + aug1, + aug2, + aug3, + aug4, evolving, loregroup, evolvedlevel, hash - ); + ); } return true; } +bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { + if (!inst) + return false; + + return MakeItemLink( + ret_link, + inst->GetItem(), + inst->GetAugmentItemID(0), + inst->GetAugmentItemID(1), + inst->GetAugmentItemID(2), + inst->GetAugmentItemID(3), + inst->GetAugmentItemID(4), + inst->GetAugmentItemID(5) + ); +} + int Client::GetItemLinkHash(const ItemInst* inst) { //pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc //Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145 diff --git a/zone/npc.cpp b/zone/npc.cpp index d52365f72..af8a013a3 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -500,36 +500,28 @@ void NPC::ClearItemList() { itemlist.clear(); } -void NPC::QueryLoot(Client* to) { - int x = 0; +void NPC::QueryLoot(Client* to) +{ to->Message(0, "Coin: %ip %ig %is %ic", platinum, gold, silver, copper); - ItemList::iterator cur,end; - cur = itemlist.begin(); - end = itemlist.end(); - for(; cur != end; ++cur) { + int x = 0; + for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); - if (item) - if (to->GetClientVersion() >= EQClientRoF2) - { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (*cur)->min_level, (*cur)->max_level, (int)item->ID, 0x12, item->ID, item->Name, 0x12); - } - else if (to->GetClientVersion() >= EQClientRoF) - { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else if (to->GetClientVersion() >= EQClientSoF) - { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else - { - to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else + if (item == nullptr) { LogFile->write(EQEMuLog::Error, "Database error, invalid item"); - x++; + continue; + } + + char* itemLinkCore = nullptr; + std::string itemLink; + + to->MakeItemLink(itemLinkCore, item); + itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, item->Name, 0x12) : "null"); + to->Message(0, "%s, ID: %u, Level: (min: , max: )", itemLink.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); + + safe_delete_array(itemLinkCore); } + to->Message(0, "%i items on %s.", x, GetName()); } From 270fe3389c0933f9e1034ed178df724afece1727 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 25 Dec 2014 11:04:01 -0500 Subject: [PATCH 0700/1883] Updated item/say links for all clients. They should be a little easier to keep track of now. --- changelog.txt | 3 ++ zone/bot.cpp | 100 ++++++++++-------------------------- zone/client.h | 15 +++--- zone/command.cpp | 75 ++++++++++++++------------- zone/inventory.cpp | 125 +++++++++++++++++++++++++++++++++------------ zone/npc.cpp | 2 +- zone/questmgr.cpp | 34 +++++++----- zone/tasks.cpp | 77 +++++++++------------------- 8 files changed, 213 insertions(+), 218 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0c9bed583..b7d8e0fe0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/25/2014 == +Uleat: Updated 'links' code for all clients + == 12/24/2014 == Trevius: (RoF+) Added herosforgemodel field to the npc_types table. Trevius: (RoF2) Updated item links from #npcstat command output. diff --git a/zone/bot.cpp b/zone/bot.cpp index 4cb5c0dc5..daab91900 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -11718,7 +11718,7 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { c->Message(13, "Database Error: %s", TempErrorMessage.c_str()); return; } - if(item2 == 0) { + if(item2 == nullptr) { c->Message(15, "I need something for my %s (Item %i)", equipped[i], i); continue; } @@ -11726,79 +11726,31 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { is2Hweapon = true; } - char* itemLink = 0; - if((i == MainCharm) || (i == MainRange) || (i == MainPrimary) || (i == MainSecondary) || (i == MainAmmo)) { - if (c->GetClientVersion() >= EQClientSoF) - { - MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - 0, - item2->ID, - item1->GetAugmentItemID(0), - item1->GetAugmentItemID(1), - item1->GetAugmentItemID(2), - item1->GetAugmentItemID(3), - item1->GetAugmentItemID(4), - 0, - 0, - 0, - 0, - 0 - ); - c->Message(15, "Using %c%s%s%c in my %s (Item %i)", 0x12, itemLink, item2->Name, 0x12, equipped[i], i); - } - else - { - MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", - 0, - item2->ID, - item1->GetAugmentItemID(0), - item1->GetAugmentItemID(1), - item1->GetAugmentItemID(2), - item1->GetAugmentItemID(3), - item1->GetAugmentItemID(4), - 0, - 0, - 0, - 0); - c->Message(15, "Using %c%s%s%c in my %s (Item %i)", 0x12, itemLink, item2->Name, 0x12, equipped[i], i); - } - } - else { - if (c->GetClientVersion() >= EQClientSoF) - { - MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - 0, - item2->ID, - item1->GetAugmentItemID(0), - item1->GetAugmentItemID(1), - item1->GetAugmentItemID(2), - item1->GetAugmentItemID(3), - item1->GetAugmentItemID(4), - 0, - 0, - 0, - 0, - 0 - ); - c->Message(15, "Using %c%s%s%c in my %s (Item %i)", 0x12, itemLink, item2->Name, 0x12, equipped[i], i); - } - else - { - MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", - 0, - item2->ID, - item1->GetAugmentItemID(0), - item1->GetAugmentItemID(1), - item1->GetAugmentItemID(2), - item1->GetAugmentItemID(3), - item1->GetAugmentItemID(4), - 0, - 0, - 0, - 0); - c->Message(15, "Using %c%s%s%c in my %s (Item %i)", 0x12, itemLink, item2->Name, 0x12, equipped[i], i); - } - } + char* link_core = nullptr; + std::string link_base; + + // I could not find a difference between the criteria positive code and the criteria negative code.. + // ..so, I deleted the check (criteria: i = { MainCharm, MainRange, MainPrimary, MainSecondary, MainAmmo }) + + c->MakeItemLink( + link_core, + item2, + item1->GetAugmentItemID(0), + item1->GetAugmentItemID(1), + item1->GetAugmentItemID(2), + item1->GetAugmentItemID(3), + item1->GetAugmentItemID(4), + item1->GetAugmentItemID(5) + ); + + if (link_core) + link_base = StringFormat("%c%s%s%c", 0x12, link_core, item2->Name, 0x12); + else + link_base = ""; + + c->Message(15, "Using %s in my %s (Item %i)", link_base.c_str(), equipped[i], i); + + safe_delete_array(link_core); } } else { diff --git a/zone/client.h b/zone/client.h index 5730cae86..c88971dd4 100644 --- a/zone/client.h +++ b/zone/client.h @@ -815,8 +815,11 @@ public: void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); - bool MakeItemLink(char* &ret_link, const Item_Struct* item, uint32 aug0=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0); + bool MakeItemLink(char* &ret_link, const Item_Struct* item, uint32 aug0=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, uint8 evolving=0, uint8 evolvedlevel=0); bool MakeItemLink(char* &ret_link, const ItemInst* inst); + bool MakeTaskLink(char* &ret_link); + bool MakeBlankLink(char* &ret_link); + static bool MakeBlankLink_(char* &ret_link); int GetItemLinkHash(const ItemInst* inst); void SendItemLink(const ItemInst* inst, bool sendtoall=false); void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); @@ -834,11 +837,11 @@ public: bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} -int32 GetHunger() const { return m_pp.hunger_level; } -int32 GetThirst() const { return m_pp.thirst_level; } -void SetHunger(int32 in_hunger); -void SetThirst(int32 in_thirst); -void SetConsumption(int32 in_hunger, int32 in_thirst); + int32 GetHunger() const { return m_pp.hunger_level; } + int32 GetThirst() const { return m_pp.thirst_level; } + void SetHunger(int32 in_hunger); + void SetThirst(int32 in_thirst); + void SetConsumption(int32 in_hunger, int32 in_thirst); bool CheckTradeLoreConflict(Client* other); void LinkDead(); diff --git a/zone/command.cpp b/zone/command.cpp index 1d8f99694..6c95d0800 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5632,75 +5632,74 @@ void command_givemoney(Client *c, const Seperator *sep) void command_itemsearch(Client *c, const Seperator *sep) { - if (sep->arg[1][0] == 0) + if (sep->arg[1][0] == 0) { c->Message(0, "Usage: #itemsearch [search string]"); + } else { const char *search_criteria=sep->argplus[1]; - const Item_Struct* item = 0; + const Item_Struct* item = nullptr; if (Seperator::IsNumber(search_criteria)) { item = database.GetItem(atoi(search_criteria)); - if (item) - if (c->GetClientVersion() >= EQClientRoF2) - { - c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (int)item->ID, 0x12, item->ID, item->Name, 0x12); - } - else if (c->GetClientVersion() >= EQClientRoF) - { - c->Message(0, " %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else if (c->GetClientVersion() >= EQClientSoF) - { - c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } + if (item) { + char* link_core = nullptr; + std::string link_base; + + c->MakeItemLink(link_core, item); + + if (link_core) + link_base = StringFormat("%c%s%s%c", 0x12, link_core, item->Name, 0x12); else - { - c->Message(0, " %i: %c%06X000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else + link_base = ""; + + c->Message(0, "%i: %s", (int)item->ID, link_base.c_str()); + + safe_delete_array(link_core); + } + else { c->Message(0, "Item #%s not found", search_criteria); + } + return; } - int count = 0; + int count = NOT_USED; char sName[64]; char sCriteria[255]; strn0cpy(sCriteria, search_criteria, sizeof(sCriteria)); strupr(sCriteria); char* pdest; - uint32 it = 0; + uint32 it = NOT_USED; while ((item = database.IterateItems(&it))) { strn0cpy(sName, item->Name, sizeof(sName)); strupr(sName); pdest = strstr(sName, sCriteria); if (pdest != nullptr) { - if (c->GetClientVersion() >= EQClientRoF2) - { - c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000000000%s%c", (int)item->ID, 0x12, item->ID, item->Name, 0x12); - } - else if (c->GetClientVersion() >= EQClientRoF) - { - c->Message(0, " %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } - else if (c->GetClientVersion() >= EQClientSoF) - { - c->Message(0, " %i: %c%06X00000000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } + char* link_core = nullptr; + std::string link_base; + + c->MakeItemLink(link_core, item); + + if (link_core) + link_base = StringFormat("%c%s%s%c", 0x12, link_core, item->Name, 0x12); else - { - c->Message(0, " %i: %c%06X000000000000000000000000000000000000000%s%c",(int) item->ID,0x12, item->ID, item->Name, 0x12); - } - count++; + link_base = ""; + + c->Message(0, "%i: %s", (int)item->ID, link_base.c_str()); + + safe_delete_array(link_core); + ++count; } + if (count == 50) break; } + if (count == 50) c->Message(0, "50 items shown...too many results."); else c->Message(0, "%i items found", count); - } } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 80d48309c..0ccd29611 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1027,7 +1027,7 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) } } -bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) { +bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { //we're sending back the entire "link", minus the null characters & item name //that way, we can use it for regular links & Task links //note: initiator needs to pass us ret_link @@ -1049,13 +1049,19 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, //length: //1 5 5 5 5 5 5 1 4 1 8 = 45 //evolving item info: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145#558 - uint8 evolving = 0; - uint16 loregroup = 0; - uint8 evolvedlevel = 0; - int hash = 0; + //int hash = GetItemLinkHash(inst); //eventually this will work (currently crashes zone), but for now we'll skip the extra overhead - if (GetClientVersion() >= EQClientRoF2) - { + int hash = NOT_USED; + + // Tested with UF and RoF..there appears to be a problem with using non-augment arguments below... + // Currently, enabling them causes misalignments in what the client expects. I haven't looked + // into it further to determine the cause..but, the function is setup to accept the parameters. + // Note: some links appear with '00000' in front of the name..so, it's likely we need to send + // some additional information when certain parameters are true -U + switch (GetClientVersion()) { + case EQClientRoF2: + // This operator contains 14 parameter masks..but, only 13 parameter values. + // Even so, the client link appears ok... Need to figure out the discrepancy -U MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, @@ -1065,17 +1071,14 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, aug3, aug4, aug5, - //0, this, or below, needs to be activated..not sure which yet - evolving, - //0, this, or above, needs to be activated..not sure which yet - loregroup, - evolvedlevel, + 0,//evolving, + 0,//item->LoreGroup, + 0,//evolvedlevel, 0, hash ); - } - else if (GetClientVersion() >= EQClientRoF) - { + return true; + case EQClientRoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, @@ -1085,15 +1088,16 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, aug3, aug4, aug5, - evolving, - loregroup, - evolvedlevel, + 0,//evolving, + 0,//item->LoreGroup, + 0,//evolvedlevel, 0, hash ); - } - else if (GetClientVersion() >= EQClientSoF) - { + return true; + case EQClientUnderfoot: + case EQClientSoD: + case EQClientSoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 0, item->ID, @@ -1102,15 +1106,14 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, aug2, aug3, aug4, - evolving, - loregroup, - evolvedlevel, + 0,//evolving, + 0,//item->LoreGroup, + 0,//evolvedlevel, 0, hash ); - } - else - { + return true; + case EQClientTitanium: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", 0, item->ID, @@ -1119,14 +1122,16 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, aug2, aug3, aug4, - evolving, - loregroup, - evolvedlevel, + 0,//evolving, + 0,//item->LoreGroup, + 0,//evolvedlevel, hash ); + return true; + case EQClient62: + default: + return false; } - - return true; } bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { @@ -1141,10 +1146,64 @@ bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { inst->GetAugmentItemID(2), inst->GetAugmentItemID(3), inst->GetAugmentItemID(4), - inst->GetAugmentItemID(5) + inst->GetAugmentItemID(5), + inst->IsEvolving(), + inst->GetEvolveLvl() ); } +bool Client::MakeTaskLink(char* &ret_link) +{ + switch (GetClientVersion()) { + case EQClientRoF2: + MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000014505DC2"); + return true; + case EQClientRoF: + MakeAnyLenString(&ret_link, "0000000000000000000000000000000000000000014505DC2"); + return true; + case EQClientUnderfoot: + case EQClientSoD: + case EQClientSoF: + MakeAnyLenString(&ret_link, "00000000000000000000000000000000000014505DC2"); + return true; + case EQClientTitanium: + MakeAnyLenString(&ret_link, "000000000000000000000000000000014505DC2"); + return true; + case EQClient62: + default: + return false; + } +} + +bool Client::MakeBlankLink(char* &ret_link) +{ + switch (GetClientVersion()) { + case EQClientRoF2: + MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000000000"); + return true; + case EQClientRoF: + MakeAnyLenString(&ret_link, "0000000000000000000000000000000000000000000000000"); + return true; + case EQClientUnderfoot: + case EQClientSoD: + case EQClientSoF: + MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000"); + return true; + case EQClientTitanium: + MakeAnyLenString(&ret_link, "000000000000000000000000000000000000000"); + return true; + case EQClient62: + default: + return false; + } +} + +bool Client::MakeBlankLink_(char* &ret_link) +{ + MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000000000"); // should be same as newest/longest client in local operator + return true; +} + int Client::GetItemLinkHash(const ItemInst* inst) { //pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc //Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145 diff --git a/zone/npc.cpp b/zone/npc.cpp index af8a013a3..ad96af1c4 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -517,7 +517,7 @@ void NPC::QueryLoot(Client* to) to->MakeItemLink(itemLinkCore, item); itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, item->Name, 0x12) : "null"); - to->Message(0, "%s, ID: %u, Level: (min: , max: )", itemLink.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); + to->Message(0, "%s, ID: %u, Level: (min: %u, max: %u)", itemLink.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); safe_delete_array(itemLinkCore); } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index eb901d92d..269f7b916 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2468,6 +2468,7 @@ const char* QuestManager::varlink(char* perltext, int item_id) { return "INVALID ITEM ID IN VARLINK"; char* link = 0; char* tempstr = 0; + // already uses Client::operator-based item link method if (initiator->MakeItemLink(link, inst)) { // make a link to the item snprintf(perltext, 250, "%c%s%s%c", 0x12, link, inst->GetItem()->Name, 0x12); } @@ -2658,24 +2659,33 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam sayid = sayid + 500000; //Create the say link as an item link hash - char linktext[250]; + char* link_core = nullptr; + std::string say_link; if (initiator) { - if (initiator->GetClientVersion() >= EQClientRoF2) - sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000000000", LinkName, 0x12); - else if (initiator->GetClientVersion() >= EQClientRoF) - sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "0000000000000000000000000000000000000000000000000", LinkName, 0x12); - else if (initiator->GetClientVersion() >= EQClientSoF) - sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000", LinkName, 0x12); + initiator->MakeBlankLink(link_core); + + if (link_core) + say_link = StringFormat("%c%06x%s%s%c", 0x12, sayid, link_core, LinkName, 0x12); else - sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "000000000000000000000000000000000000000", LinkName, 0x12); - } else { // If no initiator, create an RoF2 saylink, since older clients handle RoF2 ones better than RoF2 handles older ones. - sprintf(linktext, "%c%06X%s%s%c", 0x12, sayid, "00000000000000000000000000000000000000000000000000", LinkName, 0x12); + say_link = ""; + + safe_delete_array(link_core); + } + else { // If no initiator, create an RoF2 saylink, since older clients handle RoF2 ones better than RoF2 handles older ones. + Client::MakeBlankLink_(link_core); // Note: this is a global operator } - strcpy(Phrase,linktext); - return Phrase; + if (say_link.length() > 250) + strcpy(Phrase, ""); + else if (say_link.length() == 0) + strcpy(Phrase, ""); + else + strcpy(Phrase, say_link.c_str()); + // Why do we have '(char*)Phrase' as an argument and then return it? + // The current behavior of this function doesn't allow recursive action + return Phrase; } const char* QuestManager::getguildnamebyid(int guild_id) { diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 1e73e3150..e0e96d70c 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2743,17 +2743,17 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta } } -void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceNumber, int StartTime, int Duration, bool BringUpTaskJournal) { - - - if((TaskID<1) || (TaskID>=MAXTASKS) || !Tasks[TaskID]) return; +void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceNumber, int StartTime, int Duration, bool BringUpTaskJournal) +{ + if ((TaskID < 1) || (TaskID >= MAXTASKS) || !Tasks[TaskID]) + return; int PacketLength = sizeof(TaskDescriptionHeader_Struct) + strlen(Tasks[TaskID]->Title) + 1 + sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1 + sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct); std::string RewardText; - int ItemID = 0; + int ItemID = NOT_USED; // If there is an item make the Reward text into a link to the item (only the first item if a list // is specified). I have been unable to get multiple item links to work. @@ -2768,62 +2768,31 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN if(ItemID < 0) ItemID = 0; } + if(ItemID) { - char *RewardTmp = 0; - if(strlen(Tasks[TaskID]->Reward) != 0) { + char* link_core = nullptr; + std::string reward_link; - switch(c->GetClientVersion()) { - case EQClientTitanium: - { - MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); - break; - } - case EQClientRoF: - { - MakeAnyLenString(&RewardTmp, "%c%06X0000000000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); - break; - } - default: - { - // All clients after Titanium - MakeAnyLenString(&RewardTmp, "%c%06X00000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Tasks[TaskID]->Reward,0x12); - } - } + c->MakeTaskLink(link_core); + if (link_core && (strlen(Tasks[TaskID]->Reward) != 0)) { + reward_link = StringFormat("%c%06x%s%s%c", 0x12, ItemID, link_core, Tasks[TaskID]->Reward, 0x12); + } + else if (link_core) { + const Item_Struct* Item = database.GetItem(ItemID); + if (Item) + reward_link = StringFormat("%c%06x%s%s%c", 0x12, ItemID, link_core, Item->Name, 0x12); + else + reward_link = ""; } else { - const Item_Struct *Item = database.GetItem(ItemID); - - if(Item) { - - switch(c->GetClientVersion()) { - case EQClientTitanium: - { - MakeAnyLenString(&RewardTmp, "%c%06X000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); - break; - } - case EQClientRoF: - { - MakeAnyLenString(&RewardTmp, "%c%06X0000000000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); - break; - } - default: - { - // All clients after Titanium - MakeAnyLenString(&RewardTmp, "%c%06X00000000000000000000000000000000000014505DC2%s%c", - 0x12, ItemID, Item->Name ,0x12); - } - } - } + reward_link = ""; } - if(RewardTmp) RewardText += RewardTmp; - safe_delete_array(RewardTmp); + if(reward_link.length() != 0) + RewardText += reward_link.c_str(); + + safe_delete_array(link_core); } else { RewardText += Tasks[TaskID]->Reward; From d9dc2eb4e348441cf022e026c68c5762153ec00f Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 25 Dec 2014 21:45:38 -0500 Subject: [PATCH 0701/1883] Thought something looked like it was missing! --- zone/questmgr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 269f7b916..fbf4586bc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2669,13 +2669,14 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam say_link = StringFormat("%c%06x%s%s%c", 0x12, sayid, link_core, LinkName, 0x12); else say_link = ""; - - safe_delete_array(link_core); } else { // If no initiator, create an RoF2 saylink, since older clients handle RoF2 ones better than RoF2 handles older ones. Client::MakeBlankLink_(link_core); // Note: this is a global operator + say_link = StringFormat("%c%06x%s%s%c", 0x12, sayid, link_core, LinkName, 0x12); } + safe_delete_array(link_core); + if (say_link.length() > 250) strcpy(Phrase, ""); else if (say_link.length() == 0) From 47e98a4b62744e578bf6135fd4d7011645d873c2 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 26 Dec 2014 00:11:51 -0600 Subject: [PATCH 0702/1883] Fixed Mercenaries so they can spawn again after table field renames from recent change. --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + ...014_12_26_merc_weaponinfo_table_update.sql | 69 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 utils/sql/git/required/2014_12_26_merc_weaponinfo_table_update.sql diff --git a/common/version.h b/common/version.h index f1218e73f..868fe9be3 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9064 +#define CURRENT_BINARY_DATABASE_VERSION 9065 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 61ab5e3d9..474e317d0 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -318,6 +318,7 @@ 9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty| 9063|2014_12_24_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'd_melee_texture1'|empty| 9064|2014_12_24_npc_types_table_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'herosforgemodel'|empty| +9065|2014_12_26_merc_weaponinfo_table_update.sql|SHOW COLUMNS FROM `vwMercNpcTypes` LIKE 'd_melee_texture1'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_26_merc_weaponinfo_table_update.sql b/utils/sql/git/required/2014_12_26_merc_weaponinfo_table_update.sql new file mode 100644 index 000000000..3c8d291bb --- /dev/null +++ b/utils/sql/git/required/2014_12_26_merc_weaponinfo_table_update.sql @@ -0,0 +1,69 @@ +/* Drop the current Merc View */ +DROP VIEW vwMercNpcTypes; + +/* Rename fields to match the source changes */ +ALTER TABLE `merc_weaponinfo` CHANGE `d_meele_texture1` `d_melee_texture1` INT(11) NOT NULL DEFAULT 0; +ALTER TABLE `merc_weaponinfo` CHANGE `d_meele_texture2` `d_melee_texture2` INT(11) NOT NULL DEFAULT 0; + +/* Re-Create the Merc View with new field names */ +CREATE VIEW vwMercNpcTypes AS +SELECT + ms.merc_npc_type_id, + '' AS name, + ms.clientlevel, + ms.level, + mtyp.race_id, + mstyp.class_id, + ms.hp, + ms.mana, + 0 AS gender, + mai.texture, + mai.helmtexture, + ms.attack_speed, + ms.STR, + ms.STA, + ms.DEX, + ms.AGI, + ms._INT, + ms.WIS, + ms.CHA, + ms.MR, + ms.CR, + ms.DR, + ms.FR, + ms.PR, + ms.Corrup, + ms.mindmg, + ms.maxdmg, + ms.attack_count, + ms.special_abilities AS special_abilities, + mwi.d_melee_texture1, + mwi.d_melee_texture2, + mwi.prim_melee_type, + mwi.sec_melee_type, + ms.runspeed, + ms.hp_regen_rate, + ms.mana_regen_rate, + 1 AS bodytype, + mai.armortint_id, + mai.armortint_red, + mai.armortint_green, + mai.armortint_blue, + ms.AC, + ms.ATK, + ms.Accuracy, + ms.spellscale, + ms.healscale +FROM merc_stats ms +INNER JOIN merc_armorinfo mai +ON ms.merc_npc_type_id = mai.merc_npc_type_id +AND mai.minlevel <= ms.level AND mai.maxlevel >= ms.level +INNER JOIN merc_weaponinfo mwi +ON ms.merc_npc_type_id = mwi.merc_npc_type_id +AND mwi.minlevel <= ms.level AND mwi.maxlevel >= ms.level +INNER JOIN merc_templates mtem +ON mtem.merc_npc_type_id = ms.merc_npc_type_id +INNER JOIN merc_types mtyp +ON mtem.merc_type_id = mtyp.merc_type_id +INNER JOIN merc_subtypes mstyp +ON mtem.merc_subtype_id = mstyp.merc_subtype_id; \ No newline at end of file From d7b529d2affd0bcbc5d80f472e8543db9a327d4e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 01:07:58 -0600 Subject: [PATCH 0703/1883] Add option to automatic database upgrade script 5) Download latest Opcodes from Github --- changelog.txt | 19 ++----------------- utils/scripts/db_update.pl | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0c9bed583..9f28691c3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,22 +1,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 12/24/2014 == -Trevius: (RoF+) Added herosforgemodel field to the npc_types table. -Trevius: (RoF2) Updated item links from #npcstat command output. -Trevius: (RoF+) Implemented Hero's Forge Armor for NPCs. Set the herosforgemodel field in npc_types table to the model (example: 84 for full set, or 12107 for robe). -Trevius: (RoF+) Hero's Forge Armor now overrides NPC texture settings. To display Hero's Forge Armor Helms, set helmtexture field to anything other than 0. - -== 12/23/2014 == -Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. -Trevius: (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc. - -== 12/22/2014 == -Trevius: (RoF2) Fixed Tracking. -Trevius: (RoF+) Added a work-around for the cursor buffer issue. - -== 12/21/2014 == -Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. -Trevius: (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone. +== 12/27/2014 == +Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github == 12/20/2014 == Akkadius: Updated #cvs to display RoF2 Client Stream count diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index bf92ce60f..be1285fe4 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -155,6 +155,7 @@ sub ShowMenuPrompt { 2 => \&database_dump_compress, 3 => \&Run_Database_Check, 4 => \&AA_Fetch, + 5 => \&OpCodes_Fetch, 0 => \&Exit, ); @@ -204,6 +205,7 @@ Database Management Menu (Please Select): Ideal to perform before performing updates 3) $option[3] 4) AAs - Get Latest AA's from PEQ (This deletes AA's already in the database) + 5) OPCodes - Download latest opcodes from repository 0) Exit EO_MENU @@ -305,6 +307,36 @@ sub AA_Fetch{ print "\nDone...\n\n"; } +#::: Fetch Latest Opcodes +sub OpCodes_Fetch{ + print "Pulling down latest opcodes...\n"; + %opcodes = ( + 1 => ["opcodes", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/opcodes.conf"], + 2 => ["mail_opcodes", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/mail_opcodes.conf"], + 3 => ["Titanium", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_Titanium.conf"], + 4 => ["Secrets of Faydwer", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_SoF.conf"], + 5 => ["Seeds of Destruction", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_SoD.conf"], + 6 => ["Underfoot", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_Underfoot.conf"], + 7 => ["Rain of Fear", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_RoF.conf"], + 8 => ["Rain of Fear 2", "https://raw.githubusercontent.com/EQEmu/Server/master/utils/patches/patch_RoF2.conf"], + ); + $loop = 1; + while($opcodes{$loop}[0]){ + #::: Split the URL by the patches folder to get the file name from URL + @real_file = split("patches/", $opcodes{$loop}[1]); + $find = 0; + while($real_file[$find]){ + $file_name = $real_file[$find]; + $find++; + } + + print "\nDownloading (" . $opcodes{$loop}[0] . ") File: '" . $file_name . "'...\n\n"; + GetRemoteFile($opcodes{$loop}[1], $file_name); + $loop++; + } + print "\nDone...\n\n"; +} + #::: Responsible for Database Upgrade Routines sub Run_Database_Check{ #::: Run 2 - Running pending updates... From b63dbd50a880055030ab09b5a97fa59a0fb9e60b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 01:09:14 -0600 Subject: [PATCH 0704/1883] Fix changelog.txt merge --- changelog.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/changelog.txt b/changelog.txt index 9f28691c3..4efeac259 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,24 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 12/27/2014 == Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github +== 12/24/2014 == +Trevius: (RoF+) Added herosforgemodel field to the npc_types table. +Trevius: (RoF2) Updated item links from #npcstat command output. +Trevius: (RoF+) Implemented Hero's Forge Armor for NPCs. Set the herosforgemodel field in npc_types table to the model (example: 84 for full set, or 12107 for robe). +Trevius: (RoF+) Hero's Forge Armor now overrides NPC texture settings. To display Hero's Forge Armor Helms, set helmtexture field to anything other than 0. + +== 12/23/2014 == +Uleat: Tidied up some ItemInst* declarations and added some nullptr checks. +Trevius: (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc. + +== 12/22/2014 == +Trevius: (RoF2) Fixed Tracking. +Trevius: (RoF+) Added a work-around for the cursor buffer issue. + +== 12/21/2014 == +Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes. +Trevius: (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone. + == 12/20/2014 == Akkadius: Updated #cvs to display RoF2 Client Stream count From 05c943779d236f2ae09e4ea3f603802289378e07 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 27 Dec 2014 15:46:30 -0600 Subject: [PATCH 0705/1883] (RoF2) Fixed dropping items on the ground so they go to ground level instead of camera height. Show Helm Option should be functional again. --- changelog.txt | 2 ++ common/patches/rof2.cpp | 20 ++++++++++---------- zone/client.cpp | 39 +-------------------------------------- zone/object.cpp | 10 +++++++++- 4 files changed, 22 insertions(+), 49 deletions(-) diff --git a/changelog.txt b/changelog.txt index 4efeac259..3044a44cf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/27/2014 == Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github +Trevius: (RoF2) Fixed dropping items on the ground so they go to ground level instead of camera height. +Trevius: Show Helm Option should be functional again. == 12/24/2014 == Trevius: (RoF+) Added herosforgemodel field to the npc_types table. diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index c57266f0a..8de5dd427 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1994,17 +1994,17 @@ namespace RoF2 outapp->WriteUInt32(emu->drakkin_tattoo); outapp->WriteUInt32(emu->drakkin_details); - outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt8(0); // Unknown - outapp->WriteUInt8(0); // Unknown + outapp->WriteUInt8(0); // Unknown 0 + outapp->WriteUInt8(0xff); // Unknown 0xff + outapp->WriteUInt8(1); // Unknown 1 + outapp->WriteUInt8(0xff); // Unknown 0xff + outapp->WriteUInt8(1); // Unknown 1 - outapp->WriteFloat(5.0f); // Height ? + outapp->WriteFloat(5.0f); // Height - outapp->WriteFloat(3.0f); // Unknown - outapp->WriteFloat(2.5f); // Unknown - outapp->WriteFloat(5.5f); // Unknown + outapp->WriteFloat(3.0f); // Unknown 3.0 + outapp->WriteFloat(2.5f); // Unknown 2.5 + outapp->WriteFloat(5.5f); // Unknown 5.5 outapp->WriteUInt32(0); // Primary ? outapp->WriteUInt32(0); // Secondary ? @@ -2330,7 +2330,7 @@ namespace RoF2 outapp->WriteUInt64(emu->exp); // int32 in client - outapp->WriteUInt8(0); // Unknown - Seen 5 on Live + outapp->WriteUInt8(5); // Unknown - Seen 5 on Live - Eye Height? outapp->WriteUInt32(emu->platinum_bank); outapp->WriteUInt32(emu->gold_bank); diff --git a/zone/client.cpp b/zone/client.cpp index 32f64abfb..e25aec69a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1817,45 +1817,8 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) } ns->spawn.size = 0; // Changing size works, but then movement stops! (wth?) ns->spawn.runspeed = (gmspeed == 0) ? runspeed : 3.125f; - if (!m_pp.showhelm) ns->spawn.showhelm = 0; + ns->spawn.showhelm = m_pp.showhelm ? 1 : 0; - /* - // Equipment/Weapons already set from Mob::FillSpawnStruct - // Commenting this out for now - const Item_Struct* item = nullptr; - const ItemInst* inst = nullptr; - int16 invslot; - - for (uint32 matslot = 0; matslot < _MaterialCount; matslot++) - { - // Only Player Races Wear Armor - if (IsPlayerRace(race) || matslot > 6) - { - invslot = Inventory::CalcSlotFromMaterial(matslot); - if (invslot == INVALID_INDEX) - continue; - - if ((inst = m_inv[invslot]) && inst->IsType(ItemClassCommon)) - { - item = inst->GetItem(); - - if (matslot > 6) - { - // Weapon Models - ns->spawn.equipment[matslot].material = GetEquipmentMaterial(matslot); - } - else - { - // Armor Materials/Models - ns->spawn.equipment[matslot].material = item->Material; - ns->spawn.equipment[matslot].elitematerial = item->EliteMaterial; - ns->spawn.equipment[matslot].heroforgemodel = GetHerosForgeModel(matslot); - ns->spawn.colors[matslot].color = m_pp.item_tint[matslot].rgb.use_tint ? m_pp.item_tint[matslot].color : item->Color; - } - } - } - } - */ } bool Client::GMHideMe(Client* client) { diff --git a/zone/object.cpp b/zone/object.cpp index fa7598d39..97832a6f8 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -118,7 +118,15 @@ Object::Object(Client* client, const ItemInst* inst) m_data.heading = client->GetHeading(); m_data.x = client->GetX(); m_data.y = client->GetY(); - m_data.z = client->GetZ(); + if (client->GetClientVersion() >= EQClientRoF2) + { + // RoF2 places items at player's Z, which is 0.625 of their height. + m_data.z = client->GetZ() - (client->GetSize() * 0.625f); + } + else + { + m_data.z = client->GetZ(); + } m_data.zone_id = zone->GetZoneID(); decay_timer.Start(); From 9666f1e25ede9d33b3861a4c2cc860fcfcfa6ad2 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sat, 27 Dec 2014 18:43:59 -0500 Subject: [PATCH 0706/1883] Implemened npc special ability (43) CASTING_RESIST_DIFF which sets innate resist modifier on ALL spells used by that NPC. Ie. 43,1,-200 will set a -200 innate resist diff, so if your npc cast a spell that has a -10 resist modifier the final resist diff would be -210. --- changelog.txt | 3 +++ zone/common.h | 3 ++- zone/spells.cpp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 3044a44cf..620bc75d1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github Trevius: (RoF2) Fixed dropping items on the ground so they go to ground level instead of camera height. Trevius: Show Helm Option should be functional again. +Kayen: Implemened npc special ability (43) CASTING_RESIST_DIFF which sets innate resist modifier on +ALL spells used by that NPC. Ie. 43,1,-200 will set a -200 innate resist diff, so if your npc cast +a spell that has a -10 resist modifier the final resist diff would be -210. == 12/24/2014 == Trevius: (RoF+) Added herosforgemodel field to the npc_types table. diff --git a/zone/common.h b/zone/common.h index aa24964fd..45f3bdb09 100644 --- a/zone/common.h +++ b/zone/common.h @@ -135,7 +135,8 @@ enum { NPC_CHASE_DISTANCE = 40, ALLOW_TO_TANK = 41, IGNORE_ROOT_AGGRO_RULES = 42, - MAX_SPECIAL_ATTACK = 43 + CASTING_RESIST_DIFF = 43, + MAX_SPECIAL_ATTACK = 44 }; typedef enum { //fear states diff --git a/zone/spells.cpp b/zone/spells.cpp index 02e99490d..f9d21dd9e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4206,6 +4206,10 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get resist modifier and adjust it based on focus 2 resist about eq to 1% resist chance int resist_modifier = (use_resist_override) ? resist_override : spells[spell_id].ResistDiff; + + if(caster->GetSpecialAbility(CASTING_RESIST_DIFF)) + resist_modifier += caster->GetSpecialAbilityParam(CASTING_RESIST_DIFF, 0); + int focus_resist = caster->GetFocusEffect(focusResistRate, spell_id); resist_modifier -= 2 * focus_resist; From 3a488e3a618366340af90fe164bf30c1d8afccdc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 18:24:42 -0600 Subject: [PATCH 0707/1883] Changed hate counter to uint32 to prevent negative rollback, this most likely can will be an issue but more uncommon Renamed and refactored most functions and variables in hate_list.h/cpp for readability Refactored how hate works in some local functions mixing the use of hate variable and split it out into different status variables hate_list.cpp/.h style cleanup hate_list.h header function sort, comment erase functions should clearly state their function --- zone/aggro.cpp | 2 +- zone/attack.cpp | 22 +- zone/bot.cpp | 10 +- zone/client_packet.cpp | 2 +- zone/entity.cpp | 12 +- zone/hate_list.cpp | 621 ++++++++++++++++++---------------------- zone/hate_list.h | 96 +++---- zone/lua_hate_list.cpp | 16 +- zone/lua_hate_list.h | 8 +- zone/lua_mob.cpp | 6 +- zone/merc.cpp | 6 +- zone/mob.cpp | 12 +- zone/mob.h | 26 +- zone/mob_ai.cpp | 18 +- zone/npc.h | 4 +- zone/perl_hateentry.cpp | 18 +- zone/perl_mob.cpp | 4 +- zone/spell_effects.cpp | 16 +- zone/spells.cpp | 8 +- 19 files changed, 413 insertions(+), 494 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 3e833aad9..a82586cb5 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -1298,7 +1298,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) { void Mob::RogueEvade(Mob *other) { int amount = other->GetHateAmount(this) - (GetLevel() * 13); - other->SetHate(this, std::max(1, amount)); + other->SetHateAmountOnEnt(this, std::max(1, amount)); return; } diff --git a/zone/attack.cpp b/zone/attack.cpp index deb0daf61..9be08e893 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1518,7 +1518,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } entity_list.RemoveFromTargets(this); - hate_list.RemoveEnt(this); + hate_list.RemoveEntFromHateList(this); RemoveAutoXTargets(); //remove ourself from all proximities @@ -2076,12 +2076,12 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (killerMob) { if(GetClass() != LDON_TREASURE) - hate_list.Add(killerMob, damage); + hate_list.AddEntToHateList(killerMob, damage); } safe_delete(app); - Mob *give_exp = hate_list.GetDamageTop(this); + Mob *give_exp = hate_list.GetDamageTopOnHateList(this); if(give_exp == nullptr) give_exp = killer; @@ -2488,7 +2488,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, && other && (buffs[spellbonuses.ImprovedTaunt[2]].casterid != other->GetID())) hate = (hate*spellbonuses.ImprovedTaunt[1])/100; - hate_list.Add(other, hate, damage, bFrenzy, !iBuffTic); + hate_list.AddEntToHateList(other, hate, damage, bFrenzy, !iBuffTic); if(other->IsClient()) other->CastToClient()->AddAutoXTarget(this); @@ -2500,8 +2500,8 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, AddFeignMemory(other->CastToBot()->GetBotOwner()->CastToClient()); } else { - if(!hate_list.IsOnHateList(other->CastToBot()->GetBotOwner())) - hate_list.Add(other->CastToBot()->GetBotOwner(), 0, 0, false, true); + if(!hate_list.IsEntOnHateList(other->CastToBot()->GetBotOwner())) + hate_list.AddEntToHateList(other->CastToBot()->GetBotOwner(), 0, 0, false, true); } } #endif //BOTS @@ -2512,8 +2512,8 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, AddFeignMemory(other->CastToMerc()->GetMercOwner()->CastToClient()); } else { - if(!hate_list.IsOnHateList(other->CastToMerc()->GetMercOwner())) - hate_list.Add(other->CastToMerc()->GetMercOwner(), 0, 0, false, true); + if(!hate_list.IsEntOnHateList(other->CastToMerc()->GetMercOwner())) + hate_list.AddEntToHateList(other->CastToMerc()->GetMercOwner(), 0, 0, false, true); } } //MERC @@ -2528,7 +2528,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, // owner must get on list, but he's not actually gained any hate yet if(!owner->GetSpecialAbility(IMMUNE_AGGRO)) { - hate_list.Add(owner, 0, 0, false, !iBuffTic); + hate_list.AddEntToHateList(owner, 0, 0, false, !iBuffTic); if(owner->IsClient()) owner->CastToClient()->AddAutoXTarget(this); } @@ -2537,10 +2537,10 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, if (mypet && (!(GetAA(aaPetDiscipline) && mypet->IsHeld()))) { // I have a pet, add other to it if(!mypet->IsFamiliar() && !mypet->GetSpecialAbility(IMMUNE_AGGRO)) - mypet->hate_list.Add(other, 0, 0, bFrenzy); + mypet->hate_list.AddEntToHateList(other, 0, 0, bFrenzy); } else if (myowner) { // I am a pet, add other to owner if it's NPC/LD if (myowner->IsAIControlled() && !myowner->GetSpecialAbility(IMMUNE_AGGRO)) - myowner->hate_list.Add(other, 0, 0, bFrenzy); + myowner->hate_list.AddEntToHateList(other, 0, 0, bFrenzy); } if (other->GetTempPetCount()) diff --git a/zone/bot.cpp b/zone/bot.cpp index 4cb5c0dc5..7b6081a93 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3422,9 +3422,9 @@ void Bot::AI_Process() { rest_timer.Disable(); if(IsRooted()) - SetTarget(hate_list.GetClosest(this)); + SetTarget(hate_list.GetClosestEntOnHateList(this)); else - SetTarget(hate_list.GetTop(this)); + SetTarget(hate_list.GetEntWithMostHateInRange(this)); if(!GetTarget()) return; @@ -3791,9 +3791,9 @@ void Bot::PetAIProcess() { if (IsEngaged()) { if (botPet->IsRooted()) - botPet->SetTarget(hate_list.GetClosest(botPet)); + botPet->SetTarget(hate_list.GetClosestEntOnHateList(botPet)); else - botPet->SetTarget(hate_list.GetTop(botPet)); + botPet->SetTarget(hate_list.GetEntWithMostHateInRange(botPet)); // Let's check if we have a los with our target. // If we don't, our hate_list is wiped. @@ -5854,7 +5854,7 @@ bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes att Save(); - Mob *give_exp = hate_list.GetDamageTop(this); + Mob *give_exp = hate_list.GetDamageTopOnHateList(this); Client *give_exp_client = nullptr; if(give_exp && give_exp->IsClient()) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 663e90803..f809fb3c8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5227,7 +5227,7 @@ void Client::Handle_OP_DeleteSpawn(const EQApplicationPacket *app) entity_list.QueueClients(this, outapp, false); safe_delete(outapp); - hate_list.RemoveEnt(this->CastToMob()); + hate_list.RemoveEntFromHateList(this->CastToMob()); Disconnect(); return; diff --git a/zone/entity.cpp b/zone/entity.cpp index 3bc191715..68f5bed87 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2434,7 +2434,7 @@ void EntityList::RemoveFromHateLists(Mob *mob, bool settoone) if (!settoone) it->second->RemoveFromHateList(mob); else - it->second->SetHate(mob, 1); + it->second->SetHateAmountOnEnt(mob, 1); } ++it; } @@ -2818,7 +2818,7 @@ void EntityList::DoubleAggro(Mob *who) auto it = npc_list.begin(); while (it != npc_list.end()) { if (it->second->CheckAggro(who)) - it->second->SetHate(who, it->second->CastToNPC()->GetHateAmount(who), + it->second->SetHateAmountOnEnt(who, it->second->CastToNPC()->GetHateAmount(who), it->second->CastToNPC()->GetHateAmount(who) * 2); ++it; } @@ -2829,7 +2829,7 @@ void EntityList::HalveAggro(Mob *who) auto it = npc_list.begin(); while (it != npc_list.end()) { if (it->second->CastToNPC()->CheckAggro(who)) - it->second->CastToNPC()->SetHate(who, it->second->CastToNPC()->GetHateAmount(who) / 2); + it->second->CastToNPC()->SetHateAmountOnEnt(who, it->second->CastToNPC()->GetHateAmount(who) / 2); ++it; } } @@ -2844,9 +2844,9 @@ void EntityList::Evade(Mob *who) amt = it->second->CastToNPC()->GetHateAmount(who); amt -= flatval; if (amt > 0) - it->second->CastToNPC()->SetHate(who, amt); + it->second->CastToNPC()->SetHateAmountOnEnt(who, amt); else - it->second->CastToNPC()->SetHate(who, 0); + it->second->CastToNPC()->SetHateAmountOnEnt(who, 0); } ++it; } @@ -3647,7 +3647,7 @@ void EntityList::AddTempPetsToHateList(Mob *owner, Mob* other, bool bFrenzy) if (n->GetSwarmInfo()) { if (n->GetSwarmInfo()->owner_id == owner->GetID()) { if (!n->GetSpecialAbility(IMMUNE_AGGRO)) - n->hate_list.Add(other, 0, 0, bFrenzy); + n->hate_list.AddEntToHateList(other, 0, 0, bFrenzy); } } ++it; diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 55def09fb..57ba135cd 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) This program is free software; you can redistribute it and/or modify @@ -45,431 +45,377 @@ HateList::~HateList() // added for frenzy support // checks if target still is in frenzy mode -void HateList::CheckFrenzyHate() +void HateList::IsEntityInFrenzyMode() { auto iterator = list.begin(); - while(iterator != list.end()) - { - if ((*iterator)->ent->GetHPRatio() >= 20) - (*iterator)->bFrenzy = false; + while (iterator != list.end()) { + if ((*iterator)->entity_on_hatelist->GetHPRatio() >= 20) { + (*iterator)->is_entity_frenzy = false; + } ++iterator; } } -void HateList::Wipe() +void HateList::WipeHateList() { auto iterator = list.begin(); - - while(iterator != list.end()) - { - Mob* m = (*iterator)->ent; - if(m) - { + while (iterator != list.end()) { + Mob* m = (*iterator)->entity_on_hatelist; + if (m) { parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); - - if(m->IsClient()) + if (m->IsClient()) { m->CastToClient()->DecrementAggroCount(); + } } delete (*iterator); iterator = list.erase(iterator); - } } -bool HateList::IsOnHateList(Mob *mob) +bool HateList::IsEntOnHateList(Mob *mob) { - if(Find(mob)) + if (Find(mob)) { return true; + } return false; } -tHateEntry *HateList::Find(Mob *ent) +struct_HateList *HateList::Find(Mob *ent) { auto iterator = list.begin(); - while(iterator != list.end()) - { - if((*iterator)->ent == ent) + while (iterator != list.end()) { + if ((*iterator)->entity_on_hatelist == ent) { return (*iterator); + } ++iterator; } return nullptr; } -void HateList::Set(Mob* other, uint32 in_hate, uint32 in_dam) +void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_damage) { - tHateEntry *p = Find(other); - if(p) - { - if(in_dam > 0) - p->damage = in_dam; - if(in_hate > 0) - p->hate = in_hate; + struct_HateList *hate_list = Find(other); + if (hate_list) { + if (in_damage > 0) { + hate_list->hatelist_damage = in_damage; + } + if (in_hate > 0) { + hate_list->stored_hate_amount = in_hate; + } } } -Mob* HateList::GetDamageTop(Mob* hater) +Mob* HateList::GetDamageTopOnHateList(Mob* hater) { Mob* current = nullptr; Group* grp = nullptr; Raid* r = nullptr; uint32 dmg_amt = 0; - auto iterator = list.begin(); - while(iterator != list.end()) - { + while (iterator != list.end()) { grp = nullptr; r = nullptr; - - if((*iterator)->ent && (*iterator)->ent->IsClient()){ - r = entity_list.GetRaidByClient((*iterator)->ent->CastToClient()); + if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) { + r = entity_list.GetRaidByClient((*iterator)->entity_on_hatelist->CastToClient()); } - - grp = entity_list.GetGroupByMob((*iterator)->ent); - - if((*iterator)->ent && r){ - if(r->GetTotalRaidDamage(hater) >= dmg_amt) - { - current = (*iterator)->ent; + grp = entity_list.GetGroupByMob((*iterator)->entity_on_hatelist); + if ((*iterator)->entity_on_hatelist && r) { + if (r->GetTotalRaidDamage(hater) >= dmg_amt) { + current = (*iterator)->entity_on_hatelist; dmg_amt = r->GetTotalRaidDamage(hater); } - } - else if ((*iterator)->ent != nullptr && grp != nullptr) - { - if (grp->GetTotalGroupDamage(hater) >= dmg_amt) - { - current = (*iterator)->ent; + } else if ((*iterator)->entity_on_hatelist != nullptr && grp != nullptr) { + if (grp->GetTotalGroupDamage(hater) >= dmg_amt) { + current = (*iterator)->entity_on_hatelist; dmg_amt = grp->GetTotalGroupDamage(hater); } - } - else if ((*iterator)->ent != nullptr && (uint32)(*iterator)->damage >= dmg_amt) - { - current = (*iterator)->ent; - dmg_amt = (*iterator)->damage; + } else if ((*iterator)->entity_on_hatelist != nullptr && (uint32)(*iterator)->hatelist_damage >= dmg_amt) { + current = (*iterator)->entity_on_hatelist; + dmg_amt = (*iterator)->hatelist_damage; } ++iterator; } return current; } -Mob* HateList::GetClosest(Mob *hater) { - Mob* close = nullptr; - float closedist = 99999.9f; - float thisdist; - +Mob* HateList::GetClosestEntOnHateList(Mob *hater) +{ + Mob* close_entity = nullptr; + float close_distance = 99999.9f; + float this_distance; auto iterator = list.begin(); - while(iterator != list.end()) { - thisdist = (*iterator)->ent->DistNoRootNoZ(*hater); - if((*iterator)->ent != nullptr && thisdist <= closedist) { - closedist = thisdist; - close = (*iterator)->ent; + while (iterator != list.end()) { + this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); + if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { + close_distance = this_distance; + close_entity = (*iterator)->entity_on_hatelist; } ++iterator; } - - if ((!close && hater->IsNPC()) || (close && close->DivineAura())) - close = hater->CastToNPC()->GetHateTop(); - - return close; + if ((!close_entity && hater->IsNPC()) || (close_entity && close_entity->DivineAura())) { + close_entity = hater->CastToNPC()->GetHateTop(); + } + return close_entity; } - -// a few comments added, rearranged code for readability -void HateList::Add(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist) +void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzy, bool iAddIfNotExist) { - if(!ent) + if (!in_entity) { return; - - if(ent->IsCorpse()) - return; - - if(ent->IsClient() && ent->CastToClient()->IsDead()) - return; - - tHateEntry *p = Find(ent); - if (p) - { - p->damage+=(in_dam>=0)?in_dam:0; - p->hate+=in_hate; - p->bFrenzy = bFrenzy; } - else if (iAddIfNotExist) { - p = new tHateEntry; - p->ent = ent; - p->damage = (in_dam>=0)?in_dam:0; - p->hate = in_hate; - p->bFrenzy = bFrenzy; - list.push_back(p); - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); - - if (ent->IsClient()) { - if (owner->CastToNPC()->IsRaidTarget()) - ent->CastToClient()->SetEngagedRaidTarget(true); - ent->CastToClient()->IncrementAggroCount(); + if (in_entity->IsCorpse()) { + return; + } + if (in_entity->IsClient() && in_entity->CastToClient()->IsDead()) { + return; + } + struct_HateList *hate_list = Find(in_entity); + if (hate_list) { + hate_list->hatelist_damage += (in_damage >= 0) ? in_damage : 0; + hate_list->stored_hate_amount += in_hate; + hate_list->is_entity_frenzy = in_is_entity_frenzy; + } else if (iAddIfNotExist) { + hate_list = new struct_HateList; + hate_list->entity_on_hatelist = in_entity; + hate_list->hatelist_damage = (in_damage >= 0) ? in_damage : 0; + hate_list->stored_hate_amount = in_hate; + hate_list->is_entity_frenzy = in_is_entity_frenzy; + list.push_back(hate_list); + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), in_entity, "1", 0); + if (in_entity->IsClient()) { + if (owner->CastToNPC()->IsRaidTarget()) { + in_entity->CastToClient()->SetEngagedRaidTarget(true); + } + in_entity->CastToClient()->IncrementAggroCount(); } } } -bool HateList::RemoveEnt(Mob *ent) +bool HateList::RemoveEntFromHateList(Mob *in_entity) { - if (!ent) + if (!in_entity) { return false; - + } bool found = false; auto iterator = list.begin(); - - while(iterator != list.end()) - { - if((*iterator)->ent == ent) - { - if(ent) - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); + while (iterator != list.end()) { + if ((*iterator)->entity_on_hatelist == in_entity) { + if (in_entity) { + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), in_entity, "0", 0); + } found = true; - - - if(ent && ent->IsClient()) - ent->CastToClient()->DecrementAggroCount(); - + if (in_entity && in_entity->IsClient()) { + in_entity->CastToClient()->DecrementAggroCount(); + } delete (*iterator); iterator = list.erase(iterator); - - } - else + } else { ++iterator; + } } return found; } -void HateList::DoFactionHits(int32 nfl_id) { - if (nfl_id <= 0) +void HateList::DoFactionHits(int32 npc_faction_level_id) +{ + if (npc_faction_level_id <= 0) { return; + } auto iterator = list.begin(); - while(iterator != list.end()) - { - Client *p; - - if ((*iterator)->ent && (*iterator)->ent->IsClient()) - p = (*iterator)->ent->CastToClient(); - else - p = nullptr; - - if (p) - p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity()); + while (iterator != list.end()) { + Client *client; + if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) { + client = (*iterator)->entity_on_hatelist->CastToClient(); + } else { + client = nullptr; + } + if (client) { + client->SetFactionLevel(client->CharacterID(), npc_faction_level_id, client->GetBaseClass(), client->GetBaseRace(), client->GetDeity()); + } ++iterator; } } -int HateList::SummonedPetCount(Mob *hater) { - - //Function to get number of 'Summoned' pets on a targets hate list to allow calculations for certian spell effects. - //Unclear from description that pets are required to be 'summoned body type'. Will not require at this time. +int HateList::GetSummonedPetCountOnHateList(Mob *hater) +{ int petcount = 0; auto iterator = list.begin(); - while(iterator != list.end()) { - - if((*iterator)->ent != nullptr && (*iterator)->ent->IsNPC() && ((*iterator)->ent->CastToNPC()->IsPet() || ((*iterator)->ent->CastToNPC()->GetSwarmOwner() > 0))) - { + while (iterator != list.end()) { + if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0))) { ++petcount; } - ++iterator; } - return petcount; } -Mob *HateList::GetTop(Mob *center) +Mob *HateList::GetEntWithMostHateInRange(Mob *entity_as_center) { - // hack fix for zone shutdown crashes on some servers - if (!zone->IsLoaded()) + /* Hack fix for zone shutdown crashes on some servers */ + if (!zone->IsLoaded()) { return nullptr; - - Mob* top = nullptr; - int32 hate = -1; + } - if(center == nullptr) + Mob* entity_with_most_hate = nullptr; + int32 hate_status = -1; + uint32 temp_hate_tracker = 0; + + if (entity_as_center == nullptr) { return nullptr; - - if (RuleB(Aggro,SmartAggroList)){ - Mob* topClientTypeInRange = nullptr; - int32 hateClientTypeInRange = -1; + } + if (RuleB(Aggro, SmartAggroList)) { + Mob* top_client_type_in_range = nullptr; + int32 hate_client_type_in_range = -1; int skipped_count = 0; - auto iterator = list.begin(); - while(iterator != list.end()) - { - tHateEntry *cur = (*iterator); - int16 aggroMod = 0; - - if(!cur){ + while (iterator != list.end()) { + struct_HateList *hate_list = (*iterator); + int16 aggro_mod = 0; + if (!hate_list) { ++iterator; continue; } - - if(!cur->ent){ + if (!hate_list->entity_on_hatelist) { ++iterator; continue; } - - if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + if (entity_as_center->IsNPC() && entity_as_center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if (!zone->watermap->InLiquid(hate_list->entity_on_hatelist->GetX(), hate_list->entity_on_hatelist->GetY(), hate_list->entity_on_hatelist->GetZ())) { skipped_count++; ++iterator; continue; } } - - if (cur->ent->Sanctuary()) { - if(hate == -1) - { - top = cur->ent; - hate = 1; + if (hate_list->entity_on_hatelist->Sanctuary()) { + if (hate_status == -1) { + entity_with_most_hate = hate_list->entity_on_hatelist; + hate_status = 1; } ++iterator; continue; } - - if(cur->ent->DivineAura() || cur->ent->IsMezzed() || cur->ent->IsFeared()){ - if(hate == -1) - { - top = cur->ent; - hate = 0; + if (hate_list->entity_on_hatelist->DivineAura() || hate_list->entity_on_hatelist->IsMezzed() || hate_list->entity_on_hatelist->IsFeared()) { + if (hate_status == -1) { + entity_with_most_hate = hate_list->entity_on_hatelist; + hate_status = 0; } ++iterator; continue; } - - int32 currentHate = cur->hate; - - if(cur->ent->IsClient()){ - - if(cur->ent->CastToClient()->IsSitting()){ - aggroMod += RuleI(Aggro, SittingAggroMod); + uint32 current_stored_hate = hate_list->stored_hate_amount; + if (hate_list->entity_on_hatelist->IsClient()) { + if (hate_list->entity_on_hatelist->CastToClient()->IsSitting()) { + aggro_mod += RuleI(Aggro, SittingAggroMod); } - - if(center){ - if(center->GetTarget() == cur->ent) - aggroMod += RuleI(Aggro, CurrentTargetAggroMod); - if(RuleI(Aggro, MeleeRangeAggroMod) != 0) - { - if(center->CombatRange(cur->ent)){ - aggroMod += RuleI(Aggro, MeleeRangeAggroMod); - - if(currentHate > hateClientTypeInRange || cur->bFrenzy){ - hateClientTypeInRange = currentHate; - topClientTypeInRange = cur->ent; + if (entity_as_center) { + if (entity_as_center->GetTarget() == hate_list->entity_on_hatelist) { + aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); + } + if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { + if (entity_as_center->CombatRange(hate_list->entity_on_hatelist)) { + aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); + if (current_stored_hate > hate_client_type_in_range || hate_list->is_entity_frenzy) { + hate_client_type_in_range = current_stored_hate; + top_client_type_in_range = hate_list->entity_on_hatelist; } } } } - } - else{ - if(center){ - if(center->GetTarget() == cur->ent) - aggroMod += RuleI(Aggro, CurrentTargetAggroMod); - if(RuleI(Aggro, MeleeRangeAggroMod) != 0) - { - if(center->CombatRange(cur->ent)){ - aggroMod += RuleI(Aggro, MeleeRangeAggroMod); + else { + if (entity_as_center) { + if (entity_as_center->GetTarget() == hate_list->entity_on_hatelist) { + aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); + } + if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { + if (entity_as_center->CombatRange(hate_list->entity_on_hatelist)) { + aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); } } } } - - if(cur->ent->GetMaxHP() != 0 && ((cur->ent->GetHP()*100/cur->ent->GetMaxHP()) < 20)){ - aggroMod += RuleI(Aggro, CriticallyWoundedAggroMod); + if (hate_list->entity_on_hatelist->GetMaxHP() != 0 && ((hate_list->entity_on_hatelist->GetHP() * 100 / hate_list->entity_on_hatelist->GetMaxHP()) < 20)) { + aggro_mod += RuleI(Aggro, CriticallyWoundedAggroMod); } - - if(aggroMod){ - currentHate += (currentHate * aggroMod / 100); + if (aggro_mod) { + current_stored_hate += (current_stored_hate * aggro_mod / 100); } - - if(currentHate > hate || cur->bFrenzy){ - hate = currentHate; - top = cur->ent; + if (current_stored_hate > temp_hate_tracker || hate_list->is_entity_frenzy) { + temp_hate_tracker = current_stored_hate; + entity_with_most_hate = hate_list->entity_on_hatelist; } - ++iterator; } - - if(topClientTypeInRange != nullptr && top != nullptr) { - bool isTopClientType = top->IsClient(); -#ifdef BOTS - if(!isTopClientType) { - if(top->IsBot()) { - isTopClientType = true; - topClientTypeInRange = top; + if (top_client_type_in_range != nullptr && entity_with_most_hate != nullptr) { + bool is_top_client_type = entity_with_most_hate->IsClient(); + #ifdef BOTS + if (!is_top_client_type) { + if (entity_with_most_hate->IsBot()) { + is_top_client_type = true; + top_client_type_in_range = entity_with_most_hate; } } -#endif //BOTS - - if(!isTopClientType) { - if(top->IsMerc()) { - isTopClientType = true; - topClientTypeInRange = top; + #endif //BOTS + if (!is_top_client_type) { + if (entity_with_most_hate->IsMerc()) { + is_top_client_type = true; + top_client_type_in_range = entity_with_most_hate; } } - - if (!isTopClientType) { - if (top->GetSpecialAbility(ALLOW_TO_TANK)){ - isTopClientType = true; - topClientTypeInRange = top; + if (!is_top_client_type) { + if (entity_with_most_hate->GetSpecialAbility(ALLOW_TO_TANK)) { + is_top_client_type = true; + top_client_type_in_range = entity_with_most_hate; } } - - if(!isTopClientType) - return topClientTypeInRange ? topClientTypeInRange : nullptr; - - return top ? top : nullptr; + if (!is_top_client_type) { + return top_client_type_in_range ? top_client_type_in_range : nullptr; + } + return entity_with_most_hate ? entity_with_most_hate : nullptr; + } else { + if (entity_with_most_hate == nullptr && skipped_count > 0) { + return entity_as_center->GetTarget() ? entity_as_center->GetTarget() : nullptr; + } + return entity_with_most_hate ? entity_with_most_hate : nullptr; } - else { - if(top == nullptr && skipped_count > 0) { - return center->GetTarget() ? center->GetTarget() : nullptr; - } - return top ? top : nullptr; - } - } - else{ + } + /* Process not so smart aggro list */ + else { auto iterator = list.begin(); int skipped_count = 0; - while(iterator != list.end()) - { - tHateEntry *cur = (*iterator); - if(center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if(!zone->watermap->InLiquid(cur->ent->GetX(), cur->ent->GetY(), cur->ent->GetZ())) { + while (iterator != list.end()) { + struct_HateList *hate_list = (*iterator); + if (entity_as_center->IsNPC() && entity_as_center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if (!zone->watermap->InLiquid(hate_list->entity_on_hatelist->GetX(), hate_list->entity_on_hatelist->GetY(), hate_list->entity_on_hatelist->GetZ())) { skipped_count++; ++iterator; continue; } } - - if(cur->ent != nullptr && ((cur->hate > hate) || cur->bFrenzy )) - { - top = cur->ent; - hate = cur->hate; + if (hate_list->entity_on_hatelist != nullptr && ((hate_list->stored_hate_amount > temp_hate_tracker) || hate_list->is_entity_frenzy )) { + entity_with_most_hate = hate_list->entity_on_hatelist; + temp_hate_tracker = hate_list->stored_hate_amount; } ++iterator; } - if(top == nullptr && skipped_count > 0) { - return center->GetTarget() ? center->GetTarget() : nullptr; + if (entity_with_most_hate == nullptr && skipped_count > 0) { + return entity_as_center->GetTarget() ? entity_as_center->GetTarget() : nullptr; } - return top ? top : nullptr; + return entity_with_most_hate ? entity_with_most_hate : nullptr; } return nullptr; } -Mob *HateList::GetMostHate(){ +Mob *HateList::GetEntWithMostHateOnList() +{ Mob* top = nullptr; - int32 hate = -1; - + uint32 hate = 0; auto iterator = list.begin(); - while(iterator != list.end()) - { - tHateEntry *cur = (*iterator); - if(cur->ent != nullptr && (cur->hate > hate)) - { - top = cur->ent; - hate = cur->hate; + while (iterator != list.end()) { + struct_HateList *cur = (*iterator); + if (cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate)) { + top = cur->entity_on_hatelist; + hate = cur->stored_hate_amount; } ++iterator; } @@ -477,110 +423,97 @@ Mob *HateList::GetMostHate(){ } -Mob *HateList::GetRandom() +Mob *HateList::GetRandomEntOnHateList() { int count = list.size(); - if(count == 0) //If we don't have any entries it'll crash getting a random 0, -1 position. - return NULL; - - if(count == 1) //No need to do all that extra work if we only have one hate entry - { - if(*list.begin()) // Just in case tHateEntry is invalidated somehow... - return (*list.begin())->ent; - + if (count == 0) { //If we don't have any entries it'll crash getting a random 0, -1 position. + return NULL; + } + if (count == 1) { //No need to do all that extra work if we only have one hate entry + if (*list.begin()) { // Just in case tHateEntry is invalidated somehow... + return (*list.begin())->entity_on_hatelist; + } return NULL; } - auto iterator = list.begin(); int random = zone->random.Int(0, count - 1); - for (int i = 0; i < random; i++) + for (int i = 0; i < random; i++) { ++iterator; - - return (*iterator)->ent; + } + return (*iterator)->entity_on_hatelist; } -int32 HateList::GetEntHate(Mob *ent, bool damage) +uint32 HateList::GetEntHateAmount(Mob *ent, bool damage /*= false*/) { - tHateEntry *p; - - p = Find(ent); - - if ( p && damage) - return p->damage; - else if (p) - return p->hate; - else + struct_HateList *hate_list; + hate_list = Find(ent); + if ( hate_list && damage) { + return hate_list->hatelist_damage; + } else if (hate_list) { + return hate_list->stored_hate_amount; + } else { return 0; + } } -//looking for any mob with hate > -1 -bool HateList::IsEmpty() { - return(list.size() == 0); +bool HateList::IsHateListEmpty() +{ + return (list.size() == 0); } -// Prints hate list to a client -void HateList::PrintToClient(Client *c) +void HateList::PrintHateListToClient(Client *c) { auto iterator = list.begin(); - while (iterator != list.end()) - { - tHateEntry *e = (*iterator); - c->Message(0, "- name: %s, damage: %d, hate: %d", - (e->ent && e->ent->GetName()) ? e->ent->GetName() : "(null)", - e->damage, e->hate); + while (iterator != list.end()) { + struct_HateList *hate_list = (*iterator); + c->Message(0, "- name: %s, damage: %d, hate: %d", + (hate_list->entity_on_hatelist && hate_list->entity_on_hatelist->GetName()) ? hate_list->entity_on_hatelist->GetName() : "(null)", + hate_list->hatelist_damage, hate_list->stored_hate_amount); ++iterator; } } -int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts) +int HateList::AreaRampage(Mob *in_caster, Mob *in_target, int in_count, ExtraAttackOptions *options) { - if(!target || !caster) + if (!in_target || !in_caster) { return 0; - + } int ret = 0; std::list id_list; auto iterator = list.begin(); - while (iterator != list.end()) - { - tHateEntry *h = (*iterator); + while (iterator != list.end()) { + struct_HateList *h = (*iterator); ++iterator; - if(h && h->ent && h->ent != caster) - { - if(caster->CombatRange(h->ent)) - { - id_list.push_back(h->ent->GetID()); + if (h && h->entity_on_hatelist && h->entity_on_hatelist != in_caster) { + if (in_caster->CombatRange(h->entity_on_hatelist)) { + id_list.push_back(h->entity_on_hatelist->GetID()); ++ret; } } } - std::list::iterator iter = id_list.begin(); - while(iter != id_list.end()) - { + while (iter != id_list.end()) { Mob *cur = entity_list.GetMobID((*iter)); - if(cur) - { - for(int i = 0; i < count; ++i) { - caster->Attack(cur, MainPrimary, false, false, false, opts); + if (cur) { + for (int i = 0; i < in_count; ++i) { + in_caster->Attack(cur, MainPrimary, false, false, false, options); } } iter++; } - return ret; } void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_center) { - if(!caster) + if (!caster) { return; - + } Mob* center = caster; - - if (ae_center) + if (ae_center) { center = ae_center; - + } //this is slower than just iterating through the list but avoids //crashes when people kick the bucket in the middle of this call //that invalidates our iterator but there's no way to know sadly @@ -590,32 +523,24 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; float dist_targ = 0; auto iterator = list.begin(); - while (iterator != list.end()) - { - tHateEntry *h = (*iterator); - if(range > 0) - { - dist_targ = center->DistNoRoot(*h->ent); - if(dist_targ <= range && dist_targ >= min_range2) - { - id_list.push_back(h->ent->GetID()); - h->ent->CalcSpellPowerDistanceMod(spell_id, dist_targ); + while (iterator != list.end()) { + struct_HateList *h = (*iterator); + if (range > 0) { + dist_targ = center->DistNoRoot(*h->entity_on_hatelist); + if (dist_targ <= range && dist_targ >= min_range2) { + id_list.push_back(h->entity_on_hatelist->GetID()); + h->entity_on_hatelist->CalcSpellPowerDistanceMod(spell_id, dist_targ); } - } - else - { - id_list.push_back(h->ent->GetID()); - h->ent->CalcSpellPowerDistanceMod(spell_id, 0, caster); + } else { + id_list.push_back(h->entity_on_hatelist->GetID()); + h->entity_on_hatelist->CalcSpellPowerDistanceMod(spell_id, 0, caster); } ++iterator; } - std::list::iterator iter = id_list.begin(); - while(iter != id_list.end()) - { + while (iter != id_list.end()) { Mob *cur = entity_list.GetMobID((*iter)); - if(cur) - { + if (cur) { caster->SpellOnTarget(spell_id, cur); } iter++; diff --git a/zone/hate_list.h b/zone/hate_list.h index 97f16f9d7..374a69970 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -1,5 +1,5 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,66 +25,60 @@ class Mob; class Raid; struct ExtraAttackOptions; -struct tHateEntry -{ - Mob *ent; - int32 damage, hate; - bool bFrenzy; +struct struct_HateList { + Mob *entity_on_hatelist; + uint32 hatelist_damage; + uint32 stored_hate_amount; + bool is_entity_frenzy; }; class HateList { -public: - HateList(); - ~HateList(); + public: + HateList(); + ~HateList(); - // adds a mob to the hatelist - void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true); - // sets existing hate - void Set(Mob *other, uint32 in_hate, uint32 in_dam); - // removes mobs from hatelist - bool RemoveEnt(Mob *ent); - // Remove all - void Wipe(); - // ??? - void DoFactionHits(int32 nfl_id); - // Gets Hate amount for mob - int32 GetEntHate(Mob *ent, bool damage = false); - // gets top hated mob - Mob *GetTop(Mob *center); - // gets any on the list - Mob *GetRandom(); - // get closest mob or nullptr if list empty - Mob *GetClosest(Mob *hater); - // gets top mob or nullptr if hate list empty - Mob *GetDamageTop(Mob *hater); - // used to check if mob is on hatelist - bool IsOnHateList(Mob *); - // used to remove or add frenzy hate - void CheckFrenzyHate(); - //Gets the target with the most hate regardless of things like frenzy etc. - Mob* GetMostHate(); - // Count 'Summoned' pets on hatelist - int SummonedPetCount(Mob *hater); + Mob *GetClosestEntOnHateList(Mob *hater); + Mob *GetDamageTopOnHateList(Mob *hater); + Mob *GetRandomEntOnHateList(); + Mob *GetEntWithMostHateInRange(Mob *center); + Mob* GetEntWithMostHateOnList(); - int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); + bool IsEntOnHateList(Mob *); + bool IsHateListEmpty(); + bool RemoveEntFromHateList(Mob *ent); - void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); + int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); + int GetSummonedPetCountOnHateList(Mob *hater); - bool IsEmpty(); - void PrintToClient(Client *c); + uint32 GetEntHateAmount(Mob *in_entity, bool damage = false); - //For accessing the hate list via perl; don't use for anything else - std::list& GetHateList() { return list; } + void AddEntToHateList(Mob *in_entity, int32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true); + void DoFactionHits(int32 npc_faction_level_id); + void IsEntityInFrenzyMode(); + void PrintHateListToClient(Client *c); + void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam); + void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); + void WipeHateList(); - //setting owner - void SetOwner(Mob *newOwner) { owner = newOwner; } -protected: - tHateEntry* Find(Mob *ent); -private: - std::list list; - Mob *owner; + /* For accessing the hate list via perl; don't use for anything else */ + std::list& GetHateList() + { + return list; + } + + /* Setting owner*/ + void SetOwner(Mob *new_owner) + { + owner = new_owner; + } + + protected: + struct_HateList* Find(Mob *ent); + private: + std::list list; + Mob *owner; }; #endif diff --git a/zone/lua_hate_list.cpp b/zone/lua_hate_list.cpp index edca6ee11..e8c6a52df 100644 --- a/zone/lua_hate_list.cpp +++ b/zone/lua_hate_list.cpp @@ -12,42 +12,42 @@ Lua_Mob Lua_HateEntry::GetEnt() { Lua_Safe_Call_Class(Lua_Mob); - return Lua_Mob(self->ent); + return Lua_Mob(self->entity_on_hatelist); } void Lua_HateEntry::SetEnt(Lua_Mob e) { Lua_Safe_Call_Void(); - self->ent = e; + self->entity_on_hatelist = e; } int Lua_HateEntry::GetDamage() { Lua_Safe_Call_Int(); - return self->damage; + return self->hatelist_damage; } void Lua_HateEntry::SetDamage(int value) { Lua_Safe_Call_Void(); - self->damage = value; + self->hatelist_damage = value; } int Lua_HateEntry::GetHate() { Lua_Safe_Call_Int(); - return self->hate; + return self->stored_hate_amount; } void Lua_HateEntry::SetHate(int value) { Lua_Safe_Call_Void(); - self->hate = value; + self->stored_hate_amount = value; } int Lua_HateEntry::GetFrenzy() { Lua_Safe_Call_Int(); - return self->bFrenzy; + return self->is_entity_frenzy; } void Lua_HateEntry::SetFrenzy(bool value) { Lua_Safe_Call_Void(); - self->bFrenzy = value; + self->is_entity_frenzy = value; } luabind::scope lua_register_hate_entry() { diff --git a/zone/lua_hate_list.h b/zone/lua_hate_list.h index 4dc6502f3..41d5d75f9 100644 --- a/zone/lua_hate_list.h +++ b/zone/lua_hate_list.h @@ -5,17 +5,17 @@ #include "lua_ptr.h" class Lua_Mob; -struct tHateEntry; +struct struct_HateList; luabind::scope lua_register_hate_entry(); luabind::scope lua_register_hate_list(); -class Lua_HateEntry : public Lua_Ptr +class Lua_HateEntry : public Lua_Ptr { - typedef tHateEntry NativeType; + typedef struct_HateList NativeType; public: Lua_HateEntry() : Lua_Ptr(nullptr) { } - Lua_HateEntry(tHateEntry *d) : Lua_Ptr(d) { } + Lua_HateEntry(struct_HateList *d) : Lua_Ptr(d) { } virtual ~Lua_HateEntry() { } Lua_Mob GetEnt(); diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 50a8b50a7..92afdd8b3 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -895,17 +895,17 @@ void Lua_Mob::AddToHateList(Lua_Mob other, int hate, int damage, bool yell_for_h void Lua_Mob::SetHate(Lua_Mob other) { Lua_Safe_Call_Void(); - self->SetHate(other); + self->SetHateAmountOnEnt(other); } void Lua_Mob::SetHate(Lua_Mob other, int hate) { Lua_Safe_Call_Void(); - self->SetHate(other, hate); + self->SetHateAmountOnEnt(other, hate); } void Lua_Mob::SetHate(Lua_Mob other, int hate, int damage) { Lua_Safe_Call_Void(); - self->SetHate(other, hate, damage); + self->SetHateAmountOnEnt(other, hate, damage); } void Lua_Mob::HalveAggro(Lua_Mob other) { diff --git a/zone/merc.cpp b/zone/merc.cpp index d56d5873d..b82a22fda 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1385,7 +1385,7 @@ void Merc::AI_Process() { rest_timer.Disable(); if(IsRooted()) - SetTarget(hate_list.GetClosest(this)); + SetTarget(hate_list.GetClosestEntOnHateList(this)); else FindTarget(); @@ -2454,11 +2454,11 @@ void Merc::CheckHateList() { Mob* groupMember = g->members[counter]; if(groupMember) { if(npc->IsOnHatelist(groupMember)) { - if(!hate_list.IsOnHateList(npc)) { + if(!hate_list.IsEntOnHateList(npc)) { float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); range *= range; if(npc->DistNoRootNoZ(*this) < range) { - hate_list.Add(npc, 1); + hate_list.AddEntToHateList(npc, 1); } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 8baf361bd..c95814a7b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2556,8 +2556,8 @@ bool Mob::RemoveFromHateList(Mob* mob) bool bFound = false; if(IsEngaged()) { - bFound = hate_list.RemoveEnt(mob); - if(hate_list.IsEmpty()) + bFound = hate_list.RemoveEntFromHateList(mob); + if(hate_list.IsHateListEmpty()) { AI_Event_NoLongerEngaged(); zone->DelAggroMob(); @@ -2565,7 +2565,7 @@ bool Mob::RemoveFromHateList(Mob* mob) } if(GetTarget() == mob) { - SetTarget(hate_list.GetTop(this)); + SetTarget(hate_list.GetEntWithMostHateInRange(this)); } return bFound; @@ -2575,12 +2575,12 @@ void Mob::WipeHateList() { if(IsEngaged()) { - hate_list.Wipe(); + hate_list.WipeHateList(); AI_Event_NoLongerEngaged(); } else { - hate_list.Wipe(); + hate_list.WipeHateList(); } } @@ -3501,7 +3501,7 @@ void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsP } else if (IsPet){ - int count = hate_list.SummonedPetCount(this); + int count = hate_list.GetSummonedPetCountOnHateList(this); if ((base2 >= 220 && base2 <= 250) && count >= (base2 - 220)){ use_spell = true; } diff --git a/zone/mob.h b/zone/mob.h index 431b3ac31..be63a4d8c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -455,16 +455,16 @@ public: virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false); bool RemoveFromHateList(Mob* mob); - void SetHate(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.Set(other,hate,damage);} - void HalveAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHate(other, (in_hate > 1 ? in_hate / 2 : 1)); } - void DoubleAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHate(other, (in_hate ? in_hate * 2 : 1)); } - uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHate(tmob,is_dam);} - uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHate(tmob, true);} - Mob* GetHateTop() { return hate_list.GetTop(this);} - Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTop(other);} - Mob* GetHateRandom() { return hate_list.GetRandom();} - Mob* GetHateMost() { return hate_list.GetMostHate();} - bool IsEngaged() { return(!hate_list.IsEmpty()); } + void SetHateAmountOnEnt(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.SetHateAmountOnEnt(other,hate,damage);} + void HalveAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHateAmountOnEnt(other, (in_hate > 1 ? in_hate / 2 : 1)); } + void DoubleAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHateAmountOnEnt(other, (in_hate ? in_hate * 2 : 1)); } + uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHateAmount(tmob,is_dam);} + uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHateAmount(tmob, true);} + Mob* GetHateTop() { return hate_list.GetEntWithMostHateInRange(this);} + Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTopOnHateList(other);} + Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();} + Mob* GetHateMost() { return hate_list.GetEntWithMostHateOnList();} + bool IsEngaged() { return(!hate_list.IsHateListEmpty()); } bool HateSummon(); void FaceTarget(Mob* MobToFace = 0); void SetHeading(float iHeading) { if(heading != iHeading) { pLastChange = Timer::GetCurrentTime(); @@ -473,8 +473,8 @@ public: void AddFeignMemory(Client* attacker); void RemoveFromFeignMemory(Client* attacker); void ClearFeignMemory(); - void PrintHateListToClient(Client *who) { hate_list.PrintToClient(who); } - std::list& GetHateList() { return hate_list.GetHateList(); } + void PrintHateListToClient(Client *who) { hate_list.PrintHateListToClient(who); } + std::list& GetHateList() { return hate_list.GetHateList(); } bool CheckLosFN(Mob* other); bool CheckLosFN(float posX, float posY, float posZ, float mobSize); inline void SetChanged() { pLastChange = Timer::GetCurrentTime(); } @@ -798,7 +798,7 @@ public: void CheckFlee(); inline bool IsBlind() { return spellbonuses.IsBlind; } - inline bool CheckAggro(Mob* other) {return hate_list.IsOnHateList(other);} + inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);} float CalculateHeadingToTarget(float in_x, float in_y); bool CalculateNewPosition(float x, float y, float z, float speed, bool checkZ = false); virtual bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 9f4e8db7f..827c9a0a3 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -491,7 +491,7 @@ void Mob::AI_Start(uint32 iMoveDelay) { pAggroRange = 70; if (GetAssistRange() == 0) pAssistRange = 70; - hate_list.Wipe(); + hate_list.WipeHateList(); delta_heading = 0; delta_x = 0; @@ -551,7 +551,7 @@ void Mob::AI_Stop() { safe_delete(AIscanarea_timer); safe_delete(AIfeignremember_timer); - hate_list.Wipe(); + hate_list.WipeHateList(); } void NPC::AI_Stop() { @@ -814,12 +814,12 @@ void Client::AI_Process() if (engaged) { if (IsRooted()) - SetTarget(hate_list.GetClosest(this)); + SetTarget(hate_list.GetClosestEntOnHateList(this)); else { if(AItarget_check_timer->Check()) { - SetTarget(hate_list.GetTop(this)); + SetTarget(hate_list.GetEntWithMostHateInRange(this)); } } @@ -1039,7 +1039,7 @@ void Mob::AI_Process() { // if(RuleB(Combat, EnableFearPathing)){ if(curfp) { - if(IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosest(this)))) { + if(IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosestEntOnHateList(this)))) { //make sure everybody knows were not moving, for appearance sake if(IsMoving()) { @@ -1089,18 +1089,18 @@ void Mob::AI_Process() { // we are prevented from getting here if we are blind and don't have a target in range // from above, so no extra blind checks needed if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind()) - SetTarget(hate_list.GetClosest(this)); + SetTarget(hate_list.GetClosestEntOnHateList(this)); else { if(AItarget_check_timer->Check()) { if (IsFocused()) { if (!target) { - SetTarget(hate_list.GetTop(this)); + SetTarget(hate_list.GetEntWithMostHateInRange(this)); } } else { if (!ImprovedTaunt()) - SetTarget(hate_list.GetTop(this)); + SetTarget(hate_list.GetEntWithMostHateInRange(this)); } } @@ -1374,7 +1374,7 @@ void Mob::AI_Process() { //underwater stuff only works with water maps in the zone! if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { - Mob *tar = hate_list.GetTop(this); + Mob *tar = hate_list.GetEntWithMostHateInRange(this); if(tar == target) { WipeHateList(); Heal(); diff --git a/zone/npc.h b/zone/npc.h index 72395622b..72cc7f38c 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -249,8 +249,8 @@ public: inline int32 GetNPCFactionID() const { return npc_faction_id; } inline int32 GetPrimaryFaction() const { return primary_faction; } - int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHate(in_ent);} - bool IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);} + int32 GetNPCHate(Mob* in_ent) {return hate_list.GetEntHateAmount(in_ent);} + bool IsOnHatelist(Mob*p) { return hate_list.IsEntOnHateList(p);} void SetNPCFactionID(int32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); } diff --git a/zone/perl_hateentry.cpp b/zone/perl_hateentry.cpp index fa65e8b39..6e8b2de9e 100644 --- a/zone/perl_hateentry.cpp +++ b/zone/perl_hateentry.cpp @@ -40,19 +40,19 @@ XS(XS_HateEntry_GetEnt) if (items != 1) Perl_croak(aTHX_ "Usage: HateEntry::GetData(THIS)"); { - tHateEntry * THIS; + struct_HateList * THIS; Mob * RETVAL; if (sv_derived_from(ST(0), "HateEntry")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(tHateEntry *,tmp); + THIS = INT2PTR(struct_HateList *,tmp); } else Perl_croak(aTHX_ "THIS is not of type tHateEntry"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->ent; + RETVAL = THIS->entity_on_hatelist; ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "Mob", (void*)RETVAL); } @@ -66,20 +66,20 @@ XS(XS_HateEntry_GetHate) if (items != 1) Perl_croak(aTHX_ "Usage: HateEntry::GetHate(THIS)"); { - tHateEntry * THIS; + struct_HateList * THIS; int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "HateEntry")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(tHateEntry *,tmp); + THIS = INT2PTR(struct_HateList *,tmp); } else Perl_croak(aTHX_ "THIS is not of type tHateEntry"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->hate; + RETVAL = THIS->stored_hate_amount; XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); @@ -92,20 +92,20 @@ XS(XS_HateEntry_GetDamage) if (items != 1) Perl_croak(aTHX_ "Usage: HateEntry::GetDamage(THIS)"); { - tHateEntry * THIS; + struct_HateList * THIS; int32 RETVAL; dXSTARG; if (sv_derived_from(ST(0), "HateEntry")) { IV tmp = SvIV((SV*)SvRV(ST(0))); - THIS = INT2PTR(tHateEntry *,tmp); + THIS = INT2PTR(struct_HateList *,tmp); } else Perl_croak(aTHX_ "THIS is not of type tHateEntry"); if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->damage; + RETVAL = THIS->hatelist_damage; XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 4351fb89f..7977c3dd1 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -5354,7 +5354,7 @@ XS(XS_Mob_SetHate) damage = (int32)SvIV(ST(3)); } - THIS->SetHate(other, hate, damage); + THIS->SetHateAmountOnEnt(other, hate, damage); } XSRETURN_EMPTY; } @@ -6599,7 +6599,7 @@ XS(XS_Mob_GetHateList) while(iter != hate_list.end()) { - tHateEntry *entry = (*iter); + struct_HateList *entry = (*iter); ST(0) = sv_newmortal(); sv_setref_pv(ST(0), "HateEntry", (void*)entry); XPUSHs(ST(0)); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 9fe45fbee..efe5c74db 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2662,7 +2662,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) caster->Taunt(this->CastToNPC(), false, static_cast(spell.base[i])); if (spell.base2[i] > 0) - CastToNPC()->SetHate(caster, (CastToNPC()->GetHateAmount(caster) + spell.base2[i])); + CastToNPC()->SetHateAmountOnEnt(caster, (CastToNPC()->GetHateAmount(caster) + spell.base2[i])); } break; } @@ -2693,7 +2693,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (new_hate <= 0) new_hate = 1; - CastToNPC()->SetHate(caster, new_hate); + CastToNPC()->SetHateAmountOnEnt(caster, new_hate); } break; } @@ -2714,9 +2714,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) }else{ int32 newhate = GetHateAmount(caster) + effect_value; if (newhate < 1) - SetHate(caster,1); + SetHateAmountOnEnt(caster,1); else - SetHate(caster,newhate); + SetHateAmountOnEnt(caster,newhate); } } break; @@ -3546,9 +3546,9 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste }else{ int32 newhate = GetHateAmount(caster) + effect_value; if (newhate < 1) { - SetHate(caster,1); + SetHateAmountOnEnt(caster,1); } else { - SetHate(caster,newhate); + SetHateAmountOnEnt(caster,newhate); } } } @@ -3732,7 +3732,7 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste if (new_hate <= 0) new_hate = 1; - CastToNPC()->SetHate(caster, new_hate); + CastToNPC()->SetHateAmountOnEnt(caster, new_hate); } break; } @@ -6424,7 +6424,7 @@ bool Mob::PassCastRestriction(bool UseCastRestriction, int16 value, bool IsDama //Limit to amount of pets if (value >= 221 && value <= 249){ - int count = hate_list.SummonedPetCount(this); + int count = hate_list.GetSummonedPetCountOnHateList(this); for (int base2_value = 221; base2_value <= 249; ++base2_value){ if (value == base2_value){ diff --git a/zone/spells.cpp b/zone/spells.cpp index 02e99490d..ef11c038a 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3658,9 +3658,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r else{ int32 newhate = spelltar->GetHateAmount(this) + aggro; if (newhate < 1) { - spelltar->SetHate(this,1); + spelltar->SetHateAmountOnEnt(this,1); } else { - spelltar->SetHate(this,newhate); + spelltar->SetHateAmountOnEnt(this,newhate); } } } @@ -3688,9 +3688,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; if (newhate < 1) { - spelltar->SetHate(this,1); + spelltar->SetHateAmountOnEnt(this,1); } else { - spelltar->SetHate(this,newhate); + spelltar->SetHateAmountOnEnt(this,newhate); } } } From 73fe229e25aa8734b90450e4b7acba474b9a5305 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 20:23:49 -0600 Subject: [PATCH 0708/1883] More hate changes --- zone/attack.cpp | 3 ++- zone/bot.cpp | 2 +- zone/bot.h | 2 +- zone/command.cpp | 4 ++-- zone/entity.cpp | 2 +- zone/entity.h | 2 +- zone/hate_list.cpp | 5 ++++- zone/hate_list.h | 6 +++--- zone/mob.h | 2 +- zone/special_attacks.cpp | 8 ++++---- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 2 +- 12 files changed, 22 insertions(+), 18 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 9be08e893..efaf24239 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2400,7 +2400,8 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack return true; } -void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { +void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, bool iYellForHelp /*= true*/, bool bFrenzy /*= false*/, bool iBuffTic /*= false*/) +{ assert(other != nullptr); diff --git a/zone/bot.cpp b/zone/bot.cpp index 7b6081a93..c8befada1 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -6008,7 +6008,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ } } -void Bot::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) +void Bot::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, bool iYellForHelp /*= true*/, bool bFrenzy /*= false*/, bool iBuffTic /*= false*/) { Mob::AddToHateList(other, hate, damage, iYellForHelp, bFrenzy, iBuffTic); } diff --git a/zone/bot.h b/zone/bot.h index 6e7b452af..40b505c84 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -208,7 +208,7 @@ public: bool DoFinishedSpellGroupTarget(uint16 spell_id, Mob* spellTarget, uint16 slot, bool &stopLogic); void SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32 color); void Camp(bool databaseSave = true); - virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false); + virtual void AddToHateList(Mob* other, uint32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false); virtual void SetTarget(Mob* mob); virtual void Zone(); std::vector GetBotSpells() { return AIspells; } diff --git a/zone/command.cpp b/zone/command.cpp index 1d8f99694..be32563a5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -8656,8 +8656,8 @@ void command_aggrozone(Client *c, const Seperator *sep) { if (!m) return; - int hate = atoi(sep->arg[1]); //should default to 0 if we don't enter anything - entity_list.AggroZone(m,hate); + uint32 hate = atoi(sep->arg[1]); //should default to 0 if we don't enter anything + entity_list.AggroZone(m, hate); c->Message(0, "Train to you! Last chance to go invulnerable..."); } diff --git a/zone/entity.cpp b/zone/entity.cpp index 68f5bed87..b6a3c8fa9 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2914,7 +2914,7 @@ void EntityList::ClearZoneFeignAggro(Client *targ) } } -void EntityList::AggroZone(Mob *who, int hate) +void EntityList::AggroZone(Mob *who, uint32 hate) { auto it = npc_list.begin(); while (it != npc_list.end()) { diff --git a/zone/entity.h b/zone/entity.h index fd4f0b5a8..88f5257f7 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -355,7 +355,7 @@ public: void ClearAggro(Mob* targ); void ClearFeignAggro(Mob* targ); void ClearZoneFeignAggro(Client* targ); - void AggroZone(Mob* who, int hate = 0); + void AggroZone(Mob* who, uint32 hate = 0); bool Fighting(Mob* targ); void RemoveFromHateLists(Mob* mob, bool settoone = false); diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 57ba135cd..359b94dc1 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -158,8 +158,11 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) return close_entity; } -void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzy, bool iAddIfNotExist) +#include +void HateList::AddEntToHateList(Mob *in_entity, uint32 in_hate, int32 in_damage, bool in_is_entity_frenzy, bool iAddIfNotExist) { + std::cout << "AddEntToHateList name: " << owner->GetCleanName() << " in_hate " << in_hate << " in_damage " << in_damage << std::endl; + if (!in_entity) { return; } diff --git a/zone/hate_list.h b/zone/hate_list.h index 374a69970..5e3355dfd 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -27,7 +27,7 @@ struct ExtraAttackOptions; struct struct_HateList { Mob *entity_on_hatelist; - uint32 hatelist_damage; + int32 hatelist_damage; uint32 stored_hate_amount; bool is_entity_frenzy; }; @@ -44,7 +44,7 @@ class HateList Mob *GetEntWithMostHateInRange(Mob *center); Mob* GetEntWithMostHateOnList(); - bool IsEntOnHateList(Mob *); + bool IsEntOnHateList(Mob *mob); bool IsHateListEmpty(); bool RemoveEntFromHateList(Mob *ent); @@ -53,7 +53,7 @@ class HateList uint32 GetEntHateAmount(Mob *in_entity, bool damage = false); - void AddEntToHateList(Mob *in_entity, int32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true); + void AddEntToHateList(Mob *in_entity, uint32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true); void DoFactionHits(int32 npc_faction_level_id); void IsEntityInFrenzyMode(); void PrintHateListToClient(Client *c); diff --git a/zone/mob.h b/zone/mob.h index be63a4d8c..badde8901 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -452,7 +452,7 @@ public: static uint32 GetLevelCon(uint8 mylevel, uint8 iOtherLevel); inline uint32 GetLevelCon(uint8 iOtherLevel) const { return this ? GetLevelCon(GetLevel(), iOtherLevel) : CON_GREEN; } - virtual void AddToHateList(Mob* other, int32 hate = 0, int32 damage = 0, bool iYellForHelp = true, + virtual void AddToHateList(Mob* other, uint32 hate = 0, int32 damage = 0, bool iYellForHelp = true, bool bFrenzy = false, bool iBuffTic = false); bool RemoveFromHateList(Mob* mob); void SetHateAmountOnEnt(Mob* other, int32 hate = 0, int32 damage = 0) { hate_list.SetHateAmountOnEnt(other,hate,damage);} diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index f74949a0b..94da26e45 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -106,7 +106,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if(who->GetInvul() || who->GetSpecialAbility(IMMUNE_MELEE) || who->GetSpecialAbility(IMMUNE_MELEE_EXCEPT_BANE)) return; //-5? - int32 hate = max_damage; + uint32 hate = max_damage; if(hate_override > -1) hate = hate_override; @@ -583,7 +583,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) int32 ndamage = 0; int32 max_hit = 0; int32 min_hit = 0; - int32 hate = 0; + uint32 hate = 0; int32 primaryweapondamage = 0; int32 backstab_dmg = 0; @@ -889,7 +889,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (HeadShot_Dmg) HeadShot = true; - int32 hate = 0; + uint32 hate = 0; int32 TotalDmg = 0; int16 WDmg = 0; int16 ADmg = 0; @@ -2354,7 +2354,7 @@ void Mob::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes skillinuse = SkillOffense; int damage = 0; - int32 hate = 0; + uint32 hate = 0; int Hand = MainPrimary; if (hate == 0 && weapon_damage > 1) hate = weapon_damage; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index efe5c74db..6b9eed9c0 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3728,7 +3728,7 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste case SE_AddHateOverTimePct: { if (IsNPC()){ - int32 new_hate = CastToNPC()->GetHateAmount(caster) * (100 + spell.base[i]) / 100; + uint32 new_hate = CastToNPC()->GetHateAmount(caster) * (100 + spell.base[i]) / 100; if (new_hate <= 0) new_hate = 1; diff --git a/zone/spells.cpp b/zone/spells.cpp index d64144e87..ce5d9df8d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3656,7 +3656,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r spelltar->AddToHateList(this, aggro); } else{ - int32 newhate = spelltar->GetHateAmount(this) + aggro; + uint32 newhate = spelltar->GetHateAmount(this) + aggro; if (newhate < 1) { spelltar->SetHateAmountOnEnt(this,1); } else { From 8983953d7d6594ab7689cea77b8f90fca19d36aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 20:25:20 -0600 Subject: [PATCH 0709/1883] Remove debugging from hate changes --- zone/attack.cpp | 2 +- zone/hate_list.cpp | 4 ++-- zone/hate_list.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index efaf24239..20c01963b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2414,7 +2414,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b bool wasengaged = IsEngaged(); Mob* owner = other->GetOwner(); - Mob* mypet = this->GetPet(); + Mob* mypet = this->GetPet(); Mob* myowner = this->GetOwner(); Mob* targetmob = this->GetTarget(); diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 359b94dc1..3f7c1390b 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -158,10 +158,10 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) return close_entity; } -#include +// #include void HateList::AddEntToHateList(Mob *in_entity, uint32 in_hate, int32 in_damage, bool in_is_entity_frenzy, bool iAddIfNotExist) { - std::cout << "AddEntToHateList name: " << owner->GetCleanName() << " in_hate " << in_hate << " in_damage " << in_damage << std::endl; + // std::cout << "AddEntToHateList name: " << owner->GetCleanName() << " in_hate " << in_hate << " in_damage " << in_damage << std::endl; if (!in_entity) { return; diff --git a/zone/hate_list.h b/zone/hate_list.h index 5e3355dfd..9958c2971 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -27,7 +27,7 @@ struct ExtraAttackOptions; struct struct_HateList { Mob *entity_on_hatelist; - int32 hatelist_damage; + uint32 hatelist_damage; uint32 stored_hate_amount; bool is_entity_frenzy; }; From 4f6506627412f168fa5d30b52a423361f1e250fb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 23:19:48 -0600 Subject: [PATCH 0710/1883] Reverting some hate stuff so things work again --- zone/hate_list.cpp | 581 +++++++++++++++++++++++++-------------------- zone/hate_list.h | 116 ++++----- zone/mob.h | 2 +- 3 files changed, 388 insertions(+), 311 deletions(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 3f7c1390b..b18be50e1 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator +Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY except by those people which sell it, which +are required to give you total support for your newly bought product; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "client.h" @@ -48,10 +48,10 @@ HateList::~HateList() void HateList::IsEntityInFrenzyMode() { auto iterator = list.begin(); - while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist->GetHPRatio() >= 20) { + while (iterator != list.end()) + { + if ((*iterator)->entity_on_hatelist->GetHPRatio() >= 20) (*iterator)->is_entity_frenzy = false; - } ++iterator; } } @@ -59,49 +59,51 @@ void HateList::IsEntityInFrenzyMode() void HateList::WipeHateList() { auto iterator = list.begin(); - while (iterator != list.end()) { + + while (iterator != list.end()) + { Mob* m = (*iterator)->entity_on_hatelist; - if (m) { + if (m) + { parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); - if (m->IsClient()) { + + if (m->IsClient()) m->CastToClient()->DecrementAggroCount(); - } } delete (*iterator); iterator = list.erase(iterator); + } } bool HateList::IsEntOnHateList(Mob *mob) { - if (Find(mob)) { + if (Find(mob)) return true; - } return false; } struct_HateList *HateList::Find(Mob *ent) { auto iterator = list.begin(); - while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist == ent) { + while (iterator != list.end()) + { + if ((*iterator)->entity_on_hatelist == ent) return (*iterator); - } ++iterator; } return nullptr; } -void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_damage) +void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_dam) { - struct_HateList *hate_list = Find(other); - if (hate_list) { - if (in_damage > 0) { - hate_list->hatelist_damage = in_damage; - } - if (in_hate > 0) { - hate_list->stored_hate_amount = in_hate; - } + struct_HateList *p = Find(other); + if (p) + { + if (in_dam > 0) + p->hatelist_damage = in_dam; + if (in_hate > 0) + p->stored_hate_amount = in_hate; } } @@ -111,25 +113,36 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater) Group* grp = nullptr; Raid* r = nullptr; uint32 dmg_amt = 0; + auto iterator = list.begin(); - while (iterator != list.end()) { + while (iterator != list.end()) + { grp = nullptr; r = nullptr; - if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) { + + if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()){ r = entity_list.GetRaidByClient((*iterator)->entity_on_hatelist->CastToClient()); } + grp = entity_list.GetGroupByMob((*iterator)->entity_on_hatelist); - if ((*iterator)->entity_on_hatelist && r) { - if (r->GetTotalRaidDamage(hater) >= dmg_amt) { + + if ((*iterator)->entity_on_hatelist && r){ + if (r->GetTotalRaidDamage(hater) >= dmg_amt) + { current = (*iterator)->entity_on_hatelist; dmg_amt = r->GetTotalRaidDamage(hater); } - } else if ((*iterator)->entity_on_hatelist != nullptr && grp != nullptr) { - if (grp->GetTotalGroupDamage(hater) >= dmg_amt) { + } + else if ((*iterator)->entity_on_hatelist != nullptr && grp != nullptr) + { + if (grp->GetTotalGroupDamage(hater) >= dmg_amt) + { current = (*iterator)->entity_on_hatelist; dmg_amt = grp->GetTotalGroupDamage(hater); } - } else if ((*iterator)->entity_on_hatelist != nullptr && (uint32)(*iterator)->hatelist_damage >= dmg_amt) { + } + else if ((*iterator)->entity_on_hatelist != nullptr && (uint32)(*iterator)->hatelist_damage >= dmg_amt) + { current = (*iterator)->entity_on_hatelist; dmg_amt = (*iterator)->hatelist_damage; } @@ -138,285 +151,323 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater) return current; } -Mob* HateList::GetClosestEntOnHateList(Mob *hater) -{ - Mob* close_entity = nullptr; - float close_distance = 99999.9f; - float this_distance; +Mob* HateList::GetClosestEntOnHateList(Mob *hater) { + Mob* close = nullptr; + float closedist = 99999.9f; + float thisdist; + auto iterator = list.begin(); while (iterator != list.end()) { - this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); - if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { - close_distance = this_distance; - close_entity = (*iterator)->entity_on_hatelist; + thisdist = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); + if ((*iterator)->entity_on_hatelist != nullptr && thisdist <= closedist) { + closedist = thisdist; + close = (*iterator)->entity_on_hatelist; } ++iterator; } - if ((!close_entity && hater->IsNPC()) || (close_entity && close_entity->DivineAura())) { - close_entity = hater->CastToNPC()->GetHateTop(); - } - return close_entity; + + if ((!close && hater->IsNPC()) || (close && close->DivineAura())) + close = hater->CastToNPC()->GetHateTop(); + + return close; } -// #include -void HateList::AddEntToHateList(Mob *in_entity, uint32 in_hate, int32 in_damage, bool in_is_entity_frenzy, bool iAddIfNotExist) -{ - // std::cout << "AddEntToHateList name: " << owner->GetCleanName() << " in_hate " << in_hate << " in_damage " << in_damage << std::endl; - if (!in_entity) { +// a few comments added, rearranged code for readability +void HateList::AddEntToHateList(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist) +{ + if (!ent) return; - } - if (in_entity->IsCorpse()) { + + if (ent->IsCorpse()) return; - } - if (in_entity->IsClient() && in_entity->CastToClient()->IsDead()) { + + if (ent->IsClient() && ent->CastToClient()->IsDead()) return; + + struct_HateList *p = Find(ent); + if (p) + { + p->hatelist_damage += (in_dam >= 0) ? in_dam : 0; + p->stored_hate_amount += in_hate; + p->is_entity_frenzy = bFrenzy; } - struct_HateList *hate_list = Find(in_entity); - if (hate_list) { - hate_list->hatelist_damage += (in_damage >= 0) ? in_damage : 0; - hate_list->stored_hate_amount += in_hate; - hate_list->is_entity_frenzy = in_is_entity_frenzy; - } else if (iAddIfNotExist) { - hate_list = new struct_HateList; - hate_list->entity_on_hatelist = in_entity; - hate_list->hatelist_damage = (in_damage >= 0) ? in_damage : 0; - hate_list->stored_hate_amount = in_hate; - hate_list->is_entity_frenzy = in_is_entity_frenzy; - list.push_back(hate_list); - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), in_entity, "1", 0); - if (in_entity->IsClient()) { - if (owner->CastToNPC()->IsRaidTarget()) { - in_entity->CastToClient()->SetEngagedRaidTarget(true); - } - in_entity->CastToClient()->IncrementAggroCount(); + else if (iAddIfNotExist) { + p = new struct_HateList; + p->entity_on_hatelist = ent; + p->hatelist_damage = (in_dam >= 0) ? in_dam : 0; + p->stored_hate_amount = in_hate; + p->is_entity_frenzy = bFrenzy; + list.push_back(p); + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); + + if (ent->IsClient()) { + if (owner->CastToNPC()->IsRaidTarget()) + ent->CastToClient()->SetEngagedRaidTarget(true); + ent->CastToClient()->IncrementAggroCount(); } } } -bool HateList::RemoveEntFromHateList(Mob *in_entity) +bool HateList::RemoveEntFromHateList(Mob *ent) { - if (!in_entity) { + if (!ent) return false; - } + bool found = false; auto iterator = list.begin(); - while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist == in_entity) { - if (in_entity) { - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), in_entity, "0", 0); - } + + while (iterator != list.end()) + { + if ((*iterator)->entity_on_hatelist == ent) + { + if (ent) + parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); found = true; - if (in_entity && in_entity->IsClient()) { - in_entity->CastToClient()->DecrementAggroCount(); - } + + + if (ent && ent->IsClient()) + ent->CastToClient()->DecrementAggroCount(); + delete (*iterator); iterator = list.erase(iterator); - } else { - ++iterator; + } + else + ++iterator; } return found; } -void HateList::DoFactionHits(int32 npc_faction_level_id) -{ - if (npc_faction_level_id <= 0) { +void HateList::DoFactionHits(int32 nfl_id) { + if (nfl_id <= 0) return; - } auto iterator = list.begin(); - while (iterator != list.end()) { - Client *client; - if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) { - client = (*iterator)->entity_on_hatelist->CastToClient(); - } else { - client = nullptr; - } - if (client) { - client->SetFactionLevel(client->CharacterID(), npc_faction_level_id, client->GetBaseClass(), client->GetBaseRace(), client->GetDeity()); - } + while (iterator != list.end()) + { + Client *p; + + if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) + p = (*iterator)->entity_on_hatelist->CastToClient(); + else + p = nullptr; + + if (p) + p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity()); ++iterator; } } -int HateList::GetSummonedPetCountOnHateList(Mob *hater) -{ +int HateList::GetSummonedPetCountOnHateList(Mob *hater) { + + //Function to get number of 'Summoned' pets on a targets hate list to allow calculations for certian spell effects. + //Unclear from description that pets are required to be 'summoned body type'. Will not require at this time. int petcount = 0; auto iterator = list.begin(); while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0))) { + + if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0))) + { ++petcount; } + ++iterator; } + return petcount; } -Mob *HateList::GetEntWithMostHateInRange(Mob *entity_as_center) +Mob *HateList::GetEntWithMostHateInRange(Mob *center) { - /* Hack fix for zone shutdown crashes on some servers */ - if (!zone->IsLoaded()) { + // hack fix for zone shutdown crashes on some servers + if (!zone->IsLoaded()) return nullptr; - } - Mob* entity_with_most_hate = nullptr; - int32 hate_status = -1; - uint32 temp_hate_tracker = 0; + Mob* top = nullptr; + int32 hate = -1; - if (entity_as_center == nullptr) { + if (center == nullptr) return nullptr; - } - if (RuleB(Aggro, SmartAggroList)) { - Mob* top_client_type_in_range = nullptr; - int32 hate_client_type_in_range = -1; + + if (RuleB(Aggro, SmartAggroList)){ + Mob* topClientTypeInRange = nullptr; + int32 hateClientTypeInRange = -1; int skipped_count = 0; + auto iterator = list.begin(); - while (iterator != list.end()) { - struct_HateList *hate_list = (*iterator); - int16 aggro_mod = 0; - if (!hate_list) { + while (iterator != list.end()) + { + struct_HateList *cur = (*iterator); + int16 aggroMod = 0; + + if (!cur){ ++iterator; continue; } - if (!hate_list->entity_on_hatelist) { + + if (!cur->entity_on_hatelist){ ++iterator; continue; } - if (entity_as_center->IsNPC() && entity_as_center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if (!zone->watermap->InLiquid(hate_list->entity_on_hatelist->GetX(), hate_list->entity_on_hatelist->GetY(), hate_list->entity_on_hatelist->GetZ())) { + + if (center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if (!zone->watermap->InLiquid(cur->entity_on_hatelist->GetX(), cur->entity_on_hatelist->GetY(), cur->entity_on_hatelist->GetZ())) { skipped_count++; ++iterator; continue; } } - if (hate_list->entity_on_hatelist->Sanctuary()) { - if (hate_status == -1) { - entity_with_most_hate = hate_list->entity_on_hatelist; - hate_status = 1; + + if (cur->entity_on_hatelist->Sanctuary()) { + if (hate == -1) + { + top = cur->entity_on_hatelist; + hate = 1; } ++iterator; continue; } - if (hate_list->entity_on_hatelist->DivineAura() || hate_list->entity_on_hatelist->IsMezzed() || hate_list->entity_on_hatelist->IsFeared()) { - if (hate_status == -1) { - entity_with_most_hate = hate_list->entity_on_hatelist; - hate_status = 0; + + if (cur->entity_on_hatelist->DivineAura() || cur->entity_on_hatelist->IsMezzed() || cur->entity_on_hatelist->IsFeared()){ + if (hate == -1) + { + top = cur->entity_on_hatelist; + hate = 0; } ++iterator; continue; } - uint32 current_stored_hate = hate_list->stored_hate_amount; - if (hate_list->entity_on_hatelist->IsClient()) { - if (hate_list->entity_on_hatelist->CastToClient()->IsSitting()) { - aggro_mod += RuleI(Aggro, SittingAggroMod); + + int32 currentHate = cur->stored_hate_amount; + + if (cur->entity_on_hatelist->IsClient()){ + + if (cur->entity_on_hatelist->CastToClient()->IsSitting()){ + aggroMod += RuleI(Aggro, SittingAggroMod); } - if (entity_as_center) { - if (entity_as_center->GetTarget() == hate_list->entity_on_hatelist) { - aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); - } - if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { - if (entity_as_center->CombatRange(hate_list->entity_on_hatelist)) { - aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); - if (current_stored_hate > hate_client_type_in_range || hate_list->is_entity_frenzy) { - hate_client_type_in_range = current_stored_hate; - top_client_type_in_range = hate_list->entity_on_hatelist; + + if (center){ + if (center->GetTarget() == cur->entity_on_hatelist) + aggroMod += RuleI(Aggro, CurrentTargetAggroMod); + if (RuleI(Aggro, MeleeRangeAggroMod) != 0) + { + if (center->CombatRange(cur->entity_on_hatelist)){ + aggroMod += RuleI(Aggro, MeleeRangeAggroMod); + + if (currentHate > hateClientTypeInRange || cur->is_entity_frenzy){ + hateClientTypeInRange = currentHate; + topClientTypeInRange = cur->entity_on_hatelist; } } } } + } - else { - if (entity_as_center) { - if (entity_as_center->GetTarget() == hate_list->entity_on_hatelist) { - aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); - } - if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { - if (entity_as_center->CombatRange(hate_list->entity_on_hatelist)) { - aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); + else{ + if (center){ + if (center->GetTarget() == cur->entity_on_hatelist) + aggroMod += RuleI(Aggro, CurrentTargetAggroMod); + if (RuleI(Aggro, MeleeRangeAggroMod) != 0) + { + if (center->CombatRange(cur->entity_on_hatelist)){ + aggroMod += RuleI(Aggro, MeleeRangeAggroMod); } } } } - if (hate_list->entity_on_hatelist->GetMaxHP() != 0 && ((hate_list->entity_on_hatelist->GetHP() * 100 / hate_list->entity_on_hatelist->GetMaxHP()) < 20)) { - aggro_mod += RuleI(Aggro, CriticallyWoundedAggroMod); + + if (cur->entity_on_hatelist->GetMaxHP() != 0 && ((cur->entity_on_hatelist->GetHP() * 100 / cur->entity_on_hatelist->GetMaxHP()) < 20)){ + aggroMod += RuleI(Aggro, CriticallyWoundedAggroMod); } - if (aggro_mod) { - current_stored_hate += (current_stored_hate * aggro_mod / 100); + + if (aggroMod){ + currentHate += (currentHate * aggroMod / 100); } - if (current_stored_hate > temp_hate_tracker || hate_list->is_entity_frenzy) { - temp_hate_tracker = current_stored_hate; - entity_with_most_hate = hate_list->entity_on_hatelist; + + if (currentHate > hate || cur->is_entity_frenzy){ + hate = currentHate; + top = cur->entity_on_hatelist; } + ++iterator; } - if (top_client_type_in_range != nullptr && entity_with_most_hate != nullptr) { - bool is_top_client_type = entity_with_most_hate->IsClient(); - #ifdef BOTS - if (!is_top_client_type) { - if (entity_with_most_hate->IsBot()) { - is_top_client_type = true; - top_client_type_in_range = entity_with_most_hate; + + if (topClientTypeInRange != nullptr && top != nullptr) { + bool isTopClientType = top->IsClient(); +#ifdef BOTS + if (!isTopClientType) { + if (top->IsBot()) { + isTopClientType = true; + topClientTypeInRange = top; } } - #endif //BOTS - if (!is_top_client_type) { - if (entity_with_most_hate->IsMerc()) { - is_top_client_type = true; - top_client_type_in_range = entity_with_most_hate; +#endif //BOTS + + if (!isTopClientType) { + if (top->IsMerc()) { + isTopClientType = true; + topClientTypeInRange = top; } } - if (!is_top_client_type) { - if (entity_with_most_hate->GetSpecialAbility(ALLOW_TO_TANK)) { - is_top_client_type = true; - top_client_type_in_range = entity_with_most_hate; + + if (!isTopClientType) { + if (top->GetSpecialAbility(ALLOW_TO_TANK)){ + isTopClientType = true; + topClientTypeInRange = top; } } - if (!is_top_client_type) { - return top_client_type_in_range ? top_client_type_in_range : nullptr; - } - return entity_with_most_hate ? entity_with_most_hate : nullptr; - } else { - if (entity_with_most_hate == nullptr && skipped_count > 0) { - return entity_as_center->GetTarget() ? entity_as_center->GetTarget() : nullptr; - } - return entity_with_most_hate ? entity_with_most_hate : nullptr; + + if (!isTopClientType) + return topClientTypeInRange ? topClientTypeInRange : nullptr; + + return top ? top : nullptr; } - } - /* Process not so smart aggro list */ - else { + else { + if (top == nullptr && skipped_count > 0) { + return center->GetTarget() ? center->GetTarget() : nullptr; + } + return top ? top : nullptr; + } + } + else{ auto iterator = list.begin(); int skipped_count = 0; - while (iterator != list.end()) { - struct_HateList *hate_list = (*iterator); - if (entity_as_center->IsNPC() && entity_as_center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { - if (!zone->watermap->InLiquid(hate_list->entity_on_hatelist->GetX(), hate_list->entity_on_hatelist->GetY(), hate_list->entity_on_hatelist->GetZ())) { + while (iterator != list.end()) + { + struct_HateList *cur = (*iterator); + if (center->IsNPC() && center->CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { + if (!zone->watermap->InLiquid(cur->entity_on_hatelist->GetX(), cur->entity_on_hatelist->GetY(), cur->entity_on_hatelist->GetZ())) { skipped_count++; ++iterator; continue; } } - if (hate_list->entity_on_hatelist != nullptr && ((hate_list->stored_hate_amount > temp_hate_tracker) || hate_list->is_entity_frenzy )) { - entity_with_most_hate = hate_list->entity_on_hatelist; - temp_hate_tracker = hate_list->stored_hate_amount; + + if (cur->entity_on_hatelist != nullptr && ((cur->stored_hate_amount > hate) || cur->is_entity_frenzy)) + { + top = cur->entity_on_hatelist; + hate = cur->stored_hate_amount; } ++iterator; } - if (entity_with_most_hate == nullptr && skipped_count > 0) { - return entity_as_center->GetTarget() ? entity_as_center->GetTarget() : nullptr; + if (top == nullptr && skipped_count > 0) { + return center->GetTarget() ? center->GetTarget() : nullptr; } - return entity_with_most_hate ? entity_with_most_hate : nullptr; + return top ? top : nullptr; } return nullptr; } -Mob *HateList::GetEntWithMostHateOnList() -{ +Mob *HateList::GetEntWithMostHateInRange(){ Mob* top = nullptr; - uint32 hate = 0; + int32 hate = -1; + auto iterator = list.begin(); - while (iterator != list.end()) { + while (iterator != list.end()) + { struct_HateList *cur = (*iterator); - if (cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate)) { + if (cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate)) + { top = cur->entity_on_hatelist; hate = cur->stored_hate_amount; } @@ -429,94 +480,107 @@ Mob *HateList::GetEntWithMostHateOnList() Mob *HateList::GetRandomEntOnHateList() { int count = list.size(); - if (count == 0) { //If we don't have any entries it'll crash getting a random 0, -1 position. + if (count == 0) //If we don't have any entries it'll crash getting a random 0, -1 position. return NULL; - } - if (count == 1) { //No need to do all that extra work if we only have one hate entry - if (*list.begin()) { // Just in case tHateEntry is invalidated somehow... + + if (count == 1) //No need to do all that extra work if we only have one hate entry + { + if (*list.begin()) // Just in case tHateEntry is invalidated somehow... return (*list.begin())->entity_on_hatelist; - } + return NULL; } + auto iterator = list.begin(); int random = zone->random.Int(0, count - 1); - for (int i = 0; i < random; i++) { + for (int i = 0; i < random; i++) ++iterator; - } + return (*iterator)->entity_on_hatelist; } -uint32 HateList::GetEntHateAmount(Mob *ent, bool damage /*= false*/) +int32 HateList::GetEntHateAmount(Mob *ent, bool damage) { - struct_HateList *hate_list; - hate_list = Find(ent); - if ( hate_list && damage) { - return hate_list->hatelist_damage; - } else if (hate_list) { - return hate_list->stored_hate_amount; - } else { + struct_HateList *p; + + p = Find(ent); + + if (p && damage) + return p->hatelist_damage; + else if (p) + return p->stored_hate_amount; + else return 0; - } } -bool HateList::IsHateListEmpty() -{ - return (list.size() == 0); +//looking for any mob with hate > -1 +bool HateList::IsHateListEmpty() { + return(list.size() == 0); } +// Prints hate list to a client void HateList::PrintHateListToClient(Client *c) { auto iterator = list.begin(); - while (iterator != list.end()) { - struct_HateList *hate_list = (*iterator); - + while (iterator != list.end()) + { + struct_HateList *e = (*iterator); c->Message(0, "- name: %s, damage: %d, hate: %d", - (hate_list->entity_on_hatelist && hate_list->entity_on_hatelist->GetName()) ? hate_list->entity_on_hatelist->GetName() : "(null)", - hate_list->hatelist_damage, hate_list->stored_hate_amount); + (e->entity_on_hatelist && e->entity_on_hatelist->GetName()) ? e->entity_on_hatelist->GetName() : "(null)", + e->hatelist_damage, e->stored_hate_amount); + ++iterator; } } -int HateList::AreaRampage(Mob *in_caster, Mob *in_target, int in_count, ExtraAttackOptions *options) +int HateList::AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts) { - if (!in_target || !in_caster) { + if (!target || !caster) return 0; - } + int ret = 0; std::list id_list; auto iterator = list.begin(); - while (iterator != list.end()) { + while (iterator != list.end()) + { struct_HateList *h = (*iterator); ++iterator; - if (h && h->entity_on_hatelist && h->entity_on_hatelist != in_caster) { - if (in_caster->CombatRange(h->entity_on_hatelist)) { + if (h && h->entity_on_hatelist && h->entity_on_hatelist != caster) + { + if (caster->CombatRange(h->entity_on_hatelist)) + { id_list.push_back(h->entity_on_hatelist->GetID()); ++ret; } } } + std::list::iterator iter = id_list.begin(); - while (iter != id_list.end()) { + while (iter != id_list.end()) + { Mob *cur = entity_list.GetMobID((*iter)); - if (cur) { - for (int i = 0; i < in_count; ++i) { - in_caster->Attack(cur, MainPrimary, false, false, false, options); + if (cur) + { + for (int i = 0; i < count; ++i) { + caster->Attack(cur, MainPrimary, false, false, false, opts); } } iter++; } + return ret; } void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_center) { - if (!caster) { + if (!caster) return; - } + Mob* center = caster; - if (ae_center) { + + if (ae_center) center = ae_center; - } + //this is slower than just iterating through the list but avoids //crashes when people kick the bucket in the middle of this call //that invalidates our iterator but there's no way to know sadly @@ -526,27 +590,34 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; float dist_targ = 0; auto iterator = list.begin(); - while (iterator != list.end()) { + while (iterator != list.end()) + { struct_HateList *h = (*iterator); - if (range > 0) { + if (range > 0) + { dist_targ = center->DistNoRoot(*h->entity_on_hatelist); - if (dist_targ <= range && dist_targ >= min_range2) { + if (dist_targ <= range && dist_targ >= min_range2) + { id_list.push_back(h->entity_on_hatelist->GetID()); h->entity_on_hatelist->CalcSpellPowerDistanceMod(spell_id, dist_targ); } - } else { + } + else + { id_list.push_back(h->entity_on_hatelist->GetID()); h->entity_on_hatelist->CalcSpellPowerDistanceMod(spell_id, 0, caster); } ++iterator; } + std::list::iterator iter = id_list.begin(); - while (iter != id_list.end()) { + while (iter != id_list.end()) + { Mob *cur = entity_list.GetMobID((*iter)); - if (cur) { + if (cur) + { caster->SpellOnTarget(spell_id, cur); } iter++; } } - diff --git a/zone/hate_list.h b/zone/hate_list.h index 9958c2971..40e8188d5 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -1,19 +1,19 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org) +/* EQEMu: Everquest Server Emulator +Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY except by those people which sell it, which +are required to give you total support for your newly bought product; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef HATELIST_H @@ -25,60 +25,66 @@ class Mob; class Raid; struct ExtraAttackOptions; -struct struct_HateList { +struct struct_HateList +{ Mob *entity_on_hatelist; - uint32 hatelist_damage; - uint32 stored_hate_amount; + int32 hatelist_damage, stored_hate_amount; bool is_entity_frenzy; }; class HateList { - public: - HateList(); - ~HateList(); +public: + HateList(); + ~HateList(); - Mob *GetClosestEntOnHateList(Mob *hater); - Mob *GetDamageTopOnHateList(Mob *hater); - Mob *GetRandomEntOnHateList(); - Mob *GetEntWithMostHateInRange(Mob *center); - Mob* GetEntWithMostHateOnList(); + // adds a mob to the hatelist + void AddEntToHateList(Mob *ent, int32 in_hate = 0, int32 in_dam = 0, bool bFrenzy = false, bool iAddIfNotExist = true); + // sets existing hate + void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam); + // removes mobs from hatelist + bool RemoveEntFromHateList(Mob *ent); + // Remove all + void WipeHateList(); + // ??? + void DoFactionHits(int32 nfl_id); + // Gets Hate amount for mob + int32 GetEntHateAmount(Mob *ent, bool damage = false); + // gets top hated mob + Mob *GetEntWithMostHateInRange(Mob *center); + // gets any on the list + Mob *GetRandomEntOnHateList(); + // get closest mob or nullptr if list empty + Mob *GetClosestEntOnHateList(Mob *hater); + // gets top mob or nullptr if hate list empty + Mob *GetDamageTopOnHateList(Mob *hater); + // used to check if mob is on hatelist + bool IsEntOnHateList(Mob *); + // used to remove or add frenzy hate + void IsEntityInFrenzyMode(); + //Gets the target with the most hate regardless of things like frenzy etc. + Mob* GetEntWithMostHateInRange(); + // Count 'Summoned' pets on hatelist + int GetSummonedPetCountOnHateList(Mob *hater); - bool IsEntOnHateList(Mob *mob); - bool IsHateListEmpty(); - bool RemoveEntFromHateList(Mob *ent); + int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); - int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); - int GetSummonedPetCountOnHateList(Mob *hater); + void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); - uint32 GetEntHateAmount(Mob *in_entity, bool damage = false); + bool IsHateListEmpty(); + void PrintHateListToClient(Client *c); - void AddEntToHateList(Mob *in_entity, uint32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true); - void DoFactionHits(int32 npc_faction_level_id); - void IsEntityInFrenzyMode(); - void PrintHateListToClient(Client *c); - void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam); - void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); - void WipeHateList(); + //For accessing the hate list via perl; don't use for anything else + std::list& GetHateList() { return list; } + //setting owner + void SetOwner(Mob *newOwner) { owner = newOwner; } - /* For accessing the hate list via perl; don't use for anything else */ - std::list& GetHateList() - { - return list; - } - - /* Setting owner*/ - void SetOwner(Mob *new_owner) - { - owner = new_owner; - } - - protected: - struct_HateList* Find(Mob *ent); - private: - std::list list; - Mob *owner; +protected: + struct_HateList* Find(Mob *ent); +private: + std::list list; + Mob *owner; }; -#endif +#endif \ No newline at end of file diff --git a/zone/mob.h b/zone/mob.h index badde8901..4f3a0ea82 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -463,7 +463,7 @@ public: Mob* GetHateTop() { return hate_list.GetEntWithMostHateInRange(this);} Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTopOnHateList(other);} Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();} - Mob* GetHateMost() { return hate_list.GetEntWithMostHateOnList();} + Mob* GetHateMost() { return hate_list.GetEntWithMostHateInRange();} bool IsEngaged() { return(!hate_list.IsHateListEmpty()); } bool HateSummon(); void FaceTarget(Mob* MobToFace = 0); From 18f9a06f0638aabab1a21762cc2c595c32184c71 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 23:44:15 -0600 Subject: [PATCH 0711/1883] Re-Push Refactoring changes before without broken functionality --- zone/bot.cpp | 4 +- zone/hate_list.cpp | 204 ++++++++++++++++++++++----------------------- zone/hate_list.h | 51 ++++-------- zone/mob.cpp | 2 +- zone/mob.h | 4 +- zone/mob_ai.cpp | 8 +- 6 files changed, 127 insertions(+), 146 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index c8befada1..50e4ff75d 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3424,7 +3424,7 @@ void Bot::AI_Process() { if(IsRooted()) SetTarget(hate_list.GetClosestEntOnHateList(this)); else - SetTarget(hate_list.GetEntWithMostHateInRange(this)); + SetTarget(hate_list.GetEntWithMostHateOnList(this)); if(!GetTarget()) return; @@ -3793,7 +3793,7 @@ void Bot::PetAIProcess() { if (botPet->IsRooted()) botPet->SetTarget(hate_list.GetClosestEntOnHateList(botPet)); else - botPet->SetTarget(hate_list.GetEntWithMostHateInRange(botPet)); + botPet->SetTarget(hate_list.GetEntWithMostHateOnList(botPet)); // Let's check if we have a los with our target. // If we don't, our hate_list is wiped. diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index b18be50e1..0ee996f8d 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -36,7 +36,7 @@ extern Zone *zone; HateList::HateList() { - owner = nullptr; + hate_owner = nullptr; } HateList::~HateList() @@ -65,7 +65,7 @@ void HateList::WipeHateList() Mob* m = (*iterator)->entity_on_hatelist; if (m) { - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), m, "0", 0); + parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), m, "0", 0); if (m->IsClient()) m->CastToClient()->DecrementAggroCount(); @@ -83,27 +83,27 @@ bool HateList::IsEntOnHateList(Mob *mob) return false; } -struct_HateList *HateList::Find(Mob *ent) +struct_HateList *HateList::Find(Mob *in_entity) { auto iterator = list.begin(); while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist == ent) + if ((*iterator)->entity_on_hatelist == in_entity) return (*iterator); ++iterator; } return nullptr; } -void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_dam) +void HateList::SetHateAmountOnEnt(Mob* other, uint32 in_hate, uint32 in_damage) { - struct_HateList *p = Find(other); - if (p) + struct_HateList *entity = Find(other); + if (entity) { - if (in_dam > 0) - p->hatelist_damage = in_dam; + if (in_damage > 0) + entity->hatelist_damage = in_damage; if (in_hate > 0) - p->stored_hate_amount = in_hate; + entity->stored_hate_amount = in_hate; } } @@ -153,14 +153,14 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater) Mob* HateList::GetClosestEntOnHateList(Mob *hater) { Mob* close = nullptr; - float closedist = 99999.9f; - float thisdist; + float close_distance = 99999.9f; + float this_distance; auto iterator = list.begin(); while (iterator != list.end()) { - thisdist = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); - if ((*iterator)->entity_on_hatelist != nullptr && thisdist <= closedist) { - closedist = thisdist; + this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); + if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { + close_distance = this_distance; close = (*iterator)->entity_on_hatelist; } ++iterator; @@ -172,62 +172,60 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) { return close; } - -// a few comments added, rearranged code for readability -void HateList::AddEntToHateList(Mob *ent, int32 in_hate, int32 in_dam, bool bFrenzy, bool iAddIfNotExist) +void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzied, bool iAddIfNotExist) { - if (!ent) + if (!in_entity) return; - if (ent->IsCorpse()) + if (in_entity->IsCorpse()) return; - if (ent->IsClient() && ent->CastToClient()->IsDead()) + if (in_entity->IsClient() && in_entity->CastToClient()->IsDead()) return; - struct_HateList *p = Find(ent); - if (p) + struct_HateList *entity = Find(in_entity); + if (entity) { - p->hatelist_damage += (in_dam >= 0) ? in_dam : 0; - p->stored_hate_amount += in_hate; - p->is_entity_frenzy = bFrenzy; + entity->hatelist_damage += (in_damage >= 0) ? in_damage : 0; + entity->stored_hate_amount += in_hate; + entity->is_entity_frenzy = in_is_entity_frenzied; } else if (iAddIfNotExist) { - p = new struct_HateList; - p->entity_on_hatelist = ent; - p->hatelist_damage = (in_dam >= 0) ? in_dam : 0; - p->stored_hate_amount = in_hate; - p->is_entity_frenzy = bFrenzy; - list.push_back(p); - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "1", 0); + entity = new struct_HateList; + entity->entity_on_hatelist = in_entity; + entity->hatelist_damage = (in_damage >= 0) ? in_damage : 0; + entity->stored_hate_amount = in_hate; + entity->is_entity_frenzy = in_is_entity_frenzied; + list.push_back(entity); + parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "1", 0); - if (ent->IsClient()) { - if (owner->CastToNPC()->IsRaidTarget()) - ent->CastToClient()->SetEngagedRaidTarget(true); - ent->CastToClient()->IncrementAggroCount(); + if (in_entity->IsClient()) { + if (hate_owner->CastToNPC()->IsRaidTarget()) + in_entity->CastToClient()->SetEngagedRaidTarget(true); + in_entity->CastToClient()->IncrementAggroCount(); } } } -bool HateList::RemoveEntFromHateList(Mob *ent) +bool HateList::RemoveEntFromHateList(Mob *in_entity) { - if (!ent) + if (!in_entity) return false; - bool found = false; + bool is_found = false; auto iterator = list.begin(); while (iterator != list.end()) { - if ((*iterator)->entity_on_hatelist == ent) + if ((*iterator)->entity_on_hatelist == in_entity) { - if (ent) - parse->EventNPC(EVENT_HATE_LIST, owner->CastToNPC(), ent, "0", 0); - found = true; + if (in_entity) + parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "0", 0); + is_found = true; - if (ent && ent->IsClient()) - ent->CastToClient()->DecrementAggroCount(); + if (in_entity && in_entity->IsClient()) + in_entity->CastToClient()->DecrementAggroCount(); delete (*iterator); iterator = list.erase(iterator); @@ -236,24 +234,24 @@ bool HateList::RemoveEntFromHateList(Mob *ent) else ++iterator; } - return found; + return is_found; } -void HateList::DoFactionHits(int32 nfl_id) { - if (nfl_id <= 0) +void HateList::DoFactionHits(int32 npc_faction_level_id) { + if (npc_faction_level_id <= 0) return; auto iterator = list.begin(); while (iterator != list.end()) { - Client *p; + Client *client; if ((*iterator)->entity_on_hatelist && (*iterator)->entity_on_hatelist->IsClient()) - p = (*iterator)->entity_on_hatelist->CastToClient(); + client = (*iterator)->entity_on_hatelist->CastToClient(); else - p = nullptr; + client = nullptr; - if (p) - p->SetFactionLevel(p->CharacterID(), nfl_id, p->GetBaseClass(), p->GetBaseRace(), p->GetDeity()); + if (client) + client->SetFactionLevel(client->CharacterID(), npc_faction_level_id, client->GetBaseClass(), client->GetBaseRace(), client->GetDeity()); ++iterator; } } @@ -262,43 +260,43 @@ int HateList::GetSummonedPetCountOnHateList(Mob *hater) { //Function to get number of 'Summoned' pets on a targets hate list to allow calculations for certian spell effects. //Unclear from description that pets are required to be 'summoned body type'. Will not require at this time. - int petcount = 0; + int pet_count = 0; auto iterator = list.begin(); while (iterator != list.end()) { if ((*iterator)->entity_on_hatelist != nullptr && (*iterator)->entity_on_hatelist->IsNPC() && ((*iterator)->entity_on_hatelist->CastToNPC()->IsPet() || ((*iterator)->entity_on_hatelist->CastToNPC()->GetSwarmOwner() > 0))) { - ++petcount; + ++pet_count; } ++iterator; } - return petcount; + return pet_count; } -Mob *HateList::GetEntWithMostHateInRange(Mob *center) +Mob *HateList::GetEntWithMostHateOnList(Mob *center) { // hack fix for zone shutdown crashes on some servers if (!zone->IsLoaded()) return nullptr; - Mob* top = nullptr; + Mob* top_hate = nullptr; int32 hate = -1; if (center == nullptr) return nullptr; if (RuleB(Aggro, SmartAggroList)){ - Mob* topClientTypeInRange = nullptr; - int32 hateClientTypeInRange = -1; + Mob* top_client_type_in_range = nullptr; + int32 hate_client_type_in_range = -1; int skipped_count = 0; auto iterator = list.begin(); while (iterator != list.end()) { struct_HateList *cur = (*iterator); - int16 aggroMod = 0; + int16 aggro_mod = 0; if (!cur){ ++iterator; @@ -321,7 +319,7 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center) if (cur->entity_on_hatelist->Sanctuary()) { if (hate == -1) { - top = cur->entity_on_hatelist; + top_hate = cur->entity_on_hatelist; hate = 1; } ++iterator; @@ -331,32 +329,32 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center) if (cur->entity_on_hatelist->DivineAura() || cur->entity_on_hatelist->IsMezzed() || cur->entity_on_hatelist->IsFeared()){ if (hate == -1) { - top = cur->entity_on_hatelist; + top_hate = cur->entity_on_hatelist; hate = 0; } ++iterator; continue; } - int32 currentHate = cur->stored_hate_amount; + int32 current_hate = cur->stored_hate_amount; if (cur->entity_on_hatelist->IsClient()){ if (cur->entity_on_hatelist->CastToClient()->IsSitting()){ - aggroMod += RuleI(Aggro, SittingAggroMod); + aggro_mod += RuleI(Aggro, SittingAggroMod); } if (center){ if (center->GetTarget() == cur->entity_on_hatelist) - aggroMod += RuleI(Aggro, CurrentTargetAggroMod); + aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { if (center->CombatRange(cur->entity_on_hatelist)){ - aggroMod += RuleI(Aggro, MeleeRangeAggroMod); + aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); - if (currentHate > hateClientTypeInRange || cur->is_entity_frenzy){ - hateClientTypeInRange = currentHate; - topClientTypeInRange = cur->entity_on_hatelist; + if (current_hate > hate_client_type_in_range || cur->is_entity_frenzy){ + hate_client_type_in_range = current_hate; + top_client_type_in_range = cur->entity_on_hatelist; } } } @@ -366,67 +364,67 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center) else{ if (center){ if (center->GetTarget() == cur->entity_on_hatelist) - aggroMod += RuleI(Aggro, CurrentTargetAggroMod); + aggro_mod += RuleI(Aggro, CurrentTargetAggroMod); if (RuleI(Aggro, MeleeRangeAggroMod) != 0) { if (center->CombatRange(cur->entity_on_hatelist)){ - aggroMod += RuleI(Aggro, MeleeRangeAggroMod); + aggro_mod += RuleI(Aggro, MeleeRangeAggroMod); } } } } if (cur->entity_on_hatelist->GetMaxHP() != 0 && ((cur->entity_on_hatelist->GetHP() * 100 / cur->entity_on_hatelist->GetMaxHP()) < 20)){ - aggroMod += RuleI(Aggro, CriticallyWoundedAggroMod); + aggro_mod += RuleI(Aggro, CriticallyWoundedAggroMod); } - if (aggroMod){ - currentHate += (currentHate * aggroMod / 100); + if (aggro_mod){ + current_hate += (current_hate * aggro_mod / 100); } - if (currentHate > hate || cur->is_entity_frenzy){ - hate = currentHate; - top = cur->entity_on_hatelist; + if (current_hate > hate || cur->is_entity_frenzy){ + hate = current_hate; + top_hate = cur->entity_on_hatelist; } ++iterator; } - if (topClientTypeInRange != nullptr && top != nullptr) { - bool isTopClientType = top->IsClient(); + if (top_client_type_in_range != nullptr && top_hate != nullptr) { + bool isTopClientType = top_hate->IsClient(); #ifdef BOTS if (!isTopClientType) { - if (top->IsBot()) { + if (top_hate->IsBot()) { isTopClientType = true; - topClientTypeInRange = top; + top_client_type_in_range = top_hate; } } #endif //BOTS if (!isTopClientType) { - if (top->IsMerc()) { + if (top_hate->IsMerc()) { isTopClientType = true; - topClientTypeInRange = top; + top_client_type_in_range = top_hate; } } if (!isTopClientType) { - if (top->GetSpecialAbility(ALLOW_TO_TANK)){ + if (top_hate->GetSpecialAbility(ALLOW_TO_TANK)){ isTopClientType = true; - topClientTypeInRange = top; + top_client_type_in_range = top_hate; } } if (!isTopClientType) - return topClientTypeInRange ? topClientTypeInRange : nullptr; + return top_client_type_in_range ? top_client_type_in_range : nullptr; - return top ? top : nullptr; + return top_hate ? top_hate : nullptr; } else { - if (top == nullptr && skipped_count > 0) { + if (top_hate == nullptr && skipped_count > 0) { return center->GetTarget() ? center->GetTarget() : nullptr; } - return top ? top : nullptr; + return top_hate ? top_hate : nullptr; } } else{ @@ -445,20 +443,20 @@ Mob *HateList::GetEntWithMostHateInRange(Mob *center) if (cur->entity_on_hatelist != nullptr && ((cur->stored_hate_amount > hate) || cur->is_entity_frenzy)) { - top = cur->entity_on_hatelist; + top_hate = cur->entity_on_hatelist; hate = cur->stored_hate_amount; } ++iterator; } - if (top == nullptr && skipped_count > 0) { + if (top_hate == nullptr && skipped_count > 0) { return center->GetTarget() ? center->GetTarget() : nullptr; } - return top ? top : nullptr; + return top_hate ? top_hate : nullptr; } return nullptr; } -Mob *HateList::GetEntWithMostHateInRange(){ +Mob *HateList::GetEntWithMostHateOnList(){ Mob* top = nullptr; int32 hate = -1; @@ -499,26 +497,24 @@ Mob *HateList::GetRandomEntOnHateList() return (*iterator)->entity_on_hatelist; } -int32 HateList::GetEntHateAmount(Mob *ent, bool damage) +int32 HateList::GetEntHateAmount(Mob *in_entity, bool damage) { - struct_HateList *p; + struct_HateList *entity; - p = Find(ent); + entity = Find(in_entity); - if (p && damage) - return p->hatelist_damage; - else if (p) - return p->stored_hate_amount; + if (entity && damage) + return entity->hatelist_damage; + else if (entity) + return entity->stored_hate_amount; else return 0; } -//looking for any mob with hate > -1 bool HateList::IsHateListEmpty() { return(list.size() == 0); } -// Prints hate list to a client void HateList::PrintHateListToClient(Client *c) { auto iterator = list.begin(); diff --git a/zone/hate_list.h b/zone/hate_list.h index 40e8188d5..1320aa140 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -38,53 +38,38 @@ public: HateList(); ~HateList(); - // adds a mob to the hatelist - void AddEntToHateList(Mob *ent, int32 in_hate = 0, int32 in_dam = 0, bool bFrenzy = false, bool iAddIfNotExist = true); - // sets existing hate - void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam); - // removes mobs from hatelist - bool RemoveEntFromHateList(Mob *ent); - // Remove all - void WipeHateList(); - // ??? - void DoFactionHits(int32 nfl_id); - // Gets Hate amount for mob - int32 GetEntHateAmount(Mob *ent, bool damage = false); - // gets top hated mob - Mob *GetEntWithMostHateInRange(Mob *center); - // gets any on the list - Mob *GetRandomEntOnHateList(); - // get closest mob or nullptr if list empty Mob *GetClosestEntOnHateList(Mob *hater); - // gets top mob or nullptr if hate list empty Mob *GetDamageTopOnHateList(Mob *hater); - // used to check if mob is on hatelist + Mob *GetEntWithMostHateOnList(Mob *center); + Mob *GetRandomEntOnHateList(); + Mob* GetEntWithMostHateOnList(); + bool IsEntOnHateList(Mob *); - // used to remove or add frenzy hate - void IsEntityInFrenzyMode(); - //Gets the target with the most hate regardless of things like frenzy etc. - Mob* GetEntWithMostHateInRange(); - // Count 'Summoned' pets on hatelist - int GetSummonedPetCountOnHateList(Mob *hater); + bool IsHateListEmpty(); + bool RemoveEntFromHateList(Mob *ent); int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts); + int GetSummonedPetCountOnHateList(Mob *hater); - void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); + int32 GetEntHateAmount(Mob *ent, bool in_damage = false); - bool IsHateListEmpty(); - void PrintHateListToClient(Client *c); - - //For accessing the hate list via perl; don't use for anything else std::list& GetHateList() { return list; } - //setting owner - void SetOwner(Mob *newOwner) { owner = newOwner; } + void AddEntToHateList(Mob *ent, int32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true); + void DoFactionHits(int32 npc_faction_level_id); + void IsEntityInFrenzyMode(); + void PrintHateListToClient(Client *c); + void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_damage); + void SetOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; } + void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); + void WipeHateList(); + protected: struct_HateList* Find(Mob *ent); private: std::list list; - Mob *owner; + Mob *hate_owner; }; #endif \ No newline at end of file diff --git a/zone/mob.cpp b/zone/mob.cpp index c95814a7b..481159290 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2565,7 +2565,7 @@ bool Mob::RemoveFromHateList(Mob* mob) } if(GetTarget() == mob) { - SetTarget(hate_list.GetEntWithMostHateInRange(this)); + SetTarget(hate_list.GetEntWithMostHateOnList(this)); } return bFound; diff --git a/zone/mob.h b/zone/mob.h index 4f3a0ea82..47d2cca2f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -460,10 +460,10 @@ public: void DoubleAggro(Mob *other) { uint32 in_hate = GetHateAmount(other); SetHateAmountOnEnt(other, (in_hate ? in_hate * 2 : 1)); } uint32 GetHateAmount(Mob* tmob, bool is_dam = false) { return hate_list.GetEntHateAmount(tmob,is_dam);} uint32 GetDamageAmount(Mob* tmob) { return hate_list.GetEntHateAmount(tmob, true);} - Mob* GetHateTop() { return hate_list.GetEntWithMostHateInRange(this);} + Mob* GetHateTop() { return hate_list.GetEntWithMostHateOnList(this);} Mob* GetHateDamageTop(Mob* other) { return hate_list.GetDamageTopOnHateList(other);} Mob* GetHateRandom() { return hate_list.GetRandomEntOnHateList();} - Mob* GetHateMost() { return hate_list.GetEntWithMostHateInRange();} + Mob* GetHateMost() { return hate_list.GetEntWithMostHateOnList();} bool IsEngaged() { return(!hate_list.IsHateListEmpty()); } bool HateSummon(); void FaceTarget(Mob* MobToFace = 0); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 827c9a0a3..5802bfd93 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -819,7 +819,7 @@ void Client::AI_Process() { if(AItarget_check_timer->Check()) { - SetTarget(hate_list.GetEntWithMostHateInRange(this)); + SetTarget(hate_list.GetEntWithMostHateOnList(this)); } } @@ -1096,11 +1096,11 @@ void Mob::AI_Process() { { if (IsFocused()) { if (!target) { - SetTarget(hate_list.GetEntWithMostHateInRange(this)); + SetTarget(hate_list.GetEntWithMostHateOnList(this)); } } else { if (!ImprovedTaunt()) - SetTarget(hate_list.GetEntWithMostHateInRange(this)); + SetTarget(hate_list.GetEntWithMostHateOnList(this)); } } @@ -1374,7 +1374,7 @@ void Mob::AI_Process() { //underwater stuff only works with water maps in the zone! if(IsNPC() && CastToNPC()->IsUnderwaterOnly() && zone->HasWaterMap()) { if(!zone->watermap->InLiquid(target->GetX(), target->GetY(), target->GetZ())) { - Mob *tar = hate_list.GetEntWithMostHateInRange(this); + Mob *tar = hate_list.GetEntWithMostHateOnList(this); if(tar == target) { WipeHateList(); Heal(); From 4af3834715bda8b471b5b667197f4171debdfe7e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 27 Dec 2014 23:52:44 -0600 Subject: [PATCH 0712/1883] Some more refactoring of hate_list --- zone/hate_list.cpp | 10 +++++----- zone/hate_list.h | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 0ee996f8d..c62dbdab1 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -152,7 +152,7 @@ Mob* HateList::GetDamageTopOnHateList(Mob* hater) } Mob* HateList::GetClosestEntOnHateList(Mob *hater) { - Mob* close = nullptr; + Mob* close_entity = nullptr; float close_distance = 99999.9f; float this_distance; @@ -161,15 +161,15 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) { this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { close_distance = this_distance; - close = (*iterator)->entity_on_hatelist; + close_entity = (*iterator)->entity_on_hatelist; } ++iterator; } - if ((!close && hater->IsNPC()) || (close && close->DivineAura())) - close = hater->CastToNPC()->GetHateTop(); + if ((!close_entity && hater->IsNPC()) || (close_entity && close_entity->DivineAura())) + close_entity = hater->CastToNPC()->GetHateTop(); - return close; + return close_entity; } void HateList::AddEntToHateList(Mob *in_entity, int32 in_hate, int32 in_damage, bool in_is_entity_frenzied, bool iAddIfNotExist) diff --git a/zone/hate_list.h b/zone/hate_list.h index 1320aa140..dda8cb21d 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -28,7 +28,8 @@ struct ExtraAttackOptions; struct struct_HateList { Mob *entity_on_hatelist; - int32 hatelist_damage, stored_hate_amount; + int32 hatelist_damage; + uint32 stored_hate_amount; bool is_entity_frenzy; }; @@ -44,7 +45,7 @@ public: Mob *GetRandomEntOnHateList(); Mob* GetEntWithMostHateOnList(); - bool IsEntOnHateList(Mob *); + bool IsEntOnHateList(Mob *mob); bool IsHateListEmpty(); bool RemoveEntFromHateList(Mob *ent); @@ -60,7 +61,7 @@ public: void IsEntityInFrenzyMode(); void PrintHateListToClient(Client *c); void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_damage); - void SetOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; } + void SetHateOwner(Mob *new_hate_owner) { hate_owner = new_hate_owner; } void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr); void WipeHateList(); From 2dadc9ff242a3330cf1e6201552396d8eca2d1ba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 28 Dec 2014 00:06:51 -0600 Subject: [PATCH 0713/1883] Change SetOwner to SetHateOwner refactor --- zone/mob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 481159290..79391de5c 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -401,7 +401,7 @@ Mob::Mob(const char* in_name, PathingRouteUpdateTimerLong = new Timer(RuleI(Pathing, RouteUpdateFrequencyLong)); DistractedFromGrid = false; PathingTraversedNodes = 0; - hate_list.SetOwner(this); + hate_list.SetHateOwner(this); m_AllowBeneficial = false; m_DisableMelee = false; From dab3d1181eba60b0ce0af5b7df06eb195d7f5b9e Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 28 Dec 2014 12:49:14 -0500 Subject: [PATCH 0714/1883] Implemented class Client::TextLink --- changelog.txt | 3 + zone/bot.cpp | 53 +++----- zone/client.cpp | 233 +++++++++++++++++++++++++++++++++ zone/client.h | 57 +++++++- zone/command.cpp | 317 +++++++++++++++++---------------------------- zone/corpse.cpp | 33 +++-- zone/inventory.cpp | 77 +---------- zone/npc.cpp | 14 +- zone/questmgr.cpp | 73 +++++------ zone/tasks.cpp | 31 ++--- 10 files changed, 498 insertions(+), 393 deletions(-) diff --git a/changelog.txt b/changelog.txt index 34fca5197..a7f8ed9f2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/28/2014 == +Uleat: Implemented class Client::TextLink as a replacement for the dozens of individual link formatters. + == 12/27/2014 == Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github Trevius: (RoF2) Fixed dropping items on the ground so they go to ground level instead of camera height. diff --git a/zone/bot.cpp b/zone/bot.cpp index 4fd830659..d41b6db11 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -11699,58 +11699,47 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { const char* equipped[EmuConstants::EQUIPMENT_SIZE] = {"Charm", "Left Ear", "Head", "Face", "Right Ear", "Neck", "Shoulders", "Arms", "Back", "Left Wrist", "Right Wrist", "Range", "Hands", "Primary Hand", "Secondary Hand", "Left Finger", "Right Finger", "Chest", "Legs", "Feet", "Waist", "Ammo" }; - const ItemInst* item1 = nullptr; - const Item_Struct* item2 = nullptr; + + const ItemInst* inst = nullptr; + const Item_Struct* item = nullptr; bool is2Hweapon = false; - for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) - { + + std::string item_link; + Client::TextLink linker; + linker.SetLinkType(linker.linkItemInst); + linker.SetClientVersion(c->GetClientVersion()); + + for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { if((i == MainSecondary) && is2Hweapon) { continue; } - item1 = b->CastToBot()->GetBotItem(i); - if(item1) - item2 = item1->GetItem(); + inst = b->CastToBot()->GetBotItem(i); + if (inst) + item = inst->GetItem(); else - item2 = nullptr; + item = nullptr; if(!TempErrorMessage.empty()) { c->Message(13, "Database Error: %s", TempErrorMessage.c_str()); return; } - if(item2 == nullptr) { + if(item == nullptr) { c->Message(15, "I need something for my %s (Item %i)", equipped[i], i); continue; } - if((i == MainPrimary) && ((item2->ItemType == ItemType2HSlash) || (item2->ItemType == ItemType2HBlunt) || (item2->ItemType == ItemType2HPiercing))) { + if((i == MainPrimary) && ((item->ItemType == ItemType2HSlash) || (item->ItemType == ItemType2HBlunt) || (item->ItemType == ItemType2HPiercing))) { is2Hweapon = true; } - char* link_core = nullptr; - std::string link_base; - // I could not find a difference between the criteria positive code and the criteria negative code.. - // ..so, I deleted the check (criteria: i = { MainCharm, MainRange, MainPrimary, MainSecondary, MainAmmo }) + // ..so, I deleted the check (old criteria: i = { MainCharm, MainRange, MainPrimary, MainSecondary, MainAmmo }) + + linker.SetItemInst(inst); - c->MakeItemLink( - link_core, - item2, - item1->GetAugmentItemID(0), - item1->GetAugmentItemID(1), - item1->GetAugmentItemID(2), - item1->GetAugmentItemID(3), - item1->GetAugmentItemID(4), - item1->GetAugmentItemID(5) - ); + item_link = linker.GenerateLink(); - if (link_core) - link_base = StringFormat("%c%s%s%c", 0x12, link_core, item2->Name, 0x12); - else - link_base = ""; - - c->Message(15, "Using %s in my %s (Item %i)", link_base.c_str(), equipped[i], i); - - safe_delete_array(link_core); + c->Message(15, "Using %s in my %s (Item %i)", item_link.c_str(), equipped[i], i); } } else { diff --git a/zone/client.cpp b/zone/client.cpp index e25aec69a..0ad34d752 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8258,3 +8258,236 @@ void Client::SendColoredText(uint32 color, std::string message) safe_delete(outapp); } + +// +// class Client::TextLink +// +std::string Client::TextLink::GenerateLink() +{ + m_Link.clear(); + m_LinkBody.clear(); + m_LinkText.clear(); + + generate_body(); + generate_text(); + + if (m_LinkBody.length() && m_LinkText.length()) { + m_Link.append(StringFormat("%c", 0x12)); + m_Link.append(m_LinkBody); + m_Link.append(m_LinkText); + m_Link.append(StringFormat("%c", 0x12)); + } + + if ((m_Link.length() == 0) || (m_Link.length() > 250)) { + m_Error = true; + m_Link = ""; + _log(CHANNELS__ERROR, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {l: %u, b: %u, t: %u})", + m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); + } + + return m_Link; +} + +const char* Client::TextLink::GetLink() +{ + if (m_Link.length() == 0) + return nullptr; + + return m_Link.c_str(); +} + +const char* Client::TextLink::GetLinkBody() +{ + if (m_LinkBody.length() == 0) + return nullptr; + + return m_LinkBody.c_str(); +} + +const char* Client::TextLink::GetLinkText() +{ + if (m_LinkText.length() == 0) + return nullptr; + + return m_LinkText.c_str(); +} + +std::string Client::TextLink::GetLinkString() +{ + if (m_Link.length() == 0) + return ""; + + return m_Link; +} + +std::string Client::TextLink::GetLinkBodyString() +{ + if (m_LinkBody.length() == 0) + return ""; + + return m_LinkBody; +} + +std::string Client::TextLink::GetLinkTextString() +{ + if (m_LinkText.length() == 0) + return ""; + + return m_LinkText; +} + +void Client::TextLink::Reset() +{ + m_LinkType = linkBlank; + m_ItemData = nullptr; + m_LootData = nullptr; + m_ItemInst = nullptr; + m_ProxyItemID = NOT_USED; + m_ProxyText = nullptr; + m_TaskUse = false; + m_Link.clear(); + m_LinkBody.clear(); + m_LinkText.clear(); + m_ClientVersion = EQClientUnknown; + m_Error = false; +} + +void Client::TextLink::generate_body() +{ + enum { field_0 = 0, field_1, field_2, field_3, field_4, field_5, field_6, field_7, field_8, field_9, field_10, field_11, field_12, field_13 }; + static const int field_count = 14; + static const bool field_use[_EQClientCount][field_count] = { + // 6.2: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" + // SoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + // RoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + // RoF2: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" + +//(RoF2) %01x %05x %05x %05x %05x %05x %05x %05x %01x %01x %04x %01x %05x %08x + { true, true, true, true, true, true, true, true, true, true, true, true, true, true }, // EQClientUnknown + { true, true, true, true, true, true, true, false, false, true, true, true, false, true }, // EQClient6.2 + { true, true, true, true, true, true, true, false, false, true, true, true, false, true }, // EQClientTitanium + { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientSoF + { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientSoD + { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientUnderfoot + { true, true, true, true, true, true, true, true, false, true, true, true, true, true }, // EQClientRoF + { true, true, true, true, true, true, true, true, true, true, true, true, true, true } // EQClientRoF2 + }; + +/*%01X*/ uint8 unknown_0 = NOT_USED; +/*%05X*/ uint32 item_id = NOT_USED; +/*%05X*/ uint32 augment_0 = NOT_USED; +/*%05X*/ uint32 augment_1 = NOT_USED; +/*%05X*/ uint32 augment_2 = NOT_USED; +/*%05X*/ uint32 augment_3 = NOT_USED; +/*%05X*/ uint32 augment_4 = NOT_USED; +/*%05X*/ uint32 augment_5 = NOT_USED; +/*%01X*/ uint8 unknown_8 = NOT_USED; +/*%01X*/ uint8 unknown_9 = NOT_USED; +/*%04X*/ uint32 unknown_10 = NOT_USED; +/*%01X*/ uint8 unknown_11 = NOT_USED; +/*%05X*/ uint32 unknown_12 = NOT_USED; +/*%08X*/ int hash = NOT_USED; + + switch (m_LinkType) { + case linkBlank: + break; + case linkItemData: + if (m_ItemData != nullptr) { + item_id = m_ItemData->ID; + // TODO: add hash call + } + break; + case linkLootItem: + if (m_LootData != nullptr) { + const Item_Struct* item_data = database.GetItem(m_LootData->item_id); + if (item_data == nullptr) { break; } + item_id = item_data->ID; + augment_0 = m_LootData->aug_1; + augment_1 = m_LootData->aug_2; + augment_2 = m_LootData->aug_3; + augment_3 = m_LootData->aug_4; + augment_4 = m_LootData->aug_5; + augment_5 = m_LootData->aug_6; + // TODO: add hash call + } + break; + case linkItemInst: + if (m_ItemInst != nullptr) { + if (m_ItemInst->GetItem() == nullptr) { break; } + item_id = m_ItemInst->GetItem()->ID; + augment_0 = m_ItemInst->GetAugmentItemID(0); + augment_1 = m_ItemInst->GetAugmentItemID(1); + augment_2 = m_ItemInst->GetAugmentItemID(2); + augment_3 = m_ItemInst->GetAugmentItemID(3); + augment_4 = m_ItemInst->GetAugmentItemID(4); + augment_5 = m_ItemInst->GetAugmentItemID(5); + // TODO: add hash call + } + break; + default: + break; + } + + if (m_ProxyItemID != NOT_USED) { + item_id = m_ProxyItemID; + } + + if (m_TaskUse) { + hash = 0x0000000014505DC2; + } + + if (field_use[m_ClientVersion][field_0]) { m_LinkBody.append(StringFormat("%01x", unknown_0)); } + if (field_use[m_ClientVersion][field_1]) { m_LinkBody.append(StringFormat("%05x", item_id)); } + if (field_use[m_ClientVersion][field_2]) { m_LinkBody.append(StringFormat("%05x", augment_0)); } + if (field_use[m_ClientVersion][field_3]) { m_LinkBody.append(StringFormat("%05x", augment_1)); } + if (field_use[m_ClientVersion][field_4]) { m_LinkBody.append(StringFormat("%05x", augment_2)); } + if (field_use[m_ClientVersion][field_5]) { m_LinkBody.append(StringFormat("%05x", augment_3)); } + if (field_use[m_ClientVersion][field_6]) { m_LinkBody.append(StringFormat("%05x", augment_4)); } + if (field_use[m_ClientVersion][field_7]) { m_LinkBody.append(StringFormat("%05x", augment_5)); } + if (field_use[m_ClientVersion][field_8]) { m_LinkBody.append(StringFormat("%01x", unknown_8)); } + if (field_use[m_ClientVersion][field_9]) { m_LinkBody.append(StringFormat("%01x", unknown_9)); } + if (field_use[m_ClientVersion][field_10]) { m_LinkBody.append(StringFormat("%04x", unknown_10)); } + if (field_use[m_ClientVersion][field_11]) { m_LinkBody.append(StringFormat("%01x", unknown_11)); } + if (field_use[m_ClientVersion][field_12]) { m_LinkBody.append(StringFormat("%05x", unknown_12)); } + if (field_use[m_ClientVersion][field_13]) { m_LinkBody.append(StringFormat("%08x", hash)); } +} + +void Client::TextLink::generate_text() +{ + if (m_ProxyText != nullptr) { + m_LinkText = m_ProxyText; + return; + } + + switch (m_LinkType) { + case linkBlank: + break; + case linkItemData: + if (m_ItemData != nullptr) { + m_LinkText = m_ItemData->Name; + return; + } + break; + case linkLootItem: + if (m_LootData != nullptr) { + const Item_Struct* item_data = database.GetItem(m_LootData->item_id); + if (item_data != nullptr) { + m_LinkText = item_data->Name; + return; + } + } + break; + case linkItemInst: + if (m_ItemInst != nullptr) { + if (m_ItemInst->GetItem() != nullptr) { + m_LinkText = m_ItemInst->GetItem()->Name; + return; + } + } + break; + default: + break; + } + + m_LinkText = "null"; +} diff --git a/zone/client.h b/zone/client.h index c88971dd4..ee9f990da 100644 --- a/zone/client.h +++ b/zone/client.h @@ -815,12 +815,57 @@ public: void SetStats(uint8 type,int16 set_val); void IncStats(uint8 type,int16 increase_val); void DropItem(int16 slot_id); - bool MakeItemLink(char* &ret_link, const Item_Struct* item, uint32 aug0=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0, uint8 evolving=0, uint8 evolvedlevel=0); - bool MakeItemLink(char* &ret_link, const ItemInst* inst); - bool MakeTaskLink(char* &ret_link); - bool MakeBlankLink(char* &ret_link); - static bool MakeBlankLink_(char* &ret_link); - int GetItemLinkHash(const ItemInst* inst); + + // + // class Client::TextLink + // + class TextLink { + public: + enum LinkType { linkBlank = 0, linkItemData, linkLootItem, linkItemInst }; + + TextLink() { Reset(); } + + void SetLinkType(LinkType linkType) { m_LinkType = linkType; } + void SetItemData(const Item_Struct* itemData) { m_ItemData = itemData; } + void SetLootData(const ServerLootItem_Struct* lootData) { m_LootData = lootData; } + void SetItemInst(const ItemInst* itemInst) { m_ItemInst = itemInst; } + void SetProxyItemID(uint32 proxyItemID) { m_ProxyItemID = proxyItemID; } // mainly for saylinks..but, not limited to + void SetProxyText(const char* proxyText) { m_ProxyText = proxyText; } // overrides standard text use + void SetTaskUse() { m_TaskUse = true; } + void SetClientVersion(EQClientVersion clientVersion) { m_ClientVersion = EQLimits::ValidateClientVersion(clientVersion); } + + std::string GenerateLink(); + bool LinkError() { return m_Error; } + + const char* GetLink(); // contains full format: '/12x' '' '' '/12x' + const char* GetLinkBody(); // contains format: '' + const char* GetLinkText(); // contains format: '' + std::string GetLinkString(); + std::string GetLinkBodyString(); + std::string GetLinkTextString(); + + void Reset(); + + private: + void generate_body(); + void generate_text(); + + int m_LinkType; + const Item_Struct* m_ItemData; + const ServerLootItem_Struct* m_LootData; + const ItemInst* m_ItemInst; + uint32 m_ProxyItemID; + const char* m_ProxyText; + bool m_TaskUse; + std::string m_Link; + std::string m_LinkBody; + std::string m_LinkText; + EQClientVersion m_ClientVersion; + bool m_Error; + }; + + int GetItemLinkHash(const ItemInst* inst); // move to Item_Struct..or make use of the pre-calculated database field + void SendItemLink(const ItemInst* inst, bool sendtoall=false); void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); diff --git a/zone/command.cpp b/zone/command.cpp index ba3ffd5a7..d31ea97b7 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2615,117 +2615,93 @@ void command_peekinv(Client *c, const Seperator *sep) } Client* targetClient = c->GetTarget()->CastToClient(); - const ItemInst* instMain = nullptr; - const ItemInst* instSub = nullptr; - const Item_Struct* itemData = nullptr; - char* itemLinkCore = nullptr; - std::string itemLink; + const ItemInst* inst_main = nullptr; + const ItemInst* inst_sub = nullptr; + const Item_Struct* item_data = nullptr; + std::string item_link; + Client::TextLink linker; + linker.SetLinkType(linker.linkItemInst); + linker.SetClientVersion(c->GetClientVersion()); c->Message(0, "Displaying inventory for %s...", targetClient->GetName()); // worn for (int16 indexMain = EmuConstants::EQUIPMENT_BEGIN; (scopeWhere & peekWorn) && (indexMain <= EmuConstants::EQUIPMENT_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); + item_link = linker.GenerateLink(); - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); - - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "WornSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); } if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= EQClientSoF)) { - instMain = targetClient->GetInv().GetItem(MainPowerSource); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; - - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); + inst_main = targetClient->GetInv().GetItem(MainPowerSource); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - c->Message((itemData == 0), "WornSlot: %i, Item: %i (%s), Charges: %i", - MainPowerSource, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "WornSlot: %i, Item: %i (%s), Charges: %i", + MainPowerSource, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); } // inv for (int16 indexMain = EmuConstants::GENERAL_BEGIN; (scopeWhere & peekInv) && (indexMain <= EmuConstants::GENERAL_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "InvSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "InvSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + for (uint8 indexSub = SUB_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " InvBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } // cursor if (scopeWhere & peekCursor) { if (targetClient->GetInv().CursorEmpty()) { + linker.SetItemInst(nullptr); + + item_link = linker.GenerateLink(); + c->Message(1, "CursorSlot: %i, Item: %i (%s), Charges: %i", - MainCursor, 0, "null", 0); + MainCursor, 0, item_link.c_str(), 0); } else { int cursorDepth = 0; for (iter_queue it = targetClient->GetInv().cursor_begin(); (it != targetClient->GetInv().cursor_end()); ++it, ++cursorDepth) { - instMain = *it; - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = *it; + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", - MainCursor, cursorDepth, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "CursorSlot: %i, Depth: %i, Item: %i (%s), Charges: %i", + MainCursor, cursorDepth, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_BEGIN; (cursorDepth == 0) && instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + for (uint8 indexSub = SUB_BEGIN; (cursorDepth == 0) && inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " CursorBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(MainCursor, indexSub), MainCursor, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } } @@ -2733,116 +2709,81 @@ void command_peekinv(Client *c, const Seperator *sep) // trib for (int16 indexMain = EmuConstants::TRIBUTE_BEGIN; (scopeWhere & peekTrib) && (indexMain <= EmuConstants::TRIBUTE_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "TributeSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "TributeSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); } // bank for (int16 indexMain = EmuConstants::BANK_BEGIN; (scopeWhere & peekBank) && (indexMain <= EmuConstants::BANK_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null" ); - - c->Message((itemData == 0), "BankSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "BankSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + for (uint8 indexSub = SUB_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " BankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } for (int16 indexMain = EmuConstants::SHARED_BANK_BEGIN; (scopeWhere & peekBank) && (indexMain <= EmuConstants::SHARED_BANK_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); + item_link = linker.GenerateLink(); - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + c->Message((item_data == nullptr), "SharedBankSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - safe_delete_array(itemLinkCore); + for (uint8 indexSub = SUB_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + item_link = linker.GenerateLink(); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); - - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " SharedBankBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } // trade for (int16 indexMain = EmuConstants::TRADE_BEGIN; (scopeWhere & peekTrade) && (indexMain <= EmuConstants::TRADE_END); ++indexMain) { - instMain = targetClient->GetInv().GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = targetClient->GetInv().GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "TradeSlot: %i, Item: %i (%s), Charges: %i", - indexMain, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "TradeSlot: %i, Item: %i (%s), Charges: %i", + indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + for (uint8 indexSub = SUB_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " TradeBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + Inventory::CalcSlotId(indexMain, indexSub), indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } @@ -2857,34 +2798,24 @@ void command_peekinv(Client *c, const Seperator *sep) c->Message(0, "[WorldObject DBID: %i (entityid: %i)]", objectTradeskill->GetDBID(), objectTradeskill->GetID()); for (int16 indexMain = MAIN_BEGIN; indexMain < EmuConstants::MAP_WORLD_SIZE; ++indexMain) { - instMain = objectTradeskill->GetItem(indexMain); - itemData = (instMain ? instMain->GetItem() : nullptr); - itemLinkCore = nullptr; + inst_main = objectTradeskill->GetItem(indexMain); + item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); + linker.SetItemInst(inst_main); - if (itemData) - c->MakeItemLink(itemLinkCore, instMain); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instMain->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), "WorldSlot: %i, Item: %i (%s), Charges: %i", - (EmuConstants::WORLD_BEGIN + indexMain), ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instMain->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), "WorldSlot: %i, Item: %i (%s), Charges: %i", + (EmuConstants::WORLD_BEGIN + indexMain), ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); - for (uint8 indexSub = SUB_BEGIN; instMain && instMain->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { - instSub = instMain->GetItem(indexSub); - itemData = (instSub ? instSub->GetItem() : nullptr); - itemLinkCore = nullptr; + for (uint8 indexSub = SUB_BEGIN; inst_main && inst_main->IsType(ItemClassContainer) && (indexSub < EmuConstants::ITEM_CONTAINER_SIZE); ++indexSub) { + inst_sub = inst_main->GetItem(indexSub); + item_data = (inst_sub == nullptr) ? nullptr : inst_sub->GetItem(); + linker.SetItemInst(inst_sub); - if (itemData) - c->MakeItemLink(itemLinkCore, instSub); - - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, instSub->GetItem()->Name, 0x12) : "null"); - - c->Message((itemData == 0), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", - INVALID_INDEX, indexMain, indexSub, ((itemData == 0) ? 0 : itemData->ID), itemLink.c_str(), ((itemData == 0) ? 0 : instSub->GetCharges())); + item_link = linker.GenerateLink(); - safe_delete_array(itemLinkCore); + c->Message((item_data == nullptr), " WorldBagSlot: %i (Slot #%i, Bag #%i), Item: %i (%s), Charges: %i", + INVALID_INDEX, indexMain, indexSub, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_sub == nullptr) ? 0 : inst_sub->GetCharges())); } } } @@ -5640,22 +5571,19 @@ void command_itemsearch(Client *c, const Seperator *sep) const char *search_criteria=sep->argplus[1]; const Item_Struct* item = nullptr; + std::string item_link; + Client::TextLink linker; + linker.SetLinkType(linker.linkItemData); + linker.SetClientVersion(c->GetClientVersion()); + if (Seperator::IsNumber(search_criteria)) { item = database.GetItem(atoi(search_criteria)); if (item) { - char* link_core = nullptr; - std::string link_base; + linker.SetItemData(item); - c->MakeItemLink(link_core, item); + item_link = linker.GenerateLink(); - if (link_core) - link_base = StringFormat("%c%s%s%c", 0x12, link_core, item->Name, 0x12); - else - link_base = ""; - - c->Message(0, "%i: %s", (int)item->ID, link_base.c_str()); - - safe_delete_array(link_core); + c->Message(0, "%u: %s", item->ID, item_link.c_str()); } else { c->Message(0, "Item #%s not found", search_criteria); @@ -5676,19 +5604,12 @@ void command_itemsearch(Client *c, const Seperator *sep) strupr(sName); pdest = strstr(sName, sCriteria); if (pdest != nullptr) { - char* link_core = nullptr; - std::string link_base; + linker.SetItemData(item); - c->MakeItemLink(link_core, item); + item_link = linker.GenerateLink(); - if (link_core) - link_base = StringFormat("%c%s%s%c", 0x12, link_core, item->Name, 0x12); - else - link_base = ""; + c->Message(0, "%u: %s", item->ID, item_link.c_str()); - c->Message(0, "%i: %s", (int)item->ID, link_base.c_str()); - - safe_delete_array(link_core); ++count; } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 1e3bdcafb..a99b8b500 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1254,33 +1254,38 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { } } - if (GetPlayerKillItem() != -1){ + if (GetPlayerKillItem() != -1) { SetPlayerKillItemID(0); } /* Send message with item link to groups and such */ - char *link = 0, *link2 = 0; //just like a db query :-) - client->MakeItemLink(link2, inst); - MakeAnyLenString(&link, "%c" "%s" "%s" "%c", - 0x12, - link2, - item->Name, - 0x12); - safe_delete_array(link2); + Client::TextLink linker; + linker.SetLinkType(linker.linkItemInst); + linker.SetItemInst(inst); + linker.SetClientVersion(client->GetClientVersion()); + + auto item_link = linker.GenerateLink(); + + client->Message_StringID(MT_LootMessages, LOOTED_MESSAGE, item_link.c_str()); - client->Message_StringID(MT_LootMessages, LOOTED_MESSAGE, link); if(!IsPlayerCorpse()) { + // When sending to multiple/unknown client types, we set for the highest client.. + // ..which is processed when 'EQClientUnknown,' or default value, is selected. + // This should help with any current issues..or it may create more! O.o + linker.SetClientVersion(EQClientUnknown); + item_link = linker.GenerateLink(); + Group *g = client->GetGroup(); if(g != nullptr) { - g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), link); - } else { + g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str()); + } + else { Raid *r = client->GetRaid(); if(r != nullptr) { - r->RaidMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), link); + r->RaidMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str()); } } } - safe_delete_array(link); } else { SendEndLootErrorPacket(client); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 0ccd29611..19520a177 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -1027,7 +1027,8 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) } } -bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { +// TODO: needs clean-up to save references +bool MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { //we're sending back the entire "link", minus the null characters & item name //that way, we can use it for regular links & Task links //note: initiator needs to pass us ret_link @@ -1058,7 +1059,8 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, // into it further to determine the cause..but, the function is setup to accept the parameters. // Note: some links appear with '00000' in front of the name..so, it's likely we need to send // some additional information when certain parameters are true -U - switch (GetClientVersion()) { + //switch (GetClientVersion()) { + switch (0) { case EQClientRoF2: // This operator contains 14 parameter masks..but, only 13 parameter values. // Even so, the client link appears ok... Need to figure out the discrepancy -U @@ -1134,76 +1136,6 @@ bool Client::MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, } } -bool Client::MakeItemLink(char* &ret_link, const ItemInst *inst) { - if (!inst) - return false; - - return MakeItemLink( - ret_link, - inst->GetItem(), - inst->GetAugmentItemID(0), - inst->GetAugmentItemID(1), - inst->GetAugmentItemID(2), - inst->GetAugmentItemID(3), - inst->GetAugmentItemID(4), - inst->GetAugmentItemID(5), - inst->IsEvolving(), - inst->GetEvolveLvl() - ); -} - -bool Client::MakeTaskLink(char* &ret_link) -{ - switch (GetClientVersion()) { - case EQClientRoF2: - MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000014505DC2"); - return true; - case EQClientRoF: - MakeAnyLenString(&ret_link, "0000000000000000000000000000000000000000014505DC2"); - return true; - case EQClientUnderfoot: - case EQClientSoD: - case EQClientSoF: - MakeAnyLenString(&ret_link, "00000000000000000000000000000000000014505DC2"); - return true; - case EQClientTitanium: - MakeAnyLenString(&ret_link, "000000000000000000000000000000014505DC2"); - return true; - case EQClient62: - default: - return false; - } -} - -bool Client::MakeBlankLink(char* &ret_link) -{ - switch (GetClientVersion()) { - case EQClientRoF2: - MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000000000"); - return true; - case EQClientRoF: - MakeAnyLenString(&ret_link, "0000000000000000000000000000000000000000000000000"); - return true; - case EQClientUnderfoot: - case EQClientSoD: - case EQClientSoF: - MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000"); - return true; - case EQClientTitanium: - MakeAnyLenString(&ret_link, "000000000000000000000000000000000000000"); - return true; - case EQClient62: - default: - return false; - } -} - -bool Client::MakeBlankLink_(char* &ret_link) -{ - MakeAnyLenString(&ret_link, "00000000000000000000000000000000000000000000000000"); // should be same as newest/longest client in local operator - return true; -} - int Client::GetItemLinkHash(const ItemInst* inst) { //pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc //Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=145 @@ -1292,6 +1224,7 @@ int Client::GetItemLinkHash(const ItemInst* inst) { return hash; } +// This appears to still be in use... The core of this should be incorporated into class Client::TextLink void Client::SendItemLink(const ItemInst* inst, bool send_to_all) { /* diff --git a/zone/npc.cpp b/zone/npc.cpp index ad96af1c4..a478e3b51 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -512,14 +512,14 @@ void NPC::QueryLoot(Client* to) continue; } - char* itemLinkCore = nullptr; - std::string itemLink; + Client::TextLink linker; + linker.SetLinkType(linker.linkItemData); + linker.SetItemData(item); + linker.SetClientVersion(to->GetClientVersion()); - to->MakeItemLink(itemLinkCore, item); - itemLink = (itemLinkCore ? StringFormat("%c%s%s%c", 0x12, itemLinkCore, item->Name, 0x12) : "null"); - to->Message(0, "%s, ID: %u, Level: (min: %u, max: %u)", itemLink.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); - - safe_delete_array(itemLinkCore); + auto item_link = linker.GenerateLink(); + + to->Message(0, "%s, ID: %u, Level: (min: %u, max: %u)", item_link.c_str(), item->ID, (*cur)->min_level, (*cur)->max_level); } to->Message(0, "%i items on %s.", x, GetName()); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index fbf4586bc..8dbc068c7 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1227,15 +1227,18 @@ void QuestManager::settime(uint8 new_hour, uint8 new_min) { void QuestManager::itemlink(int item_id) { QuestManagerCurrentQuestVars(); if (initiator) { - const ItemInst* inst = database.CreateItem(item_id); - char* link = 0; - if (inst == nullptr) + const Item_Struct* item = database.GetItem(item_id); + if (item == nullptr) return; - if (initiator->MakeItemLink(link, inst)) - initiator->Message(0, "%s tells you, %c%s%s%c", owner->GetCleanName(), - 0x12, link, inst->GetItem()->Name, 0x12); - safe_delete_array(link); - safe_delete(inst); + + Client::TextLink linker; + linker.SetLinkType(linker.linkItemData); + linker.SetItemData(item); + linker.SetClientVersion(initiator->GetClientVersion()); + + auto item_link = linker.GenerateLink(); + + initiator->Message(0, "%s tells you, %s", owner->GetCleanName(), item_link.c_str()); } } @@ -2463,17 +2466,19 @@ uint32 QuestManager::MerchantCountItem(uint32 NPCid, uint32 itemid) { // Item Link for use in Variables - "my $example_link = quest::varlink(item_id);" const char* QuestManager::varlink(char* perltext, int item_id) { QuestManagerCurrentQuestVars(); - const ItemInst* inst = database.CreateItem(item_id); - if (!inst) + const Item_Struct* item = database.GetItem(item_id); + if (!item) return "INVALID ITEM ID IN VARLINK"; - char* link = 0; - char* tempstr = 0; - // already uses Client::operator-based item link method - if (initiator->MakeItemLink(link, inst)) { // make a link to the item - snprintf(perltext, 250, "%c%s%s%c", 0x12, link, inst->GetItem()->Name, 0x12); - } - safe_delete_array(link); // MakeItemLink() uses new also - safe_delete(inst); + + Client::TextLink linker; + linker.SetLinkType(linker.linkItemData); + linker.SetItemData(item); + if (initiator) + linker.SetClientVersion(initiator->GetClientVersion()); + + auto item_link = linker.GenerateLink(); + strcpy(perltext, item_link.c_str()); // link length is currently ranged from 1 to 250 in TextLink::GenerateLink() + return perltext; } @@ -2659,33 +2664,15 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam sayid = sayid + 500000; //Create the say link as an item link hash - char* link_core = nullptr; - std::string say_link; + Client::TextLink linker; + linker.SetProxyItemID(sayid); + linker.SetProxyText(LinkName); + if (initiator) + linker.SetClientVersion(initiator->GetClientVersion()); - if (initiator) { - initiator->MakeBlankLink(link_core); + auto say_link = linker.GenerateLink(); + strcpy(Phrase, say_link.c_str()); // link length is currently ranged from 1 to 250 in TextLink::GenerateLink() - if (link_core) - say_link = StringFormat("%c%06x%s%s%c", 0x12, sayid, link_core, LinkName, 0x12); - else - say_link = ""; - } - else { // If no initiator, create an RoF2 saylink, since older clients handle RoF2 ones better than RoF2 handles older ones. - Client::MakeBlankLink_(link_core); // Note: this is a global operator - say_link = StringFormat("%c%06x%s%s%c", 0x12, sayid, link_core, LinkName, 0x12); - } - - safe_delete_array(link_core); - - if (say_link.length() > 250) - strcpy(Phrase, ""); - else if (say_link.length() == 0) - strcpy(Phrase, ""); - else - strcpy(Phrase, say_link.c_str()); - - // Why do we have '(char*)Phrase' as an argument and then return it? - // The current behavior of this function doesn't allow recursive action return Phrase; } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index e0e96d70c..6c7f933b0 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2770,29 +2770,18 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN } if(ItemID) { - char* link_core = nullptr; - std::string reward_link; + const Item_Struct* reward_item = database.GetItem(ItemID); - c->MakeTaskLink(link_core); + Client::TextLink linker; + linker.SetLinkType(linker.linkItemData); + linker.SetItemData(reward_item); + linker.SetClientVersion(c->GetClientVersion()); + linker.SetTaskUse(); + if (strlen(Tasks[TaskID]->Reward) != 0) + linker.SetProxyText(Tasks[TaskID]->Reward); - if (link_core && (strlen(Tasks[TaskID]->Reward) != 0)) { - reward_link = StringFormat("%c%06x%s%s%c", 0x12, ItemID, link_core, Tasks[TaskID]->Reward, 0x12); - } - else if (link_core) { - const Item_Struct* Item = database.GetItem(ItemID); - if (Item) - reward_link = StringFormat("%c%06x%s%s%c", 0x12, ItemID, link_core, Item->Name, 0x12); - else - reward_link = ""; - } - else { - reward_link = ""; - } - - if(reward_link.length() != 0) - RewardText += reward_link.c_str(); - - safe_delete_array(link_core); + auto reward_link = linker.GenerateLink(); + RewardText += reward_link.c_str(); } else { RewardText += Tasks[TaskID]->Reward; From 33e88bffe9823e9d575aa90199f99a040b854f99 Mon Sep 17 00:00:00 2001 From: Trevius Date: Mon, 29 Dec 2014 00:29:49 -0600 Subject: [PATCH 0715/1883] (RoF2) Identified a few Item Fields and resolved an issue with cloth armor not accepting certain augments that they should. --- changelog.txt | 3 +++ common/patches/rof2.cpp | 23 +++++++++++++++++------ common/patches/rof2_structs.h | 30 ++++++++++++++++++++---------- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/changelog.txt b/changelog.txt index a7f8ed9f2..57637ca16 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/29/2014 == +Trevius: (RoF2) Identified a few Item Fields and resolved an issue with cloth armor not accepting certain augments that they should. + == 12/28/2014 == Uleat: Implemented class Client::TextLink as a replacement for the dozens of individual link formatters. diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 8de5dd427..2144f4559 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4848,10 +4848,9 @@ namespace RoF2 hdr.slot_type = (merchant_slot == 0) ? slot_id.SlotType : 9; // 9 is merchant 20 is reclaim items? hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot; hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff; - hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff; + hdr.aug_slot = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff; hdr.price = inst->GetPrice(); hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount(); - //hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff; hdr.scaled_value = inst->IsScaling() ? inst->GetExp() / 100 : 0; hdr.instance_id = (merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot; hdr.unknown028 = 0; @@ -5053,7 +5052,7 @@ namespace RoF2 memset(&isbs, 0, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); isbs.augtype = item->AugType; - isbs.augdistiller = 65535; + isbs.augrestrict2 = -1; isbs.augrestrict = item->AugRestrict; for (int x = AUG_BEGIN; x < consts::ITEM_COMMON_SIZE; x++) @@ -5297,9 +5296,21 @@ namespace RoF2 iqbs.HealAmt = item->HealAmt; iqbs.SpellDmg = item->SpellDmg; iqbs.clairvoyance = item->Clairvoyance; - iqbs.unknown28 = 0; - iqbs.unknown30 = 0; - iqbs.unknown37a = 0; + + //unknown18; //Power Source Capacity or evolve filename? + //evolve_string; // Some String, but being evolution related is just a guess + + iqbs.Heirloom = 0; + iqbs.Placeable = 0; + + iqbs.unknown28 = -1; + iqbs.unknown30 = -1; + + iqbs.NoZone = 0; + iqbs.NoGround = 0; + iqbs.unknown37a = 0; // (guessed position) New to RoF2 + iqbs.unknown38 = 0; + iqbs.unknown39 = 1; iqbs.subitem_count = 0; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index a9011c4d7..fe52a2ac6 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4352,7 +4352,7 @@ struct ItemSerializationHeader /*025*/ uint8 slot_type; // 0 = normal, 1 = bank, 2 = shared bank, 9 = merchant, 20 = ? /*026*/ uint16 main_slot; /*028*/ uint16 sub_slot; -/*030*/ uint16 unknown013; // 0xffff +/*030*/ uint16 aug_slot; // 0xffff /*032*/ uint32 price; /*036*/ uint32 merchant_slot; //1 if not a merchant item /*040*/ uint32 scaled_value; //0 @@ -4493,7 +4493,7 @@ struct ItemSecondaryBodyStruct // swapped augrestrict and augdistiller positions // (this swap does show the proper augment restrictions in Item Information window now) // unsure what the purpose of augdistiller is at this time -U 3/17/2014 - uint32 augdistiller; // New to December 10th 2012 client - NEW + int32 augrestrict2; // New to December 10th 2012 client - Hidden Aug Restriction uint32 augrestrict; AugSlotStruct augslots[6]; @@ -4598,7 +4598,7 @@ struct ItemQuaternaryBodyStruct uint8 quest_item; uint32 Power; // Enables "Power" percentage field used by Power Sources uint32 Purity; - uint8 unknown16; // RoF2 + uint8 unknown16; // RoF uint32 BackstabDmg; uint32 DSMitigation; int32 HeroicStr; @@ -4620,15 +4620,19 @@ struct ItemQuaternaryBodyStruct uint8 unknown18; //Power Source Capacity or evolve filename? uint32 evolve_string; // Some String, but being evolution related is just a guess uint8 unknown19; - uint32 unknown20; // Bard Stuff? - //uint32 unknown21; - uint8 unknown22; + uint16 unknown20; + uint8 unknown21; + uint8 Heirloom; + uint8 Placeable; + uint8 unknown22b; + uint8 unknown22c; + uint8 unknown22d; uint32 unknown23; uint32 unknown24; uint32 unknown25; float unknown26; float unknown27; - uint32 unknown_RoF26; // 0 New to March 21 2012 client + uint32 unknown_RoF_6; // 0 New to March 21 2012 client uint32 unknown28; // 0xffffffff uint16 unknown29; uint32 unknown30; // 0xffffffff @@ -4639,9 +4643,15 @@ struct ItemQuaternaryBodyStruct uint32 unknown35; uint32 unknown36; uint32 unknown37; - uint32 unknown_RoF27; - uint32 unknown_RoF28; - uint8 unknown37a; // (guessed position) New to RoF2 + uint8 NoZone; // Item will disappear upon zoning? + uint8 unknown_RoF_7b; // Maybe Uint32 ? + uint8 unknown_RoF_7c; + uint8 unknown_RoF_7d; + uint8 unknown_RoF_8a; + uint8 NoGround; // Item cannot be dropped on the ground? + uint8 unknown_RoF_8c; + uint8 unknown_RoF_8d; + uint8 unknown37a; // New to RoF2 - Probably variable length string uint8 unknown38; // 0 uint8 unknown39; // 1 uint32 subitem_count; From 81dfffadf6762bd95515c5d556c6f7bf7569483a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 29 Dec 2014 05:35:50 -0600 Subject: [PATCH 0716/1883] Updated $client->UpdateTaskActivity to have optional argument ignore_quest_update IE: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update]) Also updated internal UpdateTaskActivity methods to optionally ignore quest based task updates to prevent feedback --- changelog.txt | 2 ++ zone/client.h | 2 +- zone/embparser_api.cpp | 8 +++++--- zone/perl_client.cpp | 9 +++++---- zone/questmgr.cpp | 5 +++-- zone/questmgr.h | 2 +- zone/tasks.cpp | 28 ++++++++++++++++------------ zone/tasks.h | 4 ++-- 8 files changed, 35 insertions(+), 25 deletions(-) diff --git a/changelog.txt b/changelog.txt index 57637ca16..9ca74dd14 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 12/29/2014 == Trevius: (RoF2) Identified a few Item Fields and resolved an issue with cloth armor not accepting certain augments that they should. +Akkadius: Updated $client->UpdateTaskActivity to have optional argument ignore_quest_update IE: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update]) +Akkadius: Also updated internal UpdateTaskActivity methods to optionally ignore quest based task updates to prevent feedback == 12/28/2014 == Uleat: Implemented class Client::TextLink as a replacement for the dozens of individual link formatters. diff --git a/zone/client.h b/zone/client.h index ee9f990da..b7bb8f6a5 100644 --- a/zone/client.h +++ b/zone/client.h @@ -987,7 +987,7 @@ public: inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); } inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); } inline ActivityState GetTaskActivityState(int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); } - inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); } + inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count, bool ignore_quest_update = false) { if (taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count, ignore_quest_update); } inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); } inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); } inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index e0866083b..76ed3bee7 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2277,18 +2277,20 @@ XS(XS__updatetaskactivity); XS(XS__updatetaskactivity) { dXSARGS; - unsigned int task, activity; + unsigned int task, activity, ignore_quest_update; int count = 1; + ignore_quest_update = 0; if(items == 2) { task = (int)SvIV(ST(0)); activity = (int)SvIV(ST(1)); - quest_manager.updatetaskactivity(task, activity, count); + quest_manager.updatetaskactivity(task, activity, count, false); } else if(items == 3) { task = (int)SvIV(ST(0)); activity = (int)SvIV(ST(1)); count = (int)SvIV(ST(2)); - quest_manager.updatetaskactivity(task, activity, count); + bool ignore_quest_update = (bool)SvTRUE(ST(3)); + quest_manager.updatetaskactivity(task, activity, count, ignore_quest_update); } else { Perl_croak(aTHX_ "Usage: updatetaskactivity(task, activity [,count])"); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index e2dae6f35..6c4d3ed9c 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5057,13 +5057,14 @@ XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */ XS(XS_Client_UpdateTaskActivity) { dXSARGS; - if (items != 4) - Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count)"); + if (items <= 4) + Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update])"); { Client * THIS; int TaskID = (int)SvIV(ST(1)); int ActivityID = (int)SvIV(ST(2)); int Count = (int)SvUV(ST(3)); + bool ignore_quest_update = (bool)SvTRUE(ST(4)); if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); @@ -5074,7 +5075,7 @@ XS(XS_Client_UpdateTaskActivity) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - THIS->UpdateTaskActivity(TaskID, ActivityID, Count); + THIS->UpdateTaskActivity(TaskID, ActivityID, Count, ignore_quest_update); } XSRETURN_EMPTY; } @@ -6305,7 +6306,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "ClearCompassMark"), XS_Client_ClearCompassMark, file, "$"); newXSproto(strcpy(buf, "GetFreeSpellBookSlot"), XS_Client_GetFreeSpellBookSlot, file, "$;$"); newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$"); - newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$"); + newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$$"); newXSproto(strcpy(buf, "AssignTask"), XS_Client_AssignTask, file, "$$$"); newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$"); newXSproto(strcpy(buf, "IsTaskCompleted"), XS_Client_IsTaskCompleted, file, "$$"); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 8dbc068c7..3fb714d7e 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2108,11 +2108,12 @@ int QuestManager::gettaskactivitydonecount(int task, int activity) { } -void QuestManager::updatetaskactivity(int task, int activity, int count) { +void QuestManager::updatetaskactivity(int task, int activity, int count, bool ignore_quest_update /*= false*/) +{ QuestManagerCurrentQuestVars(); if(RuleB(TaskSystem, EnableTaskSystem) && initiator) - initiator->UpdateTaskActivity(task, activity, count); + initiator->UpdateTaskActivity(task, activity, count, ignore_quest_update); } void QuestManager::resettaskactivity(int task, int activity) { diff --git a/zone/questmgr.h b/zone/questmgr.h index 4749599ad..14a6c429c 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -183,7 +183,7 @@ public: bool istaskactive(int task); bool istaskactivityactive(int task, int activity); int gettaskactivitydonecount(int task, int activity); - void updatetaskactivity(int task, int activity, int count); + void updatetaskactivity(int task, int activity, int count, bool ignore_quest_update = false); void resettaskactivity(int task, int activity); void taskexploredarea(int exploreid); void assigntask(int taskid); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 6c7f933b0..ab35c1aa1 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1786,7 +1786,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { return; } -void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count) { +void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { _log(TASKS__UPDATE, "IncrementDoneCount"); @@ -1795,10 +1795,12 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount > Task->Activity[ActivityID].GoalCount) ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount = Task->Activity[ActivityID].GoalCount; - char buf[24]; - snprintf(buf, 23, "%d %d %d", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID, ActiveTasks[TaskIndex].TaskID); - buf[23] = '\0'; - parse->EventPlayer(EVENT_TASK_UPDATE, c, buf, 0); + if (!ignore_quest_update){ + char buf[24]; + snprintf(buf, 23, "%d %d %d", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID, ActiveTasks[TaskIndex].TaskID); + buf[23] = '\0'; + parse->EventPlayer(EVENT_TASK_UPDATE, c, buf, 0); + } ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? @@ -1821,11 +1823,12 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T c->Message(0, "Your task '%s' has been updated.", Task->Title); if(Task->Activity[ActivityID].GoalMethod != METHODQUEST) { - char buf[24]; - snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID); - buf[23] = '\0'; - parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0); - + if (!ignore_quest_update){ + char buf[24]; + snprintf(buf, 23, "%d %d", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID); + buf[23] = '\0'; + parse->EventPlayer(EVENT_TASK_STAGE_COMPLETE, c, buf, 0); + } /* QS: PlayerLogTaskUpdates :: Update */ if (RuleB(QueryServ, PlayerLogTaskUpdates)){ std::string event_desc = StringFormat("Task Stage Complete :: taskid:%i activityid:%i donecount:%i in zoneid:%i instid:%i", ActiveTasks[TaskIndex].TaskID, ActiveTasks[TaskIndex].Activity[ActivityID].ActivityID, ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, c->GetZoneID(), c->GetInstanceID()); @@ -2039,7 +2042,8 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { } -void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count) { +void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) +{ _log(TASKS__UPDATE, "ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); @@ -2069,7 +2073,7 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; _log(TASKS__UPDATE, "Increment done count on UpdateTaskActivity"); - IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count); + IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } diff --git a/zone/tasks.h b/zone/tasks.h index 6298fcb5c..c525bbcd8 100644 --- a/zone/tasks.h +++ b/zone/tasks.h @@ -175,7 +175,7 @@ public: bool IsTaskActive(int TaskID); bool IsTaskActivityActive(int TaskID, int ActivityID); ActivityState GetTaskActivityState(int index, int ActivityID); - void UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count); + void UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update = false); void ResetTaskActivity(Client *c, int TaskID, int ActivityID); void CancelTask(Client *c, int SequenceNumber, bool RemoveFromDB = true); void CancelAllTasks(Client *c); @@ -204,7 +204,7 @@ public: private: bool UnlockActivities(int CharID, int TaskIndex); - void IncrementDoneCount(Client *c, TaskInformation *Task, int TaskIndex, int ActivityID, int Count=1); + void IncrementDoneCount(Client *c, TaskInformation *Task, int TaskIndex, int ActivityID, int Count = 1, bool ignore_quest_update = false); int ActiveTaskCount; ClientTaskInformation ActiveTasks[MAXACTIVETASKS]; std::vectorEnabledTasks; From 72823182f63cc04e0a5a54888779ac7290a3fe3a Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Mon, 29 Dec 2014 17:29:45 -0500 Subject: [PATCH 0717/1883] Made fifth argument of UpdateTaskActivity truly optional. --- zone/perl_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 6c4d3ed9c..e63544c58 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -6306,7 +6306,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "ClearCompassMark"), XS_Client_ClearCompassMark, file, "$"); newXSproto(strcpy(buf, "GetFreeSpellBookSlot"), XS_Client_GetFreeSpellBookSlot, file, "$;$"); newXSproto(strcpy(buf, "GetSpellBookSlotBySpellID"), XS_Client_GetSpellBookSlotBySpellID, file, "$$"); - newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$$"); + newXSproto(strcpy(buf, "UpdateTaskActivity"), XS_Client_UpdateTaskActivity, file, "$$$$;$"); newXSproto(strcpy(buf, "AssignTask"), XS_Client_AssignTask, file, "$$$"); newXSproto(strcpy(buf, "FailTask"), XS_Client_FailTask, file, "$$"); newXSproto(strcpy(buf, "IsTaskCompleted"), XS_Client_IsTaskCompleted, file, "$$"); From 16a8d1590907935e2366b3420160ab279ddd092d Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 30 Dec 2014 00:27:23 -0600 Subject: [PATCH 0718/1883] (RoF2) Aug Type 21 no longer shows the "Buy Now" button in the aug slot of items. (RoF2) Identified the "Copied" item flag with the help of Uleat. --- changelog.txt | 4 ++ common/patches/rof2.cpp | 86 +++++++++++++++++++++++++++-------- common/patches/rof2_ops.h | 2 + common/patches/rof2_structs.h | 29 ++++++------ 4 files changed, 87 insertions(+), 34 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9ca74dd14..26bf9c85c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/30/2014 == +Trevius: (RoF2) Aug Type 21 no longer shows the "Buy Now" button in the aug slot of items. +Trevius: (RoF2) Identified the "Copied" item flag with the help of Uleat. + == 12/29/2014 == Trevius: (RoF2) Identified a few Item Fields and resolved an issue with cloth armor not accepting certain augments that they should. Akkadius: Updated $client->UpdateTaskActivity to have optional argument ignore_quest_update IE: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update]) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 2144f4559..054a2073c 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -116,6 +116,72 @@ namespace RoF2 #include "ss_define.h" // ENCODE methods + + + // RoF2 Specific Encodes Begin + ENCODE(OP_SendMembershipDetails) + { + ENCODE_LENGTH_EXACT(Membership_Details_Struct); + SETUP_DIRECT_ENCODE(Membership_Details_Struct, structs::Membership_Details_Struct); + + eq->membership_setting_count = 72; + for (uint32 i = 0; i < emu->membership_setting_count; ++i) // 66 + { + OUT(settings[i].setting_index); + OUT(settings[i].setting_id); + OUT(settings[i].setting_value); + } + // Last 6 new settings fields are all 0s on Live as of 12/29/14 + + eq->race_entry_count = emu->race_entry_count; + for (uint32 i = 0; i < emu->race_entry_count; ++i) // 15 + { + OUT(membership_races[i].purchase_id); + OUT(membership_races[i].bitwise_entry); + } + + eq->class_entry_count = emu->class_entry_count; + for (uint32 i = 0; i < emu->class_entry_count; ++i) // 15 + { + OUT(membership_classes[i].purchase_id); + OUT(membership_classes[i].bitwise_entry); + } + + eq->exit_url_length = emu->exit_url_length; + eq->exit_url_length2 = emu->exit_url_length2; + + FINISH_ENCODE(); + } + + ENCODE(OP_SendMembership) + { + ENCODE_LENGTH_EXACT(Membership_Struct); + SETUP_DIRECT_ENCODE(Membership_Struct, structs::Membership_Struct); + + eq->membership = emu->membership; + eq->races = emu->races; + eq->classes = emu->classes; + eq->entrysize = 25; //emu->entrysize; + + for (uint32 i = 0; i < emu->entrysize; ++i) // 21 + { + OUT(entries[i]); + } + // Last 4 new entries are 0s on Live Silver as of 12/29/14 + // Setting them each to 1 for now. + // This removes the "Buy Now" button from aug type 21 slots on items. + for (uint32 i = 21; i < 25; ++i) // 4 + { + eq->entries[i] = 1; + } + + + FINISH_ENCODE(); + } + + // RoF2 Specific Encodes End + + ENCODE(OP_Action) { ENCODE_LENGTH_EXACT(Action_Struct); @@ -2905,24 +2971,6 @@ namespace RoF2 FINISH_ENCODE(); } - ENCODE(OP_SendMembership) - { - ENCODE_LENGTH_EXACT(Membership_Struct); - SETUP_DIRECT_ENCODE(Membership_Struct, structs::Membership_Struct); - - eq->membership = emu->membership; - eq->races = emu->races; - eq->classes = emu->classes; - eq->entrysize = 22; - for (int i = 0; i<21; i++) - { - eq->entries[i] = emu->entries[i]; - } - eq->entries[21] = 0; - - FINISH_ENCODE(); - } - ENCODE(OP_SendZonepoints) { SETUP_VAR_ENCODE(ZonePoints); @@ -4902,7 +4950,7 @@ namespace RoF2 hdrf.unknowna1 = 0xffffffff; hdrf.ornamentHeroModel = heroModel; hdrf.unknown063 = 0; - hdrf.unknowna3 = 0; + hdrf.Copied = 0; hdrf.unknowna4 = 0xffffffff; hdrf.unknowna5 = 0; hdrf.ItemClass = item->ItemClass; diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index 19519212a..79614504d 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -1,6 +1,8 @@ // out-going packets that require an ENCODE translation: // Begin RoF2 Encodes +E(OP_SendMembershipDetails) + // incoming packets that require a DECODE translation: // Begin RoF2 Decodes diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index fe52a2ac6..f80bd17b2 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -243,7 +243,7 @@ struct Membership_Setting_Struct struct Membership_Details_Struct { /*0000*/ uint32 membership_setting_count; // Seen 66 -/*0016*/ Membership_Setting_Struct settings[66]; // 792 Bytes +/*0016*/ Membership_Setting_Struct settings[72]; // 864 Bytes /*0012*/ uint32 race_entry_count; // Seen 15 /*1044*/ Membership_Entry_Struct membership_races[15]; // 120 Bytes /*0012*/ uint32 class_entry_count; // Seen 15 @@ -260,7 +260,7 @@ struct Membership_Struct /*004*/ uint32 races; // Seen ff ff 01 00 /*008*/ uint32 classes; // Seen ff ff 01 01 /*012*/ uint32 entrysize; // Seen 22 -/*016*/ int32 entries[22]; // Most -1, 1, and 0 for Gold Status +/*016*/ int32 entries[25]; // Most -1, 1, and 0 for Gold Status /*104*/ }; @@ -4381,15 +4381,14 @@ struct EvolvingItem { struct ItemSerializationHeaderFinish { -/*079*/ uint32 ornamentIcon; -/*083*/ int32 unknowna1; // 0xffffffff -/*087*/ uint32 ornamentHeroModel; // 0 -/*091*/ uint8 unknown063; // 0 -/*092*/ uint32 unknowna3; // 0 -/*096*/ int32 unknowna4; // 0xffffffff -/*100*/ uint32 unknowna5; // 0 -/*104*/ uint8 ItemClass; //0, 1, or 2 -/*105*/ + uint32 ornamentIcon; + int32 unknowna1; // 0xffffffff + uint32 ornamentHeroModel; + int32 unknown063; // 0 + uint8 Copied; // Copied Flag - Possibly for items copied during server transfer? + int32 unknowna4; // 0xffffffff + int32 unknowna5; // 0 + uint8 ItemClass; //0, 1, or 2 }; struct ItemBodyStruct @@ -4622,8 +4621,8 @@ struct ItemQuaternaryBodyStruct uint8 unknown19; uint16 unknown20; uint8 unknown21; - uint8 Heirloom; - uint8 Placeable; + uint8 Heirloom; // Heirloom Flag + uint8 Placeable; // Placeable Flag uint8 unknown22b; uint8 unknown22c; uint8 unknown22d; @@ -4643,12 +4642,12 @@ struct ItemQuaternaryBodyStruct uint32 unknown35; uint32 unknown36; uint32 unknown37; - uint8 NoZone; // Item will disappear upon zoning? + uint8 NoZone; // No Zone Flag - Item will disappear upon zoning? uint8 unknown_RoF_7b; // Maybe Uint32 ? uint8 unknown_RoF_7c; uint8 unknown_RoF_7d; uint8 unknown_RoF_8a; - uint8 NoGround; // Item cannot be dropped on the ground? + uint8 NoGround; // No Ground Flag - Item cannot be dropped on the ground? uint8 unknown_RoF_8c; uint8 unknown_RoF_8d; uint8 unknown37a; // New to RoF2 - Probably variable length string From d93edd7393f5ec2a58efe88ee86f2d37ceada6a1 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 31 Dec 2014 17:49:12 -0500 Subject: [PATCH 0719/1883] Make NPCs less jumpy We actually didn't want that +2.0f --- zone/waypoints.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 72172a53c..da5ecb7bc 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -696,7 +696,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b { Map::Vertex dest(x_pos, y_pos, z_pos); - float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; + float newz = zone->zonemap->FindBestZ(dest, nullptr); mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); From fc544e164cf904e7c99015d6fad8354524b6da37 Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 31 Dec 2014 20:53:12 -0500 Subject: [PATCH 0720/1883] Update default npc_types values for previous NULL entries. --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + .../required/2014_12_31_npc_types_default_values_update.sql | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 utils/sql/git/required/2014_12_31_npc_types_default_values_update.sql diff --git a/common/version.h b/common/version.h index 868fe9be3..48a600be1 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9065 +#define CURRENT_BINARY_DATABASE_VERSION 9066 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 474e317d0..1ba3048b8 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -319,6 +319,7 @@ 9063|2014_12_24_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'd_melee_texture1'|empty| 9064|2014_12_24_npc_types_table_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'herosforgemodel'|empty| 9065|2014_12_26_merc_weaponinfo_table_update.sql|SHOW COLUMNS FROM `vwMercNpcTypes` LIKE 'd_melee_texture1'|empty| +9066|2014_12_31_npc_types_default_values_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'bodytype'|contains|YES # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2014_12_31_npc_types_default_values_update.sql b/utils/sql/git/required/2014_12_31_npc_types_default_values_update.sql new file mode 100644 index 000000000..b75544981 --- /dev/null +++ b/utils/sql/git/required/2014_12_31_npc_types_default_values_update.sql @@ -0,0 +1,3 @@ +ALTER TABLE `npc_types` MODIFY `bodytype` INT(11) NOT NULL DEFAULT '1'; +ALTER TABLE `npc_types` MODIFY `d_melee_texture1` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `npc_types` MODIFY `d_melee_texture2` INT(11) NOT NULL DEFAULT '0'; From f0d2fb796f2d1dd09682980a910a438aaa0afaae Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 1 Jan 2015 20:00:16 -0600 Subject: [PATCH 0721/1883] Aug Type 21 fix for RoF client. --- common/patches/rof.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 148c9662b..eace95089 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2900,7 +2900,7 @@ namespace RoF { eq->entries[i] = emu->entries[i]; } - eq->entries[21] = 0; + eq->entries[21] = 1; FINISH_ENCODE(); } From 3c6c5b9732ccb0913c7f1b24491b01d03aab5da7 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 2 Jan 2015 01:42:52 -0600 Subject: [PATCH 0722/1883] (RoF2) *Hopefully* Fixed looting incorrect items from NPCs. Please report any issues! (RoF2) Now able to loot items past the 10th slot on NPC corpses. Attuned Items can now be auto-looted and will equip properly. Mercenaries and Bots will no longer take a share from /split or /autosplit. --- changelog.txt | 6 +++++ common/eq_packet_structs.h | 3 ++- common/patches/rof.cpp | 2 -- common/patches/rof2.cpp | 46 +++++++++++++++++++++-------------- common/patches/rof2_structs.h | 4 +-- zone/client_packet.cpp | 6 ----- zone/corpse.cpp | 2 +- zone/groups.cpp | 3 ++- zone/inventory.cpp | 2 +- 9 files changed, 42 insertions(+), 32 deletions(-) diff --git a/changelog.txt b/changelog.txt index 26bf9c85c..3840c43a4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/02/2015 == +Trevius: (RoF2) *Hopefully* Fixed looting incorrect items from NPCs. Please report any issues! +Trevius: (RoF2) Now able to loot items past the 10th slot on NPC corpses. +Trevius: Attuned Items can now be auto-looted and will equip properly. +Trevius: Mercenaries and Bots will no longer take a share from /split or /autosplit. + == 12/30/2014 == Trevius: (RoF2) Aug Type 21 no longer shows the "Buy Now" button in the aug slot of items. Trevius: (RoF2) Identified the "Copied" item flag with the help of Uleat. diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a0d9eb59a..07daa97fd 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -1509,7 +1509,8 @@ enum ItemPacketType ItemPacketTributeItem = 0x6C, ItemPacketMerchant = 0x64, ItemPacketWorldContainer = 0x6B, - ItemPacketCharmUpdate = 0x6E + ItemPacketCharmUpdate = 0x6E, + ItemPacketInvalid = 0xFF }; struct ItemPacket_Struct { diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index eace95089..699b4e75a 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5485,7 +5485,6 @@ namespace RoF static inline uint32 ServerToRoFCorpseSlot(uint32 ServerCorpse) { - //uint32 RoFCorpse; return (ServerCorpse + 1); } @@ -5626,7 +5625,6 @@ namespace RoF static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse) { - //uint32 ServerCorpse; return (RoFCorpse - 1); } } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 054a2073c..00a468534 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -21,15 +21,15 @@ namespace RoF2 static OpcodeManager *opcodes = nullptr; static Strategy struct_strategy; - char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth); + char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth, ItemPacketType packet_type); // server to client inventory location converters - static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot); + static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot, ItemPacketType PacketType = ItemPacketInvalid); static inline structs::MainInvItemSlotStruct ServerToRoF2MainInvSlot(uint32 ServerSlot); static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse); // client to server inventory location converters - static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot); + static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot, ItemPacketType PacketType = ItemPacketInvalid); static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot); static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse); @@ -622,7 +622,7 @@ namespace RoF2 uint32 Length = 0; - char* Serialized = SerializeItem((const ItemInst*)eq->inst, eq->slot_id, &Length, 0); + char* Serialized = SerializeItem((const ItemInst*)eq->inst, eq->slot_id, &Length, 0, ItemPacketCharInventory); if (Serialized) { @@ -1436,7 +1436,7 @@ namespace RoF2 InternalSerializedItem_Struct *int_struct = (InternalSerializedItem_Struct *)(old_item_pkt->SerializedItem); uint32 length; - char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); + char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); @@ -4867,7 +4867,7 @@ namespace RoF2 return NextItemInstSerialNumber; } - char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth) + char* SerializeItem(const ItemInst *inst, int16 slot_id_in, uint32 *length, uint8 depth, ItemPacketType packet_type) { int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); uint8 null_term = 0; @@ -4891,7 +4891,7 @@ namespace RoF2 hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; - structs::ItemSlotStruct slot_id = ServerToRoF2Slot(slot_id_in); + structs::ItemSlotStruct slot_id = ServerToRoF2Slot(slot_id_in, packet_type); hdr.slot_type = (merchant_slot == 0) ? slot_id.SlotType : 9; // 9 is merchant 20 is reclaim items? hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot; @@ -5396,7 +5396,7 @@ namespace RoF2 SubSlotNumber = Inventory::CalcSlotID(slot_id_in, x); */ - SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1); + SubSerializations[x] = SerializeItem(subitem, SubSlotNumber, &SubLengths[x], depth + 1, packet_type); } } @@ -5422,7 +5422,7 @@ namespace RoF2 return item_serial; } - static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot) + static inline structs::ItemSlotStruct ServerToRoF2Slot(uint32 ServerSlot, ItemPacketType PacketType) { structs::ItemSlotStruct RoF2Slot; RoF2Slot.SlotType = INVALID_INDEX; @@ -5435,13 +5435,21 @@ namespace RoF2 uint32 TempSlot = 0; if (ServerSlot < 56 || ServerSlot == MainPowerSource) { // Main Inventory and Cursor - RoF2Slot.SlotType = maps::MapPossessions; - RoF2Slot.MainSlot = ServerSlot; - + if (PacketType == ItemPacketLoot) + { + RoF2Slot.SlotType = maps::MapCorpse; + RoF2Slot.MainSlot = ServerSlot - EmuConstants::CORPSE_BEGIN; + } + else + { + RoF2Slot.SlotType = maps::MapPossessions; + RoF2Slot.MainSlot = ServerSlot; + } + if (ServerSlot == MainPowerSource) RoF2Slot.MainSlot = slots::MainPowerSource; - else if (ServerSlot >= MainCursor) // Cursor and Extended Corpse Inventory + else if (ServerSlot >= MainCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory RoF2Slot.MainSlot += 3; else if (ServerSlot >= MainAmmo) // (> 20) @@ -5568,11 +5576,10 @@ namespace RoF2 static inline uint32 ServerToRoF2CorpseSlot(uint32 ServerCorpse) { - //uint32 RoF2Corpse; - return (ServerCorpse + 1); + return (ServerCorpse - EmuConstants::CORPSE_BEGIN + 1); } - static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot) + static inline uint32 RoF2ToServerSlot(structs::ItemSlotStruct RoF2Slot, ItemPacketType PacketType) { uint32 ServerSlot = INVALID_INDEX; uint32 TempSlot = 0; @@ -5667,6 +5674,10 @@ namespace RoF2 ServerSlot = INVALID_INDEX; } + else if (RoF2Slot.SlotType == maps::MapCorpse) { + ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; + } + _log(NET__ERROR, "Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; @@ -5709,8 +5720,7 @@ namespace RoF2 static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse) { - //uint32 ServerCorpse; - return (RoF2Corpse - 1); + return (RoF2Corpse + EmuConstants::CORPSE_BEGIN - 1); } } // end namespace RoF2 diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index f80bd17b2..9ba71574c 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -1843,8 +1843,8 @@ struct LootingItem_Struct { /*000*/ uint32 lootee; /*004*/ uint32 looter; /*008*/ uint16 slot_id; -/*010*/ uint16 unknown10; -/*012*/ uint32 auto_loot; +/*010*/ uint16 unknown10; // slot_id is probably uint32 +/*012*/ int32 auto_loot; /*016*/ uint32 unknown16; /*020*/ }; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f809fb3c8..7534deff7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9170,12 +9170,6 @@ void Client::Handle_OP_LootItem(const EQApplicationPacket *app) LogFile->write(EQEMuLog::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } - /* - ** fixed the looting code so that it sends the correct opcodes - ** and now correctly removes the looted item the player selected - ** as well as gives the player the proper item. - ** Also fixed a few UI lock ups that would occur. - */ EQApplicationPacket* outapp = 0; Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer)); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a99b8b500..380697eac 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1207,7 +1207,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { parse->EventPlayer(EVENT_LOOT, client, buf, 0, &args); parse->EventItem(EVENT_LOOT, client, inst, this, buf, 0); - if ((RuleB(Character, EnableDiscoveredItems))) { + if (!IsPlayerCorpse() && RuleB(Character, EnableDiscoveredItems)) { if (client && !client->GetGM() && !client->IsDiscovered(inst->GetItem()->ID)) client->DiscoverItem(inst->GetItem()->ID); } diff --git a/zone/groups.cpp b/zone/groups.cpp index 3395833bf..a6d8be42b 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -122,7 +122,8 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu uint32 i; uint8 membercount = 0; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (members[i] != nullptr) { + // Don't split with Mercs or Bots + if (members[i] != nullptr && members[i]->IsClient()) { membercount++; } } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 19520a177..fed4dde3b 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -926,7 +926,7 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_cursor, ServerLootItem_Struct** bag_item_data) { // #1: Try to auto equip - if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && !inst.GetItem()->Attuneable && inst.GetItem()->ItemType != ItemTypeAugmentation) + if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != ItemTypeAugmentation) { // too messy as-is... for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) // originally (i < 22) From a8d28cbed5d232911f8961085000d581558d85a0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 2 Jan 2015 17:51:55 -0600 Subject: [PATCH 0723/1883] True optional fix for UpdateTaskActivity now that I've had time to take care of it --- zone/perl_client.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index e63544c58..6785a80af 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5060,11 +5060,15 @@ XS(XS_Client_UpdateTaskActivity) if (items <= 4) Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update])"); { + bool ignore_quest_update = false; + Client * THIS; int TaskID = (int)SvIV(ST(1)); int ActivityID = (int)SvIV(ST(2)); int Count = (int)SvUV(ST(3)); - bool ignore_quest_update = (bool)SvTRUE(ST(4)); + if (items == 4){ + ignore_quest_update = (bool)SvTRUE(ST(4)); + } if (sv_derived_from(ST(0), "Client")) { IV tmp = SvIV((SV*)SvRV(ST(0))); From 6a2260f1066cee88ea5e0a24b39151615e038f22 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 01:26:46 -0500 Subject: [PATCH 0724/1883] Memleak in Map --- zone/map.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/map.cpp b/zone/map.cpp index b6f4de2b5..5c917b955 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -58,6 +58,7 @@ Map::Map() { Map::~Map() { if(imp) { imp->rm->release(); + safe_delete(imp); } } @@ -887,4 +888,4 @@ void Map::TranslateVertex(Vertex &v, float tx, float ty, float tz) { v.x = v.x + tx; v.y = v.y + ty; v.z = v.z + tz; -} \ No newline at end of file +} From 7cbefa4ec208d48c0fe46b6069593730b130327b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 01:52:24 -0500 Subject: [PATCH 0725/1883] Fix memleak in OP_RaidUpdate --- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/underfoot.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 699b4e75a..0970215ef 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2643,7 +2643,7 @@ namespace RoF dest->FastQueuePacket(&outapp); } - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_ReadBook) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 00a468534..478a992c2 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2727,7 +2727,7 @@ namespace RoF2 dest->FastQueuePacket(&outapp); } - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_ReadBook) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index e9c5430fb..8a240c05f 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1705,7 +1705,7 @@ namespace SoD dest->FastQueuePacket(&outapp); } - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_ReadBook) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 93114e7ab..befb9a294 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1363,7 +1363,7 @@ namespace SoF dest->FastQueuePacket(&outapp); } - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_ReadBook) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 0b9d527a6..03dd34fd0 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1991,7 +1991,7 @@ namespace Underfoot dest->FastQueuePacket(&outapp); } - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_ReadBook) From 3da3b5641f923d68027256723ab7a7de83ccab4a Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 3 Jan 2015 01:31:44 -0600 Subject: [PATCH 0726/1883] (RoF2) /shield (shielding) and /key (key ring) are both now functional after opcode updates. --- changelog.txt | 3 +++ utils/patches/patch_RoF2.conf | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3840c43a4..5aa90cfc9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/03/2015 == +Trevius: (RoF2) /shield (shielding) and /key (key ring) are both now functional after opcode updates. + == 01/02/2015 == Trevius: (RoF2) *Hopefully* Fixed looting incorrect items from NPCs. Please report any issues! Trevius: (RoF2) Now able to loot items past the 10th slot on NPC corpses. diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index b2a4db698..23bec152e 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -193,7 +193,7 @@ OP_Consent=0x1fd1 OP_ConsentDeny=0x7a45 OP_AutoFire=0x241e OP_PetCommands=0x0159 -OP_DeleteSpell=0x52e5 +OP_DeleteSpell=0x3358 OP_Surname=0x0423 OP_ClearSurname=0x3fb0 OP_FaceChange=0x5578 @@ -205,14 +205,14 @@ OP_CorpseDrag=0x0904 OP_CorpseDrop=0x7037 OP_Bug=0x73f4 OP_Feedback=0x5602 -OP_Report=0x1414 +OP_Report=0x6f14 OP_Damage=0x6f15 OP_ChannelMessage=0x2b2d OP_Assist=0x4478 OP_AssistGroup=0x27f8 OP_MoveCoin=0x0bcf OP_ZonePlayerToBind=0x08d8 -OP_KeyRing=0x6857 +OP_KeyRing=0x1219 OP_WhoAllRequest=0x674b OP_WhoAllResponse=0x578c OP_FriendsWho=0x3956 @@ -263,7 +263,7 @@ OP_SafeFallSuccess=0x2219 OP_RezzComplete=0x760d OP_RezzRequest=0x3c21 OP_RezzAnswer=0x701c -OP_Shielding=0x48c1 +OP_Shielding=0x52e5 OP_RequestDuel=0x3af1 OP_MobRename=0x2c57 OP_AugmentItem=0x661b From 1b5db0684e6dab1a6b90437c1cc36d7b4e32b6bd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 02:38:55 -0500 Subject: [PATCH 0727/1883] Fix memleak in OP_RaidJoin --- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/underfoot.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 0970215ef..36d487545 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2576,7 +2576,7 @@ namespace RoF strn0cpy(general->player_name, raid_create->leader_name, 64); dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_RaidUpdate) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 478a992c2..02ac289a9 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2660,7 +2660,7 @@ namespace RoF2 strn0cpy(general->player_name, raid_create->leader_name, 64); dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_RaidUpdate) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 8a240c05f..7355526c4 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1638,7 +1638,7 @@ namespace SoD strn0cpy(general->player_name, raid_create->leader_name, 64); dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_RaidUpdate) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index befb9a294..fc46c53cb 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1296,7 +1296,7 @@ namespace SoF strn0cpy(general->player_name, raid_create->leader_name, 64); dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_RaidUpdate) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 03dd34fd0..5ee38f586 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1924,7 +1924,7 @@ namespace Underfoot strn0cpy(general->player_name, raid_create->leader_name, 64); dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + safe_delete(inapp); } ENCODE(OP_RaidUpdate) From 9b8598c566a3f68bdc3e4160e546c2f2ba30c989 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 02:57:55 -0500 Subject: [PATCH 0728/1883] Group/raid memleaks --- zone/entity.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index b6a3c8fa9..0cdb3044f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2026,13 +2026,16 @@ void EntityList::RemoveAllNPCs() void EntityList::RemoveAllMercs() { + // doesn't clear the data merc_list.clear(); } void EntityList::RemoveAllGroups() { - while (group_list.size()) + while (group_list.size()) { + safe_delete(group_list.front()); group_list.pop_front(); + } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); #endif @@ -2040,8 +2043,10 @@ void EntityList::RemoveAllGroups() void EntityList::RemoveAllRaids() { - while (raid_list.size()) + while (raid_list.size()) { + safe_delete(raid_list.front()); raid_list.pop_front(); + } } void EntityList::RemoveAllDoors() @@ -2251,7 +2256,8 @@ bool EntityList::RemoveGroup(uint32 delete_id) while(iterator != group_list.end()) { if((*iterator)->GetID() == delete_id) { - group_list.remove (*iterator); + safe_delete(*iterator); + group_list.remove(*iterator); #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); #endif @@ -2274,7 +2280,8 @@ bool EntityList::RemoveRaid(uint32 delete_id) while(iterator != raid_list.end()) { if((*iterator)->GetID() == delete_id) { - raid_list.remove (*iterator); + safe_delete(*iterator); + raid_list.remove(*iterator); return true; } ++iterator; From ea6ab5b10f1f9207e2b32794d402735df47b7df3 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 12:33:53 -0500 Subject: [PATCH 0729/1883] Virtualize WaterMap's destructor (memleak fix) --- zone/water_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/water_map.h b/zone/water_map.h index 2141a3000..cc1887f10 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -21,15 +21,15 @@ class WaterMap { public: WaterMap() { } - ~WaterMap() { } - + virtual ~WaterMap() { } + static WaterMap* LoadWaterMapfile(std::string zone_name); virtual WaterRegionType ReturnRegionType(float y, float x, float z) const { return RegionTypeNormal; } virtual bool InWater(float y, float x, float z) const { return false; } virtual bool InVWater(float y, float x, float z) const { return false; } virtual bool InLava(float y, float x, float z) const { return false; } virtual bool InLiquid(float y, float x, float z) const { return false; } - + protected: virtual bool Load(FILE *fp) { return false; } }; From 77b8e9ec6e6c1df7753e9e1c26227a55b30fce04 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 13:54:31 -0500 Subject: [PATCH 0730/1883] Perl memleak fix This may need more test!! --- zone/embperl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 9f05d8711..87d543cff 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -210,6 +210,7 @@ Embperl::~Embperl() " if(tied *STDERR) { untie(*STDERR); }" ,FALSE); #endif + perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); my_perl = NULL; From 6897aef4b5cf7ef21681d9974af32580eb148c85 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 15:14:12 -0500 Subject: [PATCH 0731/1883] Need to set this to 1 again before the perl_destruct --- zone/embperl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 87d543cff..92a59d075 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -210,6 +210,7 @@ Embperl::~Embperl() " if(tied *STDERR) { untie(*STDERR); }" ,FALSE); #endif + PL_perl_destruct_level = 1; perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); From 09d76605f5e8a74b9d3499e5c25bd17381d76f03 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 18:42:28 -0500 Subject: [PATCH 0732/1883] Fix memleak in Mob::TemporaryPets --- zone/aa.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zone/aa.cpp b/zone/aa.cpp index f5da4c284..059d42cbb 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -606,6 +606,9 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u //the target of these swarm pets will take offense to being cast on... if(targ != nullptr) targ->AddToHateList(this, 1, 0); + + // The other pointers we make are handled elsewhere. + delete made_npc; } void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_override, uint32 duration_override, bool followme, bool sticktarg) { From f8b6ee296c88f761ae5cceb20c0692a42700e57e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 3 Jan 2015 18:48:38 -0500 Subject: [PATCH 0733/1883] Fix memleak in Mob::TypesTemporaryPets --- zone/aa.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zone/aa.cpp b/zone/aa.cpp index 059d42cbb..02f00f84d 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -701,6 +701,9 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid entity_list.AddNPC(npca, true, true); summon_count--; } + + // The other pointers we make are handled elsewhere. + delete made_npc; } void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) From a75db63cbca8b6837252c7ef1c006ab1dc1312ae Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 4 Jan 2015 01:48:31 -0500 Subject: [PATCH 0734/1883] Fix EVENT_CONNECT --- zone/client_packet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7534deff7..d2ea94e34 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1385,7 +1385,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (LFP){ LFP = atoi(row[0]); } if (LFG){ LFG = atoi(row[1]); } - if (firstlogon){ firstlogon = atoi(row[3]); } + if (row[3]) + firstlogon = atoi(row[3]); } if (RuleB(Character, SharedBankPlat)) From 85a27cdd74b8b0296faa3005e46946d6a812859e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 4 Jan 2015 01:52:46 -0500 Subject: [PATCH 0735/1883] Fix account_creation --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d2ea94e34..cf1dc71b8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1361,7 +1361,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) database.LoadCharacterFactionValues(cid, factionvalues); /* Load Character Account Data: Temp until I move */ - query = StringFormat("SELECT `status`, `name`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme` FROM `account` WHERE `id` = %u", this->AccountID()); + query = StringFormat("SELECT `status`, `name`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme`, `time_creation` FROM `account` WHERE `id` = %u", this->AccountID()); auto results = database.QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { admin = atoi(row[0]); @@ -1370,7 +1370,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) gmspeed = atoi(row[3]); revoked = atoi(row[4]); gmhideme = atoi(row[5]); - if (account_creation){ account_creation = atoul(row[6]); } + account_creation = atoul(row[6]); } /* Load Character Data */ From 9419bc8d5448f9ede6ea366f6dd174a0f504ec7b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 4 Jan 2015 02:54:50 -0600 Subject: [PATCH 0736/1883] True fix for $client->UpdateTaskActivity(TaskID, ActivityID, Count, [ignore_quest_update]) --- zone/perl_client.cpp | 8 ++++++-- zone/tasks.cpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 6785a80af..d8e672a8e 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5053,20 +5053,24 @@ XS(XS_Client_GetSpellBookSlotBySpellID) XSRETURN(1); } +#include + XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */ XS(XS_Client_UpdateTaskActivity) { dXSARGS; - if (items <= 4) + if (items < 4) Perl_croak(aTHX_ "Usage: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update])"); { bool ignore_quest_update = false; Client * THIS; + int TaskID = (int)SvIV(ST(1)); int ActivityID = (int)SvIV(ST(2)); int Count = (int)SvUV(ST(3)); - if (items == 4){ + + if (items == 5){ ignore_quest_update = (bool)SvTRUE(ST(4)); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index ab35c1aa1..79efb1115 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2052,8 +2052,8 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int ActiveTaskIndex = -1; - for(int i=0; i Date: Sun, 4 Jan 2015 02:55:38 -0600 Subject: [PATCH 0737/1883] Remove iostream from debug output --- zone/perl_client.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index d8e672a8e..d3cec99e2 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5053,8 +5053,6 @@ XS(XS_Client_GetSpellBookSlotBySpellID) XSRETURN(1); } -#include - XS(XS_Client_UpdateTaskActivity); /* prototype to pass -Wmissing-prototypes */ XS(XS_Client_UpdateTaskActivity) { From 8491e3ce9baf963b3b61aa09a0f03d1a3e301c27 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 4 Jan 2015 06:58:30 -0600 Subject: [PATCH 0738/1883] Pro-active adjustment of quest::updatetaskactivity to include ignore_quest_update quest::updatetaskactivity(task, activity, [count], [ignore_quest_update]) --- zone/embparser_api.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 76ed3bee7..124a0d265 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2277,22 +2277,24 @@ XS(XS__updatetaskactivity); XS(XS__updatetaskactivity) { dXSARGS; - unsigned int task, activity, ignore_quest_update; + unsigned int task, activity; int count = 1; - ignore_quest_update = 0; + bool ignore_quest_update = false; if(items == 2) { task = (int)SvIV(ST(0)); activity = (int)SvIV(ST(1)); quest_manager.updatetaskactivity(task, activity, count, false); } - else if(items == 3) { + else if (items == 3 || items == 4) { task = (int)SvIV(ST(0)); activity = (int)SvIV(ST(1)); count = (int)SvIV(ST(2)); - bool ignore_quest_update = (bool)SvTRUE(ST(3)); + if (items == 4){ + bool ignore_quest_update = (bool)SvTRUE(ST(3)); + } quest_manager.updatetaskactivity(task, activity, count, ignore_quest_update); } else { - Perl_croak(aTHX_ "Usage: updatetaskactivity(task, activity [,count])"); + Perl_croak(aTHX_ "Usage: updatetaskactivity(task, activity, [count], [ignore_quest_update])"); } XSRETURN_EMPTY; From ac09636a73813f6a5d22abc216e0cceea9af5ba1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 4 Jan 2015 07:01:16 -0600 Subject: [PATCH 0739/1883] Readability: embparser_api.cpp macro section A-Z sort --- zone/embparser_api.cpp | 393 +++++++++++++++++++++-------------------- 1 file changed, 197 insertions(+), 196 deletions(-) diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 124a0d265..e9f9d0974 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3526,214 +3526,215 @@ EXTERN_C XS(boot_quest) //add the strcpy stuff to get rid of const warnings.... XS_VERSION_BOOTCHECK ; - newXS(strcpy(buf, "echo"), XS__echo, file); - newXS(strcpy(buf, "say"), XS__say, file); - newXS(strcpy(buf, "me"), XS__me, file); - newXS(strcpy(buf, "summonitem"), XS__summonitem, file); - newXS(strcpy(buf, "write"), XS__write, file); - newXS(strcpy(buf, "spawn"), XS__spawn, file); - newXS(strcpy(buf, "spawn2"), XS__spawn2, file); - newXS(strcpy(buf, "unique_spawn"), XS__unique_spawn, file); - newXS(strcpy(buf, "spawn_from_spawn2"), XS__spawn_from_spawn2, file); - newXS(strcpy(buf, "enable_spawn2"), XS__enable_spawn2, file); - newXS(strcpy(buf, "disable_spawn2"), XS__disable_spawn2, file); - newXS(strcpy(buf, "setstat"), XS__setstat, file); - newXS(strcpy(buf, "incstat"), XS__incstat, file); - newXS(strcpy(buf, "castspell"), XS__castspell, file); - newXS(strcpy(buf, "selfcast"), XS__selfcast, file); + +#ifdef BOTS + newXS(strcpy(buf, "botquest"), XS__botquest, file); + newXS(strcpy(buf, "spawnbotcount"), XS__spawnbotcount, file); + newXS(strcpy(buf, "createbotcount"), XS__createbotcount, file); + newXS(strcpy(buf, "createBot"), XS__createBot, file); +#endif //BOTS + + newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file); + newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file); + newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file); + newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file); + newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); + newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); + newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file); + newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file); + newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file); + newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file); + newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file); + newXS(strcpy(buf, "GetSpellResistType"), XS__GetSpellResistType, file); + newXS(strcpy(buf, "GetSpellTargetType"), XS__GetSpellTargetType, file); + newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); + newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); + newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); + newXS(strcpy(buf, "IsBeneficialSpell"), XS__IsBeneficialSpell, file); + newXS(strcpy(buf, "IsEffectInSpell"), XS__IsEffectInSpell, file); + newXS(strcpy(buf, "IsRunning"), XS__IsRunning, file); + newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file); + newXS(strcpy(buf, "MerchantCountItem"), XS__MerchantCountItem, file); + newXS(strcpy(buf, "MerchantSetItem"), XS__MerchantSetItem, file); + newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file); + newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file); + newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file); + newXS(strcpy(buf, "SendMail"), XS__SendMail, file); + newXS(strcpy(buf, "SetRunning"), XS__SetRunning, file); + newXS(strcpy(buf, "activespeakactivity"), XS__activespeakactivity, file); + newXS(strcpy(buf, "activespeaktask"), XS__activespeaktask, file); + newXS(strcpy(buf, "activetasksinset"), XS__activetasksinset, file); + newXS(strcpy(buf, "addldonloss"), XS__addldonpoints, file); + newXS(strcpy(buf, "addldonpoints"), XS__addldonpoints, file); + newXS(strcpy(buf, "addldonwin"), XS__addldonpoints, file); newXS(strcpy(buf, "addloot"), XS__addloot, file); - newXS(strcpy(buf, "zone"), XS__zone, file); - newXS(strcpy(buf, "settimer"), XS__settimer, file); - newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file); - newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file); - newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file); - newXS(strcpy(buf, "emote"), XS__emote, file); - newXS(strcpy(buf, "shout"), XS__shout, file); - newXS(strcpy(buf, "shout2"), XS__shout2, file); - newXS(strcpy(buf, "gmsay"), XS__gmsay, file); - newXS(strcpy(buf, "depop"), XS__depop, file); - newXS(strcpy(buf, "depop_withtimer"), XS__depop_withtimer, file); - newXS(strcpy(buf, "settarget"), XS__settarget, file); - newXS(strcpy(buf, "follow"), XS__follow, file); - newXS(strcpy(buf, "sfollow"), XS__sfollow, file); - newXS(strcpy(buf, "changedeity"), XS__changedeity, file); - newXS(strcpy(buf, "exp"), XS__exp, file); - newXS(strcpy(buf, "level"), XS__level, file); - newXS(strcpy(buf, "traindisc"), XS__traindisc, file); - newXS(strcpy(buf, "isdisctome"), XS__isdisctome, file); - newXS(strcpy(buf, "safemove"), XS__safemove, file); - newXS(strcpy(buf, "rain"), XS__rain, file); - newXS(strcpy(buf, "snow"), XS__snow, file); - newXS(strcpy(buf, "surname"), XS__surname, file); - newXS(strcpy(buf, "permaclass"), XS__permaclass, file); - newXS(strcpy(buf, "permarace"), XS__permarace, file); - newXS(strcpy(buf, "permagender"), XS__permagender, file); - newXS(strcpy(buf, "scribespells"), XS__scribespells, file); - newXS(strcpy(buf, "traindiscs"), XS__traindiscs, file); - newXS(strcpy(buf, "unscribespells"), XS__unscribespells, file); - newXS(strcpy(buf, "untraindiscs"), XS__untraindiscs, file); - newXS(strcpy(buf, "givecash"), XS__givecash, file); - newXS(strcpy(buf, "pvp"), XS__pvp, file); - newXS(strcpy(buf, "movepc"), XS__movepc, file); - newXS(strcpy(buf, "gmmove"), XS__gmmove, file); - newXS(strcpy(buf, "movegrp"), XS__movegrp, file); - newXS(strcpy(buf, "doanim"), XS__doanim, file); newXS(strcpy(buf, "addskill"), XS__addskill, file); - newXS(strcpy(buf, "setlanguage"), XS__setlanguage, file); - newXS(strcpy(buf, "setskill"), XS__setskill, file); - newXS(strcpy(buf, "setallskill"), XS__setallskill, file); + newXS(strcpy(buf, "assigntask"), XS__assigntask, file); newXS(strcpy(buf, "attack"), XS__attack, file); newXS(strcpy(buf, "attacknpc"), XS__attacknpc, file); newXS(strcpy(buf, "attacknpctype"), XS__attacknpctype, file); - newXS(strcpy(buf, "save"), XS__save, file); - newXS(strcpy(buf, "faction"), XS__faction, file); - newXS(strcpy(buf, "setsky"), XS__setsky, file); - newXS(strcpy(buf, "setguild"), XS__setguild, file); - newXS(strcpy(buf, "createguild"), XS__createguild, file); - newXS(strcpy(buf, "settime"), XS__settime, file); - newXS(strcpy(buf, "itemlink"), XS__itemlink, file); - newXS(strcpy(buf, "signal"), XS__signal, file); - newXS(strcpy(buf, "signalwith"), XS__signalwith, file); - newXS(strcpy(buf, "setglobal"), XS__setglobal, file); - newXS(strcpy(buf, "targlobal"), XS__targlobal, file); - newXS(strcpy(buf, "delglobal"), XS__delglobal, file); - newXS(strcpy(buf, "ding"), XS__ding, file); - newXS(strcpy(buf, "rebind"), XS__rebind, file); - newXS(strcpy(buf, "start"), XS__start, file); - newXS(strcpy(buf, "stop"), XS__stop, file); - newXS(strcpy(buf, "pause"), XS__pause, file); - newXS(strcpy(buf, "moveto"), XS__moveto, file); - newXS(strcpy(buf, "resume"), XS__resume, file); - newXS(strcpy(buf, "addldonpoints"), XS__addldonpoints, file); - newXS(strcpy(buf, "addldonwin"), XS__addldonpoints, file); - newXS(strcpy(buf, "addldonloss"), XS__addldonpoints, file); - newXS(strcpy(buf, "setnexthpevent"), XS__setnexthpevent, file); - newXS(strcpy(buf, "setnextinchpevent"), XS__setnextinchpevent, file); - newXS(strcpy(buf, "sethp"), XS__sethp, file); - newXS(strcpy(buf, "respawn"), XS__respawn, file); - newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file); - newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file); - newXS(strcpy(buf, "set_proximity"), XS__set_proximity, file); - newXS(strcpy(buf, "clear_proximity"), XS__clear_proximity, file); - newXS(strcpy(buf, "enable_proximity_say"), XS__enable_proximity_say, file); - newXS(strcpy(buf, "disable_proximity_say"), XS__disable_proximity_say, file); - newXS(strcpy(buf, "setanim"), XS__setanim, file); - newXS(strcpy(buf, "showgrid"), XS__showgrid, file); - newXS(strcpy(buf, "spawn_condition"), XS__spawn_condition, file); - newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file); - newXS(strcpy(buf, "toggle_spawn_event"), XS__toggle_spawn_event, file); - newXS(strcpy(buf, "has_zone_flag"), XS__has_zone_flag, file); - newXS(strcpy(buf, "set_zone_flag"), XS__set_zone_flag, file); - newXS(strcpy(buf, "clear_zone_flag"), XS__clear_zone_flag, file); - newXS(strcpy(buf, "summonburriedplayercorpse"), XS__summonburriedplayercorpse, file); - newXS(strcpy(buf, "summonallplayercorpses"), XS__summonallplayercorpses, file); - newXS(strcpy(buf, "getplayerburriedcorpsecount"), XS__getplayerburriedcorpsecount, file); newXS(strcpy(buf, "buryplayercorpse"), XS__buryplayercorpse, file); - newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file); - newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file); - newXS(strcpy(buf, "toggledoorstate"), XS__toggledoorstate, file); - newXS(strcpy(buf, "isdooropen"), XS__isdooropen, file); - newXS(strcpy(buf, "depopall"), XS__depopall, file); - newXS(strcpy(buf, "depopzone"), XS__depopzone, file); - newXS(strcpy(buf, "repopzone"), XS__repopzone, file); - newXS(strcpy(buf, "npcrace"), XS__npcrace, file); - newXS(strcpy(buf, "npcgender"), XS__npcgender, file); - newXS(strcpy(buf, "npcsize"), XS__npcsize, file); - newXS(strcpy(buf, "npctexture"), XS__npctexture, file); - newXS(strcpy(buf, "playerrace"), XS__playerrace, file); - newXS(strcpy(buf, "playergender"), XS__playergender, file); - newXS(strcpy(buf, "playersize"), XS__playersize, file); - newXS(strcpy(buf, "playertexture"), XS__playertexture, file); - newXS(strcpy(buf, "playerfeature"), XS__playerfeature, file); - newXS(strcpy(buf, "npcfeature"), XS__npcfeature, file); - -#ifdef BOTS - newXS(strcpy(buf, "botquest"), XS__botquest, file); - newXS(strcpy(buf, "spawnbotcount"), XS__spawnbotcount, file); - newXS(strcpy(buf, "createbotcount"), XS__createbotcount, file); - newXS(strcpy(buf, "createBot"), XS__createBot, file); -#endif //BOTS - - newXS(strcpy(buf, "taskselector"), XS__taskselector, file); - newXS(strcpy(buf, "tasksetselector"), XS__tasksetselector, file); - newXS(strcpy(buf, "enabletask"), XS__enabletask, file); - newXS(strcpy(buf, "disabletask"), XS__disabletask, file); - newXS(strcpy(buf, "istaskenabled"), XS__istaskenabled, file); - newXS(strcpy(buf, "istaskactive"), XS__istaskactive, file); - newXS(strcpy(buf, "istaskactivityactive"), XS__istaskactivityactive, file); - newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file); - newXS(strcpy(buf, "updatetaskactivity"), XS__updatetaskactivity, file); - newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file); - newXS(strcpy(buf, "taskexploredarea"), XS__taskexploredarea, file); - newXS(strcpy(buf, "assigntask"), XS__assigntask, file); - newXS(strcpy(buf, "failtask"), XS__failtask, file); - newXS(strcpy(buf, "tasktimeleft"), XS__tasktimeleft, file); - newXS(strcpy(buf, "istaskcompleted"), XS__istaskcompleted, file); - newXS(strcpy(buf, "enabledtaskcount"), XS__enabledtaskcount, file); - newXS(strcpy(buf, "firsttaskinset"), XS__firsttaskinset, file); - newXS(strcpy(buf, "lasttaskinset"), XS__lasttaskinset, file); - newXS(strcpy(buf, "nexttaskinset"), XS__nexttaskinset, file); - newXS(strcpy(buf, "activespeaktask"), XS__activespeaktask, file); - newXS(strcpy(buf, "activespeakactivity"), XS__activespeakactivity, file); - newXS(strcpy(buf, "activetasksinset"), XS__activetasksinset, file); - newXS(strcpy(buf, "completedtasksinset"), XS__completedtasksinset, file); - newXS(strcpy(buf, "istaskappropriate"), XS__istaskappropriate, file); - newXS(strcpy(buf, "popup"), XS__popup, file); + newXS(strcpy(buf, "castspell"), XS__castspell, file); + newXS(strcpy(buf, "changedeity"), XS__changedeity, file); + newXS(strcpy(buf, "checktitle"), XS__checktitle, file); + newXS(strcpy(buf, "clear_npctype_cache"), XS__clear_npctype_cache, file); + newXS(strcpy(buf, "clear_proximity"), XS__clear_proximity, file); + newXS(strcpy(buf, "clear_zone_flag"), XS__clear_zone_flag, file); newXS(strcpy(buf, "clearspawntimers"), XS__clearspawntimers, file); - newXS(strcpy(buf, "ze"), XS__ze, file); - newXS(strcpy(buf, "we"), XS__we, file); - newXS(strcpy(buf, "getlevel"), XS__getlevel, file); + newXS(strcpy(buf, "collectitems"), XS__collectitems, file); + newXS(strcpy(buf, "completedtasksinset"), XS__completedtasksinset, file); + newXS(strcpy(buf, "createdoor"), XS__CreateDoor, file); newXS(strcpy(buf, "creategroundobject"), XS__CreateGroundObject, file); newXS(strcpy(buf, "creategroundobjectfrommodel"), XS__CreateGroundObjectFromModel, file); - newXS(strcpy(buf, "createdoor"), XS__CreateDoor, file); - newXS(strcpy(buf, "modifynpcstat"), XS__ModifyNPCStat, file); - newXS(strcpy(buf, "collectitems"), XS__collectitems, file); - newXS(strcpy(buf, "updatespawntimer"), XS__UpdateSpawnTimer, file); - newXS(strcpy(buf, "MerchantSetItem"), XS__MerchantSetItem, file); - newXS(strcpy(buf, "MerchantCountItem"), XS__MerchantCountItem, file); - newXS(strcpy(buf, "varlink"), XS__varlink, file); - newXS(strcpy(buf, "saylink"), XS__saylink, file); - newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file); - newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); - newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); - newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file); - newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file); - newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file); - newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file); - newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file); - newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file); - newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file); - newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file); - newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file); - newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file); - newXS(strcpy(buf, "SetRunning"), XS__SetRunning, file); - newXS(strcpy(buf, "IsRunning"), XS__IsRunning, file); - newXS(strcpy(buf, "IsEffectInSpell"), XS__IsEffectInSpell, file); - newXS(strcpy(buf, "IsBeneficialSpell"), XS__IsBeneficialSpell, file); - newXS(strcpy(buf, "GetSpellResistType"), XS__GetSpellResistType, file); - newXS(strcpy(buf, "GetSpellTargetType"), XS__GetSpellTargetType, file); - newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file); - newXS(strcpy(buf, "factionvalue"), XS_FactionValue, file); - newXS(strcpy(buf, "checktitle"), XS__checktitle, file); - newXS(strcpy(buf, "enabletitle"), XS__enabletitle, file); - newXS(strcpy(buf, "removetitle"), XS__removetitle, file); - newXS(strcpy(buf, "wearchange"), XS__wearchange, file); - newXS(strcpy(buf, "voicetell"), XS__voicetell, file); - newXS(strcpy(buf, "LearnRecipe"), XS__LearnRecipe, file); - newXS(strcpy(buf, "SendMail"), XS__SendMail, file); - newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); - newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); - newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); + newXS(strcpy(buf, "createguild"), XS__createguild, file); + newXS(strcpy(buf, "crosszonemessageplayerbyname"), XS__crosszonemessageplayerbyname, file); + newXS(strcpy(buf, "crosszonesetentityvariablebynpctypeid"), XS__crosszonesetentityvariablebynpctypeid, file); newXS(strcpy(buf, "crosszonesignalclientbycharid"), XS__crosszonesignalclientbycharid, file); newXS(strcpy(buf, "crosszonesignalclientbyname"), XS__crosszonesignalclientbyname, file); - newXS(strcpy(buf, "crosszonemessageplayerbyname"), XS__crosszonemessageplayerbyname, file); - newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file); - newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file); - newXS(strcpy(buf, "clear_npctype_cache"), XS__clear_npctype_cache, file); - newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file); - newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file); - newXS(strcpy(buf, "crosszonesetentityvariablebynpctypeid"), XS__crosszonesetentityvariablebynpctypeid, file); newXS(strcpy(buf, "crosszonesignalnpcbynpctypeid"), XS__crosszonesignalnpcbynpctypeid, file); + newXS(strcpy(buf, "delglobal"), XS__delglobal, file); + newXS(strcpy(buf, "depop"), XS__depop, file); + newXS(strcpy(buf, "depop_withtimer"), XS__depop_withtimer, file); + newXS(strcpy(buf, "depopall"), XS__depopall, file); + newXS(strcpy(buf, "depopzone"), XS__depopzone, file); + newXS(strcpy(buf, "ding"), XS__ding, file); + newXS(strcpy(buf, "disable_proximity_say"), XS__disable_proximity_say, file); + newXS(strcpy(buf, "disable_spawn2"), XS__disable_spawn2, file); + newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file); + newXS(strcpy(buf, "disabletask"), XS__disabletask, file); + newXS(strcpy(buf, "doanim"), XS__doanim, file); + newXS(strcpy(buf, "echo"), XS__echo, file); + newXS(strcpy(buf, "emote"), XS__emote, file); + newXS(strcpy(buf, "enable_proximity_say"), XS__enable_proximity_say, file); + newXS(strcpy(buf, "enable_spawn2"), XS__enable_spawn2, file); + newXS(strcpy(buf, "enabledtaskcount"), XS__enabledtaskcount, file); + newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file); + newXS(strcpy(buf, "enabletask"), XS__enabletask, file); + newXS(strcpy(buf, "enabletitle"), XS__enabletitle, file); + newXS(strcpy(buf, "exp"), XS__exp, file); + newXS(strcpy(buf, "faction"), XS__faction, file); + newXS(strcpy(buf, "factionvalue"), XS_FactionValue, file); + newXS(strcpy(buf, "failtask"), XS__failtask, file); + newXS(strcpy(buf, "firsttaskinset"), XS__firsttaskinset, file); + newXS(strcpy(buf, "follow"), XS__follow, file); + newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file); + newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file); + newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file); + newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file); + newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file); + newXS(strcpy(buf, "getlevel"), XS__getlevel, file); + newXS(strcpy(buf, "getplayerburriedcorpsecount"), XS__getplayerburriedcorpsecount, file); + newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file); + newXS(strcpy(buf, "givecash"), XS__givecash, file); + newXS(strcpy(buf, "gmmove"), XS__gmmove, file); + newXS(strcpy(buf, "gmsay"), XS__gmsay, file); + newXS(strcpy(buf, "has_zone_flag"), XS__has_zone_flag, file); + newXS(strcpy(buf, "incstat"), XS__incstat, file); + newXS(strcpy(buf, "isdisctome"), XS__isdisctome, file); + newXS(strcpy(buf, "isdooropen"), XS__isdooropen, file); + newXS(strcpy(buf, "istaskactive"), XS__istaskactive, file); + newXS(strcpy(buf, "istaskactivityactive"), XS__istaskactivityactive, file); + newXS(strcpy(buf, "istaskappropriate"), XS__istaskappropriate, file); + newXS(strcpy(buf, "istaskcompleted"), XS__istaskcompleted, file); + newXS(strcpy(buf, "istaskenabled"), XS__istaskenabled, file); + newXS(strcpy(buf, "itemlink"), XS__itemlink, file); + newXS(strcpy(buf, "lasttaskinset"), XS__lasttaskinset, file); + newXS(strcpy(buf, "level"), XS__level, file); + newXS(strcpy(buf, "me"), XS__me, file); + newXS(strcpy(buf, "modifynpcstat"), XS__ModifyNPCStat, file); + newXS(strcpy(buf, "movegrp"), XS__movegrp, file); + newXS(strcpy(buf, "movepc"), XS__movepc, file); + newXS(strcpy(buf, "moveto"), XS__moveto, file); + newXS(strcpy(buf, "nexttaskinset"), XS__nexttaskinset, file); + newXS(strcpy(buf, "npcfeature"), XS__npcfeature, file); + newXS(strcpy(buf, "npcgender"), XS__npcgender, file); + newXS(strcpy(buf, "npcrace"), XS__npcrace, file); + newXS(strcpy(buf, "npcsize"), XS__npcsize, file); + newXS(strcpy(buf, "npctexture"), XS__npctexture, file); + newXS(strcpy(buf, "pause"), XS__pause, file); + newXS(strcpy(buf, "permaclass"), XS__permaclass, file); + newXS(strcpy(buf, "permagender"), XS__permagender, file); + newXS(strcpy(buf, "permarace"), XS__permarace, file); + newXS(strcpy(buf, "playerfeature"), XS__playerfeature, file); + newXS(strcpy(buf, "playergender"), XS__playergender, file); + newXS(strcpy(buf, "playerrace"), XS__playerrace, file); + newXS(strcpy(buf, "playersize"), XS__playersize, file); + newXS(strcpy(buf, "playertexture"), XS__playertexture, file); + newXS(strcpy(buf, "popup"), XS__popup, file); + newXS(strcpy(buf, "pvp"), XS__pvp, file); + newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file); + newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file); + newXS(strcpy(buf, "rain"), XS__rain, file); + newXS(strcpy(buf, "rebind"), XS__rebind, file); + newXS(strcpy(buf, "removetitle"), XS__removetitle, file); + newXS(strcpy(buf, "repopzone"), XS__repopzone, file); + newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file); + newXS(strcpy(buf, "respawn"), XS__respawn, file); + newXS(strcpy(buf, "resume"), XS__resume, file); + newXS(strcpy(buf, "safemove"), XS__safemove, file); + newXS(strcpy(buf, "save"), XS__save, file); + newXS(strcpy(buf, "say"), XS__say, file); + newXS(strcpy(buf, "saylink"), XS__saylink, file); + newXS(strcpy(buf, "scribespells"), XS__scribespells, file); + newXS(strcpy(buf, "selfcast"), XS__selfcast, file); + newXS(strcpy(buf, "set_proximity"), XS__set_proximity, file); + newXS(strcpy(buf, "set_zone_flag"), XS__set_zone_flag, file); + newXS(strcpy(buf, "setallskill"), XS__setallskill, file); + newXS(strcpy(buf, "setanim"), XS__setanim, file); + newXS(strcpy(buf, "setglobal"), XS__setglobal, file); + newXS(strcpy(buf, "setguild"), XS__setguild, file); + newXS(strcpy(buf, "sethp"), XS__sethp, file); + newXS(strcpy(buf, "setlanguage"), XS__setlanguage, file); + newXS(strcpy(buf, "setnexthpevent"), XS__setnexthpevent, file); + newXS(strcpy(buf, "setnextinchpevent"), XS__setnextinchpevent, file); + newXS(strcpy(buf, "setskill"), XS__setskill, file); + newXS(strcpy(buf, "setsky"), XS__setsky, file); + newXS(strcpy(buf, "setstat"), XS__setstat, file); + newXS(strcpy(buf, "settarget"), XS__settarget, file); + newXS(strcpy(buf, "settime"), XS__settime, file); + newXS(strcpy(buf, "settimer"), XS__settimer, file); + newXS(strcpy(buf, "settimerMS"), XS__settimerMS, file); + newXS(strcpy(buf, "sfollow"), XS__sfollow, file); + newXS(strcpy(buf, "shout"), XS__shout, file); + newXS(strcpy(buf, "shout2"), XS__shout2, file); + newXS(strcpy(buf, "showgrid"), XS__showgrid, file); + newXS(strcpy(buf, "signal"), XS__signal, file); + newXS(strcpy(buf, "signalwith"), XS__signalwith, file); + newXS(strcpy(buf, "snow"), XS__snow, file); + newXS(strcpy(buf, "spawn"), XS__spawn, file); + newXS(strcpy(buf, "spawn2"), XS__spawn2, file); + newXS(strcpy(buf, "spawn_condition"), XS__spawn_condition, file); + newXS(strcpy(buf, "spawn_from_spawn2"), XS__spawn_from_spawn2, file); + newXS(strcpy(buf, "start"), XS__start, file); + newXS(strcpy(buf, "stop"), XS__stop, file); + newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file); + newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file); + newXS(strcpy(buf, "summonallplayercorpses"), XS__summonallplayercorpses, file); + newXS(strcpy(buf, "summonburriedplayercorpse"), XS__summonburriedplayercorpse, file); + newXS(strcpy(buf, "summonitem"), XS__summonitem, file); + newXS(strcpy(buf, "surname"), XS__surname, file); + newXS(strcpy(buf, "targlobal"), XS__targlobal, file); + newXS(strcpy(buf, "taskexploredarea"), XS__taskexploredarea, file); + newXS(strcpy(buf, "taskselector"), XS__taskselector, file); + newXS(strcpy(buf, "tasksetselector"), XS__tasksetselector, file); + newXS(strcpy(buf, "tasktimeleft"), XS__tasktimeleft, file); + newXS(strcpy(buf, "toggle_spawn_event"), XS__toggle_spawn_event, file); + newXS(strcpy(buf, "toggledoorstate"), XS__toggledoorstate, file); + newXS(strcpy(buf, "traindisc"), XS__traindisc, file); + newXS(strcpy(buf, "traindiscs"), XS__traindiscs, file); + newXS(strcpy(buf, "unique_spawn"), XS__unique_spawn, file); + newXS(strcpy(buf, "unscribespells"), XS__unscribespells, file); + newXS(strcpy(buf, "untraindiscs"), XS__untraindiscs, file); + newXS(strcpy(buf, "updatespawntimer"), XS__UpdateSpawnTimer, file); + newXS(strcpy(buf, "updatetaskactivity"), XS__updatetaskactivity, file); + newXS(strcpy(buf, "varlink"), XS__varlink, file); + newXS(strcpy(buf, "voicetell"), XS__voicetell, file); + newXS(strcpy(buf, "we"), XS__we, file); + newXS(strcpy(buf, "wearchange"), XS__wearchange, file); + newXS(strcpy(buf, "write"), XS__write, file); + newXS(strcpy(buf, "ze"), XS__ze, file); + newXS(strcpy(buf, "zone"), XS__zone, file); + XSRETURN_YES; } From 179f47dbe30eaad3ec746c780e2bc2d21b034397 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 4 Jan 2015 20:42:45 -0600 Subject: [PATCH 0740/1883] RoF+ - Added the "Your race, class, or deity cannot use this item." message since it no longer exists in the eqstr_us.txt file. --- zone/spells.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index ce5d9df8d..2b5536bb3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -274,7 +274,15 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } else { - Message_StringID(13, CANNOT_USE_ITEM); + if (CastToClient()->GetClientVersion() >= EQClientRoF) + { + // Line 181 in eqstr_us.txt was changed in RoF+ + Message(15, "Your race, class, or deity cannot use this item."); + } + else + { + Message_StringID(13, CANNOT_USE_ITEM); + } } return(false); } From 7557cfd845b8436a7e7f14313af59355655953c0 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 5 Jan 2015 13:44:16 -0500 Subject: [PATCH 0741/1883] Added text link translators for all supported clients - currently, only OP_ChannelMessage and OP_SpecialMesg are translated. --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index 5aa90cfc9..c9a9a2c3a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/05/2015 == +Uleat: Fixed (added translators for) item/text links. Only 'OP_ChannelMessage' and 'OP_SpecialMesg' are currently handled..more text channels will be added as the need arises. + == 01/03/2015 == Trevius: (RoF2) /shield (shielding) and /key (key ring) are both now functional after opcode updates. From 4b133c808c3dfdf619a83420b98eb55e8fa41552 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 5 Jan 2015 13:50:03 -0500 Subject: [PATCH 0742/1883] It helps if you actually push more than the changelog message... --- common/eq_dictionary.h | 2 + common/eq_packet_structs.h | 17 + common/patches/rof.cpp | 430 ++++++++++++++++++++++++- common/patches/rof2.cpp | 433 ++++++++++++++++++++++++- common/patches/rof2_constants.h | 2 + common/patches/rof2_ops.h | 1 + common/patches/rof2_structs.h | 19 ++ common/patches/rof_constants.h | 2 + common/patches/rof_ops.h | 1 + common/patches/rof_structs.h | 18 ++ common/patches/sod.cpp | 455 +++++++++++++++++++++++++++ common/patches/sod_constants.h | 2 + common/patches/sod_ops.h | 3 + common/patches/sod_structs.h | 16 + common/patches/sof.cpp | 455 +++++++++++++++++++++++++++ common/patches/sof_constants.h | 2 + common/patches/sof_ops.h | 3 + common/patches/sof_structs.h | 26 +- common/patches/titanium.cpp | 453 ++++++++++++++++++++++++++ common/patches/titanium_constants.h | 2 + common/patches/titanium_ops.h | 3 + common/patches/titanium_structs.h | 28 +- common/patches/underfoot.cpp | 426 ++++++++++++++++++++++++- common/patches/underfoot_constants.h | 2 + common/patches/underfoot_ops.h | 1 + common/patches/underfoot_structs.h | 17 + zone/bot.cpp | 1 - zone/client.cpp | 286 ++++++++--------- zone/client.h | 16 +- zone/command.cpp | 2 - zone/corpse.cpp | 17 +- zone/npc.cpp | 1 - zone/questmgr.cpp | 5 - zone/tasks.cpp | 1 - 34 files changed, 2936 insertions(+), 212 deletions(-) diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 43511072f..3438f133b 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -149,6 +149,8 @@ public: 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 diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 07daa97fd..32f7360fb 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -5269,6 +5269,23 @@ struct ClientMarqueeMessage_Struct { typedef std::list ItemList; +struct TextLinkBody_Struct { + uint8 unknown_1; /* '%1X' - Server field 1 */ + uint32 item_id; /* '%05X' - Server field 2 */ + uint32 augment_1; /* '%05X' - Server field 3 */ + uint32 augment_2; /* '%05X' - Server field 4 */ + uint32 augment_3; /* '%05X' - Server field 5 */ + uint32 augment_4; /* '%05X' - Server field 6 */ + uint32 augment_5; /* '%05X' - Server field 7 */ + uint32 augment_6; /* '%05X' - Server field 8 */ + uint8 unknown_2; /* '%1X' - Server field 9 */ + uint8 unknown_3; /* '%1X' - Server field 10 */ + uint32 unknown_4; /* '%04X' - Server field 11 */ + uint8 unknown_5; /* '%1X' - Server field 12 */ + uint32 ornament_icon; /* '%05X' - Server field 13 */ + int hash; /* '%08X' - Server field 14 */ +}; + // Restore structure packing to default #pragma pack() diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 36d487545..d236d2b34 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -33,6 +33,18 @@ namespace RoF static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct RoFSlot); static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse); + // server to client text link converters + static inline void ServerToRoFTextLinks(std::string& rofTextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToRoFTextLinkBodyStruct(structs::TextLinkBody_Struct& rofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateRoFTextLinkBody(std::string& rofLinkBody, const structs::TextLinkBody_Struct& rofLinkBodyStruct); + + // client to server text link converters + static inline void RoFToServerTextLinks(std::string& serverTextLink, const std::string& rofTextLink); + static inline bool DegenerateRoFTextLinkBody(structs::TextLinkBody_Struct& rofLinkBodyStruct, const std::string& rofLinkBody); + static inline void RoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rofLinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -488,7 +500,13 @@ namespace RoF unsigned char *__emu_buffer = in->pBuffer; - in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + std::string old_message = emu->message; + std::string new_message; + ServerToRoFTextLinks(new_message, old_message); + + //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; + in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -501,7 +519,7 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->skill_in_language); - VARSTRUCT_ENCODE_STRING(OutBuffer, emu->message); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown @@ -3096,6 +3114,44 @@ namespace RoF FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToRoFTextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Stun) { ENCODE_LENGTH_EXACT(Stun_Struct); @@ -4041,7 +4097,13 @@ namespace RoF uint32 Skill = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); - __packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + std::string old_message = InBuffer; + std::string new_message; + RoFToServerTextLinks(new_message, old_message); + + //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; @@ -4050,7 +4112,7 @@ namespace RoF emu->language = Language; emu->chan_num = Channel; emu->skill_in_language = Skill; - strcpy(emu->message, InBuffer); + strcpy(emu->message, new_message.c_str()); delete[] __eq_buffer; } @@ -5627,5 +5689,365 @@ namespace RoF { return (RoFCorpse - 1); } + + static inline void ServerToRoFTextLinks(std::string& rofTextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->RoF): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): link size equal, no conversion necessary"); + rofTextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): delimiter not found, no conversion necessary"); + rofTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToRoFTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateRoFTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): conversion error"); + rofTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + rofTextLink.push_back(delimiter); + rofTextLink.append(segments[iter].c_str()); + rofTextLink.push_back(delimiter); + } + else { + rofTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->RoF): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->RoF): new message '%s'", rofTextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + rofTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToRoFTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateRoFTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF): conversion error"); + rofTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + rofTextLink.push_back(delimiter); + rofTextLink.append(segments[iter].c_str()); + rofTextLink.push_back(delimiter); + } + else { + rofTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToRoFTextLinkBodyStruct(structs::TextLinkBody_Struct& rofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + rofLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + rofLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + rofLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + rofLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + rofLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + rofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + rofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + rofLinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; + rofLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; + rofLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; + rofLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + rofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; + rofLinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateRoFTextLinkBody(std::string& rofLinkBody, const structs::TextLinkBody_Struct& rofLinkBodyStruct) + { + rofLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", + rofLinkBodyStruct.unknown_1, + rofLinkBodyStruct.item_id, + rofLinkBodyStruct.augment_1, + rofLinkBodyStruct.augment_2, + rofLinkBodyStruct.augment_3, + rofLinkBodyStruct.augment_4, + rofLinkBodyStruct.augment_5, + rofLinkBodyStruct.augment_6, + rofLinkBodyStruct.unknown_2, + rofLinkBodyStruct.unknown_3, + rofLinkBodyStruct.unknown_4, + rofLinkBodyStruct.ornament_icon, + rofLinkBodyStruct.hash + ); + + if (rofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void RoFToServerTextLinks(std::string& serverTextLink, const std::string& rofTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(RoF->Server): old message '%s'", rofTextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): link size equal, no conversion necessary"); + serverTextLink = rofTextLink; + return; + } + + if (rofTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): delimiter not found, no conversion necessary"); + serverTextLink = rofTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(rofTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateRoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + RoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): conversion error"); + serverTextLink = rofTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(RoF->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(RoF->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find(delimiter) == std::string::npos)) { + serverTextLink = rofTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(rofTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateRoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + RoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(RoF->Server): conversion error"); + serverTextLink = rofTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateRoFTextLinkBody(structs::TextLinkBody_Struct& rofLinkBodyStruct, const std::string& rofLinkBody) + { + // RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + memset(&rofLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (rofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + rofLinkBodyStruct.unknown_1 = (uint8)strtol(rofLinkBody.substr(0, 1).c_str(), nullptr, 16); + rofLinkBodyStruct.item_id = (uint32)strtol(rofLinkBody.substr(1, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_1 = (uint32)strtol(rofLinkBody.substr(6, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_2 = (uint32)strtol(rofLinkBody.substr(11, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_3 = (uint32)strtol(rofLinkBody.substr(16, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_4 = (uint32)strtol(rofLinkBody.substr(21, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_5 = (uint32)strtol(rofLinkBody.substr(26, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.augment_6 = (uint32)strtol(rofLinkBody.substr(31, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.unknown_2 = (uint8)strtol(rofLinkBody.substr(36, 1).c_str(), nullptr, 16); + rofLinkBodyStruct.unknown_3 = (uint32)strtol(rofLinkBody.substr(37, 4).c_str(), nullptr, 16); + rofLinkBodyStruct.unknown_4 = (uint8)strtol(rofLinkBody.substr(41, 1).c_str(), nullptr, 16); + rofLinkBodyStruct.ornament_icon = (uint32)strtol(rofLinkBody.substr(42, 5).c_str(), nullptr, 16); + rofLinkBodyStruct.hash = (int)strtol(rofLinkBody.substr(47, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void RoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rofLinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = rofLinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = rofLinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = rofLinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = rofLinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = rofLinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = rofLinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = rofLinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = rofLinkBodyStruct.augment_6; + serverLinkBodyStruct.unknown_2 = NOT_USED; + serverLinkBodyStruct.unknown_3 = rofLinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_4 = rofLinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_5 = rofLinkBodyStruct.unknown_4; + serverLinkBodyStruct.ornament_icon = rofLinkBodyStruct.ornament_icon; + serverLinkBodyStruct.hash = rofLinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace RoF diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 02ac289a9..6356a6f7d 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -33,6 +33,18 @@ namespace RoF2 static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot); static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse); + // server to client text link converters + static inline void ServerToRoF2TextLinks(std::string& rof2TextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToRoF2TextLinkBodyStruct(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateRoF2TextLinkBody(std::string& rof2LinkBody, const structs::TextLinkBody_Struct& rof2LinkBodyStruct); + + // client to server text link converters + static inline void RoF2ToServerTextLinks(std::string& serverTextLink, const std::string& rof2TextLink); + static inline bool DegenerateRoF2TextLinkBody(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const std::string& rof2LinkBody); + static inline void RoF2ToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rof2LinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -554,7 +566,13 @@ namespace RoF2 unsigned char *__emu_buffer = in->pBuffer; - in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + std::string old_message = emu->message; + std::string new_message; + ServerToRoF2TextLinks(new_message, old_message); + + //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; + in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -567,7 +585,7 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->skill_in_language); - VARSTRUCT_ENCODE_STRING(OutBuffer, emu->message); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown @@ -3162,6 +3180,44 @@ namespace RoF2 FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToRoF2TextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Stun) { ENCODE_LENGTH_EXACT(Stun_Struct); @@ -4113,7 +4169,13 @@ namespace RoF2 uint32 Skill = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); - __packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + std::string old_message = InBuffer; + std::string new_message; + RoF2ToServerTextLinks(new_message, old_message); + + //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; @@ -4122,7 +4184,7 @@ namespace RoF2 emu->language = Language; emu->chan_num = Channel; emu->skill_in_language = Skill; - strcpy(emu->message, InBuffer); + strcpy(emu->message, new_message.c_str()); delete[] __eq_buffer; } @@ -5722,5 +5784,368 @@ namespace RoF2 { return (RoF2Corpse + EmuConstants::CORPSE_BEGIN - 1); } + + static inline void ServerToRoF2TextLinks(std::string& rof2TextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): link size equal, no conversion necessary"); + rof2TextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): delimiter not found, no conversion necessary"); + rof2TextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToRoF2TextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateRoF2TextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): conversion error"); + rof2TextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + rof2TextLink.push_back(delimiter); + rof2TextLink.append(segments[iter].c_str()); + rof2TextLink.push_back(delimiter); + } + else { + rof2TextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): new message '%s'", rof2TextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + rof2TextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToRoF2TextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateRoF2TextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->RoF2): conversion error"); + rof2TextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + rof2TextLink.push_back(delimiter); + rof2TextLink.append(segments[iter].c_str()); + rof2TextLink.push_back(delimiter); + } + else { + rof2TextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToRoF2TextLinkBodyStruct(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + rof2LinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + rof2LinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + rof2LinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + rof2LinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + rof2LinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + rof2LinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + rof2LinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + rof2LinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; + rof2LinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_2; + rof2LinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_3; + rof2LinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_4; + rof2LinkBodyStruct.unknown_5 = serverLinkBodyStruct.unknown_5; + rof2LinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; + rof2LinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateRoF2TextLinkBody(std::string& rof2LinkBody, const structs::TextLinkBody_Struct& rof2LinkBodyStruct) + { + rof2LinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + rof2LinkBodyStruct.unknown_1, + rof2LinkBodyStruct.item_id, + rof2LinkBodyStruct.augment_1, + rof2LinkBodyStruct.augment_2, + rof2LinkBodyStruct.augment_3, + rof2LinkBodyStruct.augment_4, + rof2LinkBodyStruct.augment_5, + rof2LinkBodyStruct.augment_6, + rof2LinkBodyStruct.unknown_2, + rof2LinkBodyStruct.unknown_3, + rof2LinkBodyStruct.unknown_4, + rof2LinkBodyStruct.unknown_5, + rof2LinkBodyStruct.ornament_icon, + rof2LinkBodyStruct.hash + ); + + if (rof2LinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void RoF2ToServerTextLinks(std::string& serverTextLink, const std::string& rof2TextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): old message '%s'", rof2TextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): link size equal, no conversion necessary"); + serverTextLink = rof2TextLink; + return; + } + + if (rof2TextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): delimiter not found, no conversion necessary"); + serverTextLink = rof2TextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(rof2TextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateRoF2TextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + RoF2ToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): conversion error"); + serverTextLink = rof2TextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rof2TextLink.find(delimiter) == std::string::npos)) { + serverTextLink = rof2TextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(rof2TextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateRoF2TextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + RoF2ToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(RoF2->Server): conversion error"); + serverTextLink = rof2TextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateRoF2TextLinkBody(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const std::string& rof2LinkBody) + { + // RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" + memset(&rof2LinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (rof2LinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + rof2LinkBodyStruct.unknown_1 = (uint8)strtol(rof2LinkBody.substr(0, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.item_id = (uint32)strtol(rof2LinkBody.substr(1, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_1 = (uint32)strtol(rof2LinkBody.substr(6, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_2 = (uint32)strtol(rof2LinkBody.substr(11, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_3 = (uint32)strtol(rof2LinkBody.substr(16, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_4 = (uint32)strtol(rof2LinkBody.substr(21, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_5 = (uint32)strtol(rof2LinkBody.substr(26, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.augment_6 = (uint32)strtol(rof2LinkBody.substr(31, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.unknown_2 = (uint8)strtol(rof2LinkBody.substr(36, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.unknown_3 = (uint32)strtol(rof2LinkBody.substr(37, 4).c_str(), nullptr, 16); + rof2LinkBodyStruct.unknown_4 = (uint8)strtol(rof2LinkBody.substr(41, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.unknown_5 = (uint8)strtol(rof2LinkBody.substr(42, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.ornament_icon = (uint32)strtol(rof2LinkBody.substr(43, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.hash = (int)strtol(rof2LinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void RoF2ToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rof2LinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = rof2LinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = rof2LinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = rof2LinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = rof2LinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = rof2LinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = rof2LinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = rof2LinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = rof2LinkBodyStruct.augment_6; + serverLinkBodyStruct.unknown_2 = rof2LinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_3 = rof2LinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_4 = rof2LinkBodyStruct.unknown_4; + serverLinkBodyStruct.unknown_5 = rof2LinkBodyStruct.unknown_5; + serverLinkBodyStruct.ornament_icon = rof2LinkBodyStruct.ornament_icon; + serverLinkBodyStruct.hash = rof2LinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace RoF2 diff --git a/common/patches/rof2_constants.h b/common/patches/rof2_constants.h index 596ffa7e7..b4cbb15e0 100644 --- a/common/patches/rof2_constants.h +++ b/common/patches/rof2_constants.h @@ -181,6 +181,8 @@ namespace RoF2 { 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 TEXT_LINK_BODY_LENGTH = 56; } namespace limits { diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index 79614504d..66b86d756 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -95,6 +95,7 @@ E(OP_SkillUpdate) E(OP_SomeItemPacketMaybe) E(OP_SpawnAppearance) E(OP_SpawnDoor) +E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) E(OP_TaskDescription) diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 9ba71574c..60cf07808 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4872,6 +4872,25 @@ struct MercenaryMerchantResponse_Struct { /*0004*/ }; +// RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - RoF2 field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - RoF2 field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - RoF2 field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - RoF2 field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - RoF2 field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - RoF2 field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - RoF2 field 7 / Server field 7 */ + uint32 augment_6; /* '%05X' - RoF2 field 8 / Server field 8 */ + uint8 unknown_2; /* '%1X' - RoF2 field 9 / Server field 9 */ + uint8 unknown_3; /* '%1X' - RoF2 field 10 / Server field 10 */ + uint32 unknown_4; /* '%04X' - RoF2 field 11 / Server field 11 */ + uint8 unknown_5; /* '%1X' - RoF2 field 12 / Server field 12 */ + uint32 ornament_icon; /* '%05X' - RoF2 field 13 / Server field 13 */ + int hash; /* '%08X' - RoF2 field 14 / Server field 14 */ +}; + }; //end namespace structs }; //end namespace RoF2 diff --git a/common/patches/rof_constants.h b/common/patches/rof_constants.h index 97cb25aa5..233a1b36c 100644 --- a/common/patches/rof_constants.h +++ b/common/patches/rof_constants.h @@ -180,6 +180,8 @@ namespace RoF { 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 TEXT_LINK_BODY_LENGTH = 55; } namespace limits { diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index 878870a81..ef97dda99 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -84,6 +84,7 @@ E(OP_SkillUpdate) E(OP_SomeItemPacketMaybe) E(OP_SpawnAppearance) E(OP_SpawnDoor) +E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) E(OP_TaskDescription) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index fb2f09615..4aa2c04a2 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4894,6 +4894,24 @@ struct MercenaryMerchantResponse_Struct { /*0004*/ }; +// RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - RoF field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - RoF field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - RoF field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - RoF field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - RoF field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - RoF field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - RoF field 7 / Server field 7 */ + uint32 augment_6; /* '%05X' - RoF field 8 / Server field 8 */ + uint8 unknown_2; /* '%1X' - RoF field 9 / Server field 10 */ + uint32 unknown_3; /* '%04X' - RoF field 10 / Server field 11 */ + uint8 unknown_4; /* '%1X' - RoF field 11 / Server field 12 */ + uint32 ornament_icon; /* '%05X' - RoF field 12 / Server field 13 */ + int hash; /* '%08X' - RoF field 13 / Server field 14 */ +}; + }; //end namespace structs }; //end namespace RoF diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 7355526c4..b30bad97d 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -31,6 +31,18 @@ namespace SoD static inline uint32 SoDToServerSlot(uint32 SoDSlot); static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse); + // server to client text link converters + static inline void ServerToSoDTextLinks(std::string& sodTextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToSoDTextLinkBodyStruct(structs::TextLinkBody_Struct& sodLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateSoDTextLinkBody(std::string& sodLinkBody, const structs::TextLinkBody_Struct& sodLinkBodyStruct); + + // client to server text link converters + static inline void SoDToServerTextLinks(std::string& serverTextLink, const std::string& sodTextLink); + static inline bool DegenerateSoDTextLinkBody(structs::TextLinkBody_Struct& sodLinkBodyStruct, const std::string& sodLinkBody); + static inline void SoDToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sodLinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -296,6 +308,35 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_ChannelMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoDTextLinks(new_message, old_message); + + in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, __emu_buffer, sizeof(ChannelMessage_Struct)); + + OutBuffer += sizeof(ChannelMessage_Struct); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_CharInventory) { //consume the packet @@ -1963,6 +2004,44 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToSoDTextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Stun) { ENCODE_LENGTH_EXACT(Stun_Struct); @@ -2729,6 +2808,25 @@ namespace SoD FINISH_DIRECT_DECODE(); } + DECODE(OP_ChannelMessage) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; + std::string new_message; + SoDToServerTextLinks(new_message, old_message); + + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; + + memcpy(emu, __eq_buffer, sizeof(ChannelMessage_Struct)); + strcpy(emu->message, new_message.c_str()); + + delete[] __eq_buffer; + } + DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); @@ -3683,5 +3781,362 @@ namespace SoD //uint32 ServerCorpse; return (SoDCorpse - 1); } + + static inline void ServerToSoDTextLinks(std::string& sodTextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->SoD): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): link size equal, no conversion necessary"); + sodTextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): delimiter not found, no conversion necessary"); + sodTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToSoDTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateSoDTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): conversion error"); + sodTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + sodTextLink.push_back(delimiter); + sodTextLink.append(segments[iter].c_str()); + sodTextLink.push_back(delimiter); + } + else { + sodTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->SoD): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->SoD): new message '%s'", sodTextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + sodTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToSoDTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateSoDTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->SoD): conversion error"); + sodTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + sodTextLink.push_back(delimiter); + sodTextLink.append(segments[iter].c_str()); + sodTextLink.push_back(delimiter); + } + else { + sodTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToSoDTextLinkBodyStruct(structs::TextLinkBody_Struct& sodLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + sodLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + sodLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + sodLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + sodLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + sodLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + sodLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + sodLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + sodLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; + sodLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; + sodLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + sodLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; + sodLinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateSoDTextLinkBody(std::string& sodLinkBody, const structs::TextLinkBody_Struct& sodLinkBodyStruct) + { + sodLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", + sodLinkBodyStruct.unknown_1, + sodLinkBodyStruct.item_id, + sodLinkBodyStruct.augment_1, + sodLinkBodyStruct.augment_2, + sodLinkBodyStruct.augment_3, + sodLinkBodyStruct.augment_4, + sodLinkBodyStruct.augment_5, + sodLinkBodyStruct.unknown_2, + sodLinkBodyStruct.unknown_3, + sodLinkBodyStruct.unknown_4, + sodLinkBodyStruct.ornament_icon, + sodLinkBodyStruct.hash + ); + + if (sodLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void SoDToServerTextLinks(std::string& serverTextLink, const std::string& sodTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(SoD->Server): old message '%s'", sodTextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): link size equal, no conversion necessary"); + serverTextLink = sodTextLink; + return; + } + + if (sodTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): delimiter not found, no conversion necessary"); + serverTextLink = sodTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(sodTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateSoDTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + SoDToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): conversion error"); + serverTextLink = sodTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(SoD->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(SoD->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sodTextLink.find(delimiter) == std::string::npos)) { + serverTextLink = sodTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(sodTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateSoDTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + SoDToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(SoD->Server): conversion error"); + serverTextLink = sodTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateSoDTextLinkBody(structs::TextLinkBody_Struct& sodLinkBodyStruct, const std::string& sodLinkBody) + { + // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + memset(&sodLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (sodLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + sodLinkBodyStruct.unknown_1 = (uint8)strtol(sodLinkBody.substr(0, 1).c_str(), nullptr, 16); + sodLinkBodyStruct.item_id = (uint32)strtol(sodLinkBody.substr(1, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.augment_1 = (uint32)strtol(sodLinkBody.substr(6, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.augment_2 = (uint32)strtol(sodLinkBody.substr(11, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.augment_3 = (uint32)strtol(sodLinkBody.substr(16, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.augment_4 = (uint32)strtol(sodLinkBody.substr(21, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.augment_5 = (uint32)strtol(sodLinkBody.substr(26, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.unknown_2 = (uint8)strtol(sodLinkBody.substr(31, 1).c_str(), nullptr, 16); + sodLinkBodyStruct.unknown_3 = (uint32)strtol(sodLinkBody.substr(32, 4).c_str(), nullptr, 16); + sodLinkBodyStruct.unknown_4 = (uint8)strtol(sodLinkBody.substr(36, 1).c_str(), nullptr, 16); + sodLinkBodyStruct.ornament_icon = (uint32)strtol(sodLinkBody.substr(37, 5).c_str(), nullptr, 16); + sodLinkBodyStruct.hash = (int)strtol(sodLinkBody.substr(42, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void SoDToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sodLinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = sodLinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = sodLinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = sodLinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = sodLinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = sodLinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = sodLinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = sodLinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = NOT_USED; + serverLinkBodyStruct.unknown_2 = NOT_USED; + serverLinkBodyStruct.unknown_3 = sodLinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_4 = sodLinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_5 = sodLinkBodyStruct.unknown_4; + serverLinkBodyStruct.ornament_icon = sodLinkBodyStruct.ornament_icon; + serverLinkBodyStruct.hash = sodLinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace SoD diff --git a/common/patches/sod_constants.h b/common/patches/sod_constants.h index 8bdf45532..89749fd56 100644 --- a/common/patches/sod_constants.h +++ b/common/patches/sod_constants.h @@ -177,6 +177,8 @@ namespace SoD { 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 TEXT_LINK_BODY_LENGTH = 50; } namespace limits { diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 038b42e08..e3b6c1f41 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -8,6 +8,7 @@ E(OP_Barter) E(OP_BazaarSearch) E(OP_Buff) E(OP_CancelTrade) +E(OP_ChannelMessage) E(OP_CharInventory) E(OP_ClientUpdate) E(OP_Consider) @@ -57,6 +58,7 @@ E(OP_ShopPlayerBuy) E(OP_ShopPlayerSell) E(OP_SomeItemPacketMaybe) E(OP_SpawnDoor) +E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) E(OP_Track) @@ -81,6 +83,7 @@ D(OP_BazaarSearch) D(OP_Buff) D(OP_Bug) D(OP_CastSpell) +D(OP_ChannelMessage) D(OP_CharacterCreate) D(OP_ClientUpdate) D(OP_Consider) diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 7ec101fd3..3c1acc37d 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -4409,6 +4409,22 @@ struct MercenaryAssign_Struct { /*0012*/ }; +// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - SoD field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - SoD field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - SoD field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - SoD field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - SoD field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - SoD field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - SoD field 7 / Server field 7 */ + uint8 unknown_2; /* '%1X' - SoD field 8 / Server field 10 */ + uint32 unknown_3; /* '%04X' - SoD field 9 / Server field 11 */ + uint8 unknown_4; /* '%1X' - SoD field 10 / Server field 12 */ + uint32 ornament_icon; /* '%05X' - SoD field 11 / Server field 13 */ + int hash; /* '%08X' - SoD field 12 / Server field 14 */ +}; }; //end namespace structs }; //end namespace SoD diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index fc46c53cb..cd5a1ef71 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -31,6 +31,18 @@ namespace SoF static inline uint32 SoFToServerSlot(uint32 SoFSlot); static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse); + // server to client text link converters + static inline void ServerToSoFTextLinks(std::string& sofTextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToSoFTextLinkBodyStruct(structs::TextLinkBody_Struct& sofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateSoFTextLinkBody(std::string& sofLinkBody, const structs::TextLinkBody_Struct& sofLinkBodyStruct); + + // client to server text link converters + static inline void SoFToServerTextLinks(std::string& serverTextLink, const std::string& sofTextLink); + static inline bool DegenerateSoFTextLinkBody(structs::TextLinkBody_Struct& sofLinkBodyStruct, const std::string& sofLinkBody); + static inline void SoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sofLinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -278,6 +290,35 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_ChannelMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoFTextLinks(new_message, old_message); + + in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, __emu_buffer, sizeof(ChannelMessage_Struct)); + + OutBuffer += sizeof(ChannelMessage_Struct); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_CharInventory) { //consume the packet @@ -1609,6 +1650,44 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToSoFTextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Stun) { ENCODE_LENGTH_EXACT(Stun_Struct); @@ -2129,6 +2208,25 @@ namespace SoF FINISH_DIRECT_DECODE(); } + DECODE(OP_ChannelMessage) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; + std::string new_message; + SoFToServerTextLinks(new_message, old_message); + + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; + + memcpy(emu, __eq_buffer, sizeof(ChannelMessage_Struct)); + strcpy(emu->message, new_message.c_str()); + + delete[] __eq_buffer; + } + DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); @@ -3005,5 +3103,362 @@ namespace SoF //uint32 ServerCorpse; return (SoFCorpse - 1); } + + static inline void ServerToSoFTextLinks(std::string& sofTextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->SoF): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): link size equal, no conversion necessary"); + sofTextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): delimiter not found, no conversion necessary"); + sofTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToSoFTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateSoFTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): conversion error"); + sofTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + sofTextLink.push_back(delimiter); + sofTextLink.append(segments[iter].c_str()); + sofTextLink.push_back(delimiter); + } + else { + sofTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->SoF): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->SoF): new message '%s'", sofTextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + sofTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToSoFTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateSoFTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->SoF): conversion error"); + sofTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + sofTextLink.push_back(delimiter); + sofTextLink.append(segments[iter].c_str()); + sofTextLink.push_back(delimiter); + } + else { + sofTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToSoFTextLinkBodyStruct(structs::TextLinkBody_Struct& sofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + sofLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + sofLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + sofLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + sofLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + sofLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + sofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + sofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + sofLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; + sofLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; + sofLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + sofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; + sofLinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateSoFTextLinkBody(std::string& sofLinkBody, const structs::TextLinkBody_Struct& sofLinkBodyStruct) + { + sofLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", + sofLinkBodyStruct.unknown_1, + sofLinkBodyStruct.item_id, + sofLinkBodyStruct.augment_1, + sofLinkBodyStruct.augment_2, + sofLinkBodyStruct.augment_3, + sofLinkBodyStruct.augment_4, + sofLinkBodyStruct.augment_5, + sofLinkBodyStruct.unknown_2, + sofLinkBodyStruct.unknown_3, + sofLinkBodyStruct.unknown_4, + sofLinkBodyStruct.ornament_icon, + sofLinkBodyStruct.hash + ); + + if (sofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void SoFToServerTextLinks(std::string& serverTextLink, const std::string& sofTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(SoF->Server): old message '%s'", sofTextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): link size equal, no conversion necessary"); + serverTextLink = sofTextLink; + return; + } + + if (sofTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): delimiter not found, no conversion necessary"); + serverTextLink = sofTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(sofTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateSoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + SoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): conversion error"); + serverTextLink = sofTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(SoF->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(SoF->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sofTextLink.find(delimiter) == std::string::npos)) { + serverTextLink = sofTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(sofTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateSoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + SoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(SoF->Server): conversion error"); + serverTextLink = sofTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateSoFTextLinkBody(structs::TextLinkBody_Struct& sofLinkBodyStruct, const std::string& sofLinkBody) + { + // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + memset(&sofLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (sofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + sofLinkBodyStruct.unknown_1 = (uint8)strtol(sofLinkBody.substr(0, 1).c_str(), nullptr, 16); + sofLinkBodyStruct.item_id = (uint32)strtol(sofLinkBody.substr(1, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.augment_1 = (uint32)strtol(sofLinkBody.substr(6, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.augment_2 = (uint32)strtol(sofLinkBody.substr(11, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.augment_3 = (uint32)strtol(sofLinkBody.substr(16, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.augment_4 = (uint32)strtol(sofLinkBody.substr(21, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.augment_5 = (uint32)strtol(sofLinkBody.substr(26, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.unknown_2 = (uint8)strtol(sofLinkBody.substr(31, 1).c_str(), nullptr, 16); + sofLinkBodyStruct.unknown_3 = (uint32)strtol(sofLinkBody.substr(32, 4).c_str(), nullptr, 16); + sofLinkBodyStruct.unknown_4 = (uint8)strtol(sofLinkBody.substr(36, 1).c_str(), nullptr, 16); + sofLinkBodyStruct.ornament_icon = (uint32)strtol(sofLinkBody.substr(37, 5).c_str(), nullptr, 16); + sofLinkBodyStruct.hash = (int)strtol(sofLinkBody.substr(42, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void SoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sofLinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = sofLinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = sofLinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = sofLinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = sofLinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = sofLinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = sofLinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = sofLinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = NOT_USED; + serverLinkBodyStruct.unknown_2 = NOT_USED; + serverLinkBodyStruct.unknown_3 = sofLinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_4 = sofLinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_5 = sofLinkBodyStruct.unknown_4; + serverLinkBodyStruct.ornament_icon = sofLinkBodyStruct.ornament_icon; + serverLinkBodyStruct.hash = sofLinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace SoF diff --git a/common/patches/sof_constants.h b/common/patches/sof_constants.h index 0b959ef3a..5e0f4b18a 100644 --- a/common/patches/sof_constants.h +++ b/common/patches/sof_constants.h @@ -177,6 +177,8 @@ namespace SoF { 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 TEXT_LINK_BODY_LENGTH = 50; } namespace limits { diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index 132e3dc77..88d468c82 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -8,6 +8,7 @@ E(OP_BazaarSearch) E(OP_BecomeTrader) E(OP_Buff) E(OP_CancelTrade) +E(OP_ChannelMessage) E(OP_CharInventory) E(OP_ClientUpdate) E(OP_Consider) @@ -50,6 +51,7 @@ E(OP_SendZonepoints) E(OP_ShopPlayerSell) E(OP_SomeItemPacketMaybe) E(OP_SpawnDoor) +E(OP_SpecialMesg) E(OP_Stun) E(OP_Track) E(OP_Trader) @@ -70,6 +72,7 @@ D(OP_AugmentInfo) D(OP_AugmentItem) D(OP_Buff) D(OP_CastSpell) +D(OP_ChannelMessage) D(OP_CharacterCreate) D(OP_ClientUpdate) D(OP_Consider) diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 51f41a590..5986e0029 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -4115,18 +4115,24 @@ struct AltCurrencySellItem_Struct { /*010*/ uint32 cost; }; +// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - SoF field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - SoF field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - SoF field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - SoF field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - SoF field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - SoF field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - SoF field 7 / Server field 7 */ + uint8 unknown_2; /* '%1X' - SoF field 8 / Server field 10 */ + uint32 unknown_3; /* '%04X' - SoF field 9 / Server field 11 */ + uint8 unknown_4; /* '%1X' - SoF field 10 / Server field 12 */ + uint32 ornament_icon; /* '%05X' - SoF field 11 / Server field 13 */ + int hash; /* '%08X' - SoF field 12 / Server field 14 */ +}; }; //end namespace structs }; //end namespace SoF #endif /*SoF_STRUCTS_H_*/ - - - - - - - - - - diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index f9ad6a4ff..fb7faa4f9 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -7,6 +7,7 @@ #include "../races.h" #include "../eq_packet_structs.h" +#include "../misc_functions.h" #include "../string_util.h" #include "../item.h" #include "titanium_structs.h" @@ -28,6 +29,18 @@ namespace Titanium static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot); static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse); + // server to client text link converters + static inline void ServerToTitaniumTextLinks(std::string& titaniumTextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToTitaniumTextLinkBodyStruct(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateTitaniumTextLinkBody(std::string& titaniumLinkBody, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct); + + // client to server text link converters + static inline void TitaniumToServerTextLinks(std::string& serverTextLink, const std::string& titaniumTextLink); + static inline bool DegenerateTitaniumTextLinkBody(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const std::string& titaniumLinkBody); + static inline void TitaniumToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -220,6 +233,35 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_ChannelMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToTitaniumTextLinks(new_message, old_message); + + in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, __emu_buffer, sizeof(ChannelMessage_Struct)); + + OutBuffer += sizeof(ChannelMessage_Struct); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_CharInventory) { //consume the packet @@ -1070,6 +1112,44 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToTitaniumTextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; @@ -1371,6 +1451,25 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_ChannelMessage) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; + std::string new_message; + TitaniumToServerTextLinks(new_message, old_message); + + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; + + ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; + + memcpy(emu, __eq_buffer, sizeof(ChannelMessage_Struct)); + strcpy(emu->message, new_message.c_str()); + + delete[] __eq_buffer; + } + DECODE(OP_CharacterCreate) { DECODE_LENGTH_EXACT(structs::CharCreate_Struct); @@ -1763,5 +1862,359 @@ namespace Titanium //uint32 ServerCorpse; return TitaniumCorpse; } + + static inline void ServerToTitaniumTextLinks(std::string& titaniumTextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): link size equal, no conversion necessary"); + titaniumTextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): delimiter not found, no conversion necessary"); + titaniumTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToTitaniumTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateTitaniumTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): conversion error"); + titaniumTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + titaniumTextLink.push_back(delimiter); + titaniumTextLink.append(segments[iter].c_str()); + titaniumTextLink.push_back(delimiter); + } + else { + titaniumTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): new message '%s'", titaniumTextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + titaniumTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToTitaniumTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateTitaniumTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->Titanium): conversion error"); + titaniumTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + titaniumTextLink.push_back(delimiter); + titaniumTextLink.append(segments[iter].c_str()); + titaniumTextLink.push_back(delimiter); + } + else { + titaniumTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToTitaniumTextLinkBodyStruct(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + titaniumLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + titaniumLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + titaniumLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + titaniumLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + titaniumLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + titaniumLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + titaniumLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + titaniumLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; + titaniumLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; + titaniumLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + titaniumLinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateTitaniumTextLinkBody(std::string& titaniumLinkBody, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct) + { + titaniumLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", + titaniumLinkBodyStruct.unknown_1, + titaniumLinkBodyStruct.item_id, + titaniumLinkBodyStruct.augment_1, + titaniumLinkBodyStruct.augment_2, + titaniumLinkBodyStruct.augment_3, + titaniumLinkBodyStruct.augment_4, + titaniumLinkBodyStruct.augment_5, + titaniumLinkBodyStruct.unknown_2, + titaniumLinkBodyStruct.unknown_3, + titaniumLinkBodyStruct.unknown_4, + titaniumLinkBodyStruct.hash + ); + + if (titaniumLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void TitaniumToServerTextLinks(std::string& serverTextLink, const std::string& titaniumTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): old message '%s'", titaniumTextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): link size equal, no conversion necessary"); + serverTextLink = titaniumTextLink; + return; + } + + if (titaniumTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): delimiter not found, no conversion necessary"); + serverTextLink = titaniumTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(titaniumTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateTitaniumTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + TitaniumToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): conversion error"); + serverTextLink = titaniumTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (titaniumTextLink.find(delimiter) == std::string::npos)) { + serverTextLink = titaniumTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(titaniumTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateTitaniumTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + TitaniumToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Titanium->Server): conversion error"); + serverTextLink = titaniumTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateTitaniumTextLinkBody(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const std::string& titaniumLinkBody) + { + // 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" + memset(&titaniumLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (titaniumLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + titaniumLinkBodyStruct.unknown_1 = (uint8)strtol(titaniumLinkBody.substr(0, 1).c_str(), nullptr, 16); + titaniumLinkBodyStruct.item_id = (uint32)strtol(titaniumLinkBody.substr(1, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.augment_1 = (uint32)strtol(titaniumLinkBody.substr(6, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.augment_2 = (uint32)strtol(titaniumLinkBody.substr(11, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.augment_3 = (uint32)strtol(titaniumLinkBody.substr(16, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.augment_4 = (uint32)strtol(titaniumLinkBody.substr(21, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.augment_5 = (uint32)strtol(titaniumLinkBody.substr(26, 5).c_str(), nullptr, 16); + titaniumLinkBodyStruct.unknown_2 = (uint8)strtol(titaniumLinkBody.substr(31, 1).c_str(), nullptr, 16); + titaniumLinkBodyStruct.unknown_3 = (uint32)strtol(titaniumLinkBody.substr(32, 4).c_str(), nullptr, 16); + titaniumLinkBodyStruct.unknown_4 = (uint8)strtol(titaniumLinkBody.substr(36, 1).c_str(), nullptr, 16); + titaniumLinkBodyStruct.hash = (int)strtol(titaniumLinkBody.substr(37, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void TitaniumToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = titaniumLinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = titaniumLinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = titaniumLinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = titaniumLinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = titaniumLinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = titaniumLinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = titaniumLinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = NOT_USED; + serverLinkBodyStruct.unknown_2 = NOT_USED; + serverLinkBodyStruct.unknown_3 = titaniumLinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_4 = titaniumLinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_5 = titaniumLinkBodyStruct.unknown_4; + serverLinkBodyStruct.ornament_icon = NOT_USED; + serverLinkBodyStruct.hash = titaniumLinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace Titanium diff --git a/common/patches/titanium_constants.h b/common/patches/titanium_constants.h index 85e525fe8..ff44513c2 100644 --- a/common/patches/titanium_constants.h +++ b/common/patches/titanium_constants.h @@ -176,6 +176,8 @@ namespace Titanium { 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 TEXT_LINK_BODY_LENGTH = 45; } namespace limits { diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 338558602..a3d2e71af 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -4,6 +4,7 @@ E(OP_AdventureMerchantSell) E(OP_ApplyPoison) E(OP_BazaarSearch) E(OP_BecomeTrader) +E(OP_ChannelMessage) E(OP_CharInventory) E(OP_DeleteCharge) E(OP_DeleteItem) @@ -35,6 +36,7 @@ E(OP_RespondAA) E(OP_SendCharInfo) E(OP_SendAATable) E(OP_ShopPlayerSell) +E(OP_SpecialMesg) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) @@ -49,6 +51,7 @@ D(OP_AdventureMerchantSell) D(OP_ApplyPoison) D(OP_AugmentItem) D(OP_CastSpell) +D(OP_ChannelMessage) D(OP_CharacterCreate) D(OP_Consume) D(OP_DeleteItem) diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 0b5b1ec25..7fb2df5cd 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -3329,19 +3329,23 @@ struct LFGuild_GuildToggle_Struct /*616*/ }; +// 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - Titanium field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - Titanium field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - Titanium field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - Titanium field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - Titanium field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - Titanium field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - Titanium field 7 / Server field 7 */ + uint8 unknown_2; /* '%1X' - Titanium field 8 / Server field 10 */ + uint32 unknown_3; /* '%04X' - Titanium field 9 / Server field 11 */ + uint8 unknown_4; /* '%1X' - Titanium field 10 / Server field 12 */ + int hash; /* '%08X' - Titanium field 11 / Server field 14 */ +}; + }; //end namespace structs }; //end namespace Titanium - - #endif /*Titanium_STRUCTS_H_*/ - - - - - - - - - - diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 5ee38f586..e45dae148 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -31,6 +31,18 @@ namespace Underfoot static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot); static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse); + // server to client text link converters + static inline void ServerToUnderfootTextLinks(std::string& underfootTextLink, const std::string& serverTextLink); + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); + static inline void ServerToUnderfootTextLinkBodyStruct(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); + static inline bool GenerateUnderfootTextLinkBody(std::string& underfootLinkBody, const structs::TextLinkBody_Struct& underfootLinkBodyStruct); + + // client to server text link converters + static inline void UnderfootToServerTextLinks(std::string& serverTextLink, const std::string& underfootTextLink); + static inline bool DegenerateUnderfootTextLinkBody(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const std::string& underfootLinkBody); + static inline void UnderfootToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& underfootLinkBodyStruct); + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + void Register(EQStreamIdentifier &into) { //create our opcode manager if we havent already @@ -432,7 +444,12 @@ namespace Underfoot unsigned char *__emu_buffer = in->pBuffer; - in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + std::string old_message = emu->message; + std::string new_message; + ServerToUnderfootTextLinks(new_message, old_message); + + //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; + in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; in->pBuffer = new unsigned char[in->size]; @@ -446,7 +463,7 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->skill_in_language); - VARSTRUCT_ENCODE_STRING(OutBuffer, emu->message); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); // Unknown @@ -2298,6 +2315,44 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_SpecialMesg) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + SpecialMesg_Struct *emu = (SpecialMesg_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = &emu->message[strlen(emu->sayer)]; + std::string new_message; + ServerToUnderfootTextLinks(new_message, old_message); + + //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; + in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->header[2]); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->msg_type); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->target_spawn_id); + + VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Stun) { ENCODE_LENGTH_EXACT(Stun_Struct); @@ -3036,7 +3091,13 @@ namespace Underfoot uint32 Skill = VARSTRUCT_DECODE_TYPE(uint32, InBuffer); - __packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + std::string old_message = InBuffer; + std::string new_message; + UnderfootToServerTextLinks(new_message, old_message); + + //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; + __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; + __packet->pBuffer = new unsigned char[__packet->size]; ChannelMessage_Struct *emu = (ChannelMessage_Struct *)__packet->pBuffer; @@ -3045,7 +3106,7 @@ namespace Underfoot emu->language = Language; emu->chan_num = Channel; emu->skill_in_language = Skill; - strcpy(emu->message, InBuffer); + strcpy(emu->message, new_message.c_str()); delete[] __eq_buffer; } @@ -4155,5 +4216,362 @@ namespace Underfoot //uint32 ServerCorpse; return (UnderfootCorpse - 1); } + + static inline void ServerToUnderfootTextLinks(std::string& underfootTextLink, const std::string& serverTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): old message '%s'", serverTextLink.c_str()); + + if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): link size equal, no conversion necessary"); + underfootTextLink = serverTextLink; + return; + } + + if (serverTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): delimiter not found, no conversion necessary"); + underfootTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + } + + structs::TextLinkBody_Struct new_body_data; + ServerToUnderfootTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateUnderfootTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): conversion error"); + underfootTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + underfootTextLink.push_back(delimiter); + underfootTextLink.append(segments[iter].c_str()); + underfootTextLink.push_back(delimiter); + } + else { + underfootTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): new message '%s'", underfootTextLink.c_str()); +#else + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + underfootTextLink = serverTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(serverTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + TextLinkBody_Struct old_body_data; + if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + structs::TextLinkBody_Struct new_body_data; + ServerToUnderfootTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateUnderfootTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): conversion error"); + underfootTextLink = serverTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + underfootTextLink.push_back(delimiter); + underfootTextLink.append(segments[iter].c_str()); + underfootTextLink.push_back(delimiter); + } + else { + underfootTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) + { + memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); + serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void ServerToUnderfootTextLinkBodyStruct(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) + { + underfootLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; + underfootLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; + underfootLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; + underfootLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; + underfootLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; + underfootLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; + underfootLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; + underfootLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; + underfootLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; + underfootLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + underfootLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; + underfootLinkBodyStruct.hash = serverLinkBodyStruct.hash; + } + + static inline bool GenerateUnderfootTextLinkBody(std::string& underfootLinkBody, const structs::TextLinkBody_Struct& underfootLinkBodyStruct) + { + underfootLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", + underfootLinkBodyStruct.unknown_1, + underfootLinkBodyStruct.item_id, + underfootLinkBodyStruct.augment_1, + underfootLinkBodyStruct.augment_2, + underfootLinkBodyStruct.augment_3, + underfootLinkBodyStruct.augment_4, + underfootLinkBodyStruct.augment_5, + underfootLinkBodyStruct.unknown_2, + underfootLinkBodyStruct.unknown_3, + underfootLinkBodyStruct.unknown_4, + underfootLinkBodyStruct.ornament_icon, + underfootLinkBodyStruct.hash + ); + + if (underfootLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } + + static inline void UnderfootToServerTextLinks(std::string& serverTextLink, const std::string& underfootTextLink) + { + const char delimiter = 0x12; + +#if EQDEBUG >= 6 + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): old message '%s'", underfootTextLink.c_str()); + + if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): link size equal, no conversion necessary"); + serverTextLink = underfootTextLink; + return; + } + + if (underfootTextLink.find(delimiter) == std::string::npos) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): delimiter not found, no conversion necessary"); + serverTextLink = underfootTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(underfootTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateUnderfootTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); + } + + TextLinkBody_Struct new_body_data; + UnderfootToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body generation error '%s'", segment.c_str()); + conversion_error = true; + } + else { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body generation success '%s'", segment.c_str()); + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): conversion error"); + serverTextLink = underfootTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): segment[%u] '%s'", iter, segments[iter].c_str()); + } + + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): new message '%s'", serverTextLink.c_str()); +#else + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (underfootTextLink.find(delimiter) == std::string::npos)) { + serverTextLink = underfootTextLink; + return; + } + + bool conversion_error = false; + auto segments = SplitString(underfootTextLink, delimiter); + + for (size_t iter = 1; iter < segments.size(); iter += 2) { + structs::TextLinkBody_Struct old_body_data; + if (!DegenerateUnderfootTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { + conversion_error = true; + break; + } + + TextLinkBody_Struct new_body_data; + UnderfootToServerTextLinkBodyStruct(new_body_data, old_body_data); + + std::string segment; + if (!GenerateServerTextLinkBody(segment, new_body_data)) { + conversion_error = true; + break; + } + else { + segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); + segments[iter] = segment.c_str(); + } + } + + if (conversion_error) { + _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): conversion error"); + serverTextLink = underfootTextLink; + return; + } + + for (size_t iter = 0; iter < segments.size(); ++iter) { + if (iter & 1) { + serverTextLink.push_back(delimiter); + serverTextLink.append(segments[iter].c_str()); + serverTextLink.push_back(delimiter); + } + else { + serverTextLink.append(segments[iter].c_str()); + } + } +#endif + } + + static inline bool DegenerateUnderfootTextLinkBody(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const std::string& underfootLinkBody) + { + // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" + memset(&underfootLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); + if (underfootLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } + + underfootLinkBodyStruct.unknown_1 = (uint8)strtol(underfootLinkBody.substr(0, 1).c_str(), nullptr, 16); + underfootLinkBodyStruct.item_id = (uint32)strtol(underfootLinkBody.substr(1, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.augment_1 = (uint32)strtol(underfootLinkBody.substr(6, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.augment_2 = (uint32)strtol(underfootLinkBody.substr(11, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.augment_3 = (uint32)strtol(underfootLinkBody.substr(16, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.augment_4 = (uint32)strtol(underfootLinkBody.substr(21, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.augment_5 = (uint32)strtol(underfootLinkBody.substr(26, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.unknown_2 = (uint8)strtol(underfootLinkBody.substr(31, 1).c_str(), nullptr, 16); + underfootLinkBodyStruct.unknown_3 = (uint32)strtol(underfootLinkBody.substr(32, 4).c_str(), nullptr, 16); + underfootLinkBodyStruct.unknown_4 = (uint8)strtol(underfootLinkBody.substr(36, 1).c_str(), nullptr, 16); + underfootLinkBodyStruct.ornament_icon = (uint32)strtol(underfootLinkBody.substr(37, 5).c_str(), nullptr, 16); + underfootLinkBodyStruct.hash = (int)strtol(underfootLinkBody.substr(42, 8).c_str(), nullptr, 16); + + return true; + } + + static inline void UnderfootToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& underfootLinkBodyStruct) + { + serverLinkBodyStruct.unknown_1 = underfootLinkBodyStruct.unknown_1; + serverLinkBodyStruct.item_id = underfootLinkBodyStruct.item_id; + serverLinkBodyStruct.augment_1 = underfootLinkBodyStruct.augment_1; + serverLinkBodyStruct.augment_2 = underfootLinkBodyStruct.augment_2; + serverLinkBodyStruct.augment_3 = underfootLinkBodyStruct.augment_3; + serverLinkBodyStruct.augment_4 = underfootLinkBodyStruct.augment_4; + serverLinkBodyStruct.augment_5 = underfootLinkBodyStruct.augment_5; + serverLinkBodyStruct.augment_6 = NOT_USED; + serverLinkBodyStruct.unknown_2 = NOT_USED; + serverLinkBodyStruct.unknown_3 = underfootLinkBodyStruct.unknown_2; + serverLinkBodyStruct.unknown_4 = underfootLinkBodyStruct.unknown_3; + serverLinkBodyStruct.unknown_5 = underfootLinkBodyStruct.unknown_4; + serverLinkBodyStruct.ornament_icon = underfootLinkBodyStruct.ornament_icon; + serverLinkBodyStruct.hash = underfootLinkBodyStruct.hash; + } + + static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) + { + serverLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + serverLinkBodyStruct.unknown_1, + serverLinkBodyStruct.item_id, + serverLinkBodyStruct.augment_1, + serverLinkBodyStruct.augment_2, + serverLinkBodyStruct.augment_3, + serverLinkBodyStruct.augment_4, + serverLinkBodyStruct.augment_5, + serverLinkBodyStruct.augment_6, + serverLinkBodyStruct.unknown_2, + serverLinkBodyStruct.unknown_3, + serverLinkBodyStruct.unknown_4, + serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.ornament_icon, + serverLinkBodyStruct.hash + ); + + if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; + } } // end namespace Underfoot diff --git a/common/patches/underfoot_constants.h b/common/patches/underfoot_constants.h index b89a4f255..a656c56eb 100644 --- a/common/patches/underfoot_constants.h +++ b/common/patches/underfoot_constants.h @@ -177,6 +177,8 @@ namespace Underfoot { 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 TEXT_LINK_BODY_LENGTH = 50; } namespace limits { diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index cfb4d4fe9..61f4f1c0f 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -65,6 +65,7 @@ E(OP_ShopPlayerSell) E(OP_SomeItemPacketMaybe) E(OP_SpawnAppearance) E(OP_SpawnDoor) +E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) E(OP_Track) diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 3a63a8c0f..9180a762b 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4530,6 +4530,23 @@ struct MercenaryAssign_Struct { /*0012*/ }; +// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" +struct TextLinkBody_Struct +{ + uint8 unknown_1; /* '%1X' - Underfoot field 1 / Server field 1 */ + uint32 item_id; /* '%05X' - Underfoot field 2 / Server field 2 */ + uint32 augment_1; /* '%05X' - Underfoot field 3 / Server field 3 */ + uint32 augment_2; /* '%05X' - Underfoot field 4 / Server field 4 */ + uint32 augment_3; /* '%05X' - Underfoot field 5 / Server field 5 */ + uint32 augment_4; /* '%05X' - Underfoot field 6 / Server field 6 */ + uint32 augment_5; /* '%05X' - Underfoot field 7 / Server field 7 */ + uint8 unknown_2; /* '%1X' - Underfoot field 8 / Server field 10 */ + uint32 unknown_3; /* '%04X' - Underfoot field 9 / Server field 11 */ + uint8 unknown_4; /* '%1X' - Underfoot field 10 / Server field 12 */ + uint32 ornament_icon; /* '%05X' - Underfoot field 11 / Server field 13 */ + int hash; /* '%08X' - Underfoot field 12 / Server field 14 */ +}; + }; //end namespace structs }; //end namespace Underfoot diff --git a/zone/bot.cpp b/zone/bot.cpp index d41b6db11..bd7c9f946 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -11707,7 +11707,6 @@ void Bot::ProcessBotCommands(Client *c, const Seperator *sep) { std::string item_link; Client::TextLink linker; linker.SetLinkType(linker.linkItemInst); - linker.SetClientVersion(c->GetClientVersion()); for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) { if((i == MainSecondary) && is2Hweapon) { diff --git a/zone/client.cpp b/zone/client.cpp index 0ad34d752..54324932d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8271,71 +8271,27 @@ std::string Client::TextLink::GenerateLink() generate_body(); generate_text(); - if (m_LinkBody.length() && m_LinkText.length()) { - m_Link.append(StringFormat("%c", 0x12)); + if ((m_LinkBody.length() == EmuConstants::TEXT_LINK_BODY_LENGTH) && (m_LinkText.length() > 0)) { + m_Link.push_back(0x12); m_Link.append(m_LinkBody); m_Link.append(m_LinkText); - m_Link.append(StringFormat("%c", 0x12)); + m_Link.push_back(0x12); } if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - _log(CHANNELS__ERROR, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {l: %u, b: %u, t: %u})", + _log(CHANNELS__ERROR, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); +#if EQDEBUG >= 5 + _log(CHANNELS__ERROR, ">> LinkBody: %s", m_LinkBody.c_str()); + _log(CHANNELS__ERROR, ">> LinkText: %s", m_LinkText.c_str()); +#endif } return m_Link; } -const char* Client::TextLink::GetLink() -{ - if (m_Link.length() == 0) - return nullptr; - - return m_Link.c_str(); -} - -const char* Client::TextLink::GetLinkBody() -{ - if (m_LinkBody.length() == 0) - return nullptr; - - return m_LinkBody.c_str(); -} - -const char* Client::TextLink::GetLinkText() -{ - if (m_LinkText.length() == 0) - return nullptr; - - return m_LinkText.c_str(); -} - -std::string Client::TextLink::GetLinkString() -{ - if (m_Link.length() == 0) - return ""; - - return m_Link; -} - -std::string Client::TextLink::GetLinkBodyString() -{ - if (m_LinkBody.length() == 0) - return ""; - - return m_LinkBody; -} - -std::string Client::TextLink::GetLinkTextString() -{ - if (m_LinkText.length() == 0) - return ""; - - return m_LinkText; -} - void Client::TextLink::Reset() { m_LinkType = linkBlank; @@ -8348,81 +8304,72 @@ void Client::TextLink::Reset() m_Link.clear(); m_LinkBody.clear(); m_LinkText.clear(); - m_ClientVersion = EQClientUnknown; m_Error = false; } void Client::TextLink::generate_body() { - enum { field_0 = 0, field_1, field_2, field_3, field_4, field_5, field_6, field_7, field_8, field_9, field_10, field_11, field_12, field_13 }; - static const int field_count = 14; - static const bool field_use[_EQClientCount][field_count] = { - // 6.2: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" - // SoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - // RoF: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - // RoF2: MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" + /* + Current server mask: EQClientRoF2 + + RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" (56) + RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) + SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) + 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45) + */ -//(RoF2) %01x %05x %05x %05x %05x %05x %05x %05x %01x %01x %04x %01x %05x %08x - { true, true, true, true, true, true, true, true, true, true, true, true, true, true }, // EQClientUnknown - { true, true, true, true, true, true, true, false, false, true, true, true, false, true }, // EQClient6.2 - { true, true, true, true, true, true, true, false, false, true, true, true, false, true }, // EQClientTitanium - { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientSoF - { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientSoD - { true, true, true, true, true, true, true, false, false, true, true, true, true, true }, // EQClientUnderfoot - { true, true, true, true, true, true, true, true, false, true, true, true, true, true }, // EQClientRoF - { true, true, true, true, true, true, true, true, true, true, true, true, true, true } // EQClientRoF2 - }; - -/*%01X*/ uint8 unknown_0 = NOT_USED; -/*%05X*/ uint32 item_id = NOT_USED; -/*%05X*/ uint32 augment_0 = NOT_USED; -/*%05X*/ uint32 augment_1 = NOT_USED; -/*%05X*/ uint32 augment_2 = NOT_USED; -/*%05X*/ uint32 augment_3 = NOT_USED; -/*%05X*/ uint32 augment_4 = NOT_USED; -/*%05X*/ uint32 augment_5 = NOT_USED; -/*%01X*/ uint8 unknown_8 = NOT_USED; -/*%01X*/ uint8 unknown_9 = NOT_USED; -/*%04X*/ uint32 unknown_10 = NOT_USED; -/*%01X*/ uint8 unknown_11 = NOT_USED; -/*%05X*/ uint32 unknown_12 = NOT_USED; -/*%08X*/ int hash = NOT_USED; + // could use a ##_cast(&this) with a memset to '0' since these properties are inherited + + unknown_1 = NOT_USED; /* field 1 */ + item_id = NOT_USED; /* field 2 */ + augment_1 = NOT_USED; /* field 3 */ + augment_2 = NOT_USED; /* field 4 */ + augment_3 = NOT_USED; /* field 5 */ + augment_4 = NOT_USED; /* field 6 */ + augment_5 = NOT_USED; /* field 7 */ + augment_6 = NOT_USED; /* field 8 */ + unknown_2 = NOT_USED; /* field 9 */ + unknown_3 = NOT_USED; /* field 10 */ + unknown_4 = NOT_USED; /* field 11 */ + unknown_5 = NOT_USED; /* field 12 */ + ornament_icon = NOT_USED; /* field 13 */ + hash = NOT_USED; /* field 14 */ + const Item_Struct* item_data = nullptr; + switch (m_LinkType) { case linkBlank: break; case linkItemData: - if (m_ItemData != nullptr) { - item_id = m_ItemData->ID; - // TODO: add hash call - } + if (m_ItemData == nullptr) { break; } + item_id = m_ItemData->ID; + // TODO: add hash call break; case linkLootItem: - if (m_LootData != nullptr) { - const Item_Struct* item_data = database.GetItem(m_LootData->item_id); - if (item_data == nullptr) { break; } - item_id = item_data->ID; - augment_0 = m_LootData->aug_1; - augment_1 = m_LootData->aug_2; - augment_2 = m_LootData->aug_3; - augment_3 = m_LootData->aug_4; - augment_4 = m_LootData->aug_5; - augment_5 = m_LootData->aug_6; - // TODO: add hash call - } + if (m_LootData == nullptr) { break; } + item_data = database.GetItem(m_LootData->item_id); + if (item_data == nullptr) { break; } + item_id = item_data->ID; + augment_1 = m_LootData->aug_1; + augment_2 = m_LootData->aug_2; + augment_3 = m_LootData->aug_3; + augment_4 = m_LootData->aug_4; + augment_5 = m_LootData->aug_5; + augment_6 = m_LootData->aug_6; + // TODO: add hash call break; case linkItemInst: - if (m_ItemInst != nullptr) { - if (m_ItemInst->GetItem() == nullptr) { break; } - item_id = m_ItemInst->GetItem()->ID; - augment_0 = m_ItemInst->GetAugmentItemID(0); - augment_1 = m_ItemInst->GetAugmentItemID(1); - augment_2 = m_ItemInst->GetAugmentItemID(2); - augment_3 = m_ItemInst->GetAugmentItemID(3); - augment_4 = m_ItemInst->GetAugmentItemID(4); - augment_5 = m_ItemInst->GetAugmentItemID(5); - // TODO: add hash call - } + if (m_ItemInst == nullptr) { break; } + if (m_ItemInst->GetItem() == nullptr) { break; } + item_id = m_ItemInst->GetItem()->ID; + augment_1 = m_ItemInst->GetAugmentItemID(0); + augment_2 = m_ItemInst->GetAugmentItemID(1); + augment_3 = m_ItemInst->GetAugmentItemID(2); + augment_4 = m_ItemInst->GetAugmentItemID(3); + augment_5 = m_ItemInst->GetAugmentItemID(4); + augment_6 = m_ItemInst->GetAugmentItemID(5); + ornament_icon = m_ItemInst->GetOrnamentationIcon(); + // TODO: add hash call break; default: break; @@ -8433,23 +8380,27 @@ void Client::TextLink::generate_body() } if (m_TaskUse) { - hash = 0x0000000014505DC2; + //hash = 0x0000000014505DC2; + hash = 0x14505DC2; } - if (field_use[m_ClientVersion][field_0]) { m_LinkBody.append(StringFormat("%01x", unknown_0)); } - if (field_use[m_ClientVersion][field_1]) { m_LinkBody.append(StringFormat("%05x", item_id)); } - if (field_use[m_ClientVersion][field_2]) { m_LinkBody.append(StringFormat("%05x", augment_0)); } - if (field_use[m_ClientVersion][field_3]) { m_LinkBody.append(StringFormat("%05x", augment_1)); } - if (field_use[m_ClientVersion][field_4]) { m_LinkBody.append(StringFormat("%05x", augment_2)); } - if (field_use[m_ClientVersion][field_5]) { m_LinkBody.append(StringFormat("%05x", augment_3)); } - if (field_use[m_ClientVersion][field_6]) { m_LinkBody.append(StringFormat("%05x", augment_4)); } - if (field_use[m_ClientVersion][field_7]) { m_LinkBody.append(StringFormat("%05x", augment_5)); } - if (field_use[m_ClientVersion][field_8]) { m_LinkBody.append(StringFormat("%01x", unknown_8)); } - if (field_use[m_ClientVersion][field_9]) { m_LinkBody.append(StringFormat("%01x", unknown_9)); } - if (field_use[m_ClientVersion][field_10]) { m_LinkBody.append(StringFormat("%04x", unknown_10)); } - if (field_use[m_ClientVersion][field_11]) { m_LinkBody.append(StringFormat("%01x", unknown_11)); } - if (field_use[m_ClientVersion][field_12]) { m_LinkBody.append(StringFormat("%05x", unknown_12)); } - if (field_use[m_ClientVersion][field_13]) { m_LinkBody.append(StringFormat("%08x", hash)); } + m_LinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + unknown_1, + item_id, + augment_1, + augment_2, + augment_3, + augment_4, + augment_5, + augment_6, + unknown_2, + unknown_3, + unknown_4, + unknown_5, + ornament_icon, + hash + ); } void Client::TextLink::generate_text() @@ -8459,35 +8410,76 @@ void Client::TextLink::generate_text() return; } + const Item_Struct* item_data = nullptr; + switch (m_LinkType) { case linkBlank: break; case linkItemData: - if (m_ItemData != nullptr) { - m_LinkText = m_ItemData->Name; - return; - } - break; + if (m_ItemData == nullptr) { break; } + m_LinkText = m_ItemData->Name; + return; case linkLootItem: - if (m_LootData != nullptr) { - const Item_Struct* item_data = database.GetItem(m_LootData->item_id); - if (item_data != nullptr) { - m_LinkText = item_data->Name; - return; - } - } - break; + if (m_LootData == nullptr) { break; } + item_data = database.GetItem(m_LootData->item_id); + if (item_data == nullptr) { break; } + m_LinkText = item_data->Name; + return; case linkItemInst: - if (m_ItemInst != nullptr) { - if (m_ItemInst->GetItem() != nullptr) { - m_LinkText = m_ItemInst->GetItem()->Name; - return; - } - } - break; + if (m_ItemInst == nullptr) { break; } + if (m_ItemInst->GetItem() == nullptr) { break; } + m_LinkText = m_ItemInst->GetItem()->Name; + return; default: break; } m_LinkText = "null"; } + +bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruct, const std::string& textLinkBody) +{ + memset(&textLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); + if (textLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + + textLinkBodyStruct.unknown_1 = (uint8)strtol(textLinkBody.substr(0, 1).c_str(), nullptr, 16); + textLinkBodyStruct.item_id = (uint32)strtol(textLinkBody.substr(1, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_1 = (uint32)strtol(textLinkBody.substr(6, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_2 = (uint32)strtol(textLinkBody.substr(11, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_3 = (uint32)strtol(textLinkBody.substr(16, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_4 = (uint32)strtol(textLinkBody.substr(21, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_5 = (uint32)strtol(textLinkBody.substr(26, 5).c_str(), nullptr, 16); + textLinkBodyStruct.augment_6 = (uint32)strtol(textLinkBody.substr(31, 5).c_str(), nullptr, 16); + textLinkBodyStruct.unknown_2 = (uint8)strtol(textLinkBody.substr(36, 1).c_str(), nullptr, 16); + textLinkBodyStruct.unknown_3 = (uint8)strtol(textLinkBody.substr(37, 1).c_str(), nullptr, 16); + textLinkBodyStruct.unknown_4 = (uint32)strtol(textLinkBody.substr(38, 4).c_str(), nullptr, 16); + textLinkBodyStruct.unknown_5 = (uint8)strtol(textLinkBody.substr(42, 1).c_str(), nullptr, 16); + textLinkBodyStruct.ornament_icon = (uint32)strtol(textLinkBody.substr(43, 5).c_str(), nullptr, 16); + textLinkBodyStruct.hash = (int)strtol(textLinkBody.substr(48, 8).c_str(), nullptr, 16); + + return true; +} + +bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct) +{ + textLinkBody = StringFormat( + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + textLinkBodyStruct.unknown_1, + textLinkBodyStruct.item_id, + textLinkBodyStruct.augment_1, + textLinkBodyStruct.augment_2, + textLinkBodyStruct.augment_3, + textLinkBodyStruct.augment_4, + textLinkBodyStruct.augment_5, + textLinkBodyStruct.augment_6, + textLinkBodyStruct.unknown_2, + textLinkBodyStruct.unknown_3, + textLinkBodyStruct.unknown_4, + textLinkBodyStruct.unknown_5, + textLinkBodyStruct.ornament_icon, + textLinkBodyStruct.hash + ); + + if (textLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } + return true; +} diff --git a/zone/client.h b/zone/client.h index b7bb8f6a5..d6ef83523 100644 --- a/zone/client.h +++ b/zone/client.h @@ -819,7 +819,7 @@ public: // // class Client::TextLink // - class TextLink { + class TextLink : TextLinkBody_Struct { public: enum LinkType { linkBlank = 0, linkItemData, linkLootItem, linkItemInst }; @@ -832,20 +832,19 @@ public: void SetProxyItemID(uint32 proxyItemID) { m_ProxyItemID = proxyItemID; } // mainly for saylinks..but, not limited to void SetProxyText(const char* proxyText) { m_ProxyText = proxyText; } // overrides standard text use void SetTaskUse() { m_TaskUse = true; } - void SetClientVersion(EQClientVersion clientVersion) { m_ClientVersion = EQLimits::ValidateClientVersion(clientVersion); } std::string GenerateLink(); bool LinkError() { return m_Error; } - const char* GetLink(); // contains full format: '/12x' '' '' '/12x' - const char* GetLinkBody(); // contains format: '' - const char* GetLinkText(); // contains format: '' - std::string GetLinkString(); - std::string GetLinkBodyString(); - std::string GetLinkTextString(); + std::string GetLink() { return m_Link; } // contains full string format: '/12x' '' '' '/12x' + std::string GetLinkBody() { return m_LinkBody; } // contains string format: '' + std::string GetLinkText() { return m_LinkText; } // contains string format: '' void Reset(); + static bool DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruct, const std::string& textLinkBody); + static bool GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct); + private: void generate_body(); void generate_text(); @@ -860,7 +859,6 @@ public: std::string m_Link; std::string m_LinkBody; std::string m_LinkText; - EQClientVersion m_ClientVersion; bool m_Error; }; diff --git a/zone/command.cpp b/zone/command.cpp index d31ea97b7..b33a3ee6d 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2621,7 +2621,6 @@ void command_peekinv(Client *c, const Seperator *sep) std::string item_link; Client::TextLink linker; linker.SetLinkType(linker.linkItemInst); - linker.SetClientVersion(c->GetClientVersion()); c->Message(0, "Displaying inventory for %s...", targetClient->GetName()); @@ -5574,7 +5573,6 @@ void command_itemsearch(Client *c, const Seperator *sep) std::string item_link; Client::TextLink linker; linker.SetLinkType(linker.linkItemData); - linker.SetClientVersion(c->GetClientVersion()); if (Seperator::IsNumber(search_criteria)) { item = database.GetItem(atoi(search_criteria)); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 380697eac..d5db03856 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1258,23 +1258,16 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { SetPlayerKillItemID(0); } - /* Send message with item link to groups and such */ - Client::TextLink linker; - linker.SetLinkType(linker.linkItemInst); - linker.SetItemInst(inst); - linker.SetClientVersion(client->GetClientVersion()); + /* Send message with item link to groups and such */ + Client::TextLink linker; + linker.SetLinkType(linker.linkItemInst); + linker.SetItemInst(inst); auto item_link = linker.GenerateLink(); client->Message_StringID(MT_LootMessages, LOOTED_MESSAGE, item_link.c_str()); - if(!IsPlayerCorpse()) { - // When sending to multiple/unknown client types, we set for the highest client.. - // ..which is processed when 'EQClientUnknown,' or default value, is selected. - // This should help with any current issues..or it may create more! O.o - linker.SetClientVersion(EQClientUnknown); - item_link = linker.GenerateLink(); - + if (!IsPlayerCorpse()) { Group *g = client->GetGroup(); if(g != nullptr) { g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str()); diff --git a/zone/npc.cpp b/zone/npc.cpp index a478e3b51..d6cf9ed9f 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -515,7 +515,6 @@ void NPC::QueryLoot(Client* to) Client::TextLink linker; linker.SetLinkType(linker.linkItemData); linker.SetItemData(item); - linker.SetClientVersion(to->GetClientVersion()); auto item_link = linker.GenerateLink(); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 3fb714d7e..53eed6787 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1234,7 +1234,6 @@ void QuestManager::itemlink(int item_id) { Client::TextLink linker; linker.SetLinkType(linker.linkItemData); linker.SetItemData(item); - linker.SetClientVersion(initiator->GetClientVersion()); auto item_link = linker.GenerateLink(); @@ -2474,8 +2473,6 @@ const char* QuestManager::varlink(char* perltext, int item_id) { Client::TextLink linker; linker.SetLinkType(linker.linkItemData); linker.SetItemData(item); - if (initiator) - linker.SetClientVersion(initiator->GetClientVersion()); auto item_link = linker.GenerateLink(); strcpy(perltext, item_link.c_str()); // link length is currently ranged from 1 to 250 in TextLink::GenerateLink() @@ -2668,8 +2665,6 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam Client::TextLink linker; linker.SetProxyItemID(sayid); linker.SetProxyText(LinkName); - if (initiator) - linker.SetClientVersion(initiator->GetClientVersion()); auto say_link = linker.GenerateLink(); strcpy(Phrase, say_link.c_str()); // link length is currently ranged from 1 to 250 in TextLink::GenerateLink() diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 79efb1115..1f6e381fd 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2779,7 +2779,6 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN Client::TextLink linker; linker.SetLinkType(linker.linkItemData); linker.SetItemData(reward_item); - linker.SetClientVersion(c->GetClientVersion()); linker.SetTaskUse(); if (strlen(Tasks[TaskID]->Reward) != 0) linker.SetProxyText(Tasks[TaskID]->Reward); From 668823eaf20fa5533d9226f57368b2254e98e22e Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 5 Jan 2015 23:11:38 -0500 Subject: [PATCH 0743/1883] Fix for text link issues with items whose loregroup is '-1' --- common/eq_packet_structs.h | 27 ++++++++--------- common/patches/rof.cpp | 41 ++++++++++++------------- common/patches/rof2.cpp | 48 +++++++++++++----------------- common/patches/rof2_structs.h | 29 +++++++++--------- common/patches/rof_structs.h | 26 ++++++++-------- common/patches/sod.cpp | 41 ++++++++++++------------- common/patches/sod_structs.h | 24 +++++++-------- common/patches/sof.cpp | 41 ++++++++++++------------- common/patches/sof_structs.h | 24 +++++++-------- common/patches/titanium.cpp | 41 ++++++++++++------------- common/patches/titanium_structs.h | 22 +++++++------- common/patches/underfoot.cpp | 41 ++++++++++++------------- common/patches/underfoot_structs.h | 24 +++++++-------- zone/client.cpp | 44 +++++++++++++-------------- 14 files changed, 223 insertions(+), 250 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 32f7360fb..2c38b5bb0 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -5270,20 +5270,19 @@ struct ClientMarqueeMessage_Struct { typedef std::list ItemList; struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - Server field 1 */ - uint32 item_id; /* '%05X' - Server field 2 */ - uint32 augment_1; /* '%05X' - Server field 3 */ - uint32 augment_2; /* '%05X' - Server field 4 */ - uint32 augment_3; /* '%05X' - Server field 5 */ - uint32 augment_4; /* '%05X' - Server field 6 */ - uint32 augment_5; /* '%05X' - Server field 7 */ - uint32 augment_6; /* '%05X' - Server field 8 */ - uint8 unknown_2; /* '%1X' - Server field 9 */ - uint8 unknown_3; /* '%1X' - Server field 10 */ - uint32 unknown_4; /* '%04X' - Server field 11 */ - uint8 unknown_5; /* '%1X' - Server field 12 */ - uint32 ornament_icon; /* '%05X' - Server field 13 */ - int hash; /* '%08X' - Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint32 augment_6; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; // Restore structure packing to default diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d236d2b34..00b76da6c 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5819,10 +5819,9 @@ namespace RoF serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -5839,9 +5838,9 @@ namespace RoF rofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; rofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; rofLinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; - rofLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; - rofLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; - rofLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + rofLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + rofLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + rofLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; rofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; rofLinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -5858,9 +5857,9 @@ namespace RoF rofLinkBodyStruct.augment_4, rofLinkBodyStruct.augment_5, rofLinkBodyStruct.augment_6, - rofLinkBodyStruct.unknown_2, - rofLinkBodyStruct.unknown_3, - rofLinkBodyStruct.unknown_4, + rofLinkBodyStruct.is_evolving, + rofLinkBodyStruct.lore_group, + rofLinkBodyStruct.evolve_max, rofLinkBodyStruct.ornament_icon, rofLinkBodyStruct.hash ); @@ -5999,9 +5998,9 @@ namespace RoF rofLinkBodyStruct.augment_4 = (uint32)strtol(rofLinkBody.substr(21, 5).c_str(), nullptr, 16); rofLinkBodyStruct.augment_5 = (uint32)strtol(rofLinkBody.substr(26, 5).c_str(), nullptr, 16); rofLinkBodyStruct.augment_6 = (uint32)strtol(rofLinkBody.substr(31, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.unknown_2 = (uint8)strtol(rofLinkBody.substr(36, 1).c_str(), nullptr, 16); - rofLinkBodyStruct.unknown_3 = (uint32)strtol(rofLinkBody.substr(37, 4).c_str(), nullptr, 16); - rofLinkBodyStruct.unknown_4 = (uint8)strtol(rofLinkBody.substr(41, 1).c_str(), nullptr, 16); + rofLinkBodyStruct.is_evolving = (uint8)strtol(rofLinkBody.substr(36, 1).c_str(), nullptr, 16); + rofLinkBodyStruct.lore_group = (uint32)strtol(rofLinkBody.substr(37, 4).c_str(), nullptr, 16); + rofLinkBodyStruct.evolve_max = (uint8)strtol(rofLinkBody.substr(41, 1).c_str(), nullptr, 16); rofLinkBodyStruct.ornament_icon = (uint32)strtol(rofLinkBody.substr(42, 5).c_str(), nullptr, 16); rofLinkBodyStruct.hash = (int)strtol(rofLinkBody.substr(47, 8).c_str(), nullptr, 16); @@ -6018,10 +6017,9 @@ namespace RoF serverLinkBodyStruct.augment_4 = rofLinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = rofLinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = rofLinkBodyStruct.augment_6; - serverLinkBodyStruct.unknown_2 = NOT_USED; - serverLinkBodyStruct.unknown_3 = rofLinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_4 = rofLinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_5 = rofLinkBodyStruct.unknown_4; + serverLinkBodyStruct.is_evolving = rofLinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = rofLinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = rofLinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = rofLinkBodyStruct.ornament_icon; serverLinkBodyStruct.hash = rofLinkBodyStruct.hash; } @@ -6029,7 +6027,7 @@ namespace RoF static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -6038,10 +6036,9 @@ namespace RoF serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 6356a6f7d..3d23c54bc 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5914,10 +5914,9 @@ namespace RoF2 serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -5934,10 +5933,9 @@ namespace RoF2 rof2LinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; rof2LinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; rof2LinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; - rof2LinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_2; - rof2LinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_3; - rof2LinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_4; - rof2LinkBodyStruct.unknown_5 = serverLinkBodyStruct.unknown_5; + rof2LinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + rof2LinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + rof2LinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; rof2LinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; rof2LinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -5945,7 +5943,7 @@ namespace RoF2 static inline bool GenerateRoF2TextLinkBody(std::string& rof2LinkBody, const structs::TextLinkBody_Struct& rof2LinkBodyStruct) { rof2LinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", rof2LinkBodyStruct.unknown_1, rof2LinkBodyStruct.item_id, rof2LinkBodyStruct.augment_1, @@ -5954,10 +5952,9 @@ namespace RoF2 rof2LinkBodyStruct.augment_4, rof2LinkBodyStruct.augment_5, rof2LinkBodyStruct.augment_6, - rof2LinkBodyStruct.unknown_2, - rof2LinkBodyStruct.unknown_3, - rof2LinkBodyStruct.unknown_4, - rof2LinkBodyStruct.unknown_5, + rof2LinkBodyStruct.is_evolving, + rof2LinkBodyStruct.lore_group, + rof2LinkBodyStruct.evolve_max, rof2LinkBodyStruct.ornament_icon, rof2LinkBodyStruct.hash ); @@ -6084,7 +6081,7 @@ namespace RoF2 static inline bool DegenerateRoF2TextLinkBody(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const std::string& rof2LinkBody) { - // RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" + // RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" memset(&rof2LinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); if (rof2LinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } @@ -6096,10 +6093,9 @@ namespace RoF2 rof2LinkBodyStruct.augment_4 = (uint32)strtol(rof2LinkBody.substr(21, 5).c_str(), nullptr, 16); rof2LinkBodyStruct.augment_5 = (uint32)strtol(rof2LinkBody.substr(26, 5).c_str(), nullptr, 16); rof2LinkBodyStruct.augment_6 = (uint32)strtol(rof2LinkBody.substr(31, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.unknown_2 = (uint8)strtol(rof2LinkBody.substr(36, 1).c_str(), nullptr, 16); - rof2LinkBodyStruct.unknown_3 = (uint32)strtol(rof2LinkBody.substr(37, 4).c_str(), nullptr, 16); - rof2LinkBodyStruct.unknown_4 = (uint8)strtol(rof2LinkBody.substr(41, 1).c_str(), nullptr, 16); - rof2LinkBodyStruct.unknown_5 = (uint8)strtol(rof2LinkBody.substr(42, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.is_evolving = (uint8)strtol(rof2LinkBody.substr(36, 1).c_str(), nullptr, 16); + rof2LinkBodyStruct.lore_group = (uint32)strtol(rof2LinkBody.substr(37, 5).c_str(), nullptr, 16); + rof2LinkBodyStruct.evolve_max = (uint8)strtol(rof2LinkBody.substr(42, 1).c_str(), nullptr, 16); rof2LinkBodyStruct.ornament_icon = (uint32)strtol(rof2LinkBody.substr(43, 5).c_str(), nullptr, 16); rof2LinkBodyStruct.hash = (int)strtol(rof2LinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -6116,10 +6112,9 @@ namespace RoF2 serverLinkBodyStruct.augment_4 = rof2LinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = rof2LinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = rof2LinkBodyStruct.augment_6; - serverLinkBodyStruct.unknown_2 = rof2LinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_3 = rof2LinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_4 = rof2LinkBodyStruct.unknown_4; - serverLinkBodyStruct.unknown_5 = rof2LinkBodyStruct.unknown_5; + serverLinkBodyStruct.is_evolving = rof2LinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = rof2LinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = rof2LinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = rof2LinkBodyStruct.ornament_icon; serverLinkBodyStruct.hash = rof2LinkBodyStruct.hash; } @@ -6127,7 +6122,7 @@ namespace RoF2 static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -6136,10 +6131,9 @@ namespace RoF2 serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 60cf07808..0b2de35ab 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4872,23 +4872,22 @@ struct MercenaryMerchantResponse_Struct { /*0004*/ }; -// RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" +// RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - RoF2 field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - RoF2 field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - RoF2 field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - RoF2 field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - RoF2 field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - RoF2 field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - RoF2 field 7 / Server field 7 */ - uint32 augment_6; /* '%05X' - RoF2 field 8 / Server field 8 */ - uint8 unknown_2; /* '%1X' - RoF2 field 9 / Server field 9 */ - uint8 unknown_3; /* '%1X' - RoF2 field 10 / Server field 10 */ - uint32 unknown_4; /* '%04X' - RoF2 field 11 / Server field 11 */ - uint8 unknown_5; /* '%1X' - RoF2 field 12 / Server field 12 */ - uint32 ornament_icon; /* '%05X' - RoF2 field 13 / Server field 13 */ - int hash; /* '%08X' - RoF2 field 14 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint32 augment_6; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; }; //end namespace structs diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 4aa2c04a2..c5f02dc9b 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4897,19 +4897,19 @@ struct MercenaryMerchantResponse_Struct { // RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - RoF field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - RoF field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - RoF field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - RoF field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - RoF field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - RoF field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - RoF field 7 / Server field 7 */ - uint32 augment_6; /* '%05X' - RoF field 8 / Server field 8 */ - uint8 unknown_2; /* '%1X' - RoF field 9 / Server field 10 */ - uint32 unknown_3; /* '%04X' - RoF field 10 / Server field 11 */ - uint8 unknown_4; /* '%1X' - RoF field 11 / Server field 12 */ - uint32 ornament_icon; /* '%05X' - RoF field 12 / Server field 13 */ - int hash; /* '%08X' - RoF field 13 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint32 augment_6; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; }; //end namespace structs diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index b30bad97d..94d1cb120 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3911,10 +3911,9 @@ namespace SoD serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -3930,9 +3929,9 @@ namespace SoD sodLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; sodLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; sodLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - sodLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; - sodLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; - sodLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + sodLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + sodLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + sodLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; sodLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; sodLinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -3948,9 +3947,9 @@ namespace SoD sodLinkBodyStruct.augment_3, sodLinkBodyStruct.augment_4, sodLinkBodyStruct.augment_5, - sodLinkBodyStruct.unknown_2, - sodLinkBodyStruct.unknown_3, - sodLinkBodyStruct.unknown_4, + sodLinkBodyStruct.is_evolving, + sodLinkBodyStruct.lore_group, + sodLinkBodyStruct.evolve_max, sodLinkBodyStruct.ornament_icon, sodLinkBodyStruct.hash ); @@ -4088,9 +4087,9 @@ namespace SoD sodLinkBodyStruct.augment_3 = (uint32)strtol(sodLinkBody.substr(16, 5).c_str(), nullptr, 16); sodLinkBodyStruct.augment_4 = (uint32)strtol(sodLinkBody.substr(21, 5).c_str(), nullptr, 16); sodLinkBodyStruct.augment_5 = (uint32)strtol(sodLinkBody.substr(26, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.unknown_2 = (uint8)strtol(sodLinkBody.substr(31, 1).c_str(), nullptr, 16); - sodLinkBodyStruct.unknown_3 = (uint32)strtol(sodLinkBody.substr(32, 4).c_str(), nullptr, 16); - sodLinkBodyStruct.unknown_4 = (uint8)strtol(sodLinkBody.substr(36, 1).c_str(), nullptr, 16); + sodLinkBodyStruct.is_evolving = (uint8)strtol(sodLinkBody.substr(31, 1).c_str(), nullptr, 16); + sodLinkBodyStruct.lore_group = (uint32)strtol(sodLinkBody.substr(32, 4).c_str(), nullptr, 16); + sodLinkBodyStruct.evolve_max = (uint8)strtol(sodLinkBody.substr(36, 1).c_str(), nullptr, 16); sodLinkBodyStruct.ornament_icon = (uint32)strtol(sodLinkBody.substr(37, 5).c_str(), nullptr, 16); sodLinkBodyStruct.hash = (int)strtol(sodLinkBody.substr(42, 8).c_str(), nullptr, 16); @@ -4107,10 +4106,9 @@ namespace SoD serverLinkBodyStruct.augment_4 = sodLinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = sodLinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.unknown_2 = NOT_USED; - serverLinkBodyStruct.unknown_3 = sodLinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_4 = sodLinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_5 = sodLinkBodyStruct.unknown_4; + serverLinkBodyStruct.is_evolving = sodLinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = sodLinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = sodLinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = sodLinkBodyStruct.ornament_icon; serverLinkBodyStruct.hash = sodLinkBodyStruct.hash; } @@ -4118,7 +4116,7 @@ namespace SoD static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -4127,10 +4125,9 @@ namespace SoD serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 3c1acc37d..39f81b7c1 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -4412,18 +4412,18 @@ struct MercenaryAssign_Struct { // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - SoD field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - SoD field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - SoD field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - SoD field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - SoD field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - SoD field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - SoD field 7 / Server field 7 */ - uint8 unknown_2; /* '%1X' - SoD field 8 / Server field 10 */ - uint32 unknown_3; /* '%04X' - SoD field 9 / Server field 11 */ - uint8 unknown_4; /* '%1X' - SoD field 10 / Server field 12 */ - uint32 ornament_icon; /* '%05X' - SoD field 11 / Server field 13 */ - int hash; /* '%08X' - SoD field 12 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; }; //end namespace structs diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index cd5a1ef71..a75b07307 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -3233,10 +3233,9 @@ namespace SoF serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -3252,9 +3251,9 @@ namespace SoF sofLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; sofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; sofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - sofLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; - sofLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; - sofLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + sofLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + sofLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + sofLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; sofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; sofLinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -3270,9 +3269,9 @@ namespace SoF sofLinkBodyStruct.augment_3, sofLinkBodyStruct.augment_4, sofLinkBodyStruct.augment_5, - sofLinkBodyStruct.unknown_2, - sofLinkBodyStruct.unknown_3, - sofLinkBodyStruct.unknown_4, + sofLinkBodyStruct.is_evolving, + sofLinkBodyStruct.lore_group, + sofLinkBodyStruct.evolve_max, sofLinkBodyStruct.ornament_icon, sofLinkBodyStruct.hash ); @@ -3410,9 +3409,9 @@ namespace SoF sofLinkBodyStruct.augment_3 = (uint32)strtol(sofLinkBody.substr(16, 5).c_str(), nullptr, 16); sofLinkBodyStruct.augment_4 = (uint32)strtol(sofLinkBody.substr(21, 5).c_str(), nullptr, 16); sofLinkBodyStruct.augment_5 = (uint32)strtol(sofLinkBody.substr(26, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.unknown_2 = (uint8)strtol(sofLinkBody.substr(31, 1).c_str(), nullptr, 16); - sofLinkBodyStruct.unknown_3 = (uint32)strtol(sofLinkBody.substr(32, 4).c_str(), nullptr, 16); - sofLinkBodyStruct.unknown_4 = (uint8)strtol(sofLinkBody.substr(36, 1).c_str(), nullptr, 16); + sofLinkBodyStruct.is_evolving = (uint8)strtol(sofLinkBody.substr(31, 1).c_str(), nullptr, 16); + sofLinkBodyStruct.lore_group = (uint32)strtol(sofLinkBody.substr(32, 4).c_str(), nullptr, 16); + sofLinkBodyStruct.evolve_max = (uint8)strtol(sofLinkBody.substr(36, 1).c_str(), nullptr, 16); sofLinkBodyStruct.ornament_icon = (uint32)strtol(sofLinkBody.substr(37, 5).c_str(), nullptr, 16); sofLinkBodyStruct.hash = (int)strtol(sofLinkBody.substr(42, 8).c_str(), nullptr, 16); @@ -3429,10 +3428,9 @@ namespace SoF serverLinkBodyStruct.augment_4 = sofLinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = sofLinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.unknown_2 = NOT_USED; - serverLinkBodyStruct.unknown_3 = sofLinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_4 = sofLinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_5 = sofLinkBodyStruct.unknown_4; + serverLinkBodyStruct.is_evolving = sofLinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = sofLinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = sofLinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = sofLinkBodyStruct.ornament_icon; serverLinkBodyStruct.hash = sofLinkBodyStruct.hash; } @@ -3440,7 +3438,7 @@ namespace SoF static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -3449,10 +3447,9 @@ namespace SoF serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 5986e0029..08d7f6fa6 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -4118,18 +4118,18 @@ struct AltCurrencySellItem_Struct { // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - SoF field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - SoF field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - SoF field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - SoF field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - SoF field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - SoF field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - SoF field 7 / Server field 7 */ - uint8 unknown_2; /* '%1X' - SoF field 8 / Server field 10 */ - uint32 unknown_3; /* '%04X' - SoF field 9 / Server field 11 */ - uint8 unknown_4; /* '%1X' - SoF field 10 / Server field 12 */ - uint32 ornament_icon; /* '%05X' - SoF field 11 / Server field 13 */ - int hash; /* '%08X' - SoF field 12 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; }; //end namespace structs diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index fb7faa4f9..e083f9561 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1992,10 +1992,9 @@ namespace Titanium serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -2011,9 +2010,9 @@ namespace Titanium titaniumLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; titaniumLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; titaniumLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - titaniumLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; - titaniumLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; - titaniumLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + titaniumLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + titaniumLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + titaniumLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; titaniumLinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -2028,9 +2027,9 @@ namespace Titanium titaniumLinkBodyStruct.augment_3, titaniumLinkBodyStruct.augment_4, titaniumLinkBodyStruct.augment_5, - titaniumLinkBodyStruct.unknown_2, - titaniumLinkBodyStruct.unknown_3, - titaniumLinkBodyStruct.unknown_4, + titaniumLinkBodyStruct.is_evolving, + titaniumLinkBodyStruct.lore_group, + titaniumLinkBodyStruct.evolve_max, titaniumLinkBodyStruct.hash ); @@ -2167,9 +2166,9 @@ namespace Titanium titaniumLinkBodyStruct.augment_3 = (uint32)strtol(titaniumLinkBody.substr(16, 5).c_str(), nullptr, 16); titaniumLinkBodyStruct.augment_4 = (uint32)strtol(titaniumLinkBody.substr(21, 5).c_str(), nullptr, 16); titaniumLinkBodyStruct.augment_5 = (uint32)strtol(titaniumLinkBody.substr(26, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.unknown_2 = (uint8)strtol(titaniumLinkBody.substr(31, 1).c_str(), nullptr, 16); - titaniumLinkBodyStruct.unknown_3 = (uint32)strtol(titaniumLinkBody.substr(32, 4).c_str(), nullptr, 16); - titaniumLinkBodyStruct.unknown_4 = (uint8)strtol(titaniumLinkBody.substr(36, 1).c_str(), nullptr, 16); + titaniumLinkBodyStruct.is_evolving = (uint8)strtol(titaniumLinkBody.substr(31, 1).c_str(), nullptr, 16); + titaniumLinkBodyStruct.lore_group = (uint32)strtol(titaniumLinkBody.substr(32, 4).c_str(), nullptr, 16); + titaniumLinkBodyStruct.evolve_max = (uint8)strtol(titaniumLinkBody.substr(36, 1).c_str(), nullptr, 16); titaniumLinkBodyStruct.hash = (int)strtol(titaniumLinkBody.substr(37, 8).c_str(), nullptr, 16); return true; @@ -2185,10 +2184,9 @@ namespace Titanium serverLinkBodyStruct.augment_4 = titaniumLinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = titaniumLinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.unknown_2 = NOT_USED; - serverLinkBodyStruct.unknown_3 = titaniumLinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_4 = titaniumLinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_5 = titaniumLinkBodyStruct.unknown_4; + serverLinkBodyStruct.is_evolving = titaniumLinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = titaniumLinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = titaniumLinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = NOT_USED; serverLinkBodyStruct.hash = titaniumLinkBodyStruct.hash; } @@ -2196,7 +2194,7 @@ namespace Titanium static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -2205,10 +2203,9 @@ namespace Titanium serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 7fb2df5cd..06536c7c2 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -3332,17 +3332,17 @@ struct LFGuild_GuildToggle_Struct // 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - Titanium field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - Titanium field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - Titanium field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - Titanium field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - Titanium field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - Titanium field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - Titanium field 7 / Server field 7 */ - uint8 unknown_2; /* '%1X' - Titanium field 8 / Server field 10 */ - uint32 unknown_3; /* '%04X' - Titanium field 9 / Server field 11 */ - uint8 unknown_4; /* '%1X' - Titanium field 10 / Server field 12 */ - int hash; /* '%08X' - Titanium field 11 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + int hash; }; }; //end namespace structs diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index e45dae148..022c1d62c 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -4346,10 +4346,9 @@ namespace Underfoot serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_2 = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_3 = (uint8)strtol(serverLinkBody.substr(37, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_4 = (uint32)strtol(serverLinkBody.substr(38, 4).c_str(), nullptr, 16); - serverLinkBodyStruct.unknown_5 = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); + serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); + serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -4365,9 +4364,9 @@ namespace Underfoot underfootLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; underfootLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; underfootLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - underfootLinkBodyStruct.unknown_2 = serverLinkBodyStruct.unknown_3; - underfootLinkBodyStruct.unknown_3 = serverLinkBodyStruct.unknown_4; - underfootLinkBodyStruct.unknown_4 = serverLinkBodyStruct.unknown_5; + underfootLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; + underfootLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; + underfootLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; underfootLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; underfootLinkBodyStruct.hash = serverLinkBodyStruct.hash; } @@ -4383,9 +4382,9 @@ namespace Underfoot underfootLinkBodyStruct.augment_3, underfootLinkBodyStruct.augment_4, underfootLinkBodyStruct.augment_5, - underfootLinkBodyStruct.unknown_2, - underfootLinkBodyStruct.unknown_3, - underfootLinkBodyStruct.unknown_4, + underfootLinkBodyStruct.is_evolving, + underfootLinkBodyStruct.lore_group, + underfootLinkBodyStruct.evolve_max, underfootLinkBodyStruct.ornament_icon, underfootLinkBodyStruct.hash ); @@ -4523,9 +4522,9 @@ namespace Underfoot underfootLinkBodyStruct.augment_3 = (uint32)strtol(underfootLinkBody.substr(16, 5).c_str(), nullptr, 16); underfootLinkBodyStruct.augment_4 = (uint32)strtol(underfootLinkBody.substr(21, 5).c_str(), nullptr, 16); underfootLinkBodyStruct.augment_5 = (uint32)strtol(underfootLinkBody.substr(26, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.unknown_2 = (uint8)strtol(underfootLinkBody.substr(31, 1).c_str(), nullptr, 16); - underfootLinkBodyStruct.unknown_3 = (uint32)strtol(underfootLinkBody.substr(32, 4).c_str(), nullptr, 16); - underfootLinkBodyStruct.unknown_4 = (uint8)strtol(underfootLinkBody.substr(36, 1).c_str(), nullptr, 16); + underfootLinkBodyStruct.is_evolving = (uint8)strtol(underfootLinkBody.substr(31, 1).c_str(), nullptr, 16); + underfootLinkBodyStruct.lore_group = (uint32)strtol(underfootLinkBody.substr(32, 4).c_str(), nullptr, 16); + underfootLinkBodyStruct.evolve_max = (uint8)strtol(underfootLinkBody.substr(36, 1).c_str(), nullptr, 16); underfootLinkBodyStruct.ornament_icon = (uint32)strtol(underfootLinkBody.substr(37, 5).c_str(), nullptr, 16); underfootLinkBodyStruct.hash = (int)strtol(underfootLinkBody.substr(42, 8).c_str(), nullptr, 16); @@ -4542,10 +4541,9 @@ namespace Underfoot serverLinkBodyStruct.augment_4 = underfootLinkBodyStruct.augment_4; serverLinkBodyStruct.augment_5 = underfootLinkBodyStruct.augment_5; serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.unknown_2 = NOT_USED; - serverLinkBodyStruct.unknown_3 = underfootLinkBodyStruct.unknown_2; - serverLinkBodyStruct.unknown_4 = underfootLinkBodyStruct.unknown_3; - serverLinkBodyStruct.unknown_5 = underfootLinkBodyStruct.unknown_4; + serverLinkBodyStruct.is_evolving = underfootLinkBodyStruct.is_evolving; + serverLinkBodyStruct.lore_group = underfootLinkBodyStruct.lore_group; + serverLinkBodyStruct.evolve_max = underfootLinkBodyStruct.evolve_max; serverLinkBodyStruct.ornament_icon = underfootLinkBodyStruct.ornament_icon; serverLinkBodyStruct.hash = underfootLinkBodyStruct.hash; } @@ -4553,7 +4551,7 @@ namespace Underfoot static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) { serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%01X" "%04X" "%01X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", serverLinkBodyStruct.unknown_1, serverLinkBodyStruct.item_id, serverLinkBodyStruct.augment_1, @@ -4562,10 +4560,9 @@ namespace Underfoot serverLinkBodyStruct.augment_4, serverLinkBodyStruct.augment_5, serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.unknown_2, - serverLinkBodyStruct.unknown_3, - serverLinkBodyStruct.unknown_4, - serverLinkBodyStruct.unknown_5, + serverLinkBodyStruct.is_evolving, + serverLinkBodyStruct.lore_group, + serverLinkBodyStruct.evolve_max, serverLinkBodyStruct.ornament_icon, serverLinkBodyStruct.hash ); diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index 9180a762b..b196e5867 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4533,18 +4533,18 @@ struct MercenaryAssign_Struct { // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" struct TextLinkBody_Struct { - uint8 unknown_1; /* '%1X' - Underfoot field 1 / Server field 1 */ - uint32 item_id; /* '%05X' - Underfoot field 2 / Server field 2 */ - uint32 augment_1; /* '%05X' - Underfoot field 3 / Server field 3 */ - uint32 augment_2; /* '%05X' - Underfoot field 4 / Server field 4 */ - uint32 augment_3; /* '%05X' - Underfoot field 5 / Server field 5 */ - uint32 augment_4; /* '%05X' - Underfoot field 6 / Server field 6 */ - uint32 augment_5; /* '%05X' - Underfoot field 7 / Server field 7 */ - uint8 unknown_2; /* '%1X' - Underfoot field 8 / Server field 10 */ - uint32 unknown_3; /* '%04X' - Underfoot field 9 / Server field 11 */ - uint8 unknown_4; /* '%1X' - Underfoot field 10 / Server field 12 */ - uint32 ornament_icon; /* '%05X' - Underfoot field 11 / Server field 13 */ - int hash; /* '%08X' - Underfoot field 12 / Server field 14 */ + uint8 unknown_1; + uint32 item_id; + uint32 augment_1; + uint32 augment_2; + uint32 augment_3; + uint32 augment_4; + uint32 augment_5; + uint8 is_evolving; + uint32 lore_group; + uint8 evolve_max; + uint32 ornament_icon; + int hash; }; }; //end namespace structs diff --git a/zone/client.cpp b/zone/client.cpp index 54324932d..c8bbd25cf 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8312,10 +8312,10 @@ void Client::TextLink::generate_body() /* Current server mask: EQClientRoF2 - RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X" (56) - RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) - SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) - 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45) + RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" (56) + RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) + SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) + 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45) */ // could use a ##_cast(&this) with a memset to '0' since these properties are inherited @@ -8328,12 +8328,11 @@ void Client::TextLink::generate_body() augment_4 = NOT_USED; /* field 6 */ augment_5 = NOT_USED; /* field 7 */ augment_6 = NOT_USED; /* field 8 */ - unknown_2 = NOT_USED; /* field 9 */ - unknown_3 = NOT_USED; /* field 10 */ - unknown_4 = NOT_USED; /* field 11 */ - unknown_5 = NOT_USED; /* field 12 */ - ornament_icon = NOT_USED; /* field 13 */ - hash = NOT_USED; /* field 14 */ + is_evolving = NOT_USED; /* field 9 */ + lore_group = NOT_USED; /* field 10 */ + evolve_max = NOT_USED; /* field 11 */ + ornament_icon = NOT_USED; /* field 12 */ + hash = NOT_USED; /* field 13 */ const Item_Struct* item_data = nullptr; @@ -8385,7 +8384,7 @@ void Client::TextLink::generate_body() } m_LinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", unknown_1, item_id, augment_1, @@ -8394,10 +8393,9 @@ void Client::TextLink::generate_body() augment_4, augment_5, augment_6, - unknown_2, - unknown_3, - unknown_4, - unknown_5, + is_evolving, + lore_group, + evolve_max, ornament_icon, hash ); @@ -8450,10 +8448,9 @@ bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruc textLinkBodyStruct.augment_4 = (uint32)strtol(textLinkBody.substr(21, 5).c_str(), nullptr, 16); textLinkBodyStruct.augment_5 = (uint32)strtol(textLinkBody.substr(26, 5).c_str(), nullptr, 16); textLinkBodyStruct.augment_6 = (uint32)strtol(textLinkBody.substr(31, 5).c_str(), nullptr, 16); - textLinkBodyStruct.unknown_2 = (uint8)strtol(textLinkBody.substr(36, 1).c_str(), nullptr, 16); - textLinkBodyStruct.unknown_3 = (uint8)strtol(textLinkBody.substr(37, 1).c_str(), nullptr, 16); - textLinkBodyStruct.unknown_4 = (uint32)strtol(textLinkBody.substr(38, 4).c_str(), nullptr, 16); - textLinkBodyStruct.unknown_5 = (uint8)strtol(textLinkBody.substr(42, 1).c_str(), nullptr, 16); + textLinkBodyStruct.is_evolving = (uint8)strtol(textLinkBody.substr(36, 1).c_str(), nullptr, 16); + textLinkBodyStruct.lore_group = (uint32)strtol(textLinkBody.substr(37, 5).c_str(), nullptr, 16); + textLinkBodyStruct.evolve_max = (uint8)strtol(textLinkBody.substr(42, 1).c_str(), nullptr, 16); textLinkBodyStruct.ornament_icon = (uint32)strtol(textLinkBody.substr(43, 5).c_str(), nullptr, 16); textLinkBodyStruct.hash = (int)strtol(textLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -8463,7 +8460,7 @@ bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruc bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct) { textLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X", + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", textLinkBodyStruct.unknown_1, textLinkBodyStruct.item_id, textLinkBodyStruct.augment_1, @@ -8472,10 +8469,9 @@ bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLin textLinkBodyStruct.augment_4, textLinkBodyStruct.augment_5, textLinkBodyStruct.augment_6, - textLinkBodyStruct.unknown_2, - textLinkBodyStruct.unknown_3, - textLinkBodyStruct.unknown_4, - textLinkBodyStruct.unknown_5, + textLinkBodyStruct.is_evolving, + textLinkBodyStruct.lore_group, + textLinkBodyStruct.evolve_max, textLinkBodyStruct.ornament_icon, textLinkBodyStruct.hash ); From f1a73d4da2e0bcfefe19a0bd99cafde42a23ecda Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 6 Jan 2015 01:19:33 -0600 Subject: [PATCH 0744/1883] Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional. Added more toggle and on/off support for pet commands. --- changelog.txt | 4 ++ common/patches/rof.cpp | 43 +------------------ common/patches/rof2.cpp | 43 +------------------ common/patches/sod.cpp | 81 +++++++++++++++++++++++++++++++++++ common/patches/sod_ops.h | 1 + common/patches/sof.cpp | 81 +++++++++++++++++++++++++++++++++++ common/patches/sof_ops.h | 1 + common/patches/titanium.cpp | 81 +++++++++++++++++++++++++++++++++++ common/patches/titanium_ops.h | 1 + common/patches/underfoot.cpp | 53 +---------------------- zone/client_packet.cpp | 69 ++++++++++++++++++++++++----- zone/npc.h | 1 + zone/pets.h | 48 ++++++++++++--------- 13 files changed, 343 insertions(+), 164 deletions(-) diff --git a/changelog.txt b/changelog.txt index c9a9a2c3a..36e19a297 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/06/2015 == +Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. +Trevius: (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional. + == 01/05/2015 == Uleat: Fixed (added translators for) item/text links. Only 'OP_ChannelMessage' and 'OP_SpecialMesg' are currently handled..more text channels will be added as the need arises. diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 00b76da6c..57312d6f0 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -4518,47 +4518,8 @@ namespace RoF DECODE_LENGTH_EXACT(structs::PetCommand_Struct); SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); - switch (eq->command) - { - case 0x00: - emu->command = 0x04; // Health - break; - case 0x01: - emu->command = 0x10; // Leader - break; - case 0x02: - emu->command = 0x07; // Attack - break; - case 0x04: - emu->command = 0x08; // Follow - break; - case 0x05: - emu->command = 0x05; // Guard - break; - case 0x06: - emu->command = 0x09; // Sit. Needs work. This appears to be a toggle between Sit/Stand now. - break; - case 0x0c: - emu->command = 0x0b; // Taunt - break; - case 0x0f: - emu->command = 0x0c; // Hold - break; - case 0x10: - emu->command = 0x1b; // Hold on - break; - case 0x11: - emu->command = 0x1c; // Hold off - break; - case 0x1c: - emu->command = 0x01; // Back - break; - case 0x1d: - emu->command = 0x02; // Leave/Go Away - break; - default: - emu->command = eq->command; - } + IN(command); + emu->unknown = eq->unknown04; FINISH_DIRECT_DECODE(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 3d23c54bc..9f93c0700 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4589,47 +4589,8 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::PetCommand_Struct); SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); - switch (eq->command) - { - case 0x00: - emu->command = 0x04; // Health - break; - case 0x01: - emu->command = 0x10; // Leader - break; - case 0x02: - emu->command = 0x07; // Attack - break; - case 0x04: - emu->command = 0x08; // Follow - break; - case 0x05: - emu->command = 0x05; // Guard - break; - case 0x06: - emu->command = 0x09; // Sit. Needs work. This appears to be a toggle between Sit/Stand now. - break; - case 0x0c: - emu->command = 0x0b; // Taunt - break; - case 0x0f: - emu->command = 0x0c; // Hold - break; - case 0x10: - emu->command = 0x1b; // Hold on - break; - case 0x11: - emu->command = 0x1c; // Hold off - break; - case 0x1c: - emu->command = 0x01; // Back - break; - case 0x1d: - emu->command = 0x02; // Leave/Go Away - break; - default: - emu->command = eq->command; - } + IN(command); + emu->unknown = eq->unknown04; FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 94d1cb120..a6025b287 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3105,6 +3105,87 @@ namespace SoD FINISH_DIRECT_DECODE(); } + DECODE(OP_PetCommands) + { + DECODE_LENGTH_EXACT(structs::PetCommand_Struct); + SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); + + switch (eq->command) + { + case 0x04: + emu->command = 0x00; // /pet health + break; + case 0x10: + emu->command = 0x01; // /pet leader + break; + case 0x07: + emu->command = 0x02; // /pet attack or Pet Window + break; + case 0x08: + emu->command = 0x04; // /pet follow or Pet Window + break; + case 0x05: + emu->command = 0x05; // /pet guard or Pet Window + break; + case 0x09: + emu->command = 0x07; // /pet sit or Pet Window + break; + case 0x0a: + emu->command = 0x08; // /pet stand or Pet Window + break; + case 0x06: + emu->command = 0x03; // /pet guard me + break; + case 0x03: // Case Made Up + emu->command = 0x09; // Stop? + break; + case 0x0b: + emu->command = 0x0d; // /pet taunt or Pet Window + break; + case 0x0e: + emu->command = 0x0e; // /pet notaunt or Pet Window + break; + case 0x0c: + emu->command = 0x0f; // /pet hold + break; + case 0x1b: + emu->command = 0x10; // /pet hold on + break; + case 0x1c: + emu->command = 0x11; // /pet hold off + break; + case 0x11: + emu->command = 0x12; // Slumber? + break; + case 0x12: + emu->command = 0x15; // /pet no cast + break; + case 0x0d: // Case Made Up + emu->command = 0x16; // Pet Window No Cast + break; + case 0x13: + emu->command = 0x18; // /pet focus + break; + case 0x19: + emu->command = 0x19; // /pet focus on + break; + case 0x1a: + emu->command = 0x1a; // /pet focus off + break; + case 0x01: + emu->command = 0x1c; // /pet back off + break; + case 0x02: + emu->command = 0x1d; // /pet get lost + break; + default: + emu->command = eq->command; + } + OUT(unknown); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_RaidInvite) { DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index e3b6c1f41..0a0a8a4d5 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -104,6 +104,7 @@ D(OP_ItemVerifyRequest) D(OP_LoadSpellSet) D(OP_LootItem) D(OP_MoveItem) +D(OP_PetCommands) D(OP_RaidInvite) D(OP_ReadBook) D(OP_Save) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index a75b07307..5e3dff8b1 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2443,6 +2443,87 @@ namespace SoF FINISH_DIRECT_DECODE(); } + DECODE(OP_PetCommands) + { + DECODE_LENGTH_EXACT(structs::PetCommand_Struct); + SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); + + switch (eq->command) + { + case 0x04: + emu->command = 0x00; // /pet health + break; + case 0x10: + emu->command = 0x01; // /pet leader + break; + case 0x07: + emu->command = 0x02; // /pet attack or Pet Window + break; + case 0x08: + emu->command = 0x04; // /pet follow or Pet Window + break; + case 0x05: + emu->command = 0x05; // /pet guard or Pet Window + break; + case 0x09: + emu->command = 0x07; // /pet sit or Pet Window + break; + case 0x0a: + emu->command = 0x08; // /pet stand or Pet Window + break; + case 0x06: + emu->command = 0x03; // /pet guard me + break; + case 0x03: // Case Made Up + emu->command = 0x09; // Stop? + break; + case 0x0b: + emu->command = 0x0d; // /pet taunt or Pet Window + break; + case 0x0e: + emu->command = 0x0e; // /pet notaunt or Pet Window + break; + case 0x0c: + emu->command = 0x0f; // /pet hold + break; + case 0x1b: + emu->command = 0x10; // /pet hold on + break; + case 0x1c: + emu->command = 0x11; // /pet hold off + break; + case 0x11: + emu->command = 0x12; // Slumber? + break; + case 0x12: + emu->command = 0x15; // /pet no cast + break; + case 0x0d: // Case Made Up + emu->command = 0x16; // Pet Window No Cast + break; + case 0x13: + emu->command = 0x18; // /pet focus + break; + case 0x19: + emu->command = 0x19; // /pet focus on + break; + case 0x1a: + emu->command = 0x1a; // /pet focus off + break; + case 0x01: + emu->command = 0x1c; // /pet back off + break; + case 0x02: + emu->command = 0x1d; // /pet get lost + break; + default: + emu->command = eq->command; + } + OUT(unknown); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_RaidInvite) { DECODE_LENGTH_ATLEAST(structs::RaidGeneral_Struct); diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index 88d468c82..9cfd400e3 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -88,6 +88,7 @@ D(OP_ItemLinkClick) D(OP_ItemVerifyRequest) D(OP_LootItem) D(OP_MoveItem) +D(OP_PetCommands) D(OP_RaidInvite) D(OP_ReadBook) D(OP_Save) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index e083f9561..895f2ee88 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1637,6 +1637,87 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_PetCommands) + { + DECODE_LENGTH_EXACT(structs::PetCommand_Struct); + SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); + + switch (eq->command) + { + case 0x04: + emu->command = 0x00; // /pet health + break; + case 0x10: + emu->command = 0x01; // /pet leader + break; + case 0x07: + emu->command = 0x02; // /pet attack or Pet Window + break; + case 0x08: + emu->command = 0x04; // /pet follow or Pet Window + break; + case 0x05: + emu->command = 0x05; // /pet guard or Pet Window + break; + case 0x09: + emu->command = 0x07; // /pet sit or Pet Window + break; + case 0x0a: + emu->command = 0x08; // /pet stand or Pet Window + break; + case 0x06: + emu->command = 0x03; // /pet guard me + break; + case 0x03: // Case Made Up + emu->command = 0x09; // Stop? + break; + case 0x0b: + emu->command = 0x0d; // /pet taunt or Pet Window + break; + case 0x0e: + emu->command = 0x0e; // /pet notaunt or Pet Window + break; + case 0x0c: + emu->command = 0x0f; // /pet hold + break; + case 0x1b: + emu->command = 0x10; // /pet hold on + break; + case 0x1c: + emu->command = 0x11; // /pet hold off + break; + case 0x11: + emu->command = 0x12; // Slumber? + break; + case 0x12: + emu->command = 0x15; // /pet no cast + break; + case 0x0d: // Case Made Up + emu->command = 0x16; // Pet Window No Cast + break; + case 0x13: + emu->command = 0x18; // /pet focus + break; + case 0x19: + emu->command = 0x19; // /pet focus on + break; + case 0x1a: + emu->command = 0x1a; // /pet focus off + break; + case 0x01: + emu->command = 0x1c; // /pet back off + break; + case 0x02: + emu->command = 0x1d; // /pet get lost + break; + default: + emu->command = eq->command; + } + OUT(unknown); + + FINISH_DIRECT_DECODE(); + } + DECODE(OP_ReadBook) { // no apparent slot translation needed -U diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index a3d2e71af..4ddcae630 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -62,6 +62,7 @@ D(OP_ItemLinkClick) D(OP_LFGuild) D(OP_LootItem) D(OP_MoveItem) +D(OP_PetCommands) D(OP_ReadBook) D(OP_SetServerFilter) D(OP_ShopPlayerSell) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 022c1d62c..b525a3c46 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -3425,57 +3425,8 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::PetCommand_Struct); SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); - switch (eq->command) - { - case 0x00: - emu->command = 0x04; // Health - break; - case 0x01: - emu->command = 0x10; // Leader - break; - case 0x02: - emu->command = 0x07; // Attack - break; - case 0x04: - emu->command = 0x08; // Follow - break; - case 0x05: - emu->command = 0x05; // Guard - break; - case 0x06: - emu->command = 0x09; // Sit. Needs work. This appears to be a toggle between Sit/Stand now. - break; - case 0x0c: - emu->command = 0x0b; // Taunt - break; - case 0x0f: - emu->command = 0x0c; // Hold - break; - case 0x10: - emu->command = 0x1b; // Hold on - break; - case 0x11: - emu->command = 0x1c; // Hold off - break; - case 0x1c: - emu->command = 0x01; // Back - break; - case 0x1d: - emu->command = 0x02; // Leave/Go Away - break; - case 0x15: - emu->command = 0x12; // No Cast - /command - break; - case 0x16: - emu->command = 0x12; // No Cast - Pet Window - break; - case 0x18: - emu->command = 0x13; // Focus - Pet Window - break; - default: - emu->command = eq->command; - } - OUT(unknown); + IN(command); + IN(unknown); FINISH_DIRECT_DECODE(); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cf1dc71b8..785abb0c8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9925,12 +9925,14 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) uint32 PetCommand = pet->command; // Handle Sit/Stand toggle in UF and later. + /* if (GetClientVersion() >= EQClientUnderfoot) { if (PetCommand == PET_SITDOWN) if (mypet->GetPetOrder() == SPO_Sit) PetCommand = PET_STANDUP; } + */ switch (PetCommand) { @@ -10036,13 +10038,28 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) break; } case PET_TAUNT: { + if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { + if (mypet->CastToNPC()->IsTaunting()) + { + Message_StringID(MT_PetResponse, PET_NO_TAUNT); + mypet->CastToNPC()->SetTaunting(false); + } + else + { + Message_StringID(MT_PetResponse, PET_DO_TAUNT); + mypet->CastToNPC()->SetTaunting(true); + } + } + break; + } + case PET_TAUNT_ON: { if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { Message_StringID(MT_PetResponse, PET_DO_TAUNT); mypet->CastToNPC()->SetTaunting(true); } break; } - case PET_NOTAUNT: { + case PET_TAUNT_OFF: { if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { Message_StringID(MT_PetResponse, PET_NO_TAUNT); mypet->CastToNPC()->SetTaunting(false); @@ -10060,16 +10077,25 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } - case PET_SITDOWN: { + case PET_SIT: { if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { - mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); - mypet->SetPetOrder(SPO_Sit); - mypet->SetRunAnimSpeed(0); - if (!mypet->UseBardSpellLogic()) //maybe we can have a bard pet - mypet->InterruptSpell(); //No cast 4 u. //i guess the pet should start casting - mypet->SendAppearancePacket(AT_Anim, ANIM_SIT); + if (mypet->GetPetOrder() == SPO_Sit) + { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Follow); + mypet->SendAppearancePacket(AT_Anim, ANIM_STAND); + } + else + { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Sit); + mypet->SetRunAnimSpeed(0); + if (!mypet->UseBardSpellLogic()) //maybe we can have a bard pet + mypet->InterruptSpell(); //No cast 4 u. //i guess the pet should start casting + mypet->SendAppearancePacket(AT_Anim, ANIM_SIT); + } } break; } @@ -10083,6 +10109,19 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_SITDOWN: { + if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF + + if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 3) || mypet->GetPetType() != petAnimation) { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Sit); + mypet->SetRunAnimSpeed(0); + if (!mypet->UseBardSpellLogic()) //maybe we can have a bard pet + mypet->InterruptSpell(); //No cast 4 u. //i guess the pet should start casting + mypet->SendAppearancePacket(AT_Anim, ANIM_SIT); + } + break; + } case PET_SLUMBER: { if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF @@ -10101,9 +10140,16 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF - mypet->Say_StringID(MT_PetResponse, PET_ON_HOLD); - mypet->WipeHateList(); - mypet->SetHeld(true); + if (mypet->IsHeld()) + { + mypet->SetHeld(false); + } + else + { + mypet->Say_StringID(MT_PetResponse, PET_ON_HOLD); + mypet->WipeHateList(); + mypet->SetHeld(true); + } } break; } @@ -10123,6 +10169,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) mypet->SetHeld(false); break; } + case PET_NOCAST_ON: case PET_NOCAST: { if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { if (mypet->IsFeared()) diff --git a/zone/npc.h b/zone/npc.h index 72cc7f38c..e7a72ff11 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -266,6 +266,7 @@ public: void SetPetSpellID(uint16 amt) {pet_spell_id = amt;} uint32 GetMaxDamage(uint8 tlevel); void SetTaunting(bool tog) {taunting = tog;} + bool IsTaunting() const { return taunting; } void PickPocket(Client* thief); void StartSwarmTimer(uint32 duration) { swarm_timer.Start(duration); } void AddLootDrop(const Item_Struct*dbitem, ItemList* itemlistconst, int16 charges, uint8 minlevel, uint8 maxlevel, bool equipit, bool wearchange = false); diff --git a/zone/pets.h b/zone/pets.h index db78accea..243807502 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -1,26 +1,34 @@ #ifndef PETS_H #define PETS_H -#define PET_BACKOFF 1 -#define PET_GETLOST 2 -#define PET_HEALTHREPORT 4 -#define PET_GUARDHERE 5 -#define PET_GUARDME 6 -#define PET_ATTACK 7 -#define PET_FOLLOWME 8 -#define PET_SITDOWN 9 -#define PET_STANDUP 10 -#define PET_TAUNT 11 -#define PET_HOLD 12 -#define PET_NOTAUNT 14 -#define PET_LEADER 16 -#define PET_SLUMBER 17 -#define PET_NOCAST 18 -#define PET_FOCUS 19 -#define PET_FOCUS_ON 25 -#define PET_FOCUS_OFF 26 -#define PET_HOLD_ON 27 -#define PET_HOLD_OFF 28 +// Defines based on the RoF2 Client +#define PET_HEALTHREPORT 0 // 0x00 - /pet health +#define PET_LEADER 1 // 0x01 - /pet leader +#define PET_ATTACK 2 // 0x02 - /pet attack or Pet Window +#define PET_GUARDME 3 // 0x03 - No longer exists? - define not from client +#define PET_FOLLOWME 4 // 0x04 - /pet follow or Pet Window +#define PET_GUARDHERE 5 // 0x05 - /pet guard or Pet Window +#define PET_SIT 6 // 0x06 - /pet sit or Pet Window +#define PET_SITDOWN 7 // 0x07 - /pet sit on +#define PET_STANDUP 8 // 0x08 - /pet sit off +#define PET_STOP 9 // 0x09 - Not implemented? + // Guessing 10 and 11 are PET_STOP_ON and PET_STOP_OFF +#define PET_TAUNT 12 // 0x0c - /pet taunt or Pet Window +#define PET_TAUNT_ON 13 // 0x0d - /pet taunt on +#define PET_TAUNT_OFF 14 // 0x0e - /pet taunt off +#define PET_HOLD 15 // 0x0f - /pet hold +#define PET_HOLD_ON 16 // 0x10 - /pet hold on +#define PET_HOLD_OFF 17 // 0x11 - /pet hold off +#define PET_SLUMBER 18 // 0x12 - What is this? - define not from client + // Guessing 19 and 20 are PET_SLUMBER_ON and PET_SLUMBER_OFF +#define PET_NOCAST 21 // 0x15 - /pet no cast +#define PET_NOCAST_ON 22 // 0x16 - Pet Window No Cast +#define PET_NOCAST_OFF 23 // 0x17 - Guessed +#define PET_FOCUS 24 // 0x18 - /pet focus +#define PET_FOCUS_ON 25 // 0x19 - /pet focus on +#define PET_FOCUS_OFF 26 // 0x1a - /pet focus off +#define PET_BACKOFF 28 // 0x1c - /pet back off +#define PET_GETLOST 29 // 0x1d - /pet get lost class Mob; struct NPCType; From cde406a49656a791f12bb6dbfad9caeaaef794a0 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 6 Jan 2015 13:51:36 -0500 Subject: [PATCH 0745/1883] Add PhR to #showstats and a few places that can/should be implemented in the future. --- zone/client.cpp | 13 +++++++++---- zone/client.h | 3 +++ zone/lua_mob.cpp | 5 +++++ zone/lua_mob.h | 1 + zone/mob.cpp | 2 +- zone/mob.h | 2 +- zone/perl_mob.cpp | 26 ++++++++++++++++++++++++++ 7 files changed, 46 insertions(+), 6 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index c8bbd25cf..143b9271a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6255,6 +6255,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid made_npc->DR = GetDR(); made_npc->PR = GetPR(); made_npc->Corrup = GetCorrup(); + made_npc->PhR = GetPhR(); // looks made_npc->texture = GetEquipmentMaterial(MaterialChest); made_npc->helmtexture = GetEquipmentMaterial(MaterialHead); @@ -6352,7 +6353,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) // Set Class std::string class_Name = itoa(GetClass()); - std::string class_List[] = { "WAR", "CLR", "PAL", "RNG", "SK", "DRU", "MNK", "BRD", "ROG", "SHM", "NEC", "WIZ", "MAG", "ENC", "BST", "BER" }; + std::string class_List[] = { "WAR", "CLR", "PAL", "RNG", "SHD", "DRU", "MNK", "BRD", "ROG", "SHM", "NEC", "WIZ", "MAG", "ENC", "BST", "BER" }; if(GetClass() < 17 && GetClass() > 0) { class_Name = class_List[GetClass()-1]; } @@ -6440,7 +6441,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) /*===========================*/ std::string regen_row_header = ""; std::string regen_row_color = ""; - std::string base_regen_field = ""; + std::string base_regen_field = ""; std::string base_regen_spacing = ""; std::string item_regen_field = ""; std::string item_regen_spacing = ""; @@ -6601,8 +6602,11 @@ void Client::SendStatsWindow(Client* client, bool use_window) } case 6: { a_stat_name = " CHA: "; + a_resist_name = "PhR: "; // Not implemented for clients yet a_stat = itoa(GetCHA()); h_stat = itoa(GetHeroicCHA()); + a_resist = itoa(GetPhR()); + h_resist_field = itoa(GetHeroicPhR()); break; } default: { break; } @@ -6617,8 +6621,9 @@ void Client::SendStatsWindow(Client* client, bool use_window) for(int h = a_resist.size(); h < max_stat_value_len; h++) { a_resist_spacing += " . "; } stat_field += indP + a_stat_name + a_stat_spacing + a_stat + heroic_color + h_stat + ""; + stat_field += h_stat_spacing + a_resist_name + a_resist_spacing + a_resist + heroic_color + h_resist_field + ""; if(stat_row_counter < 6) { - stat_field += h_stat_spacing + a_resist_name + a_resist_spacing + a_resist + heroic_color + h_resist_field + "
"; + stat_field += "
"; } } /*########################################################## @@ -6827,7 +6832,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) client->Message(0, " Haste: %i / %i (Item: %i + Spell: %i + Over: %i)", GetHaste(), RuleI(Character, HasteCap), itembonuses.haste, spellbonuses.haste + spellbonuses.hastetype2, spellbonuses.hastetype3 + ExtraHaste); client->Message(0, " STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA()); client->Message(0, " hSTR: %i hSTA: %i hDEX: %i hAGI: %i hINT: %i hWIS: %i hCHA: %i", GetHeroicSTR(), GetHeroicSTA(), GetHeroicDEX(), GetHeroicAGI(), GetHeroicINT(), GetHeroicWIS(), GetHeroicCHA()); - client->Message(0, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup()); + client->Message(0, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i PhR: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup(), GetPhR()); client->Message(0, " hMR: %i hPR: %i hFR: %i hCR: %i hDR: %i hCorruption: %i", GetHeroicMR(), GetHeroicPR(), GetHeroicFR(), GetHeroicCR(), GetHeroicDR(), GetHeroicCorrup()); client->Message(0, " Shielding: %i Spell Shield: %i DoT Shielding: %i Stun Resist: %i Strikethrough: %i Avoidance: %i Accuracy: %i Combat Effects: %i", GetShielding(), GetSpellShield(), GetDoTShield(), GetStunResist(), GetStrikeThrough(), GetAvoidance(), GetAccuracy(), GetCombatEffects()); client->Message(0, " Heal Amt.: %i Spell Dmg.: %i Clairvoyance: %i DS Mitigation: %i", GetHealAmt(), GetSpellDmg(), GetClair(), GetDSMit()); diff --git a/zone/client.h b/zone/client.h index d6ef83523..fd88848fa 100644 --- a/zone/client.h +++ b/zone/client.h @@ -428,6 +428,7 @@ public: inline virtual int32 GetPR() const { return PR; } inline virtual int32 GetCR() const { return CR; } inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetPhR() const { return PhR; } int32 GetMaxStat() const; int32 GetMaxResist() const; @@ -452,6 +453,7 @@ public: inline uint8 GetBaseAGI() const { return m_pp.AGI; } inline uint8 GetBaseWIS() const { return m_pp.WIS; } inline uint8 GetBaseCorrup() const { return 15; } // Same for all + inline uint8 GetBasePhR() const { return 0; } // Guessing at 0 as base inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } @@ -466,6 +468,7 @@ public: inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicPhR() const { return 0; } // Heroic PhR not implemented yet // Mod2 inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 92afdd8b3..b65cda254 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -576,6 +576,11 @@ int Lua_Mob::GetCorruption() { return self->GetCorrup(); } +int Lua_Mob::GetPhR() { + Lua_Safe_Call_Int(); + return self->GetPhR(); +} + int Lua_Mob::GetMaxSTR() { Lua_Safe_Call_Int(); return self->GetMaxSTR(); diff --git a/zone/lua_mob.h b/zone/lua_mob.h index a5c00c5f0..f272cd440 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -128,6 +128,7 @@ public: int GetPR(); int GetCR(); int GetCorruption(); + int GetPhR(); int GetMaxSTR(); int GetMaxSTA(); int GetMaxDEX(); diff --git a/zone/mob.cpp b/zone/mob.cpp index 79391de5c..3ea572eb6 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1296,7 +1296,7 @@ void Mob::ShowStats(Client* client) client->Message(0, " Mana: %i Max Mana: %i", GetMana(), GetMaxMana()); client->Message(0, " Total ATK: %i Worn/Spell ATK (Cap %i): %i", GetATK(), RuleI(Character, ItemATKCap), GetATKBonus()); client->Message(0, " STR: %i STA: %i DEX: %i AGI: %i INT: %i WIS: %i CHA: %i", GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA()); - client->Message(0, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup()); + client->Message(0, " MR: %i PR: %i FR: %i CR: %i DR: %i Corruption: %i PhR: %i", GetMR(), GetPR(), GetFR(), GetCR(), GetDR(), GetCorrup(), GetPhR()); client->Message(0, " Race: %i BaseRace: %i Texture: %i HelmTexture: %i Gender: %i BaseGender: %i", GetRace(), GetBaseRace(), GetTexture(), GetHelmTexture(), GetGender(), GetBaseGender()); if (client->Admin() >= 100) client->Message(0, " EntityID: %i PetID: %i OwnerID: %i AIControlled: %i Targetted: %i", GetID(), GetPetID(), GetOwnerID(), IsAIControlled(), targeted); diff --git a/zone/mob.h b/zone/mob.h index 47d2cca2f..5997ffeae 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -371,7 +371,7 @@ public: inline virtual int32 GetPR() const { return PR + itembonuses.PR + spellbonuses.PR; } inline virtual int32 GetCR() const { return CR + itembonuses.CR + spellbonuses.CR; } inline virtual int32 GetCorrup() const { return Corrup + itembonuses.Corrup + spellbonuses.Corrup; } - inline virtual int32 GetPhR() const { return PhR; } + inline virtual int32 GetPhR() const { return PhR; } // PhR bonuses not implemented yet inline StatBonuses GetItemBonuses() const { return itembonuses; } inline StatBonuses GetSpellBonuses() const { return spellbonuses; } inline StatBonuses GetAABonuses() const { return aabonuses; } diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 7977c3dd1..633139704 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -2933,6 +2933,32 @@ XS(XS_Mob_GetCorruption) XSRETURN(1); } +XS(XS_Mob_GetPhR); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_GetPhR) +{ + dXSARGS; + if (items != 1) + Perl_croak(aTHX_ "Usage: Mob::GetPhR(THIS)"); + { + Mob * THIS; + int32 RETVAL; + dXSTARG; + + if (sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if (THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetPhR(); + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + XS(XS_Mob_GetMaxSTR); /* prototype to pass -Wmissing-prototypes */ XS(XS_Mob_GetMaxSTR) { From 364f2f6bf81ec24e54fca24d9cff6845a3979378 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 6 Jan 2015 15:09:18 -0500 Subject: [PATCH 0746/1883] Forgot prototype declaration from previous commit. Also fix corruption declaration. --- zone/perl_mob.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 633139704..af07cfcdf 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -8488,7 +8488,8 @@ XS(boot_Mob) newXSproto(strcpy(buf, "GetDR"), XS_Mob_GetDR, file, "$"); newXSproto(strcpy(buf, "GetPR"), XS_Mob_GetPR, file, "$"); newXSproto(strcpy(buf, "GetCR"), XS_Mob_GetCR, file, "$"); - newXSproto(strcpy(buf, "GetCorruption"), XS_Mob_GetCR, file, "$"); + newXSproto(strcpy(buf, "GetCorruption"), XS_Mob_GetCorruption, file, "$"); + newXSproto(strcpy(buf, "GetPhR"), XS_Mob_GetPhR, file, "$"); newXSproto(strcpy(buf, "GetMaxSTR"), XS_Mob_GetMaxSTR, file, "$"); newXSproto(strcpy(buf, "GetMaxSTA"), XS_Mob_GetMaxSTA, file, "$"); newXSproto(strcpy(buf, "GetMaxDEX"), XS_Mob_GetMaxDEX, file, "$"); From 671701460176ea19962e5411ca13ddc296947b5c Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 6 Jan 2015 16:10:29 -0500 Subject: [PATCH 0747/1883] Lua declaration as well... --- zone/lua_mob.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index b65cda254..26bb08f0a 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -1967,6 +1967,7 @@ luabind::scope lua_register_mob() { .def("GetPR", &Lua_Mob::GetPR) .def("GetCR", &Lua_Mob::GetCR) .def("GetCorruption", &Lua_Mob::GetCorruption) + .def("GetPhR", &Lua_Mob::GetPhR) .def("GetMaxSTR", &Lua_Mob::GetMaxSTR) .def("GetMaxSTA", &Lua_Mob::GetMaxSTA) .def("GetMaxDEX", &Lua_Mob::GetMaxDEX) From 2c43e6f68dab213b8b11c10bbf9ec63e9670eac2 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 6 Jan 2015 19:14:06 -0600 Subject: [PATCH 0748/1883] Added defines for all remaining pet commands and some support for them as well. --- changelog.txt | 1 + common/patches/sod.cpp | 8 ++-- common/patches/sof.cpp | 6 ++- common/patches/titanium.cpp | 6 ++- zone/client_packet.cpp | 75 ++++++++++++++++++++++++++++++++++++- zone/pets.h | 27 +++++++------ 6 files changed, 102 insertions(+), 21 deletions(-) diff --git a/changelog.txt b/changelog.txt index 36e19a297..1b5483e73 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 01/06/2015 == Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. Trevius: (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional. +Trevius: Added defines for all remaining pet commands and some support for them as well. == 01/05/2015 == Uleat: Fixed (added translators for) item/text links. Only 'OP_ChannelMessage' and 'OP_SpecialMesg' are currently handled..more text channels will be added as the need arises. diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index a6025b287..910a094d4 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -3121,6 +3121,8 @@ namespace SoD case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -3134,10 +3136,10 @@ namespace SoD emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up - emu->command = 0x09; // Stop? + case 0x0f: // Case Made Up + emu->command = 0x09; // /pet stop break; case 0x0b: emu->command = 0x0d; // /pet taunt or Pet Window diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 5e3dff8b1..70fb34597 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2459,6 +2459,8 @@ namespace SoF case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -2472,9 +2474,9 @@ namespace SoF emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up + case 0x0f: // Case Made Up emu->command = 0x09; // Stop? break; case 0x0b: diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 895f2ee88..eef600795 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1653,6 +1653,8 @@ namespace Titanium case 0x07: emu->command = 0x02; // /pet attack or Pet Window break; + case 0x03: // Case Guessed + emu->command = 0x03; // /pet qattack case 0x08: emu->command = 0x04; // /pet follow or Pet Window break; @@ -1666,9 +1668,9 @@ namespace Titanium emu->command = 0x08; // /pet stand or Pet Window break; case 0x06: - emu->command = 0x03; // /pet guard me + emu->command = 0x1e; // /pet guard me break; - case 0x03: // Case Made Up + case 0x0f: // Case Made Up emu->command = 0x09; // Stop? break; case 0x0b: diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 785abb0c8..c9ec08b30 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9970,6 +9970,31 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_QATTACK: { + if (mypet->IsFeared()) + break; //prevent pet from attacking stuff while feared + + if (!GetTarget()) + break; + if (GetTarget()->IsMezzed()) { + Message_StringID(10, CANNOT_WAKE, mypet->GetCleanName(), GetTarget()->GetCleanName()); + break; + } + + if (!mypet->IsAttackAllowed(GetTarget())) { + mypet->Say_StringID(NOT_LEGAL_TARGET); + break; + } + + if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { + if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + zone->AddAggroMob(); + mypet->AddToHateList(GetTarget(), 1); + Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName()); + } + } + break; + } case PET_BACKOFF: { if (mypet->IsFeared()) break; //keeps pet running while feared @@ -10126,6 +10151,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF if (mypet->GetPetType() != petAnimation) { + // Needs to have an IsSleeping() check added and this case should toggle on/off mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); mypet->SetPetOrder(SPO_Sit); mypet->SetRunAnimSpeed(0); @@ -10135,6 +10161,30 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_SLUMBER_ON: { + if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF + + if (mypet->GetPetType() != petAnimation) { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Sit); + mypet->SetRunAnimSpeed(0); + if (!mypet->UseBardSpellLogic()) //maybe we can have a bard pet + mypet->InterruptSpell(); //No cast 4 u. //i guess the pet should start casting + mypet->SendAppearancePacket(AT_Anim, ANIM_DEATH); + } + break; + } + case PET_SLUMBER_OFF: { + if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF + + if (mypet->GetPetType() != petAnimation) { + mypet->Say_StringID(MT_PetResponse, PET_SIT_STRING); + mypet->SetPetOrder(SPO_Follow); + mypet->SetRunAnimSpeed(mypet->GetBaseRunspeed()); + mypet->SendAppearancePacket(AT_Anim, ANIM_STAND); + } + break; + } case PET_HOLD: { if (GetAA(aaPetDiscipline) && mypet->IsNPC()){ if (mypet->IsFeared()) @@ -10169,8 +10219,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) mypet->SetHeld(false); break; } - case PET_NOCAST_ON: - case PET_NOCAST: { + case PET_SPELLHOLD: { if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { if (mypet->IsFeared()) break; @@ -10185,6 +10234,28 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } break; } + case PET_SPELLHOLD_ON: { + if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { + if (mypet->IsFeared()) + break; + if (!mypet->IsNoCast()) { + Message_StringID(MT_PetResponse, PET_NOT_CASTING); + mypet->CastToNPC()->SetNoCast(true); + } + } + break; + } + case PET_SPELLHOLD_OFF: { + if (GetAA(aaAdvancedPetDiscipline) == 2 && mypet->IsNPC()) { + if (mypet->IsFeared()) + break; + if (mypet->IsNoCast()) { + Message_StringID(MT_PetResponse, PET_CASTING); + mypet->CastToNPC()->SetNoCast(false); + } + } + break; + } case PET_FOCUS: { if (GetAA(aaAdvancedPetDiscipline) >= 1 && mypet->IsNPC()) { if (mypet->IsFeared()) diff --git a/zone/pets.h b/zone/pets.h index 243807502..f0c71fbe7 100644 --- a/zone/pets.h +++ b/zone/pets.h @@ -2,33 +2,36 @@ #define PETS_H // Defines based on the RoF2 Client -#define PET_HEALTHREPORT 0 // 0x00 - /pet health -#define PET_LEADER 1 // 0x01 - /pet leader +#define PET_HEALTHREPORT 0 // 0x00 - /pet health or Pet Window +#define PET_LEADER 1 // 0x01 - /pet leader or Pet Window #define PET_ATTACK 2 // 0x02 - /pet attack or Pet Window -#define PET_GUARDME 3 // 0x03 - No longer exists? - define not from client +#define PET_QATTACK 3 // 0x03 - /pet qattack or Pet Window #define PET_FOLLOWME 4 // 0x04 - /pet follow or Pet Window #define PET_GUARDHERE 5 // 0x05 - /pet guard or Pet Window #define PET_SIT 6 // 0x06 - /pet sit or Pet Window #define PET_SITDOWN 7 // 0x07 - /pet sit on #define PET_STANDUP 8 // 0x08 - /pet sit off -#define PET_STOP 9 // 0x09 - Not implemented? - // Guessing 10 and 11 are PET_STOP_ON and PET_STOP_OFF +#define PET_STOP 9 // 0x09 - /pet stop or Pet Window - Not implemented +#define PET_STOP_ON 10 // 0x0a - /pet stop on - Not implemented +#define PET_STOP_OFF 11 // 0x0b - /pet stop off - Not implemented #define PET_TAUNT 12 // 0x0c - /pet taunt or Pet Window #define PET_TAUNT_ON 13 // 0x0d - /pet taunt on #define PET_TAUNT_OFF 14 // 0x0e - /pet taunt off -#define PET_HOLD 15 // 0x0f - /pet hold +#define PET_HOLD 15 // 0x0f - /pet hold or Pet Window #define PET_HOLD_ON 16 // 0x10 - /pet hold on #define PET_HOLD_OFF 17 // 0x11 - /pet hold off -#define PET_SLUMBER 18 // 0x12 - What is this? - define not from client - // Guessing 19 and 20 are PET_SLUMBER_ON and PET_SLUMBER_OFF -#define PET_NOCAST 21 // 0x15 - /pet no cast -#define PET_NOCAST_ON 22 // 0x16 - Pet Window No Cast -#define PET_NOCAST_OFF 23 // 0x17 - Guessed -#define PET_FOCUS 24 // 0x18 - /pet focus +#define PET_SLUMBER 18 // 0x12 - What activates this? - define guessed +#define PET_SLUMBER_ON 19 // 0x13 - What activates this? - define guessed +#define PET_SLUMBER_OFF 20 // 0x14 - What activates this? - define guessed +#define PET_SPELLHOLD 21 // 0x15 - /pet no cast or /pet spellhold or Pet Window +#define PET_SPELLHOLD_ON 22 // 0x16 - /pet spellhold on +#define PET_SPELLHOLD_OFF 23 // 0x17 - /pet spellhold off +#define PET_FOCUS 24 // 0x18 - /pet focus or Pet Window #define PET_FOCUS_ON 25 // 0x19 - /pet focus on #define PET_FOCUS_OFF 26 // 0x1a - /pet focus off #define PET_BACKOFF 28 // 0x1c - /pet back off #define PET_GETLOST 29 // 0x1d - /pet get lost +#define PET_GUARDME 30 // 0x1e - Same as /pet follow, but different message in older clients - define not from client class Mob; struct NPCType; From b27737bfcdf69dcb7323a71b34c229d4948f43d0 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 6 Jan 2015 23:19:41 -0500 Subject: [PATCH 0749/1883] Rework of the text link translator code (Known bug with broadcast message link size not in OP_ChannelMessage or OP_SpecialMesg) --- common/eq_packet_structs.h | 27 +-- common/patches/rof.cpp | 364 +++-------------------------- common/patches/rof2.cpp | 357 +++------------------------- common/patches/rof2_structs.h | 18 -- common/patches/rof_structs.h | 18 -- common/patches/sod.cpp | 364 ++++------------------------- common/patches/sod_structs.h | 17 -- common/patches/sof.cpp | 364 ++++------------------------- common/patches/sof_structs.h | 17 -- common/patches/titanium.cpp | 363 ++++------------------------ common/patches/titanium_structs.h | 16 -- common/patches/underfoot.cpp | 364 ++++------------------------- common/patches/underfoot_structs.h | 17 -- zone/client.cpp | 128 +++++----- zone/client.h | 3 +- 15 files changed, 304 insertions(+), 2133 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 2c38b5bb0..0c91d96f8 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -5270,19 +5270,20 @@ struct ClientMarqueeMessage_Struct { typedef std::list ItemList; struct TextLinkBody_Struct { - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint32 augment_6; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; + // Current server mask: EQClientRoF2 + uint8 unknown_1; /* %1X */ + uint32 item_id; /* %05X */ + uint32 augment_1; /* %05X */ + uint32 augment_2; /* %05X */ + uint32 augment_3; /* %05X */ + uint32 augment_4; /* %05X */ + uint32 augment_5; /* %05X */ + uint32 augment_6; /* %05X */ + uint8 is_evolving; /* %1X */ + uint32 evolve_group; /* %05X */ + uint8 evolve_level; /* %02X */ + uint32 ornament_icon; /* %05X */ + int hash; /* %08X */ }; // Restore structure packing to default diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 57312d6f0..f65302c36 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -33,17 +33,11 @@ namespace RoF static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct RoFSlot); static inline uint32 RoFToServerCorpseSlot(uint32 RoFCorpse); - // server to client text link converters - static inline void ServerToRoFTextLinks(std::string& rofTextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToRoFTextLinkBodyStruct(structs::TextLinkBody_Struct& rofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateRoFTextLinkBody(std::string& rofLinkBody, const structs::TextLinkBody_Struct& rofLinkBodyStruct); + // server to client text link converter + static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void RoFToServerTextLinks(std::string& serverTextLink, const std::string& rofTextLink); - static inline bool DegenerateRoFTextLinkBody(structs::TextLinkBody_Struct& rofLinkBodyStruct, const std::string& rofLinkBody); - static inline void RoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rofLinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink); void Register(EQStreamIdentifier &into) { @@ -502,7 +496,7 @@ namespace RoF std::string old_message = emu->message; std::string new_message; - ServerToRoFTextLinks(new_message, old_message); + ServerToRoFTextLink(new_message, old_message); //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; @@ -3125,7 +3119,7 @@ namespace RoF std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToRoFTextLinks(new_message, old_message); + ServerToRoFTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -4099,7 +4093,7 @@ namespace RoF std::string old_message = InBuffer; std::string new_message; - RoFToServerTextLinks(new_message, old_message); + RoFToServerTextLink(new_message, old_message); //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -5651,361 +5645,77 @@ namespace RoF return (RoFCorpse - 1); } - static inline void ServerToRoFTextLinks(std::string& rofTextLink, const std::string& serverTextLink) + static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink) { const char delimiter = 0x12; - -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->RoF): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): link size equal, no conversion necessary"); - rofTextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): delimiter not found, no conversion necessary"); - rofTextLink = serverTextLink; - return; - } - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToRoFTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateRoFTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): conversion error"); - rofTextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - rofTextLink.push_back(delimiter); - rofTextLink.append(segments[iter].c_str()); - rofTextLink.push_back(delimiter); - } - else { - rofTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->RoF): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->RoF): new message '%s'", rofTextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { rofTextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToRoFTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) + // Diff: ^ - std::string segment; - if (!GenerateRoFTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 41).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF): conversion error"); - rofTextLink = serverTextLink; - return; - } + if (segments[segment_iter].substr(41, 1) == "0") + new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + else + new_segment.append("F"); + + new_segment.append(segments[segment_iter].substr(43).c_str()); - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { rofTextLink.push_back(delimiter); - rofTextLink.append(segments[iter].c_str()); + rofTextLink.append(new_segment.c_str()); rofTextLink.push_back(delimiter); } else { - rofTextLink.append(segments[iter].c_str()); + rofTextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToRoFTextLinkBodyStruct(structs::TextLinkBody_Struct& rofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - rofLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - rofLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - rofLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - rofLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - rofLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - rofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - rofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - rofLinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; - rofLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - rofLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - rofLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - rofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; - rofLinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateRoFTextLinkBody(std::string& rofLinkBody, const structs::TextLinkBody_Struct& rofLinkBodyStruct) - { - rofLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - rofLinkBodyStruct.unknown_1, - rofLinkBodyStruct.item_id, - rofLinkBodyStruct.augment_1, - rofLinkBodyStruct.augment_2, - rofLinkBodyStruct.augment_3, - rofLinkBodyStruct.augment_4, - rofLinkBodyStruct.augment_5, - rofLinkBodyStruct.augment_6, - rofLinkBodyStruct.is_evolving, - rofLinkBodyStruct.lore_group, - rofLinkBodyStruct.evolve_max, - rofLinkBodyStruct.ornament_icon, - rofLinkBodyStruct.hash - ); - - if (rofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void RoFToServerTextLinks(std::string& serverTextLink, const std::string& rofTextLink) + static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(RoF->Server): old message '%s'", rofTextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): link size equal, no conversion necessary"); - serverTextLink = rofTextLink; - return; - } - - if (rofTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): delimiter not found, no conversion necessary"); - serverTextLink = rofTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(rofTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateRoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - RoFToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): conversion error"); - serverTextLink = rofTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(RoF->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(RoF->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find(delimiter) == std::string::npos)) { serverTextLink = rofTextLink; return; } - bool conversion_error = false; auto segments = SplitString(rofTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateRoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - RoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 42 47 (Source) + // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: ^ - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 41).c_str()); + new_segment.append("0"); + new_segment.append(segments[segment_iter].substr(41).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(RoF->Server): conversion error"); - serverTextLink = rofTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateRoFTextLinkBody(structs::TextLinkBody_Struct& rofLinkBodyStruct, const std::string& rofLinkBody) - { - // RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - memset(&rofLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (rofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - rofLinkBodyStruct.unknown_1 = (uint8)strtol(rofLinkBody.substr(0, 1).c_str(), nullptr, 16); - rofLinkBodyStruct.item_id = (uint32)strtol(rofLinkBody.substr(1, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_1 = (uint32)strtol(rofLinkBody.substr(6, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_2 = (uint32)strtol(rofLinkBody.substr(11, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_3 = (uint32)strtol(rofLinkBody.substr(16, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_4 = (uint32)strtol(rofLinkBody.substr(21, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_5 = (uint32)strtol(rofLinkBody.substr(26, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.augment_6 = (uint32)strtol(rofLinkBody.substr(31, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.is_evolving = (uint8)strtol(rofLinkBody.substr(36, 1).c_str(), nullptr, 16); - rofLinkBodyStruct.lore_group = (uint32)strtol(rofLinkBody.substr(37, 4).c_str(), nullptr, 16); - rofLinkBodyStruct.evolve_max = (uint8)strtol(rofLinkBody.substr(41, 1).c_str(), nullptr, 16); - rofLinkBodyStruct.ornament_icon = (uint32)strtol(rofLinkBody.substr(42, 5).c_str(), nullptr, 16); - rofLinkBodyStruct.hash = (int)strtol(rofLinkBody.substr(47, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void RoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rofLinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = rofLinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = rofLinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = rofLinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = rofLinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = rofLinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = rofLinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = rofLinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = rofLinkBodyStruct.augment_6; - serverLinkBodyStruct.is_evolving = rofLinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = rofLinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = rofLinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = rofLinkBodyStruct.ornament_icon; - serverLinkBodyStruct.hash = rofLinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace RoF diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 9f93c0700..03d919dd8 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -33,17 +33,11 @@ namespace RoF2 static inline uint32 RoF2ToServerMainInvSlot(structs::MainInvItemSlotStruct RoF2Slot); static inline uint32 RoF2ToServerCorpseSlot(uint32 RoF2Corpse); - // server to client text link converters - static inline void ServerToRoF2TextLinks(std::string& rof2TextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToRoF2TextLinkBodyStruct(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateRoF2TextLinkBody(std::string& rof2LinkBody, const structs::TextLinkBody_Struct& rof2LinkBodyStruct); + // server to client text link converter + static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void RoF2ToServerTextLinks(std::string& serverTextLink, const std::string& rof2TextLink); - static inline bool DegenerateRoF2TextLinkBody(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const std::string& rof2LinkBody); - static inline void RoF2ToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rof2LinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink); void Register(EQStreamIdentifier &into) { @@ -568,7 +562,7 @@ namespace RoF2 std::string old_message = emu->message; std::string new_message; - ServerToRoF2TextLinks(new_message, old_message); + ServerToRoF2TextLink(new_message, old_message); //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; @@ -3191,7 +3185,7 @@ namespace RoF2 std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToRoF2TextLinks(new_message, old_message); + ServerToRoF2TextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -4171,7 +4165,7 @@ namespace RoF2 std::string old_message = InBuffer; std::string new_message; - RoF2ToServerTextLinks(new_message, old_message); + RoF2ToServerTextLink(new_message, old_message); //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -5746,361 +5740,68 @@ namespace RoF2 return (RoF2Corpse + EmuConstants::CORPSE_BEGIN - 1); } - static inline void ServerToRoF2TextLinks(std::string& rof2TextLink, const std::string& serverTextLink) + static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): link size equal, no conversion necessary"); - rof2TextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): delimiter not found, no conversion necessary"); - rof2TextLink = serverTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToRoF2TextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateRoF2TextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): conversion error"); - rof2TextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - rof2TextLink.push_back(delimiter); - rof2TextLink.append(segments[iter].c_str()); - rof2TextLink.push_back(delimiter); - } - else { - rof2TextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): new message '%s'", rof2TextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { rof2TextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToRoF2TextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: - std::string segment; - if (!GenerateRoF2TextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter]); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->RoF2): conversion error"); - rof2TextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { rof2TextLink.push_back(delimiter); - rof2TextLink.append(segments[iter].c_str()); + rof2TextLink.append(new_segment.c_str()); rof2TextLink.push_back(delimiter); } else { - rof2TextLink.append(segments[iter].c_str()); + rof2TextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToRoF2TextLinkBodyStruct(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - rof2LinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - rof2LinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - rof2LinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - rof2LinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - rof2LinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - rof2LinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - rof2LinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - rof2LinkBodyStruct.augment_6 = serverLinkBodyStruct.augment_6; - rof2LinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - rof2LinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - rof2LinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - rof2LinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; - rof2LinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateRoF2TextLinkBody(std::string& rof2LinkBody, const structs::TextLinkBody_Struct& rof2LinkBodyStruct) - { - rof2LinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", - rof2LinkBodyStruct.unknown_1, - rof2LinkBodyStruct.item_id, - rof2LinkBodyStruct.augment_1, - rof2LinkBodyStruct.augment_2, - rof2LinkBodyStruct.augment_3, - rof2LinkBodyStruct.augment_4, - rof2LinkBodyStruct.augment_5, - rof2LinkBodyStruct.augment_6, - rof2LinkBodyStruct.is_evolving, - rof2LinkBodyStruct.lore_group, - rof2LinkBodyStruct.evolve_max, - rof2LinkBodyStruct.ornament_icon, - rof2LinkBodyStruct.hash - ); - - if (rof2LinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void RoF2ToServerTextLinks(std::string& serverTextLink, const std::string& rof2TextLink) + static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): old message '%s'", rof2TextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): link size equal, no conversion necessary"); - serverTextLink = rof2TextLink; - return; - } - - if (rof2TextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): delimiter not found, no conversion necessary"); - serverTextLink = rof2TextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(rof2TextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateRoF2TextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - RoF2ToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): conversion error"); - serverTextLink = rof2TextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rof2TextLink.find(delimiter) == std::string::npos)) { serverTextLink = rof2TextLink; return; } - bool conversion_error = false; auto segments = SplitString(rof2TextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateRoF2TextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - RoF2ToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter]); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(RoF2->Server): conversion error"); - serverTextLink = rof2TextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateRoF2TextLinkBody(structs::TextLinkBody_Struct& rof2LinkBodyStruct, const std::string& rof2LinkBody) - { - // RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" - memset(&rof2LinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (rof2LinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - rof2LinkBodyStruct.unknown_1 = (uint8)strtol(rof2LinkBody.substr(0, 1).c_str(), nullptr, 16); - rof2LinkBodyStruct.item_id = (uint32)strtol(rof2LinkBody.substr(1, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_1 = (uint32)strtol(rof2LinkBody.substr(6, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_2 = (uint32)strtol(rof2LinkBody.substr(11, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_3 = (uint32)strtol(rof2LinkBody.substr(16, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_4 = (uint32)strtol(rof2LinkBody.substr(21, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_5 = (uint32)strtol(rof2LinkBody.substr(26, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.augment_6 = (uint32)strtol(rof2LinkBody.substr(31, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.is_evolving = (uint8)strtol(rof2LinkBody.substr(36, 1).c_str(), nullptr, 16); - rof2LinkBodyStruct.lore_group = (uint32)strtol(rof2LinkBody.substr(37, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.evolve_max = (uint8)strtol(rof2LinkBody.substr(42, 1).c_str(), nullptr, 16); - rof2LinkBodyStruct.ornament_icon = (uint32)strtol(rof2LinkBody.substr(43, 5).c_str(), nullptr, 16); - rof2LinkBodyStruct.hash = (int)strtol(rof2LinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void RoF2ToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& rof2LinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = rof2LinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = rof2LinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = rof2LinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = rof2LinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = rof2LinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = rof2LinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = rof2LinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = rof2LinkBodyStruct.augment_6; - serverLinkBodyStruct.is_evolving = rof2LinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = rof2LinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = rof2LinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = rof2LinkBodyStruct.ornament_icon; - serverLinkBodyStruct.hash = rof2LinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace RoF2 diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 0b2de35ab..9ba71574c 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -4872,24 +4872,6 @@ struct MercenaryMerchantResponse_Struct { /*0004*/ }; -// RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint32 augment_6; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; -}; - }; //end namespace structs }; //end namespace RoF2 diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index c5f02dc9b..fb2f09615 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4894,24 +4894,6 @@ struct MercenaryMerchantResponse_Struct { /*0004*/ }; -// RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint32 augment_6; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; -}; - }; //end namespace structs }; //end namespace RoF diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 910a094d4..6982290c8 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -31,17 +31,11 @@ namespace SoD static inline uint32 SoDToServerSlot(uint32 SoDSlot); static inline uint32 SoDToServerCorpseSlot(uint32 SoDCorpse); - // server to client text link converters - static inline void ServerToSoDTextLinks(std::string& sodTextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToSoDTextLinkBodyStruct(structs::TextLinkBody_Struct& sodLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateSoDTextLinkBody(std::string& sodLinkBody, const structs::TextLinkBody_Struct& sodLinkBodyStruct); + // server to client text link converter + static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void SoDToServerTextLinks(std::string& serverTextLink, const std::string& sodTextLink); - static inline bool DegenerateSoDTextLinkBody(structs::TextLinkBody_Struct& sodLinkBodyStruct, const std::string& sodLinkBody); - static inline void SoDToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sodLinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink); void Register(EQStreamIdentifier &into) { @@ -319,7 +313,7 @@ namespace SoD std::string old_message = emu->message; std::string new_message; - ServerToSoDTextLinks(new_message, old_message); + ServerToSoDTextLink(new_message, old_message); in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -2015,7 +2009,7 @@ namespace SoD std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToSoDTextLinks(new_message, old_message); + ServerToSoDTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -2814,7 +2808,7 @@ namespace SoD std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; std::string new_message; - SoDToServerTextLinks(new_message, old_message); + SoDToServerTextLink(new_message, old_message); __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; __packet->pBuffer = new unsigned char[__packet->size]; @@ -3865,358 +3859,80 @@ namespace SoD return (SoDCorpse - 1); } - static inline void ServerToSoDTextLinks(std::string& sodTextLink, const std::string& serverTextLink) + static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->SoD): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): link size equal, no conversion necessary"); - sodTextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): delimiter not found, no conversion necessary"); - sodTextLink = serverTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToSoDTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateSoDTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): conversion error"); - sodTextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - sodTextLink.push_back(delimiter); - sodTextLink.append(segments[iter].c_str()); - sodTextLink.push_back(delimiter); - } - else { - sodTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->SoD): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->SoD): new message '%s'", sodTextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { sodTextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToSoDTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateSoDTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append(segments[segment_iter].substr(36, 5).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->SoD): conversion error"); - sodTextLink = serverTextLink; - return; - } + if (segments[segment_iter].substr(41, 1) == "0") + new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + else + new_segment.append("F"); + + new_segment.append(segments[segment_iter].substr(43).c_str()); - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { sodTextLink.push_back(delimiter); - sodTextLink.append(segments[iter].c_str()); + sodTextLink.append(new_segment.c_str()); sodTextLink.push_back(delimiter); } else { - sodTextLink.append(segments[iter].c_str()); + sodTextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToSoDTextLinkBodyStruct(structs::TextLinkBody_Struct& sodLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - sodLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - sodLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - sodLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - sodLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - sodLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - sodLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - sodLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - sodLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - sodLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - sodLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - sodLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; - sodLinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateSoDTextLinkBody(std::string& sodLinkBody, const structs::TextLinkBody_Struct& sodLinkBodyStruct) - { - sodLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - sodLinkBodyStruct.unknown_1, - sodLinkBodyStruct.item_id, - sodLinkBodyStruct.augment_1, - sodLinkBodyStruct.augment_2, - sodLinkBodyStruct.augment_3, - sodLinkBodyStruct.augment_4, - sodLinkBodyStruct.augment_5, - sodLinkBodyStruct.is_evolving, - sodLinkBodyStruct.lore_group, - sodLinkBodyStruct.evolve_max, - sodLinkBodyStruct.ornament_icon, - sodLinkBodyStruct.hash - ); - - if (sodLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void SoDToServerTextLinks(std::string& serverTextLink, const std::string& sodTextLink) + static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(SoD->Server): old message '%s'", sodTextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): link size equal, no conversion necessary"); - serverTextLink = sodTextLink; - return; - } - - if (sodTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): delimiter not found, no conversion necessary"); - serverTextLink = sodTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(sodTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateSoDTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - SoDToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): conversion error"); - serverTextLink = sodTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(SoD->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(SoD->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sodTextLink.find(delimiter) == std::string::npos)) { serverTextLink = sodTextLink; return; } - bool conversion_error = false; auto segments = SplitString(sodTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateSoDTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - SoDToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append("00000"); + new_segment.append(segments[segment_iter].substr(31, 5).c_str()); + new_segment.append("0"); + new_segment.append(segments[segment_iter].substr(36).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(SoD->Server): conversion error"); - serverTextLink = sodTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateSoDTextLinkBody(structs::TextLinkBody_Struct& sodLinkBodyStruct, const std::string& sodLinkBody) - { - // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - memset(&sodLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (sodLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - sodLinkBodyStruct.unknown_1 = (uint8)strtol(sodLinkBody.substr(0, 1).c_str(), nullptr, 16); - sodLinkBodyStruct.item_id = (uint32)strtol(sodLinkBody.substr(1, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.augment_1 = (uint32)strtol(sodLinkBody.substr(6, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.augment_2 = (uint32)strtol(sodLinkBody.substr(11, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.augment_3 = (uint32)strtol(sodLinkBody.substr(16, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.augment_4 = (uint32)strtol(sodLinkBody.substr(21, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.augment_5 = (uint32)strtol(sodLinkBody.substr(26, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.is_evolving = (uint8)strtol(sodLinkBody.substr(31, 1).c_str(), nullptr, 16); - sodLinkBodyStruct.lore_group = (uint32)strtol(sodLinkBody.substr(32, 4).c_str(), nullptr, 16); - sodLinkBodyStruct.evolve_max = (uint8)strtol(sodLinkBody.substr(36, 1).c_str(), nullptr, 16); - sodLinkBodyStruct.ornament_icon = (uint32)strtol(sodLinkBody.substr(37, 5).c_str(), nullptr, 16); - sodLinkBodyStruct.hash = (int)strtol(sodLinkBody.substr(42, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void SoDToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sodLinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = sodLinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = sodLinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = sodLinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = sodLinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = sodLinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = sodLinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = sodLinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.is_evolving = sodLinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = sodLinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = sodLinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = sodLinkBodyStruct.ornament_icon; - serverLinkBodyStruct.hash = sodLinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace SoD diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 39f81b7c1..24ed9c7cc 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -4409,23 +4409,6 @@ struct MercenaryAssign_Struct { /*0012*/ }; -// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; -}; - }; //end namespace structs }; //end namespace SoD diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 70fb34597..8405f9def 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -31,17 +31,11 @@ namespace SoF static inline uint32 SoFToServerSlot(uint32 SoFSlot); static inline uint32 SoFToServerCorpseSlot(uint32 SoFCorpse); - // server to client text link converters - static inline void ServerToSoFTextLinks(std::string& sofTextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToSoFTextLinkBodyStruct(structs::TextLinkBody_Struct& sofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateSoFTextLinkBody(std::string& sofLinkBody, const structs::TextLinkBody_Struct& sofLinkBodyStruct); + // server to client text link converter + static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void SoFToServerTextLinks(std::string& serverTextLink, const std::string& sofTextLink); - static inline bool DegenerateSoFTextLinkBody(structs::TextLinkBody_Struct& sofLinkBodyStruct, const std::string& sofLinkBody); - static inline void SoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sofLinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink); void Register(EQStreamIdentifier &into) { @@ -301,7 +295,7 @@ namespace SoF std::string old_message = emu->message; std::string new_message; - ServerToSoFTextLinks(new_message, old_message); + ServerToSoFTextLink(new_message, old_message); in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -1661,7 +1655,7 @@ namespace SoF std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToSoFTextLinks(new_message, old_message); + ServerToSoFTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -2214,7 +2208,7 @@ namespace SoF std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; std::string new_message; - SoFToServerTextLinks(new_message, old_message); + SoFToServerTextLink(new_message, old_message); __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; __packet->pBuffer = new unsigned char[__packet->size]; @@ -3187,358 +3181,80 @@ namespace SoF return (SoFCorpse - 1); } - static inline void ServerToSoFTextLinks(std::string& sofTextLink, const std::string& serverTextLink) + static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->SoF): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): link size equal, no conversion necessary"); - sofTextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): delimiter not found, no conversion necessary"); - sofTextLink = serverTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToSoFTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateSoFTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): conversion error"); - sofTextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - sofTextLink.push_back(delimiter); - sofTextLink.append(segments[iter].c_str()); - sofTextLink.push_back(delimiter); - } - else { - sofTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->SoF): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->SoF): new message '%s'", sofTextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { sofTextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToSoFTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateSoFTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append(segments[segment_iter].substr(36, 5).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->SoF): conversion error"); - sofTextLink = serverTextLink; - return; - } + if (segments[segment_iter].substr(41, 1) == "0") + new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + else + new_segment.append("F"); + + new_segment.append(segments[segment_iter].substr(43).c_str()); - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { sofTextLink.push_back(delimiter); - sofTextLink.append(segments[iter].c_str()); + sofTextLink.append(new_segment.c_str()); sofTextLink.push_back(delimiter); } else { - sofTextLink.append(segments[iter].c_str()); + sofTextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToSoFTextLinkBodyStruct(structs::TextLinkBody_Struct& sofLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - sofLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - sofLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - sofLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - sofLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - sofLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - sofLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - sofLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - sofLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - sofLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - sofLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - sofLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; - sofLinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateSoFTextLinkBody(std::string& sofLinkBody, const structs::TextLinkBody_Struct& sofLinkBodyStruct) - { - sofLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - sofLinkBodyStruct.unknown_1, - sofLinkBodyStruct.item_id, - sofLinkBodyStruct.augment_1, - sofLinkBodyStruct.augment_2, - sofLinkBodyStruct.augment_3, - sofLinkBodyStruct.augment_4, - sofLinkBodyStruct.augment_5, - sofLinkBodyStruct.is_evolving, - sofLinkBodyStruct.lore_group, - sofLinkBodyStruct.evolve_max, - sofLinkBodyStruct.ornament_icon, - sofLinkBodyStruct.hash - ); - - if (sofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void SoFToServerTextLinks(std::string& serverTextLink, const std::string& sofTextLink) + static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(SoF->Server): old message '%s'", sofTextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): link size equal, no conversion necessary"); - serverTextLink = sofTextLink; - return; - } - - if (sofTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): delimiter not found, no conversion necessary"); - serverTextLink = sofTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(sofTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateSoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - SoFToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): conversion error"); - serverTextLink = sofTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(SoF->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(SoF->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sofTextLink.find(delimiter) == std::string::npos)) { serverTextLink = sofTextLink; return; } - bool conversion_error = false; auto segments = SplitString(sofTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateSoFTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - SoFToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append("00000"); + new_segment.append(segments[segment_iter].substr(31, 5).c_str()); + new_segment.append("0"); + new_segment.append(segments[segment_iter].substr(36).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(SoF->Server): conversion error"); - serverTextLink = sofTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateSoFTextLinkBody(structs::TextLinkBody_Struct& sofLinkBodyStruct, const std::string& sofLinkBody) - { - // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - memset(&sofLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (sofLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - sofLinkBodyStruct.unknown_1 = (uint8)strtol(sofLinkBody.substr(0, 1).c_str(), nullptr, 16); - sofLinkBodyStruct.item_id = (uint32)strtol(sofLinkBody.substr(1, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.augment_1 = (uint32)strtol(sofLinkBody.substr(6, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.augment_2 = (uint32)strtol(sofLinkBody.substr(11, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.augment_3 = (uint32)strtol(sofLinkBody.substr(16, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.augment_4 = (uint32)strtol(sofLinkBody.substr(21, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.augment_5 = (uint32)strtol(sofLinkBody.substr(26, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.is_evolving = (uint8)strtol(sofLinkBody.substr(31, 1).c_str(), nullptr, 16); - sofLinkBodyStruct.lore_group = (uint32)strtol(sofLinkBody.substr(32, 4).c_str(), nullptr, 16); - sofLinkBodyStruct.evolve_max = (uint8)strtol(sofLinkBody.substr(36, 1).c_str(), nullptr, 16); - sofLinkBodyStruct.ornament_icon = (uint32)strtol(sofLinkBody.substr(37, 5).c_str(), nullptr, 16); - sofLinkBodyStruct.hash = (int)strtol(sofLinkBody.substr(42, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void SoFToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& sofLinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = sofLinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = sofLinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = sofLinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = sofLinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = sofLinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = sofLinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = sofLinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.is_evolving = sofLinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = sofLinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = sofLinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = sofLinkBodyStruct.ornament_icon; - serverLinkBodyStruct.hash = sofLinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace SoF diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index 08d7f6fa6..4e84998b7 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -4115,23 +4115,6 @@ struct AltCurrencySellItem_Struct { /*010*/ uint32 cost; }; -// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; -}; - }; //end namespace structs }; //end namespace SoF diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index eef600795..f40c0266c 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -29,17 +29,11 @@ namespace Titanium static inline uint32 TitaniumToServerSlot(int16 TitaniumSlot); static inline uint32 TitaniumToServerCorpseSlot(int16 TitaniumCorpse); - // server to client text link converters - static inline void ServerToTitaniumTextLinks(std::string& titaniumTextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToTitaniumTextLinkBodyStruct(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateTitaniumTextLinkBody(std::string& titaniumLinkBody, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct); + // server to client text link converter + static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void TitaniumToServerTextLinks(std::string& serverTextLink, const std::string& titaniumTextLink); - static inline bool DegenerateTitaniumTextLinkBody(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const std::string& titaniumLinkBody); - static inline void TitaniumToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink); void Register(EQStreamIdentifier &into) { @@ -244,7 +238,7 @@ namespace Titanium std::string old_message = emu->message; std::string new_message; - ServerToTitaniumTextLinks(new_message, old_message); + ServerToTitaniumTextLink(new_message, old_message); in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -1123,7 +1117,7 @@ namespace Titanium std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToTitaniumTextLinks(new_message, old_message); + ServerToTitaniumTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -1457,7 +1451,7 @@ namespace Titanium std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)]; std::string new_message; - TitaniumToServerTextLinks(new_message, old_message); + TitaniumToServerTextLink(new_message, old_message); __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; __packet->pBuffer = new unsigned char[__packet->size]; @@ -1946,355 +1940,82 @@ namespace Titanium return TitaniumCorpse; } - static inline void ServerToTitaniumTextLinks(std::string& titaniumTextLink, const std::string& serverTextLink) + static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): link size equal, no conversion necessary"); - titaniumTextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): delimiter not found, no conversion necessary"); - titaniumTextLink = serverTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToTitaniumTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateTitaniumTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): conversion error"); - titaniumTextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - titaniumTextLink.push_back(delimiter); - titaniumTextLink.append(segments[iter].c_str()); - titaniumTextLink.push_back(delimiter); - } - else { - titaniumTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): new message '%s'", titaniumTextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { titaniumTextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToTitaniumTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) + // Diff: ^^^^^ ^ ^^^^^ - std::string segment; - if (!GenerateTitaniumTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append(segments[segment_iter].substr(36, 5).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->Titanium): conversion error"); - titaniumTextLink = serverTextLink; - return; - } + if (segments[segment_iter].substr(41, 1) == "0") + new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + else + new_segment.append("F"); + + new_segment.append(segments[segment_iter].substr(48).c_str()); - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { titaniumTextLink.push_back(delimiter); - titaniumTextLink.append(segments[iter].c_str()); + titaniumTextLink.append(new_segment.c_str()); titaniumTextLink.push_back(delimiter); } else { - titaniumTextLink.append(segments[iter].c_str()); + titaniumTextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToTitaniumTextLinkBodyStruct(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - titaniumLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - titaniumLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - titaniumLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - titaniumLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - titaniumLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - titaniumLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - titaniumLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - titaniumLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - titaniumLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - titaniumLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - titaniumLinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateTitaniumTextLinkBody(std::string& titaniumLinkBody, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct) - { - titaniumLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X", - titaniumLinkBodyStruct.unknown_1, - titaniumLinkBodyStruct.item_id, - titaniumLinkBodyStruct.augment_1, - titaniumLinkBodyStruct.augment_2, - titaniumLinkBodyStruct.augment_3, - titaniumLinkBodyStruct.augment_4, - titaniumLinkBodyStruct.augment_5, - titaniumLinkBodyStruct.is_evolving, - titaniumLinkBodyStruct.lore_group, - titaniumLinkBodyStruct.evolve_max, - titaniumLinkBodyStruct.hash - ); - - if (titaniumLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void TitaniumToServerTextLinks(std::string& serverTextLink, const std::string& titaniumTextLink) + static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): old message '%s'", titaniumTextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): link size equal, no conversion necessary"); - serverTextLink = titaniumTextLink; - return; - } - - if (titaniumTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): delimiter not found, no conversion necessary"); - serverTextLink = titaniumTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(titaniumTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateTitaniumTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - TitaniumToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): conversion error"); - serverTextLink = titaniumTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (titaniumTextLink.find(delimiter) == std::string::npos)) { serverTextLink = titaniumTextLink; return; } - bool conversion_error = false; auto segments = SplitString(titaniumTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateTitaniumTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - TitaniumToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 32 36 37 (Source) + // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: ^^^^^ ^ ^^^^^ - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append("00000"); + new_segment.append(segments[segment_iter].substr(31, 5).c_str()); + new_segment.append("0"); + new_segment.append(segments[segment_iter].substr(36, 1).c_str()); + new_segment.append("00000"); + new_segment.append(segments[segment_iter].substr(37).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Titanium->Server): conversion error"); - serverTextLink = titaniumTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateTitaniumTextLinkBody(structs::TextLinkBody_Struct& titaniumLinkBodyStruct, const std::string& titaniumLinkBody) - { - // 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" - memset(&titaniumLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (titaniumLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - titaniumLinkBodyStruct.unknown_1 = (uint8)strtol(titaniumLinkBody.substr(0, 1).c_str(), nullptr, 16); - titaniumLinkBodyStruct.item_id = (uint32)strtol(titaniumLinkBody.substr(1, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.augment_1 = (uint32)strtol(titaniumLinkBody.substr(6, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.augment_2 = (uint32)strtol(titaniumLinkBody.substr(11, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.augment_3 = (uint32)strtol(titaniumLinkBody.substr(16, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.augment_4 = (uint32)strtol(titaniumLinkBody.substr(21, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.augment_5 = (uint32)strtol(titaniumLinkBody.substr(26, 5).c_str(), nullptr, 16); - titaniumLinkBodyStruct.is_evolving = (uint8)strtol(titaniumLinkBody.substr(31, 1).c_str(), nullptr, 16); - titaniumLinkBodyStruct.lore_group = (uint32)strtol(titaniumLinkBody.substr(32, 4).c_str(), nullptr, 16); - titaniumLinkBodyStruct.evolve_max = (uint8)strtol(titaniumLinkBody.substr(36, 1).c_str(), nullptr, 16); - titaniumLinkBodyStruct.hash = (int)strtol(titaniumLinkBody.substr(37, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void TitaniumToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& titaniumLinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = titaniumLinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = titaniumLinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = titaniumLinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = titaniumLinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = titaniumLinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = titaniumLinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = titaniumLinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.is_evolving = titaniumLinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = titaniumLinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = titaniumLinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = NOT_USED; - serverLinkBodyStruct.hash = titaniumLinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace Titanium diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 06536c7c2..7d21ba998 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -3329,22 +3329,6 @@ struct LFGuild_GuildToggle_Struct /*616*/ }; -// 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - int hash; -}; - }; //end namespace structs }; //end namespace Titanium diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index b525a3c46..1ebd8dc8d 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -31,17 +31,11 @@ namespace Underfoot static inline uint32 UnderfootToServerSlot(uint32 UnderfootSlot); static inline uint32 UnderfootToServerCorpseSlot(uint32 UnderfootCorpse); - // server to client text link converters - static inline void ServerToUnderfootTextLinks(std::string& underfootTextLink, const std::string& serverTextLink); - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody); - static inline void ServerToUnderfootTextLinkBodyStruct(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct); - static inline bool GenerateUnderfootTextLinkBody(std::string& underfootLinkBody, const structs::TextLinkBody_Struct& underfootLinkBodyStruct); + // server to client text link converter + static inline void ServerToUnderfootTextLink(std::string& underfootTextLink, const std::string& serverTextLink); - // client to server text link converters - static inline void UnderfootToServerTextLinks(std::string& serverTextLink, const std::string& underfootTextLink); - static inline bool DegenerateUnderfootTextLinkBody(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const std::string& underfootLinkBody); - static inline void UnderfootToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& underfootLinkBodyStruct); - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct); + // client to server text link converter + static inline void UnderfootToServerTextLink(std::string& serverTextLink, const std::string& underfootTextLink); void Register(EQStreamIdentifier &into) { @@ -446,7 +440,7 @@ namespace Underfoot std::string old_message = emu->message; std::string new_message; - ServerToUnderfootTextLinks(new_message, old_message); + ServerToUnderfootTextLink(new_message, old_message); //in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36; in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39; @@ -2326,7 +2320,7 @@ namespace Underfoot std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; - ServerToUnderfootTextLinks(new_message, old_message); + ServerToUnderfootTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; in->size = 25 + strlen(emu->sayer) + new_message.length(); @@ -3093,7 +3087,7 @@ namespace Underfoot std::string old_message = InBuffer; std::string new_message; - UnderfootToServerTextLinks(new_message, old_message); + UnderfootToServerTextLink(new_message, old_message); //__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1; __packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1; @@ -4168,358 +4162,80 @@ namespace Underfoot return (UnderfootCorpse - 1); } - static inline void ServerToUnderfootTextLinks(std::string& underfootTextLink, const std::string& serverTextLink) + static inline void ServerToUnderfootTextLink(std::string& underfootTextLink, const std::string& serverTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): old message '%s'", serverTextLink.c_str()); - - if (consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): link size equal, no conversion necessary"); - underfootTextLink = serverTextLink; - return; - } - - if (serverTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): delimiter not found, no conversion necessary"); - underfootTextLink = serverTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(serverTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body degeneration error '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body degeneration success '%s'", segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - } - - structs::TextLinkBody_Struct new_body_data; - ServerToUnderfootTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateUnderfootTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): conversion error"); - underfootTextLink = serverTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - underfootTextLink.push_back(delimiter); - underfootTextLink.append(segments[iter].c_str()); - underfootTextLink.push_back(delimiter); - } - else { - underfootTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): new message '%s'", underfootTextLink.c_str()); -#else if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { underfootTextLink = serverTextLink; return; } - bool conversion_error = false; auto segments = SplitString(serverTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - TextLinkBody_Struct old_body_data; - if (!DegenerateServerTextLinkBody(old_body_data, segments[iter].substr(0, EmuConstants::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - structs::TextLinkBody_Struct new_body_data; - ServerToUnderfootTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateUnderfootTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(EmuConstants::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append(segments[segment_iter].substr(36, 5).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Server->Underfoot): conversion error"); - underfootTextLink = serverTextLink; - return; - } + if (segments[segment_iter].substr(41, 1) == "0") + new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + else + new_segment.append("F"); + + new_segment.append(segments[segment_iter].substr(43).c_str()); - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { underfootTextLink.push_back(delimiter); - underfootTextLink.append(segments[iter].c_str()); + underfootTextLink.append(new_segment.c_str()); underfootTextLink.push_back(delimiter); } else { - underfootTextLink.append(segments[iter].c_str()); + underfootTextLink.append(segments[segment_iter].c_str()); } } -#endif } - static inline bool DegenerateServerTextLinkBody(TextLinkBody_Struct& serverLinkBodyStruct, const std::string& serverLinkBody) - { - memset(&serverLinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - - serverLinkBodyStruct.unknown_1 = (uint8)strtol(serverLinkBody.substr(0, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.item_id = (uint32)strtol(serverLinkBody.substr(1, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_1 = (uint32)strtol(serverLinkBody.substr(6, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_2 = (uint32)strtol(serverLinkBody.substr(11, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_3 = (uint32)strtol(serverLinkBody.substr(16, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_4 = (uint32)strtol(serverLinkBody.substr(21, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_5 = (uint32)strtol(serverLinkBody.substr(26, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.augment_6 = (uint32)strtol(serverLinkBody.substr(31, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.is_evolving = (uint8)strtol(serverLinkBody.substr(36, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.lore_group = (uint32)strtol(serverLinkBody.substr(37, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.evolve_max = (uint8)strtol(serverLinkBody.substr(42, 1).c_str(), nullptr, 16); - serverLinkBodyStruct.ornament_icon = (uint32)strtol(serverLinkBody.substr(43, 5).c_str(), nullptr, 16); - serverLinkBodyStruct.hash = (int)strtol(serverLinkBody.substr(48, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void ServerToUnderfootTextLinkBodyStruct(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const TextLinkBody_Struct& serverLinkBodyStruct) - { - underfootLinkBodyStruct.unknown_1 = serverLinkBodyStruct.unknown_1; - underfootLinkBodyStruct.item_id = serverLinkBodyStruct.item_id; - underfootLinkBodyStruct.augment_1 = serverLinkBodyStruct.augment_1; - underfootLinkBodyStruct.augment_2 = serverLinkBodyStruct.augment_2; - underfootLinkBodyStruct.augment_3 = serverLinkBodyStruct.augment_3; - underfootLinkBodyStruct.augment_4 = serverLinkBodyStruct.augment_4; - underfootLinkBodyStruct.augment_5 = serverLinkBodyStruct.augment_5; - underfootLinkBodyStruct.is_evolving = serverLinkBodyStruct.is_evolving; - underfootLinkBodyStruct.lore_group = serverLinkBodyStruct.lore_group; - underfootLinkBodyStruct.evolve_max = serverLinkBodyStruct.evolve_max; - underfootLinkBodyStruct.ornament_icon = serverLinkBodyStruct.ornament_icon; - underfootLinkBodyStruct.hash = serverLinkBodyStruct.hash; - } - - static inline bool GenerateUnderfootTextLinkBody(std::string& underfootLinkBody, const structs::TextLinkBody_Struct& underfootLinkBodyStruct) - { - underfootLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", - underfootLinkBodyStruct.unknown_1, - underfootLinkBodyStruct.item_id, - underfootLinkBodyStruct.augment_1, - underfootLinkBodyStruct.augment_2, - underfootLinkBodyStruct.augment_3, - underfootLinkBodyStruct.augment_4, - underfootLinkBodyStruct.augment_5, - underfootLinkBodyStruct.is_evolving, - underfootLinkBodyStruct.lore_group, - underfootLinkBodyStruct.evolve_max, - underfootLinkBodyStruct.ornament_icon, - underfootLinkBodyStruct.hash - ); - - if (underfootLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - return true; - } - - static inline void UnderfootToServerTextLinks(std::string& serverTextLink, const std::string& underfootTextLink) + static inline void UnderfootToServerTextLink(std::string& serverTextLink, const std::string& underfootTextLink) { const char delimiter = 0x12; -#if EQDEBUG >= 6 - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): old message '%s'", underfootTextLink.c_str()); - - if (EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): link size equal, no conversion necessary"); - serverTextLink = underfootTextLink; - return; - } - - if (underfootTextLink.find(delimiter) == std::string::npos) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): delimiter not found, no conversion necessary"); - serverTextLink = underfootTextLink; - return; - } - - bool conversion_error = false; - auto segments = SplitString(underfootTextLink, delimiter); - - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateUnderfootTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body degeneration error '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body degeneration success '%s'", segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str()); - } - - TextLinkBody_Struct new_body_data; - UnderfootToServerTextLinkBodyStruct(new_body_data, old_body_data); - - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body generation error '%s'", segment.c_str()); - conversion_error = true; - } - else { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): body generation success '%s'", segment.c_str()); - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } - - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): conversion error"); - serverTextLink = underfootTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { - serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); - serverTextLink.push_back(delimiter); - } - else { - serverTextLink.append(segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): segment[%u] '%s'", iter, segments[iter].c_str()); - } - - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): new message '%s'", serverTextLink.c_str()); -#else if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (underfootTextLink.find(delimiter) == std::string::npos)) { serverTextLink = underfootTextLink; return; } - bool conversion_error = false; auto segments = SplitString(underfootTextLink, delimiter); - for (size_t iter = 1; iter < segments.size(); iter += 2) { - structs::TextLinkBody_Struct old_body_data; - if (!DegenerateUnderfootTextLinkBody(old_body_data, segments[iter].substr(0, consts::TEXT_LINK_BODY_LENGTH).c_str())) { - conversion_error = true; - break; - } + for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { + if (segment_iter & 1) { + std::string new_segment; - TextLinkBody_Struct new_body_data; - UnderfootToServerTextLinkBodyStruct(new_body_data, old_body_data); + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) + // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) + // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) + // Diff: ^^^^^ ^ - std::string segment; - if (!GenerateServerTextLinkBody(segment, new_body_data)) { - conversion_error = true; - break; - } - else { - segment.append(segments[iter].substr(consts::TEXT_LINK_BODY_LENGTH).c_str()); - segments[iter] = segment.c_str(); - } - } + new_segment.append(segments[segment_iter].substr(0, 31).c_str()); + new_segment.append("00000"); + new_segment.append(segments[segment_iter].substr(31, 5).c_str()); + new_segment.append("0"); + new_segment.append(segments[segment_iter].substr(36).c_str()); - if (conversion_error) { - _log(CHANNELS__ERROR, "TextLink(Underfoot->Server): conversion error"); - serverTextLink = underfootTextLink; - return; - } - - for (size_t iter = 0; iter < segments.size(); ++iter) { - if (iter & 1) { serverTextLink.push_back(delimiter); - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(new_segment.c_str()); serverTextLink.push_back(delimiter); } else { - serverTextLink.append(segments[iter].c_str()); + serverTextLink.append(segments[segment_iter].c_str()); } } -#endif - } - - static inline bool DegenerateUnderfootTextLinkBody(structs::TextLinkBody_Struct& underfootLinkBodyStruct, const std::string& underfootLinkBody) - { - // SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" - memset(&underfootLinkBodyStruct, 0, sizeof(structs::TextLinkBody_Struct)); - if (underfootLinkBody.length() != consts::TEXT_LINK_BODY_LENGTH) { return false; } - - underfootLinkBodyStruct.unknown_1 = (uint8)strtol(underfootLinkBody.substr(0, 1).c_str(), nullptr, 16); - underfootLinkBodyStruct.item_id = (uint32)strtol(underfootLinkBody.substr(1, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.augment_1 = (uint32)strtol(underfootLinkBody.substr(6, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.augment_2 = (uint32)strtol(underfootLinkBody.substr(11, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.augment_3 = (uint32)strtol(underfootLinkBody.substr(16, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.augment_4 = (uint32)strtol(underfootLinkBody.substr(21, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.augment_5 = (uint32)strtol(underfootLinkBody.substr(26, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.is_evolving = (uint8)strtol(underfootLinkBody.substr(31, 1).c_str(), nullptr, 16); - underfootLinkBodyStruct.lore_group = (uint32)strtol(underfootLinkBody.substr(32, 4).c_str(), nullptr, 16); - underfootLinkBodyStruct.evolve_max = (uint8)strtol(underfootLinkBody.substr(36, 1).c_str(), nullptr, 16); - underfootLinkBodyStruct.ornament_icon = (uint32)strtol(underfootLinkBody.substr(37, 5).c_str(), nullptr, 16); - underfootLinkBodyStruct.hash = (int)strtol(underfootLinkBody.substr(42, 8).c_str(), nullptr, 16); - - return true; - } - - static inline void UnderfootToServerTextLinkBodyStruct(TextLinkBody_Struct& serverLinkBodyStruct, const structs::TextLinkBody_Struct& underfootLinkBodyStruct) - { - serverLinkBodyStruct.unknown_1 = underfootLinkBodyStruct.unknown_1; - serverLinkBodyStruct.item_id = underfootLinkBodyStruct.item_id; - serverLinkBodyStruct.augment_1 = underfootLinkBodyStruct.augment_1; - serverLinkBodyStruct.augment_2 = underfootLinkBodyStruct.augment_2; - serverLinkBodyStruct.augment_3 = underfootLinkBodyStruct.augment_3; - serverLinkBodyStruct.augment_4 = underfootLinkBodyStruct.augment_4; - serverLinkBodyStruct.augment_5 = underfootLinkBodyStruct.augment_5; - serverLinkBodyStruct.augment_6 = NOT_USED; - serverLinkBodyStruct.is_evolving = underfootLinkBodyStruct.is_evolving; - serverLinkBodyStruct.lore_group = underfootLinkBodyStruct.lore_group; - serverLinkBodyStruct.evolve_max = underfootLinkBodyStruct.evolve_max; - serverLinkBodyStruct.ornament_icon = underfootLinkBodyStruct.ornament_icon; - serverLinkBodyStruct.hash = underfootLinkBodyStruct.hash; - } - - static inline bool GenerateServerTextLinkBody(std::string& serverLinkBody, const TextLinkBody_Struct& serverLinkBodyStruct) - { - serverLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%01X" "%05X" "%01X" "%05X" "%08X", - serverLinkBodyStruct.unknown_1, - serverLinkBodyStruct.item_id, - serverLinkBodyStruct.augment_1, - serverLinkBodyStruct.augment_2, - serverLinkBodyStruct.augment_3, - serverLinkBodyStruct.augment_4, - serverLinkBodyStruct.augment_5, - serverLinkBodyStruct.augment_6, - serverLinkBodyStruct.is_evolving, - serverLinkBodyStruct.lore_group, - serverLinkBodyStruct.evolve_max, - serverLinkBodyStruct.ornament_icon, - serverLinkBodyStruct.hash - ); - - if (serverLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } - return true; } } // end namespace Underfoot diff --git a/common/patches/underfoot_structs.h b/common/patches/underfoot_structs.h index b196e5867..3a63a8c0f 100644 --- a/common/patches/underfoot_structs.h +++ b/common/patches/underfoot_structs.h @@ -4530,23 +4530,6 @@ struct MercenaryAssign_Struct { /*0012*/ }; -// SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" -struct TextLinkBody_Struct -{ - uint8 unknown_1; - uint32 item_id; - uint32 augment_1; - uint32 augment_2; - uint32 augment_3; - uint32 augment_4; - uint32 augment_5; - uint8 is_evolving; - uint32 lore_group; - uint8 evolve_max; - uint32 ornament_icon; - int hash; -}; - }; //end namespace structs }; //end namespace Underfoot diff --git a/zone/client.cpp b/zone/client.cpp index 143b9271a..8b82f77cf 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8317,27 +8317,13 @@ void Client::TextLink::generate_body() /* Current server mask: EQClientRoF2 - RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X" (56) - RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) - SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) - 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45) + RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X" (56) + RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55) + SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50) + 6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45) */ - // could use a ##_cast(&this) with a memset to '0' since these properties are inherited - - unknown_1 = NOT_USED; /* field 1 */ - item_id = NOT_USED; /* field 2 */ - augment_1 = NOT_USED; /* field 3 */ - augment_2 = NOT_USED; /* field 4 */ - augment_3 = NOT_USED; /* field 5 */ - augment_4 = NOT_USED; /* field 6 */ - augment_5 = NOT_USED; /* field 7 */ - augment_6 = NOT_USED; /* field 8 */ - is_evolving = NOT_USED; /* field 9 */ - lore_group = NOT_USED; /* field 10 */ - evolve_max = NOT_USED; /* field 11 */ - ornament_icon = NOT_USED; /* field 12 */ - hash = NOT_USED; /* field 13 */ + memset(&m_LinkBodyStruct, 0, sizeof(TextLinkBody_Struct)); const Item_Struct* item_data = nullptr; @@ -8346,33 +8332,40 @@ void Client::TextLink::generate_body() break; case linkItemData: if (m_ItemData == nullptr) { break; } - item_id = m_ItemData->ID; + m_LinkBodyStruct.item_id = m_ItemData->ID; + m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items + //m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel; // TODO: add hash call break; case linkLootItem: if (m_LootData == nullptr) { break; } item_data = database.GetItem(m_LootData->item_id); if (item_data == nullptr) { break; } - item_id = item_data->ID; - augment_1 = m_LootData->aug_1; - augment_2 = m_LootData->aug_2; - augment_3 = m_LootData->aug_3; - augment_4 = m_LootData->aug_4; - augment_5 = m_LootData->aug_5; - augment_6 = m_LootData->aug_6; + m_LinkBodyStruct.item_id = item_data->ID; + m_LinkBodyStruct.augment_1 = m_LootData->aug_1; + m_LinkBodyStruct.augment_2 = m_LootData->aug_2; + m_LinkBodyStruct.augment_3 = m_LootData->aug_3; + m_LinkBodyStruct.augment_4 = m_LootData->aug_4; + m_LinkBodyStruct.augment_5 = m_LootData->aug_5; + m_LinkBodyStruct.augment_6 = m_LootData->aug_6; + m_LinkBodyStruct.evolve_group = item_data->LoreGroup; // see note above + //m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel; // TODO: add hash call break; case linkItemInst: if (m_ItemInst == nullptr) { break; } if (m_ItemInst->GetItem() == nullptr) { break; } - item_id = m_ItemInst->GetItem()->ID; - augment_1 = m_ItemInst->GetAugmentItemID(0); - augment_2 = m_ItemInst->GetAugmentItemID(1); - augment_3 = m_ItemInst->GetAugmentItemID(2); - augment_4 = m_ItemInst->GetAugmentItemID(3); - augment_5 = m_ItemInst->GetAugmentItemID(4); - augment_6 = m_ItemInst->GetAugmentItemID(5); - ornament_icon = m_ItemInst->GetOrnamentationIcon(); + m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID; + m_LinkBodyStruct.augment_1 = m_ItemInst->GetAugmentItemID(0); + m_LinkBodyStruct.augment_2 = m_ItemInst->GetAugmentItemID(1); + m_LinkBodyStruct.augment_3 = m_ItemInst->GetAugmentItemID(2); + m_LinkBodyStruct.augment_4 = m_ItemInst->GetAugmentItemID(3); + m_LinkBodyStruct.augment_5 = m_ItemInst->GetAugmentItemID(4); + m_LinkBodyStruct.augment_6 = m_ItemInst->GetAugmentItemID(5); + m_LinkBodyStruct.is_evolving = (m_ItemInst->IsEvolving() ? 1 : 0); + m_LinkBodyStruct.evolve_group = m_ItemInst->GetItem()->LoreGroup; // see note above + m_LinkBodyStruct.evolve_level = m_ItemInst->GetEvolveLvl(); + m_LinkBodyStruct.ornament_icon = m_ItemInst->GetOrnamentationIcon(); // TODO: add hash call break; default: @@ -8380,29 +8373,28 @@ void Client::TextLink::generate_body() } if (m_ProxyItemID != NOT_USED) { - item_id = m_ProxyItemID; + m_LinkBodyStruct.item_id = m_ProxyItemID; } if (m_TaskUse) { - //hash = 0x0000000014505DC2; - hash = 0x14505DC2; + m_LinkBodyStruct.hash = 0x14505DC2; } m_LinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", - unknown_1, - item_id, - augment_1, - augment_2, - augment_3, - augment_4, - augment_5, - augment_6, - is_evolving, - lore_group, - evolve_max, - ornament_icon, - hash + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X", + (0x0F & m_LinkBodyStruct.unknown_1), + (0x000FFFFF & m_LinkBodyStruct.item_id), + (0x000FFFFF & m_LinkBodyStruct.augment_1), + (0x000FFFFF & m_LinkBodyStruct.augment_2), + (0x000FFFFF & m_LinkBodyStruct.augment_3), + (0x000FFFFF & m_LinkBodyStruct.augment_4), + (0x000FFFFF & m_LinkBodyStruct.augment_5), + (0x000FFFFF & m_LinkBodyStruct.augment_6), + (0x0F & m_LinkBodyStruct.is_evolving), + (0x0000FFFF & m_LinkBodyStruct.evolve_group), + (0xFF & m_LinkBodyStruct.evolve_level), + (0x000FFFFF & m_LinkBodyStruct.ornament_icon), + (0xFFFFFFFF & m_LinkBodyStruct.hash) ); } @@ -8454,8 +8446,8 @@ bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruc textLinkBodyStruct.augment_5 = (uint32)strtol(textLinkBody.substr(26, 5).c_str(), nullptr, 16); textLinkBodyStruct.augment_6 = (uint32)strtol(textLinkBody.substr(31, 5).c_str(), nullptr, 16); textLinkBodyStruct.is_evolving = (uint8)strtol(textLinkBody.substr(36, 1).c_str(), nullptr, 16); - textLinkBodyStruct.lore_group = (uint32)strtol(textLinkBody.substr(37, 5).c_str(), nullptr, 16); - textLinkBodyStruct.evolve_max = (uint8)strtol(textLinkBody.substr(42, 1).c_str(), nullptr, 16); + textLinkBodyStruct.evolve_group = (uint32)strtol(textLinkBody.substr(37, 4).c_str(), nullptr, 16); + textLinkBodyStruct.evolve_level = (uint8)strtol(textLinkBody.substr(41, 2).c_str(), nullptr, 16); textLinkBodyStruct.ornament_icon = (uint32)strtol(textLinkBody.substr(43, 5).c_str(), nullptr, 16); textLinkBodyStruct.hash = (int)strtol(textLinkBody.substr(48, 8).c_str(), nullptr, 16); @@ -8465,20 +8457,20 @@ bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruc bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct) { textLinkBody = StringFormat( - "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%05X" "%1X" "%05X" "%08X", - textLinkBodyStruct.unknown_1, - textLinkBodyStruct.item_id, - textLinkBodyStruct.augment_1, - textLinkBodyStruct.augment_2, - textLinkBodyStruct.augment_3, - textLinkBodyStruct.augment_4, - textLinkBodyStruct.augment_5, - textLinkBodyStruct.augment_6, - textLinkBodyStruct.is_evolving, - textLinkBodyStruct.lore_group, - textLinkBodyStruct.evolve_max, - textLinkBodyStruct.ornament_icon, - textLinkBodyStruct.hash + "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X", + (0x0F & textLinkBodyStruct.unknown_1), + (0x000FFFFF & textLinkBodyStruct.item_id), + (0x000FFFFF & textLinkBodyStruct.augment_1), + (0x000FFFFF & textLinkBodyStruct.augment_2), + (0x000FFFFF & textLinkBodyStruct.augment_3), + (0x000FFFFF & textLinkBodyStruct.augment_4), + (0x000FFFFF & textLinkBodyStruct.augment_5), + (0x000FFFFF & textLinkBodyStruct.augment_6), + (0x0F & textLinkBodyStruct.is_evolving), + (0x0000FFFF & textLinkBodyStruct.evolve_group), + (0xFF & textLinkBodyStruct.evolve_level), + (0x000FFFFF & textLinkBodyStruct.ornament_icon), + (0xFFFFFFFF & textLinkBodyStruct.hash) ); if (textLinkBody.length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { return false; } diff --git a/zone/client.h b/zone/client.h index fd88848fa..22b413b50 100644 --- a/zone/client.h +++ b/zone/client.h @@ -822,7 +822,7 @@ public: // // class Client::TextLink // - class TextLink : TextLinkBody_Struct { + class TextLink { public: enum LinkType { linkBlank = 0, linkItemData, linkLootItem, linkItemInst }; @@ -859,6 +859,7 @@ public: uint32 m_ProxyItemID; const char* m_ProxyText; bool m_TaskUse; + TextLinkBody_Struct m_LinkBodyStruct; std::string m_Link; std::string m_LinkBody; std::string m_LinkText; From 66cc498421b14c1c31d640c9b66e964733b4e9e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 7 Jan 2015 08:45:04 -0600 Subject: [PATCH 0750/1883] Added colors to windows consoles, the logging system still needs to be overhauled but this crap code should make debugging easier until the rest of it is cleaned up --- common/debug.cpp | 117 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 3b283240a..a02aeaa34 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -9,6 +9,31 @@ #define strncasecmp _strnicmp #define strcasecmp _stricmp + #include + #include + #include + +namespace ConsoleColor { + enum Colors { + Black = 0, + Blue = 1, + Green = 2, + Cyan = 3, + Red = 4, + Magenta = 5, + Brown = 6, + LightGray = 7, + DarkGray = 8, + LightBlue = 9, + LightGreen = 10, + LightCyan = 11, + LightRed = 12, + LightMagenta = 13, + Yellow = 14, + White = 15, + }; +} + #else #include @@ -156,15 +181,45 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] ", LogNames[id]); vfprintf( stderr, fmt, argptr ); - } else { + } + /* This is what's outputted to console */ + else { + +#ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + + if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } +#endif + fprintf(stdout, "[%s] ", LogNames[id]); vfprintf( stdout, fmt, argptr ); + +#ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); +#endif } } va_end(argptr); if (dofile) { fprintf(fp[id], "\n"); } + + /* Print Lind Endings */ if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "\n"); @@ -223,9 +278,38 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] %s", LogNames[id], prefix); vfprintf( stderr, fmt, argptr ); - } else { + } + /* Console Output */ + else { + + +#ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + + if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } +#endif + fprintf(stdout, "[%s] %s", LogNames[id], prefix); - vfprintf( stdout, fmt, argptr ); + vfprintf(stdout, fmt, argptr); + +#ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); +#endif } } va_end(argptr); @@ -288,9 +372,36 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) fwrite(buf, size, count, stderr); fprintf(stderr, "\n"); } else { +#ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + + if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } +#endif + fprintf(stdout, "[%s] ", LogNames[id]); fwrite(buf, size, count, stdout); fprintf(stdout, "\n"); + +#ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); +#endif + + } } if (dofile) { From 0552220f00988c55e4f43a78af31603b485b4a88 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 7 Jan 2015 11:13:48 -0500 Subject: [PATCH 0751/1883] Excluded text link body from message scrambling in Client::GarbleMessage() --- changelog.txt | 3 +++ zone/client.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/changelog.txt b/changelog.txt index 1b5483e73..42fe19a31 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/07/2015 == +Uleat: Excluded text link body from message scrambling in Client::GarbleMessage() + == 01/06/2015 == Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. Trevius: (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional. diff --git a/zone/client.cpp b/zone/client.cpp index 8b82f77cf..aae809f60 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7470,8 +7470,17 @@ void Client::GarbleMessage(char *message, uint8 variance) { // Garble message by variance% const char alpha_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; // only change alpha characters for now + const char delimiter = 0x12; + int delimiter_count = 0; for (size_t i = 0; i < strlen(message); i++) { + // Client expects hex values inside of a text link body + if (message[i] == delimiter) { + if (!(delimiter_count & 1)) { i += EmuConstants::TEXT_LINK_BODY_LENGTH; } + ++delimiter_count; + continue; + } + uint8 chance = (uint8)zone->random.Int(0, 115); // variation just over worst possible scrambling if (isalpha(message[i]) && (chance <= variance)) { uint8 rand_char = (uint8)zone->random.Int(0,51); // choose a random character from the alpha list From a83d536712fff1db8407fb53930552d699639020 Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 7 Jan 2015 22:20:44 -0600 Subject: [PATCH 0752/1883] Mercenaries now load directly from tables only. The vwMercNpcTypes view is no longer required and can be deleted. --- changelog.txt | 1 + common/patches/rof2_structs.h | 6 +++ common/shareddb.cpp | 12 +++-- zone/zonedb.cpp | 98 +++++++++++++++++++++++++---------- 4 files changed, 86 insertions(+), 31 deletions(-) diff --git a/changelog.txt b/changelog.txt index 42fe19a31..cb580d283 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 01/07/2015 == Uleat: Excluded text link body from message scrambling in Client::GarbleMessage() +Trevius: Mercenaries now load directly from tables only. The vwMercNpcTypes view is no longer required and can be deleted. == 01/06/2015 == Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index 9ba71574c..baf067bbf 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -884,6 +884,12 @@ struct Disciplines_Struct { }; +struct DisciplineTimer_Struct +{ + /*00*/ uint32 TimerID; + /*04*/ uint32 Duration; + /*08*/ uint32 Unknown08; +}; struct Tribute_Struct { uint32 tribute; diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 4e67487c6..eed08e483 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -581,13 +581,19 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { inst->PutAugment(this, i, aug[i]); if (slot_id >= 8000 && slot_id <= 8999) + { put_slot_id = inv->PushCursor(*inst); - else if (slot_id >= 3111 && slot_id <= 3179) { + } + else if (slot_id >= 3111 && slot_id <= 3179) + { // Admins: please report any occurrences of this error LogFile->write(EQEMuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); - } else - put_slot_id = inv->PutItem(slot_id, *inst); + } + else + { + put_slot_id = inv->PutItem(slot_id, *inst); + } safe_delete(inst); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index d067411e6..baccaf3e9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1956,39 +1956,81 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client //need to save based on merc_npc_type & client level uint32 merc_type_id = id * 100 + clientlevel; - // If NPC is already in tree, return it. + // If Merc is already in tree, return it. auto itr = zone->merctable.find(merc_type_id); if(itr != zone->merctable.end()) return itr->second; - //If the NPC type is 0, return nullptr. (sanity check) + //If the id is 0, return nullptr. (sanity check) if(id == 0) return nullptr; - // Otherwise, get NPCs from database. - // If id is 0, load all npc_types for the current zone, - // according to spawn2. - std::string query = StringFormat("SELECT vwMercNpcTypes.merc_npc_type_id, vwMercNpcTypes.name, " - "vwMercNpcTypes.level, vwMercNpcTypes.race_id, vwMercNpcTypes.class_id, " - "vwMercNpcTypes.hp, vwMercNpcTypes.mana, vwMercNpcTypes.gender, " - "vwMercNpcTypes.texture, vwMercNpcTypes.helmtexture, vwMercNpcTypes.attack_speed, " - "vwMercNpcTypes.STR, vwMercNpcTypes.STA, vwMercNpcTypes.DEX, vwMercNpcTypes.AGI, " - "vwMercNpcTypes._INT, vwMercNpcTypes.WIS, vwMercNpcTypes.CHA, vwMercNpcTypes.MR, " - "vwMercNpcTypes.CR, vwMercNpcTypes.DR, vwMercNpcTypes.FR, vwMercNpcTypes.PR, " - "vwMercNpcTypes.Corrup, vwMercNpcTypes.mindmg, vwMercNpcTypes.maxdmg, " - "vwMercNpcTypes.attack_count, vwMercNpcTypes.special_abilities, " - "vwMercNpcTypes.d_melee_texture1, vwMercNpcTypes.d_melee_texture2, " - "vwMercNpcTypes.prim_melee_type, vwMercNpcTypes.sec_melee_type, " - "vwMercNpcTypes.runspeed, vwMercNpcTypes.hp_regen_rate, vwMercNpcTypes.mana_regen_rate, " - "vwMercNpcTypes.bodytype, vwMercNpcTypes.armortint_id, " - "vwMercNpcTypes.armortint_red, vwMercNpcTypes.armortint_green, vwMercNpcTypes.armortint_blue, " - "vwMercNpcTypes.AC, vwMercNpcTypes.ATK, vwMercNpcTypes.Accuracy, vwMercNpcTypes.spellscale, " - "vwMercNpcTypes.healscale FROM vwMercNpcTypes " - "WHERE merc_npc_type_id = %d AND clientlevel = %d AND race_id = %d", - id, clientlevel, raceid); //dual primary keys. one is ID, one is level. + // Otherwise, load Merc data on demand + std::string query = StringFormat("SELECT " + "m_stats.merc_npc_type_id, " + "'' AS name, " + "m_stats.level, " + "m_types.race_id, " + "m_subtypes.class_id, " + "m_stats.hp, " + "m_stats.mana, " + "0 AS gender, " + "m_armorinfo.texture, " + "m_armorinfo.helmtexture, " + "m_stats.attack_speed, " + "m_stats.STR, " + "m_stats.STA, " + "m_stats.DEX, " + "m_stats.AGI, " + "m_stats._INT, " + "m_stats.WIS, " + "m_stats.CHA, " + "m_stats.MR, " + "m_stats.CR, " + "m_stats.DR, " + "m_stats.FR, " + "m_stats.PR, " + "m_stats.Corrup, " + "m_stats.mindmg, " + "m_stats.maxdmg, " + "m_stats.attack_count, " + "m_stats.special_abilities, " + "m_weaponinfo.d_melee_texture1, " + "m_weaponinfo.d_melee_texture2, " + "m_weaponinfo.prim_melee_type, " + "m_weaponinfo.sec_melee_type, " + "m_stats.runspeed, " + "m_stats.hp_regen_rate, " + "m_stats.mana_regen_rate, " + "1 AS bodytype, " + "m_armorinfo.armortint_id, " + "m_armorinfo.armortint_red, " + "m_armorinfo.armortint_green, " + "m_armorinfo.armortint_blue, " + "m_stats.AC, " + "m_stats.ATK, " + "m_stats.Accuracy, " + "m_stats.spellscale, " + "m_stats.healscale " + "FROM merc_stats m_stats " + "INNER JOIN merc_armorinfo m_armorinfo " + "ON m_stats.merc_npc_type_id = m_armorinfo.merc_npc_type_id " + "AND m_armorinfo.minlevel <= m_stats.level AND m_armorinfo.maxlevel >= m_stats.level " + "INNER JOIN merc_weaponinfo m_weaponinfo " + "ON m_stats.merc_npc_type_id = m_weaponinfo.merc_npc_type_id " + "AND m_weaponinfo.minlevel <= m_stats.level AND m_weaponinfo.maxlevel >= m_stats.level " + "INNER JOIN merc_templates m_templates " + "ON m_templates.merc_npc_type_id = m_stats.merc_npc_type_id " + "INNER JOIN merc_types m_types " + "ON m_templates.merc_type_id = m_types.merc_type_id " + "INNER JOIN merc_subtypes m_subtypes " + "ON m_templates.merc_subtype_id = m_subtypes.merc_subtype_id " + "WHERE m_templates.merc_npc_type_id = %d AND m_stats.clientlevel = %d AND m_types.race_id = %d", + id, clientlevel, raceid); //dual primary keys. one is ID, one is level. + auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error loading NPCs from database. Bad query: " << results.ErrorMessage() << std::endl; + std::cerr << "Error loading Mercenaries from database. Bad query: " << results.ErrorMessage() << std::endl; return nullptr; } @@ -2094,16 +2136,16 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->accuracy_rating = atoi(row[42]); tmpNPCType->scalerate = RuleI(Mercs, ScaleRate); tmpNPCType->spellscale = atoi(row[43]); - tmpNPCType->healscale = atoi(row[4]); + tmpNPCType->healscale = atoi(row[44]); - // If NPC with duplicate NPC id already in table, + // If Merc with duplicate NPC id already in table, // free item we attempted to add. - if (zone->merctable.find(tmpNPCType->npc_id * 100 + clientlevel) != zone->merctable.end()) { + if (zone->merctable.find(merc_type_id) != zone->merctable.end()) { delete tmpNPCType; return nullptr; } - zone->merctable[tmpNPCType->npc_id * 100 + clientlevel]=tmpNPCType; + zone->merctable[merc_type_id] = tmpNPCType; npc = tmpNPCType; } From 3b2fbd337f24b71d4d88f89918f61e2a245757fa Mon Sep 17 00:00:00 2001 From: Trevius Date: Wed, 7 Jan 2015 23:45:44 -0600 Subject: [PATCH 0753/1883] Query fix for group_leaders table. This may resolve some crashes/bugs related to Mercs/Bots and Groups. --- changelog.txt | 1 + common/database.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index cb580d283..53d02d02d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 01/07/2015 == Uleat: Excluded text link body from message scrambling in Client::GarbleMessage() Trevius: Mercenaries now load directly from tables only. The vwMercNpcTypes view is no longer required and can be deleted. +Trevius: Query fix for group_leaders table. This may resolve some crashes/bugs related to Mercs/Bots and Groups. == 01/06/2015 == Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD. diff --git a/common/database.cpp b/common/database.cpp index 3de2a308b..85ee258a2 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3303,7 +3303,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { return; } - query = StringFormat("INSERT INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%u, '%s', '', '', '', '', '', '', '0')", + query = StringFormat("REPLACE INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%u, '%s', '', '', '', '', '', '', '0')", gid, EscapeString(name).c_str()); result = QueryDatabase(query); From 77f9cf9f633aa5f37d6b61ef85430591e4279120 Mon Sep 17 00:00:00 2001 From: Kemmler Date: Thu, 8 Jan 2015 09:49:46 -0500 Subject: [PATCH 0754/1883] Work-around for "strange ADL issues" not needed if using Boost 1.57.0 (was required through 1.56.0, thus test for less than 1.57.0). Tested on VS2013. --- luabind/luabind/object.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/luabind/luabind/object.hpp b/luabind/luabind/object.hpp index ea12bf272..0feb7bd48 100644 --- a/luabind/luabind/object.hpp +++ b/luabind/luabind/object.hpp @@ -537,6 +537,7 @@ namespace detail }; // Needed because of some strange ADL issues. +#if BOOST_VERSION < 105700 #define LUABIND_OPERATOR_ADL_WKND(op) \ inline bool operator op( \ @@ -557,7 +558,8 @@ namespace detail LUABIND_OPERATOR_ADL_WKND(!=) #undef LUABIND_OPERATOR_ADL_WKND - +#endif + } // namespace detail namespace adl From 94be9e91627714c0589fa91a30adb528a6835116 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 8 Jan 2015 17:08:20 -0600 Subject: [PATCH 0755/1883] Added some extra checks and clean-up related to Groups and Mercenaries. --- changelog.txt | 3 ++ zone/groups.cpp | 75 +++++++++++++++++++++---------------------------- 2 files changed, 35 insertions(+), 43 deletions(-) diff --git a/changelog.txt b/changelog.txt index 53d02d02d..0091a7583 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/08/2015 == +Trevius: Added some extra checks and clean-up related to Groups and Mercenaries. + == 01/07/2015 == Uleat: Excluded text link body from message scrambling in Client::GarbleMessage() Trevius: Mercenaries now load directly from tables only. The vwMercNpcTypes view is no longer required and can be deleted. diff --git a/zone/groups.cpp b/zone/groups.cpp index a6d8be42b..b4f195c74 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -26,23 +26,16 @@ extern EntityList entity_list; extern WorldServer worldserver; -// -// Xorlac: This will need proper synchronization to make it work correctly. -// Also, should investigate client ack for packet to ensure proper synch. -// - /* - note about how groups work: A group contains 2 list, a list of pointers to members and a list of member names. All members of a group should have their -name in the membername array, wether they are in the zone or not. +name in the membername array, whether they are in the zone or not. Only members in this zone will have non-null pointers in the members array. - */ -//create a group which should allready exist in the database +//create a group which should already exist in the database Group::Group(uint32 gid) : GroupIDConsumer(gid) { @@ -112,8 +105,7 @@ Group::~Group() } } -//Cofruben:Split money used in OP_Split. -//Rewritten by Father Nitwit +//Split money used in OP_Split (/split and /autosplit). void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter) { //avoid unneeded work if(copper == 0 && silver == 0 && gold == 0 && platinum == 0) @@ -197,7 +189,7 @@ void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinu for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client - Client *c = members[i]->CastToClient(); + Client *c = members[i]->CastToClient(); //I could not get MoneyOnCorpse to work, so we use this c->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true); c->Message(2, msg.c_str()); @@ -368,7 +360,6 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte void Group::AddMember(const char *NewMemberName) { // This method should be called when both the new member and the group leader are in a different zone to this one. - // for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) if(!strcasecmp(membername[i], NewMemberName)) { @@ -395,9 +386,8 @@ void Group::QueuePacket(const EQApplicationPacket *app, bool ack_req) members[i]->CastToClient()->QueuePacket(app, ack_req); } -// solar: sends the rest of the group's hps to member. this is useful when -// someone first joins a group, but otherwise there shouldn't be a need to -// call it +// Sends the rest of the group's hps to member. this is useful when someone +// first joins a group, but otherwise there shouldn't be a need to call it void Group::SendHPPacketsTo(Mob *member) { if(member && member->IsClient()) @@ -459,9 +449,11 @@ void Group::SendHPPacketsFrom(Mob *member) } //updates a group member's client pointer when they zone in -//if the group was in the zone allready +//if the group was in the zone already bool Group::UpdatePlayer(Mob* update){ + bool updateSuccess = false; + VerifyGroup(); uint32 i=0; @@ -487,7 +479,8 @@ bool Group::UpdatePlayer(Mob* update){ { members[i] = update; members[i]->SetGrouped(true); - return true; + updateSuccess = true; + break; } } @@ -495,7 +488,7 @@ bool Group::UpdatePlayer(Mob* update){ if (update->IsClient() && !mentoree && mentoree_name.length() && !mentoree_name.compare(update->GetName())) mentoree = update->CastToClient(); - return false; + return updateSuccess; } @@ -520,6 +513,7 @@ void Group::MemberZoned(Mob* removemob) { } #endif //BOTS } + if(removemob->IsClient() && HasRole(removemob, RoleAssist)) SetGroupAssistTarget(0); @@ -592,7 +586,7 @@ bool Group::DelMemberOOZ(const char *Name) { return false; } -bool Group::DelMember(Mob* oldmember,bool ignoresender) +bool Group::DelMember(Mob* oldmember, bool ignoresender) { if (oldmember == nullptr) { @@ -689,6 +683,8 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) if(oldmember->IsClient()) oldmember->CastToClient()->QueuePacket(outapp); } + + safe_delete(outapp); if(oldmember->IsClient()) { @@ -707,8 +703,6 @@ bool Group::DelMember(Mob* oldmember,bool ignoresender) oldmember->SetGrouped(false); disbandcheck = true; - safe_delete(outapp); - if(HasRole(oldmember, RoleTank)) { SetGroupTankTarget(0); @@ -998,24 +992,21 @@ void Group::SendLeadershipAAUpdate() // aware of it until they are next in the same zone as the leader. EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); - GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer; - gu->action = groupActAAUpdate; - - uint32 i = 0; - gu->leader_aas = LeaderAbilities; - gu->NPCMarkerID = GetNPCMarkerID(); + uint32 i = 0; for (i = 0;i < MAX_GROUP_MEMBERS; ++i) + { if(members[i] && members[i]->IsClient()) { strcpy(gu->yourname, members[i]->GetName()); strcpy(gu->membername, members[i]->GetName()); members[i]->CastToClient()->QueuePacket(outapp); } + } safe_delete(outapp); } @@ -1037,8 +1028,8 @@ uint8 Group::GroupCount() { uint32 Group::GetHighestLevel() { -uint32 level = 1; -uint32 i; + uint32 level = 1; + uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i]) @@ -1049,10 +1040,11 @@ uint32 i; } return level; } + uint32 Group::GetLowestLevel() { -uint32 level = 255; -uint32 i; + uint32 level = 255; + uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i]) @@ -1112,16 +1104,14 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 -LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; } - //it should be safe to use GetClientByName, but Group is trying - //to be generic, so we'll go for general Mob Mob *them = entity_list.GetMob(membername[i]); - if(them == nullptr && members[i] != nullptr) { //they arnt here anymore.... + if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 LogFile->write(EQEMuLog::Debug, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif @@ -1143,7 +1133,6 @@ LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long } } - void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2,const char* message3,const char* message4,const char* message5,const char* message6,const char* message7,const char* message8,const char* message9, uint32 distance) { uint32 i; for (i = 0; i < MAX_GROUP_MEMBERS; i++) { @@ -1152,13 +1141,14 @@ void Group::GroupMessage_StringID(Mob* sender, uint32 type, uint32 string_id, co if(members[i] == sender) continue; + + if(!members[i]->IsClient()) + continue; members[i]->Message_StringID(type, string_id, message, message2, message3, message4, message5, message6, message7, message8, message9, 0); } } - - void Client::LeaveGroup() { Group *g = GetGroup(); @@ -1178,7 +1168,7 @@ void Client::LeaveGroup() { else { g->DelMember(this); - if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g) + if (GetMerc() != nullptr && g == GetMerc()->GetGroup() ) { GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup()); } @@ -1363,7 +1353,7 @@ void Group::MarkNPC(Mob* Target, int Number) // Send a packet to all group members in this zone causing the client to prefix the Target mob's name // with the specified Number. // - if(!Target || Target->IsClient()) + if(!Target || Target->IsClient() || Target->IsMerc()) return; if((Number < 1) || (Number > MAX_MARKED_NPCS)) @@ -2166,7 +2156,6 @@ int8 Group::GetNumberNeedingHealedInGroup(int8 hpr, bool includePets) { } } - return needHealed; } @@ -2228,7 +2217,7 @@ void Group::ChangeLeader(Mob* newleader) // this changes the current group leader, notifies other members, and updates leadship AA // if the new leader is invalid, do nothing - if (!newleader) + if (!newleader || !newleader->IsClient()) return; Mob* oldleader = GetLeader(); From be381b4e5650ca49751c55c2a6a96b7412ac7f51 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 8 Jan 2015 19:46:28 -0600 Subject: [PATCH 0756/1883] Renamed EQEMuLog class to EQEmuLog --- client_files/export/main.cpp | 30 +-- client_files/import/main.cpp | 28 +-- common/crash.cpp | 44 ++--- common/database.cpp | 34 ++-- common/debug.cpp | 92 ++++----- common/debug.h | 8 +- common/eq_stream.cpp | 2 +- common/eqtime.cpp | 6 +- common/guild_base.cpp | 2 +- common/item.cpp | 2 +- common/logsys_eqemu.cpp | 2 +- common/ptimer.cpp | 14 +- common/rulesys.cpp | 8 +- common/shareddb.cpp | 98 ++++----- common/timeoutmgr.cpp | 6 +- queryserv/database.cpp | 4 +- shared_memory/main.cpp | 34 ++-- ucs/database.cpp | 4 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/eql_config.cpp | 22 +-- world/world_logsys.cpp | 4 +- world/worlddb.cpp | 18 +- zone/aa.cpp | 38 ++-- zone/aggro.cpp | 10 +- zone/attack.cpp | 18 +- zone/bot.cpp | 24 +-- zone/client.cpp | 52 ++--- zone/client_logs.cpp | 28 +-- zone/client_logs.h | 14 +- zone/client_mods.cpp | 10 +- zone/client_packet.cpp | 374 +++++++++++++++++------------------ zone/client_process.cpp | 4 +- zone/command.cpp | 68 +++---- zone/corpse.cpp | 8 +- zone/doors.cpp | 10 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 10 +- zone/embxs.cpp | 6 +- zone/entity.cpp | 12 +- zone/exp.cpp | 4 +- zone/forage.cpp | 6 +- zone/groups.cpp | 32 +-- zone/guild.cpp | 4 +- zone/horse.cpp | 6 +- zone/inventory.cpp | 8 +- zone/loottables.cpp | 4 +- zone/merc.cpp | 10 +- zone/net.cpp | 2 +- zone/npc.cpp | 20 +- zone/object.cpp | 8 +- zone/pathing.cpp | 14 +- zone/petitions.cpp | 10 +- zone/pets.cpp | 16 +- zone/questmgr.cpp | 28 +-- zone/raids.cpp | 18 +- zone/spawn2.cpp | 22 +-- zone/spawngroup.cpp | 2 +- zone/spell_effects.cpp | 12 +- zone/spells.cpp | 18 +- zone/tasks.cpp | 66 +++---- zone/titles.cpp | 12 +- zone/tradeskills.cpp | 66 +++---- zone/trading.cpp | 12 +- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 46 ++--- zone/worldserver.cpp | 2 +- zone/zone.cpp | 148 +++++++------- zone/zone_logsys.cpp | 4 +- zone/zonedb.cpp | 78 ++++---- zone/zoning.cpp | 36 ++-- 74 files changed, 945 insertions(+), 945 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index e9b127aad..8bf6827d4 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -33,22 +33,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientExport); set_exception_handler(); - LogFile->write(EQEMuLog::Status, "Client Files Export Utility"); + LogFile->write(EQEmuLog::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); + LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEMuLog::Status, "Connecting to database..."); + LogFile->write(EQEmuLog::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a " + LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -61,11 +61,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Exporting Spells..."); + LogFile->write(EQEmuLog::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open export/spells_us.txt to write, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -89,7 +89,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -103,7 +103,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -123,7 +123,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -135,11 +135,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Exporting Skill Caps..."); + LogFile->write(EQEmuLog::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -164,11 +164,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Exporting Base Data..."); + LogFile->write(EQEmuLog::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open export/BaseData.txt to write, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -190,7 +190,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 9683e3bfe..7617248d0 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -32,22 +32,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientImport); set_exception_handler(); - LogFile->write(EQEMuLog::Status, "Client Files Import Utility"); + LogFile->write(EQEmuLog::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); + LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEMuLog::Status, "Connecting to database..."); + LogFile->write(EQEmuLog::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a " + LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -64,7 +64,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -72,10 +72,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Importing Spells..."); + LogFile->write(EQEmuLog::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open import/spells_us.txt to read, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -138,23 +138,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported); + LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported); + LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Importing Skill Caps..."); + LogFile->write(EQEmuLog::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -186,11 +186,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - LogFile->write(EQEMuLog::Status, "Importing Base Data..."); + LogFile->write(EQEmuLog::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - LogFile->write(EQEMuLog::Error, "Unable to open import/BaseData.txt to read, skipping."); + LogFile->write(EQEmuLog::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index 5ce1229a5..cd7389c09 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -24,7 +24,7 @@ public: } } - LogFile->write(EQEMuLog::Crash, buffer); + LogFile->write(EQEmuLog::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -34,67 +34,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW"); + LogFile->write(EQEmuLog::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - LogFile->write(EQEMuLog::Crash, "Unknown Exception"); + LogFile->write(EQEmuLog::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index 85ee258a2..d6dcd7405 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEMuLog::Error, "Failed to connect to database: Error: %s", errbuf); + LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - LogFile->write(EQEMuLog::Status, "Using database '%s' at %s:%d",database,host,port); + LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - LogFile->write(EQEMuLog::Error, "StoreCharacter: no character id"); + LogFile->write(EQEmuLog::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - LogFile->write(EQEMuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - LogFile->write(EQEMuLog::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + LogFile->write(EQEmuLog::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,13 +3255,13 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Debug, "Character not in a group: %s", name); + LogFile->write(EQEmuLog::Debug, "Character not in a group: %s", name); return 0; } @@ -3308,7 +3308,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - LogFile->write(EQEMuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4048,7 +4048,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/debug.cpp b/common/debug.cpp index a02aeaa34..ce56ebcbb 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -50,13 +50,13 @@ namespace ConsoleColor { #endif static volatile bool logFileValid = false; -static EQEMuLog realLogFile; -EQEMuLog *LogFile = &realLogFile; +static EQEmuLog realLogFile; +EQEmuLog *LogFile = &realLogFile; -static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; -static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; +static const char* FileNames[EQEmuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; +static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; -EQEMuLog::EQEMuLog() +EQEmuLog::EQEmuLog() { for (int i = 0; i < MaxLogID; i++) { fp[i] = 0; @@ -64,17 +64,17 @@ EQEMuLog::EQEMuLog() logCallbackBuf[i] = nullptr; logCallbackPva[i] = nullptr; } - pLogStatus[EQEMuLog::LogIDs::Status] = LOG_LEVEL_STATUS; - pLogStatus[EQEMuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; - pLogStatus[EQEMuLog::LogIDs::Error] = LOG_LEVEL_ERROR; - pLogStatus[EQEMuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG; - pLogStatus[EQEMuLog::LogIDs::Quest] = LOG_LEVEL_QUEST; - pLogStatus[EQEMuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS; - pLogStatus[EQEMuLog::LogIDs::Crash] = LOG_LEVEL_CRASH; + pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS; + pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; + pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR; + pLogStatus[EQEmuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG; + pLogStatus[EQEmuLog::LogIDs::Quest] = LOG_LEVEL_QUEST; + pLogStatus[EQEmuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS; + pLogStatus[EQEmuLog::LogIDs::Crash] = LOG_LEVEL_CRASH; logFileValid = true; } -EQEMuLog::~EQEMuLog() +EQEmuLog::~EQEmuLog() { logFileValid = false; for (int i = 0; i < MaxLogID; i++) { @@ -85,7 +85,7 @@ EQEMuLog::~EQEMuLog() } } -bool EQEMuLog::open(LogIDs id) +bool EQEmuLog::open(LogIDs id) { if (!logFileValid) { return false; @@ -137,7 +137,7 @@ bool EQEMuLog::open(LogIDs id) return true; } -bool EQEMuLog::write(LogIDs id, const char *fmt, ...) +bool EQEmuLog::write(LogIDs id, const char *fmt, ...) { if (!logFileValid) { return false; @@ -196,13 +196,13 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } #endif fprintf(stdout, "[%s] ", LogNames[id]); @@ -236,7 +236,7 @@ bool EQEMuLog::write(LogIDs id, const char *fmt, ...) } //write with Prefix and a VA_list -bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) +bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) { if (!logFileValid) { return false; @@ -294,13 +294,13 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } #endif fprintf(stdout, "[%s] %s", LogNames[id], prefix); @@ -329,7 +329,7 @@ bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list return true; } -bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) +bool EQEmuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) { if (!logFileValid) { return false; @@ -383,13 +383,13 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (id == EQEMuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEMuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEMuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEMuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEMuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEMuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEMuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } #endif fprintf(stdout, "[%s] ", LogNames[id]); @@ -410,7 +410,7 @@ bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) return true; } -bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) +bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { va_list argptr, tmpargptr; va_start(argptr, fmt); @@ -429,7 +429,7 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) return true; }; -bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) +bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) { if (!logFileValid) { #if EQDEBUG >= 10 @@ -497,7 +497,7 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski return true; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) +void EQEmuLog::SetCallback(LogIDs id, msgCallbackFmt proc) { if (!logFileValid) { return; @@ -508,7 +508,7 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) logCallbackFmt[id] = proc; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) +void EQEmuLog::SetCallback(LogIDs id, msgCallbackBuf proc) { if (!logFileValid) { return; @@ -519,7 +519,7 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) logCallbackBuf[id] = proc; } -void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) +void EQEmuLog::SetCallback(LogIDs id, msgCallbackPva proc) { if (!logFileValid) { return; @@ -530,7 +530,7 @@ void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) logCallbackPva[id] = proc; } -void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) +void EQEmuLog::SetAllCallbacks(msgCallbackFmt proc) { if (!logFileValid) { return; @@ -541,7 +541,7 @@ void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) } } -void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) +void EQEmuLog::SetAllCallbacks(msgCallbackBuf proc) { if (!logFileValid) { return; @@ -552,7 +552,7 @@ void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) } } -void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) +void EQEmuLog::SetAllCallbacks(msgCallbackPva proc) { if (!logFileValid) { return; diff --git a/common/debug.h b/common/debug.h index 5e2fff368..da97fb0de 100644 --- a/common/debug.h +++ b/common/debug.h @@ -74,10 +74,10 @@ #include -class EQEMuLog { +class EQEmuLog { public: - EQEMuLog(); - ~EQEMuLog(); + EQEmuLog(); + ~EQEmuLog(); enum LogIDs { Status = 0, /* This must stay the first entry in this list */ @@ -128,7 +128,7 @@ private: msgCallbackPva logCallbackPva[MaxLogID]; }; -extern EQEMuLog* LogFile; +extern EQEmuLog* LogFile; #ifdef _EQDEBUG class PerformanceMonitor { diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 594f3b5bc..3e89e2fc3 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -987,7 +987,7 @@ EQRawApplicationPacket *p=nullptr; EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); #if EQDEBUG >= 4 if(emu_op == OP_Unknown) { - LogFile->write(EQEMuLog::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + LogFile->write(EQEmuLog::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } #endif p->SetOpcode(emu_op); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 7e1eb9f5d..bff36bc4c 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -140,7 +140,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - LogFile->write(EQEMuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + LogFile->write(EQEmuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -164,14 +164,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - LogFile->write(EQEMuLog::Error, "Could not load EQTime file %s", filename); + LogFile->write(EQEmuLog::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - LogFile->write(EQEMuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + LogFile->write(EQEmuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 06e108534..f1db14af7 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -337,7 +337,7 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } diff --git a/common/item.cpp b/common/item.cpp index e5a788879..7f6e049d6 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1151,7 +1151,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - LogFile->write(EQEMuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id); + LogFile->write(EQEmuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp index b5f846b4a..f91de2cea 100644 --- a/common/logsys_eqemu.cpp +++ b/common/logsys_eqemu.cpp @@ -35,6 +35,6 @@ void log_message(LogType type, const char *fmt, ...) { void log_messageVA(LogType type, const char *fmt, va_list args) { std::string prefix_buffer = StringFormat("[%s] ", log_type_info[type].name); - LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args); + LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); } diff --git a/common/ptimer.cpp b/common/ptimer.cpp index b39f37a04..bd753d391 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - LogFile->write(EQEMuLog::Error, "Null timer during ->Check()!?\n"); + LogFile->write(EQEmuLog::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEMuLog::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 95f22754c..ae1b8e5f6 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -282,7 +282,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index eed08e483..c036fb5de 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - LogFile->write(EQEMuLog::Error, + LogFile->write(EQEmuLog::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - LogFile->write(EQEMuLog::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + LogFile->write(EQEmuLog::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - LogFile->write(EQEMuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + LogFile->write(EQEmuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEMuLog::Error, "Error Loading Items: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Database::LoadItems: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "No book to send, (%s)", txtfile); + LogFile->write(EQEmuLog::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEMuLog::Error, "Error Loading npc factions: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - LogFile->write(EQEMuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - LogFile->write(EQEMuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading skill caps: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEMuLog::Error, "Error Loading Base Data: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level <= 0, ignoring."); + LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - LogFile->write(EQEMuLog::Error, "Non fatal error: base_data.class > 16, ignoring."); + LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading loot: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Could not get loot table: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Could not get loot drop: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index ca436b093..771ce16af 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - LogFile->write(EQEMuLog::Debug, "Checking timeout on 0x%x\n", it); + LogFile->write(EQEmuLog::Debug, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - LogFile->write(EQEMuLog::Debug, "Adding timeoutable 0x%x\n", who); + LogFile->write(EQEmuLog::Debug, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - LogFile->write(EQEMuLog::Debug, "Removing timeoutable 0x%x\n", who); + LogFile->write(EQEmuLog::Debug, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 4f7fdf10f..56e09e238 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -68,14 +68,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEMuLog::Error, "Failed to connect to database: Error: %s", errbuf); + LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - LogFile->write(EQEMuLog::Status, "Using database '%s' at %s:%d",database,host,port); + LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 8cc554441..b9ee32929 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -35,22 +35,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); set_exception_handler(); - LogFile->write(EQEMuLog::Status, "Shared Memory Loader Program"); + LogFile->write(EQEmuLog::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEMuLog::Error, "Unable to load configuration file."); + LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEMuLog::Status, "Connecting to database..."); + LogFile->write(EQEmuLog::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a " + LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -109,61 +109,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - LogFile->write(EQEMuLog::Status, "Loading items..."); + LogFile->write(EQEmuLog::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - LogFile->write(EQEMuLog::Status, "Loading factions..."); + LogFile->write(EQEmuLog::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - LogFile->write(EQEMuLog::Status, "Loading loot..."); + LogFile->write(EQEmuLog::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - LogFile->write(EQEMuLog::Status, "Loading skill caps..."); + LogFile->write(EQEmuLog::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - LogFile->write(EQEMuLog::Status, "Loading spells..."); + LogFile->write(EQEmuLog::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - LogFile->write(EQEMuLog::Status, "Loading base data..."); + LogFile->write(EQEmuLog::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "%s", ex.what()); + LogFile->write(EQEmuLog::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/database.cpp b/ucs/database.cpp index 8130585d1..09e4389b7 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -73,14 +73,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEMuLog::Error, "Failed to connect to database: Error: %s", errbuf); + LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - LogFile->write(EQEMuLog::Status, "Using database '%s' at %s:%d",database,host,port); + LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/world/adventure.cpp b/world/adventure.cpp index b6db3d6d0..c6272cb31 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -385,7 +385,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 47ea42c51..4a6756d5e 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -649,7 +649,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -699,7 +699,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1074,7 +1074,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/eql_config.cpp b/world/eql_config.cpp index f99ba0fb6..65d4a5f11 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name); + LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - LogFile->write(EQEMuLog::Error, "Update for unknown zone %s", short_name); + LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/world_logsys.cpp b/world/world_logsys.cpp index 351af9767..3cfada073 100644 --- a/world/world_logsys.cpp +++ b/world/world_logsys.cpp @@ -14,7 +14,7 @@ void log_message_clientVA(LogType type, Client *who, const char *fmt, va_list ar std::string prefix_buffer = StringFormat("[%s] %s: ", log_type_info[type].name, who->GetAccountName()); - LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args); + LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); } void log_message_client(LogType type, Client *who, const char *fmt, ...) { @@ -36,7 +36,7 @@ void log_message_zoneVA(LogType type, ZoneServer *who, const char *fmt, va_list prefix_buffer = StringFormat("[%s] %s ", log_type_info[type].name, zone_tag.c_str()); - LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args); + LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); } void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...) { diff --git a/world/worlddb.cpp b/world/worlddb.cpp index e65a3a338..91406b527 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEMuLog::Status, "Start zone query: %s\n", query.c_str()); + LogFile->write(EQEmuLog::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); + LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEMuLog::Status, "SoF Start zone query: %s\n", query.c_str()); + LogFile->write(EQEmuLog::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - LogFile->write(EQEMuLog::Status, "Found starting location in start_zones"); + LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/zone/aa.cpp b/zone/aa.cpp index 02f00f84d..9aba83bbd 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -444,7 +444,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - LogFile->write(EQEMuLog::Error, "Unknown AA nonspell action type %d", caa->action); + LogFile->write(EQEmuLog::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -500,7 +500,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - LogFile->write(EQEMuLog::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + LogFile->write(EQEmuLog::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -527,7 +527,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - LogFile->write(EQEMuLog::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + LogFile->write(EQEmuLog::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -624,7 +624,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - LogFile->write(EQEMuLog::Error, "Unknown npc type for swarm pet type id: %d", typesid); + LogFile->write(EQEmuLog::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -1428,10 +1428,10 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - LogFile->write(EQEMuLog::Status, "Loading AA information..."); + LogFile->write(EQEmuLog::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - LogFile->write(EQEMuLog::Error, "Failed to load AAs!"); + LogFile->write(EQEmuLog::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1446,11 +1446,11 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - LogFile->write(EQEMuLog::Status, "Loading AA Effects..."); + LogFile->write(EQEmuLog::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - LogFile->write(EQEMuLog::Status, "Loaded %d AA Effects.", aa_effects.size()); + LogFile->write(EQEmuLog::Status, "Loaded %d AA Effects.", aa_effects.size()); else - LogFile->write(EQEMuLog::Error, "Failed to load AA Effects!"); + LogFile->write(EQEmuLog::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1459,12 +1459,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - LogFile->write(EQEMuLog::Error, "Error loading AA Effects, none found in the database."); + LogFile->write(EQEmuLog::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1801,7 +1801,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1840,7 +1840,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1894,7 +1894,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1911,7 +1911,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1944,14 +1944,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1969,7 +1969,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1989,7 +1989,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index a82586cb5..b2b3881bb 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -344,7 +344,7 @@ bool Mob::CheckWillAggro(Mob *mob) { // Aggro #if EQDEBUG>=6 - LogFile->write(EQEMuLog::Debug, "Check aggro for %s target %s.", GetName(), mob->GetName()); + LogFile->write(EQEmuLog::Debug, "Check aggro for %s target %s.", GetName(), mob->GetName()); #endif return( mod_will_aggro(mob, this) ); } @@ -469,7 +469,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - LogFile->write(EQEMuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -696,7 +696,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - LogFile->write(EQEMuLog::Debug, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + LogFile->write(EQEmuLog::Debug, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -836,7 +836,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - LogFile->write(EQEMuLog::Debug, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + LogFile->write(EQEmuLog::Debug, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -948,7 +948,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - LogFile->write(EQEMuLog::Debug, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + LogFile->write(EQEmuLog::Debug, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 20c01963b..8b9196adc 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -61,7 +61,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug, "Weapon skill:%i", item->ItemType); + LogFile->write(EQEmuLog::Debug, "Weapon skill:%i", item->ItemType); #endif switch (item->ItemType) { @@ -192,7 +192,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += RuleR(Combat, NPCBonusHitChance); #if ATTACK_DEBUG>=11 - LogFile->write(EQEMuLog::Debug, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + LogFile->write(EQEmuLog::Debug, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); #endif mlog(COMBAT__TOHIT,"CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); @@ -334,7 +334,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins #if EQDEBUG>=11 - LogFile->write(EQEMuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + LogFile->write(EQEmuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); #endif // @@ -1135,7 +1135,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } @@ -1699,7 +1699,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -2036,7 +2036,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack { zone->DelAggroMob(); #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount()); + LogFile->write(EQEmuLog::Debug,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount()); #endif } SetHP(0); @@ -3896,7 +3896,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3927,7 +3927,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } @@ -4476,7 +4476,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } diff --git a/zone/bot.cpp b/zone/bot.cpp index bd7c9f946..bcc9a763c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + LogFile->write(EQEmuLog::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Bot::LoadAAs()"); + LogFile->write(EQEmuLog::Error, "Error in Bot::LoadAAs()"); return; } @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "Error in Bot::LoadStance()"); + LogFile->write(EQEmuLog::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in Bot::SaveStance()"); + LogFile->write(EQEmuLog::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Bot::LoadTimers()"); + LogFile->write(EQEmuLog::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - LogFile->write(EQEMuLog::Error, "Error in Bot::SaveTimers()"); + LogFile->write(EQEmuLog::Error, "Error in Bot::SaveTimers()"); } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - LogFile->write(EQEMuLog::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + LogFile->write(EQEmuLog::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - LogFile->write(EQEMuLog::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -6017,7 +6017,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7336,7 +7336,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } } @@ -8550,7 +8550,7 @@ int32 Bot::CalcMaxMana() { } default: { - LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } diff --git a/zone/client.cpp b/zone/client.cpp index aae809f60..d8c24d1ba 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -339,7 +339,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - LogFile->write(EQEMuLog::Debug, "Client '%s' was destroyed before reaching the connected state:", GetName()); + LogFile->write(EQEmuLog::Debug, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -437,31 +437,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - LogFile->write(EQEMuLog::Debug, "Client has not sent us an initial zone entry packet."); + LogFile->write(EQEmuLog::Debug, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - LogFile->write(EQEMuLog::Debug, "Client sent initial zone packet, but we never got their player info from the database."); + LogFile->write(EQEmuLog::Debug, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - LogFile->write(EQEMuLog::Debug, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + LogFile->write(EQEmuLog::Debug, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - LogFile->write(EQEMuLog::Debug, "We successfully sent player info and spawns, waiting for client to request new zone."); + LogFile->write(EQEmuLog::Debug, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - LogFile->write(EQEMuLog::Debug, "We received client's new zone request, waiting for client spawn request."); + LogFile->write(EQEmuLog::Debug, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - LogFile->write(EQEMuLog::Debug, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + LogFile->write(EQEmuLog::Debug, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - LogFile->write(EQEMuLog::Debug, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + LogFile->write(EQEmuLog::Debug, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - LogFile->write(EQEMuLog::Debug, "We received client ready notification, but never finished Client::CompleteConnect"); + LogFile->write(EQEmuLog::Debug, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - LogFile->write(EQEMuLog::Debug, "Client is successfully connected."); + LogFile->write(EQEmuLog::Debug, "Client is successfully connected."); break; }; } @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); #if EQDEBUG >= 6 - LogFile->write(EQEMuLog::Normal, "Transmitting a packet"); + LogFile->write(EQEmuLog::Normal, "Transmitting a packet"); #endif } return true; @@ -701,7 +701,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + LogFile->write(EQEmuLog::Debug,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); #endif if (targetname == nullptr) { @@ -1917,7 +1917,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - LogFile->write(EQEMuLog::Normal,"Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + LogFile->write(EQEmuLog::Normal,"Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2111,7 +2111,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + LogFile->write(EQEmuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2151,7 +2151,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - LogFile->write(EQEMuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + LogFile->write(EQEmuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2370,7 +2370,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - LogFile->write(EQEMuLog::Normal, "Reset %s's caster specialization skills to 1. " + LogFile->write(EQEmuLog::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } @@ -4550,14 +4550,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - LogFile->write(EQEMuLog::Debug, "%s tried to open %s but %s was not a treasure chest.", + LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - LogFile->write(EQEMuLog::Debug, "%s tried to open %s but %s was out of range", + LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -5300,7 +5300,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5368,7 +5368,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5395,7 +5395,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5403,7 +5403,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6217,7 +6217,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - LogFile->write(EQEMuLog::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + LogFile->write(EQEmuLog::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6231,7 +6231,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - LogFile->write(EQEMuLog::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + LogFile->write(EQEmuLog::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8155,7 +8155,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "Eating from slot:%i", (int)slot); + LogFile->write(EQEmuLog::Debug, "Eating from slot:%i", (int)slot); #endif } else @@ -8172,7 +8172,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "Drinking from slot:%i", (int)slot); + LogFile->write(EQEmuLog::Debug, "Drinking from slot:%i", (int)slot); #endif } } diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 7ce3d5aab..4aba31159 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -27,8 +27,8 @@ ClientLogs client_logs; char ClientLogs::_buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1]; -void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) { - if(id >= EQEMuLog::MaxLogID) +void ClientLogs::subscribe(EQEmuLog::LogIDs id, Client *c) { + if(id >= EQEmuLog::MaxLogID) return; if(c == nullptr) return; @@ -47,8 +47,8 @@ void ClientLogs::subscribe(EQEMuLog::LogIDs id, Client *c) { entries[id].push_back(c); } -void ClientLogs::unsubscribe(EQEMuLog::LogIDs id, Client *c) { - if(id >= EQEMuLog::MaxLogID) +void ClientLogs::unsubscribe(EQEmuLog::LogIDs id, Client *c) { + if(id >= EQEmuLog::MaxLogID) return; if(c == nullptr) return; @@ -68,8 +68,8 @@ void ClientLogs::subscribeAll(Client *c) { if(c == nullptr) return; int r; - for(r = EQEMuLog::Status; r < EQEMuLog::MaxLogID; r++) { - subscribe((EQEMuLog::LogIDs)r, c); + for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { + subscribe((EQEmuLog::LogIDs)r, c); } } @@ -77,20 +77,20 @@ void ClientLogs::unsubscribeAll(Client *c) { if(c == nullptr) return; int r; - for(r = EQEMuLog::Status; r < EQEMuLog::MaxLogID; r++) { - unsubscribe((EQEMuLog::LogIDs)r, c); + for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { + unsubscribe((EQEmuLog::LogIDs)r, c); } } void ClientLogs::clear() { int r; - for(r = EQEMuLog::Status; r < EQEMuLog::MaxLogID; r++) { + for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { entries[r].clear(); } } -void ClientLogs::msg(EQEMuLog::LogIDs id, const char *buf) { - if(id >= EQEMuLog::MaxLogID) +void ClientLogs::msg(EQEmuLog::LogIDs id, const char *buf) { + if(id >= EQEmuLog::MaxLogID) return; std::vector::iterator cur,end; cur = entries[id].begin(); @@ -103,7 +103,7 @@ void ClientLogs::msg(EQEMuLog::LogIDs id, const char *buf) { } } -void ClientLogs::EQEmuIO_buf(EQEMuLog::LogIDs id, const char *buf, uint8 size, uint32 count) { +void ClientLogs::EQEmuIO_buf(EQEmuLog::LogIDs id, const char *buf, uint8 size, uint32 count) { if(size != 1) return; //cannot print multibyte data if(buf[0] == '\n' || buf[0] == '\r') @@ -115,7 +115,7 @@ void ClientLogs::EQEmuIO_buf(EQEMuLog::LogIDs id, const char *buf, uint8 size, u client_logs.msg(id, _buffer); } -void ClientLogs::EQEmuIO_fmt(EQEMuLog::LogIDs id, const char *fmt, va_list ap) { +void ClientLogs::EQEmuIO_fmt(EQEmuLog::LogIDs id, const char *fmt, va_list ap) { if(fmt[0] == '\n' || fmt[0] == '\r') return; //skip new lines... vsnprintf(_buffer, MAX_CLIENT_LOG_MESSAGE_LENGTH, fmt, ap); @@ -123,7 +123,7 @@ void ClientLogs::EQEmuIO_fmt(EQEMuLog::LogIDs id, const char *fmt, va_list ap) { client_logs.msg(id, _buffer); } -void ClientLogs::EQEmuIO_pva(EQEMuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap) { +void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap) { if(fmt[0] == '\n' || fmt[0] == '\r') return; //skip new lines... char *buf = _buffer; diff --git a/zone/client_logs.h b/zone/client_logs.h index e3d5350b5..4db83a6b1 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -35,21 +35,21 @@ class Client; class ClientLogs { public: - static void EQEmuIO_buf(EQEMuLog::LogIDs id, const char *buf, uint8 size, uint32 count); - static void EQEmuIO_fmt(EQEMuLog::LogIDs id, const char *fmt, va_list ap); - static void EQEmuIO_pva(EQEMuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap); + static void EQEmuIO_buf(EQEmuLog::LogIDs id, const char *buf, uint8 size, uint32 count); + static void EQEmuIO_fmt(EQEmuLog::LogIDs id, const char *fmt, va_list ap); + static void EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap); - void subscribe(EQEMuLog::LogIDs id, Client *c); - void unsubscribe(EQEMuLog::LogIDs id, Client *c); + void subscribe(EQEmuLog::LogIDs id, Client *c); + void unsubscribe(EQEmuLog::LogIDs id, Client *c); void subscribeAll(Client *c); void unsubscribeAll(Client *c); void clear(); //unsubscribes everybody - void msg(EQEMuLog::LogIDs id, const char *buf); + void msg(EQEmuLog::LogIDs id, const char *buf); protected: - std::vector entries[EQEMuLog::MaxLogID]; + std::vector entries[EQEmuLog::MaxLogID]; static char _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1]; }; diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 2db70e8a3..1a05052ad 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -825,7 +825,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + LogFile->write(EQEmuLog::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; @@ -934,7 +934,7 @@ int32 Client::CalcMaxMana() break; } default: { - LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -955,7 +955,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + LogFile->write(EQEmuLog::Debug, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1045,14 +1045,14 @@ int32 Client::CalcBaseMana() break; } default: { - LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + LogFile->write(EQEmuLog::Debug, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c9ec08b30..61f7813e1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -415,7 +415,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) #ifdef SOLAR if(0 && opcode != OP_ClientUpdate) { - LogFile->write(EQEMuLog::Debug,"HandlePacket() OPCODE debug enabled client %s", GetName()); + LogFile->write(EQEmuLog::Debug,"HandlePacket() OPCODE debug enabled client %s", GetName()); std::cerr << "OPCODE: " << std::hex << std::setw(4) << std::setfill('0') << opcode << std::dec << ", size: " << app->size << std::endl; DumpPacket(app); } @@ -430,7 +430,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - LogFile->write(EQEMuLog::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + LogFile->write(EQEmuLog::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -482,7 +482,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - LogFile->write(EQEMuLog::Debug, "Unknown client_state: %d\n", client_state); + LogFile->write(EQEmuLog::Debug, "Unknown client_state: %d\n", client_state); break; } @@ -965,7 +965,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -978,14 +978,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - LogFile->write(EQEMuLog::Error, "Client error: %s", error->character_name); - LogFile->write(EQEMuLog::Error, "Error message: %s", error->message); + LogFile->write(EQEmuLog::Error, "Client error: %s", error->character_name); + LogFile->write(EQEmuLog::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1179,7 +1179,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized OP_SetServerFilter"); + LogFile->write(EQEmuLog::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1196,7 +1196,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1316,14 +1316,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - LogFile->write(EQEMuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - LogFile->write(EQEMuLog::Error, "GetAuth() returned false kicking client"); + LogFile->write(EQEmuLog::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1339,7 +1339,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - LogFile->write(EQEMuLog::Error,"Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + LogFile->write(EQEmuLog::Error,"Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1728,7 +1728,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - LogFile->write(EQEMuLog::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + LogFile->write(EQEmuLog::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AcceptNewTask expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - LogFile->write(EQEMuLog::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + LogFile->write(EQEmuLog::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + LogFile->write(EQEmuLog::Debug, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + LogFile->write(EQEmuLog::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized " + LogFile->write(EQEmuLog::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - LogFile->write(EQEMuLog::Debug, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + LogFile->write(EQEmuLog::Debug, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AugmentInfo expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_Bandolier expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - LogFile->write(EQEMuLog::Debug, "Uknown Bandolier action %i", bs->action); + LogFile->write(EQEmuLog::Debug, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - LogFile->write(EQEMuLog::Debug, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + LogFile->write(EQEmuLog::Debug, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3636,7 +3636,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - LogFile->write(EQEMuLog::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + LogFile->write(EQEmuLog::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,16 +3721,16 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - LogFile->write(EQEMuLog::Error, "Size mismatch for Bind wound packet"); + LogFile->write(EQEmuLog::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - LogFile->write(EQEMuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + LogFile->write(EQEmuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - LogFile->write(EQEMuLog::Debug, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + LogFile->write(EQEmuLog::Debug, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_BlockedBuffs expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - LogFile->write(EQEMuLog::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + LogFile->write(EQEmuLog::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,7 +3859,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - LogFile->write(EQEMuLog::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + LogFile->write(EQEmuLog::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_CancelTask expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - LogFile->write(EQEMuLog::Debug, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + LogFile->write(EQEmuLog::Debug, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + LogFile->write(EQEmuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - LogFile->write(EQEMuLog::Debug, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + LogFile->write(EQEmuLog::Debug, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - LogFile->write(EQEMuLog::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + LogFile->write(EQEmuLog::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - LogFile->write(EQEMuLog::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + LogFile->write(EQEmuLog::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - LogFile->write(EQEMuLog::Error, "Client error: %s", error->character_name); - LogFile->write(EQEMuLog::Error, "Error message:%s", error->message); + LogFile->write(EQEmuLog::Error, "Client error: %s", error->character_name); + LogFile->write(EQEmuLog::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - LogFile->write(EQEMuLog::Error, "Consuming from empty slot %d", pcs->slot); + LogFile->write(EQEmuLog::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - LogFile->write(EQEMuLog::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + LogFile->write(EQEmuLog::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + LogFile->write(EQEmuLog::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5137,7 +5137,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_DelegateAbility expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5312,7 +5312,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5364,7 +5364,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - LogFile->write(EQEMuLog::Debug, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + LogFile->write(EQEmuLog::Debug, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5446,7 +5446,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized " + LogFile->write(EQEmuLog::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5537,7 +5537,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + LogFile->write(EQEmuLog::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5592,7 +5592,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5861,7 +5861,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5913,7 +5913,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5930,7 +5930,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -5946,7 +5946,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6011,7 +6011,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6061,7 +6061,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6128,7 +6128,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6138,7 +6138,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - LogFile->write(EQEMuLog::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + LogFile->write(EQEmuLog::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -6180,7 +6180,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - LogFile->write(EQEMuLog::Debug, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + LogFile->write(EQEmuLog::Debug, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6303,7 +6303,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6314,7 +6314,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6382,7 +6382,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6399,7 +6399,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6443,12 +6443,12 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } - LogFile->write(EQEMuLog::Debug, "Member Disband Request from %s\n", GetName()); + LogFile->write(EQEmuLog::Debug, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6590,7 +6590,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - LogFile->write(EQEMuLog::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + LogFile->write(EQEmuLog::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6610,7 +6610,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6659,7 +6659,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6728,7 +6728,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - LogFile->write(EQEMuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); + LogFile->write(EQEmuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6737,7 +6737,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6773,7 +6773,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6819,7 +6819,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch on OP_GroupUpdate: got %u expected %u", + LogFile->write(EQEmuLog::Debug, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6838,7 +6838,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - LogFile->write(EQEMuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); + LogFile->write(EQEmuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6847,7 +6847,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - LogFile->write(EQEMuLog::Debug, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + LogFile->write(EQEmuLog::Debug, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -6867,7 +6867,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -7797,7 +7797,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GuildStatus expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7854,7 +7854,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7959,7 +7959,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_HideCorpse expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -7988,7 +7988,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + LogFile->write(EQEmuLog::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8018,7 +8018,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8073,7 +8073,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8087,7 +8087,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8124,7 +8124,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - LogFile->write(EQEMuLog::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8224,7 +8224,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8239,7 +8239,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8437,7 +8437,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8465,7 +8465,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - LogFile->write(EQEMuLog::Debug, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + LogFile->write(EQEmuLog::Debug, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8508,7 +8508,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - LogFile->write(EQEMuLog::Debug, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + LogFile->write(EQEmuLog::Debug, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8546,7 +8546,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - LogFile->write(EQEMuLog::Debug, "Item with no effect right clicked by %s", GetName()); + LogFile->write(EQEmuLog::Debug, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - LogFile->write(EQEMuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); + LogFile->write(EQEmuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8635,7 +8635,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - LogFile->write(EQEMuLog::Debug, "Drinking Alcohol from slot:%i", slot_id); + LogFile->write(EQEmuLog::Debug, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8662,7 +8662,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - LogFile->write(EQEMuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); + LogFile->write(EQEmuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8803,7 +8803,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -8890,7 +8890,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9050,7 +9050,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9087,7 +9087,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - LogFile->write(EQEMuLog::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + LogFile->write(EQEmuLog::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9112,7 +9112,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9168,7 +9168,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9345,7 +9345,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9402,7 +9402,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9537,7 +9537,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9557,7 +9557,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9582,7 +9582,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9654,7 +9654,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9678,7 +9678,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9716,7 +9716,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - LogFile->write(EQEMuLog::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9732,7 +9732,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9874,7 +9874,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9887,7 +9887,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10350,7 +10350,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10394,7 +10394,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10464,7 +10464,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - LogFile->write(EQEMuLog::Error, "Size mismatch for Pick Pocket packet"); + LogFile->write(EQEmuLog::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10534,7 +10534,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PopupResponse expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10569,7 +10569,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PotionBelt expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10577,7 +10577,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - LogFile->write(EQEMuLog::Debug, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + LogFile->write(EQEmuLog::Debug, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10600,7 +10600,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10690,7 +10690,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10717,7 +10717,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -10738,7 +10738,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11323,7 +11323,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11352,7 +11352,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11368,7 +11368,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11382,7 +11382,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - LogFile->write(EQEMuLog::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11396,14 +11396,14 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - LogFile->write(EQEMuLog::Debug, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + LogFile->write(EQEmuLog::Debug, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11455,7 +11455,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11464,7 +11464,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - LogFile->write(EQEMuLog::Debug, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + LogFile->write(EQEmuLog::Debug, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11524,7 +11524,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11687,7 +11687,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_RespawnWindow expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11738,14 +11738,14 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - LogFile->write(EQEMuLog::Error, "Unexpected OP_Sacrifice reply"); + LogFile->write(EQEmuLog::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11789,7 +11789,7 @@ void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - LogFile->write(EQEMuLog::Error, "Invalid size on OP_SelectTribute packet"); + LogFile->write(EQEmuLog::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11903,7 +11903,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - LogFile->write(EQEMuLog::Error, "Received invalid sized " + LogFile->write(EQEmuLog::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11923,7 +11923,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11937,7 +11937,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "No valid start zones found for /setstartcity"); + LogFile->write(EQEmuLog::Error, "No valid start zones found for /setstartcity"); return; } @@ -11988,7 +11988,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -12012,7 +12012,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12109,7 +12109,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12117,7 +12117,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "%s, purchase item..", GetName()); + LogFile->write(EQEmuLog::Debug, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12277,7 +12277,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - LogFile->write(EQEMuLog::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + LogFile->write(EQEmuLog::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12367,7 +12367,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + LogFile->write(EQEmuLog::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12523,7 +12523,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12816,7 +12816,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12853,7 +12853,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -12943,7 +12943,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - LogFile->write(EQEMuLog::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + LogFile->write(EQEmuLog::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13168,7 +13168,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13221,7 +13221,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - LogFile->write(EQEMuLog::Error, "Unable to generate OP_Track packet requested by client."); + LogFile->write(EQEmuLog::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13235,7 +13235,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13388,7 +13388,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13534,7 +13534,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) _log(TRADING__CLIENT, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - LogFile->write(EQEMuLog::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + LogFile->write(EQEmuLog::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13544,7 +13544,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Unknown size for OP_Trader: %i\n", app->size); - LogFile->write(EQEMuLog::Error, "Unknown size for OP_Trader: %i\n", app->size); + LogFile->write(EQEmuLog::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13582,7 +13582,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13618,7 +13618,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - LogFile->write(EQEMuLog::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13689,7 +13689,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - LogFile->write(EQEMuLog::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + LogFile->write(EQEmuLog::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13710,7 +13710,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13828,7 +13828,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - LogFile->write(EQEMuLog::Error, "Invalid size on OP_TributeToggle packet"); + LogFile->write(EQEmuLog::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13843,7 +13843,7 @@ void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - LogFile->write(EQEMuLog::Error, "Invalid size on OP_TributeUpdate packet"); + LogFile->write(EQEmuLog::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); @@ -13855,7 +13855,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - LogFile->write(EQEMuLog::Debug, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", + LogFile->write(EQEmuLog::Debug, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; @@ -13896,7 +13896,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13947,7 +13947,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13959,7 +13959,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - LogFile->write(EQEMuLog::Debug, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14182,7 +14182,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - LogFile->write(EQEMuLog::Debug, "Unhandled XTarget Type %i", Type); + LogFile->write(EQEmuLog::Debug, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 0b99b1c2a..6e21ecd36 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1035,7 +1035,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - LogFile->write(EQEMuLog::Debug, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + LogFile->write(EQEmuLog::Debug, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } @@ -1199,7 +1199,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - LogFile->write(EQEMuLog::Error,"Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + LogFile->write(EQEmuLog::Error,"Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } diff --git a/zone/command.cpp b/zone/command.cpp index b33a3ee6d..a0b9ae642 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -445,14 +445,14 @@ int command_init(void) { { cur->second->access = itr->second; #if EQDEBUG >=5 - LogFile->write(EQEMuLog::Debug, "command_init(): - Command '%s' set to access level %d." , cur->first.c_str(), itr->second); + LogFile->write(EQEmuLog::Debug, "command_init(): - Command '%s' set to access level %d." , cur->first.c_str(), itr->second); #endif } else { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - LogFile->write(EQEMuLog::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + LogFile->write(EQEmuLog::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -497,7 +497,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - LogFile->write(EQEMuLog::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + LogFile->write(EQEmuLog::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -571,12 +571,12 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - LogFile->write(EQEMuLog::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + LogFile->write(EQEmuLog::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif if(cur->function == nullptr) { - LogFile->write(EQEMuLog::Error, "Command '%s' has a null function\n", cstr.c_str()); + LogFile->write(EQEmuLog::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command @@ -1348,7 +1348,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEMuLog::Normal,"View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + LogFile->write(EQEmuLog::Normal,"View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1373,7 +1373,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEMuLog::Normal,"Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + LogFile->write(EQEmuLog::Normal,"Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1399,7 +1399,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEMuLog::Normal,"Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + LogFile->write(EQEmuLog::Normal,"Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1622,7 +1622,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - LogFile->write(EQEMuLog::Normal,"Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + LogFile->write(EQEmuLog::Normal,"Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1644,7 +1644,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - LogFile->write(EQEMuLog::Normal,"Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + LogFile->write(EQEmuLog::Normal,"Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1668,7 +1668,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - LogFile->write(EQEMuLog::Normal,"Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + LogFile->write(EQEmuLog::Normal,"Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -2010,7 +2010,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - LogFile->write(EQEMuLog::Normal,"Spawning database spawn"); + LogFile->write(EQEmuLog::Normal,"Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2330,7 +2330,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - LogFile->write(EQEMuLog::Normal,"Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + LogFile->write(EQEmuLog::Normal,"Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2355,7 +2355,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - LogFile->write(EQEMuLog::Normal,"Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + LogFile->write(EQEmuLog::Normal,"Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2375,7 +2375,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - LogFile->write(EQEMuLog::Normal,"Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + LogFile->write(EQEmuLog::Normal,"Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -2465,7 +2465,7 @@ void command_spawn(Client *c, const Seperator *sep) } } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug,"#spawn Spawning:"); + LogFile->write(EQEmuLog::Debug,"#spawn Spawning:"); #endif NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), c); @@ -3170,7 +3170,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEMuLog::Normal,"Petition list requested by %s", c->GetName()); + LogFile->write(EQEmuLog::Normal,"Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3827,7 +3827,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - LogFile->write(EQEMuLog::Normal,"#lastname request from %s for %s", c->GetName(), t->GetName()); + LogFile->write(EQEmuLog::Normal,"#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4450,7 +4450,7 @@ void command_time(Client *c, const Seperator *sep) ); c->Message(13, "It is now %s.", timeMessage); #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug,"Recieved timeMessage:%s", timeMessage); + LogFile->write(EQEmuLog::Debug,"Recieved timeMessage:%s", timeMessage); #endif } } @@ -4925,7 +4925,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - LogFile->write(EQEMuLog::Normal,"Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + LogFile->write(EQEmuLog::Normal,"Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5277,7 +5277,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - LogFile->write(EQEMuLog::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + LogFile->write(EQEmuLog::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5334,7 +5334,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - LogFile->write(EQEMuLog::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + LogFile->write(EQEmuLog::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5381,7 +5381,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - LogFile->write(EQEMuLog::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + LogFile->write(EQEmuLog::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -6809,15 +6809,15 @@ void command_logs(Client *c, const Seperator *sep) } if(!strcasecmp(sep->arg[1], "status" ) ) - client_logs.subscribe(EQEMuLog::Status, t); + client_logs.subscribe(EQEmuLog::Status, t); else if(!strcasecmp(sep->arg[1], "normal" ) ) - client_logs.subscribe(EQEMuLog::Normal, t); + client_logs.subscribe(EQEmuLog::Normal, t); else if(!strcasecmp(sep->arg[1], "error" ) ) - client_logs.subscribe(EQEMuLog::Error, t); + client_logs.subscribe(EQEmuLog::Error, t); else if(!strcasecmp(sep->arg[1], "debug" ) ) - client_logs.subscribe(EQEMuLog::Debug, t); + client_logs.subscribe(EQEmuLog::Debug, t); else if(!strcasecmp(sep->arg[1], "quest" ) ) - client_logs.subscribe(EQEMuLog::Quest, t); + client_logs.subscribe(EQEmuLog::Quest, t); else if(!strcasecmp(sep->arg[1], "all" ) ) client_logs.subscribeAll(t); else { @@ -6841,15 +6841,15 @@ void command_nologs(Client *c, const Seperator *sep) } if(!strcasecmp(sep->arg[1], "status" ) ) - client_logs.unsubscribe(EQEMuLog::Status, t); + client_logs.unsubscribe(EQEmuLog::Status, t); else if(!strcasecmp(sep->arg[1], "normal" ) ) - client_logs.unsubscribe(EQEMuLog::Normal, t); + client_logs.unsubscribe(EQEmuLog::Normal, t); else if(!strcasecmp(sep->arg[1], "error" ) ) - client_logs.unsubscribe(EQEMuLog::Error, t); + client_logs.unsubscribe(EQEmuLog::Error, t); else if(!strcasecmp(sep->arg[1], "debug" ) ) - client_logs.unsubscribe(EQEMuLog::Debug, t); + client_logs.unsubscribe(EQEmuLog::Debug, t); else if(!strcasecmp(sep->arg[1], "quest" ) ) - client_logs.unsubscribe(EQEMuLog::Quest, t); + client_logs.unsubscribe(EQEmuLog::Quest, t); else if(!strcasecmp(sep->arg[1], "all" ) ) client_logs.unsubscribeAll(t); else { @@ -8140,7 +8140,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - LogFile->write(EQEMuLog::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + LogFile->write(EQEmuLog::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { diff --git a/zone/corpse.cpp b/zone/corpse.cpp index d5db03856..433fc9a66 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -841,7 +841,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - LogFile->write(EQEMuLog::Debug, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + LogFile->write(EQEmuLog::Debug, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -871,10 +871,10 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - LogFile->write(EQEMuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); + LogFile->write(EQEmuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); } else { - LogFile->write(EQEMuLog::Error, "Unable to bury %s player corpse.", this->GetName()); + LogFile->write(EQEmuLog::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } @@ -1082,7 +1082,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + LogFile->write(EQEmuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index 50f1e8eaa..a745265cf 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -302,7 +302,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - LogFile->write(EQEMuLog::Debug, "Client has lockpicks: skill=%f", modskill); + LogFile->write(EQEmuLog::Debug, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -559,13 +559,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - LogFile->write(EQEMuLog::Debug, + LogFile->write(EQEmuLog::Debug, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - LogFile->write(EQEMuLog::Debug, + LogFile->write(EQEmuLog::Debug, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - LogFile->write(EQEMuLog::Debug, + LogFile->write(EQEmuLog::Debug, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } @@ -644,7 +644,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - LogFile->write(EQEMuLog::Status, "Loading Doors from database..."); + LogFile->write(EQEmuLog::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/effects.cpp b/zone/effects.cpp index c236fb942..ec463bddf 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -460,7 +460,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - LogFile->write(EQEMuLog::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + LogFile->write(EQEmuLog::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index bfac13660..c39426953 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - LogFile->write(EQEMuLog::Status, "Error re-initializing perlembed: %s", e.what()); + LogFile->write(EQEmuLog::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index e9f9d0974..e75575b7c 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - LogFile->write(EQEMuLog::Error, "boot_quest does not take any arguments."); + LogFile->write(EQEmuLog::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 92a59d075..e356ff7ac 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -139,12 +139,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - LogFile->write(EQEMuLog::Quest, "perl error: %s", err); + LogFile->write(EQEmuLog::Quest, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - LogFile->write(EQEMuLog::Quest, "Tying perl output to eqemu logs"); + LogFile->write(EQEmuLog::Quest, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -169,14 +169,14 @@ void Embperl::DoInit() { ,FALSE ); - LogFile->write(EQEMuLog::Quest, "Loading perlemb plugins."); + LogFile->write(EQEmuLog::Quest, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - LogFile->write(EQEMuLog::Quest, "Warning - plugin.pl: %s", err); + LogFile->write(EQEmuLog::Quest, "Warning - plugin.pl: %s", err); } try { @@ -194,7 +194,7 @@ void Embperl::DoInit() { } catch(const char *err) { - LogFile->write(EQEMuLog::Quest, "Perl warning: %s", err); + LogFile->write(EQEmuLog::Quest, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 164a0b2af..11b444ef0 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -63,7 +63,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - LogFile->write(EQEMuLog::Error, "boot_qc does not take any arguments."); + LogFile->write(EQEmuLog::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. @@ -96,7 +96,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - LogFile->writebuf(EQEMuLog::Quest, str + pos, 1, len); + LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); len = 0; pos = i+1; } else { @@ -104,7 +104,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - LogFile->writebuf(EQEMuLog::Quest, str + pos, 1, len); + LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index 0cdb3044f..3d91d0441 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - LogFile->write(EQEMuLog::Error, "nullptr group, %s:%i", fname, fline); + LogFile->write(EQEmuLog::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -529,12 +529,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - LogFile->write(EQEMuLog::Error, "About to delete a client still in a group."); + LogFile->write(EQEmuLog::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - LogFile->write(EQEMuLog::Error, "About to delete a client still in a raid."); + LogFile->write(EQEmuLog::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -566,7 +566,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - LogFile->write(EQEMuLog::Error, + LogFile->write(EQEmuLog::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -595,7 +595,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - LogFile->write(EQEMuLog::Error, + LogFile->write(EQEmuLog::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2530,7 +2530,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - LogFile->write(EQEMuLog::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + LogFile->write(EQEmuLog::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); diff --git a/zone/exp.cpp b/zone/exp.cpp index 1aafb8a3f..7edd70864 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - LogFile->write(EQEMuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + LogFile->write(EQEmuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - LogFile->write(EQEMuLog::Normal,"Setting Level for %s to %i", GetName(), set_level); + LogFile->write(EQEmuLog::Normal,"Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/forage.cpp b/zone/forage.cpp index 8476ceaad..6704e9b45 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -58,7 +58,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -69,7 +69,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - LogFile->write(EQEMuLog::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + LogFile->write(EQEmuLog::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -388,7 +388,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - LogFile->write(EQEMuLog::Error, "nullptr returned from database.GetItem in ClientForageItem"); + LogFile->write(EQEmuLog::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index a6d8be42b..b3e923aff 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1083,7 +1083,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1112,7 +1112,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 -LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); +LogFile->write(EQEmuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1123,7 +1123,7 @@ LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they arnt here anymore.... #if EQDEBUG >= 6 - LogFile->write(EQEMuLog::Debug, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1132,13 +1132,13 @@ LogFile->write(EQEMuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - LogFile->write(EQEMuLog::Debug, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } @@ -1473,7 +1473,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1519,7 +1519,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1566,7 +1566,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1717,7 +1717,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1766,7 +1766,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1794,7 +1794,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1877,7 +1877,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1888,7 +1888,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1958,7 +1958,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2039,7 +2039,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2056,7 +2056,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 58b0f006e..39785f3dd 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -413,7 +413,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -433,7 +433,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/horse.cpp b/zone/horse.cpp index 9a4e5240c..044c64e15 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -72,12 +72,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - LogFile->write(EQEMuLog::Error, "No Database entry for mount: %s, check the horses table", fileName); + LogFile->write(EQEmuLog::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -120,7 +120,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - LogFile->write(EQEMuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + LogFile->write(EQEmuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index fed4dde3b..42a05e175 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -532,7 +532,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - LogFile->write(EQEMuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + LogFile->write(EQEmuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -699,7 +699,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - LogFile->write(EQEMuLog::Debug, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + LogFile->write(EQEmuLog::Debug, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. @@ -1442,7 +1442,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + LogFile->write(EQEmuLog::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1457,7 +1457,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + LogFile->write(EQEmuLog::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 000bb9bb1..f652cdbe0 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - LogFile->write(EQEMuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + LogFile->write(EQEmuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - LogFile->write(EQEMuLog::Debug, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + LogFile->write(EQEmuLog::Debug, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index b82a22fda..b73c4fa0e 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -884,7 +884,7 @@ int32 Merc::CalcMaxMana() break; } default: { - LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -905,7 +905,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - LogFile->write(EQEMuLog::Debug, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + LogFile->write(EQEmuLog::Debug, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -4450,7 +4450,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5985,7 +5985,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); + LogFile->write(EQEmuLog::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6018,7 +6018,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in NPC::LoadMercTypes()"); + LogFile->write(EQEmuLog::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/net.cpp b/zone/net.cpp index 9b4080eb2..25c770f14 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -609,7 +609,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEMuLog::Error, "Error loading spells: %s", ex.what()); + LogFile->write(EQEmuLog::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index d6cf9ed9f..479a3d5a7 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - LogFile->write(EQEMuLog::Error, "Database error, invalid item"); + LogFile->write(EQEmuLog::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - LogFile->write(EQEMuLog::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + LogFile->write(EQEmuLog::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/object.cpp b/zone/object.cpp index 97832a6f8..c8bde8f1f 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - LogFile->write(EQEMuLog::Error, "Object::PutItem: Invalid index specified (%i)", index); + LogFile->write(EQEmuLog::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index b58e4ae2e..ed969b0ff 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,19 +61,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - LogFile->write(EQEMuLog::Status, "Path File %s loaded.", ZonePathFileName); + LogFile->write(EQEmuLog::Status, "Path File %s loaded.", ZonePathFileName); } else { - LogFile->write(EQEMuLog::Error, "Path File %s failed to load.", ZonePathFileName); + LogFile->write(EQEmuLog::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - LogFile->write(EQEMuLog::Error, "Path File %s not found.", ZonePathFileName); + LogFile->write(EQEmuLog::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,18 +103,18 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - LogFile->write(EQEMuLog::Error, "Bad Magic String in .path file."); + LogFile->write(EQEmuLog::Error, "Bad Magic String in .path file."); return false; } fread(&Head, sizeof(Head), 1, PathFile); - LogFile->write(EQEMuLog::Status, "Path File Header: Version %ld, PathNodes %ld", + LogFile->write(EQEmuLog::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { - LogFile->write(EQEMuLog::Error, "Unsupported path file version."); + LogFile->write(EQEmuLog::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - LogFile->write(EQEMuLog::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + LogFile->write(EQEmuLog::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 76f902a9d..0329675d7 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -212,7 +212,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -226,7 +226,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -253,12 +253,12 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "New petition created"); + LogFile->write(EQEmuLog::Debug, "New petition created"); #endif } @@ -272,7 +272,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 6bd92cdca..eb120d619 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - LogFile->write(EQEMuLog::Error, "Unable to find data for pet %s, check pets table.", pettype); + LogFile->write(EQEmuLog::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - LogFile->write(EQEMuLog::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + LogFile->write(EQEmuLog::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - LogFile->write(EQEMuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - LogFile->write(EQEMuLog::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + LogFile->write(EQEmuLog::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 53eed6787..1dd219032 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEMuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEMuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEMuLog::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEMuLog::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEMuLog::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - LogFile->write(EQEMuLog::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - LogFile->write(EQEMuLog::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - LogFile->write(EQEMuLog::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - LogFile->write(EQEMuLog::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - LogFile->write(EQEMuLog::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + LogFile->write(EQEmuLog::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - LogFile->write(EQEMuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - LogFile->write(EQEMuLog::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + LogFile->write(EQEmuLog::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 31d2b63c9..b01d169fd 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - LogFile->write(EQEMuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index eae93c8c7..f96c9872a 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - LogFile->write(EQEMuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - LogFile->write(EQEMuLog::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + LogFile->write(EQEmuLog::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 487e66a6d..bb9cb8abf 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - LogFile->write(EQEMuLog::Debug, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + LogFile->write(EQEmuLog::Debug, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 6b9eed9c0..70a7d3981 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -475,7 +475,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - LogFile->write(EQEMuLog::Debug, "Succor/Evacuation Spell In Same Zone."); + LogFile->write(EQEmuLog::Debug, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -484,7 +484,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - LogFile->write(EQEMuLog::Debug, "Succor/Evacuation Spell To Another Zone."); + LogFile->write(EQEmuLog::Debug, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -1771,7 +1771,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - LogFile->write(EQEMuLog::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + LogFile->write(EQEmuLog::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } @@ -3325,7 +3325,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - LogFile->write(EQEMuLog::Debug, "Unknown spell effect value forumula %d", formula); + LogFile->write(EQEmuLog::Debug, "Unknown spell effect value forumula %d", formula); } } @@ -4816,7 +4816,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5155,7 +5155,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEMuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index 2b5536bb3..f749f062d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -257,7 +257,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - LogFile->write(EQEMuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -269,7 +269,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - LogFile->write(EQEMuLog::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -290,7 +290,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - LogFile->write(EQEMuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -2672,7 +2672,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - LogFile->write(EQEMuLog::Debug, "CalcBuffDuration_formula: unknown formula %d", formula); + LogFile->write(EQEmuLog::Debug, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } @@ -4962,7 +4962,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4981,12 +4981,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + LogFile->write(EQEmuLog::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - LogFile->write(EQEMuLog::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + LogFile->write(EQEmuLog::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5000,7 +5000,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - LogFile->write(EQEMuLog::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + LogFile->write(EQEmuLog::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } @@ -5039,7 +5039,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - LogFile->write(EQEMuLog::Normal, + LogFile->write(EQEmuLog::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 1f6e381fd..d6f285de6 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEMuLog::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + LogFile->write(EQEmuLog::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - LogFile->write(EQEMuLog::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + LogFile->write(EQEmuLog::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - LogFile->write(EQEMuLog::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + LogFile->write(EQEmuLog::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -323,7 +323,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -362,7 +362,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -466,7 +466,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - LogFile->write(EQEMuLog::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + LogFile->write(EQEmuLog::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - LogFile->write(EQEMuLog::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + LogFile->write(EQEmuLog::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEMuLog::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + LogFile->write(EQEmuLog::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - LogFile->write(EQEMuLog::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - LogFile->write(EQEMuLog::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEMuLog::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + LogFile->write(EQEmuLog::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,7 +634,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - LogFile->write(EQEMuLog::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + LogFile->write(EQEmuLog::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - LogFile->write(EQEMuLog::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + LogFile->write(EQEmuLog::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -725,7 +725,7 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -774,7 +774,7 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { @@ -1280,7 +1280,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2938,7 +2938,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -2947,7 +2947,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -3088,7 +3088,7 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/titles.cpp b/zone/titles.cpp index a9e8454f1..109a793b3 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + LogFile->write(EQEmuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 453a8474b..e1cbbafc3 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - LogFile->write(EQEMuLog::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + LogFile->write(EQEmuLog::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - LogFile->write(EQEMuLog::Error, "Player tried to augment an item without a container set."); + LogFile->write(EQEmuLog::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - LogFile->write(EQEMuLog::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + LogFile->write(EQEmuLog::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - LogFile->write(EQEMuLog::Error, "Replace container combine executed in a world container."); + LogFile->write(EQEmuLog::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - LogFile->write(EQEMuLog::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + LogFile->write(EQEmuLog::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine: no components returned"); + LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - LogFile->write(EQEMuLog::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + LogFile->write(EQEmuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails: no components returned"); + LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - LogFile->write(EQEMuLog::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - LogFile->write(EQEMuLog::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + LogFile->write(EQEmuLog::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - LogFile->write(EQEMuLog::Error, "Combine error: Incorrect container is being used!"); + LogFile->write(EQEmuLog::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - LogFile->write(EQEMuLog::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + LogFile->write(EQEmuLog::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - LogFile->write(EQEMuLog::Error, "Error in GetTradeRecept success: no success items returned"); + LogFile->write(EQEmuLog::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,12 +1477,12 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if (results.RowCount() != 1) { - LogFile->write(EQEMuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + LogFile->write(EQEmuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 7d66adb30..d8c67588f 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -85,7 +85,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - LogFile->write(EQEMuLog::Debug, "Programming error: NPC's should not call Trade::AddEntity()"); + LogFile->write(EQEmuLog::Debug, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -295,7 +295,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - LogFile->write(EQEMuLog::Debug, "Dumping trade data: '%s' in TradeState %i with '%s'", + LogFile->write(EQEmuLog::Debug, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -306,7 +306,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - LogFile->write(EQEMuLog::Debug, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + LogFile->write(EQEmuLog::Debug, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -314,7 +314,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - LogFile->write(EQEMuLog::Debug, "\tBagItem %i (Charges=%i, Slot=%i)", + LogFile->write(EQEmuLog::Debug, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -323,7 +323,7 @@ void Trade::DumpTrade() } } - LogFile->write(EQEMuLog::Debug, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + LogFile->write(EQEmuLog::Debug, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif @@ -1538,7 +1538,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - LogFile->write(EQEMuLog::Error, "Bazaar: Zero price transaction between %s and %s aborted." + LogFile->write(EQEmuLog::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); diff --git a/zone/trap.cpp b/zone/trap.cpp index 182cc8915..e48f9edf4 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index bbe8c1ef9..9fc6638e1 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - LogFile->write(EQEMuLog::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + LogFile->write(EQEmuLog::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - LogFile->write(EQEMuLog::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + LogFile->write(EQEmuLog::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - LogFile->write(EQEMuLog::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + LogFile->write(EQEmuLog::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index da5ecb7bc..9a9192397 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -116,7 +116,7 @@ void NPC::ResumeWandering() } else { - LogFile->write(EQEMuLog::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + LogFile->write(EQEmuLog::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - LogFile->write(EQEMuLog::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + LogFile->write(EQEmuLog::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - LogFile->write(EQEMuLog::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + LogFile->write(EQEmuLog::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - LogFile->write(EQEMuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - LogFile->write(EQEMuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index b0d958e7c..d76fec5c0 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1384,7 +1384,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - LogFile->write(EQEMuLog::Error,"Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + LogFile->write(EQEmuLog::Error,"Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } diff --git a/zone/zone.cpp b/zone/zone.cpp index 13f480332..fc134a735 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -83,7 +83,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - LogFile->write(EQEMuLog::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + LogFile->write(EQEmuLog::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -110,13 +110,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - LogFile->write(EQEMuLog::Status, "General logging level: %i", zone->loglevelvar); + LogFile->write(EQEmuLog::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - LogFile->write(EQEMuLog::Status, "Merchant logging level: %i", zone->merchantvar); + LogFile->write(EQEmuLog::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - LogFile->write(EQEMuLog::Status, "Trade logging level: %i", zone->tradevar); + LogFile->write(EQEmuLog::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - LogFile->write(EQEMuLog::Status, "Loot logging level: %i", zone->lootvar); + LogFile->write(EQEmuLog::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -137,8 +137,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - LogFile->write(EQEMuLog::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - LogFile->write(EQEMuLog::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + LogFile->write(EQEmuLog::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + LogFile->write(EQEmuLog::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -156,11 +156,11 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEMuLog::Status, "Loading Objects from DB..."); + LogFile->write(EQEmuLog::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -277,7 +277,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - LogFile->write(EQEMuLog::Status, "Loading Ground Spawns from DB..."); + LogFile->write(EQEmuLog::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -391,7 +391,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - LogFile->write(EQEMuLog::Status, "Loading Temporary Merchant Lists..."); + LogFile->write(EQEmuLog::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -409,7 +409,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -442,7 +442,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -463,7 +463,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - LogFile->write(EQEMuLog::Status, "Loading Merchant Lists..."); + LogFile->write(EQEmuLog::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -486,7 +486,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - LogFile->write(EQEMuLog::Debug, "No Merchant Data found for %s.", GetShortName()); + LogFile->write(EQEmuLog::Debug, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -536,7 +536,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -559,7 +559,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -603,7 +603,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -627,7 +627,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadMercSpells()"); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -649,7 +649,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - LogFile->write(EQEMuLog::Debug, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + LogFile->write(EQEmuLog::Debug, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -696,11 +696,11 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - LogFile->write(EQEMuLog::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + LogFile->write(EQEmuLog::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - LogFile->write(EQEMuLog::Normal, "Zone shutdown: going to sleep"); + LogFile->write(EQEmuLog::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); @@ -712,19 +712,19 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - LogFile->write(EQEMuLog::Status, "Loading doors for %s ...", zone); + LogFile->write(EQEmuLog::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - LogFile->write(EQEMuLog::Status, "... No doors loaded."); + LogFile->write(EQEmuLog::Status, "... No doors loaded."); return; } Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - LogFile->write(EQEMuLog::Error, "... Failed to load doors."); + LogFile->write(EQEmuLog::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -788,12 +788,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - LogFile->write(EQEMuLog::Debug, "Graveyard ID is %i.", graveyard_id()); + LogFile->write(EQEmuLog::Debug, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - LogFile->write(EQEMuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + LogFile->write(EQEmuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - LogFile->write(EQEMuLog::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + LogFile->write(EQEmuLog::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -801,7 +801,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - LogFile->write(EQEMuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + LogFile->write(EQEmuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -886,56 +886,56 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - LogFile->write(EQEMuLog::Status, "Loading spawn conditions..."); + LogFile->write(EQEmuLog::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - LogFile->write(EQEMuLog::Error, "Loading spawn conditions failed, continuing without them."); + LogFile->write(EQEmuLog::Error, "Loading spawn conditions failed, continuing without them."); } - LogFile->write(EQEMuLog::Status, "Loading static zone points..."); + LogFile->write(EQEmuLog::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - LogFile->write(EQEMuLog::Error, "Loading static zone points failed."); + LogFile->write(EQEmuLog::Error, "Loading static zone points failed."); return false; } - LogFile->write(EQEMuLog::Status, "Loading spawn groups..."); + LogFile->write(EQEmuLog::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - LogFile->write(EQEMuLog::Error, "Loading spawn groups failed."); + LogFile->write(EQEmuLog::Error, "Loading spawn groups failed."); return false; } - LogFile->write(EQEMuLog::Status, "Loading spawn2 points..."); + LogFile->write(EQEmuLog::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - LogFile->write(EQEMuLog::Error, "Loading spawn2 points failed."); + LogFile->write(EQEmuLog::Error, "Loading spawn2 points failed."); return false; } - LogFile->write(EQEMuLog::Status, "Loading player corpses..."); + LogFile->write(EQEmuLog::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - LogFile->write(EQEMuLog::Error, "Loading player corpses failed."); + LogFile->write(EQEmuLog::Error, "Loading player corpses failed."); return false; } - LogFile->write(EQEMuLog::Status, "Loading traps..."); + LogFile->write(EQEmuLog::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - LogFile->write(EQEMuLog::Error, "Loading traps failed."); + LogFile->write(EQEmuLog::Error, "Loading traps failed."); return false; } - LogFile->write(EQEMuLog::Status, "Loading adventure flavor text..."); + LogFile->write(EQEmuLog::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - LogFile->write(EQEMuLog::Status, "Loading ground spawns..."); + LogFile->write(EQEmuLog::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - LogFile->write(EQEMuLog::Error, "Loading ground spawns failed. continuing."); + LogFile->write(EQEmuLog::Error, "Loading ground spawns failed. continuing."); } - LogFile->write(EQEMuLog::Status, "Loading World Objects from DB..."); + LogFile->write(EQEmuLog::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - LogFile->write(EQEMuLog::Error, "Loading World Objects failed. continuing."); + LogFile->write(EQEmuLog::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -992,10 +992,10 @@ bool Zone::Init(bool iStaticZone) { } } - LogFile->write(EQEMuLog::Status, "Loading timezone data..."); + LogFile->write(EQEmuLog::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - LogFile->write(EQEMuLog::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + LogFile->write(EQEmuLog::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1006,32 +1006,32 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - LogFile->write(EQEMuLog::Status, "Reloading Zone Static Data..."); + LogFile->write(EQEmuLog::Status, "Reloading Zone Static Data..."); - LogFile->write(EQEMuLog::Status, "Reloading static zone points..."); + LogFile->write(EQEmuLog::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - LogFile->write(EQEMuLog::Error, "Loading static zone points failed."); + LogFile->write(EQEmuLog::Error, "Loading static zone points failed."); } - LogFile->write(EQEMuLog::Status, "Reloading traps..."); + LogFile->write(EQEmuLog::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - LogFile->write(EQEMuLog::Error, "Reloading traps failed."); + LogFile->write(EQEmuLog::Error, "Reloading traps failed."); } - LogFile->write(EQEMuLog::Status, "Reloading ground spawns..."); + LogFile->write(EQEmuLog::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - LogFile->write(EQEMuLog::Error, "Reloading ground spawns failed. continuing."); + LogFile->write(EQEmuLog::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - LogFile->write(EQEMuLog::Status, "Reloading World Objects from DB..."); + LogFile->write(EQEmuLog::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - LogFile->write(EQEMuLog::Error, "Reloading World Objects failed. continuing."); + LogFile->write(EQEmuLog::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1047,7 +1047,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - LogFile->write(EQEMuLog::Status, "Zone Static Data Reloaded."); + LogFile->write(EQEmuLog::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1059,7 +1059,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - LogFile->write(EQEMuLog::Error, "Error loading the Zone Config."); + LogFile->write(EQEmuLog::Error, "Error loading the Zone Config."); return false; } } @@ -1074,7 +1074,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - LogFile->write(EQEMuLog::Error, "Error loading the Zone Config."); + LogFile->write(EQEmuLog::Error, "Error loading the Zone Config."); return false; } } @@ -1085,7 +1085,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - LogFile->write(EQEMuLog::Status, "Successfully loaded Zone Config."); + LogFile->write(EQEmuLog::Status, "Successfully loaded Zone Config."); return true; } @@ -1390,11 +1390,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - LogFile->write(EQEMuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + LogFile->write(EQEmuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - LogFile->write(EQEMuLog::Debug, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + LogFile->write(EQEmuLog::Debug, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1479,7 +1479,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - LogFile->write(EQEMuLog::Debug, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + LogFile->write(EQEmuLog::Debug, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); @@ -1567,8 +1567,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - LogFile->write(EQEMuLog::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - LogFile->write(EQEMuLog::Status, ". %f x %f y %f z ", x, y, z); + LogFile->write(EQEmuLog::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + LogFile->write(EQEmuLog::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1848,7 +1848,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - LogFile->write(EQEMuLog::Error, "... Failed to load blocked spells."); + LogFile->write(EQEmuLog::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1983,7 +1983,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2004,7 +2004,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2046,7 +2046,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2092,7 +2092,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2140,7 +2140,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2215,7 +2215,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2249,7 +2249,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zone_logsys.cpp b/zone/zone_logsys.cpp index c9ea6255d..50362c6b1 100644 --- a/zone/zone_logsys.cpp +++ b/zone/zone_logsys.cpp @@ -34,7 +34,7 @@ void log_message_mob(LogType type, Mob *who, const char *fmt, ...) { va_list args; va_start(args, fmt); - LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args); + LogFile->writePVA(EQEmuLog::Debug, prefix_buffer, fmt, args); va_end(args); } @@ -46,7 +46,7 @@ void log_message_mobVA(LogType type, Mob *who, const char *fmt, va_list args) { snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetName()); prefix_buffer[255] = '\0'; - LogFile->writePVA(EQEMuLog::Debug, prefix_buffer, fmt, args); + LogFile->writePVA(EQEmuLog::Debug, prefix_buffer, fmt, args); } void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length, uint8 padding) { diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index baccaf3e9..a1fdb1a76 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - LogFile->write(EQEMuLog::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + LogFile->write(EQEmuLog::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + LogFile->write(EQEmuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id); + LogFile->write(EQEmuLog::Debug, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - LogFile->write(EQEMuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + LogFile->write(EQEmuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - LogFile->write(EQEMuLog::Status, "Loading Blocked Spells from database..."); + LogFile->write(EQEmuLog::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapwrite(EQEMuLog::Error, "Error in LoadAltCurrencyValues query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadAltCurrencyValues query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2866,7 +2866,7 @@ void ZoneDatabase::SaveBuffs(Client *client) { buffs[index].ExtraDIChance); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEMuLog::Error, "Error in SaveBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in SaveBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -2885,7 +2885,7 @@ void ZoneDatabase::LoadBuffs(Client *client) { "FROM `character_buffs` WHERE `character_id` = '%u'", client->CharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + LogFile->write(EQEmuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - LogFile->write(EQEMuLog::Error, "Unable to construct a player corpse for character id %u.", char_id); + LogFile->write(EQEmuLog::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 55d4d3366..9566a9a5c 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -43,12 +43,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - LogFile->write(EQEMuLog::Debug, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + LogFile->write(EQEmuLog::Debug, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - LogFile->write(EQEMuLog::Debug, "Zone request from %s", GetName()); + LogFile->write(EQEmuLog::Debug, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -96,7 +96,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -128,7 +128,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -159,7 +159,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - LogFile->write(EQEMuLog::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + LogFile->write(EQEmuLog::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -172,7 +172,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - LogFile->write(EQEMuLog::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + LogFile->write(EQEmuLog::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -192,7 +192,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - LogFile->write(EQEMuLog::Debug, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + LogFile->write(EQEmuLog::Debug, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -252,7 +252,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - LogFile->write(EQEMuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -287,7 +287,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - LogFile->write(EQEMuLog::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + LogFile->write(EQEmuLog::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -311,7 +311,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - LogFile->write(EQEMuLog::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + LogFile->write(EQEmuLog::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -346,7 +346,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - LogFile->write(EQEMuLog::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + LogFile->write(EQEmuLog::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it @@ -471,7 +471,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - LogFile->write(EQEMuLog::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + LogFile->write(EQEmuLog::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -533,7 +533,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - LogFile->write(EQEMuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + LogFile->write(EQEmuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -542,14 +542,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - LogFile->write(EQEMuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + LogFile->write(EQEmuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; SetHeading(heading); break; default: - LogFile->write(EQEMuLog::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + LogFile->write(EQEmuLog::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -767,7 +767,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -780,7 +780,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -790,7 +790,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } From 784a6974d103eee25b5bbdf2627a0e1a24b485c7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 8 Jan 2015 22:00:36 -0500 Subject: [PATCH 0757/1883] Range-based for for world/adventure.cpp --- world/adventure.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index c6272cb31..b5ba4aea1 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -392,8 +392,7 @@ void Adventure::MoveCorpsesToGraveyard() charid_list.push_back(atoi(row[1])); } - for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter) - { + for (auto &elem : dbid_list) { float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius); float z = GetTemplate()->graveyard_z; From 4f643c72016af40c8762c70835055da02b646129 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 8 Jan 2015 22:01:02 -0500 Subject: [PATCH 0758/1883] Range-based for for world/adventure_manager.cpp --- world/adventure_manager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 4a6756d5e..53d5fb191 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -30,9 +30,8 @@ AdventureManager::~AdventureManager() safe_delete(save_timer); safe_delete(leaderboard_info_timer); - for (auto iter = adventure_templates.begin(); iter != adventure_templates.end(); ++iter) { - delete iter->second; - } + for (auto &elem : adventure_templates) + delete elem.second; } void AdventureManager::Process() From 4fde4bba7212d9dc697b64e2a0d7f006d2161c1a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 8 Jan 2015 22:01:21 -0500 Subject: [PATCH 0759/1883] Range-based for for world/lfplist.cpp --- world/lfplist.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/world/lfplist.cpp b/world/lfplist.cpp index 52474dfda..47f91a8b3 100644 --- a/world/lfplist.cpp +++ b/world/lfplist.cpp @@ -30,11 +30,11 @@ extern ZSList zoneserver_list; GroupLFP::GroupLFP(uint32 inLeaderID) { LeaderID = inLeaderID; - for(unsigned int i=0; i Date: Thu, 8 Jan 2015 22:01:37 -0500 Subject: [PATCH 0760/1883] Range-based for for world/zonelist.cpp --- world/zonelist.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/world/zonelist.cpp b/world/zonelist.cpp index c6c1043f5..683181354 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -246,16 +246,16 @@ ZoneServer* ZSList::FindByInstanceID(uint32 InstanceID) } bool ZSList::SetLockedZone(uint16 iZoneID, bool iLock) { - for (int i=0; iSendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(pLockedZones[i], true)); + for (auto &zone : pLockedZones) { + if (zone) { + connection->SendEmoteMessageRaw(to, 0, 0, 0, database.GetZoneName(zone, true)); x++; } } From f6166bcb944b3e3295319f03326f0858967ccd9c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Thu, 8 Jan 2015 20:34:38 -0800 Subject: [PATCH 0761/1883] modified mysql results/row to be ready for range based for --- common/mysql_request_result.h | 2 +- common/mysql_request_row.cpp | 6 ++++++ common/mysql_request_row.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/mysql_request_result.h b/common/mysql_request_result.h index b2d6fe3d1..2944f528b 100644 --- a/common/mysql_request_result.h +++ b/common/mysql_request_result.h @@ -48,7 +48,7 @@ public: const std::string FieldName(int columnIndex); MySQLRequestRow& begin() { return m_CurrentRow; } - MySQLRequestRow& end() { return m_OneBeyondRow;} + MySQLRequestRow& end() { return m_OneBeyondRow; } private: void FreeInternals(); diff --git a/common/mysql_request_row.cpp b/common/mysql_request_row.cpp index 9491fd1b2..6f5300964 100644 --- a/common/mysql_request_row.cpp +++ b/common/mysql_request_row.cpp @@ -30,6 +30,12 @@ MySQLRequestRow& MySQLRequestRow::operator=(MySQLRequestRow& moveItem) return *this; } + +MySQLRequestRow MySQLRequestRow::operator*() +{ + return *this; +} + MySQLRequestRow::MySQLRequestRow(MYSQL_RES *result) : m_Result(result) { diff --git a/common/mysql_request_row.h b/common/mysql_request_row.h index 85fe7cb4f..06788025d 100644 --- a/common/mysql_request_row.h +++ b/common/mysql_request_row.h @@ -28,7 +28,7 @@ public: MySQLRequestRow operator++(int); bool operator==(const MySQLRequestRow& rhs); bool operator!=(const MySQLRequestRow& rhs); - + MySQLRequestRow operator*(); char* operator[](int index); }; From 4c9653d204e8851b5d4bcab73fd5d559661b9556 Mon Sep 17 00:00:00 2001 From: Trevius Date: Thu, 8 Jan 2015 23:28:22 -0600 Subject: [PATCH 0762/1883] Potential crash/bug fixes for Groups and Mercs. --- zone/entity.cpp | 10 ++++++---- zone/groups.cpp | 45 +++++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 3d91d0441..9905374fd 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2033,8 +2033,9 @@ void EntityList::RemoveAllMercs() void EntityList::RemoveAllGroups() { while (group_list.size()) { - safe_delete(group_list.front()); + auto group = group_list.front(); group_list.pop_front(); + delete group; } #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -2044,8 +2045,9 @@ void EntityList::RemoveAllGroups() void EntityList::RemoveAllRaids() { while (raid_list.size()) { - safe_delete(raid_list.front()); + auto raid = raid_list.front(); raid_list.pop_front(); + delete raid; } } @@ -2256,8 +2258,8 @@ bool EntityList::RemoveGroup(uint32 delete_id) while(iterator != group_list.end()) { if((*iterator)->GetID() == delete_id) { - safe_delete(*iterator); group_list.remove(*iterator); + delete *iterator; #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); #endif @@ -2280,8 +2282,8 @@ bool EntityList::RemoveRaid(uint32 delete_id) while(iterator != raid_list.end()) { if((*iterator)->GetID() == delete_id) { - safe_delete(*iterator); raid_list.remove(*iterator); + delete *iterator; return true; } ++iterator; diff --git a/zone/groups.cpp b/zone/groups.cpp index cf016e759..6adc6735a 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -231,7 +231,6 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte if(owner) { CharacterID = owner->CastToClient()->CharacterID(); - NewMemberName = newmember->GetName(); } ismerc = true; } @@ -282,14 +281,7 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte if (members[i] != nullptr && members[i] != newmember) { //fill in group join & send it - if(members[i]->IsMerc()) - { - strcpy(gj->yourname, members[i]->GetName()); - } - else - { - strcpy(gj->yourname, members[i]->GetCleanName()); - } + strcpy(gj->yourname, members[i]->GetCleanName()); if(members[i]->IsClient()) { members[i]->CastToClient()->QueuePacket(outapp); @@ -336,7 +328,7 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte Client* owner = newmember->CastToMerc()->GetMercOwner(); if(owner) { - database.SetGroupID(newmember->GetName(), GetID(), owner->CharacterID(), true); + database.SetGroupID(NewMemberName, GetID(), owner->CharacterID(), true); } } #ifdef BOTS @@ -475,7 +467,7 @@ bool Group::UpdatePlayer(Mob* update){ for (i = 0; i < MAX_GROUP_MEMBERS; i++) { - if (!strcasecmp(membername[i],update->GetName())) + if (!strcasecmp(membername[i],update->GetCleanName())) { members[i] = update; members[i]->SetGrouped(true); @@ -545,7 +537,7 @@ void Group::SendGroupJoinOOZ(Mob* NewMember) { gj->gid = GetID(); gj->zoneid = zone->GetZoneID(); gj->instance_id = zone->GetInstanceID(); - strcpy(gj->member_name, NewMember->GetName()); + strcpy(gj->member_name, NewMember->GetCleanName()); worldserver.SendPacket(pack); safe_delete(pack); @@ -645,7 +637,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) gl->gid = GetID(); gl->zoneid = zone->GetZoneID(); gl->instance_id = zone->GetInstanceID(); - strcpy(gl->member_name, oldmember->GetName()); + strcpy(gl->member_name, oldmember->GetCleanName()); worldserver.SendPacket(pack); safe_delete(pack); @@ -696,7 +688,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) Client* owner = oldmember->CastToMerc()->GetMercOwner(); if(owner) { - database.SetGroupID(oldmember->GetName(), 0, owner->CharacterID(), true); + database.SetGroupID(oldmember->GetCleanName(), 0, owner->CharacterID(), true); } } @@ -706,19 +698,19 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) if(HasRole(oldmember, RoleTank)) { SetGroupTankTarget(0); - UnDelegateMainTank(oldmember->GetName()); + UnDelegateMainTank(oldmember->GetCleanName()); } if(HasRole(oldmember, RoleAssist)) { SetGroupAssistTarget(0); - UnDelegateMainAssist(oldmember->GetName()); + UnDelegateMainAssist(oldmember->GetCleanName()); } if(HasRole(oldmember, RolePuller)) { SetGroupPullerTarget(0); - UnDelegatePuller(oldmember->GetName()); + UnDelegatePuller(oldmember->GetCleanName()); } if (oldmember->GetName() == mentoree_name) @@ -858,7 +850,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch gcm->zoneid = zone->GetZoneID(); gcm->groupid = GetID(); gcm->instanceid = zone->GetInstanceID(); - strcpy(gcm->from, sender->GetName()); + strcpy(gcm->from, sender->GetCleanName()); strcpy(gcm->message, message); worldserver.SendPacket(pack); safe_delete(pack); @@ -900,8 +892,8 @@ void Group::DisbandGroup() { Leader = members[i]->CastToClient(); } - strcpy(gu->yourname, members[i]->GetName()); - database.SetGroupID(members[i]->GetName(), 0, members[i]->CastToClient()->CharacterID(), false); + strcpy(gu->yourname, members[i]->GetCleanName()); + database.SetGroupID(members[i]->GetCleanName(), 0, members[i]->CastToClient()->CharacterID(), false); members[i]->CastToClient()->QueuePacket(outapp); SendMarkedNPCsToMember(members[i]->CastToClient(), true); } @@ -911,7 +903,7 @@ void Group::DisbandGroup() { Client* owner = members[i]->CastToMerc()->GetMercOwner(); if(owner) { - database.SetGroupID(members[i]->GetName(), 0, owner->CharacterID(), true); + database.SetGroupID(members[i]->GetCleanName(), 0, owner->CharacterID(), true); } } @@ -930,12 +922,13 @@ void Group::DisbandGroup() { worldserver.SendPacket(pack); safe_delete(pack); - entity_list.RemoveGroup(GetID()); if(GetID() != 0) { database.ClearGroup(GetID()); } + entity_list.RemoveGroup(GetID()); + if(Leader && (Leader->IsLFP())) { Leader->UpdateLFP(); @@ -975,7 +968,7 @@ void Group::SendUpdate(uint32 type, Mob* member) for (uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) if (members[i] != nullptr && members[i] != member) - strcpy(gu->membername[x++], members[i]->GetName()); + strcpy(gu->membername[x++], members[i]->GetCleanName()); member->CastToClient()->QueuePacket(outapp); @@ -1156,7 +1149,7 @@ void Client::LeaveGroup() { { int32 MemberCount = g->GroupCount(); // Account for both client and merc leaving the group - if (GetMerc() && GetMerc()->HasGroup() && GetMerc()->GetGroup() == g) + if (GetMerc() && g == GetMerc()->GetGroup()) { MemberCount -= 1; } @@ -1177,10 +1170,10 @@ void Client::LeaveGroup() { else { //force things a little - database.SetGroupID(GetName(), 0, CharacterID(), false); + database.SetGroupID(GetCleanName(), 0, CharacterID(), false); if (GetMerc()) { - database.SetGroupID(GetMerc()->GetName(), 0, CharacterID(), true); + database.SetGroupID(GetMerc()->GetCleanName(), 0, CharacterID(), true); } } From c33973f20aa31a66650c55e296762c7dc08eff0b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 02:44:20 -0500 Subject: [PATCH 0763/1883] Optimize EntityList::RemoveGroup/RemoveRaid lambdas are cheating btw. --- zone/entity.cpp | 48 +++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9905374fd..296144a3d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2251,44 +2251,30 @@ bool EntityList::RemoveCorpse(uint16 delete_id) bool EntityList::RemoveGroup(uint32 delete_id) { - std::list::iterator iterator; - - iterator = group_list.begin(); - - while(iterator != group_list.end()) - { - if((*iterator)->GetID() == delete_id) { - group_list.remove(*iterator); - delete *iterator; + auto it = std::find_if(group_list.begin(), group_list.end(), + [delete_id](const Group *a) { return a->GetID() == delete_id; }); + if (it == group_list.end()) { #if EQDEBUG >= 5 - CheckGroupList (__FILE__, __LINE__); + CheckGroupList (__FILE__, __LINE__); #endif - return true; - } - ++iterator; + return false; } -#if EQDEBUG >= 5 - CheckGroupList (__FILE__, __LINE__); -#endif - return false; + auto group = *it; + group_list.erase(it); + delete group; + return true; } bool EntityList::RemoveRaid(uint32 delete_id) { - std::list::iterator iterator; - - iterator = raid_list.begin(); - - while(iterator != raid_list.end()) - { - if((*iterator)->GetID() == delete_id) { - raid_list.remove(*iterator); - delete *iterator; - return true; - } - ++iterator; - } - return false; + auto it = std::find_if(raid_list.begin(), raid_list.end(), + [delete_id](const Raid *a) { return a->GetID() == delete_id; }); + if (it == raid_list.end()) + return false; + auto raid = *it; + raid_list.erase(it); + delete raid; + return true; } void EntityList::Clear() From 1873b1d7398b2966c6fb81948e1ecb67abeaf55f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 02:50:13 -0500 Subject: [PATCH 0764/1883] Ranged-based for for ucs/clientlist.cpp --- ucs/clientlist.cpp | 60 +++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 8a60fc749..80e7d394e 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -280,11 +280,11 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { int VisibleRecipients = 0; - for(unsigned int i = 0; iMailBoxName(), Subject, Body, RecipientsString)) { + if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - _log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipients[i].c_str(), - c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); + _log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); - int PacketLength = 10 + Recipients[i].length() + Subject.length(); + int PacketLength = 10 + Recipient.length() + Subject.length(); // Failure EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, PacketLength); @@ -316,7 +316,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x20); - VARSTRUCT_ENCODE_STRING(PacketBuffer, Recipients[i].c_str()); + VARSTRUCT_ENCODE_STRING(PacketBuffer, Recipient.c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, Subject.c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, "0"); VARSTRUCT_ENCODE_TYPE(uint16, PacketBuffer, 0x3237); @@ -505,8 +505,8 @@ Client::Client(EQStream *eqs) { AllowInvites = true; Revoked = false; - for(int i = 0; i < MAX_JOINED_CHANNELS ; i++) - JoinedChannels[i] = nullptr; + for (auto &elem : JoinedChannels) + elem = nullptr; TotalKarma = 0; AttemptedMessages = 0; @@ -995,8 +995,8 @@ int Client::ChannelCount() { int NumberOfChannels = 0; - for(int i = 0; i < MAX_JOINED_CHANNELS; i++) - if(JoinedChannels[i]) + for (auto &elem : JoinedChannels) + if (elem) NumberOfChannels++; return NumberOfChannels; @@ -1005,11 +1005,9 @@ int Client::ChannelCount() { void Client::JoinChannels(std::string ChannelNameList) { - for(int x = 0; x < ChannelNameList.size(); ++x) - { - if(ChannelNameList[x] == '%') - { - ChannelNameList[x] = '/'; + for (auto &elem : ChannelNameList) { + if (elem == '%') { + elem = '/'; } } @@ -1203,13 +1201,13 @@ void Client::LeaveChannels(std::string ChannelNameList) { void Client::LeaveAllChannels(bool SendUpdatedChannelList) { - for(int i = 0; i < MAX_JOINED_CHANNELS; i++) { + for (auto &elem : JoinedChannels) { - if(JoinedChannels[i]) { + if (elem) { - ChannelList->RemoveClientFromChannel(JoinedChannels[i]->GetName(), this); + ChannelList->RemoveClientFromChannel(elem->GetName(), this); - JoinedChannels[i] = nullptr; + elem = nullptr; } } @@ -1310,11 +1308,9 @@ void Client::SendChannelMessage(std::string Message) if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) { CharacterEntry *char_ent = nullptr; - for(int x = 0; x < Characters.size(); ++x) - { - if(Characters[x].Name.compare(GetName()) == 0) - { - char_ent = &Characters[x]; + for (auto &elem : Characters) { + if (elem.Name.compare(GetName()) == 0) { + char_ent = &elem; break; } } @@ -1423,11 +1419,9 @@ void Client::SendChannelMessageByNumber(std::string Message) { if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit)) { CharacterEntry *char_ent = nullptr; - for(int x = 0; x < Characters.size(); ++x) - { - if(Characters[x].Name.compare(GetName()) == 0) - { - char_ent = &Characters[x]; + for (auto &elem : Characters) { + if (elem.Name.compare(GetName()) == 0) { + char_ent = &elem; break; } } From b34b26c42393c22d12f4d83045b1845b9b8c097a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 02:57:00 -0500 Subject: [PATCH 0765/1883] clang-modernize -use-auto convert for ucs/clientlist.cpp --- ucs/clientlist.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 80e7d394e..08b01f077 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -225,7 +225,7 @@ std::vector ParseRecipients(std::string RecipientString) { sort(RecipientList.begin(), RecipientList.end()); - std::vector::iterator new_end_pos = unique(RecipientList.begin(), RecipientList.end()); + auto new_end_pos = unique(RecipientList.begin(), RecipientList.end()); RecipientList.erase(new_end_pos, RecipientList.end()); @@ -310,7 +310,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { int PacketLength = 10 + Recipient.length() + Subject.length(); // Failure - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, PacketLength); + auto outapp = new EQApplicationPacket(OP_MailDeliveryStatus, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -334,7 +334,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if(Success) { // Success - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailDeliveryStatus, 10); + auto outapp = new EQApplicationPacket(OP_MailDeliveryStatus, 10); char *PacketBuffer = (char *)outapp->pBuffer; @@ -407,7 +407,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { if(Buddy.substr(0, 1) == "-") SubAction = 0; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Buddy, Buddy.length() + 2); + auto outapp = new EQApplicationPacket(OP_Buddy, Buddy.length() + 2); char *PacketBuffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, SubAction); @@ -458,7 +458,7 @@ static void ProcessCommandIgnore(Client *c, std::string Ignoree) { Ignoree = "SOE.EQ." + WorldShortName + "." + Ignoree; } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Ignore, Ignoree.length() + 2); + auto outapp = new EQApplicationPacket(OP_Ignore, Ignoree.length() + 2); char *PacketBuffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, SubAction); @@ -589,7 +589,7 @@ void Clientlist::Process() { eqs->SetOpcodeManager(&ChatOpMgr); - Client *c = new Client(eqs); + auto c = new Client(eqs); ClientChatConnections.push_back(c); } @@ -931,7 +931,7 @@ void Client::SendMailBoxes() { PacketLength += s.length() + 1; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailLogin, PacketLength); + auto outapp = new EQApplicationPacket(OP_MailLogin, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1080,8 +1080,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Mail, JoinedChannelsList.length() + 1); + auto outapp = new EQApplicationPacket(OP_Mail, JoinedChannelsList.length() + 1); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1168,8 +1167,7 @@ void Client::LeaveChannels(std::string ChannelNameList) { } } - - EQApplicationPacket *outapp = new EQApplicationPacket(OP_Mail, JoinedChannelsList.length() + 1); + auto outapp = new EQApplicationPacket(OP_Mail, JoinedChannelsList.length() + 1); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1268,7 +1266,7 @@ void Client::SendChannelList() { if(ChannelCount == 0) ChannelMessage = "You are not on any channels."; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelMessage, ChannelMessage.length() + 3); + auto outapp = new EQApplicationPacket(OP_ChannelMessage, ChannelMessage.length() + 3); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1506,7 +1504,7 @@ void Client::SendChannelMessage(std::string ChannelName, std::string Message, Cl if(UnderfootOrLater) PacketLength += 8; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelMessage, PacketLength); + auto outapp = new EQApplicationPacket(OP_ChannelMessage, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1548,7 +1546,7 @@ void Client::AnnounceJoin(ChatChannel *Channel, Client *c) { int PacketLength = Channel->GetName().length() + c->GetName().length() + 2; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelAnnounceJoin, PacketLength); + auto outapp = new EQApplicationPacket(OP_ChannelAnnounceJoin, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1568,7 +1566,7 @@ void Client::AnnounceLeave(ChatChannel *Channel, Client *c) { int PacketLength = Channel->GetName().length() + c->GetName().length() + 2; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelAnnounceLeave, PacketLength); + auto outapp = new EQApplicationPacket(OP_ChannelAnnounceLeave, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -1594,7 +1592,7 @@ void Client::GeneralChannelMessage(const char *Characters) { void Client::GeneralChannelMessage(std::string Message) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3); + auto outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3); char *PacketBuffer = (char *)outapp->pBuffer; VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); @@ -2280,7 +2278,7 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin int PacketLength = 8 + strlen(sMessageID) + strlen(TimeStamp)+ From.length() + Subject.length(); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailNew, PacketLength); + auto outapp = new EQApplicationPacket(OP_MailNew, PacketLength); char *PacketBuffer = (char *)outapp->pBuffer; @@ -2306,7 +2304,7 @@ void Client::ChangeMailBox(int NewMailBox) { _log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str()); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailboxChange, 2); + auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); char *buf = (char *)outapp->pBuffer; From 09f37323d1214c7f5139704bfc9a99fb8d1ba70d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 02:57:00 -0500 Subject: [PATCH 0766/1883] clang-modernize -use-auto convert for ucs/database.cpp --- ucs/database.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 09e4389b7..8b224b936 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -321,7 +321,7 @@ void Database::SendHeaders(Client *client) { sprintf(buffer, "%i", results.RowCount()); headerCountPacketLength += (strlen(buffer) + 1); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailHeaderCount, headerCountPacketLength); + auto outapp = new EQApplicationPacket(OP_MailHeaderCount, headerCountPacketLength); char *packetBuffer = (char *)outapp->pBuffer; @@ -402,7 +402,7 @@ void Database::SendBody(Client *client, int messageNumber) { int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_MailSendBody,packetLength); + auto outapp = new EQApplicationPacket(OP_MailSendBody, packetLength); char *packetBuffer = (char *)outapp->pBuffer; @@ -449,8 +449,8 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub if(characterID <= 0) return false; - char *escSubject = new char[subject.length() * 2 + 1]; - char *escBody = new char[body.length() * 2 + 1]; + auto escSubject = new char[subject.length() * 2 + 1]; + auto escBody = new char[body.length() * 2 + 1]; DoEscapeString(escSubject, subject.c_str(), subject.length()); DoEscapeString(escBody, body.c_str(), body.length()); From 502bb6ca792774c6547e53cb040bd12cadbf6d97 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 02:57:00 -0500 Subject: [PATCH 0767/1883] clang-modernize -use-auto convert for ucs/worldserver.cpp --- ucs/worldserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 7e243a467..eddd23ad1 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -81,7 +81,7 @@ void WorldServer::Process() { char *Buffer = (char *)pack->pBuffer; - char *From = new char[strlen(Buffer) + 1]; + auto From = new char[strlen(Buffer) + 1]; VARSTRUCT_DECODE_STRING(From, Buffer); From 28680a46959e881b1e853041a1589f270f652a02 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0768/1883] clang-modernize -use-auto convert for world/adventure.cpp --- world/adventure.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index b5ba4aea1..98ec087b4 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -67,7 +67,7 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc void Adventure::RemovePlayer(std::string character_name) { - std::list::iterator iter = players.begin(); + auto iter = players.begin(); while(iter != players.end()) { if((*iter).compare(character_name) == 0) @@ -86,7 +86,7 @@ void Adventure::RemovePlayer(std::string character_name) bool Adventure::PlayerExists(std::string character_name) { - std::list::iterator iter = players.begin(); + auto iter = players.begin(); while(iter != players.end()) { if(character_name.compare((*iter)) == 0) @@ -172,7 +172,7 @@ void Adventure::SetStatus(AdventureStatus new_status) safe_delete(current_timer); current_timer = new Timer(adventure_template->duration * 1000); database.SetInstanceDuration(instance_id, adventure_template->duration + 60); - ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); + auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; ut->instance_id = instance_id; ut->new_duration = adventure_template->duration + 60; @@ -187,7 +187,7 @@ void Adventure::SetStatus(AdventureStatus new_status) safe_delete(current_timer); current_timer = new Timer(1800000); database.SetInstanceDuration(instance_id, 1860); - ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); + auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; ut->instance_id = instance_id; ut->new_duration = 1860; @@ -202,7 +202,7 @@ void Adventure::SetStatus(AdventureStatus new_status) safe_delete(current_timer); current_timer = new Timer(1800000); database.SetInstanceDuration(instance_id, 1800); - ServerPacket *pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); + auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct)); ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; ut->instance_id = instance_id; ut->new_duration = 1860; @@ -216,7 +216,7 @@ void Adventure::SetStatus(AdventureStatus new_status) return; } - std::list::iterator iter = players.begin(); + auto iter = players.begin(); while(iter != players.end()) { adventure_manager.GetAdventureData((*iter).c_str()); @@ -226,11 +226,11 @@ void Adventure::SetStatus(AdventureStatus new_status) void Adventure::SendAdventureMessage(uint32 type, const char *msg) { - ServerPacket *pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(msg) + 1); + auto pack = new ServerPacket(ServerOP_EmoteMessage, sizeof(ServerEmoteMessage_Struct) + strlen(msg) + 1); ServerEmoteMessage_Struct *sms = (ServerEmoteMessage_Struct*)pack->pBuffer; sms->type = type; strcpy(sms->message, msg); - std::list::iterator iter = players.begin(); + auto iter = players.begin(); while(iter != players.end()) { ClientListEntry *current = client_list.FindCharacter((*iter).c_str()); @@ -284,7 +284,7 @@ void Adventure::IncrementAssassinationCount() void Adventure::Finished(AdventureWinStatus ws) { - std::list::iterator iter = players.begin(); + auto iter = players.begin(); while(iter != players.end()) { ClientListEntry *current = client_list.FindCharacter((*iter).c_str()); @@ -293,7 +293,8 @@ void Adventure::Finished(AdventureWinStatus ws) if(current->Online() == CLE_Status_InZone) { //We can send our packets only. - ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct)); + auto pack = + new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct)); ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer; strcpy(af->player, (*iter).c_str()); af->theme = GetTemplate()->theme; @@ -410,7 +411,8 @@ void Adventure::MoveCorpsesToGraveyard() auto c_iter = charid_list.begin(); for (auto iter = dbid_list.begin(); iter != dbid_list.end(); ++iter, ++c_iter) { - ServerPacket* pack = new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); + auto pack = + new ServerPacket(ServerOP_DepopAllPlayersCorpses, sizeof(ServerDepopAllPlayersCorpses_Struct)); ServerDepopAllPlayersCorpses_Struct *dpc = (ServerDepopAllPlayersCorpses_Struct*)pack->pBuffer; dpc->CharacterID = (*c_iter); dpc->InstanceID = 0; From 64be231fe6dcffa63330e96e58680974f4079bcb Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0769/1883] clang-modernize -use-auto convert for world/adventure_manager.cpp --- world/adventure_manager.cpp | 157 +++++++++++++++++++----------------- 1 file changed, 82 insertions(+), 75 deletions(-) diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 53d5fb191..db4b768d8 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -38,7 +38,7 @@ void AdventureManager::Process() { if(process_timer->Check()) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); while(iter != adventure_list.end()) { if(!(*iter)->Process()) @@ -76,10 +76,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) /** * This block checks to see if we actually have any adventures for the requested theme. */ - std::map >::iterator adv_list_iter = adventure_entries.find(sar->template_id); + auto adv_list_iter = adventure_entries.find(sar->template_id); if(adv_list_iter == adventure_entries.end()) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer; strcpy(deny->leader, sar->leader); strcpy(deny->reason, "There are currently no adventures set for this theme."); @@ -94,7 +94,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) * Active being in progress, finished adventures that are still waiting to expire do not count * Though they will count against you for which new adventure you can get. */ - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); while(iter != adventure_list.end()) { Adventure* current = (*iter); @@ -104,7 +104,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) { if(current->PlayerExists((data + sizeof(ServerAdventureRequest_Struct) + (64 * i)))) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, + sizeof(ServerAdventureRequestDeny_Struct)); ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer; strcpy(deny->leader, sar->leader); @@ -158,7 +159,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) * Remove zones from eligible zones based on their difficulty and type. * ie only use difficult zones for difficult, collect for collect, etc. */ - std::list::iterator ea_iter = eligible_adventures.begin(); + auto ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) { if((*ea_iter)->is_hard != ((sar->risk == 2) ? true : false)) @@ -240,7 +241,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) if(valid_count == 0) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer; strcpy(deny->leader, sar->leader); strcpy(deny->reason, "The number of found players for this adventure was zero."); @@ -254,7 +255,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) if(max_level - min_level > RuleI(Adventure, MaxLevelRange)) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer; strcpy(deny->leader, sar->leader); @@ -271,10 +272,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) /** * Remove the zones from our eligible zones based on the exclusion above */ - std::list::iterator ez_iter = excluded_zones.begin(); + auto ez_iter = excluded_zones.begin(); while(ez_iter != excluded_zones.end()) { - std::list::iterator ea_iter = eligible_adventures.begin(); + auto ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) { if((*ez_iter).zone.compare((*ea_iter)->zone) == 0 && (*ez_iter).version == (*ea_iter)->zone_version) @@ -287,10 +288,10 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) ++ez_iter; } - std::list::iterator ezi_iter = excluded_zone_ins.begin(); + auto ezi_iter = excluded_zone_ins.begin(); while(ezi_iter != excluded_zone_ins.end()) { - std::list::iterator ea_iter = eligible_adventures.begin(); + auto ea_iter = eligible_adventures.begin(); while(ea_iter != eligible_adventures.end()) { if((*ezi_iter).zone_id == (*ea_iter)->zone_in_zone_id && (*ezi_iter).door_id == (*ea_iter)->zone_in_object_id) @@ -331,7 +332,8 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) { ++ea_iter; } - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestAccept, sizeof(ServerAdventureRequestAccept_Struct) + (sar->member_count * 64)); + auto pack = new ServerPacket(ServerOP_AdventureRequestAccept, + sizeof(ServerAdventureRequestAccept_Struct) + (sar->member_count * 64)); ServerAdventureRequestAccept_Struct *sra = (ServerAdventureRequestAccept_Struct*)pack->pBuffer; strcpy(sra->leader, sar->leader); strcpy(sra->text, (*ea_iter)->text); @@ -346,7 +348,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data) } else { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureRequestDeny, sizeof(ServerAdventureRequestDeny_Struct)); ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer; strcpy(deny->leader, sar->leader); strcpy(deny->reason, "The number of adventures returned was zero."); @@ -369,7 +371,7 @@ void AdventureManager::TryAdventureCreate(const char *data) AdventureTemplate *adv_template = GetAdventureTemplate(src->theme, src->id); if(!adv_template) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); + auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); strcpy((char*)pack->pBuffer, src->leader); pack->Deflate(); zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack); @@ -377,10 +379,10 @@ void AdventureManager::TryAdventureCreate(const char *data) return; } - Adventure *adv = new Adventure(adv_template); + auto adv = new Adventure(adv_template); if(!adv->CreateInstance()) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); + auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); strcpy((char*)pack->pBuffer, src->leader); pack->Deflate(); zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack); @@ -394,7 +396,7 @@ void AdventureManager::TryAdventureCreate(const char *data) Adventure *a = GetActiveAdventure((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i))); if(a) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); + auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64); strcpy((char*)pack->pBuffer, src->leader); pack->Deflate(); zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack); @@ -415,8 +417,9 @@ void AdventureManager::TryAdventureCreate(const char *data) { int f_count = 0; Adventure** finished_adventures = GetFinishedAdventures((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)), f_count); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct) - + (sizeof(ServerFinishedAdventures_Struct) * f_count)); + auto pack = new ServerPacket(ServerOP_AdventureData, + sizeof(ServerSendAdventureData_Struct) + + (sizeof(ServerFinishedAdventures_Struct) * f_count)); ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer; strcpy(sca->player, (data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i))); @@ -454,7 +457,7 @@ void AdventureManager::TryAdventureCreate(const char *data) void AdventureManager::GetAdventureData(Adventure *adv) { std::list player_list = adv->GetPlayers(); - std::list::iterator iter = player_list.begin(); + auto iter = player_list.begin(); while(iter != player_list.end()) { GetAdventureData((*iter).c_str()); @@ -470,8 +473,9 @@ void AdventureManager::GetAdventureData(const char *name) int f_count = 0; Adventure** finished_adventures = GetFinishedAdventures(name, f_count); Adventure *current = GetActiveAdventure(name); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct) - + (sizeof(ServerFinishedAdventures_Struct) * f_count)); + auto pack = + new ServerPacket(ServerOP_AdventureData, sizeof(ServerSendAdventureData_Struct) + + (sizeof(ServerFinishedAdventures_Struct) * f_count)); ServerSendAdventureData_Struct *sca = (ServerSendAdventureData_Struct*)pack->pBuffer; if(current) @@ -500,7 +504,7 @@ void AdventureManager::GetAdventureData(const char *name) if(f_count == 0) { delete pack; - ServerPacket *pack = new ServerPacket(ServerOP_AdventureDataClear, 64); + auto pack = new ServerPacket(ServerOP_AdventureDataClear, 64); strcpy((char*)pack->pBuffer, name); pack->Deflate(); zoneserver_list.SendPacket(player->zone(), player->instance(), pack); @@ -531,7 +535,7 @@ void AdventureManager::GetAdventureData(const char *name) bool AdventureManager::IsInExcludedZoneList(std::list excluded_zones, std::string zone_name, int version) { - std::list::iterator iter = excluded_zones.begin(); + auto iter = excluded_zones.begin(); while(iter != excluded_zones.end()) { if(((*iter).zone.compare(zone_name) == 0) && ((*iter).version == version)) @@ -545,7 +549,7 @@ bool AdventureManager::IsInExcludedZoneList(std::list excluded_z bool AdventureManager::IsInExcludedZoneInList(std::list excluded_zone_ins, int zone_id, int door_object) { - std::list::iterator iter = excluded_zone_ins.begin(); + auto iter = excluded_zone_ins.begin(); while(iter != excluded_zone_ins.end()) { if(((*iter).zone_id == zone_id) && ((*iter).door_id == door_object)) @@ -562,7 +566,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou Adventure **ret = nullptr; count = 0; - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); while(iter != adventure_list.end()) { if((*iter)->PlayerExists(player)) @@ -571,7 +575,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou { if(ret) { - Adventure **t = new Adventure*[count + 1]; + auto t = new Adventure *[count + 1]; for(int i = 0; i < count; i++) { t[i] = ret[i]; @@ -595,7 +599,7 @@ Adventure **AdventureManager::GetFinishedAdventures(const char *player, int &cou Adventure *AdventureManager::GetActiveAdventure(const char *player) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); while(iter != adventure_list.end()) { if((*iter)->PlayerExists(player) && (*iter)->IsActive()) @@ -609,13 +613,13 @@ Adventure *AdventureManager::GetActiveAdventure(const char *player) AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id) { - std::map >::iterator iter = adventure_entries.find(theme); + auto iter = adventure_entries.find(theme); if(iter == adventure_entries.end()) { return nullptr; } - std::list::iterator l_iter = (*iter).second.begin(); + auto l_iter = (*iter).second.begin(); while(l_iter != (*iter).second.end()) { if((*l_iter)->id == id) @@ -629,7 +633,7 @@ AdventureTemplate *AdventureManager::GetAdventureTemplate(int theme, int id) AdventureTemplate *AdventureManager::GetAdventureTemplate(int id) { - std::map::iterator iter = adventure_templates.find(id); + auto iter = adventure_templates.find(id); if(iter == adventure_templates.end()) { return nullptr; @@ -653,7 +657,7 @@ bool AdventureManager::LoadAdventureTemplates() } for (auto row = results.begin(); row != results.end(); ++row) { - AdventureTemplate *aTemplate = new AdventureTemplate; + auto aTemplate = new AdventureTemplate; aTemplate->id = atoi(row[0]); strcpy(aTemplate->zone, row[1]); aTemplate->zone_version = atoi(row[2]); @@ -728,7 +732,7 @@ bool AdventureManager::LoadAdventureEntries() void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int door_id) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); while(iter != adventure_list.end()) { const AdventureTemplate *t = (*iter)->GetTemplate(); @@ -739,7 +743,9 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureClickDoorReply, sizeof(ServerPlayerClickedAdventureDoorReply_Struct)); + auto pack = + new ServerPacket(ServerOP_AdventureClickDoorReply, + sizeof(ServerPlayerClickedAdventureDoorReply_Struct)); ServerPlayerClickedAdventureDoorReply_Struct *sr = (ServerPlayerClickedAdventureDoorReply_Struct*)pack->pBuffer; strcpy(sr->player, player); sr->zone_id = database.GetZoneID(t->zone); @@ -766,7 +772,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureClickDoorError, 64); + auto pack = new ServerPacket(ServerOP_AdventureClickDoorError, 64); strcpy((char*)pack->pBuffer, player); pack->Deflate(); zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack); @@ -784,7 +790,7 @@ void AdventureManager::LeaveAdventure(const char *name) { if(pc->instance() != 0 && pc->instance() == current->GetInstanceID()) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveDeny, 64); + auto pack = new ServerPacket(ServerOP_AdventureLeaveDeny, 64); strcpy((char*)pack->pBuffer, name); pack->Deflate(); zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack); @@ -798,7 +804,7 @@ void AdventureManager::LeaveAdventure(const char *name) } current->RemovePlayer(name); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64); + auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64); strcpy((char*)pack->pBuffer, name); pack->Deflate(); zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack); @@ -807,7 +813,7 @@ void AdventureManager::LeaveAdventure(const char *name) } else { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64); + auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64); strcpy((char*)pack->pBuffer, name); pack->Deflate(); zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack); @@ -818,7 +824,7 @@ void AdventureManager::LeaveAdventure(const char *name) void AdventureManager::IncrementCount(uint16 instance_id) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); Adventure *current = nullptr; while(iter != adventure_list.end()) { @@ -834,8 +840,8 @@ void AdventureManager::IncrementCount(uint16 instance_id) { current->IncrementCount(); std::list slist = current->GetPlayers(); - std::list::iterator siter = slist.begin(); - ServerPacket *pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(ServerAdventureCountUpdate_Struct)); + auto siter = slist.begin(); + auto pack = new ServerPacket(ServerOP_AdventureCountUpdate, sizeof(ServerAdventureCountUpdate_Struct)); ServerAdventureCountUpdate_Struct *ac = (ServerAdventureCountUpdate_Struct*)pack->pBuffer; ac->count = current->GetCount(); ac->total = current->GetTemplate()->type_count; @@ -858,7 +864,7 @@ void AdventureManager::IncrementCount(uint16 instance_id) void AdventureManager::IncrementAssassinationCount(uint16 instance_id) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); Adventure *current = nullptr; while(iter != adventure_list.end()) { @@ -879,7 +885,7 @@ void AdventureManager::IncrementAssassinationCount(uint16 instance_id) void AdventureManager::GetZoneData(uint16 instance_id) { - std::list::iterator iter = adventure_list.begin(); + auto iter = adventure_list.begin(); Adventure *current = nullptr; while(iter != adventure_list.end()) { @@ -893,7 +899,7 @@ void AdventureManager::GetZoneData(uint16 instance_id) if(current) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(ServerZoneAdventureDataReply_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(ServerZoneAdventureDataReply_Struct)); ServerZoneAdventureDataReply_Struct *zd = (ServerZoneAdventureDataReply_Struct*)pack->pBuffer; const AdventureTemplate* temp = current->GetTemplate(); @@ -1241,7 +1247,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1249,7 +1255,7 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins.begin(); + auto iter = leaderboard_info_wins.begin(); while(i < 100 && iter != leaderboard_info_wins.end()) { LeaderboardInfo li = (*iter); @@ -1308,7 +1314,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1316,7 +1322,7 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage.begin(); + auto iter = leaderboard_info_percentage.begin(); while(i < 100 && iter != leaderboard_info_percentage.end()) { LeaderboardInfo li = (*iter); @@ -1375,7 +1381,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1383,7 +1389,7 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins_guk.begin(); + auto iter = leaderboard_info_wins_guk.begin(); while(i < 100 && iter != leaderboard_info_wins_guk.end()) { LeaderboardInfo li = (*iter); @@ -1442,7 +1448,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1450,7 +1456,7 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage_guk.begin(); + auto iter = leaderboard_info_percentage_guk.begin(); while(i < 100 && iter != leaderboard_info_percentage_guk.end()) { LeaderboardInfo li = (*iter); @@ -1509,7 +1515,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1517,7 +1523,7 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins_mir.begin(); + auto iter = leaderboard_info_wins_mir.begin(); while(i < 100 && iter != leaderboard_info_wins_mir.end()) { LeaderboardInfo li = (*iter); @@ -1576,7 +1582,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1584,7 +1590,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage_mir.begin(); + auto iter = leaderboard_info_percentage_mir.begin(); while(i < 100 && iter != leaderboard_info_percentage_mir.end()) { LeaderboardInfo li = (*iter); @@ -1643,7 +1649,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1651,7 +1657,7 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins_mmc.begin(); + auto iter = leaderboard_info_wins_mmc.begin(); while(i < 100 && iter != leaderboard_info_wins_mmc.end()) { LeaderboardInfo li = (*iter); @@ -1710,7 +1716,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1718,7 +1724,7 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage_mmc.begin(); + auto iter = leaderboard_info_percentage_mmc.begin(); while(i < 100 && iter != leaderboard_info_percentage_mmc.end()) { LeaderboardInfo li = (*iter); @@ -1777,7 +1783,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1785,7 +1791,7 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins_ruj.begin(); + auto iter = leaderboard_info_wins_ruj.begin(); while(i < 100 && iter != leaderboard_info_wins_ruj.end()) { LeaderboardInfo li = (*iter); @@ -1844,7 +1850,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1852,7 +1858,7 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage_ruj.begin(); + auto iter = leaderboard_info_percentage_ruj.begin(); while(i < 100 && iter != leaderboard_info_percentage_ruj.end()) { LeaderboardInfo li = (*iter); @@ -1911,7 +1917,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1919,7 +1925,7 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_wins_ruj.begin(); + auto iter = leaderboard_info_wins_ruj.begin(); while(i < 100 && iter != leaderboard_info_wins_ruj.end()) { LeaderboardInfo li = (*iter); @@ -1978,7 +1984,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player) ClientListEntry *pc = client_list.FindCharacter(player); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct)); AdventureLeaderboard_Struct *al = (AdventureLeaderboard_Struct*)(pack->pBuffer + 64); strcpy((char*)pack->pBuffer, player); @@ -1986,7 +1992,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player) int our_successes = 0; int our_failures = 0; int i = 0; - std::list::iterator iter = leaderboard_info_percentage_tak.begin(); + auto iter = leaderboard_info_percentage_tak.begin(); while(i < 100 && iter != leaderboard_info_percentage_tak.end()) { LeaderboardInfo li = (*iter); @@ -2042,7 +2048,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player) bool AdventureManager::PopFinishedEvent(const char *name, AdventureFinishEvent &fe) { - std::list::iterator iter = finished_list.begin(); + auto iter = finished_list.begin(); while(iter != finished_list.end()) { if((*iter).name.compare(name) == 0) @@ -2065,7 +2071,7 @@ void AdventureManager::SendAdventureFinish(AdventureFinishEvent fe) ClientListEntry *pc = client_list.FindCharacter(fe.name.c_str()); if(pc) { - ServerPacket *pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct)); + auto pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct)); ServerAdventureFinish_Struct *af = (ServerAdventureFinish_Struct*)pack->pBuffer; strcpy(af->player, fe.name.c_str()); af->theme = fe.theme; @@ -2088,7 +2094,7 @@ void AdventureManager::Save() ss.write((const char*)&number_of_elements, sizeof(int)); char null_term = 0; - std::list::iterator a_iter = adventure_list.begin(); + auto a_iter = adventure_list.begin(); while(a_iter != adventure_list.end()) { int cur = (*a_iter)->GetCount(); @@ -2113,7 +2119,7 @@ void AdventureManager::Save() cur = players.size(); ss.write((const char*)&cur, sizeof(int)); - std::list::iterator s_iter = players.begin(); + auto s_iter = players.begin(); while(s_iter != players.end()) { ss.write((const char*)(*s_iter).c_str(), (*s_iter).size()); @@ -2126,7 +2132,7 @@ void AdventureManager::Save() number_of_elements = finished_list.size(); ss.write((const char*)&number_of_elements, sizeof(int)); - std::list::iterator f_iter = finished_list.begin(); + auto f_iter = finished_list.begin(); while(f_iter != finished_list.end()) { ss.write((const char*)&(*f_iter).win, sizeof(bool)); @@ -2198,7 +2204,8 @@ void AdventureManager::Load() AdventureTemplate *t = GetAdventureTemplate(template_id); if(t) { - Adventure *adv = new Adventure(t, count, a_count, (AdventureStatus)status, instance_id, rem_time); + auto adv = + new Adventure(t, count, a_count, (AdventureStatus)status, instance_id, rem_time); for(int j = 0; j < num_players; ++j) { adv->AddPlayer((const char*)ptr, false); From c2936a893ec00c8f5d3293d0f0d15cc132a44428 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0770/1883] clang-modernize -use-auto convert for world/client.cpp --- world/client.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index decb98f9a..01130302d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -105,7 +105,7 @@ Client::~Client() { void Client::SendLogServer() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_LogServer, sizeof(LogServer_Struct)); + auto outapp = new EQApplicationPacket(OP_LogServer, sizeof(LogServer_Struct)); LogServer_Struct *l=(LogServer_Struct *)outapp->pBuffer; const char *wsn=WorldConfig::get()->ShortName.c_str(); memcpy(l->worldshortname,wsn,strlen(wsn)); @@ -140,14 +140,14 @@ void Client::SendEnterWorld(std::string name) } } - EQApplicationPacket *outapp = new EQApplicationPacket(OP_EnterWorld, strlen(char_name)+1); + auto outapp = new EQApplicationPacket(OP_EnterWorld, strlen(char_name) + 1); memcpy(outapp->pBuffer,char_name,strlen(char_name)+1); QueuePacket(outapp); safe_delete(outapp); } void Client::SendExpansionInfo() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct)); + auto outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct)); ExpansionInfo_Struct *eis = (ExpansionInfo_Struct*)outapp->pBuffer; eis->Expansions = (RuleI(World, ExpansionSettings)); QueuePacket(outapp); @@ -171,7 +171,7 @@ void Client::SendCharInfo() { // Send OP_SendCharInfo - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct)); + auto outapp = new EQApplicationPacket(OP_SendCharInfo, sizeof(CharacterSelect_Struct)); CharacterSelect_Struct* cs = (CharacterSelect_Struct*)outapp->pBuffer; database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); @@ -181,7 +181,7 @@ void Client::SendCharInfo() { } void Client::SendMaxCharCreate(int max_chars) { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct)); + auto outapp = new EQApplicationPacket(OP_SendMaxCharacters, sizeof(MaxCharacters_Struct)); MaxCharacters_Struct* mc = (MaxCharacters_Struct*)outapp->pBuffer; mc->max_chars = max_chars; @@ -191,7 +191,7 @@ void Client::SendMaxCharCreate(int max_chars) { } void Client::SendMembership() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMembership, sizeof(Membership_Struct)); + auto outapp = new EQApplicationPacket(OP_SendMembership, sizeof(Membership_Struct)); Membership_Struct* mc = (Membership_Struct*)outapp->pBuffer; /* @@ -248,7 +248,7 @@ void Client::SendMembership() { } void Client::SendMembershipSettings() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendMembershipDetails, sizeof(Membership_Details_Struct)); + auto outapp = new EQApplicationPacket(OP_SendMembershipDetails, sizeof(Membership_Details_Struct)); Membership_Details_Struct* mds = (Membership_Details_Struct*)outapp->pBuffer; mds->membership_setting_count = 66; @@ -357,7 +357,7 @@ void Client::SendMembershipSettings() { } void Client::SendPostEnterWorld() { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_PostEnterWorld, 1); + auto outapp = new EQApplicationPacket(OP_PostEnterWorld, 1); outapp->size=0; QueuePacket(outapp); safe_delete(outapp); @@ -438,7 +438,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { const WorldConfig *Config=WorldConfig::get(); if(Config->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSPlayerJoinWorld; pack->size = sizeof(ServerLSPlayerJoinWorld_Struct); pack->pBuffer = new uchar[pack->size]; @@ -609,7 +609,7 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) len += sizeof(uint32); len += sizeof(uint32); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_CharacterCreateRequest, len); + auto outapp = new EQApplicationPacket(OP_CharacterCreateRequest, len); unsigned char *ptr = outapp->pBuffer; *((uint8*)ptr) = 0; ptr += sizeof(uint8); @@ -662,7 +662,7 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { CharCreate_Struct *cc = (CharCreate_Struct*)app->pBuffer; if(OPCharCreate(char_name, cc) == false) { database.DeleteCharacter(char_name); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_ApproveName, 1); + auto outapp = new EQApplicationPacket(OP_ApproveName, 1); outapp->pBuffer[0] = 0; QueuePacket(outapp); safe_delete(outapp); @@ -715,7 +715,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } if(!pZoning && ew->return_home && !ew->tutorial) { - CharacterSelect_Struct* cs = new CharacterSelect_Struct; + auto cs = new CharacterSelect_Struct; memset(cs, 0, sizeof(CharacterSelect_Struct)); database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); bool home_enabled = false; @@ -745,7 +745,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } if(!pZoning && (RuleB(World, EnableTutorialButton) && (ew->tutorial || StartInTutorial))) { - CharacterSelect_Struct* cs = new CharacterSelect_Struct; + auto cs = new CharacterSelect_Struct; memset(cs, 0, sizeof(CharacterSelect_Struct)); database.GetCharSelectInfo(GetAccountID(), cs, ClientVersionBit); bool tutorial_enabled = false; @@ -810,7 +810,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { char* leader = 0; char leaderbuf[64] = {0}; if((leader = database.GetGroupLeaderForLogin(char_name, leaderbuf)) && strlen(leader)>1){ - EQApplicationPacket* outapp3 = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); + auto outapp3 = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* gj=(GroupJoin_Struct*)outapp3->pBuffer; gj->action=8; strcpy(gj->yourname, char_name); @@ -851,7 +851,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { else ConnectionType = 'C'; - EQApplicationPacket *outapp2 = new EQApplicationPacket(OP_SetChatServer); + auto outapp2 = new EQApplicationPacket(OP_SetChatServer); char buffer[112]; const WorldConfig *Config = WorldConfig::get(); @@ -1047,7 +1047,7 @@ bool Client::Process() { if (!eqs->CheckState(ESTABLISHED)) { if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSPlayerLeftWorld; pack->size = sizeof(ServerLSPlayerLeftWorld_Struct); pack->pBuffer = new uchar[pack->size]; @@ -1136,7 +1136,7 @@ void Client::EnterWorld(bool TryBootup) { return; } - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_AcceptWorldEntrance; pack->size = sizeof(WorldToZone_Struct); pack->pBuffer = new uchar[pack->size]; @@ -1234,7 +1234,7 @@ void Client::Clearance(int8 response) } void Client::ZoneUnavail() { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct)); + auto outapp = new EQApplicationPacket(OP_ZoneUnavail, sizeof(ZoneUnavail_Struct)); ZoneUnavail_Struct* ua = (ZoneUnavail_Struct*)outapp->pBuffer; const char* zonename = database.GetZoneName(zoneID); if (zonename) From bb37dd1b16cd177d42e1ee71c099856463003c06 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0771/1883] clang-modernize -use-auto convert for world/cliententry.cpp --- world/cliententry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/world/cliententry.cpp b/world/cliententry.cpp index fa5b60c43..5e93a8668 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -121,7 +121,7 @@ void ClientListEntry::SetOnline(int8 iOnline) { } void ClientListEntry::LSUpdate(ZoneServer* iZS){ if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSZoneInfo; pack->size = sizeof(ZoneInfo_Struct); pack->pBuffer = new uchar[pack->size]; @@ -135,7 +135,7 @@ void ClientListEntry::LSUpdate(ZoneServer* iZS){ } void ClientListEntry::LSZoneChange(ZoneToZone_Struct* ztz){ if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSPlayerZoneChange; pack->size = sizeof(ServerLSPlayerZoneChange_Struct); pack->pBuffer = new uchar[pack->size]; From 81a48cac6c4d6849ddc866156e05365f48f8d9a3 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0772/1883] clang-modernize -use-auto convert for world/clientlist.cpp --- world/clientlist.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 6ef730990..f2e1c8b9b 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -116,7 +116,8 @@ void ClientList::EnforceSessionLimit(uint32 iLSAccountID) { // If we have a char name, they are in a zone, so send a kick to the zone server if(strlen(ClientEntry->name())) { - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + auto pack = + new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; strcpy(skp->adminname, "SessionLimit"); strcpy(skp->name, ClientEntry->name()); @@ -223,7 +224,7 @@ void ClientList::DisconnectByIP(uint32 iIP) { countCLEIPs = iterator.GetData(); if ((countCLEIPs->GetIP() == iIP)) { if(strlen(countCLEIPs->name())) { - ServerPacket* pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); + auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct)); ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*) pack->pBuffer; strcpy(skp->adminname, "SessionLimit"); strcpy(skp->name, countCLEIPs->name()); @@ -328,7 +329,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect void ClientList::CLEAdd(uint32 iLSID, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local) { - ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginName, iLoginKey, iWorldAdmin, ip, local); + auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginName, iLoginKey, iWorldAdmin, ip, local); clientlist.Append(tmp); } @@ -430,7 +431,7 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) if (accid) { uint32 lsid = 0; database.GetAccountIDByName(iName, &tmpadmin, &lsid); - ClientListEntry* tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0); + auto tmp = new ClientListEntry(GetNextCLEID(), lsid, iName, tmpMD5, tmpadmin, 0, 0); clientlist.Append(tmp); return tmp; } @@ -470,7 +471,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) Iterator.Reset(); - ServerPacket* pack = new ServerPacket(ServerOP_OnlineGuildMembersResponse, PacketLength); + auto pack = new ServerPacket(ServerOP_OnlineGuildMembersResponse, PacketLength); char *Buffer = (char *)pack->pBuffer; @@ -572,7 +573,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S unknown44[1]=0; uint32 unknown52=totalusers; uint32 unknown56=1; - ServerPacket* pack2 = new ServerPacket(ServerOP_WhoAllReply,64+totallength+(49*totalusers)); + auto pack2 = new ServerPacket(ServerOP_WhoAllReply, 64 + totallength + (49 * totalusers)); memset(pack2->pBuffer,0,pack2->size); uchar *buffer=pack2->pBuffer; uchar *bufptr=buffer; @@ -801,7 +802,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon ClientListEntry* cle; int FriendsOnline = FriendsCLEs.size(); int PacketLength = sizeof(WhoAllReturnStruct) + (47 * FriendsOnline) + TotalLength; - ServerPacket* pack2 = new ServerPacket(ServerOP_WhoAllReply, PacketLength); + auto pack2 = new ServerPacket(ServerOP_WhoAllReply, PacketLength); memset(pack2->pBuffer,0,pack2->size); uchar *buffer=pack2->pBuffer; uchar *bufptr=buffer; @@ -931,7 +932,7 @@ void ClientList::SendLFGMatches(ServerLFGMatchesRequest_Struct *smrs) { } Iterator.Advance(); } - ServerPacket* Pack = new ServerPacket(ServerOP_LFGMatches, (sizeof(ServerLFGMatchesResponse_Struct) * Matches) + 4); + auto Pack = new ServerPacket(ServerOP_LFGMatches, (sizeof(ServerLFGMatchesResponse_Struct) * Matches) + 4); char *Buf = (char *)Pack->pBuffer; // FromID is the Entity ID of the player doing the search. From 0ed10ec102946fe271ca01cb41afc3b671ee4af8 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0773/1883] clang-modernize -use-auto convert for world/console.cpp --- world/console.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/world/console.cpp b/world/console.cpp index 6caa9ce86..c57a85f43 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -114,7 +114,8 @@ bool Console::SendChannelMessage(const ServerChannelMessage_Struct* scm) { } case 7: { SendMessage(1, "[%s] tells you, '%s'", scm->from, scm->message); - ServerPacket* pack = new ServerPacket(ServerOP_ChannelMessage, sizeof(ServerChannelMessage_Struct) + strlen(scm->message) + 1); + auto pack = new ServerPacket(ServerOP_ChannelMessage, + sizeof(ServerChannelMessage_Struct) + strlen(scm->message) + 1); memcpy(pack->pBuffer, scm, pack->size); ServerChannelMessage_Struct* scm2 = (ServerChannelMessage_Struct*) pack->pBuffer; strcpy(scm2->deliverto, scm2->from); @@ -241,7 +242,7 @@ bool Console::Process() { struct in_addr in; in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { - ZoneServer* zs = new ZoneServer(tcpc); + auto zs = new ZoneServer(tcpc); _log(WORLD__CONSOLE,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; @@ -477,7 +478,8 @@ void Console::ProcessCommand(const char* command) { else if (strcasecmp(sep.arg[0], "signalcharbyname") == 0) { SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], atoi(sep.arg[2])); uint32 message_len = strlen((char*) sep.arg[1]) + 1; - ServerPacket* pack = new ServerPacket(ServerOP_CZSignalClientByName, sizeof(CZClientSignalByName_Struct) + message_len); + auto pack = new ServerPacket(ServerOP_CZSignalClientByName, + sizeof(CZClientSignalByName_Struct) + message_len); CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer; strn0cpy(CZSC->Name, (char*) sep.arg[1], 64); CZSC->data = atoi(sep.arg[2]); @@ -503,7 +505,7 @@ void Console::ProcessCommand(const char* command) { } else if (strcasecmp(sep.arg[0], "uptime") == 0) { if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) { - ServerPacket* pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); + auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; snprintf(sus->adminname, sizeof(sus->adminname), "*%s", this->GetName()); sus->zoneserverid = atoi(sep.arg[1]); @@ -628,7 +630,7 @@ void Console::ProcessCommand(const char* command) { char tmpname[64]; tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_KickPlayer; pack->size = sizeof(ServerKickPlayer_Struct); pack->pBuffer = new uchar[pack->size]; @@ -640,7 +642,7 @@ void Console::ProcessCommand(const char* command) { delete pack; } else if (strcasecmp(sep.arg[0], "who") == 0) { - Who_All_Struct* whom = new Who_All_Struct; + auto whom = new Who_All_Struct; memset(whom, 0, sizeof(Who_All_Struct)); whom->lvllow = 0xFFFF; whom->lvlhigh = 0xFFFF; @@ -681,7 +683,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->size = sizeof(ServerZoneStateChange_struct); pack->pBuffer = new uchar[pack->size]; memset(pack->pBuffer, 0, sizeof(ServerZoneStateChange_struct)); @@ -841,7 +843,7 @@ void Console::ProcessCommand(const char* command) { else if (strcasecmp(sep.arg[0], "reloadworld") == 0 && admin > 101) { SendEmoteMessage(0,0,0,15,"Reloading World..."); - ServerPacket* pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); + auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct)); ReloadWorld_Struct* RW = (ReloadWorld_Struct*) pack->pBuffer; RW->Option = 1; zoneserver_list.SendPacket(pack); From 0956575292501d161cd49bb62680f8a53a2dcbc7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:13 -0500 Subject: [PATCH 0774/1883] clang-modernize -use-auto convert for world/eqw_http_handler.cpp --- world/eqw_http_handler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index 6a703172a..70c56acfa 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -178,8 +178,7 @@ void EQWHTTPHandler::SendPage(const std::string &file) { } #endif - - char *buffer = new char[READ_BUFFER_LEN+1]; + auto buffer = new char[READ_BUFFER_LEN + 1]; size_t len; std::string to_process; while((len = fread(buffer, 1, READ_BUFFER_LEN, f)) > 0) { @@ -274,7 +273,7 @@ EQWHTTPServer::EQWHTTPServer() } void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort) { - EQWHTTPHandler *conn = new EQWHTTPHandler(ID, in_socket, irIP, irPort); + auto conn = new EQWHTTPHandler(ID, in_socket, irIP, irPort); AddConnection(conn); } From 446b085d6cc4a4665273ec78ae4514639e98ae8a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0775/1883] clang-modernize -use-auto convert for world/eqw_parser.cpp --- world/eqw_parser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 9aa372308..172c839d7 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -229,8 +229,7 @@ bool EQWParser::dosub(const char * subname, const std::vector &args PUSHMARK(SP); // remember the stack pointer if(args.size() > 0) { - for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) - {/* push the arguments onto the perl stack */ + for (auto i = args.begin(); i != args.end(); ++i) { /* push the arguments onto the perl stack */ XPUSHs(sv_2mortal(newSVpv(i->c_str(), i->length()))); } } From da13affebce48047e688e15385e0488fe49dd31a Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0776/1883] clang-modernize -use-auto convert for world/launcher_link.cpp --- world/launcher_link.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 180e742a5..c72416a2d 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -80,7 +80,7 @@ bool LauncherLink::Process() { struct in_addr in; in.s_addr = GetIP(); _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -91,7 +91,7 @@ bool LauncherLink::Process() { struct in_addr in; in.s_addr = GetIP(); _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -207,7 +207,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { } void LauncherLink::StartZone(const char *short_name) { - ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); + auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer; strn0cpy(s->short_name, short_name, 32); @@ -218,7 +218,7 @@ void LauncherLink::StartZone(const char *short_name) { } void LauncherLink::RestartZone(const char *short_name) { - ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); + auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer; strn0cpy(s->short_name, short_name, 32); @@ -229,7 +229,7 @@ void LauncherLink::RestartZone(const char *short_name) { } void LauncherLink::StopZone(const char *short_name) { - ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); + auto pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer; strn0cpy(s->short_name, short_name, 32); @@ -329,7 +329,7 @@ void LauncherLink::GetZoneDetails(const char *short_name, std::map Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0777/1883] clang-modernize -use-auto convert for world/launcher_list.cpp --- world/launcher_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 9c3bada2b..0722cb1e9 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -130,7 +130,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { } void LauncherList::Add(EmuTCPConnection *conn) { - LauncherLink *it = new LauncherLink(nextID++, conn); + auto it = new LauncherLink(nextID++, conn); _log(WORLD__LAUNCH, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } From 1770862b102fee405718748a581235ffde724e2f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0778/1883] clang-modernize -use-auto convert for world/lfplist.cpp --- world/lfplist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/world/lfplist.cpp b/world/lfplist.cpp index 47f91a8b3..f04a833dd 100644 --- a/world/lfplist.cpp +++ b/world/lfplist.cpp @@ -228,7 +228,7 @@ void GroupLFPList::SendLFPMatches(ServerLFPMatchesRequest_Struct* smrs) { } } - ServerPacket* Pack = new ServerPacket(ServerOP_LFPMatches, (sizeof(ServerLFPMatchesResponse_Struct) * Matches) + 4); + auto Pack = new ServerPacket(ServerOP_LFPMatches, (sizeof(ServerLFPMatchesResponse_Struct) * Matches) + 4); char *Buf = (char *)Pack->pBuffer; From 6b75e03d723bab0de04e1325ec3c1ad59955e31e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0779/1883] clang-modernize -use-auto convert for world/login_server.cpp --- world/login_server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/world/login_server.cpp b/world/login_server.cpp index 83f432ca0..a448c0826 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -111,7 +111,7 @@ bool LoginServer::Process() { uint32 id = database.GetAccountIDFromLSID(utwr->lsaccountid); int16 status = database.CheckStatus(id); - ServerPacket* outpack = new ServerPacket; + auto outpack = new ServerPacket; outpack->opcode = ServerOP_UsertoWorldResp; outpack->size = sizeof(UsertoWorldResponse_Struct); outpack->pBuffer = new uchar[outpack->size]; @@ -255,7 +255,7 @@ bool LoginServer::Connect() { void LoginServer::SendInfo() { const WorldConfig *Config=WorldConfig::get(); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSInfo; pack->size = sizeof(ServerLSInfo_Struct); pack->pBuffer = new uchar[pack->size]; @@ -275,7 +275,7 @@ void LoginServer::SendNewInfo() { uint16 port; const WorldConfig *Config=WorldConfig::get(); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_NewLSInfo; pack->size = sizeof(ServerNewLSInfo_Struct); pack->pBuffer = new uchar[pack->size]; @@ -301,7 +301,7 @@ void LoginServer::SendNewInfo() { void LoginServer::SendStatus() { statusupdate_timer.Start(); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSStatus; pack->size = sizeof(ServerLSStatus_Struct); pack->pBuffer = new uchar[pack->size]; From 8f18672690ac5e2d9a327fd14bfb79fd93d9cf2e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0780/1883] clang-modernize -use-auto convert for world/login_server_list.cpp --- world/login_server_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index 8e3780463..4bce5032c 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -51,7 +51,7 @@ LoginServerList::~LoginServerList() { void LoginServerList::Add(const char* iAddress, uint16 iPort, const char* Account, const char* Password) { - LoginServer* loginserver = new LoginServer(iAddress, iPort, Account, Password); + auto loginserver = new LoginServer(iAddress, iPort, Account, Password); list.Insert(loginserver); } From 7e2661bbc1c6aada76dfcc94a9f50aad44c92e99 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:14 -0500 Subject: [PATCH 0781/1883] clang-modernize -use-auto convert for world/net.cpp --- world/net.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/world/net.cpp b/world/net.cpp index 44107e39b..dbc63ee5d 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -417,7 +417,7 @@ int main(int argc, char** argv) { _log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. _log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); - Client* client = new Client(eqsi); + auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { @@ -427,7 +427,7 @@ int main(int argc, char** argv) { } if (!RuleB(World, UseBannedIPsTable)){ _log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); - Client* client = new Client(eqsi); + auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } From c9a75dcf64cb481bf0f857fa87d4ddf585e1576b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:15 -0500 Subject: [PATCH 0782/1883] clang-modernize -use-auto convert for world/queryserv.cpp --- world/queryserv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 2539fff63..3eb664a5e 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -57,7 +57,7 @@ bool QueryServConnection::Process() struct in_addr in; in.s_addr = GetIP(); _log(QUERYSERV__ERROR, "QueryServ authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -69,7 +69,7 @@ bool QueryServConnection::Process() struct in_addr in; in.s_addr = GetIP(); _log(QUERYSERV__ERROR, "QueryServ authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); From ca0a8fd974d9e4617e81184c6ff95e9bb206ff4c Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:15 -0500 Subject: [PATCH 0783/1883] clang-modernize -use-auto convert for world/ucs.cpp --- world/ucs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/world/ucs.cpp b/world/ucs.cpp index f89874ae2..875d2be23 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -52,7 +52,7 @@ bool UCSConnection::Process() struct in_addr in; in.s_addr = GetIP(); _log(UCS__ERROR, "UCS authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -64,7 +64,7 @@ bool UCSConnection::Process() struct in_addr in; in.s_addr = GetIP(); _log(UCS__ERROR, "UCS authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -117,7 +117,7 @@ bool UCSConnection::SendPacket(ServerPacket* pack) void UCSConnection::SendMessage(const char *From, const char *Message) { - ServerPacket* pack = new ServerPacket(ServerOP_UCSMessage, strlen(From) + strlen(Message) + 2); + auto pack = new ServerPacket(ServerOP_UCSMessage, strlen(From) + strlen(Message) + 2); char *Buffer = (char *)pack->pBuffer; From e87a3096f46d3c3244b3fc6e5a9c435544a9751e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:15 -0500 Subject: [PATCH 0784/1883] clang-modernize -use-auto convert for world/wguild_mgr.cpp --- world/wguild_mgr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index 45cad0f56..0f3e07636 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -33,7 +33,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { _log(GUILDS__REFRESH, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); - ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); + auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; s->name_change = name; @@ -46,7 +46,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { _log(GUILDS__REFRESH, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); - ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); + auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; s->old_guild_id = old_guild_id; @@ -57,7 +57,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui void WorldGuildManager::SendGuildDelete(uint32 guild_id) { _log(GUILDS__REFRESH, "Broadcasting guild delete for guild %d to world", guild_id); - ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); + auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; zoneserver_list.SendPacket(pack); From c6388d8c5dde0b6dd47e4621b7297a4225f690e7 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:15 -0500 Subject: [PATCH 0785/1883] clang-modernize -use-auto convert for world/zonelist.cpp --- world/zonelist.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 683181354..cf27ed495 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -80,7 +80,7 @@ void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ _log(WORLD__ZONELIST, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); - ServerPacket* pack2 = new ServerPacket; + auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; SendPacket(pack2); @@ -399,7 +399,7 @@ void ZSList::SendChannelMessage(const char* from, const char* to, uint8 chan_num void ZSList::SendChannelMessageRaw(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message) { if (!message) return; - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_ChannelMessage; pack->size = sizeof(ServerChannelMessage_Struct)+strlen(message)+1; @@ -453,7 +453,7 @@ void ZSList::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_mins void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message) { if (!message) return; - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_EmoteMessage; pack->size = sizeof(ServerEmoteMessage_Struct)+strlen(message)+1; @@ -500,7 +500,7 @@ void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_m } void ZSList::SendTimeSync() { - ServerPacket* pack = new ServerPacket(ServerOP_SyncWorldTime, sizeof(eqTimeOfDay)); + auto pack = new ServerPacket(ServerOP_SyncWorldTime, sizeof(eqTimeOfDay)); eqTimeOfDay* tod = (eqTimeOfDay*) pack->pBuffer; tod->start_eqtime=worldclock.getStartEQTime(); tod->start_realtime=worldclock.getStartRealTime(); @@ -554,7 +554,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip } if (x == 0) return; - ZoneServer** tmp = new ZoneServer*[x]; + auto tmp = new ZoneServer *[x]; uint32 y = 0; iterator.Reset(); while(iterator.MoreElements()) { @@ -569,7 +569,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip } uint32 z = emu_random.Int(0, y-1); - ServerPacket* pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct)); + auto pack = new ServerPacket(ServerOP_ZoneReboot, sizeof(ServerZoneReboot_Struct)); ServerZoneReboot_Struct* s = (ServerZoneReboot_Struct*) pack->pBuffer; // strcpy(s->ip1,ip1); strcpy(s->ip2,ip2); @@ -734,7 +734,7 @@ void ZSList::WorldShutDown(uint32 time, uint32 interval) } else { SendEmoteMessage(0,0,0,15,":SYSTEM MSG:World coming down, everyone log out now."); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_ShutdownAll; pack->size=0; SendPacket(pack); From b0e59e112dad322ddad9102ff998dbf85f64fb1b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 03:05:15 -0500 Subject: [PATCH 0786/1883] clang-modernize -use-auto convert for world/zoneserver.cpp --- world/zoneserver.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index aeb0709eb..70c1cd1b1 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -117,7 +117,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { void ZoneServer::LSShutDownUpdate(uint32 zoneid){ if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSZoneShutdown; pack->size = sizeof(ZoneShutdown_Struct); pack->pBuffer = new uchar[pack->size]; @@ -134,7 +134,7 @@ void ZoneServer::LSShutDownUpdate(uint32 zoneid){ } void ZoneServer::LSBootUpdate(uint32 zoneid, uint32 instanceid, bool startup){ if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; if(startup) pack->opcode = ServerOP_LSZoneStart; else @@ -155,7 +155,7 @@ void ZoneServer::LSBootUpdate(uint32 zoneid, uint32 instanceid, bool startup){ void ZoneServer::LSSleepUpdate(uint32 zoneid){ if(WorldConfig::get()->UpdateStats){ - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_LSZoneSleep; pack->size = sizeof(ServerLSZoneSleep_Struct); pack->pBuffer = new uchar[pack->size]; @@ -189,7 +189,7 @@ bool ZoneServer::Process() { struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -200,7 +200,7 @@ bool ZoneServer::Process() { struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); - ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); + auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); @@ -771,7 +771,7 @@ bool ZoneServer::Process() { } case ServerOP_Who: { ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; - Who_All_Struct* whom = new Who_All_Struct; + auto whom = new Who_All_Struct; memset(whom,0,sizeof(Who_All_Struct)); whom->gmlookup = whoall->gmlookup; whom->lvllow = whoall->lvllow; @@ -945,7 +945,7 @@ bool ZoneServer::Process() { } case ServerOP_GetWorldTime: { zlog(WORLD__ZONE,"Broadcasting a world time update"); - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; pack->size = sizeof(eqTimeOfDay); @@ -1336,7 +1336,7 @@ void ZoneServer::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_ void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message) { if (!message) return; - ServerPacket* pack = new ServerPacket; + auto pack = new ServerPacket; pack->opcode = ServerOP_EmoteMessage; pack->size = sizeof(ServerEmoteMessage_Struct)+strlen(message)+1; @@ -1362,7 +1362,7 @@ void ZoneServer::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 } void ZoneServer::SendGroupIDs() { - ServerPacket* pack = new ServerPacket(ServerOP_GroupIDReply, sizeof(ServerGroupIDReply_Struct)); + auto pack = new ServerPacket(ServerOP_GroupIDReply, sizeof(ServerGroupIDReply_Struct)); ServerGroupIDReply_Struct* sgi = (ServerGroupIDReply_Struct*)pack->pBuffer; zoneserver_list.NextGroupIDs(sgi->start, sgi->end); SendPacket(pack); @@ -1370,7 +1370,7 @@ void ZoneServer::SendGroupIDs() { } void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) { - ServerPacket* pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct)); + auto pack = new ServerPacket(ServerOP_ChangeWID, sizeof(ServerChangeWID_Struct)); ServerChangeWID_Struct* scw = (ServerChangeWID_Struct*) pack->pBuffer; scw->charid = iCharID; scw->newwid = iWID; @@ -1384,7 +1384,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a zoneID = iZoneID; instanceID = iInstanceID; - ServerPacket* pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct)); + auto pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct)); ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; s->ZoneServerID = ID; if (adminname != 0) @@ -1404,7 +1404,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a void ZoneServer::IncommingClient(Client* client) { BootingUp = true; - ServerPacket* pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncommingClient_Struct)); + auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncommingClient_Struct)); ServerZoneIncommingClient_Struct* s = (ServerZoneIncommingClient_Struct*) pack->pBuffer; s->zoneid = GetZoneID(); s->instanceid = GetInstanceID(); From 1b8711bce9fd5bfcd1bfa73e5a7776044b37dc85 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 12:59:13 -0500 Subject: [PATCH 0787/1883] Minor tweaking to zone/entity.cpp --- zone/entity.cpp | 52 ++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 296144a3d..68a80f1ac 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -386,11 +386,8 @@ void EntityList::GroupProcess() return; } - auto it = group_list.begin(); - while (it != group_list.end()) { - (*it)->Process(); - ++it; - } + for (auto &group : group_list) + group->Process(); #if EQDEBUG >= 5 CheckGroupList (__FILE__, __LINE__); @@ -399,11 +396,8 @@ void EntityList::GroupProcess() void EntityList::QueueToGroupsForNPCHealthAA(Mob *sender, const EQApplicationPacket *app) { - auto it = group_list.begin(); - while (it != group_list.end()) { - (*it)->QueueHPPacketsForNPCHealthAA(sender, app); - ++it; - } + for (auto &group : group_list) + group->QueueHPPacketsForNPCHealthAA(sender, app); } void EntityList::RaidProcess() @@ -416,11 +410,8 @@ void EntityList::RaidProcess() return; } - auto it = raid_list.begin(); - while (it != raid_list.end()) { - (*it)->Process(); - ++it; - } + for (auto &raid : raid_list) + raid->Process(); } void EntityList::DoorProcess() @@ -3131,21 +3122,18 @@ void EntityList::AddProximity(NPC *proximity_for) proximity_list.push_back(proximity_for); - proximity_for->proximity = new NPCProximity; + proximity_for->proximity = new NPCProximity; // deleted in NPC::~NPC } bool EntityList::RemoveProximity(uint16 delete_npc_id) { - auto iter = proximity_list.begin(); + auto it = std::find_if(proximity_list.begin(), proximity_list.end(), + [delete_npc_id](const NPC *a) { return a->GetID() == delete_npc_id; }); + if (it == proximity_list.end()) + return false; - while (iter != proximity_list.end()) { - if ((*iter)->GetID() == delete_npc_id) { - proximity_list.erase(iter); - return true; - } - ++iter; - } - return false; + proximity_list.erase(it); + return true; } void EntityList::RemoveAllLocalities() @@ -3348,14 +3336,12 @@ void EntityList::AddArea(int id, int type, float min_x, float max_x, float min_y void EntityList::RemoveArea(int id) { - auto iter = area_list.begin(); - while(iter != area_list.end()) { - if((*iter).id == id) { - area_list.erase(iter); - return; - } - ++iter; - } + auto it = std::find_if(area_list.begin(), area_list.end(), + [id](const Area &a) { return a.id == id; }); + if (it == area_list.end()) + return; + + area_list.erase(it); } void EntityList::ClearAreas() From f3f9997adf1cb498a2e59048232a59b5bc092bf2 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 12:59:48 -0500 Subject: [PATCH 0788/1883] Packets are already memset to 0 --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 68a80f1ac..d5e5774ca 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4504,7 +4504,6 @@ void EntityList::AddLootToNPCS(uint32 item_id, uint32 count) void EntityList::CameraEffect(uint32 duration, uint32 intensity) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); Camera_Struct* cs = (Camera_Struct*) outapp->pBuffer; cs->duration = duration; // Duration in milliseconds cs->intensity = ((intensity * 6710886) + 1023410176); // Intensity ranges from 1023410176 to 1090519040, so simplify it from 0 to 10. From bf9b126eef5770c63d5b85b977d400584a89baf4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 13:18:49 -0500 Subject: [PATCH 0789/1883] clang-modernize -use-nullptr for ucs/clientlist.cpp --- ucs/clientlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 08b01f077..26c1befa4 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -618,7 +618,7 @@ void Clientlist::Process() { continue; } - EQApplicationPacket *app = 0; + EQApplicationPacket *app = nullptr; bool KeyValid = true; From b398d65eb83177eb26940e8864461d8bc968fa3f Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 13:18:49 -0500 Subject: [PATCH 0790/1883] clang-modernize -use-nullptr for ucs/ucs.cpp --- ucs/ucs.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 46d898f6b..dd5f304b3 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -49,8 +49,7 @@ std::string WorldShortName; const ucsconfig *Config; -WorldServer *worldserver = 0; - +WorldServer *worldserver = nullptr; void CatchSignal(int sig_num) { From 7e72f10a3bb59316cf15d5820f5c7209c84183f8 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 9 Jan 2015 13:18:49 -0500 Subject: [PATCH 0791/1883] clang-modernize -use-nullptr for ucs/worldserver.cpp --- ucs/worldserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index eddd23ad1..83e1764a1 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -62,7 +62,7 @@ void WorldServer::Process() if (!Connected()) return; - ServerPacket *pack = 0; + ServerPacket *pack = nullptr; while((pack = tcpc.PopPacket())) { From bf8f70342b2c638689d368385713bb6b6a02a810 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 9 Jan 2015 17:56:46 -0500 Subject: [PATCH 0792/1883] Added text link translators for OP_FormattedMessage --- changelog.txt | 3 ++ common/patches/rof.cpp | 62 +++++++++++++++++++++++++++++--- common/patches/rof2.cpp | 62 +++++++++++++++++++++++++++++--- common/patches/rof2_ops.h | 1 + common/patches/rof_ops.h | 1 + common/patches/sod.cpp | 62 +++++++++++++++++++++++++++++--- common/patches/sod_ops.h | 1 + common/patches/sof.cpp | 62 +++++++++++++++++++++++++++++--- common/patches/sof_ops.h | 1 + common/patches/titanium.cpp | 64 +++++++++++++++++++++++++++++++--- common/patches/titanium_ops.h | 1 + common/patches/underfoot.cpp | 62 +++++++++++++++++++++++++++++--- common/patches/underfoot_ops.h | 1 + 13 files changed, 358 insertions(+), 25 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0091a7583..8d9ab0ff9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/09/2015 == +Uleat: Added text link translators for OP_FormattedMessage + == 01/08/2015 == Trevius: Added some extra checks and clean-up related to Groups and Mercenaries. diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index f65302c36..d915ae808 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -840,6 +840,50 @@ namespace RoF FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToRoFTextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GMLastName) { ENCODE_LENGTH_EXACT(GMLastName_Struct); @@ -3119,10 +3163,11 @@ namespace RoF std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToRoFTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -3136,9 +3181,18 @@ namespace RoF VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 03d919dd8..dc6c60603 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -906,6 +906,50 @@ namespace RoF2 FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToRoF2TextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GMLastName) { ENCODE_LENGTH_EXACT(GMLastName_Struct); @@ -3185,10 +3229,11 @@ namespace RoF2 std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToRoF2TextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -3202,9 +3247,18 @@ namespace RoF2 VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index 66b86d756..7b4e6b7d4 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -43,6 +43,7 @@ E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) E(OP_ExpansionInfo) +E(OP_FormattedMessage) E(OP_GMLastName) E(OP_GMTrainSkillConfirm) E(OP_GroundSpawn) diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index ef97dda99..8ce23e94a 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -32,6 +32,7 @@ E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) E(OP_ExpansionInfo) +E(OP_FormattedMessage) E(OP_GMLastName) E(OP_GMTrainSkillConfirm) E(OP_GroundSpawn) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 6982290c8..00ae9b3eb 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -609,6 +609,50 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToSoDTextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GroundSpawn) { ENCODE_LENGTH_EXACT(Object_Struct); @@ -2009,10 +2053,11 @@ namespace SoD std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToSoDTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -2026,9 +2071,18 @@ namespace SoD VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 0a0a8a4d5..1eda944d0 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -23,6 +23,7 @@ E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) E(OP_ExpansionInfo) +E(OP_FormattedMessage) E(OP_GroundSpawn) E(OP_GroupCancelInvite) E(OP_GroupFollow) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 8405f9def..c503e2c5f 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -596,6 +596,50 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToSoFTextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GroundSpawn) { ENCODE_LENGTH_EXACT(Object_Struct); @@ -1655,10 +1699,11 @@ namespace SoF std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToSoFTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -1672,9 +1717,18 @@ namespace SoF VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index 9cfd400e3..df58cffa8 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -24,6 +24,7 @@ E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) E(OP_ExpansionInfo) +E(OP_FormattedMessage) E(OP_GroundSpawn) E(OP_GuildMemberList) E(OP_Illusion) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index f40c0266c..97be94693 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -455,6 +455,50 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GuildMemberList) { //consume the packet @@ -1117,10 +1161,11 @@ namespace Titanium std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToTitaniumTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -1134,12 +1179,21 @@ namespace Titanium VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); - + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 4ddcae630..ad3723ab6 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -16,6 +16,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_FormattedMessage) E(OP_GuildMemberLevelUpdate) E(OP_GuildMemberList) E(OP_Illusion) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 1ebd8dc8d..e6c081823 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -753,6 +753,50 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_FormattedMessage) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + FormattedMessage_Struct *emu = (FormattedMessage_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; + + char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); + + for (int i = 0; i < 9; ++i) { + old_message_array[i] = old_message_ptr; + old_message_ptr += old_message_array[i].length() + 1; + } + + uint32 new_message_size = 0; + std::string new_message_array[9]; + + for (int i = 0; i < 9; ++i) { + ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]); + new_message_size += (new_message_array[i].length() + 1); + } + + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown0); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); + + for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_GroundSpawn) { // We are not encoding the spawn_id field here, or a size but it doesn't appear to matter. @@ -2320,10 +2364,11 @@ namespace Underfoot std::string old_message = &emu->message[strlen(emu->sayer)]; std::string new_message; + ServerToUnderfootTextLink(new_message, old_message); //in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1; - in->size = 25 + strlen(emu->sayer) + new_message.length(); + in->size = strlen(emu->sayer) + new_message.length() + 25; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -2337,9 +2382,18 @@ namespace Underfoot VARSTRUCT_ENCODE_STRING(OutBuffer, emu->sayer); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, 0); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[0]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[1]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[2]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[3]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[4]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[5]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[6]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[7]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[8]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[9]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[10]); + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 61f4f1c0f..2f0f8ba94 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -26,6 +26,7 @@ E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) E(OP_ExpansionInfo) +E(OP_FormattedMessage) E(OP_GroundSpawn) E(OP_GroupCancelInvite) E(OP_GroupFollow) From f799b8ef683e34cbc3559f257772a436f8136600 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 9 Jan 2015 20:16:23 -0600 Subject: [PATCH 0793/1883] Changed some console logging for slot and group errors. --- common/database.cpp | 3 ++- common/item.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index d6dcd7405..39f78cfa6 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3261,7 +3261,8 @@ uint32 Database::GetGroupID(const char* name){ if (results.RowCount() == 0) { - LogFile->write(EQEmuLog::Debug, "Character not in a group: %s", name); + // Commenting this out until logging levels can prevent this from going to console + //LogFile->write(EQEmuLog::Debug, "Character not in a group: %s", name); return 0; } diff --git a/common/item.cpp b/common/item.cpp index 7f6e049d6..c06df3a89 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1108,6 +1108,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } int16 result = INVALID_INDEX; + int16 parentSlot = INVALID_INDEX; if (slot_id == MainCursor) { // Replace current item on cursor, if exists @@ -1142,16 +1143,17 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) else { // Slot must be within a bag - ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); // Get parent bag + parentSlot = Inventory::CalcSlotId(slot_id); + ItemInst* baginst = GetItem(parentSlot); // Get parent bag if (baginst && baginst->IsType(ItemClassContainer)) { baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst); result = slot_id; } } - + if (result == INVALID_INDEX) { - LogFile->write(EQEmuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i)", slot_id); + LogFile->write(EQEmuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } From 999a6501e0f5837669f2c0cc875e6bba511553eb Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Fri, 9 Jan 2015 22:33:41 -0500 Subject: [PATCH 0794/1883] Fix for spell projectiles (target type 1) being applied as melee damage. Resolves those random 1 million damage hits that have been reported --- zone/special_attacks.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 94da26e45..5255ff1f6 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1101,8 +1101,14 @@ void Mob::ProjectileAttack() if (target){ - if (IsNPC()) - CastToNPC()->DoRangedAttackDmg(target, false, ProjectileAtk[i].wpn_dmg,0, static_cast(ProjectileAtk[i].skill)); + if (IsNPC()){ + if (ProjectileAtk[i].skill == SkillConjuration){ + if (IsValidSpell(ProjectileAtk[i].wpn_dmg)) + SpellOnTarget(ProjectileAtk[i].wpn_dmg, target, false, true, spells[ProjectileAtk[i].wpn_dmg].ResistDiff, true); + } + else + CastToNPC()->DoRangedAttackDmg(target, false, ProjectileAtk[i].wpn_dmg,0, static_cast(ProjectileAtk[i].skill)); + } else { From 5b78acc45efe8c2c81b1e312bac38fd1dc8f3143 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 10 Jan 2015 02:34:06 -0500 Subject: [PATCH 0795/1883] Make the AI stopping a little less silly on zone shutdown --- zone/entity.cpp | 7 +++++++ zone/entity.h | 2 ++ zone/zone.cpp | 10 +--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index d5e5774ca..eaed09570 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4668,3 +4668,10 @@ Mob *EntityList::GetTargetForVirus(Mob *spreader, int range) return TargetsInRange[zone->random.Int(0, TargetsInRange.size() - 1)]; } +void EntityList::StopMobAI() +{ + for (auto &mob : mob_list) { + mob.second->AI_Stop(); + mob.second->AI_ShutDown(); + } +} diff --git a/zone/entity.h b/zone/entity.h index 88f5257f7..2b1678740 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -268,6 +268,8 @@ public: Entity *GetEntityMob(const char *name); Entity *GetEntityCorpse(const char *name); + void StopMobAI(); + void DescribeAggro(Client *towho, NPC *from_who, float dist, bool verbose); void Message(uint32 to_guilddbid, uint32 type, const char* message, ...); diff --git a/zone/zone.cpp b/zone/zone.cpp index fc134a735..3ee15be83 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -662,15 +662,7 @@ void Zone::Shutdown(bool quite) if (!ZoneLoaded) return; - std::list mob_list; - entity_list.GetMobList(mob_list); - std::list::iterator mob_itr = mob_list.begin(); - while (mob_itr != mob_list.end()) { - Mob* mob_inst = *mob_itr; - mob_inst->AI_Stop(); - mob_inst->AI_ShutDown(); - ++mob_itr; - } + entity_list.StopMobAI(); std::map::iterator itr; while(zone->npctable.size()) { From 80d11d4ca99ed7f27aec2a337e7972e75e201a84 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 03:43:44 -0600 Subject: [PATCH 0796/1883] Added eqemu_logsys.cpp/.h --- common/CMakeLists.txt | 2 + common/eqemu_logsys.cpp | 113 ++++++++++++++++++++++++++++++++++++++++ common/eqemu_logsys.h | 55 +++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 common/eqemu_logsys.cpp create mode 100644 common/eqemu_logsys.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d547c4c88..2a98f5cfb 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -19,6 +19,7 @@ SET(common_sources eqemu_exception.cpp eqemu_config.cpp eqemu_error.cpp + eqemu_logsys.cpp eq_packet.cpp eq_stream.cpp eq_stream_factory.cpp @@ -121,6 +122,7 @@ SET(common_headers eqemu_config.h eqemu_config_elements.h eqemu_error.h + eqemu_logsys.h eq_packet.h eq_stream.h eq_stream_factory.h diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp new file mode 100644 index 000000000..8b72ea804 --- /dev/null +++ b/common/eqemu_logsys.cpp @@ -0,0 +1,113 @@ +/* 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 +*/ + + +#include "eqemu_logsys.h" +#include "string_util.h" +#include "rulesys.h" + +#include +#include +#include +#include +#include + +std::ofstream zone_general_log; + +static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash"}; + +#ifdef _WINDOWS +#include +#include +#include +#include +#endif + +namespace Console { + enum Color { + Black = 0, + Blue = 1, + Green = 2, + Cyan = 3, + Red = 4, + Magenta = 5, + Brown = 6, + LightGray = 7, + DarkGray = 8, + LightBlue = 9, + LightGreen = 10, + LightCyan = 11, + LightRed = 12, + LightMagenta = 13, + Yellow = 14, + White = 15, + }; +} + +EQEmuLogSys::EQEmuLogSys(){ +} + +EQEmuLogSys::~EQEmuLogSys(){ +} + +void EQEmuLogSys::StartZoneLogs(const std::string log_name) +{ + _mkdir("logs/zone"); + std::cout << "Starting Zone Logs..." << std::endl; + zone_general_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); +} + +void EQEmuLogSys::WriteZoneLog(uint16 log_type, const std::string message) +{ + auto t = std::time(nullptr); + auto tm = *std::localtime(&t); + EQEmuLogSys::ConsoleMessage(log_type, message); + zone_general_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << message << std::endl; +} + +void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message){ +#ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + + if (log_type == EQEmuLogSys::LogType::Status){ SetConsoleTextAttribute(console_handle, Console::Color::Yellow); } + if (log_type == EQEmuLogSys::LogType::Error){ SetConsoleTextAttribute(console_handle, Console::Color::LightRed); } + if (log_type == EQEmuLogSys::LogType::Normal){ SetConsoleTextAttribute(console_handle, Console::Color::LightGreen); } + if (log_type == EQEmuLogSys::LogType::Debug){ SetConsoleTextAttribute(console_handle, Console::Color::Yellow); } + if (log_type == EQEmuLogSys::LogType::Quest){ SetConsoleTextAttribute(console_handle, Console::Color::LightCyan); } + if (log_type == EQEmuLogSys::LogType::Commands){ SetConsoleTextAttribute(console_handle, Console::Color::LightMagenta); } + if (log_type == EQEmuLogSys::LogType::Crash){ SetConsoleTextAttribute(console_handle, Console::Color::LightRed); } +#endif + std::cout << "[" << TypeNames[log_type] << "] " << message << std::endl; +#ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, Console::Color::White); +#endif +} + +void EQEmuLogSys::CloseZoneLogs(){ + std::cout << "Closing down zone logs..." << std::endl; + zone_general_log.close(); +} \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h new file mode 100644 index 000000000..2d3498f6e --- /dev/null +++ b/common/eqemu_logsys.h @@ -0,0 +1,55 @@ +/* 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 EQEMU_LOGSYS_H +#define EQEMU_LOGSYS_H + +#include +#include +#include "types.h" + +class EQEmuLogSys { +public: + EQEmuLogSys(); + ~EQEmuLogSys(); + + enum LogType { + Status = 0, /* This must stay the first entry in this list */ + Normal, /* Normal Logs */ + Error, /* Error Logs */ + Debug, /* Debug Logs */ + Quest, /* Quest Logs */ + Commands, /* Issued Comamnds */ + Crash, /* Crash Logs */ + Save, /* Client Saves */ + MaxLogID /* Max, used in functions to get the max log ID */ + }; + + void StartZoneLogs(const std::string log_name); + void WriteZoneLog(uint16 log_type, const std::string message); + void CloseZoneLogs(); + void ConsoleMessage(uint16 log_type, const std::string message); + +private: + bool zone_general_init = false; + +}; + +extern EQEmuLogSys log_sys; + +#endif \ No newline at end of file From 2aacc7323e32e71a1beb777f82a97d2ca59ad2ec Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 03:44:49 -0600 Subject: [PATCH 0797/1883] Backport logging from debug.cpp EQEmuLog::write back to EQEmuLogSys::WriteZoneLog Logs being written to logs/zone/ currently --- common/debug.cpp | 78 ++++++------------------------------------------ zone/net.cpp | 8 +++++ zone/zone.cpp | 22 ++++++++++++-- 3 files changed, 37 insertions(+), 71 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index ce56ebcbb..c7360daf7 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -44,6 +44,10 @@ namespace ConsoleColor { #include "debug.h" #include "misc_functions.h" #include "platform.h" +#include "eqemu_logsys.h" +#include "string_util.h" + +EQEmuLogSys backport_log_sys; #ifndef va_copy #define va_copy(d,s) ((d) = (s)) @@ -145,6 +149,7 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) if (id >= MaxLogID) { return false; } + bool dofile = false; if (pLogStatus[id] & 1) { dofile = open(id); @@ -156,82 +161,17 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) if (!logFileValid) { return false; //check again for threading race reasons (to avoid two mutexes) } - time_t aclock; - struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - if (dofile) - #ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); - #else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); - #endif + va_list argptr, tmpargptr; va_start(argptr, fmt); - if (dofile) { - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } + + backport_log_sys.WriteZoneLog(id, vStringFormat(fmt, argptr).c_str()); + if (logCallbackFmt[id]) { msgCallbackFmt p = logCallbackFmt[id]; va_copy(tmpargptr, argptr); p(id, fmt, tmpargptr ); } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] ", LogNames[id]); - vfprintf( stderr, fmt, argptr ); - } - /* This is what's outputted to console */ - else { - -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } -#endif - - fprintf(stdout, "[%s] ", LogNames[id]); - vfprintf( stdout, fmt, argptr ); - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); -#endif - } - } - va_end(argptr); - if (dofile) { - fprintf(fp[id], "\n"); - } - - /* Print Lind Endings */ - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "\n"); - fflush(stderr); - } else { - fprintf(stdout, "\n"); - fflush(stdout); - } - } - if (dofile) { - fflush(fp[id]); - } return true; } diff --git a/zone/net.cpp b/zone/net.cpp index 25c770f14..b728de18f 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -43,6 +43,8 @@ #include "../common/eqemu_exception.h" #include "../common/spdat.h" +#include "../common/eqemu_logsys.h" + #include "zone_config.h" #include "masterentity.h" #include "worldserver.h" @@ -69,6 +71,7 @@ #include #include #include +#include #ifdef _CRTDBG_MAP_ALLOC #undef new @@ -100,6 +103,7 @@ TitleManager title_manager; QueryServ *QServ = 0; TaskManager *taskmanager = 0; QuestParserCollection *parse = 0; +EQEmuLogSys log_sys; const SPDat_Spell_Struct* spells; void LoadSpells(EQEmu::MemoryMappedFile **mmf); @@ -351,6 +355,10 @@ int main(int argc, char** argv) { if (!eqsf.IsOpen() && Config->ZonePort!=0) { _log(ZONE__INIT, "Starting EQ Network server on port %d",Config->ZonePort); + + // log_sys.CloseZoneLogs(); + // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + if (!eqsf.Open(Config->ZonePort)) { _log(ZONE__INIT_ERR, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); diff --git a/zone/zone.cpp b/zone/zone.cpp index fc134a735..330b7782f 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -35,6 +35,7 @@ #include "../common/rulesys.h" #include "../common/seperator.h" #include "../common/string_util.h" +#include "../common/eqemu_logsys.h" #include "client_logs.h" #include "guild_mgr.h" @@ -52,12 +53,18 @@ #include "zone.h" #include "zone_config.h" +#include +#include +#include + #ifdef _WINDOWS #define snprintf _snprintf #define strncasecmp _strnicmp #define strcasecmp _stricmp #endif + + extern bool staticzone; extern NetConnection net; extern PetitionList petition_list; @@ -124,7 +131,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { zone->tradevar = 0; zone->lootvar = 0; } - } + } ZoneLoaded = true; @@ -132,7 +139,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { if(iInstanceID != 0) { ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16)); - *((uint16*)pack->pBuffer) = iInstanceID; + *((uint16*)pack->pBuffer) = iInstanceID; worldserver.SendPacket(pack); delete pack; } @@ -143,6 +150,15 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { UpdateWindowTitle(); zone->GetTimeSync(); + /* Set Logging */ + + log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + + clock_t t = std::clock(); /* Function timer start */ + uint64 i = 0; + + log_sys.WriteZoneLog(1, "This is some serious shit"); + return true; } @@ -708,6 +724,8 @@ void Zone::Shutdown(bool quite) entity_list.ClearAreas(); parse->ReloadQuests(true); UpdateWindowTitle(); + + log_sys.CloseZoneLogs(); } void Zone::LoadZoneDoors(const char* zone, int16 version) From 5b4cf79b040a0d4b7ec80e77aac3210f157f3050 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 03:56:52 -0600 Subject: [PATCH 0798/1883] Create console colors type map from Console::Color LogColors --- common/eqemu_logsys.cpp | 48 ++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 8b72ea804..6e666e402 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -29,8 +29,6 @@ std::ofstream zone_general_log; -static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash"}; - #ifdef _WINDOWS #include #include @@ -59,6 +57,26 @@ namespace Console { }; } +static const char* TypeNames[EQEmuLogSys::MaxLogID] = { + "Status", + "Normal", + "Error", + "Debug", + "Quest", + "Command", + "Crash" +}; +static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { + Console::Color::Yellow, // "Status", + Console::Color::LightRed, // "Normal", + Console::Color::LightGreen, // "Error", + Console::Color::Yellow, // "Debug", + Console::Color::LightCyan, // "Quest", + Console::Color::LightMagenta, // "Command", + Console::Color::LightRed // "Crash" +}; + + EQEmuLogSys::EQEmuLogSys(){ } @@ -74,13 +92,24 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) void EQEmuLogSys::WriteZoneLog(uint16 log_type, const std::string message) { + if (log_type > EQEmuLogSys::MaxLogID){ + return; + } + auto t = std::time(nullptr); auto tm = *std::localtime(&t); EQEmuLogSys::ConsoleMessage(log_type, message); - zone_general_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << message << std::endl; + + if (zone_general_log){ + zone_general_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << message << std::endl; + } } -void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message){ +void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) +{ + if (log_type > EQEmuLogSys::MaxLogID){ + return; + } #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -92,15 +121,10 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message){ wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (log_type == EQEmuLogSys::LogType::Status){ SetConsoleTextAttribute(console_handle, Console::Color::Yellow); } - if (log_type == EQEmuLogSys::LogType::Error){ SetConsoleTextAttribute(console_handle, Console::Color::LightRed); } - if (log_type == EQEmuLogSys::LogType::Normal){ SetConsoleTextAttribute(console_handle, Console::Color::LightGreen); } - if (log_type == EQEmuLogSys::LogType::Debug){ SetConsoleTextAttribute(console_handle, Console::Color::Yellow); } - if (log_type == EQEmuLogSys::LogType::Quest){ SetConsoleTextAttribute(console_handle, Console::Color::LightCyan); } - if (log_type == EQEmuLogSys::LogType::Commands){ SetConsoleTextAttribute(console_handle, Console::Color::LightMagenta); } - if (log_type == EQEmuLogSys::LogType::Crash){ SetConsoleTextAttribute(console_handle, Console::Color::LightRed); } + SetConsoleTextAttribute(console_handle, LogColors[log_type]); + #endif - std::cout << "[" << TypeNames[log_type] << "] " << message << std::endl; + std::cout << "[(N)" << TypeNames[log_type] << "] " << message << std::endl; #ifdef _WINDOWS /* Always set back to white*/ SetConsoleTextAttribute(console_handle, Console::Color::White); From ce54071296e99bb920e2af563ad53cfe9decef8a Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 10 Jan 2015 13:50:48 -0500 Subject: [PATCH 0799/1883] Added text link translators for OP_Emote --- changelog.txt | 3 +++ common/patches/rof.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/rof2.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/rof2_ops.h | 2 ++ common/patches/rof_ops.h | 2 ++ common/patches/sod.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/sod_ops.h | 2 ++ common/patches/sof.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/sof_ops.h | 2 ++ common/patches/titanium.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/titanium_ops.h | 2 ++ common/patches/underfoot.cpp | 49 ++++++++++++++++++++++++++++++++++ common/patches/underfoot_ops.h | 2 ++ 13 files changed, 309 insertions(+) diff --git a/changelog.txt b/changelog.txt index 8d9ab0ff9..95204e643 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/10/2015 == +Uleat: Added text link translators for OP_Emote + == 01/09/2015 == Uleat: Added text link translators for OP_FormattedMessage diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d915ae808..3fce18414 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -830,6 +830,34 @@ namespace RoF FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToRoFTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -4275,6 +4303,27 @@ namespace RoF FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + RoFToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index dc6c60603..782df8be7 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -896,6 +896,34 @@ namespace RoF2 FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToRoF2TextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -4347,6 +4375,27 @@ namespace RoF2 FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + RoF2ToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/rof2_ops.h b/common/patches/rof2_ops.h index 7b4e6b7d4..c2a1bb5e6 100644 --- a/common/patches/rof2_ops.h +++ b/common/patches/rof2_ops.h @@ -42,6 +42,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GMLastName) @@ -134,6 +135,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest) diff --git a/common/patches/rof_ops.h b/common/patches/rof_ops.h index 8ce23e94a..ce994ea11 100644 --- a/common/patches/rof_ops.h +++ b/common/patches/rof_ops.h @@ -31,6 +31,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GMLastName) @@ -123,6 +124,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 00ae9b3eb..34469d987 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -599,6 +599,34 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoDTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -2970,6 +2998,27 @@ namespace SoD FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + SoDToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 1eda944d0..5a1d313a2 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -22,6 +22,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -91,6 +92,7 @@ D(OP_Consider) D(OP_ConsiderCorpse) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_FindPersonRequest) D(OP_GroupCancelInvite) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index c503e2c5f..22e8771b6 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -586,6 +586,34 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToSoFTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -2370,6 +2398,27 @@ namespace SoF FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + SoFToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index df58cffa8..08e30aeff 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -23,6 +23,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -80,6 +81,7 @@ D(OP_Consider) D(OP_ConsiderCorpse) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_FindPersonRequest) D(OP_GroupFollow) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 97be94693..77077c3bc 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -455,6 +455,34 @@ namespace Titanium FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToTitaniumTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_FormattedMessage) { EQApplicationPacket *in = *p; @@ -1571,6 +1599,27 @@ namespace Titanium FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + TitaniumToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_FaceChange) { DECODE_LENGTH_EXACT(structs::FaceChange_Struct); diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index ad3723ab6..47d992b16 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -16,6 +16,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_FormattedMessage) E(OP_GuildMemberLevelUpdate) E(OP_GuildMemberList) @@ -56,6 +57,7 @@ D(OP_ChannelMessage) D(OP_CharacterCreate) D(OP_Consume) D(OP_DeleteItem) +D(OP_Emote) D(OP_FaceChange) D(OP_InspectAnswer) D(OP_InspectRequest) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index e6c081823..fb5daa179 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -743,6 +743,34 @@ namespace Underfoot FINISH_ENCODE(); } + ENCODE(OP_Emote) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + Emote_Struct *emu = (Emote_Struct *)in->pBuffer; + + unsigned char *__emu_buffer = in->pBuffer; + + std::string old_message = emu->message; + std::string new_message; + ServerToUnderfootTextLink(new_message, old_message); + + //if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm) + // new_message = new_message.substr(0, 512); + + in->size = new_message.length() + 5; + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_ExpansionInfo) { ENCODE_LENGTH_EXACT(ExpansionInfo_Struct); @@ -3269,6 +3297,27 @@ namespace Underfoot FINISH_DIRECT_DECODE(); } + DECODE(OP_Emote) + { + unsigned char *__eq_buffer = __packet->pBuffer; + + std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset + std::string new_message; + UnderfootToServerTextLink(new_message, old_message); + + __packet->size = sizeof(Emote_Struct); + __packet->pBuffer = new unsigned char[__packet->size]; + + char *InBuffer = (char *)__packet->pBuffer; + + memcpy(InBuffer, __eq_buffer, 4); + InBuffer += 4; + strcpy(InBuffer, new_message.substr(0, 1023).c_str()); + InBuffer[1023] = '\0'; + + delete[] __eq_buffer; + } + DECODE(OP_EnvDamage) { DECODE_LENGTH_EXACT(structs::EnvDamage2_Struct); diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 2f0f8ba94..4443425fb 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -25,6 +25,7 @@ E(OP_DzExpeditionList) E(OP_DzJoinExpeditionConfirm) E(OP_DzLeaderStatus) E(OP_DzMemberList) +E(OP_Emote) E(OP_ExpansionInfo) E(OP_FormattedMessage) E(OP_GroundSpawn) @@ -99,6 +100,7 @@ D(OP_ConsiderCorpse) D(OP_Consume) D(OP_Damage) D(OP_DeleteItem) +D(OP_Emote) D(OP_EnvDamage) D(OP_FaceChange) D(OP_FindPersonRequest) From f4e33f6faa8eb333752aca97ccaf0b31bb0a4b67 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 13:34:39 -0600 Subject: [PATCH 0800/1883] Changed some console colors --- common/eqemu_logsys.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 6e666e402..081182386 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -27,7 +27,7 @@ #include #include -std::ofstream zone_general_log; +std::ofstream process_log; #ifdef _WINDOWS #include @@ -68,9 +68,9 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { }; static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", - Console::Color::LightRed, // "Normal", - Console::Color::LightGreen, // "Error", - Console::Color::Yellow, // "Debug", + Console::Color::Yellow, // "Normal", + Console::Color::LightRed, // "Error", + Console::Color::LightGreen, // "Debug", Console::Color::LightCyan, // "Quest", Console::Color::LightMagenta, // "Command", Console::Color::LightRed // "Crash" @@ -87,10 +87,10 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) { _mkdir("logs/zone"); std::cout << "Starting Zone Logs..." << std::endl; - zone_general_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); + process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } -void EQEmuLogSys::WriteZoneLog(uint16 log_type, const std::string message) +void EQEmuLogSys::Log(uint16 log_type, const std::string message) { if (log_type > EQEmuLogSys::MaxLogID){ return; @@ -100,8 +100,11 @@ void EQEmuLogSys::WriteZoneLog(uint16 log_type, const std::string message) auto tm = *std::localtime(&t); EQEmuLogSys::ConsoleMessage(log_type, message); - if (zone_general_log){ - zone_general_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << message << std::endl; + if (process_log){ + process_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << StringFormat("[%s] ", TypeNames[log_type]).c_str() << message << std::endl; + } + else{ + std::cout << "[DEBUG] " << " :: There currently is no log file open for this process " << std::endl; } } @@ -110,6 +113,7 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) if (log_type > EQEmuLogSys::MaxLogID){ return; } + #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -124,7 +128,9 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) SetConsoleTextAttribute(console_handle, LogColors[log_type]); #endif + std::cout << "[(N)" << TypeNames[log_type] << "] " << message << std::endl; + #ifdef _WINDOWS /* Always set back to white*/ SetConsoleTextAttribute(console_handle, Console::Color::White); @@ -133,5 +139,5 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) void EQEmuLogSys::CloseZoneLogs(){ std::cout << "Closing down zone logs..." << std::endl; - zone_general_log.close(); + process_log.close(); } \ No newline at end of file From 01ca81a177d103a51c77ec8a9f353f68266a56ed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 13:35:02 -0600 Subject: [PATCH 0801/1883] Remove debugging and generalize the Log function --- common/debug.cpp | 2 +- common/eqemu_logsys.h | 4 +++- zone/zone.cpp | 5 ----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index c7360daf7..9bbe9d304 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -165,7 +165,7 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) va_list argptr, tmpargptr; va_start(argptr, fmt); - backport_log_sys.WriteZoneLog(id, vStringFormat(fmt, argptr).c_str()); + backport_log_sys.Log(id, vStringFormat(fmt, argptr).c_str()); if (logCallbackFmt[id]) { msgCallbackFmt p = logCallbackFmt[id]; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2d3498f6e..d2a6c4622 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -41,7 +41,7 @@ public: }; void StartZoneLogs(const std::string log_name); - void WriteZoneLog(uint16 log_type, const std::string message); + void Log(uint16 log_type, const std::string message); void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); @@ -52,4 +52,6 @@ private: extern EQEmuLogSys log_sys; + + #endif \ No newline at end of file diff --git a/zone/zone.cpp b/zone/zone.cpp index 330b7782f..63b673cd1 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -154,11 +154,6 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); - clock_t t = std::clock(); /* Function timer start */ - uint64 i = 0; - - log_sys.WriteZoneLog(1, "This is some serious shit"); - return true; } From b8ed29c600e04c993bba91524627684b38ee5052 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 14:37:33 -0600 Subject: [PATCH 0802/1883] Add RULE_CATEGORY(Logging) RULE_BOOL(Logging, ConsoleLogCommands, false) /* Turns on or off console logs */ RULE_BOOL(Logging, LogFileCommands, false) RULE_CATEGORY_END() --- common/ruletypes.h | 6 ++++++ zone/command.cpp | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index c5a4bb562..aa9a83c72 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -596,6 +596,12 @@ RULE_CATEGORY( Client ) RULE_BOOL( Client, UseLiveFactionMessage, false) // Allows players to see faction adjustments like Live RULE_CATEGORY_END() +RULE_CATEGORY(Logging) +RULE_BOOL(Logging, ConsoleLogCommands, false) /* Turns on or off console logs */ +RULE_BOOL(Logging, LogFileCommands, false) +RULE_CATEGORY_END() + + #undef RULE_CATEGORY #undef RULE_INT #undef RULE_REAL diff --git a/zone/command.cpp b/zone/command.cpp index a0b9ae642..0a6a1b551 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -50,6 +50,7 @@ #include "../common/rulesys.h" #include "../common/serverinfo.h" #include "../common/string_util.h" +#include "../common/eqemu_logsys.h" #include "client_logs.h" #include "command.h" @@ -444,9 +445,7 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; -#if EQDEBUG >=5 - LogFile->write(EQEmuLog::Debug, "command_init(): - Command '%s' set to access level %d." , cur->first.c_str(), itr->second); -#endif + logger.Log(EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { From 84741e4cb1edf42478ccd4357c1d14804032c2b9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 14:40:47 -0600 Subject: [PATCH 0803/1883] log_sys to logger enum DebugLevel { General = 0, /* 0 - Low-Level general debugging, useful info on single line */ Moderate, /* 1 - Informational based, used in functions, when particular things load */ Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) --- common/eqemu_logsys.cpp | 32 ++++++++++++++++++++++---------- common/eqemu_logsys.h | 14 +++++++++++--- zone/net.cpp | 6 +++++- zone/zone.cpp | 4 ++-- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 081182386..498526d3b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -90,21 +90,35 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } -void EQEmuLogSys::Log(uint16 log_type, const std::string message) +void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...){ + va_list args; + va_start(args, message); + std::string output_message = vStringFormat(message.c_str(), args); + va_end(args); + EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); +} + +void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { if (log_type > EQEmuLogSys::MaxLogID){ return; } + if (!RuleB(Logging, LogFileCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } + + va_list args; + va_start(args, message); + std::string output_message = vStringFormat(message.c_str(), args); + va_end(args); auto t = std::time(nullptr); auto tm = *std::localtime(&t); EQEmuLogSys::ConsoleMessage(log_type, message); if (process_log){ - process_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << StringFormat("[%s] ", TypeNames[log_type]).c_str() << message << std::endl; + process_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; } else{ - std::cout << "[DEBUG] " << " :: There currently is no log file open for this process " << std::endl; + std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << std::endl; } } @@ -113,23 +127,21 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) if (log_type > EQEmuLogSys::MaxLogID){ return; } + if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } #ifdef _WINDOWS HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_FONT_INFOEX info = { 0 }; info.cbSize = sizeof(info); info.dwFontSize.Y = 12; // leave X as zero info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - SetConsoleTextAttribute(console_handle, LogColors[log_type]); - + SetCurrentConsoleFontEx(console_handle, NULL, &info); + SetConsoleTextAttribute(console_handle, LogColors[log_type]); #endif - std::cout << "[(N)" << TypeNames[log_type] << "] " << message << std::endl; + std::cout << "[N::" << TypeNames[log_type] << "] " << message << std::endl; #ifdef _WINDOWS /* Always set back to white*/ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d2a6c4622..cfeea78ce 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -40,17 +40,25 @@ public: MaxLogID /* Max, used in functions to get the max log ID */ }; - void StartZoneLogs(const std::string log_name); - void Log(uint16 log_type, const std::string message); + enum DebugLevel { + General = 0, /* 0 - Low-Level general debugging, useful info on single line */ + Moderate, /* 1 - Informational based, used in functions, when particular things load */ + Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ + }; + void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); + void LogDebug(DebugLevel debug_level, std::string message, ...); + void Log(uint16 log_type, const std::string message, ...); + void StartZoneLogs(const std::string log_name); + private: bool zone_general_init = false; }; -extern EQEmuLogSys log_sys; +extern EQEmuLogSys logger; diff --git a/zone/net.cpp b/zone/net.cpp index b728de18f..cfd00628a 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -103,7 +103,7 @@ TitleManager title_manager; QueryServ *QServ = 0; TaskManager *taskmanager = 0; QuestParserCollection *parse = 0; -EQEmuLogSys log_sys; +EQEmuLogSys logger; const SPDat_Spell_Struct* spells; void LoadSpells(EQEmu::MemoryMappedFile **mmf); @@ -146,6 +146,8 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } + + _log(ZONE__INIT, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { _log(ZONE__INIT_ERR, "Loading server configuration failed."); @@ -174,6 +176,8 @@ int main(int argc, char** argv) { GuildBanks = nullptr; + logger.LogDebug(EQEmuLogSys::DebugLevel::General, "This is a crazy test message, database is %s and username is %s", Config->DatabaseDB.c_str(), Config->DatabaseUsername.c_str()); + #ifdef _EQDEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif diff --git a/zone/zone.cpp b/zone/zone.cpp index 63b673cd1..b56509ee8 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -152,7 +152,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { /* Set Logging */ - log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + logger.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; } @@ -720,7 +720,7 @@ void Zone::Shutdown(bool quite) parse->ReloadQuests(true); UpdateWindowTitle(); - log_sys.CloseZoneLogs(); + logger.CloseZoneLogs(); } void Zone::LoadZoneDoors(const char* zone, int16 version) From 9e4ef74dd553a3dcaa7d4e7d6aef6f570548844c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 14:59:32 -0600 Subject: [PATCH 0804/1883] RULE_INT(Logging, DebugLogLevel, 0) /* Sets Debug Level, -1 = OFF, 0 = Low Level, 1 = Info, 2 = Extreme */ --- common/eqemu_logsys.cpp | 5 +++++ common/ruletypes.h | 4 ++-- zone/net.cpp | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 498526d3b..3806e49e4 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -91,10 +91,15 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...){ + if (RuleI(Logging, DebugLogLevel) < debug_level){ + return; + } + va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); + EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } diff --git a/common/ruletypes.h b/common/ruletypes.h index aa9a83c72..1d9286a69 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -599,6 +599,7 @@ RULE_CATEGORY_END() RULE_CATEGORY(Logging) RULE_BOOL(Logging, ConsoleLogCommands, false) /* Turns on or off console logs */ RULE_BOOL(Logging, LogFileCommands, false) +RULE_INT(Logging, DebugLogLevel, 0) /* Sets Debug Level, -1 = OFF, 0 = Low Level, 1 = Info, 2 = Extreme */ RULE_CATEGORY_END() @@ -606,5 +607,4 @@ RULE_CATEGORY_END() #undef RULE_INT #undef RULE_REAL #undef RULE_BOOL -#undef RULE_CATEGORY_END - +#undef RULE_CATEGORY_END \ No newline at end of file diff --git a/zone/net.cpp b/zone/net.cpp index cfd00628a..c9fd32a00 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -176,7 +176,11 @@ int main(int argc, char** argv) { GuildBanks = nullptr; - logger.LogDebug(EQEmuLogSys::DebugLevel::General, "This is a crazy test message, database is %s and username is %s", Config->DatabaseDB.c_str(), Config->DatabaseUsername.c_str()); + logger.LogDebug(EQEmuLogSys::General, "Test, Debug Log Level 0"); + logger.LogDebug(EQEmuLogSys::Moderate, "Test, Debug Log Level 1"); + logger.LogDebug(EQEmuLogSys::Detail, "Test, Debug Log Level 2"); + + logger.LogDebug(EQEmuLogSys::General, "This is a crazy test message, database is '%s' and port is %u", Config->DatabaseDB.c_str(), Config->DatabasePort); #ifdef _EQDEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); From ebb26596308f9d883ee4e59c6e891876928e26a2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:08:30 -0600 Subject: [PATCH 0805/1883] Line changes --- zone/client_packet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 61f7813e1..ea012898c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13855,8 +13855,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - LogFile->write(EQEmuLog::Debug, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", - app->size, sizeof(VeteranClaimRequest)); + LogFile->write(EQEmuLog::Debug, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } From dadae1a71fc088abadaec80b31dcffedad7a64aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:26:38 -0600 Subject: [PATCH 0806/1883] Replaced Debug messages: LogFile->write with logger.LogDebug --- zone/aggro.cpp | 11 +-- zone/attack.cpp | 8 +- zone/bot.cpp | 2 +- zone/client.cpp | 35 ++++----- zone/client_mods.cpp | 9 ++- zone/client_packet.cpp | 163 ++++++++++++++++++++-------------------- zone/client_process.cpp | 4 +- zone/command.cpp | 4 +- zone/corpse.cpp | 7 +- zone/doors.cpp | 9 ++- zone/groups.cpp | 9 ++- zone/inventory.cpp | 3 +- zone/loottables.cpp | 4 +- zone/merc.cpp | 5 +- zone/petitions.cpp | 3 +- zone/spawngroup.cpp | 2 +- zone/spell_effects.cpp | 7 +- zone/spells.cpp | 3 +- zone/trading.cpp | 11 +-- zone/zone.cpp | 16 ++-- zone/zonedb.cpp | 24 +++--- zone/zoning.cpp | 11 +-- 22 files changed, 183 insertions(+), 167 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index b2b3881bb..0fe174a65 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/faction.h" #include "../common/rulesys.h" #include "../common/spdat.h" @@ -344,7 +345,7 @@ bool Mob::CheckWillAggro(Mob *mob) { // Aggro #if EQDEBUG>=6 - LogFile->write(EQEmuLog::Debug, "Check aggro for %s target %s.", GetName(), mob->GetName()); + logger.LogDebug(EQEmuLogSys::General, "Check aggro for %s target %s.", GetName(), mob->GetName()); #endif return( mod_will_aggro(mob, this) ); } @@ -469,7 +470,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + logger.LogDebug(EQEmuLogSys::General, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -696,7 +697,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - LogFile->write(EQEmuLog::Debug, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + logger.LogDebug(EQEmuLogSys::General, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -836,7 +837,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - LogFile->write(EQEmuLog::Debug, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + logger.LogDebug(EQEmuLogSys::General, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -948,7 +949,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - LogFile->write(EQEmuLog::Debug, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + logger.LogDebug(EQEmuLogSys::General, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 8b9196adc..29d46d76e 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -61,7 +61,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug, "Weapon skill:%i", item->ItemType); + logger.LogDebug(EQEmuLogSys::General, "Weapon skill:%i", item->ItemType); #endif switch (item->ItemType) { @@ -192,7 +192,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += RuleR(Combat, NPCBonusHitChance); #if ATTACK_DEBUG>=11 - LogFile->write(EQEmuLog::Debug, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + logger.LogDebug(EQEmuLogSys::General, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); #endif mlog(COMBAT__TOHIT,"CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); @@ -334,7 +334,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins #if EQDEBUG>=11 - LogFile->write(EQEmuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + logger.LogDebug(EQEmuLogSys::General, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); #endif // @@ -2036,7 +2036,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack { zone->DelAggroMob(); #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount()); + logger.LogDebug(EQEmuLogSys::General,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount()); #endif } SetHP(0); diff --git a/zone/bot.cpp b/zone/bot.cpp index bcc9a763c..4c88a4986 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8550,7 +8550,7 @@ int32 Bot::CalcMaxMana() { } default: { - LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } diff --git a/zone/client.cpp b/zone/client.cpp index d8c24d1ba..88b729105 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -34,6 +34,7 @@ extern volatile bool RunLoops; +#include "../common/eqemu_logsys.h" #include "../common/features.h" #include "../common/spdat.h" #include "../common/guilds.h" @@ -339,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - LogFile->write(EQEmuLog::Debug, "Client '%s' was destroyed before reaching the connected state:", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -437,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - LogFile->write(EQEmuLog::Debug, "Client has not sent us an initial zone entry packet."); + logger.LogDebug(EQEmuLogSys::General, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - LogFile->write(EQEmuLog::Debug, "Client sent initial zone packet, but we never got their player info from the database."); + logger.LogDebug(EQEmuLogSys::General, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - LogFile->write(EQEmuLog::Debug, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + logger.LogDebug(EQEmuLogSys::General, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - LogFile->write(EQEmuLog::Debug, "We successfully sent player info and spawns, waiting for client to request new zone."); + logger.LogDebug(EQEmuLogSys::General, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - LogFile->write(EQEmuLog::Debug, "We received client's new zone request, waiting for client spawn request."); + logger.LogDebug(EQEmuLogSys::General, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - LogFile->write(EQEmuLog::Debug, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + logger.LogDebug(EQEmuLogSys::General, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - LogFile->write(EQEmuLog::Debug, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + logger.LogDebug(EQEmuLogSys::General, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - LogFile->write(EQEmuLog::Debug, "We received client ready notification, but never finished Client::CompleteConnect"); + logger.LogDebug(EQEmuLogSys::General, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - LogFile->write(EQEmuLog::Debug, "Client is successfully connected."); + logger.LogDebug(EQEmuLogSys::General, "Client is successfully connected."); break; }; } @@ -701,7 +702,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + logger.LogDebug(EQEmuLogSys::General,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); #endif if (targetname == nullptr) { @@ -2111,7 +2112,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - LogFile->write(EQEmuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + logger.LogDebug(EQEmuLogSys::General, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2151,7 +2152,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - LogFile->write(EQEmuLog::Debug, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + logger.LogDebug(EQEmuLogSys::General, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -4550,14 +4551,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was not a treasure chest.", + logger.LogDebug(EQEmuLogSys::General, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range", + logger.LogDebug(EQEmuLogSys::General, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -8155,7 +8156,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "Eating from slot:%i", (int)slot); + logger.LogDebug(EQEmuLogSys::General, "Eating from slot:%i", (int)slot); #endif } else @@ -8172,7 +8173,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "Drinking from slot:%i", (int)slot); + logger.LogDebug(EQEmuLogSys::General, "Drinking from slot:%i", (int)slot); #endif } } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 1a05052ad..1353b6f99 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/logsys.h" #include "../common/rulesys.h" #include "../common/spdat.h" @@ -934,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -955,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + logger.LogDebug(EQEmuLogSys::General, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1045,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + logger.LogDebug(EQEmuLogSys::General, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ea012898c..3d2c76a05 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -16,6 +16,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include #include @@ -415,7 +416,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) #ifdef SOLAR if(0 && opcode != OP_ClientUpdate) { - LogFile->write(EQEmuLog::Debug,"HandlePacket() OPCODE debug enabled client %s", GetName()); + logger.LogDebug(EQEmuLogSys::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); std::cerr << "OPCODE: " << std::hex << std::setw(4) << std::setfill('0') << opcode << std::dec << ", size: " << app->size << std::endl; DumpPacket(app); } @@ -482,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - LogFile->write(EQEmuLog::Debug, "Unknown client_state: %d\n", client_state); + logger.LogDebug(EQEmuLogSys::General, "Unknown client_state: %d\n", client_state); break; } @@ -1316,7 +1317,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + logger.LogDebug(EQEmuLogSys::General, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object @@ -1940,7 +1941,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AcceptNewTask expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -2280,7 +2281,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2994,7 +2995,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - LogFile->write(EQEmuLog::Debug, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + logger.LogDebug(EQEmuLogSys::General, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3010,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3040,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3053,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AugmentInfo expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3295,7 +3296,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3312,7 @@ 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)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Bandolier expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3331,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - LogFile->write(EQEmuLog::Debug, "Uknown Bandolier action %i", bs->action); + logger.LogDebug(EQEmuLogSys::General, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3340,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3425,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - LogFile->write(EQEmuLog::Debug, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + logger.LogDebug(EQEmuLogSys::General, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3730,7 +3731,7 @@ void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) LogFile->write(EQEmuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - LogFile->write(EQEmuLog::Debug, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + logger.LogDebug(EQEmuLogSys::General, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3744,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_BlockedBuffs expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3941,7 +3942,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_CancelTask expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -4006,16 +4007,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - LogFile->write(EQEmuLog::Debug, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - LogFile->write(EQEmuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + logger.LogDebug(EQEmuLogSys::General, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4048,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - LogFile->write(EQEmuLog::Debug, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + logger.LogDebug(EQEmuLogSys::General, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4191,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4213,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4718,7 +4719,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4813,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -5137,7 +5138,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_DelegateAbility expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5312,7 +5313,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5364,7 +5365,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - LogFile->write(EQEmuLog::Debug, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + logger.LogDebug(EQEmuLogSys::General, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5930,7 +5931,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -6180,7 +6181,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - LogFile->write(EQEmuLog::Debug, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + logger.LogDebug(EQEmuLogSys::General, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6303,7 +6304,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6314,7 +6315,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6448,7 +6449,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) return; } - LogFile->write(EQEmuLog::Debug, "Member Disband Request from %s\n", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6728,7 +6729,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - LogFile->write(EQEmuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6819,7 +6820,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch on OP_GroupUpdate: got %u expected %u", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6838,7 +6839,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - LogFile->write(EQEmuLog::Debug, "Group /makeleader request originated from non-leader member: %s", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6847,7 +6848,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - LogFile->write(EQEmuLog::Debug, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + logger.LogDebug(EQEmuLogSys::General, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -7797,7 +7798,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GuildStatus expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7854,7 +7855,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7959,7 +7960,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_HideCorpse expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -8465,7 +8466,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - LogFile->write(EQEmuLog::Debug, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + logger.LogDebug(EQEmuLogSys::General, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8508,7 +8509,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - LogFile->write(EQEmuLog::Debug, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + logger.LogDebug(EQEmuLogSys::General, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8546,7 +8547,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - LogFile->write(EQEmuLog::Debug, "Item with no effect right clicked by %s", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8619,7 +8620,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - LogFile->write(EQEmuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); + logger.LogDebug(EQEmuLogSys::General, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8635,7 +8636,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - LogFile->write(EQEmuLog::Debug, "Drinking Alcohol from slot:%i", slot_id); + logger.LogDebug(EQEmuLogSys::General, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8662,7 +8663,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - LogFile->write(EQEmuLog::Debug, "Error: unknown item->Click.Type (%i)", item->Click.Type); + logger.LogDebug(EQEmuLogSys::General, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8803,7 +8804,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -9345,7 +9346,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9402,7 +9403,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9537,7 +9538,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9557,7 +9558,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9582,7 +9583,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9654,7 +9655,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9678,7 +9679,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -10534,7 +10535,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PopupResponse expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10569,7 +10570,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PotionBelt expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10577,7 +10578,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - LogFile->write(EQEmuLog::Debug, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + logger.LogDebug(EQEmuLogSys::General, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10600,7 +10601,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10690,7 +10691,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10717,7 +10718,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -11403,7 +11404,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - LogFile->write(EQEmuLog::Debug, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + logger.LogDebug(EQEmuLogSys::General, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11464,7 +11465,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - LogFile->write(EQEmuLog::Debug, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + logger.LogDebug(EQEmuLogSys::General, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11524,7 +11525,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11687,7 +11688,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_RespawnWindow expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11738,7 +11739,7 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } @@ -11988,7 +11989,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -12117,7 +12118,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "%s, purchase item..", GetName()); + logger.LogDebug(EQEmuLogSys::General, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12853,7 +12854,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -13168,7 +13169,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13710,7 +13711,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13855,7 +13856,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - LogFile->write(EQEmuLog::Debug, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + logger.LogDebug(EQEmuLogSys::General, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13895,7 +13896,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13946,7 +13947,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13958,7 +13959,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - LogFile->write(EQEmuLog::Debug, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14181,7 +14182,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - LogFile->write(EQEmuLog::Debug, "Unhandled XTarget Type %i", Type); + logger.LogDebug(EQEmuLogSys::General, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 6e21ecd36..e42c939b5 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -18,6 +18,8 @@ client_process.cpp: Handles client login sequence and packets sent from client to zone */ + +#include "../common/eqemu_logsys.h" #include "../common/debug.h" #include #include @@ -1035,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - LogFile->write(EQEmuLog::Debug, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + logger.LogDebug(EQEmuLogSys::General, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } diff --git a/zone/command.cpp b/zone/command.cpp index 0a6a1b551..73bd705a5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2464,7 +2464,7 @@ void command_spawn(Client *c, const Seperator *sep) } } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug,"#spawn Spawning:"); + logger.LogDebug(EQEmuLogSys::General,"#spawn Spawning:"); #endif NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), c); @@ -4449,7 +4449,7 @@ void command_time(Client *c, const Seperator *sep) ); c->Message(13, "It is now %s.", timeMessage); #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug,"Recieved timeMessage:%s", timeMessage); + logger.LogDebug(EQEmuLogSys::General,"Recieved timeMessage:%s", timeMessage); #endif } } diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 433fc9a66..dacc0aba1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -29,6 +29,7 @@ Child of the Mob class. #endif #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" @@ -841,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - LogFile->write(EQEmuLog::Debug, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + logger.LogDebug(EQEmuLogSys::General, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -871,7 +872,7 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - LogFile->write(EQEmuLog::Debug, "Tagged %s player corpse has burried.", this->GetName()); + logger.LogDebug(EQEmuLogSys::General, "Tagged %s player corpse has burried.", this->GetName()); } else { LogFile->write(EQEmuLog::Error, "Unable to bury %s player corpse.", this->GetName()); @@ -1082,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - LogFile->write(EQEmuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + logger.LogDebug(EQEmuLogSys::General, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index a745265cf..229bb3e4c 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/string_util.h" #include "client.h" @@ -302,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - LogFile->write(EQEmuLog::Debug, "Client has lockpicks: skill=%f", modskill); + logger.LogDebug(EQEmuLogSys::General, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -559,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - LogFile->write(EQEmuLog::Debug, + logger.LogDebug(EQEmuLogSys::General, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - LogFile->write(EQEmuLog::Debug, + logger.LogDebug(EQEmuLogSys::General, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - LogFile->write(EQEmuLog::Debug, + logger.LogDebug(EQEmuLogSys::General, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } diff --git a/zone/groups.cpp b/zone/groups.cpp index 6adc6735a..6f4ca88c2 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "masterentity.h" #include "npc_ai.h" #include "../common/packet_functions.h" @@ -1097,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - LogFile->write(EQEmuLog::Debug, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + logger.LogDebug(EQEmuLogSys::General, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1106,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1115,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - LogFile->write(EQEmuLog::Debug, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 42a05e175..002883aa9 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/logsys.h" #include "../common/string_util.h" #include "quest_parser_collection.h" @@ -699,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - LogFile->write(EQEmuLog::Debug, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + logger.LogDebug(EQEmuLogSys::General, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. diff --git a/zone/loottables.cpp b/zone/loottables.cpp index f652cdbe0..74f347f69 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - LogFile->write(EQEmuLog::Debug, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + logger.LogDebug(EQEmuLogSys::General, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - LogFile->write(EQEmuLog::Debug, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + logger.LogDebug(EQEmuLogSys::General, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index b73c4fa0e..0ee4950ac 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -6,6 +6,7 @@ #include "groups.h" #include "mob.h" +#include "../common/eqemu_logsys.h" #include "../common/eq_packet_structs.h" #include "../common/eq_constants.h" #include "../common/skills.h" @@ -884,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - LogFile->write(EQEmuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -905,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Debug, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + logger.LogDebug(EQEmuLogSys::General, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 0329675d7..5843c2351 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -16,6 +16,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #ifdef _WINDOWS #include @@ -258,7 +259,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) } #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "New petition created"); + logger.LogDebug(EQEmuLogSys::General, "New petition created"); #endif } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index bb9cb8abf..d6745ed6b 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - LogFile->write(EQEmuLog::Debug, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + logger.LogDebug(EQEmuLogSys::General, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 70a7d3981..692856078 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "../common/eqemu_logsys.h" #include "../common/bodytypes.h" #include "../common/classes.h" #include "../common/debug.h" @@ -475,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - LogFile->write(EQEmuLog::Debug, "Succor/Evacuation Spell In Same Zone."); + logger.LogDebug(EQEmuLogSys::General, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -484,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - LogFile->write(EQEmuLog::Debug, "Succor/Evacuation Spell To Another Zone."); + logger.LogDebug(EQEmuLogSys::General, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -3325,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - LogFile->write(EQEmuLog::Debug, "Unknown spell effect value forumula %d", formula); + logger.LogDebug(EQEmuLogSys::General, "Unknown spell effect value forumula %d", formula); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index f749f062d..9db7ca8a2 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -69,6 +69,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/bodytypes.h" #include "../common/classes.h" #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/item.h" #include "../common/rulesys.h" #include "../common/skills.h" @@ -2672,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - LogFile->write(EQEmuLog::Debug, "CalcBuffDuration_formula: unknown formula %d", formula); + logger.LogDebug(EQEmuLogSys::General, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } diff --git a/zone/trading.cpp b/zone/trading.cpp index d8c67588f..b591beaec 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" @@ -85,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - LogFile->write(EQEmuLog::Debug, "Programming error: NPC's should not call Trade::AddEntity()"); + logger.LogDebug(EQEmuLogSys::General, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -295,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - LogFile->write(EQEmuLog::Debug, "Dumping trade data: '%s' in TradeState %i with '%s'", + logger.LogDebug(EQEmuLogSys::General, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -306,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - LogFile->write(EQEmuLog::Debug, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + logger.LogDebug(EQEmuLogSys::General, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -314,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - LogFile->write(EQEmuLog::Debug, "\tBagItem %i (Charges=%i, Slot=%i)", + logger.LogDebug(EQEmuLogSys::General, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -323,7 +324,7 @@ void Trade::DumpTrade() } } - LogFile->write(EQEmuLog::Debug, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + logger.LogDebug(EQEmuLogSys::General, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif diff --git a/zone/zone.cpp b/zone/zone.cpp index b56509ee8..77622f7dd 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - LogFile->write(EQEmuLog::Debug, "No Merchant Data found for %s.", GetShortName()); + logger.LogDebug(EQEmuLogSys::General, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - LogFile->write(EQEmuLog::Debug, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + logger.LogDebug(EQEmuLogSys::General, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -801,10 +801,10 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - LogFile->write(EQEmuLog::Debug, "Graveyard ID is %i.", graveyard_id()); + logger.LogDebug(EQEmuLogSys::General, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - LogFile->write(EQEmuLog::Debug, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + logger.LogDebug(EQEmuLogSys::General, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else LogFile->write(EQEmuLog::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - LogFile->write(EQEmuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + logger.LogDebug(EQEmuLogSys::General, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - LogFile->write(EQEmuLog::Debug, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + logger.LogDebug(EQEmuLogSys::General, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - LogFile->write(EQEmuLog::Debug, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + logger.LogDebug(EQEmuLogSys::General, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - LogFile->write(EQEmuLog::Debug, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + logger.LogDebug(EQEmuLogSys::General, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a1fdb1a76..30f570b20 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1,5 +1,5 @@ - +#include "../common/eqemu_logsys.h" #include "../common/extprofile.h" #include "../common/item.h" #include "../common/rulesys.h" @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - LogFile->write(EQEmuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + logger.LogDebug(EQEmuLogSys::General, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - LogFile->write(EQEmuLog::Debug, "Saving Currency for character ID: %i, done", character_id); + logger.LogDebug(EQEmuLogSys::General, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - LogFile->write(EQEmuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + logger.LogDebug(EQEmuLogSys::General, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 9566a9a5c..1591bf0b6 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" @@ -43,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - LogFile->write(EQEmuLog::Debug, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + logger.LogDebug(EQEmuLogSys::General, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - LogFile->write(EQEmuLog::Debug, "Zone request from %s", GetName()); + logger.LogDebug(EQEmuLogSys::General, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -192,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - LogFile->write(EQEmuLog::Debug, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + logger.LogDebug(EQEmuLogSys::General, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -533,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - LogFile->write(EQEmuLog::Debug, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + logger.LogDebug(EQEmuLogSys::General, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -542,7 +543,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - LogFile->write(EQEmuLog::Debug, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + logger.LogDebug(EQEmuLogSys::General, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; From 6844645dfb047fb38cee828d92349cd80e123b08 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:44:35 -0600 Subject: [PATCH 0807/1883] Replace LogFile->write(EQEmuLog::Error, with logger.logevents(EQEmuLogSys::Error --- common/database.h | 1 + zone/aa.cpp | 33 +++---- zone/attack.cpp | 10 +- zone/bot.cpp | 18 ++-- zone/client.cpp | 12 +-- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 208 ++++++++++++++++++++--------------------- zone/command.cpp | 4 +- zone/corpse.cpp | 2 +- zone/effects.cpp | 3 +- zone/embparser_api.cpp | 2 +- zone/embxs.cpp | 3 +- zone/entity.cpp | 8 +- zone/forage.cpp | 7 +- zone/groups.cpp | 24 ++--- zone/guild.cpp | 4 +- zone/horse.cpp | 7 +- zone/inventory.cpp | 6 +- zone/merc.cpp | 6 +- zone/net.cpp | 2 +- zone/npc.cpp | 18 ++-- zone/object.cpp | 8 +- zone/pathing.cpp | 10 +- zone/petitions.cpp | 8 +- zone/pets.cpp | 16 ++-- zone/questmgr.cpp | 4 +- zone/raids.cpp | 18 ++-- zone/spawn2.cpp | 22 ++--- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 14 +-- zone/tasks.cpp | 66 ++++++------- zone/titles.cpp | 12 +-- zone/tradeskills.cpp | 64 ++++++------- zone/trading.cpp | 2 +- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 46 ++++----- zone/zone.cpp | 62 ++++++------ zone/zonedb.cpp | 54 +++++------ zone/zoning.cpp | 24 ++--- 40 files changed, 415 insertions(+), 409 deletions(-) diff --git a/common/database.h b/common/database.h index 5be342482..f45b83600 100644 --- a/common/database.h +++ b/common/database.h @@ -22,6 +22,7 @@ #define INVALID_ID 0xFFFFFFFF #include "debug.h" +#include "eqemu_logsys.h" #include "types.h" #include "dbcore.h" #include "linked_list.h" diff --git a/zone/aa.cpp b/zone/aa.cpp index 9aba83bbd..b3f626b93 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -18,6 +18,7 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) #include "../common/classes.h" #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/eq_packet_structs.h" #include "../common/races.h" #include "../common/spdat.h" @@ -444,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - LogFile->write(EQEmuLog::Error, "Unknown AA nonspell action type %d", caa->action); + logger.Log(EQEmuLogSys::Error,"Unknown AA nonspell action type %d", caa->action); return; } @@ -500,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - LogFile->write(EQEmuLog::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + logger.Log(EQEmuLogSys::Error,"Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -527,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - LogFile->write(EQEmuLog::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + logger.Log(EQEmuLogSys::Error,"Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -624,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - LogFile->write(EQEmuLog::Error, "Unknown npc type for swarm pet type id: %d", typesid); + logger.Log(EQEmuLogSys::Error,"Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -1431,7 +1432,7 @@ void Zone::LoadAAs() { LogFile->write(EQEmuLog::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - LogFile->write(EQEmuLog::Error, "Failed to load AAs!"); + logger.Log(EQEmuLogSys::Error,"Failed to load AAs!"); aas = nullptr; return; } @@ -1450,7 +1451,7 @@ void Zone::LoadAAs() { if (database.LoadAAEffects2()) LogFile->write(EQEmuLog::Status, "Loaded %d AA Effects.", aa_effects.size()); else - LogFile->write(EQEmuLog::Error, "Failed to load AA Effects!"); + logger.Log(EQEmuLogSys::Error,"Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1459,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - LogFile->write(EQEmuLog::Error, "Error loading AA Effects, none found in the database."); + logger.Log(EQEmuLogSys::Error,"Error loading AA Effects, none found in the database."); return false; } @@ -1801,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1840,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1894,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1911,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1944,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1969,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1989,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/attack.cpp b/zone/attack.cpp index 29d46d76e..59cc0216b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1135,7 +1135,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Client::Attack() for evaluation!"); return false; } @@ -1699,7 +1699,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -3896,7 +3896,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3927,7 +3927,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } @@ -4476,7 +4476,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 4c88a4986..e0cf89601 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + logger.Log(EQEmuLogSys::Error,"Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Bot::LoadAAs()"); + logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadAAs()"); return; } @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - LogFile->write(EQEmuLog::Error, "Error in Bot::LoadStance()"); + logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in Bot::SaveStance()"); + logger.Log(EQEmuLogSys::Error,"Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Bot::LoadTimers()"); + logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - LogFile->write(EQEmuLog::Error, "Error in Bot::SaveTimers()"); + logger.Log(EQEmuLogSys::Error,"Error in Bot::SaveTimers()"); } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - LogFile->write(EQEmuLog::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + logger.Log(EQEmuLogSys::Error,"Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + logger.Log(EQEmuLogSys::Error,"Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -6017,7 +6017,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Bot::Attack for evaluation!"); return false; } diff --git a/zone/client.cpp b/zone/client.cpp index 88b729105..41c2a6134 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5301,7 +5301,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5369,7 +5369,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5396,7 +5396,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5404,7 +5404,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6218,7 +6218,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - LogFile->write(EQEmuLog::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + logger.Log(EQEmuLogSys::Error,"Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6232,7 +6232,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - LogFile->write(EQEmuLog::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + logger.Log(EQEmuLogSys::Error,"Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 1353b6f99..a2cd7eefb 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - LogFile->write(EQEmuLog::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + logger.Log(EQEmuLogSys::Error,"Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3d2c76a05..721e7e836 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - LogFile->write(EQEmuLog::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + logger.Log(EQEmuLogSys::Error,"HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - LogFile->write(EQEmuLog::Error, "Client error: %s", error->character_name); - LogFile->write(EQEmuLog::Error, "Error message: %s", error->message); + logger.Log(EQEmuLogSys::Error,"Client error: %s", error->character_name); + logger.Log(EQEmuLogSys::Error,"Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized OP_SetServerFilter"); + logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1324,7 +1324,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - LogFile->write(EQEmuLog::Error, "GetAuth() returned false kicking client"); + logger.Log(EQEmuLogSys::Error,"GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - LogFile->write(EQEmuLog::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + logger.Log(EQEmuLogSys::Error,"Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1956,7 +1956,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - LogFile->write(EQEmuLog::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + logger.Log(EQEmuLogSys::Error,"Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2011,7 +2011,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2191,7 +2191,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2413,7 +2413,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + logger.Log(EQEmuLogSys::Error,"Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2939,7 +2939,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized " + logger.Log(EQEmuLogSys::Error,"Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2958,7 +2958,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -3072,7 +3072,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3229,7 +3229,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3581,7 +3581,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3637,7 +3637,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - LogFile->write(EQEmuLog::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + logger.Log(EQEmuLogSys::Error,"Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3722,13 +3722,13 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - LogFile->write(EQEmuLog::Error, "Size mismatch for Bind wound packet"); + logger.Log(EQEmuLogSys::Error,"Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - LogFile->write(EQEmuLog::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + logger.Log(EQEmuLogSys::Error,"Bindwound on non-exsistant mob from %s", this->GetName()); } else { logger.LogDebug(EQEmuLogSys::General, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); @@ -3839,7 +3839,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - LogFile->write(EQEmuLog::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + logger.Log(EQEmuLogSys::Error,"Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3860,7 +3860,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - LogFile->write(EQEmuLog::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } @@ -3956,7 +3956,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4235,7 +4235,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4260,7 +4260,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4311,7 +4311,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4324,11 +4324,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - LogFile->write(EQEmuLog::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + logger.Log(EQEmuLogSys::Error,"Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - LogFile->write(EQEmuLog::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + logger.Log(EQEmuLogSys::Error,"Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4345,8 +4345,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - LogFile->write(EQEmuLog::Error, "Client error: %s", error->character_name); - LogFile->write(EQEmuLog::Error, "Error message:%s", error->message); + logger.Log(EQEmuLogSys::Error,"Client error: %s", error->character_name); + logger.Log(EQEmuLogSys::Error,"Error message:%s", error->message); return; } @@ -4367,7 +4367,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4873,7 +4873,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4910,7 +4910,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - LogFile->write(EQEmuLog::Error, "Consuming from empty slot %d", pcs->slot); + logger.Log(EQEmuLogSys::Error,"Consuming from empty slot %d", pcs->slot); return; } @@ -4922,7 +4922,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - LogFile->write(EQEmuLog::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + logger.Log(EQEmuLogSys::Error,"OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4943,7 +4943,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5099,7 +5099,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5447,7 +5447,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized " + logger.Log(EQEmuLogSys::Error,"Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5538,7 +5538,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5593,7 +5593,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5862,7 +5862,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5914,7 +5914,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5947,7 +5947,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6012,7 +6012,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6062,7 +6062,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6129,7 +6129,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6383,7 +6383,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6400,7 +6400,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6444,7 +6444,7 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6591,7 +6591,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - LogFile->write(EQEmuLog::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + logger.Log(EQEmuLogSys::Error,"Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6611,7 +6611,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6660,7 +6660,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6738,7 +6738,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6774,7 +6774,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6868,7 +6868,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -7989,7 +7989,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8019,7 +8019,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8074,7 +8074,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8088,7 +8088,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8125,7 +8125,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - LogFile->write(EQEmuLog::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8225,7 +8225,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8240,7 +8240,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8438,7 +8438,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8891,7 +8891,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9051,7 +9051,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9088,7 +9088,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - LogFile->write(EQEmuLog::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + logger.Log(EQEmuLogSys::Error,"Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9113,7 +9113,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9169,7 +9169,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9717,7 +9717,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - LogFile->write(EQEmuLog::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9733,7 +9733,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9875,7 +9875,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9888,7 +9888,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10351,7 +10351,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10395,7 +10395,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10465,7 +10465,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - LogFile->write(EQEmuLog::Error, "Size mismatch for Pick Pocket packet"); + logger.Log(EQEmuLogSys::Error,"Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10739,7 +10739,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11324,7 +11324,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11353,7 +11353,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11369,7 +11369,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11383,7 +11383,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - LogFile->write(EQEmuLog::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11397,7 +11397,7 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } @@ -11456,7 +11456,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11746,7 +11746,7 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - LogFile->write(EQEmuLog::Error, "Unexpected OP_Sacrifice reply"); + logger.Log(EQEmuLogSys::Error,"Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11790,7 +11790,7 @@ void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - LogFile->write(EQEmuLog::Error, "Invalid size on OP_SelectTribute packet"); + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - LogFile->write(EQEmuLog::Error, "Received invalid sized " + logger.Log(EQEmuLogSys::Error,"Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11924,7 +11924,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11938,7 +11938,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "No valid start zones found for /setstartcity"); + logger.Log(EQEmuLogSys::Error,"No valid start zones found for /setstartcity"); return; } @@ -12013,7 +12013,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12110,7 +12110,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12278,7 +12278,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - LogFile->write(EQEmuLog::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + logger.Log(EQEmuLogSys::Error,"OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12368,7 +12368,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12524,7 +12524,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12817,7 +12817,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12944,7 +12944,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - LogFile->write(EQEmuLog::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + logger.Log(EQEmuLogSys::Error,"OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13222,7 +13222,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - LogFile->write(EQEmuLog::Error, "Unable to generate OP_Track packet requested by client."); + logger.Log(EQEmuLogSys::Error,"Unable to generate OP_Track packet requested by client."); return; } @@ -13236,7 +13236,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13389,7 +13389,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13535,7 +13535,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) _log(TRADING__CLIENT, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - LogFile->write(EQEmuLog::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + logger.Log(EQEmuLogSys::Error,"Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13545,7 +13545,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Unknown size for OP_Trader: %i\n", app->size); - LogFile->write(EQEmuLog::Error, "Unknown size for OP_Trader: %i\n", app->size); + logger.Log(EQEmuLogSys::Error,"Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13583,7 +13583,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13619,7 +13619,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - LogFile->write(EQEmuLog::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13690,7 +13690,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - LogFile->write(EQEmuLog::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error,"Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13829,7 +13829,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - LogFile->write(EQEmuLog::Error, "Invalid size on OP_TributeToggle packet"); + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13844,7 +13844,7 @@ void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - LogFile->write(EQEmuLog::Error, "Invalid size on OP_TributeUpdate packet"); + logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); diff --git a/zone/command.cpp b/zone/command.cpp index 73bd705a5..f5b4419a0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -496,7 +496,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - LogFile->write(EQEmuLog::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + logger.Log(EQEmuLogSys::Error,"command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -575,7 +575,7 @@ int command_realdispatch(Client *c, const char *message) #endif if(cur->function == nullptr) { - LogFile->write(EQEmuLog::Error, "Command '%s' has a null function\n", cstr.c_str()); + logger.Log(EQEmuLogSys::Error,"Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command diff --git a/zone/corpse.cpp b/zone/corpse.cpp index dacc0aba1..f6a193bc9 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -875,7 +875,7 @@ bool Corpse::Process() { logger.LogDebug(EQEmuLogSys::General, "Tagged %s player corpse has burried.", this->GetName()); } else { - LogFile->write(EQEmuLog::Error, "Unable to bury %s player corpse.", this->GetName()); + logger.Log(EQEmuLogSys::Error,"Unable to bury %s player corpse.", this->GetName()); return true; } } diff --git a/zone/effects.cpp b/zone/effects.cpp index ec463bddf..bd1fa7a54 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/spdat.h" #include "client.h" @@ -460,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - LogFile->write(EQEmuLog::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + logger.Log(EQEmuLogSys::Error,"Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index e75575b7c..1a51ede27 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - LogFile->write(EQEmuLog::Error, "boot_quest does not take any arguments."); + logger.Log(EQEmuLogSys::Error,"boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 11b444ef0..33cc53377 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -18,6 +18,7 @@ #ifdef EMBPERL #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "masterentity.h" #include "command.h" @@ -63,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - LogFile->write(EQEmuLog::Error, "boot_qc does not take any arguments."); + logger.Log(EQEmuLogSys::Error,"boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/entity.cpp b/zone/entity.cpp index d5e5774ca..c2d19d11a 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - LogFile->write(EQEmuLog::Error, "nullptr group, %s:%i", fname, fline); + logger.Log(EQEmuLogSys::Error,"nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - LogFile->write(EQEmuLog::Error, "About to delete a client still in a group."); + logger.Log(EQEmuLogSys::Error,"About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - LogFile->write(EQEmuLog::Error, "About to delete a client still in a raid."); + logger.Log(EQEmuLogSys::Error,"About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - LogFile->write(EQEmuLog::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + logger.Log(EQEmuLogSys::Error,"Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); diff --git a/zone/forage.cpp b/zone/forage.cpp index 6704e9b45..64318ec48 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" @@ -58,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -69,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - LogFile->write(EQEmuLog::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + logger.Log(EQEmuLogSys::Error,"Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -388,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - LogFile->write(EQEmuLog::Error, "nullptr returned from database.GetItem in ClientForageItem"); + logger.Log(EQEmuLogSys::Error,"nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index 6f4ca88c2..dfd36602b 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - LogFile->write(EQEmuLog::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 39785f3dd..fcc57bc86 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -413,7 +413,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -433,7 +433,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/horse.cpp b/zone/horse.cpp index 044c64e15..98b9ab91e 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/linked_list.h" #include "../common/string_util.h" @@ -72,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - LogFile->write(EQEmuLog::Error, "No Database entry for mount: %s, check the horses table", fileName); + logger.Log(EQEmuLogSys::Error,"No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -120,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - LogFile->write(EQEmuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + logger.Log(EQEmuLogSys::Error,"%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 002883aa9..a934a56ae 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - LogFile->write(EQEmuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.Log(EQEmuLogSys::Error,"Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - LogFile->write(EQEmuLog::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + logger.Log(EQEmuLogSys::Error,"Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - LogFile->write(EQEmuLog::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + logger.Log(EQEmuLogSys::Error,"Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } diff --git a/zone/merc.cpp b/zone/merc.cpp index 0ee4950ac..a6143c83c 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - LogFile->write(EQEmuLog::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in NPC::LoadMercTypes()"); + logger.Log(EQEmuLogSys::Error,"Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in NPC::LoadMercTypes()"); + logger.Log(EQEmuLogSys::Error,"Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/net.cpp b/zone/net.cpp index c9fd32a00..d451521df 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -625,7 +625,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Error loading spells: %s", ex.what()); + logger.Log(EQEmuLogSys::Error,"Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 479a3d5a7..516d5b3d6 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - LogFile->write(EQEmuLog::Error, "Database error, invalid item"); + logger.Log(EQEmuLogSys::Error,"Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/object.cpp b/zone/object.cpp index c8bde8f1f..9545caf19 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - LogFile->write(EQEmuLog::Error, "Object::PutItem: Invalid index specified (%i)", index); + logger.Log(EQEmuLogSys::Error,"Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index ed969b0ff..f5e1603e8 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -66,14 +66,14 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) } else { - LogFile->write(EQEmuLog::Error, "Path File %s failed to load.", ZonePathFileName); + logger.Log(EQEmuLogSys::Error,"Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - LogFile->write(EQEmuLog::Error, "Path File %s not found.", ZonePathFileName); + logger.Log(EQEmuLogSys::Error,"Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,7 +103,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - LogFile->write(EQEmuLog::Error, "Bad Magic String in .path file."); + logger.Log(EQEmuLogSys::Error,"Bad Magic String in .path file."); return false; } @@ -114,7 +114,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(Head.version != 2) { - LogFile->write(EQEmuLog::Error, "Unsupported path file version."); + logger.Log(EQEmuLogSys::Error,"Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - LogFile->write(EQEmuLog::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + logger.Log(EQEmuLogSys::Error,"Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 5843c2351..b0932bccb 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,7 +254,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index eb120d619..b75670ad0 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - LogFile->write(EQEmuLog::Error, "Unable to find data for pet %s, check pets table.", pettype); + logger.Log(EQEmuLogSys::Error,"Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - LogFile->write(EQEmuLog::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + logger.Log(EQEmuLogSys::Error,"Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - LogFile->write(EQEmuLog::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - LogFile->write(EQEmuLog::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + logger.Log(EQEmuLogSys::Error,"Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 1dd219032..09fce9c70 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - LogFile->write(EQEmuLog::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } diff --git a/zone/raids.cpp b/zone/raids.cpp index b01d169fd..17b000ff4 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - LogFile->write(EQEmuLog::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - LogFile->write(EQEmuLog::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index f96c9872a..e5f955e95 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - LogFile->write(EQEmuLog::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - LogFile->write(EQEmuLog::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + logger.Log(EQEmuLogSys::Error,"Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 692856078..2203b1be4 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - LogFile->write(EQEmuLog::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + logger.Log(EQEmuLogSys::Error,"%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 9db7ca8a2..5b6c88551 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + logger.Log(EQEmuLogSys::Error,"Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - LogFile->write(EQEmuLog::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + logger.Log(EQEmuLogSys::Error,"Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - LogFile->write(EQEmuLog::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + logger.Log(EQEmuLogSys::Error,"Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index d6f285de6..15ae8666e 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - LogFile->write(EQEmuLog::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + logger.Log(EQEmuLogSys::Error,"[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - LogFile->write(EQEmuLog::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - LogFile->write(EQEmuLog::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -323,7 +323,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -362,7 +362,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -466,7 +466,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - LogFile->write(EQEmuLog::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + logger.Log(EQEmuLogSys::Error,"[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - LogFile->write(EQEmuLog::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEmuLog::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - LogFile->write(EQEmuLog::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - LogFile->write(EQEmuLog::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - LogFile->write(EQEmuLog::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,7 +634,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - LogFile->write(EQEmuLog::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + logger.Log(EQEmuLogSys::Error,"[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - LogFile->write(EQEmuLog::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + logger.Log(EQEmuLogSys::Error,"[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -725,7 +725,7 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -774,7 +774,7 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { @@ -1280,7 +1280,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2938,7 +2938,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -2947,7 +2947,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -3088,7 +3088,7 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/titles.cpp b/zone/titles.cpp index 109a793b3..389e7f6ca 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + logger.Log(EQEmuLogSys::Error,"Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index e1cbbafc3..c56a070b0 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - LogFile->write(EQEmuLog::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + logger.Log(EQEmuLogSys::Error,"Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - LogFile->write(EQEmuLog::Error, "Player tried to augment an item without a container set."); + logger.Log(EQEmuLogSys::Error,"Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - LogFile->write(EQEmuLog::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + logger.Log(EQEmuLogSys::Error,"Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - LogFile->write(EQEmuLog::Error, "Replace container combine executed in a world container."); + logger.Log(EQEmuLogSys::Error,"Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - LogFile->write(EQEmuLog::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + logger.Log(EQEmuLogSys::Error,"Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine: no components returned"); + logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - LogFile->write(EQEmuLog::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - LogFile->write(EQEmuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + logger.Log(EQEmuLogSys::Error,"Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails: no components returned"); + logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - LogFile->write(EQEmuLog::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe search, query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - LogFile->write(EQEmuLog::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + logger.Log(EQEmuLogSys::Error,"GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, re-query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, re-query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - LogFile->write(EQEmuLog::Error, "Combine error: Incorrect container is being used!"); + logger.Log(EQEmuLogSys::Error,"Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - LogFile->write(EQEmuLog::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + logger.Log(EQEmuLogSys::Error,"Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - LogFile->write(EQEmuLog::Error, "Error in GetTradeRecept success: no success items returned"); + logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,7 +1477,7 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index b591beaec..4a8450204 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1539,7 +1539,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - LogFile->write(EQEmuLog::Error, "Bazaar: Zero price transaction between %s and %s aborted." + logger.Log(EQEmuLogSys::Error,"Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); diff --git a/zone/trap.cpp b/zone/trap.cpp index e48f9edf4..42995265f 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 9fc6638e1..961be18f9 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - LogFile->write(EQEmuLog::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + logger.Log(EQEmuLogSys::Error,"Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - LogFile->write(EQEmuLog::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + logger.Log(EQEmuLogSys::Error,"Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - LogFile->write(EQEmuLog::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + logger.Log(EQEmuLogSys::Error,"Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 9a9192397..82d0893a5 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -116,7 +116,7 @@ void NPC::ResumeWandering() } else { - LogFile->write(EQEmuLog::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error,"NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - LogFile->write(EQEmuLog::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - LogFile->write(EQEmuLog::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - LogFile->write(EQEmuLog::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - LogFile->write(EQEmuLog::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/zone.cpp b/zone/zone.cpp index 77622f7dd..d7c8ff822 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -167,7 +167,7 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadMercSpells()"); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadMercSpells()"); return; } @@ -737,7 +737,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version) Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - LogFile->write(EQEmuLog::Error, "... Failed to load doors."); + logger.Log(EQEmuLogSys::Error,"... Failed to load doors."); delete[] dlist; return; } @@ -806,7 +806,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(GraveYardLoaded) logger.LogDebug(EQEmuLogSys::General, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - LogFile->write(EQEmuLog::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + logger.Log(EQEmuLogSys::Error,"Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -901,38 +901,38 @@ bool Zone::Init(bool iStaticZone) { LogFile->write(EQEmuLog::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - LogFile->write(EQEmuLog::Error, "Loading spawn conditions failed, continuing without them."); + logger.Log(EQEmuLogSys::Error,"Loading spawn conditions failed, continuing without them."); } LogFile->write(EQEmuLog::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - LogFile->write(EQEmuLog::Error, "Loading static zone points failed."); + logger.Log(EQEmuLogSys::Error,"Loading static zone points failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - LogFile->write(EQEmuLog::Error, "Loading spawn groups failed."); + logger.Log(EQEmuLogSys::Error,"Loading spawn groups failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - LogFile->write(EQEmuLog::Error, "Loading spawn2 points failed."); + logger.Log(EQEmuLogSys::Error,"Loading spawn2 points failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - LogFile->write(EQEmuLog::Error, "Loading player corpses failed."); + logger.Log(EQEmuLogSys::Error,"Loading player corpses failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - LogFile->write(EQEmuLog::Error, "Loading traps failed."); + logger.Log(EQEmuLogSys::Error,"Loading traps failed."); return false; } @@ -942,13 +942,13 @@ bool Zone::Init(bool iStaticZone) { LogFile->write(EQEmuLog::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - LogFile->write(EQEmuLog::Error, "Loading ground spawns failed. continuing."); + logger.Log(EQEmuLogSys::Error,"Loading ground spawns failed. continuing."); } LogFile->write(EQEmuLog::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - LogFile->write(EQEmuLog::Error, "Loading World Objects failed. continuing."); + logger.Log(EQEmuLogSys::Error,"Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1024,27 +1024,27 @@ void Zone::ReloadStaticData() { LogFile->write(EQEmuLog::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - LogFile->write(EQEmuLog::Error, "Loading static zone points failed."); + logger.Log(EQEmuLogSys::Error,"Loading static zone points failed."); } LogFile->write(EQEmuLog::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - LogFile->write(EQEmuLog::Error, "Reloading traps failed."); + logger.Log(EQEmuLogSys::Error,"Reloading traps failed."); } LogFile->write(EQEmuLog::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - LogFile->write(EQEmuLog::Error, "Reloading ground spawns failed. continuing."); + logger.Log(EQEmuLogSys::Error,"Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); LogFile->write(EQEmuLog::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - LogFile->write(EQEmuLog::Error, "Reloading World Objects failed. continuing."); + logger.Log(EQEmuLogSys::Error,"Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - LogFile->write(EQEmuLog::Error, "Error loading the Zone Config."); + logger.Log(EQEmuLogSys::Error,"Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - LogFile->write(EQEmuLog::Error, "Error loading the Zone Config."); + logger.Log(EQEmuLogSys::Error,"Error loading the Zone Config."); return false; } } @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - LogFile->write(EQEmuLog::Error, "... Failed to load blocked spells."); + logger.Log(EQEmuLogSys::Error,"... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 30f570b20..579213d87 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - LogFile->write(EQEmuLog::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + logger.Log(EQEmuLogSys::Error,"Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapwrite(EQEmuLog::Error, "Error in LoadAltCurrencyValues query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadAltCurrencyValues query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2866,7 +2866,7 @@ void ZoneDatabase::SaveBuffs(Client *client) { buffs[index].ExtraDIChance); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in SaveBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in SaveBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -2885,7 +2885,7 @@ void ZoneDatabase::LoadBuffs(Client *client) { "FROM `character_buffs` WHERE `character_id` = '%u'", client->CharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - LogFile->write(EQEmuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + logger.Log(EQEmuLogSys::Error,"Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - LogFile->write(EQEmuLog::Error, "Unable to construct a player corpse for character id %u.", char_id); + logger.Log(EQEmuLogSys::Error,"Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 1591bf0b6..d404cf468 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - LogFile->write(EQEmuLog::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - LogFile->write(EQEmuLog::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - LogFile->write(EQEmuLog::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - LogFile->write(EQEmuLog::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error,"Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - LogFile->write(EQEmuLog::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + logger.Log(EQEmuLogSys::Error,"Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - LogFile->write(EQEmuLog::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + logger.Log(EQEmuLogSys::Error,"Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -550,7 +550,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; default: - LogFile->write(EQEmuLog::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + logger.Log(EQEmuLogSys::Error,"Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } From b76e179d758be28206e8c77baa306ac018c0e825 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:47:36 -0600 Subject: [PATCH 0808/1883] Fix spacing --- zone/aa.cpp | 32 +++---- zone/attack.cpp | 10 +- zone/bot.cpp | 18 ++-- zone/client.cpp | 12 +-- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 208 ++++++++++++++++++++--------------------- zone/command.cpp | 4 +- zone/corpse.cpp | 2 +- zone/effects.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embxs.cpp | 2 +- zone/entity.cpp | 8 +- zone/forage.cpp | 6 +- zone/groups.cpp | 24 ++--- zone/guild.cpp | 4 +- zone/horse.cpp | 6 +- zone/inventory.cpp | 6 +- zone/merc.cpp | 6 +- zone/net.cpp | 2 +- zone/npc.cpp | 18 ++-- zone/object.cpp | 8 +- zone/pathing.cpp | 10 +- zone/petitions.cpp | 8 +- zone/pets.cpp | 16 ++-- zone/questmgr.cpp | 4 +- zone/raids.cpp | 18 ++-- zone/spawn2.cpp | 22 ++--- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 14 +-- zone/tasks.cpp | 66 ++++++------- zone/titles.cpp | 12 +-- zone/tradeskills.cpp | 64 ++++++------- zone/trading.cpp | 2 +- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 46 ++++----- zone/zone.cpp | 62 ++++++------ zone/zonedb.cpp | 54 +++++------ zone/zoning.cpp | 24 ++--- 39 files changed, 409 insertions(+), 409 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index b3f626b93..6ee33ee1c 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - logger.Log(EQEmuLogSys::Error,"Unknown AA nonspell action type %d", caa->action); + logger.Log(EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - logger.Log(EQEmuLogSys::Error,"Unknown swarm pet spell id: %d, check pets table", spell_id); + logger.Log(EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - logger.Log(EQEmuLogSys::Error,"Unknown npc type for swarm pet spell id: %d", spell_id); + logger.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - logger.Log(EQEmuLogSys::Error,"Unknown npc type for swarm pet type id: %d", typesid); + logger.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -1432,7 +1432,7 @@ void Zone::LoadAAs() { LogFile->write(EQEmuLog::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - logger.Log(EQEmuLogSys::Error,"Failed to load AAs!"); + logger.Log(EQEmuLogSys::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1451,7 +1451,7 @@ void Zone::LoadAAs() { if (database.LoadAAEffects2()) LogFile->write(EQEmuLog::Status, "Loaded %d AA Effects.", aa_effects.size()); else - logger.Log(EQEmuLogSys::Error,"Failed to load AA Effects!"); + logger.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - logger.Log(EQEmuLogSys::Error,"Error loading AA Effects, none found in the database."); + logger.Log(EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/attack.cpp b/zone/attack.cpp index 59cc0216b..70ac972eb 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1135,7 +1135,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Client::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } @@ -1699,7 +1699,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to NPC::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -3896,7 +3896,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3927,7 +3927,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } @@ -4476,7 +4476,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } diff --git a/zone/bot.cpp b/zone/bot.cpp index e0cf89601..3b860ab92 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - logger.Log(EQEmuLogSys::Error,"Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + logger.Log(EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadAAs()"); + logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); return; } @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadStance()"); + logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in Bot::SaveStance()"); + logger.Log(EQEmuLogSys::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Bot::LoadTimers()"); + logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - logger.Log(EQEmuLogSys::Error,"Error in Bot::SaveTimers()"); + logger.Log(EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - logger.Log(EQEmuLogSys::Error,"Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + logger.Log(EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - logger.Log(EQEmuLogSys::Error,"Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -6017,7 +6017,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Bot::Attack for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } diff --git a/zone/client.cpp b/zone/client.cpp index 41c2a6134..319b076c9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5301,7 +5301,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5369,7 +5369,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5396,7 +5396,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5404,7 +5404,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6218,7 +6218,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - logger.Log(EQEmuLogSys::Error,"Unknown doppelganger spell id: %d, check pets table", spell_id); + logger.Log(EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6232,7 +6232,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - logger.Log(EQEmuLogSys::Error,"Unknown npc type for doppelganger spell id: %d", spell_id); + logger.Log(EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index a2cd7eefb..f7a73c4cf 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - logger.Log(EQEmuLogSys::Error,"Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + logger.Log(EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 721e7e836..aaffb8687 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - logger.Log(EQEmuLogSys::Error,"HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + logger.Log(EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ApproveZone: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ClientError: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - logger.Log(EQEmuLogSys::Error,"Client error: %s", error->character_name); - logger.Log(EQEmuLogSys::Error,"Error message: %s", error->message); + logger.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); + logger.Log(EQEmuLogSys::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_SetServerFilter"); + logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TGB: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1324,7 +1324,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - logger.Log(EQEmuLogSys::Error,"GetAuth() returned false kicking client"); + logger.Log(EQEmuLogSys::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - logger.Log(EQEmuLogSys::Error,"Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + logger.Log(EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1956,7 +1956,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - logger.Log(EQEmuLogSys::Error,"Handle_OP_AdventureInfoRequest had a packet that was too small."); + logger.Log(EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2011,7 +2011,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2191,7 +2191,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2413,7 +2413,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Handle_OP_AdventureRequest had a packet that was too small."); + logger.Log(EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2939,7 +2939,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized " + logger.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2958,7 +2958,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -3072,7 +3072,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3229,7 +3229,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_AutoAttack expected:4 got:%i", app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3581,7 +3581,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3637,7 +3637,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - logger.Log(EQEmuLogSys::Error,"Malformed BazaarSearch_Struct packet received, ignoring...\n"); + logger.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3722,13 +3722,13 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - logger.Log(EQEmuLogSys::Error,"Size mismatch for Bind wound packet"); + logger.Log(EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - logger.Log(EQEmuLogSys::Error,"Bindwound on non-exsistant mob from %s", this->GetName()); + logger.Log(EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { logger.LogDebug(EQEmuLogSys::General, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); @@ -3839,7 +3839,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - logger.Log(EQEmuLogSys::Error,"Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + logger.Log(EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3860,7 +3860,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - logger.Log(EQEmuLogSys::Error,"Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } @@ -3956,7 +3956,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4235,7 +4235,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4260,7 +4260,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on ClickObject_Struct: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4311,7 +4311,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4324,11 +4324,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - logger.Log(EQEmuLogSys::Error,"Unsupported action %d in OP_ClickObjectAction", oos->open); + logger.Log(EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - logger.Log(EQEmuLogSys::Error,"Invalid object %d in OP_ClickObjectAction", oos->drop_id); + logger.Log(EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4345,8 +4345,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - logger.Log(EQEmuLogSys::Error,"Client error: %s", error->character_name); - logger.Log(EQEmuLogSys::Error,"Error message:%s", error->message); + logger.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); + logger.Log(EQEmuLogSys::Error, "Error message:%s", error->message); return; } @@ -4367,7 +4367,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4873,7 +4873,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4910,7 +4910,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - logger.Log(EQEmuLogSys::Error,"Consuming from empty slot %d", pcs->slot); + logger.Log(EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4922,7 +4922,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - logger.Log(EQEmuLogSys::Error,"OP_Consume: unknown type, type:%i", (int)pcs->type); + logger.Log(EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4943,7 +4943,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5099,7 +5099,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_Damage: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5447,7 +5447,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized " + logger.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5538,7 +5538,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5593,7 +5593,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for OP_FaceChange: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5862,7 +5862,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5914,7 +5914,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5947,7 +5947,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6012,7 +6012,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6062,7 +6062,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6129,7 +6129,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6383,7 +6383,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6400,7 +6400,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6444,7 +6444,7 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6591,7 +6591,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - logger.Log(EQEmuLogSys::Error,"Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + logger.Log(EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6611,7 +6611,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6660,7 +6660,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6738,7 +6738,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6774,7 +6774,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6868,7 +6868,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -7989,7 +7989,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized OP_Illusion: got %d, expected %d", app->size, + logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8019,7 +8019,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8074,7 +8074,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8088,7 +8088,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8125,7 +8125,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - logger.Log(EQEmuLogSys::Error,"Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8225,7 +8225,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8240,7 +8240,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8438,7 +8438,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8891,7 +8891,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9051,7 +9051,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9088,7 +9088,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - logger.Log(EQEmuLogSys::Error,"Client sent LFP on for character %s who is grouped but not leader.", GetName()); + logger.Log(EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9113,7 +9113,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9169,7 +9169,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9717,7 +9717,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - logger.Log(EQEmuLogSys::Error,"Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9733,7 +9733,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9875,7 +9875,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9888,7 +9888,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10351,7 +10351,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10395,7 +10395,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10465,7 +10465,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - logger.Log(EQEmuLogSys::Error,"Size mismatch for Pick Pocket packet"); + logger.Log(EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10739,7 +10739,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11324,7 +11324,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11353,7 +11353,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11369,7 +11369,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11383,7 +11383,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11397,7 +11397,7 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } @@ -11456,7 +11456,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11746,7 +11746,7 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - logger.Log(EQEmuLogSys::Error,"Unexpected OP_Sacrifice reply"); + logger.Log(EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11790,7 +11790,7 @@ void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_SelectTribute packet"); + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - logger.Log(EQEmuLogSys::Error,"Received invalid sized " + logger.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11924,7 +11924,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11938,7 +11938,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"No valid start zones found for /setstartcity"); + logger.Log(EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); return; } @@ -12013,7 +12013,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12110,7 +12110,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12278,7 +12278,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - logger.Log(EQEmuLogSys::Error,"OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + logger.Log(EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12368,7 +12368,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12524,7 +12524,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12817,7 +12817,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12944,7 +12944,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - logger.Log(EQEmuLogSys::Error,"OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + logger.Log(EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13222,7 +13222,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - logger.Log(EQEmuLogSys::Error,"Unable to generate OP_Track packet requested by client."); + logger.Log(EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13236,7 +13236,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13389,7 +13389,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13535,7 +13535,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) _log(TRADING__CLIENT, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - logger.Log(EQEmuLogSys::Error,"Unknown TraderStruct code of: %i\n", ints->Code); + logger.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13545,7 +13545,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } else { _log(TRADING__CLIENT, "Unknown size for OP_Trader: %i\n", app->size); - logger.Log(EQEmuLogSys::Error,"Unknown size for OP_Trader: %i\n", app->size); + logger.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13583,7 +13583,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13619,7 +13619,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - logger.Log(EQEmuLogSys::Error,"Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13690,7 +13690,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - logger.Log(EQEmuLogSys::Error,"Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + logger.Log(EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13829,7 +13829,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TributeToggle packet"); + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13844,7 +13844,7 @@ void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - logger.Log(EQEmuLogSys::Error,"Invalid size on OP_TributeUpdate packet"); + logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); diff --git a/zone/command.cpp b/zone/command.cpp index f5b4419a0..5fc9e2a9f 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -496,7 +496,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - logger.Log(EQEmuLogSys::Error,"command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + logger.Log(EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -575,7 +575,7 @@ int command_realdispatch(Client *c, const char *message) #endif if(cur->function == nullptr) { - logger.Log(EQEmuLogSys::Error,"Command '%s' has a null function\n", cstr.c_str()); + logger.Log(EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command diff --git a/zone/corpse.cpp b/zone/corpse.cpp index f6a193bc9..ec4503476 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -875,7 +875,7 @@ bool Corpse::Process() { logger.LogDebug(EQEmuLogSys::General, "Tagged %s player corpse has burried.", this->GetName()); } else { - logger.Log(EQEmuLogSys::Error,"Unable to bury %s player corpse.", this->GetName()); + logger.Log(EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } diff --git a/zone/effects.cpp b/zone/effects.cpp index bd1fa7a54..861d6bd14 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - logger.Log(EQEmuLogSys::Error,"Unable to find turned in tome id %lu\n", (unsigned long)itemid); + logger.Log(EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 1a51ede27..e44fcf6a0 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - logger.Log(EQEmuLogSys::Error,"boot_quest does not take any arguments."); + logger.Log(EQEmuLogSys::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 33cc53377..784f8b1ba 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - logger.Log(EQEmuLogSys::Error,"boot_qc does not take any arguments."); + logger.Log(EQEmuLogSys::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/entity.cpp b/zone/entity.cpp index c2d19d11a..0712d252b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - logger.Log(EQEmuLogSys::Error,"nullptr group, %s:%i", fname, fline); + logger.Log(EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - logger.Log(EQEmuLogSys::Error,"About to delete a client still in a group."); + logger.Log(EQEmuLogSys::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - logger.Log(EQEmuLogSys::Error,"About to delete a client still in a raid."); + logger.Log(EQEmuLogSys::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - logger.Log(EQEmuLogSys::Error,"Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + logger.Log(EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); diff --git a/zone/forage.cpp b/zone/forage.cpp index 64318ec48..e30dd7b0a 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - logger.Log(EQEmuLogSys::Error,"Possible Forage: %d with a %d chance", item[index], chance[index]); + logger.Log(EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - logger.Log(EQEmuLogSys::Error,"nullptr returned from database.GetItem in ClientForageItem"); + logger.Log(EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index dfd36602b..eca2884e5 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error,"Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index fcc57bc86..392ac8e48 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -413,7 +413,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -433,7 +433,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/horse.cpp b/zone/horse.cpp index 98b9ab91e..f5574f8ea 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error,"No Database entry for mount: %s, check the horses table", fileName); + logger.Log(EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - logger.Log(EQEmuLogSys::Error,"%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + logger.Log(EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index a934a56ae..d1b3d3ba0 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - logger.Log(EQEmuLogSys::Error,"Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.Log(EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - logger.Log(EQEmuLogSys::Error,"Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + logger.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - logger.Log(EQEmuLogSys::Error,"Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + logger.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } diff --git a/zone/merc.cpp b/zone/merc.cpp index a6143c83c..0d9a225f2 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error,"A null Mob object was passed to Merc::Attack() for evaluation!"); + logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in NPC::LoadMercTypes()"); + logger.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in NPC::LoadMercTypes()"); + logger.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/net.cpp b/zone/net.cpp index d451521df..c339e393f 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -625,7 +625,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error,"Error loading spells: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 516d5b3d6..c95f4e417 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - logger.Log(EQEmuLogSys::Error,"Database error, invalid item"); + logger.Log(EQEmuLogSys::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/object.cpp b/zone/object.cpp index 9545caf19..b2632bc2c 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - logger.Log(EQEmuLogSys::Error,"Object::PutItem: Invalid index specified (%i)", index); + logger.Log(EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Unable to insert object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Unable to update object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Unable to delete object: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index f5e1603e8..c5cd26e68 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -66,14 +66,14 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) } else { - logger.Log(EQEmuLogSys::Error,"Path File %s failed to load.", ZonePathFileName); + logger.Log(EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - logger.Log(EQEmuLogSys::Error,"Path File %s not found.", ZonePathFileName); + logger.Log(EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,7 +103,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - logger.Log(EQEmuLogSys::Error,"Bad Magic String in .path file."); + logger.Log(EQEmuLogSys::Error, "Bad Magic String in .path file."); return false; } @@ -114,7 +114,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(Head.version != 2) { - logger.Log(EQEmuLogSys::Error,"Unsupported path file version."); + logger.Log(EQEmuLogSys::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - logger.Log(EQEmuLogSys::Error,"Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + logger.Log(EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index b0932bccb..1ef3c85b0 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,7 +254,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index b75670ad0..5cc236176 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - logger.Log(EQEmuLogSys::Error,"Unable to find data for pet %s, check pets table.", pettype); + logger.Log(EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - logger.Log(EQEmuLogSys::Error,"Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + logger.Log(EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - logger.Log(EQEmuLogSys::Error,"Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - logger.Log(EQEmuLogSys::Error,"Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + logger.Log(EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems equipment set '%d' does not exist", curset); + logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 09fce9c70..cca186924 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in saylink phrase queries", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - logger.Log(EQEmuLogSys::Error,"Error in saylink phrase queries", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 17b000ff4..3f68f2270 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error inserting into raid members: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error,"Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error,"Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index e5f955e95..5a4f9b998 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error,"Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - logger.Log(EQEmuLogSys::Error,"Refusing to load spawn event #%d because it has a period of 0\n", event.id); + logger.Log(EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 2203b1be4..a6dd26cbc 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - logger.Log(EQEmuLogSys::Error,"%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + logger.Log(EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 5b6c88551..3f7d622b8 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - logger.Log(EQEmuLogSys::Error,"HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + logger.Log(EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error,"Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + logger.Log(EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - logger.Log(EQEmuLogSys::Error,"Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + logger.Log(EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 15ae8666e..3433842b2 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading tasks from database", taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - logger.Log(EQEmuLogSys::Error,"[TASKS]Task or Activity ID (%i, %i) out of range while loading " + logger.Log(EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -323,7 +323,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -362,7 +362,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -466,7 +466,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - logger.Log(EQEmuLogSys::Error,"[TASKS] Slot %i out of range while loading character tasks from database", slot); + logger.Log(EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - logger.Log(EQEmuLogSys::Error,"[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading character activities from database", taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,7 +634,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - logger.Log(EQEmuLogSys::Error,"[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + logger.Log(EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - logger.Log(EQEmuLogSys::Error,"[TASKS]Fatal error in character %i task state. Activity %i for " + logger.Log(EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -725,7 +725,7 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -774,7 +774,7 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { _log(TASKS__UPDATE, "Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { @@ -1280,7 +1280,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2938,7 +2938,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -2947,7 +2947,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); @@ -3088,7 +3088,7 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/titles.cpp b/zone/titles.cpp index 389e7f6ca..d90c63f6e 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + logger.Log(EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index c56a070b0..399935dd1 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - logger.Log(EQEmuLogSys::Error,"Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + logger.Log(EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - logger.Log(EQEmuLogSys::Error,"Player tried to augment an item without a container set."); + logger.Log(EQEmuLogSys::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - logger.Log(EQEmuLogSys::Error,"Client or NewCombine_Struct not set in Object::HandleCombine"); + logger.Log(EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - logger.Log(EQEmuLogSys::Error,"Replace container combine executed in a world container."); + logger.Log(EQEmuLogSys::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - logger.Log(EQEmuLogSys::Error,"Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + logger.Log(EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine: no components returned"); + logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - logger.Log(EQEmuLogSys::Error,"Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - logger.Log(EQEmuLogSys::Error,"Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails: no components returned"); + logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - logger.Log(EQEmuLogSys::Error,"Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe search, query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - logger.Log(EQEmuLogSys::Error,"GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + logger.Log(EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, re-query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, re-query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - logger.Log(EQEmuLogSys::Error,"Combine error: Incorrect container is being used!"); + logger.Log(EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - logger.Log(EQEmuLogSys::Error,"Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + logger.Log(EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error,"Error in GetTradeRecept success: no success items returned"); + logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,7 +1477,7 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 4a8450204..fa3c8783f 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1539,7 +1539,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - logger.Log(EQEmuLogSys::Error,"Bazaar: Zero price transaction between %s and %s aborted." + logger.Log(EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); diff --git a/zone/trap.cpp b/zone/trap.cpp index 42995265f..6f8132c3c 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 961be18f9..c9d5877c2 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - logger.Log(EQEmuLogSys::Error,"Details request for invalid tribute %lu", (unsigned long)tribute_id); + logger.Log(EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + logger.Log(EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + logger.Log(EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 82d0893a5..203deacfa 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -116,7 +116,7 @@ void NPC::ResumeWandering() } else { - logger.Log(EQEmuLogSys::Error,"NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - logger.Log(EQEmuLogSys::Error,"NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + logger.Log(EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - logger.Log(EQEmuLogSys::Error,"Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - logger.Log(EQEmuLogSys::Error,"Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/zone.cpp b/zone/zone.cpp index d7c8ff822..50c857309 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -167,7 +167,7 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadMercTemplates()"); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadMercTemplates()"); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::LoadEXPLevelMods()"); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadMercSpells()"); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -737,7 +737,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version) Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - logger.Log(EQEmuLogSys::Error,"... Failed to load doors."); + logger.Log(EQEmuLogSys::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -806,7 +806,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(GraveYardLoaded) logger.LogDebug(EQEmuLogSys::General, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - logger.Log(EQEmuLogSys::Error,"Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + logger.Log(EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -901,38 +901,38 @@ bool Zone::Init(bool iStaticZone) { LogFile->write(EQEmuLog::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - logger.Log(EQEmuLogSys::Error,"Loading spawn conditions failed, continuing without them."); + logger.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } LogFile->write(EQEmuLog::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error,"Loading static zone points failed."); + logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - logger.Log(EQEmuLogSys::Error,"Loading spawn groups failed."); + logger.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error,"Loading spawn2 points failed."); + logger.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - logger.Log(EQEmuLogSys::Error,"Loading player corpses failed."); + logger.Log(EQEmuLogSys::Error, "Loading player corpses failed."); return false; } LogFile->write(EQEmuLog::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error,"Loading traps failed."); + logger.Log(EQEmuLogSys::Error, "Loading traps failed."); return false; } @@ -942,13 +942,13 @@ bool Zone::Init(bool iStaticZone) { LogFile->write(EQEmuLog::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - logger.Log(EQEmuLogSys::Error,"Loading ground spawns failed. continuing."); + logger.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } LogFile->write(EQEmuLog::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - logger.Log(EQEmuLogSys::Error,"Loading World Objects failed. continuing."); + logger.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1024,27 +1024,27 @@ void Zone::ReloadStaticData() { LogFile->write(EQEmuLog::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error,"Loading static zone points failed."); + logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); } LogFile->write(EQEmuLog::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error,"Reloading traps failed."); + logger.Log(EQEmuLogSys::Error, "Reloading traps failed."); } LogFile->write(EQEmuLog::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - logger.Log(EQEmuLogSys::Error,"Reloading ground spawns failed. continuing."); + logger.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); LogFile->write(EQEmuLog::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - logger.Log(EQEmuLogSys::Error,"Reloading World Objects failed. continuing."); + logger.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - logger.Log(EQEmuLogSys::Error,"Error loading the Zone Config."); + logger.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - logger.Log(EQEmuLogSys::Error,"Error loading the Zone Config."); + logger.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - logger.Log(EQEmuLogSys::Error,"... Failed to load blocked spells."); + logger.Log(EQEmuLogSys::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 579213d87..1b3f9cec3 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - logger.Log(EQEmuLogSys::Error,"Programming error: LoadWorldContainer passed nullptr pointer"); + logger.Log(EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Deleting Merc: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - logger.Log(EQEmuLogSys::Error,"Unable to unbury a summoned player corpse for character id %u.", char_id); + logger.Log(EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - logger.Log(EQEmuLogSys::Error,"Unable to construct a player corpse for character id %u.", char_id); + logger.Log(EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index d404cf468..1d50ed51d 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - logger.Log(EQEmuLogSys::Error,"Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - logger.Log(EQEmuLogSys::Error,"Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - logger.Log(EQEmuLogSys::Error,"Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - logger.Log(EQEmuLogSys::Error,"Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + logger.Log(EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - logger.Log(EQEmuLogSys::Error,"Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + logger.Log(EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - logger.Log(EQEmuLogSys::Error,"Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + logger.Log(EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -550,7 +550,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; default: - logger.Log(EQEmuLogSys::Error,"Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + logger.Log(EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error,"MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } From fdbd76e4ad1408fa5882cd446192b1c98f159614 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:54:37 -0600 Subject: [PATCH 0809/1883] Replaced Status log calls --- zone/aa.cpp | 6 ++--- zone/embparser.cpp | 2 +- zone/pathing.cpp | 4 +-- zone/zone.cpp | 66 +++++++++++++++++++++++----------------------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 6ee33ee1c..0e6e0aad0 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1429,7 +1429,7 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - LogFile->write(EQEmuLog::Status, "Loading AA information..."); + logger.Log(EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { logger.Log(EQEmuLogSys::Error, "Failed to load AAs!"); @@ -1447,9 +1447,9 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - LogFile->write(EQEmuLog::Status, "Loading AA Effects..."); + logger.Log(EQEmuLogSys::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - LogFile->write(EQEmuLog::Status, "Loaded %d AA Effects.", aa_effects.size()); + logger.Log(EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else logger.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index c39426953..50df10905 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - LogFile->write(EQEmuLog::Status, "Error re-initializing perlembed: %s", e.what()); + logger.Log(EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index c5cd26e68..0d201bc6b 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,7 +61,7 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - LogFile->write(EQEmuLog::Status, "Path File %s loaded.", ZonePathFileName); + logger.Log(EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); } else @@ -109,7 +109,7 @@ bool PathManager::loadPaths(FILE *PathFile) fread(&Head, sizeof(Head), 1, PathFile); - LogFile->write(EQEmuLog::Status, "Path File Header: Version %ld, PathNodes %ld", + logger.Log(EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) diff --git a/zone/zone.cpp b/zone/zone.cpp index 50c857309..a8a030cf9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - LogFile->write(EQEmuLog::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + logger.Log(EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - LogFile->write(EQEmuLog::Status, "General logging level: %i", zone->loglevelvar); + logger.Log(EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - LogFile->write(EQEmuLog::Status, "Merchant logging level: %i", zone->merchantvar); + logger.Log(EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - LogFile->write(EQEmuLog::Status, "Trade logging level: %i", zone->tradevar); + logger.Log(EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - LogFile->write(EQEmuLog::Status, "Loot logging level: %i", zone->lootvar); + logger.Log(EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -145,7 +145,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { } LogFile->write(EQEmuLog::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - LogFile->write(EQEmuLog::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + logger.Log(EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -171,7 +171,7 @@ bool Zone::LoadZoneObjects() { return false; } - LogFile->write(EQEmuLog::Status, "Loading Objects from DB..."); + logger.Log(EQEmuLogSys::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - LogFile->write(EQEmuLog::Status, "Loading Ground Spawns from DB..."); + logger.Log(EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - LogFile->write(EQEmuLog::Status, "Loading Temporary Merchant Lists..."); + logger.Log(EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - LogFile->write(EQEmuLog::Status, "Loading Merchant Lists..."); + logger.Log(EQEmuLogSys::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -707,7 +707,7 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - LogFile->write(EQEmuLog::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + logger.Log(EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) @@ -725,12 +725,12 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - LogFile->write(EQEmuLog::Status, "Loading doors for %s ...", zone); + logger.Log(EQEmuLogSys::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - LogFile->write(EQEmuLog::Status, "... No doors loaded."); + logger.Log(EQEmuLogSys::Status, "... No doors loaded."); return; } @@ -899,53 +899,53 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - LogFile->write(EQEmuLog::Status, "Loading spawn conditions..."); + logger.Log(EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { logger.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } - LogFile->write(EQEmuLog::Status, "Loading static zone points..."); + logger.Log(EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); return false; } - LogFile->write(EQEmuLog::Status, "Loading spawn groups..."); + logger.Log(EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { logger.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } - LogFile->write(EQEmuLog::Status, "Loading spawn2 points..."); + logger.Log(EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { logger.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } - LogFile->write(EQEmuLog::Status, "Loading player corpses..."); + logger.Log(EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { logger.Log(EQEmuLogSys::Error, "Loading player corpses failed."); return false; } - LogFile->write(EQEmuLog::Status, "Loading traps..."); + logger.Log(EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { logger.Log(EQEmuLogSys::Error, "Loading traps failed."); return false; } - LogFile->write(EQEmuLog::Status, "Loading adventure flavor text..."); + logger.Log(EQEmuLogSys::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - LogFile->write(EQEmuLog::Status, "Loading ground spawns..."); + logger.Log(EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { logger.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } - LogFile->write(EQEmuLog::Status, "Loading World Objects from DB..."); + logger.Log(EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { logger.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - LogFile->write(EQEmuLog::Status, "Loading timezone data..."); + logger.Log(EQEmuLogSys::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - LogFile->write(EQEmuLog::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + logger.Log(EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,29 +1019,29 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - LogFile->write(EQEmuLog::Status, "Reloading Zone Static Data..."); + logger.Log(EQEmuLogSys::Status, "Reloading Zone Static Data..."); - LogFile->write(EQEmuLog::Status, "Reloading static zone points..."); + logger.Log(EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); } - LogFile->write(EQEmuLog::Status, "Reloading traps..."); + logger.Log(EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { logger.Log(EQEmuLogSys::Error, "Reloading traps failed."); } - LogFile->write(EQEmuLog::Status, "Reloading ground spawns..."); + logger.Log(EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { logger.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - LogFile->write(EQEmuLog::Status, "Reloading World Objects from DB..."); + logger.Log(EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { logger.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - LogFile->write(EQEmuLog::Status, "Zone Static Data Reloaded."); + logger.Log(EQEmuLogSys::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - LogFile->write(EQEmuLog::Status, "Successfully loaded Zone Config."); + logger.Log(EQEmuLogSys::Status, "Successfully loaded Zone Config."); return true; } @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - LogFile->write(EQEmuLog::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - LogFile->write(EQEmuLog::Status, ". %f x %f y %f z ", x, y, z); + logger.Log(EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + logger.Log(EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) From a92233240c5760eeacc2d60583ca9bfb9cc95cbf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:55:10 -0600 Subject: [PATCH 0810/1883] Replaced Normal calls --- zone/bot.cpp | 4 ++-- zone/npc.cpp | 2 +- zone/tradeskills.cpp | 2 +- zone/zone.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 3b860ab92..013f08a74 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7336,7 +7336,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } } diff --git a/zone/npc.cpp b/zone/npc.cpp index c95f4e417..9f67afbd5 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - LogFile->write(EQEmuLog::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + logger.Log(EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 399935dd1..b249e2c28 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1482,7 +1482,7 @@ void Client::LearnRecipe(uint32 recipeID) } if (results.RowCount() != 1) { - LogFile->write(EQEmuLog::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + logger.Log(EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } diff --git a/zone/zone.cpp b/zone/zone.cpp index a8a030cf9..9c00d23cb 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -144,7 +144,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - LogFile->write(EQEmuLog::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + logger.Log(EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); logger.Log(EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); @@ -711,7 +711,7 @@ void Zone::Shutdown(bool quite) petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - LogFile->write(EQEmuLog::Normal, "Zone shutdown: going to sleep"); + logger.Log(EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); From 4bf74348a10ca8c451f35c4accb654727d92e3c8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:56:09 -0600 Subject: [PATCH 0811/1883] Replaced Error calls --- zone/client_process.cpp | 2 +- zone/exp.cpp | 2 +- zone/worldserver.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e42c939b5..2b41d8bd2 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - LogFile->write(EQEmuLog::Error,"Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + logger.Log(EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } diff --git a/zone/exp.cpp b/zone/exp.cpp index 7edd70864..8e401eedc 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - LogFile->write(EQEmuLog::Error,"Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + logger.Log(EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d76fec5c0..9839ec3a1 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1384,7 +1384,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - LogFile->write(EQEmuLog::Error,"Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + logger.Log(EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } From 18c837c39825c9fc534e001354b31aac4667d9b4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 15:59:32 -0600 Subject: [PATCH 0812/1883] Replaced various other log calls in zone --- zone/client_packet.cpp | 8 +++----- zone/command.cpp | 36 ++++++++++++++++++------------------ zone/embperl.cpp | 10 +++++----- zone/exp.cpp | 2 +- zone/questmgr.cpp | 24 ++++++++++++------------ 5 files changed, 39 insertions(+), 41 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index aaffb8687..30e3d760b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - LogFile->write(EQEmuLog::Error,"Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + logger.Log(EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -6139,7 +6139,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - LogFile->write(EQEmuLog::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + logger.Log(EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -9153,9 +9153,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - //LogFile->write(EQEMuLog::Debug, "%s sent a logout packet.", GetName()); - //we will save when we get destroyed soon anyhow - //Save(); + logger.LogDebug(EQEmuLogSys:EQEmuLogSys::Detail, "%s sent a logout packet.", GetName()); SendLogoutPackets(); diff --git a/zone/command.cpp b/zone/command.cpp index 5fc9e2a9f..d77279e09 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -451,7 +451,7 @@ int command_init(void) { { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - LogFile->write(EQEmuLog::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + logger.Log(EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -1347,7 +1347,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEmuLog::Normal,"View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + logger.Log(EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1372,7 +1372,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEmuLog::Normal,"Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + logger.Log(EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1398,7 +1398,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEmuLog::Normal,"Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + logger.Log(EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1621,7 +1621,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - LogFile->write(EQEmuLog::Normal,"Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + logger.Log(EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1643,7 +1643,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - LogFile->write(EQEmuLog::Normal,"Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + logger.Log(EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1667,7 +1667,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - LogFile->write(EQEmuLog::Normal,"Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + logger.Log(EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -2009,7 +2009,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - LogFile->write(EQEmuLog::Normal,"Spawning database spawn"); + logger.Log(EQEmuLogSys::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2329,7 +2329,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - LogFile->write(EQEmuLog::Normal,"Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + logger.Log(EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2354,7 +2354,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - LogFile->write(EQEmuLog::Normal,"Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + logger.Log(EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2374,7 +2374,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - LogFile->write(EQEmuLog::Normal,"Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + logger.Log(EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -3169,7 +3169,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - LogFile->write(EQEmuLog::Normal,"Petition list requested by %s", c->GetName()); + logger.Log(EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3826,7 +3826,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - LogFile->write(EQEmuLog::Normal,"#lastname request from %s for %s", c->GetName(), t->GetName()); + logger.Log(EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4924,7 +4924,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - LogFile->write(EQEmuLog::Normal,"Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + logger.Log(EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5276,7 +5276,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - LogFile->write(EQEmuLog::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + logger.Log(EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5333,7 +5333,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - LogFile->write(EQEmuLog::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + logger.Log(EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5380,7 +5380,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - LogFile->write(EQEmuLog::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + logger.Log(EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -8139,7 +8139,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - LogFile->write(EQEmuLog::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + logger.Log(EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { diff --git a/zone/embperl.cpp b/zone/embperl.cpp index e356ff7ac..e1f1612e6 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -139,12 +139,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - LogFile->write(EQEmuLog::Quest, "perl error: %s", err); + logger.Log(EQEmuLogSys::Quest, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - LogFile->write(EQEmuLog::Quest, "Tying perl output to eqemu logs"); + logger.Log(EQEmuLogSys::Quest, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -169,14 +169,14 @@ void Embperl::DoInit() { ,FALSE ); - LogFile->write(EQEmuLog::Quest, "Loading perlemb plugins."); + logger.Log(EQEmuLogSys::Quest, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - LogFile->write(EQEmuLog::Quest, "Warning - plugin.pl: %s", err); + logger.Log(EQEmuLogSys::Quest, "Warning - plugin.pl: %s", err); } try { @@ -194,7 +194,7 @@ void Embperl::DoInit() { } catch(const char *err) { - LogFile->write(EQEmuLog::Quest, "Perl warning: %s", err); + logger.Log(EQEmuLogSys::Quest, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/exp.cpp b/zone/exp.cpp index 8e401eedc..a96b9a9a0 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - LogFile->write(EQEmuLog::Normal,"Setting Level for %s to %i", GetName(), set_level); + logger.Log(EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index cca186924..bdc1ecb6f 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEmuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEmuLog::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEmuLog::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEmuLog::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - LogFile->write(EQEmuLog::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - LogFile->write(EQEmuLog::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - LogFile->write(EQEmuLog::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - LogFile->write(EQEmuLog::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - LogFile->write(EQEmuLog::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - LogFile->write(EQEmuLog::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + logger.Log(EQEmuLogSys::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - LogFile->write(EQEmuLog::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + logger.Log(EQEmuLogSys::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } From 26b550dd0d3cd724447537d03f0673bf2f2aee4c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 16:01:43 -0600 Subject: [PATCH 0813/1883] More log replacements --- zone/client.cpp | 6 +++--- zone/client_packet.cpp | 2 +- zone/command.cpp | 2 +- zone/doors.cpp | 2 +- zone/embperl.cpp | 1 + zone/entity.cpp | 4 ++-- zone/spell_effects.cpp | 4 ++-- zone/spells.cpp | 2 +- zone/zonedb.cpp | 2 +- zone/zoning.cpp | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 319b076c9..cd62b3331 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -651,7 +651,7 @@ bool Client::SendAllPackets() { eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); #if EQDEBUG >= 6 - LogFile->write(EQEmuLog::Normal, "Transmitting a packet"); + logger.Log(EQEmuLogSys::Normal, "Transmitting a packet"); #endif } return true; @@ -1918,7 +1918,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - LogFile->write(EQEmuLog::Normal,"Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + logger.Log(EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2371,7 +2371,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - LogFile->write(EQEmuLog::Normal, "Reset %s's caster specialization skills to 1. " + logger.Log(EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 30e3d760b..c3f8ef6c0 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9153,7 +9153,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - logger.LogDebug(EQEmuLogSys:EQEmuLogSys::Detail, "%s sent a logout packet.", GetName()); + logger.LogDebug(EQEmuLogSys::Detail, "%s sent a logout packet.", GetName()); SendLogoutPackets(); diff --git a/zone/command.cpp b/zone/command.cpp index d77279e09..5d9cfe942 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -570,7 +570,7 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - LogFile->write(EQEmuLog::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + logger.Log(EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif diff --git a/zone/doors.cpp b/zone/doors.cpp index 229bb3e4c..a4d3f80f2 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - LogFile->write(EQEmuLog::Status, "Loading Doors from database..."); + logger.Log(EQEmuLogSys::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/embperl.cpp b/zone/embperl.cpp index e1f1612e6..52fe31826 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -11,6 +11,7 @@ Eglin #ifdef EMBPERL #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include #include diff --git a/zone/entity.cpp b/zone/entity.cpp index 0712d252b..ccc74629c 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - LogFile->write(EQEmuLog::Error, + logger.Log(EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - LogFile->write(EQEmuLog::Error, + logger.Log(EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index a6dd26cbc..b8d67ddaa 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - LogFile->write(EQEmuLog::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index 3f7d622b8..ff456fcbc 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - LogFile->write(EQEmuLog::Normal, + logger.Log(EQEmuLogSys::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 1b3f9cec3..61cbaaada 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - LogFile->write(EQEmuLog::Status, "Loading Blocked Spells from database..."); + logger.Log(EQEmuLogSys::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 1d50ed51d..d6df3a896 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - LogFile->write(EQEmuLog::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + logger.Log(EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it From b7ade8bf1b72286dfc3af56f2aa40c73e51bda9b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 17:27:24 -0600 Subject: [PATCH 0814/1883] EQEmuLog::Dump preprocessor remove --- common/debug.cpp | 4 +--- common/eqemu_logsys.cpp | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 9bbe9d304..1150db9f0 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -372,9 +372,7 @@ bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) { if (!logFileValid) { - #if EQDEBUG >= 10 - std::cerr << "Error: Dump() from null pointer" << std::endl; - #endif + logger.LogDebug(EQEmuLogSys::Detail, "Error: Dump() from null pointer"); return false; } if (size == 0) { diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 3806e49e4..3da479576 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -68,9 +68,9 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { }; static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", - Console::Color::Yellow, // "Normal", + Console::Color::Yellow, // "Normal", Console::Color::LightRed, // "Error", - Console::Color::LightGreen, // "Debug", + Console::Color::LightGreen, // "Debug", Console::Color::LightCyan, // "Quest", Console::Color::LightMagenta, // "Command", Console::Color::LightRed // "Crash" @@ -91,9 +91,7 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...){ - if (RuleI(Logging, DebugLogLevel) < debug_level){ - return; - } + if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } va_list args; va_start(args, message); From 7a9860fdd12114359e97944d9ce46c123b596b98 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 18:12:58 -0600 Subject: [PATCH 0815/1883] Added EQEmuLogSys logger; pointer to the rest of the projects --- client_files/export/main.cpp | 4 ++++ client_files/import/main.cpp | 3 +++ common/eqemu_logsys.cpp | 10 ++++++---- common/eqemu_logsys.h | 3 +-- eqlaunch/eqlaunch.cpp | 3 +++ eqlaunch/worldserver.cpp | 1 + queryserv/queryserv.cpp | 2 ++ shared_memory/main.cpp | 4 ++++ ucs/ucs.cpp | 2 ++ world/net.cpp | 3 ++- zone/pathing.cpp | 4 ++-- 11 files changed, 30 insertions(+), 9 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 8bf6827d4..87874fc61 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -17,6 +17,8 @@ */ #include + +#include "../../common/eqemu_logsys.h" #include "../../common/debug.h" #include "../../common/shareddb.h" #include "../../common/eqemu_config.h" @@ -25,6 +27,8 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" +EQEmuLogSys logger; + void ExportSpells(SharedDatabase *db); void ExportSkillCaps(SharedDatabase *db); void ExportBaseData(SharedDatabase *db); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 7617248d0..390c1c109 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "../../common/eqemu_logsys.h" #include "../../common/debug.h" #include "../../common/shareddb.h" #include "../../common/eqemu_config.h" @@ -24,6 +25,8 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" +EQEmuLogSys logger; + void ImportSpells(SharedDatabase *db); void ImportSkillCaps(SharedDatabase *db); void ImportBaseData(SharedDatabase *db); diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 3da479576..ee3cb98ce 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -90,8 +90,9 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } -void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...){ - if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } +void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) +{ + if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } va_list args; va_start(args, message); @@ -103,7 +104,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...){ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { - if (log_type > EQEmuLogSys::MaxLogID){ + if (log_type > EQEmuLogSys::MaxLogID){ return; } if (!RuleB(Logging, LogFileCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } @@ -152,7 +153,8 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) #endif } -void EQEmuLogSys::CloseZoneLogs(){ +void EQEmuLogSys::CloseZoneLogs() +{ std::cout << "Closing down zone logs..." << std::endl; process_log.close(); } \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index cfeea78ce..fff2af07f 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -34,7 +34,7 @@ public: Error, /* Error Logs */ Debug, /* Debug Logs */ Quest, /* Quest Logs */ - Commands, /* Issued Comamnds */ + Commands, /* Issued Commands */ Crash, /* Crash Logs */ Save, /* Client Saves */ MaxLogID /* Max, used in functions to get the max log ID */ @@ -61,5 +61,4 @@ private: extern EQEmuLogSys logger; - #endif \ No newline at end of file diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index fbac09541..5ddcfefdd 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/proc_launcher.h" #include "../common/eqemu_config.h" #include "../common/servertalk.h" @@ -30,6 +31,8 @@ #include #include +EQEmuLogSys logger; + bool RunLoops = false; void CatchSignal(int sig_num); diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 1754b6564..920bf982e 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -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 */ + #include "../common/debug.h" #include "../common/servertalk.h" #include "../common/eqemu_config.h" diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 22ddb87ee..ce64b646b 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -18,6 +18,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_factory.h" #include "../common/rulesys.h" @@ -39,6 +40,7 @@ LFGuildManager lfguildmanager; std::string WorldShortName; const queryservconfig *Config; WorldServer *worldserver = 0; +EQEmuLogSys logger; void CatchSignal(int sig_num) { RunLoops = false; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index b9ee32929..dbb1885d1 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -17,6 +17,8 @@ */ #include + +#include "../common/eqemu_logsys.h" #include "../common/debug.h" #include "../common/shareddb.h" #include "../common/eqemu_config.h" @@ -31,6 +33,8 @@ #include "spells.h" #include "base_data.h" +EQEmuLogSys logger; + int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); set_exception_handler(); diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index dd5f304b3..ad3af0379 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -17,6 +17,7 @@ */ +#include "../common/eqemu_logsys.h" #include "../common/debug.h" #include "clientlist.h" #include "../common/opcodemgr.h" @@ -50,6 +51,7 @@ std::string WorldShortName; const ucsconfig *Config; WorldServer *worldserver = nullptr; +EQEmuLogSys logger; void CatchSignal(int sig_num) { diff --git a/world/net.cpp b/world/net.cpp index dbc63ee5d..11de88892 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -25,6 +25,7 @@ #include #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/queue.h" #include "../common/timer.h" #include "../common/eq_stream_factory.h" @@ -103,7 +104,7 @@ volatile bool RunLoops = true; uint32 numclients = 0; uint32 numzones = 0; bool holdzones = false; - +EQEmuLogSys logger; extern ConsoleList console_list; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 0d201bc6b..5550c1519 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -206,10 +206,10 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) } std::deque PathManager::FindRoute(int startID, int endID) -{ +{ _log(PATHING__DEBUG, "FindRoute from node %i to %i", startID, endID); - memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); + memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); std::deque OpenList, ClosedList; From fc76e5c8acdd63fff081e091c430aafdaa8065c8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 18:29:27 -0600 Subject: [PATCH 0816/1883] pathing _log to logger.LogDebug --- zone/pathing.cpp | 42 +++++++++++++++++++++--------------------- zone/zoning.cpp | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 5550c1519..a998bf395 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - _log(PATHING__DEBUG, "FindRoute from node %i to %i", startID, endID); + logger.LogDebug(EQEmuLogSys::Detail, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - _log(PATHING__DEBUG, "Unable to find a route."); + logger.LogDebug(EQEmuLogSys::Detail, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + logger.LogDebug(EQEmuLogSys::Detail, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - _log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - _log(PATHING__DEBUG, "No LOS to any starting Path Node within range."); + logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any starting Path Node within range."); return noderoute; } - _log(PATHING__DEBUG, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + logger.LogDebug(EQEmuLogSys::Detail, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - _log(PATHING__DEBUG, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - _log(PATHING__DEBUG, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + logger.LogDebug(EQEmuLogSys::Detail, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - _log(PATHING__DEBUG, "No LOS to any end Path Node within range."); + logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any end Path Node within range."); return noderoute; } - _log(PATHING__DEBUG, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + logger.LogDebug(EQEmuLogSys::Detail, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - _log(PATHING__DEBUG, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - _log(PATHING__DEBUG, "No LOS to any starting Path Node within range."); + logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - _log(PATHING__DEBUG, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - _log(PATHING__DEBUG, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + logger.LogDebug(EQEmuLogSys::Detail, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - _log(PATHING__DEBUG, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - _log(PATHING__DEBUG, " HAZARD DETECTED, really deep water/lava!"); + logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - _log(PATHING__DEBUG, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - _log(PATHING__DEBUG, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + logger.LogDebug(EQEmuLogSys::Detail, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - _log(PATHING__DEBUG, "Hazard point not in water or lava!"); + logger.LogDebug(EQEmuLogSys::Detail, "Hazard point not in water or lava!"); } } else { - _log(PATHING__DEBUG, "No water map loaded for hazards!"); + logger.LogDebug(EQEmuLogSys::Detail, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - _log(PATHING__DEBUG, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + logger.LogDebug(EQEmuLogSys::Detail, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index d6df3a896..7e4a05818 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - _log(NET__DEBUG, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + logger.LogDebug(EQEmuLogSys::Detail, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. From d459c144fefa118bca03a26c5509c916b63cbbb4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 18:38:04 -0600 Subject: [PATCH 0817/1883] replace mlog with logger.LogDebug --- zone/fearpath.cpp | 4 +-- zone/pathing.cpp | 90 +++++++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index f4354e709..e2e3be399 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + logger.LogDebug(EQEmuLogSys::Detail, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - mlog(PATHING__DEBUG, "No path found to selected node. Falling through to old fear point selection."); + logger.LogDebug(EQEmuLogSys::Detail, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index a998bf395..dc0d4cb40 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - mlog(PATHING__DEBUG, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + logger.LogDebug(EQEmuLogSys::Detail, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - mlog(PATHING__DEBUG, "appears to be stuck. Teleporting them to next position.", GetName()); + logger.LogDebug(EQEmuLogSys::Detail, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - mlog(PATHING__DEBUG, " Still pathing to the same destination."); + logger.LogDebug(EQEmuLogSys::Detail, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - mlog(PATHING__DEBUG, " Arrived at node %i", NextNode); + logger.LogDebug(EQEmuLogSys::Detail, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - mlog(PATHING__DEBUG, "Route size is %i", RouteSize); + logger.LogDebug(EQEmuLogSys::Detail, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - mlog(PATHING__DEBUG, " Checking distance to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance); + logger.LogDebug(EQEmuLogSys::Detail, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS"); + logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - mlog(PATHING__DEBUG, " No hazards. Running directly to target."); + logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); Route.clear(); return To; } else { - mlog(PATHING__DEBUG, " Continuing on node path."); + logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - mlog(PATHING__DEBUG, "Missing node after teleport."); + logger.LogDebug(EQEmuLogSys::Detail, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + logger.LogDebug(EQEmuLogSys::Detail, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - mlog(PATHING__DEBUG, " Now moving to node %i", NextNode); + logger.LogDebug(EQEmuLogSys::Detail, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - mlog(PATHING__DEBUG, " Reached end of node path, running direct to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - mlog(PATHING__DEBUG, " Checking distance to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - mlog(PATHING__DEBUG, " Distance between From and To (NoRoot) is %8.3f", Distance); + logger.LogDebug(EQEmuLogSys::Detail, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS"); + logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - mlog(PATHING__DEBUG, " No hazards. Running directly to target."); + logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); Route.clear(); return To; } else { - mlog(PATHING__DEBUG, " Continuing on node path."); + logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - mlog(PATHING__DEBUG, " Target has changed position."); + logger.LogDebug(EQEmuLogSys::Detail, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - mlog(PATHING__DEBUG, " Checking for short LOS at distance %8.3f.", Distance); + logger.LogDebug(EQEmuLogSys::Detail, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS"); + logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - mlog(PATHING__DEBUG, " No hazards. Running directly to target."); + logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); Route.clear(); return To; } else { - mlog(PATHING__DEBUG, " Continuing on node path."); + logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - mlog(PATHING__DEBUG, "Short route update timer not yet expired."); + logger.LogDebug(EQEmuLogSys::Detail, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - mlog(PATHING__DEBUG, "Short route update timer expired."); + logger.LogDebug(EQEmuLogSys::Detail, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - mlog(PATHING__DEBUG, "Long route update timer not yet expired."); + logger.LogDebug(EQEmuLogSys::Detail, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - mlog(PATHING__DEBUG, "Long route update timer expired."); + logger.LogDebug(EQEmuLogSys::Detail, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - mlog(PATHING__DEBUG, " Unable to find path node for new destination. Running straight to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - mlog(PATHING__DEBUG, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + logger.LogDebug(EQEmuLogSys::Detail, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - mlog(PATHING__DEBUG, " Arrived at node %i, moving to next one.\n", Route.front()); + logger.LogDebug(EQEmuLogSys::Detail, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - mlog(PATHING__DEBUG, "Missing node after teleport."); + logger.LogDebug(EQEmuLogSys::Detail, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + logger.LogDebug(EQEmuLogSys::Detail, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - mlog(PATHING__DEBUG, " Now moving to node %i", NextNode); + logger.LogDebug(EQEmuLogSys::Detail, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - mlog(PATHING__DEBUG, " Reached end of path grid. Running direct to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - mlog(PATHING__DEBUG, " Target moved. End node is different. Clearing route."); + logger.LogDebug(EQEmuLogSys::Detail, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - mlog(PATHING__DEBUG, " Our route list is empty."); + logger.LogDebug(EQEmuLogSys::Detail, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - mlog(PATHING__DEBUG, " Destination same as before, LOS check timer not reached. Returning To."); + logger.LogDebug(EQEmuLogSys::Detail, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - mlog(PATHING__DEBUG, " Checking for long LOS at distance %8.3f.", Distance); + logger.LogDebug(EQEmuLogSys::Detail, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - mlog(PATHING__DEBUG, " LOS stats is %s", (PathingLOSState == HaveLOS) ? "HaveLOS" : "NoLOS"); + logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - mlog(PATHING__DEBUG, "Target is reachable. Running directly there."); + logger.LogDebug(EQEmuLogSys::Detail, "Target is reachable. Running directly there."); return To; } } - mlog(PATHING__DEBUG, " Calculating new route to target."); + logger.LogDebug(EQEmuLogSys::Detail, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - mlog(PATHING__DEBUG, " No route available, running direct."); + logger.LogDebug(EQEmuLogSys::Detail, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - mlog(PATHING__DEBUG, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + logger.LogDebug(EQEmuLogSys::Detail, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - mlog(PATHING__DEBUG, " New route determined, heading for node %i", Route.front()); + logger.LogDebug(EQEmuLogSys::Detail, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; From b2a1597e734044f534208b03fe3aa36f1cb34c00 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 18:52:27 -0600 Subject: [PATCH 0818/1883] More _log Client replacements --- zone/client_packet.cpp | 2 +- zone/inventory.cpp | 6 ++---- zone/perl_client.cpp | 16 ++++++++-------- zone/trading.cpp | 14 +++++++------- zone/worldserver.cpp | 2 +- zone/zonedb.cpp | 26 +++++++++++++------------- zone/zoning.cpp | 8 ++++---- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c3f8ef6c0..33f597fff 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - _log(CLIENT__ERROR, "Kicking char from zone, not allowed here"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index d1b3d3ba0..6dfaa28c2 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2848,8 +2848,6 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool if (autolog && error && (!log)) log = true; - if (log) - _log(INVENTORY__ERROR, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); if (!silent) requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); @@ -2868,7 +2866,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool if (log) { _log(INVENTORY__ERROR, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - _log(INVENTORY__ERROR, "Client::InterrogateInventory() -- End"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2883,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - _log(INVENTORY__ERROR, "Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index d3cec99e2..82600923d 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - _log(CLIENT__ERROR, "Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - _log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - _log(CLIENT__ERROR, "Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/trading.cpp b/zone/trading.cpp index fa3c8783f..eb8399ac8 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - _log(TRADING__ERROR, "Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - _log(TRADING__ERROR, "Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(TRADING__CLIENT, "Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1836,7 +1836,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(TRADING__CLIENT, "Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - _log(TRADING__CLIENT, "Error retrieving Trader items details to update price."); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - _log(TRADING__BARTER, "Client::SendBuyerResults %s\n", searchString); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(TRADING__CLIENT, "Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 9839ec3a1..41220437a 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -387,7 +387,7 @@ void WorldServer::Process() { } else { #ifdef _EQDEBUG - _log(ZONE__WORLD, "Error: WhoAllReturnStruct did not point to a valid client! " + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] "id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); #endif diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 61cbaaada..c16739e16 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -619,7 +619,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -630,7 +630,7 @@ void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int3 Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } @@ -650,7 +650,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - _log(TRADING__CLIENT, "Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 7e4a05818..741a2fbd2 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - _log(CLIENT__ERROR, "Unable to query zone info for ourself '%s'", zone->GetShortName()); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - _log(CLIENT__ERROR, "Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - _log(CLIENT__ERROR, "Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - _log(CLIENT__ERROR, "Character does not have the flag to be in this zone (%s)!", flag_needed); + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 7e7c59967cfb3f0a87acf9d6b8dbad4b1b6026c5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 19:05:46 -0600 Subject: [PATCH 0819/1883] _log error convert to logger.Log(EQEmuLogSys::Error --- zone/bot.cpp | 2 +- zone/client.cpp | 6 +++--- zone/client_packet.cpp | 6 +++--- zone/guild_mgr.cpp | 28 ++++++++++++++-------------- zone/inventory.cpp | 10 +++++----- zone/merc.cpp | 2 +- zone/mob_ai.cpp | 2 +- zone/net.cpp | 32 ++++++++++++++++---------------- zone/spawngroup.cpp | 9 +++------ zone/trading.cpp | 12 ++++++------ zone/worldserver.cpp | 4 ++-- 11 files changed, 55 insertions(+), 58 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 013f08a74..bde330f03 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -15456,7 +15456,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - _log(AI__ERROR, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/client.cpp b/zone/client.cpp index cd62b3331..abb7725ba 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8296,11 +8296,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - _log(CHANNELS__ERROR, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + logger.Log(EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - _log(CHANNELS__ERROR, ">> LinkBody: %s", m_LinkBody.c_str()); - _log(CHANNELS__ERROR, ">> LinkText: %s", m_LinkText.c_str()); + logger.Log(EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + logger.Log(EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 33f597fff..c6f8fce39 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6893,7 +6893,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - _log(GUILDS__BANK_ERROR, "Suspected hacking attempt on guild bank from %s", GetName()); + logger.Log(EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7054,7 +7054,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - _log(GUILDS__BANK_ERROR, "Suspected attempted hack on the guild bank from %s", GetName()); + logger.Log(EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7125,7 +7125,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - _log(GUILDS__BANK_ERROR, "Received unexpected guild bank action code %i from %s", Action, GetName()); + logger.Log(EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 5d42846e4..50c37aded 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -261,7 +261,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + logger.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; @@ -295,7 +295,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + logger.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + logger.Log(EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,7 +364,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + logger.Log(EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - _log(GUILDS__BANK_ERROR, "Unable to find guild bank for guild ID %i", c->GuildID()); + logger.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - _log(GUILDS__BANK_ERROR, "Unable to find guild bank for guild ID %i", GuildID); + logger.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - _log(GUILDS__BANK_ERROR, "No space to add item to the guild bank."); + logger.Log(EQEmuLogSys::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(GUILDS__BANK_ERROR, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__BANK_ERROR, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 6dfaa28c2..19fca9f47 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2594,7 +2594,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), + logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), + logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2646,7 +2646,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), + logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2865,7 +2865,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - _log(INVENTORY__ERROR, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + logger.Log(EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - _log(INVENTORY__ERROR, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + logger.Log(EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/merc.cpp b/zone/merc.cpp index 0d9a225f2..f482ab71a 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - _log(AI__ERROR, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 5802bfd93..e359194b5 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - _log(AI__ERROR, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/net.cpp b/zone/net.cpp index c339e393f..a26a7c1fa 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -150,7 +150,7 @@ int main(int argc, char** argv) { _log(ZONE__INIT, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - _log(ZONE__INIT_ERR, "Loading server configuration failed."); + logger.Log(EQEmuLogSys::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); @@ -169,7 +169,7 @@ int main(int argc, char** argv) { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - _log(ZONE__INIT_ERR, "Cannot continue without a database connection."); + logger.Log(EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -192,16 +192,16 @@ int main(int argc, char** argv) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - _log(ZONE__INIT_ERR, "Could not set signal handler"); + logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - _log(ZONE__INIT_ERR, "Could not set signal handler"); + logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - _log(ZONE__INIT_ERR, "Could not set signal handler"); + logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #endif @@ -220,25 +220,25 @@ int main(int argc, char** argv) { database.LoadZoneNames(); _log(ZONE__INIT, "Loading items"); if (!database.LoadItems()) { - _log(ZONE__INIT_ERR, "Loading items FAILED!"); - _log(ZONE__INIT, "Failed. But ignoring error and going on..."); + logger.Log(EQEmuLogSys::Error, "Loading items FAILED!"); + logger.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } _log(ZONE__INIT, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - _log(ZONE__INIT_ERR, "Loading npcs faction lists FAILED!"); + logger.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } _log(ZONE__INIT, "Loading loot tables"); if (!database.LoadLoot()) { - _log(ZONE__INIT_ERR, "Loading loot FAILED!"); + logger.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } _log(ZONE__INIT, "Loading skill caps"); if (!database.LoadSkillCaps()) { - _log(ZONE__INIT_ERR, "Loading skill caps FAILED!"); + logger.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } @@ -249,7 +249,7 @@ int main(int argc, char** argv) { _log(ZONE__INIT, "Loading base data"); if (!database.LoadBaseData()) { - _log(ZONE__INIT_ERR, "Loading base data FAILED!"); + logger.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } @@ -269,7 +269,7 @@ int main(int argc, char** argv) { _log(ZONE__INIT, "Loading commands"); int retval=command_init(); if(retval<0) - _log(ZONE__INIT_ERR, "Command loading FAILED"); + logger.Log(EQEmuLogSys::Error, "Command loading FAILED"); else _log(ZONE__INIT, "%d commands loaded", retval); @@ -279,7 +279,7 @@ int main(int argc, char** argv) { if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { _log(ZONE__INIT, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - _log(ZONE__INIT_ERR, "Failed to load ruleset '%s', falling back to defaults.", tmp); + logger.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { @@ -318,7 +318,7 @@ int main(int argc, char** argv) { LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_pva); #endif if (!worldserver.Connect()) { - _log(ZONE__INIT_ERR, "worldserver.Connect() FAILED!"); + logger.Log(EQEmuLogSys::Error, "worldserver.Connect() FAILED!"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -331,7 +331,7 @@ int main(int argc, char** argv) { if (!strlen(zone_name) || !strcmp(zone_name,".")) { _log(ZONE__INIT, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - _log(ZONE__INIT_ERR, "Zone bootup FAILED!"); + logger.Log(EQEmuLogSys::Error, "Zone bootup FAILED!"); zone = 0; } @@ -368,7 +368,7 @@ int main(int argc, char** argv) { // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - _log(ZONE__INIT_ERR, "Failed to open port %d",Config->ZonePort); + logger.Log(EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index d6745ed6b..bc1e21451 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -149,7 +149,6 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND spawn2.version = %u and zone = '%s'", version, zone_name); auto results = QueryDatabase(query); if (!results.Success()) { - _log(ZONE__SPAWNS, "Error2 in PopulateZoneLists query '%s' ", query.c_str()); return false; } @@ -168,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - _log(ZONE__SPAWNS, "Error2 in PopulateZoneLists query '%'", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -177,7 +176,6 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0])); if (!sg) { - _log(ZONE__SPAWNS, "Error in LoadSpawnGroups %s ", query.c_str()); continue; } @@ -197,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - _log(ZONE__SPAWNS, "Error2 in PopulateZoneLists query %s", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -212,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - _log(ZONE__SPAWNS, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + logger.Log(EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } @@ -220,7 +218,6 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g SpawnEntry* newSpawnEntry = new SpawnEntry( atoi(row[1]), atoi(row[2]), row[3]?atoi(row[3]):0); SpawnGroup *sg = spawn_group_list->GetSpawnGroup(atoi(row[0])); if (!sg) { - _log(ZONE__SPAWNS, "Error in SpawngroupID: %s ", row[0]); continue; } diff --git a/zone/trading.cpp b/zone/trading.cpp index eb8399ac8..41f9047e2 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - _log(TRADING__BARTER, "Unexpected error while moving item from seller to buyer."); + logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 41220437a..f8d4ff63e 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -394,7 +394,7 @@ void WorldServer::Process() { } } else - _log(ZONE__WORLD_ERR, "WhoAllReturnStruct: Could not get return struct!"); + logger.Log(EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -2064,7 +2064,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - _log(ZONE__WORLD_ERR, "Ran out of group IDs before the server sent us more."); + logger.Log(EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { From 167e11426f8fb469d3344492a9703c8ac3427fca Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 19:32:07 -0600 Subject: [PATCH 0820/1883] Log Message reword for zone and world bootup failure --- zone/net.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index a26a7c1fa..2ab8a0e2e 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -318,7 +318,7 @@ int main(int argc, char** argv) { LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_pva); #endif if (!worldserver.Connect()) { - logger.Log(EQEmuLogSys::Error, "worldserver.Connect() FAILED!"); + logger.Log(EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -331,7 +331,7 @@ int main(int argc, char** argv) { if (!strlen(zone_name) || !strcmp(zone_name,".")) { _log(ZONE__INIT, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - logger.Log(EQEmuLogSys::Error, "Zone bootup FAILED!"); + logger.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } From 17d9b9199c55d59ce0ced383ee9531f541df25a6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 19:36:15 -0600 Subject: [PATCH 0821/1883] Replace rest of EQEmuLog->write with EQEmuLogSys Log --- client_files/export/main.cpp | 30 +++++------ client_files/import/main.cpp | 28 +++++------ common/crash.cpp | 45 +++++++++-------- common/database.cpp | 34 ++++++------- common/eq_stream.cpp | 3 +- common/eqtime.cpp | 7 +-- common/guild_base.cpp | 2 +- common/item.cpp | 2 +- common/ptimer.cpp | 14 +++--- common/rulesys.cpp | 8 +-- common/shareddb.cpp | 98 ++++++++++++++++++------------------ common/timeoutmgr.cpp | 6 +-- queryserv/database.cpp | 5 +- shared_memory/main.cpp | 34 ++++++------- ucs/database.cpp | 5 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +-- world/eql_config.cpp | 22 ++++---- world/worlddb.cpp | 18 +++---- 19 files changed, 188 insertions(+), 183 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 87874fc61..d76ae12cd 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -37,22 +37,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientExport); set_exception_handler(); - LogFile->write(EQEmuLog::Status, "Client Files Export Utility"); + logger.Log(EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); + logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEmuLog::Status, "Connecting to database..."); + logger.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " + logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -65,11 +65,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Exporting Spells..."); + logger.Log(EQEmuLogSys::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open export/spells_us.txt to write, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -93,7 +93,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - LogFile->write(EQEmuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -107,7 +107,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -127,7 +127,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -139,11 +139,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Exporting Skill Caps..."); + logger.Log(EQEmuLogSys::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -168,11 +168,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Exporting Base Data..."); + logger.Log(EQEmuLogSys::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open export/BaseData.txt to write, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -194,7 +194,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - LogFile->write(EQEmuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 390c1c109..7e1eb7557 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -35,22 +35,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientImport); set_exception_handler(); - LogFile->write(EQEmuLog::Status, "Client Files Import Utility"); + logger.Log(EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); + logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEmuLog::Status, "Connecting to database..."); + logger.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " + logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -67,7 +67,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -75,10 +75,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Importing Spells..."); + logger.Log(EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open import/spells_us.txt to read, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -141,23 +141,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported); + logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported); + logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Importing Skill Caps..."); + logger.Log(EQEmuLogSys::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -189,11 +189,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - LogFile->write(EQEmuLog::Status, "Importing Base Data..."); + logger.Log(EQEmuLogSys::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - LogFile->write(EQEmuLog::Error, "Unable to open import/BaseData.txt to read, skipping."); + logger.Log(EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index cd7389c09..94a8fb928 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -1,4 +1,5 @@ #include "debug.h" +#include "eqemu_logsys.h" #include "crash.h" #if defined(_WINDOWS) && defined(CRASH_LOGGING) @@ -24,7 +25,7 @@ public: } } - LogFile->write(EQEmuLog::Crash, buffer); + logger.Log(EQEmuLogSys::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -34,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_ACCESS_VIOLATION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_BREAKPOINT"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_OVERFLOW"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_STACK_CHECK"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_UNDERFLOW"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_IN_PAGE_ERROR"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_OVERFLOW"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_INVALID_DISPOSITION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_SINGLE_STEP"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - LogFile->write(EQEmuLog::Crash, "EXCEPTION_STACK_OVERFLOW"); + logger.Log(EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - LogFile->write(EQEmuLog::Crash, "Unknown Exception"); + logger.Log(EQEmuLogSys::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index 39f78cfa6..f852ae37e 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); + logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); + logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - LogFile->write(EQEmuLog::Error, "StoreCharacter: no character id"); + logger.Log(EQEmuLogSys::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - LogFile->write(EQEmuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - LogFile->write(EQEmuLog::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + logger.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //LogFile->write(EQEmuLog::Debug, "Character not in a group: %s", name); + //logger.Log(EQEmuLogSys::Debug, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - LogFile->write(EQEmuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 3e89e2fc3..70e9ab43f 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -17,6 +17,7 @@ */ #include "debug.h" +#include "eqemu_logsys.h" #include "eq_packet.h" #include "eq_stream.h" #include "op_codes.h" @@ -987,7 +988,7 @@ EQRawApplicationPacket *p=nullptr; EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); #if EQDEBUG >= 4 if(emu_op == OP_Unknown) { - LogFile->write(EQEmuLog::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + logger.Log(EQEmuLogSys::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } #endif p->SetOpcode(emu_op); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index bff36bc4c..4ffd66bb3 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -18,6 +18,7 @@ #include #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/eqtime.h" #include "../common/eq_packet_structs.h" #include @@ -140,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - LogFile->write(EQEmuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + logger.Log(EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -164,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - LogFile->write(EQEmuLog::Error, "Could not load EQTime file %s", filename); + logger.Log(EQEmuLogSys::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - LogFile->write(EQEmuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + logger.Log(EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index f1db14af7..e2a411c6c 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -337,7 +337,7 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } diff --git a/common/item.cpp b/common/item.cpp index c06df3a89..9e8be60f7 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - LogFile->write(EQEmuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + logger.Log(EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/ptimer.cpp b/common/ptimer.cpp index bd753d391..2d6e07c63 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - LogFile->write(EQEmuLog::Error, "Null timer during ->Check()!?\n"); + logger.Log(EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - LogFile->write(EQEmuLog::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index ae1b8e5f6..148f2bfc9 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -282,7 +282,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c036fb5de..0a8148c8d 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - LogFile->write(EQEmuLog::Error, + logger.Log(EQEmuLogSys::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - LogFile->write(EQEmuLog::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + logger.Log(EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - LogFile->write(EQEmuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + logger.Log(EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEmuLog::Error, "Error Loading Items: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Database::LoadItems: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - LogFile->write(EQEmuLog::Error, "No book to send, (%s)", txtfile); + logger.Log(EQEmuLogSys::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEmuLog::Error, "Error Loading npc factions: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Error loading skill caps: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - LogFile->write(EQEmuLog::Error, "Error Loading Base Data: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level <= 0, ignoring."); + logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.class > 16, ignoring."); + logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Error loading loot: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Could not get loot table: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "Could not get loot drop: %s", ex.what()); + logger.Log(EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 771ce16af..309d24f1a 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - LogFile->write(EQEmuLog::Debug, "Checking timeout on 0x%x\n", it); + logger.Log(EQEmuLogSys::Debug, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - LogFile->write(EQEmuLog::Debug, "Adding timeoutable 0x%x\n", who); + logger.Log(EQEmuLogSys::Debug, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - LogFile->write(EQEmuLog::Debug, "Removing timeoutable 0x%x\n", who); + logger.Log(EQEmuLogSys::Debug, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 56e09e238..18a852e2b 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -19,6 +19,7 @@ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include #include @@ -68,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); + logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); + logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index dbb1885d1..c7d9f2e42 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -39,22 +39,22 @@ int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); set_exception_handler(); - LogFile->write(EQEmuLog::Status, "Shared Memory Loader Program"); + logger.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - LogFile->write(EQEmuLog::Error, "Unable to load configuration file."); + logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - LogFile->write(EQEmuLog::Status, "Connecting to database..."); + logger.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a " + logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -113,61 +113,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - LogFile->write(EQEmuLog::Status, "Loading items..."); + logger.Log(EQEmuLogSys::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - LogFile->write(EQEmuLog::Status, "Loading factions..."); + logger.Log(EQEmuLogSys::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - LogFile->write(EQEmuLog::Status, "Loading loot..."); + logger.Log(EQEmuLogSys::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - LogFile->write(EQEmuLog::Status, "Loading skill caps..."); + logger.Log(EQEmuLogSys::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - LogFile->write(EQEmuLog::Status, "Loading spells..."); + logger.Log(EQEmuLogSys::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - LogFile->write(EQEmuLog::Status, "Loading base data..."); + logger.Log(EQEmuLogSys::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - LogFile->write(EQEmuLog::Error, "%s", ex.what()); + logger.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/database.cpp b/ucs/database.cpp index 8b224b936..b73a50711 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -19,6 +19,7 @@ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include #include @@ -73,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf); + logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port); + logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/world/adventure.cpp b/world/adventure.cpp index 98ec087b4..453e3f93f 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index db4b768d8..022448516 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 65d4a5f11..5707d43d7 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name); + logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name); + logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 91406b527..5e14dcc59 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEmuLog::Status, "Start zone query: %s\n", query.c_str()); + logger.Log(EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); + logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEmuLog::Status, "SoF Start zone query: %s\n", query.c_str()); + logger.Log(EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); + logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - LogFile->write(EQEmuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - LogFile->write(EQEmuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } From ce0a5cf7b81fabb21cb5aab78302e1bc965fd3ae Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 20:14:27 -0600 Subject: [PATCH 0822/1883] Add LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...) --- common/eqemu_logsys.cpp | 6 +++++- common/eqemu_logsys.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index ee3cb98ce..28da9d627 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -90,6 +90,10 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } +void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...){ + +} + void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) { if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } @@ -116,7 +120,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) auto t = std::time(nullptr); auto tm = *std::localtime(&t); - EQEmuLogSys::ConsoleMessage(log_type, message); + EQEmuLogSys::ConsoleMessage(log_type, output_message); if (process_log){ process_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index fff2af07f..f91a2338b 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -49,6 +49,7 @@ public: void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); void LogDebug(DebugLevel debug_level, std::string message, ...); + void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); void Log(uint16 log_type, const std::string message, ...); void StartZoneLogs(const std::string log_name); From b1fbcc51e074c74675a6e41dc29341e9896faa0a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 20:52:51 -0600 Subject: [PATCH 0823/1883] linux compile fix --- common/eqemu_logsys.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 28da9d627..fd380e1e2 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -25,11 +25,12 @@ #include #include #include -#include + std::ofstream process_log; #ifdef _WINDOWS +#include #include #include #include @@ -90,8 +91,16 @@ void EQEmuLogSys::StartZoneLogs(const std::string log_name) process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } -void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...){ +void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...) +{ + if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } + va_list args; + va_start(args, message); + std::string output_message = vStringFormat(message.c_str(), args); + va_end(args); + + EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) @@ -103,7 +112,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); + EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) From 2159a56b17800b80cfad440bc13d58efb0f2d8eb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 23:25:50 -0600 Subject: [PATCH 0824/1883] Add log test command #logtest --- zone/command.cpp | 14 +++++++++++++- zone/command.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 5d9cfe942..0171aaa7c 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef _WINDOWS #define strcasecmp _stricmp @@ -428,7 +429,8 @@ int command_init(void) { command_add("open_shop", nullptr, 100, command_merchantopenshop) || command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) || - command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) + command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || + command_add("logtest", "Performs log performance testing.", 250, command_logtest) ) { command_deinit(); @@ -10665,3 +10667,13 @@ void command_shownumhits(Client *c, const Seperator *sep) c->ShowNumHits(); return; } + +void command_logtest(Client *c, const Seperator *sep){ + clock_t t = std::clock(); /* Function timer start */ + if (sep->IsNumber(1)){ + uint32 i = 0; + for (i = 0; i < atoi(sep->arg[1]); i++){ + logger.LogDebug(EQEmuLogSys::General, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + } + } +} \ No newline at end of file diff --git a/zone/command.h b/zone/command.h index 68e956166..088c83510 100644 --- a/zone/command.h +++ b/zone/command.h @@ -326,6 +326,7 @@ void command_npctype_cache(Client *c, const Seperator *sep); void command_merchantopenshop(Client *c, const Seperator *sep); void command_merchantcloseshop(Client *c, const Seperator *sep); void command_shownumhits(Client *c, const Seperator *sep); +void command_logtest(Client *c, const Seperator *sep); #ifdef EQPROFILE void command_profiledump(Client *c, const Seperator *sep); From 108d3110b64fd921e868820c6ebb52c44f1b90ed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 10 Jan 2015 23:26:10 -0600 Subject: [PATCH 0825/1883] RULE_BOOL(Logging, EnableConsoleLogging, true) /* Turns on or off ALL logging to console */ RULE_BOOL(Logging, EnableFileLogging, true) /* Turns on or off ALL forms of file logging */ --- common/eqemu_logsys.cpp | 60 ++++++++++++++++++++++++++++++++++------- common/eqemu_logsys.h | 6 +++-- common/ruletypes.h | 5 ++++ 3 files changed, 60 insertions(+), 11 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index fd380e1e2..eab7ee2d9 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -25,7 +25,7 @@ #include #include #include - +#include std::ofstream process_log; @@ -35,6 +35,8 @@ std::ofstream process_log; #include #include #include +#else +#include #endif namespace Console { @@ -65,7 +67,18 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Debug", "Quest", "Command", - "Crash" + "Crash", + "Save", + "UCS", + "Query Server", + "Socket Server", + "Spawns", + "AI", + "Pathing", + "Quests", + "Spells", + "Zone", + }; static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", @@ -86,7 +99,7 @@ EQEmuLogSys::~EQEmuLogSys(){ void EQEmuLogSys::StartZoneLogs(const std::string log_name) { - _mkdir("logs/zone"); + EQEmuLogSys::MakeDirectory("logs/zone"); std::cout << "Starting Zone Logs..." << std::endl; process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } @@ -115,6 +128,22 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } +void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ + time_t raw_time; + struct tm * time_info; + time(&raw_time); + time_info = localtime(&raw_time); + strftime(time_stamp, 80, "[%d-%m-%Y :: %H:%M:%S]", time_info); +} + +void EQEmuLogSys::MakeDirectory(std::string directory_name){ +#ifdef _WINDOWS + _mkdir(directory_name.c_str()); +#else + mkdir(directory_name.c_str()); +#endif +} + void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { if (log_type > EQEmuLogSys::MaxLogID){ @@ -122,20 +151,25 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) } if (!RuleB(Logging, LogFileCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } + if (!RuleB(Logging, EnableFileLogging)){ + return; + } + va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - auto t = std::time(nullptr); - auto tm = *std::localtime(&t); EQEmuLogSys::ConsoleMessage(log_type, output_message); + char time_stamp[80]; + EQEmuLogSys::SetCurrentTimeStamp(time_stamp); + if (process_log){ - process_log << std::put_time(&tm, "[%d-%m-%Y :: %H:%M:%S] ") << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; + process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; } else{ - std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << std::endl; + std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; } } @@ -144,6 +178,9 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) if (log_type > EQEmuLogSys::MaxLogID){ return; } + if (!RuleB(Logging, EnableConsoleLogging)){ + return; + } if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } #ifdef _WINDOWS @@ -155,10 +192,15 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - SetConsoleTextAttribute(console_handle, LogColors[log_type]); + if (LogColors[log_type]){ + SetConsoleTextAttribute(console_handle, LogColors[log_type]); + } + else{ + SetConsoleTextAttribute(console_handle, Console::Color::White); + } #endif - std::cout << "[N::" << TypeNames[log_type] << "] " << message << std::endl; + std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index f91a2338b..88fd1362f 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -45,12 +45,14 @@ public: Moderate, /* 1 - Informational based, used in functions, when particular things load */ Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; - + void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); + void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); - void Log(uint16 log_type, const std::string message, ...); + void MakeDirectory(std::string directory_name); + void SetCurrentTimeStamp(char* time_stamp); void StartZoneLogs(const std::string log_name); diff --git a/common/ruletypes.h b/common/ruletypes.h index 1d9286a69..c16590783 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -599,7 +599,12 @@ RULE_CATEGORY_END() RULE_CATEGORY(Logging) RULE_BOOL(Logging, ConsoleLogCommands, false) /* Turns on or off console logs */ RULE_BOOL(Logging, LogFileCommands, false) + RULE_INT(Logging, DebugLogLevel, 0) /* Sets Debug Level, -1 = OFF, 0 = Low Level, 1 = Info, 2 = Extreme */ + +RULE_BOOL(Logging, EnableConsoleLogging, true) /* Turns on or off ALL logging to console */ +RULE_BOOL(Logging, EnableFileLogging, true) /* Turns on or off ALL forms of file logging */ + RULE_CATEGORY_END() From d57d463818b8f9939abc2afcc53e1a5e4f811d59 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 11 Jan 2015 00:45:37 -0500 Subject: [PATCH 0826/1883] New Command #tune Used to return ideal values for tuning NPC/Client combat statistics. --- zone/CMakeLists.txt | 1 + zone/client.h | 4 + zone/command.cpp | 212 ++++++++- zone/command.h | 1 + zone/mob.h | 10 + zone/tune.cpp | 1089 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1316 insertions(+), 1 deletion(-) create mode 100644 zone/tune.cpp diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 8cd086405..69e006ec8 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -110,6 +110,7 @@ SET(zone_sources trading.cpp trap.cpp tribute.cpp + tune.cpp water_map.cpp water_map_v1.cpp water_map_v2.cpp diff --git a/zone/client.h b/zone/client.h index d6ef83523..c21fc857a 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1243,6 +1243,10 @@ public: bool InterrogateInventory(Client* requester, bool log, bool silent, bool allowtrip, bool& error, bool autolog = true); + //Command #Tune functions + virtual int32 Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating); + int32 GetMeleeDamage(Mob* other, bool GetMinDamage = false); + protected: friend class Mob; void CalcItemBonuses(StatBonuses* newbon); diff --git a/zone/command.cpp b/zone/command.cpp index b33a3ee6d..24dd2cec5 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -427,7 +427,8 @@ int command_init(void) { command_add("open_shop", nullptr, 100, command_merchantopenshop) || command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) || - command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) + command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || + command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) ) { command_deinit(); @@ -10666,3 +10667,212 @@ void command_shownumhits(Client *c, const Seperator *sep) c->ShowNumHits(); return; } + +void command_tune(Client *c, const Seperator *sep) +{ + //Work in progress - Kayen + + if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { + c->Message(0, "Syntax: #tune [subcommand]."); + c->Message(0, "-- Tune System Commands --"); + c->Message(0, "-- Usage: Returning recommended combat statistical values based on a desired outcome."); + c->Message(0, "-- Note: If targeted mob does not have a target (ie not engaged in combat), YOU will be considered the target."); + c->Message(0, "-- Warning: The calculations done in this process are intense and can potentially cause zone crashes depending on parameters set, use with caution!"); + c->Message(0, "-- Below are OPTIONAL parameters."); + c->Message(0, "-- Note: [interval] Determines how fast the stat being checked increases/decreases till it finds the best result. Default [ATK/AC 50][Acc/Avoid 10] "); + c->Message(0, "-- Note: [loop_max] Determines how many iterations are done to increases/decreases the stat till it finds the best result. Default [ATK/AC 100][Acc/Avoid 1000]"); + c->Message(0, "-- Note: [Stat Override] Will override that stat on mob being checkd with the specified value. Default=0"); + c->Message(0, "-- Note: [Info Level] How much statistical detail is displayed[0 - 3]. Default=0 "); + c->Message(0, "-- Note: Results are only approximations usually accurate to +/- 2 intervals."); + + c->Message(0, "... "); + c->Message(0, "...### Category A ### Target = ATTACKER ### YOU or Target's Target = DEFENDER ###"); + c->Message(0, "...### Category B ### Target = DEFENDER ### YOU or Target's Target = ATTACKER ###"); + c->Message(0, "... "); + c->Message(0, "...#Returns recommended ATK adjustment +/- on ATTACKER that will result in an average mitigation pct on DEFENDER. "); + c->Message(0, "...tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level]"); + c->Message(0, "... "); + c->Message(0, "...#Returns recommended AC adjustment +/- on DEFENDER for an average mitigation pct from ATTACKER. "); + c->Message(0, "...tune FindAC [A/B] [pct mitigation] [interval][loop_max][ATK Overwride][Info Level] "); + c->Message(0, "... "); + c->Message(0, "...#Returns recommended Accuracy adjustment +/- on ATTACKER that will result in a hit chance pct on DEFENDER. "); + c->Message(0, "...tune FindAccuracy [A/B] [hit chance] [interval][loop_max][Avoidance Overwride][Info Level]"); + c->Message(0, "... "); + c->Message(0, "...#Returns recommended Avoidance adjustment +/- on DEFENDER for in a hit chance pct from ATTACKER. "); + c->Message(0, "...tune FindAvoidance [A/B] [pct mitigation] [interval][loop_max][Accuracy Overwride][Info Level] "); + + return; + } + //Default is category A for attacker/defender settings, which then are swapped under category B. + Mob* defender = c; + Mob* attacker = c->GetTarget(); + + if (!attacker) + { + c->Message(0, "#Tune - Error no target selected. [#Tune help]"); + return; + } + + Mob* ttarget = attacker->GetTarget(); + + if (ttarget) + defender = ttarget; + + if(!strcasecmp(sep->arg[1], "FindATK")) + { + float pct_mitigation = atof(sep->arg[3]); + int interval = atoi(sep->arg[4]); + int max_loop = atoi(sep->arg[5]); + int ac_override = atoi(sep->arg[6]); + int info_level = atoi(sep->arg[7]); + + if (!pct_mitigation) + { + c->Message(13, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); + return; + } + + if (!interval) + interval = 50; + if (!max_loop) + max_loop = 100; + if(!ac_override) + ac_override = 0; + if (!info_level) + info_level = 1; + + if(!strcasecmp(sep->arg[2], "A")) + c->Tune_FindATKByPctMitigation(c, attacker, pct_mitigation, interval, max_loop,ac_override,info_level); + else if(!strcasecmp(sep->arg[2], "B")) + c->Tune_FindATKByPctMitigation(attacker,c, pct_mitigation, interval, max_loop,ac_override,info_level); + else { + c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); + c->Message(0, "Usage #tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level] "); + c->Message(0, "Example #tune FindATK A 60"); + } + return; + } + + if(!strcasecmp(sep->arg[1], "FindAC")) + { + float pct_mitigation = atof(sep->arg[3]); + int interval = atoi(sep->arg[4]); + int max_loop = atoi(sep->arg[5]); + int atk_override = atoi(sep->arg[6]); + int info_level = atoi(sep->arg[7]); + + if (!pct_mitigation) + { + c->Message(13, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); + return; + } + + if (!interval) + interval = 50; + if (!max_loop) + max_loop = 100; + if(!atk_override) + atk_override = 0; + if (!info_level) + info_level = 1; + + if(!strcasecmp(sep->arg[2], "A")) + c->Tune_FindACByPctMitigation(c, attacker, pct_mitigation, interval, max_loop,atk_override,info_level); + else if(!strcasecmp(sep->arg[2], "B")) + c->Tune_FindACByPctMitigation(attacker, c, pct_mitigation, interval, max_loop,atk_override,info_level); + else { + c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); + c->Message(0, "Usage #tune FindAC [A/B] [pct mitigation] [interval][loop_max][ATK Overwride][Info Level] "); + c->Message(0, "Example #tune FindAC A 60"); + } + + return; + } + + if(!strcasecmp(sep->arg[1], "FindAccuracy")) + { + float hit_chance = atof(sep->arg[3]); + int interval = atoi(sep->arg[4]); + int max_loop = atoi(sep->arg[5]); + int avoid_override = atoi(sep->arg[6]); + int info_level = atoi(sep->arg[7]); + + if (!hit_chance) + { + c->Message(10, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); + return; + } + + if (!interval) + interval = 10; + if (!max_loop) + max_loop = 1000; + if(!avoid_override) + avoid_override = 0; + if (!info_level) + info_level = 1; + + if (hit_chance > RuleR(Combat,MaxChancetoHit) || hit_chance < RuleR(Combat,MinChancetoHit)) + { + c->Message(10, "#Tune - Error hit chance out of bounds. [Max %.2f Min .2f]", RuleR(Combat,MaxChancetoHit),RuleR(Combat,MinChancetoHit)); + return; + } + + if(!strcasecmp(sep->arg[2], "A")) + c->Tune_FindAccuaryByHitChance(c, attacker, hit_chance, interval, max_loop,avoid_override,info_level); + else if(!strcasecmp(sep->arg[2], "B")) + c->Tune_FindAccuaryByHitChance(attacker, c, hit_chance, interval, max_loop,avoid_override,info_level); + else { + c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); + c->Message(0, "Usage #tune FindAcccuracy [A/B] [hit chance] [interval][loop_max][Avoidance Overwride][Info Level]"); + c->Message(0, "Exampled #tune FindAccuracy B 30"); + } + + return; + } + + if(!strcasecmp(sep->arg[1], "FindAvoidance")) + { + float hit_chance = atof(sep->arg[3]); + int interval = atoi(sep->arg[4]); + int max_loop = atoi(sep->arg[5]); + int acc_override = atoi(sep->arg[6]); + int info_level = atoi(sep->arg[7]); + + if (!hit_chance) + { + c->Message(0, "#Tune - Error must enter the desired hit chance on defender. Ie. Defender to have hit chance of 40 pct."); + return; + } + + if (!interval) + interval = 10; + if (!max_loop) + max_loop = 1000; + if(!acc_override) + acc_override = 0; + if (!info_level) + info_level = 1; + + if (hit_chance > RuleR(Combat,MaxChancetoHit) || hit_chance < RuleR(Combat,MinChancetoHit)) + { + c->Message(10, "#Tune - Error hit chance out of bounds. [Max %.2f Min .2f]", RuleR(Combat,MaxChancetoHit),RuleR(Combat,MinChancetoHit)); + return; + } + + if(!strcasecmp(sep->arg[2], "A")) + c->Tune_FindAvoidanceByHitChance(c, attacker, hit_chance, interval, max_loop,acc_override, info_level); + else if(!strcasecmp(sep->arg[2], "B")) + c->Tune_FindAvoidanceByHitChance(attacker, c, hit_chance, interval, max_loop,acc_override, info_level); + else { + c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); + c->Message(0, "Usage #tune FindAvoidance [A/B] [hit chance] [interval][loop_max][Accuracy Overwride][Info Level]"); + c->Message(0, "Exampled #tune FindAvoidance B 30"); + } + + return; + } + + + return; +} diff --git a/zone/command.h b/zone/command.h index 68e956166..f8018f295 100644 --- a/zone/command.h +++ b/zone/command.h @@ -326,6 +326,7 @@ void command_npctype_cache(Client *c, const Seperator *sep); void command_merchantopenshop(Client *c, const Seperator *sep); void command_merchantcloseshop(Client *c, const Seperator *sep); void command_shownumhits(Client *c, const Seperator *sep); +void command_tune(Client *c, const Seperator *sep); #ifdef EQPROFILE void command_profiledump(Client *c, const Seperator *sep); diff --git a/zone/mob.h b/zone/mob.h index 47d2cca2f..908865d72 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -930,6 +930,16 @@ public: void mod_spell_cast(uint16 spell_id, Mob* spelltar, bool reflect, bool use_resist_adjust, int16 resist_adjust, bool isproc); bool mod_will_aggro(Mob *attacker, Mob *on); + //Command #Tune functions + int32 Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts = nullptr, int Msg =0, int ac_override=0, int atk_override=0, int add_ac=0, int add_atk = 0); + virtual int32 Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating); + uint32 Tune_GetMeanDamage(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts = nullptr, int Msg = 0,int ac_override=0, int atk_override=0, int add_ac=0, int add_atk = 0); + void Tune_FindATKByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int ac_override=0,int Msg =0); + void Tune_FindACByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int atk_override=0,int Msg =0); + float Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod, int Msg = 1,int acc_override=0, int avoid_override=0, int add_acc=0, int add_avoid = 0); + void Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int avoid_override, int Msg = 0); + void Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int acc_override, int Msg = 0); + protected: void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillUseTypes attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic); static uint16 GetProcID(uint16 spell_id, uint8 effect_index); diff --git a/zone/tune.cpp b/zone/tune.cpp new file mode 100644 index 000000000..2f071e458 --- /dev/null +++ b/zone/tune.cpp @@ -0,0 +1,1089 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 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 +*/ + +#if EQDEBUG >= 5 +//#define TUNE_DEBUG 20 +#endif + +#include "../common/debug.h" +#include "../common/eq_constants.h" +#include "../common/eq_packet_structs.h" +#include "../common/rulesys.h" +#include "../common/skills.h" +#include "../common/spdat.h" +#include "../common/string_util.h" +#include "queryserv.h" +#include "quest_parser_collection.h" +#include "string_ids.h" +#include "water_map.h" +#include "worldserver.h" +#include "zone.h" + +#include +#include +#include + +#ifdef BOTS +#include "bot.h" +#endif + +extern QueryServ* QServ; +extern WorldServer worldserver; + +#ifdef _WINDOWS +#define snprintf _snprintf +#define strncasecmp _strnicmp +#define strcasecmp _stricmp +#endif + +extern EntityList entity_list; +extern Zone* zone; + +void Mob::Tune_FindATKByPctMitigation(Mob* defender,Mob *attacker, float pct_mitigation, int interval, int max_loop, int ac_override, int Msg) +{ + /*Find the amount of 'ATTACK' stat that has to be added/subtracted FROM ATTACKER to reach a specific average mitigation value on the TARGET. + Can use ac_override to find the value verse a hypothetical amount of worn AC */ + + int atk = 0; + uint32 total_damage = 0; + int32 damage = 0; + uint32 minhit = 0; + int mean_dmg = 0; + float tmp_pct_mitigated = 0.0f; + int end = 0; + + if (attacker->IsNPC()) + { + damage = static_cast(attacker->CastToNPC()->GetMaxDMG()); + minhit = attacker->CastToNPC()->GetMinDMG(); + } + else if (attacker->IsClient()) + { + damage = static_cast(attacker->CastToClient()->GetMeleeDamage(this)); + minhit = attacker->CastToClient()->GetMeleeDamage(this, true); + } + + if (damage == 0 || minhit == 0) + { + Message(0, "#Tune - Processing... Abort! Damage not found! [MaxDMG %i MinDMG %i]", damage,minhit); + return; + } + + mean_dmg = defender->Tune_GetMeanDamage(this, attacker, damage, minhit, nullptr, 0, ac_override, 0, 0,atk); + tmp_pct_mitigated = 100.0f - static_cast( mean_dmg * 100 /damage); + + Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); + Message(0, "#Tune - Processing... Find ATK for attacker Mitigation (%.0f) pct on defender [MaxDMG %i MinDMG %i Current Mitigation %.2f]", pct_mitigation, damage, minhit,tmp_pct_mitigated); + + if (tmp_pct_mitigated < pct_mitigation) + interval = interval * -1; + + for (int j=0; j < max_loop; j++) + { + mean_dmg = defender->Tune_GetMeanDamage(this, attacker, damage, minhit, nullptr, 0, ac_override,0, 0,atk); + tmp_pct_mitigated = 100.0f - ( static_cast(mean_dmg) * 100.0f /static_cast(damage)); + + if (Msg >= 3) + Message(0, "#Tune - Processing... [%i] [ATK %i] Average Melee Hit %i | Pct Mitigated %.2f ",j,atk, mean_dmg, tmp_pct_mitigated); + + if (interval > 0 && tmp_pct_mitigated <= pct_mitigation) + end = 1; + + else if (interval < 0 && tmp_pct_mitigated >= pct_mitigation) + end = 1; + + else if (interval < 0 && mean_dmg == minhit) + end = 2; + + if (end >= 1){ + + defender->Tune_MeleeMitigation(this, attacker, damage, minhit, nullptr,Msg,ac_override, 0, 0, atk); + + if (end == 2) + Message(0, "#Tune - [WARNING] Mitigation can not be further decreased due to minium hit value (%i).",minhit); + + if (attacker->IsNPC()){ + Message(0, "#Tune - Recommended NPC ATK ADJUSTMENT ( %i ) on ' %s ' average mitigation of (%.0f) pct verse ' %s '. ",atk, attacker->GetCleanName(), pct_mitigation, defender->GetCleanName()); + Message(0, "#SET: [NPC Attack STAT] = [%i]",atk + defender->CastToNPC()->ATK); + } + if (attacker->IsClient()){ + Message(0, "#Tune - Recommended CLIENT ATK ADJUSTMENT ( %i ) on ' %s ' average mitigation of (%.0f) pct verse ' %s '. ", atk, attacker->GetCleanName(), pct_mitigation, defender->GetCleanName()); + Message(0, "#Modify (+/-): [Client Attack STAT/SE_ATK(2)] [%i]",atk); + } + + return; + } + + atk = atk + interval; + } + + Message(0, "#Tune - Error: Unable to find desired result for (%.0f) pct - Increase interval (%i) AND/OR max loop value (%i) and run again.", pct_mitigation, interval, max_loop); + Message(0, "#Tune - Parse ended at ATK ADJUSTMENT ( %i ) average target mitigation of (%.0f) pct.",atk,tmp_pct_mitigated); +} + +void Mob::Tune_FindACByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval, int max_loop, int atk_override, int Msg) +{ + + /*Find the amount of AC stat that has to be added/subtracted from TARGET to reach a specific average mitigation value based on ATTACKER's statistics. + Can use ac_override to find the value verse a hypothetical amount of worn AC */ + + int add_ac = 0; + uint32 total_damage = 0; + int32 damage = 0; + uint32 minhit = 0; + int mean_dmg = 0; + float tmp_pct_mitigated = 0.0f; + int end = 0; + + + if (attacker->IsNPC()) + { + damage = static_cast(attacker->CastToNPC()->GetMaxDMG()); + minhit = attacker->CastToNPC()->GetMinDMG(); + } + else if (attacker->IsClient()) + { + damage = static_cast(attacker->CastToClient()->GetMeleeDamage(this)); + minhit = attacker->CastToClient()->GetMeleeDamage(this, true); + } + + if (damage == 0 || minhit == 0) + { + Message(0, "#Tune - Processing... Abort! Damage not found! [MaxDMG %i MinDMG %i]", damage,minhit); + return; + } + + mean_dmg = defender->Tune_GetMeanDamage(this, attacker, damage, minhit, nullptr, 0, 0, atk_override); + tmp_pct_mitigated = 100.0f - static_cast( mean_dmg * 100 /damage); + + Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); + Message(0, "#Tune - Processing... Find AC for defender Mitigation (%.0f) pct from attacker [MaxDMG %i MinDMG %i Current Mitigation %.2f]", pct_mitigation, damage, minhit,tmp_pct_mitigated); + + + if (tmp_pct_mitigated > pct_mitigation) + interval = interval * -1; + + for (int j=0; j < max_loop; j++) + { + mean_dmg = defender->Tune_GetMeanDamage(this, attacker, damage, minhit, nullptr, 0, 0,atk_override, add_ac, 0); + tmp_pct_mitigated = 100.0f - ( static_cast(mean_dmg) * 100.0f /static_cast(damage)); + + if (Msg >= 3) + Message(0, "#Tune - Processing... [%i] [AC %i] Average Melee Hit %i | Pct Mitigated %.2f ",j,add_ac, mean_dmg, tmp_pct_mitigated); + + if (interval > 0 && tmp_pct_mitigated >= pct_mitigation) + end = 1; + + else if (interval < 0 && tmp_pct_mitigated <= pct_mitigation) + end = 1; + + else if (interval < 0 && mean_dmg == minhit) + end = 2; + + if (end >= 1){ + + defender->Tune_MeleeMitigation(this, attacker, damage, minhit, nullptr,Msg,0,atk_override, add_ac, 0); + + if (end == 2) + Message(0, "#Tune - [WARNING] Mitigation can not be further decreased due to minium hit value (%i).",minhit); + + if (defender->IsNPC()){ + Message(7, "#Tune - Recommended NPC AC ADJUSTMENT ( %i ) on ' %s ' for an average mitigation of (+ %.0f) pct from attacker ' %s '.",add_ac,defender->GetCleanName(), pct_mitigation, attacker->GetCleanName()); + Message(0, "#SET: [NPC Attack STAT] = [%i]",add_ac + defender->CastToNPC()->GetRawAC()); + } + if (defender->IsClient()){ + Message(7, "#Tune - Recommended CLIENT AC ADJUSTMENT ( %i ) on ' %s ' for an average mitigation of (+ %.0f) pct from attacker ' %s '.",add_ac,defender->GetCleanName(), pct_mitigation, attacker->GetCleanName()); + Message(0, "#Modify (+/-): [Client AC STAT/SE_AC(1)] [%i]",add_ac); + } + + return; + } + + + + add_ac = add_ac + interval; + } + + Message(0, "#Tune - Error: Unable to find desired result for (%.0f) pct - Increase interval (%i) AND/OR max loop value (%i) and run again.", pct_mitigation, interval, max_loop); + Message(0, "#Tune - Parse ended at AC ADJUSTMENT ( %i ) at average mitigation of (%.0f) / (%.0f) pct.",add_ac,tmp_pct_mitigated / pct_mitigation); +} + +uint32 Mob::Tune_GetMeanDamage(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts, int Msg, + int ac_override, int atk_override, int add_ac, int add_atk) +{ + uint32 total_damage = 0; + int loop_max = 1000; + + for (int i=0; i < loop_max ; i++) + { + total_damage += Tune_MeleeMitigation(GM, attacker, damage, minhit, nullptr,0,ac_override, atk_override, add_ac, add_atk); + } + + return(total_damage/loop_max); +} + +int32 Mob::Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts, int Msg, + int ac_override, int atk_override, int add_ac, int add_atk) +{ + if (damage <= 0) + return 0; + + Mob* defender = this; + float aa_mit = (aabonuses.CombatStability + itembonuses.CombatStability + + spellbonuses.CombatStability) / 100.0f; + + if (Msg){ + + GM->Message(0, "######### Melee Mitigation Report: Start [Detail Level %i]#########", Msg); + GM->Message(0, "#ATTACKER: %s", attacker->GetCleanName()); + GM->Message(0, "#DEFENDER: %s", defender->GetCleanName()); + } + + if (RuleB(Combat, UseIntervalAC)) { + float softcap = (GetSkill(SkillDefense) + GetLevel()) * + RuleR(Combat, SoftcapFactor) * (1.0 + aa_mit); + float mitigation_rating = 0.0; + float attack_rating = 0.0; + int shield_ac = 0; + int armor = 0; + float weight = 0.0; + + if (Msg >= 2){ + GM->Message(0, " "); + GM->Message(0, "### Calculate Mitigation Rating ###"); + if (aabonuses.CombatStability) + GM->Message(0, "# %i #### DEFENDER SE_CombatStability(259) AA Bonus", aabonuses.CombatStability); + if (spellbonuses.CombatStability) + GM->Message(0, "# %i #### DEFENDER SE_CombatStability(259) Spell Bonus", spellbonuses.CombatStability); + if (itembonuses.CombatStability) + GM->Message(0, "# %i #### DEFENDER SE_CombatStability(259) Worn Bonus", itembonuses.CombatStability); + + GM->Message(0, "# %.2f #### DEFENDER Base Soft Cap", softcap); + } + + float monkweight = RuleI(Combat, MonkACBonusWeight); + monkweight = mod_monk_weight(monkweight, attacker); + + if (IsClient()) { + armor = CastToClient()->GetRawACNoShield(shield_ac) + add_ac; + weight = (CastToClient()->CalcCurrentWeight() / 10.0); + + if (ac_override) + armor = ac_override; + + if (Msg >=2 ){ + GM->Message(0, "# %i #### DEFENDER AC Equiped/Worn Bonus", itembonuses.AC); + GM->Message(0, "# %i #### DEFENDER SE_ArmorClass(1) AA Bonus", aabonuses.AC); + GM->Message(0, "# %i #### DEFENDER SE_ArmorClass(1) Spell Bonus", spellbonuses.AC); + GM->Message(0, "# %i #### DEFENDER Shield AC", shield_ac); + GM->Message(0, "# %i #### DEFENDER Total Client Armor - NO shield", armor); + } + + } else if (IsNPC()) { + armor = CastToNPC()->GetRawAC() + add_ac; + + if (ac_override) + armor = ac_override; + + if (Msg >=2 ){ + GM->Message(0, "# %i #### DEFENDER AC Equiped/Worn Bonus", itembonuses.AC); + GM->Message(0, "# %i #### DEFENDER SE_ArmorClass(1) Spell Bonus", spellbonuses.AC); + GM->Message(0, "# %i #### DEFENDER NPC AC Stat", CastToNPC()->GetRawAC()); + } + + int PetACBonus = 0; + + if (!IsPet()){ + armor = (armor / RuleR(Combat, NPCACFactor)); + if (Msg >=2 ) + GM->Message(0, "# %i #### DEFENDER NPC Armor after RuleR(Combat, NPCACFactor) %.2f", armor, RuleR(Combat, NPCACFactor)); + } + + Mob *owner = nullptr; + if (IsPet()) + owner = GetOwner(); + else if ((CastToNPC()->GetSwarmOwner())) + owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner()); + + if (owner){ + PetACBonus = owner->aabonuses.PetMeleeMitigation + owner->itembonuses.PetMeleeMitigation + owner->spellbonuses.PetMeleeMitigation; + + if (Msg >=2 ){ + if (owner->aabonuses.PetMeleeMitigation) + GM->Message(0, "# %i #### DEFENDER Pet Owner SE_PetMeleeMitigation(379) AA Bonus", owner->aabonuses.PetMeleeMitigation); + if (owner->spellbonuses.PetMeleeMitigation) + GM->Message(0, "# %i #### DEFENDER Pet Owner SE_PetMeleeMitigation(379) Spell Bonus",owner->spellbonuses.PetMeleeMitigation); + if (owner->itembonuses.PetMeleeMitigation) + GM->Message(0, "# %i #### DEFENDER Pet Owner SE_PetMeleeMitigation(379) Worn Bonus", owner->itembonuses.PetMeleeMitigation); + } + } + + armor += spellbonuses.AC + itembonuses.AC + PetACBonus + 1; + + if (Msg >= 2) + GM->Message(0, "# %i #### DEFENDER NPC Total Base Armor",armor); + } + + if (opts) { + armor *= (1.0f - opts->armor_pen_percent); + armor -= opts->armor_pen_flat; + } + + if (RuleB(Combat, OldACSoftcapRules)) { + if (GetClass() == WIZARD || GetClass() == MAGICIAN || + GetClass() == NECROMANCER || GetClass() == ENCHANTER) + softcap = RuleI(Combat, ClothACSoftcap); + else if (GetClass() == MONK && weight <= monkweight) + softcap = RuleI(Combat, MonkACSoftcap); + else if(GetClass() == DRUID || GetClass() == BEASTLORD || GetClass() == MONK) + softcap = RuleI(Combat, LeatherACSoftcap); + else if(GetClass() == SHAMAN || GetClass() == ROGUE || + GetClass() == BERSERKER || GetClass() == RANGER) + softcap = RuleI(Combat, ChainACSoftcap); + else + softcap = RuleI(Combat, PlateACSoftcap); + } + softcap += shield_ac; + armor += shield_ac; + + if (RuleB(Combat, OldACSoftcapRules)) + softcap += (softcap * (aa_mit * RuleR(Combat, AAMitigationACFactor))); + if (armor > softcap) { + int softcap_armor = armor - softcap; + if (RuleB(Combat, OldACSoftcapRules)) { + if (GetClass() == WARRIOR) + softcap_armor = softcap_armor * RuleR(Combat, WarriorACSoftcapReturn); + else if (GetClass() == SHADOWKNIGHT || GetClass() == PALADIN || + (GetClass() == MONK && weight <= monkweight)) + softcap_armor = softcap_armor * RuleR(Combat, KnightACSoftcapReturn); + else if (GetClass() == CLERIC || GetClass() == BARD || + GetClass() == BERSERKER || GetClass() == ROGUE || + GetClass() == SHAMAN || GetClass() == MONK) + softcap_armor = softcap_armor * RuleR(Combat, LowPlateChainACSoftcapReturn); + else if (GetClass() == RANGER || GetClass() == BEASTLORD) + softcap_armor = softcap_armor * RuleR(Combat, LowChainLeatherACSoftcapReturn); + else if (GetClass() == WIZARD || GetClass() == MAGICIAN || + GetClass() == NECROMANCER || GetClass() == ENCHANTER || + GetClass() == DRUID) + softcap_armor = softcap_armor * RuleR(Combat, CasterACSoftcapReturn); + else + softcap_armor = softcap_armor * RuleR(Combat, MiscACSoftcapReturn); + } else { + if (GetClass() == WARRIOR) + softcap_armor *= RuleR(Combat, WarACSoftcapReturn); + else if (GetClass() == PALADIN || GetClass() == SHADOWKNIGHT) + softcap_armor *= RuleR(Combat, PalShdACSoftcapReturn); + else if (GetClass() == CLERIC || GetClass() == RANGER || + GetClass() == MONK || GetClass() == BARD) + softcap_armor *= RuleR(Combat, ClrRngMnkBrdACSoftcapReturn); + else if (GetClass() == DRUID || GetClass() == NECROMANCER || + GetClass() == WIZARD || GetClass() == ENCHANTER || + GetClass() == MAGICIAN) + softcap_armor *= RuleR(Combat, DruNecWizEncMagACSoftcapReturn); + else if (GetClass() == ROGUE || GetClass() == SHAMAN || + GetClass() == BEASTLORD || GetClass() == BERSERKER) + softcap_armor *= RuleR(Combat, RogShmBstBerACSoftcapReturn); + else + softcap_armor *= RuleR(Combat, MiscACSoftcapReturn); + } + + + armor = softcap + softcap_armor; + if (Msg >= 2) + GM->Message(0, "# %i #### DEFENDER Final Armor [Soft Cap %i Soft Cap Armor %i]",armor, softcap,softcap_armor); + } + int tmp_armor = armor; + if (GetClass() == WIZARD || GetClass() == MAGICIAN || + GetClass() == NECROMANCER || GetClass() == ENCHANTER){ + mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 4.0) + armor + 1; + if (Msg >= 2) + GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(SkillDefense), itembonuses.HeroicAGI); + } + else{ + mitigation_rating = ((GetSkill(SkillDefense) + itembonuses.HeroicAGI/10) / 3.0) + (armor * 1.333333) + 1; + if (Msg >= 2) + GM->Message(0, "# + %.2f #### DEFENDER Armor Bonus [Defense Skill %i Heroic Agi %i]", mitigation_rating - tmp_armor, GetSkill(SkillDefense), itembonuses.HeroicAGI); + + } + mitigation_rating *= 0.847; + + if (Msg >= 1) + GM->Message(0, "# %.2f #### DEFENDER Final Mitigation Rating", mitigation_rating); + + + if (Msg >= 2){ + GM->Message(0, " "); + GM->Message(0, "### Mitigation Bonus Effects ###"); + if (itembonuses.MeleeMitigation) + GM->Message(0, "# %i #### DEFENDER Item Mod2 Shielding", itembonuses.MeleeMitigation); + if (aabonuses.MeleeMitigationEffect) + GM->Message(0, "# %i #### DEFENDER SE_MeleeMitigation(168) AA Bonus", aabonuses.MeleeMitigationEffect); + if (spellbonuses.MeleeMitigationEffect) + GM->Message(0, "# %i #### DEFENDER SE_MeleeMitigation(168) Spell Bonus", spellbonuses.MeleeMitigationEffect); + if (itembonuses.MeleeMitigationEffect) + GM->Message(0, "# %i #### DEFENDER SE_MeleeMitigation(168) Worn Bonus", itembonuses.MeleeMitigationEffect); + } + + mitigation_rating = mod_mitigation_rating(mitigation_rating, attacker); + + if (attacker->IsClient()){ + if (atk_override) + attack_rating = (atk_override + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); + else + attack_rating = ((attacker->CastToClient()->CalcATK() + add_atk) + ((attacker->GetSTR()-66) * 0.9) + (attacker->GetSkill(SkillOffense)*1.345)); + + } + else{ + if (atk_override) + attack_rating = (atk_override + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); + else + attack_rating = ((attacker->GetATK() + add_atk) + (attacker->GetSkill(SkillOffense)*1.345) + ((attacker->GetSTR()-66) * 0.9)); + } + + attack_rating = attacker->mod_attack_rating(attack_rating, this); + + if (Msg >= 2){ + GM->Message(0, " "); + GM->Message(0, "### Calculate Attack Rating ###"); + if (attacker->IsClient()){ + GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); + GM->Message(0, "# %i #### ATTACKER SE_ATK(2) AA Bonus", attacker->aabonuses.ATK); + GM->Message(0, "# %i #### ATTACKER SE_ATK(2) spell Bonus", attacker->spellbonuses.ATK); + GM->Message(0, "# %i #### ATTACKER Leadership Bonus", attacker->CastToClient()->GroupLeadershipAAOffenseEnhancement()); + GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); + GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); + GM->Message(0, "# %.2f #### ATTACKER Strength Stat ATK Bonus [Stat Amt: %i]", ((attacker->GetSTR()-66) * 0.9),attacker->GetSTR()); + GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(SkillOffense)*1.345) ,attacker->GetSkill(SkillOffense)); + } + + else{ + GM->Message(0, "# %i #### ATTACKER Worn/Equip ATK Bonus", attacker->itembonuses.ATK); + GM->Message(0, "# %i #### ATTACKER SE_ATK(2) spell Bonus", attacker->spellbonuses.ATK); + GM->Message(0, "# %i #### ATTACKER NPC ATK Stat", attacker->CastToNPC()->ATK); + GM->Message(0, "# %.2f #### ATTACKER Strength Stat ATK Bonus [Stat Amt: %i]", ((attacker->GetSTR()-66) * 0.9),attacker->GetSTR()); + GM->Message(0, "# %.2f #### ATTACKER Offensive Skill ATK Bonus [Stat Amt: %i]", (attacker->GetSkill(SkillOffense)*1.345) ,attacker->GetSkill(SkillOffense)); + } + } + + if (Msg >= 1){ + GM->Message(0, "# %.2f #### ATTACKER Final Attack Rating", attack_rating); + GM->Message(0, "######### Melee Mitigation Report: Complete #########", Msg); + } + + + damage = GetMeleeMitDmg(attacker, damage, minhit, mitigation_rating, attack_rating); + } + + if (damage < 0) + damage = 0; + + return damage; +} + +// This is called when the Mob is the one being hit +int32 Mob::Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, + float mit_rating, float atk_rating) +{ + float d = 10.0; + float mit_roll = zone->random.Real(0, mit_rating); + float atk_roll = zone->random.Real(0, atk_rating); + + if (atk_roll > mit_roll) { + float a_diff = atk_roll - mit_roll; + float thac0 = atk_rating * RuleR(Combat, ACthac0Factor); + float thac0cap = attacker->GetLevel() * 9 + 20; + if (thac0 > thac0cap) + thac0 = thac0cap; + + d -= 10.0 * (a_diff / thac0); + } else if (mit_roll > atk_roll) { + float m_diff = mit_roll - atk_roll; + float thac20 = mit_rating * RuleR(Combat, ACthac20Factor); + float thac20cap = GetLevel() * 9 + 20; + if (thac20 > thac20cap) + thac20 = thac20cap; + + d += 10.0 * (m_diff / thac20); + } + + if (d < 0.0) + d = 0.0; + else if (d > 20.0) + d = 20.0; + + float interval = (damage - minhit) / 20.0; + damage -= ((int)d * interval); + + damage -= (minhit * itembonuses.MeleeMitigation / 100); + damage -= (damage * (spellbonuses.MeleeMitigationEffect + itembonuses.MeleeMitigationEffect + aabonuses.MeleeMitigationEffect) / 100); + return damage; +} + +// This is called when the Client is the one being hit +int32 Client::Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, + float mit_rating, float atk_rating) +{ + if (!attacker->IsNPC() || RuleB(Combat, UseOldDamageIntervalRules)) + return Mob::GetMeleeMitDmg(attacker, damage, minhit, mit_rating, atk_rating); + int d = 10; + // floats for the rounding issues + float dmg_interval = (damage - minhit) / 19.0; + float dmg_bonus = minhit - dmg_interval; + float spellMeleeMit = (spellbonuses.MeleeMitigationEffect + itembonuses.MeleeMitigationEffect + aabonuses.MeleeMitigationEffect) / 100.0; + if (GetClass() == WARRIOR) + spellMeleeMit += 0.05; + dmg_bonus -= dmg_bonus * (itembonuses.MeleeMitigation / 100.0); + dmg_interval -= dmg_interval * spellMeleeMit; + + float mit_roll = zone->random.Real(0, mit_rating); + float atk_roll = zone->random.Real(0, atk_rating); + + if (atk_roll > mit_roll) { + float a_diff = atk_roll - mit_roll; + float thac0 = atk_rating * RuleR(Combat, ACthac0Factor); + float thac0cap = attacker->GetLevel() * 9 + 20; + if (thac0 > thac0cap) + thac0 = thac0cap; + + d += 10 * (a_diff / thac0); + } else if (mit_roll > atk_roll) { + float m_diff = mit_roll - atk_roll; + float thac20 = mit_rating * RuleR(Combat, ACthac20Factor); + float thac20cap = GetLevel() * 9 + 20; + if (thac20 > thac20cap) + thac20 = thac20cap; + + d -= 10 * (m_diff / thac20); + } + + if (d < 1) + d = 1; + else if (d > 20) + d = 20; + + return static_cast((dmg_bonus + dmg_interval * d)); +} + + +int32 Client::GetMeleeDamage(Mob* other, bool GetMinDamage) +{ + int Hand = MainPrimary; + + if (!other) + return 0; + + ItemInst* weapon; + weapon = GetInv().GetItem(MainPrimary); + + if(weapon != nullptr) { + if (!weapon->IsWeapon()) { + return(0); + } + } + + SkillUseTypes skillinuse; + AttackAnimation(skillinuse, Hand, weapon); + + int damage = 0; + uint8 mylevel = GetLevel() ? GetLevel() : 1; + uint32 hate = 0; + if (weapon) hate = weapon->GetItem()->Damage + weapon->GetItem()->ElemDmgAmt; + int weapon_damage = GetWeaponDamage(other, weapon, &hate); + if (hate == 0 && weapon_damage > 1) hate = weapon_damage; + + if(weapon_damage > 0){ + if(IsBerserk() && GetClass() == BERSERKER){ + int bonus = 3 + GetLevel()/10; //unverified + weapon_damage = weapon_damage * (100+bonus) / 100; + } + + int min_hit = 1; + int max_hit = (2*weapon_damage*GetDamageTable(skillinuse)) / 100; + + if(GetLevel() < 10 && max_hit > RuleI(Combat, HitCapPre10)) + max_hit = (RuleI(Combat, HitCapPre10)); + else if(GetLevel() < 20 && max_hit > RuleI(Combat, HitCapPre20)) + max_hit = (RuleI(Combat, HitCapPre20)); + + CheckIncreaseSkill(skillinuse, other, -15); + CheckIncreaseSkill(SkillOffense, other, -15); + + +#ifndef EQEMU_NO_WEAPON_DAMAGE_BONUS + + int ucDamageBonus = 0; + + if( Hand == MainPrimary && GetLevel() >= 28 && IsWarriorClass() ) + { + ucDamageBonus = GetWeaponDamageBonus( weapon ? weapon->GetItem() : (const Item_Struct*) nullptr ); + + min_hit += (int) ucDamageBonus; + max_hit += (int) ucDamageBonus; + hate += ucDamageBonus; + } +#endif + min_hit += min_hit * GetMeleeMinDamageMod_SE(skillinuse) / 100; + + if(max_hit < min_hit) + max_hit = min_hit; + + if (GetMinDamage) + return min_hit; + else + return max_hit; + } + + return 0; +} + +void Mob::Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int avoid_override, int Msg) +{ + + int add_acc = 0; + float tmp_hit_chance = 0.0f; + bool end = false; + + SkillUseTypes skillinuse = SkillHandtoHand; + if (attacker->IsClient()) + {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. + ItemInst* weapon; + weapon = attacker->CastToClient()->GetInv().GetItem(MainPrimary); + + if(weapon && weapon->IsWeapon()){ + attacker->CastToClient()->AttackAnimation(skillinuse, MainPrimary, weapon); + } + else { + weapon = attacker->CastToClient()->GetInv().GetItem(MainSecondary); + if (weapon && weapon->IsWeapon()) + attacker->CastToClient()->AttackAnimation(skillinuse, MainSecondary, weapon); + else { + weapon = attacker->CastToClient()->GetInv().GetItem(MainRange); + if (weapon && weapon->IsWeapon()) + attacker->CastToClient()->AttackAnimation(skillinuse, MainRange, weapon); + } + } + } + + tmp_hit_chance = Tune_CheckHitChance(defender,attacker, skillinuse, MainPrimary,0,0,0, avoid_override); + + + Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); + Message(0, "#Tune - Processing... Find Accuracy for hit chance on attacker of (%.0f) pct on defender [Current Hit Chance %.2f]", hit_chance, tmp_hit_chance); + + + if (tmp_hit_chance > hit_chance) + interval = interval * -1; + + for (int j=0; j < max_loop; j++) + { + tmp_hit_chance =Tune_CheckHitChance(defender,attacker, skillinuse, MainPrimary,0,false,0, avoid_override, add_acc); + + if (Msg >= 3) + Message(15, "#Tune - Processing... [%i] [ACCURACY %i] Hit Chance %.2f ",j,add_acc,tmp_hit_chance); + + if (interval > 0 && tmp_hit_chance >= hit_chance){ + end = true; + } + + else if (interval < 0 && tmp_hit_chance <= hit_chance){ + end = true; + } + + if (end){ + + Tune_CheckHitChance(defender,attacker, skillinuse, MainPrimary,0,Msg,0,avoid_override);//Display Stat Report + + Message(0, " "); + + if (attacker->IsNPC()){ + Message(0, "#Recommended NPC Accuracy Statistic adjustment of ( %i ) on ' %s ' for a hit chance of (+ %.0f) pct verse ' %s '. ",add_acc,defender->GetCleanName(), hit_chance, attacker->GetCleanName()); + Message(0, "#SET: [NPC Avoidance] = [%i]",add_acc + defender->CastToNPC()->GetAccuracyRating()); + } + else if (attacker->IsClient()){ + Message(0, "#Recommended Client Accuracy Bonus adjustment of ( %i ) on ' %s ' for a hit chance of (+ %.0f) pct verse ' %s '. ",add_acc,defender->GetCleanName(), hit_chance, attacker->GetCleanName()); + Message(0, "#Modify (+/-): [Item Mod2 Accuracy] [%i]",add_acc); + Message(0, "#Modify (+/-): [SE_Accuracy(216)] [%i]",add_acc); + Message(0, "#Modify (+/-): [SE_HitChance(184)] [%i]",add_acc / 15); + } + + return; + } + + + add_acc = add_acc + interval; + } + + Message(7, "#Tune - Error: Unable to find desired result for (%.0f) pct - Increase interval (%i) AND/OR max loop value (%i) and run again.", hit_chance, interval, max_loop); + Message(7, "#Tune - Parse ended at ACCURACY ADJUSTMENTT ( %i ) at hit chance of (%.0f) / (%.0f) pct.",add_acc,tmp_hit_chance / hit_chance); +} + +void Mob::Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int acc_override, int Msg) +{ + int add_avoid = 0; + float tmp_hit_chance = 0.0f; + bool end = false; + + SkillUseTypes skillinuse = SkillHandtoHand; + if (attacker->IsClient()) + {//Will check first equiped weapon for skill. Ie. remove wepaons to assess bow. + ItemInst* weapon; + weapon = attacker->CastToClient()->GetInv().GetItem(MainPrimary); + + if(weapon && weapon->IsWeapon()){ + attacker->CastToClient()->AttackAnimation(skillinuse, MainPrimary, weapon); + } + else { + weapon = attacker->CastToClient()->GetInv().GetItem(MainSecondary); + if (weapon && weapon->IsWeapon()) + attacker->CastToClient()->AttackAnimation(skillinuse, MainSecondary, weapon); + else { + weapon = attacker->CastToClient()->GetInv().GetItem(MainRange); + if (weapon && weapon->IsWeapon()) + attacker->CastToClient()->AttackAnimation(skillinuse, MainRange, weapon); + } + } + } + + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, MainPrimary,0,0,acc_override, 0); + + Message(0, "#Tune - Begin Parse [Interval %i Max Loop Iterations %i]", interval, max_loop); + Message(0, "#Tune - Processing... Find Avoidance for hit chance on defender of (%.0f) pct from attacker. [Current Hit Chance %.2f]", hit_chance, tmp_hit_chance); + + if (tmp_hit_chance < hit_chance) + interval = interval * -1; + + for (int j=0; j < max_loop; j++) + { + tmp_hit_chance = Tune_CheckHitChance(defender, attacker, skillinuse, MainPrimary, 0,0, acc_override, 0,0,add_avoid); + + if (Msg >= 3) + Message(0, "#Tune - Processing... [%i] [AVOIDANCE %i] Hit Chance %.2f ",j,add_avoid,tmp_hit_chance); + + if (interval > 0 && tmp_hit_chance <= hit_chance){ + end = true; + } + + else if (interval < 0 && tmp_hit_chance >= hit_chance){ + end = true; + } + + if (end){ + + Tune_CheckHitChance(defender,attacker, skillinuse, MainPrimary,0,Msg,acc_override, 0);//Display Stat Report + + Message(0, " "); + + if (defender->IsNPC()){ + Message(0, "#Recommended NPC Avoidance Statistic adjustment of ( %i ) on ' %s ' for a hit chance of ( %.0f) pct from ' %s '. ",add_avoid,defender->GetCleanName(), hit_chance, attacker->GetCleanName()); + Message(0, "#SET: [NPC Avoidance] = [%i]",add_avoid + defender->CastToNPC()->GetAvoidanceRating()); + } + else if (defender->IsClient()){ + Message(0, "#Recommended Client Avoidance Bonus adjustment of ( %i ) on ' %s ' for a hit chance of ( %.0f) pct from ' %s '. ",add_avoid,defender->GetCleanName(), hit_chance, attacker->GetCleanName()); + Message(0, "#Modify (+/-): [Item Mod2 Avoidance] [%i]",add_avoid); + Message(0, "#Modify (+/-): [SE_AvoidMeleeChance(172)] [%i]",add_avoid / 10); + } + + return; + } + + add_avoid = add_avoid + interval; + } + + Message(0, "#Tune - Error: Unable to find desired result for (%.0f) pct - Increase interval (%i) AND/OR max loop value (%i) and run again.", hit_chance, interval, max_loop); + Message(0, "#Tune - Parse ended at AVOIDANCE ADJUSTMENT ( %i ) at hit chance of (%.0f) / (%.0f) pct.",add_avoid,tmp_hit_chance / hit_chance); +} + + +float Mob::Tune_CheckHitChance(Mob* defender, Mob* attacker, SkillUseTypes skillinuse, int Hand, int16 chance_mod, int Msg,int acc_override, int avoid_override, int add_acc, int add_avoid) +{ + + float chancetohit = RuleR(Combat, BaseHitChance); + + if(attacker->IsNPC() && !attacker->IsPet()) + chancetohit += RuleR(Combat, NPCBonusHitChance); + + if (Msg){ + + Message(0, "######### Hit Chance Report: Start [Detail Level %i]#########", Msg); + Message(0, "#ATTACKER: %s", attacker->GetCleanName()); + Message(0, "#DEFENDER: %s", defender->GetCleanName()); + if (Msg >= 2){ + Message(0, " "); + Message(0, "### Calculate Base Hit Chance ###"); + Message(0, "# + %.2f Total: %.2f #### RuleR(Combat, BaseHitChance)", RuleR(Combat, BaseHitChance), RuleR(Combat, BaseHitChance)); + if (attacker->IsNPC()) + Message(0, "# + %.2f Total: %.2f #### RuleR(Combat, NPCBonusHitChance)", RuleR(Combat, NPCBonusHitChance), chancetohit); + } + } + + float temp_chancetohit = chancetohit; + + bool pvpmode = false; + if(IsClient() && attacker->IsClient()) + pvpmode = true; + + if (chance_mod >= 10000) + return true; + + float avoidanceBonus = 0; + float hitBonus = 0; + + //////////////////////////////////////////////////////// + // To hit calcs go here + //////////////////////////////////////////////////////// + + uint8 attacker_level = attacker->GetLevel() ? attacker->GetLevel() : 1; + uint8 defender_level = defender->GetLevel() ? defender->GetLevel() : 1; + + //Calculate the level difference + + double level_difference = attacker_level - defender_level; + double range = defender->GetLevel(); + range = ((range / 4) + 3); + + if(level_difference < 0) + { + if(level_difference >= -range) + { + chancetohit += (level_difference / range) * RuleR(Combat,HitFalloffMinor); //5 + } + else if (level_difference >= -(range+3.0)) + { + chancetohit -= RuleR(Combat,HitFalloffMinor); + chancetohit += ((level_difference+range) / (3.0)) * RuleR(Combat,HitFalloffModerate); //7 + } + else + { + chancetohit -= (RuleR(Combat,HitFalloffMinor) + RuleR(Combat,HitFalloffModerate)); + chancetohit += ((level_difference+range+3.0)/12.0) * RuleR(Combat,HitFalloffMajor); //50 + } + } + else + { + chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); + } + + if (Msg >= 2) + Message(0, "# + %.2f Total: %.2f #### Level Modifers", chancetohit - temp_chancetohit, chancetohit); + + temp_chancetohit = chancetohit; + + chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); + + if (Msg >= 2) + Message(0, "# - %.2f Total: %.2f #### DEFENDER Agility", ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)), chancetohit); + + if(attacker->IsClient()) + { + chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); + if (Msg >= 2) + Message(0, "# - %.2f Total: %.2f ##### ATTACKER Wpn Skill Mod: ", (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))), chancetohit); + } + + if(defender->IsClient()) + { + chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); + if (Msg >= 2) + Message(0, "# + %.2f Total: %.2f #### DEFENDER Defense Skill Mod", (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))), chancetohit); + } + + + //I dont think this is 100% correct, but at least it does something... + if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { + chancetohit += attacker->spellbonuses.MeleeSkillCheck; + if (Msg >= 2) + Message(0, "# + %.2f Total: %.2f #### ATTACKER SE_MeleeSkillCheck(183) Spell Bonus", attacker->spellbonuses.MeleeSkillCheck , chancetohit); + } + if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { + chancetohit += attacker->itembonuses.MeleeSkillCheck; + if (Msg >= 2) + Message(0, "# + %.2f Total: %.2f #### ATTACKER SE_MeleeSkillCheck(183) Worn Bonus", attacker->itembonuses.MeleeSkillCheck , chancetohit); + } + + if (Msg) + Message(0, "#FINAL Base Hit Chance: %.2f percent", chancetohit); + + if (Msg >= 2){ + Message(0, " "); + Message(0, "######### Calculate Avoidance Bonuses #########"); + } + + //Avoidance Bonuses on defender decreases baseline hit chance by percent. + avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + + defender->itembonuses.AvoidMeleeChanceEffect + + defender->aabonuses.AvoidMeleeChanceEffect + + (defender->itembonuses.AvoidMeleeChance / 10.0f); //Item Mod 'Avoidence' + + if (Msg >= 2){ + if (defender->aabonuses.AvoidMeleeChanceEffect) + Message(0, "# %i #### DEFENDER SE_AvoidMeleeChance(172) AA Bonus", defender->aabonuses.AvoidMeleeChanceEffect); + if (defender->spellbonuses.AvoidMeleeChanceEffect) + Message(0, "# %i #### DEFENDER SE_AvoidMeleeChance(172) Spell Bonus", defender->spellbonuses.AvoidMeleeChanceEffect); + if (defender->itembonuses.AvoidMeleeChanceEffect) + Message(0, "# %i #### DEFENDER SE_AvoidMeleeChance(172) Worn Bonus", defender->itembonuses.AvoidMeleeChanceEffect); + if (defender->itembonuses.AvoidMeleeChance) + Message(0, "# %i #### DEFENDER Avoidance Item Mod2 Bonus[Amt: %i] ", defender->itembonuses.AvoidMeleeChance / 10.0f,defender->itembonuses.AvoidMeleeChance); + } + + + Mob *owner = nullptr; + if (defender->IsPet()) + owner = defender->GetOwner(); + else if ((defender->IsNPC() && defender->CastToNPC()->GetSwarmOwner())) + owner = entity_list.GetMobID(defender->CastToNPC()->GetSwarmOwner()); + + if (owner){ + avoidanceBonus += owner->aabonuses.PetAvoidance + owner->spellbonuses.PetAvoidance + owner->itembonuses.PetAvoidance; + + if (Msg >= 2){ + if (owner->aabonuses.PetAvoidance) + Message(0, "# %i #### DEFENDER SE_PetAvoidance(215) AA Bonus", owner->aabonuses.PetAvoidance); + if (owner->aabonuses.PetAvoidance) + Message(0, "# %i #### DEFENDER SE_PetAvoidance(215) Spell Bonus", owner->itembonuses.PetAvoidance); + if (owner->aabonuses.PetAvoidance) + Message(0, "# %i #### DEFENDER SE_PetAvoidance(215) Worn Bonus", owner->spellbonuses.PetAvoidance); + } + } + + if(defender->IsNPC()){ + avoidanceBonus += ((defender->CastToNPC()->GetAvoidanceRating() + add_avoid) / 10.0f); //Modifier from database + if (Msg >= 2) + Message(0, "# + %.2f #### DEFENDER NPC AVOIDANCE STAT [Stat Amt: %i] ", ((defender->CastToNPC()->GetAvoidanceRating() + add_avoid) / 10.0f),defender->CastToNPC()->GetAvoidanceRating()); + } + else if(defender->IsClient()){ + avoidanceBonus += (add_avoid / 10.0f); //Avoidance Item Mod + } + + //#tune override value + if (avoid_override){ + avoidanceBonus = (avoid_override / 10.0f); + if (Msg >= 2) + Message(0, "%.2f #### DEFENDER 'AVOIDANCE OVERRIDE'", avoidanceBonus); + } + + if (Msg) + Message(0, "#FINAL Avoidance Bonus': %.2f percent ", avoidanceBonus); + + if (Msg >= 2){ + Message(0, " "); + Message(0, "######### Calculate Accuracy Bonuses #########"); + } + + //Hit Chance Bonuses on attacker increases baseline hit chance by percent. + hitBonus += attacker->itembonuses.HitChanceEffect[skillinuse] + + attacker->spellbonuses.HitChanceEffect[skillinuse]+ + attacker->aabonuses.HitChanceEffect[skillinuse]+ + attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1] + + attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] + + attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]; + + if (Msg >= 2){ + if (attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) AA Bonus [All Skills]", attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]); + if (attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Spell Bonus [All Skills]", attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1]); + if (attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Worn Bonus [All Skills]", attacker->itembonuses.HitChanceEffect[HIGHEST_SKILL+1]); + if (attacker->itembonuses.HitChanceEffect[skillinuse]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) AA Bonus [Skill]", attacker->aabonuses.HitChanceEffect[skillinuse]); + if (attacker->spellbonuses.HitChanceEffect[skillinuse]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Spell Bonus [Skill]", attacker->spellbonuses.HitChanceEffect[skillinuse]); + if (attacker->itembonuses.HitChanceEffect[skillinuse]) + Message(0, "# %i #### ATTACKER SE_HitChance(184) Worn Bonus [Skill]", attacker->itembonuses.HitChanceEffect[skillinuse]); + } + + //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect + //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) + hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + + attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1] + + attacker->aabonuses.Accuracy[HIGHEST_SKILL+1] + + attacker->aabonuses.Accuracy[skillinuse] + + attacker->itembonuses.HitChance) / 15.0f; //Item Mod 'Accuracy' + + if (Msg >= 2) { + if (attacker->aabonuses.Accuracy[HIGHEST_SKILL+1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) AA Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->aabonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->aabonuses.Accuracy[HIGHEST_SKILL+1]); + if (attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Spell Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->spellbonuses.Accuracy[HIGHEST_SKILL+1]); + if (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) Worn Bonus [All Skills] [Stat Amt: %i]", static_cast(attacker->itembonuses.Accuracy[HIGHEST_SKILL+1])/15.0f,attacker->itembonuses.Accuracy[HIGHEST_SKILL+1]); + if (attacker->aabonuses.Accuracy[skillinuse]) + Message(0, "# %.2f #### ATTACKER SE_Accuracy(216) AA Bonus [Skill] [Stat Amt: %i]", static_cast(attacker->aabonuses.Accuracy[skillinuse])/15.0f,attacker->aabonuses.Accuracy[skillinuse]); + if (attacker->itembonuses.HitChance) + Message(0, "# %.2f #### ATTACKER Accuracy Item Mod2 Bonus [Stat Amt: %i]", static_cast(attacker->itembonuses.HitChance)/15.0f,attacker->itembonuses.HitChance); + } + + hitBonus += chance_mod; //Modifier applied from casted/disc skill attacks. + + if(attacker->IsNPC()){ + if (acc_override){ + hitBonus = (acc_override / 10.0f); + if (Msg >= 2) + Message(0, "# %.2f #### ATTACKER 'ACCURACY OVERRIDE'", hitBonus); + } + else { + hitBonus += ((attacker->CastToNPC()->GetAccuracyRating() + add_acc) / 10.0f); //Modifier from database + if (Msg >= 2){ + Message(0, "# %.2f #### ATTACKER NPC ACCURACY STAT [Stat Amt: %i] ", ((attacker->CastToNPC()->GetAccuracyRating() + add_avoid) / 10.0f),attacker->CastToNPC()->GetAccuracyRating()); + } + } + } + else if(attacker->IsClient()){ + if (acc_override){ + hitBonus = (acc_override / 15.0f); + if (Msg >= 2) + Message(0, "# %.2f #### ATTACKER 'ACCURACY OVERRIDE': %.2f "); + } + else + hitBonus += (add_acc / 15.0f); //Modifier from database + } + + if(skillinuse == SkillArchery){ + hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); + if (Msg >= 2) + Message(0, "# %.2f pct #### RuleR(Combat, ArcheryHitPenalty) ", RuleR(Combat, ArcheryHitPenalty)); + } + + //Calculate final chance to hit + chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); + + if (Msg){ + Message(0, "#FINAL Accuracy Bonus': %.2f percent", hitBonus); + + if (Msg >= 2) + Message(0, " "); + + Message(0, "#FINAL Hit Chance: %.2f percent [Max: %.2f Min: %.2f] ", chancetohit, RuleR(Combat,MaxChancetoHit), RuleR(Combat,MinChancetoHit) ); + Message(0, "######### Hit Chance Report: Completed #########"); + } + + chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); + + // Chance to hit; Max 95%, Min 5% DEFAULTS + if(chancetohit > 1000 || chancetohit < -1000) { + //if chance to hit is crazy high, that means a discipline is in use, and let it stay there + } + else if(chancetohit > RuleR(Combat,MaxChancetoHit)) { + chancetohit = RuleR(Combat,MaxChancetoHit); + } + else if(chancetohit < RuleR(Combat,MinChancetoHit)) { + chancetohit = RuleR(Combat,MinChancetoHit); + } + + return(chancetohit); +} \ No newline at end of file From 855f7ac2a026ae3aac91910dd93e9b640bc2792e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 11 Jan 2015 00:20:43 -0600 Subject: [PATCH 0827/1883] Quote fix --- common/eqemu_logsys.cpp | 6 +++++- zone/worldserver.cpp | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index eab7ee2d9..f7bd6edc3 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -69,6 +69,7 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Command", "Crash", "Save", + /* "UCS", "Query Server", "Socket Server", @@ -78,8 +79,11 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Quests", "Spells", "Zone", - + "Tasks", + "Trading", + */ }; + static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", Console::Color::Yellow, // "Normal", diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index f8d4ff63e..2e1c2e699 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -386,11 +386,8 @@ void WorldServer::Process() { } } else { - #ifdef _EQDEBUG - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] - "id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); - #endif } } else From 8f1c227125f4334fce3acf5ea75109c96ff7f07e Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 11 Jan 2015 12:25:58 -0500 Subject: [PATCH 0828/1883] Tweaked client text link translators --- common/eq_packet_structs.h | 2 +- common/patches/rof.cpp | 50 ++++++++++++------------------ common/patches/rof2.cpp | 38 ++++++++--------------- common/patches/sod.cpp | 56 +++++++++++++-------------------- common/patches/sof.cpp | 56 +++++++++++++-------------------- common/patches/titanium.cpp | 60 +++++++++++++++--------------------- common/patches/underfoot.cpp | 56 +++++++++++++-------------------- zone/client_packet.cpp | 4 +-- 8 files changed, 125 insertions(+), 197 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 0c91d96f8..4ca5fa59c 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2388,7 +2388,7 @@ struct AugmentItem_Struct { // OP_Emote struct Emote_Struct { -/*0000*/ uint32 unknown01; +/*0000*/ uint32 type; // 0 - custom, 0xffffffff - command (/dance, /flip, etc...) /*0004*/ char message[1024]; /*1028*/ }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 3fce18414..9b097bf49 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -851,7 +851,7 @@ namespace RoF char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -5750,73 +5750,61 @@ namespace RoF static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { rofTextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) // Diff: ^ - new_segment.append(segments[segment_iter].substr(0, 41).c_str()); + rofTextLink.push_back('\x12'); + rofTextLink.append(segments[segment_iter].substr(0, 41)); - if (segments[segment_iter].substr(41, 1) == "0") - new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + if (segments[segment_iter][41] == '0') + rofTextLink.push_back(segments[segment_iter][42]); else - new_segment.append("F"); + rofTextLink.push_back('F'); - new_segment.append(segments[segment_iter].substr(43).c_str()); - - rofTextLink.push_back(delimiter); - rofTextLink.append(new_segment.c_str()); - rofTextLink.push_back(delimiter); + rofTextLink.append(segments[segment_iter].substr(43)); + rofTextLink.push_back('\x12'); } else { - rofTextLink.append(segments[segment_iter].c_str()); + rofTextLink.append(segments[segment_iter]); } } } static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find('\x12') == std::string::npos)) { serverTextLink = rofTextLink; return; } - auto segments = SplitString(rofTextLink, delimiter); + auto segments = SplitString(rofTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 42 47 (Source) // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: ^ - new_segment.append(segments[segment_iter].substr(0, 41).c_str()); - new_segment.append("0"); - new_segment.append(segments[segment_iter].substr(41).c_str()); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter].substr(0, 41)); + serverTextLink.push_back('0'); + serverTextLink.append(segments[segment_iter].substr(41)); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 782df8be7..e5b8c1805 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -917,7 +917,7 @@ namespace RoF2 char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -5845,64 +5845,52 @@ namespace RoF2 static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { rof2TextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: - new_segment.append(segments[segment_iter]); - - rof2TextLink.push_back(delimiter); - rof2TextLink.append(new_segment.c_str()); - rof2TextLink.push_back(delimiter); + rof2TextLink.push_back('\x12'); + rof2TextLink.append(segments[segment_iter]); + rof2TextLink.push_back('\x12'); } else { - rof2TextLink.append(segments[segment_iter].c_str()); + rof2TextLink.append(segments[segment_iter]); } } } static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rof2TextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rof2TextLink.find('\x12') == std::string::npos)) { serverTextLink = rof2TextLink; return; } - auto segments = SplitString(rof2TextLink, delimiter); + auto segments = SplitString(rof2TextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: - new_segment.append(segments[segment_iter]); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter]); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 34469d987..74f150e59 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -620,7 +620,7 @@ namespace SoD char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -3964,76 +3964,64 @@ namespace SoD static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { sodTextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append(segments[segment_iter].substr(36, 5).c_str()); + sodTextLink.push_back('\x12'); + sodTextLink.append(segments[segment_iter].substr(0, 31)); + sodTextLink.append(segments[segment_iter].substr(36, 5)); - if (segments[segment_iter].substr(41, 1) == "0") - new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + if (segments[segment_iter][41] == '0') + sodTextLink.push_back(segments[segment_iter][42]); else - new_segment.append("F"); + sodTextLink.push_back('F'); - new_segment.append(segments[segment_iter].substr(43).c_str()); - - sodTextLink.push_back(delimiter); - sodTextLink.append(new_segment.c_str()); - sodTextLink.push_back(delimiter); + sodTextLink.append(segments[segment_iter].substr(43)); + sodTextLink.push_back('\x12'); } else { - sodTextLink.append(segments[segment_iter].c_str()); + sodTextLink.append(segments[segment_iter]); } } } static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sodTextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sodTextLink.find('\x12') == std::string::npos)) { serverTextLink = sodTextLink; return; } - auto segments = SplitString(sodTextLink, delimiter); + auto segments = SplitString(sodTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append("00000"); - new_segment.append(segments[segment_iter].substr(31, 5).c_str()); - new_segment.append("0"); - new_segment.append(segments[segment_iter].substr(36).c_str()); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter].substr(0, 31)); + serverTextLink.append("00000"); + serverTextLink.append(segments[segment_iter].substr(31, 5)); + serverTextLink.push_back('0'); + serverTextLink.append(segments[segment_iter].substr(36)); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 22e8771b6..854953b32 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -607,7 +607,7 @@ namespace SoF char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -3286,76 +3286,64 @@ namespace SoF static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { sofTextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append(segments[segment_iter].substr(36, 5).c_str()); + sofTextLink.push_back('\x12'); + sofTextLink.append(segments[segment_iter].substr(0, 31)); + sofTextLink.append(segments[segment_iter].substr(36, 5)); - if (segments[segment_iter].substr(41, 1) == "0") - new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + if (segments[segment_iter][41] == '0') + sofTextLink.push_back(segments[segment_iter][42]); else - new_segment.append("F"); + sofTextLink.push_back('F'); - new_segment.append(segments[segment_iter].substr(43).c_str()); - - sofTextLink.push_back(delimiter); - sofTextLink.append(new_segment.c_str()); - sofTextLink.push_back(delimiter); + sofTextLink.append(segments[segment_iter].substr(43)); + sofTextLink.push_back('\x12'); } else { - sofTextLink.append(segments[segment_iter].c_str()); + sofTextLink.append(segments[segment_iter]); } } } static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sofTextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (sofTextLink.find('\x12') == std::string::npos)) { serverTextLink = sofTextLink; return; } - auto segments = SplitString(sofTextLink, delimiter); + auto segments = SplitString(sofTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append("00000"); - new_segment.append(segments[segment_iter].substr(31, 5).c_str()); - new_segment.append("0"); - new_segment.append(segments[segment_iter].substr(36).c_str()); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter].substr(0, 31)); + serverTextLink.append("00000"); + serverTextLink.append(segments[segment_iter].substr(31, 5)); + serverTextLink.push_back('0'); + serverTextLink.append(segments[segment_iter].substr(36)); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 77077c3bc..ac154a79d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -476,7 +476,7 @@ namespace Titanium char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -2045,78 +2045,66 @@ namespace Titanium static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { titaniumTextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) // Diff: ^^^^^ ^ ^^^^^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append(segments[segment_iter].substr(36, 5).c_str()); + titaniumTextLink.push_back('\x12'); + titaniumTextLink.append(segments[segment_iter].substr(0, 31)); + titaniumTextLink.append(segments[segment_iter].substr(36, 5)); - if (segments[segment_iter].substr(41, 1) == "0") - new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + if (segments[segment_iter][41] == '0') + titaniumTextLink.push_back(segments[segment_iter][42]); else - new_segment.append("F"); + titaniumTextLink.push_back('F'); - new_segment.append(segments[segment_iter].substr(48).c_str()); - - titaniumTextLink.push_back(delimiter); - titaniumTextLink.append(new_segment.c_str()); - titaniumTextLink.push_back(delimiter); + titaniumTextLink.append(segments[segment_iter].substr(48)); + titaniumTextLink.push_back('\x12'); } else { - titaniumTextLink.append(segments[segment_iter].c_str()); + titaniumTextLink.append(segments[segment_iter]); } } } static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (titaniumTextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (titaniumTextLink.find('\x12') == std::string::npos)) { serverTextLink = titaniumTextLink; return; } - auto segments = SplitString(titaniumTextLink, delimiter); + auto segments = SplitString(titaniumTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 32 36 37 (Source) // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: ^^^^^ ^ ^^^^^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append("00000"); - new_segment.append(segments[segment_iter].substr(31, 5).c_str()); - new_segment.append("0"); - new_segment.append(segments[segment_iter].substr(36, 1).c_str()); - new_segment.append("00000"); - new_segment.append(segments[segment_iter].substr(37).c_str()); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter].substr(0, 31)); + serverTextLink.append("00000"); + serverTextLink.append(segments[segment_iter].substr(31, 5)); + serverTextLink.push_back('0'); + serverTextLink.push_back(segments[segment_iter][36]); + serverTextLink.append("00000"); + serverTextLink.append(segments[segment_iter].substr(37)); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index fb5daa179..fc20e6e4b 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -764,7 +764,7 @@ namespace Underfoot char *OutBuffer = (char *)in->pBuffer; - VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->unknown01); + VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); delete[] __emu_buffer; @@ -4267,76 +4267,64 @@ namespace Underfoot static inline void ServerToUnderfootTextLink(std::string& underfootTextLink, const std::string& serverTextLink) { - const char delimiter = 0x12; - - if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find(delimiter) == std::string::npos)) { + if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) { underfootTextLink = serverTextLink; return; } - auto segments = SplitString(serverTextLink, delimiter); + auto segments = SplitString(serverTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append(segments[segment_iter].substr(36, 5).c_str()); + underfootTextLink.push_back('\x12'); + underfootTextLink.append(segments[segment_iter].substr(0, 31)); + underfootTextLink.append(segments[segment_iter].substr(36, 5)); - if (segments[segment_iter].substr(41, 1) == "0") - new_segment.append(segments[segment_iter].substr(42, 1).c_str()); + if (segments[segment_iter][41] == '0') + underfootTextLink.push_back(segments[segment_iter][42]); else - new_segment.append("F"); + underfootTextLink.push_back('F'); - new_segment.append(segments[segment_iter].substr(43).c_str()); - - underfootTextLink.push_back(delimiter); - underfootTextLink.append(new_segment.c_str()); - underfootTextLink.push_back(delimiter); + underfootTextLink.append(segments[segment_iter].substr(43)); + underfootTextLink.push_back('\x12'); } else { - underfootTextLink.append(segments[segment_iter].c_str()); + underfootTextLink.append(segments[segment_iter]); } } } static inline void UnderfootToServerTextLink(std::string& serverTextLink, const std::string& underfootTextLink) { - const char delimiter = 0x12; - - if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (underfootTextLink.find(delimiter) == std::string::npos)) { + if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (underfootTextLink.find('\x12') == std::string::npos)) { serverTextLink = underfootTextLink; return; } - auto segments = SplitString(underfootTextLink, delimiter); + auto segments = SplitString(underfootTextLink, '\x12'); for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - std::string new_segment; - // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // Diff: ^^^^^ ^ - new_segment.append(segments[segment_iter].substr(0, 31).c_str()); - new_segment.append("00000"); - new_segment.append(segments[segment_iter].substr(31, 5).c_str()); - new_segment.append("0"); - new_segment.append(segments[segment_iter].substr(36).c_str()); - - serverTextLink.push_back(delimiter); - serverTextLink.append(new_segment.c_str()); - serverTextLink.push_back(delimiter); + serverTextLink.push_back('\x12'); + serverTextLink.append(segments[segment_iter].substr(0, 31)); + serverTextLink.append("00000"); + serverTextLink.append(segments[segment_iter].substr(31, 5)); + serverTextLink.push_back('0'); + serverTextLink.append(segments[segment_iter].substr(36)); + serverTextLink.push_back('\x12'); } else { - serverTextLink.append(segments[segment_iter].c_str()); + serverTextLink.append(segments[segment_iter]); } } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 61f7813e1..8b82d84db 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5465,13 +5465,13 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) in->message[512] = '\0'; len_msg = 512; } - uint32 len_packet = sizeof(in->unknown01) + len_name + uint32 len_packet = sizeof(in->type) + len_name + len_msg + 1; // Construct outgoing packet EQApplicationPacket* outapp = new EQApplicationPacket(OP_Emote, len_packet); Emote_Struct* out = (Emote_Struct*)outapp->pBuffer; - out->unknown01 = in->unknown01; + out->type = in->type; memcpy(out->message, name, len_name); memcpy(&out->message[len_name], in->message, len_msg); From 756d4f4c5c449611bbd132ee48a61009048f782c Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 11 Jan 2015 15:49:54 -0500 Subject: [PATCH 0829/1883] Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work) --- changelog.txt | 3 +++ common/patches/rof.cpp | 6 +++++ common/patches/sod.cpp | 43 ++++++++++++++++++++++++++++++++++ common/patches/sod_ops.h | 1 + common/patches/sof.cpp | 43 ++++++++++++++++++++++++++++++++++ common/patches/sof_ops.h | 1 + common/patches/titanium.cpp | 43 ++++++++++++++++++++++++++++++++++ common/patches/titanium_ops.h | 1 + common/patches/underfoot.cpp | 43 ++++++++++++++++++++++++++++++++++ common/patches/underfoot_ops.h | 1 + 10 files changed, 185 insertions(+) diff --git a/changelog.txt b/changelog.txt index 95204e643..51350d4a1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/11/2015 == +Uleat: Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work) + == 01/10/2015 == Uleat: Added text link translators for OP_Emote diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 9b097bf49..03b47b2bc 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3251,6 +3251,12 @@ namespace RoF // Set the Write pointer as we don't know what has been done with the packet before we get it. in->SetReadPosition(0); // Copy the header + // + // Server header struct is { uint32; uint32; uint32; uint32; uint8; } + // Yet, we're writing 5 uint32's... that's 17 vs 20 bytes... + // 3 Bytes difference..but, we only increase packet size by 1 byte..something wrong here? -U + // (Tying to add text link translators and can't figure out if '+1' size is a new RoF field or something else) + // for (int i = 0; i < 5; ++i) outapp->WriteUInt32(in->ReadUInt32()); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 74f150e59..5f9a1f0db 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2177,6 +2177,49 @@ namespace SoD FINISH_ENCODE(); } + ENCODE(OP_TaskDescription) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToSoDTextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; diff --git a/common/patches/sod_ops.h b/common/patches/sod_ops.h index 5a1d313a2..3ce2ac2cb 100644 --- a/common/patches/sod_ops.h +++ b/common/patches/sod_ops.h @@ -63,6 +63,7 @@ E(OP_SpawnDoor) E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) +E(OP_TaskDescription) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 854953b32..dda929c74 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1776,6 +1776,49 @@ namespace SoF FINISH_ENCODE(); } + ENCODE(OP_TaskDescription) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToSoFTextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; diff --git a/common/patches/sof_ops.h b/common/patches/sof_ops.h index 08e30aeff..14ad69a8b 100644 --- a/common/patches/sof_ops.h +++ b/common/patches/sof_ops.h @@ -55,6 +55,7 @@ E(OP_SomeItemPacketMaybe) E(OP_SpawnDoor) E(OP_SpecialMesg) E(OP_Stun) +E(OP_TaskDescription) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index ac154a79d..e0e5f8528 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1226,6 +1226,49 @@ namespace Titanium dest->FastQueuePacket(&in, ack_req); } + ENCODE(OP_TaskDescription) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToTitaniumTextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct) + + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct) + + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; diff --git a/common/patches/titanium_ops.h b/common/patches/titanium_ops.h index 47d992b16..88c12e3ac 100644 --- a/common/patches/titanium_ops.h +++ b/common/patches/titanium_ops.h @@ -39,6 +39,7 @@ E(OP_SendCharInfo) E(OP_SendAATable) E(OP_ShopPlayerSell) E(OP_SpecialMesg) +E(OP_TaskDescription) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index fc20e6e4b..ba94084fb 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2443,6 +2443,49 @@ namespace Underfoot ENCODE(OP_TargetBuffs) { ENCODE_FORWARD(OP_BuffCreate); } + ENCODE(OP_TaskDescription) + { + EQApplicationPacket *in = *p; + *p = nullptr; + + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToUnderfootTextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + } + ENCODE(OP_Track) { EQApplicationPacket *in = *p; diff --git a/common/patches/underfoot_ops.h b/common/patches/underfoot_ops.h index 4443425fb..188cf3d9e 100644 --- a/common/patches/underfoot_ops.h +++ b/common/patches/underfoot_ops.h @@ -70,6 +70,7 @@ E(OP_SpawnDoor) E(OP_SpecialMesg) E(OP_Stun) E(OP_TargetBuffs) +E(OP_TaskDescription) E(OP_Track) E(OP_Trader) E(OP_TraderBuy) From 73c29fc2f0e6e5b36771007f24a6e1e00cc91214 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 11 Jan 2015 19:13:38 -0600 Subject: [PATCH 0830/1883] Added host parameter for folks using different hosts cause one is not enough --- utils/scripts/db_update.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/scripts/db_update.pl b/utils/scripts/db_update.pl index be1285fe4..1cb0f46e8 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/db_update.pl @@ -240,17 +240,17 @@ sub Exit{ } #::: Returns Tab Delimited MySQL Result from Command Line sub GetMySQLResult{ my $run_query = $_[0]; - if($OS eq "Windows"){ return `"$path" --user $user --password="$pass" $db -N -B -e "$run_query"`; } + if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" $db -N -B -e "$run_query"`; } if($OS eq "Linux"){ $run_query =~s/`//g; - return `$path --user="$user" --password="$pass" $db -N -B -e "$run_query"`; + return `$path --user="$user" --host $host --password="$pass" $db -N -B -e "$run_query"`; } } sub GetMySQLResultFromFile{ my $update_file = $_[0]; - if($OS eq "Windows"){ return `"$path" --user $user --password="$pass" --force $db < $update_file`; } - if($OS eq "Linux"){ return `"$path" --user $user --password="$pass" --force $db < $update_file`; } + if($OS eq "Windows"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } + if($OS eq "Linux"){ return `"$path" --host $host --user $user --password="$pass" --force $db < $update_file`; } } #::: Gets Remote File based on URL (1st Arg), and saves to destination file (2nd Arg) From add346b8dcf8703f92407627d57079a2cf47dd29 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 11 Jan 2015 20:57:04 -0500 Subject: [PATCH 0831/1883] Added text link body size mismatch checks to translators --- common/patches/rof.cpp | 12 ++++++++++++ common/patches/rof2.cpp | 12 ++++++++++++ common/patches/sod.cpp | 12 ++++++++++++ common/patches/sof.cpp | 12 ++++++++++++ common/patches/titanium.cpp | 12 ++++++++++++ common/patches/underfoot.cpp | 12 ++++++++++++ 6 files changed, 72 insertions(+) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 03b47b2bc..a31b75ae4 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5765,6 +5765,12 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + rofTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) @@ -5798,6 +5804,12 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 42 47 (Source) // RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index e5b8c1805..c14cf0f0d 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5854,6 +5854,12 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + rof2TextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) @@ -5880,6 +5886,12 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 5f9a1f0db..ba611f174 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -4016,6 +4016,12 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + sodTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) @@ -4050,6 +4056,12 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index dda929c74..3e22b5fc4 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -3338,6 +3338,12 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + sofTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) @@ -3372,6 +3378,12 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index e0e5f8528..d4cf82651 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -2097,6 +2097,12 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + titaniumTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) @@ -2131,6 +2137,12 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 32 36 37 (Source) // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index ba94084fb..48bb913bd 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -4319,6 +4319,12 @@ namespace Underfoot for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + underfootTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 36 37 41 43 48 (Source) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) @@ -4353,6 +4359,12 @@ namespace Underfoot for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { + if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + serverTextLink.append(segments[segment_iter]); + // TODO: log size mismatch error + continue; + } + // Idx: 0 1 6 11 16 21 26 31 32 36 37 42 (Source) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) From 21e5ccdf884deea7c5abd1d10b9d181830fd515a Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 11 Jan 2015 22:51:31 -0500 Subject: [PATCH 0832/1883] Fixed conditional criteria for size mismatch check --- common/patches/rof.cpp | 4 ++-- common/patches/rof2.cpp | 4 ++-- common/patches/sod.cpp | 4 ++-- common/patches/sof.cpp | 4 ++-- common/patches/titanium.cpp | 4 ++-- common/patches/underfoot.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index a31b75ae4..e8f6aa4b9 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -5765,7 +5765,7 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { rofTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -5804,7 +5804,7 @@ namespace RoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index c14cf0f0d..4b1213277 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -5854,7 +5854,7 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { rof2TextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -5886,7 +5886,7 @@ namespace RoF2 for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index ba611f174..b3f60fb34 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -4016,7 +4016,7 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { sodTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -4056,7 +4056,7 @@ namespace SoD for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 3e22b5fc4..e2d46a3ab 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -3338,7 +3338,7 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { sofTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -3378,7 +3378,7 @@ namespace SoF for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index d4cf82651..52b849176 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -2097,7 +2097,7 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { titaniumTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -2137,7 +2137,7 @@ namespace Titanium for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 48bb913bd..426d70ef0 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -4319,7 +4319,7 @@ namespace Underfoot for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != EmuConstants::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) { underfootTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; @@ -4359,7 +4359,7 @@ namespace Underfoot for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { if (segment_iter & 1) { - if (segments[segment_iter].length() != consts::TEXT_LINK_BODY_LENGTH) { + if (segments[segment_iter].length() <= consts::TEXT_LINK_BODY_LENGTH) { serverTextLink.append(segments[segment_iter]); // TODO: log size mismatch error continue; From 48199f374405b9668c1b0bac78384965fdf042a8 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 11 Jan 2015 23:09:28 -0500 Subject: [PATCH 0833/1883] #tune command fix --- zone/command.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 24dd2cec5..228e670c0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10742,9 +10742,9 @@ void command_tune(Client *c, const Seperator *sep) info_level = 1; if(!strcasecmp(sep->arg[2], "A")) - c->Tune_FindATKByPctMitigation(c, attacker, pct_mitigation, interval, max_loop,ac_override,info_level); + c->Tune_FindATKByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop,ac_override,info_level); else if(!strcasecmp(sep->arg[2], "B")) - c->Tune_FindATKByPctMitigation(attacker,c, pct_mitigation, interval, max_loop,ac_override,info_level); + c->Tune_FindATKByPctMitigation(attacker,defender, pct_mitigation, interval, max_loop,ac_override,info_level); else { c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); c->Message(0, "Usage #tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level] "); @@ -10777,9 +10777,9 @@ void command_tune(Client *c, const Seperator *sep) info_level = 1; if(!strcasecmp(sep->arg[2], "A")) - c->Tune_FindACByPctMitigation(c, attacker, pct_mitigation, interval, max_loop,atk_override,info_level); + c->Tune_FindACByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop,atk_override,info_level); else if(!strcasecmp(sep->arg[2], "B")) - c->Tune_FindACByPctMitigation(attacker, c, pct_mitigation, interval, max_loop,atk_override,info_level); + c->Tune_FindACByPctMitigation(attacker, defender, pct_mitigation, interval, max_loop,atk_override,info_level); else { c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); c->Message(0, "Usage #tune FindAC [A/B] [pct mitigation] [interval][loop_max][ATK Overwride][Info Level] "); @@ -10819,9 +10819,9 @@ void command_tune(Client *c, const Seperator *sep) } if(!strcasecmp(sep->arg[2], "A")) - c->Tune_FindAccuaryByHitChance(c, attacker, hit_chance, interval, max_loop,avoid_override,info_level); + c->Tune_FindAccuaryByHitChance(defender, attacker, hit_chance, interval, max_loop,avoid_override,info_level); else if(!strcasecmp(sep->arg[2], "B")) - c->Tune_FindAccuaryByHitChance(attacker, c, hit_chance, interval, max_loop,avoid_override,info_level); + c->Tune_FindAccuaryByHitChance(attacker, defender, hit_chance, interval, max_loop,avoid_override,info_level); else { c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); c->Message(0, "Usage #tune FindAcccuracy [A/B] [hit chance] [interval][loop_max][Avoidance Overwride][Info Level]"); @@ -10861,9 +10861,9 @@ void command_tune(Client *c, const Seperator *sep) } if(!strcasecmp(sep->arg[2], "A")) - c->Tune_FindAvoidanceByHitChance(c, attacker, hit_chance, interval, max_loop,acc_override, info_level); + c->Tune_FindAvoidanceByHitChance(defender, attacker, hit_chance, interval, max_loop,acc_override, info_level); else if(!strcasecmp(sep->arg[2], "B")) - c->Tune_FindAvoidanceByHitChance(attacker, c, hit_chance, interval, max_loop,acc_override, info_level); + c->Tune_FindAvoidanceByHitChance(attacker, defender, hit_chance, interval, max_loop,acc_override, info_level); else { c->Message(0, "#Tune - Error no category selcted. [#Tune help]"); c->Message(0, "Usage #tune FindAvoidance [A/B] [hit chance] [interval][loop_max][Accuracy Overwride][Info Level]"); From 2c97d98963dc1cd902ecac77e878d0e72146f123 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 11 Jan 2015 23:34:00 -0500 Subject: [PATCH 0834/1883] Remove unnecessary and incorrect memset --- zone/command.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 30a60f9f6..1a190cc28 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10279,7 +10279,6 @@ void command_camerashake(Client *c, const Seperator *sep) if(sep->arg[1][0] && sep->arg[2][0]) { ServerPacket *pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); - memset(pack->pBuffer, 0, sizeof(pack->pBuffer)); ServerCameraShake_Struct* scss = (ServerCameraShake_Struct*) pack->pBuffer; scss->duration = atoi(sep->arg[1]); scss->intensity = atoi(sep->arg[2]); From 3c53d907da922b06f877f73b634a5d92ab388543 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 11 Jan 2015 22:41:44 -0600 Subject: [PATCH 0835/1883] Fix double construction of EQEmuLogSys --- common/debug.cpp | 5 ++--- common/eqemu_logsys.cpp | 1 + common/eqemu_logsys.h | 1 - world/net.cpp | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 1150db9f0..874de6aa6 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -41,14 +41,13 @@ namespace ConsoleColor { #endif +#include "eqemu_logsys.h" #include "debug.h" #include "misc_functions.h" #include "platform.h" #include "eqemu_logsys.h" #include "string_util.h" -EQEmuLogSys backport_log_sys; - #ifndef va_copy #define va_copy(d,s) ((d) = (s)) #endif @@ -165,7 +164,7 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) va_list argptr, tmpargptr; va_start(argptr, fmt); - backport_log_sys.Log(id, vStringFormat(fmt, argptr).c_str()); + logger.Log(id, vStringFormat(fmt, argptr).c_str()); if (logCallbackFmt[id]) { msgCallbackFmt p = logCallbackFmt[id]; diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index f7bd6edc3..c7e8d300f 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -96,6 +96,7 @@ static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { EQEmuLogSys::EQEmuLogSys(){ + std::cout << "I AM CONSTRUCTING!!!! LUL " << std::endl; } EQEmuLogSys::~EQEmuLogSys(){ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 88fd1362f..746689920 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -55,7 +55,6 @@ public: void SetCurrentTimeStamp(char* time_stamp); void StartZoneLogs(const std::string log_name); - private: bool zone_general_init = false; diff --git a/world/net.cpp b/world/net.cpp index 11de88892..c75dbe04b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -97,14 +97,13 @@ LoginServerList loginserverlist; EQWHTTPServer http_server; UCSConnection UCSLink; QueryServConnection QSLink; -LauncherList launcher_list; +LauncherList launcher_list; AdventureManager adventure_manager; EQEmu::Random emu_random; volatile bool RunLoops = true; uint32 numclients = 0; uint32 numzones = 0; bool holdzones = false; -EQEmuLogSys logger; extern ConsoleList console_list; From f612082f5d9490db4f462071513cdc1b3992e2db Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 12 Jan 2015 01:42:27 -0500 Subject: [PATCH 0836/1883] Fix for OP_FormattedMessage text link server crashes --- changelog.txt | 3 +++ common/patches/rof.cpp | 12 +++++++----- common/patches/rof2.cpp | 12 +++++++----- common/patches/sod.cpp | 12 +++++++----- common/patches/sof.cpp | 12 +++++++----- common/patches/titanium.cpp | 12 +++++++----- common/patches/underfoot.cpp | 12 +++++++----- zone/client.cpp | 25 +++++++++++++++++-------- 8 files changed, 62 insertions(+), 38 deletions(-) diff --git a/changelog.txt b/changelog.txt index 51350d4a1..8ad64ad30 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/12/2015 == +Uleat: Fix for OP_FormattedMessage text link server crashes + == 01/11/2015 == Uleat: Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index e8f6aa4b9..2ccac0803 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -877,7 +877,6 @@ namespace RoF unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -885,6 +884,7 @@ namespace RoF for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -893,9 +893,10 @@ namespace RoF for (int i = 0; i < 9; ++i) { ServerToRoFTextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -904,9 +905,10 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4b1213277..10798be82 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -943,7 +943,6 @@ namespace RoF2 unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -951,6 +950,7 @@ namespace RoF2 for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -959,9 +959,10 @@ namespace RoF2 for (int i = 0; i < 9; ++i) { ServerToRoF2TextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -970,9 +971,10 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index b3f60fb34..3938e238f 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -646,7 +646,6 @@ namespace SoD unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -654,6 +653,7 @@ namespace SoD for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -662,9 +662,10 @@ namespace SoD for (int i = 0; i < 9; ++i) { ServerToSoDTextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -673,9 +674,10 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index e2d46a3ab..a9c5c0ea2 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -633,7 +633,6 @@ namespace SoF unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -641,6 +640,7 @@ namespace SoF for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -649,9 +649,10 @@ namespace SoF for (int i = 0; i < 9; ++i) { ServerToSoFTextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -660,9 +661,10 @@ namespace SoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 52b849176..500e5f128 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -492,7 +492,6 @@ namespace Titanium unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -500,6 +499,7 @@ namespace Titanium for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -508,9 +508,10 @@ namespace Titanium for (int i = 0; i < 9; ++i) { ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -519,9 +520,10 @@ namespace Titanium VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 426d70ef0..5a07fed7e 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -790,7 +790,6 @@ namespace Underfoot unsigned char *__emu_buffer = in->pBuffer; - uint32 old_message_size = in->size - sizeof(FormattedMessage_Struct); std::string old_message_array[9]; char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); @@ -798,6 +797,7 @@ namespace Underfoot for (int i = 0; i < 9; ++i) { old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; + if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; @@ -806,9 +806,10 @@ namespace Underfoot for (int i = 0; i < 9; ++i) { ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]); new_message_size += (new_message_array[i].length() + 1); + if (new_message_array[i].length() == 0) { break; } } - in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; + in->size = sizeof(FormattedMessage_Struct) + new_message_size; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -817,9 +818,10 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->string_id); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); - for (int i = 0; i < 9; ++i) { VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } - - VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + for (int i = 0; i < 9; ++i) { + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); + if (new_message_array[i].length() == 0) { break; } + } delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); diff --git a/zone/client.cpp b/zone/client.cpp index d8c24d1ba..55775943c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2813,7 +2813,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message if (GetFilter(FilterDamageShields) == FilterHide && type == MT_DS) return; - int i, argcount, length; + int i = 0, argcount = 0, length = 0; char *bufptr; const char *message_arg[9] = {0}; @@ -2826,7 +2826,6 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message return; } - i = 0; message_arg[i++] = message1; message_arg[i++] = message2; message_arg[i++] = message3; @@ -2837,10 +2836,13 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message message_arg[i++] = message8; message_arg[i++] = message9; - for(argcount = length = 0; message_arg[argcount]; argcount++) + for(; message_arg[argcount]; ++argcount) length += strlen(message_arg[argcount]) + 1; - EQApplicationPacket* outapp = new EQApplicationPacket(OP_FormattedMessage, length+13); + if (length == 0) + length = 1; + + EQApplicationPacket* outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; fm->string_id = string_id; fm->type = type; @@ -2851,6 +2853,8 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message bufptr += strlen(message_arg[i]) + 1; } + if (argcount == 0) + bufptr = '\0'; if(distance>0) entity_list.QueueCloseClients(this,outapp,false,distance); @@ -2925,7 +2929,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil if (!FilteredMessageCheck(sender, filter)) return; - int i, argcount, length; + int i = 0, argcount = 0, length = 0; char *bufptr; const char *message_arg[9] = {0}; @@ -2937,7 +2941,6 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil return; } - i = 0; message_arg[i++] = message1; message_arg[i++] = message2; message_arg[i++] = message3; @@ -2948,10 +2951,13 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil message_arg[i++] = message8; message_arg[i++] = message9; - for (argcount = length = 0; message_arg[argcount]; argcount++) + for (; message_arg[argcount]; ++argcount) length += strlen(message_arg[argcount]) + 1; - EQApplicationPacket *outapp = new EQApplicationPacket(OP_FormattedMessage, length+13); + if (length == 0) + length = 1; + + EQApplicationPacket *outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; fm->string_id = string_id; fm->type = type; @@ -2961,6 +2967,9 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil bufptr += strlen(message_arg[i]) + 1; } + if (argcount == 0) + bufptr = '\0'; + QueuePacket(outapp); safe_delete(outapp); } From 489f24a80ac20c916432b73fc50cd993234ef075 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 02:16:57 -0600 Subject: [PATCH 0837/1883] Preliminary addition of log settings map --- common/eqemu_logsys.cpp | 24 +++++++++++------------- common/eqemu_logsys.h | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index c7e8d300f..632eed4da 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -69,19 +69,12 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Command", "Crash", "Save", - /* - "UCS", - "Query Server", - "Socket Server", - "Spawns", - "AI", - "Pathing", - "Quests", - "Spells", - "Zone", - "Tasks", - "Trading", - */ +}; + +static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { + "Netcode", + "Guilds", + "Rules", }; static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { @@ -96,6 +89,11 @@ static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { EQEmuLogSys::EQEmuLogSys(){ + // LogSettings log_settings; + for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ + log_settings[i].log_to_console = 1; + std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; + } std::cout << "I AM CONSTRUCTING!!!! LUL " << std::endl; } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 746689920..2e0b8c0a4 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -46,6 +46,13 @@ public: Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; + enum LogCategory { + Netcode = 0, + Guilds, + Rules, + MaxCategoryID /* Don't Remove this*/ + }; + void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); void Log(uint16 log_type, const std::string message, ...); @@ -55,6 +62,14 @@ public: void SetCurrentTimeStamp(char* time_stamp); void StartZoneLogs(const std::string log_name); + struct LogSettings{ + uint8 log_to_file; + uint8 log_to_console; + uint8 log_to_gmsay; + }; + + LogSettings log_settings[EQEmuLogSys::LogCategory::MaxCategoryID]; + private: bool zone_general_init = false; From 2e397b1383e2e1bc403f48a6ae3a7ebca974c90f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 05:14:46 -0600 Subject: [PATCH 0838/1883] static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] enum LogCategory --- common/eqemu_logsys.cpp | 71 ++++++++++++++++++++++++++++------------- common/eqemu_logsys.h | 23 +++++++++++-- 2 files changed, 70 insertions(+), 24 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 632eed4da..e2324fdf7 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -20,6 +20,7 @@ #include "eqemu_logsys.h" #include "string_util.h" #include "rulesys.h" +#include "platform.h" #include #include @@ -61,45 +62,68 @@ namespace Console { } static const char* TypeNames[EQEmuLogSys::MaxLogID] = { - "Status", - "Normal", - "Error", - "Debug", - "Quest", - "Command", - "Crash", - "Save", + "Status", + "Normal", + "Error", + "Debug", + "Quest", + "Command", + "Crash", + "Save", }; +/* If you add to this, make sure you update LogCategory in eqemu_logsys.h */ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { + "Zone", + "World", + "UCS", + "QueryServer", + "WebInterface", + "AA", + "Doors", + "Guild", + "Inventory", "Netcode", - "Guilds", + "Object", "Rules", + "Skills", + "Spawns", + "Spells", + "Tasks", + "Trading", + "Tribute", }; static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { - Console::Color::Yellow, // "Status", - Console::Color::Yellow, // "Normal", - Console::Color::LightRed, // "Error", - Console::Color::LightGreen, // "Debug", - Console::Color::LightCyan, // "Quest", - Console::Color::LightMagenta, // "Command", - Console::Color::LightRed // "Crash" + Console::Color::Yellow, // "Status", + Console::Color::Yellow, // "Normal", + Console::Color::LightRed, // "Error", + Console::Color::LightGreen, // "Debug", + Console::Color::LightCyan, // "Quest", + Console::Color::LightMagenta, // "Command", + Console::Color::LightRed // "Crash" }; EQEmuLogSys::EQEmuLogSys(){ - // LogSettings log_settings; - for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ - log_settings[i].log_to_console = 1; - std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; - } - std::cout << "I AM CONSTRUCTING!!!! LUL " << std::endl; } EQEmuLogSys::~EQEmuLogSys(){ } +void EQEmuLogSys::LoadLogSettings() +{ + log_platform = GetExecutablePlatformInt(); + std::cout << "PLATFORM " << log_platform << std::endl; + for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ + log_settings[i].log_to_console = 1; + log_settings[i].log_to_file = 1; + log_settings[i].log_to_gmsay = 1; + std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; + } + log_settings_loaded = true; +} + void EQEmuLogSys::StartZoneLogs(const std::string log_name) { EQEmuLogSys::MakeDirectory("logs/zone"); @@ -149,6 +173,9 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { + if (!log_settings_loaded){ + EQEmuLogSys::LoadLogSettings(); + } if (log_type > EQEmuLogSys::MaxLogID){ return; } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2e0b8c0a4..eaa30f374 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -46,10 +46,26 @@ public: Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; + /* If you add to this, make sure you update LogCategoryName in eqemu_logsys.cpp */ enum LogCategory { - Netcode = 0, - Guilds, + Zone_Server = 0, + World_Server, + UCS_Server, + QS_Server, + WebInterface_Server, + AA, + Doors, + Guild, + Inventory, + Netcode, + Object, Rules, + Skills, + Spawns, + Spells, + Tasks, + Trading, + Tribute, MaxCategoryID /* Don't Remove this*/ }; @@ -61,6 +77,7 @@ public: void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartZoneLogs(const std::string log_name); + void LoadLogSettings(); struct LogSettings{ uint8 log_to_file; @@ -69,6 +86,8 @@ public: }; LogSettings log_settings[EQEmuLogSys::LogCategory::MaxCategoryID]; + bool log_settings_loaded = false; + int log_platform = 0; private: bool zone_general_init = false; From fac1361d36df1f5a8c15ef0847d22f388b59bc2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 05:15:31 -0600 Subject: [PATCH 0839/1883] logger.LoadLogSettings() added after each platform executable registry Added int return for platform executable --- client_files/export/main.cpp | 1 + client_files/import/main.cpp | 1 + common/platform.cpp | 3 +++ common/platform.h | 1 + eqlaunch/eqlaunch.cpp | 1 + queryserv/queryserv.cpp | 1 + shared_memory/main.cpp | 1 + ucs/ucs.cpp | 1 + world/net.cpp | 3 +++ zone/net.cpp | 3 ++- 10 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index d76ae12cd..550446cb2 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -35,6 +35,7 @@ void ExportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientExport); + logger.LoadLogSettings(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Client Files Export Utility"); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 7e1eb7557..381889d93 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -33,6 +33,7 @@ void ImportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientImport); + logger.LoadLogSettings(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Client Files Import Utility"); diff --git a/common/platform.cpp b/common/platform.cpp index 1a7b2ed7f..4955d6639 100644 --- a/common/platform.cpp +++ b/common/platform.cpp @@ -10,3 +10,6 @@ const EQEmuExePlatform& GetExecutablePlatform() { return exe_platform; } +int GetExecutablePlatformInt(){ + return exe_platform; +} \ No newline at end of file diff --git a/common/platform.h b/common/platform.h index 7eaae045b..281402291 100644 --- a/common/platform.h +++ b/common/platform.h @@ -18,5 +18,6 @@ enum EQEmuExePlatform void RegisterExecutablePlatform(EQEmuExePlatform p); const EQEmuExePlatform& GetExecutablePlatform(); +int GetExecutablePlatformInt(); #endif diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 5ddcfefdd..89e2b0670 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -39,6 +39,7 @@ void CatchSignal(int sig_num); int main(int argc, char *argv[]) { RegisterExecutablePlatform(ExePlatformLaunch); + logger.LoadLogSettings(); set_exception_handler(); std::string launcher_name; diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index ce64b646b..fa52a11f5 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -50,6 +50,7 @@ void CatchSignal(int sig_num) { int main() { RegisterExecutablePlatform(ExePlatformQueryServ); + logger.LoadLogSettings(); set_exception_handler(); Timer LFGuildExpireTimer(60000); Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index c7d9f2e42..333d5789c 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -37,6 +37,7 @@ EQEmuLogSys logger; int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); + logger.LoadLogSettings(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index ad3af0379..2024bf155 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -69,6 +69,7 @@ std::string GetMailPrefix() { int main() { RegisterExecutablePlatform(ExePlatformUCS); + logger.LoadLogSettings(); set_exception_handler(); // Check every minute for unused channels we can delete diff --git a/world/net.cpp b/world/net.cpp index c75dbe04b..3977f482b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -105,12 +105,15 @@ uint32 numclients = 0; uint32 numzones = 0; bool holdzones = false; +EQEmuLogSys logger; + extern ConsoleList console_list; void CatchSignal(int sig_num); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); + logger.LoadLogSettings(); set_exception_handler(); /* Database Version Check */ diff --git a/zone/net.cpp b/zone/net.cpp index 2ab8a0e2e..95b7f1396 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -17,6 +17,7 @@ */ #define DONT_SHARED_OPCODES +#define PLATFORM_ZONE 1 #include "../common/debug.h" #include "../common/features.h" @@ -42,7 +43,6 @@ #include "../common/memory_mapped_file.h" #include "../common/eqemu_exception.h" #include "../common/spdat.h" - #include "../common/eqemu_logsys.h" #include "zone_config.h" @@ -114,6 +114,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); + logger.LoadLogSettings(); set_exception_handler(); const char *zone_name; From 08a23265f8cd86489181f6e4aefb916c4d565ed7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 12:37:33 -0600 Subject: [PATCH 0840/1883] Make some log functions less process specific in naming --- common/eqemu_logsys.cpp | 21 ++++++++++++--------- common/eqemu_logsys.h | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index e2324fdf7..1d1a732af 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -115,6 +115,7 @@ void EQEmuLogSys::LoadLogSettings() { log_platform = GetExecutablePlatformInt(); std::cout << "PLATFORM " << log_platform << std::endl; + /* Write defaults */ for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ log_settings[i].log_to_console = 1; log_settings[i].log_to_file = 1; @@ -124,11 +125,13 @@ void EQEmuLogSys::LoadLogSettings() log_settings_loaded = true; } -void EQEmuLogSys::StartZoneLogs(const std::string log_name) +void EQEmuLogSys::StartLogs(const std::string log_name) { - EQEmuLogSys::MakeDirectory("logs/zone"); - std::cout << "Starting Zone Logs..." << std::endl; - process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + std::cout << "Starting Zone Logs..." << std::endl; + EQEmuLogSys::MakeDirectory("logs/zone"); + process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); + } } void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...) @@ -173,9 +176,7 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { - if (!log_settings_loaded){ - EQEmuLogSys::LoadLogSettings(); - } + if (log_type > EQEmuLogSys::MaxLogID){ return; } @@ -240,6 +241,8 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) void EQEmuLogSys::CloseZoneLogs() { - std::cout << "Closing down zone logs..." << std::endl; - process_log.close(); + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + std::cout << "Closing down zone logs..." << std::endl; + process_log.close(); + } } \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index eaa30f374..9a0586f7e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -76,7 +76,7 @@ public: void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); - void StartZoneLogs(const std::string log_name); + void StartLogs(const std::string log_name); void LoadLogSettings(); struct LogSettings{ From d5b24543e84abe121edeb7471b7e73831f651d46 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 12 Jan 2015 14:35:38 -0500 Subject: [PATCH 0841/1883] Added text link translators for OP_TaskDescription (RoF+ -- all clients current) --- changelog.txt | 1 + common/patches/rof.cpp | 52 +++++++++++++++++++++++++++++++----- common/patches/rof2.cpp | 46 +++++++++++++++++++++++++++++++ common/patches/sod.cpp | 6 ++--- common/patches/sof.cpp | 6 ++--- common/patches/titanium.cpp | 2 +- common/patches/underfoot.cpp | 6 ++--- zone/tasks.cpp | 12 ++++----- 8 files changed, 109 insertions(+), 22 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8ad64ad30..656a861e8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 01/12/2015 == Uleat: Fix for OP_FormattedMessage text link server crashes +Uleat: Added text link translators for OP_TaskDescription (RoF+ -- all clients current) == 01/11/2015 == Uleat: Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 2ccac0803..9bf49156f 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3249,16 +3249,55 @@ namespace RoF EQApplicationPacket *in = *p; *p = nullptr; + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + + TaskDescriptionData1_Struct *emu_tdd1 = (TaskDescriptionData1_Struct *)InBuffer; + emu_tdd1->StartTime = (time(nullptr) - emu_tdd1->StartTime); // RoF has elapsed time here rather than start time + + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToRoFTextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+ + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, block_start, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + +#if 0 // original code + EQApplicationPacket *in = *p; + *p = nullptr; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskDescription, in->size + 1); // Set the Write pointer as we don't know what has been done with the packet before we get it. in->SetReadPosition(0); // Copy the header - // - // Server header struct is { uint32; uint32; uint32; uint32; uint8; } - // Yet, we're writing 5 uint32's... that's 17 vs 20 bytes... - // 3 Bytes difference..but, we only increase packet size by 1 byte..something wrong here? -U - // (Tying to add text link translators and can't figure out if '+1' size is a new RoF field or something else) - // for (int i = 0; i < 5; ++i) outapp->WriteUInt32(in->ReadUInt32()); @@ -3278,6 +3317,7 @@ namespace RoF delete in; dest->FastQueuePacket(&outapp, ack_req); +#endif } ENCODE(OP_TaskHistoryReply) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 10798be82..61d09826a 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -3315,6 +3315,51 @@ namespace RoF2 EQApplicationPacket *in = *p; *p = nullptr; + unsigned char *__emu_buffer = in->pBuffer; + + char *InBuffer = (char *)in->pBuffer; + char *block_start = InBuffer; + + InBuffer += sizeof(TaskDescriptionHeader_Struct); + uint32 title_size = strlen(InBuffer) + 1; + InBuffer += title_size; + + TaskDescriptionData1_Struct *emu_tdd1 = (TaskDescriptionData1_Struct *)InBuffer; + emu_tdd1->StartTime = (time(nullptr) - emu_tdd1->StartTime); // RoF2 has elapsed time here rather than start time + + InBuffer += sizeof(TaskDescriptionData1_Struct); + uint32 description_size = strlen(InBuffer) + 1; + InBuffer += description_size; + InBuffer += sizeof(TaskDescriptionData2_Struct); + + std::string old_message = InBuffer; // start 'Reward' as string + std::string new_message; + ServerToRoF2TextLink(new_message, old_message); + + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+ + title_size + description_size + new_message.length() + 1; + + in->pBuffer = new unsigned char[in->size]; + + char *OutBuffer = (char *)in->pBuffer; + + memcpy(OutBuffer, block_start, (InBuffer - block_start)); + OutBuffer += (InBuffer - block_start); + + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); + + InBuffer += strlen(InBuffer) + 1; + + memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); + + delete[] __emu_buffer; + dest->FastQueuePacket(&in, ack_req); + +#if 0 // original code + EQApplicationPacket *in = *p; + *p = nullptr; + EQApplicationPacket *outapp = new EQApplicationPacket(OP_TaskDescription, in->size + 1); // Set the Write pointer as we don't know what has been done with the packet before we get it. in->SetReadPosition(0); @@ -3338,6 +3383,7 @@ namespace RoF2 delete in; dest->FastQueuePacket(&outapp, ack_req); +#endif } ENCODE(OP_TaskHistoryReply) diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 3938e238f..7e4059414 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2201,15 +2201,15 @@ namespace SoD std::string new_message; ServerToSoDTextLink(new_message, old_message); - in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ - sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+ title_size + description_size + new_message.length() + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; - memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + memcpy(OutBuffer, block_start, (InBuffer - block_start)); OutBuffer += (InBuffer - block_start); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index a9c5c0ea2..942e36581 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1800,15 +1800,15 @@ namespace SoF std::string new_message; ServerToSoFTextLink(new_message, old_message); - in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ - sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+ title_size + description_size + new_message.length() + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; - memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + memcpy(OutBuffer, block_start, (InBuffer - block_start)); OutBuffer += (InBuffer - block_start); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 500e5f128..c51f6b078 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1258,7 +1258,7 @@ namespace Titanium char *OutBuffer = (char *)in->pBuffer; - memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + memcpy(OutBuffer, block_start, (InBuffer - block_start)); OutBuffer += (InBuffer - block_start); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 5a07fed7e..9f595a8e3 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2467,15 +2467,15 @@ namespace Underfoot std::string new_message; ServerToUnderfootTextLink(new_message, old_message); - in->size = sizeof(TaskDescriptionHeader_Struct)+sizeof(TaskDescriptionData1_Struct)+ - sizeof(TaskDescriptionData2_Struct)+sizeof(TaskDescriptionTrailer_Struct)+ + in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+ + sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+ title_size + description_size + new_message.length() + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; - memcpy(OutBuffer, (char *)__emu_buffer, (InBuffer - block_start)); + memcpy(OutBuffer, block_start, (InBuffer - block_start)); OutBuffer += (InBuffer - block_start); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index d6f285de6..431a7554c 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2756,7 +2756,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN + sizeof(TaskDescriptionData1_Struct) + strlen(Tasks[TaskID]->Description) + 1 + sizeof(TaskDescriptionData2_Struct) + 1 + sizeof(TaskDescriptionTrailer_Struct); - std::string RewardText; + std::string reward_text; int ItemID = NOT_USED; // If there is an item make the Reward text into a link to the item (only the first item if a list @@ -2784,17 +2784,17 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN linker.SetProxyText(Tasks[TaskID]->Reward); auto reward_link = linker.GenerateLink(); - RewardText += reward_link.c_str(); + reward_text.append(reward_link); } else { - RewardText += Tasks[TaskID]->Reward; + reward_text.append(Tasks[TaskID]->Reward); } } else { - RewardText += Tasks[TaskID]->Reward; + reward_text.append(Tasks[TaskID]->Reward); } - PacketLength += strlen(RewardText.c_str()) + 1; + PacketLength += reward_text.length() + 1; char *Ptr; TaskDescriptionHeader_Struct* tdh; @@ -2850,7 +2850,7 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN tdd2->unknown3 = 0x0000; Ptr = (char *) tdd2 + sizeof(TaskDescriptionData2_Struct); - sprintf(Ptr, "%s", RewardText.c_str()); + sprintf(Ptr, "%s", reward_text.c_str()); Ptr = Ptr + strlen(Ptr) + 1; tdt = (TaskDescriptionTrailer_Struct*)Ptr; From a6148565e5b4b0b4c5d2b06fb0cbcc2606fd7071 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 12 Jan 2015 15:53:33 -0500 Subject: [PATCH 0842/1883] Fix for load_bots.sql using '\\' as a delimiter (Changed to '$$') --- changelog.txt | 1 + utils/sql/git/bots/deprecated/load_bots_old.sql | 4 ++-- utils/sql/git/bots/load_bots.sql | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 656a861e8..54c7478a2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) == 01/12/2015 == Uleat: Fix for OP_FormattedMessage text link server crashes Uleat: Added text link translators for OP_TaskDescription (RoF+ -- all clients current) +Uleat: Fix for load_bots.sql using '\\' as a delimiter (Changed to '$$') == 01/11/2015 == Uleat: Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work) diff --git a/utils/sql/git/bots/deprecated/load_bots_old.sql b/utils/sql/git/bots/deprecated/load_bots_old.sql index 44d1c1b90..5d88a8088 100644 --- a/utils/sql/git/bots/deprecated/load_bots_old.sql +++ b/utils/sql/git/bots/deprecated/load_bots_old.sql @@ -194,7 +194,7 @@ CREATE TABLE `botguildmembers` ( PRIMARY KEY (`char_id`) ) ENGINE=InnoDB; -DELIMITER // +DELIMITER $$ CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1) BEGIN @@ -209,7 +209,7 @@ BEGIN END IF; RETURN Result; -END// +END$$ DELIMITER ; diff --git a/utils/sql/git/bots/load_bots.sql b/utils/sql/git/bots/load_bots.sql index 9957b882a..0dd030545 100644 --- a/utils/sql/git/bots/load_bots.sql +++ b/utils/sql/git/bots/load_bots.sql @@ -194,7 +194,7 @@ CREATE TABLE `botguildmembers` ( PRIMARY KEY (`char_id`) ) ENGINE=InnoDB; -DELIMITER \\ +DELIMITER $$ CREATE FUNCTION `GetMobType` (mobname VARCHAR(64)) RETURNS CHAR(1) BEGIN @@ -209,7 +209,7 @@ BEGIN END IF; RETURN Result; -END\\ +END$$ DELIMITER ; From 5cb2b146450d11dc60bd7304a7972e503749a42e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Mon, 12 Jan 2015 16:57:41 -0500 Subject: [PATCH 0843/1883] Fix issue with SharedDatabase::LoadCharacterInspectMessage --- common/shareddb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c036fb5de..42aeebfea 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1979,7 +1979,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id); auto results = QueryDatabase(query); auto row = results.begin(); - memcpy(message, "", sizeof(InspectMessage_Struct)); + memset(message, '\0', sizeof(InspectMessage_Struct)); for (auto row = results.begin(); row != results.end(); ++row) { memcpy(message, row[0], sizeof(InspectMessage_Struct)); } From 9d355f0f990b340ba033919ac009cbe0db3ec50f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 20:11:23 -0600 Subject: [PATCH 0844/1883] Add zone callback for client messages so log messages can be piped to it --- common/eqemu_logsys.cpp | 6 +++++- common/eqemu_logsys.h | 7 ++++++- zone/client_logs.cpp | 5 +++++ zone/client_logs.h | 1 + zone/net.cpp | 2 ++ zone/zone.cpp | 2 +- 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 1d1a732af..1d0af0bb4 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -106,6 +106,7 @@ static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { EQEmuLogSys::EQEmuLogSys(){ + on_log_gmsay_hook = [](uint16 log_type, std::string&) {}; } EQEmuLogSys::~EQEmuLogSys(){ @@ -154,7 +155,6 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } @@ -191,6 +191,10 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + on_log_gmsay_hook(output_message); + } + EQEmuLogSys::ConsoleMessage(log_type, output_message); char time_stamp[80]; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 9a0586f7e..037a06feb 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -21,6 +21,9 @@ #include #include +#include +#include + #include "types.h" class EQEmuLogSys { @@ -89,9 +92,11 @@ public: bool log_settings_loaded = false; int log_platform = 0; + void OnLogHookCallBack(std::function f) { on_log_gmsay_hook = f; } + private: bool zone_general_init = false; - + std::function on_log_gmsay_hook; }; extern EQEmuLogSys logger; diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 4aba31159..f2ead3a59 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -21,6 +21,7 @@ #ifdef CLIENT_LOGS #include "client_logs.h" #include "client.h" +#include "entity.h" #include ClientLogs client_logs; @@ -134,6 +135,10 @@ void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char client_logs.msg(id, _buffer); } +void ClientLogs::ClientMessage(uint16 log_type, std::string& message){ + entity_list.MessageStatus(0, 80, 7, "%s", message.c_str()); +} + #endif //CLIENT_LOGS diff --git a/zone/client_logs.h b/zone/client_logs.h index 4db83a6b1..547c49641 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -46,6 +46,7 @@ public: void clear(); //unsubscribes everybody void msg(EQEmuLog::LogIDs id, const char *buf); + static void ClientMessage(uint16 log_type, std::string& message); protected: diff --git a/zone/net.cpp b/zone/net.cpp index 95b7f1396..601a598e5 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -45,6 +45,7 @@ #include "../common/spdat.h" #include "../common/eqemu_logsys.h" +#include "client_logs.h" #include "zone_config.h" #include "masterentity.h" #include "worldserver.h" @@ -115,6 +116,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); logger.LoadLogSettings(); + logger.OnLog(&ClientLogs::ClientMessage); set_exception_handler(); const char *zone_name; diff --git a/zone/zone.cpp b/zone/zone.cpp index 9c00d23cb..98eb41ee3 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -152,7 +152,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { /* Set Logging */ - logger.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + logger.StartLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; } From e84cebe3754addb5aec91d20a56f5aef0de88097 Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 12 Jan 2015 21:15:12 -0500 Subject: [PATCH 0845/1883] Changed OP_FormattedMessage code to eliminate possible oob error --- common/patches/rof.cpp | 17 ++++++++++------- common/patches/rof2.cpp | 17 ++++++++++------- common/patches/sod.cpp | 17 ++++++++++------- common/patches/sof.cpp | 17 ++++++++++------- common/patches/titanium.cpp | 17 ++++++++++------- common/patches/underfoot.cpp | 17 ++++++++++------- zone/client.cpp | 16 ++++++---------- 7 files changed, 66 insertions(+), 52 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 9bf49156f..3346a7823 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -877,26 +877,27 @@ namespace RoF unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToRoFTextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToRoFTextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -906,10 +907,12 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 61d09826a..db48d231d 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -943,26 +943,27 @@ namespace RoF2 unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToRoF2TextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToRoF2TextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -972,10 +973,12 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 7e4059414..7a118abb0 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -646,26 +646,27 @@ namespace SoD unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToSoDTextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToSoDTextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -675,10 +676,12 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 942e36581..8040d2287 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -633,26 +633,27 @@ namespace SoF unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToSoFTextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToSoFTextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -662,10 +663,12 @@ namespace SoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index c51f6b078..187ac0bdf 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -492,26 +492,27 @@ namespace Titanium unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -521,10 +522,12 @@ namespace Titanium VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 9f595a8e3..ea31aa68f 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -790,26 +790,27 @@ namespace Underfoot unsigned char *__emu_buffer = in->pBuffer; + char *old_message_ptr = (char *)in->pBuffer; + old_message_ptr += sizeof(FormattedMessage_Struct); + std::string old_message_array[9]; - char *old_message_ptr = (char *)__emu_buffer + sizeof(FormattedMessage_Struct); - for (int i = 0; i < 9; ++i) { + if (*old_message_ptr == 0) { break; } old_message_array[i] = old_message_ptr; old_message_ptr += old_message_array[i].length() + 1; - if (old_message_array[i].length() == 0) { break; } } uint32 new_message_size = 0; std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]); - new_message_size += (new_message_array[i].length() + 1); if (new_message_array[i].length() == 0) { break; } + ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]); + new_message_size += new_message_array[i].length() + 1; } - in->size = sizeof(FormattedMessage_Struct) + new_message_size; + in->size = sizeof(FormattedMessage_Struct) + new_message_size + 1; in->pBuffer = new unsigned char[in->size]; char *OutBuffer = (char *)in->pBuffer; @@ -819,10 +820,12 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, emu->type); for (int i = 0; i < 9; ++i) { - VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); if (new_message_array[i].length() == 0) { break; } + VARSTRUCT_ENCODE_STRING(OutBuffer, new_message_array[i].c_str()); } + VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0); + delete[] __emu_buffer; dest->FastQueuePacket(&in, ack_req); } diff --git a/zone/client.cpp b/zone/client.cpp index 55775943c..adaa7ce2f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2814,7 +2814,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message return; int i = 0, argcount = 0, length = 0; - char *bufptr; + char *bufptr = nullptr; const char *message_arg[9] = {0}; if(type==MT_Emote) @@ -2839,8 +2839,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message for(; message_arg[argcount]; ++argcount) length += strlen(message_arg[argcount]) + 1; - if (length == 0) - length = 1; + length += 1; EQApplicationPacket* outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; @@ -2853,8 +2852,7 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message bufptr += strlen(message_arg[i]) + 1; } - if (argcount == 0) - bufptr = '\0'; + bufptr = '\0'; if(distance>0) entity_list.QueueCloseClients(this,outapp,false,distance); @@ -2930,7 +2928,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil return; int i = 0, argcount = 0, length = 0; - char *bufptr; + char *bufptr = nullptr; const char *message_arg[9] = {0}; if (type == MT_Emote) @@ -2954,8 +2952,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil for (; message_arg[argcount]; ++argcount) length += strlen(message_arg[argcount]) + 1; - if (length == 0) - length = 1; + length += 1; EQApplicationPacket *outapp = new EQApplicationPacket(OP_FormattedMessage, sizeof(FormattedMessage_Struct) + length); FormattedMessage_Struct *fm = (FormattedMessage_Struct *)outapp->pBuffer; @@ -2967,8 +2964,7 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil bufptr += strlen(message_arg[i]) + 1; } - if (argcount == 0) - bufptr = '\0'; + bufptr = '\0'; QueuePacket(outapp); safe_delete(outapp); From b1939aaa3eb0934f4e35ded0c567b4d73fca9004 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 20:58:17 -0600 Subject: [PATCH 0846/1883] Remove Save from LogTypes --- common/eqemu_logsys.cpp | 4 ++-- common/eqemu_logsys.h | 5 ++--- zone/net.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 1d0af0bb4..73317e525 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -69,7 +69,6 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Quest", "Command", "Crash", - "Save", }; /* If you add to this, make sure you update LogCategory in eqemu_logsys.h */ @@ -155,6 +154,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); + EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } @@ -192,7 +192,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) va_end(args); if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - on_log_gmsay_hook(output_message); + on_log_gmsay_hook(log_type, output_message); } EQEmuLogSys::ConsoleMessage(log_type, output_message); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 037a06feb..8d577bfc1 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -39,7 +39,6 @@ public: Quest, /* Quest Logs */ Commands, /* Issued Commands */ Crash, /* Crash Logs */ - Save, /* Client Saves */ MaxLogID /* Max, used in functions to get the max log ID */ }; @@ -74,13 +73,13 @@ public: void CloseZoneLogs(); void ConsoleMessage(uint16 log_type, const std::string message); + void LoadLogSettings(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartLogs(const std::string log_name); - void LoadLogSettings(); struct LogSettings{ uint8 log_to_file; @@ -92,7 +91,7 @@ public: bool log_settings_loaded = false; int log_platform = 0; - void OnLogHookCallBack(std::function f) { on_log_gmsay_hook = f; } + void OnLogHookCallBackZone(std::function f) { on_log_gmsay_hook = f; } private: bool zone_general_init = false; diff --git a/zone/net.cpp b/zone/net.cpp index 601a598e5..c10c2b00c 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -116,7 +116,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); logger.LoadLogSettings(); - logger.OnLog(&ClientLogs::ClientMessage); + logger.OnLogHookCallBackZone(&ClientLogs::ClientMessage); set_exception_handler(); const char *zone_name; From 4811631127f98dc12951413e6f50d32eed920c59 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 21:19:19 -0600 Subject: [PATCH 0847/1883] Convert _log from TASKS category --- zone/entity.cpp | 2 +- zone/net.cpp | 2 +- zone/questmgr.cpp | 2 +- zone/tasks.cpp | 180 +++++++++++++++++++++---------------------- zone/worldserver.cpp | 14 ++-- 5 files changed, 100 insertions(+), 100 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index ccc74629c..1854f83bf 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - _log(TASKS__CLIENTLOAD, "Reloading Task State For Client %s", client->GetName()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/net.cpp b/zone/net.cpp index c10c2b00c..39cc24b96 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -294,7 +294,7 @@ int main(int argc, char** argv) { } if(RuleB(TaskSystem, EnableTaskSystem)) { - _log(ZONE__INIT, "Loading Tasks"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index bdc1ecb6f..50e722d8d 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - _log(TASKS__UPDATE, "TaskSetSelector called for task set %i", tasksetid); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 3433842b2..67f137d64 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - _log(TASKS__GLOBALLOAD, "Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - _log(TASKS__GLOBALLOAD, "TaskManager::LoadSingleTask(%i)", TaskID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -121,7 +121,7 @@ void TaskManager::ReloadGoalLists() { bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - _log(TASKS__GLOBALLOAD, "TaskManager::LoadTasks Called"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - _log(TASKS__GLOBALLOAD,"TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - _log(TASKS__GLOBALLOAD,"Title: %s ", Tasks[taskID]->Title); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - _log(TASKS__GLOBALLOAD, "Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - _log(TASKS__GLOBALLOAD, " Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - _log(TASKS__GLOBALLOAD, " Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - _log(TASKS__GLOBALLOAD, " Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -316,7 +316,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[task].Updated) { - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,7 +358,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - _log(TASKS__CLIENTSAVE, "Executing query %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - _log(TASKS__CLIENTSAVE, "TaskManager::SaveClientState Saving Completed Task at slot %i", i); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -459,7 +459,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState for character ID %d", characterID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - _log(TASKS__CLIENTLOAD, "LoadClientState. Loading activities for character ID %d", characterID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - _log(TASKS__CLIENTLOAD, "TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -639,7 +639,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - _log(TASKS__CLIENTLOAD, "Adding TaskID %i to enabled tasks", taskID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - _log(TASKS__CLIENTLOAD, "LoadClientState for Character ID %d DONE!", characterID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - _log(TASKS__UPDATE, "New enabled task list "); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - _log(TASKS__UPDATE, "TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - _log(TASKS__UPDATE, "TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - _log(TASKS__UPDATE, "Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - _log(TASKS__UPDATE, "TaskSelector for %i Tasks", TaskCount); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - _log(TASKS__UPDATE, "TaskSelector for %i Tasks", TaskCount); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,7 +1275,7 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - _log(TASKS__UPDATE, "DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); @@ -1284,7 +1284,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { return; } - _log(TASKS__UPDATE, "Delete query %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - _log(TASKS__UPDATE, "CharID: %i Task: %i Sequence mode is %i", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - _log(TASKS__UPDATE, "KeepOneRecord enabled"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - _log(TASKS__UPDATE, "Erased Element count is %i", ErasedElements); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - _log(TASKS__UPDATE, "Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - _log(TASKS__UPDATE, "Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - _log(TASKS__UPDATE, "KeepOneRecord enabled"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - _log(TASKS__UPDATE, "Erased Element count is %i", ErasedElements); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - _log(TASKS__UPDATE, "ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - _log(TASKS__UPDATE, "Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - _log(TASKS__UPDATE, "Calling increment done count ByNPC"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - _log(TASKS__UPDATE, "ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - _log(TASKS__UPDATE, "Char: %s Activity type %i for Item %i failed zone check", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - _log(TASKS__UPDATE, "Calling increment done count ForItem"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - _log(TASKS__UPDATE, "ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - _log(TASKS__UPDATE, "Char: %s Explore exploreid %i failed zone check", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - _log(TASKS__UPDATE, "Increment on explore"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - _log(TASKS__UPDATE, "ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - _log(TASKS__UPDATE, "Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - _log(TASKS__UPDATE, "Increment on GiveCash"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - _log(TASKS__UPDATE, "Increment on GiveItem"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - _log(TASKS__UPDATE, "ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - _log(TASKS__UPDATE, "Char: %s Touch activity failed zone check", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - _log(TASKS__UPDATE, "Increment on Touch"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - _log(TASKS__UPDATE, "IncrementDoneCount"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - _log(TASKS__UPDATE, "Done (%i) = Goal (%i) for Activity %i", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - _log(TASKS__UPDATE, "TaskCompleted is %i", TaskComplete); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - _log(TASKS__UPDATE, "FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - _log(TASKS__UPDATE, "ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - _log(TASKS__UPDATE, "ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - _log(TASKS__UPDATE, "Increment done count on UpdateTaskActivity"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - _log(TASKS__UPDATE, "ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - _log(TASKS__UPDATE, "ResetTaskActivityCount"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - _log(TASKS__UPDATE, "TaskFailed"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - _log(TASKS__UPDATE, "Completed Task Count: %i, First Task to send is %i, Last is %i", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - _log(TASKS__UPDATE, "SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - _log(TASKS__UPDATE, " Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - _log(TASKS__UPDATE, " Short: %i, %i, %i", TaskID, Activity, TaskIndex); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - _log(TASKS__UPDATE, "SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - _log(TASKS__UPDATE, " Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - _log(TASKS__UPDATE, " Short: %i, %i, %i", TaskID, Activity, TaskIndex); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - _log(TASKS__UPDATE, "CancelTask"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,24 +2932,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - _log(TASKS__UPDATE, "ClientTaskState Cancel Task %i ", sequenceNumber); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - _log(TASKS__UPDATE, "CancelTask: %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - _log(TASKS__PROXIMITY, "Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - _log(TASKS__GLOBALLOAD, "TaskGoalListManager::LoadLists Called"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3093,7 +3093,7 @@ bool TaskGoalListManager::LoadLists() { } NumberOfLists = results.RowCount(); - _log(TASKS__GLOBALLOAD, "Database returned a count of %i lists", NumberOfLists); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - _log(TASKS__UPDATE, "TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - _log(TASKS__UPDATE, "TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - _log(TASKS__GLOBALLOAD, "TaskProximityManager::LoadProximities Called for zone %i", zoneID); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - _log(TASKS__PROXIMITY, "Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 2e1c2e699..68ebb51fc 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - _log(TASKS__GLOBALLOAD, "Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - _log(TASKS__GLOBALLOAD, "Reload ALL tasks"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - _log(TASKS__GLOBALLOAD, "Reload only task %i", rts->Parameter); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - _log(TASKS__GLOBALLOAD, "Reload task proximities"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - _log(TASKS__GLOBALLOAD, "Reload task goal lists"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - _log(TASKS__GLOBALLOAD, "Reload task sets"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - _log(TASKS__GLOBALLOAD, "Unhandled ServerOP_ReloadTasks command %i", rts->Command); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } From 390681e0d0e7453966477bf6ed23c5d85b9e4fbf Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 12 Jan 2015 22:26:33 -0500 Subject: [PATCH 0848/1883] Fix for missing names in StringID-based messages --- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/titanium.cpp | 2 +- common/patches/underfoot.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 3346a7823..3ec0565bb 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -892,7 +892,7 @@ namespace RoF std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToRoFTextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index db48d231d..c586fe260 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -958,7 +958,7 @@ namespace RoF2 std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToRoF2TextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 7a118abb0..09e219672 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -661,7 +661,7 @@ namespace SoD std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToSoDTextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 8040d2287..07885944a 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -648,7 +648,7 @@ namespace SoF std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToSoFTextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 187ac0bdf..9aa8afad8 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -507,7 +507,7 @@ namespace Titanium std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index ea31aa68f..ba04ea9a7 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -805,7 +805,7 @@ namespace Underfoot std::string new_message_array[9]; for (int i = 0; i < 9; ++i) { - if (new_message_array[i].length() == 0) { break; } + if (old_message_array[i].length() == 0) { break; } ServerToUnderfootTextLink(new_message_array[i], old_message_array[i]); new_message_size += new_message_array[i].length() + 1; } From ffdce868c1aeb3968b4d474af373e29ab35bc7cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 21:45:49 -0600 Subject: [PATCH 0849/1883] Convert netcode debugging _log to logger.LogDebugType --- common/eq_stream.cpp | 14 +++--- common/eq_stream_ident.cpp | 23 +++++----- common/patches/rof.cpp | 89 ++++++++++++++++++------------------ common/patches/rof2.cpp | 89 ++++++++++++++++++------------------ common/patches/sod.cpp | 59 ++++++++++++------------ common/patches/sof.cpp | 29 ++++++------ common/patches/template.cpp | 6 +-- common/patches/titanium.cpp | 23 +++++----- common/patches/underfoot.cpp | 59 ++++++++++++------------ common/struct_strategy.cpp | 5 +- common/worldconn.cpp | 5 +- 11 files changed, 205 insertions(+), 196 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 70e9ab43f..d2326cf7b 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -200,7 +200,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - _log(NET__NET_TRACE, "OP_Packet: Removing older queued packet with sequence %d", seq); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -250,7 +250,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - _log(NET__NET_TRACE, "OP_Fragment: Removing older queued packet with sequence %d", seq); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -960,7 +960,7 @@ EQRawApplicationPacket *p=nullptr; EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); #if EQDEBUG >= 4 if(emu_op == OP_Unknown) { - _log(NET__ERROR, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } #endif p->SetOpcode(emu_op); @@ -1426,19 +1426,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - _log(NET__IDENT_TRACE, "%s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - _log(NET__IDENT_TRACE, "%s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - _log(NET__IDENT_TRACE, "%s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - _log(NET__IDENT_TRACE, "%s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index 97fdd2c48..531a297ad 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -1,4 +1,5 @@ #include "debug.h" +#include "eqemu_logsys.h" #include "eq_stream_ident.h" #include "eq_stream_proxy.h" #include "logsys.h" @@ -45,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - _log(NET__IDENTIFY, "Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -61,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - _log(NET__IDENTIFY, "Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - _log(NET__IDENTIFY, "Stream state was Established"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - _log(NET__IDENTIFY, "Stream state was Closing"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - _log(NET__IDENTIFY, "Stream state was Disconnecting"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - _log(NET__IDENTIFY, "Stream state was Closed"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - _log(NET__IDENTIFY, "Stream state was Unestablished or unknown"); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -102,13 +103,13 @@ void EQStreamIdentifier::Process() { switch(res) { case EQStream::MatchNotReady: //the stream has not received enough packets to compare with this signature -// _log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); +// logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); all_ready = false; break; case EQStream::MatchSuccessful: { //yay, a match. - _log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -122,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - _log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -130,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - _log(NET__IDENTIFY, "Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index f65302c36..32ce8f07d 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "rof.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -51,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -77,7 +78,7 @@ namespace RoF - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -92,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -315,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -550,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -584,13 +585,13 @@ namespace RoF safe_delete_array(Serialized); } else { - _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //_log(NET__ERROR, "Sending inventory to client"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -951,16 +952,16 @@ namespace RoF ENCODE(OP_GroupUpdate) { - //_log(NET__ERROR, "OP_GroupUpdate"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //_log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -978,7 +979,7 @@ namespace RoF return; } //if(gjs->action == groupActLeave) - // _log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -995,19 +996,19 @@ namespace RoF if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //_log(NET__ERROR, "Struct is GroupUpdate2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //_log(NET__ERROR, "Yourname is %s", gu2->yourname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //_log(NET__ERROR, "Membername[%i] is %s", i, gu2->membername[i]); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1015,7 +1016,7 @@ namespace RoF } } - //_log(NET__ERROR, "Leadername is %s", gu2->leadersname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1077,7 +1078,7 @@ namespace RoF return; } - //_log(NET__ERROR, "Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1385,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2555,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - _log(NET__STRUCTS, "Player Profile Packet is %i bytes", outapp->GetWritePosition()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3320,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3653,16 +3654,16 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //_log(NET__STRUCTS, "Spawn packet size is %i, entries = %i", in->size, entrycount); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3901,9 +3902,9 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - _log(NET__ERROR, "SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //_log(NET__ERROR, "Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4297,7 +4298,7 @@ namespace RoF DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_Disband"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4311,7 +4312,7 @@ namespace RoF DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4325,7 +4326,7 @@ namespace RoF DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4339,7 +4340,7 @@ namespace RoF DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupInvite"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4352,7 +4353,7 @@ namespace RoF DECODE(OP_GroupInvite2) { - //_log(NET__ERROR, "Received incoming OP_GroupInvite2. Forwarding"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4496,8 +4497,8 @@ namespace RoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - _log(NET__ERROR, "MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4826,7 +4827,7 @@ namespace RoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //_log(NET__ERROR, "Serialize called for: %s", item->Name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF::structs::ItemSerializationHeader hdr; @@ -4935,7 +4936,7 @@ namespace RoF } ss.write((const char*)&null_term, sizeof(uint8)); - //_log(NET__ERROR, "ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); RoF::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF::structs::ItemBodyStruct)); @@ -5042,7 +5043,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //_log(NET__ERROR, "ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); RoF::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF::structs::ItemSecondaryBodyStruct)); @@ -5083,7 +5084,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //_log(NET__ERROR, "ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); RoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF::structs::ItemTertiaryBodyStruct)); @@ -5122,7 +5123,7 @@ namespace RoF // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //_log(NET__ERROR, "ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); RoF::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF::structs::ClickEffectStruct)); @@ -5149,7 +5150,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //_log(NET__ERROR, "ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); RoF::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF::structs::ProcEffectStruct)); @@ -5173,7 +5174,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //_log(NET__ERROR, "ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); RoF::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF::structs::WornEffectStruct)); @@ -5264,7 +5265,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //_log(NET__ERROR, "ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); RoF::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF::structs::ItemQuaternaryBodyStruct)); @@ -5454,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - _log(NET__ERROR, "Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5495,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - _log(NET__ERROR, "Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5600,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - _log(NET__ERROR, "Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5635,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - _log(NET__ERROR, "Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 03d919dd8..7548dec77 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "rof2.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -51,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -77,7 +78,7 @@ namespace RoF2 - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -92,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -381,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -616,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -650,13 +651,13 @@ namespace RoF2 safe_delete_array(Serialized); } else { - _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //_log(NET__ERROR, "Sending inventory to client"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -1017,16 +1018,16 @@ namespace RoF2 ENCODE(OP_GroupUpdate) { - //_log(NET__ERROR, "OP_GroupUpdate"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //_log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -1044,7 +1045,7 @@ namespace RoF2 return; } //if(gjs->action == groupActLeave) - // _log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -1061,19 +1062,19 @@ namespace RoF2 if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //_log(NET__ERROR, "Struct is GroupUpdate2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //_log(NET__ERROR, "Yourname is %s", gu2->yourname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //_log(NET__ERROR, "Membername[%i] is %s", i, gu2->membername[i]); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1081,7 +1082,7 @@ namespace RoF2 } } - //_log(NET__ERROR, "Leadername is %s", gu2->leadersname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1143,7 +1144,7 @@ namespace RoF2 return; } - //_log(NET__ERROR, "Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1451,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2639,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - _log(NET__STRUCTS, "Player Profile Packet is %i bytes", outapp->GetWritePosition()); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3386,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3720,16 +3721,16 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //_log(NET__STRUCTS, "Spawn packet size is %i, entries = %i", in->size, entrycount); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3972,9 +3973,9 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - _log(NET__ERROR, "SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //_log(NET__ERROR, "Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4369,7 +4370,7 @@ namespace RoF2 DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_Disband"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4383,7 +4384,7 @@ namespace RoF2 DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4397,7 +4398,7 @@ namespace RoF2 DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4411,7 +4412,7 @@ namespace RoF2 DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupInvite"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4424,7 +4425,7 @@ namespace RoF2 DECODE(OP_GroupInvite2) { - //_log(NET__ERROR, "Received incoming OP_GroupInvite2. Forwarding"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4567,8 +4568,8 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //_log(NET__ERROR, "Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - _log(NET__ERROR, "MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4897,7 +4898,7 @@ namespace RoF2 std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //_log(NET__ERROR, "Serialize called for: %s", item->Name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF2::structs::ItemSerializationHeader hdr; @@ -5005,7 +5006,7 @@ namespace RoF2 } ss.write((const char*)&null_term, sizeof(uint8)); - //_log(NET__ERROR, "ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); RoF2::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF2::structs::ItemBodyStruct)); @@ -5112,7 +5113,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //_log(NET__ERROR, "ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); RoF2::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); @@ -5153,7 +5154,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //_log(NET__ERROR, "ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); RoF2::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF2::structs::ItemTertiaryBodyStruct)); @@ -5192,7 +5193,7 @@ namespace RoF2 // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //_log(NET__ERROR, "ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); RoF2::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF2::structs::ClickEffectStruct)); @@ -5219,7 +5220,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //_log(NET__ERROR, "ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); RoF2::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF2::structs::ProcEffectStruct)); @@ -5243,7 +5244,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //_log(NET__ERROR, "ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); RoF2::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF2::structs::WornEffectStruct)); @@ -5334,7 +5335,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //_log(NET__ERROR, "ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); RoF2::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); @@ -5545,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - _log(NET__ERROR, "Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5586,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - _log(NET__ERROR, "Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5695,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - _log(NET__ERROR, "Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5730,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - _log(NET__ERROR, "Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 6982290c8..51992cc68 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "sod.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -49,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -75,7 +76,7 @@ namespace SoD - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -90,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -246,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -358,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -390,13 +391,13 @@ namespace SoD } else { - _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //_log(NET__ERROR, "Sending inventory to client"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -682,16 +683,16 @@ namespace SoD ENCODE(OP_GroupUpdate) { - //_log(NET__ERROR, "OP_GroupUpdate"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //_log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -709,7 +710,7 @@ namespace SoD return; } //if(gjs->action == groupActLeave) - // _log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -726,19 +727,19 @@ namespace SoD if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //_log(NET__ERROR, "Struct is GroupUpdate2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //_log(NET__ERROR, "Yourname is %s", gu2->yourname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //_log(NET__ERROR, "Membername[%i] is %s", i, gu2->membername[i]); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -746,7 +747,7 @@ namespace SoD } } - //_log(NET__ERROR, "Leadername is %s", gu2->leadersname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -806,7 +807,7 @@ namespace SoD return; } - //_log(NET__ERROR, "Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -966,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2107,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2362,16 +2363,16 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //_log(NET__STRUCTS, "Spawn packet size is %i, entries = %i", in->size, entrycount); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -2962,7 +2963,7 @@ namespace SoD DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_Disband"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -2976,7 +2977,7 @@ namespace SoD DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -2990,7 +2991,7 @@ namespace SoD DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3004,7 +3005,7 @@ namespace SoD DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupInvite"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3017,7 +3018,7 @@ namespace SoD DECODE(OP_GroupInvite2) { - //_log(NET__ERROR, "Received incoming OP_GroupInvite2. Forwarding"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3090,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); @@ -3383,7 +3384,7 @@ namespace SoD std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //_log(NET__ERROR, "Serialize called for: %s", item->Name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoD::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 8405f9def..913e300b5 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "sof.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -49,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -75,7 +76,7 @@ namespace SoF - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -90,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -213,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -336,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -370,13 +371,13 @@ namespace SoF } else { - _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //_log(NET__ERROR, "Sending inventory to client"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -765,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1706,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1886,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2095,7 +2096,7 @@ namespace SoF //kill off the emu structure and send the eq packet. delete[] __emu_buffer; - //_log(NET__ERROR, "Sending zone spawns"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawns"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -2428,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); @@ -2707,7 +2708,7 @@ namespace SoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //_log(NET__ERROR, "Serialize called for: %s", item->Name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoF::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/template.cpp b/common/patches/template.cpp index 8c4be992c..5120a2ef2 100644 --- a/common/patches/template.cpp +++ b/common/patches/template.cpp @@ -23,7 +23,7 @@ void Register(EQStreamIdentifier &into) { //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if(!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -55,10 +55,10 @@ void Reload() { opfile += name; opfile += ".conf"; if(!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index f40c0266c..b24021f87 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "titanium.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -47,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -73,7 +74,7 @@ namespace Titanium - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -88,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -186,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -267,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -284,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - _log(NET__STRUCTS, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -634,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1156,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1273,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1622,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 1ebd8dc8d..f896a4c3f 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1,4 +1,5 @@ #include "../debug.h" +#include "../eqemu_logsys.h" #include "underfoot.h" #include "../opcodemgr.h" #include "../logsys.h" @@ -49,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -75,7 +76,7 @@ namespace Underfoot - _log(NET__IDENTIFY, "Registered patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -90,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - _log(NET__OPCODES, "Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - _log(NET__OPCODES, "Reloaded opcodes for patch %s", name); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -306,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -493,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -525,13 +526,13 @@ namespace Underfoot safe_delete_array(Serialized); } else { - _log(NET__ERROR, "Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //_log(NET__ERROR, "Sending inventory to client"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -838,16 +839,16 @@ namespace Underfoot ENCODE(OP_GroupUpdate) { - //_log(NET__ERROR, "OP_GroupUpdate"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //_log(NET__ERROR, "Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //_log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -866,7 +867,7 @@ namespace Underfoot return; } //if(gjs->action == groupActLeave) - // _log(NET__ERROR, "Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -883,19 +884,19 @@ namespace Underfoot if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //_log(NET__ERROR, "Struct is GroupUpdate2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //_log(NET__ERROR, "Yourname is %s", gu2->yourname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //_log(NET__ERROR, "Membername[%i] is %s", i, gu2->membername[i]); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -903,7 +904,7 @@ namespace Underfoot } } - //_log(NET__ERROR, "Leadername is %s", gu2->leadersname); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -963,7 +964,7 @@ namespace Underfoot delete in; return; } - //_log(NET__ERROR, "Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1189,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - _log(NET__STRUCTS, "Serialization failed on item slot %d.", int_struct->slot_id); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2373,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2623,16 +2624,16 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - _log(NET__STRUCTS, "Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //_log(NET__STRUCTS, "Spawn name is [%s]", emu->name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //_log(NET__STRUCTS, "Spawn packet size is %i, entries = %i", in->size, entrycount); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -3275,7 +3276,7 @@ namespace Underfoot DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_Disband"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -3289,7 +3290,7 @@ namespace Underfoot DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3303,7 +3304,7 @@ namespace Underfoot DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupFollow2"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3317,7 +3318,7 @@ namespace Underfoot DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //_log(NET__ERROR, "Received incoming OP_GroupInvite"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3330,7 +3331,7 @@ namespace Underfoot DECODE(OP_GroupInvite2) { - //_log(NET__ERROR, "Received incoming OP_GroupInvite2. Forwarding"); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3405,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - _log(NET__ERROR, "Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); @@ -3628,7 +3629,7 @@ namespace Underfoot std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //_log(NET__ERROR, "Serialize called for: %s", item->Name); + //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); Underfoot::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 9b568b12e..06ab1a5b3 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -1,5 +1,6 @@ #include "debug.h" +#include "eqemu_logsys.h" #include "struct_strategy.h" #include "logsys.h" #include "eq_stream.h" @@ -38,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - _log(NET__STRUCTS, "Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - _log(NET__STRUCTS, "Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/worldconn.cpp b/common/worldconn.cpp index d43009b23..c0aafd19f 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include "worldconn.h" @@ -43,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - _log(NET__WORLD, "Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -75,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - _log(NET__WORLD, "WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } From 34f30b974e05e5b620ec15181b35be64df6df980 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:07:16 -0600 Subject: [PATCH 0850/1883] More netcode debugging _log to logger.LogDebugType --- common/eq_stream.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index d2326cf7b..475fab95e 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - _log(NET__DEBUG, _L "Session not initialized, packet ignored" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -184,7 +184,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - _log(NET__DEBUG, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); @@ -193,7 +193,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - _log(NET__DEBUG, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { @@ -234,7 +234,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - _log(NET__DEBUG, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); @@ -243,7 +243,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - _log(NET__DEBUG, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - _log(NET__DEBUG, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - _log(NET__DEBUG, _L "All outgoing data flushed, closing stream." __L ); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -1113,7 +1113,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - _log(NET__DEBUG, _L "Incoming packet failed checksum" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1214,7 +1214,7 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - _log(NET__DEBUG, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; _log(NET__APP_TRACE, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); @@ -1327,22 +1327,22 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - _log(NET__DEBUG, _L "Timeout expired in closing state. Moving to closed state." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - _log(NET__DEBUG, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - _log(NET__DEBUG, _L "Timeout expired in closed state??" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - _log(NET__DEBUG, _L "Timeout expired in established state. Closing connection." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1393,12 +1393,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - _log(NET__DEBUG, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - _log(NET__DEBUG, _L "Stream closing immediate due to Close()" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } From bc02d7c31acdb2d90cd9efc6542d4a71014a24ce Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:20:11 -0600 Subject: [PATCH 0851/1883] More netcode debugging _log to logger.LogDebugType --- common/eq_stream.cpp | 196 +++++++++++++++++++++---------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 475fab95e..9a957f5a7 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - _log(NET__APP_CREATE, _L "Creating new application packet, length %d" __L, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - _log(NET__APP_CREATE, _L "Creating new application packet, length %d" __L, len); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - _log(NET__NET_CREATE, _L "Extracting combined packet of length %d" __L, subpacket_length); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - _log(NET__NET_CREATE, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - _log(NET__NET_CREATE, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,7 +178,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - _log(NET__ERROR, _L "Received OP_Packet that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); @@ -188,7 +188,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - _log(NET__APP_TRACE, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - _log(NET__NET_CREATE, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,7 +228,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - _log(NET__ERROR, _L "Received OP_Fragment that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); @@ -238,7 +238,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - _log(NET__APP_TRACE, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - _log(NET__NET_TRACE, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - _log(NET__NET_CREATE, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - _log(NET__NET_CREATE, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - _log(NET__NET_TRACE, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - _log(NET__NET_TRACE, _L "Received and queued reply to keep alive" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - _log(NET__ERROR, _L "Received OP_Ack that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - _log(NET__ERROR, _L "Received OP_SessionRequest that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - _log(NET__ERROR, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - _log(NET__NET_TRACE, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - _log(NET__ERROR, _L "Received OP_SessionResponse that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - _log(NET__NET_TRACE, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - _log(NET__NET_TRACE, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - _log(NET__NET_TRACE, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - _log(NET__NET_TRACE, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - _log(NET__ERROR, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - _log(NET__NET_TRACE, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - _log(NET__NET_TRACE, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - _log(NET__NET_TRACE, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - _log(NET__ERROR, _L "Received OP_SessionStatRequest that was of malformed size" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - _log(NET__NET_TRACE, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - _log(NET__NET_TRACE, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - _log(NET__NET_TRACE, _L "Received OP_SessionStatResponse. Ignoring." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - _log(NET__NET_TRACE, _L "Received OP_OutOfSession. Ignoring." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - _log(NET__FRAGMENT, _L "Making oversized packet, len %d" __L, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - _log(NET__FRAGMENT, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - _log(NET__FRAGMENT, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - _log(NET__APP_TRACE, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - _log(NET__APP_TRACE, _L "Pushing non-sequenced packet of length %d" __L, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - _log(NET__NET_ACKS, _L "Sending ack with sequence %d" __L, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - _log(NET__APP_TRACE, _L "Sending out of order ack with sequence %d" __L, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - _log(NET__NET_TRACE, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - _log(NET__NET_COMBINE, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - _log(NET__NET_COMBINE, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - _log(NET__RATES, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - _log(NET__NET_COMBINE, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - _log(NET__ERROR, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - _log(NET__NET_TRACE, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - _log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - _log(NET__NET_COMBINE, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - _log(NET__RATES, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - _log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - _log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - _log(NET__NET_COMBINE, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - _log(NET__RATES, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - _log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - _log(NET__NET_COMBINE, _L "Final combined packet not full, len %d" __L, p->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - _log(NET__NET_TRACE, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - _log(NET__NET_TRACE, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - _log(NET__NET_TRACE, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -1016,7 +1016,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - _log(NET__APP_TRACE, _L "Clearing inbound queue" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1059,7 +1059,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - _log(NET__APP_TRACE, _L "Clearing outbound queue" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1081,7 +1081,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - _log(NET__APP_TRACE, _L "Clearing future packet queue" __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1143,33 +1143,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - _log(NET__NET_ACKS, _L "Received an ack with no window advancement (seq %d)." __L, seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - _log(NET__NET_ACKS, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - _log(NET__NET_ACKS, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -_log(NET__ERROR, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - _log(NET__NET_ACKS, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1180,10 +1180,10 @@ _log(NET__ERROR, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - _log(NET__ERROR, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - _log(NET__ERROR, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1193,7 +1193,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - _log(NET__NET_ACKS, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1201,7 +1201,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - _log(NET__NET_ACKS, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1217,7 +1217,7 @@ void EQStream::ProcessQueue() logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - _log(NET__APP_TRACE, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1228,21 +1228,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - _log(NET__APP_TRACE, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - _log(NET__NET_TRACE, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - _log(NET__NET_TRACE, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1250,7 +1250,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - _log(NET__NET_TRACE, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1258,7 +1258,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - _log(NET__NET_TRACE, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1308,7 +1308,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - _log(NET__NET_TRACE, _L "Changing state from %d to %d" __L, State, state); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1320,7 +1320,7 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - _log(NET__NET_TRACE, _L "Out of data in closing state, disconnecting." __L); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { @@ -1371,11 +1371,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - _log(NET__RATES, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - _log(NET__RATES, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1383,7 +1383,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - _log(NET__RATES, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } From 6e11baf30827be770215da5687a852e5843ea701 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:28:16 -0600 Subject: [PATCH 0852/1883] Convert world debugging _log to logger.LogDebugType --- queryserv/queryserv.cpp | 2 +- ucs/ucs.cpp | 4 +- world/client.cpp | 48 +++++++-------- world/cliententry.cpp | 2 +- world/clientlist.cpp | 14 ++--- world/console.cpp | 24 ++++---- world/eqw.cpp | 6 +- world/eqw_http_handler.cpp | 18 +++--- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 ++++---- world/launcher_list.cpp | 10 ++-- world/login_server.cpp | 32 +++++----- world/login_server_list.cpp | 2 +- world/net.cpp | 116 ++++++++++++++++++------------------ world/zonelist.cpp | 8 +-- world/zoneserver.cpp | 8 +-- zone/net.cpp | 4 +- 17 files changed, 164 insertions(+), 164 deletions(-) diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index fa52a11f5..425ab0f9e 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -83,7 +83,7 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - _log(WORLD__INIT_ERR, "Cannot continue without a database connection."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 2024bf155..6d3d8975e 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -104,14 +104,14 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - _log(WORLD__INIT_ERR, "Cannot continue without a database connection."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - _log(WORLD__INIT, "Loading rule set '%s'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { _log(UCS__ERROR, "Failed to load ruleset '%s', falling back to defaults.", tmp); } diff --git a/world/client.cpp b/world/client.cpp index 01130302d..a2ee6638f 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1519,7 +1519,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - _log(WORLD__CLIENT, "Validating char creation info..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1536,7 +1536,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - _log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1553,7 +1553,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - _log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1566,37 +1566,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - _log(WORLD__CLIENT_ERR, "Strength out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - _log(WORLD__CLIENT_ERR, "Dexterity out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - _log(WORLD__CLIENT_ERR, "Agility out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - _log(WORLD__CLIENT_ERR, "Stamina out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - _log(WORLD__CLIENT_ERR, "Intelligence out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - _log(WORLD__CLIENT_ERR, "Wisdom out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - _log(WORLD__CLIENT_ERR, "Charisma out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); return false; } @@ -1609,7 +1609,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - _log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1690,7 +1690,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - _log(WORLD__CLIENT,"Validating char creation info..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1703,16 +1703,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - _log(WORLD__CLIENT_ERR," class is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - _log(WORLD__CLIENT_ERR," race is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - _log(WORLD__CLIENT_ERR," invalid race/class combination"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1740,43 +1740,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - _log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - _log(WORLD__CLIENT_ERR," stat STR is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - _log(WORLD__CLIENT_ERR," stat STA is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - _log(WORLD__CLIENT_ERR," stat AGI is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - _log(WORLD__CLIENT_ERR," stat DEX is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - _log(WORLD__CLIENT_ERR," stat WIS is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - _log(WORLD__CLIENT_ERR," stat INT is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - _log(WORLD__CLIENT_ERR," stat CHA is out of range"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - _log(WORLD__CLIENT,"Found %d errors in character creation request", Charerrors); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 5e93a8668..8f2301f1d 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - _log(WORLD__CLIENTLIST_ERR,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index f2e1c8b9b..1a4237186 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - _log(WORLD__CLIENTLIST,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -425,7 +425,7 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) } int16 tmpadmin; - //_log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword); + //logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login with '%s' and '%s'", iName, iPassword); uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin); if (accid) { @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - _log(WORLD__CLIENT_ERR,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - _log(WORLD__ZONELIST_ERR,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - _log(WORLD__ZONELIST_ERR,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - _log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - _log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index c57a85f43..a6cb6027d 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - _log(WORLD__CONSOLE,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - _log(WORLD__CONSOLE,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - _log(WORLD__CONSOLE,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - _log(WORLD__CONSOLE,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - _log(WORLD__CONSOLE,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - _log(WORLD__CONSOLE,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - _log(WORLD__CONSOLE,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - _log(WORLD__CONSOLE,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - _log(WORLD__CONSOLE,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - _log(WORLD__CONSOLE,"TCP command: %s: \"%s\"",paccountname,command); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - _log(WORLD__CONSOLE,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - _log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Console"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eqw.cpp b/world/eqw.cpp index 343aa9ebd..b85720808 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -75,11 +75,11 @@ EQW::EQW() { void EQW::AppendOutput(const char *str) { m_outputBuffer += str; -// _log(WORLD__EQW, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); +// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); } const std::string &EQW::GetOutput() const { -// _log(WORLD__EQW, "Getting, length %d", m_outputBuffer.length()); +// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Getting, length %d", m_outputBuffer.length()); return(m_outputBuffer); } @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - _log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Web Tool"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index 70c56acfa..ae2f18403 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - _log(WORLD__HTTP_ERR, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - _log(WORLD__HTTP_ERR, "Login of %s failed: status too low.", m_username.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - _log(WORLD__HTTP, "Requesting that HTTP Service stop."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - _log(WORLD__HTTP_ERR, "HTTP Service is already running on port %d", m_port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - _log(WORLD__HTTP_ERR, "Failed to load mime types from '%s'", mime_file); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - _log(WORLD__HTTP, "Loaded mime types from %s", mime_file); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - _log(WORLD__HTTP_ERR, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } @@ -320,12 +320,12 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { /* void EQWHTTPServer::Run() { - _log(WORLD__HTTP, "HTTP Processing thread started on port %d", m_port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread started on port %d", m_port); do { #warning DELETE THIS IF YOU DONT USE IT Sleep(10); } while(m_running); - _log(WORLD__HTTP, "HTTP Processing thread terminating on port %d", m_port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread terminating on port %d", m_port); } ThreadReturnType EQWHTTPServer::ThreadProc(void *data) { diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 172c839d7..0a4a19ff5 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - _log(WORLD__PERL_ERR, "Error: perl_alloc failed!"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - _log(WORLD__PERL, "Loading worldui perl plugins."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - _log(WORLD__PERL_ERR, "Warning - world.pl: %s", err.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index c72416a2d..4a56e4977 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - _log(WORLD__LAUNCH_ERR, "Launcher authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - _log(WORLD__LAUNCH,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - _log(WORLD__LAUNCH, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - _log(WORLD__LAUNCH_ERR, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - _log(WORLD__LAUNCH, "Unknown launcher '%s' connected. Disconnecting.", it->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - _log(WORLD__LAUNCH, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - _log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - _log(WORLD__LAUNCH_ERR, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - _log(WORLD__LAUNCH, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - _log(WORLD__LAUNCH_ERR, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - _log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 0722cb1e9..1f220c8b6 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - _log(WORLD__LAUNCH, "Removing pending launcher %d", l->GetID()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - _log(WORLD__LAUNCH, "Ghosting launcher %s", name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - _log(WORLD__LAUNCH, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - _log(WORLD__LAUNCH, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - _log(WORLD__LAUNCH, "Adding pending launcher %d", it->GetID()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index a448c0826..1a9eabda3 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - _log(WORLD__LS_TRACE,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - _log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - _log(WORLD__LS_ERR, "Login server responded with FatalError."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - _log(WORLD__LS_ERR, " %s",pack->pBuffer); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - _log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - _log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - _log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - _log(WORLD__LS, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - _log(WORLD__LS_ERR, "Not connected but not ready to connect, this is bad: %s:%d", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - _log(WORLD__LS, "Setting World to MiniLogin Server type"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - _log(WORLD__LS_ERR, "**** For minilogin to work, you need to set the
element in the section."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - _log(WORLD__LS_ERR, "Unable to resolve '%s' to an IP.",LoginServerAddress); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - _log(WORLD__LS_ERR, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - _log(WORLD__LS, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - _log(WORLD__LS_ERR, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - _log(WORLD__LS, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index 4bce5032c..84cb4af76 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - _log(WORLD__LS, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index 3977f482b..6f3d85f5e 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - _log(WORLD__INIT, "Loading server configuration.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - _log(WORLD__INIT_ERR, "Loading server configuration failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - _log(WORLD__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - _log(WORLD__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - _log(WORLD__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - _log(WORLD__INIT_ERR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - _log(WORLD__INIT_ERR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - _log(WORLD__INIT_ERR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - _log(WORLD__INIT, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - _log(WORLD__INIT, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - _log(WORLD__INIT, "Connecting to MySQL..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - _log(WORLD__INIT_ERR, "Cannot continue without a database connection."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - _log(WORLD__INIT, "Starting HTTP world service..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - _log(WORLD__INIT, "HTTP world service disabled."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); } - _log(WORLD__INIT, "Checking Database Conversions.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - _log(WORLD__INIT, "Loading variables.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); database.LoadVariables(); - _log(WORLD__INIT, "Loading zones.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); database.LoadZoneNames(); - _log(WORLD__INIT, "Clearing groups.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); database.ClearGroup(); - _log(WORLD__INIT, "Clearing raids.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - _log(WORLD__INIT, "Loading items.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); if (!database.LoadItems()) - _log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring"); - _log(WORLD__INIT, "Loading skill caps.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - _log(WORLD__INIT_ERR, "Error: Could not load skill cap data. But ignoring"); - _log(WORLD__INIT, "Loading guilds.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - _log(WORLD__INIT, "Loading rule set '%s'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - _log(WORLD__INIT_ERR, "Failed to load ruleset '%s', falling back to defaults.", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - _log(WORLD__INIT, "No rule set configured, using default rules"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); } else { - _log(WORLD__INIT, "Loaded default rule set 'default'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - _log(WORLD__INIT, "Clearing temporary merchant lists.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - _log(WORLD__INIT, "Loading EQ time of day.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - _log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str()); - _log(WORLD__INIT, "Loading launcher list.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - _log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - _log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - _log(WORLD__INIT, "Loading adventures..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - _log(WORLD__INIT_ERR, "Unable to load adventure templates."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - _log(WORLD__INIT_ERR, "Unable to load adventure templates."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - _log(WORLD__INIT, "Purging expired instances"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - _log(WORLD__INIT, "Loading char create info..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - _log(WORLD__INIT,"Zone (TCP) listener started."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); } else { - _log(WORLD__INIT_ERR,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - _log(WORLD__INIT_ERR," %s",errbuf); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - _log(WORLD__INIT,"Client (UDP) listener started."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); } else { - _log(WORLD__INIT_ERR,"Failed to start client (UDP) listener (port 9000)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - _log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - _log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - _log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - _log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - _log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - _log(WORLD__ZONE, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - _log(WORLD__SHUTDOWN,"World main loop completed."); - _log(WORLD__SHUTDOWN,"Shutting down console connections (if any)."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - _log(WORLD__SHUTDOWN,"Shutting down zone connections (if any)."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - _log(WORLD__SHUTDOWN,"Zone (TCP) listener stopped."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - _log(WORLD__SHUTDOWN,"Client (UDP) listener stopped."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - _log(WORLD__SHUTDOWN,"Signaling HTTP service to stop..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - _log(WORLD__SHUTDOWN,"Caught signal %d",sig_num); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - _log(WORLD__SHUTDOWN,"Failed to save time file."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index cf27ed495..49d1d24eb 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - _log(WORLD__ZONELIST, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - _log(WORLD__ZONELIST,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - _log(WORLD__ZONELIST,"Hold Zones mode is ON - rebooting lost zone"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - _log(WORLD__ZONELIST,"Rebooting static zone with the ID of: %i",zoneid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 70c1cd1b1..62c7ca37a 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - _log(WORLD__ZONE,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - _log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - _log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - _log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } diff --git a/zone/net.cpp b/zone/net.cpp index 39cc24b96..31648b9f9 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - _log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - _log(WORLD__CLIENT, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } From 6c0e2631dc4db14a479ba812dc66523133511074 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:29:56 -0600 Subject: [PATCH 0853/1883] Convert rules debugging _log to logger.LogDebugType --- common/rulesys.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 148f2bfc9..13c9fbf98 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - _log(RULES__ERROR, "Unable to find category '%s'", catname); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - _log(RULES__CHANGE, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - _log(RULES__CHANGE, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - _log(RULES__CHANGE, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - _log(RULES__CHANGE, "Resetting running rules to default values"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - _log(RULES__ERROR, "Unable to find rule '%s'", rule_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - _log(RULES__ERROR, "Unable to find or create rule set %s", ruleset); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - _log(RULES__CHANGE, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - _log(RULES__CHANGE, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - _log(RULES__ERROR, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - _log(RULES__CHANGE, "Loading rule set '%s' (%d)", ruleset, rsid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -288,7 +288,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - _log(RULES__ERROR, "Unable to interpret rule record for %s", row[0]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - _log(RULES__ERROR, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - _log(RULES__ERROR, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From c288ca5204914042977a9035b019a7136718b7d0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:32:44 -0600 Subject: [PATCH 0854/1883] Convert 'Guilds' debugging _log to logger.LogDebugType --- common/eqemu_logsys.h | 2 +- common/guild_base.cpp | 130 ++++++++++++++++++++--------------------- world/wguild_mgr.cpp | 28 ++++----- zone/bot.cpp | 2 +- zone/client_packet.cpp | 2 +- zone/command.cpp | 14 ++--- zone/guild_mgr.cpp | 20 +++---- 7 files changed, 100 insertions(+), 98 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 8d577bfc1..e1363c8dc 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -57,7 +57,7 @@ public: WebInterface_Server, AA, Doors, - Guild, + Guilds, Inventory, Netcode, Object, diff --git a/common/guild_base.cpp b/common/guild_base.cpp index e2a411c6c..b8b6206e9 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to load guilds when we have no database object."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - _log(GUILDS__ERROR, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - _log(GUILDS__ERROR, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - _log(GUILDS__ERROR, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - _log(GUILDS__ERROR, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to refresh guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - _log(GUILDS__ERROR, "Unable to find guild %d in the database.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - _log(GUILDS__ERROR, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - _log(GUILDS__DB, "Successfully refreshed guild %d from the database.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to store guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - _log(GUILDS__DB, "Requested to store non-existent guild %d", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - _log(GUILDS__ERROR, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - _log(GUILDS__ERROR, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - _log(GUILDS__DB, "Stored guild %d in the database", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested find a free guild ID when we have no database object."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -343,12 +343,12 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (results.RowCount() == 0) { - _log(GUILDS__DB, "Located free guild ID %d in the database", index); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); return index; } } - _log(GUILDS__ERROR, "Unable to find a free guild ID when requested."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - _log(GUILDS__ERROR, "Error storing new guild. It may have been partially created which may need manual removal."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - _log(GUILDS__DB, "Created guild %d in the database.", new_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to delete guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - _log(GUILDS__DB, "Deleted guild %d from the database.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to rename guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - _log(GUILDS__DB, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to set the leader for guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - _log(GUILDS__DB, "Set guild leader for guild %d to %d in the database", guild_id, leader); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - _log(GUILDS__ERROR, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - _log(GUILDS__DB, "Set MOTD for guild %d in the database", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - _log(GUILDS__ERROR, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - _log(GUILDS__DB, "Set URL for guild %d in the database", GuildID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - _log(GUILDS__ERROR, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - _log(GUILDS__DB, "Set Channel for guild %d in the database", GuildID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested to set char to guild %d when we have no database object.", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - _log(GUILDS__DB, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__ERROR, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - _log(GUILDS__ERROR, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - _log(GUILDS__DB, "Set public not for char %d", charid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - _log(GUILDS__ERROR, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - _log(GUILDS__DB, "Retreived guild member info for char %s from the database", char_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - _log(GUILDS__DB, "Requested char info on %d when we have no database object.", char_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - _log(GUILDS__DB, "Retreived guild member info for char %d", char_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - _log(GUILDS__PERMISSIONS, "Check leader for char %d: not a guild.", char_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - _log(GUILDS__PERMISSIONS, "Check leader for char %d: invalid guild.", char_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - _log(GUILDS__PERMISSIONS, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - _log(GUILDS__PERMISSIONS, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - _log(GUILDS__PERMISSIONS, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - _log(GUILDS__PERMISSIONS, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - _log(GUILDS__PERMISSIONS, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - _log(GUILDS__ERROR, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index 0f3e07636..1a148bc08 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -15,6 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "../common/eqemu_logsys.h" #include "../common/debug.h" #include "wguild_mgr.h" #include "../common/servertalk.h" @@ -32,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - _log(GUILDS__REFRESH, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -45,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - _log(GUILDS__REFRESH, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -56,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - _log(GUILDS__REFRESH, "Broadcasting guild delete for guild %d to world", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -69,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - _log(GUILDS__ERROR, "Unable to preform local refresh on guild %d", s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -89,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -108,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received and broadcasting guild delete for guild %d", s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - _log(GUILDS__ERROR, "Unable to preform local delete on guild %d", s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -129,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - _log(GUILDS__ERROR, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -139,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - _log(GUILDS__ERROR, "Unknown packet 0x%x received from zone??", pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/zone/bot.cpp b/zone/bot.cpp index bde330f03..1f0cc6062 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8447,7 +8447,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); - //_log(GUILDS__REFRESH, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); + //logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c6f8fce39..83d386b72 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -7196,7 +7196,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - _log(GUILDS__ACTIONS, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) diff --git a/zone/command.cpp b/zone/command.cpp index 0171aaa7c..f79e7e385 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4602,10 +4602,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - _log(GUILDS__ACTIONS, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - _log(GUILDS__ACTIONS, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4654,7 +4654,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - _log(GUILDS__ACTIONS, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4696,7 +4696,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - _log(GUILDS__ACTIONS, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4735,7 +4735,7 @@ void command_guild(Client *c, const Seperator *sep) } } - _log(GUILDS__ACTIONS, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4769,7 +4769,7 @@ void command_guild(Client *c, const Seperator *sep) } } - _log(GUILDS__ACTIONS, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4820,7 +4820,7 @@ void command_guild(Client *c, const Seperator *sep) } } - _log(GUILDS__ACTIONS, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 50c37aded..4a72a6d9c 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - _log(GUILDS__REFRESH, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - _log(GUILDS__REFRESH, "Guild lookup for char %d when sending char refresh.", charid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - _log(GUILDS__REFRESH, "Sending char refresh for %d from guild %d to world", charid, guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - _log(GUILDS__REFRESH, "Sending guild delete for guild %d to world", guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -266,7 +266,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -300,7 +300,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -369,7 +369,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - _log(GUILDS__REFRESH, "Received guild delete from world for guild %d", s->guild_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - _log(GUILDS__ERROR,"Invalid Client or not in guild. ID=%i", FromID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - _log(GUILDS__IN_PACKETS,"Processing ServerOP_OnlineGuildMembersResponse"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - _log(GUILDS__OUT_PACKETS,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); From f26f49c2a1322331e60bb60be5ce03babbc41d84 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:37:20 -0600 Subject: [PATCH 0855/1883] Convert 'QueryServ' debugging _log to logger.LogDebugType --- queryserv/database.cpp | 56 +++++++++++++++++++-------------------- queryserv/lfguild.cpp | 15 ++++++----- queryserv/queryserv.cpp | 14 +++++----- queryserv/worldserver.cpp | 37 ++++++++++++++------------ world/queryserv.cpp | 13 ++++----- 5 files changed, 70 insertions(+), 65 deletions(-) diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 18a852e2b..13206857a 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - _log(QUERYSERV__ERROR, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - _log(QUERYSERV__ERROR, "%s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index c135d4991..27cf102de 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -2,6 +2,7 @@ #include "lfguild.h" #include "database.h" #include "worldserver.h" +#include "../common/eqemu_logsys.h" #include "../common/string_util.h" #include "../common/packet_dump.h" #include "../common/rulesys.h" @@ -39,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(QUERYSERV__ERROR, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -241,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -256,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -287,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -304,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -334,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -347,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - _log(QUERYSERV__ERROR, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 425ab0f9e..a64ce9be8 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -65,16 +65,16 @@ int main() { */ - _log(QUERYSERV__INIT, "Starting EQEmu QueryServ."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - _log(QUERYSERV__INIT, "Loading server configuration failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - _log(QUERYSERV__INIT, "Connecting to MySQL..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -89,16 +89,16 @@ int main() { /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - _log(QUERYSERV__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - _log(QUERYSERV__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - _log(QUERYSERV__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - _log(QUERYSERV__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index fc87929ca..9a0c2d46d 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -15,23 +15,26 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" -#include -#include -#include -#include -#include -#include -#include -#include "../common/servertalk.h" -#include "worldserver.h" -#include "queryservconfig.h" -#include "database.h" -#include "lfguild.h" -#include "../common/packet_functions.h" + +#include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/md5.h" #include "../common/packet_dump.h" +#include "../common/packet_functions.h" +#include "../common/servertalk.h" + +#include "database.h" +#include "lfguild.h" +#include "queryservconfig.h" +#include "worldserver.h" +#include +#include +#include +#include +#include +#include +#include extern WorldServer worldserver; extern const queryservconfig *Config; @@ -50,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - _log(QUERYSERV__INIT, "Connected to World."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -63,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - _log(QUERYSERV__TRACE, "Received Opcode: %4X", pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -145,7 +148,7 @@ void WorldServer::Process() break; } default: - _log(QUERYSERV__ERROR, "Received unhandled ServerOP_QueryServGeneric", Type); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 3eb664a5e..3a7147f23 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -1,4 +1,5 @@ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "queryserv.h" #include "world_config.h" #include "clientlist.h" @@ -22,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - _log(QUERYSERV__ERROR, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -56,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - _log(QUERYSERV__ERROR, "QueryServ authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -68,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - _log(QUERYSERV__ERROR, "QueryServ authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -78,7 +79,7 @@ bool QueryServConnection::Process() } else { - _log(QUERYSERV__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -96,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - _log(QUERYSERV__ERROR, "Got authentication from QueryServ when they are already authenticated."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -113,7 +114,7 @@ bool QueryServConnection::Process() } default: { - _log(QUERYSERV__ERROR, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } From 40d32fc1e5f7c04d4c3e9264370aeb776b54421a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:44:47 -0600 Subject: [PATCH 0856/1883] Convert 'UCS' debugging _log to logger.LogDebugType --- common/eqemu_logsys.cpp | 1 + common/eqemu_logsys.h | 1 + ucs/chatchannel.cpp | 35 +++++++++-------- ucs/clientlist.cpp | 79 ++++++++++++++++++------------------- ucs/database.cpp | 86 ++++++++++++++++++++--------------------- ucs/ucs.cpp | 22 +++++------ ucs/worldserver.cpp | 9 +++-- world/ucs.cpp | 13 ++++--- 8 files changed, 126 insertions(+), 120 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 73317e525..857d0ed63 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -82,6 +82,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Doors", "Guild", "Inventory", + "Launcher", "Netcode", "Object", "Rules", diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index e1363c8dc..ecf3fecf7 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -59,6 +59,7 @@ public: Doors, Guilds, Inventory, + Launcher, Netcode, Object, Rules, diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 56b7eb5b9..3435eeda6 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -17,10 +17,11 @@ */ +#include "../common/eqemu_logsys.h" +#include "../common/string_util.h" #include "chatchannel.h" #include "clientlist.h" #include "database.h" -#include "../common/string_util.h" #include extern Database database; @@ -41,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - _log(UCS__TRACE, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -148,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - _log(UCS__TRACE, "RemoveChannel(%s)", Channel->GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -169,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - _log(UCS__TRACE, "RemoveAllChannels"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -227,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - _log(UCS__ERROR, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -236,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - _log(UCS__TRACE, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -261,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - _log(UCS__TRACE, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -298,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - _log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -396,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - _log(UCS__TRACE, "Sending message to %s from %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -478,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - _log(UCS__TRACE, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -554,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - _log(UCS__TRACE, "Empty temporary password protected channel %s being destroyed.", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -571,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - _log(UCS__TRACE, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -586,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - _log(UCS__TRACE, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -612,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - _log(UCS__TRACE, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -627,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - _log(UCS__TRACE, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -653,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - _log(UCS__TRACE, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -668,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - _log(UCS__TRACE, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 26c1befa4..48e2b1a94 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -19,6 +19,7 @@ #include "../common/debug.h" #include "../common/string_util.h" +#include "../common/eqemu_logsys.h" #include "clientlist.h" #include "database.h" @@ -235,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - _log(UCS__TRACE, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -304,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - _log(UCS__ERROR, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -399,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - _log(UCS__TRACE, "Received buddy command with parameters %s", Buddy.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -429,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - _log(UCS__TRACE, "Received ignore command with parameters %s", Ignoree.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -480,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - _log(UCS__INIT,"Client (UDP) Chat listener started on port %i.", ChatPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - _log(UCS__ERROR,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -559,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - _log(UCS__CLIENT, "Removing old connection for %s", c->GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -585,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - _log(UCS__CLIENT, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -605,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - _log(UCS__CLIENT, "Client connection from %s:%d closed.", inet_ntoa(in), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -645,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - _log(UCS__ERROR, "Mail key is the wrong size. Version of world incompatible with UCS."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -666,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - _log(UCS__TRACE, "Received login for user %s with key %s", MailBox, Key); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - _log(UCS__ERROR, "Chat Key for %s does not match, closing connection.", MailBox); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -702,7 +703,7 @@ void Clientlist::Process() { default: { - _log(UCS__ERROR, "Unhandled chat opcode %8X", opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -715,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - _log(UCS__TRACE, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -859,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - _log(UCS__TRACE, "Set Message Status, Params: %s", Parameters.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -884,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - _log(UCS__ERROR, "Unhandled OP_Mail command: %s", CommandString.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -895,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - _log(UCS__TRACE, "Removing client %s", (*Iterator)->GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -904,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - _log(UCS__TRACE, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -970,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - _log(UCS__TRACE, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1011,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - _log(UCS__TRACE, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1112,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - _log(UCS__TRACE, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1291,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1434,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - _log(UCS__TRACE, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1646,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - _log(UCS__TRACE, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1701,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - _log(UCS__TRACE, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1789,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - _log(UCS__TRACE, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1917,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - _log(UCS__TRACE, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1998,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - _log(UCS__TRACE, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2086,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - _log(UCS__TRACE, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2195,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - _log(UCS__TRACE, "Connection type is Combined (SoF/SoD)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - _log(UCS__TRACE, "Connection type is Combined (Underfoot+)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - _log(UCS__TRACE, "Connection type is Mail (6.2 or Titanium client)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - _log(UCS__TRACE, "Connection type is Chat (6.2 or Titanium client)"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - _log(UCS__TRACE, "Connection type is unknown."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); } } } @@ -2298,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - _log(UCS__TRACE, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - _log(UCS__TRACE, "New mailbox is %s", MailBoxName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2376,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - _log(UCS__ERROR, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - _log(UCS__TRACE, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index b73a50711..8caa5ef5d 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - _log(UCS__TRACE, "GetAccountStatus Query: %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - _log(UCS__ERROR, "Error in GetAccountStatus"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - _log(UCS__TRACE, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - _log(UCS__TRACE, "FindAccount for character %s", characterName); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "FindAccount query failed: %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - _log(UCS__ERROR, "Bad result from query"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - _log(UCS__TRACE, "Account ID for %s is %i", characterName, accountID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - _log(UCS__TRACE, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - _log(UCS__ERROR, "Bad result from FindCharacter query for character %s", characterName); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - _log(UCS__INIT, "Loading chat channels from the database."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - _log(UCS__TRACE, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - _log(UCS__ERROR, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - _log(UCS__TRACE, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - _log(UCS__ERROR, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - _log(UCS__TRACE, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - _log(UCS__TRACE, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - _log(UCS__TRACE, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - _log(UCS__TRACE, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - _log(UCS__ERROR, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - _log(UCS__TRACE, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - _log(UCS__TRACE, "SetMessageStatus %i %i", messageNumber, status); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - _log(UCS__ERROR, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - _log(UCS__INIT, "Expiring mail..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - _log(UCS__INIT, "There are %s messages in the database.", row[0]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - _log(UCS__INIT, "Expired %i trash messages.", results.RowsAffected()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - _log(UCS__ERROR, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - _log(UCS__INIT, "Expired %i read messages.", results.RowsAffected()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - _log(UCS__ERROR, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - _log(UCS__INIT, "Expired %i unread messages.", results.RowsAffected()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - _log(UCS__ERROR, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - _log(UCS__ERROR, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - _log(UCS__TRACE, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - _log(UCS__ERROR, "Error removing friend/ignore, query was %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - _log(UCS__TRACE, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - _log(UCS__ERROR, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - _log(UCS__TRACE, "Added Ignoree from DB %s", name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - _log(UCS__TRACE, "Added Friend from DB %s", name.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 6d3d8975e..2af41f71d 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - _log(UCS__INIT, "Starting EQEmu Universal Chat Server."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - _log(UCS__INIT, "Loading server configuration failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - _log(UCS__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - _log(UCS__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - _log(UCS__INIT, "Connecting to MySQL..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -113,13 +113,13 @@ int main() { if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - _log(UCS__ERROR, "Failed to load ruleset '%s', falling back to defaults.", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - _log(UCS__INIT, "No rule set configured, using default rules"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); } else { - _log(UCS__INIT, "Loaded default rule set 'default'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - _log(UCS__ERROR, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - _log(UCS__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - _log(UCS__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 83e1764a1..105dc3d4a 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include #include @@ -51,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - _log(UCS__INIT, "Connected to World."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - _log(UCS__TRACE, "Received Opcode: %4X", pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -87,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - _log(UCS__TRACE, "Player: %s, Sent Message: %s", From, Message.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -98,7 +99,7 @@ void WorldServer::Process() if(!c) { - _log(UCS__TRACE, "Client not found."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index 875d2be23..d2e361964 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -1,4 +1,5 @@ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "ucs.h" #include "world_config.h" #include "../common/logsys.h" @@ -17,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - _log(UCS__ERROR, "Incoming UCS Connection while we were already connected to a UCS."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -51,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - _log(UCS__ERROR, "UCS authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -63,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - _log(UCS__ERROR, "UCS authorization failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -73,7 +74,7 @@ bool UCSConnection::Process() } else { - _log(UCS__ERROR,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -91,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - _log(UCS__ERROR, "Got authentication from UCS when they are already authenticated."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - _log(UCS__ERROR, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } From 4c50025f1371c78703cd2d4c8641d46f0e12db1f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:47:37 -0600 Subject: [PATCH 0857/1883] Convert 'ZoneServer' debugging _log to logger.LogDebugType --- zone/net.cpp | 66 ++++++++++++++++++++++---------------------- zone/worldserver.cpp | 4 +-- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index 31648b9f9..7ca406a96 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -151,7 +151,7 @@ int main(int argc, char** argv) { - _log(ZONE__INIT, "Loading server configuration.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { logger.Log(EQEmuLogSys::Error, "Loading server configuration failed."); return 1; @@ -159,13 +159,13 @@ int main(int argc, char** argv) { const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - _log(ZONE__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - _log(ZONE__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - _log(ZONE__INIT, "Connecting to MySQL..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), @@ -189,7 +189,7 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - _log(ZONE__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers @@ -211,84 +211,84 @@ int main(int argc, char** argv) { const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - _log(ZONE__INIT, "Warning: Unable to read %s", log_ini_file); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - _log(ZONE__INIT, "Log settings loaded from %s", log_ini_file); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); - _log(ZONE__INIT, "Mapping Incoming Opcodes"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - _log(ZONE__INIT, "Loading Variables"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); - _log(ZONE__INIT, "Loading zone names"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - _log(ZONE__INIT, "Loading items"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { logger.Log(EQEmuLogSys::Error, "Loading items FAILED!"); logger.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } - _log(ZONE__INIT, "Loading npc faction lists"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { logger.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - _log(ZONE__INIT, "Loading loot tables"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { logger.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - _log(ZONE__INIT, "Loading skill caps"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { logger.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - _log(ZONE__INIT, "Loading spells"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - _log(ZONE__INIT, "Loading base data"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { logger.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - _log(ZONE__INIT, "Loading guilds"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - _log(ZONE__INIT, "Loading factions"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); - _log(ZONE__INIT, "Loading titles"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - _log(ZONE__INIT, "Loading AA effects"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - _log(ZONE__INIT, "Loading tributes"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); - _log(ZONE__INIT, "Loading corpse timers"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - _log(ZONE__INIT, "Loading commands"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) logger.Log(EQEmuLogSys::Error, "Command loading FAILED"); else - _log(ZONE__INIT, "%d commands loaded", retval); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - _log(ZONE__INIT, "Loading rule set '%s'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { logger.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - _log(ZONE__INIT, "No rule set configured, using default rules"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); } else { - _log(ZONE__INIT, "Loaded default rule set 'default'", tmp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); } } } @@ -311,7 +311,7 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - _log(ZONE__INIT, "Loading quests"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); @@ -332,7 +332,7 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - _log(ZONE__INIT, "Entering sleep mode"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance logger.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; @@ -365,7 +365,7 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - _log(ZONE__INIT, "Starting EQ Network server on port %d",Config->ZonePort); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - _log(ZONE__INIT, "Proper zone shutdown complete."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - _log(ZONE__INIT, "Recieved signal: %i", sig_num); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - _log(ZONE__INIT, "Shutting down..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 68ebb51fc..2b9a47ecf 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - _log(ZONE__WORLD_TRACE,"Got 0x%04x from world:",pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server,"Got 0x%04x from world:",pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,7 +155,7 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - _log(ZONE__WORLD,"World indicated port %d for this zone.",sci->port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server,"World indicated port %d for this zone.",sci->port); ZoneConfig::SetZonePort(sci->port); break; } From 49ecd69b34286c6251a8213437e8e00955776e9d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:50:09 -0600 Subject: [PATCH 0858/1883] Convert 'LAUNCHER' debugging _log to logger.LogDebugType --- eqlaunch/eqlaunch.cpp | 18 +++++++-------- eqlaunch/worldserver.cpp | 19 ++++++++-------- eqlaunch/zone_launch.cpp | 47 ++++++++++++++++++++-------------------- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 89e2b0670..11ad0686f 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - _log(LAUNCHER__ERROR, "You must specfify a launcher name as the first argument to this program."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - _log(LAUNCHER__INIT, "Loading server configuration.."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - _log(LAUNCHER__ERROR, "Loading server configuration failed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - _log(LAUNCHER__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - _log(LAUNCHER__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - _log(LAUNCHER__ERROR, "Could not set signal handler"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - _log(LAUNCHER__ERROR, "worldserver.Connect() FAILED! Will retry."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - _log(LAUNCHER__INIT, "Starting main loop..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - _log(LAUNCHER__STATUS, "Caught signal %d", sig_num); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 920bf982e..9346879bc 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/servertalk.h" #include "../common/eqemu_config.h" #include "../common/string_util.h" @@ -73,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - _log(LAUNCHER__ERROR, "World server responded 'Not Authorized', disabling reconnect"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - _log(LAUNCHER__NET, "Invalid size of LauncherZoneRequest: %d", pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -89,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - _log(LAUNCHER__ERROR, "World told us to start zone %s, but it is already running.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - _log(LAUNCHER__WORLD, "World told us to start zone %s.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -100,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - _log(LAUNCHER__ERROR, "World told us to restart zone %s, but it is not running.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - _log(LAUNCHER__WORLD, "World told us to restart zone %s.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -110,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - _log(LAUNCHER__ERROR, "World told us to stop zone %s, but it is not running.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - _log(LAUNCHER__WORLD, "World told us to stop zone %s.", lzr->short_name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -126,7 +127,7 @@ void WorldServer::Process() { } default: { - _log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index fee133da7..2da3a6554 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include "../common/eqemu_config.h" #include "zone_launch.h" #include "worldserver.h" @@ -71,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - _log(LAUNCHER__ERROR, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -83,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - _log(LAUNCHER__STATUS, "Zone %s has been started.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - _log(LAUNCHER__STATUS, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - _log(LAUNCHER__STATUS, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -101,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - _log(LAUNCHER__ERROR, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - _log(LAUNCHER__STATUS, "Termination signal sent to zone %s.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - _log(LAUNCHER__STATUS, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - _log(LAUNCHER__STATUS, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -123,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - _log(LAUNCHER__STATUS, "Stopping zone %s before it has started.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -133,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - _log(LAUNCHER__ERROR, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - _log(LAUNCHER__STATUS, "Termination signal sent to zone %s.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - _log(LAUNCHER__STATUS, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -163,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - _log(LAUNCHER__STATUS, "Starting zone %s", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - _log(LAUNCHER__STATUS, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - _log(LAUNCHER__STATUS, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -186,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - _log(LAUNCHER__STATUS, "Zone %s refused to die, killing again.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -196,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - _log(LAUNCHER__STATUS, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - _log(LAUNCHER__STATUS, "Zone %s refused to die, killing again.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -220,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - _log(LAUNCHER__STATUS, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - _log(LAUNCHER__STATUS, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - _log(LAUNCHER__STATUS, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - _log(LAUNCHER__STATUS, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - _log(LAUNCHER__STATUS, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } From 3390164aea84a879316d9d0655391200b1b5ef82 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:51:35 -0600 Subject: [PATCH 0859/1883] Convert 'TRADING' debugging _log to logger.LogDebugType --- zone/client_packet.cpp | 20 +++++++-------- zone/client_process.cpp | 2 +- zone/trading.cpp | 56 ++++++++++++++++++++--------------------- zone/zonedb.cpp | 20 +++++++-------- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 83d386b72..07c7de75b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3573,7 +3573,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - _log(TRADING__BARTER, "Unrecognised Barter Action %i", Action); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3636,7 +3636,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - _log(TRADING__CLIENT, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); logger.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } @@ -13435,7 +13435,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - _log(TRADING__CLIENT, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13444,7 +13444,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - _log(TRADING__CLIENT, "Unhandled action code in OP_Trader ShowItems_Struct"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13530,7 +13530,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - _log(TRADING__CLIENT, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); logger.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); @@ -13542,7 +13542,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - _log(TRADING__CLIENT, "Unknown size for OP_Trader: %i\n", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); logger.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; @@ -13568,11 +13568,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - _log(TRADING__CLIENT, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - _log(TRADING__CLIENT, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13646,7 +13646,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - _log(TRADING__CLIENT, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13660,7 +13660,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - _log(TRADING__CLIENT, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 2b41d8bd2..397c71ac3 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - _log(TRADING__CLIENT, "Previous customer has gone away."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 41f9047e2..6fc82fd25 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - _log(TRADING__HOLDER, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - _log(TRADING__HOLDER, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - _log(TRADING__CLIENT, "Bogus item deleted in Client::SendTraderItem!\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - _log(TRADING__CLIENT, "Client::BulkSendTraderInventory nullptr inst pointer"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - _log(TRADING__CLIENT, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - _log(TRADING__CLIENT, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - _log(TRADING__CLIENT, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - _log(TRADING__CLIENT, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - _log(TRADING__CLIENT, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - _log(TRADING__CLIENT, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - _log(TRADING__CLIENT, "Unable to find item on trader."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - _log(TRADING__CLIENT, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,7 +1534,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - _log(TRADING__CLIENT, "Actual quantity that will be traded is %i", outtbs->Quantity); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); @@ -1840,7 +1840,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint return; } - _log(TRADING__CLIENT, "SRCH: %s", query.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - _log(TRADING__CLIENT, "Unable to find trader: %i\n",atoi(row[1])); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - _log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - _log(TRADING__CLIENT, "Telling customer to remove item %i with %i charges and S/N %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - _log(TRADING__CLIENT, "Sending price updates to customer %s", Customer->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - _log(TRADING__CLIENT, "Sending price update for %s, Serial No. %i with %i charges", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - _log(TRADING__CLIENT, "Received Price Update for %s, Item Serial No. %i, New Price %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - _log(TRADING__CLIENT, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - _log(TRADING__CLIENT, "Unable to find item to update price for. Rechecking trader satchels"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - _log(TRADING__CLIENT, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - _log(TRADING__CLIENT, "Item not found in Trader Satchels either."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - _log(TRADING__CLIENT, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - _log(TRADING__CLIENT, "The new price is the same as the old one."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - _log(TRADING__BARTER, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - _log(TRADING__BARTER, "Adding to database"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index c16739e16..da24a3665 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - _log(TRADING__CLIENT, "Failed to load trader information!\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - _log(TRADING__CLIENT, "Bad Slot number when trying to load trader information!\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - _log(TRADING__CLIENT, "Failed to load trader information!\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - _log(TRADING__CLIENT, "Bad Slot number when trying to load trader information!\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - _log(TRADING__CLIENT, "Bad result from query\n"); fflush(stdout); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - _log(TRADING__CLIENT, "Unable to create item\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - _log(TRADING__CLIENT, "Unable to create item instance\n"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -624,7 +624,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - _log(TRADING__CLIENT, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); @@ -637,7 +637,7 @@ void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int3 void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - _log(TRADING__CLIENT, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,7 +645,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - _log(TRADING__CLIENT, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); From 683ff1ea6008e4b5f19ec5dab3afc304825f9aea Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:52:11 -0600 Subject: [PATCH 0860/1883] Convert 'SPELLS' debugging _log to logger.LogDebugType --- common/shareddb.cpp | 8 ++++---- common/spdat.cpp | 2 +- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 2 +- zone/client_process.cpp | 10 +++++----- zone/groups.cpp | 4 ++-- zone/raids.cpp | 4 ++-- zone/spells.cpp | 2 +- zone/worldserver.cpp | 12 ++++++------ 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0a8148c8d..c9894abc0 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - _log(SPELLS__LOAD_ERR, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - _log(SPELLS__LOAD_ERR, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - _log(SPELLS__LOAD_ERR, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - _log(SPELLS__LOAD_ERR, "Non fatal error: spell.id >= max_spells, ignoring."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } diff --git a/common/spdat.cpp b/common/spdat.cpp index 8bceec249..22861e53e 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -838,7 +838,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - _log(SPELLS__EFFECT_VALUES, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index f7a73c4cf..0f6df5965 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - _log(SPELLS__BARDS, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 07c7de75b..08f52a4bb 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11714,7 +11714,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - _log(SPELLS__REZ, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 397c71ac3..01c59236e 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - _log(SPELLS__REZ, "Unexpected OP_RezzAnswer. Ignoring it."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - _log(SPELLS__REZ, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - _log(SPELLS__REZ, "Unexpected Rezz from hover request."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - _log(SPELLS__REZ, "Hover Rez in zone %s for corpse %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/groups.cpp b/zone/groups.cpp index eca2884e5..ab90cddec 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - _log(SPELLS__CASTING, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - _log(SPELLS__BARDS, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 3f68f2270..7a35d91ac 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - _log(SPELLS__CASTING, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - _log(SPELLS__BARDS, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/spells.cpp b/zone/spells.cpp index ff456fcbc..ba8431814 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3832,7 +3832,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - _log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 2b9a47ecf..2166aba56 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - _log(SPELLS__REZ, "OP_RezzRequest in zone %s for %s, spellid:%i", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - _log(SPELLS__REZ, "OP_RezzComplete received in zone %s for corpse %s", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - _log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - _log(SPELLS__REZ, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - _log(SPELLS__REZ, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - _log(SPELLS__REZ, "NOT Sending player rezz packet to world"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; From 3693868acf0cfd9577ee69825667c501af7ae9df Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:52:46 -0600 Subject: [PATCH 0861/1883] Convert 'SPAWNS' debugging _log to logger.LogDebugType --- zone/spawn2.cpp | 130 ++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 5a4f9b998..367427527 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - _log(SPAWNS__MAIN, "Spawn2 %d: Timer has triggered", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - _log(SPAWNS__MAIN, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - _log(SPAWNS__MAIN, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - _log(SPAWNS__MAIN, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - _log(SPAWNS__MAIN, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - _log(SPAWNS__CONDITIONS,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - _log(SPAWNS__CONDITIONS,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - _log(SPAWNS__CONDITIONS, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - _log(SPAWNS__CONDITIONS, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - _log(SPAWNS__CONDITIONS, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - _log(SPAWNS__CONDITIONS, "Event %d: Invalid event action type %d", event.id, event.action); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - _log(SPAWNS__CONDITIONS, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - _log(SPAWNS__CONDITIONS, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - _log(SPAWNS__CONDITIONS, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - _log(SPAWNS__CONDITIONS, "Initial next trigger time set for spawn event %d", cevent.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - _log(SPAWNS__CONDITIONS, "Catch up triggering on event %d", cevent.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - _log(SPAWNS__CONDITIONS, "No spawn events enabled. Disabling next event."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - _log(SPAWNS__CONDITIONS, "Next event determined to be event %d", next_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - _log(SPAWNS__CONDITIONS, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - _log(SPAWNS__CONDITIONS, "Requested to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - _log(SPAWNS__CONDITIONS, "Failed to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - _log(SPAWNS__CONDITIONS, "Failed to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - _log(SPAWNS__CONDITIONS, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone. State changed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone but no change was needed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - _log(SPAWNS__CONDITIONS, "Unable to find spawn event %d in the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d is not located in this zone but no change was needed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Unable to find local condition %d in Get request.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(SPAWNS__CONDITIONS, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - _log(SPAWNS__CONDITIONS, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } From eaf2da1171ab6a704adc558d22683867f1d157cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:53:17 -0600 Subject: [PATCH 0862/1883] Convert 'TRIBUTE' debugging _log to logger.LogDebugType --- zone/client_packet.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 08f52a4bb..09f2b1da6 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9814,7 +9814,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_OpenGuildTributeMaster of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9846,7 +9846,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_OpenTributeMaster of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -11782,7 +11782,7 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_SelectTribute of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this @@ -13757,7 +13757,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_TributeItem of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13776,7 +13776,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - _log(TRIBUTE__OUT, "Sending tribute item reply with %d points", t->tribute_points); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13786,7 +13786,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_TributeMoney of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13805,7 +13805,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - _log(TRIBUTE__OUT, "Sending tribute money reply with %d points", t->tribute_points); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13815,7 +13815,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_TributeNPC of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13823,7 +13823,7 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_TributeToggle of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) @@ -13837,7 +13837,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - _log(TRIBUTE__IN, "Received OP_TributeUpdate of length %d", app->size); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... From 463b358992c8352acbaa7ddd406e46df6b6316ff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:53:46 -0600 Subject: [PATCH 0863/1883] Convert 'INVENTORY' debugging _log to logger.LogDebugType --- zone/inventory.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 19fca9f47..898a0b833 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - _log(INVENTORY__BANDOLIER, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - _log(INVENTORY__BANDOLIER, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::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); } else { - _log(INVENTORY__BANDOLIER, "Char: %s no item in slot %i", GetName(), WeaponSlot); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - _log(INVENTORY__BANDOLIER, "Char: %s removing set", GetName(), bds->number); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - _log(INVENTORY__BANDOLIER, "Char: %s activating set %i", GetName(), bss->number); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,11 +2585,11 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - _log(INVENTORY__BANDOLIER, "Character does not have required bandolier item for slot %i", WeaponSlot); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - _log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); @@ -2640,7 +2640,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - _log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory", + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - _log(INVENTORY__SLOTS,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - _log(INVENTORY__SLOTS, "Char: %s Storing in main inventory slot %i", GetName(), i); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - _log(INVENTORY__SLOTS, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - _log(INVENTORY__SLOTS, "Char: %s No space, putting on the cursor", GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); From 53db4771f75a1610d0477a8181349dc9faac96dd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:54:16 -0600 Subject: [PATCH 0864/1883] Convert 'DOORS' debugging _log to logger.LogDebugType --- zone/doors.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index a4d3f80f2..3bc0101b1 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - _log(DOORS__INFO, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - _log(DOORS__INFO, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - _log(DOORS__INFO, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; From 509bd2d652a5a593386ad627d0796a040348b8b7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:55:44 -0600 Subject: [PATCH 0865/1883] Convert 'TRADESKILLS' debugging _log to logger.LogDebugType --- common/eqemu_logsys.cpp | 1 + common/eqemu_logsys.h | 1 + zone/tradeskills.cpp | 16 ++++++++-------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 857d0ed63..d2e839ddf 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -91,6 +91,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Spells", "Tasks", "Trading", + "Tradeskills", "Tribute", }; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index ecf3fecf7..f99273313 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -68,6 +68,7 @@ public: Spells, Tasks, Trading, + Tradeskills, Tribute, MaxCategoryID /* Don't Remove this*/ }; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index b249e2c28..ad85d23df 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - _log(TRADESKILLS__TRACE, "...This combine cannot fail."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - _log(TRADESKILLS__TRACE, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - _log(TRADESKILLS__TRACE, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - _log(TRADESKILLS__TRACE, "Tradeskill success"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - _log(TRADESKILLS__TRACE, "Tradeskill failed"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - _log(TRADESKILLS__TRACE, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - _log(TRADESKILLS__TRACE, "...Stage1 chance was: %f percent", chance_stage1); - _log(TRADESKILLS__TRACE, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, From 44b6e9aa3f5612f4ee7a74e8c315517782d2a8d6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:57:04 -0600 Subject: [PATCH 0866/1883] Convert 'AA' debugging _log to logger.LogDebugType --- zone/bonuses.cpp | 6 +++--- zone/bot.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a47c1f38b..48102b120 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - _log(AA__BONUSES, "Calculating AA Bonuses for %s.", this->GetCleanName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - _log(AA__BONUSES, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -638,7 +638,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - _log(AA__BONUSES, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index 1f0cc6062..608cad996 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - _log(AA__BONUSES, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) From ae6bf5a227879039e66bb4335bbee69bfc02d1c5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:57:38 -0600 Subject: [PATCH 0867/1883] Convert 'Skills' debugging _log to logger.LogDebugType --- zone/client.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index abb7725ba..d65354d0e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2242,13 +2242,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - _log(SKILLS__GAIN, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - _log(SKILLS__GAIN, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2269,10 +2269,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - _log(SKILLS__GAIN, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - _log(SKILLS__GAIN, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } From 6d8f64da57f936f418378781bedfad20853b1473 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:58:13 -0600 Subject: [PATCH 0868/1883] Convert 'TASKS' debugging _log to logger.LogDebugType --- zone/tasks.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 67f137d64..1cd2588e1 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -115,7 +115,7 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadLists failed"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { @@ -126,10 +126,10 @@ bool TaskManager::LoadTasks(int singleTask) { std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadLists failed"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - _log(TASKS__GLOBALLOAD,"TaskManager::LoadTasks LoadTaskSets failed"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - _log(TASKS__CLIENTSAVE,"TaskManager::SaveClientState for character ID %d", characterID); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; task Date: Mon, 12 Jan 2015 23:01:01 -0600 Subject: [PATCH 0869/1883] Convert 'COMMON' debugging _log to logger.LogDebugType --- common/eq_stream_factory.cpp | 8 ++++---- common/spdat.cpp | 1 + common/tcp_connection.cpp | 4 ++-- common/tcp_server.cpp | 4 ++-- zone/net.cpp | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 0b940c18f..22412e0fe 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -25,13 +25,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - _log(COMMON__THREADS, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - _log(COMMON__THREADS, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -42,13 +42,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - _log(COMMON__THREADS, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - _log(COMMON__THREADS, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/spdat.cpp b/common/spdat.cpp index 22861e53e..08081c8d8 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -72,6 +72,7 @@ #include "../common/logsys.h" #include "../common/logtypes.h" +#include "../common/eqemu_logsys.h" #include "classes.h" #include "spdat.h" diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 890a46adc..3f1e30a46 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -899,7 +899,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - _log(COMMON__THREADS, "Starting TCPConnectionLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -926,7 +926,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - _log(COMMON__THREADS, "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index f99fb256d..2313b9e7c 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -67,7 +67,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - _log(COMMON__THREADS, "Starting TCPServerLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -78,7 +78,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - _log(COMMON__THREADS, "Ending TCPServerLoop with thread ID %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/zone/net.cpp b/zone/net.cpp index 7ca406a96..df17ff73e 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - _log(COMMON__THREADS, "Main thread running with thread id %d", pthread_self()); + logger.LogDebug(EQEmuLogSys::Detail, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); From b219d7316301c748f1f24190efbc2477dcac2281 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 23:08:35 -0600 Subject: [PATCH 0870/1883] _log replacements in various spots --- common/misc_functions.h | 2 +- common/patches/ss_define.h | 8 ++++---- zone/exp.cpp | 4 ++-- zone/tasks.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/misc_functions.h b/common/misc_functions.h index 610a86b04..7900bc855 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - _log(NET__ERROR, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index 23d5dbbad..fbaee3689 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - _log(NET__STRUCTS, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - _log(NET__STRUCTS, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - _log(NET__STRUCTS, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - _log(NET__STRUCTS, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/zone/exp.cpp b/zone/exp.cpp index a96b9a9a0..c1ceeeae2 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - _log(CLIENT__EXP, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + logger.LogDebug(EQEmuLogSys::Detail, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - _log(CLIENT__EXP, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + logger.LogDebug(EQEmuLogSys::Detail, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 1cd2588e1..37dc89fc2 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2262,7 +2262,7 @@ void Client::SendTaskComplete(int TaskIndex) { // I suspect this is the type field to indicate this is a quest task, as opposed to other types. tcs->unknown04 = 0x00000002; - _log("[TASKS]SendTasksComplete"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks, "SendTasksComplete"); DumpPacket(outapp); fflush(stdout); QueuePacket(outapp); From e0602efca2eb8e18bd7ed9f579f9521d38954854 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 13 Jan 2015 00:36:25 -0500 Subject: [PATCH 0871/1883] Fix out of bounds in Mob::ResourceTap --- zone/spell_effects.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 70a7d3981..1f7083118 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -6568,33 +6568,32 @@ bool Mob::TrySpellProjectile(Mob* spell_target, uint16 spell_id, float speed){ DoAnim(anim, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); //Override the default projectile animation. return true; -} +} -void Mob::ResourceTap(int32 damage, uint16 spellid){ +void Mob::ResourceTap(int32 damage, uint16 spellid) +{ //'this' = caster if (!IsValidSpell(spellid)) return; - for (int i = 0; i <= EFFECT_COUNT; i++) - { - if (spells[spellid].effectid[i] == SE_ResourceTap){ - - damage += (damage * spells[spellid].base[i])/100; + for (int i = 0; i < EFFECT_COUNT; i++) { + if (spells[spellid].effectid[i] == SE_ResourceTap) { + damage += (damage * spells[spellid].base[i]) / 100; if (spells[spellid].max[i] && (damage > spells[spellid].max[i])) damage = spells[spellid].max[i]; - if (spells[spellid].base2[i] == 0){ //HP Tap + if (spells[spellid].base2[i] == 0) { // HP Tap if (damage > 0) HealDamage(damage); else - Damage(this, -damage,0, SkillEvocation,false); + Damage(this, -damage, 0, SkillEvocation, false); } - if (spells[spellid].base2[i] == 1) //Mana Tap + if (spells[spellid].base2[i] == 1) // Mana Tap SetMana(GetMana() + damage); - if (spells[spellid].base2[i] == 2 && IsClient()) //Endurance Tap + if (spells[spellid].base2[i] == 2 && IsClient()) // Endurance Tap CastToClient()->SetEndurance(CastToClient()->GetEndurance() + damage); } } From 4bf2bfc8e36af5072d633ec71c0f1bb751c25519 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 13 Jan 2015 13:43:41 -0600 Subject: [PATCH 0872/1883] Debug message function updates --- common/eqemu_logsys.cpp | 29 +++++++++++++++++++++++------ common/eqemu_logsys.h | 5 +++-- zone/client_logs.cpp | 13 ++++++++++++- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d2e839ddf..a0220e282 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -136,7 +136,7 @@ void EQEmuLogSys::StartLogs(const std::string log_name) } } -void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...) +void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) { if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } @@ -145,7 +145,19 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::str std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); + + std::string category_string = ""; + if (log_category > 0 && LogCategoryName[log_category]){ + category_string = StringFormat("[%s]", LogCategoryName[log_category]); + } + + std::string output_debug_message = StringFormat("%s %s", category_string.c_str(), output_message.c_str()); + + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + on_log_gmsay_hook(EQEmuLogSys::LogType::Debug, output_debug_message); + } + + EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, log_category, output_message); } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) @@ -197,7 +209,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) on_log_gmsay_hook(log_type, output_message); } - EQEmuLogSys::ConsoleMessage(log_type, output_message); + EQEmuLogSys::ConsoleMessage(log_type, 0, output_message); char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); @@ -206,11 +218,11 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; } else{ - std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; + // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; } } -void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) +void EQEmuLogSys::ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) { if (log_type > EQEmuLogSys::MaxLogID){ return; @@ -220,6 +232,11 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) } if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } + std::string category = ""; + if (log_category > 0 && LogCategoryName[log_category]){ + category = StringFormat("[%s] ", LogCategoryName[log_category]); + } + #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -237,7 +254,7 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) } #endif - std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; + std::cout << "[N::" << TypeNames[log_type] << "] " << category << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index f99273313..3440f5a5e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,11 +74,11 @@ public: }; void CloseZoneLogs(); - void ConsoleMessage(uint16 log_type, const std::string message); + void ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); void LoadLogSettings(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); - void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); + void LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartLogs(const std::string log_name); @@ -98,6 +98,7 @@ public: private: bool zone_general_init = false; std::function on_log_gmsay_hook; + }; extern EQEmuLogSys logger; diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index f2ead3a59..15079df60 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" #include "../common/features.h" +#include "../common/eqemu_logsys.h" #ifdef CLIENT_LOGS #include "client_logs.h" @@ -135,8 +136,18 @@ void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char client_logs.msg(id, _buffer); } +static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { + 15, // "Status", - Yellow + 15, // "Normal", - Yellow + 3, // "Error", - Red + 14, // "Debug", - Light Green + 4, // "Quest", + 5, // "Command", + 3 // "Crash" +}; + void ClientLogs::ClientMessage(uint16 log_type, std::string& message){ - entity_list.MessageStatus(0, 80, 7, "%s", message.c_str()); + entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } #endif //CLIENT_LOGS From 72b53ee2a56b89498a06e19e507c7d1cd1b037bd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 13 Jan 2015 15:11:01 -0600 Subject: [PATCH 0873/1883] EQEmuLogSys internal function consolidation --- common/eqemu_logsys.cpp | 65 +++++++++++++++++++++-------------------- common/eqemu_logsys.h | 5 +++- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index a0220e282..2dd2aed14 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -136,6 +136,14 @@ void EQEmuLogSys::StartLogs(const std::string log_name) } } +std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, std::string in_message){ + std::string category_string = ""; + if (log_category > 0 && LogCategoryName[log_category]){ + category_string = StringFormat("[%s] ", LogCategoryName[log_category]); + } + return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); +} + void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) { if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } @@ -145,19 +153,29 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std: std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - - std::string category_string = ""; - if (log_category > 0 && LogCategoryName[log_category]){ - category_string = StringFormat("[%s]", LogCategoryName[log_category]); - } + std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - std::string output_debug_message = StringFormat("%s %s", category_string.c_str(), output_message.c_str()); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); +} +void EQEmuLogSys::ProcessGMSay(uint16 log_type, std::string message){ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - on_log_gmsay_hook(EQEmuLogSys::LogType::Debug, output_debug_message); + on_log_gmsay_hook(log_type, message); } +} - EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, log_category, output_message); +void EQEmuLogSys::ProcessLogWrite(uint16 log_type, std::string message){ + char time_stamp[80]; + EQEmuLogSys::SetCurrentTimeStamp(time_stamp); + + if (process_log){ + process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << message << std::endl; + } + else{ + // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; + } } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) @@ -169,7 +187,9 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_message); + EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, output_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ @@ -205,24 +225,12 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - on_log_gmsay_hook(log_type, output_message); - } - - EQEmuLogSys::ConsoleMessage(log_type, 0, output_message); - - char time_stamp[80]; - EQEmuLogSys::SetCurrentTimeStamp(time_stamp); - - if (process_log){ - process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; - } - else{ - // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; - } + EQEmuLogSys::ProcessGMSay(log_type, output_message); + EQEmuLogSys::ConsoleMessage(log_type, output_message); + EQEmuLogSys::ProcessLogWrite(log_type, output_message); } -void EQEmuLogSys::ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) +void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) { if (log_type > EQEmuLogSys::MaxLogID){ return; @@ -232,11 +240,6 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, uint16 log_category, const std } if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } - std::string category = ""; - if (log_category > 0 && LogCategoryName[log_category]){ - category = StringFormat("[%s] ", LogCategoryName[log_category]); - } - #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -254,7 +257,7 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, uint16 log_category, const std } #endif - std::cout << "[N::" << TypeNames[log_type] << "] " << category << message << "\n"; + std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 3440f5a5e..d4a055260 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,7 +74,7 @@ public: }; void CloseZoneLogs(); - void ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); + void ConsoleMessage(uint16 log_type, const std::string message); void LoadLogSettings(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); @@ -99,6 +99,9 @@ private: bool zone_general_init = false; std::function on_log_gmsay_hook; + void ProcessGMSay(uint16 log_type, std::string message); + void ProcessLogWrite(uint16 log_type, std::string message); + std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); }; extern EQEmuLogSys logger; From 99a0012bddd37f0908e043a1fc14855cb0f1b054 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 13 Jan 2015 15:13:12 -0600 Subject: [PATCH 0874/1883] Removal of rule based settings, moving to separate DB table --- common/eqemu_logsys.cpp | 14 -------------- common/ruletypes.h | 12 ------------ 2 files changed, 26 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 2dd2aed14..cfd7ab372 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -19,7 +19,6 @@ #include "eqemu_logsys.h" #include "string_util.h" -#include "rulesys.h" #include "platform.h" #include @@ -146,7 +145,6 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) { - if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } va_list args; va_start(args, message); @@ -180,8 +178,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_type, std::string message){ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) { - if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } - va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); @@ -210,15 +206,9 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { - if (log_type > EQEmuLogSys::MaxLogID){ return; } - if (!RuleB(Logging, LogFileCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } - - if (!RuleB(Logging, EnableFileLogging)){ - return; - } va_list args; va_start(args, message); @@ -235,10 +225,6 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) if (log_type > EQEmuLogSys::MaxLogID){ return; } - if (!RuleB(Logging, EnableConsoleLogging)){ - return; - } - if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } #ifdef _WINDOWS HANDLE console_handle; diff --git a/common/ruletypes.h b/common/ruletypes.h index c16590783..ad04cdbff 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -596,18 +596,6 @@ RULE_CATEGORY( Client ) RULE_BOOL( Client, UseLiveFactionMessage, false) // Allows players to see faction adjustments like Live RULE_CATEGORY_END() -RULE_CATEGORY(Logging) -RULE_BOOL(Logging, ConsoleLogCommands, false) /* Turns on or off console logs */ -RULE_BOOL(Logging, LogFileCommands, false) - -RULE_INT(Logging, DebugLogLevel, 0) /* Sets Debug Level, -1 = OFF, 0 = Low Level, 1 = Info, 2 = Extreme */ - -RULE_BOOL(Logging, EnableConsoleLogging, true) /* Turns on or off ALL logging to console */ -RULE_BOOL(Logging, EnableFileLogging, true) /* Turns on or off ALL forms of file logging */ - -RULE_CATEGORY_END() - - #undef RULE_CATEGORY #undef RULE_INT #undef RULE_REAL From ea7453946ceac8f2025cf103af88ed88c5eeb98e Mon Sep 17 00:00:00 2001 From: RicardoCampos Date: Tue, 13 Jan 2015 21:47:51 +0000 Subject: [PATCH 0875/1883] Altered the way that start zone overrides work. These now no longer use an entry in the variables table, but rather use TitaniumStartZoneID, and SofStartZoneID in the rule_values table. If this is set, it will look for a match in the start_zones based on race/class/deity and the zone id. If it finds a matching row (by zone_id), it will use that row's details. If not, it will use a default. --- common/ruletypes.h | 1 + world/client.cpp | 42 +++---- world/worlddb.cpp | 266 +++++++++++++++++++-------------------------- world/worlddb.h | 9 +- 4 files changed, 137 insertions(+), 181 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index c5a4bb562..79e28c143 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -165,6 +165,7 @@ RULE_INT ( World, ExemptAccountLimitStatus, -1 ) //Min status required to be exe RULE_BOOL ( World, GMAccountIPList, false) // Check ip list against GM Accounts, AntiHack GM Accounts. RULE_INT ( World, MinGMAntiHackStatus, 1 ) //Minimum GM status to check against AntiHack list RULE_INT ( World, SoFStartZoneID, -1 ) //Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled) +RULE_INT ( World, TitaniumStartZoneID, -1) //Sets the Starting Zone for Titanium Clients (-1 is disabled). Replaces the old method. RULE_INT ( World, ExpansionSettings, 16383) // Sets the expansion settings for the server, This is sent on login to world and affects client expansion settings. Defaults to all expansions enabled up to TSS. RULE_INT ( World, PVPSettings, 0) // Sets the PVP settings for the server, 1 = Rallos Zek RuleSet, 2 = Tallon/Vallon Zek Ruleset, 4 = Sullon Zek Ruleset, 6 = Discord Ruleset, anything above 6 is the Discord Ruleset without the no-drop restrictions removed. TODO: Edit IsAttackAllowed in Zone to accomodate for these rules. RULE_BOOL (World, IsGMPetitionWindowEnabled, false) diff --git a/world/client.cpp b/world/client.cpp index 01130302d..1ceca8284 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1439,33 +1439,27 @@ 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 && RuleI(World, SoFStartZoneID) > 0) { + if (ClientVersionBit & BIT_SoFAndLater) { clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); - pp.zone_id = RuleI(World, SoFStartZoneID); - if (pp.zone_id) - database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); - else - clog(WORLD__CLIENT_ERR,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); - } else { - /* if there's a startzone variable put them in there */ - if (database.GetVariable("startzone", startzone, 50)) { - clog(WORLD__CLIENT,"Found 'startzone' variable setting: %s", startzone); - pp.zone_id = database.GetZoneID(startzone); - if (pp.zone_id) - database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); - else - clog(WORLD__CLIENT_ERR,"Error getting zone id for '%s'", startzone); - } else { /* otherwise use normal starting zone logic */ - bool ValidStartZone = false; - if (ClientVersionBit & BIT_TitaniumAndEarlier) - ValidStartZone = database.GetStartZone(&pp, cc); - else - ValidStartZone = database.GetStartZoneSoF(&pp, cc); - - if (!ValidStartZone) - return false; + if (RuleI(World, SoFStartZoneID) > 0) { + pp.zone_id = RuleI(World, SoFStartZoneID); + cc->start_zone = pp.zone_id; } } + else { + clog(WORLD__CLIENT, "Found 'TitaniumStartZoneID' rule setting: %i", RuleI(World, TitaniumStartZoneID)); + if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */ + + pp.zone_id = RuleI(World, TitaniumStartZoneID); + cc->start_zone = pp.zone_id; + } + } + /* 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); + + if (!ValidStartZone){ + return false; + } /* just in case */ if (!pp.zone_id) { diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 91406b527..73a7a284b 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -282,117 +282,38 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { return zone_id; } -bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) + + +bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc,bool isTitanium) { + // SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead. + // + // For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity. + // + // For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely + // reason for no match being found. + // if(!in_pp || !in_cc) return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; - std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id " - "FROM start_zones WHERE player_choice = % i " - "AND player_class = %i AND player_deity = %i " - "AND player_race = %i", - in_cc->start_zone, in_cc->class_, in_cc->deity, - in_cc->race); + //this is wrong. if start_zone is set we should use that id + std::string query = StringFormat("SELECT x, y, z, heading, start_zone, bind_id FROM start_zones WHERE zone_id = %i " + "AND player_class = %i AND player_deity = %i AND player_race = %i", + in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - LogFile->write(EQEmuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + LogFile->write(EQEmuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - LogFile->write(EQEmuLog::Status, "Start zone query: %s\n", query.c_str()); + LogFile->write(EQEmuLog::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); - switch(in_cc->start_zone) - { - case 0: - { - in_pp->zone_id = 24; // erudnext - in_pp->binds[0].zoneId = 38; // tox - break; - } - case 1: - { - in_pp->zone_id = 2; // qeynos2 - in_pp->binds[0].zoneId = 2; // qeynos2 - break; - } - case 2: - { - in_pp->zone_id = 29; // halas - in_pp->binds[0].zoneId = 30; // everfrost - break; - } - case 3: - { - in_pp->zone_id = 19; // rivervale - in_pp->binds[0].zoneId = 20; // kithicor - break; - } - case 4: - { - in_pp->zone_id = 9; // freportw - in_pp->binds[0].zoneId = 9; // freportw - break; - } - case 5: - { - in_pp->zone_id = 40; // neriaka - in_pp->binds[0].zoneId = 25; // nektulos - break; - } - case 6: - { - in_pp->zone_id = 52; // gukta - in_pp->binds[0].zoneId = 46; // innothule - break; - } - case 7: - { - in_pp->zone_id = 49; // oggok - in_pp->binds[0].zoneId = 47; // feerrott - break; - } - case 8: - { - in_pp->zone_id = 60; // kaladima - in_pp->binds[0].zoneId = 68; // butcher - break; - } - case 9: - { - in_pp->zone_id = 54; // gfaydark - in_pp->binds[0].zoneId = 54; // gfaydark - break; - } - case 10: - { - in_pp->zone_id = 61; // felwithea - in_pp->binds[0].zoneId = 54; // gfaydark - break; - } - case 11: - { - in_pp->zone_id = 55; // akanon - in_pp->binds[0].zoneId = 56; // steamfont - break; - } - case 12: - { - in_pp->zone_id = 82; // cabwest - in_pp->binds[0].zoneId = 78; // fieldofbone - break; - } - case 13: - { - in_pp->zone_id = 155; // sharvahl - in_pp->binds[0].zoneId = 155; // sharvahl - break; - } - } + isTitanium ? SetTitaniumDefaultStartZone(in_pp, in_cc) : SetSoFDefaultStartZone(in_pp, in_cc); } else { LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); @@ -413,65 +334,106 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* return true; } - -bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) -{ - // SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead. - // - // For SoF, search for an entry in start_zones with a matching zone_id, class, race and deity. - // - // For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely - // reason for no match being found. - // - if(!in_pp || !in_cc) - return false; - - in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; - in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; - - std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i " - "AND player_class = %i AND player_deity = %i AND player_race = %i", - in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); - auto results = QueryDatabase(query); - if(!results.Success()) { - LogFile->write(EQEmuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); - return false; - } - - LogFile->write(EQEmuLog::Status, "SoF Start zone query: %s\n", query.c_str()); - - if (results.RowCount() == 0) { - printf("No start_zones entry in database, using defaults\n"); - - if(in_cc->start_zone == RuleI(World, TutorialZoneID)) - in_pp->zone_id = in_cc->start_zone; - else { - in_pp->x = in_pp->binds[0].x = -51; - in_pp->y = in_pp->binds[0].y = -20; - in_pp->z = in_pp->binds[0].z = 0.79; - in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach. - } - } - else { - LogFile->write(EQEmuLog::Status, "Found starting location in start_zones"); - auto row = results.begin(); - in_pp->x = atof(row[0]); - in_pp->y = atof(row[1]); - in_pp->z = atof(row[2]); - in_pp->heading = atof(row[3]); +void WorldDatabase::SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc){ + if (in_cc->start_zone == RuleI(World, TutorialZoneID)) in_pp->zone_id = in_cc->start_zone; - in_pp->binds[0].zoneId = atoi(row[4]); + else { + in_pp->x = in_pp->binds[0].x = -51; + in_pp->y = in_pp->binds[0].y = -20; + in_pp->z = in_pp->binds[0].z = 0.79; + in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach. + } +} +void WorldDatabase::SetTitaniumDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) +{ + switch (in_cc->start_zone) + { + case 0: + { + in_pp->zone_id = 24; // erudnext + in_pp->binds[0].zoneId = 38; // tox + break; + } + case 1: + { + in_pp->zone_id = 2; // qeynos2 + in_pp->binds[0].zoneId = 2; // qeynos2 + break; + } + case 2: + { + in_pp->zone_id = 29; // halas + in_pp->binds[0].zoneId = 30; // everfrost + break; + } + case 3: + { + in_pp->zone_id = 19; // rivervale + in_pp->binds[0].zoneId = 20; // kithicor + break; + } + case 4: + { + in_pp->zone_id = 9; // freportw + in_pp->binds[0].zoneId = 9; // freportw + break; + } + case 5: + { + in_pp->zone_id = 40; // neriaka + in_pp->binds[0].zoneId = 25; // nektulos + break; + } + case 6: + { + in_pp->zone_id = 52; // gukta + in_pp->binds[0].zoneId = 46; // innothule + break; + } + case 7: + { + in_pp->zone_id = 49; // oggok + in_pp->binds[0].zoneId = 47; // feerrott + break; + } + case 8: + { + in_pp->zone_id = 60; // kaladima + in_pp->binds[0].zoneId = 68; // butcher + break; + } + case 9: + { + in_pp->zone_id = 54; // gfaydark + in_pp->binds[0].zoneId = 54; // gfaydark + break; + } + case 10: + { + in_pp->zone_id = 61; // felwithea + in_pp->binds[0].zoneId = 54; // gfaydark + break; + } + case 11: + { + in_pp->zone_id = 55; // akanon + in_pp->binds[0].zoneId = 56; // steamfont + break; + } + case 12: + { + in_pp->zone_id = 82; // cabwest + in_pp->binds[0].zoneId = 78; // fieldofbone + break; + } + case 13: + { + in_pp->zone_id = 155; // sharvahl + in_pp->binds[0].zoneId = 155; // sharvahl + break; + } } - - if(in_pp->x == 0 && in_pp->y == 0 && in_pp->z == 0) - database.GetSafePoints(in_pp->zone_id, 0, &in_pp->x, &in_pp->y, &in_pp->z); - - if(in_pp->binds[0].x == 0 && in_pp->binds[0].y == 0 && in_pp->binds[0].z == 0) - database.GetSafePoints(in_pp->binds[0].zoneId, 0, &in_pp->binds[0].x, &in_pp->binds[0].y, &in_pp->binds[0].z); - - return true; } - void WorldDatabase::GetLauncherList(std::vector &rl) { rl.clear(); diff --git a/world/worlddb.h b/world/worlddb.h index ecb39ef61..166248e72 100644 --- a/world/worlddb.h +++ b/world/worlddb.h @@ -28,9 +28,7 @@ struct CharacterSelect_Struct; class WorldDatabase : public SharedDatabase { public: - bool GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc); - bool GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc); - + bool GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc, bool isTitanium); void GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*, uint32 ClientVersion); int MoveCharacterToBind(int CharID, uint8 bindnum = 0); @@ -40,8 +38,9 @@ public: bool LoadCharacterCreateAllocations(); bool LoadCharacterCreateCombos(); -protected: - +private: + void SetTitaniumDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc); + void SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc); }; extern WorldDatabase database; From 87bf191fad71016b11ba0dfec18475db9a2adaea Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 13 Jan 2015 23:48:34 -0500 Subject: [PATCH 0876/1883] Placed an upper limit on the cursor queue save loop --- changelog.txt | 3 +++ common/shareddb.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/changelog.txt b/changelog.txt index 54c7478a2..a84b822bf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/13/2015 == +Uleat: Placed an upper limit on the cursor queue save loop. + == 01/12/2015 == Uleat: Fix for OP_FormattedMessage text link server crashes Uleat: Added text link translators for OP_TaskDescription (RoF+ -- all clients current) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 42aeebfea..b97d5a984 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -108,6 +108,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iter int i = 8000; for(auto it = start; it != end; ++it, i++) { + if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high ItemInst *inst = *it; if (!SaveInventory(char_id,inst,(i == 8000) ? MainCursor : i)) return false; From af42bfdb02c4068e9cc989376ee2a3fa8942ff21 Mon Sep 17 00:00:00 2001 From: Trevius Date: Tue, 13 Jan 2015 23:37:35 -0600 Subject: [PATCH 0877/1883] (RoF2) Guild invites now add new members as members instead of recruits, and /guild chat works properly. (RoF2) Guild Promote is now functional. --- changelog.txt | 2 ++ utils/patches/patch_RoF2.conf | 2 +- zone/client_packet.cpp | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index a84b822bf..fe471b367 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 01/13/2015 == Uleat: Placed an upper limit on the cursor queue save loop. +Trevius: (RoF2) Guild invites now add new members as members instead of recruits, and /guild chat works properly. +Trevius: (RoF2) Guild Promote is now functional. == 01/12/2015 == Uleat: Fix for OP_FormattedMessage text link server crashes diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 23bec152e..7159dcce5 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -126,7 +126,7 @@ OP_GuildLeader=0x7e09 OP_GuildDelete=0x3708 OP_GuildInviteAccept=0x7053 OP_GuildDemote=0x2d4e -OP_GuildPromote=0x0000 +OP_GuildPromote=0x6a98 OP_GuildPublicNote=0x5053 OP_GuildManageBanker=0x748f OP_GuildBank=0x5134 diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 8b82d84db..734d82de5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -7489,7 +7489,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) uint32 guildrank = gj->response; - if (GetClientVersion() == EQClientRoF) + if (GetClientVersion() >= EQClientRoF) { if (gj->response == 8) { @@ -7668,7 +7668,10 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) uint8 rank = gci.rank + 1; if (rank > GUILD_OFFICER) + { + Message(0, "You cannot promote someone to be guild leader. You must use /guildleader."); return; + } mlog(GUILDS__ACTIONS, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", From bdd170df6ceb8545d740e56ce98cfdd93091d902 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 14 Jan 2015 05:12:01 -0600 Subject: [PATCH 0878/1883] More moving around of internal EQEmuLogSys functions --- common/eqemu_logsys.cpp | 145 ++++++++++++++++++++-------------------- common/eqemu_logsys.h | 10 +-- zone/zone.cpp | 4 +- 3 files changed, 81 insertions(+), 78 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index cfd7ab372..4883b94a6 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -18,8 +18,8 @@ #include "eqemu_logsys.h" -#include "string_util.h" #include "platform.h" +#include "string_util.h" #include #include @@ -126,15 +126,6 @@ void EQEmuLogSys::LoadLogSettings() log_settings_loaded = true; } -void EQEmuLogSys::StartLogs(const std::string log_name) -{ - if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - std::cout << "Starting Zone Logs..." << std::endl; - EQEmuLogSys::MakeDirectory("logs/zone"); - process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); - } -} - std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, std::string in_message){ std::string category_string = ""; if (log_category > 0 && LogCategoryName[log_category]){ @@ -143,20 +134,7 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); } -void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) -{ - va_list args; - va_start(args, message); - std::string output_message = vStringFormat(message.c_str(), args); - va_end(args); - - std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_debug_message); - EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, output_debug_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); -} void EQEmuLogSys::ProcessGMSay(uint16 log_type, std::string message){ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ @@ -176,6 +154,51 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_type, std::string message){ } } +void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, const std::string message) +{ + if (log_type > EQEmuLogSys::MaxLogID){ + return; + } + + #ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + if (LogColors[log_type]){ + SetConsoleTextAttribute(console_handle, LogColors[log_type]); + } + else{ + SetConsoleTextAttribute(console_handle, Console::Color::White); + } + #endif + + std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; + + #ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, Console::Color::White); + #endif +} + +void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) +{ + va_list args; + va_start(args, message); + std::string output_message = vStringFormat(message.c_str(), args); + va_end(args); + + std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); + + EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); +} + void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) { va_list args; @@ -183,11 +206,27 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); + EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_message); EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_message); - EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, output_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_message); } +void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) +{ + if (log_type > EQEmuLogSys::MaxLogID){ + return; + } + + va_list args; + va_start(args, message); + std::string output_message = vStringFormat(message.c_str(), args); + va_end(args); + + EQEmuLogSys::ProcessConsoleMessage(log_type, output_message); + EQEmuLogSys::ProcessGMSay(log_type, output_message); + EQEmuLogSys::ProcessLogWrite(log_type, output_message); +} + void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ time_t raw_time; struct tm * time_info; @@ -204,57 +243,19 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ #endif } -void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) -{ - if (log_type > EQEmuLogSys::MaxLogID){ - return; - } - - va_list args; - va_start(args, message); - std::string output_message = vStringFormat(message.c_str(), args); - va_end(args); - - EQEmuLogSys::ProcessGMSay(log_type, output_message); - EQEmuLogSys::ConsoleMessage(log_type, output_message); - EQEmuLogSys::ProcessLogWrite(log_type, output_message); -} - -void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) -{ - if (log_type > EQEmuLogSys::MaxLogID){ - return; - } - -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (LogColors[log_type]){ - SetConsoleTextAttribute(console_handle, LogColors[log_type]); - } - else{ - SetConsoleTextAttribute(console_handle, Console::Color::White); - } -#endif - - std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, Console::Color::White); -#endif -} - -void EQEmuLogSys::CloseZoneLogs() +void EQEmuLogSys::CloseFileLogs() { if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ std::cout << "Closing down zone logs..." << std::endl; process_log.close(); } +} + +void EQEmuLogSys::StartFileLogs(const std::string log_name) +{ + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + std::cout << "Starting Zone Logs..." << std::endl; + EQEmuLogSys::MakeDirectory("logs/zone"); + process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); + } } \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d4a055260..b52f3ecd6 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -73,15 +73,15 @@ public: MaxCategoryID /* Don't Remove this*/ }; - void CloseZoneLogs(); - void ConsoleMessage(uint16 log_type, const std::string message); + void CloseFileLogs(); + void LoadLogSettings(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); void LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); - void StartLogs(const std::string log_name); + void StartFileLogs(const std::string log_name); struct LogSettings{ uint8 log_to_file; @@ -99,9 +99,11 @@ private: bool zone_general_init = false; std::function on_log_gmsay_hook; + std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); + + void ProcessConsoleMessage(uint16 log_type, const std::string message); void ProcessGMSay(uint16 log_type, std::string message); void ProcessLogWrite(uint16 log_type, std::string message); - std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); }; extern EQEmuLogSys logger; diff --git a/zone/zone.cpp b/zone/zone.cpp index 98eb41ee3..6098a61c5 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -152,7 +152,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { /* Set Logging */ - logger.StartLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + logger.StartFileLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; } @@ -720,7 +720,7 @@ void Zone::Shutdown(bool quite) parse->ReloadQuests(true); UpdateWindowTitle(); - logger.CloseZoneLogs(); + logger.CloseFileLogs(); } void Zone::LoadZoneDoors(const char* zone, int16 version) From aa405df0e9a31c1425b04ee437a15273f28ca2c0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Wed, 14 Jan 2015 15:32:42 -0500 Subject: [PATCH 0879/1883] Fix clang compile --- zone/client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index adaa7ce2f..52bced4f4 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2852,7 +2852,8 @@ void Client::Message_StringID(uint32 type, uint32 string_id, const char* message bufptr += strlen(message_arg[i]) + 1; } - bufptr = '\0'; + // since we're moving the pointer the 0 offset is correct + bufptr[0] = '\0'; if(distance>0) entity_list.QueueCloseClients(this,outapp,false,distance); @@ -2964,7 +2965,8 @@ void Client::FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType fil bufptr += strlen(message_arg[i]) + 1; } - bufptr = '\0'; + // since we're moving the pointer the 0 offset is correct + bufptr[0] = '\0'; QueuePacket(outapp); safe_delete(outapp); From 2f32950364a26e4acba8c26eb09ed7dde9d37c4b Mon Sep 17 00:00:00 2001 From: JJ Date: Wed, 14 Jan 2015 18:32:53 -0500 Subject: [PATCH 0880/1883] Fix in npc save feature sql. (iluvseq) --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 1a190cc28..dd4618c87 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6654,7 +6654,7 @@ void command_npcedit(Client *c, const Seperator *sep) "SET luclin_haircolor = %i, luclin_beardcolor = %i, " "luclin_hairstyle = %i, luclin_beard = %i, " "face = %i, drakkin_heritage = %i, " - "drakkin_tattoo = %i, drakkin_details = %i, " + "drakkin_tattoo = %i, drakkin_details = %i " "WHERE id = %i", target->GetHairColor(), target->GetBeardColor(), target->GetHairStyle(), target->GetBeard(), From d694940b80d060f79701f3d27bbba77eebfb0ddb Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 14 Jan 2015 23:47:33 -0500 Subject: [PATCH 0881/1883] Fix for beneficial spells that do decrease hit point over time to start working again. --- zone/spell_effects.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1f7083118..cb21073ca 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3471,14 +3471,16 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste { effect_value = CalcSpellEffectValue(spell_id, i, caster_level, caster, ticsremaining); //Handle client cast DOTs here. - if (caster && effect_value < 0 && IsDetrimentalSpell(spell_id)){ + if (caster && effect_value < 0){ - if (caster->IsClient()){ - if (!caster->CastToClient()->GetFeigned()) + if (IsDetrimentalSpell(spell_id)){ + if (caster->IsClient()){ + if (!caster->CastToClient()->GetFeigned()) + AddToHateList(caster, -effect_value); + } + else if (!IsClient()) //Allow NPC's to generate hate if casted on other NPC's. AddToHateList(caster, -effect_value); } - else if (!IsClient()) //Allow NPC's to generate hate if casted on other NPC's. - AddToHateList(caster, -effect_value); effect_value = caster->GetActDoTDamage(spell_id, effect_value, this); From 75501fbb5d54194a27a42e824823553436ffb72b Mon Sep 17 00:00:00 2001 From: ricardocampos23 Date: Thu, 15 Jan 2015 21:03:06 +0000 Subject: [PATCH 0882/1883] corrected comment --- world/worlddb.cpp | 177 +++++++++++++++++++++++----------------------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 73a7a284b..988b7b32c 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -282,8 +282,6 @@ int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { return zone_id; } - - bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc,bool isTitanium) { // SoF doesn't send the player_choice field in character creation, it now sends the real zoneID instead. @@ -298,8 +296,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; - - //this is wrong. if start_zone is set we should use that id + // see if we have an entry for start_zone. We can support both titanium & SOF+ by having two entries per class/race/deity combo with different zone_ids std::string query = StringFormat("SELECT x, y, z, heading, start_zone, bind_id FROM start_zones WHERE zone_id = %i " "AND player_class = %i AND player_deity = %i AND player_race = %i", in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); @@ -335,8 +332,9 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* return true; } void WorldDatabase::SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc){ - if (in_cc->start_zone == RuleI(World, TutorialZoneID)) + if (in_cc->start_zone == RuleI(World, TutorialZoneID)) { in_pp->zone_id = in_cc->start_zone; + } else { in_pp->x = in_pp->binds[0].x = -51; in_pp->y = in_pp->binds[0].y = -20; @@ -344,94 +342,95 @@ void WorldDatabase::SetSoFDefaultStartZone(PlayerProfile_Struct* in_pp, CharCrea in_pp->zone_id = in_pp->binds[0].zoneId = 394; // Crescent Reach. } } + void WorldDatabase::SetTitaniumDefaultStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) { switch (in_cc->start_zone) { - case 0: - { - in_pp->zone_id = 24; // erudnext - in_pp->binds[0].zoneId = 38; // tox - break; - } - case 1: - { - in_pp->zone_id = 2; // qeynos2 - in_pp->binds[0].zoneId = 2; // qeynos2 - break; - } - case 2: - { - in_pp->zone_id = 29; // halas - in_pp->binds[0].zoneId = 30; // everfrost - break; - } - case 3: - { - in_pp->zone_id = 19; // rivervale - in_pp->binds[0].zoneId = 20; // kithicor - break; - } - case 4: - { - in_pp->zone_id = 9; // freportw - in_pp->binds[0].zoneId = 9; // freportw - break; - } - case 5: - { - in_pp->zone_id = 40; // neriaka - in_pp->binds[0].zoneId = 25; // nektulos - break; - } - case 6: - { - in_pp->zone_id = 52; // gukta - in_pp->binds[0].zoneId = 46; // innothule - break; - } - case 7: - { - in_pp->zone_id = 49; // oggok - in_pp->binds[0].zoneId = 47; // feerrott - break; - } - case 8: - { - in_pp->zone_id = 60; // kaladima - in_pp->binds[0].zoneId = 68; // butcher - break; - } - case 9: - { - in_pp->zone_id = 54; // gfaydark - in_pp->binds[0].zoneId = 54; // gfaydark - break; - } - case 10: - { - in_pp->zone_id = 61; // felwithea - in_pp->binds[0].zoneId = 54; // gfaydark - break; - } - case 11: - { - in_pp->zone_id = 55; // akanon - in_pp->binds[0].zoneId = 56; // steamfont - break; - } - case 12: - { - in_pp->zone_id = 82; // cabwest - in_pp->binds[0].zoneId = 78; // fieldofbone - break; - } - case 13: - { - in_pp->zone_id = 155; // sharvahl - in_pp->binds[0].zoneId = 155; // sharvahl - break; - } + case 0: + { + in_pp->zone_id = 24; // erudnext + in_pp->binds[0].zoneId = 38; // tox + break; + } + case 1: + { + in_pp->zone_id = 2; // qeynos2 + in_pp->binds[0].zoneId = 2; // qeynos2 + break; + } + case 2: + { + in_pp->zone_id = 29; // halas + in_pp->binds[0].zoneId = 30; // everfrost + break; + } + case 3: + { + in_pp->zone_id = 19; // rivervale + in_pp->binds[0].zoneId = 20; // kithicor + break; + } + case 4: + { + in_pp->zone_id = 9; // freportw + in_pp->binds[0].zoneId = 9; // freportw + break; + } + case 5: + { + in_pp->zone_id = 40; // neriaka + in_pp->binds[0].zoneId = 25; // nektulos + break; + } + case 6: + { + in_pp->zone_id = 52; // gukta + in_pp->binds[0].zoneId = 46; // innothule + break; + } + case 7: + { + in_pp->zone_id = 49; // oggok + in_pp->binds[0].zoneId = 47; // feerrott + break; + } + case 8: + { + in_pp->zone_id = 60; // kaladima + in_pp->binds[0].zoneId = 68; // butcher + break; + } + case 9: + { + in_pp->zone_id = 54; // gfaydark + in_pp->binds[0].zoneId = 54; // gfaydark + break; + } + case 10: + { + in_pp->zone_id = 61; // felwithea + in_pp->binds[0].zoneId = 54; // gfaydark + break; + } + case 11: + { + in_pp->zone_id = 55; // akanon + in_pp->binds[0].zoneId = 56; // steamfont + break; + } + case 12: + { + in_pp->zone_id = 82; // cabwest + in_pp->binds[0].zoneId = 78; // fieldofbone + break; + } + case 13: + { + in_pp->zone_id = 155; // sharvahl + in_pp->binds[0].zoneId = 155; // sharvahl + break; + } } } void WorldDatabase::GetLauncherList(std::vector &rl) { From 636a259c4ccf939ccc5cd5b175f49e1d65622c87 Mon Sep 17 00:00:00 2001 From: Uleat Date: Thu, 15 Jan 2015 21:24:26 -0500 Subject: [PATCH 0883/1883] Patchwork of changes..mostly related tracing a cursor queue bug (see changelog) --- changelog.txt | 10 + common/item.cpp | 781 +++++++++++++++++++++-------------------- common/item.h | 38 +- common/shareddb.cpp | 57 +-- zone/client_packet.cpp | 7 +- zone/command.cpp | 2 +- zone/corpse.cpp | 24 +- zone/inventory.cpp | 647 +++++++++++++++++----------------- 8 files changed, 794 insertions(+), 772 deletions(-) diff --git a/changelog.txt b/changelog.txt index fe471b367..79b156c0b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,15 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/15/2015 == +Uleat: Attempted fix for elusive inventory bug: + - Removed 'iter_queue' typedef and converted lcast to explicit or auto defines + - Reworked several functions that manipulate the cursor queue + - Found/corrected one occurrence of post-processing iterator incrementing in an ItemInstQueue handler + - Added many scope declarations in code that handles inventory manipulation (loose macros are bad...) +Uleat: Added Item_Struct pointer checks to ItemInst methods that did not have them +Uleat: Changed IsEquippable(race,class) to use bit-wise 'and' (&) over '(x%2)==1' in conditional check. +Uleat: Changed DyeArmor() assignment of 'armor_color' to use bit-wise 'or' and bit-shifting (|,<<) over multiplication and addition (*,+). + == 01/13/2015 == Uleat: Placed an upper limit on the cursor queue save loop. Trevius: (RoF2) Guild invites now add new members as members instead of recruits, and /guild chat works properly. diff --git a/common/item.cpp b/common/item.cpp index c06df3a89..044d55d3d 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -55,13 +55,10 @@ static inline int32 GetNextItemInstSerialNumber() { // // class ItemInstQueue // -ItemInstQueue::~ItemInstQueue() { - iter_queue cur, end; - cur = m_list.begin(); - end = m_list.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = *cur; - safe_delete(tmp); +ItemInstQueue::~ItemInstQueue() +{ + for (auto iter = m_list.begin(); iter != m_list.end(); ++iter) { + safe_delete(*iter); } m_list.clear(); } @@ -81,7 +78,7 @@ void ItemInstQueue::push_front(ItemInst* inst) // Remove item from front of queue ItemInst* ItemInstQueue::pop() { - if (m_list.size() == 0) + if (m_list.empty()) return nullptr; ItemInst* inst = m_list.front(); @@ -92,7 +89,7 @@ ItemInst* ItemInstQueue::pop() // Remove item from back of queue ItemInst* ItemInstQueue::pop_back() { - if (m_list.size() == 0) + if (m_list.empty()) return nullptr; ItemInst* inst = m_list.back(); @@ -103,53 +100,37 @@ ItemInst* ItemInstQueue::pop_back() // Look at item at front of queue ItemInst* ItemInstQueue::peek_front() const { - return (m_list.size() == 0) ? nullptr : m_list.front(); + return (m_list.empty()) ? nullptr : m_list.front(); } // // class Inventory // -Inventory::~Inventory() { - std::map::iterator cur, end; - - cur = m_worn.begin(); - end = m_worn.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = cur->second; - safe_delete(tmp); +Inventory::~Inventory() +{ + for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) { + safe_delete(iter->second); } m_worn.clear(); - cur = m_inv.begin(); - end = m_inv.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = cur->second; - safe_delete(tmp); + for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) { + safe_delete(iter->second); } m_inv.clear(); - cur = m_bank.begin(); - end = m_bank.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = cur->second; - safe_delete(tmp); + for (auto iter = m_bank.begin(); iter != m_bank.end(); ++iter) { + safe_delete(iter->second); } m_bank.clear(); - cur = m_shbank.begin(); - end = m_shbank.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = cur->second; - safe_delete(tmp); + for (auto iter = m_shbank.begin(); iter != m_shbank.end(); ++iter) { + safe_delete(iter->second); } m_shbank.clear(); - cur = m_trade.begin(); - end = m_trade.end(); - for (; cur != end; ++cur) { - ItemInst *tmp = cur->second; - safe_delete(tmp); + for (auto iter = m_trade.begin(); iter != m_trade.end(); ++iter) { + safe_delete(iter->second); } m_trade.clear(); } @@ -309,7 +290,8 @@ bool Inventory::DeleteItem(int16 slot_id, uint8 quantity) // the item is not stackable, and is not a charged item, or is expendable, delete it if (item_to_delete->IsStackable() || (!item_to_delete->IsStackable() && - ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))) { + ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) + ) { // Item can now be destroyed Inventory::MarkDirty(item_to_delete); return true; @@ -334,7 +316,8 @@ bool Inventory::CheckNoDrop(int16 slot_id) { if (inst->GetItem()->ItemClass == 1) { for (uint8 i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { ItemInst* bagitem = GetItem(Inventory::CalcSlotId(slot_id, i)); - if (bagitem && !bagitem->GetItem()->NoDrop) return true; + if (bagitem && !bagitem->GetItem()->NoDrop) + return true; } } return false; @@ -638,8 +621,7 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo if (!for_bag) { for (int16 i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { const ItemInst* inst = GetItem(i); - if (inst && inst->IsType(ItemClassContainer) - && inst->GetItem()->BagSize >= min_size) + if (inst && inst->IsType(ItemClassContainer) && inst->GetItem()->BagSize >= min_size) { if (inst->GetItem()->BagType == BagTypeQuiver && inst->GetItem()->ItemType != ItemTypeArrow) { @@ -651,18 +633,20 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo uint8 slots = inst->GetItem()->BagSlots; uint8 j; for (j = SUB_BEGIN; jIsType(ItemClassContainer)) { - for (int16 free_slot = EmuConstants::GENERAL_BEGIN; free_slot <= EmuConstants::GENERAL_END; ++free_slot) + for (int16 free_slot = EmuConstants::GENERAL_BEGIN; free_slot <= EmuConstants::GENERAL_END; ++free_slot) { if (!m_inv[free_slot]) return free_slot; + } return MainCursor; // return cursor since bags do not stack and will not fit inside other bags..yet...) } @@ -727,9 +712,10 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { if (!main_inst || (main_inst->GetItem()->BagType != BagTypeQuiver) || !main_inst->IsType(ItemClassContainer)) continue; - for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) + for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); + } } } @@ -741,9 +727,10 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { if (!main_inst || (main_inst->GetItem()->BagType != BagTypeBandolier) || !main_inst->IsType(ItemClassContainer)) continue; - for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) + for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); + } } } @@ -762,9 +749,10 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { if ((main_inst->GetItem()->BagSize < inst->GetItem()->Size) || (main_inst->GetItem()->BagType == BagTypeBandolier) || (main_inst->GetItem()->BagType == BagTypeQuiver)) continue; - for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) + for (uint8 free_bag_slot = SUB_BEGIN; (free_bag_slot < main_inst->GetItem()->BagSlots) && (free_bag_slot < EmuConstants::ITEM_CONTAINER_SIZE); ++free_bag_slot) { if (!main_inst->GetItem(free_bag_slot)) return Inventory::CalcSlotId(free_slot, free_bag_slot); + } } } @@ -776,27 +764,26 @@ int16 Inventory::FindFreeSlotForTradeItem(const ItemInst* inst) { int16 Inventory::CalcSlotId(int16 slot_id) { int16 parent_slot_id = INVALID_INDEX; - if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) - parent_slot_id = EmuConstants::GENERAL_BEGIN + (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; - - else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) - parent_slot_id = MainCursor; - - /* // this is not a bag range... using this risks over-writing existing items - else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) - parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; - */ - - else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) - parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; - - else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) - parent_slot_id = EmuConstants::SHARED_BANK_BEGIN + (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; - + //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + // parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; //else if (slot_id >= 3100 && slot_id <= 3179) should be {3031..3110}..where did this range come from!!? (verified db save range) - else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) + + if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) { + parent_slot_id = EmuConstants::GENERAL_BEGIN + (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + } + else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) { + parent_slot_id = MainCursor; + } + else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) { + parent_slot_id = EmuConstants::BANK_BEGIN + (slot_id - EmuConstants::BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + } + else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { + parent_slot_id = EmuConstants::SHARED_BANK_BEGIN + (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + } + else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) { parent_slot_id = EmuConstants::TRADE_BEGIN + (slot_id - EmuConstants::TRADE_BAGS_BEGIN) / EmuConstants::ITEM_CONTAINER_SIZE; + } return parent_slot_id; } @@ -808,20 +795,21 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { int16 slot_id = INVALID_INDEX; - if (bagslot_id == MainCursor || bagslot_id == 8000) + if (bagslot_id == MainCursor || bagslot_id == 8000) { slot_id = EmuConstants::CURSOR_BAG_BEGIN + bagidx; - - else if (bagslot_id >= EmuConstants::GENERAL_BEGIN && bagslot_id <= EmuConstants::GENERAL_END) + } + else if (bagslot_id >= EmuConstants::GENERAL_BEGIN && bagslot_id <= EmuConstants::GENERAL_END) { slot_id = EmuConstants::GENERAL_BAGS_BEGIN + (bagslot_id - EmuConstants::GENERAL_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; - - else if (bagslot_id >= EmuConstants::BANK_BEGIN && bagslot_id <= EmuConstants::BANK_END) + } + else if (bagslot_id >= EmuConstants::BANK_BEGIN && bagslot_id <= EmuConstants::BANK_END) { slot_id = EmuConstants::BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; - - else if (bagslot_id >= EmuConstants::SHARED_BANK_BEGIN && bagslot_id <= EmuConstants::SHARED_BANK_END) + } + else if (bagslot_id >= EmuConstants::SHARED_BANK_BEGIN && bagslot_id <= EmuConstants::SHARED_BANK_END) { slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN + (bagslot_id - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; - - else if (bagslot_id >= EmuConstants::TRADE_BEGIN && bagslot_id <= EmuConstants::TRADE_END) + } + else if (bagslot_id >= EmuConstants::TRADE_BEGIN && bagslot_id <= EmuConstants::TRADE_END) { slot_id = EmuConstants::TRADE_BAGS_BEGIN + (bagslot_id - EmuConstants::TRADE_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE + bagidx; + } return slot_id; } @@ -829,30 +817,28 @@ int16 Inventory::CalcSlotId(int16 bagslot_id, uint8 bagidx) { uint8 Inventory::CalcBagIdx(int16 slot_id) { uint8 index = 0; - if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) - index = (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - - else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) - index = (slot_id - EmuConstants::CURSOR_BAG_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots - - /* // this is not a bag range... using this risks over-writing existing items - else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) - index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - */ + //else if (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) + // index = (slot_id - EmuConstants::BANK_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) + if (slot_id >= EmuConstants::GENERAL_BAGS_BEGIN && slot_id <= EmuConstants::GENERAL_BAGS_END) { + index = (slot_id - EmuConstants::GENERAL_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; + } + else if (slot_id >= EmuConstants::CURSOR_BAG_BEGIN && slot_id <= EmuConstants::CURSOR_BAG_END) { + index = (slot_id - EmuConstants::CURSOR_BAG_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + } + else if (slot_id >= EmuConstants::BANK_BAGS_BEGIN && slot_id <= EmuConstants::BANK_BAGS_END) { index = (slot_id - EmuConstants::BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - - else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) + } + else if (slot_id >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { index = (slot_id - EmuConstants::SHARED_BANK_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - - else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) + } + else if (slot_id >= EmuConstants::TRADE_BAGS_BEGIN && slot_id <= EmuConstants::TRADE_BAGS_END) { index = (slot_id - EmuConstants::TRADE_BAGS_BEGIN) % EmuConstants::ITEM_CONTAINER_SIZE; - - // odd..but, ok... (probably a range-slot conversion for ItemInst* Object::item - else if (slot_id >= EmuConstants::WORLD_BEGIN && slot_id <= EmuConstants::WORLD_END) + } + else if (slot_id >= EmuConstants::WORLD_BEGIN && slot_id <= EmuConstants::WORLD_END) { index = (slot_id - EmuConstants::WORLD_BEGIN); // % EmuConstants::ITEM_CONTAINER_SIZE; - not needed since range is 10 slots + } return index; } @@ -914,13 +900,17 @@ uint8 Inventory::CalcMaterialFromSlot(int16 equipslot) bool Inventory::CanItemFitInContainer(const Item_Struct *ItemToTry, const Item_Struct *Container) { - if (!ItemToTry || !Container) return false; + if (!ItemToTry || !Container) + return false; - if (ItemToTry->Size > Container->BagSize) return false; + if (ItemToTry->Size > Container->BagSize) + return false; - if ((Container->BagType == BagTypeQuiver) && (ItemToTry->ItemType != ItemTypeArrow)) return false; + if ((Container->BagType == BagTypeQuiver) && (ItemToTry->ItemType != ItemTypeArrow)) + return false; - if ((Container->BagType == BagTypeBandolier) && (ItemToTry->ItemType != ItemTypeSmallThrowing)) return false; + if ((Container->BagType == BagTypeBandolier) && (ItemToTry->ItemType != ItemTypeSmallThrowing)) + return false; return true; } @@ -956,8 +946,11 @@ bool Inventory::SupportsContainers(int16 slot_id) (slot_id >= EmuConstants::GENERAL_BEGIN && slot_id <= EmuConstants::GENERAL_END) || (slot_id >= EmuConstants::BANK_BEGIN && slot_id <= EmuConstants::BANK_END) || (slot_id >= EmuConstants::SHARED_BANK_BEGIN && slot_id <= EmuConstants::SHARED_BANK_END) || - (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END)) + (slot_id >= EmuConstants::TRADE_BEGIN && slot_id <= EmuConstants::TRADE_END) + ) { return true; + } + return false; } @@ -1140,8 +1133,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) m_trade[slot_id] = inst; result = slot_id; } - else - { + else { // Slot must be within a bag parentSlot = Inventory::CalcSlotId(slot_id); ItemInst* baginst = GetItem(parentSlot); // Get parent bag @@ -1163,246 +1155,233 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) // Internal Method: Checks an inventory bucket for a particular item int16 Inventory::_HasItem(std::map& bucket, uint32 item_id, uint8 quantity) { - iter_inst it; - iter_contents itb; - ItemInst* inst = nullptr; uint8 quantity_found = 0; - // Check item: After failed checks, check bag contents (if bag) - for (it = bucket.begin(); it != bucket.end(); ++it) { - inst = it->second; - if (inst) { - if (inst->GetID() == item_id) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return it->first; - } + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + if (inst->GetID() == item_id) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return iter->first; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { - for (itb = inst->_begin(); itb != inst->_end(); ++itb) { - ItemInst* baginst = itb->second; - if (baginst && baginst->GetID() == item_id) { - quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(it->first, itb->first); - } - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (baginst && baginst->GetAugmentItemID(i) == item_id && quantity <= 1) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return legacy::SLOT_AUGMENT; + } + + if (!inst->IsType(ItemClassContainer)) { continue; } + + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->GetID() == item_id) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(iter->first, bag_iter->first); + } + + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return legacy::SLOT_AUGMENT; } } } - // Not found return INVALID_INDEX; } // Internal Method: Checks an inventory queue type bucket for a particular item int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity) { - iter_queue it; - iter_contents itb; + // The downfall of this (these) queue procedure is that callers presume that when an item is + // found, it is presented as being available on the cursor. In cases of a parity check, this + // is sufficient. However, in cases where referential criteria is considered, this can lead + // to unintended results. Funtionality should be observed when referencing the return value + // of this query -U + uint8 quantity_found = 0; - // Read-only iteration of queue - for (it = iqueue.begin(); it != iqueue.end(); ++it) { - ItemInst* inst = *it; - if (inst) - { - if (inst->GetID() == item_id) { - quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); - if (quantity_found >= quantity) - return MainCursor; - } - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (inst->GetAugmentItemID(i) == item_id && quantity <= 1) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (auto iter = iqueue.begin(); iter != iqueue.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + + if (inst->GetID() == item_id) { + quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); + if (quantity_found >= quantity) + return MainCursor; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { - for (itb = inst->_begin(); itb != inst->_end(); ++itb) { - ItemInst* baginst = itb->second; - if (baginst && baginst->GetID() == item_id) { - quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(MainCursor, itb->first); - } - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (baginst && baginst->GetAugmentItemID(i) == item_id && quantity <= 1) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return legacy::SLOT_AUGMENT; + } + if (!inst->IsType(ItemClassContainer)) { continue; } + + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->GetID() == item_id) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(MainCursor, bag_iter->first); + } + + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1) + return legacy::SLOT_AUGMENT; } } } - // Not found return INVALID_INDEX; } // Internal Method: Checks an inventory bucket for a particular item int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, uint8 quantity) { - iter_inst it; - iter_contents itb; - ItemInst* inst = nullptr; uint8 quantity_found = 0; - // Check item: After failed checks, check bag contents (if bag) - for (it = bucket.begin(); it != bucket.end(); ++it) { - inst = it->second; - if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } + + if (inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) - return it->first; + return iter->first; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { + if (!inst->IsType(ItemClassContainer)) { continue; } - for (itb = inst->_begin(); itb != inst->_end(); itb++) { - ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { - quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(it->first, itb->first); - } + for (auto bag_iter = bucket.begin(); bag_iter != bucket.end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(iter->first, bag_iter->first); } } } - // Not found return INVALID_INDEX; } // Internal Method: Checks an inventory queue type bucket for a particular item int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity) { - iter_queue it; - iter_contents itb; uint8 quantity_found = 0; - // Read-only iteration of queue - for (it = iqueue.begin(); it != iqueue.end(); ++it) { - ItemInst* inst = *it; - if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { + for (auto iter = iqueue.begin(); iter != iqueue.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + + if (inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) { quantity_found += (inst->GetCharges() <= 0) ? 1 : inst->GetCharges(); if (quantity_found >= quantity) return MainCursor; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { + if (!inst->IsType(ItemClassContainer)) { continue; } - for (itb = inst->_begin(); itb != inst->_end(); ++itb) { - ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) { - quantity_found += (baginst->GetCharges() <= 0) ? 1 : baginst->GetCharges(); - if (quantity_found >= quantity) - return Inventory::CalcSlotId(MainCursor, itb->first); - } + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->ItemType == use) { + quantity_found += (bag_inst->GetCharges() <= 0) ? 1 : bag_inst->GetCharges(); + if (quantity_found >= quantity) + return Inventory::CalcSlotId(MainCursor, bag_iter->first); } } } - // Not found return INVALID_INDEX; } int16 Inventory::_HasItemByLoreGroup(std::map& bucket, uint32 loregroup) { - iter_inst it; - iter_contents itb; - ItemInst* inst = nullptr; + for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) { + auto inst = iter->second; + if (inst == nullptr) { continue; } - // Check item: After failed checks, check bag contents (if bag) - for (it = bucket.begin(); it != bucket.end(); ++it) { - inst = it->second; - if (inst) { - if (inst->GetItem()->LoreGroup == loregroup) - return it->first; + if (inst->GetItem()->LoreGroup == loregroup) + return iter->first; - ItemInst* Aug = nullptr; - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - Aug = inst->GetAugment(i); - if (Aug && Aug->GetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + auto aug_inst = inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return legacy::SLOT_AUGMENT; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { - for (itb = inst->_begin(); itb != inst->_end(); ++itb) { - ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(it->first, itb->first); + if (!inst->IsType(ItemClassContainer)) { continue; } - ItemInst* Aug2 = nullptr; - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - Aug2 = baginst->GetAugment(i); - if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } + + if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) + return Inventory::CalcSlotId(iter->first, bag_iter->first); + + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + auto aug_inst = bag_inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return legacy::SLOT_AUGMENT; } } } - // Not found return INVALID_INDEX; } // Internal Method: Checks an inventory queue type bucket for a particular item int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup) { - iter_queue it; - iter_contents itb; + for (auto iter = iqueue.begin(); iter != iqueue.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } - // Read-only iteration of queue - for (it = iqueue.begin(); it != iqueue.end(); ++it) { - ItemInst* inst = *it; - if (inst) - { - if (inst->GetItem()->LoreGroup == loregroup) - return MainCursor; + if (inst->GetItem()->LoreGroup == loregroup) + return MainCursor; - ItemInst* Aug = nullptr; - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - Aug = inst->GetAugment(i); - if (Aug && Aug->GetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + auto aug_inst = inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return legacy::SLOT_AUGMENT; } - // Go through bag, if bag - if (inst && inst->IsType(ItemClassContainer)) { - for (itb = inst->_begin(); itb != inst->_end(); ++itb) { - ItemInst* baginst = itb->second; - if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->LoreGroup == loregroup) - return Inventory::CalcSlotId(MainCursor, itb->first); + if (!inst->IsType(ItemClassContainer)) { continue; } + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { + auto bag_inst = bag_iter->second; + if (bag_inst == nullptr) { continue; } - ItemInst* Aug2 = nullptr; - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - Aug2 = baginst->GetAugment(i); - if (Aug2 && Aug2->GetItem()->LoreGroup == loregroup) - return legacy::SLOT_AUGMENT; // Only one augment per slot. - } + if (bag_inst->IsType(ItemClassCommon) && bag_inst->GetItem()->LoreGroup == loregroup) + return Inventory::CalcSlotId(MainCursor, bag_iter->first); + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + auto aug_inst = bag_inst->GetAugment(index); + if (aug_inst == nullptr) { continue; } + + if (aug_inst->GetItem()->LoreGroup == loregroup) + return legacy::SLOT_AUGMENT; } } } - - // Not found + return INVALID_INDEX; } @@ -1544,10 +1523,12 @@ ItemInst::~ItemInst() // Query item type bool ItemInst::IsType(ItemClassTypes item_class) const { + // IsType() does not protect against 'm_item = nullptr' + // Check usage type if ((m_use_type == ItemInstWorldContainer) && (item_class == ItemClassContainer)) - return true; + if (!m_item) return false; @@ -1557,11 +1538,17 @@ bool ItemInst::IsType(ItemClassTypes item_class) const // Is item stackable? bool ItemInst::IsStackable() const { + if (!m_item) + return false; + return m_item->Stackable; } bool ItemInst::IsCharged() const { + if (!m_item) + return false; + if (m_item->MaxCharges > 1) return true; else @@ -1584,16 +1571,25 @@ bool ItemInst::IsEquipable(int16 slot_id) const return false; // another "shouldn't do" fix..will be fixed in future updates (requires code and database work) - if (slot_id == MainPowerSource) { - slot_id = MainGeneral1; - uint32 slot_mask = (1 << slot_id); - if (slot_mask & m_item->Slots) + int16 use_slot = INVALID_INDEX; + if (slot_id == MainPowerSource) { use_slot = MainGeneral1; } + if ((uint16)slot_id <= EmuConstants::EQUIPMENT_END) { use_slot = slot_id; } + + if (use_slot != INVALID_INDEX) { + if (m_item->Slots & (1 << use_slot)) return true; } - if ((uint16)slot_id <= EmuConstants::EQUIPMENT_END) { - uint32 slot_mask = (1 << slot_id); - if (slot_mask & m_item->Slots) + return false; +} + +bool ItemInst::IsAugmentable() const +{ + if (!m_item) + return false; + + for (int index = 0; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (m_item->AugSlotType[index] != NO_ITEM) return true; } @@ -1603,39 +1599,38 @@ bool ItemInst::IsEquipable(int16 slot_id) const bool ItemInst::AvailableWearSlot(uint32 aug_wear_slots) const { // TODO: check to see if incoming 'aug_wear_slots' "switches" bit assignments like above... // (if wrong, would only affect MainAmmo and MainPowerSource augments) - if (m_item->ItemClass != ItemClassCommon || !m_item) + if (!m_item || m_item->ItemClass != ItemClassCommon) return false; - int i; - for (i = EmuConstants::EQUIPMENT_BEGIN; i <= MainGeneral1; i++) { // MainGeneral1 should be EmuConstants::EQUIPMENT_END - if (m_item->Slots & (1 << i)) { - if (aug_wear_slots & (1 << i)) + int index = EmuConstants::EQUIPMENT_BEGIN; + for (; index <= MainGeneral1; ++index) { // MainGeneral1 should be EmuConstants::EQUIPMENT_END + if (m_item->Slots & (1 << index)) { + if (aug_wear_slots & (1 << index)) break; } } - return (i<23) ? true : false; + return (index < 23) ? true : false; } int8 ItemInst::AvailableAugmentSlot(int32 augtype) const { - if (m_item->ItemClass != ItemClassCommon || !m_item) - return -1; - - int i; - for (i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (!GetItem(i)) { - if (augtype == -1 || (m_item->AugSlotType[i] && ((1 << (m_item->AugSlotType[i] - 1)) & augtype))) - break; - } + if (!m_item || m_item->ItemClass != ItemClassCommon) + return INVALID_INDEX; + int index = AUG_BEGIN; + for (; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (GetItem(index)) { continue; } + if (augtype == -1 || (m_item->AugSlotType[index] && ((1 << (m_item->AugSlotType[index] - 1)) & augtype))) + break; } - return (i < EmuConstants::ITEM_COMMON_SIZE) ? i : INVALID_INDEX; + return (index < EmuConstants::ITEM_COMMON_SIZE) ? index : INVALID_INDEX; } -bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const { - if (m_item->ItemClass != ItemClassCommon || !m_item) +bool ItemInst::IsAugmentSlotAvailable(int32 augtype, uint8 slot) const +{ + if (!m_item || m_item->ItemClass != ItemClassCommon) return false; if ((!GetItem(slot) && m_item->AugSlotVisible[slot]) && augtype == -1 || (m_item->AugSlotType[slot] && ((1 << (m_item->AugSlotType[slot] - 1)) & augtype))) { @@ -1649,8 +1644,7 @@ ItemInst* ItemInst::GetItem(uint8 index) const { iter_contents it = m_contents.find(index); if (it != m_contents.end()) { - ItemInst* inst = it->second; - return inst; + return it->second; } return nullptr; @@ -1658,12 +1652,11 @@ ItemInst* ItemInst::GetItem(uint8 index) const uint32 ItemInst::GetItemID(uint8 slot) const { - const ItemInst *item; - uint32 id = NO_ITEM; - if ((item = GetItem(slot)) != nullptr) - id = item->GetItem()->ID; + ItemInst *item = GetItem(slot); + if (item) + return item->GetID(); - return id; + return NO_ITEM; } void ItemInst::PutItem(uint8 index, const ItemInst& inst) @@ -1671,7 +1664,6 @@ void ItemInst::PutItem(uint8 index, const ItemInst& inst) // Clean up item already in slot (if exists) DeleteItem(index); - // Delegate to internal method _PutItem(index, inst.Clone()); } @@ -1687,14 +1679,13 @@ void ItemInst::DeleteItem(uint8 index) // Hands over memory ownership to client of this function call ItemInst* ItemInst::PopItem(uint8 index) { - iter_contents it = m_contents.find(index); - if (it != m_contents.end()) { - ItemInst* inst = it->second; + auto iter = m_contents.find(index); + if (iter != m_contents.end()) { + ItemInst* inst = iter->second; m_contents.erase(index); - return inst; + return inst; // Return pointer that needs to be deleted (or otherwise managed) } - - // Return pointer that needs to be deleted (or otherwise managed) + return nullptr; } @@ -1702,12 +1693,8 @@ ItemInst* ItemInst::PopItem(uint8 index) void ItemInst::Clear() { // Destroy container contents - iter_contents cur, end; - cur = m_contents.begin(); - end = m_contents.end(); - for (; cur != end; ++cur) { - ItemInst* inst = cur->second; - safe_delete(inst); + for (auto iter = m_contents.begin(); iter != m_contents.end(); ++iter) { + safe_delete(iter->second); } m_contents.clear(); } @@ -1715,6 +1702,8 @@ void ItemInst::Clear() // Remove all items from container void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) { + // TODO: This needs work... + // Destroy container contents iter_contents cur, end, del; cur = m_contents.begin(); @@ -1765,6 +1754,9 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) uint8 ItemInst::FirstOpenSlot() const { + if (!m_item) + return INVALID_INDEX; + uint8 slots = m_item->BagSlots, i; for (i = SUB_BEGIN; i < slots; i++) { if (!GetItem(i)) @@ -1778,21 +1770,22 @@ uint8 ItemInst::GetTotalItemCount() const { uint8 item_count = 1; - if (m_item->ItemClass != ItemClassContainer) { return item_count; } + if (m_item && m_item->ItemClass != ItemClassContainer) { return item_count; } - for (int idx = SUB_BEGIN; idx < m_item->BagSlots; idx++) { if (GetItem(idx)) { item_count++; } } + for (int index = SUB_BEGIN; index < m_item->BagSlots; ++index) { if (GetItem(index)) { ++item_count; } } return item_count; } bool ItemInst::IsNoneEmptyContainer() { - if (m_item->ItemClass != ItemClassContainer) + if (!m_item || m_item->ItemClass != ItemClassContainer) return false; - for (int i = SUB_BEGIN; i < m_item->BagSlots; ++i) - if (GetItem(i)) + for (int index = SUB_BEGIN; index < m_item->BagSlots; ++index) { + if (GetItem(index)) return true; + } return false; } @@ -1800,7 +1793,7 @@ bool ItemInst::IsNoneEmptyContainer() // Retrieve augment inside item ItemInst* ItemInst::GetAugment(uint8 slot) const { - if (m_item->ItemClass == ItemClassCommon) + if (m_item && m_item->ItemClass == ItemClassCommon) return GetItem(slot); return nullptr; @@ -1808,23 +1801,23 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const { - if (ornamentationAugtype > 0) + if (!m_item || m_item->ItemClass != ItemClassCommon) { return nullptr; } + if (ornamentationAugtype == 0) { return nullptr; } + + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) + if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) { - if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) + const char *item_IDFile = GetAugment(i)->GetItem()->IDFile; + if ( + (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 + || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0) + && GetAugment(i)->GetItem()->HerosForgeModel == 0 + ) { - const char *item_IDFile = GetAugment(i)->GetItem()->IDFile; - if ( - (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 - || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0) - && GetAugment(i)->GetItem()->HerosForgeModel == 0 - ) - { - continue; - } - return this->GetAugment(i); + continue; } + return this->GetAugment(i); } } @@ -1845,37 +1838,38 @@ uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const { } bool ItemInst::UpdateOrnamentationInfo() { + if (!m_item || m_item->ItemClass != ItemClassCommon) + return false; + bool ornamentSet = false; - if (IsType(ItemClassCommon)) + int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); + if (GetOrnamentationAug(ornamentationAugtype)) { - int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType); - if (GetOrnamentationAug(ornamentationAugtype)) + const Item_Struct* ornamentItem; + ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem(); + if (ornamentItem != nullptr) { - const Item_Struct* ornamentItem; - ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem(); - if (ornamentItem != nullptr) + SetOrnamentIcon(ornamentItem->Icon); + SetOrnamentHeroModel(ornamentItem->HerosForgeModel); + if (strlen(ornamentItem->IDFile) > 2) { - SetOrnamentIcon(ornamentItem->Icon); - SetOrnamentHeroModel(ornamentItem->HerosForgeModel); - if (strlen(ornamentItem->IDFile) > 2) - { - SetOrnamentationIDFile(atoi(&ornamentItem->IDFile[2])); - } - else - { - SetOrnamentationIDFile(0); - } - ornamentSet = true; + SetOrnamentationIDFile(atoi(&ornamentItem->IDFile[2])); } - } - else - { - SetOrnamentIcon(0); - SetOrnamentHeroModel(0); - SetOrnamentationIDFile(0); + else + { + SetOrnamentationIDFile(0); + } + ornamentSet = true; } } + else + { + SetOrnamentIcon(0); + SetOrnamentHeroModel(0); + SetOrnamentationIDFile(0); + } + return ornamentSet; } @@ -1927,54 +1921,60 @@ bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Con uint32 ItemInst::GetAugmentItemID(uint8 slot) const { - uint32 id = NO_ITEM; - if (m_item->ItemClass == ItemClassCommon) { - return GetItemID(slot); - } + if (!m_item || m_item->ItemClass != ItemClassCommon) + return NO_ITEM; - return id; + return GetItemID(slot); } // Add an augment to the item void ItemInst::PutAugment(uint8 slot, const ItemInst& augment) { - if (m_item->ItemClass == ItemClassCommon) - PutItem(slot, augment); + if (!m_item || m_item->ItemClass != ItemClassCommon) + return; + + PutItem(slot, augment); } void ItemInst::PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id) { - if (item_id != NO_ITEM) { - const ItemInst* aug = db->CreateItem(item_id); - if (aug) - { - PutAugment(slot, *aug); - safe_delete(aug); - } - } + if (item_id == NO_ITEM) { return; } + if (db == nullptr) { return; /* TODO: add log message for nullptr */ } + + const ItemInst* aug = db->CreateItem(item_id); + if (aug) { + PutAugment(slot, *aug); + safe_delete(aug); + } } // Remove augment from item and destroy it void ItemInst::DeleteAugment(uint8 index) { - if (m_item->ItemClass == ItemClassCommon) - DeleteItem(index); + if (!m_item || m_item->ItemClass != ItemClassCommon) + return; + + DeleteItem(index); } // Remove augment from item and return it ItemInst* ItemInst::RemoveAugment(uint8 index) { - if (m_item->ItemClass == ItemClassCommon) - return PopItem(index); - - return nullptr; + if (!m_item || m_item->ItemClass != ItemClassCommon) + return nullptr; + + return PopItem(index); } bool ItemInst::IsAugmented() { - for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; ++i) - if (GetAugmentItemID(i)) + if (!m_item || m_item->ItemClass != ItemClassCommon) + return false; + + for (int index = AUG_BEGIN; index < EmuConstants::ITEM_COMMON_SIZE; ++index) { + if (GetAugmentItemID(index)) return true; + } return false; } @@ -1984,33 +1984,43 @@ bool ItemInst::IsWeapon() const { if (!m_item || m_item->ItemClass != ItemClassCommon) return false; + if (m_item->ItemType == ItemTypeArrow && m_item->Damage != 0) return true; else return ((m_item->Damage != 0) && (m_item->Delay != 0)); } -bool ItemInst::IsAmmo() const { - - if (!m_item) return false; +bool ItemInst::IsAmmo() const +{ + if (!m_item) + return false; if ((m_item->ItemType == ItemTypeArrow) || (m_item->ItemType == ItemTypeLargeThrowing) || - (m_item->ItemType == ItemTypeSmallThrowing)) + (m_item->ItemType == ItemTypeSmallThrowing) + ) { return true; + } return false; } -const Item_Struct* ItemInst::GetItem() const { - if (!m_scaledItem) - return m_item; - else +const Item_Struct* ItemInst::GetItem() const +{ + if (!m_item) + return nullptr; + + if (m_scaledItem) return m_scaledItem; + + return m_item; } -const Item_Struct* ItemInst::GetUnscaledItem() const { +const Item_Struct* ItemInst::GetUnscaledItem() const +{ + // No operator calls and defaults to nullptr return m_item; } @@ -2112,6 +2122,9 @@ void ItemInst::Initialize(SharedDatabase *db) { } void ItemInst::ScaleItem() { + if (!m_item) + return; + if (m_scaledItem) { memcpy(m_scaledItem, m_item, sizeof(Item_Struct)); } @@ -2255,6 +2268,7 @@ EvolveInfo::EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 } EvolveInfo::~EvolveInfo() { + } @@ -2267,18 +2281,13 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const bool IsClass = false; uint32 Classes_ = Classes; - uint32 Races_ = Races; - uint32 Race_ = GetArrayRace(Race); - for (int CurrentClass = 1; CurrentClass <= PLAYER_CLASS_COUNT; ++CurrentClass) - { - if (Classes_ % 2 == 1) - { - if (CurrentClass == Class_) - { - IsClass = true; + for (int CurrentClass = 1; CurrentClass <= PLAYER_CLASS_COUNT; ++CurrentClass) { + if (Classes_ & 1) { + if (CurrentClass == Class_) { + IsClass = true; break; } } @@ -2287,17 +2296,15 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const Race_ = (Race_ == 18 ? 16 : Race_); - for (unsigned int CurrentRace = 1; CurrentRace <= PLAYER_RACE_COUNT; ++CurrentRace) - { - if (Races_ % 2 == 1) - { - if (CurrentRace == Race_) - { - IsRace = true; + for (unsigned int CurrentRace = 1; CurrentRace <= PLAYER_RACE_COUNT; ++CurrentRace) { + if (Races_ & 1) { + if (CurrentRace == Race_) { + IsRace = true; break; } } Races_ >>= 1; } + return (IsRace && IsClass); } diff --git a/common/item.h b/common/item.h index 03182e4dd..888d47d2b 100644 --- a/common/item.h +++ b/common/item.h @@ -34,7 +34,6 @@ class EvolveInfo; // Stores information about an evolving item family #include // Helper typedefs -typedef std::list::const_iterator iter_queue; typedef std::map::const_iterator iter_inst; typedef std::map::const_iterator iter_contents; @@ -87,15 +86,17 @@ public: // Public Methods ///////////////////////// - inline iter_queue begin() { return m_list.begin(); } - inline iter_queue end() { return m_list.end(); } + inline std::list::const_iterator begin() { return m_list.begin(); } + inline std::list::const_iterator end() { return m_list.end(); } + + inline int size() { return static_cast(m_list.size()); } // TODO: change to size_t + inline bool empty() { return m_list.empty(); } void push(ItemInst* inst); void push_front(ItemInst* inst); ItemInst* pop(); ItemInst* pop_back(); ItemInst* peek_front() const; - inline int size() { return static_cast(m_list.size()); } protected: ///////////////////////// @@ -103,7 +104,6 @@ protected: ///////////////////////// std::list m_list; - }; // ######################################## @@ -140,9 +140,11 @@ public: ItemInst* GetItem(int16 slot_id) const; ItemInst* GetItem(int16 slot_id, uint8 bagidx) const; - inline iter_queue cursor_begin() { return m_cursor.begin(); } - inline iter_queue cursor_end() { return m_cursor.end(); } - inline bool CursorEmpty() { return (m_cursor.size() == 0); } + inline std::list::const_iterator cursor_begin() { return m_cursor.begin(); } + inline std::list::const_iterator cursor_end() { return m_cursor.end(); } + + inline int CursorSize() { return m_cursor.size(); } + inline bool CursorEmpty() { return m_cursor.empty(); } // Retrieve a read-only item from inventory inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); } @@ -291,15 +293,15 @@ public: bool IsEquipable(int16 slot_id) const; // - // Augements + // Augments // - inline bool IsAugmentable() const { return m_item->AugSlotType[0] != 0 || m_item->AugSlotType[1] != 0 || m_item->AugSlotType[2] != 0 || m_item->AugSlotType[3] != 0 || m_item->AugSlotType[4] != 0 || m_item->AugSlotType[5] != 0; } + bool IsAugmentable() const; bool AvailableWearSlot(uint32 aug_wear_slots) const; int8 AvailableAugmentSlot(int32 augtype) const; bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const; - inline int32 GetAugmentType() const { return m_item->AugType; } + inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); } - inline bool IsExpendable() const { return ((m_item->Click.Type == ET_Expendable ) || (m_item->ItemType == ItemTypePotion)); } + inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == ET_Expendable ) || (m_item->ItemType == ItemTypePotion)) : false); } // // Contents @@ -337,8 +339,8 @@ public: bool IsAmmo() const; // Accessors - const uint32 GetID() const { return m_item->ID; } - const uint32 GetItemScriptID() const { return m_item->ScriptFileID; } + const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); } + const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); } const Item_Struct* GetItem() const; const Item_Struct* GetUnscaledItem() const; @@ -351,18 +353,18 @@ public: void SetColor(uint32 color) { m_color = color; } uint32 GetColor() const { return m_color; } - uint32 GetMerchantSlot() const { return m_merchantslot; } + uint32 GetMerchantSlot() const { return m_merchantslot; } void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; } - int32 GetMerchantCount() const { return m_merchantcount; } + int32 GetMerchantCount() const { return m_merchantcount; } void SetMerchantCount(int32 count) { m_merchantcount = count; } int16 GetCurrentSlot() const { return m_currentslot; } void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; } // Is this item already attuned? - bool IsAttuned() const { return m_attuned; } - void SetAttuned(bool flag) { m_attuned=flag; } + bool IsAttuned() const { return m_attuned; } + void SetAttuned(bool flag) { m_attuned=flag; } std::string GetCustomDataString() const; std::string GetCustomData(std::string identifier); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b97d5a984..3276bff25 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -110,8 +110,10 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list::const_iter for(auto it = start; it != end; ++it, i++) { if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high ItemInst *inst = *it; - if (!SaveInventory(char_id,inst,(i == 8000) ? MainCursor : i)) - return false; + int16 use_slot = (i == 8000) ? MainCursor : i; + if (!SaveInventory(char_id, inst, use_slot)) { + return false; + } } return true; @@ -171,8 +173,9 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s else return UpdateSharedBankSlot(char_id, inst, slot_id); } - else if (!inst) // All other inventory - return DeleteInventorySlot(char_id, slot_id); + else if (!inst) { // All other inventory + return DeleteInventorySlot(char_id, slot_id); + } return UpdateInventorySlot(char_id, inst, slot_id); } @@ -181,11 +184,12 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i // need to check 'inst' argument for valid pointer uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; - if (inst->IsType(ItemClassCommon)) - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - ItemInst *auginst=inst->GetItem(i); - augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; + if (inst->IsType(ItemClassCommon)) { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + ItemInst *auginst = inst->GetItem(i); + augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; } + } uint16 charges = 0; if(inst->GetCharges() >= 0) @@ -226,11 +230,12 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, // need to check 'inst' argument for valid pointer uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM }; - if (inst->IsType(ItemClassCommon)) - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - ItemInst *auginst=inst->GetItem(i); - augslot[i]=(auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; + if (inst->IsType(ItemClassCommon)) { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + ItemInst *auginst = inst->GetItem(i); + augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : NO_ITEM; } + } // Update/Insert item uint32 account_id = GetAccountIDByChar(char_id); @@ -252,11 +257,12 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents - if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) + if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) { for (uint8 idx = SUB_BEGIN; idx < EmuConstants::ITEM_CONTAINER_SIZE; idx++) { const ItemInst* baginst = inst->GetItem(idx); SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx)); } + } if (!results.Success()) { LogFile->write(EQEmuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); @@ -435,9 +441,8 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { ItemInst* inst = CreateBaseItem(item, charges); if (inst && item->ItemClass == ItemClassCommon) { for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { - if (aug[i]) { - inst->PutAugment(this, i, aug[i]); - } + if (aug[i]) + inst->PutAugment(this, i, aug[i]); } } @@ -576,10 +581,12 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else inst->SetCharges(charges); - if (item->ItemClass == ItemClassCommon) - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) - if (aug[i]) - inst->PutAugment(this, i, aug[i]); + if (item->ItemClass == ItemClassCommon) { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + if (aug[i]) + inst->PutAugment(this, i, aug[i]); + } + } if (slot_id >= 8000 && slot_id <= 8999) { @@ -691,10 +698,12 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) inst->SetCharges(charges); - if (item->ItemClass == ItemClassCommon) - for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) - if (aug[i]) - inst->PutAugment(this, i, aug[i]); + if (item->ItemClass == ItemClassCommon) { + for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) { + if (aug[i]) + inst->PutAugment(this, i, aug[i]); + } + } if (slot_id>=8000 && slot_id <= 8999) put_slot_id = inv->PushCursor(*inst); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 734d82de5..1fa18051f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1837,12 +1837,11 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (loaditems) { /* Dont load if a length error occurs */ BulkSendInventoryItems(); /* Send stuff on the cursor which isnt sent in bulk */ - iter_queue it; - for (it = m_inv.cursor_begin(); it != m_inv.cursor_end(); ++it) { + for (auto iter = m_inv.cursor_begin(); iter != m_inv.cursor_end(); ++iter) { /* First item cursor is sent in bulk inventory packet */ - if (it == m_inv.cursor_begin()) + if (iter == m_inv.cursor_begin()) continue; - const ItemInst *inst = *it; + const ItemInst *inst = *iter; SendItemPacket(MainCursor, inst, ItemPacketSummonItem); } } diff --git a/zone/command.cpp b/zone/command.cpp index dd4618c87..140427520 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2683,7 +2683,7 @@ void command_peekinv(Client *c, const Seperator *sep) } else { int cursorDepth = 0; - for (iter_queue it = targetClient->GetInv().cursor_begin(); (it != targetClient->GetInv().cursor_end()); ++it, ++cursorDepth) { + for (auto it = targetClient->GetInv().cursor_begin(); (it != targetClient->GetInv().cursor_end()); ++it, ++cursorDepth) { inst_main = *it; item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); linker.SetItemInst(inst_main); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 433fc9a66..0f0a04c28 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -363,9 +363,10 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // solar: TODO soulbound items need not be added to corpse, but they need // to go into the regular slots on the player, out of bags - // worn + inventory + cursor + // possessions + // TODO: accomodate soul-bound items std::list removed_list; - bool cursor = false; + //bool cursor = false; for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) { if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) { item = client->GetInv().GetItem(MainPowerSource); @@ -383,14 +384,18 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( } } +#if 0 + // This will either be re-enabled or deleted at some point. The client doesn't appear + // to like to have items deleted from it's buffer..or, I just haven't figure out how -U + // (Besides, the 'corpse' slots equal the size of MapPossessions..not MapPossessions + MapCorpse) + // cursor queue // (change to first client that supports 'death hover' mode, if not SoF.) if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { // bumped starting assignment to 8001 because any in-memory 'slot 8000' item was moved above as 'slot 30' // this was mainly for client profile state reflection..should match db player inventory entries now. - - iter_queue it; - for (it = client->GetInv().cursor_begin(), i = 8001; it != client->GetInv().cursor_end(); ++it, i++) { + i = 8001; + for (auto it = client->GetInv().cursor_begin(); it != client->GetInv().cursor_end(); ++it, i++) { item = *it; if ((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { std::list slot_list = MoveItemToCorpse(client, item, i); @@ -399,6 +404,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( } } } +#endif database.TransactionBegin(); if (removed_list.size() != 0) { @@ -421,6 +427,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( database.QueryDatabase(ss.str().c_str()); } +#if 0 if (cursor) { // all cursor items should be on corpse (client < SoF or RespawnFromHover = false) while (!client->GetInv().CursorEmpty()) client->DeleteItemInInventory(MainCursor, 0, false, false); @@ -430,8 +437,13 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( std::list::const_iterator finish = client->GetInv().cursor_end(); database.SaveCursor(client->CharacterID(), start, finish); } +#endif - client->CalcBonuses(); // will only affect offline profile viewing of dead characters..unneeded overhead + auto start = client->GetInv().cursor_begin(); + auto finish = client->GetInv().cursor_end(); + database.SaveCursor(client->CharacterID(), start, finish); + + client->CalcBonuses(); client->Save(); IsRezzed(false); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 42a05e175..20781b749 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -618,7 +618,7 @@ void Client::DropItem(int16 slot_id) // Save client inventory change to database if (slot_id == MainCursor) { SendCursorBuffer(); - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(CharacterID(), s, e); } else { database.SaveInventory(CharacterID(), nullptr, slot_id); @@ -668,12 +668,12 @@ int32 Client::GetItemIDAt(int16 slot_id) { } // Returns an augment's ID that's in an item (returns INVALID_ID if not found) -// Pass in the slot ID of the item and which augslot you want to check (0-4) +// Pass in the slot ID of the item and which augslot you want to check (0-5) int32 Client::GetAugmentIDAt(int16 slot_id, uint8 augslot) { const ItemInst* inst = m_inv[slot_id]; - if (inst) - if (inst->GetAugmentItemID(augslot)) - return inst->GetAugmentItemID(augslot); + if (inst && inst->GetAugmentItemID(augslot)) { + return inst->GetAugmentItemID(augslot); + } // None found return INVALID_ID; @@ -698,9 +698,9 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { - #if (EQDEBUG >= 5) - LogFile->write(EQEmuLog::Debug, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); - #endif +#if (EQDEBUG >= 5) + LogFile->write(EQEmuLog::Debug, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true" : "false"); +#endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. // - cursor queue slots were slipping through and crashing client @@ -769,9 +769,9 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool isDeleted = m_inv.DeleteItem(slot_id, quantity); - const ItemInst* inst=nullptr; + const ItemInst* inst = nullptr; if (slot_id == MainCursor) { - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); if(update_db) database.SaveCursor(character_id, s, e); } @@ -783,22 +783,25 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd } if(client_update && IsValidSlot(slot_id)) { - EQApplicationPacket* outapp; + EQApplicationPacket* outapp = nullptr; if(inst) { - if(!inst->IsStackable() && !isDeleted) + if (!inst->IsStackable() && !isDeleted) { // Non stackable item with charges = Item with clicky spell effect ? Delete a charge. outapp = new EQApplicationPacket(OP_DeleteCharge, sizeof(MoveItem_Struct)); - else + } + else { // Stackable, arrows, etc ? Delete one from the stack outapp = new EQApplicationPacket(OP_DeleteItem, sizeof(MoveItem_Struct)); + } - DeleteItem_Struct* delitem = (DeleteItem_Struct*)outapp->pBuffer; - delitem->from_slot = slot_id; - delitem->to_slot = 0xFFFFFFFF; - delitem->number_in_stack = 0xFFFFFFFF; - for(int loop=0;looppBuffer; + delitem->from_slot = slot_id; + delitem->to_slot = 0xFFFFFFFF; + delitem->number_in_stack = 0xFFFFFFFF; + + for(int loop=0;loopfrom_slot = slot_id; delitem->to_slot = 0xFFFFFFFF; delitem->number_in_stack = 0xFFFFFFFF; + QueuePacket(outapp); safe_delete(outapp); } @@ -821,7 +825,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) SendItemPacket(MainCursor, &inst, ItemPacketSummonItem); } - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); return database.SaveCursor(CharacterID(), s, e); } @@ -832,10 +836,12 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { mlog(INVENTORY__SLOTS, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); - if (slot_id == MainCursor) + if (slot_id == MainCursor) { // don't trust macros before conditional statements... return PushItemOnCursor(inst, client_update); - else + } + else { m_inv.PutItem(slot_id, inst); + } if (client_update) { @@ -843,9 +849,8 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client //SendWearChange(Inventory::CalcMaterialFromSlot(slot_id)); } - if (slot_id == MainCursor) { - std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); return database.SaveCursor(this->CharacterID(), s, e); } else { @@ -853,6 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client } CalcBonuses(); + // a lot of wasted checks and calls coded above... } void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) @@ -863,17 +869,17 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI SendLootItemInPacket(&inst, slot_id); if (slot_id == MainCursor) { - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(this->CharacterID(), s, e); - } else + } + else { database.SaveInventory(this->CharacterID(), &inst, slot_id); + } - if(bag_item_data) // bag contents - { + if(bag_item_data) { // bag contents int16 interior_slot; // solar: our bag went into slot_id, now let's pack the contents in - for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) - { + for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if(bag_item_data[i] == nullptr) continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); @@ -891,86 +897,74 @@ bool Client::TryStacking(ItemInst* item, uint8 type, bool try_worn, bool try_cur return false; int16 i; uint32 item_id = item->GetItem()->ID; - for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) - { + for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { ItemInst* tmp_inst = m_inv.GetItem(i); if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){ MoveItemCharges(*item, i, type); CalcBonuses(); - if(item->GetCharges()) // we didn't get them all + if (item->GetCharges()) { // we didn't get them all return AutoPutLootInInventory(*item, try_worn, try_cursor, 0); + } return true; } } - for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) - { - for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) - { + for (i = EmuConstants::GENERAL_BEGIN; i <= EmuConstants::GENERAL_END; i++) { + for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { uint16 slotid = Inventory::CalcSlotId(i, j); ItemInst* tmp_inst = m_inv.GetItem(slotid); - if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize){ + if(tmp_inst && tmp_inst->GetItem()->ID == item_id && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { MoveItemCharges(*item, slotid, type); CalcBonuses(); - if(item->GetCharges()) // we didn't get them all + if (item->GetCharges()) { // we didn't get them all return AutoPutLootInInventory(*item, try_worn, try_cursor, 0); + } return true; } } } return false; } + // Locate an available space in inventory to place an item // and then put the item there // The change will be saved to the database bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_cursor, ServerLootItem_Struct** bag_item_data) { // #1: Try to auto equip - if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != ItemTypeAugmentation) - { + if (try_worn && inst.IsEquipable(GetBaseRace(), GetClass()) && inst.GetItem()->ReqLevel<=level && (!inst.GetItem()->Attuneable || inst.IsAttuned()) && inst.GetItem()->ItemType != ItemTypeAugmentation) { // too messy as-is... - for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) // originally (i < 22) - { + for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) { // originally (i < 22) if (i == EmuConstants::GENERAL_BEGIN) { - if(this->GetClientVersion() >= EQClientSoF) { i = MainPowerSource; } // added power source check for SoF+ clients - else { break; } + // added power source check for SoF+ clients + if (this->GetClientVersion() >= EQClientSoF) + i = MainPowerSource; + else + break; } - if (!m_inv[i]) - { - if( i == MainPrimary && inst.IsWeapon() ) // If item is primary slot weapon - { - if( (inst.GetItem()->ItemType == ItemType2HSlash) || (inst.GetItem()->ItemType == ItemType2HBlunt) || (inst.GetItem()->ItemType == ItemType2HPiercing) ) // and uses 2hs \ 2hb \ 2hp - { - if( m_inv[MainSecondary] ) // and if secondary slot is not empty - { + if (!m_inv[i]) { + if (i == MainPrimary && inst.IsWeapon()) { // If item is primary slot weapon + if ((inst.GetItem()->ItemType == ItemType2HSlash) || (inst.GetItem()->ItemType == ItemType2HBlunt) || (inst.GetItem()->ItemType == ItemType2HPiercing)) { // and uses 2hs \ 2hb \ 2hp + if (m_inv[MainSecondary]) { // and if secondary slot is not empty continue; // Can't auto-equip } } } - if( i== MainSecondary && m_inv[MainPrimary]) // check to see if primary slot is a two hander - { + if (i == MainSecondary && m_inv[MainPrimary]) { // check to see if primary slot is a two hander uint8 use = m_inv[MainPrimary]->GetItem()->ItemType; - if(use == ItemType2HSlash || use == ItemType2HBlunt || use == ItemType2HPiercing) + if (use == ItemType2HSlash || use == ItemType2HBlunt || use == ItemType2HPiercing) continue; } - if - ( - i == MainSecondary && - inst.IsWeapon() && - !CanThisClassDualWield() - ) - { + if (i == MainSecondary && inst.IsWeapon() && !CanThisClassDualWield()) { continue; } - if (inst.IsEquipable(i)) // Equippable at this slot? - { + if (inst.IsEquipable(i)) { // Equippable at this slot? //send worn to everyone... PutLootInInventory(i, inst); uint8 worn_slot_material = Inventory::CalcMaterialFromSlot(i); - if(worn_slot_material != _MaterialInvalid) - { + if (worn_slot_material != _MaterialInvalid) { SendWearChange(worn_slot_material); } @@ -982,17 +976,15 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs } // #2: Stackable item? - if (inst.IsStackable()) - { - if(TryStacking(&inst, ItemPacketTrade, try_worn, try_cursor)) + if (inst.IsStackable()) { + if (TryStacking(&inst, ItemPacketTrade, try_worn, try_cursor)) return true; } // #3: put it in inventory bool is_arrow = (inst.GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 slot_id = m_inv.FindFreeSlot(inst.IsType(ItemClassContainer), try_cursor, inst.GetItem()->Size, is_arrow); - if (slot_id != INVALID_INDEX) - { + if (slot_id != INVALID_INDEX) { PutLootInInventory(slot_id, inst, bag_item_data); return true; } @@ -1005,28 +997,27 @@ void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) { ItemInst *tmp_inst = m_inv.GetItem(to_slot); - if(tmp_inst && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) - { + if(tmp_inst && tmp_inst->GetCharges() < tmp_inst->GetItem()->StackSize) { // this is how much room is left on the item we're stacking onto int charge_slots_left = tmp_inst->GetItem()->StackSize - tmp_inst->GetCharges(); // this is how many charges we can move from the looted item to // the item in the inventory - int charges_to_move = - from.GetCharges() < charge_slots_left ? - from.GetCharges() : - charge_slots_left; + int charges_to_move = (from.GetCharges() < charge_slots_left) ? from.GetCharges() : charge_slots_left; tmp_inst->SetCharges(tmp_inst->GetCharges() + charges_to_move); from.SetCharges(from.GetCharges() - charges_to_move); SendLootItemInPacket(tmp_inst, to_slot); - if (to_slot == MainCursor){ - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + if (to_slot == MainCursor) { + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(this->CharacterID(), s, e); - } else + } + else { database.SaveInventory(this->CharacterID(), tmp_inst, to_slot); + } } } +#if 0 // TODO: needs clean-up to save references bool MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint8 evolving, uint8 evolvedlevel) { //we're sending back the entire "link", minus the null characters & item name @@ -1135,6 +1126,7 @@ bool MakeItemLink(char* &ret_link, const Item_Struct *item, uint32 aug0, uint32 return false; } } +#endif int Client::GetItemLinkHash(const ItemInst* inst) { //pre-Titanium: http://eqitems.13th-floor.org/phpBB2/viewtopic.php?t=70&postdays=0&postorder=asc @@ -1281,10 +1273,13 @@ bool Client::IsValidSlot(uint32 slot) { (slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && slot <= EmuConstants::SHARED_BANK_BAGS_END) || (slot >= EmuConstants::TRADE_BEGIN && slot <= EmuConstants::TRADE_END) || (slot >= EmuConstants::WORLD_BEGIN && slot <= EmuConstants::WORLD_END) || - (slot == MainPowerSource)) + (slot == MainPowerSource) + ) { return true; - else + } + else { return false; + } } bool Client::IsBankSlot(uint32 slot) @@ -1361,11 +1356,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { int16 src_slot_id = (int16)move_in->from_slot; int16 dst_slot_id = (int16)move_in->to_slot; - if(IsBankSlot(src_slot_id) || - IsBankSlot(dst_slot_id) || - IsBankSlot(src_slot_check) || - IsBankSlot(dst_slot_check)) - { + if(IsBankSlot(src_slot_id) || IsBankSlot(dst_slot_id) || IsBankSlot(src_slot_check) || IsBankSlot(dst_slot_check)) { uint32 distance = 0; NPC *banker = entity_list.GetClosestBanker(this, distance); @@ -1555,7 +1546,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { { SendCursorBuffer(); } - std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); } else @@ -1708,22 +1699,26 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } // Step 7: Save change to the database - if (src_slot_id == MainCursor){ + if (src_slot_id == MainCursor) { // If not swapping another item to cursor and stacking items were depleted if (dstitemid == 0 || all_to_stack == true) { SendCursorBuffer(); } - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); - } else + } + else { database.SaveInventory(character_id, m_inv.GetItem(src_slot_id), src_slot_id); + } if (dst_slot_id == MainCursor) { - std::list::const_iterator s=m_inv.cursor_begin(),e=m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(character_id, s, e); - } else + } + else { database.SaveInventory(character_id, m_inv.GetItem(dst_slot_id), dst_slot_id); + } if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in, true); } // QS Audit @@ -1928,16 +1923,17 @@ 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){ DeleteItemInInventory(slot,1,true); uint8 slot2=SlotConvert(i); ItemInst* inst = this->m_inv.GetItem(slot2); if(inst){ - uint32 armor_color = (dye->dye[i].rgb.red * 65536) + (dye->dye[i].rgb.green * 256) + (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); @@ -1963,7 +1959,8 @@ void Client::DyeArmor(DyeStruct* dye){ } -/*bool Client::DecreaseByItemType(uint32 type, uint8 amt) { +#if 0 +bool Client::DecreaseByItemType(uint32 type, uint8 amt) { const Item_Struct* TempItem = 0; ItemInst* ins; int x; @@ -2012,10 +2009,11 @@ void Client::DyeArmor(DyeStruct* dye){ } } return false; -}*/ +} +#endif bool Client::DecreaseByID(uint32 type, uint8 amt) { - const Item_Struct* TempItem = 0; + const Item_Struct* TempItem = nullptr; ItemInst* ins = nullptr; int x; int num = 0; @@ -2023,7 +2021,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { { if (x == MainCursor + 1) x = EmuConstants::GENERAL_BAGS_BEGIN; - TempItem = 0; + TempItem = nullptr; ins = GetInv().GetItem(x); if (ins) TempItem = ins->GetItem(); @@ -2040,7 +2038,7 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { { if (x == MainCursor + 1) x = EmuConstants::GENERAL_BAGS_BEGIN; - TempItem = 0; + TempItem = nullptr; ins = GetInv().GetItem(x); if (ins) TempItem = ins->GetItem(); @@ -2063,151 +2061,133 @@ bool Client::DecreaseByID(uint32 type, uint8 amt) { return true; } -void Client::RemoveNoRent(bool client_update) { - int16 slot_id = 0; - - // equipment - for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; +void Client::RemoveNoRent(bool client_update) +{ + for (auto slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } - // general - for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id) { + auto inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } - // power source if (m_inv[MainPowerSource]) { - const ItemInst* inst = m_inv[MainPowerSource]; + auto inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } - // containers - for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } - // bank - for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } - // bank containers - for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } - // shared bank - for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } - // shared bank containers - for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { - const ItemInst* inst = m_inv[slot_id]; + for (auto slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; ++slot_id) { + auto inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } - // cursor & limbo if (!m_inv.CursorEmpty()) { std::list local; - ItemInst* inst = nullptr; while (!m_inv.CursorEmpty()) { - inst = m_inv.PopItem(MainCursor); - if (inst) - local.push_back(inst); + auto inst = m_inv.PopItem(MainCursor); + if (inst == nullptr) { continue; } + local.push_back(inst); } - std::list::iterator iter = local.begin(); - while (iter != local.end()) { - inst = *iter; - // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U - if (!inst->GetItem()->NoRent) + for (auto iter = local.begin(); iter != local.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } + if (!inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); - else - m_inv.PushCursor(**iter); - - safe_delete(*iter); - iter = local.erase(iter); + } + else { + m_inv.PushCursor(*inst); + } + safe_delete(inst); } - - std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); - database.SaveCursor(this->CharacterID(), s, e); local.clear(); + + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + database.SaveCursor(this->CharacterID(), s, e); } } // Two new methods to alleviate perpetual login desyncs -void Client::RemoveDuplicateLore(bool client_update) { - int16 slot_id = 0; - - // equipment - for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); - if(inst) { - if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, slot_id); - } - else { - m_inv.PutItem(slot_id, *inst); - } - safe_delete(inst); +void Client::RemoveDuplicateLore(bool client_update) +{ + for (auto slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; ++slot_id) { + auto inst = m_inv.PopItem(slot_id); + if (inst == nullptr) { continue; } + if(CheckLoreConflict(inst->GetItem())) { + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + database.SaveInventory(character_id, nullptr, slot_id); } + else { + m_inv.PutItem(slot_id, *inst); + } + safe_delete(inst); + } + + for (auto slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; ++slot_id) { + auto inst = m_inv.PopItem(slot_id); + if (inst == nullptr) { continue; } + if (CheckLoreConflict(inst->GetItem())) { + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + database.SaveInventory(character_id, nullptr, slot_id); + } + else { + m_inv.PutItem(slot_id, *inst); + } + safe_delete(inst); } - // general - for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); - if (inst) { - if (CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, slot_id); - } - else { - m_inv.PutItem(slot_id, *inst); - } - safe_delete(inst); - } - } - - // power source if (m_inv[MainPowerSource]) { - ItemInst* inst = m_inv.PopItem(MainPowerSource); + auto inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2217,108 +2197,96 @@ void Client::RemoveDuplicateLore(bool client_update) { } } - // containers - for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); - if(inst) { - if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, slot_id); - } - else { - m_inv.PutItem(slot_id, *inst); - } - safe_delete(inst); + for (auto slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; ++slot_id) { + auto inst = m_inv.PopItem(slot_id); + if (inst == nullptr) { continue; } + if(CheckLoreConflict(inst->GetItem())) { + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + database.SaveInventory(character_id, nullptr, slot_id); } + else { + m_inv.PutItem(slot_id, *inst); + } + safe_delete(inst); } - // bank - for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); - if(inst) { - if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, slot_id); - } - else { - m_inv.PutItem(slot_id, *inst); - } - safe_delete(inst); + for (auto slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; ++slot_id) { + auto inst = m_inv.PopItem(slot_id); + if (inst == nullptr) { continue; } + if(CheckLoreConflict(inst->GetItem())) { + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + database.SaveInventory(character_id, nullptr, slot_id); } + else { + m_inv.PutItem(slot_id, *inst); + } + safe_delete(inst); } - // bank containers - for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { - ItemInst* inst = m_inv.PopItem(slot_id); - if(inst) { - if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); - database.SaveInventory(character_id, nullptr, slot_id); - } - else { - m_inv.PutItem(slot_id, *inst); - } - safe_delete(inst); + for (auto slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; ++slot_id) { + auto inst = m_inv.PopItem(slot_id); + if (inst == nullptr) { continue; } + if(CheckLoreConflict(inst->GetItem())) { + mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + database.SaveInventory(character_id, nullptr, slot_id); } + else { + m_inv.PutItem(slot_id, *inst); + } + safe_delete(inst); } // Shared Bank and Shared Bank Containers are not checked due to their allowing duplicate lore items -U - // cursor & limbo if (!m_inv.CursorEmpty()) { - std::list local; - ItemInst* inst = nullptr; + std::list local_1; + std::list local_2; while (!m_inv.CursorEmpty()) { - inst = m_inv.PopItem(MainCursor); - if (inst) - local.push_back(inst); + auto inst = m_inv.PopItem(MainCursor); + if (inst == nullptr) { continue; } + local_1.push_back(inst); } - std::list::iterator iter = local.begin(); - while (iter != local.end()) { - inst = *iter; - // probably needs a valid pointer check -U + for (auto iter = local_1.begin(); iter != local_1.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } if (CheckLoreConflict(inst->GetItem())) { mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); - safe_delete(*iter); - iter = local.erase(iter); + safe_delete(inst); } else { - ++iter; + local_2.push_back(inst); } } + local_1.clear(); - iter = local.begin(); - while (iter != local.end()) { - inst = *iter; + for (auto iter = local_2.begin(); iter != local_2.end(); ++iter) { + auto inst = *iter; + if (inst == nullptr) { continue; } if (!inst->GetItem()->LoreFlag || ((inst->GetItem()->LoreGroup == -1) && (m_inv.HasItem(inst->GetID(), 0, invWhereCursor) == INVALID_INDEX)) || - (inst->GetItem()->LoreGroup && ~inst->GetItem()->LoreGroup && (m_inv.HasItemByLoreGroup(inst->GetItem()->LoreGroup, invWhereCursor) == INVALID_INDEX))) { - - m_inv.PushCursor(**iter); + (inst->GetItem()->LoreGroup && (~inst->GetItem()->LoreGroup) && (m_inv.HasItemByLoreGroup(inst->GetItem()->LoreGroup, invWhereCursor) == INVALID_INDEX)) + ) { + m_inv.PushCursor(*inst); } else { mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } - - safe_delete(*iter); - iter = local.erase(iter); + safe_delete(inst); } + local_2.clear(); - std::list::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end(); + auto s = m_inv.cursor_begin(), e = m_inv.cursor_end(); database.SaveCursor(this->CharacterID(), s, e); - local.clear(); } } -void Client::MoveSlotNotAllowed(bool client_update) { - int16 slot_id = 0; - - // equipment - for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { +void Client::MoveSlotNotAllowed(bool client_update) +{ + for (auto slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; ++slot_id) { if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) { - ItemInst* inst = m_inv.PopItem(slot_id); + auto inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); @@ -2328,15 +2296,13 @@ void Client::MoveSlotNotAllowed(bool client_update) { } } - // power source - slot_id = MainPowerSource; - if(m_inv[slot_id] && !m_inv[slot_id]->IsSlotAllowed(slot_id)) { - ItemInst* inst = m_inv.PopItem(slot_id); + if (m_inv[MainPowerSource] && !m_inv[MainPowerSource]->IsSlotAllowed(MainPowerSource)) { + auto inst = m_inv.PopItem(MainPowerSource); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, MainPowerSource, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); - database.SaveInventory(character_id, nullptr, slot_id); + database.SaveInventory(character_id, nullptr, MainPowerSource); safe_delete(inst); } @@ -2371,7 +2337,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const return 0; } -/* +#if 0 int32 Client::GetEquipmentMaterial(uint8 material_slot) { const Item_Struct *item; @@ -2384,24 +2350,16 @@ int32 Client::GetEquipmentMaterial(uint8 material_slot) return 0; } -*/ +#endif uint32 Client::GetEquipmentColor(uint8 material_slot) const { - const Item_Struct *item; - - if(material_slot > EmuConstants::MATERIAL_END) - { + if (material_slot > EmuConstants::MATERIAL_END) return 0; - } - item = database.GetItem(GetEquipment(material_slot)); - if(item != 0) - { - return m_pp.item_tint[material_slot].rgb.use_tint ? - m_pp.item_tint[material_slot].color : - item->Color; - } + 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 0; } @@ -2435,7 +2393,7 @@ void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type) { if (!inst) - return 0; + return nullptr; // Serialize item into |-delimited string std::string packet = inst->Serialize(slot_id); @@ -2541,8 +2499,9 @@ void Client::SetBandolier(const EQApplicationPacket *app) { 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 && - m_inv.GetItem(MainCursor)->GetCharges() >= 1) // '> 0' the same, but this matches Inventory::_HasItem conditional check + 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)) { @@ -2575,11 +2534,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { database.SaveInventory(character_id, BandolierItems[BandolierSlot], slot); BandolierItems[BandolierSlot]->SetCharges(1); } - else // Remove the item from the inventory + else { // Remove the item from the inventory database.SaveInventory(character_id, 0, slot); + } } - else // Remove the item from the inventory + else { // Remove the item from the inventory database.SaveInventory(character_id, 0, slot); + } } else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; @@ -2588,16 +2549,15 @@ void Client::SetBandolier(const EQApplicationPacket *app) { ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - _log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory", - InvItem->GetItem()->Name, WeaponSlot); - if(MoveItemToInventory(InvItem)) + _log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); + if (MoveItemToInventory(InvItem)) { database.SaveInventory(character_id, 0, WeaponSlot); - else - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + } + else { + _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); + } safe_delete(InvItem); } - } } } @@ -2627,9 +2587,9 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it - if(!MoveItemToInventory(InvItem)) - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + if (!MoveItemToInventory(InvItem)) { + _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); + } safe_delete(InvItem); } } @@ -2639,14 +2599,14 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - _log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory", - WeaponSlot, InvItem->GetItem()->Name); + _log(INVENTORY__BANDOLIER, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory - if(MoveItemToInventory(InvItem)) + if (MoveItemToInventory(InvItem)) { database.SaveInventory(character_id, 0, WeaponSlot); - else - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), - InvItem->GetItem()->Name); + } + else { + _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); + } safe_delete(InvItem); } } @@ -2674,7 +2634,9 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // depends on current behaviour, this routine operates the same as the client when moving items back to inventory when // swapping bandolier sets. - if(!ItemToReturn) return false; + if (!ItemToReturn) { + return false; + } _log(INVENTORY__SLOTS,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); @@ -2692,8 +2654,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() : - ChargeSlotsLeft; + int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() : ChargeSlotsLeft; InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove); @@ -2723,17 +2684,14 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { int ChargeSlotsLeft = InvItem->GetItem()->StackSize - InvItem->GetCharges(); - int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft - ? ItemToReturn->GetCharges() : ChargeSlotsLeft; + int ChargesToMove = ItemToReturn->GetCharges() < ChargeSlotsLeft ? ItemToReturn->GetCharges() : ChargeSlotsLeft; InvItem->SetCharges(InvItem->GetCharges() + ChargesToMove); if(UpdateClient) - SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot), - ItemPacketTrade); + SendItemPacket(BaseSlotID + BagSlot, m_inv.GetItem(BaseSlotID + BagSlot), ItemPacketTrade); - database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), - BaseSlotID + BagSlot); + database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); ItemToReturn->SetCharges(ItemToReturn->GetCharges() - ChargesToMove); @@ -2808,30 +2766,45 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool std::map instmap; // build reference map - for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_POSSESSIONS_SIZE; ++index) - if (m_inv[index]) - instmap[index] = m_inv[index]; - for (int16 index = EmuConstants::TRIBUTE_BEGIN; index <= EmuConstants::TRIBUTE_END; ++index) - if (m_inv[index]) - instmap[index] = m_inv[index]; - for (int16 index = EmuConstants::BANK_BEGIN; index <= EmuConstants::BANK_END; ++index) - if (m_inv[index]) - instmap[index] = m_inv[index]; - for (int16 index = EmuConstants::SHARED_BANK_BEGIN; index <= EmuConstants::SHARED_BANK_END; ++index) - if (m_inv[index]) - instmap[index] = m_inv[index]; - for (int16 index = EmuConstants::TRADE_BEGIN; index <= EmuConstants::TRADE_END; ++index) - if (m_inv[index]) - instmap[index] = m_inv[index]; + for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_POSSESSIONS_SIZE; ++index) { + auto inst = m_inv[index]; + if (inst == nullptr) { continue; } + instmap[index] = inst; + } + for (int16 index = EmuConstants::TRIBUTE_BEGIN; index <= EmuConstants::TRIBUTE_END; ++index) { + auto inst = m_inv[index]; + if (inst == nullptr) { continue; } + instmap[index] = inst; + } + for (int16 index = EmuConstants::BANK_BEGIN; index <= EmuConstants::BANK_END; ++index) { + auto inst = m_inv[index]; + if (inst == nullptr) { continue; } + instmap[index] = inst; + } + for (int16 index = EmuConstants::SHARED_BANK_BEGIN; index <= EmuConstants::SHARED_BANK_END; ++index) { + auto inst = m_inv[index]; + if (inst == nullptr) { continue; } + instmap[index] = inst; + } + for (int16 index = EmuConstants::TRADE_BEGIN; index <= EmuConstants::TRADE_END; ++index) { + auto inst = m_inv[index]; + if (inst == nullptr) { continue; } + instmap[index] = inst; + } - if (Object* tsobject = GetTradeskillObject()) - for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_WORLD_SIZE; ++index) - if (tsobject->GetItem(index)) - instmap[EmuConstants::WORLD_BEGIN + index] = tsobject->GetItem(index); + auto tsobject = GetTradeskillObject(); + if (tsobject != nullptr) { + for (int16 index = MAIN_BEGIN; index < EmuConstants::MAP_WORLD_SIZE; ++index) { + auto inst = tsobject->GetItem(index); + if (inst == nullptr) { continue; } + instmap[EmuConstants::WORLD_BEGIN + index] = inst; + } + } int limbo = 0; - for (iter_queue cursor_itr = m_inv.cursor_begin(); cursor_itr != m_inv.cursor_end(); ++cursor_itr, ++limbo) { - if (cursor_itr == m_inv.cursor_begin()) // m_inv.cursor_begin() is referenced as MainCursor in MapPossessions above + for (auto cursor_itr = m_inv.cursor_begin(); cursor_itr != m_inv.cursor_end(); ++cursor_itr, ++limbo) { + // m_inv.cursor_begin() is referenced as MainCursor in MapPossessions above + if (cursor_itr == m_inv.cursor_begin()) continue; instmap[8000 + limbo] = *cursor_itr; @@ -2841,20 +2814,24 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool instmap[MainPowerSource] = m_inv[MainPowerSource]; // call InterrogateInventory_ for error check - for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) + for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()) && (!error); ++instmap_itr) { InterrogateInventory_(true, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); + } if (autolog && error && (!log)) log = true; - if (log) + if (log) { _log(INVENTORY__ERROR, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); - if (!silent) + } + if (!silent) { requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); + } // call InterrogateInventory_ for report - for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()); ++instmap_itr) + for (std::map::iterator instmap_itr = instmap.begin(); (instmap_itr != instmap.end()); ++instmap_itr) { InterrogateInventory_(false, requester, instmap_itr->first, INVALID_INDEX, instmap_itr->second, nullptr, log, silent, error, 0); + } if (error) { Message(13, "An error has been discovered in your inventory!"); @@ -2891,10 +2868,12 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea error = true; } else { - if (inst) - for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE) && (!error); ++sub) // treat any ItemInst as having the max internal slots available + if (inst) { + for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE) && (!error); ++sub) { // treat any ItemInst as having the max internal slots available if (inst->GetItem(sub)) InterrogateInventory_(true, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); + } + } } } else { @@ -2903,24 +2882,28 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea std::string p; std::string e; - if (inst) { i = StringFormat("%s (class: %u | augtype: %u)", inst->GetItem()->Name, inst->GetItem()->ItemClass, inst->GetItem()->AugType); } + if (inst) { i = StringFormat("%s (id: %u, cls: %u, aug_t: %u)", inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->ItemClass, inst->GetItem()->AugType); } else { i = "NONE"; } - if (parent) { p = StringFormat("%s (class: %u | augtype: %u), index: %i", parent->GetItem()->Name, parent->GetItem()->ItemClass, parent->GetItem()->AugType, index); } + if (parent) { p = StringFormat("%s (id: %u, cls: %u, aug_t: %u), index: %i", parent->GetItem()->Name, parent->GetItem()->ID, parent->GetItem()->ItemClass, parent->GetItem()->AugType, index); } else { p = "NONE"; } if (localerror) { e = " [ERROR]"; } else { e = ""; } - if (log) + if (log) { _log(INVENTORY__ERROR, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", - head, depth, i.c_str(), p.c_str(), e.c_str()); - if (!silent) - requester->Message(1, "%i:%i - inst: %s - parent: %s%s", - head, depth, i.c_str(), p.c_str(), e.c_str()); + head, depth, i.c_str(), p.c_str(), e.c_str()); + } + if (!silent) { + requester->Message(6, "%i:%i - inst: %s - parent: %s%s", + head, depth, i.c_str(), p.c_str(), e.c_str()); + } - if (inst) - for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE); ++sub) + if (inst) { + for (int16 sub = SUB_BEGIN; (sub < EmuConstants::ITEM_CONTAINER_SIZE); ++sub) { if (inst->GetItem(sub)) InterrogateInventory_(false, requester, head, sub, inst->GetItem(sub), inst, log, silent, error, depth + 1); + } + } } return; From 6eae464211b626962a7bc869291befe82b2a1dcd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 22:17:37 -0600 Subject: [PATCH 0884/1883] Some EQEmuLogSys changes --- common/eqemu_logsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 4883b94a6..b47ccef65 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -138,7 +138,7 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s void EQEmuLogSys::ProcessGMSay(uint16 log_type, std::string message){ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - on_log_gmsay_hook(log_type, message); + // on_log_gmsay_hook(log_type, message); } } From 1e10e088ad2439a175ce4588d14529cd013676a7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 22:35:58 -0600 Subject: [PATCH 0885/1883] Add category to ProcessGMSay --- common/eqemu_logsys.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index b47ccef65..7c3ef2cb7 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -136,7 +136,8 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s -void EQEmuLogSys::ProcessGMSay(uint16 log_type, std::string message){ +void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) +{ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ // on_log_gmsay_hook(log_type, message); } @@ -195,7 +196,7 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std: std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_debug_message); - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_debug_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); } @@ -207,7 +208,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) va_end(args); EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_message); - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, output_message); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_message); } @@ -223,7 +224,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) va_end(args); EQEmuLogSys::ProcessConsoleMessage(log_type, output_message); - EQEmuLogSys::ProcessGMSay(log_type, output_message); + EQEmuLogSys::ProcessGMSay(log_type, 0, output_message); EQEmuLogSys::ProcessLogWrite(log_type, output_message); } From 723b87bba4b73faf4d822e32dcefc77db1869804 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 22:37:36 -0600 Subject: [PATCH 0886/1883] Add category to ProcessConsoleMessage --- common/eqemu_logsys.cpp | 8 ++++---- common/eqemu_logsys.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 7c3ef2cb7..cf452d7bf 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -155,7 +155,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_type, std::string message){ } } -void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, const std::string message) +void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) { if (log_type > EQEmuLogSys::MaxLogID){ return; @@ -195,7 +195,7 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std: std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_debug_message); EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_debug_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); } @@ -207,7 +207,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, output_message); + EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_message); EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_message); } @@ -223,7 +223,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::ProcessConsoleMessage(log_type, output_message); + EQEmuLogSys::ProcessConsoleMessage(log_type, 0, output_message); EQEmuLogSys::ProcessGMSay(log_type, 0, output_message); EQEmuLogSys::ProcessLogWrite(log_type, output_message); } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index b52f3ecd6..471be0846 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -101,8 +101,8 @@ private: std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); - void ProcessConsoleMessage(uint16 log_type, const std::string message); - void ProcessGMSay(uint16 log_type, std::string message); + void ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); + void ProcessGMSay(uint16 log_type, uint16 log_category, std::string message); void ProcessLogWrite(uint16 log_type, std::string message); }; From dbdfb23cc39642089e3a4ed6f1839dbbdf6d972a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 22:38:24 -0600 Subject: [PATCH 0887/1883] Add category to ProcessLogWrite --- common/eqemu_logsys.cpp | 9 +++++---- common/eqemu_logsys.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index cf452d7bf..d0d7887e4 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -143,7 +143,8 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string } } -void EQEmuLogSys::ProcessLogWrite(uint16 log_type, std::string message){ +void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message) +{ char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); @@ -197,7 +198,7 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std: EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_debug_message); EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_debug_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_debug_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_debug_message); } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) @@ -209,7 +210,7 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_message); EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, output_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_message); } void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) @@ -225,7 +226,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) EQEmuLogSys::ProcessConsoleMessage(log_type, 0, output_message); EQEmuLogSys::ProcessGMSay(log_type, 0, output_message); - EQEmuLogSys::ProcessLogWrite(log_type, output_message); + EQEmuLogSys::ProcessLogWrite(log_type, 0, output_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 471be0846..5eed3e181 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -103,7 +103,7 @@ private: void ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_type, uint16 log_category, std::string message); - void ProcessLogWrite(uint16 log_type, std::string message); + void ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message); }; extern EQEmuLogSys logger; From 362de5084ff6b725a5e1ef4640dbe13a0a00e31e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 22:44:27 -0600 Subject: [PATCH 0888/1883] Add category processing to ProcessGMSay so we don't get a zone crash from feedback loop of GMSay outputting packets, then those packets going to GMSay. This would make a log inside of a log inside of a log, I call it, log inception --- common/eqemu_logsys.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d0d7887e4..b60687300 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -138,8 +138,12 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) { + /* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */ + if (log_category == EQEmuLogSys::LogCategory::Netcode) + return; + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - // on_log_gmsay_hook(log_type, message); + on_log_gmsay_hook(log_type, message); } } @@ -196,9 +200,9 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std: std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_debug_message); - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_debug_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) From 3a24372009bdf592bd243336a57728ad96b8fa0d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 23:10:45 -0600 Subject: [PATCH 0889/1883] Added 2015_1_15_logsys_categories_table.sql --- .../2015_1_15_logsys_categories_table.sql | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 utils/sql/git/required/2015_1_15_logsys_categories_table.sql diff --git a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql new file mode 100644 index 000000000..2ed16f5aa --- /dev/null +++ b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql @@ -0,0 +1,36 @@ +-- ---------------------------- +-- Table structure for logsys_categories +-- ---------------------------- +DROP TABLE IF EXISTS `logsys_categories`; +CREATE TABLE `logsys_categories` ( + `log_category_id` int(11) NOT NULL, + `log_category_description` varchar(150) DEFAULT NULL, + `log_to_console` smallint(11) DEFAULT '0', + `log_to_file` smallint(11) DEFAULT '0', + `log_to_gmsay` smallint(11) DEFAULT '0', + PRIMARY KEY (`log_category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of logsys_categories +-- ---------------------------- +INSERT INTO `logsys_categories` VALUES ('0', 'Zone_Server', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('1', 'World_Server', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('2', 'UCS_Server', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('3', 'QS_Server', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('4', 'WebInterface_Server', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('5', 'AA', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('6', 'Doors', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('7', 'Guilds', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('8', 'Inventory', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('9', 'Launcher', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('10', 'Netcode - Does not log to gmsay for loop reasons', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('11', 'Object', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('12', 'Rules', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('13', 'Skills', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('14', 'Spawns', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('15', 'Spells', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('16', 'Tasks', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('17', 'Trading', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('18', 'Tradeskills', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('19', 'Tribute', '0', '0', '0'); From 44b65d1ee50e1c6acaabc98c7d00351da27127f3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 15 Jan 2015 23:49:20 -0600 Subject: [PATCH 0890/1883] Add Database::LoadLogSysSettings function --- common/database.cpp | 25 +++++++++++++++++++++++++ common/database.h | 3 +++ common/eqemu_logsys.cpp | 27 ++------------------------- common/eqemu_logsys.h | 25 ++++++++++++++++++++++++- zone/zonedb.h | 1 + 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index f852ae37e..dd95103ba 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4257,3 +4257,28 @@ uint32 Database::GetGuildIDByCharID(uint32 char_id) auto row = results.begin(); return atoi(row[0]); } + +void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ + std::string query = + "SELECT " + "log_category_id, " + "log_category_description, " + "log_to_console, " + "log_to_file, " + "log_to_gmsay " + "FROM " + "logsys_categories " + "ORDER BY log_category_id"; + auto results = QueryDatabase(query); + int log_category = 0; + for (auto row = results.begin(); row != results.end(); ++row) { + log_category = atoi(row[0]); + log_settings[log_category].log_to_console = atoi(row[2]); + log_settings[log_category].log_to_file = atoi(row[3]); + log_settings[log_category].log_to_gmsay = atoi(row[4]); + std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; + std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; + std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; + std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; + } +} \ No newline at end of file diff --git a/common/database.h b/common/database.h index f45b83600..424a0dfa9 100644 --- a/common/database.h +++ b/common/database.h @@ -645,6 +645,9 @@ public: void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon); void AddReport(std::string who, std::string against, std::string lines); + /* EQEmuLogSys */ + void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + private: void DBInitVars(); diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index b60687300..5b13438d1 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -20,6 +20,7 @@ #include "eqemu_logsys.h" #include "platform.h" #include "string_util.h" +#include "database.h" #include #include @@ -70,30 +71,6 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Crash", }; -/* If you add to this, make sure you update LogCategory in eqemu_logsys.h */ -static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { - "Zone", - "World", - "UCS", - "QueryServer", - "WebInterface", - "AA", - "Doors", - "Guild", - "Inventory", - "Launcher", - "Netcode", - "Object", - "Rules", - "Skills", - "Spawns", - "Spells", - "Tasks", - "Trading", - "Tradeskills", - "Tribute", -}; - static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", Console::Color::Yellow, // "Normal", @@ -121,7 +98,7 @@ void EQEmuLogSys::LoadLogSettings() log_settings[i].log_to_console = 1; log_settings[i].log_to_file = 1; log_settings[i].log_to_gmsay = 1; - std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; + // std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; } log_settings_loaded = true; } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 5eed3e181..669d06ea9 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -48,7 +48,7 @@ public: Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; - /* If you add to this, make sure you update LogCategoryName in eqemu_logsys.cpp */ + /* If you add to this, make sure you update LogCategoryName */ enum LogCategory { Zone_Server = 0, World_Server, @@ -108,5 +108,28 @@ private: extern EQEmuLogSys logger; +/* If you add to this, make sure you update LogCategory */ +static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { + "Zone", + "World", + "UCS", + "QueryServer", + "WebInterface", + "AA", + "Doors", + "Guild", + "Inventory", + "Launcher", + "Netcode", + "Object", + "Rules", + "Skills", + "Spawns", + "Spells", + "Tasks", + "Trading", + "Tradeskills", + "Tribute", +}; #endif \ No newline at end of file diff --git a/zone/zonedb.h b/zone/zonedb.h index 1c103074a..56d9a2b25 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -4,6 +4,7 @@ #include "../common/shareddb.h" #include "../common/eq_packet_structs.h" #include "../common/faction.h" +#include "../common/eqemu_logsys.h" class Client; class Corpse; From 0d2c3966809db0df72c1a71251ea95ea34dcc518 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:06:12 -0600 Subject: [PATCH 0891/1883] zone LoadLogSysSettings --- zone/net.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index df17ff73e..8d18daba1 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -115,8 +115,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); - logger.LoadLogSettings(); - logger.OnLogHookCallBackZone(&ClientLogs::ClientMessage); + set_exception_handler(); const char *zone_name; @@ -149,8 +148,6 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { logger.Log(EQEmuLogSys::Error, "Loading server configuration failed."); @@ -175,6 +172,12 @@ int main(int argc, char** argv) { logger.Log(EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } + + /* Register Log System and Settings */ + logger.LoadLogSettings(); + logger.OnLogHookCallBackZone(&ClientLogs::ClientMessage); + database.LoadLogSysSettings(logger.log_settings); + guild_mgr.SetDatabase(&database); GuildBanks = nullptr; From 70fbf23d2736fe7e3db7ba3f67f38d2708ae7259 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:07:30 -0600 Subject: [PATCH 0892/1883] Rename LoadLogSettings to LoadLogSettingsDefaults --- client_files/export/main.cpp | 2 +- client_files/import/main.cpp | 2 +- common/eqemu_logsys.cpp | 2 +- common/eqemu_logsys.h | 2 +- eqlaunch/eqlaunch.cpp | 2 +- queryserv/queryserv.cpp | 2 +- shared_memory/main.cpp | 2 +- ucs/ucs.cpp | 2 +- world/net.cpp | 2 +- zone/net.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 550446cb2..18136fcf4 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -35,7 +35,7 @@ void ExportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientExport); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Client Files Export Utility"); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 381889d93..492e7b901 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -33,7 +33,7 @@ void ImportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientImport); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Client Files Import Utility"); diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 5b13438d1..61f4f81bd 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -89,7 +89,7 @@ EQEmuLogSys::EQEmuLogSys(){ EQEmuLogSys::~EQEmuLogSys(){ } -void EQEmuLogSys::LoadLogSettings() +void EQEmuLogSys::LoadLogSettingsDefaults() { log_platform = GetExecutablePlatformInt(); std::cout << "PLATFORM " << log_platform << std::endl; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 669d06ea9..29315c74c 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -75,7 +75,7 @@ public: void CloseFileLogs(); - void LoadLogSettings(); + void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); void LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...); diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 11ad0686f..861f536fa 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -39,7 +39,7 @@ void CatchSignal(int sig_num); int main(int argc, char *argv[]) { RegisterExecutablePlatform(ExePlatformLaunch); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); std::string launcher_name; diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index a64ce9be8..25b033a24 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -50,7 +50,7 @@ void CatchSignal(int sig_num) { int main() { RegisterExecutablePlatform(ExePlatformQueryServ); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); Timer LFGuildExpireTimer(60000); Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 333d5789c..e8d7ec8b9 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -37,7 +37,7 @@ EQEmuLogSys logger; int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); logger.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 2af41f71d..74f7c0522 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -69,7 +69,7 @@ std::string GetMailPrefix() { int main() { RegisterExecutablePlatform(ExePlatformUCS); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); // Check every minute for unused channels we can delete diff --git a/world/net.cpp b/world/net.cpp index 6f3d85f5e..64a0b973b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -113,7 +113,7 @@ void CatchSignal(int sig_num); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); set_exception_handler(); /* Database Version Check */ diff --git a/zone/net.cpp b/zone/net.cpp index 8d18daba1..64c741ffc 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -174,7 +174,7 @@ int main(int argc, char** argv) { } /* Register Log System and Settings */ - logger.LoadLogSettings(); + logger.LoadLogSettingsDefaults(); logger.OnLogHookCallBackZone(&ClientLogs::ClientMessage); database.LoadLogSysSettings(logger.log_settings); From 2fb50fa5cc42b4d90177e647545a1edb4b2da4b6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:13:56 -0600 Subject: [PATCH 0893/1883] Implement log_settings for ProcessGMSay --- common/eqemu_logsys.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 61f4f81bd..be6cb45de 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -92,13 +92,11 @@ EQEmuLogSys::~EQEmuLogSys(){ void EQEmuLogSys::LoadLogSettingsDefaults() { log_platform = GetExecutablePlatformInt(); - std::cout << "PLATFORM " << log_platform << std::endl; /* Write defaults */ for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ - log_settings[i].log_to_console = 1; - log_settings[i].log_to_file = 1; - log_settings[i].log_to_gmsay = 1; - // std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; + log_settings[i].log_to_console = 0; + log_settings[i].log_to_file = 0; + log_settings[i].log_to_gmsay = 0; } log_settings_loaded = true; } @@ -115,6 +113,10 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) { + /* Check if category enabled for process */ + if (log_settings[log_category].log_to_gmsay) + return; + /* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */ if (log_category == EQEmuLogSys::LogCategory::Netcode) return; From 0b661a634728d11625d0ea7677c8e363eac9c57e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:14:16 -0600 Subject: [PATCH 0894/1883] Implement log_settings for ProcessLogWrite --- common/eqemu_logsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index be6cb45de..68f1cafdf 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -128,6 +128,10 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message) { + /* Check if category enabled for process */ + if (log_settings[log_category].log_to_file) + return; + char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); From 73b54ffabb11fda8e1cede77d591bd6213a481f3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:14:49 -0600 Subject: [PATCH 0895/1883] Implement log_settings for ProcessConsoleMessage --- common/eqemu_logsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 68f1cafdf..a2316933d 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -145,6 +145,10 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::str void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) { + /* Check if category enabled for process */ + if (log_settings[log_category].log_to_console) + return; + if (log_type > EQEmuLogSys::MaxLogID){ return; } From 829dd8ddafc5cb014da83fbe70c38034b642a455 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:15:34 -0600 Subject: [PATCH 0896/1883] Correct log_settings checks --- common/eqemu_logsys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index a2316933d..ac81c106a 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -114,7 +114,7 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) { /* Check if category enabled for process */ - if (log_settings[log_category].log_to_gmsay) + if (log_settings[log_category].log_to_gmsay == 0) return; /* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */ @@ -129,7 +129,7 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message) { /* Check if category enabled for process */ - if (log_settings[log_category].log_to_file) + if (log_settings[log_category].log_to_file == 0) return; char time_stamp[80]; @@ -146,7 +146,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::str void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) { /* Check if category enabled for process */ - if (log_settings[log_category].log_to_console) + if (log_settings[log_category].log_to_console == 0) return; if (log_type > EQEmuLogSys::MaxLogID){ From cdc249dde341e0147093e95217d1c2bb66a477dc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:37:36 -0600 Subject: [PATCH 0897/1883] Converted SyncWorldtime std::cout --- common/eqemu_logsys.cpp | 2 -- zone/worldserver.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index ac81c106a..8a3a49adf 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -109,8 +109,6 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); } - - void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) { /* Check if category enabled for process */ diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 2166aba56..06c4a26cb 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - std::cout << "Received Message SyncWorldTime" << std::endl; + logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); From e69486d9058d52e332c7eabc87169ee8e2641615 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:40:43 -0600 Subject: [PATCH 0898/1883] Converted 'is a GM' debug --- zone/client.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index d65354d0e..69569cbf2 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1511,9 +1511,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { -#if EQDEBUG >= 5 - printf("%s is a GM\n", GetName()); -#endif + logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "%s is a GM"); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); From 055f1523c7588f1fe8cc7450d2607d305b23219d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:44:28 -0600 Subject: [PATCH 0899/1883] Comment defaults debugging --- common/database.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index dd95103ba..1fb4ef445 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4276,9 +4276,9 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ log_settings[log_category].log_to_console = atoi(row[2]); log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); - std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; - std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; - std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; - std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; + // std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; + // std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; + // std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; + // std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; } } \ No newline at end of file From cd7e9d40bf7a47a6e1a7d72492e9e5e229fcc934 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:50:16 -0600 Subject: [PATCH 0900/1883] Re-Index Log Categories to avoid bugginies with index references --- common/database.cpp | 8 ++-- common/eqemu_logsys.h | 2 +- .../2015_1_15_logsys_categories_table.sql | 43 ++++++++++--------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 1fb4ef445..dd95103ba 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4276,9 +4276,9 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ log_settings[log_category].log_to_console = atoi(row[2]); log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); - // std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; - // std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; - // std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; - // std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; + std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; + std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; + std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; + std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; } } \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 29315c74c..f3f31740e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -50,7 +50,7 @@ public: /* If you add to this, make sure you update LogCategoryName */ enum LogCategory { - Zone_Server = 0, + Zone_Server = 1, World_Server, UCS_Server, QS_Server, diff --git a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql index 2ed16f5aa..6e6847416 100644 --- a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql +++ b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql @@ -1,3 +1,6 @@ + +SET FOREIGN_KEY_CHECKS=0; + -- ---------------------------- -- Table structure for logsys_categories -- ---------------------------- @@ -14,23 +17,23 @@ CREATE TABLE `logsys_categories` ( -- ---------------------------- -- Records of logsys_categories -- ---------------------------- -INSERT INTO `logsys_categories` VALUES ('0', 'Zone_Server', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('1', 'World_Server', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('2', 'UCS_Server', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('3', 'QS_Server', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('4', 'WebInterface_Server', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('5', 'AA', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('6', 'Doors', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('7', 'Guilds', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('8', 'Inventory', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('9', 'Launcher', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('10', 'Netcode - Does not log to gmsay for loop reasons', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('11', 'Object', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('12', 'Rules', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('13', 'Skills', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('14', 'Spawns', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('15', 'Spells', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('16', 'Tasks', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('17', 'Trading', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('18', 'Tradeskills', '0', '0', '0'); -INSERT INTO `logsys_categories` VALUES ('19', 'Tribute', '0', '0', '0'); +INSERT INTO `logsys_categories` VALUES ('1', 'Zone_Server', '1', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('2', 'World_Server', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('3', 'UCS_Server', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('4', 'QS_Server', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('5', 'WebInterface_Server', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('6', 'AA', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('7', 'Doors', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('8', 'Guilds', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('9', 'Inventory', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('10', 'Launcher', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('11', 'Netcode - Does not log to gmsay for loop reasons', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('12', 'Object', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('13', 'Rules', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('14', 'Skills', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('15', 'Spawns', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('16', 'Spells', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('17', 'Tasks', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('18', 'Trading', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('19', 'Tradeskills', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('20', 'Tribute', '0', '0', '1'); From af1fc5539331efcfe522aca3001f09b9919d1703 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:52:00 -0600 Subject: [PATCH 0901/1883] Comment defaults debugging --- common/database.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index dd95103ba..0246785fd 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4276,9 +4276,5 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ log_settings[log_category].log_to_console = atoi(row[2]); log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); - std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; - std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; - std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; - std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; } } \ No newline at end of file From 2cb3a491e0a30a5e3be655438456a04ecf3c811f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:53:31 -0600 Subject: [PATCH 0902/1883] Add include to eq_stream_factory.cpp for EQEmuLogSys --- common/eq_stream_factory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 22412e0fe..7d2a7e365 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -1,4 +1,5 @@ #include "debug.h" +#include "eqemu_logsys.h" #include "eq_stream_factory.h" #ifdef _WINDOWS From 32a3666170fe407839cbb870b50a37892555c1c9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 00:54:27 -0600 Subject: [PATCH 0903/1883] Add Linux chmod mask 0755 for mkdir --- common/eqemu_logsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 8a3a49adf..9204f3136 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -230,7 +230,7 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ #ifdef _WINDOWS _mkdir(directory_name.c_str()); #else - mkdir(directory_name.c_str()); + mkdir(directory_name.c_str(), 0755); #endif } From 04f13bbf4bd327a0d2e2345f6d02b2eb9431ce07 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:03:15 -0600 Subject: [PATCH 0904/1883] Fix for tcp_connection.cpp logger references --- common/tcp_connection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 3f1e30a46..f0df7b197 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" +#include "../common/eqemu_logsys.h" #include #include From 3c22b106efd6a4f17cc081a91ffe9db38868dcc6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:07:29 -0600 Subject: [PATCH 0905/1883] TCPConnection LogCategory Add --- common/eqemu_logsys.h | 2 ++ common/tcp_connection.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index f3f31740e..a80932edc 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -70,6 +70,7 @@ public: Trading, Tradeskills, Tribute, + TCP_Connection, MaxCategoryID /* Don't Remove this*/ }; @@ -130,6 +131,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Trading", "Tradeskills", "Tribute", + "TCP_Connection" }; #endif \ No newline at end of file diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index f0df7b197..4a17125a0 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Starting TCPConnectionLoop with thread ID %d", pthread_self()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { From d42a63b72dfbc2688b5c7ff021f2f66b409b5fd6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:08:26 -0600 Subject: [PATCH 0906/1883] TCPConnection Loop add to TCP Category --- common/tcp_connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 4a17125a0..2cba6fd88 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); From 5b51f69753a9d0df74d72e95a912189198b94843 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:16:17 -0600 Subject: [PATCH 0907/1883] Fix for 'is a GM' convert (Derp) --- common/eqemu_logsys.h | 1 + zone/client.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index a80932edc..18c063495 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -111,6 +111,7 @@ extern EQEmuLogSys logger; /* If you add to this, make sure you update LogCategory */ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { + "", "Zone", "World", "UCS", diff --git a/zone/client.cpp b/zone/client.cpp index 69569cbf2..0bb719e35 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1511,7 +1511,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "%s is a GM"); + logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "%s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); From 295fa30a35b01f67dc25f6d0e208c54ed60aac8e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:21:02 -0600 Subject: [PATCH 0908/1883] Adjust World to zone port assignment message --- zone/client.cpp | 2 +- zone/worldserver.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 0bb719e35..89a4ab75e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1511,7 +1511,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "%s is a GM", GetName()); + logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 06c4a26cb..d75e79b38 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server,"Got 0x%04x from world:",pack->opcode); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,7 +155,7 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server,"World indicated port %d for this zone.",sci->port); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } From 08d05d8aae4f3ed9656aab150d3c09444d2b89aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:21:58 -0600 Subject: [PATCH 0909/1883] ServerOP_ZAAuthFailed cout message to LogDebugType --- zone/worldserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d75e79b38..8abb308d7 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -160,7 +160,7 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - std::cout << "World server responded 'Not Authorized', disabling reconnect" << std::endl; + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; From d77ec9b46681c00e7ddd1d443343073f260099b2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:26:36 -0600 Subject: [PATCH 0910/1883] Add Client_Server_Packet Category --- common/eqemu_logsys.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 18c063495..62a57d682 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -71,6 +71,7 @@ public: Tradeskills, Tribute, TCP_Connection, + Client_Server_Packet, MaxCategoryID /* Don't Remove this*/ }; @@ -132,7 +133,8 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Trading", "Tradeskills", "Tribute", - "TCP_Connection" + "TCP_Connection", + "Client_Server_Packet", }; #endif \ No newline at end of file From 0c905226e1b515a4cafef7a34e9cdb4d165ad500 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 16 Jan 2015 02:32:05 -0500 Subject: [PATCH 0911/1883] Fix linux compile (partially) --- common/tcp_server.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index 2313b9e7c..9e0553d40 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -1,5 +1,6 @@ #include "debug.h" #include "tcp_server.h" +#include "../common/eqemu_logsys.h" #include #include From 5902330bc5d5efc3bd011e8fd678876f6be5c9e7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:46:17 -0600 Subject: [PATCH 0912/1883] ChannelMesssageReceived debug convert from preprocessor --- common/eqemu_logsys.h | 1 - zone/client.cpp | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 62a57d682..afcf04aab 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -76,7 +76,6 @@ public: }; void CloseFileLogs(); - void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); diff --git a/zone/client.cpp b/zone/client.cpp index 89a4ab75e..b05ae924c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -700,10 +700,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - - #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); - #endif + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); From bab8e2ef33fcfbaf72ca9d0dd2f343c0cd2139f1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:47:27 -0600 Subject: [PATCH 0913/1883] Removed preprocessor EQDEBUG from EQStream from unknown opcode to Application map --- common/eq_stream.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 9a957f5a7..39659e897 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -958,11 +958,10 @@ EQRawApplicationPacket *p=nullptr; if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); -#if EQDEBUG >= 4 - if(emu_op == OP_Unknown) { + if (emu_op == OP_Unknown) { logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } -#endif + p->SetOpcode(emu_op); } } From 3c9a2702b51532ebe0cf68f182953440ca650874 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:48:43 -0600 Subject: [PATCH 0914/1883] Removed preprocessor EQDEBUG from EQStream from unknown opcode to Application map for PopRawPacket --- common/eq_stream.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 39659e897..38f2c0cdd 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -985,11 +985,10 @@ EQRawApplicationPacket *p=nullptr; if(p) { if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); -#if EQDEBUG >= 4 if(emu_op == OP_Unknown) { - logger.Log(EQEmuLogSys::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } -#endif + p->SetOpcode(emu_op); } } From ba2b91a548d20cba13dd17d91809e045ae6da02b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 16 Jan 2015 02:56:14 -0500 Subject: [PATCH 0915/1883] Fix loginserver --- loginserver/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loginserver/main.cpp b/loginserver/main.cpp index 820cc9113..31941b800 100644 --- a/loginserver/main.cpp +++ b/loginserver/main.cpp @@ -22,6 +22,7 @@ #include "../common/timer.h" #include "../common/platform.h" #include "../common/crash.h" +#include "../common/eqemu_logsys.h" #include "login_server.h" #include #include @@ -30,6 +31,7 @@ TimeoutManager timeout_manager; LoginServer server; +EQEmuLogSys logger; ErrorLog *server_log; bool run_server = true; From bd4e15609a50ef02daaabe57a6ba451bc5290361 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 01:59:57 -0600 Subject: [PATCH 0916/1883] astyle the terrible sin that is maxskill.h --- zone/maxskill.h | 5170 ++++++++++++++++++++++++++--------------------- 1 file changed, 2868 insertions(+), 2302 deletions(-) diff --git a/zone/maxskill.h b/zone/maxskill.h index 8979d4814..e37cccac0 100644 --- a/zone/maxskill.h +++ b/zone/maxskill.h @@ -1,2340 +1,2906 @@ // This file needs more than just 'std' updates -uint16 Mob::MaxSkill_weapon(uint16 skillid, uint16 class_, uint16 level) const{ - if (skillid > HIGHEST_SKILL) +uint16 Mob::MaxSkill_weapon(uint16 skillid, uint16 class_, uint16 level) const +{ + if (skillid > HIGHEST_SKILL) { return 0; - uint16 r_value = 0; - switch(skillid) { - case _1H_BLUNT: - case _2H_BLUNT: - case PIERCING: - case HAND_TO_HAND: - case _1H_SLASHING: - case _2H_SLASHING:{ - switch (class_) { - // Pure melee classes - case WARRIOR: case WARRIORGM:{ - r_value = 5 + (level*5); - if ( level < 51 && r_value > 200) - r_value = 200; - if ( level > 50 && r_value > 250 ) - r_value = 250; - switch (skillid) { - case PIERCING:{ - if ( r_value > 240 ) - r_value = 240; - break; - } - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - default: break; - } - break; - } - case MONK: case MONKGM:{ - r_value = 5 + (level*5); - if ( level < 51 && r_value > 240) - if ( r_value > 240 ) - r_value = 240; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 225 && level < 51 ) - r_value = 225; - break; - } - case PIERCING: - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: break; - } - break; - } - case ROGUE: case ROGUEGM:{ - r_value = 5 + (level*5); - if ( level > 50 && r_value > 250 ) - r_value = 250; - if ( level < 51 ){ - if ( r_value > 200 && skillid != PIERCING ) - r_value = 200; - if ( r_value > 210 && skillid == PIERCING ) - r_value = 210; - } - if (skillid == HAND_TO_HAND && r_value > 100) - r_value = 100; - break; - } - case BERSERKER: case BERSERKERGM:{ - r_value = 5 + (level*5); - if ( level < 51 && r_value > 240) - r_value = 240; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 198) - r_value = 198; - break; - } - case PIERCING:{ - if ( r_value > 240) - r_value = 240; - break; - } - case _2H_BLUNT: - case _2H_SLASHING:{ - if ( r_value > 252 ) - r_value = 252; - break; - } - default: - r_value = 0; - break; - } - break; - } - // Priest classes - case CLERIC: case CLERICGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - break; - } - case PIERCING: - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: break; - } - break; - } - case DRUID: case DRUIDGM:{ - r_value = 4 + (level*4); - if ( r_value > 175 ){ - r_value = 175; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - } - case PIERCING: - case _2H_SLASHING:{ - r_value = 0; - break; - - } - default: break; - } - break; - } - case SHAMAN: case SHAMANGM:{ - r_value = 4 + (level*4); - if ( r_value > 200 ){ - r_value = 200; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: break; - } - break; - } - // Hybrids - case RANGER: case RANGERGM:{ - r_value = 5 + (level*5); - if ( level > 50 ){ - if ( r_value > 250 ) - r_value = 250; - switch (skillid) { - case PIERCING:{ - if ( r_value > 240 ) - r_value = 240; - break; - } - default: break; - } - } - else if ( level < 51 ){ - if ( r_value > 200 ) - r_value = 200; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - default: break; - } - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - r_value = 5 + (level*5); - if ( level > 50 && r_value > 225 ){ - r_value = 225; - } - if ( level < 51 && r_value > 200 ){ - r_value = 200; - } - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - default: break; - } - break; - } - case BARD: case BARDGM:{ - r_value = 5 + (level*5); - if ( level > 51 && r_value > 225 ) - r_value = 225; - if ( level < 51 && r_value > 200 ) - r_value = 200; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 100 ) - r_value = 100; - break; - } - case _2H_BLUNT: - case _2H_SLASHING:{ - r_value = 0; - } - default: break; - } - break; - } - case BEASTLORD: case BEASTLORDGM:{ - r_value = 4 + (level*4); - if ( level > 51 ){ - if ( r_value > 225 ) - r_value = 225; - } - if ( level < 51 && r_value > 200 ) - r_value = 200; - switch (skillid) { - case HAND_TO_HAND:{ - r_value = 5 + (level*5); // Beastlords use different max skill formula only for h2h 200/250 - if ( level < 51 ) - r_value = 200; - break; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: break; - } - if ( r_value > 250 ) - r_value = 250; - break; - } - // Pure casters - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - r_value = 3 + (level*3); - if ( r_value > 110 ) - r_value = 110; - switch (skillid) { - case HAND_TO_HAND:{ - if ( r_value > 75 ) - r_value = 75; - } - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = 0; - break; - } - default: break; - } - break; - } - default: -#if EQDEBUG - std::cout<<"MaxSkill_Weapon() Unknown class: "< 252) - r_value = 252; - return r_value; + } + uint16 r_value = 0; + switch (skillid) { + case _1H_BLUNT: + case _2H_BLUNT: + case PIERCING: + case HAND_TO_HAND: + case _1H_SLASHING: + case _2H_SLASHING: { + switch (class_) { + // Pure melee classes + case WARRIOR: + case WARRIORGM: { + r_value = 5 + (level * 5); + if ( level < 51 && r_value > 200) { + r_value = 200; + } + if ( level > 50 && r_value > 250 ) { + r_value = 250; + } + switch (skillid) { + case PIERCING: { + if ( r_value > 240 ) { + r_value = 240; + } + break; + } + case HAND_TO_HAND: { + if ( r_value > 100 ) { + r_value = 100; + } + break; + } + default: + break; + } + break; + } + case MONK: + case MONKGM: { + r_value = 5 + (level * 5); + if ( level < 51 && r_value > 240) + if ( r_value > 240 ) { + r_value = 240; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 225 && level < 51 ) { + r_value = 225; + } + break; + } + case PIERCING: + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + break; + } + case ROGUE: + case ROGUEGM: { + r_value = 5 + (level * 5); + if ( level > 50 && r_value > 250 ) { + r_value = 250; + } + if ( level < 51 ) { + if ( r_value > 200 && skillid != PIERCING ) { + r_value = 200; + } + if ( r_value > 210 && skillid == PIERCING ) { + r_value = 210; + } + } + if (skillid == HAND_TO_HAND && r_value > 100) { + r_value = 100; + } + break; + } + case BERSERKER: + case BERSERKERGM: { + r_value = 5 + (level * 5); + if ( level < 51 && r_value > 240) { + r_value = 240; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 198) { + r_value = 198; + } + break; + } + case PIERCING: { + if ( r_value > 240) { + r_value = 240; + } + break; + } + case _2H_BLUNT: + case _2H_SLASHING: { + if ( r_value > 252 ) { + r_value = 252; + } + break; + } + default: + r_value = 0; + break; + } + break; + } + // Priest classes + case CLERIC: + case CLERICGM: { + r_value = 4 + (level * 4); + if ( r_value > 175 ) { + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 75 ) { + r_value = 75; + } + break; + } + case PIERCING: + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + break; + } + case DRUID: + case DRUIDGM: { + r_value = 4 + (level * 4); + if ( r_value > 175 ) { + r_value = 175; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 75 ) { + r_value = 75; + } + } + case PIERCING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + break; + } + case SHAMAN: + case SHAMANGM: { + r_value = 4 + (level * 4); + if ( r_value > 200 ) { + r_value = 200; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 75 ) { + r_value = 75; + } + } + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + break; + } + // Hybrids + case RANGER: + case RANGERGM: { + r_value = 5 + (level * 5); + if ( level > 50 ) { + if ( r_value > 250 ) { + r_value = 250; + } + switch (skillid) { + case PIERCING: { + if ( r_value > 240 ) { + r_value = 240; + } + break; + } + default: + break; + } + } else if ( level < 51 ) { + if ( r_value > 200 ) { + r_value = 200; + } + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 100 ) { + r_value = 100; + } + break; + } + default: + break; + } + break; + } + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + r_value = 5 + (level * 5); + if ( level > 50 && r_value > 225 ) { + r_value = 225; + } + if ( level < 51 && r_value > 200 ) { + r_value = 200; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 100 ) { + r_value = 100; + } + break; + } + default: + break; + } + break; + } + case BARD: + case BARDGM: { + r_value = 5 + (level * 5); + if ( level > 51 && r_value > 225 ) { + r_value = 225; + } + if ( level < 51 && r_value > 200 ) { + r_value = 200; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 100 ) { + r_value = 100; + } + break; + } + case _2H_BLUNT: + case _2H_SLASHING: { + r_value = 0; + } + default: + break; + } + break; + } + case BEASTLORD: + case BEASTLORDGM: { + r_value = 4 + (level * 4); + if ( level > 51 ) { + if ( r_value > 225 ) { + r_value = 225; + } + } + if ( level < 51 && r_value > 200 ) { + r_value = 200; + } + switch (skillid) { + case HAND_TO_HAND: { + r_value = 5 + (level * 5); // Beastlords use different max skill formula only for h2h 200/250 + if ( level < 51 ) { + r_value = 200; + } + break; + } + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + if ( r_value > 250 ) { + r_value = 250; + } + break; + } + // Pure casters + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: { + r_value = 3 + (level * 3); + if ( r_value > 110 ) { + r_value = 110; + } + switch (skillid) { + case HAND_TO_HAND: { + if ( r_value > 75 ) { + r_value = 75; + } + } + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = 0; + break; + } + default: + break; + } + break; + } + default: + #if EQDEBUG + std::cout << "MaxSkill_Weapon() Unknown class: " << class_ << std::endl; + #endif + break; + } + break;// Switch Class + } + default: + #if EQDEBUG + std::cout << "Unknown weapon skill: " << skillid << std::endl; + #endif + break; + }// Switch skill + if (r_value > 252) { + r_value = 252; + } + return r_value; } -uint16 Mob::MaxSkill_offensive(uint16 skillid, uint16 class_, uint16 level) const{ - uint16 r_value = 0; - switch(skillid) { - - case OFFENSE:{ - switch (class_) { - // Melee - case WARRIOR: case WARRIORGM: - case BERSERKER: case BERSERKERGM: - case ROGUE: case ROGUEGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 200 225 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 225) - r_value = 225; - break; - } - case RANGER: case RANGERGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 140 140 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; - break; - } - default: break; - } - break; - } - case THROWING:{ - switch (class_) { - // Melee - case BERSERKER: case BERSERKERGM: - case ROGUE: case ROGUEGM:{ - // 220 250 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 220) - r_value = 220; - } - if (r_value > 250) - r_value = 250; - break; - } - case WARRIOR: case WARRIORGM: - case MONK: case MONKGM:{ - // 113 200 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 113) - r_value = 113; - } - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - - case BARD: case BARDGM: - case RANGER: case RANGERGM:{ - // 113 - r_value = ((level*5) + 5); - if ( r_value > 113 ) - r_value = 113; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - - case ENCHANTER: case ENCHANTERGM:{ - // 75 - r_value = ((level*3) + 3); - if ( r_value > 75 ) - r_value = 75; - break; - } - // No skill classes - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - default: - r_value = 0; - break; - } - break; - } +uint16 Mob::MaxSkill_offensive(uint16 skillid, uint16 class_, uint16 level) const +{ + uint16 r_value = 0; + switch (skillid) { + case OFFENSE: { + switch (class_) { + // Melee + case WARRIOR: + case WARRIORGM: + case BERSERKER: + case BERSERKERGM: + case ROGUE: + case ROGUEGM: { + // 210 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case MONK: + case MONKGM: { + // 230 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 230) { + r_value = 230; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: { + // 200 200 4*level+4 + r_value = ((level * 4) + 4); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: { + // 200 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: + case BARD: + case BARDGM: { + // 200 225 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case RANGER: + case RANGERGM: { + // 210 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: { + // 140 140 level*4 + r_value = (level * 4); + if (r_value > 140) { + r_value = 140; + } + break; + } + default: + break; + } + break; + } + case THROWING: { + switch (class_) { + // Melee + case BERSERKER: + case BERSERKERGM: + case ROGUE: + case ROGUEGM: { + // 220 250 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 220) { + r_value = 220; + } + } + if (r_value > 250) { + r_value = 250; + } + break; + } + case WARRIOR: + case WARRIORGM: + case MONK: + case MONKGM: { + // 113 200 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 113) { + r_value = 113; + } + } + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case BARD: + case BARDGM: + case RANGER: + case RANGERGM: { + // 113 + r_value = ((level * 5) + 5); + if ( r_value > 113 ) { + r_value = 113; + } + break; + } + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: { + // 75 + r_value = ((level * 3) + 3); + if ( r_value > 75 ) { + r_value = 75; + } + break; + } + // No skill classes + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: + default: + r_value = 0; + break; + } + break; + } ///////////////////////////////////////////////// - case ARCHERY:{ - switch (class_) { - // Melee - case ROGUE: case ROGUEGM: - case WARRIOR: case WARRIORGM:{ - // 200 240 - r_value = ((level*5) + 5); - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 240) - r_value = 240; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 75 75 - r_value = ((level*5) + 5); - if ( r_value > 75 ) - r_value = 75; - break; - } - case RANGER: case RANGERGM:{ - // 240 240 - r_value = ((level*5) + 5); - if ( r_value > 240 ) - r_value = 240; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: - default: - r_value = 0; - break; - } - break; - } + case ARCHERY: { + switch (class_) { + // Melee + case ROGUE: + case ROGUEGM: + case WARRIOR: + case WARRIORGM: { + // 200 240 + r_value = ((level * 5) + 5); + if ( level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 240) { + r_value = 240; + } + break; + } + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 75 75 + r_value = ((level * 5) + 5); + if ( r_value > 75 ) { + r_value = 75; + } + break; + } + case RANGER: + case RANGERGM: { + // 240 240 + r_value = ((level * 5) + 5); + if ( r_value > 240 ) { + r_value = 240; + } + break; + } + // Pure + // No skill classes + // Melee + case MONK: + case MONKGM: + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case BARD: + case BARDGM: + default: + r_value = 0; + break; + } + break; + } ///////////////////////////////////////////////// - case DOUBLE_ATTACK:{ - switch (class_) { - // Melee - case ROGUE: case ROGUEGM:{ - // 16 200 240 - r_value = ((level*5) + 5); - if ( level < 16 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 240) - r_value = 240; - break; - } - case BERSERKER: case BERSERKERGM: - case WARRIOR: case WARRIORGM:{ - // 15 205 245 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - case MONK: case MONKGM:{ - // 15 210 250 - r_value = ((level*5) + 5); - if ( level < 15 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 250) - r_value = 250; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 20 200 235 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 235) - r_value = 235; - break; - } - case RANGER: case RANGERGM:{ - // 20 200 245 - r_value = ((level*5) + 5); - if ( level < 20 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 245) - r_value = 245; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: - default: - r_value = 0; - break; - } - break; - } + case DOUBLE_ATTACK: { + switch (class_) { + // Melee + case ROGUE: + case ROGUEGM: { + // 16 200 240 + r_value = ((level * 5) + 5); + if ( level < 16 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 240) { + r_value = 240; + } + break; + } + case BERSERKER: + case BERSERKERGM: + case WARRIOR: + case WARRIORGM: { + // 15 205 245 + r_value = ((level * 5) + 5); + if ( level < 15 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 245) { + r_value = 245; + } + break; + } + case MONK: + case MONKGM: { + // 15 210 250 + r_value = ((level * 5) + 5); + if ( level < 15 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 250) { + r_value = 250; + } + break; + } + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 20 200 235 + r_value = ((level * 5) + 5); + if ( level < 20 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 235) { + r_value = 235; + } + break; + } + case RANGER: + case RANGERGM: { + // 20 200 245 + r_value = ((level * 5) + 5); + if ( level < 20 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 245) { + r_value = 245; + } + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case BARD: + case BARDGM: + default: + r_value = 0; + break; + } + break; + } ///////////////////////////////////////////////// case DUAL_WIELD: { - switch (class_) { - // Melee - case MONK: case MONKGM:{ - // 1 252 252 - r_value = level*7; // This can't be right can it? - break -; - } - case WARRIOR: case WARRIORGM: - case ROGUE: case ROGUEGM: { - // 15 210 245 - r_value = ((level*5) + 5); - if ( level < 13 ) + switch (class_) { + // Melee + case MONK: + case MONKGM: { + // 1 252 252 + r_value = level * 7; // This can't be right can it? + break + ; + } + case WARRIOR: + case WARRIORGM: + case ROGUE: + case ROGUEGM: { + // 15 210 245 + r_value = ((level * 5) + 5); + if ( level < 13 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 245) { + r_value = 245; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + // 17 210 245 + case RANGER: + case RANGERGM: { + // 17 210 245 + r_value = ((level * 5) + 5); + if ( level < 17 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 245) { + r_value = 245; + } + break; + } + case BARD: + case BARDGM: { + // 17 210 210 + r_value = ((level * 5) + 5); + if ( level < 17 ) { + r_value = 0; + } + if (r_value > 210) { + r_value = 210; + } + break; + } + // No skill classes + // Melee + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: + default: { + r_value = 0; + break; + } + }// end Class switch + break; + } // end case DUAL_WIELD: +//////////////////////////////////////////////////////// + case KICK: { + switch (class_) { + // Melee + case BERSERKER: + case BERSERKERGM: + case WARRIOR: + case WARRIORGM: { + // 1 149 210 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 149) { + r_value = 149; + } + } + if (r_value > 210) { + r_value = 210; + } + break; + } + case MONK: + case MONKGM: { + // 1 200 250 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 250) { + r_value = 250; + } + break; + } + // Hybrid + case RANGER: + case RANGERGM: { + // 5 149 205 + r_value = ((level * 5) + 5); + if ( level < 5 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 149) { + r_value = 149; + } + } + if (r_value > 205) { + r_value = 205; + } + break; + } + case BEASTLORD: + case BEASTLORDGM: { + // 5 180 230 + r_value = ((level * 5) + 5); + if ( level < 5 ) { + r_value = 0; + } + if ( level < 51 ) { + if (r_value > 180) { + r_value = 180; + } + } + if (r_value > 230) { + r_value = 230; + } + break; + } + // Pure + // No skill classes + case ROGUE: + case ROGUEGM: + // Melee + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: + case BARD: + case BARDGM: + default: r_value = 0; - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 245) - r_value = 245; - break; + break; } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - // 17 210 245 - case RANGER: case RANGERGM:{ - // 17 210 245 - r_value = ((level*5) + 5); - if ( level < 17 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 245) - r_value = 245; - break; + break; + } +//////////////////////////////////////////////////////// + case BASH: { + r_value = ((level * 5) + 5); + switch (class_) { + // Melee + case WARRIOR: + case WARRIORGM: { + // 6 220 240 + if (level < 6) { + r_value = 0; + } + if (level < 51 && r_value > 220) { + r_value = 220; + } + if (r_value > 240) { + r_value = 240; + } + break; + } + // Priest + case CLERIC: + case CLERICGM: { + // 25 180 200 + if (level < 25) { + r_value = 0; + } + if (level < 51 && r_value > 180) { + r_value = 180; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 6 175 200 + if (level < 6) { + r_value = 0; + } + if (level < 51 && r_value > 175) { + r_value = 175; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + // Pure + // No skill classes + // Melee + case MONK: + case MONKGM: + case ROGUE: + case ROGUEGM: + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case RANGER: + case RANGERGM: + case BARD: + case BARDGM: { + // switch (race) { + // case BARBARIAN: + // case TROLL: + //case OGRE:{ + // r_value = 50; + //break; + //} + //default: break; + //} + r_value = 0; + break; + } } - case BARD: case BARDGM:{ - // 17 210 210 - r_value = ((level*5) + 5); - if ( level < 17 ) - r_value = 0; - if (r_value > 210) - r_value = 210; - break; - } - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - default: { - r_value = 0; - break; - } - }// end Class switch + break; + } +//////////////////////////////////////////////////////// + default: + #if EQDEBUG >= 1 + std::cout << "Unknown Offensive skill: " << skillid << std::endl; + #endif break; - } // end case DUAL_WIELD: -//////////////////////////////////////////////////////// - case KICK:{ - switch (class_) { - // Melee - case BERSERKER: case BERSERKERGM: - case WARRIOR: case WARRIORGM:{ - // 1 149 210 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 149) - r_value = 149; - } - if (r_value > 210) - r_value = 210; - break; - } - case MONK: case MONKGM:{ - // 1 200 250 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 250) - r_value = 250; - break; - } - // Hybrid - case RANGER: case RANGERGM:{ - // 5 149 205 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 149) - r_value = 149; - } - if (r_value > 205) - r_value = 205; - break; - } - case BEASTLORD: case BEASTLORDGM:{ - // 5 180 230 - r_value = ((level*5) + 5); - if ( level < 5 ) - r_value = 0; - if ( level < 51 ) { - if (r_value > 180) - r_value = 180; - } - if (r_value > 230) - r_value = 230; - break; - } - // Pure - // No skill classes - case ROGUE: case ROGUEGM: - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM: - default: - r_value = 0; - break; - } - break; - } -//////////////////////////////////////////////////////// - case BASH:{ - r_value = ((level*5)+5); - switch (class_) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 6 220 240 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 220) - r_value = 220; - if (r_value > 240) - r_value = 240; - break; - } - // Priest - case CLERIC: case CLERICGM:{ - // 25 180 200 - - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 180) - r_value = 180; - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 6 175 200 - if (level < 6) - r_value = 0; - if (level < 51 && r_value > 175) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - case ROGUE: case ROGUEGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case RANGER: case RANGERGM: - case BARD: case BARDGM:{ - // switch (race) { - // case BARBARIAN: - // case TROLL: - //case OGRE:{ - // r_value = 50; - - //break; - //} - //default: break; - //} - r_value = 0; - break; - } - } - break; - } -//////////////////////////////////////////////////////// - default: -#if EQDEBUG >= 1 - std::cout<<"Unknown Offensive skill: "< 252) - r_value = 252; - return r_value; -} - -uint16 Mob::MaxSkill_defensive(uint16 skillid, uint16 class_, uint16 level) const{ - uint16 r_value = 0; - switch(skillid) { - case DEFENSE:{ - switch (class_) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case ROGUE: case ROGUEGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case MONK: case MONKGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - case BERSERKER: case BERSERKERGM:{ - // 230 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 230) - r_value = 230; - } - if (r_value > 252) - r_value = 252; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 200 200 4*level+4 - r_value = ((level*4) + 4); - if (r_value > 200) - r_value = 200; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 210 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 210) - r_value = 210; - } - if (r_value > 252) - r_value = 252; - break; - } - case BARD: case BARDGM:{ - // 200 252 5*level+5 - r_value = ((level*5) + 5); - if ( level < 51 ) { - if (r_value > 200) - r_value = 200; - } - if (r_value > 252) - r_value = 252; - break; - } - case RANGER: case RANGERGM:{ - // 200 200 5*level+5 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 145 145 level*4 - r_value = (level*4); - if (r_value > 140) - r_value = 140; - break; - - } - default: break; - } - break; - } - case PARRY:{ - switch (class_) { - // Melee - case ROGUE: case ROGUEGM:{ - // 12 200 230 - r_value = ((level*5) + 5); - if ( level < 12 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case WARRIOR: case WARRIORGM:{ - // 10 200 230 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case BERSERKER: case BERSERKERGM:{ - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 175) - r_value = 175; - break; - } - - // Hybrid - case BARD: case BARDGM:{ - // 53 0 75 - r_value = ((level*5) + 5); - if ( level < 53 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 17 175 205 - r_value = ((level*5) + 5); - if ( level < 17 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 205) - r_value = 205; - break; - } - case RANGER: case RANGERGM:{ - // 18 185 220 - r_value = ((level*5) + 5); - if ( level < 18 ) - r_value = 0; - if (r_value > 185 && level < 51 ) - r_value = 185; - if (r_value > 220) - r_value = 220; - break; - } - // Pure - // No skill classes - // Melee - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - default: - r_value = 0; - break; - } - break; - } - case RIPOSTE:{ - switch (class_) { - // Melee - case BERSERKER: case BERSERKERGM: - case WARRIOR: case WARRIORGM:{ - // 25 200 225 - r_value = ((level*5) + 5); - if ( level < 25 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case ROGUE: case ROGUEGM:{ - // 30 200 225 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case MONK: case MONKGM:{ - // 35 200 225 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 200 && level < 51 ) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM:{ - // 40 150 185 - r_value = ((level*5) + 5); - if ( level < 40 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 185) - r_value = 185; - break; - } - case BARD: case BARDGM:{ - // 58 75 75 - r_value = ((level*5) + 5); - if ( level < 58 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 30 175 200 - r_value = ((level*5) + 5); - if ( level < 30 ) - r_value = 0; - if (r_value > 175 && level < 51 ) - r_value = 175; - if (r_value > 200) - r_value = 200; - break; - } - case RANGER: case RANGERGM:{ - // 35 150 150 - r_value = ((level*5) + 5); - if ( level < 35 ) - r_value = 0; - if (r_value > 150) - r_value = 150; - break; - } - // Pure - // No skill classes - // Melee - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - default: - r_value = 0; - break; - - } - break; - } - case DODGE:{ - switch (class_) { - // Melee - case BERSERKER: case BERSERKERGM: - case WARRIOR: case WARRIORGM:{ - // 6 140 175 - r_value = ((level*5) + 5); - if ( level < 6 ) - r_value = 0; - if (r_value > 140 && level < 51 ) - r_value = 140; - if (r_value > 175) - r_value = 175; - break; - } - case ROGUE: case ROGUEGM:{ - // 4 150 210 - r_value = ((level*5) + 5); - if ( level < 4 ) - r_value = 0; - if (r_value > 150 && level < 51 ) - r_value = 150; - if (r_value > 210) - r_value = 210; - break; - } - case MONK: case MONKGM:{ - // 1 200 230 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM:{ - // 15 75 75 4*level+4 - r_value = ((level*4) + 4); - if ( level < 15 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM: - case BARD: case BARDGM:{ - // 10 125 155 5*level+5 - r_value = ((level*5) + 5); - if ( level < 10 ) - r_value = 0; - if (r_value > 125 && level < 51 ) - r_value = 125; - if (r_value > 155) - r_value = 155; - break; - } - case RANGER: case RANGERGM:{ - // 8 137 170 5*level+5 - r_value = ((level*5) + 5); - if ( level < 8 ) - r_value = 0; - if (r_value > 137 && level < 51 ) - r_value = 137; - if (r_value > 170) - r_value = 170; - break; - } - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM:{ - // 22 75 75 3*level+3 - r_value = ((level*3) + 3); - if ( level < 22 ) - r_value = 0; - if (r_value > 75) - r_value = 75; - break; - } - // No skill classes - // Melee - // Priest - // Pure - // Hybrid - default: break; - } - break; - } - // Other - case TAUNT:{ - switch (class_) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 1 200 200 - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 1 180 180 - r_value = ((level*5) + 5); - if (r_value > 180) - r_value = 180; - - break; - } - case RANGER: case RANGERGM:{ - // 1 150 150 - r_value = ((level*5) + 5); - if (r_value > 150) - r_value = 150; - break; - - } - // Pure - - // No skill classes - // Melee - case ROGUE: case ROGUEGM: - case MONK: case MONKGM: - // Priest - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BEASTLORD: case BEASTLORDGM: - case BARD: case BARDGM: - default: break; - } - break; - } - case DISARM:{ - switch (class_) { - // Melee - case WARRIOR: case WARRIORGM:{ - // 35 200 200 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case ROGUE: case ROGUEGM: - case MONK: case MONKGM:{ - // 27 200 200 - r_value = ((level*5) + 5); - if (level < 27) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case BERSERKER: case BERSERKERGM:{ - // 35 65 65 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 65) - r_value = 65; - break; - } - // Priest - // Hybrid - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 40 70 70 - r_value = ((level*5) + 5); - if (level < 40) - r_value = 0; - if (r_value > 70) - r_value = 70; - break; - } - case RANGER: case RANGERGM:{ - // 35 55 55 - r_value = ((level*5) + 5); - if (level < 35) - r_value = 0; - if (r_value > 55) - r_value = 55; - break; - } - // Pure - - // No skill classes - // Melee - // Priest - - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - case CLERIC: case CLERICGM: - // Pure - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM: - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - // Hybrid - case BARD: case BARDGM: - case BEASTLORD: case BEASTLORDGM: - default: break; - } - break; - } -//////////////////////////////////////////////////////// - - default: -#if EQDEBUG - std::cout<<"Unknown Defensive skill: "< 252) - r_value = 252; - return r_value; -} - -uint16 Mob::MaxSkill_arcane(uint16 skillid, uint16 class_, uint16 level) const{ - uint16 r_value = 0; - switch(skillid) { - case MEDITATE: - case ABJURE: - case ALTERATION: - case CHANNELING: - case CONJURATION: - case DIVINATION: - case EVOCATION:{ - r_value = ((level*5) + 5); - switch(class_){ - // Hybrid - case RANGER: case RANGERGM:{ - // 9 235 235 - // Channel 9 200 215 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 215) - r_value = 215; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - r_value = 235; - } - break; - } - case BEASTLORD: case BEASTLORDGM: - case PALADIN: case PALADINGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ - // 9 235 235 - // Channel 9 200 220 - // Med 12 185 235 - if (level < 9) - r_value = 0; - if (level < 12 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 185) - r_value = 185; - if (r_value > 235) - - r_value = 235; - } - break; - } - // Priest - case CLERIC: case CLERICGM: - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM:{ - // 1 235 235 - // Channel 4 200 220 - // Med 8 235 252 - - if (level < 4 && skillid == CHANNELING) - r_value = 0; - if (level < 8 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; - } - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // 1 235 235 - // Channel 1 200 220 - // Med 4 235 252 - if (level < 4 && skillid == MEDITATE) - r_value = 0; - if (r_value > 0 && skillid == CHANNELING) { - if ( level < 51 && r_value > 200) - r_value = 200; - if (r_value > 220) - r_value = 220; - } - if (r_value > 0 && skillid == MEDITATE) { - if ( level < 51 && r_value > 235) - r_value = 235; - if (r_value > 252) - r_value = 252; - } - break; - } - case BARD: case BARDGM:{ - r_value = 0; - if (level > 9 && skillid == MEDITATE) - r_value = 1; - break; - } - default: - // Unknown class - r_value = 0; - break; - }// Class Switch - break; - } - - case SPECIALIZE_ABJURE: - case SPECIALIZE_ALTERATION: - case SPECIALIZE_CONJURATION: - case SPECIALIZE_DIVINATION: - case SPECIALIZE_EVOCATION: - { - r_value = ((level*5) + 5); - switch(class_){ - // Non-int casters - case CLERIC: case CLERICGM: - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM: - if(level < 30) { - r_value = 0; - break; - } - - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - if (level < 20) { - r_value = 0; - break; - } - - //make sure only 1 skill can be over 50 - uint16 hskill = 0; - uint16 high = 0; - uint16 cur; - cur = GetSkill(SPECIALIZE_ABJURE); - if(cur > high) { - hskill = SPECIALIZE_ABJURE; - high = cur; - } - cur = GetSkill(SPECIALIZE_ALTERATION); - if(cur > high) { - hskill = SPECIALIZE_ALTERATION; - high = cur; - } - cur = GetSkill(SPECIALIZE_CONJURATION); - if(cur > high) { - hskill = SPECIALIZE_CONJURATION; - high = cur; - } - cur = GetSkill(SPECIALIZE_DIVINATION); - if(cur > high) { - hskill = SPECIALIZE_DIVINATION; - high = cur; - } - cur = GetSkill(SPECIALIZE_EVOCATION); - if(cur > high) { - hskill = SPECIALIZE_EVOCATION; - high = cur; - } - if(high > 50 && hskill != skillid) { - r_value = 50; - break; - } - - if (r_value > 200) - r_value = 200; - break; - } - default:{ - r_value = 0; - break; - } - }// Class Switch - break; - } - case RESEARCH:{ - r_value = ((level*5) + 5); - switch(class_){ - // Int caster - case ENCHANTER: case ENCHANTERGM: - case MAGICIAN: case MAGICIANGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - // Res 16 200 200 - if (level < 16) - r_value = 0; - if (r_value > 200) - r_value = 200; - // FIXME Only let one SPEC go above what ever limit theres supposed to be - break; - } - default:{ - r_value = 0; - break; - } - }// Class Switch - break; - } - - case BRASS_INSTRUMENTS: - case SINGING: - case STRINGED_INSTRUMENTS: - case WIND_INSTRUMENTS: - case PERCUSSION_INSTRUMENTS:{ - switch(class_){ - case BARD: case BARDGM:{ - r_value = ((level*5) + 5); - if (level < 5 && skillid == PERCUSSION_INSTRUMENTS){ - r_value = 0; - } - if (level < 8 && skillid == STRINGED_INSTRUMENTS){ - r_value = 0; - } - if (level < 11 && skillid == BRASS_INSTRUMENTS){ - r_value = 0; - } - if (level < 14 && skillid == WIND_INSTRUMENTS){ - r_value = 0; - } - if (r_value > 235) - r_value = 235; - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } -//////////////////////////////////////////////////////// - default: -#if EQDEBUG - std::cout<<"Unknown arcane skill: "< 252) - r_value = 252; - return r_value; -} - -uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const{ - uint16 r_value = 0; - switch(skillid) { - // Rogue - case APPLY_POISON: - case MAKE_POISON: - case PICK_POCKETS: - case BACKSTAB:{ - switch (class_) { - // Melee - case ROGUE: case ROGUEGM: { - r_value = ((level*5) + 5); - switch (skillid){ - case APPLY_POISON:{ - // 18 200 200 - if (level < 18) - r_value = 0; - if (r_value > 200) - r_value = 200; - break; - } - case MAKE_POISON:{ - // 20 200 250 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 250) - r_value = 250; - break; - } - case PICK_POCKETS:{ - // 7 200 210 - if (level < 7) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 210) - r_value = 210; - break; - } - case BACKSTAB:{ - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - default: - r_value = 0; - break; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - // Monk - case BLOCKSKILL: { - switch(class_){ - case BEASTLORD: case BEASTLORDGM:{ - r_value = (((level-25)*5) + 5); - // 12 200 230 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - case MONK: case MONKGM:{ - r_value = ((level*5) + 5); - // 12 200 230 - if (level < 12) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 230) - r_value = 230; - break; - } - } - break; - } - case FEIGN_DEATH: - case MEND: - case DRAGON_PUNCH: - case EAGLE_STRIKE: - case FLYING_KICK: - case ROUND_KICK: - case TIGER_CLAW:{ - switch(class_){ - case MONK: case MONKGM:{ - r_value = ((level*5) + 5); - switch (skillid){ - case MEND:{ - // 1 200 200 - if (r_value > 200) - r_value = 200; - break; - } - case ROUND_KICK:{ - // 5 200 225 - if (level < 5) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case TIGER_CLAW:{ - - // 10 200 225 - if (level < 10) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case FEIGN_DEATH:{ - // 17 200 200 - if (level < 17) - r_value = 0; - if (r_value > 200) - - r_value = 200; - break; - } - case EAGLE_STRIKE:{ - // 20 200 225 - if (level < 20) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case DRAGON_PUNCH:{ - // 25 200 225 - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - case FLYING_KICK:{ - // 30 200 225 - if (level < 30) - r_value = 0; - if (level < 51 && r_value > 200) - r_value = 200; - if (r_value > 225) - r_value = 225; - break; - } - default: - r_value = 0; - break; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - - //Berzerkers - case BERSERKING: { - switch(class_){ - case BERSERKER: case BERSERKERGM: { - r_value = ((level*5) + 5); - if(r_value > 200) - r_value = 200; - } - default: - r_value = 0; - break; - } - break; + }// Switch skill + if (r_value > 252) { + r_value = 252; } + return r_value; +} - // Shaman - case ALCHEMY:{ - switch(class_){ - case SHAMAN: case SHAMANGM:{ - // 25 130 180 - r_value = ((level*5) + 5); - if (level < 25) - r_value = 0; - if (level < 51 && r_value > 130) - r_value = 130; - if (r_value > 180) - r_value = 180; - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } +uint16 Mob::MaxSkill_defensive(uint16 skillid, uint16 class_, uint16 level) const +{ + uint16 r_value = 0; + switch (skillid) { + case DEFENSE: { + switch (class_) { + // Melee + case WARRIOR: + case WARRIORGM: { + // 210 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case ROGUE: + case ROGUEGM: { + // 200 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case MONK: + case MONKGM: { + // 230 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 230) { + r_value = 230; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case BERSERKER: + case BERSERKERGM: { + // 230 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 230) { + r_value = 230; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: { + // 200 200 4*level+4 + r_value = ((level * 4) + 4); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: { + // 210 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 210 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 210) { + r_value = 210; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case BARD: + case BARDGM: { + // 200 252 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 51 ) { + if (r_value > 200) { + r_value = 200; + } + } + if (r_value > 252) { + r_value = 252; + } + break; + } + case RANGER: + case RANGERGM: { + // 200 200 5*level+5 + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: { + // 145 145 level*4 + r_value = (level * 4); + if (r_value > 140) { + r_value = 140; + } + break; + } + default: + break; + } + break; + } + case PARRY: { + switch (class_) { + // Melee + case ROGUE: + case ROGUEGM: { + // 12 200 230 + r_value = ((level * 5) + 5); + if ( level < 12 ) { + r_value = 0; + } + if (r_value > 200 && level < 51 ) { + r_value = 200; + } + if (r_value > 230) { + r_value = 230; + } + break; + } + case WARRIOR: + case WARRIORGM: { + // 10 200 230 + r_value = ((level * 5) + 5); + if ( level < 10 ) { + r_value = 0; + } + if (r_value > 200 && level < 51 ) { + r_value = 200; + } + if (r_value > 230) { + r_value = 230; + } + break; + } + case BERSERKER: + case BERSERKERGM: { + r_value = ((level * 5) + 5); + if ( level < 10 ) { + r_value = 0; + } + if (r_value > 175) { + r_value = 175; + } + break; + } + // Hybrid + case BARD: + case BARDGM: { + // 53 0 75 + r_value = ((level * 5) + 5); + if ( level < 53 ) { + r_value = 0; + } + if (r_value > 75) { + r_value = 75; + } + break; + } + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 17 175 205 + r_value = ((level * 5) + 5); + if ( level < 17 ) { + r_value = 0; + } + if (r_value > 175 && level < 51 ) { + r_value = 175; + } + if (r_value > 205) { + r_value = 205; + } + break; + } + case RANGER: + case RANGERGM: { + // 18 185 220 + r_value = ((level * 5) + 5); + if ( level < 18 ) { + r_value = 0; + } + if (r_value > 185 && level < 51 ) { + r_value = 185; + } + if (r_value > 220) { + r_value = 220; + } + break; + } + // Pure + // No skill classes + // Melee + case MONK: + case MONKGM: + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + default: + r_value = 0; + break; + } + break; + } + case RIPOSTE: { + switch (class_) { + // Melee + case BERSERKER: + case BERSERKERGM: + case WARRIOR: + case WARRIORGM: { + // 25 200 225 + r_value = ((level * 5) + 5); + if ( level < 25 ) { + r_value = 0; + } + if (r_value > 200 && level < 51 ) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case ROGUE: + case ROGUEGM: { + // 30 200 225 + r_value = ((level * 5) + 5); + if ( level < 30 ) { + r_value = 0; + } + if (r_value > 200 && level < 51 ) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case MONK: + case MONKGM: { + // 35 200 225 + r_value = ((level * 5) + 5); + if ( level < 35 ) { + r_value = 0; + } + if (r_value > 200 && level < 51 ) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: { + // 40 150 185 + r_value = ((level * 5) + 5); + if ( level < 40 ) { + r_value = 0; + } + if (r_value > 150 && level < 51 ) { + r_value = 150; + } + if (r_value > 185) { + r_value = 185; + } + break; + } + case BARD: + case BARDGM: { + // 58 75 75 + r_value = ((level * 5) + 5); + if ( level < 58 ) { + r_value = 0; + } + if (r_value > 75) { + r_value = 75; + } + break; + } + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 30 175 200 + r_value = ((level * 5) + 5); + if ( level < 30 ) { + r_value = 0; + } + if (r_value > 175 && level < 51 ) { + r_value = 175; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + case RANGER: + case RANGERGM: { + // 35 150 150 + r_value = ((level * 5) + 5); + if ( level < 35 ) { + r_value = 0; + } + if (r_value > 150) { + r_value = 150; + } + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + default: + r_value = 0; + break; + } + break; + } + case DODGE: { + switch (class_) { + // Melee + case BERSERKER: + case BERSERKERGM: + case WARRIOR: + case WARRIORGM: { + // 6 140 175 + r_value = ((level * 5) + 5); + if ( level < 6 ) { + r_value = 0; + } + if (r_value > 140 && level < 51 ) { + r_value = 140; + } + if (r_value > 175) { + r_value = 175; + } + break; + } + case ROGUE: + case ROGUEGM: { + // 4 150 210 + r_value = ((level * 5) + 5); + if ( level < 4 ) { + r_value = 0; + } + if (r_value > 150 && level < 51 ) { + r_value = 150; + } + if (r_value > 210) { + r_value = 210; + } + break; + } + case MONK: + case MONKGM: { + // 1 200 230 + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + if (r_value > 230) { + r_value = 230; + } + break; + } + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: { + // 15 75 75 4*level+4 + r_value = ((level * 4) + 4); + if ( level < 15 ) { + r_value = 0; + } + if (r_value > 75) { + r_value = 75; + } + break; + } + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: + case BARD: + case BARDGM: { + // 10 125 155 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 10 ) { + r_value = 0; + } + if (r_value > 125 && level < 51 ) { + r_value = 125; + } + if (r_value > 155) { + r_value = 155; + } + break; + } + case RANGER: + case RANGERGM: { + // 8 137 170 5*level+5 + r_value = ((level * 5) + 5); + if ( level < 8 ) { + r_value = 0; + } + if (r_value > 137 && level < 51 ) { + r_value = 137; + } + if (r_value > 170) { + r_value = 170; + } + break; + } + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: { + // 22 75 75 3*level+3 + r_value = ((level * 3) + 3); + if ( level < 22 ) { + r_value = 0; + } + if (r_value > 75) { + r_value = 75; + } + break; + } + // No skill classes + // Melee + // Priest + // Pure + // Hybrid + default: + break; + } + break; + } + // Other + case TAUNT: { + switch (class_) { + // Melee + case WARRIOR: + case WARRIORGM: { + // 1 200 200 + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Priest + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 1 180 180 + r_value = ((level * 5) + 5); + if (r_value > 180) { + r_value = 180; + } + break; + } + case RANGER: + case RANGERGM: { + // 1 150 150 + r_value = ((level * 5) + 5); + if (r_value > 150) { + r_value = 150; + } + break; + } + // Pure + // No skill classes + // Melee + case ROGUE: + case ROGUEGM: + case MONK: + case MONKGM: + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BEASTLORD: + case BEASTLORDGM: + case BARD: + case BARDGM: + default: + break; + } + break; + } + case DISARM: { + switch (class_) { + // Melee + case WARRIOR: + case WARRIORGM: { + // 35 200 200 + r_value = ((level * 5) + 5); + if (level < 35) { + r_value = 0; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + case ROGUE: + case ROGUEGM: + case MONK: + case MONKGM: { + // 27 200 200 + r_value = ((level * 5) + 5); + if (level < 27) { + r_value = 0; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + case BERSERKER: + case BERSERKERGM: { + // 35 65 65 + r_value = ((level * 5) + 5); + if (level < 35) { + r_value = 0; + } + if (r_value > 65) { + r_value = 65; + } + break; + } + // Priest + // Hybrid + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 40 70 70 + r_value = ((level * 5) + 5); + if (level < 40) { + r_value = 0; + } + if (r_value > 70) { + r_value = 70; + } + break; + } + case RANGER: + case RANGERGM: { + // 35 55 55 + r_value = ((level * 5) + 5); + if (level < 35) { + r_value = 0; + } + if (r_value > 55) { + r_value = 55; + } + break; + } + // Pure + // No skill classes + // Melee + // Priest + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + case CLERIC: + case CLERICGM: + // Pure + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + // Hybrid + case BARD: + case BARDGM: + case BEASTLORD: + case BEASTLORDGM: + default: + break; + } + break; + } +//////////////////////////////////////////////////////// + default: + #if EQDEBUG + std::cout << "Unknown Defensive skill: " << skillid << std::endl; + #endif + break; + }// Switch skill + if (r_value > 252) { + r_value = 252; + } + return r_value; +} + +uint16 Mob::MaxSkill_arcane(uint16 skillid, uint16 class_, uint16 level) const +{ + uint16 r_value = 0; + switch (skillid) { + case MEDITATE: + case ABJURE: + case ALTERATION: + case CHANNELING: + case CONJURATION: + case DIVINATION: + case EVOCATION: { + r_value = ((level * 5) + 5); + switch (class_) { + // Hybrid + case RANGER: + case RANGERGM: { + // 9 235 235 + // Channel 9 200 215 + // Med 12 185 235 + if (level < 9) { + r_value = 0; + } + if (level < 12 && skillid == MEDITATE) { + r_value = 0; + } + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 215) { + r_value = 215; + } + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) { + r_value = 185; + } + if (r_value > 235) { + r_value = 235; + } + } + break; + } + case BEASTLORD: + case BEASTLORDGM: + case PALADIN: + case PALADINGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + // 9 235 235 + // Channel 9 200 220 + // Med 12 185 235 + if (level < 9) { + r_value = 0; + } + if (level < 12 && skillid == MEDITATE) { + r_value = 0; + } + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 185) { + r_value = 185; + } + if (r_value > 220) { + r_value = 220; + } + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 185) { + r_value = 185; + } + if (r_value > 235) { + r_value = 235; + } + } + break; + } + // Priest + case CLERIC: + case CLERICGM: + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: { + // 1 235 235 + // Channel 4 200 220 + // Med 8 235 252 + if (level < 4 && skillid == CHANNELING) { + r_value = 0; + } + if (level < 8 && skillid == MEDITATE) { + r_value = 0; + } + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 220) { + r_value = 220; + } + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) { + r_value = 235; + } + if (r_value > 252) { + r_value = 252; + } + } + break; + } + // Int caster + case ENCHANTER: + case ENCHANTERGM: + case MAGICIAN: + case MAGICIANGM: + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: { + // 1 235 235 + // Channel 1 200 220 + // Med 4 235 252 + if (level < 4 && skillid == MEDITATE) { + r_value = 0; + } + if (r_value > 0 && skillid == CHANNELING) { + if ( level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 220) { + r_value = 220; + } + } + if (r_value > 0 && skillid == MEDITATE) { + if ( level < 51 && r_value > 235) { + r_value = 235; + } + if (r_value > 252) { + r_value = 252; + } + } + break; + } + case BARD: + case BARDGM: { + r_value = 0; + if (level > 9 && skillid == MEDITATE) { + r_value = 1; + } + break; + } + default: + // Unknown class + r_value = 0; + break; + }// Class Switch + break; + } + case SPECIALIZE_ABJURE: + case SPECIALIZE_ALTERATION: + case SPECIALIZE_CONJURATION: + case SPECIALIZE_DIVINATION: + case SPECIALIZE_EVOCATION: { + r_value = ((level * 5) + 5); + switch (class_) { + // Non-int casters + case CLERIC: + case CLERICGM: + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: + if (level < 30) { + r_value = 0; + break; + } + // Int caster + case ENCHANTER: + case ENCHANTERGM: + case MAGICIAN: + case MAGICIANGM: + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: { + if (level < 20) { + r_value = 0; + break; + } + //make sure only 1 skill can be over 50 + uint16 hskill = 0; + uint16 high = 0; + uint16 cur; + cur = GetSkill(SPECIALIZE_ABJURE); + if (cur > high) { + hskill = SPECIALIZE_ABJURE; + high = cur; + } + cur = GetSkill(SPECIALIZE_ALTERATION); + if (cur > high) { + hskill = SPECIALIZE_ALTERATION; + high = cur; + } + cur = GetSkill(SPECIALIZE_CONJURATION); + if (cur > high) { + hskill = SPECIALIZE_CONJURATION; + high = cur; + } + cur = GetSkill(SPECIALIZE_DIVINATION); + if (cur > high) { + hskill = SPECIALIZE_DIVINATION; + high = cur; + } + cur = GetSkill(SPECIALIZE_EVOCATION); + if (cur > high) { + hskill = SPECIALIZE_EVOCATION; + high = cur; + } + if (high > 50 && hskill != skillid) { + r_value = 50; + break; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch + break; + } + case RESEARCH: { + r_value = ((level * 5) + 5); + switch (class_) { + // Int caster + case ENCHANTER: + case ENCHANTERGM: + case MAGICIAN: + case MAGICIANGM: + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: { + // Res 16 200 200 + if (level < 16) { + r_value = 0; + } + if (r_value > 200) { + r_value = 200; + } + // FIXME Only let one SPEC go above what ever limit theres supposed to be + break; + } + default: { + r_value = 0; + break; + } + }// Class Switch + break; + } + case BRASS_INSTRUMENTS: + case SINGING: + case STRINGED_INSTRUMENTS: + case WIND_INSTRUMENTS: + case PERCUSSION_INSTRUMENTS: { + switch (class_) { + case BARD: + case BARDGM: { + r_value = ((level * 5) + 5); + if (level < 5 && skillid == PERCUSSION_INSTRUMENTS) { + r_value = 0; + } + if (level < 8 && skillid == STRINGED_INSTRUMENTS) { + r_value = 0; + } + if (level < 11 && skillid == BRASS_INSTRUMENTS) { + r_value = 0; + } + if (level < 14 && skillid == WIND_INSTRUMENTS) { + r_value = 0; + } + if (r_value > 235) { + r_value = 235; + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } +//////////////////////////////////////////////////////// + default: + #if EQDEBUG + std::cout << "Unknown arcane skill: " << skillid << std::endl; + #endif + break; + }// Switch skill + if (r_value > 252) { + r_value = 252; + } + return r_value; +} + +uint16 Mob::MaxSkill_class(uint16 skillid, uint16 class_, uint16 level) const +{ + uint16 r_value = 0; + switch (skillid) { + // Rogue + case APPLY_POISON: + case MAKE_POISON: + case PICK_POCKETS: + case BACKSTAB: { + switch (class_) { + // Melee + case ROGUE: + case ROGUEGM: { + r_value = ((level * 5) + 5); + switch (skillid) { + case APPLY_POISON: { + // 18 200 200 + if (level < 18) { + r_value = 0; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + case MAKE_POISON: { + // 20 200 250 + if (level < 20) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 250) { + r_value = 250; + } + break; + } + case PICK_POCKETS: { + // 7 200 210 + if (level < 7) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 210) { + r_value = 210; + } + break; + } + case BACKSTAB: { + // 10 200 225 + if (level < 10) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + default: + r_value = 0; + break; + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + // Monk + case BLOCKSKILL: { + switch (class_) { + case BEASTLORD: + case BEASTLORDGM: { + r_value = (((level - 25) * 5) + 5); + // 12 200 230 + if (level < 25) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 230) { + r_value = 230; + } + break; + } + case MONK: + case MONKGM: { + r_value = ((level * 5) + 5); + // 12 200 230 + if (level < 12) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 230) { + r_value = 230; + } + break; + } + } + break; + } + case FEIGN_DEATH: + case MEND: + case DRAGON_PUNCH: + case EAGLE_STRIKE: + case FLYING_KICK: + case ROUND_KICK: + case TIGER_CLAW: { + switch (class_) { + case MONK: + case MONKGM: { + r_value = ((level * 5) + 5); + switch (skillid) { + case MEND: { + // 1 200 200 + if (r_value > 200) { + r_value = 200; + } + break; + } + case ROUND_KICK: { + // 5 200 225 + if (level < 5) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case TIGER_CLAW: { + // 10 200 225 + if (level < 10) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case FEIGN_DEATH: { + // 17 200 200 + if (level < 17) { + r_value = 0; + } + if (r_value > 200) { + r_value = 200; + } + break; + } + case EAGLE_STRIKE: { + // 20 200 225 + if (level < 20) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case DRAGON_PUNCH: { + // 25 200 225 + if (level < 25) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + case FLYING_KICK: { + // 30 200 225 + if (level < 30) { + r_value = 0; + } + if (level < 51 && r_value > 200) { + r_value = 200; + } + if (r_value > 225) { + r_value = 225; + } + break; + } + default: + r_value = 0; + break; + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + //Berzerkers + case BERSERKING: { + switch (class_) { + case BERSERKER: + case BERSERKERGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + default: + r_value = 0; + break; + } + break; + } + // Shaman + case ALCHEMY: { + switch (class_) { + case SHAMAN: + case SHAMANGM: { + // 25 130 180 + r_value = ((level * 5) + 5); + if (level < 25) { + r_value = 0; + } + if (level < 51 && r_value > 130) { + r_value = 130; + } + if (r_value > 180) { + r_value = 180; + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } /////////////////////////////////////////// ////////////////////////////////////////// // Shared skill - // Shared Rogue - case HIDE:{ - switch(class_){ - // True class - case ROGUE: case ROGUEGM:{ - r_value = ((level*5) + 5); - if(r_value > 200) - r_value = 200; - break; - } - // Hybrids - case RANGER: case RANGERGM: - case SHADOWKNIGHT: case SHADOWKNIGHTGM:{ //75 cap - if(level >= 35) { - r_value = (((level-35)*5) + 5); - if(r_value > 75) - r_value = 75; - } - break; - } - case BARD: case BARDGM:{ //40 cap - if(level > 25) { - r_value = (((level-25)*5) + 5); - if(r_value > 40) - r_value = 40; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - - case SNEAK:{ - switch(class_){ - // True class - case ROGUE: case ROGUEGM:{ - r_value = ((level*5) + 5); - if(r_value > 200) - r_value = 200; - break; - } - // Hybrids - case MONK: case MONKGM:{ //113 cap - if(level >= 8) { - r_value = (((level-8)*5) + 5); - if(r_value > 113) - r_value = 113; - } - break; - } - case RANGER: case RANGERGM:{ //75 cap - if(level >= 10) { - r_value = (((level-10)*5) + 5); - if(r_value > 75) - r_value = 75; - } - break; - } - case BARD: case BARDGM:{ //75 cap - if(level >= 17) { - r_value = (((level-17)*5) + 5); - if(r_value > 75) - r_value = 75; - } - break; - } - case BEASTLORD: case BEASTLORDGM:{ //50 cap - if(level >= 50) { - r_value = (((level-50)*5) + 5); - if(r_value > 50) - r_value = 50; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - - case SENSE_TRAPS: - case PICK_LOCK: - case DISARM_TRAPS:{ - switch(class_){ - // True class - case ROGUE: case ROGUEGM:{ - r_value = ((level*5) + 5); - if(r_value > 200) - r_value = 200; - break; - } - // Hybrids - case BARD: case BARDGM:{ //100 cap - if(level >= 30) { //this is wrong I think... - r_value = (((level-30)*5) + 5); - if(r_value > 100) - r_value = 100; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - case SAFE_FALL:{ - switch(class_){ - // Hybrids - case BARD: case BARDGM:{ //40 cap - if(level >= 24) { - r_value = (((level-24)*5) + 5); - if(r_value > 40) - r_value = 40; - } - break; - } - // Melee - case MONK: case MONKGM:{ - if(level >= 3) { - r_value = (((level-3)*5) + 5); - if(r_value > 200) - r_value = 200; - } - break; - } - case ROGUE: case ROGUEGM:{ //100 cap - if(level >= 12) { - r_value = (((level-12)*5) + 5); - if(r_value > 100) - r_value = 100; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - case INTIMIDATION:{ - switch(class_){ - case BARD: case BARDGM:{ //100 cap - if(level >= 26) { - r_value = (((level-26)*5) + 5); - if(r_value > 100) - r_value = 100; - } - break; - } - // Melee - case MONK: case MONKGM:{ - if(level >= 18) { - r_value = (((level-18)*5) + 5); - if(r_value > 200) - r_value = 200; - } - break; - } - case BERSERKER: case BERSERKERGM:{ - if(level >= 20) { - r_value = (((level-20)*5) + 5); - if(r_value > 200) - r_value = 200; - } - break; - } - case ROGUE: case ROGUEGM:{ - if(level >= 22) { - r_value = (((level-22)*5) + 5); - if(r_value > 200) - r_value = 200; - } - break; - } - default: - r_value = 0; - break; - }// Class Switch - break; - } - // Druid/Ranger/Bard - case FORAGE:{ - switch(class_) { - case RANGER: case RANGERGM:{ - if(level > 3) { - r_value = (((level-3)*5) + 5); - if (r_value > 200) - r_value = 200; - } - break; - } - case DRUID: case DRUIDGM:{ - r_value = ((level*5) + 5); - if (r_value > 200) - r_value = 200; - break; - } - case MONK: case MONKGM: - case BARD: case BARDGM: - r_value = 55; - break; - default: - r_value = 50; - break; - }// Class Switch - break; - } - case TRACKING:{ - switch(class_){ - case RANGER: case RANGERGM: - case BARD: case BARDGM: - case DRUID: case DRUIDGM: - r_value=200; - break; - default: - r_value = 0; - break; - }// Class Switch - break; - } + // Shared Rogue + case HIDE: { + switch (class_) { + // True class + case ROGUE: + case ROGUEGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrids + case RANGER: + case RANGERGM: + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { //75 cap + if (level >= 35) { + r_value = (((level - 35) * 5) + 5); + if (r_value > 75) { + r_value = 75; + } + } + break; + } + case BARD: + case BARDGM: { //40 cap + if (level > 25) { + r_value = (((level - 25) * 5) + 5); + if (r_value > 40) { + r_value = 40; + } + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + case SNEAK: { + switch (class_) { + // True class + case ROGUE: + case ROGUEGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrids + case MONK: + case MONKGM: { //113 cap + if (level >= 8) { + r_value = (((level - 8) * 5) + 5); + if (r_value > 113) { + r_value = 113; + } + } + break; + } + case RANGER: + case RANGERGM: { //75 cap + if (level >= 10) { + r_value = (((level - 10) * 5) + 5); + if (r_value > 75) { + r_value = 75; + } + } + break; + } + case BARD: + case BARDGM: { //75 cap + if (level >= 17) { + r_value = (((level - 17) * 5) + 5); + if (r_value > 75) { + r_value = 75; + } + } + break; + } + case BEASTLORD: + case BEASTLORDGM: { //50 cap + if (level >= 50) { + r_value = (((level - 50) * 5) + 5); + if (r_value > 50) { + r_value = 50; + } + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + case SENSE_TRAPS: + case PICK_LOCK: + case DISARM_TRAPS: { + switch (class_) { + // True class + case ROGUE: + case ROGUEGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + // Hybrids + case BARD: + case BARDGM: { //100 cap + if (level >= 30) { //this is wrong I think... + r_value = (((level - 30) * 5) + 5); + if (r_value > 100) { + r_value = 100; + } + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + case SAFE_FALL: { + switch (class_) { + // Hybrids + case BARD: + case BARDGM: { //40 cap + if (level >= 24) { + r_value = (((level - 24) * 5) + 5); + if (r_value > 40) { + r_value = 40; + } + } + break; + } + // Melee + case MONK: + case MONKGM: { + if (level >= 3) { + r_value = (((level - 3) * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case ROGUE: + case ROGUEGM: { //100 cap + if (level >= 12) { + r_value = (((level - 12) * 5) + 5); + if (r_value > 100) { + r_value = 100; + } + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + case INTIMIDATION: { + switch (class_) { + case BARD: + case BARDGM: { //100 cap + if (level >= 26) { + r_value = (((level - 26) * 5) + 5); + if (r_value > 100) { + r_value = 100; + } + } + break; + } + // Melee + case MONK: + case MONKGM: { + if (level >= 18) { + r_value = (((level - 18) * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case BERSERKER: + case BERSERKERGM: { + if (level >= 20) { + r_value = (((level - 20) * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case ROGUE: + case ROGUEGM: { + if (level >= 22) { + r_value = (((level - 22) * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + break; + } + default: + r_value = 0; + break; + }// Class Switch + break; + } + // Druid/Ranger/Bard + case FORAGE: { + switch (class_) { + case RANGER: + case RANGERGM: { + if (level > 3) { + r_value = (((level - 3) * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case DRUID: + case DRUIDGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + case MONK: + case MONKGM: + case BARD: + case BARDGM: + r_value = 55; + break; + default: + r_value = 50; + break; + }// Class Switch + break; + } + case TRACKING: { + switch (class_) { + case RANGER: + case RANGERGM: + case BARD: + case BARDGM: + case DRUID: + case DRUIDGM: + r_value = 200; + break; + default: + r_value = 0; + break; + }// Class Switch + break; + } //////////////////////////////////////////////////////// - default: -#if EQDEBUG - std::cout<<"Unknown class skill: "< 252) - r_value = 252; - return r_value; + default: + #if EQDEBUG + std::cout << "Unknown class skill: " << skillid << std::endl; + #endif + break; + }// Switch skill + if (r_value > 252) { + r_value = 252; + } + return r_value; } -uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const { - uint16 r_value = 0; - switch (skillid) { - case _1H_BLUNT: - case _2H_BLUNT: - case PIERCING: - case HAND_TO_HAND: - case _1H_SLASHING: - case _2H_SLASHING:{ - r_value = MaxSkill_weapon(skillid, class_, level); - break; - } - case OFFENSE: - case THROWING: - case ARCHERY: - case DOUBLE_ATTACK: - case DUAL_WIELD: - case KICK: - case BASH:{ - r_value = MaxSkill_offensive(skillid, class_, level); - break; - } - case DEFENSE: - case PARRY: - case RIPOSTE: - case DODGE: - case TAUNT: - case DISARM:{ - r_value = MaxSkill_defensive(skillid,class_,level); - break; - } - case MEDITATE: - case ABJURE: - case ALTERATION: - case CHANNELING: - case CONJURATION: - case DIVINATION: - case EVOCATION: - case SPECIALIZE_ABJURE: - case SPECIALIZE_ALTERATION: - case SPECIALIZE_CONJURATION: - case SPECIALIZE_DIVINATION: - case SPECIALIZE_EVOCATION: - case RESEARCH: - case BRASS_INSTRUMENTS: - case SINGING: - case STRINGED_INSTRUMENTS: - case WIND_INSTRUMENTS: - case PERCUSSION_INSTRUMENTS:{ - r_value = MaxSkill_arcane(skillid,class_,level); - break; - } +uint16 Mob::MaxSkill(uint16 skillid, uint16 class_, uint16 level) const +{ + uint16 r_value = 0; + switch (skillid) { + case _1H_BLUNT: + case _2H_BLUNT: + case PIERCING: + case HAND_TO_HAND: + case _1H_SLASHING: + case _2H_SLASHING: { + r_value = MaxSkill_weapon(skillid, class_, level); + break; + } + case OFFENSE: + case THROWING: + case ARCHERY: + case DOUBLE_ATTACK: + case DUAL_WIELD: + case KICK: + case BASH: { + r_value = MaxSkill_offensive(skillid, class_, level); + break; + } + case DEFENSE: + case PARRY: + case RIPOSTE: + case DODGE: + case TAUNT: + case DISARM: { + r_value = MaxSkill_defensive(skillid, class_, level); + break; + } + case MEDITATE: + case ABJURE: + case ALTERATION: + case CHANNELING: + case CONJURATION: + case DIVINATION: + case EVOCATION: + case SPECIALIZE_ABJURE: + case SPECIALIZE_ALTERATION: + case SPECIALIZE_CONJURATION: + case SPECIALIZE_DIVINATION: + case SPECIALIZE_EVOCATION: + case RESEARCH: + case BRASS_INSTRUMENTS: + case SINGING: + case STRINGED_INSTRUMENTS: + case WIND_INSTRUMENTS: + case PERCUSSION_INSTRUMENTS: { + r_value = MaxSkill_arcane(skillid, class_, level); + break; + } /////////////////////////////////////////// /////////////////////////////////////////// // Class skills - // Rogue - case APPLY_POISON: - case MAKE_POISON: - case PICK_POCKETS: - case BACKSTAB: - // Monk - case FEIGN_DEATH: - case MEND: - case DRAGON_PUNCH: - case EAGLE_STRIKE: - case FLYING_KICK: - case ROUND_KICK: - case TIGER_CLAW: - case BLOCKSKILL: - case ALCHEMY: - case HIDE: - case SNEAK: - case SENSE_TRAPS: - case PICK_LOCK: - case DISARM_TRAPS: - case SAFE_FALL: - case INTIMIDATION: - // Druid/Ranger/Bard - case FORAGE: - case TRACKING:{ - r_value = MaxSkill_class(skillid,class_,level); - break; - } + // Rogue + case APPLY_POISON: + case MAKE_POISON: + case PICK_POCKETS: + case BACKSTAB: + // Monk + case FEIGN_DEATH: + case MEND: + case DRAGON_PUNCH: + case EAGLE_STRIKE: + case FLYING_KICK: + case ROUND_KICK: + case TIGER_CLAW: + case BLOCKSKILL: + case ALCHEMY: + case HIDE: + case SNEAK: + case SENSE_TRAPS: + case PICK_LOCK: + case DISARM_TRAPS: + case SAFE_FALL: + case INTIMIDATION: + // Druid/Ranger/Bard + case FORAGE: + case TRACKING: { + r_value = MaxSkill_class(skillid, class_, level); + break; + } /////////////////////////////////////////// /////////////////////////////////////////// // Tradeskills - case BAKING: - case TAILORING: - case BLACKSMITHING: - case FLETCHING: - case BREWING: - case JEWELRY_MAKING: - case POTTERY: - case FISHING:{ - // Check for Any Trade above 200, check for X (aa skill) Trades above 200 - r_value = 250; - break; - } + case BAKING: + case TAILORING: + case BLACKSMITHING: + case FLETCHING: + case BREWING: + case JEWELRY_MAKING: + case POTTERY: + case FISHING: { + // Check for Any Trade above 200, check for X (aa skill) Trades above 200 + r_value = 250; + break; + } ///////////////////////////////////// ///////////////////////////////////// - // Gnome - case TINKERING:{ - if ( race == GNOME && level > 24 ) { - r_value = ((level*5)+5); - break; - } - r_value = 0; - break; - } - + // Gnome + case TINKERING: { + if ( race == GNOME && level > 24 ) { + r_value = ((level * 5) + 5); + break; + } + r_value = 0; + break; + } ///////////////////////////////////////// // Common ///////////////////////////////////////// - case BIND_WOUND:{ - switch(class_){ - case BARD: case BARDGM:{ - r_value = ((level*5)+5); - if(level >= 50) { - if(r_value > 210) - r_value = 210; - } else { - if(r_value > 200) - r_value = 200; - } - break; - } - case CLERIC: case CLERICGM:{ - r_value = ((level*5)+5); - if(level >= 50) { - if(r_value > 201) - r_value = 201; - } else { - if(r_value > 200) - r_value = 200; - } - break; - } - - case DRUID: case DRUIDGM: - case SHAMAN: case SHAMANGM:{ - r_value = ((level*5) + 5); - if(r_value > 200) - r_value = 200; - break; - } - case MAGICIAN: case MAGICIANGM: - case ENCHANTER: case ENCHANTERGM: - case NECROMANCER: case NECROMANCERGM: - case WIZARD: case WIZARDGM:{ - r_value = ((level*5) + 5); - if(r_value > 100) - r_value = 100; - break; - } - case BEASTLORD: case BEASTLORDGM: - case BERSERKER: case BERSERKERGM: - case MONK: case MONKGM: { - r_value = ((level*5)+5); - if(level >= 50) { - if(r_value > 210) - r_value = 210; - } else { - if(r_value > 200) - r_value = 200; - } - break; - } - case PALADIN: case PALADINGM: { - if (level > 10) { - r_value = (((level-10)*5)+5); - if(level >= 50) { - if(r_value > 210) - r_value = 210; - } else { - if(r_value > 200) + case BIND_WOUND: { + switch (class_) { + case BARD: + case BARDGM: { + r_value = ((level * 5) + 5); + if (level >= 50) { + if (r_value > 210) { + r_value = 210; + } + } else { + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case CLERIC: + case CLERICGM: { + r_value = ((level * 5) + 5); + if (level >= 50) { + if (r_value > 201) { + r_value = 201; + } + } else { + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case DRUID: + case DRUIDGM: + case SHAMAN: + case SHAMANGM: { + r_value = ((level * 5) + 5); + if (r_value > 200) { + r_value = 200; + } + break; + } + case MAGICIAN: + case MAGICIANGM: + case ENCHANTER: + case ENCHANTERGM: + case NECROMANCER: + case NECROMANCERGM: + case WIZARD: + case WIZARDGM: { + r_value = ((level * 5) + 5); + if (r_value > 100) { + r_value = 100; + } + break; + } + case BEASTLORD: + case BEASTLORDGM: + case BERSERKER: + case BERSERKERGM: + case MONK: + case MONKGM: { + r_value = ((level * 5) + 5); + if (level >= 50) { + if (r_value > 210) { + r_value = 210; + } + } else { + if (r_value > 200) { + r_value = 200; + } + } + break; + } + case PALADIN: + case PALADINGM: { + if (level > 10) { + r_value = (((level - 10) * 5) + 5); + if (level >= 50) { + if (r_value > 210) { + r_value = 210; + } + } else { + if (r_value > 200) { + r_value = 200; + } + } + } + break; + } + case RANGER: + case RANGERGM: { + if (level > 15) { + r_value = (((level - 15) * 5) + 5); + if (level >= 50) { + if (r_value > 200) { + r_value = 200; + } + } else { + if (r_value > 150) { + r_value = 150; + } + } + } + break; + } + case ROGUE: + case ROGUEGM: { + r_value = ((level * 5) + 5); + if (level >= 50) { + if (r_value > 210) { + r_value = 210; + } + } else { + if (r_value > 176) { + r_value = 176; + } + } + break; + } + case SHADOWKNIGHT: + case SHADOWKNIGHTGM: { + r_value = ((level * 5) + 5); + if (level >= 50) { + if (r_value > 200) { + r_value = 200; + } + } else { + if (r_value > 150) { + r_value = 150; + } + } + break; + } + case WARRIOR: + case WARRIORGM: { + if (level > 5) { + r_value = (((level - 5) * 5) + 5); + if (level >= 50) { + if (r_value > 210) { + r_value = 210; + } + } else { + if (r_value > 175) { + r_value = 175; + } + } + } + break; + } + default: + r_value = 0; + break; + } + break; + } + case SENSE_HEADING: + case SWIMMING: + case ALCOHOL_TOLERANCE: + case BEGGING: { + r_value = 5 + (level * 5); + if (r_value > 200) { r_value = 200; + } + break; } - } - break; - } - case RANGER: case RANGERGM: { - if (level > 15) { - r_value = (((level-15)*5)+5); - if(level >= 50) { - if(r_value > 200) - r_value = 200; - } else { - if(r_value > 150) - r_value = 150; + //case BERSERKING: + default: { + // Unknown skill we should like print something to a log/debug here + r_value = 0; + break; } - } - break; - } - - case ROGUE: case ROGUEGM: { - r_value = ((level*5)+5); - if(level >= 50) { - if(r_value > 210) - r_value = 210; - } else { - if(r_value > 176) - r_value = 176; - } - break; - } - case SHADOWKNIGHT: case SHADOWKNIGHTGM: { - r_value = ((level*5)+5); - if(level >= 50) { - if(r_value > 200) - r_value = 200; - } else { - if(r_value > 150) - r_value = 150; - } - break; - } - case WARRIOR: case WARRIORGM: { - if (level > 5) { - r_value = (((level-5)*5)+5); - if(level >= 50) { - if(r_value > 210) - r_value = 210; - } else { - if(r_value > 175) - r_value = 175; - } - } - break; - } - - default: r_value = 0; - break; - } - break; } - case SENSE_HEADING: - case SWIMMING: - case ALCOHOL_TOLERANCE: - case BEGGING:{ - r_value = 5 + (level*5); - if (r_value > 200) - r_value = 200; - break; - } - //case BERSERKING: - default: { - - // Unknown skill we should like print something to a log/debug here - r_value = 0; - break; - } - - } - if (r_value >= 253) - r_value = 252; - return r_value; + if (r_value >= 253) { + r_value = 252; + } + return r_value; } From c23a5008e28e0d3672826fdb55204050183676f2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:04:52 -0600 Subject: [PATCH 0917/1883] Add 'Aggro' Category --- common/eqemu_logsys.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index afcf04aab..6dec2b6ff 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -72,6 +72,7 @@ public: Tribute, TCP_Connection, Client_Server_Packet, + Aggro, MaxCategoryID /* Don't Remove this*/ }; @@ -134,6 +135,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Tribute", "TCP_Connection", "Client_Server_Packet", + "Aggro", }; #endif \ No newline at end of file From f760597684e2781cfb6092613938d55c75f756a0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:06:22 -0600 Subject: [PATCH 0918/1883] Removed preprocessor EQDEBUG in CheckWillAggro and converted log message --- zone/aggro.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 0fe174a65..437713062 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,11 +342,8 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - - // Aggro - #if EQDEBUG>=6 - logger.LogDebug(EQEmuLogSys::General, "Check aggro for %s target %s.", GetName(), mob->GetName()); - #endif + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + return( mod_will_aggro(mob, this) ); } } From 4851fe1791bdbfee442b6781830d63b3a3a71a02 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:07:19 -0600 Subject: [PATCH 0919/1883] Converted more Aggro Debugs --- zone/aggro.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 437713062..295d5c495 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,19 +342,18 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); - + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } -#if EQDEBUG >= 6 - printf("Is In zone?:%d\n", mob->InZone()); - printf("Dist^2: %f\n", dist2); - printf("Range^2: %f\n", iAggroRange2); - printf("Faction: %d\n", fv); - printf("Int: %d\n", GetINT()); - printf("Con: %d\n", GetLevelCon(mob->GetLevel())); -#endif + + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + return(false); } From edd871353d9242a9cbd51ed68ad3b3076dde54fc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:08:04 -0600 Subject: [PATCH 0920/1883] Removed attack.cpp #EQDEBUG --- zone/attack.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 70ac972eb..73262fc72 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -16,10 +16,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if EQDEBUG >= 5 -//#define ATTACK_DEBUG 20 -#endif - #include "../common/debug.h" #include "../common/eq_constants.h" #include "../common/eq_packet_structs.h" From 1e741c1b9291d778d98ba1ff342b6c3fbad4b58b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:09:13 -0600 Subject: [PATCH 0921/1883] Add 'Attack' Category --- common/eqemu_logsys.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 6dec2b6ff..4be510767 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -73,6 +73,7 @@ public: TCP_Connection, Client_Server_Packet, Aggro, + Attack, MaxCategoryID /* Don't Remove this*/ }; @@ -136,6 +137,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "TCP_Connection", "Client_Server_Packet", "Aggro", + "Attack", }; #endif \ No newline at end of file From 488e94df56fa7997239032eaeda3722f49845d44 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:10:10 -0600 Subject: [PATCH 0922/1883] Removed #EQDEBUG Mob::AttackAnimation --- zone/attack.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 73262fc72..ecb6b1746 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -56,9 +56,9 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w int type = 0; if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); -#if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General, "Weapon skill:%i", item->ItemType); -#endif + + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + switch (item->ItemType) { case ItemType1HSlash: // 1H Slashing From f957d27fa5d088890aea936dcc5dd5f918604bff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:11:28 -0600 Subject: [PATCH 0923/1883] Removed #EQDEBUG Mob::CheckHitChance and converted debug --- zone/attack.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index ecb6b1746..1101375ea 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -329,9 +329,9 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //I dont know the best way to handle a garunteed hit discipline being used //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - #if EQDEBUG>=11 - logger.LogDebug(EQEmuLogSys::General, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); - #endif + + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + // // Did we hit? From c10f5b2cbc5807e303973ea22b5864f1ee871993 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:12:19 -0600 Subject: [PATCH 0924/1883] Removed #ATTACK_DEBUG Mob::CheckHitChance and converted debug --- zone/attack.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 1101375ea..eacee46fe 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -187,9 +187,8 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); -#if ATTACK_DEBUG>=11 - logger.LogDebug(EQEmuLogSys::General, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); -#endif + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + mlog(COMBAT__TOHIT,"CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; From 2828d513084835c6a44895cd3f7945c9dcb4baa3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:16:07 -0600 Subject: [PATCH 0925/1883] Converted mlogs in Mob::CheckHitChance to new logs --- zone/attack.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index eacee46fe..e7f4f08f8 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -189,8 +189,6 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); - mlog(COMBAT__TOHIT,"CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); - bool pvpmode = false; if(IsClient() && other->IsClient()) pvpmode = true; @@ -210,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - mlog(COMBAT__TOHIT, "Chance to hit before level diff calc %.2f", chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -238,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - mlog(COMBAT__TOHIT, "Chance to hit after level diff calc %.2f", chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - mlog(COMBAT__TOHIT, "Chance to hit after agil calc %.2f", chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - mlog(COMBAT__TOHIT, "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - mlog(COMBAT__TOHIT, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - mlog(COMBAT__TOHIT, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - mlog(COMBAT__TOHIT, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -310,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - mlog(COMBAT__TOHIT, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -338,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - mlog(COMBAT__TOHIT, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } From 59f90aede9987381d4b1337db467b594580f9e1f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:18:30 -0600 Subject: [PATCH 0926/1883] Another convert --- zone/attack.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index e7f4f08f8..35b410412 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2028,9 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); -#if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount()); -#endif + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); From 00bab967173ac5554f8ae9940305b0607c6c475a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:25:04 -0600 Subject: [PATCH 0927/1883] Convert Bot::CalcBotFocusEffect Debug to new --- zone/bonuses.cpp | 6 +----- zone/bot.cpp | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 48102b120..a1db65930 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -538,11 +538,7 @@ void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAu } void Client::CalcEdibleBonuses(StatBonuses* newbon) { -//#if EQDEBUG >= 11 -// std::cout<<"Client::CalcEdibleBonuses(StatBonuses* newbon)"<= 6 //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); -#endif + logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. From 168e6ec80d303887437d8f8f765aa2edc7e8287a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:26:19 -0600 Subject: [PATCH 0928/1883] Convert Client::SendAllPackets to new debug log --- zone/client.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index b05ae924c..ed832a208 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -650,9 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); -#if EQDEBUG >= 6 - logger.Log(EQEmuLogSys::Normal, "Transmitting a packet"); -#endif + logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); } return true; } From 7c8e5645f0ce9a92ffabeb26552ec9b6807b2863 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:43:24 -0600 Subject: [PATCH 0929/1883] Remove command_log --- zone/command.cpp | 54 ------------------------------------------------ zone/command.h | 1 - 2 files changed, 55 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index f79e7e385..abd2dda9d 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -164,7 +164,6 @@ int command_init(void) { command_add("getvariable","[varname] - Get the value of a variable from the database",200,command_getvariable) || command_add("chat","[channel num] [message] - Send a channel message to all zones",200,command_chat) || command_add("npcloot","[show/money/add/remove] [itemid/all/money: pp gp sp cp] - Manipulate the loot an NPC is carrying",80,command_npcloot) || - command_add("log","- Search character event log",80,command_log) || command_add("gm","- Turn player target's or your GM flag on or off",80,command_gm) || command_add("summon","[charname] - Summons your player/npc/corpse target, or charname if specified",80,command_summon) || command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) || @@ -969,59 +968,6 @@ void command_npcloot(Client *c, const Seperator *sep) c->Message(0, "Usage: #npcloot [show/money/add/remove] [itemid/all/money: pp gp sp cp]"); } -void command_log(Client *c, const Seperator *sep) -{ - if(strlen(sep->arg[4]) == 0 || strlen(sep->arg[1]) == 0 || strlen(sep->arg[2]) == 0 || (strlen(sep->arg[3]) == 0 && atoi(sep->arg[3]) == 0)) - { - c->Message(0,"#log
"); - c->Message(0,"(Req.) Types: 1) Command, 2) Merchant Buying, 3) Merchant Selling, 4) Loot, 5) Money Loot 6) Trade"); - c->Message(0,"(Req.) byaccountid/bycharname: choose either byaccountid or bycharname and then set querytype to effect it"); - c->Message(0,"(Req.) Details are information about the event, for example, partially an items name, or item id."); - c->Message(0,"Timestamp allows you to set a date to when the event occured: YYYYMMDDHHMMSS (Year,Month,Day,Hour,Minute,Second). It can be a partial timestamp."); - c->Message(0,"Note: when specifying a target, spaces in EQEMu use '_'"); - return; - // help - } - CharacterEventLog_Struct* cel = new CharacterEventLog_Struct; - memset(cel,0,sizeof(CharacterEventLog_Struct)); - if(strcasecmp(sep->arg[2], "byaccountid") == 0) - database.GetEventLogs("",sep->arg[5],atoi(sep->arg[3]),atoi(sep->arg[1]),sep->arg[4],sep->arg[6],cel); - else if(strcasecmp(sep->arg[2], "bycharname") == 0) - database.GetEventLogs(sep->arg[3],sep->arg[5],0,atoi(sep->arg[1]),sep->arg[4],sep->arg[6],cel); - else - { - c->Message(0,"Incorrect query type, use either byaccountid or bycharname"); - safe_delete(cel); - return; - } - if(cel->count != 0) - { - uint32 count = 0; - bool cont = true; - while(cont) - { - if(count >= cel->count) - cont = false; - else if(cel->eld[count].id != 0) - { - c->Message(0,"ID: %i AccountName: %s AccountID: %i Status: %i CharacterName: %s TargetName: %s",cel->eld[count].id,cel->eld[count].accountname,cel->eld[count].account_id,cel->eld[count].status,cel->eld[count].charactername,cel->eld[count].targetname); - - c->Message(0,"LogType: %s Timestamp: %s LogDetails: %s",cel->eld[count].descriptiontype,cel->eld[count].timestamp,cel->eld[count].details); - } - else - cont = false; - count++; - if(count > 20) - { - c->Message(0,"Please refine search."); - cont = false; - } - } - } - c->Message(0,"End of Query"); - safe_delete(cel); -} - void command_gm(Client *c, const Seperator *sep) { bool state=atobool(sep->arg[1]); diff --git a/zone/command.h b/zone/command.h index 088c83510..d487a2105 100644 --- a/zone/command.h +++ b/zone/command.h @@ -87,7 +87,6 @@ void command_chat(Client *c, const Seperator *sep); void command_showpetspell(Client *c, const Seperator *sep); void command_ipc(Client *c, const Seperator *sep); void command_npcloot(Client *c, const Seperator *sep); -void command_log(Client *c, const Seperator *sep); void command_gm(Client *c, const Seperator *sep); void command_summon(Client *c, const Seperator *sep); void command_zone(Client *c, const Seperator *sep); From 82407ba86d3a693b76ab731cd385e0ca9afa791d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:44:30 -0600 Subject: [PATCH 0930/1883] Remove command_nologs --- zone/command.cpp | 32 -------------------------------- zone/command.h | 1 - 2 files changed, 33 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index abd2dda9d..e153c20a4 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -348,7 +348,6 @@ int command_init(void) { command_add("opcode","- opcode management",250,command_opcode) || command_add("logs","[status|normal|error|debug|quest|all] - Subscribe to a log type",250,command_logs) || - command_add("nologs","[status|normal|error|debug|quest|all] - Unsubscribe to a log type",250,command_nologs) || command_add("ban","[name] [reason]- Ban by character name",150,command_ban) || command_add("suspend","[name] [days] [reason] - Suspend by character name and for specificed number of days",150,command_suspend) || command_add("ipban","[IP address] - Ban IP by character name",200,command_ipban) || @@ -6779,37 +6778,6 @@ void command_logs(Client *c, const Seperator *sep) #endif } -void command_nologs(Client *c, const Seperator *sep) -{ -#ifdef CLIENT_LOGS - Client *t = c; - if(c->GetTarget() && c->GetTarget()->IsClient()) { - t = c; - } - - if(!strcasecmp(sep->arg[1], "status" ) ) - client_logs.unsubscribe(EQEmuLog::Status, t); - else if(!strcasecmp(sep->arg[1], "normal" ) ) - client_logs.unsubscribe(EQEmuLog::Normal, t); - else if(!strcasecmp(sep->arg[1], "error" ) ) - client_logs.unsubscribe(EQEmuLog::Error, t); - else if(!strcasecmp(sep->arg[1], "debug" ) ) - client_logs.unsubscribe(EQEmuLog::Debug, t); - else if(!strcasecmp(sep->arg[1], "quest" ) ) - client_logs.unsubscribe(EQEmuLog::Quest, t); - else if(!strcasecmp(sep->arg[1], "all" ) ) - client_logs.unsubscribeAll(t); - else { - c->Message(0, "Usage: #logs [status|normal|error|debug|quest|all]"); - return; - } - - c->Message(0, "You have been unsubscribed from %s logs.", sep->arg[1]); -#else - c->Message(0, "Client logs are disabled in this server's build."); -#endif -} - void command_qglobal(Client *c, const Seperator *sep) { //In-game switch for qglobal column if(sep->arg[1][0] == 0) { diff --git a/zone/command.h b/zone/command.h index d487a2105..dd7968fd0 100644 --- a/zone/command.h +++ b/zone/command.h @@ -259,7 +259,6 @@ void command_undyeme(Client *c, const Seperator *sep); void command_hp(Client *c, const Seperator *sep); void command_ginfo(Client *c, const Seperator *sep); void command_logs(Client *c, const Seperator *sep); -void command_nologs(Client *c, const Seperator *sep); void command_logsql(Client *c, const Seperator *sep); void command_qglobal(Client *c, const Seperator *sep); void command_path(Client *c, const Seperator *sep); From 7173fc5db357b8daa63c193f09150a41b9ad0130 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:45:18 -0600 Subject: [PATCH 0931/1883] Remove command_logs --- zone/command.cpp | 33 --------------------------------- zone/command.h | 1 - 2 files changed, 34 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index e153c20a4..12f79a2a6 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -347,7 +347,6 @@ int command_init(void) { #endif command_add("opcode","- opcode management",250,command_opcode) || - command_add("logs","[status|normal|error|debug|quest|all] - Subscribe to a log type",250,command_logs) || command_add("ban","[name] [reason]- Ban by character name",150,command_ban) || command_add("suspend","[name] [days] [reason] - Suspend by character name and for specificed number of days",150,command_suspend) || command_add("ipban","[IP address] - Ban IP by character name",200,command_ipban) || @@ -6746,38 +6745,6 @@ void command_logsql(Client *c, const Seperator *sep) { } } -void command_logs(Client *c, const Seperator *sep) -{ -#ifdef CLIENT_LOGS - Client *t = c; - if(c->GetTarget() && c->GetTarget()->IsClient()) { - t = c->GetTarget()->CastToClient(); - } - - if(!strcasecmp(sep->arg[1], "status" ) ) - client_logs.subscribe(EQEmuLog::Status, t); - else if(!strcasecmp(sep->arg[1], "normal" ) ) - client_logs.subscribe(EQEmuLog::Normal, t); - else if(!strcasecmp(sep->arg[1], "error" ) ) - client_logs.subscribe(EQEmuLog::Error, t); - else if(!strcasecmp(sep->arg[1], "debug" ) ) - client_logs.subscribe(EQEmuLog::Debug, t); - else if(!strcasecmp(sep->arg[1], "quest" ) ) - client_logs.subscribe(EQEmuLog::Quest, t); - else if(!strcasecmp(sep->arg[1], "all" ) ) - client_logs.subscribeAll(t); - else { - c->Message(0, "Usage: #logs [status|normal|error|debug|quest|all]"); - return; - } - if(c != t) - c->Message(0, "%s have been subscribed to %s logs.", t->GetName(), sep->arg[1]); - t->Message(0, "You have been subscribed to %s logs.", sep->arg[1]); -#else - c->Message(0, "Client logs are disabled in this server's build."); -#endif -} - void command_qglobal(Client *c, const Seperator *sep) { //In-game switch for qglobal column if(sep->arg[1][0] == 0) { diff --git a/zone/command.h b/zone/command.h index dd7968fd0..c3825a66a 100644 --- a/zone/command.h +++ b/zone/command.h @@ -258,7 +258,6 @@ void command_undye(Client *c, const Seperator *sep); void command_undyeme(Client *c, const Seperator *sep); void command_hp(Client *c, const Seperator *sep); void command_ginfo(Client *c, const Seperator *sep); -void command_logs(Client *c, const Seperator *sep); void command_logsql(Client *c, const Seperator *sep); void command_qglobal(Client *c, const Seperator *sep); void command_path(Client *c, const Seperator *sep); From d9626e392edd0f224bca0c5e79300e78497c42ba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:49:23 -0600 Subject: [PATCH 0932/1883] Rip out Client Log Callbacks from zone --- zone/net.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index 64c741ffc..11f5a6038 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -317,12 +317,6 @@ int main(int argc, char** argv) { logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); - -#ifdef CLIENT_LOGS - LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_buf); - LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_fmt); - LogFile->SetAllCallbacks(ClientLogs::EQEmuIO_pva); -#endif if (!worldserver.Connect()) { logger.Log(EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } From a1df2b8f641932813e796f723f1fb89f80e14a92 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:51:29 -0600 Subject: [PATCH 0933/1883] Rip out Client Log functions that were used in Callbacks --- zone/client_logs.cpp | 31 ------------------------------- zone/client_logs.h | 3 --- 2 files changed, 34 deletions(-) diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 15079df60..16f90c1c1 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -105,37 +105,6 @@ void ClientLogs::msg(EQEmuLog::LogIDs id, const char *buf) { } } -void ClientLogs::EQEmuIO_buf(EQEmuLog::LogIDs id, const char *buf, uint8 size, uint32 count) { - if(size != 1) - return; //cannot print multibyte data - if(buf[0] == '\n' || buf[0] == '\r') - return; //skip new lines... - if(count > MAX_CLIENT_LOG_MESSAGE_LENGTH) - count = MAX_CLIENT_LOG_MESSAGE_LENGTH; - memcpy(_buffer, buf, count); - _buffer[count] = '\0'; - client_logs.msg(id, _buffer); -} - -void ClientLogs::EQEmuIO_fmt(EQEmuLog::LogIDs id, const char *fmt, va_list ap) { - if(fmt[0] == '\n' || fmt[0] == '\r') - return; //skip new lines... - vsnprintf(_buffer, MAX_CLIENT_LOG_MESSAGE_LENGTH, fmt, ap); - _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH] = '\0'; - client_logs.msg(id, _buffer); -} - -void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap) { - if(fmt[0] == '\n' || fmt[0] == '\r') - return; //skip new lines... - char *buf = _buffer; - int plen = snprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH, "%s", prefix); - buf += plen; - vsnprintf(buf, MAX_CLIENT_LOG_MESSAGE_LENGTH-plen, fmt, ap); - _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH] = '\0'; - client_logs.msg(id, _buffer); -} - static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { 15, // "Status", - Yellow 15, // "Normal", - Yellow diff --git a/zone/client_logs.h b/zone/client_logs.h index 547c49641..86802f391 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -35,9 +35,6 @@ class Client; class ClientLogs { public: - static void EQEmuIO_buf(EQEmuLog::LogIDs id, const char *buf, uint8 size, uint32 count); - static void EQEmuIO_fmt(EQEmuLog::LogIDs id, const char *fmt, va_list ap); - static void EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char *fmt, va_list ap); void subscribe(EQEmuLog::LogIDs id, Client *c); void unsubscribe(EQEmuLog::LogIDs id, Client *c); From 78e08e532717c96dac7d224d8403e941854b66b1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 02:56:39 -0600 Subject: [PATCH 0934/1883] Move GMSayHookCallBackProcess out of client logs and into Zone Class --- zone/client_logs.cpp | 12 ------------ zone/client_logs.h | 1 - zone/net.cpp | 2 +- zone/zone.h | 12 ++++++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index 16f90c1c1..de6278dcd 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -105,19 +105,7 @@ void ClientLogs::msg(EQEmuLog::LogIDs id, const char *buf) { } } -static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { - 15, // "Status", - Yellow - 15, // "Normal", - Yellow - 3, // "Error", - Red - 14, // "Debug", - Light Green - 4, // "Quest", - 5, // "Command", - 3 // "Crash" -}; -void ClientLogs::ClientMessage(uint16 log_type, std::string& message){ - entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); -} #endif //CLIENT_LOGS diff --git a/zone/client_logs.h b/zone/client_logs.h index 86802f391..aacefdba9 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -43,7 +43,6 @@ public: void clear(); //unsubscribes everybody void msg(EQEmuLog::LogIDs id, const char *buf); - static void ClientMessage(uint16 log_type, std::string& message); protected: diff --git a/zone/net.cpp b/zone/net.cpp index 11f5a6038..d343d14b6 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -175,7 +175,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ logger.LoadLogSettingsDefaults(); - logger.OnLogHookCallBackZone(&ClientLogs::ClientMessage); + logger.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); database.LoadLogSysSettings(logger.log_settings); guild_mgr.SetDatabase(&database); diff --git a/zone/zone.h b/zone/zone.h index bbf273069..38c3d4a05 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -67,6 +67,16 @@ struct item_tick_struct { std::string qglobal; }; +static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { + 15, // "Status", - Yellow + 15, // "Normal", - Yellow + 3, // "Error", - Red + 14, // "Debug", - Light Green + 4, // "Quest", + 5, // "Command", + 3 // "Crash" +}; + class Client; class Map; class Mob; @@ -261,6 +271,8 @@ public: // random object that provides random values for the zone EQEmu::Random random; + void GMSayHookCallBackProcess(uint16 log_type, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } + //MODDING HOOKS void mod_init(); void mod_repop(); From d1d26437e50786df584e9be6d884a6bc7f5e08aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 03:00:49 -0600 Subject: [PATCH 0935/1883] Cleaning up Zone net.cpp --- zone/net.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/zone/net.cpp b/zone/net.cpp index d343d14b6..771a6ea38 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -178,8 +178,8 @@ int main(int argc, char** argv) { logger.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); database.LoadLogSysSettings(logger.log_settings); + /* Guilds */ guild_mgr.SetDatabase(&database); - GuildBanks = nullptr; logger.LogDebug(EQEmuLogSys::General, "Test, Debug Log Level 0"); @@ -220,10 +220,13 @@ int main(int argc, char** argv) { logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { logger.Log(EQEmuLogSys::Error, "Loading items FAILED!"); @@ -262,16 +265,22 @@ int main(int argc, char** argv) { logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) From 5a3b40c503ab8b644a9c665283f4b3304154c6c2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 03:02:30 -0600 Subject: [PATCH 0936/1883] Remove my test code in net.cpp --- zone/net.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index 771a6ea38..2e8d77942 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -182,12 +182,6 @@ int main(int argc, char** argv) { guild_mgr.SetDatabase(&database); GuildBanks = nullptr; - logger.LogDebug(EQEmuLogSys::General, "Test, Debug Log Level 0"); - logger.LogDebug(EQEmuLogSys::Moderate, "Test, Debug Log Level 1"); - logger.LogDebug(EQEmuLogSys::Detail, "Test, Debug Log Level 2"); - - logger.LogDebug(EQEmuLogSys::General, "This is a crazy test message, database is '%s' and port is %u", Config->DatabaseDB.c_str(), Config->DatabasePort); - #ifdef _EQDEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif From 132fbbb0c6a8606a0d1830a91f199ef931bfc7ed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 03:09:02 -0600 Subject: [PATCH 0937/1883] Rename LogDebugType to DebugCategory --- common/eq_stream.cpp | 242 +++++++++++++++++------------------ common/eq_stream_ident.cpp | 20 +-- common/eqemu_logsys.cpp | 2 +- common/eqemu_logsys.h | 2 +- common/guild_base.cpp | 130 +++++++++---------- common/patches/rof.cpp | 34 ++--- common/patches/rof2.cpp | 34 ++--- common/patches/sod.cpp | 22 ++-- common/patches/sof.cpp | 22 ++-- common/patches/titanium.cpp | 22 ++-- common/patches/underfoot.cpp | 22 ++-- common/rulesys.cpp | 28 ++-- common/shareddb.cpp | 8 +- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 4 +- common/tcp_connection.cpp | 4 +- common/worldconn.cpp | 4 +- eqlaunch/eqlaunch.cpp | 18 +-- eqlaunch/worldserver.cpp | 18 +-- eqlaunch/zone_launch.cpp | 46 +++---- queryserv/database.cpp | 56 ++++---- queryserv/lfguild.cpp | 14 +- queryserv/queryserv.cpp | 16 +-- queryserv/worldserver.cpp | 6 +- ucs/chatchannel.cpp | 32 ++--- ucs/clientlist.cpp | 78 +++++------ ucs/database.cpp | 86 ++++++------- ucs/ucs.cpp | 26 ++-- ucs/worldserver.cpp | 8 +- world/client.cpp | 48 +++---- world/cliententry.cpp | 2 +- world/clientlist.cpp | 12 +- world/console.cpp | 24 ++-- world/eqw.cpp | 2 +- world/eqw_http_handler.cpp | 14 +- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 ++-- world/launcher_list.cpp | 10 +- world/login_server.cpp | 32 ++--- world/login_server_list.cpp | 2 +- world/net.cpp | 116 ++++++++--------- world/queryserv.cpp | 12 +- world/ucs.cpp | 12 +- world/wguild_mgr.cpp | 26 ++-- world/zonelist.cpp | 8 +- world/zoneserver.cpp | 8 +- zone/aggro.cpp | 14 +- zone/attack.cpp | 26 ++-- zone/bonuses.cpp | 6 +- zone/bot.cpp | 4 +- zone/client.cpp | 16 +-- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 44 +++---- zone/client_process.cpp | 12 +- zone/command.cpp | 14 +- zone/doors.cpp | 6 +- zone/entity.cpp | 2 +- zone/groups.cpp | 4 +- zone/guild_mgr.cpp | 20 +-- zone/inventory.cpp | 24 ++-- zone/net.cpp | 72 +++++------ zone/questmgr.cpp | 2 +- zone/raids.cpp | 4 +- zone/spawn2.cpp | 130 +++++++++---------- zone/spells.cpp | 2 +- zone/tasks.cpp | 184 +++++++++++++------------- zone/tradeskills.cpp | 16 +-- zone/trading.cpp | 56 ++++---- zone/worldserver.cpp | 34 ++--- zone/zonedb.cpp | 20 +-- 70 files changed, 1039 insertions(+), 1039 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 38f2c0cdd..eb95d557f 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if (emu_op == OP_Unknown) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if(emu_op == OP_Unknown) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1111,7 +1111,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1141,33 +1141,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1178,10 +1178,10 @@ logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKET SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } @@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } @@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index 531a297ad..a550bbbd3 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -109,7 +109,7 @@ void EQStreamIdentifier::Process() { case EQStream::MatchSuccessful: { //yay, a match. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 9204f3136..106df197a 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -176,7 +176,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, co #endif } -void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) +void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; va_start(args, message); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 4be510767..2d33e2bfe 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -81,7 +81,7 @@ public: void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); - void LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...); + void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); diff --git a/common/guild_base.cpp b/common/guild_base.cpp index b8b6206e9..deb7ea1e0 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -343,12 +343,12 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (results.RowCount() == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); return index; } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 32ce8f07d..4925ba3d4 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -52,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -316,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -551,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -585,7 +585,7 @@ namespace RoF safe_delete_array(Serialized); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1386,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2556,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3321,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3654,7 +3654,7 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3902,7 +3902,7 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4498,7 +4498,7 @@ namespace RoF SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5455,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5496,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5601,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5636,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 7548dec77..b0cdc9739 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -52,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF2 - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -382,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -617,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -651,7 +651,7 @@ namespace RoF2 safe_delete_array(Serialized); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1452,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2640,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3387,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3721,7 +3721,7 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3973,7 +3973,7 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4569,7 +4569,7 @@ namespace RoF2 SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5546,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5587,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5696,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5731,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 51992cc68..230316bed 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -50,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoD - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -247,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -359,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -391,7 +391,7 @@ namespace SoD } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -967,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2108,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2363,7 +2363,7 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3091,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 913e300b5..c84518293 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -50,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoF - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -214,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -337,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -371,7 +371,7 @@ namespace SoF } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -766,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1707,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1887,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2429,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index b24021f87..e7903e304 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -48,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -74,7 +74,7 @@ namespace Titanium - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -89,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -187,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -268,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -285,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -635,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1157,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1274,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1623,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index f896a4c3f..a12fc66ed 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -50,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace Underfoot - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -307,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -494,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -526,7 +526,7 @@ namespace Underfoot safe_delete_array(Serialized); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1190,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2374,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2624,7 +2624,7 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3406,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 13c9fbf98..683697422 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -288,7 +288,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c9894abc0..5efa08efe 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } diff --git a/common/spdat.cpp b/common/spdat.cpp index 08081c8d8..c6b7b26d9 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 06ab1a5b3..97541d559 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 2cba6fd88..bc9df8389 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index c0aafd19f..72e1c768e 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -76,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 861f536fa..1ef88d381 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 9346879bc..43170a9ec 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -74,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -90,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -101,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -111,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -127,7 +127,7 @@ void WorldServer::Process() { } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 2da3a6554..532028fc6 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -72,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -84,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -102,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -164,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -187,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -197,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 13206857a..244292de4 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 27cf102de..01ab77312 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -242,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -257,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -288,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -305,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -335,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -348,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 25b033a24..696224bc0 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -65,16 +65,16 @@ int main() { */ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -83,22 +83,22 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 9a0c2d46d..d55da3be9 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -53,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -148,7 +148,7 @@ void WorldServer::Process() break; } default: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 3435eeda6..13d37f9ec 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -42,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -149,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -170,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -228,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -237,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -262,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -299,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -397,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -479,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -555,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -572,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -587,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -613,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -628,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -654,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -669,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 48e2b1a94..a95e951e6 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -236,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -305,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -400,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -430,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -481,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -560,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -586,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -606,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -646,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -667,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -703,7 +703,7 @@ void Clientlist::Process() { default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -716,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -860,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -885,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -896,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -905,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -971,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1012,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1113,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1292,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1435,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1647,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1702,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1790,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1918,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1999,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2087,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2196,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); } } } @@ -2299,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2377,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index 8caa5ef5d..f18e12fe5 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 74f7c0522..6f64463f3 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -104,22 +104,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 105dc3d4a..49f4d2b48 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -52,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -67,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -88,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -99,7 +99,7 @@ void WorldServer::Process() if(!c) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); break; } diff --git a/world/client.cpp b/world/client.cpp index a2ee6638f..4a4cbb1d0 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1519,7 +1519,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1536,7 +1536,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1553,7 +1553,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1566,37 +1566,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); return false; } @@ -1609,7 +1609,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1690,7 +1690,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1703,16 +1703,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1740,43 +1740,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 8f2301f1d..d66401810 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 1a4237186..d8c536ca4 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index a6cb6027d..f9a646d07 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eqw.cpp b/world/eqw.cpp index b85720808..677aed6f9 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index ae2f18403..06660b683 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 0a4a19ff5..09710cbff 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 4a56e4977..3baaabc92 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 1f220c8b6..01dbbd4a7 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index 1a9eabda3..e526febfc 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index 84cb4af76..e74bc6a9a 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index 64a0b973b..d3defb1a2 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); database.LoadVariables(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); database.LoadZoneNames(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); database.ClearGroup(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); if (!database.LoadItems()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 3a7147f23..66af57d53 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -23,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -57,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -69,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -79,7 +79,7 @@ bool QueryServConnection::Process() } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -97,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -114,7 +114,7 @@ bool QueryServConnection::Process() } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index d2e361964..174b71b98 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -18,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -52,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -64,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -74,7 +74,7 @@ bool UCSConnection::Process() } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -92,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index 1a148bc08..c97f29b7a 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -34,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 49d1d24eb..51962d16e 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 62c7ca37a..29abeabf9 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 295d5c495..98ca3ee84 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,17 +342,17 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); return(false); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 35b410412..d284b9184 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -57,7 +57,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); switch (item->ItemType) { @@ -187,7 +187,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; if(IsClient() && other->IsClient()) @@ -208,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -236,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -308,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -327,7 +327,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); // @@ -336,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } @@ -2028,7 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a1db65930..423f7742a 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -634,7 +634,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index b9d5ebdc9..fa4d937f2 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) @@ -7335,7 +7335,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. diff --git a/zone/client.cpp b/zone/client.cpp index ed832a208..8ea010890 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); - logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); + logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); } return true; } @@ -698,7 +698,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); @@ -1506,7 +1506,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); @@ -2235,13 +2235,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2262,10 +2262,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 0f6df5965..51b73e6a5 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 09f2b1da6..a18438f5c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3573,7 +3573,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3636,7 +3636,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); logger.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } @@ -7196,7 +7196,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) @@ -9814,7 +9814,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9846,7 +9846,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -11714,7 +11714,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -11782,7 +11782,7 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this @@ -13435,7 +13435,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13444,7 +13444,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13530,7 +13530,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); logger.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); @@ -13542,7 +13542,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); logger.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; @@ -13568,11 +13568,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13646,7 +13646,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13660,7 +13660,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } @@ -13757,7 +13757,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13776,7 +13776,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13786,7 +13786,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13805,7 +13805,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13815,7 +13815,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13823,7 +13823,7 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) @@ -13837,7 +13837,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 01c59236e..5c9444ee0 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/command.cpp b/zone/command.cpp index 12f79a2a6..35ca539e8 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4546,10 +4546,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4598,7 +4598,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4640,7 +4640,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4679,7 +4679,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4713,7 +4713,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4764,7 +4764,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) diff --git a/zone/doors.cpp b/zone/doors.cpp index 3bc0101b1..d602fafe1 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; diff --git a/zone/entity.cpp b/zone/entity.cpp index 1854f83bf..7b85b286b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/groups.cpp b/zone/groups.cpp index ab90cddec..3eccb7fa6 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 4a72a6d9c..4d58b1fb0 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -266,7 +266,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -300,7 +300,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -369,7 +369,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 898a0b833..103728e83 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s removing set", GetName(), bds->number); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,11 +2585,11 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); @@ -2640,7 +2640,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); diff --git a/zone/net.cpp b/zone/net.cpp index 2e8d77942..5cfe506cd 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -148,7 +148,7 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { logger.Log(EQEmuLogSys::Error, "Loading server configuration failed."); return 1; @@ -156,13 +156,13 @@ int main(int argc, char** argv) { const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), @@ -186,7 +186,7 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers @@ -208,99 +208,99 @@ int main(int argc, char** argv) { const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { logger.Log(EQEmuLogSys::Error, "Loading items FAILED!"); logger.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { logger.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { logger.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { logger.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { logger.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) logger.Log(EQEmuLogSys::Error, "Command loading FAILED"); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { logger.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(TaskSystem, EnableTaskSystem)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } @@ -317,7 +317,7 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { @@ -332,7 +332,7 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance logger.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; @@ -365,7 +365,7 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 50e722d8d..0494f7f67 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } diff --git a/zone/raids.cpp b/zone/raids.cpp index 7a35d91ac..9a87b539a 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 367427527..2aebb5339 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } diff --git a/zone/spells.cpp b/zone/spells.cpp index ba8431814..113c335e4 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3832,7 +3832,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 37dc89fc2..593926f38 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -115,21 +115,21 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; taskActiveTasks[task].Updated) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,7 +358,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -459,7 +459,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -639,7 +639,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,7 +1275,7 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); @@ -1284,7 +1284,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,7 +2932,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); @@ -2941,7 +2941,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); @@ -2949,7 +2949,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { if(!results.Success()) logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3093,7 +3093,7 @@ bool TaskGoalListManager::LoadLists() { } NumberOfLists = results.RowCount(); - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index ad85d23df..7ac9cbaf5 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, diff --git a/zone/trading.cpp b/zone/trading.cpp index 6fc82fd25..12fc01a64 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,7 +1534,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); @@ -1840,7 +1840,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 8abb308d7..3bce1101a 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,12 +155,12 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } case ServerOP_ZAAuthFailed: { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - logger.LogDebugType(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index da24a3665..507e1ef27 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -624,7 +624,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); @@ -637,7 +637,7 @@ void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int3 void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,7 +645,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); From f410b270adaca3c3ec2834f7e1e5c4d0c5ef923c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 03:22:23 -0600 Subject: [PATCH 0938/1883] Fix Callback in zone, some stragglers in the renaming of function --- common/eqemu_logsys.h | 1 + common/misc_functions.h | 2 +- common/patches/ss_define.h | 8 ++++---- zone/zone.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2d33e2bfe..d8ade655b 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -81,6 +81,7 @@ public: void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); + //void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); diff --git a/common/misc_functions.h b/common/misc_functions.h index 7900bc855..8a77972c2 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index fbaee3689..7b53f78bb 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/zone/zone.h b/zone/zone.h index 38c3d4a05..6c437bed2 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -271,7 +271,7 @@ public: // random object that provides random values for the zone EQEmu::Random random; - void GMSayHookCallBackProcess(uint16 log_type, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } + static void GMSayHookCallBackProcess(uint16 log_type, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } //MODDING HOOKS void mod_init(); From 4978999d78fbcd4b0c24692759f8a5331b0e8f06 Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 16 Jan 2015 17:15:33 -0500 Subject: [PATCH 0939/1883] Pre-p'd a bot iter --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index bcc9a763c..a4780ddc8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8420,7 +8420,7 @@ void Bot::ProcessBotOwnerRefDelete(Mob* botOwner) { std::list BotList = entity_list.GetBotsByBotOwnerCharacterID(botOwner->CastToClient()->CharacterID()); if(!BotList.empty()) { - for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); botListItr++) { + for(std::list::iterator botListItr = BotList.begin(); botListItr != BotList.end(); ++botListItr) { Bot* tempBot = *botListItr; if(tempBot) { From 0eb7eefcb539e75c59d8b3b5651d0cddd424596f Mon Sep 17 00:00:00 2001 From: Uleat Date: Fri, 16 Jan 2015 18:07:19 -0500 Subject: [PATCH 0940/1883] Fix for possible race/crash condition in ItemInst::ClearByFlags() --- common/item.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/item.cpp b/common/item.cpp index 044d55d3d..533a0817b 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1710,9 +1710,17 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) end = m_contents.end(); for (; cur != end;) { ItemInst* inst = cur->second; - if (inst == nullptr) + if (inst == nullptr) { + cur = m_contents.erase(cur); continue; + } + const Item_Struct* item = inst->GetItem(); + if (item == nullptr) { + cur = m_contents.erase(cur); + continue; + } + del = cur; ++cur; @@ -1723,6 +1731,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) m_contents.erase(del->first); continue; } + // no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere case byFlagNotSet: if (item->NoDrop != 0) { safe_delete(inst); @@ -1740,6 +1749,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent) m_contents.erase(del->first); continue; } + // no 'break;' deletes 'byFlagNotSet' type - can't add at the moment because it really *breaks* the process somewhere case byFlagNotSet: if (item->NoRent != 0) { safe_delete(inst); From bfd73e5b96b007991038454551738ef8db60ddb4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 20:58:13 -0600 Subject: [PATCH 0941/1883] Remove some more old log callbacks --- common/debug.cpp | 23 ----------------------- common/debug.h | 3 --- 2 files changed, 26 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 874de6aa6..2bf685cbf 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -61,12 +61,6 @@ static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", EQEmuLog::EQEmuLog() { - for (int i = 0; i < MaxLogID; i++) { - fp[i] = 0; - logCallbackFmt[i] = nullptr; - logCallbackBuf[i] = nullptr; - logCallbackPva[i] = nullptr; - } pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS; pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR; @@ -166,11 +160,6 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) logger.Log(id, vStringFormat(fmt, argptr).c_str()); - if (logCallbackFmt[id]) { - msgCallbackFmt p = logCallbackFmt[id]; - va_copy(tmpargptr, argptr); - p(id, fmt, tmpargptr ); - } return true; } @@ -208,11 +197,6 @@ bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list va_copy(tmpargptr, argptr); vfprintf( fp[id], fmt, tmpargptr ); } - if (logCallbackPva[id]) { - msgCallbackPva p = logCallbackPva[id]; - va_copy(tmpargptr, argptr); - p(id, prefix, fmt, tmpargptr ); - } if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] %s", LogNames[id], prefix); @@ -301,10 +285,6 @@ bool EQEmuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) fwrite(buf, size, count, fp[id]); fprintf(fp[id], "\n"); } - if (logCallbackBuf[id]) { - msgCallbackBuf p = logCallbackBuf[id]; - p(id, buf, size, count); - } if (pLogStatus[id] & 2) { if (pLogStatus[id] & 8) { fprintf(stderr, "[%s] ", LogNames[id]); @@ -442,7 +422,6 @@ void EQEmuLog::SetCallback(LogIDs id, msgCallbackFmt proc) if (id >= MaxLogID) { return; } - logCallbackFmt[id] = proc; } void EQEmuLog::SetCallback(LogIDs id, msgCallbackBuf proc) @@ -453,7 +432,6 @@ void EQEmuLog::SetCallback(LogIDs id, msgCallbackBuf proc) if (id >= MaxLogID) { return; } - logCallbackBuf[id] = proc; } void EQEmuLog::SetCallback(LogIDs id, msgCallbackPva proc) @@ -464,7 +442,6 @@ void EQEmuLog::SetCallback(LogIDs id, msgCallbackPva proc) if (id >= MaxLogID) { return; } - logCallbackPva[id] = proc; } void EQEmuLog::SetAllCallbacks(msgCallbackFmt proc) diff --git a/common/debug.h b/common/debug.h index da97fb0de..120b332de 100644 --- a/common/debug.h +++ b/common/debug.h @@ -123,9 +123,6 @@ private: */ uint8 pLogStatus[MaxLogID]; - msgCallbackFmt logCallbackFmt[MaxLogID]; - msgCallbackBuf logCallbackBuf[MaxLogID]; - msgCallbackPva logCallbackPva[MaxLogID]; }; extern EQEmuLog* LogFile; From ef4847555a5a64c406d5668d2c85e5f1594c5a0b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:19:19 -0600 Subject: [PATCH 0942/1883] Add 'Quests' Category --- common/debug.cpp | 2 +- common/eqemu_logsys.h | 2 ++ zone/embxs.cpp | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/debug.cpp b/common/debug.cpp index 2bf685cbf..cd02b8005 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -226,7 +226,7 @@ bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } #endif - fprintf(stdout, "[%s] %s", LogNames[id], prefix); + fprintf(stdout, "[%s] %s", LogNames[id], prefix); vfprintf(stdout, fmt, argptr); #ifdef _WINDOWS diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d8ade655b..2ce906b41 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,6 +74,7 @@ public: Client_Server_Packet, Aggro, Attack, + Quests, MaxCategoryID /* Don't Remove this*/ }; @@ -139,6 +140,7 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Client_Server_Packet", "Aggro", "Attack", + "Quests" }; #endif \ No newline at end of file diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 784f8b1ba..2666665f2 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -98,6 +98,8 @@ XS(XS_EQEmuIO_PRINT) for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); + //logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + //std::cout << str << "LOLOL\n"; len = 0; pos = i+1; } else { @@ -106,6 +108,7 @@ XS(XS_EQEmuIO_PRINT) } if(len > 0) { LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); + // logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); } } From 1fcc1f619355a6b30f37d0360c4d1404dd666539 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:19:53 -0600 Subject: [PATCH 0943/1883] Convert Perl Quest Logging to the new system --- zone/embxs.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 2666665f2..e080d6a13 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -97,9 +97,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); - //logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); - //std::cout << str << "LOLOL\n"; + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); len = 0; pos = i+1; } else { @@ -107,8 +105,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - LogFile->writebuf(EQEmuLog::Quest, str + pos, 1, len); - // logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); } } From d3de7c923780faaf7e10e6061ca5a4912d995763 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:21:53 -0600 Subject: [PATCH 0944/1883] Remove EQEmuLog writebuf --- common/debug.cpp | 77 ------------------------------------------------ common/debug.h | 2 -- 2 files changed, 79 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index cd02b8005..d31eb54dc 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -252,83 +252,6 @@ bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list return true; } -bool EQEmuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) -{ - if (!logFileValid) { - return false; - } - if (id >= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - time_t aclock; - struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - if (dofile) - #ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); - #else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec); - #endif - if (dofile) { - fwrite(buf, size, count, fp[id]); - fprintf(fp[id], "\n"); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] ", LogNames[id]); - fwrite(buf, size, count, stderr); - fprintf(stderr, "\n"); - } else { -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } -#endif - - fprintf(stdout, "[%s] ", LogNames[id]); - fwrite(buf, size, count, stdout); - fprintf(stdout, "\n"); - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); -#endif - - - } - } - if (dofile) { - fflush(fp[id]); - } - return true; -} - bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) { va_list argptr, tmpargptr; diff --git a/common/debug.h b/common/debug.h index 120b332de..8127d85cb 100644 --- a/common/debug.h +++ b/common/debug.h @@ -102,8 +102,6 @@ public: void SetCallback(LogIDs id, msgCallbackFmt proc); void SetCallback(LogIDs id, msgCallbackBuf proc); void SetCallback(LogIDs id, msgCallbackPva proc); - - bool writebuf(LogIDs id, const char *buf, uint8 size, uint32 count); bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0); From 5161cb6bd288f6ebb05ab81f6b718247e2a91cf3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:23:50 -0600 Subject: [PATCH 0945/1883] Remove more old Callback code --- common/debug.cpp | 63 ------------------------------------------------ common/debug.h | 11 --------- 2 files changed, 74 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index d31eb54dc..136c4ddf0 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -337,66 +337,3 @@ bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski return true; } -void EQEmuLog::SetCallback(LogIDs id, msgCallbackFmt proc) -{ - if (!logFileValid) { - return; - } - if (id >= MaxLogID) { - return; - } -} - -void EQEmuLog::SetCallback(LogIDs id, msgCallbackBuf proc) -{ - if (!logFileValid) { - return; - } - if (id >= MaxLogID) { - return; - } -} - -void EQEmuLog::SetCallback(LogIDs id, msgCallbackPva proc) -{ - if (!logFileValid) { - return; - } - if (id >= MaxLogID) { - return; - } -} - -void EQEmuLog::SetAllCallbacks(msgCallbackFmt proc) -{ - if (!logFileValid) { - return; - } - int r; - for (r = Status; r < MaxLogID; r++) { - SetCallback((LogIDs)r, proc); - } -} - -void EQEmuLog::SetAllCallbacks(msgCallbackBuf proc) -{ - if (!logFileValid) { - return; - } - int r; - for (r = Status; r < MaxLogID; r++) { - SetCallback((LogIDs)r, proc); - } -} - -void EQEmuLog::SetAllCallbacks(msgCallbackPva proc) -{ - if (!logFileValid) { - return; - } - int r; - for (r = Status; r < MaxLogID; r++) { - SetCallback((LogIDs)r, proc); - } -} - diff --git a/common/debug.h b/common/debug.h index 8127d85cb..85894ba59 100644 --- a/common/debug.h +++ b/common/debug.h @@ -91,17 +91,6 @@ public: MaxLogID /* Max, used in functions to get the max log ID */ }; - //these are callbacks called for each - typedef void (* msgCallbackBuf)(LogIDs id, const char *buf, uint8 size, uint32 count); - typedef void (* msgCallbackFmt)(LogIDs id, const char *fmt, va_list ap); - typedef void (* msgCallbackPva)(LogIDs id, const char *prefix, const char *fmt, va_list ap); - - void SetAllCallbacks(msgCallbackFmt proc); - void SetAllCallbacks(msgCallbackBuf proc); - void SetAllCallbacks(msgCallbackPva proc); - void SetCallback(LogIDs id, msgCallbackFmt proc); - void SetCallback(LogIDs id, msgCallbackBuf proc); - void SetCallback(LogIDs id, msgCallbackPva proc); bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0); From a4dbe13c3d6412094aa2adce5a3e20b40c61ef81 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:26:37 -0600 Subject: [PATCH 0946/1883] Remove EQEmuLog::Dump --- common/debug.cpp | 69 +----------------------------------------------- common/debug.h | 1 - 2 files changed, 1 insertion(+), 69 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 136c4ddf0..fc7a4cc16 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -269,71 +269,4 @@ bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) } va_end(argptr); return true; -}; - -bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) -{ - if (!logFileValid) { - logger.LogDebug(EQEmuLogSys::Detail, "Error: Dump() from null pointer"); - return false; - } - if (size == 0) { - return true; - } - if (!LogFile) { - return false; - } - if (id >= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - write(id, "Dumping Packet: %i", size); - // Output as HEX - int beginningOfLineOffset = 0; - uint32 indexInData; - std::string asciiOutput; - for (indexInData = skip; indexInData < size; indexInData++) { - if ((indexInData - skip) % cols == 0) { - if (indexInData != skip) { - writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); - } - writeNTS(id, dofile, "%4i: ", indexInData - skip); - asciiOutput.clear(); - beginningOfLineOffset = 0; - } else if ((indexInData - skip) % (cols / 2) == 0) { - writeNTS(id, dofile, "- "); - } - writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]); - if (data[indexInData] >= 32 && data[indexInData] < 127) { - // According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx - // Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long - // version. - asciiOutput.append(std::to_string((long long)data[indexInData])); - } else { - asciiOutput.append("."); - } - } - uint32 k = ((indexInData - skip) - 1) % cols; - if (k < 8) { - writeNTS(id, dofile, " "); - } - for (uint32 h = k + 1; h < cols; h++) { - writeNTS(id, dofile, " "); - } - writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); - if (dofile) { - fflush(fp[id]); - } - return true; -} - +}; \ No newline at end of file diff --git a/common/debug.h b/common/debug.h index 85894ba59..5c32eadce 100644 --- a/common/debug.h +++ b/common/debug.h @@ -93,7 +93,6 @@ public: bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); - bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0); private: bool open(LogIDs id); bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline From 50b686b16283aec5994264d6d59a60ed0c6379f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:30:41 -0600 Subject: [PATCH 0947/1883] Remove debug.cpp/.h files and from CMakeLists.txt --- common/CMakeLists.txt | 2 - common/debug.cpp | 272 ------------------------------------------ common/debug.h | 132 -------------------- 3 files changed, 406 deletions(-) delete mode 100644 common/debug.cpp delete mode 100644 common/debug.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2a98f5cfb..489c5e7de 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,7 +9,6 @@ SET(common_sources crc32.cpp database.cpp dbcore.cpp - debug.cpp emu_opcodes.cpp emu_tcp_connection.cpp emu_tcp_server.cpp @@ -107,7 +106,6 @@ SET(common_headers data_verification.h database.h dbcore.h - debug.h deity.h emu_opcodes.h emu_oplist.h diff --git a/common/debug.cpp b/common/debug.cpp deleted file mode 100644 index fc7a4cc16..000000000 --- a/common/debug.cpp +++ /dev/null @@ -1,272 +0,0 @@ -#include -#include - -#ifdef _WINDOWS - #include - - #define snprintf _snprintf - #define vsnprintf _vsnprintf - #define strncasecmp _strnicmp - #define strcasecmp _stricmp - - #include - #include - #include - -namespace ConsoleColor { - enum Colors { - Black = 0, - Blue = 1, - Green = 2, - Cyan = 3, - Red = 4, - Magenta = 5, - Brown = 6, - LightGray = 7, - DarkGray = 8, - LightBlue = 9, - LightGreen = 10, - LightCyan = 11, - LightRed = 12, - LightMagenta = 13, - Yellow = 14, - White = 15, - }; -} - -#else - - #include - #include - -#endif - -#include "eqemu_logsys.h" -#include "debug.h" -#include "misc_functions.h" -#include "platform.h" -#include "eqemu_logsys.h" -#include "string_util.h" - -#ifndef va_copy - #define va_copy(d,s) ((d) = (s)) -#endif - -static volatile bool logFileValid = false; -static EQEmuLog realLogFile; -EQEmuLog *LogFile = &realLogFile; - -static const char* FileNames[EQEmuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; -static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; - -EQEmuLog::EQEmuLog() -{ - pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS; - pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; - pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR; - pLogStatus[EQEmuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG; - pLogStatus[EQEmuLog::LogIDs::Quest] = LOG_LEVEL_QUEST; - pLogStatus[EQEmuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS; - pLogStatus[EQEmuLog::LogIDs::Crash] = LOG_LEVEL_CRASH; - logFileValid = true; -} - -EQEmuLog::~EQEmuLog() -{ - logFileValid = false; - for (int i = 0; i < MaxLogID; i++) { - LockMutex lock(&MLog[i]); //to prevent termination race - if (fp[i]) { - fclose(fp[i]); - } - } -} - -bool EQEmuLog::open(LogIDs id) -{ - if (!logFileValid) { - return false; - } - if (id >= MaxLogID) { - return false; - } - LockMutex lock(&MOpen); - if (pLogStatus[id] & 4) { - return false; - } - if (fp[id]) { - //cerr<<"Warning: LogFile already open"<= MaxLogID) { - return false; - } - - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - - va_list argptr, tmpargptr; - va_start(argptr, fmt); - - logger.Log(id, vStringFormat(fmt, argptr).c_str()); - - return true; -} - -//write with Prefix and a VA_list -bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) -{ - if (!logFileValid) { - return false; - } - if (id >= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - time_t aclock; - struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - va_list tmpargptr; - if (dofile) { - #ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); - #else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); - #endif - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] %s", LogNames[id], prefix); - vfprintf( stderr, fmt, argptr ); - } - /* Console Output */ - else { - - -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } -#endif - - fprintf(stdout, "[%s] %s", LogNames[id], prefix); - vfprintf(stdout, fmt, argptr); - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); -#endif - } - } - va_end(argptr); - if (dofile) { - fprintf(fp[id], "\n"); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "\n"); - } else { - fprintf(stdout, "\n"); - } - } - if (dofile) { - fflush(fp[id]); - } - return true; -} - -bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) -{ - va_list argptr, tmpargptr; - va_start(argptr, fmt); - if (dofile) { - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - vfprintf( stderr, fmt, argptr ); - } else { - vfprintf( stdout, fmt, argptr ); - } - } - va_end(argptr); - return true; -}; \ No newline at end of file diff --git a/common/debug.h b/common/debug.h deleted file mode 100644 index 5c32eadce..000000000 --- a/common/debug.h +++ /dev/null @@ -1,132 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -// Debug Levels -#ifndef EQDEBUG -#define EQDEBUG 1 -#else -////// File/Console options -// 0 <= Quiet mode Errors to file Status and Normal ignored -// 1 >= Status and Normal to console, Errors to file -// 2 >= Status, Normal, and Error to console and logfile -// 3 >= Lite debug -// 4 >= Medium debug -// 5 >= Debug release (Anything higher is not recommended for regular use) -// 6 == (Reserved for special builds) Login opcode debug All packets dumped -// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped -// 8 == (Reserved for special builds) World opcode debug All packets dumped -// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped -// 10 >= More than you ever wanted to know -// -///// -// Add more below to reserve for file's functions ect. -///// -// Any setup code based on defines should go here -// -#endif - - -#if defined(_DEBUG) && defined(WIN32) - #ifndef _CRTDBG_MAP_ALLOC - #include - #include - #endif -#endif - -#ifndef EQDEBUG_H -#define EQDEBUG_H - -#ifndef _WINDOWS - #define DebugBreak() if(0) {} -#endif - -#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues -#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) ) - // Packet Collector on win32 requires winsock.h due to latest pcap.h - // winsock.h must come before windows.h - #include -#endif - -#ifdef _WINDOWS - #include - #include -#endif - -#include "logsys.h" - -#include "../common/mutex.h" -#include -#include - - -class EQEmuLog { -public: - EQEmuLog(); - ~EQEmuLog(); - - enum LogIDs { - Status = 0, /* This must stay the first entry in this list */ - Normal, /* Normal Logs */ - Error, /* Error Logs */ - Debug, /* Debug Logs */ - Quest, /* Quest Logs */ - Commands, /* Issued Comamnds */ - Crash, /* Crash Logs */ - Save, /* Client Saves */ - MaxLogID /* Max, used in functions to get the max log ID */ - }; - - bool write(LogIDs id, const char *fmt, ...); - bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); -private: - bool open(LogIDs id); - bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline - - Mutex MOpen; - Mutex MLog[MaxLogID]; - FILE* fp[MaxLogID]; - -/* LogStatus: bitwise variable - 1 = output to file - 2 = output to stdout - 4 = fopen error, dont retry - 8 = use stderr instead (2 must be set) -*/ - uint8 pLogStatus[MaxLogID]; - -}; - -extern EQEmuLog* LogFile; - -#ifdef _EQDEBUG -class PerformanceMonitor { -public: - PerformanceMonitor(int64* ip) { - p = ip; - QueryPerformanceCounter(&tmp); - } - ~PerformanceMonitor() { - LARGE_INTEGER tmp2; - QueryPerformanceCounter(&tmp2); - *p += tmp2.QuadPart - tmp.QuadPart; - } - LARGE_INTEGER tmp; - int64* p; -}; -#endif -#endif From 7c78cf5ab70f0b020364a0d998b1fe8fb99b268f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:39:51 -0600 Subject: [PATCH 0948/1883] More debug changes --- common/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 489c5e7de..2a98f5cfb 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,6 +9,7 @@ SET(common_sources crc32.cpp database.cpp dbcore.cpp + debug.cpp emu_opcodes.cpp emu_tcp_connection.cpp emu_tcp_server.cpp @@ -106,6 +107,7 @@ SET(common_headers data_verification.h database.h dbcore.h + debug.h deity.h emu_opcodes.h emu_oplist.h From 79ac3f9b44afe1b0a6b0cbad8b5175416b6a17ce Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:40:47 -0600 Subject: [PATCH 0949/1883] added debug.cpp/.h back in temporarily because of stupid dependencies --- common/debug.cpp | 272 +++++++++++++++++++++++++++++++++++++++++++++++ common/debug.h | 132 +++++++++++++++++++++++ 2 files changed, 404 insertions(+) create mode 100644 common/debug.cpp create mode 100644 common/debug.h diff --git a/common/debug.cpp b/common/debug.cpp new file mode 100644 index 000000000..fc7a4cc16 --- /dev/null +++ b/common/debug.cpp @@ -0,0 +1,272 @@ +#include +#include + +#ifdef _WINDOWS + #include + + #define snprintf _snprintf + #define vsnprintf _vsnprintf + #define strncasecmp _strnicmp + #define strcasecmp _stricmp + + #include + #include + #include + +namespace ConsoleColor { + enum Colors { + Black = 0, + Blue = 1, + Green = 2, + Cyan = 3, + Red = 4, + Magenta = 5, + Brown = 6, + LightGray = 7, + DarkGray = 8, + LightBlue = 9, + LightGreen = 10, + LightCyan = 11, + LightRed = 12, + LightMagenta = 13, + Yellow = 14, + White = 15, + }; +} + +#else + + #include + #include + +#endif + +#include "eqemu_logsys.h" +#include "debug.h" +#include "misc_functions.h" +#include "platform.h" +#include "eqemu_logsys.h" +#include "string_util.h" + +#ifndef va_copy + #define va_copy(d,s) ((d) = (s)) +#endif + +static volatile bool logFileValid = false; +static EQEmuLog realLogFile; +EQEmuLog *LogFile = &realLogFile; + +static const char* FileNames[EQEmuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; +static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; + +EQEmuLog::EQEmuLog() +{ + pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS; + pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; + pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR; + pLogStatus[EQEmuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG; + pLogStatus[EQEmuLog::LogIDs::Quest] = LOG_LEVEL_QUEST; + pLogStatus[EQEmuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS; + pLogStatus[EQEmuLog::LogIDs::Crash] = LOG_LEVEL_CRASH; + logFileValid = true; +} + +EQEmuLog::~EQEmuLog() +{ + logFileValid = false; + for (int i = 0; i < MaxLogID; i++) { + LockMutex lock(&MLog[i]); //to prevent termination race + if (fp[i]) { + fclose(fp[i]); + } + } +} + +bool EQEmuLog::open(LogIDs id) +{ + if (!logFileValid) { + return false; + } + if (id >= MaxLogID) { + return false; + } + LockMutex lock(&MOpen); + if (pLogStatus[id] & 4) { + return false; + } + if (fp[id]) { + //cerr<<"Warning: LogFile already open"<= MaxLogID) { + return false; + } + + bool dofile = false; + if (pLogStatus[id] & 1) { + dofile = open(id); + } + if (!(dofile || pLogStatus[id] & 2)) { + return false; + } + LockMutex lock(&MLog[id]); + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } + + va_list argptr, tmpargptr; + va_start(argptr, fmt); + + logger.Log(id, vStringFormat(fmt, argptr).c_str()); + + return true; +} + +//write with Prefix and a VA_list +bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) +{ + if (!logFileValid) { + return false; + } + if (id >= MaxLogID) { + return false; + } + bool dofile = false; + if (pLogStatus[id] & 1) { + dofile = open(id); + } + if (!(dofile || pLogStatus[id] & 2)) { + return false; + } + LockMutex lock(&MLog[id]); + if (!logFileValid) { + return false; //check again for threading race reasons (to avoid two mutexes) + } + time_t aclock; + struct tm *newtime; + time( &aclock ); /* Get time in seconds */ + newtime = localtime( &aclock ); /* Convert time to struct */ + va_list tmpargptr; + if (dofile) { + #ifndef NO_PIDLOG + fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); + #else + fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); + #endif + va_copy(tmpargptr, argptr); + vfprintf( fp[id], fmt, tmpargptr ); + } + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + fprintf(stderr, "[%s] %s", LogNames[id], prefix); + vfprintf( stderr, fmt, argptr ); + } + /* Console Output */ + else { + + +#ifdef _WINDOWS + HANDLE console_handle; + console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_FONT_INFOEX info = { 0 }; + info.cbSize = sizeof(info); + info.dwFontSize.Y = 12; // leave X as zero + info.FontWeight = FW_NORMAL; + wcscpy(info.FaceName, L"Lucida Console"); + SetCurrentConsoleFontEx(console_handle, NULL, &info); + + if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } + if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } + if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } + if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } + if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } + if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } +#endif + + fprintf(stdout, "[%s] %s", LogNames[id], prefix); + vfprintf(stdout, fmt, argptr); + +#ifdef _WINDOWS + /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); +#endif + } + } + va_end(argptr); + if (dofile) { + fprintf(fp[id], "\n"); + } + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + fprintf(stderr, "\n"); + } else { + fprintf(stdout, "\n"); + } + } + if (dofile) { + fflush(fp[id]); + } + return true; +} + +bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) +{ + va_list argptr, tmpargptr; + va_start(argptr, fmt); + if (dofile) { + va_copy(tmpargptr, argptr); + vfprintf( fp[id], fmt, tmpargptr ); + } + if (pLogStatus[id] & 2) { + if (pLogStatus[id] & 8) { + vfprintf( stderr, fmt, argptr ); + } else { + vfprintf( stdout, fmt, argptr ); + } + } + va_end(argptr); + return true; +}; \ No newline at end of file diff --git a/common/debug.h b/common/debug.h new file mode 100644 index 000000000..5c32eadce --- /dev/null +++ b/common/debug.h @@ -0,0 +1,132 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +// Debug Levels +#ifndef EQDEBUG +#define EQDEBUG 1 +#else +////// File/Console options +// 0 <= Quiet mode Errors to file Status and Normal ignored +// 1 >= Status and Normal to console, Errors to file +// 2 >= Status, Normal, and Error to console and logfile +// 3 >= Lite debug +// 4 >= Medium debug +// 5 >= Debug release (Anything higher is not recommended for regular use) +// 6 == (Reserved for special builds) Login opcode debug All packets dumped +// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped +// 8 == (Reserved for special builds) World opcode debug All packets dumped +// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped +// 10 >= More than you ever wanted to know +// +///// +// Add more below to reserve for file's functions ect. +///// +// Any setup code based on defines should go here +// +#endif + + +#if defined(_DEBUG) && defined(WIN32) + #ifndef _CRTDBG_MAP_ALLOC + #include + #include + #endif +#endif + +#ifndef EQDEBUG_H +#define EQDEBUG_H + +#ifndef _WINDOWS + #define DebugBreak() if(0) {} +#endif + +#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues +#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) ) + // Packet Collector on win32 requires winsock.h due to latest pcap.h + // winsock.h must come before windows.h + #include +#endif + +#ifdef _WINDOWS + #include + #include +#endif + +#include "logsys.h" + +#include "../common/mutex.h" +#include +#include + + +class EQEmuLog { +public: + EQEmuLog(); + ~EQEmuLog(); + + enum LogIDs { + Status = 0, /* This must stay the first entry in this list */ + Normal, /* Normal Logs */ + Error, /* Error Logs */ + Debug, /* Debug Logs */ + Quest, /* Quest Logs */ + Commands, /* Issued Comamnds */ + Crash, /* Crash Logs */ + Save, /* Client Saves */ + MaxLogID /* Max, used in functions to get the max log ID */ + }; + + bool write(LogIDs id, const char *fmt, ...); + bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); +private: + bool open(LogIDs id); + bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline + + Mutex MOpen; + Mutex MLog[MaxLogID]; + FILE* fp[MaxLogID]; + +/* LogStatus: bitwise variable + 1 = output to file + 2 = output to stdout + 4 = fopen error, dont retry + 8 = use stderr instead (2 must be set) +*/ + uint8 pLogStatus[MaxLogID]; + +}; + +extern EQEmuLog* LogFile; + +#ifdef _EQDEBUG +class PerformanceMonitor { +public: + PerformanceMonitor(int64* ip) { + p = ip; + QueryPerformanceCounter(&tmp); + } + ~PerformanceMonitor() { + LARGE_INTEGER tmp2; + QueryPerformanceCounter(&tmp2); + *p += tmp2.QuadPart - tmp.QuadPart; + } + LARGE_INTEGER tmp; + int64* p; +}; +#endif +#endif From d21466566ef11a78b56f5c146b4ea313ee160f55 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:53:56 -0600 Subject: [PATCH 0950/1883] Remove some mlog related functions in Mob:: --- zone/entity.cpp | 29 ----------------------------- zone/entity.h | 2 -- zone/mob.h | 6 ------ 3 files changed, 37 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 7b85b286b..d3b95e7f5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3538,35 +3538,6 @@ bool EntityList::LimitCheckName(const char *npc_name) return true; } -void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients, - bool non_clients, float range) -{ - float range2 = range * range; - - auto it = mob_list.begin(); - while (it != mob_list.end()) { - Mob *mob = it->second; - - ++it; - - if (mob->IsClient()) { - if (!clients) - continue; - } else { - if (!non_clients) - continue; - } - - if (around->DistNoRoot(*mob) > range2) - continue; - - if (enabled) - mob->EnableLogging(); - else - mob->DisableLogging(); - } -} - void EntityList::UpdateHoTT(Mob *target) { auto it = client_list.begin(); diff --git a/zone/entity.h b/zone/entity.h index 88f5257f7..69cb0208b 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -318,8 +318,6 @@ public: void MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); void AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster = true); - void RadialSetLogging(Mob *around, bool enabled, bool clients, bool non_clients, float range = 0); - //trap stuff Mob* GetTrapTrigger(Trap* trap); void SendAlarm(Trap* trap, Mob* currenttarget, uint8 kos); diff --git a/zone/mob.h b/zone/mob.h index 5997ffeae..b994f519b 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -535,12 +535,6 @@ public: bool HasProcs() const; bool IsCombatProc(uint16 spell_id); - //Logging - bool IsLoggingEnabled() const { return(logging_enabled); } - void EnableLogging() { logging_enabled = true; } - void DisableLogging() { logging_enabled = false; } - - //More stuff to sort: virtual bool IsRaidTarget() const { return false; }; virtual bool IsAttackAllowed(Mob *target, bool isSpellAttack = false); From 2bc6ed17c76e06fb0677efb54312308089e27d84 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:54:51 -0600 Subject: [PATCH 0951/1883] Remove command_mlog --- zone/command.cpp | 160 ----------------------------------------------- zone/command.h | 1 - 2 files changed, 161 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 35ca539e8..df31b604b 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -366,7 +366,6 @@ int command_init(void) { command_add("path","- view and edit pathing",200,command_path) || command_add("flags","- displays the flags of you or your target",0,command_flags) || command_add("flagedit","- Edit zone flags on your target",100,command_flagedit) || - command_add("mlog","- Manage log settings",250,command_mlog) || command_add("aggro","(range) [-v] - Display aggro information for all mobs 'range' distance from your target. -v is verbose faction info.",80,command_aggro) || command_add("hatelist"," - Display hate list for target.", 80,command_hatelist) || command_add("aggrozone","[aggro] - Aggro every mob in the zone with X aggro. Default is 0. Not recommend if you're not invulnerable.",100,command_aggrozone) || @@ -7444,165 +7443,6 @@ void command_flagedit(Client *c, const Seperator *sep) { c->Message(15, "Invalid action specified. use '#flagedit help' for help"); } -void command_mlog(Client *c, const Seperator *sep) { - //super-command for managing log settings - if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { - c->Message(0, "Syntax: #mlog [subcommand]."); - c->Message(0, "-- Mob Logging Togglers --"); - c->Message(0, "...target [on|off] - Set logging enabled for your target"); - c->Message(0, "...all [on|off] - Set logging enabled for all mobs and clients (prolly a bad idea)"); - c->Message(0, "...mobs [on|off] - Set logging enabled for all mobs"); - c->Message(0, "...clients [on|off] - Set logging enabled for all clients"); - c->Message(0, "...radius [on|off] [radius] - Set logging enable for all mobs and clients within `radius`"); - c->Message(0, "-------------"); - c->Message(0, "-- Log Settings --"); - c->Message(0, "...list [category] - List all log types in specified category, or all categories if none specified."); - c->Message(0, "...setcat [category] [on|off] - Enable/Disable all types in a specified category"); - c->Message(0, "...set [type] [on|off] - Enable/Disable the specified log type"); - c->Message(0, "...load [filename] - Load log type settings from the file `filename`"); - return; - } - bool onoff; - std::string on("on"); - std::string off("off"); - - if(!strcasecmp(sep->arg[1], "target")) { - if(on == sep->arg[2]) onoff = true; - else if(off == sep->arg[2]) onoff = false; - else { c->Message(13, "Invalid argument. Expected on/off."); return; } - - Mob *tgt = c->GetTarget(); - if(tgt == nullptr) { - c->Message(13, "You must have a target for this command."); - return; - } - - if(onoff) - tgt->EnableLogging(); - else - tgt->DisableLogging(); - - c->Message(0, "Logging has been enabled on %s", tgt->GetName()); - } else if(!strcasecmp(sep->arg[1], "all")) { - if(on == sep->arg[2]) onoff = true; - else if(off == sep->arg[2]) onoff = false; - else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; } - - entity_list.RadialSetLogging(c, onoff, true, true); - - c->Message(0, "Logging has been enabled for all entities"); - } else if(!strcasecmp(sep->arg[1], "mobs")) { - if(on == sep->arg[2]) onoff = true; - else if(off == sep->arg[2]) onoff = false; - else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; } - - entity_list.RadialSetLogging(c, onoff, false, true); - - c->Message(0, "Logging has been enabled for all mobs"); - } else if(!strcasecmp(sep->arg[1], "clients")) { - if(on == sep->arg[2]) onoff = true; - else if(off == sep->arg[2]) onoff = false; - else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; } - - entity_list.RadialSetLogging(c, onoff, true, false); - - c->Message(0, "Logging has been enabled for all clients"); - } else if(!strcasecmp(sep->arg[1], "radius")) { - if(on == sep->arg[2]) onoff = true; - else if(off == sep->arg[2]) onoff = false; - else { c->Message(13, "Invalid argument '%s'. Expected on/off.", sep->arg[2]); return; } - - float radius = atof(sep->arg[3]); - if(radius <= 0) { - c->Message(13, "Invalid radius %f", radius); - return; - } - - entity_list.RadialSetLogging(c, onoff, false, true, radius); - - c->Message(0, "Logging has been enabled for all entities within %f", radius); - } else if(!strcasecmp(sep->arg[1], "list")) { - int r; - if(sep->arg[2][0] == '\0') { - c->Message(0, "Listing all log categories:"); - for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { - c->Message(0, "Category %d: %s", r, log_category_names[r]); - } - } else { - //first we have to find the category ID. - for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { - if(!strcasecmp(log_category_names[r], sep->arg[2])) - break; - } - if(r == NUMBER_OF_LOG_CATEGORIES) { - c->Message(13, "Unable to find category '%s'", sep->arg[2]); - return; - } - int logcat = r; - c->Message(0, "Types for category %d: %s", logcat, log_category_names[logcat]); - for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { - if(log_type_info[r].category != logcat) - continue; - c->Message(0, "...%d: %s (%s)", r, log_type_info[r].name, is_log_enabled(LogType(r))?"enabled":"disabled"); - } - } - } else if(!strcasecmp(sep->arg[1], "setcat")) { - if(on == sep->arg[3]) onoff = true; - else if(off == sep->arg[3]) onoff = false; - else { c->Message(13, "Invalid argument %s. Expected on/off.", sep->arg[3]); return; } - - int r; - //first we have to find the category ID. - for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { - if(!strcasecmp(log_category_names[r], sep->arg[2])) - break; - } - if(r == NUMBER_OF_LOG_CATEGORIES) { - c->Message(13, "Unable to find category '%s'", sep->arg[2]); - return; - } - - LogCategory logcat = LogCategory(r); - for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { - if(log_type_info[r].category != logcat) - continue; - - if(onoff) { - log_enable(LogType(r)); - c->Message(0, "Log type %s (%d) has been enabled", log_type_info[r].name, r); - } else { - log_disable(LogType(r)); - c->Message(0, "Log type %s (%d) has been disabled", log_type_info[r].name, r); - } - } - } else if(!strcasecmp(sep->arg[1], "set")) { - if(on == sep->arg[3]) onoff = true; - else if(off == sep->arg[3]) onoff = false; - else { c->Message(13, "Invalid argument %s. Expected on/off.", sep->arg[3]); return; } - - //first we have to find the category ID. - int r; - for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { - if(!strcasecmp(log_type_info[r].name, sep->arg[2])) - break; - } - if(r == NUMBER_OF_LOG_TYPES) { - c->Message(13, "Unable to find log type %s", sep->arg[2]); - return; - } - - if(onoff) { - log_enable(LogType(r)); - c->Message(0, "Log type %s (%d) has been enabled", log_type_info[r].name, r); - } else { - log_disable(LogType(r)); - c->Message(0, "Log type %s (%d) has been disabled", log_type_info[r].name, r); - } - } else { - c->Message(15, "Invalid action specified. use '#mlog help' for help"); - } -} - void command_serverrules(Client *c, const Seperator *sep) { c->SendRules(c); diff --git a/zone/command.h b/zone/command.h index c3825a66a..ab32bfd5e 100644 --- a/zone/command.h +++ b/zone/command.h @@ -269,7 +269,6 @@ void command_aggrozone(Client *c, const Seperator *sep); void command_reloadstatic(Client *c, const Seperator *sep); void command_flags(Client *c, const Seperator *sep); void command_flagedit(Client *c, const Seperator *sep); -void command_mlog(Client *c, const Seperator *sep); void command_serverrules(Client *c, const Seperator *sep); void command_acceptrules(Client *c, const Seperator *sep); void command_guildcreate(Client *c, const Seperator *sep); From a6c521a73e88d6fcb6e8c4f1a5d2550bed2259b3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:58:08 -0600 Subject: [PATCH 0952/1883] Keep mlog happy until it is completely replaced --- common/logsys.h | 2 +- zone/zone_logsys.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index 84741cdb4..f6a23e5db 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -159,7 +159,7 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); extern void log_packet_mob(LogType type, Mob *who, const BasePacket *p); #define mpkt( type, packet) \ do { \ - if(IsLoggingEnabled()) \ + if(1) \ if(log_type_info[ type ].enabled) { \ log_packet_mob(type, this, packet); \ } \ diff --git a/zone/zone_logsys.cpp b/zone/zone_logsys.cpp index 50362c6b1..10d563de7 100644 --- a/zone/zone_logsys.cpp +++ b/zone/zone_logsys.cpp @@ -25,8 +25,8 @@ #include void log_message_mob(LogType type, Mob *who, const char *fmt, ...) { - if(!who->IsLoggingEnabled()) - return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common + // if(!who->IsLoggingEnabled()) + // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common char prefix_buffer[256]; snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetName()); @@ -39,8 +39,8 @@ void log_message_mob(LogType type, Mob *who, const char *fmt, ...) { } void log_message_mobVA(LogType type, Mob *who, const char *fmt, va_list args) { - if(!who->IsLoggingEnabled()) - return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common + // if(!who->IsLoggingEnabled()) + // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common char prefix_buffer[256]; snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetName()); @@ -50,15 +50,15 @@ void log_message_mobVA(LogType type, Mob *who, const char *fmt, va_list args) { } void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length, uint8 padding) { - if(!who->IsLoggingEnabled()) - return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common + // if(!who->IsLoggingEnabled()) + // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common log_hex(type,data,length,padding); } void log_packet_mob(LogType type, Mob *who, const BasePacket *p) { - if(!who->IsLoggingEnabled()) - return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common + // if(!who->IsLoggingEnabled()) + // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common char buffer[80]; p->build_header_dump(buffer); From 449c12d6c267395ebaed97b6b9493c3f8fd81096 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 22:04:40 -0600 Subject: [PATCH 0953/1883] Delete mpkt and some calls to it --- common/logsys.h | 8 -------- zone/client_packet.cpp | 4 +--- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index f6a23e5db..9b3da9aa2 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -156,14 +156,6 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); log_hex_mob(type, this, data, len); \ } \ } while(false) - extern void log_packet_mob(LogType type, Mob *who, const BasePacket *p); - #define mpkt( type, packet) \ - do { \ - if(1) \ - if(log_type_info[ type ].enabled) { \ - log_packet_mob(type, this, packet); \ - } \ - } while(false) #endif extern void log_enable(LogType t); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a18438f5c..aeb689505 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -401,7 +401,6 @@ int Client::HandlePacket(const EQApplicationPacket *app) char buffer[64]; app->build_header_dump(buffer); mlog(CLIENT__NET_IN_TRACE, "Dispatch opcode: %s", buffer); - mpkt(CLIENT__NET_IN_TRACE, app); } EmuOpcode opcode = app->GetOpcode(); @@ -5835,7 +5834,6 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GetGuildMOTD"); - mpkt(GUILDS__IN_PACKET_TRACE, app); SendGuildMOTD(true); @@ -7219,7 +7217,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildDelete"); - mpkt(GUILDS__IN_PACKET_TRACE, app); + mpkt(GUILDS__IN_PACKET_TRACE, app);s if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); From 647874d424f5101d80f1bde102059f8ccfeb1513 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 22:12:36 -0600 Subject: [PATCH 0954/1883] Remove occurrences of mkpt --- zone/client_packet.cpp | 16 ---------------- zone/guild.cpp | 4 ---- 2 files changed, 20 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index aeb689505..23dd11529 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1899,7 +1899,6 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { mlog(AA__IN, "Received OP_AAAction"); - mpkt(AA__IN, app); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -5847,7 +5846,6 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GetGuildsList"); - mpkt(GUILDS__IN_PACKET_TRACE, app); SendGuildList(); } @@ -7217,7 +7215,6 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildDelete"); - mpkt(GUILDS__IN_PACKET_TRACE, app);s if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); @@ -7234,7 +7231,6 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildDemote"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildDemoteStruct)) { mlog(GUILDS__ERROR, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); @@ -7286,7 +7282,6 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildInvite"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7359,7 +7354,6 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) gc->guildeqid = GuildID(); mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); - mpkt(GUILDS__OUT_PACKET_TRACE, app); client->QueuePacket(app); } @@ -7393,7 +7387,6 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) gc->guildeqid = GuildID(); mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); - mpkt(GUILDS__OUT_PACKET_TRACE, app); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7417,7 +7410,6 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildInviteAccept"); - mpkt(GUILDS__IN_PACKET_TRACE, app); SetPendingGuildInvitation(false); @@ -7509,7 +7501,6 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildLeader"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size < 2) { mlog(GUILDS__ERROR, "Invalid length %d on OP_GuildLeader", app->size); @@ -7553,7 +7544,6 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Got OP_GuildManageBanker of len %d", app->size); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildManageBanker_Struct)) { mlog(GUILDS__ERROR, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; @@ -7631,14 +7621,12 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Got OP_GuildPeace of len %d", app->size); - mpkt(GUILDS__IN_PACKET_TRACE, app); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildPromote"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildPromoteStruct)) { mlog(GUILDS__ERROR, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); @@ -7688,7 +7676,6 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildPublicNote"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7725,7 +7712,6 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_GuildRemove"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7882,7 +7868,6 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Got OP_GuildWar of len %d", app->size); - mpkt(GUILDS__IN_PACKET_TRACE, app); return; } @@ -11864,7 +11849,6 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { mlog(GUILDS__IN_PACKETS, "Received OP_SetGuildMOTD"); - mpkt(GUILDS__IN_PACKET_TRACE, app); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild diff --git a/zone/guild.cpp b/zone/guild.cpp index 392ac8e48..0bc5186de 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -57,7 +57,6 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMOTD of length %d", outapp->size); - mpkt(GUILDS__OUT_PACKET_TRACE, outapp); FastQueuePacket(&outapp); } @@ -177,7 +176,6 @@ void Client::SendGuildList() { } mlog(GUILDS__OUT_PACKETS, "Sending OP_ZoneGuildList of length %d", outapp->size); -// mpkt(GUILDS__OUT_PACKET_TRACE, outapp); FastQueuePacket(&outapp); } @@ -195,7 +193,6 @@ void Client::SendGuildMembers() { data = nullptr; mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMemberList of length %d", outapp->size); - mpkt(GUILDS__OUT_PACKET_TRACE, outapp); FastQueuePacket(&outapp); @@ -339,7 +336,6 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->zoneid = gj->zoneid; mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildManageAdd for join of length %d", outapp->size); - mpkt(GUILDS__OUT_PACKET_TRACE, outapp); FastQueuePacket(&outapp); From b06d1b9050bb471707375f8175a39fd797d6a8ea Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 01:52:12 -0600 Subject: [PATCH 0955/1883] Strip newlines that pipe from quest logs --- zone/embxs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zone/embxs.cpp b/zone/embxs.cpp index e080d6a13..f8a948578 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -92,6 +92,9 @@ XS(XS_EQEmuIO_PRINT) char *str = SvPV_nolen(ST(r)); char *cur = str; + /* Strip newlines from log message 'str' */ + *std::remove(str, str + strlen(str), '\n') = '\0'; + int i; int pos = 0; int len = 0; From aec39d2650fe23b3cd6f368dbfd4c2c2b5fa0154 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 01:59:18 -0600 Subject: [PATCH 0956/1883] Port mlog AA category to new log system --- zone/aa.cpp | 8 ++++---- zone/client_packet.cpp | 4 ++-- zone/spells.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 0e6e0aad0..db28b2dc8 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -951,7 +951,7 @@ void Client::SendAAStats() { void Client::BuyAA(AA_Action* action) { - mlog(AA__MESSAGE, "Starting to buy AA %d", action->ability); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); //find the AA information from the database SendAA_Struct* aa2 = zone->FindAA(action->ability); @@ -963,7 +963,7 @@ void Client::BuyAA(AA_Action* action) a = action->ability - i; if(a <= 0) break; - mlog(AA__MESSAGE, "Could not find AA %d, trying potential parent %d", action->ability, a); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); aa2 = zone->FindAA(a); if(aa2 != nullptr) break; @@ -980,7 +980,7 @@ void Client::BuyAA(AA_Action* action) uint32 cur_level = GetAA(aa2->id); if((aa2->id + cur_level) != action->ability) { //got invalid AA - mlog(AA__ERROR, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); return; } @@ -1011,7 +1011,7 @@ void Client::BuyAA(AA_Action* action) if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); - mlog(AA__MESSAGE, "Set AA %d to level %d", aa2->id, cur_level + 1); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); m_pp.aapoints -= real_cost; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 23dd11529..22d63370c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1898,7 +1898,7 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { - mlog(AA__IN, "Received OP_AAAction"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -1907,7 +1907,7 @@ void Client::Handle_OP_AAAction(const EQApplicationPacket *app) AA_Action* action = (AA_Action*)app->pBuffer; if (action->action == aaActionActivate) {//AA Hotkey - mlog(AA__MESSAGE, "Activating AA %d", action->ability); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); ActivateAA((aaID)action->ability); } else if (action->action == aaActionBuy) { diff --git a/zone/spells.cpp b/zone/spells.cpp index 113c335e4..0e2b1e49f 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1391,7 +1391,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce && (IsGrouped() // still self only if not grouped || IsRaidGrouped()) && (HasProjectIllusion())){ - mlog(AA__MESSAGE, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); targetType = ST_GroupClientAndPet; } @@ -2067,11 +2067,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsPlayerIllusionSpell(spell_id) && IsClient() && (HasProjectIllusion())){ - mlog(AA__MESSAGE, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); SetProjectIllusion(false); } else{ - mlog(AA__MESSAGE, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); } break; } From cae6a70a2c0d39345ef156216dbacb9157fba0be Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:01:20 -0600 Subject: [PATCH 0957/1883] port mlog 'Spells' category to new log system --- zone/attack.cpp | 12 +- zone/bot.cpp | 16 +-- zone/client_packet.cpp | 4 +- zone/spell_effects.cpp | 16 +-- zone/spells.cpp | 308 ++++++++++++++++++++--------------------- 5 files changed, 178 insertions(+), 178 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index d284b9184..4e3aa3c2f 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3137,7 +3137,7 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce >= buffs[slot].melee_rune) { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3145,7 +3145,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3164,7 +3164,7 @@ int32 Mob::ReduceDamage(int32 damage) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3172,7 +3172,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) @@ -3290,7 +3290,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if(!TryFadeEffect(slot)) @@ -3298,7 +3298,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } else { - mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) diff --git a/zone/bot.cpp b/zone/bot.cpp index fa4d937f2..611fb871c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -9076,7 +9076,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - mlog(SPELLS__CASTING, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -9084,7 +9084,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -9105,7 +9105,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t //cannot cast under deivne aura if(DivineAura()) { - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -9119,7 +9119,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -9127,7 +9127,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t } if (HasActiveSong()) { - mlog(SPELLS__BARDS, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client //_StopSong(); bardsong = 0; @@ -9256,7 +9256,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - mlog(SPELLS__RESISTS, "Bot's target is not an undead."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); return true; } } @@ -9266,13 +9266,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3) ) { - mlog(SPELLS__RESISTS, "Bot's target is not a summoned creature."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); return true; } } } - mlog(SPELLS__RESISTS, "No bot immunities to spell %d found.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 22d63370c..65fcd4cfe 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2970,7 +2970,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (!IsPoison) { - mlog(SPELLS__CASTING_ERR, "Item used to cast spell effect from a poison item was missing from inventory slot %d " + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); @@ -3865,7 +3865,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*)app->pBuffer; uint32 spid = sbf->spellid; - mlog(SPELLS__BUFFS, "Client requested that buff with spell id %d be canceled.", spid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b8d67ddaa..217172e8b 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1649,7 +1649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - mlog(SPELLS__REZ, " corpse being rezzed using spell %i by %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int mod = caster->GetInstrumentMod(spell_id); mod = ApplySpellEffectiveness(caster, spell_id, mod, true); effect_value = effect_value * mod / 10; - mlog(SPELLS__BARDS, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); } effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); @@ -3127,7 +3127,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - mlog(SPELLS__EFFECT_VALUES, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3351,7 +3351,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - mlog(SPELLS__EFFECT_VALUES, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3383,18 +3383,18 @@ void Mob::BuffProcess() IsMezSpell(buffs[buffs_i].spellid) || IsBlindSpell(buffs[buffs_i].spellid)) { - mlog(SPELLS__BUFFS, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } } else if (buffs[buffs_i].ticsremaining < 0) { - mlog(SPELLS__BUFFS, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - mlog(SPELLS__BUFFS, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if(IsClient() && !(CastToClient()->GetClientVersionBit() & BIT_SoFAndLater)) @@ -3759,7 +3759,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - mlog(SPELLS__BUFFS, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; diff --git a/zone/spells.cpp b/zone/spells.cpp index 0e2b1e49f..d3b2c3e4b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -147,7 +147,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust) { - mlog(SPELLS__CASTING, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -166,7 +166,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -204,7 +204,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, //cannot cast under divine aura if(DivineAura()) { - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -234,7 +234,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - mlog(SPELLS__CASTING_ERR, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -243,7 +243,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - mlog(SPELLS__BARDS, "Casting a new song while singing a song. Killing old song %d.", bardsong); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -349,7 +349,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - mlog(SPELLS__CASTING, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -363,7 +363,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - mlog(SPELLS__CASTING, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this @@ -375,7 +375,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - mlog(SPELLS__CASTING, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -392,7 +392,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // we checked for spells not requiring targets above if(target_id == 0) { - mlog(SPELLS__CASTING_ERR, "Spell Error: no target. spell=%d\n", GetName(), spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, SPELL_NEED_TAR); @@ -430,7 +430,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, { mana_cost = 0; } else { - mlog(SPELLS__CASTING_ERR, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, INSUFFICIENT_MANA); @@ -451,7 +451,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_resist_adjust = resist_adjust; - mlog(SPELLS__CASTING, "Spell %d: Casting time %d (orig %d), mana cost %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", spell_id, cast_time, orgcasttime, mana_cost); // cast time is 0, just finish it right now and be done with it @@ -517,7 +517,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - mlog(SPELLS__BUFFS, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -756,7 +756,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - mlog(SPELLS__CASTING, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -816,7 +816,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - mlog(SPELLS__CASTING, "Spell %d has been interrupted.", spellid); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); if(!spellid) return; @@ -893,7 +893,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: spell reuse timer not expired", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -907,7 +907,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { Message_StringID(13, SPELL_RECAST); - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -916,7 +916,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!IsValidSpell(spell_id)) { - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: invalid spell id", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -927,7 +927,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(delaytimer) { - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: recast too quickly", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); Message(13, "You are unable to focus."); InterruptSpell(); return; @@ -937,7 +937,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: already casting", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); Message_StringID(13,ALREADY_CASTING); InterruptSpell(); return; @@ -952,7 +952,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - mlog(SPELLS__BARDS, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); } else { bardsong = spell_id; bardsong_slot = slot; @@ -962,7 +962,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, else bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); - mlog(SPELLS__BARDS, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1041,10 +1041,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - mlog(SPELLS__CASTING, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: interrupted.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; } @@ -1060,10 +1060,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - mlog(SPELLS__CASTING, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - mlog(SPELLS__CASTING, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, break; default: // some non-instrument component. Let it go, but record it in the log - mlog(SPELLS__CASTING_ERR, "Something odd happened: Song %d required component %s", spell_id, component); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - mlog(SPELLS__CASTING_ERR, "Song %d: Canceled. Missing required instrument %s", spell_id, component); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); if(c->GetGM()) c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1143,12 +1143,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, const Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); - mlog(SPELLS__CASTING_ERR, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - mlog(SPELLS__CASTING_ERR, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1169,7 +1169,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (component == -1) continue; component_count = spells[spell_id].component_counts[t_count]; - mlog(SPELLS__CASTING_ERR, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1234,7 +1234,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { Message_StringID(13, SPELL_RECAST); - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -1253,15 +1253,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - mlog(SPELLS__CASTING, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - mlog(SPELLS__CASTING, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - mlog(SPELLS__CASTING_ERR, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); Message(13, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1280,7 +1280,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - mlog(SPELLS__CASTING_ERR, "Casting of %d canceled: SpellFinished returned false.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); InterruptSpell(); return; } @@ -1309,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, this->CastToClient()->CheckSongSkillIncrease(spell_id); this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar); } - mlog(SPELLS__CASTING, "Bard song %d should be started", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); } else { @@ -1344,7 +1344,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, delaytimer = true; spellend_timer.Start(400,true); - mlog(SPELLS__CASTING, "Spell casting of %d is finished.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); } @@ -1474,7 +1474,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1487,7 +1487,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3)) { //invalid target - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1501,7 +1501,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target of body type %d (summoned pet)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1526,7 +1526,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); if(!spell_target) Message_StringID(13,SPELL_NEED_TAR); else @@ -1544,7 +1544,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (ldon object)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1552,14 +1552,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (normal)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (normal)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1568,7 +1568,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (normal)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1580,7 +1580,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (corpse)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1596,7 +1596,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (no pet)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); Message_StringID(13,NO_PET); return false; // can't cast these unless we have a target } @@ -1666,7 +1666,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (AOE)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1703,7 +1703,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1800,14 +1800,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - mlog(SPELLS__CASTING_ERR, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } @@ -1878,7 +1878,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - mlog(SPELLS__CASTING_ERR, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -1957,7 +1957,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) return(false); - mlog(SPELLS__CASTING, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -1968,7 +1968,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - mlog(SPELLS__CASTING, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -1977,7 +1977,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - mlog(SPELLS__CASTING, "Spell %d: cannot see target %s", spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); Message_StringID(13,CANT_SEE_TARGET); return false; } @@ -2008,13 +2008,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - mlog(SPELLS__CASTING, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - mlog(SPELLS__CASTING, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); Message_StringID(13, TARGET_TOO_CLOSE); return(false); } @@ -2043,7 +2043,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 #endif //BOTS if(spell_target == nullptr) { - mlog(SPELLS__CASTING, "Spell %d: Targeted spell, but we have no target", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2235,7 +2235,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // CastSpell already reduced the cost for it if we're a client with focus if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { - mlog(SPELLS__CASTING, "Spell %d: consuming %d mana", spell_id, mana_used); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2247,7 +2247,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF) { CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - mlog(SPELLS__CASTING, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2263,7 +2263,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(reduction) recast -= reduction; - mlog(SPELLS__CASTING, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2301,7 +2301,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(slot == USE_ITEM_SPELL_SLOT) { //bard songs should never come from items... - mlog(SPELLS__BARDS, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); return(false); } @@ -2309,12 +2309,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) { - mlog(SPELLS__BARDS, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - mlog(SPELLS__BARDS, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2323,18 +2323,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - mlog(SPELLS__BARDS, "Ran out of mana while singing song %d", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); return(false); } - mlog(SPELLS__CASTING, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - mlog(SPELLS__CASTING, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); Message_StringID(13, CANT_SEE_TARGET); return(false); } @@ -2349,7 +2349,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { float range2 = range * range; if(dist2 > range2) { //target is out of range. - mlog(SPELLS__BARDS, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } @@ -2365,10 +2365,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case SingleTarget: { if(spell_target == nullptr) { - mlog(SPELLS__BARDS, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); return(false); } - mlog(SPELLS__BARDS, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2386,7 +2386,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - mlog(SPELLS__BARDS, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2394,9 +2394,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - mlog(SPELLS__BARDS, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); } else { - mlog(SPELLS__BARDS, "Bard Song Pulse: spell %d, AE with no target", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2406,13 +2406,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case GroupSpell: { if(spell_target->IsGrouped()) { - mlog(SPELLS__BARDS, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - mlog(SPELLS__BARDS, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2429,7 +2429,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { } } else { - mlog(SPELLS__BARDS, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2455,13 +2455,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - mlog(SPELLS__BARDS, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - mlog(SPELLS__BARDS, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2559,7 +2559,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - mlog(SPELLS__BARDS, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2601,7 +2601,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - mlog(SPELLS__CASTING, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", spell_id, castlevel, formula, duration, res); return(res); @@ -2695,15 +2695,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - mlog(SPELLS__STACKING, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); // Same Spells and dot exemption is set to 1 or spell is Manaburn if (spellid1 == spellid2) { if (sp1.dot_stacking_exempt == 1 && caster1 != caster2) { // same caster can refresh - mlog(SPELLS__STACKING, "Blocking spell due to dot stacking exemption."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); return -1; } else if (spellid1 == 2751) { - mlog(SPELLS__STACKING, "Blocking spell because manaburn does not stack with itself."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); return -1; } } @@ -2735,7 +2735,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - mlog(SPELLS__STACKING, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2804,16 +2804,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - mlog(SPELLS__STACKING, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - mlog(SPELLS__STACKING, "Overwrite spell because sp1_value < overwrite_below_value"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - mlog(SPELLS__STACKING, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2827,22 +2827,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - mlog(SPELLS__STACKING, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - mlog(SPELLS__STACKING, "Blocking spell because sp2_Value < blocked_below_value"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - mlog(SPELLS__STACKING, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - mlog(SPELLS__STACKING, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -2905,13 +2905,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - mlog(SPELLS__STACKING, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - mlog(SPELLS__STACKING, "Blocking spell because complete heal never stacks or overwries"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -2923,7 +2923,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(sp_det_mismatch) { - mlog(SPELLS__STACKING, "The effects are the same but the spell types are not, passing the effect"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); continue; } @@ -2932,7 +2932,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - mlog(SPELLS__STACKING, "The spells are not the same and it is a detrimental dot, passing"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -2958,7 +2958,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - mlog(SPELLS__STACKING, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -2967,7 +2967,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - mlog(SPELLS__STACKING, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -2976,15 +2976,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - mlog(SPELLS__STACKING, "%s (%d) appears to be the single target version of %s (%d), rejecting", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - mlog(SPELLS__STACKING, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); return(1); } - mlog(SPELLS__STACKING, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); return 0; } @@ -3043,11 +3043,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - mlog(SPELLS__BUFFS, "Buff %d failed to add because its duration came back as 0.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); return -2; // no duration? this isn't a buff } - mlog(SPELLS__BUFFS, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3077,12 +3077,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - mlog(SPELLS__BUFFS, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - mlog(SPELLS__BUFFS, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite) @@ -3106,7 +3106,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - mlog(SPELLS__BUFFS, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3114,11 +3114,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - mlog(SPELLS__BUFFS, "Unable to find a buff slot for detrimental buff %d", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); return -1; } } else { - mlog(SPELLS__BUFFS, "Unable to find a buff slot for beneficial buff %d", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); return -1; } } @@ -3169,7 +3169,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - mlog(SPELLS__BUFFS, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3270,7 +3270,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - mlog(SPELLS__CASTING_ERR, "Unable to apply spell %d without a target", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); Message(13, "SOT: You must have a target for this spell."); return false; } @@ -3298,7 +3298,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r uint16 caster_level = GetCasterLevel(spell_id); - mlog(SPELLS__CASTING, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3378,7 +3378,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - mlog(SPELLS__BUFFS, "Spell %i not applied to %s as it is a Blocked Buff.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3386,7 +3386,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - mlog(SPELLS__BUFFS, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3395,7 +3395,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - mlog(SPELLS__CASTING_ERR, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3406,17 +3406,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - mlog(SPELLS__CASTING_ERR, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - mlog(SPELLS__CASTING_ERR, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - mlog(SPELLS__CASTING_ERR, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3525,9 +3525,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - mlog(SPELLS__CASTING_ERR, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - mlog(SPELLS__CASTING_ERR, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3537,7 +3537,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - mlog(SPELLS__CASTING_ERR, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); spelltar->Message_StringID(MT_SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3551,7 +3551,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - mlog(SPELLS__RESISTS, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3644,7 +3644,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - mlog(SPELLS__RESISTS, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ Message_StringID(MT_SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3692,7 +3692,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, isproc); - mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); if(aggro_amount > 0) spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; @@ -3709,7 +3709,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - mlog(SPELLS__BUFFS, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - mlog(SPELLS__CASTING_ERR, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_type != 1) // AA is handled differently Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3825,7 +3825,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - mlog(SPELLS__CASTING, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); return true; } @@ -4005,7 +4005,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - mlog(SPELLS__RESISTS, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4016,7 +4016,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - mlog(SPELLS__RESISTS, "We are immune to Mez spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); caster->Message_StringID(MT_Shout, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4034,7 +4034,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - mlog(SPELLS__RESISTS, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); return true; } @@ -4043,7 +4043,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - mlog(SPELLS__RESISTS, "We are immune to Slow spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4059,7 +4059,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - mlog(SPELLS__RESISTS, "We are immune to Fear spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4070,13 +4070,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - mlog(SPELLS__RESISTS, "Clients cannot fear eachother!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - mlog(SPELLS__RESISTS, "Level is %d, cannot be feared by this spell.", GetLevel()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); caster->Message_StringID(MT_Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id); if (aggro > 0) { @@ -4090,7 +4090,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (IsClient() && CastToClient()->CheckAAEffect(aaEffectWarcry)) { Message(13, "Your are immune to fear."); - mlog(SPELLS__RESISTS, "Clients has WarCry effect, immune to fear!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } @@ -4100,7 +4100,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - mlog(SPELLS__RESISTS, "We are immune to Charm spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); caster->Message_StringID(MT_Shout, CANNOT_CHARM); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4113,7 +4113,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - mlog(SPELLS__RESISTS, "You are immune to your own charms."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); caster->Message(MT_Shout, "You cannot charm yourself."); return true; } @@ -4126,7 +4126,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - mlog(SPELLS__RESISTS, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); return true; } @@ -4140,7 +4140,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - mlog(SPELLS__RESISTS, "We are immune to Snare spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4156,7 +4156,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - mlog(SPELLS__RESISTS, "You cannot lifetap yourself."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); return true; } @@ -4166,13 +4166,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - mlog(SPELLS__RESISTS, "You cannot sacrifice yourself."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); return true; } } - mlog(SPELLS__RESISTS, "No immunities to spell %d found.", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); return false; } @@ -4209,7 +4209,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - mlog(SPELLS__RESISTS, "We are immune to magic, so we fully resist the spell %d", spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); return(0); } @@ -4230,7 +4230,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - mlog(SPELLS__RESISTS, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; } } @@ -4248,7 +4248,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - mlog(SPELLS__RESISTS, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; } } @@ -4256,7 +4256,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE) { - mlog(SPELLS__RESISTS, "Spell was unresistable"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); return 100; } @@ -5089,23 +5089,23 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; - mlog(SPELLS__PROCS, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - mlog(SPELLS__PROCS, "Too many perma procs for %s", GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; - mlog(SPELLS__PROCS, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - mlog(SPELLS__PROCS, "Too many procs for %s", GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); } return false; } @@ -5116,7 +5116,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].spellID = SPELL_UNKNOWN; SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; - mlog(SPELLS__PROCS, "Removed proc %d from slot %d", spell_id, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); } } return true; @@ -5133,7 +5133,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - mlog(SPELLS__PROCS, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5148,7 +5148,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - mlog(SPELLS__PROCS, "Removed defensive proc %d from slot %d", spell_id, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); } } return true; @@ -5165,7 +5165,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - mlog(SPELLS__PROCS, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5180,7 +5180,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - mlog(SPELLS__PROCS, "Removed ranged proc %d from slot %d", spell_id, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); } } return true; @@ -5211,7 +5211,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - mlog(SPELLS__CASTING, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return(level); } From 25642f924e2d901486e6d9ab4da4e63cacc5811c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:04:43 -0600 Subject: [PATCH 0958/1883] port mlog 'Inventory' category to new log system --- zone/client_process.cpp | 2 +- zone/inventory.cpp | 108 ++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 5c9444ee0..fe89c942d 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -836,7 +836,7 @@ void Client::BulkSendInventoryItems() { if(inst) { bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - mlog(INVENTORY__ERROR, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 103728e83..3062db265 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check to make sure we are augmenting an augmentable item else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -229,7 +229,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -269,7 +269,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -292,7 +292,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -559,7 +559,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; @@ -815,7 +815,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { - mlog(INVENTORY__SLOTS, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); if (client_update) { @@ -831,7 +831,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { - mlog(INVENTORY__SLOTS, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == MainCursor) return PushItemOnCursor(inst, client_update); @@ -858,7 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) { - mlog(INVENTORY__SLOTS, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); m_inv.PutItem(slot_id, inst); SendLootItemInPacket(&inst, slot_id); @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); - mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); } @@ -1313,7 +1313,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - mlog(INVENTORY__SLOTS, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1321,7 +1321,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - mlog(INVENTORY__SLOTS, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1334,7 +1334,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->to_slot == (uint32)INVALID_INDEX) { if (move_in->from_slot == (uint32)MainCursor) { - mlog(INVENTORY__SLOTS, "Client destroyed item from cursor slot %d", move_in->from_slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit ItemInst *inst = m_inv.GetItem(MainCursor); @@ -1348,7 +1348,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item destroyed by client } else { - mlog(INVENTORY__SLOTS, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); return true; // Item deletion @@ -1388,7 +1388,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ItemInst* src_inst = m_inv.GetItem(src_slot_id); ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ - mlog(INVENTORY__SLOTS, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) @@ -1398,7 +1398,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } if (dst_inst) { - mlog(INVENTORY__SLOTS, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ @@ -1435,7 +1435,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { move_in->from_slot = dst_slot_check; move_in->to_slot = src_slot_check; move_in->number_in_stack = dst_inst->GetCharges(); - if(!SwapItem(move_in)) { mlog(INVENTORY__ERROR, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } + if(!SwapItem(move_in)) { logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } } return false; @@ -1577,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } if (with) { - mlog(INVENTORY__SLOTS, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor if (!m_inv[MainCursor]) { Message(13, "Error: Cursor item not located on server!"); @@ -1610,18 +1610,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->number_in_stack > 0) { // Determine if charged items can stack if(src_inst && !src_inst->IsStackable()) { - mlog(INVENTORY__ERROR, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); return false; } if (dst_inst) { if(src_inst->GetID() != dst_inst->GetID()) { - mlog(INVENTORY__ERROR, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); return(false); } if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) { //we have a chance of stacking. - mlog(INVENTORY__SLOTS, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); // Charges can be emptied into dst uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges(); if (usedcharges > move_in->number_in_stack) @@ -1633,15 +1633,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Depleted all charges? if (src_inst->GetCharges() < 1) { - mlog(INVENTORY__SLOTS, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); all_to_stack = true; } else { - mlog(INVENTORY__SLOTS, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } } else { - mlog(INVENTORY__ERROR, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); return false; } } @@ -1650,12 +1650,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) { // Move entire stack if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - mlog(INVENTORY__SLOTS, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); } else { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); - mlog(INVENTORY__SLOTS, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); @@ -1680,7 +1680,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { SetMaterial(dst_slot_id,src_inst->GetItem()->ID); } if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - mlog(INVENTORY__SLOTS, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) { if(src_inst) { @@ -1739,7 +1739,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { // resync the 'from' and 'to' slots on an as-needed basis // Not as effective as the full process, but less intrusive to gameplay -U - mlog(INVENTORY__ERROR, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { @@ -2071,7 +2071,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2080,7 +2080,7 @@ void Client::RemoveNoRent(bool client_update) { for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2089,7 +2089,7 @@ void Client::RemoveNoRent(bool client_update) { if (m_inv[MainPowerSource]) { const ItemInst* inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } @@ -2098,7 +2098,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2107,7 +2107,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } @@ -2116,7 +2116,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } @@ -2125,7 +2125,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } @@ -2134,7 +2134,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } @@ -2155,7 +2155,7 @@ void Client::RemoveNoRent(bool client_update) { inst = *iter; // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) - mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else m_inv.PushCursor(**iter); @@ -2178,7 +2178,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2193,7 +2193,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2208,7 +2208,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2223,7 +2223,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2238,7 +2238,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2253,7 +2253,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2281,7 +2281,7 @@ void Client::RemoveDuplicateLore(bool client_update) { inst = *iter; // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); iter = local.erase(iter); } @@ -2300,7 +2300,7 @@ void Client::RemoveDuplicateLore(bool client_update) { m_inv.PushCursor(**iter); } else { - mlog(INVENTORY__ERROR, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } safe_delete(*iter); @@ -2322,7 +2322,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2335,7 +2335,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); From 97e87f53dbaf2ceeaa86bcbf3df14e0b053cc5cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:16:44 -0600 Subject: [PATCH 0959/1883] port mlog 'Guilds' category to new log system --- zone/bot.cpp | 2 +- zone/client_packet.cpp | 68 +++++++++++++++++++++--------------------- zone/guild.cpp | 16 +++++----- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 611fb871c..2381e64f3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8441,7 +8441,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { return; } - // mlog(GUILDS__ACTIONS, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); + // logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 65fcd4cfe..68f537ab7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5832,7 +5832,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GetGuildMOTD"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); SendGuildMOTD(true); @@ -5845,7 +5845,7 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GetGuildsList"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); SendGuildList(); } @@ -7214,12 +7214,12 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildDelete"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); else { - mlog(GUILDS__ACTIONS, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); if (!guild_mgr.DeleteGuild(GuildID())) Message(0, "Guild delete failed."); else { @@ -7230,10 +7230,10 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildDemote"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); if (app->size != sizeof(GuildDemoteStruct)) { - mlog(GUILDS__ERROR, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); return; } @@ -7263,7 +7263,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) uint8 rank = gci.rank - 1; - mlog(GUILDS__ACTIONS, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", demote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7281,7 +7281,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildInvite"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7322,7 +7322,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) //we could send this to the member and prompt them to see if they want to //be demoted (I guess), but I dont see a point in that. - mlog(GUILDS__ACTIONS, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7341,7 +7341,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - mlog(GUILDS__ACTIONS, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7353,7 +7353,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); client->QueuePacket(app); } @@ -7376,7 +7376,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - mlog(GUILDS__ACTIONS, "Inviting %s (%d) into guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7386,7 +7386,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7409,7 +7409,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildInviteAccept"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); SetPendingGuildInvitation(false); @@ -7445,7 +7445,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - mlog(GUILDS__ACTIONS, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", gj->guildeqid, gj->response, gj->inviter, gj->newmember); //we dont really care a lot about what this packet means, as long as @@ -7459,7 +7459,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) if (gj->guildeqid == GuildID()) { //only need to change rank. - mlog(GUILDS__ACTIONS, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), gj->response, guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7471,7 +7471,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } else { - mlog(GUILDS__ACTIONS, "Adding %s (%d) to guild %s (%d) at rank %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", GetName(), CharacterID(), guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid, gj->response); @@ -7500,10 +7500,10 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildLeader"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); if (app->size < 2) { - mlog(GUILDS__ERROR, "Invalid length %d on OP_GuildLeader", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); return; } @@ -7522,7 +7522,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) Client* newleader = entity_list.GetClientByName(gml->target); if (newleader) { - mlog(GUILDS__ACTIONS, "Transfering leadership of %s (%d) to %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID(), newleader->GetName(), newleader->CharacterID()); @@ -7543,9 +7543,9 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Got OP_GuildManageBanker of len %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); if (app->size != sizeof(GuildManageBanker_Struct)) { - mlog(GUILDS__ERROR, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; } GuildManageBanker_Struct* gmb = (GuildManageBanker_Struct*)app->pBuffer; @@ -7620,16 +7620,16 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Got OP_GuildPeace of len %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildPromote"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); if (app->size != sizeof(GuildPromoteStruct)) { - mlog(GUILDS__ERROR, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); return; } @@ -7658,7 +7658,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) return; - mlog(GUILDS__ACTIONS, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", promote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7675,7 +7675,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildPublicNote"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7694,7 +7694,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) return; } - mlog(GUILDS__ACTIONS, "Setting public note on %s (%d) in guild %s (%d) to: %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", gpn->target, gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID(), gpn->note); @@ -7711,7 +7711,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_GuildRemove"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7741,7 +7741,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = client->CharacterID(); - mlog(GUILDS__ACTIONS, "Removing %s (%d) from guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7757,7 +7757,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = gci.char_id; - mlog(GUILDS__ACTIONS, "Removing remote/offline %s (%d) into guild %s (%d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", gci.char_name.c_str(), gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7867,7 +7867,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Got OP_GuildWar of len %d", app->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); return; } @@ -11848,7 +11848,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { - mlog(GUILDS__IN_PACKETS, "Received OP_SetGuildMOTD"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild @@ -11866,7 +11866,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) GuildMOTD_Struct* gmotd = (GuildMOTD_Struct*)app->pBuffer; - mlog(GUILDS__ACTIONS, "Setting MOTD for %s (%d) to: %s - %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", guild_mgr.GetGuildName(GuildID()), GuildID(), GetName(), gmotd->motd); if (!guild_mgr.SetGuildMOTD(GuildID(), gmotd->motd, GetName())) { diff --git a/zone/guild.cpp b/zone/guild.cpp index 0bc5186de..86a4c06dd 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } - mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMOTD of length %d", outapp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -144,10 +144,10 @@ void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); - mlog(GUILDS__OUT_PACKETS, "Sending spawn appearance for no guild tag."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); - mlog(GUILDS__OUT_PACKETS, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if(GetClientVersion() >= EQClientRoF) { @@ -171,11 +171,11 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size); if(outapp->pBuffer == nullptr) { - mlog(GUILDS__ERROR, "Unable to make guild list!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); return; } - mlog(GUILDS__OUT_PACKETS, "Sending OP_ZoneGuildList of length %d", outapp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -192,7 +192,7 @@ void Client::SendGuildMembers() { outapp->pBuffer = data; data = nullptr; - mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildMemberList of length %d", outapp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); @@ -223,7 +223,7 @@ void Client::RefreshGuildInfo() CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { - mlog(GUILDS__ERROR, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } @@ -335,7 +335,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->rank = gj->rank; outgj->zoneid = gj->zoneid; - mlog(GUILDS__OUT_PACKETS, "Sending OP_GuildManageAdd for join of length %d", outapp->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); FastQueuePacket(&outapp); From d4f2e0ce5f83b70a6bb4bff70ee7dbe84ca22e90 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:20:01 -0600 Subject: [PATCH 0960/1883] port mlog 'AI' category to new log system --- common/eqemu_logsys.h | 4 +++- zone/bot.cpp | 6 ++--- zone/botspellsai.cpp | 4 ++-- zone/merc.cpp | 4 ++-- zone/mob_ai.cpp | 12 +++++----- zone/spells.cpp | 8 +++---- zone/waypoints.cpp | 54 +++++++++++++++++++++---------------------- 7 files changed, 47 insertions(+), 45 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2ce906b41..00090cf24 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -75,6 +75,7 @@ public: Aggro, Attack, Quests, + AI, MaxCategoryID /* Don't Remove this*/ }; @@ -140,7 +141,8 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Client_Server_Packet", "Aggro", "Attack", - "Quests" + "Quests", + "AI" }; #endif \ No newline at end of file diff --git a/zone/bot.cpp b/zone/bot.cpp index 2381e64f3..3552ec6c5 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3362,7 +3362,7 @@ void Bot::AI_Process() { else if(!IsRooted()) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { - mlog(AI__WAYPOINTS, "Returning to location prior to being summoned."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); return; @@ -3689,7 +3689,7 @@ void Bot::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -3972,7 +3972,7 @@ void Bot::PetAIProcess() { { botPet->SetRunAnimSpeed(0); if(!botPet->IsRooted()) { - mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed()); return; } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index a5be7341e..5ee57305b 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -950,7 +950,7 @@ bool Bot::AI_PursueCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - mlog(AI__SPELLS, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { @@ -1055,7 +1055,7 @@ bool Bot::AI_EngagedCastCheck() { BotStanceType botStance = GetBotStance(); bool mayGetAggro = HasOrMayGetAggro(); - mlog(AI__SPELLS, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); if(botClass == CLERIC) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { diff --git a/zone/merc.cpp b/zone/merc.cpp index f482ab71a..ec5a74308 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1647,7 +1647,7 @@ void Merc::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -1766,7 +1766,7 @@ bool Merc::AI_EngagedCastCheck() { { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - mlog(AI__SPELLS, "Engaged autocast check triggered (MERCS)."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); int8 mercClass = GetClass(); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e359194b5..a42e6157b 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1404,7 +1404,7 @@ void Mob::AI_Process() { else if (AImovement_timer->Check()) { if(!IsRooted()) { - mlog(AI__WAYPOINTS, "Pursuing %s while engaged.", target->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); if(!RuleB(Pathing, Aggro) || !zone->pathing) CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed()); else @@ -1639,7 +1639,7 @@ void NPC::AI_DoMovement() { roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } - mlog(AI__WAYPOINTS, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) { @@ -1727,7 +1727,7 @@ void NPC::AI_DoMovement() { { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) { // are we there yet? then stop - mlog(AI__WAYPOINTS, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1809,7 +1809,7 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - mlog(AI__WAYPOINTS, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); ClearFeignMemory(); moved=false; SetMoving(false); @@ -1934,7 +1934,7 @@ bool NPC::AI_EngagedCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - mlog(AI__SPELLS, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); // try casting a heal or gate if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) { @@ -1957,7 +1957,7 @@ bool NPC::AI_PursueCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - mlog(AI__SPELLS, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { //no spell cast, try again soon. AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false); diff --git a/zone/spells.cpp b/zone/spells.cpp index d3b2c3e4b..9dcc8a461 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3207,7 +3207,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) { int i, ret, firstfree = -2; - mlog(AI__BUFFS, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) @@ -3231,19 +3231,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) if(ret == 1) { // should overwrite current slot if(iFailIfOverwrite) { - mlog(AI__BUFFS, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return(-1); } if(firstfree == -2) firstfree = i; } if(ret == -1) { - mlog(AI__BUFFS, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } } - mlog(AI__BUFFS, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); return firstfree; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 203deacfa..5437d838d 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -166,7 +166,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if (GetGrid() < 0) { // currently stopped by a quest command SetGrid( 0 - GetGrid()); // get him moving again - mlog(AI__WAYPOINTS, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); } AIwalking_timer->Disable(); // disable timer in case he is paused at a wp if (cur_wp>=0) @@ -174,14 +174,14 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - mlog(AI__WAYPOINTS, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - mlog(AI__WAYPOINTS, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); } if (saveguardspot) { @@ -196,7 +196,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if(guard_heading == -1) guard_heading = this->CalculateHeadingToTarget(mtx, mty); - mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } cur_wp_x = mtx; @@ -212,7 +212,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) void NPC::UpdateWaypoint(int wp_index) { if(wp_index >= static_cast(Waypoints.size())) { - mlog(AI__WAYPOINTS, "Update to waypoint %d failed. Not found.", wp_index); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); return; } std::vector::iterator cur; @@ -224,7 +224,7 @@ void NPC::UpdateWaypoint(int wp_index) cur_wp_z = cur->z; cur_wp_pause = cur->pause; cur_wp_heading = cur->heading; - mlog(AI__WAYPOINTS, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) @@ -430,7 +430,7 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { - mlog(AI__WAYPOINTS, "Clearing guard order."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); guard_x = 0; guard_y = 0; guard_z = 0; @@ -443,14 +443,14 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler - mlog(AI__WAYPOINTS, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } } void NPC::NextGuardPosition() { if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { SetHeading(guard_heading); - mlog(AI__WAYPOINTS, "Unable to move to next guard position. Probably rooted."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); } else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) { @@ -516,15 +516,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if(z_pos-z != 0) { z_pos = z; - mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } - mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) { - mlog(AI__WAYPOINTS, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); @@ -550,7 +550,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; - mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); uint8 NPCFlyMode = 0; @@ -569,7 +569,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -612,7 +612,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -647,7 +647,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b z_pos = new_z; tar_ndx=22-numsteps; heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } else { @@ -659,7 +659,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = y; z_pos = z; - mlog(AI__WAYPOINTS, "Only a single step to get there... jumping."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); } } @@ -678,7 +678,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; heading = CalculateHeadingToTarget(x, y); - mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } uint8 NPCFlyMode = 0; @@ -698,7 +698,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -759,7 +759,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec moved=false; } SetRunAnimSpeed(0); - mlog(AI__WAYPOINTS, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); return true; } @@ -773,7 +773,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - mlog(AI__WAYPOINTS, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -790,7 +790,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = x; y_pos = y; z_pos = z; - mlog(AI__WAYPOINTS, "Close enough, jumping to waypoint"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); } else { float new_x = x_pos + tar_vx*tar_vector; @@ -803,7 +803,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = new_x; y_pos = new_y; z_pos = new_z; - mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); } uint8 NPCFlyMode = 0; @@ -823,7 +823,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -951,7 +951,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { x_pos = new_x; y_pos = new_y; z_pos = new_z; - mlog(AI__WAYPOINTS, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) return; @@ -967,7 +967,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -998,7 +998,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; From c9589dce2173ca63d7ba83c998c8dd863b9b6cbd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:21:51 -0600 Subject: [PATCH 0961/1883] Add 'Combat' log category --- common/eqemu_logsys.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 00090cf24..1bc5d93f3 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -76,6 +76,7 @@ public: Attack, Quests, AI, + Combat, MaxCategoryID /* Don't Remove this*/ }; @@ -142,7 +143,8 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Aggro", "Attack", "Quests", - "AI" + "AI", + "Combat" }; #endif \ No newline at end of file From 6a567288ae0d7527df2804510c558e0584448aea Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:22:53 -0600 Subject: [PATCH 0962/1883] port mlog 'Combat' category to new log system --- zone/attack.cpp | 124 +++++++++++++++++++-------------------- zone/bot.cpp | 62 ++++++++++---------- zone/mob.cpp | 2 +- zone/special_attacks.cpp | 56 +++++++++--------- zone/spell_effects.cpp | 4 +- 5 files changed, 124 insertions(+), 124 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 4e3aa3c2f..1bf858cf9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -370,7 +370,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && other->InFrontMob(this, other->GetX(), other->GetY())) { damage = -3; - mlog(COMBAT__DAMAGE, "I am enraged, riposting frontal attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -517,7 +517,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - mlog(COMBAT__DAMAGE, "Final damage after all avoidances: %d", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -690,9 +690,9 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; - mlog(COMBAT__DAMAGE, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); } else { - mlog(COMBAT__DAMAGE, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); } } @@ -1135,7 +1135,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(!GetTarget()) SetTarget(other); - mlog(COMBAT__ATTACKS, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); //SetAttackTimer(); if ( @@ -1145,12 +1145,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b || (GetHP() < 0) || (!IsAttackAllowed(other)) ) { - mlog(COMBAT__ATTACKS, "Attack canceled, invalid circumstances."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); return false; // Only bards can attack while casting } if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm - mlog(COMBAT__ATTACKS, "Attack canceled, Divine Aura is in effect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable! return false; } @@ -1170,19 +1170,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - mlog(COMBAT__ATTACKS, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - mlog(COMBAT__ATTACKS, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - mlog(COMBAT__ATTACKS, "Attacking without a weapon."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - mlog(COMBAT__ATTACKS, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -1200,7 +1200,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(IsBerserk() && GetClass() == BERSERKER){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - mlog(COMBAT__DAMAGE, "Berserker damage bonus increases DMG to %d", weapon_damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -1268,7 +1268,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); - mlog(COMBAT__DAMAGE, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); int hit_chance_bonus = 0; @@ -1283,7 +1283,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { - mlog(COMBAT__ATTACKS, "Attack missed. Damage set to 0."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it other->AvoidDamage(this, damage); @@ -1291,7 +1291,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -1430,7 +1430,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } int exploss = 0; - mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); /* #1: Send death packet to everyone @@ -1710,7 +1710,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (other->IsClient()) other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); - mlog(COMBAT__ATTACKS, "I am not allowed to attack %s", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); } return false; } @@ -1737,10 +1737,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { - mlog(COMBAT__ATTACKS, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); if(Hand == MainSecondary && weapon->ItemType == ItemTypeShield){ - mlog(COMBAT__ATTACKS, "Attack with shield canceled."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); return false; } @@ -1829,11 +1829,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { - mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { - mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } @@ -1846,7 +1846,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if(other->IsClient() && other->CastToClient()->IsSitting()) { - mlog(COMBAT__DAMAGE, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); damage = (max_dmg+eleBane); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); @@ -1857,7 +1857,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool hate += opts->hate_flat; } - mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list other->AddToHateList(this, hate); @@ -1881,7 +1881,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(damage > 0) { CommonOutgoingHitSuccess(other, damage, skillinuse); } - mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list if(damage > 0) other->AddToHateList(this, hate); @@ -1890,7 +1890,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } } - mlog(COMBAT__DAMAGE, "Final damage against %s: %d", other->GetName(), damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); if(other->IsClient() && IsPet() && GetOwner()->IsClient()) { //pets do half damage to clients in pvp @@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //cant riposte a riposte if (bRiposte && damage == -3) { - mlog(COMBAT__DAMAGE, "Riposte of riposte canceled."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); return false; } @@ -1954,7 +1954,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - mlog(COMBAT__HITS, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -1991,7 +1991,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { - mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); Mob *oos = nullptr; if(killerMob) { @@ -2580,7 +2580,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(DS == 0 && rev_ds == 0) return; - mlog(COMBAT__HITS, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); //invert DS... spells yield negative values for a true damage shield if(DS < 0) { @@ -2625,7 +2625,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID; if(rev_ds < 0) { - mlog(COMBAT__HITS, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } @@ -3437,11 +3437,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == SkillAbjuration); - mlog(COMBAT__HITS, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); if (GetInvul() || DivineAura()) { - mlog(COMBAT__DAMAGE, "Avoiding %d damage due to invulnerability.", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } @@ -3493,7 +3493,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int healed = damage; healed = attacker->GetActSpellHealing(spell_id, healed); - mlog(COMBAT__DAMAGE, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); attacker->HealDamage(healed); //we used to do a message to the client, but its gone now. @@ -3516,7 +3516,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if any runes want to reduce this damage if(spell_id == SPELL_UNKNOWN) { damage = ReduceDamage(damage); - mlog(COMBAT__HITS, "Melee Damage reduced to %d", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); damage = ReduceAllDamage(damage); TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker); } else { @@ -3573,7 +3573,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //fade mez if we are mezzed if (IsMezzed() && attacker) { - mlog(COMBAT__HITS, "Breaking mez due to attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); @@ -3616,7 +3616,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; - mlog(COMBAT__HITS, "Stun passed, checking resists. Was %d chance.", stun_chance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); if (IsClient()) { stun_resist += aabonuses.StunResist; frontal_stun_resist += aabonuses.FrontalStunResist; @@ -3626,20 +3626,20 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (((GetBaseRace() == OGRE && IsClient()) || (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { - mlog(COMBAT__HITS, "Frontal stun resisted. %d chance.", frontal_stun_resist); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - mlog(COMBAT__HITS, "Stun Resisted. %d chance.", stun_resist); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); } else { - mlog(COMBAT__HITS, "Stunned. %d resist chance.", stun_resist); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { - mlog(COMBAT__HITS, "Stun failed. %d chance.", stun_chance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); } } @@ -3653,7 +3653,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //increment chances of interrupting if(IsCasting()) { //shouldnt interrupt on regular spell damage attacked_count++; - mlog(COMBAT__HITS, "Melee attack while casting. Attack count %d", attacked_count); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); } } @@ -3859,7 +3859,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) ProcChance += ProcChance * ProcBonus / 100.0f; } - mlog(COMBAT__PROCS, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3878,7 +3878,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; ProcChance = ProcChance + (ProcChance * ProcBonus); - mlog(COMBAT__PROCS, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3923,12 +3923,12 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { } if (!IsAttackAllowed(on)) { - mlog(COMBAT__PROCS, "Preventing procing off of unattackable things."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); return; } if (DivineAura()) { - mlog(COMBAT__PROCS, "Procs canceled, Divine Aura is in effect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); return; } @@ -3975,7 +3975,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level); if (IsPet()) { @@ -3986,7 +3986,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on Message_StringID(13, PROC_TOOLOW); } } else { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100); ExecWeaponProc(inst, weapon->Proc.Effect, on); @@ -4065,12 +4065,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); ExecWeaponProc(nullptr, PermaProcs[i].spellID, on); } else { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); } @@ -4080,13 +4080,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); } else { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d failed to proc %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); } @@ -4096,13 +4096,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); } else { - mlog(COMBAT__PROCS, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d failed to proc %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); } @@ -4352,7 +4352,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Mob::DoRiposte(Mob* defender) { - mlog(COMBAT__ATTACKS, "Preforming a riposte"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -4370,7 +4370,7 @@ void Mob::DoRiposte(Mob* defender) { //Live AA - Double Riposte if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - mlog(COMBAT__ATTACKS, "Preforming a double riposed (%d percent chance)", DoubleRipChance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; } @@ -4381,7 +4381,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - mlog(COMBAT__ATTACKS, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); @@ -4398,7 +4398,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ int dmgbonusmod = 0; dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3; dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5; - mlog(COMBAT__DAMAGE, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); damage += (damage*dmgbonusmod/10000); } } @@ -4692,13 +4692,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); - mlog(COMBAT__HITS, "Spell broke root! BreakChance percent chance"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); return true; } } } - mlog(COMBAT__HITS, "Spell did not break root. BreakChance percent chance"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); return false; } @@ -4770,19 +4770,19 @@ void Mob::CommonBreakInvisible() { //break invis when you attack if(invisible) { - mlog(COMBAT__ATTACKS, "Removing invisibility due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - mlog(COMBAT__ATTACKS, "Removing invisibility vs. undead due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - mlog(COMBAT__ATTACKS, "Removing invisibility vs. animals due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 3552ec6c5..fb3f86c90 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2979,7 +2979,7 @@ void Bot::BotRangedAttack(Mob* other) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { - mlog(COMBAT__RANGED, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -2997,7 +2997,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!RangeWeapon || !Ammo) return; - mlog(COMBAT__RANGED, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); if(!IsAttackAllowed(other) || IsCasting() || @@ -3015,19 +3015,19 @@ void Bot::BotRangedAttack(Mob* other) { //break invis when you attack if(invisible) { - mlog(COMBAT__ATTACKS, "Removing invisibility due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - mlog(COMBAT__ATTACKS, "Removing invisibility vs. undead due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - mlog(COMBAT__ATTACKS, "Removing invisibility vs. animals due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -5959,7 +5959,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - mlog(COMBAT__HITS, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); parse->EventNPC(EVENT_ATTACK, this, from, "", 0); } @@ -5972,7 +5972,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ // if spell is lifetap add hp to the caster if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { int healed = GetActSpellHealing(spell_id, damage); - mlog(COMBAT__DAMAGE, "Applying lifetap heal of %d to %s", healed, GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); HealDamage(healed); entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() ); } @@ -6024,7 +6024,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(!GetTarget() || GetTarget() != other) SetTarget(other); - mlog(COMBAT__ATTACKS, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || @@ -6036,13 +6036,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); if(other) { RemoveFromHateList(other); - mlog(COMBAT__ATTACKS, "I am not allowed to attack %s", other->GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); } return false; } if(DivineAura()) {//cant attack while invulnerable - mlog(COMBAT__ATTACKS, "Attack canceled, Divine Aura is in effect."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); return false; } @@ -6068,19 +6068,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - mlog(COMBAT__ATTACKS, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - mlog(COMBAT__ATTACKS, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - mlog(COMBAT__ATTACKS, "Attacking without a weapon."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - mlog(COMBAT__ATTACKS, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -6098,7 +6098,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(berserk && (GetClass() == BERSERKER)){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - mlog(COMBAT__DAMAGE, "Berserker damage bonus increases DMG to %d", weapon_damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -6163,7 +6163,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b else damage = zone->random.Int(min_hit, max_hit); - mlog(COMBAT__DAMAGE, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); if(opts) { @@ -6175,7 +6175,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(other, skillinuse, Hand)) { - mlog(COMBAT__ATTACKS, "Attack missed. Damage set to 0."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; other->AddToHateList(this, 0); } else { //we hit, try to avoid it @@ -6185,13 +6185,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b ApplyMeleeDamageBonus(skillinuse, damage); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); TryCriticalHit(other, skillinuse, damage, opts); - mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetCleanName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); // now add done damage to the hate list //other->AddToHateList(this, hate); } else other->AddToHateList(this, 0); - mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -6253,19 +6253,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //break invis when you attack if(invisible) { - mlog(COMBAT__ATTACKS, "Removing invisibility due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - mlog(COMBAT__ATTACKS, "Removing invisibility vs. undead due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - mlog(COMBAT__ATTACKS, "Removing invisibility vs. animals due to melee attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -7378,7 +7378,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { ProcChance += ProcChance*ProcBonus / 100.0f; } - mlog(COMBAT__PROCS, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -7414,7 +7414,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && !other->BehindMob(this, other->GetX(), other->GetY())) { damage = -3; - mlog(COMBAT__DAMAGE, "I am enraged, riposting frontal attack."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -7556,7 +7556,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - mlog(COMBAT__DAMAGE, "Final damage after all avoidances: %d", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -7609,14 +7609,14 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint16 levelreq = aabonuses.FinishingBlowLvl[0]; if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ - mlog(COMBAT__ATTACKS, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); return true; } else { - mlog(COMBAT__ATTACKS, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -7624,7 +7624,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Bot::DoRiposte(Mob* defender) { - mlog(COMBAT__ATTACKS, "Preforming a riposte"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -7637,7 +7637,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { - mlog(COMBAT__ATTACKS, "Preforming a double riposte (%d percent chance)", DoubleRipChance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); } @@ -8207,7 +8207,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { - mlog(COMBAT__ATTACKS, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW //entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s has scored a leathal HEADSHOT!", GetName()); @@ -8215,7 +8215,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { Result = true; } else { - mlog(COMBAT__ATTACKS, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 3ea572eb6..d63cdf0f7 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -4536,7 +4536,7 @@ void Mob::MeleeLifeTap(int32 damage) { if(lifetap_amt && damage > 0){ lifetap_amt = damage * lifetap_amt / 100; - mlog(COMBAT__DAMAGE, "Melee lifetap healing for %d damage.", damage); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 5255ff1f6..bf8d875b8 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -683,7 +683,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - mlog(COMBAT__RANGED, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -695,12 +695,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const ItemInst* Ammo = m_inv[MainAmmo]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(MainRange)); return; } if (!Ammo || !Ammo->IsType(ItemClassCommon)) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(MainAmmo)); return; } @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const Item_Struct* AmmoItem = Ammo->GetItem(); if(RangeItem->ItemType != ItemTypeBow) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } if(AmmoItem->ItemType != ItemTypeArrow) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); return; } - mlog(COMBAT__RANGED, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -746,7 +746,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Ammo = baginst; ammo_slot = m_inv.CalcSlotId(r, i); found = true; - mlog(COMBAT__RANGED, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); break; } } @@ -761,17 +761,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (aslot != INVALID_INDEX) { ammo_slot = aslot; Ammo = m_inv[aslot]; - mlog(COMBAT__RANGED, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); } } } float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); - mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -799,9 +799,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); - mlog(COMBAT__RANGED, "Consumed one arrow from slot %d", ammo_slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); } else { - mlog(COMBAT__RANGED, "Endless Quiver prevented ammo consumption."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); } CheckIncreaseSkill(SkillArchery, GetTarget(), -15); @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillArchery); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { - mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); @@ -882,7 +882,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { - mlog(COMBAT__RANGED, "Ranged attack hit %s.", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); @@ -923,7 +923,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - mlog(COMBAT__RANGED, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ @@ -944,7 +944,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - mlog(COMBAT__RANGED, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); } } @@ -1192,7 +1192,7 @@ void NPC::RangedAttack(Mob* other) //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){ - mlog(COMBAT__RANGED, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -1361,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - mlog(COMBAT__RANGED, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -1371,19 +1371,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 const ItemInst* RangeWeapon = m_inv[MainRange]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(MainRange)); return; } const Item_Struct* item = RangeWeapon->GetItem(); if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { - mlog(COMBAT__RANGED, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(MainRange)); return; } - mlog(COMBAT__RANGED, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1392,7 +1392,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //more in the ammo slot, use it RangeWeapon = AmmoItem; ammo_slot = MainAmmo; - mlog(COMBAT__RANGED, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal); @@ -1400,17 +1400,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //the item wont change, but the instance does, not that it matters ammo_slot = aslot; RangeWeapon = m_inv[aslot]; - mlog(COMBAT__RANGED, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } } } float range = item->Range + GetRangeDistTargetSizeMod(other); - mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1489,7 +1489,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillThrowing); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ - mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; @@ -1497,7 +1497,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { - mlog(COMBAT__RANGED, "Throwing attack hit %s.", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); int16 WDmg = 0; @@ -1533,7 +1533,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - mlog(COMBAT__RANGED, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) other->AvoidDamage(this, TotalDmg, false); //CanRiposte=false - Can not riposte throw attacks. diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 217172e8b..f666c62ce 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -711,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) stun_resist += aabonuses.StunResist; if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { - mlog(COMBAT__HITS, "Stunned. We had %d percent resist chance.", stun_resist); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -721,7 +721,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - mlog(COMBAT__HITS, "Stun Resisted. We had %d percent resist chance.", stun_resist); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); } } break; From 1405d9e114b868df2ab9bb90169b4641f53bbe6a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:28:25 -0600 Subject: [PATCH 0963/1883] port mlog 'CLIENT__SPELLS' category to new log system --- zone/client_packet.cpp | 1 - zone/mob.cpp | 4 ++-- zone/spells.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 68f537ab7..3f021640e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5119,7 +5119,6 @@ void Client::Handle_OP_Death(const EQApplicationPacket *app) //I think this attack_skill value is really a value from SkillDamageTypes... if (ds->attack_skill > HIGHEST_SKILL) { - mlog(CLIENT__ERROR, "Invalid skill in OP_Death: %d"); return; } diff --git a/zone/mob.cpp b/zone/mob.cpp index d63cdf0f7..7cfc58bcc 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1576,7 +1576,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, entity_list.QueueClients(this, outapp); safe_delete(outapp); - mlog(CLIENT__SPELLS, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } @@ -3043,7 +3043,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - mlog(CLIENT__SPELLS, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); } return; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 9dcc8a461..1b4de2406 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4822,7 +4822,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - mlog(CLIENT__SPELLS, "Spell %d memorized into slot %d", spell_id, slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4837,7 +4837,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > MAX_PP_MEMSPELL || slot < 0) return; - mlog(CLIENT__SPELLS, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4870,7 +4870,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - mlog(CLIENT__SPELLS, "Spell %d scribed into spell book slot %d", spell_id, slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); if(update_client) { @@ -4883,7 +4883,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= MAX_PP_SPELLBOOK || slot < 0) return; - mlog(CLIENT__SPELLS, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -4914,7 +4914,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - mlog(CLIENT__SPELLS, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); From 5b41bdeec64fb13724fdd32e15674cad939b4779 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:30:58 -0600 Subject: [PATCH 0964/1883] port mlog 'CLIENT__TRADING' category to new log system --- zone/client_process.cpp | 2 +- zone/trading.cpp | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index fe89c942d..81c0f384f 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -799,7 +799,7 @@ void Client::OnDisconnect(bool hard_disconnect) { Mob *Other = trade->With(); if(Other) { - mlog(TRADING__CLIENT, "Client disconnected during a trade. Returning their items."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) diff --git a/zone/trading.cpp b/zone/trading.cpp index 12fc01a64..4c06dfc42 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -458,7 +458,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool qs_log = false; if(other) { - mlog(TRADING__CLIENT, "Finishing trade with client %s", other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); @@ -491,7 +491,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst && inst->IsType(ItemClassContainer)) { - mlog(TRADING__CLIENT, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -499,7 +499,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - mlog(TRADING__CLIENT, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - mlog(TRADING__ERROR, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - mlog(TRADING__ERROR, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - mlog(TRADING__ERROR, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st inst->SetCharges(0); } - mlog(TRADING__CLIENT, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); if (other->PutItemInInventory(partial_slot, *partial_inst, true)) { - mlog(TRADING__CLIENT, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - mlog(TRADING__ERROR, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges())); inst->SetCharges(old_charges); @@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst) { - mlog(TRADING__CLIENT, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - mlog(TRADING__CLIENT, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -772,17 +772,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - mlog(TRADING__ERROR, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - mlog(TRADING__ERROR, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - mlog(TRADING__ERROR, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } From a46c0ee7e2dcf094c4b0e4d9cb91525443c19c5b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:32:45 -0600 Subject: [PATCH 0965/1883] Add 'Pathing' log category --- common/eqemu_logsys.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 1bc5d93f3..3cce91ebe 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -77,6 +77,7 @@ public: Quests, AI, Combat, + Pathing, MaxCategoryID /* Don't Remove this*/ }; @@ -144,7 +145,8 @@ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "Attack", "Quests", "AI", - "Combat" + "Combat", + "Pathing" }; #endif \ No newline at end of file From 648494ec16f90334c09c5ca5d5b83afadefbf329 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:33:48 -0600 Subject: [PATCH 0966/1883] port mlog '*PATHING*' category to new log system --- zone/mob_ai.cpp | 6 +++--- zone/waypoints.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index a42e6157b..699bd1dea 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1692,11 +1692,11 @@ void NPC::AI_DoMovement() { else { movetimercompleted=false; - mlog(QUESTS__PATHING, "We are departing waypoint %d.", cur_wp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); //if we were under quest control (with no grid), we are done now.. if(cur_wp == -2) { - mlog(QUESTS__PATHING, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; } @@ -1773,7 +1773,7 @@ void NPC::AI_DoMovement() { if (movetimercompleted==true) { // time to pause has ended SetGrid( 0 - GetGrid()); // revert to AI control - mlog(QUESTS__PATHING, "Quest pathing is finished. Resuming on grid %d", GetGrid()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 5437d838d..45f8db13f 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -88,7 +88,7 @@ void NPC::StopWandering() roamer=false; CastToNPC()->SetGrid(0); SendPosition(); - mlog(QUESTS__PATHING, "Stop Wandering requested."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); return; } @@ -107,11 +107,11 @@ void NPC::ResumeWandering() cur_wp=save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here } - mlog(QUESTS__PATHING, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); } else if (AIwalking_timer->Enabled()) { // we are at a waypoint paused normally - mlog(QUESTS__PATHING, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); AIwalking_timer->Trigger(); // disable timer to end pause now } else @@ -143,7 +143,7 @@ void NPC::PauseWandering(int pausetime) if (GetGrid() != 0) { DistractedFromGrid = true; - mlog(QUESTS__PATHING, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); SendPosition(); if (pausetime<1) { // negative grid number stops him dead in his tracks until ResumeWandering() From 0641be187da73a1e1ce3ac2f3864016bf0894014 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:46:26 -0600 Subject: [PATCH 0967/1883] Convert Client unhandled incoming opcodes --- zone/attack.cpp | 2 +- zone/client_packet.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 1bf858cf9..fdb95e467 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3506,7 +3506,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse()) { if (!pet->IsHeld()) { - mlog(PETS__AGGRO, "Sending pet %s into battle due to attack.", pet->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); pet->AddToHateList(attacker, 1); pet->SetTarget(attacker); Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName()); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3f021640e..561b7ba90 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -458,18 +458,20 @@ int Client::HandlePacket(const EQApplicationPacket *app) args.push_back(const_cast(app)); parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); -#if (EQDEBUG >= 10) + char buffer[64]; app->build_header_dump(buffer); - mlog(CLIENT__NET_ERR, "Unhandled incoming opcode: %s", buffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s", buffer); - if(app->size < 1000) - DumpPacket(app, app->size); - else{ - std::cout << "Dump limited to 1000 characters:\n"; - DumpPacket(app, 1000); + if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console == 1){ + if (app->size < 1000) + DumpPacket(app, app->size); + else{ + std::cout << "Dump limited to 1000 characters:\n"; + DumpPacket(app, 1000); + } } -#endif + break; } From b0412101b0106f3df431a5b1abb5756b3f1d406d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:48:50 -0600 Subject: [PATCH 0968/1883] Convert Client::HandlePaclet --- zone/client_packet.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 561b7ba90..b45f69e7b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -400,7 +400,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) if(is_log_enabled(CLIENT__NET_IN_TRACE)) { char buffer[64]; app->build_header_dump(buffer); - mlog(CLIENT__NET_IN_TRACE, "Dispatch opcode: %s", buffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); } EmuOpcode opcode = app->GetOpcode(); @@ -459,11 +459,10 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); - char buffer[64]; - app->build_header_dump(buffer); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s", buffer); - - if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console == 1){ + char buffer[64]; + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s", buffer); + if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ + app->build_header_dump(buffer); if (app->size < 1000) DumpPacket(app, app->size); else{ From 483086dc3a4c422f7f43a5eef55153b6f8cbbeed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:50:29 -0600 Subject: [PATCH 0969/1883] Convert OPGMTrainSkill mlogs --- zone/client_process.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 81c0f384f..2d64eed51 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1723,12 +1723,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; if(!CanHaveSkill(skill)) { - mlog(CLIENT__ERROR, "Tried to train skill %d, which is not allowed.", skill); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); return; } if(MaxSkill(skill) == 0) { - mlog(CLIENT__ERROR, "Tried to train skill %d, but training is not allowed at this level.", skill); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); return; } From d490209c9ec9b1eb8c7c8959ae3418cef2668c8a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:52:30 -0600 Subject: [PATCH 0970/1883] Convert skill mlog call --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index bf8d875b8..cb4b77f78 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -464,7 +464,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) break; } default: - mlog(CLIENT__ERROR, "Invalid special attack type %d attempted", unchecked_type); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); return(1000); /* nice long delay for them, the caller depends on this! */ } From 3d5434b91dd1bf40e3ce621924ad2e668e5d28e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:54:02 -0600 Subject: [PATCH 0971/1883] Remove mlog and _log completely --- common/logsys.h | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index 9b3da9aa2..567d3f8db 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -73,32 +73,9 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); #ifdef DISABLE_LOGSYS //completely disabled, this is the best I can come up with since we have no variadic macros - inline void _log(LogType, const char *, ...) {}//i feel dirty for putting this ifdef here, but I dont wanna have to include a header in all zone files to get it - inline void mlog(LogType, const char *, ...) {} inline void clog(LogType, const char *, ...) {} inline void zlog(LogType, const char *, ...) {} #else //!DISABLE_LOGSYS - - //we have variadic macros, hooray! - //the do-while construct is needed to allow a ; at the end of log(); lines when used - //in conditional statements without {}'s - #define _log( type, format, ...) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_message(type, format, ##__VA_ARGS__); \ - } \ - } while(false) - #ifdef ZONE - class Mob; - extern void log_message_mob(LogType type, Mob *who, const char *fmt, ...); - #define mlog( type, format, ...) \ - do { \ - if(IsLoggingEnabled()) \ - if(log_type_info[ type ].enabled) { \ - log_message_mob(type, this, format, ##__VA_ARGS__); \ - } \ - } while(false) - #endif #ifdef WORLD class Client; extern void log_message_client(LogType type, Client *who, const char *fmt, ...); From bcaaaac090bddf71fb408e18e8bf52d093c18979 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:56:10 -0600 Subject: [PATCH 0972/1883] Replace all clog calls, (Mostly WORLD__) --- world/client.cpp | 120 +++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index 4a4cbb1d0..e83961435 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -136,7 +136,7 @@ void Client::SendEnterWorld(std::string name) eqs->Close(); return; } else { - clog(WORLD__CLIENT,"Telling client to continue session."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); } } @@ -378,7 +378,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if (strlen(password) <= 1) { // TODO: Find out how to tell the client wrong username/password - clog(WORLD__CLIENT_ERR,"Login without a password"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); return false; } @@ -408,31 +408,31 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password))) #else if (loginserverlist.Connected() == false && !pZoning) { - clog(WORLD__CLIENT_ERR,"Error: Login server login while not connected to login server."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); return false; } if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - clog(WORLD__CLIENT_ERR,"ID is 0. Is this server connected to minilogin?"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) - clog(WORLD__CLIENT_ERR,"If so you forget the minilogin variable..."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); else - clog(WORLD__CLIENT_ERR,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); return false; } cle->SetOnline(); - clog(WORLD__CLIENT,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); if(minilogin){ WorldConfig::DisableStats(); - clog(WORLD__CLIENT,"MiniLogin Account #%d",cle->AccountID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); } else { - clog(WORLD__CLIENT,"LS Account #%d",cle->LSID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); } const WorldConfig *Config=WorldConfig::get(); @@ -465,7 +465,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else { // TODO: Find out how to tell the client wrong username/password - clog(WORLD__CLIENT_ERR,"Bad/Expired session key '%s'",name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); return false; } @@ -479,7 +479,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - clog(WORLD__CLIENT_ERR,"Name approval request with no logged in account"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); return false; } @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - clog(WORLD__CLIENT, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -648,11 +648,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - clog(WORLD__CLIENT_ERR,"Account ID not set; unable to create character."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); return false; } else if (app->size != sizeof(CharCreate_Struct)) { - clog(WORLD__CLIENT_ERR,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); DumpPacket(app); // the previous behavior was essentially returning true here // but that seems a bit odd to me. @@ -679,14 +679,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - clog(WORLD__CLIENT_ERR,"Enter world with no logged in account"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); eqs->Close(); return true; } if(GetAdmin() < 0) { - clog(WORLD__CLIENT,"Account banned or suspended."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); eqs->Close(); return true; } @@ -702,14 +702,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { uint32 tmpaccid = 0; charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID); if (charid == 0 || tmpaccid != GetAccountID()) { - clog(WORLD__CLIENT_ERR,"Could not get CharInfo for '%s'",char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); eqs->Close(); return true; } // Make sure this account owns this character if (tmpaccid != GetAccountID()) { - clog(WORLD__CLIENT_ERR,"This account does not own the character named '%s'",char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); eqs->Close(); return true; } @@ -737,7 +737,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { zoneID = database.MoveCharacterToBind(charid,4); } else { - clog(WORLD__CLIENT_ERR,"'%s' is trying to go home before they're able...",char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -770,7 +770,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } else { - clog(WORLD__CLIENT_ERR,"'%s' is trying to go to tutorial but are not allowed...",char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -780,7 +780,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (zoneID == 0 || !database.GetZoneName(zoneID)) { // This is to save people in an invalid zone, once it's removed from the DB database.MoveCharacterToZone(charid, "arena"); - clog(WORLD__CLIENT_ERR, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); } if(instanceID > 0) @@ -894,7 +894,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer); if(char_acct_id == GetAccountID()) { - clog(WORLD__CLIENT,"Delete character: %s",app->pBuffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); database.DeleteCharacter((char *)app->pBuffer); SendCharInfo(); } @@ -915,25 +915,25 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); - clog(WORLD__CLIENT_TRACE,"Recevied EQApplicationPacket"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { - clog(WORLD__CLIENT,"Client disconnected (net inactive on send)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); return false; } // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { - clog(WORLD__CLIENT,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); eqs->Close(); } } if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) { // Got a packet other than OP_SendLoginInfo when not logged in - clog(WORLD__CLIENT_ERR,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); return false; } else if (opcode == OP_AckPacket) { @@ -1005,7 +1005,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { } default: { - clog(WORLD__CLIENT_ERR,"Received unknown EQApplicationPacket"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); _pkt(WORLD__CLIENT_ERR,app); return true; } @@ -1024,7 +1024,7 @@ bool Client::Process() { to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { - clog(WORLD__CLIENT_ERR, "Zone bootup timer expired, bootup failed or too slow."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); ZoneUnavail(); } if(connect.Check()){ @@ -1058,7 +1058,7 @@ bool Client::Process() { loginserverlist.SendPacket(pack); safe_delete(pack); } - clog(WORLD__CLIENT,"Client disconnected (not active in process)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); return false; } @@ -1107,17 +1107,17 @@ void Client::EnterWorld(bool TryBootup) { } else { if (TryBootup) { - clog(WORLD__CLIENT,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); autobootup_timeout.Start(); pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID); if (pwaitingforbootup == 0) { - clog(WORLD__CLIENT_ERR,"No zoneserver available to boot up."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); ZoneUnavail(); } return; } else { - clog(WORLD__CLIENT_ERR,"Requested zone %s is no running.",zone_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); ZoneUnavail(); return; } @@ -1126,12 +1126,12 @@ void Client::EnterWorld(bool TryBootup) { cle->SetChar(charid, char_name); database.UpdateLiveChar(char_name, GetAccountID()); - clog(WORLD__CLIENT,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); // database.SetAuthentication(account_id, char_name, zone_name, ip); if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - clog(WORLD__CLIENT_ERR,"Enter world failed. Zone is locked."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,9 +1169,9 @@ void Client::Clearance(int8 response) { if (zs == 0) { - clog(WORLD__CLIENT_ERR,"Unable to find zoneserver in Client::Clearance!!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); } else { - clog(WORLD__CLIENT_ERR, "Invalid response %d in Client::Clearance", response); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); } ZoneUnavail(); @@ -1181,20 +1181,20 @@ void Client::Clearance(int8 response) EQApplicationPacket* outapp; if (zs->GetCAddress() == nullptr) { - clog(WORLD__CLIENT_ERR, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); ZoneUnavail(); return; } if (zoneID == 0) { - clog(WORLD__CLIENT_ERR, "zoneID is nullptr in Client::Clearance!!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } const char* zonename = database.GetZoneName(zoneID); if (zonename == 0) { - clog(WORLD__CLIENT_ERR, "zonename is nullptr in Client::Clearance!!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } @@ -1225,7 +1225,7 @@ void Client::Clearance(int8 response) } strcpy(zsi->ip, zs_addr); zsi->port =zs->GetCPort(); - clog(WORLD__CLIENT,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); QueuePacket(outapp); safe_delete(outapp); @@ -1256,7 +1256,7 @@ bool Client::GenPassKey(char* key) { } void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { - clog(WORLD__CLIENT_TRACE, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P @@ -1358,27 +1358,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) in.s_addr = GetIP(); - clog(WORLD__CLIENT, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - clog(WORLD__CLIENT, "Name: %s", name); - clog(WORLD__CLIENT, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); - clog(WORLD__CLIENT, "STR STA AGI DEX WIS INT CHA Total"); - clog(WORLD__CLIENT, "%3d %3d %3d %3d %3d %3d %3d %3d", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - clog(WORLD__CLIENT, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - clog(WORLD__CLIENT, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - clog(WORLD__CLIENT, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); /* Validate the char creation struct */ if (ClientVersionBit & BIT_SoFAndLater) { if (!CheckCharCreateInfoSoF(cc)) { - clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { if (!CheckCharCreateInfoTitanium(cc)) { - clog(WORLD__CLIENT_ERR,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } @@ -1440,21 +1440,21 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { - clog(WORLD__CLIENT,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); pp.zone_id = RuleI(World, SoFStartZoneID); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - clog(WORLD__CLIENT_ERR,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); } else { /* if there's a startzone variable put them in there */ if (database.GetVariable("startzone", startzone, 50)) { - clog(WORLD__CLIENT,"Found 'startzone' variable setting: %s", startzone); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - clog(WORLD__CLIENT_ERR,"Error getting zone id for '%s'", startzone); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; if (ClientVersionBit & BIT_TitaniumAndEarlier) @@ -1493,11 +1493,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - clog(WORLD__CLIENT,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); - clog(WORLD__CLIENT,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); - clog(WORLD__CLIENT,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ @@ -1506,10 +1506,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // now we give the pp and the inv we made to StoreCharacter // to see if we can store it if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) { - clog(WORLD__CLIENT_ERR,"Character creation failed: %s", pp.name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); return false; } - clog(WORLD__CLIENT,"Character creation successful: %s", pp.name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); return true; } From 1069b13992091ba68322d425528b94f852c84131 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:57:47 -0600 Subject: [PATCH 0973/1883] Remove clog completely --- common/logsys.h | 10 ---------- world/client.cpp | 3 --- 2 files changed, 13 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index 567d3f8db..15584276f 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -73,19 +73,9 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); #ifdef DISABLE_LOGSYS //completely disabled, this is the best I can come up with since we have no variadic macros - inline void clog(LogType, const char *, ...) {} inline void zlog(LogType, const char *, ...) {} #else //!DISABLE_LOGSYS #ifdef WORLD - class Client; - extern void log_message_client(LogType type, Client *who, const char *fmt, ...); - #define clog( type, format, ...) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_message_client(type, this, format, ##__VA_ARGS__); \ - } \ - } while(false) - class ZoneServer; extern void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...); #define zlog( type, format, ...) \ diff --git a/world/client.cpp b/world/client.cpp index e83961435..0584fac61 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1270,12 +1270,9 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList("", outapp->size); if(outapp->pBuffer == nullptr) { - clog(GUILDS__ERROR, "Unable to make guild list!"); return; } - clog(GUILDS__OUT_PACKETS, "Sending OP_GuildsList of length %d", outapp->size); -// _pkt(GUILDS__OUT_PACKET_TRACE, outapp); eqs->FastQueuePacket((EQApplicationPacket **)&outapp); } From 551aadd27a7d2306dd94070ea8735fb167d877de Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:59:10 -0600 Subject: [PATCH 0974/1883] Replace all zlog calls --- world/zoneserver.cpp | 80 ++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 29abeabf9..a55009514 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -77,7 +77,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { char* longname; if (iZoneID) - zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; @@ -188,7 +188,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - zlog(WORLD__ZONE_ERR,"Zone authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -199,7 +199,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - zlog(WORLD__ZONE_ERR,"Zone authorization failed."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -541,10 +541,10 @@ bool ZoneServer::Process() { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ - zlog(WORLD__ZONE,"Sent Rez packet for %s",sRezz->rez.your_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); } else { - zlog(WORLD__ZONE,"Could not send Rez packet for %s",sRezz->rez.your_name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } @@ -589,10 +589,10 @@ bool ZoneServer::Process() { ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); - zlog(WORLD__ZONE,"Auto zone port configuration. Telling zone to use port %d",clientport); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; - zlog(WORLD__ZONE,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } @@ -602,7 +602,7 @@ bool ZoneServer::Process() { const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; - zlog(WORLD__ZONE, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { @@ -685,12 +685,12 @@ bool ZoneServer::Process() { if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); - zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); /* This is a request from the egress zone */ if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) { - zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) { ztz->response = 0; @@ -736,7 +736,7 @@ bool ZoneServer::Process() { /* Response from Ingress server, route back to egress */ else{ - zlog(WORLD__ZONE,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = nullptr; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); @@ -754,7 +754,7 @@ bool ZoneServer::Process() { } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); @@ -763,7 +763,7 @@ bool ZoneServer::Process() { case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); @@ -869,7 +869,7 @@ bool ZoneServer::Process() { } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; @@ -889,7 +889,7 @@ bool ZoneServer::Process() { } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; @@ -914,7 +914,7 @@ bool ZoneServer::Process() { } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; @@ -925,7 +925,7 @@ bool ZoneServer::Process() { } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; @@ -944,7 +944,7 @@ bool ZoneServer::Process() { break; } case ServerOP_GetWorldTime: { - zlog(WORLD__ZONE,"Broadcasting a world time update"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; @@ -959,17 +959,17 @@ bool ZoneServer::Process() { break; } case ServerOP_SetWorldTime: { - zlog(WORLD__ZONE,"Received SetWorldTime"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - zlog(WORLD__ZONE,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; @@ -981,7 +981,7 @@ bool ZoneServer::Process() { } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { - zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; @@ -1026,10 +1026,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { - zlog(WORLD__ZONE,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { - zlog(WORLD__ZONE_ERR,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; @@ -1048,10 +1048,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { - zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else @@ -1068,10 +1068,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } @@ -1080,10 +1080,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { - zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { @@ -1099,10 +1099,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } @@ -1120,10 +1120,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1139,10 +1139,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else @@ -1150,10 +1150,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1255,7 +1255,7 @@ bool ZoneServer::Process() { case ServerOP_LSAccountUpdate: { - zlog(WORLD__ZONE, "Received ServerOP_LSAccountUpdate packet from zone"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } @@ -1310,7 +1310,7 @@ bool ZoneServer::Process() { } default: { - zlog(WORLD__ZONE_ERR,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } From 7d14fad78210392fc6dbcb1afe0ee147c0fd48ea Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 02:59:49 -0600 Subject: [PATCH 0975/1883] Remove zlog completely --- common/logsys.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/common/logsys.h b/common/logsys.h index 15584276f..d65ecb928 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -71,22 +71,6 @@ extern void log_hex(LogType type, const void *data, unsigned long length, unsign extern void log_packet(LogType type, const BasePacket *p); extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); -#ifdef DISABLE_LOGSYS - //completely disabled, this is the best I can come up with since we have no variadic macros - inline void zlog(LogType, const char *, ...) {} -#else //!DISABLE_LOGSYS - #ifdef WORLD - class ZoneServer; - extern void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...); - #define zlog( type, format, ...) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_message_zone(type, this, format, ##__VA_ARGS__); \ - } \ - } while(false) - #endif -#endif //!DISABLE_LOGSYS - #ifndef DISABLE_LOGSYS /* these are macros which do not use ..., and work for anybody */ #define _hex( type, data, len) \ From f9a7da61b8387a6496d167171ebdcfc8635dae0d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 17 Jan 2015 16:18:09 -0500 Subject: [PATCH 0976/1883] Switch NUMHIT_ enum to a strongly typed enum --- zone/attack.cpp | 22 +++++++++++++--------- zone/bot.cpp | 6 +++--- zone/common.h | 24 ++++++++++++------------ zone/mob.cpp | 6 +++--- zone/mob.h | 2 +- zone/spell_effects.cpp | 14 +++++++------- zone/spells.cpp | 14 +++++++------- 7 files changed, 46 insertions(+), 42 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 8b9196adc..9f6011c52 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3348,7 +3348,7 @@ int32 Mob::ReduceAllDamage(int32 damage) } } - CheckNumHitsRemaining(NUMHIT_IncomingDamage); + CheckNumHitsRemaining(NumHit::IncomingDamage); return(damage); } @@ -3464,10 +3464,10 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (spell_id == SPELL_UNKNOWN && skill_used) { - CheckNumHitsRemaining(NUMHIT_IncomingHitAttempts); + CheckNumHitsRemaining(NumHit::IncomingHitAttempts); if (attacker) - attacker->CheckNumHitsRemaining(NUMHIT_OutgoingHitAttempts); + attacker->CheckNumHitsRemaining(NumHit::OutgoingHitAttempts); } if(attacker){ @@ -3544,7 +3544,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons } if (skill_used) - CheckNumHitsRemaining(NUMHIT_IncomingHitSuccess); + CheckNumHitsRemaining(NumHit::IncomingHitSuccess); if(IsClient() && CastToClient()->sneaking){ CastToClient()->sneaking = false; @@ -3917,7 +3917,8 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { float chance = ProcChance * (static_cast(DefensiveProcs[i].chance)/100.0f); if (zone->random.Roll(chance)) { ExecWeaponProc(nullptr, DefensiveProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_DefensiveSpellProcs,0,DefensiveProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::DefensiveSpellProcs, 0, + DefensiveProcs[i].base_spellID); } } } @@ -4093,7 +4094,8 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + SpellProcs[i].base_spellID); } else { mlog(COMBAT__PROCS, "Spell proc %d failed to proc %d (%.2f percent chance)", @@ -4109,7 +4111,8 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + RangedProcs[i].base_spellID); } else { mlog(COMBAT__PROCS, "Ranged proc %d failed to proc %d (%.2f percent chance)", @@ -4526,7 +4529,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui float final_chance = chance * (ProcMod / 100.0f); if (zone->random.Roll(final_chance)) { ExecWeaponProc(nullptr, proc_spell_id, on); - CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs,0, base_spell_id); + CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, + base_spell_id); CanProc = false; break; } @@ -4772,7 +4776,7 @@ void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes s ApplyMeleeDamageBonus(skillInUse, damage); damage += (damage * defender->GetSkillDmgTaken(skillInUse) / 100) + (GetSkillDmgAmt(skillInUse) + defender->GetFcDamageAmtIncoming(this, 0, true, skillInUse)); TryCriticalHit(defender, skillInUse, damage); - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); } void Mob::CommonBreakInvisible() diff --git a/zone/bot.cpp b/zone/bot.cpp index a4780ddc8..eb919272a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3184,7 +3184,7 @@ void Bot::DoMeleeSkillAttackDmg(Mob* other, uint16 weapon_damage, SkillUseTypes return; if (damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); if((skillinuse == SkillDragonPunch) && GetAA(aaDragonPunch) && zone->random.Int(0, 99) < 25){ SpellFinished(904, other, 10, 0, -1, spells[904].ResistDiff); @@ -6249,7 +6249,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b MeleeLifeTap(damage); if (damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); //break invis when you attack if(invisible) { @@ -7707,7 +7707,7 @@ void Bot::DoSpecialAttackDamage(Mob *who, SkillUseTypes skill, int32 max_damage, if (HasDied()) return; if (max_damage > 0) - CheckNumHitsRemaining(NUMHIT_OutgoingHitSuccess); + CheckNumHitsRemaining(NumHit::OutgoingHitSuccess); //[AA Dragon Punch] value[0] = 100 for 25%, chance value[1] = skill if(aabonuses.SpecialAttackKBProc[0] && aabonuses.SpecialAttackKBProc[1] == skill){ diff --git a/zone/common.h b/zone/common.h index 45f3bdb09..3639f74a0 100644 --- a/zone/common.h +++ b/zone/common.h @@ -158,18 +158,18 @@ enum TradeState { TradeCompleting }; -enum { //Numhits type - NUMHIT_IncomingHitAttempts = 1, //Attempted incoming melee attacks (hit or miss) on YOU. - NUMHIT_OutgoingHitAttempts = 2, //Attempted outgoing melee attacks (hit or miss) on YOUR TARGET. - NUMHIT_IncomingSpells = 3, //Incoming detrimental spells - NUMHIT_OutgoingSpells = 4, //Outgoing deterimental spells - NUMHIT_OutgoingHitSuccess = 5, //Successful outgoing melee attack HIT on YOUR TARGET. - NUMHIT_IncomingHitSuccess = 6, //Successful incoming melee attack HIT on YOU. - NUMHIT_MatchingSpells = 7, //Any casted spell matching/triggering a focus effect. - NUMHIT_IncomingDamage = 8, //Successful incoming spell or melee dmg attack on YOU - NUMHIT_ReflectSpell = 9, //Incoming Reflected spells. - NUMHIT_DefensiveSpellProcs = 10, //Defensive buff procs - NUMHIT_OffensiveSpellProcs = 11 //Offensive buff procs +enum class NumHit { // Numhits type + IncomingHitAttempts = 1, // Attempted incoming melee attacks (hit or miss) on YOU. + OutgoingHitAttempts = 2, // Attempted outgoing melee attacks (hit or miss) on YOUR TARGET. + IncomingSpells = 3, // Incoming detrimental spells + OutgoingSpells = 4, // Outgoing detrimental spells + OutgoingHitSuccess = 5, // Successful outgoing melee attack HIT on YOUR TARGET. + IncomingHitSuccess = 6, // Successful incoming melee attack HIT on YOU. + MatchingSpells = 7, // Any casted spell matching/triggering a focus effect. + IncomingDamage = 8, // Successful incoming spell or melee dmg attack on YOU + ReflectSpell = 9, // Incoming Reflected spells. + DefensiveSpellProcs = 10, // Defensive buff procs + OffensiveSpellProcs = 11 // Offensive buff procs }; //this is our internal representation of the BUFF struct, can put whatever we want in it diff --git a/zone/mob.cpp b/zone/mob.cpp index 3ea572eb6..3c7243e03 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3383,7 +3383,7 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger) if(IsValidSpell(trigger_spell_id) && GetTarget()){ SpellFinished(trigger_spell_id, GetTarget(),10, 0, -1, spells[trigger_spell_id].ResistDiff); - CheckNumHitsRemaining(NUMHIT_MatchingSpells,-1, focus_spell); + CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } } } @@ -3615,7 +3615,7 @@ int32 Mob::GetVulnerability(Mob* caster, uint32 spell_id, uint32 ticsremaining) value += tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); + CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot); } return value; } @@ -3720,7 +3720,7 @@ void Mob::TrySympatheticProc(Mob *target, uint32 spell_id) SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff); } - CheckNumHitsRemaining(NUMHIT_MatchingSpells, -1, focus_spell); + CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell); } } diff --git a/zone/mob.h b/zone/mob.h index 2fc9a7287..515f484e1 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -282,7 +282,7 @@ public: int16 GetBuffSlotFromType(uint16 type); uint16 GetSpellIDFromSlot(uint8 slot); int CountDispellableBuffs(); - void CheckNumHitsRemaining(uint8 type, int32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); + void CheckNumHitsRemaining(NumHit type, int32 buff_slot = -1, uint16 spell_id = SPELL_UNKNOWN); bool HasNumhits() const { return has_numhits; } inline void Numhits(bool val) { has_numhits = val; } bool HasMGB() const { return has_MGB; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index cb21073ca..507c361dd 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5645,7 +5645,7 @@ int16 NPC::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2; } -void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) +void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, uint16 spell_id) { /* Field 175 = numhits type @@ -5672,7 +5672,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) if (IsValidSpell(spell_id)) { for (int d = 0; d < buff_max; d++) { if (buffs[d].spellid == spell_id && buffs[d].numhits > 0 && - spells[buffs[d].spellid].numhitstype == type) { + spells[buffs[d].spellid].numhitstype == static_cast(type)) { if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); if (!TryFadeEffect(d)) @@ -5682,7 +5682,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) } } } - } else if (type == NUMHIT_MatchingSpells) { + } else if (type == NumHit::MatchingSpells) { if (buff_slot >= 0) { if (--buffs[buff_slot].numhits == 0) { CastOnNumHitFade(buffs[buff_slot].spellid); @@ -5711,7 +5711,7 @@ void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) } else { for (int d = 0; d < buff_max; d++) { if (IsValidSpell(buffs[d].spellid) && buffs[d].numhits > 0 && - spells[buffs[d].spellid].numhitstype == type) { + spells[buffs[d].spellid].numhitstype == static_cast(type)) { if (--buffs[d].numhits == 0) { CastOnNumHitFade(buffs[d].spellid); if (!TryFadeEffect(d)) @@ -5975,7 +5975,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, } if ((!limit_exists) || (limit_exists && skill_found)){ dmg += temp_dmg; - CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); + CheckNumHitsRemaining(NumHit::MatchingSpells, i); } } @@ -5983,7 +5983,7 @@ int32 Mob::GetFcDamageAmtIncoming(Mob *caster, uint32 spell_id, bool use_skill, int32 focus = caster->CalcFocusEffect(focusFcDamageAmtIncoming, buffs[i].spellid, spell_id); if(focus){ dmg += focus; - CheckNumHitsRemaining(NUMHIT_MatchingSpells,i); + CheckNumHitsRemaining(NumHit::MatchingSpells, i); } } } @@ -6035,7 +6035,7 @@ int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spel value = tmp_focus; if (tmp_buffslot >= 0) - CheckNumHitsRemaining(NUMHIT_MatchingSpells, tmp_buffslot); + CheckNumHitsRemaining(NumHit::MatchingSpells, tmp_buffslot); } diff --git a/zone/spells.cpp b/zone/spells.cpp index f749f062d..ef5dd165a 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1268,7 +1268,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } if(IsClient()) { - CheckNumHitsRemaining(NUMHIT_MatchingSpells); + CheckNumHitsRemaining(NumHit::MatchingSpells); TrySympatheticProc(target, spell_id); } @@ -3573,7 +3573,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(IsEffectInSpell(buffs[b].spellid, SE_BlockNextSpellFocus)) { focus = CalcFocusEffect(focusBlockNextSpell, buffs[b].spellid, spell_id); if(focus) { - CheckNumHitsRemaining(NUMHIT_MatchingSpells,b); + CheckNumHitsRemaining(NumHit::MatchingSpells, b); Message_StringID(MT_SpellFailure, SPELL_WOULDNT_HOLD); safe_delete(action_packet); return false; @@ -3622,7 +3622,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } if(reflect_chance) { Message_StringID(MT_Spells, SPELL_REFLECT, GetCleanName(), spelltar->GetCleanName()); - CheckNumHitsRemaining(NUMHIT_ReflectSpell); + CheckNumHitsRemaining(NumHit::ReflectSpell); SpellOnTarget(spell_id, this, true, use_resist_adjust, resist_adjust); safe_delete(action_packet); return false; @@ -3673,8 +3673,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } } - spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); - CheckNumHitsRemaining(NUMHIT_OutgoingSpells); + spelltar->CheckNumHitsRemaining(NumHit::IncomingSpells); + CheckNumHitsRemaining(NumHit::OutgoingSpells); safe_delete(action_packet); return false; @@ -3732,10 +3732,10 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (IsDetrimentalSpell(spell_id)) { - CheckNumHitsRemaining(NUMHIT_OutgoingSpells); + CheckNumHitsRemaining(NumHit::OutgoingSpells); if (spelltar) - spelltar->CheckNumHitsRemaining(NUMHIT_IncomingSpells); + spelltar->CheckNumHitsRemaining(NumHit::IncomingSpells); } // send the action packet again now that the spell is successful From 53f3fbfb4d2c51c3b3a3cc71c33dce03f28e9785 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 14:16:23 -0800 Subject: [PATCH 0977/1883] 16 char copy not 32 --- zone/doors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index b6f529e91..152712c15 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -64,7 +64,7 @@ Doors::Doors(const Door* door) : close_timer.Disable(); - strn0cpy(dest_zone,door->dest_zone,32); + strn0cpy(dest_zone,door->dest_zone,16); dest_instance_id = door->dest_instance_id; is_ldon_door = door->is_ldon_door; From 136dee691ad6e5f4706dddcf345c11459159eeb4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 14:53:06 -0800 Subject: [PATCH 0978/1883] removed unused macro debug message --- zone/beacon.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/zone/beacon.cpp b/zone/beacon.cpp index c3988e866..aa44b2504 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -35,7 +35,7 @@ class Zone; #include "../common/races.h" #include "beacon.h" #include "entity.h" -#include "mob.h" +#include "mob.h" #ifdef BOTS @@ -68,19 +68,12 @@ Beacon::Beacon(Mob *at_mob, int lifetime) caster_id = 0; if(lifetime) - { remove_timer.Start(); - } -#ifdef SOLAR - entity_list.Message(0, 0, "Beacon being created at %0.2f %0.2f %0.2f heading %0.2f lifetime %d", GetX(), GetY(), GetZ(), GetHeading(), lifetime); -#endif } Beacon::~Beacon() { -#ifdef SOLAR - entity_list.Message(0, 0, "Beacon %d being removed at %0.2f %0.2f %0.2f heading %0.2f", GetID(), GetX(), GetY(), GetZ(), GetHeading()); -#endif + } bool Beacon::Process() From 9f8dad894c2755a27f4a8b9671bdcf1a9669fb73 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:22:46 -0800 Subject: [PATCH 0979/1883] Added 'GetTargetRingLocation' which will eventualy replace the individual GetTargetRing methods --- zone/mob.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/mob.h b/zone/mob.h index 6e304c34a..89c3fc410 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -294,6 +294,7 @@ public: inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } void RemoveNimbusEffect(int effectid); + inline const xyz_location& GetTargetRingLocation() const { return m_TargetRing; } inline float GetTargetRingX() const { return m_TargetRing.m_X; } inline float GetTargetRingY() const { return m_TargetRing.m_Y; } inline float GetTargetRingZ() const { return m_TargetRing.m_Z; } From e653a3943a11e9c7eb22f79ba8497f436c74a90b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:32:04 -0800 Subject: [PATCH 0980/1883] removed usage of mob distnoroot and used ComparativeDistance instead --- zone/effects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index ec463bddf..0e71ca0eb 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -26,6 +26,7 @@ #include "string_ids.h" #include "worldserver.h" #include "zonedb.h" +#include "position.h" float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard) { @@ -720,7 +721,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (spells[spell_id].targettype == ST_Ring) { - dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ()); + dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); } else if (center) { dist_targ = center->DistNoRoot(*curmob); From 91b2e23e563f99b63ecaf6ec74327d9f5ea1e0f1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:37:24 -0800 Subject: [PATCH 0981/1883] removed usage of mob->distnoroot and switched to ComparativeDistance --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 0e71ca0eb..6206593ac 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -724,7 +724,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); } else if (center) { - dist_targ = center->DistNoRoot(*curmob); + dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), static_cast(center->GetPosition())); } if (dist_targ > dist2) //make sure they are in range From 70a9a4e7cdfa6d655f5e4c63129336e4bc5880e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:42:58 -0800 Subject: [PATCH 0982/1883] Removed usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 6eb32b684..d62fd8880 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1558,7 +1558,7 @@ Client *EntityList::GetRandomClient(const xyz_location& location, float Distance for (auto it = client_list.begin();it != client_list.end(); ++it) - if ((it->second != ExcludeClient) && (it->second->DistNoRoot(location.m_X, location.m_Y, location.m_Z) <= Distance)) + if ((it->second != ExcludeClient) && (ComparativeDistance(it->second->GetPosition(), location) <= Distance)) ClientsInRange.push_back(it->second); if (ClientsInRange.empty()) From f1759421d1c28f33d5a28075b5c2bc6bc7a3c7a4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:51:26 -0800 Subject: [PATCH 0983/1883] Removed Mob::DistNoRoot(x,y,z) --- zone/mob.cpp | 10 ---------- zone/mob.h | 1 - 2 files changed, 11 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 1d2d7053e..4e2f3c9f2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2302,16 +2302,6 @@ float Mob::DistNoRoot(const Mob &other) const { + (zDiff * zDiff) ); } -float Mob::DistNoRoot(float x, float y, float z) const { - float xDiff = x - m_Position.m_X; - float yDiff = y - m_Position.m_Y; - float zDiff = z - m_Position.m_Z; - - return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoRootNoZ(float x, float y) const { float xDiff = x - m_Position.m_X; float yDiff = y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index 89c3fc410..2afcd4aa0 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -514,7 +514,6 @@ public: float Dist(const Mob &) const; float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; - float DistNoRoot(float x, float y, float z) const; float DistNoRootNoZ(float x, float y) const; float DistNoRootNoZ(const Mob &) const; static float GetReciprocalHeading(Mob* target); From 2eaeb38138e53d8abcb8a50e5fd9eebc4cd5b370 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:56:06 -0800 Subject: [PATCH 0984/1883] Removed a usage of Mob::Dist and used Distance instead --- zone/client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index a988c04a6..ee48af831 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -40,6 +40,7 @@ extern volatile bool RunLoops; #include "../common/rulesys.h" #include "../common/string_util.h" #include "../common/data_verification.h" +#include "position.h" #include "net.h" #include "worldserver.h" #include "zonedb.h" @@ -3178,7 +3179,7 @@ void Client::Insight(uint32 t_id) Message(0,"This ability can only be used on NPCs."); return; } - if (Dist(*who) > 200) + if (Distance(static_cast(m_Position), static_cast(who->GetPosition())) > 200) { Message(0,"You must get closer to your target!"); return; From 77badffa299324ddf7e5b48187cd18036b8c8ad7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:00:12 -0800 Subject: [PATCH 0985/1883] Removed a usage of Mob::Dist and used Distance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 5cc3da16d..61a09094f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3025,7 +3025,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) if (assistee->GetTarget()) { Mob *new_target = assistee->GetTarget(); if (new_target && (GetGM() || - Dist(*assistee) <= TARGETING_RANGE)) { + Distance(static_cast(m_Position), static_cast(assistee->GetPosition())) <= TARGETING_RANGE)) { SetAssistExemption(true); eid->entity_id = new_target->GetID(); } From 6e06110b7552898c4a8328e1ef8470cced3b407b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 17 Jan 2015 19:03:13 -0500 Subject: [PATCH 0986/1883] Remove more extra and incorrect memsets --- zone/mob.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 1d2d7053e..d1e6ac7c5 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1524,7 +1524,6 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, } EQApplicationPacket* outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); Illusion_Struct* is = (Illusion_Struct*) outapp->pBuffer; is->spawnid = GetID(); strcpy(is->charname, GetCleanName()); @@ -1890,7 +1889,6 @@ void Mob::SendTargetable(bool on, Client *specific_target) { void Mob::QuestReward(Client *c, uint32 silver, uint32 gold, uint32 platinum) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_Sound, sizeof(QuestReward_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); QuestReward_Struct* qr = (QuestReward_Struct*) outapp->pBuffer; qr->from_mob = GetID(); // Entity ID for the from mob name @@ -1910,7 +1908,6 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global if(global == true) { ServerPacket* pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct)); - memset(pack->pBuffer, 0, sizeof(pack->pBuffer)); ServerCameraShake_Struct* scss = (ServerCameraShake_Struct*) pack->pBuffer; scss->duration = duration; scss->intensity = intensity; @@ -1920,7 +1917,6 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global } EQApplicationPacket* outapp = new EQApplicationPacket(OP_CameraEffect, sizeof(Camera_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); Camera_Struct* cs = (Camera_Struct*) outapp->pBuffer; cs->duration = duration; // Duration in milliseconds cs->intensity = ((intensity * 6710886) + 1023410176); // Intensity ranges from 1023410176 to 1090519040, so simplify it from 0 to 10. @@ -1936,7 +1932,6 @@ void Mob::CameraEffect(uint32 duration, uint32 intensity, Client *c, bool global void Mob::SendSpellEffect(uint32 effectid, uint32 duration, uint32 finish_delay, bool zone_wide, uint32 unk020, bool perm_effect, Client *c) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_SpellEffect, sizeof(SpellEffect_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); SpellEffect_Struct* se = (SpellEffect_Struct*) outapp->pBuffer; se->EffectID = effectid; // ID of the Particle Effect se->EntityID = GetID(); @@ -1988,7 +1983,6 @@ void Mob::TempName(const char *newname) // Send the new name to all clients EQApplicationPacket* outapp = new EQApplicationPacket(OP_MobRename, sizeof(MobRename_Struct)); - memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer)); MobRename_Struct* mr = (MobRename_Struct*) outapp->pBuffer; strn0cpy(mr->old_name, old_name, 64); strn0cpy(mr->old_name_again, old_name, 64); From a135a3d597fe9d9fdc1d9fa188c55ce935f0b6fe Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:08:45 -0800 Subject: [PATCH 0987/1883] Added explicit xyz_heading overrides for the 4 distance functions --- zone/effects.cpp | 4 ++-- zone/entity.cpp | 2 +- zone/position.cpp | 28 ++++++++++++++++++++++++++++ zone/position.h | 5 +++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 6206593ac..d94f26159 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -721,10 +721,10 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (spells[spell_id].targettype == ST_Ring) { - dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); + dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), caster->GetTargetRingLocation()); } else if (center) { - dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), static_cast(center->GetPosition())); + dist_targ = ComparativeDistance(curmob->GetPosition(), center->GetPosition()); } if (dist_targ > dist2) //make sure they are in range diff --git a/zone/entity.cpp b/zone/entity.cpp index d62fd8880..7e3b925ca 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1558,7 +1558,7 @@ Client *EntityList::GetRandomClient(const xyz_location& location, float Distance for (auto it = client_list.begin();it != client_list.end(); ++it) - if ((it->second != ExcludeClient) && (ComparativeDistance(it->second->GetPosition(), location) <= Distance)) + if ((it->second != ExcludeClient) && (ComparativeDistance(static_cast(it->second->GetPosition()), location) <= Distance)) ClientsInRange.push_back(it->second); if (ClientsInRange.empty()) diff --git a/zone/position.cpp b/zone/position.cpp index ddbe429af..63c5b034f 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -145,6 +145,13 @@ float ComparativeDistance(const xyz_location& point1, const xyz_location& point2 return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z; } +/** +* Produces the non square root'ed distance between the two points. +*/ +float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2) { + ComparativeDistance(static_cast(point1), static_cast(point2)); +} + /** * Produces the distance between the two points. */ @@ -152,6 +159,13 @@ float Distance(const xyz_location& point1, const xyz_location& point2) { return sqrt(ComparativeDistance(point1, point2)); } +/** +* Produces the distance between the two points. +*/ +float Distance(const xyz_heading& point1, const xyz_heading& point2) { + Distance(static_cast(point1), static_cast(point2)); +} + /** * Produces the distance between the two points within the XY plane. */ @@ -159,6 +173,13 @@ float DistanceNoZ(const xyz_location& point1, const xyz_location& point2) { return Distance(static_cast(point1),static_cast(point2)); } +/** +* Produces the distance between the two points within the XY plane. +*/ +float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) { + return Distance(static_cast(point1),static_cast(point2)); +} + /** * Produces the non square root'ed distance between the two points within the XY plane. */ @@ -166,6 +187,13 @@ float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& poi return ComparativeDistance(static_cast(point1),static_cast(point2)); } +/** +* Produces the non square root'ed distance between the two points within the XY plane. +*/ +float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) { + return ComparativeDistance(static_cast(point1),static_cast(point2)); +} + /** * Determines if 'position' is within (inclusive) the axis aligned * box (3 dimensional) formed from the points minimum and maximum. diff --git a/zone/position.h b/zone/position.h index fd66ede5f..30f8fcb1c 100644 --- a/zone/position.h +++ b/zone/position.h @@ -94,4 +94,9 @@ float Distance(const xyz_location& point1, const xyz_location& point2); float DistanceNoZ(const xyz_location& point1, const xyz_location& point2); float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2); +float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2); +float Distance(const xyz_heading& point1, const xyz_heading& point2); +float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); +float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); + #endif From 76afc1119902bb710e9e8914b9113a96d3c5e575 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:12:30 -0800 Subject: [PATCH 0988/1883] Overloads of xyz_heading means no longer need the static cast here --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 61a09094f..332a1cc98 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3025,7 +3025,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) if (assistee->GetTarget()) { Mob *new_target = assistee->GetTarget(); if (new_target && (GetGM() || - Distance(static_cast(m_Position), static_cast(assistee->GetPosition())) <= TARGETING_RANGE)) { + Distance(m_Position, assistee->GetPosition()) <= TARGETING_RANGE)) { SetAssistExemption(true); eid->entity_id = new_target->GetID(); } From 1bd4d38537f37389168bcddc7b826e6b7d63d95d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:39:12 -0800 Subject: [PATCH 0989/1883] Removed usage of Mod::Dist and used Distance instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index ea527cbe8..3c42d00fb 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10183,7 +10183,7 @@ void command_distance(Client *c, const Seperator *sep) { if(c && c->GetTarget()) { Mob* target = c->GetTarget(); - c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), c->Dist(*target)); + c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), Distance(c->GetPosition(), target->GetPosition())); } } From a60c37098cc540a3774baa8227b32e6ab190e144 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:41:26 -0800 Subject: [PATCH 0990/1883] Removed usage of Mod::Dist and used Distance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 7e3b925ca..9884f825e 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1119,7 +1119,7 @@ void EntityList::ChannelMessage(Mob *from, uint8 chan_num, uint8 language, filter = FilterAuctions; // // Only say is limited in range - if (chan_num != 8 || client->Dist(*from) < 200) + if (chan_num != 8 || Distance(client->GetPosition(), from->GetPosition()) < 200) if (filter == FilterNone || client->GetFilter(filter) != FilterHide) client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer); ++it; From 8895dd599e4d93b25e6078005320735f490456e4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:44:17 -0800 Subject: [PATCH 0991/1883] Removed usage of Mod::Dist and used Distance instead --- zone/entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9884f825e..9cf0d45a5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2991,7 +2991,8 @@ void EntityList::MessageGroup(Mob *sender, bool skipclose, uint32 type, const ch auto it = client_list.begin(); while (it != client_list.end()) { - if (it->second != sender && (it->second->Dist(*sender) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) { + if (it->second != sender && + (Distance(it->second->GetPosition(), sender->GetPosition()) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) { it->second->Message(type, buffer); } ++it; From ee0b9edc21720ec17563ad29203b3bd511351f36 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:49:16 -0800 Subject: [PATCH 0992/1883] Removed Mob::Dist --- zone/mob.cpp | 10 ---------- zone/mob.h | 1 - 2 files changed, 11 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 4e2f3c9f2..6b7db13b2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,16 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::Dist(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - float zDiff = other.m_Position.m_Z - m_Position.m_Z; - - return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoZ(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index 2afcd4aa0..d32777d8f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,7 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float Dist(const Mob &) const; float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; float DistNoRootNoZ(float x, float y) const; From bff17cddf9d31805e7eae5f8a74f660d8eab411b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:50:08 -0800 Subject: [PATCH 0993/1883] Removed a usage of Mob::DistNoZ and used DistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e9d708d80..eeb005dd8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -15811,7 +15811,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { curMob = it->second; - if (curMob && curMob->DistNoZ(*client)<=Distance) { + if (curMob && DistanceNoZ(curMob->GetPosition(), client->GetPosition()) <= Distance) { if(curMob->IsTrackable()) { Mob* cur_entity = curMob; int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient()); From 2d7297dc676c93005bf3dca955fbfcab3953d3b5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:51:52 -0800 Subject: [PATCH 0994/1883] Removed a usage of Mob::DistNoZ and used DistanceNoZ instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9cf0d45a5..486a65972 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2942,7 +2942,7 @@ bool EntityList::MakeTrackPacket(Client *client) it->second->IsInvisible(client)) continue; - MobDistance = it->second->DistNoZ(*client); + MobDistance = DistanceNoZ(it->second->GetPosition(), client->GetPosition()); if (MobDistance > distance) continue; From 1e2198f5f4a760b8f4b0598568c77d2574e49533 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:53:41 -0800 Subject: [PATCH 0995/1883] Removed Mob::DistNoZ --- zone/mob.cpp | 8 -------- zone/mob.h | 1 - 2 files changed, 9 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 6b7db13b2..8b8a23747 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,14 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoZ(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - - return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) ); -} - float Mob::DistNoRoot(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index d32777d8f..c78eee65c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,7 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; float DistNoRootNoZ(float x, float y) const; float DistNoRootNoZ(const Mob &) const; From eb2eaa4d68a07deea4240dfbbbbd42d6e8f47ae3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:57:36 -0800 Subject: [PATCH 0996/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index b2b3881bb..847840b50 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -88,7 +88,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo if (mob->IsClient()) //also ensures that mob != around continue; - if (mob->DistNoRoot(*from_who) > d2) + if (ComparativeDistance(mob->GetPosition(), from_who->GetPosition()) > d2) continue; if (engaged) { From f1937335dd4675a49b3089147804c09137d7f531 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:01:20 -0800 Subject: [PATCH 0997/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 847840b50..918b7de10 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -150,7 +150,8 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { return; } - float dist2 = mob->DistNoRoot(*this); + float dist2 = ComparativeDistance(mob->GetPosition(), m_Position); + float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(), From 254ec5997cdcea9ce6563fe2063ae0674c3575ef Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:05:03 -0800 Subject: [PATCH 0998/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 918b7de10..f68c77efa 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -296,7 +296,7 @@ bool Mob::CheckWillAggro(Mob *mob) { return(false); } - float dist2 = mob->DistNoRoot(*this); + float dist2 = ComparativeDistance(mob->GetPosition(), m_Position); float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { From f43bf5542f1f04ecde6bd7e932a28fe2c4d5ed73 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:07:16 -0800 Subject: [PATCH 0999/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index f68c77efa..c0bd53d67 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -414,7 +414,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) AggroRange *= AggroRange; - if (mob->DistNoRoot(*attacker) > AggroRange) + if (ComparativeDistance(mob->GetPosition(), attacker->GetPosition()) > AggroRange) continue; Count++; From f79bad8b4bbb0f562ed611d155875d3949c8e66b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:09:43 -0800 Subject: [PATCH 1000/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index c0bd53d67..98135153c 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -444,7 +444,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { // && !mob->IsCorpse() // && mob->IsAIControlled() && mob->GetPrimaryFaction() != 0 - && mob->DistNoRoot(*sender) <= r + && ComparativeDistance(mob->GetPosition(), sender->GetPosition()) <= r && !mob->IsEngaged() && ((!mob->IsPet()) || (mob->IsPet() && mob->GetOwner() && !mob->GetOwner()->IsClient())) // If we're a pet we don't react to any calls for help if our owner is a client From 64bd24d5f9a2d714532351533854f21aa3f94992 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:13:34 -0800 Subject: [PATCH 1001/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 98135153c..c3861f13e 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -471,7 +471,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", - sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); + sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), ComparativeDistance(mob->GetPosition(), sender->GetPosition()), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); } From 262ae383c9ef5e9ef13edcad7bfc04f47305d8ef Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:15:48 -0800 Subject: [PATCH 1002/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index c3861f13e..7e8080cc7 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -878,7 +878,7 @@ bool Mob::CombatRange(Mob* other) if (size_mod > 10000) size_mod = size_mod / 7; - float _DistNoRoot = DistNoRoot(*other); + float _DistNoRoot = ComparativeDistance(m_Position, other->GetPosition()); if (GetSpecialAbility(NPC_CHASE_DISTANCE)){ From 815a2084928841a83c52c24521fe94febb36a310 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:18:35 -0800 Subject: [PATCH 1003/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index eeb005dd8..e368364b6 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3505,7 +3505,7 @@ void Bot::AI_Process() { if(IsBotCasterCombatRange(GetTarget())) atCombatRange = true; } - else if(DistNoRoot(*GetTarget()) <= meleeDistance) { + else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) { atCombatRange = true; } From d71fc61511c1249084a6584be9d646fc791c0546 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:20:29 -0800 Subject: [PATCH 1004/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e368364b6..e420f7a99 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3732,7 +3732,7 @@ void Bot::AI_Process() { Mob* follow = entity_list.GetMob(GetFollowID()); if(follow) { - float dist = DistNoRoot(*follow); + float dist = ComparativeDistance(m_Position, follow->GetPosition()); float speed = follow->GetRunspeed(); if(dist < GetFollowDistance() + 1000) From 86639f924d260e38d05d19407fb02a48d87c23f7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:22:48 -0800 Subject: [PATCH 1005/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e420f7a99..7326a9e42 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4003,7 +4003,7 @@ void Bot::PetAIProcess() { switch(pStandingPetOrder) { case SPO_Follow: { - float dist = botPet->DistNoRoot(*botPet->GetTarget()); + float dist = ComparativeDistance(botPet->GetPosition(), botPet->GetTarget()->GetPosition()); botPet->SetRunAnimSpeed(0); if(dist > 184) { botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetTarget()->GetRunspeed()); From 1303a297c014c113512351958a7731254381b4b2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:26:14 -0800 Subject: [PATCH 1006/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/botspellsai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index a5be7341e..68da92cae 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -898,7 +898,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain if (AIspells[i].type & SpellType_Escape) { dist2 = 0; } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2) || spells[AIspells[i].spellid].targettype==ST_AECaster From 78eb852ed3c64d01e7a8b45e342aa3ff03b4be1d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:32:41 -0800 Subject: [PATCH 1007/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index ee48af831..cee43648e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2540,7 +2540,7 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){ } else { - if (!GetFeigned() && (bindmob->DistNoRoot(*this) <= 400)) { + if (!GetFeigned() && (ComparativeDistance(bindmob->GetPosition(), m_Position) <= 400)) { // send bindmob bind done if(!bindmob->IsAIControlled() && bindmob != this ) { From 9400b860a3c0db8e8a0ced779fbe386bab2e87e7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:37:01 -0800 Subject: [PATCH 1008/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 332a1cc98..2092998d3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2030,7 +2030,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From e8144cb3eee888af37fa61e8d69132a84f14dc3d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:39:59 -0800 Subject: [PATCH 1009/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2092998d3..b2e8ec43c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2205,7 +2205,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 65bd2cf8aca6c87bc936c674993cbd4030577494 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:42:59 -0800 Subject: [PATCH 1010/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b2e8ec43c..be8defcfc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2296,7 +2296,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) return; } - if (DistNoRoot(*vendor) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2) { Message(13, "Vendor is out of range."); return; From 8efb9e75f89af3625e1fda042d9ca4acd5a0d2b1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:49:24 -0800 Subject: [PATCH 1011/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index be8defcfc..6faed0e44 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2554,7 +2554,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer)); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { @@ -2633,7 +2633,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer; NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition())> USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From e54cdad85d0d953c498a0485e683d0d3c2744dab Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:51:06 -0800 Subject: [PATCH 1012/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6faed0e44..4f2298344 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2770,7 +2770,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From 6b3099daac2aa5c8e026c1a3fb3a449f9e510ccf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:54:57 -0800 Subject: [PATCH 1013/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 4f2298344..0b8315b57 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2867,7 +2867,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer; NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From 926cba2cdc2520162fb4627dcf6187e5938dc1c7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:57:52 -0800 Subject: [PATCH 1014/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0b8315b57..265a1625d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9414,7 +9414,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) int mercTypeCount = 0; int mercCount = 0; - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != MERCERNARY_MASTER) { From 6f209fd8b9a9fc08494e91776275cded7541852a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:00:57 -0800 Subject: [PATCH 1015/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 265a1625d..867a90156 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9796,7 +9796,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; Mob* tribmast = entity_list.GetMob(st->tribute_master_id); if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == GUILD_TRIBUTE_MASTER - && DistNoRoot(*tribmast) <= USE_NPC_RANGE2) { + && ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) { st->response = 1; QueuePacket(app); tribute_master_id = st->tribute_master_id; From bcc4c1e4b6a28c8001165d696614a9b100ec7fca Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:07:25 -0800 Subject: [PATCH 1016/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 867a90156..70917df1d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9828,7 +9828,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; Mob* tribmast = entity_list.GetMob(st->tribute_master_id); if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == TRIBUTE_MASTER - && DistNoRoot(*tribmast) <= USE_NPC_RANGE2) { + && ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) { st->response = 1; QueuePacket(app); tribute_master_id = st->tribute_master_id; @@ -12102,7 +12102,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) if (mp->quantity < 1) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 6b979d1c5de8155d064b26b72fd2f7aca78407c9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:09:32 -0800 Subject: [PATCH 1017/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 70917df1d..cdaf755b3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12351,7 +12351,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*vendor) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2) return; uint32 price = 0; From 80154d06615e8603fc42581a0fc01f6d7a04abe4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:13:47 -0800 Subject: [PATCH 1018/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cdaf755b3..f0e411923 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12510,7 +12510,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 0c3efc3c4ff29d9cdf6629bc71d5c14fb4b37a52 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:16:45 -0800 Subject: [PATCH 1019/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f0e411923..e9482f8b8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13006,7 +13006,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) // For /target, send reject or success packet if (app->GetOpcode() == OP_TargetCommand) { - if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (DistNoRoot(*GetTarget()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) { + if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) { if (GetTarget()->GetBodyType() == BT_NoTarget2 || GetTarget()->GetBodyType() == BT_Special || GetTarget()->GetBodyType() == BT_NoTarget) { From 4174036ce7b0e03ce0780eb0d0940321e8aa2aaf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:22:59 -0800 Subject: [PATCH 1020/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e9482f8b8..73b25b6b7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13097,7 +13097,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (GetBindSightTarget()->DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { - if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { char *hacker_str = nullptr; MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units," From 6d7e8d7e9a0b5f506c8b6573f05e86b0ca0ad6be Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:32:34 -0800 Subject: [PATCH 1021/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 73b25b6b7..b9e1fae0e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13095,7 +13095,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) } else if (GetBindSightTarget()) { - if (GetBindSightTarget()->DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + if (ComparativeDistance(GetBindSightTarget()->GetPosition(), GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { From 0351ea2d3387bc315f1c0c67a1f144e5747e2ee4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:35:39 -0800 Subject: [PATCH 1022/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b9e1fae0e..dc53a02f7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13111,7 +13111,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) } } } - else if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + else if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { char *hacker_str = nullptr; MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units," From dc1db1fa0d2d855916bd38f0eac5dc58c3c0b869 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:45:42 -0800 Subject: [PATCH 1023/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index dc53a02f7..1474e024b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13743,7 +13743,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) Mob* tribmast = entity_list.GetMob(t->tribute_master_id); if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER) return; - if (DistNoRoot(*tribmast) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2) return; t->tribute_points = TributeItem(t->slot, t->quantity); From a5521badb157a0c5f3e2846376004a7755b5870d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:03:11 -0800 Subject: [PATCH 1024/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1474e024b..8bd986225 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13772,7 +13772,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) Mob* tribmast = entity_list.GetMob(t->tribute_master_id); if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER) return; - if (DistNoRoot(*tribmast) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2) return; t->tribute_points = TributeMoney(t->platinum); From 2b72a50f91ad07ed7cc39042a7a04c7f04e44407 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:08:29 -0800 Subject: [PATCH 1025/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 542390da9..e7eef4bbc 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1601,7 +1601,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2) return; // if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas From e44d9ce77f700e9e8e05c38139a5ff8bcd5e79c7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:14:05 -0800 Subject: [PATCH 1026/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e7eef4bbc..2f2498530 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1649,7 +1649,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2) return; // goodbye message From 608809a5dcf5a3de77d9f264307010b8864650dc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:45:32 -0800 Subject: [PATCH 1027/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 2f2498530..fc94fd415 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1678,7 +1678,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2) return; if (gmskill->skillbank == 0x01) From ef68b46c9cee578b8a0c93833d54028158f307f2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:49:09 -0800 Subject: [PATCH 1028/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index d94f26159..34b03de38 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -796,7 +796,7 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a continue; if (curmob == caster && !affect_caster) //watch for caster too continue; - if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range + if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range continue; //Only npcs mgb should hit are client pets... From 4fa102cb2408a638169d3d7887ac1f33e56322e8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:53:08 -0800 Subject: [PATCH 1029/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 34b03de38..103f3521d 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -838,7 +838,7 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff continue; if (curmob == caster && !affect_caster) //watch for caster too continue; - if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range + if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range continue; if (isnpc && curmob->IsNPC()) { //check npc->npc casting FACTION_VALUE f = curmob->GetReverseFactionCon(caster); From 93c5422966f9fd8155c5eac87edf32a00283ff32 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:35:30 -0800 Subject: [PATCH 1030/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 103f3521d..1a988d500 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -888,7 +888,7 @@ void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count, bool I && curmob != attacker //this is not needed unless NPCs can use this &&(attacker->IsAttackAllowed(curmob)) && curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */ - && (curmob->DistNoRoot(*attacker) <= dist2) + && (ComparativeDistance(curmob->GetPosition(), attacker->GetPosition()) <= dist2) ) { attacker->Attack(curmob, Hand, false, false, IsFromSpell); hit++; From 8eea92654fe68584f84e7489614cc1d3ddf06c0c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:38:44 -0800 Subject: [PATCH 1031/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 486a65972..2cd9d740f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1442,7 +1442,7 @@ void EntityList::QueueCloseClients(Mob *sender, const EQApplicationPacket *app, || (filter2 == FilterShowGroupOnly && (sender == ent || (ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender)))) || (filter2 == FilterShowSelfOnly && ent == sender)) - && (ent->DistNoRoot(*sender) <= dist2)) { + && (ComparativeDistance(ent->GetPosition(), sender->GetPosition()) <= dist2)) { ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED); } } From 3f37aef41c0bf75b2778bca23d5d3745b1418a2e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:41:53 -0800 Subject: [PATCH 1032/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2cd9d740f..2f21f29d9 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1921,7 +1921,7 @@ void EntityList::MessageClose_StringID(Mob *sender, bool skipsender, float dist, for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if(c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender)) + if(c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9); } } From 7dce5c4e6fbb89e378f4deebd1bc9e334bd9ebb6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:45:31 -0800 Subject: [PATCH 1033/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2f21f29d9..95ae4bf8d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1937,7 +1937,7 @@ void EntityList::FilteredMessageClose_StringID(Mob *sender, bool skipsender, for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if (c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender)) + if (c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) c->FilteredMessage_StringID(sender, type, filter, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9); From d45ed9befaddec87318a128abf539ed02eccce04 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sat, 17 Jan 2015 23:59:06 -0600 Subject: [PATCH 1034/1883] Consolidate EQEmuLogsys::Debug calls into DebugCategory --- common/eq_stream_factory.cpp | 8 +-- common/eqemu_logsys.h | 1 + common/tcp_server.cpp | 4 +- world/zoneserver.cpp | 1 - zone/client_packet.cpp | 4 +- zone/exp.cpp | 4 +- zone/fearpath.cpp | 4 +- zone/inventory.cpp | 4 +- zone/net.cpp | 2 +- zone/pathing.cpp | 132 +++++++++++++++++------------------ zone/perl_client.cpp | 16 ++--- zone/trading.cpp | 14 ++-- zone/worldserver.cpp | 2 +- zone/zonedb.cpp | 26 +++---- zone/zoning.cpp | 10 +-- 15 files changed, 116 insertions(+), 116 deletions(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 7d2a7e365..3bd6ad185 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 3cce91ebe..e15c99087 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -50,6 +50,7 @@ public: /* If you add to this, make sure you update LogCategoryName */ enum LogCategory { + None = 0, Zone_Server = 1, World_Server, UCS_Server, diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index 9e0553d40..f1154b120 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Starting TCPServerLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Ending TCPServerLoop with thread ID %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index a55009514..3cf75a90d 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -785,7 +785,6 @@ bool ZoneServer::Process() { } case ServerOP_RequestOnlineGuildMembers: { ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*) pack->pBuffer; - zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID); client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID); break; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b45f69e7b..382436e65 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Kicking char from zone, not allowed here"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } @@ -9136,7 +9136,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - logger.LogDebug(EQEmuLogSys::Detail, "%s sent a logout packet.", GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); SendLogoutPackets(); diff --git a/zone/exp.cpp b/zone/exp.cpp index c1ceeeae2..47d864706 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - logger.LogDebug(EQEmuLogSys::Detail, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - logger.LogDebug(EQEmuLogSys::Detail, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index e2e3be399..3a3fdcd58 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - logger.LogDebug(EQEmuLogSys::Detail, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - logger.LogDebug(EQEmuLogSys::Detail, "No path found to selected node. Falling through to old fear point selection."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 3062db265..22816a75f 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2866,7 +2866,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool if (log) { logger.Log(EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::InterrogateInventory() -- End"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2881,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } diff --git a/zone/net.cpp b/zone/net.cpp index 5cfe506cd..b630dadb2 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - logger.LogDebug(EQEmuLogSys::Detail, "Main thread running with thread id %d", pthread_self()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); diff --git a/zone/pathing.cpp b/zone/pathing.cpp index dc0d4cb40..07b145d34 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - logger.LogDebug(EQEmuLogSys::Detail, "FindRoute from node %i to %i", startID, endID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - logger.LogDebug(EQEmuLogSys::Detail, "Unable to find a route."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - logger.LogDebug(EQEmuLogSys::Detail, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any starting Path Node within range."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return noderoute; } - logger.LogDebug(EQEmuLogSys::Detail, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - logger.LogDebug(EQEmuLogSys::Detail, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any end Path Node within range."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); return noderoute; } - logger.LogDebug(EQEmuLogSys::Detail, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - logger.LogDebug(EQEmuLogSys::Detail, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - logger.LogDebug(EQEmuLogSys::Detail, "appears to be stuck. Teleporting them to next position.", GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - logger.LogDebug(EQEmuLogSys::Detail, " Still pathing to the same destination."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - logger.LogDebug(EQEmuLogSys::Detail, " Arrived at node %i", NextNode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - logger.LogDebug(EQEmuLogSys::Detail, "Route size is %i", RouteSize); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - logger.LogDebug(EQEmuLogSys::Detail, " Checking distance to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - logger.LogDebug(EQEmuLogSys::Detail, " Distance between From and To (NoRoot) is %8.3f", Distance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.LogDebug(EQEmuLogSys::Detail, "Missing node after teleport."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - logger.LogDebug(EQEmuLogSys::Detail, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - logger.LogDebug(EQEmuLogSys::Detail, " Now moving to node %i", NextNode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - logger.LogDebug(EQEmuLogSys::Detail, " Reached end of node path, running direct to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - logger.LogDebug(EQEmuLogSys::Detail, " Checking distance to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - logger.LogDebug(EQEmuLogSys::Detail, " Distance between From and To (NoRoot) is %8.3f", Distance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - logger.LogDebug(EQEmuLogSys::Detail, " Target has changed position."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - logger.LogDebug(EQEmuLogSys::Detail, " Checking for short LOS at distance %8.3f.", Distance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.LogDebug(EQEmuLogSys::Detail, " No hazards. Running directly to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.LogDebug(EQEmuLogSys::Detail, " Continuing on node path."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - logger.LogDebug(EQEmuLogSys::Detail, "Short route update timer not yet expired."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - logger.LogDebug(EQEmuLogSys::Detail, "Short route update timer expired."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - logger.LogDebug(EQEmuLogSys::Detail, "Long route update timer not yet expired."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - logger.LogDebug(EQEmuLogSys::Detail, "Long route update timer expired."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - logger.LogDebug(EQEmuLogSys::Detail, " Unable to find path node for new destination. Running straight to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - logger.LogDebug(EQEmuLogSys::Detail, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - logger.LogDebug(EQEmuLogSys::Detail, " Arrived at node %i, moving to next one.\n", Route.front()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.LogDebug(EQEmuLogSys::Detail, "Missing node after teleport."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - logger.LogDebug(EQEmuLogSys::Detail, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - logger.LogDebug(EQEmuLogSys::Detail, " Now moving to node %i", NextNode); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - logger.LogDebug(EQEmuLogSys::Detail, " Reached end of path grid. Running direct to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - logger.LogDebug(EQEmuLogSys::Detail, " Target moved. End node is different. Clearing route."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - logger.LogDebug(EQEmuLogSys::Detail, " Our route list is empty."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - logger.LogDebug(EQEmuLogSys::Detail, " Destination same as before, LOS check timer not reached. Returning To."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - logger.LogDebug(EQEmuLogSys::Detail, " Checking for long LOS at distance %8.3f.", Distance); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.LogDebug(EQEmuLogSys::Detail, "NoLOS"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.LogDebug(EQEmuLogSys::Detail, "Target is reachable. Running directly there."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); return To; } } - logger.LogDebug(EQEmuLogSys::Detail, " Calculating new route to target."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.LogDebug(EQEmuLogSys::Detail, " No route available, running direct."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - logger.LogDebug(EQEmuLogSys::Detail, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - logger.LogDebug(EQEmuLogSys::Detail, " New route determined, heading for node %i", Route.front()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.LogDebug(EQEmuLogSys::Detail, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - logger.LogDebug(EQEmuLogSys::Detail, "No LOS to any starting Path Node within range."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - logger.LogDebug(EQEmuLogSys::Detail, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED, really deep water/lava!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - logger.LogDebug(EQEmuLogSys::Detail, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - logger.LogDebug(EQEmuLogSys::Detail, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - logger.LogDebug(EQEmuLogSys::Detail, "Hazard point not in water or lava!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); } } else { - logger.LogDebug(EQEmuLogSys::Detail, "No water map loaded for hazards!"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - logger.LogDebug(EQEmuLogSys::Detail, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 82600923d..59a865887 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/trading.cpp b/zone/trading.cpp index 4c06dfc42..761c954f8 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1836,7 +1836,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Error retrieving Trader items details to update price."); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Client::SendBuyerResults %s\n", searchString); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 3bce1101a..7bbd5db5d 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -386,7 +386,7 @@ void WorldServer::Process() { } } else { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); } } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 507e1ef27..5a8c19e16 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -619,7 +619,7 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -630,7 +630,7 @@ void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int3 Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } @@ -650,7 +650,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 741a2fbd2..d2d814414 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - logger.LogDebug(EQEmuLogSys::Detail, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - logger.LogDebug(EQEmuLogSys::Detail, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 58d0b86a67d4f123e291376f00e0b6a290755f3a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:00:03 -0600 Subject: [PATCH 1035/1883] Consolidate EQEmuLogsys::Debug General calls into DebugCategory --- zone/aggro.cpp | 8 +- zone/bot.cpp | 2 +- zone/client.cpp | 32 ++++---- zone/client_mods.cpp | 8 +- zone/client_packet.cpp | 160 ++++++++++++++++++++-------------------- zone/client_process.cpp | 2 +- zone/command.cpp | 2 +- zone/corpse.cpp | 6 +- zone/doors.cpp | 2 +- zone/groups.cpp | 8 +- zone/inventory.cpp | 2 +- zone/loottables.cpp | 4 +- zone/merc.cpp | 4 +- zone/petitions.cpp | 2 +- zone/spawngroup.cpp | 2 +- zone/spell_effects.cpp | 6 +- zone/spells.cpp | 2 +- zone/trading.cpp | 10 +-- zone/zone.cpp | 16 ++-- zone/zonedb.cpp | 22 +++--- zone/zoning.cpp | 10 +-- 21 files changed, 155 insertions(+), 155 deletions(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 98ca3ee84..83a47a76e 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -466,7 +466,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - logger.LogDebug(EQEmuLogSys::General, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -693,7 +693,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - logger.LogDebug(EQEmuLogSys::General, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -833,7 +833,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - logger.LogDebug(EQEmuLogSys::General, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -945,7 +945,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - logger.LogDebug(EQEmuLogSys::General, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/bot.cpp b/zone/bot.cpp index fb3f86c90..4cf6325b2 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8548,7 +8548,7 @@ int32 Bot::CalcMaxMana() { } default: { - logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } diff --git a/zone/client.cpp b/zone/client.cpp index 8ea010890..cef327e77 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -340,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - logger.LogDebug(EQEmuLogSys::General, "Client '%s' was destroyed before reaching the connected state:", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -438,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - logger.LogDebug(EQEmuLogSys::General, "Client has not sent us an initial zone entry packet."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - logger.LogDebug(EQEmuLogSys::General, "Client sent initial zone packet, but we never got their player info from the database."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - logger.LogDebug(EQEmuLogSys::General, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - logger.LogDebug(EQEmuLogSys::General, "We successfully sent player info and spawns, waiting for client to request new zone."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - logger.LogDebug(EQEmuLogSys::General, "We received client's new zone request, waiting for client spawn request."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - logger.LogDebug(EQEmuLogSys::General, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - logger.LogDebug(EQEmuLogSys::General, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - logger.LogDebug(EQEmuLogSys::General, "We received client ready notification, but never finished Client::CompleteConnect"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - logger.LogDebug(EQEmuLogSys::General, "Client is successfully connected."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); break; }; } @@ -2105,7 +2105,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - logger.LogDebug(EQEmuLogSys::General, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2145,7 +2145,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - logger.LogDebug(EQEmuLogSys::General, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -4544,14 +4544,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - logger.LogDebug(EQEmuLogSys::General, "%s tried to open %s but %s was not a treasure chest.", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - logger.LogDebug(EQEmuLogSys::General, "%s tried to open %s but %s was out of range", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -8149,7 +8149,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "Eating from slot:%i", (int)slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); #endif } else @@ -8166,7 +8166,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "Drinking from slot:%i", (int)slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); #endif } } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 51b73e6a5..feaa0d18a 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -935,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -956,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1046,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 382436e65..abeafc750 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -483,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - logger.LogDebug(EQEmuLogSys::General, "Unknown client_state: %d\n", client_state); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); break; } @@ -1317,7 +1317,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - logger.LogDebug(EQEmuLogSys::General, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AcceptNewTask expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - logger.LogDebug(EQEmuLogSys::General, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AugmentInfo expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Bandolier expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - logger.LogDebug(EQEmuLogSys::General, "Uknown Bandolier action %i", bs->action); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - logger.LogDebug(EQEmuLogSys::General, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3730,7 +3730,7 @@ void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) logger.Log(EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - logger.LogDebug(EQEmuLogSys::General, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_BlockedBuffs expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_CancelTask expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - logger.LogDebug(EQEmuLogSys::General, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - logger.LogDebug(EQEmuLogSys::General, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - logger.LogDebug(EQEmuLogSys::General, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -5136,7 +5136,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_DelegateAbility expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5311,7 +5311,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5363,7 +5363,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - logger.LogDebug(EQEmuLogSys::General, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5927,7 +5927,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -6177,7 +6177,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6300,7 +6300,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6311,7 +6311,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6445,7 +6445,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) return; } - logger.LogDebug(EQEmuLogSys::General, "Member Disband Request from %s\n", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6725,7 +6725,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - logger.LogDebug(EQEmuLogSys::General, "Group /makeleader request originated from non-leader member: %s", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6816,7 +6816,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch on OP_GroupUpdate: got %u expected %u", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6835,7 +6835,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - logger.LogDebug(EQEmuLogSys::General, "Group /makeleader request originated from non-leader member: %s", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6844,7 +6844,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - logger.LogDebug(EQEmuLogSys::General, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -7782,7 +7782,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GuildStatus expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7839,7 +7839,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7943,7 +7943,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_HideCorpse expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -8449,7 +8449,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - logger.LogDebug(EQEmuLogSys::General, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8492,7 +8492,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - logger.LogDebug(EQEmuLogSys::General, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8530,7 +8530,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - logger.LogDebug(EQEmuLogSys::General, "Item with no effect right clicked by %s", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8603,7 +8603,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - logger.LogDebug(EQEmuLogSys::General, "Error: unknown item->Click.Type (%i)", item->Click.Type); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - logger.LogDebug(EQEmuLogSys::General, "Drinking Alcohol from slot:%i", slot_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8646,7 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - logger.LogDebug(EQEmuLogSys::General, "Error: unknown item->Click.Type (%i)", item->Click.Type); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8787,7 +8787,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -9327,7 +9327,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9384,7 +9384,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9519,7 +9519,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9539,7 +9539,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9564,7 +9564,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9636,7 +9636,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9660,7 +9660,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PopupResponse expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10551,7 +10551,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PotionBelt expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10559,7 +10559,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - logger.LogDebug(EQEmuLogSys::General, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10582,7 +10582,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10672,7 +10672,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10699,7 +10699,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -11385,7 +11385,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - logger.LogDebug(EQEmuLogSys::General, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11446,7 +11446,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - logger.LogDebug(EQEmuLogSys::General, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11506,7 +11506,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11669,7 +11669,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_RespawnWindow expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11720,7 +11720,7 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } @@ -11969,7 +11969,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -12098,7 +12098,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "%s, purchase item..", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12834,7 +12834,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -13149,7 +13149,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13691,7 +13691,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13836,7 +13836,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - logger.LogDebug(EQEmuLogSys::General, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13876,7 +13876,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13927,7 +13927,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13939,7 +13939,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - logger.LogDebug(EQEmuLogSys::General, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14162,7 +14162,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - logger.LogDebug(EQEmuLogSys::General, "Unhandled XTarget Type %i", Type); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 2d64eed51..e66fbaaeb 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1037,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - logger.LogDebug(EQEmuLogSys::General, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } diff --git a/zone/command.cpp b/zone/command.cpp index df31b604b..66fc57106 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10394,7 +10394,7 @@ void command_logtest(Client *c, const Seperator *sep){ if (sep->IsNumber(1)){ uint32 i = 0; for (i = 0; i < atoi(sep->arg[1]); i++){ - logger.LogDebug(EQEmuLogSys::General, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } } \ No newline at end of file diff --git a/zone/corpse.cpp b/zone/corpse.cpp index ec4503476..8c2eebb68 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -842,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - logger.LogDebug(EQEmuLogSys::General, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -872,7 +872,7 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - logger.LogDebug(EQEmuLogSys::General, "Tagged %s player corpse has burried.", this->GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); } else { logger.Log(EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); @@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - logger.LogDebug(EQEmuLogSys::General, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index d602fafe1..1f3008175 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -303,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - logger.LogDebug(EQEmuLogSys::General, "Client has lockpicks: skill=%f", modskill); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) diff --git a/zone/groups.cpp b/zone/groups.cpp index 3eccb7fa6..df687c6db 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1098,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - logger.LogDebug(EQEmuLogSys::General, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1107,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1116,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - logger.LogDebug(EQEmuLogSys::General, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 22816a75f..53eb3ae31 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -700,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - logger.LogDebug(EQEmuLogSys::General, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 74f347f69..fed8b2210 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - logger.LogDebug(EQEmuLogSys::General, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - logger.LogDebug(EQEmuLogSys::General, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index ec5a74308..c25248e2f 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -885,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - logger.LogDebug(EQEmuLogSys::General, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -906,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 1ef3c85b0..deab5789d 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -259,7 +259,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) } #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "New petition created"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); #endif } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index bc1e21451..abd93c84c 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - logger.LogDebug(EQEmuLogSys::General, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index f666c62ce..1e0f29e47 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -476,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - logger.LogDebug(EQEmuLogSys::General, "Succor/Evacuation Spell In Same Zone."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -485,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - logger.LogDebug(EQEmuLogSys::General, "Succor/Evacuation Spell To Another Zone."); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -3326,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - logger.LogDebug(EQEmuLogSys::General, "Unknown spell effect value forumula %d", formula); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 1b4de2406..e3c826b97 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2673,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - logger.LogDebug(EQEmuLogSys::General, "CalcBuffDuration_formula: unknown formula %d", formula); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } diff --git a/zone/trading.cpp b/zone/trading.cpp index 761c954f8..ff0fc6f5e 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -86,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - logger.LogDebug(EQEmuLogSys::General, "Programming error: NPC's should not call Trade::AddEntity()"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -296,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - logger.LogDebug(EQEmuLogSys::General, "Dumping trade data: '%s' in TradeState %i with '%s'", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -307,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - logger.LogDebug(EQEmuLogSys::General, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -315,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - logger.LogDebug(EQEmuLogSys::General, "\tBagItem %i (Charges=%i, Slot=%i)", + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -324,7 +324,7 @@ void Trade::DumpTrade() } } - logger.LogDebug(EQEmuLogSys::General, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif diff --git a/zone/zone.cpp b/zone/zone.cpp index 6098a61c5..b79335ad0 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - logger.LogDebug(EQEmuLogSys::General, "No Merchant Data found for %s.", GetShortName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - logger.LogDebug(EQEmuLogSys::General, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -801,10 +801,10 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - logger.LogDebug(EQEmuLogSys::General, "Graveyard ID is %i.", graveyard_id()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - logger.LogDebug(EQEmuLogSys::General, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else logger.Log(EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - logger.LogDebug(EQEmuLogSys::General, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - logger.LogDebug(EQEmuLogSys::General, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - logger.LogDebug(EQEmuLogSys::General, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - logger.LogDebug(EQEmuLogSys::General, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 5a8c19e16..6e15155cf 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - logger.LogDebug(EQEmuLogSys::General, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - logger.LogDebug(EQEmuLogSys::General, "Saving Currency for character ID: %i, done", character_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - logger.LogDebug(EQEmuLogSys::General, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index d2d814414..37ea17eb5 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - logger.LogDebug(EQEmuLogSys::General, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - logger.LogDebug(EQEmuLogSys::General, "Zone request from %s", GetName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - logger.LogDebug(EQEmuLogSys::General, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -534,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - logger.LogDebug(EQEmuLogSys::General, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -543,7 +543,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - logger.LogDebug(EQEmuLogSys::General, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; From 726b3a33f51477148dfe9ed57cafca80a8db4468 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:06:01 -0600 Subject: [PATCH 1036/1883] Consolidate EQEmuLogsys::Debug stragglers to DebugCategory for further refactoring --- common/eqemu_logsys.cpp | 22 +++++++++++----------- common/eqemu_logsys.h | 2 +- zone/doors.cpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 106df197a..8e3448e5b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -190,17 +190,17 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); } -void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) -{ - va_list args; - va_start(args, message); - std::string output_message = vStringFormat(message.c_str(), args); - va_end(args); - - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_message); - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_message); -} +// void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) +// { +// va_list args; +// va_start(args, message); +// std::string output_message = vStringFormat(message.c_str(), args); +// va_end(args); +// +// EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_message); +// EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); +// EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_message); +// } void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index e15c99087..7a6ba419e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -85,7 +85,7 @@ public: void CloseFileLogs(); void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); - void LogDebug(DebugLevel debug_level, std::string message, ...); + //void LogDebug(DebugLevel debug_level, std::string message, ...); //void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); diff --git a/zone/doors.cpp b/zone/doors.cpp index 1f3008175..98784eb90 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -560,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - logger.LogDebug(EQEmuLogSys::General, + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - logger.LogDebug(EQEmuLogSys::General, + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - logger.LogDebug(EQEmuLogSys::General, + logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } From 91221db4c9121709bf12a0e6d1dc57a7a7dc68a3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:07:17 -0800 Subject: [PATCH 1037/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 95ae4bf8d..3393c19a9 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1985,7 +1985,7 @@ void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 t auto it = client_list.begin(); while (it != client_list.end()) { - if (it->second->DistNoRoot(*sender) <= dist2 && (!skipsender || it->second != sender)) + if (ComparativeDistance(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender)) it->second->Message(type, buffer); ++it; } @@ -2460,7 +2460,7 @@ void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate, //bool Grouped = client->HasGroup() && mob->IsClient() && (client->GetGroup() == mob->CastToClient()->GetGroup()); //if (range == 0 || (iterator.GetData() == alwayssend) || Grouped || (mob->DistNoRootNoZ(*client) <= range)) { - if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (mob->DistNoRoot(*client) <= range)) { + if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (ComparativeDistance(mob->GetPosition(), client->GetPosition()) <= range)) { mob->MakeSpawnUpdate(ppu); } if(mob && mob->IsClient() && mob->GetID()>0) { From 84c82ca4ab1fb08d87e17f8e457e9aa859788cec Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:12:36 -0800 Subject: [PATCH 1038/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 3393c19a9..4dc914273 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3546,7 +3546,7 @@ void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients, continue; } - if (around->DistNoRoot(*mob) > range2) + if (ComparativeDistance(around->GetPosition(), mob->GetPosition()) > range2) continue; if (enabled) From 0b687e47796176d717c66df56f328d1f4b1ec9b8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:25:23 -0600 Subject: [PATCH 1039/1883] Fix some unhandled opcode output messages --- zone/client_packet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index abeafc750..d01d7ad75 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -458,9 +458,8 @@ int Client::HandlePacket(const EQApplicationPacket *app) args.push_back(const_cast(app)); parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); - char buffer[64]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s", buffer); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: 0x%04x", app->GetOpcode()); if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) From 126eca2ad69957a6cec68b81df6ba821231e3452 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:32:11 -0600 Subject: [PATCH 1040/1883] Add opcode name lookup on unhandled client opcode log message --- zone/client_packet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d01d7ad75..691681347 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -17,6 +17,7 @@ #include "../common/debug.h" #include "../common/eqemu_logsys.h" +#include "../common/opcodemgr.h" #include #include #include @@ -459,7 +460,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); char buffer[64]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: 0x%04x", app->GetOpcode()); + logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) From d01f307edcc475954122a6d080c0916c1a9af863 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:34:49 -0800 Subject: [PATCH 1041/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 4dc914273..bb985ddce 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3666,7 +3666,7 @@ void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator, // Use the old method for all other nearby clients for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2) + if(c && (c != QuestInitiator) && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2) c->Message_StringID(10, GENERIC_SAY, mobname, message); } } From 30eb545b0bd7faddce130bf6c76505e4fb19e7df Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:36:59 -0800 Subject: [PATCH 1042/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index bb985ddce..2b0551a26 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3868,7 +3868,7 @@ Mob *EntityList::GetTargetForMez(Mob *caster) continue; } - if (caster->DistNoRoot(*d) > 22250) { //only pick targets within 150 range + if (ComparativeDistance(caster->GetPosition(), d->GetPosition()) > 22250) { //only pick targets within 150 range ++it; continue; } From 55024a861535867d581dcd8dd73a2ad8e5083200 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:41:04 -0800 Subject: [PATCH 1043/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 6adc6735a..4b18abb40 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -758,7 +758,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { } else if(members[z] != nullptr) { - distance = caster->DistNoRoot(*members[z]); + distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition()); if(distance <= range2 && distance >= min_range2) { members[z]->CalcSpellPowerDistanceMod(spell_id, distance); caster->SpellOnTarget(spell_id, members[z]); @@ -798,7 +798,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { } else if(members[z] != nullptr) { - distance = caster->DistNoRoot(*members[z]); + distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition()); if(distance <= range2) { members[z]->BardPulse(spell_id, caster); #ifdef GROUP_BUFF_PETS From 7dbde36b031abf82fd64b550a9874b91761e4368 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:41:18 -0600 Subject: [PATCH 1044/1883] Rename reference logger to Log --- client_files/export/main.cpp | 34 +-- client_files/import/main.cpp | 32 +-- common/crash.cpp | 44 +-- common/database.cpp | 34 +-- common/debug.cpp | 2 +- common/eq_stream.cpp | 242 ++++++++--------- common/eq_stream_factory.cpp | 8 +- common/eq_stream_ident.cpp | 22 +- common/eqemu_logsys.h | 2 +- common/eqtime.cpp | 6 +- common/guild_base.cpp | 132 ++++----- common/item.cpp | 2 +- common/misc_functions.h | 2 +- common/patches/rof.cpp | 88 +++--- common/patches/rof2.cpp | 88 +++--- common/patches/sod.cpp | 58 ++-- common/patches/sof.cpp | 28 +- common/patches/ss_define.h | 8 +- common/patches/titanium.cpp | 22 +- common/patches/underfoot.cpp | 58 ++-- common/ptimer.cpp | 14 +- common/rulesys.cpp | 36 +-- common/shareddb.cpp | 106 ++++---- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 4 +- common/tcp_connection.cpp | 4 +- common/tcp_server.cpp | 4 +- common/timeoutmgr.cpp | 6 +- common/worldconn.cpp | 4 +- eqlaunch/eqlaunch.cpp | 22 +- eqlaunch/worldserver.cpp | 18 +- eqlaunch/zone_launch.cpp | 46 ++-- queryserv/database.cpp | 60 ++--- queryserv/lfguild.cpp | 14 +- queryserv/queryserv.cpp | 20 +- queryserv/worldserver.cpp | 6 +- shared_memory/main.cpp | 38 +-- ucs/chatchannel.cpp | 32 +-- ucs/clientlist.cpp | 78 +++--- ucs/database.cpp | 90 +++---- ucs/ucs.cpp | 30 +-- ucs/worldserver.cpp | 8 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/client.cpp | 168 ++++++------ world/cliententry.cpp | 2 +- world/clientlist.cpp | 14 +- world/console.cpp | 24 +- world/eql_config.cpp | 22 +- world/eqw.cpp | 6 +- world/eqw_http_handler.cpp | 18 +- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 +- world/launcher_list.cpp | 10 +- world/login_server.cpp | 32 +-- world/login_server_list.cpp | 2 +- world/net.cpp | 120 ++++----- world/queryserv.cpp | 12 +- world/ucs.cpp | 12 +- world/wguild_mgr.cpp | 26 +- world/worlddb.cpp | 18 +- world/zonelist.cpp | 8 +- world/zoneserver.cpp | 88 +++--- zone/aa.cpp | 46 ++-- zone/aggro.cpp | 22 +- zone/attack.cpp | 174 ++++++------ zone/bonuses.cpp | 6 +- zone/bot.cpp | 116 ++++---- zone/botspellsai.cpp | 4 +- zone/client.cpp | 70 ++--- zone/client_mods.cpp | 12 +- zone/client_packet.cpp | 510 +++++++++++++++++------------------ zone/client_process.cpp | 24 +- zone/command.cpp | 64 ++--- zone/corpse.cpp | 8 +- zone/doors.cpp | 16 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 10 +- zone/embxs.cpp | 6 +- zone/entity.cpp | 14 +- zone/exp.cpp | 8 +- zone/fearpath.cpp | 4 +- zone/forage.cpp | 6 +- zone/groups.cpp | 36 +-- zone/guild.cpp | 20 +- zone/guild_mgr.cpp | 48 ++-- zone/horse.cpp | 6 +- zone/inventory.cpp | 154 +++++------ zone/loottables.cpp | 4 +- zone/merc.cpp | 16 +- zone/mob.cpp | 6 +- zone/mob_ai.cpp | 20 +- zone/net.cpp | 116 ++++---- zone/npc.cpp | 20 +- zone/object.cpp | 8 +- zone/pathing.cpp | 146 +++++----- zone/perl_client.cpp | 16 +- zone/petitions.cpp | 10 +- zone/pets.cpp | 16 +- zone/questmgr.cpp | 30 +-- zone/raids.cpp | 22 +- zone/spawn2.cpp | 152 +++++------ zone/spawngroup.cpp | 8 +- zone/special_attacks.cpp | 58 ++-- zone/spell_effects.cpp | 32 +-- zone/spells.cpp | 352 ++++++++++++------------ zone/tasks.cpp | 252 ++++++++--------- zone/titles.cpp | 12 +- zone/tradeskills.cpp | 82 +++--- zone/trading.cpp | 122 ++++----- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 108 ++++---- zone/worldserver.cpp | 42 +-- zone/zone.cpp | 152 +++++------ zone/zonedb.cpp | 124 ++++----- zone/zoning.cpp | 46 ++-- 119 files changed, 2775 insertions(+), 2775 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 18136fcf4..1b129e552 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -27,7 +27,7 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" -EQEmuLogSys logger; +EQEmuLogSys Log; void ExportSpells(SharedDatabase *db); void ExportSkillCaps(SharedDatabase *db); @@ -35,25 +35,25 @@ void ExportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientExport); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); - logger.Log(EQEmuLogSys::Status, "Client Files Export Utility"); + Log.Log(EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - logger.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -66,11 +66,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Exporting Spells..."); + Log.Log(EQEmuLogSys::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - logger.Log(EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -140,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Exporting Skill Caps..."); + Log.Log(EQEmuLogSys::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -169,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Exporting Base Data..."); + Log.Log(EQEmuLogSys::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - logger.Log(EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 492e7b901..6e65df96b 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -25,7 +25,7 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" -EQEmuLogSys logger; +EQEmuLogSys Log; void ImportSpells(SharedDatabase *db); void ImportSkillCaps(SharedDatabase *db); @@ -33,25 +33,25 @@ void ImportBaseData(SharedDatabase *db); int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformClientImport); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); - logger.Log(EQEmuLogSys::Status, "Client Files Import Utility"); + Log.Log(EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - logger.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -76,10 +76,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Importing Spells..."); + Log.Log(EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -142,23 +142,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Importing Skill Caps..."); + Log.Log(EQEmuLogSys::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -190,11 +190,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - logger.Log(EQEmuLogSys::Status, "Importing Base Data..."); + Log.Log(EQEmuLogSys::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - logger.Log(EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); + Log.Log(EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index 94a8fb928..bbc9c3f49 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -25,7 +25,7 @@ public: } } - logger.Log(EQEmuLogSys::Crash, buffer); + Log.Log(EQEmuLogSys::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - logger.Log(EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); + Log.Log(EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - logger.Log(EQEmuLogSys::Crash, "Unknown Exception"); + Log.Log(EQEmuLogSys::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index 0246785fd..5c506fd53 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - logger.Log(EQEmuLogSys::Error, "StoreCharacter: no character id"); + Log.Log(EQEmuLogSys::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - logger.Log(EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - logger.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + Log.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //logger.Log(EQEmuLogSys::Debug, "Character not in a group: %s", name); + //Log.Log(EQEmuLogSys::Debug, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - logger.Log(EQEmuLogSys::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/debug.cpp b/common/debug.cpp index fc7a4cc16..9b15bcbd9 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -158,7 +158,7 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) va_list argptr, tmpargptr; va_start(argptr, fmt); - logger.Log(id, vStringFormat(fmt, argptr).c_str()); + Log.Log(id, vStringFormat(fmt, argptr).c_str()); return true; } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index eb95d557f..9ae9db4e3 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if (emu_op == OP_Unknown) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if(emu_op == OP_Unknown) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1111,7 +1111,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1141,33 +1141,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1178,10 +1178,10 @@ logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKE SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } @@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } @@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 3bd6ad185..f0fb30929 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index a550bbbd3..d267a013c 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -103,13 +103,13 @@ void EQStreamIdentifier::Process() { switch(res) { case EQStream::MatchNotReady: //the stream has not received enough packets to compare with this signature -// logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); +// Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); all_ready = false; break; case EQStream::MatchSuccessful: { //yay, a match. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 7a6ba419e..97cffc9dd 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -115,7 +115,7 @@ private: void ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message); }; -extern EQEmuLogSys logger; +extern EQEmuLogSys Log; /* If you add to this, make sure you update LogCategory */ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 4ffd66bb3..c689b634c 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - logger.Log(EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + Log.Log(EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - logger.Log(EQEmuLogSys::Error, "Could not load EQTime file %s", filename); + Log.Log(EQEmuLogSys::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - logger.Log(EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + Log.Log(EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index deb7ea1e0..b168d49fb 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -337,18 +337,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } if (results.RowCount() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); return index; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/common/item.cpp b/common/item.cpp index 9e8be60f7..c564edae7 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - logger.Log(EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Log.Log(EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/misc_functions.h b/common/misc_functions.h index 8a77972c2..27e648511 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 4925ba3d4..9e952ca74 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -52,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -316,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -551,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -585,13 +585,13 @@ namespace RoF safe_delete_array(Serialized); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -952,16 +952,16 @@ namespace RoF ENCODE(OP_GroupUpdate) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -979,7 +979,7 @@ namespace RoF return; } //if(gjs->action == groupActLeave) - // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -996,19 +996,19 @@ namespace RoF if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1016,7 +1016,7 @@ namespace RoF } } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1078,7 +1078,7 @@ namespace RoF return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1386,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2556,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3321,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3654,16 +3654,16 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3902,9 +3902,9 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4298,7 +4298,7 @@ namespace RoF DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4312,7 +4312,7 @@ namespace RoF DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4326,7 +4326,7 @@ namespace RoF DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4340,7 +4340,7 @@ namespace RoF DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4353,7 +4353,7 @@ namespace RoF DECODE(OP_GroupInvite2) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4497,8 +4497,8 @@ namespace RoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4827,7 +4827,7 @@ namespace RoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF::structs::ItemSerializationHeader hdr; @@ -4936,7 +4936,7 @@ namespace RoF } ss.write((const char*)&null_term, sizeof(uint8)); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); RoF::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF::structs::ItemBodyStruct)); @@ -5043,7 +5043,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); RoF::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF::structs::ItemSecondaryBodyStruct)); @@ -5084,7 +5084,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); RoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF::structs::ItemTertiaryBodyStruct)); @@ -5123,7 +5123,7 @@ namespace RoF // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); RoF::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF::structs::ClickEffectStruct)); @@ -5150,7 +5150,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); RoF::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF::structs::ProcEffectStruct)); @@ -5174,7 +5174,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); RoF::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF::structs::WornEffectStruct)); @@ -5265,7 +5265,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); RoF::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF::structs::ItemQuaternaryBodyStruct)); @@ -5455,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5496,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5601,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5636,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index b0cdc9739..0fa71bb36 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -52,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF2 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -382,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -617,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -651,13 +651,13 @@ namespace RoF2 safe_delete_array(Serialized); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -1018,16 +1018,16 @@ namespace RoF2 ENCODE(OP_GroupUpdate) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -1045,7 +1045,7 @@ namespace RoF2 return; } //if(gjs->action == groupActLeave) - // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -1062,19 +1062,19 @@ namespace RoF2 if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1082,7 +1082,7 @@ namespace RoF2 } } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1144,7 +1144,7 @@ namespace RoF2 return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1452,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2640,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3387,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3721,16 +3721,16 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3973,9 +3973,9 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4370,7 +4370,7 @@ namespace RoF2 DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4384,7 +4384,7 @@ namespace RoF2 DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4398,7 +4398,7 @@ namespace RoF2 DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4412,7 +4412,7 @@ namespace RoF2 DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4425,7 +4425,7 @@ namespace RoF2 DECODE(OP_GroupInvite2) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4568,8 +4568,8 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4898,7 +4898,7 @@ namespace RoF2 std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF2::structs::ItemSerializationHeader hdr; @@ -5006,7 +5006,7 @@ namespace RoF2 } ss.write((const char*)&null_term, sizeof(uint8)); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); RoF2::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF2::structs::ItemBodyStruct)); @@ -5113,7 +5113,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); RoF2::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); @@ -5154,7 +5154,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); RoF2::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF2::structs::ItemTertiaryBodyStruct)); @@ -5193,7 +5193,7 @@ namespace RoF2 // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); RoF2::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF2::structs::ClickEffectStruct)); @@ -5220,7 +5220,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); RoF2::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF2::structs::ProcEffectStruct)); @@ -5244,7 +5244,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); RoF2::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF2::structs::WornEffectStruct)); @@ -5335,7 +5335,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); RoF2::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); @@ -5546,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5587,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5696,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5731,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 230316bed..5b9ea0aab 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -50,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoD - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -247,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -359,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -391,13 +391,13 @@ namespace SoD } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -683,16 +683,16 @@ namespace SoD ENCODE(OP_GroupUpdate) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -710,7 +710,7 @@ namespace SoD return; } //if(gjs->action == groupActLeave) - // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -727,19 +727,19 @@ namespace SoD if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -747,7 +747,7 @@ namespace SoD } } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -807,7 +807,7 @@ namespace SoD return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -967,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2108,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2363,16 +2363,16 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -2963,7 +2963,7 @@ namespace SoD DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -2977,7 +2977,7 @@ namespace SoD DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -2991,7 +2991,7 @@ namespace SoD DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3005,7 +3005,7 @@ namespace SoD DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3018,7 +3018,7 @@ namespace SoD DECODE(OP_GroupInvite2) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3091,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); @@ -3384,7 +3384,7 @@ namespace SoD std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoD::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index c84518293..0ab39d521 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -50,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoF - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -214,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -337,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -371,13 +371,13 @@ namespace SoF } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -766,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1707,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1887,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2096,7 +2096,7 @@ namespace SoF //kill off the emu structure and send the eq packet. delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawns"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawns"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -2429,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); @@ -2708,7 +2708,7 @@ namespace SoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoF::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index 7b53f78bb..de9237636 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index e7903e304..f607941fd 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -48,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -74,7 +74,7 @@ namespace Titanium - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -89,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -187,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -268,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -285,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -635,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1157,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1274,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1623,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index a12fc66ed..2602a62c1 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -50,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace Underfoot - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -307,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -494,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -526,13 +526,13 @@ namespace Underfoot safe_delete_array(Serialized); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -839,16 +839,16 @@ namespace Underfoot ENCODE(OP_GroupUpdate) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -867,7 +867,7 @@ namespace Underfoot return; } //if(gjs->action == groupActLeave) - // logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -884,19 +884,19 @@ namespace Underfoot if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -904,7 +904,7 @@ namespace Underfoot } } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -964,7 +964,7 @@ namespace Underfoot delete in; return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1190,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2374,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2624,16 +2624,16 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -3276,7 +3276,7 @@ namespace Underfoot DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -3290,7 +3290,7 @@ namespace Underfoot DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3304,7 +3304,7 @@ namespace Underfoot DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3318,7 +3318,7 @@ namespace Underfoot DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3331,7 +3331,7 @@ namespace Underfoot DECODE(OP_GroupInvite2) { - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3406,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); @@ -3629,7 +3629,7 @@ namespace Underfoot std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //logger.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); Underfoot::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 2d6e07c63..ea718fdd9 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - logger.Log(EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); + Log.Log(EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - logger.Log(EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 683697422..e0a1091e3 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -282,13 +282,13 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 5efa08efe..d6d6916fd 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - logger.Log(EQEmuLogSys::Error, + Log.Log(EQEmuLogSys::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - logger.Log(EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + Log.Log(EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - logger.Log(EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + Log.Log(EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - logger.Log(EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error, "No book to send, (%s)", txtfile); + Log.Log(EQEmuLogSys::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - logger.Log(EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - logger.Log(EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); + Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); + Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/spdat.cpp b/common/spdat.cpp index c6b7b26d9..c54dfd1de 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 97541d559..a0890c1ec 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index bc9df8389..b7434b947 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index f1154b120..f61418a50 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 309d24f1a..5cc77e750 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - logger.Log(EQEmuLogSys::Debug, "Checking timeout on 0x%x\n", it); + Log.Log(EQEmuLogSys::Debug, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - logger.Log(EQEmuLogSys::Debug, "Adding timeoutable 0x%x\n", who); + Log.Log(EQEmuLogSys::Debug, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - logger.Log(EQEmuLogSys::Debug, "Removing timeoutable 0x%x\n", who); + Log.Log(EQEmuLogSys::Debug, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index 72e1c768e..f1820186f 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -76,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 1ef88d381..c145ed9a6 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -31,7 +31,7 @@ #include #include -EQEmuLogSys logger; +EQEmuLogSys Log; bool RunLoops = false; @@ -39,7 +39,7 @@ void CatchSignal(int sig_num); int main(int argc, char *argv[]) { RegisterExecutablePlatform(ExePlatformLaunch); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); std::string launcher_name; @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 43170a9ec..4d537c40b 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -74,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -90,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -101,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -111,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -127,7 +127,7 @@ void WorldServer::Process() { } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 532028fc6..66baf675b 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -72,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -84,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -102,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -164,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -187,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -197,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 244292de4..c7c4ec8c9 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 01ab77312..cb3143d7b 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -242,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -257,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -288,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -305,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -335,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -348,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 696224bc0..9011d94f5 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -40,7 +40,7 @@ LFGuildManager lfguildmanager; std::string WorldShortName; const queryservconfig *Config; WorldServer *worldserver = 0; -EQEmuLogSys logger; +EQEmuLogSys Log; void CatchSignal(int sig_num) { RunLoops = false; @@ -50,7 +50,7 @@ void CatchSignal(int sig_num) { int main() { RegisterExecutablePlatform(ExePlatformQueryServ); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); Timer LFGuildExpireTimer(60000); Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect @@ -65,16 +65,16 @@ int main() { */ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -83,22 +83,22 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index d55da3be9..b2a3d0605 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -53,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -148,7 +148,7 @@ void WorldServer::Process() break; } default: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index e8d7ec8b9..765d08c22 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -33,29 +33,29 @@ #include "spells.h" #include "base_data.h" -EQEmuLogSys logger; +EQEmuLogSys Log; int main(int argc, char **argv) { RegisterExecutablePlatform(ExePlatformSharedMemory); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); - logger.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); + Log.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - logger.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - logger.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.Log(EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -114,61 +114,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - logger.Log(EQEmuLogSys::Status, "Loading items..."); + Log.Log(EQEmuLogSys::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - logger.Log(EQEmuLogSys::Status, "Loading factions..."); + Log.Log(EQEmuLogSys::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - logger.Log(EQEmuLogSys::Status, "Loading loot..."); + Log.Log(EQEmuLogSys::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - logger.Log(EQEmuLogSys::Status, "Loading skill caps..."); + Log.Log(EQEmuLogSys::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - logger.Log(EQEmuLogSys::Status, "Loading spells..."); + Log.Log(EQEmuLogSys::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - logger.Log(EQEmuLogSys::Status, "Loading base data..."); + Log.Log(EQEmuLogSys::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.Log(EQEmuLogSys::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 13d37f9ec..06c05516f 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -42,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -149,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -170,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -228,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -237,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -262,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -299,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -397,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -479,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -555,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -572,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -587,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -613,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -628,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -654,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -669,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index a95e951e6..de18778c8 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -236,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -305,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -400,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -430,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -481,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -560,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -586,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -606,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -646,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -667,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -703,7 +703,7 @@ void Clientlist::Process() { default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -716,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -860,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -885,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -896,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -905,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -971,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1012,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1113,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1292,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1435,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1647,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1702,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1790,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1918,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1999,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2087,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2196,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); } } } @@ -2299,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2377,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index f18e12fe5..d437e3d64 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 6f64463f3..196200a48 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -51,7 +51,7 @@ std::string WorldShortName; const ucsconfig *Config; WorldServer *worldserver = nullptr; -EQEmuLogSys logger; +EQEmuLogSys Log; void CatchSignal(int sig_num) { @@ -69,7 +69,7 @@ std::string GetMailPrefix() { int main() { RegisterExecutablePlatform(ExePlatformUCS); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); // Check every minute for unused channels we can delete @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -104,22 +104,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 49f4d2b48..c6e91d47c 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -52,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -67,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -88,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -99,7 +99,7 @@ void WorldServer::Process() if(!c) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); break; } diff --git a/world/adventure.cpp b/world/adventure.cpp index 453e3f93f..0c0c3b18d 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 022448516..53a755bdb 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/client.cpp b/world/client.cpp index 0584fac61..1606de8af 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -136,7 +136,7 @@ void Client::SendEnterWorld(std::string name) eqs->Close(); return; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); } } @@ -378,7 +378,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if (strlen(password) <= 1) { // TODO: Find out how to tell the client wrong username/password - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); return false; } @@ -408,31 +408,31 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password))) #else if (loginserverlist.Connected() == false && !pZoning) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); return false; } if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); return false; } cle->SetOnline(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); if(minilogin){ WorldConfig::DisableStats(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); } const WorldConfig *Config=WorldConfig::get(); @@ -465,7 +465,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else { // TODO: Find out how to tell the client wrong username/password - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); return false; } @@ -479,7 +479,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); return false; } @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -648,11 +648,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); return false; } else if (app->size != sizeof(CharCreate_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); DumpPacket(app); // the previous behavior was essentially returning true here // but that seems a bit odd to me. @@ -679,14 +679,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); eqs->Close(); return true; } if(GetAdmin() < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); eqs->Close(); return true; } @@ -702,14 +702,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { uint32 tmpaccid = 0; charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID); if (charid == 0 || tmpaccid != GetAccountID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); eqs->Close(); return true; } // Make sure this account owns this character if (tmpaccid != GetAccountID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); eqs->Close(); return true; } @@ -737,7 +737,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { zoneID = database.MoveCharacterToBind(charid,4); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go home before they're able...",char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -770,7 +770,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -780,7 +780,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (zoneID == 0 || !database.GetZoneName(zoneID)) { // This is to save people in an invalid zone, once it's removed from the DB database.MoveCharacterToZone(charid, "arena"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); } if(instanceID > 0) @@ -894,7 +894,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer); if(char_acct_id == GetAccountID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); database.DeleteCharacter((char *)app->pBuffer); SendCharInfo(); } @@ -915,25 +915,25 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); return false; } // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); eqs->Close(); } } if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) { // Got a packet other than OP_SendLoginInfo when not logged in - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); return false; } else if (opcode == OP_AckPacket) { @@ -1005,7 +1005,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); _pkt(WORLD__CLIENT_ERR,app); return true; } @@ -1024,7 +1024,7 @@ bool Client::Process() { to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); ZoneUnavail(); } if(connect.Check()){ @@ -1058,7 +1058,7 @@ bool Client::Process() { loginserverlist.SendPacket(pack); safe_delete(pack); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); return false; } @@ -1107,17 +1107,17 @@ void Client::EnterWorld(bool TryBootup) { } else { if (TryBootup) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); autobootup_timeout.Start(); pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID); if (pwaitingforbootup == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); ZoneUnavail(); } return; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); ZoneUnavail(); return; } @@ -1126,12 +1126,12 @@ void Client::EnterWorld(bool TryBootup) { cle->SetChar(charid, char_name); database.UpdateLiveChar(char_name, GetAccountID()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); // database.SetAuthentication(account_id, char_name, zone_name, ip); if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,9 +1169,9 @@ void Client::Clearance(int8 response) { if (zs == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); } ZoneUnavail(); @@ -1181,20 +1181,20 @@ void Client::Clearance(int8 response) EQApplicationPacket* outapp; if (zs->GetCAddress() == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); ZoneUnavail(); return; } if (zoneID == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } const char* zonename = database.GetZoneName(zoneID); if (zonename == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } @@ -1225,7 +1225,7 @@ void Client::Clearance(int8 response) } strcpy(zsi->ip, zs_addr); zsi->port =zs->GetCPort(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); QueuePacket(outapp); safe_delete(outapp); @@ -1256,7 +1256,7 @@ bool Client::GenPassKey(char* key) { } void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P @@ -1355,27 +1355,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); /* Validate the char creation struct */ if (ClientVersionBit & BIT_SoFAndLater) { if (!CheckCharCreateInfoSoF(cc)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { if (!CheckCharCreateInfoTitanium(cc)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } @@ -1437,21 +1437,21 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); pp.zone_id = RuleI(World, SoFStartZoneID); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); } else { /* if there's a startzone variable put them in there */ if (database.GetVariable("startzone", startzone, 50)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; if (ClientVersionBit & BIT_TitaniumAndEarlier) @@ -1490,11 +1490,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ @@ -1503,10 +1503,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // now we give the pp and the inv we made to StoreCharacter // to see if we can store it if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); return false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); return true; } @@ -1516,7 +1516,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1533,7 +1533,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1550,7 +1550,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1563,37 +1563,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); return false; } @@ -1606,7 +1606,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1687,7 +1687,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1700,16 +1700,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1737,43 +1737,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index d66401810..1dc8f3eca 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index d8c536ca4..0d874b304 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -425,7 +425,7 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) } int16 tmpadmin; - //logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login with '%s' and '%s'", iName, iPassword); + //Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login with '%s' and '%s'", iName, iPassword); uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin); if (accid) { @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index f9a646d07..f1f4a7edf 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 5707d43d7..80ec90f40 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/eqw.cpp b/world/eqw.cpp index 677aed6f9..1c0b811ee 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -75,11 +75,11 @@ EQW::EQW() { void EQW::AppendOutput(const char *str) { m_outputBuffer += str; -// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); +// Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); } const std::string &EQW::GetOutput() const { -// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Getting, length %d", m_outputBuffer.length()); +// Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Getting, length %d", m_outputBuffer.length()); return(m_outputBuffer); } @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index 06660b683..9737bca12 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } @@ -320,12 +320,12 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { /* void EQWHTTPServer::Run() { - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread started on port %d", m_port); + Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread started on port %d", m_port); do { #warning DELETE THIS IF YOU DONT USE IT Sleep(10); } while(m_running); - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread terminating on port %d", m_port); + Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread terminating on port %d", m_port); } ThreadReturnType EQWHTTPServer::ThreadProc(void *data) { diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 09710cbff..f3f5dd50f 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 3baaabc92..8e1c65afe 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 01dbbd4a7..56c9c38e1 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index e526febfc..10b6e36c8 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index e74bc6a9a..1504badcc 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index d3defb1a2..d6ea3259d 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -105,7 +105,7 @@ uint32 numclients = 0; uint32 numzones = 0; bool holdzones = false; -EQEmuLogSys logger; +EQEmuLogSys Log; extern ConsoleList console_list; @@ -113,7 +113,7 @@ void CatchSignal(int sig_num); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); - logger.LoadLogSettingsDefaults(); + Log.LoadLogSettingsDefaults(); set_exception_handler(); /* Database Version Check */ @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); database.LoadVariables(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); database.LoadZoneNames(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); database.ClearGroup(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); if (!database.LoadItems()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 66af57d53..b206dc961 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -23,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -57,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -69,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -79,7 +79,7 @@ bool QueryServConnection::Process() } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -97,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -114,7 +114,7 @@ bool QueryServConnection::Process() } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index 174b71b98..91ac8afba 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -18,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -52,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -64,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -74,7 +74,7 @@ bool UCSConnection::Process() } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -92,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index c97f29b7a..a4de9647d 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -34,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 5e14dcc59..72c90f494 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.Log(EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); + Log.Log(EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - logger.Log(EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); + Log.Log(EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 51962d16e..d1abf523a 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 3cf75a90d..4a09a7b98 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -77,7 +77,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { char* longname; if (iZoneID) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; @@ -188,7 +188,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -199,7 +199,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -541,10 +541,10 @@ bool ZoneServer::Process() { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } @@ -589,10 +589,10 @@ bool ZoneServer::Process() { ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } @@ -602,7 +602,7 @@ bool ZoneServer::Process() { const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { @@ -685,12 +685,12 @@ bool ZoneServer::Process() { if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); /* This is a request from the egress zone */ if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) { ztz->response = 0; @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } @@ -736,7 +736,7 @@ bool ZoneServer::Process() { /* Response from Ingress server, route back to egress */ else{ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = nullptr; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); @@ -754,7 +754,7 @@ bool ZoneServer::Process() { } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); @@ -763,7 +763,7 @@ bool ZoneServer::Process() { case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); @@ -868,7 +868,7 @@ bool ZoneServer::Process() { } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; @@ -888,7 +888,7 @@ bool ZoneServer::Process() { } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; @@ -913,7 +913,7 @@ bool ZoneServer::Process() { } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; @@ -924,7 +924,7 @@ bool ZoneServer::Process() { } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; @@ -943,7 +943,7 @@ bool ZoneServer::Process() { break; } case ServerOP_GetWorldTime: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; @@ -958,17 +958,17 @@ bool ZoneServer::Process() { break; } case ServerOP_SetWorldTime: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; @@ -980,7 +980,7 @@ bool ZoneServer::Process() { } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; @@ -1025,10 +1025,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; @@ -1047,10 +1047,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else @@ -1067,10 +1067,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } @@ -1079,10 +1079,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { @@ -1098,10 +1098,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } @@ -1119,10 +1119,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1138,10 +1138,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else @@ -1149,10 +1149,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1254,7 +1254,7 @@ bool ZoneServer::Process() { case ServerOP_LSAccountUpdate: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } @@ -1309,7 +1309,7 @@ bool ZoneServer::Process() { } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/zone/aa.cpp b/zone/aa.cpp index db28b2dc8..13ab491d6 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - logger.Log(EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); + Log.Log(EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - logger.Log(EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + Log.Log(EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - logger.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + Log.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - logger.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); + Log.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -951,7 +951,7 @@ void Client::SendAAStats() { void Client::BuyAA(AA_Action* action) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); //find the AA information from the database SendAA_Struct* aa2 = zone->FindAA(action->ability); @@ -963,7 +963,7 @@ void Client::BuyAA(AA_Action* action) a = action->ability - i; if(a <= 0) break; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); aa2 = zone->FindAA(a); if(aa2 != nullptr) break; @@ -980,7 +980,7 @@ void Client::BuyAA(AA_Action* action) uint32 cur_level = GetAA(aa2->id); if((aa2->id + cur_level) != action->ability) { //got invalid AA - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); return; } @@ -1011,7 +1011,7 @@ void Client::BuyAA(AA_Action* action) if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); m_pp.aapoints -= real_cost; @@ -1429,10 +1429,10 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - logger.Log(EQEmuLogSys::Status, "Loading AA information..."); + Log.Log(EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - logger.Log(EQEmuLogSys::Error, "Failed to load AAs!"); + Log.Log(EQEmuLogSys::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1447,11 +1447,11 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - logger.Log(EQEmuLogSys::Status, "Loading AA Effects..."); + Log.Log(EQEmuLogSys::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - logger.Log(EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); + Log.Log(EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else - logger.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); + Log.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - logger.Log(EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); + Log.Log(EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 83a47a76e..c1f3d4ce3 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,17 +342,17 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); return(false); } @@ -466,7 +466,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -693,7 +693,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -833,7 +833,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -945,7 +945,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index fdb95e467..ec696990c 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -57,7 +57,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); switch (item->ItemType) { @@ -187,7 +187,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; if(IsClient() && other->IsClient()) @@ -208,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -236,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -308,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -327,7 +327,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); // @@ -336,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } @@ -370,7 +370,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && other->InFrontMob(this, other->GetX(), other->GetY())) { damage = -3; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -517,7 +517,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -690,9 +690,9 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); } } @@ -1128,14 +1128,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } if(!GetTarget()) SetTarget(other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); //SetAttackTimer(); if ( @@ -1145,12 +1145,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b || (GetHP() < 0) || (!IsAttackAllowed(other)) ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); return false; // Only bards can attack while casting } if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable! return false; } @@ -1170,19 +1170,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -1200,7 +1200,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(IsBerserk() && GetClass() == BERSERKER){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -1268,7 +1268,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); int hit_chance_bonus = 0; @@ -1283,7 +1283,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it other->AvoidDamage(this, damage); @@ -1291,7 +1291,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -1430,7 +1430,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } int exploss = 0; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); /* #1: Send death packet to everyone @@ -1692,7 +1692,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -1710,7 +1710,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (other->IsClient()) other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); } return false; } @@ -1737,10 +1737,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); if(Hand == MainSecondary && weapon->ItemType == ItemTypeShield){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); return false; } @@ -1829,11 +1829,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } @@ -1846,7 +1846,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if(other->IsClient() && other->CastToClient()->IsSitting()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); damage = (max_dmg+eleBane); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); @@ -1857,7 +1857,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool hate += opts->hate_flat; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list other->AddToHateList(this, hate); @@ -1881,7 +1881,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(damage > 0) { CommonOutgoingHitSuccess(other, damage, skillinuse); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list if(damage > 0) other->AddToHateList(this, hate); @@ -1890,7 +1890,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); if(other->IsClient() && IsPet() && GetOwner()->IsClient()) { //pets do half damage to clients in pvp @@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //cant riposte a riposte if (bRiposte && damage == -3) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); return false; } @@ -1954,7 +1954,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -1991,7 +1991,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); Mob *oos = nullptr; if(killerMob) { @@ -2028,7 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); @@ -2580,7 +2580,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(DS == 0 && rev_ds == 0) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); //invert DS... spells yield negative values for a true damage shield if(DS < 0) { @@ -2625,7 +2625,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID; if(rev_ds < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } @@ -3137,7 +3137,7 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce >= buffs[slot].melee_rune) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3145,7 +3145,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3164,7 +3164,7 @@ int32 Mob::ReduceDamage(int32 damage) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3172,7 +3172,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) @@ -3290,7 +3290,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if(!TryFadeEffect(slot)) @@ -3298,7 +3298,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) @@ -3437,11 +3437,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == SkillAbjuration); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); if (GetInvul() || DivineAura()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } @@ -3493,7 +3493,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int healed = damage; healed = attacker->GetActSpellHealing(spell_id, healed); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); attacker->HealDamage(healed); //we used to do a message to the client, but its gone now. @@ -3506,7 +3506,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse()) { if (!pet->IsHeld()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); pet->AddToHateList(attacker, 1); pet->SetTarget(attacker); Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName()); @@ -3516,7 +3516,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if any runes want to reduce this damage if(spell_id == SPELL_UNKNOWN) { damage = ReduceDamage(damage); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); damage = ReduceAllDamage(damage); TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker); } else { @@ -3573,7 +3573,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //fade mez if we are mezzed if (IsMezzed() && attacker) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); @@ -3616,7 +3616,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); if (IsClient()) { stun_resist += aabonuses.StunResist; frontal_stun_resist += aabonuses.FrontalStunResist; @@ -3626,20 +3626,20 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (((GetBaseRace() == OGRE && IsClient()) || (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); } } @@ -3653,7 +3653,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //increment chances of interrupting if(IsCasting()) { //shouldnt interrupt on regular spell damage attacked_count++; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); } } @@ -3859,7 +3859,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) ProcChance += ProcChance * ProcBonus / 100.0f; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3878,7 +3878,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; ProcChance = ProcChance + (ProcChance * ProcBonus); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3887,7 +3887,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3918,17 +3918,17 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } if (!IsAttackAllowed(on)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); return; } if (DivineAura()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); return; } @@ -3975,7 +3975,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level); if (IsPet()) { @@ -3986,7 +3986,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on Message_StringID(13, PROC_TOOLOW); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100); ExecWeaponProc(inst, weapon->Proc.Effect, on); @@ -4065,12 +4065,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); ExecWeaponProc(nullptr, PermaProcs[i].spellID, on); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); } @@ -4080,13 +4080,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d failed to proc %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); } @@ -4096,13 +4096,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d failed to proc %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); } @@ -4352,7 +4352,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Mob::DoRiposte(Mob* defender) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -4370,7 +4370,7 @@ void Mob::DoRiposte(Mob* defender) { //Live AA - Double Riposte if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; } @@ -4381,7 +4381,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); @@ -4398,7 +4398,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ int dmgbonusmod = 0; dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3; dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); damage += (damage*dmgbonusmod/10000); } } @@ -4467,7 +4467,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } @@ -4692,13 +4692,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); return true; } } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); return false; } @@ -4770,19 +4770,19 @@ void Mob::CommonBreakInvisible() { //break invis when you attack if(invisible) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 423f7742a..fde1dacc8 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -634,7 +634,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index 4cf6325b2..111d52675 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - logger.Log(EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + Log.Log(EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); + Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); return; } @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadStance()"); + Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in Bot::SaveStance()"); + Log.Log(EQEmuLogSys::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); + Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - logger.Log(EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); + Log.Log(EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); } @@ -2979,7 +2979,7 @@ void Bot::BotRangedAttack(Mob* other) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -2997,7 +2997,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!RangeWeapon || !Ammo) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); if(!IsAttackAllowed(other) || IsCasting() || @@ -3015,19 +3015,19 @@ void Bot::BotRangedAttack(Mob* other) { //break invis when you attack if(invisible) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -3362,7 +3362,7 @@ void Bot::AI_Process() { else if(!IsRooted()) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); return; @@ -3689,7 +3689,7 @@ void Bot::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -3972,7 +3972,7 @@ void Bot::PetAIProcess() { { botPet->SetRunAnimSpeed(0); if(!botPet->IsRooted()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed()); return; } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - logger.Log(EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + Log.Log(EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -5959,7 +5959,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); parse->EventNPC(EVENT_ATTACK, this, from, "", 0); } @@ -5972,7 +5972,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ // if spell is lifetap add hp to the caster if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { int healed = GetActSpellHealing(spell_id, damage); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); HealDamage(healed); entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() ); } @@ -6017,14 +6017,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } if(!GetTarget() || GetTarget() != other) SetTarget(other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || @@ -6036,13 +6036,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); if(other) { RemoveFromHateList(other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); } return false; } if(DivineAura()) {//cant attack while invulnerable - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); return false; } @@ -6068,19 +6068,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -6098,7 +6098,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(berserk && (GetClass() == BERSERKER)){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -6163,7 +6163,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b else damage = zone->random.Int(min_hit, max_hit); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); if(opts) { @@ -6175,7 +6175,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(other, skillinuse, Hand)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; other->AddToHateList(this, 0); } else { //we hit, try to avoid it @@ -6185,13 +6185,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b ApplyMeleeDamageBonus(skillinuse, damage); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); TryCriticalHit(other, skillinuse, damage, opts); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); // now add done damage to the hate list //other->AddToHateList(this, hate); } else other->AddToHateList(this, 0); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -6253,19 +6253,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //break invis when you attack if(invisible) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7335,7 +7335,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. @@ -7378,7 +7378,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { ProcChance += ProcChance*ProcBonus / 100.0f; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -7414,7 +7414,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && !other->BehindMob(this, other->GetX(), other->GetY())) { damage = -3; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -7556,7 +7556,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -7609,14 +7609,14 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint16 levelreq = aabonuses.FinishingBlowLvl[0]; if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); return true; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -7624,7 +7624,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Bot::DoRiposte(Mob* defender) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -7637,7 +7637,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); } @@ -8207,7 +8207,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW //entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s has scored a leathal HEADSHOT!", GetName()); @@ -8215,7 +8215,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { Result = true; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); } } } @@ -8441,11 +8441,11 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { return; } - // logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); + // Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); - //logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); + //Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -8548,7 +8548,7 @@ int32 Bot::CalcMaxMana() { } default: { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -9076,7 +9076,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -9084,7 +9084,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -9105,7 +9105,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t //cannot cast under deivne aura if(DivineAura()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -9119,7 +9119,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -9127,7 +9127,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t } if (HasActiveSong()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client //_StopSong(); bardsong = 0; @@ -9256,7 +9256,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); return true; } } @@ -9266,13 +9266,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3) ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); return true; } } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); } } @@ -15454,7 +15454,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 5ee57305b..cb2b2f4cd 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -950,7 +950,7 @@ bool Bot::AI_PursueCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { @@ -1055,7 +1055,7 @@ bool Bot::AI_EngagedCastCheck() { BotStanceType botStance = GetBotStance(); bool mayGetAggro = HasOrMayGetAggro(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); if(botClass == CLERIC) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { diff --git a/zone/client.cpp b/zone/client.cpp index cef327e77..7c993f337 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -340,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -438,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); break; }; } @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); - logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); + Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); } return true; } @@ -698,7 +698,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); @@ -1506,7 +1506,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); @@ -1911,7 +1911,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - logger.Log(EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + Log.Log(EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2105,7 +2105,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2145,7 +2145,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2235,13 +2235,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2262,10 +2262,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } @@ -2364,7 +2364,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - logger.Log(EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " + Log.Log(EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } @@ -4544,14 +4544,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -5294,7 +5294,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5362,7 +5362,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5389,7 +5389,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5397,7 +5397,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6211,7 +6211,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - logger.Log(EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + Log.Log(EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6225,7 +6225,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - logger.Log(EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + Log.Log(EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8149,7 +8149,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); #endif } else @@ -8166,7 +8166,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); #endif } } @@ -8289,11 +8289,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - logger.Log(EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + Log.Log(EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - logger.Log(EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - logger.Log(EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); + Log.Log(EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + Log.Log(EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index feaa0d18a..5d4221305 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - logger.Log(EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + Log.Log(EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; @@ -935,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -956,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1046,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 691681347..a39ad8fa2 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -401,7 +401,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) if(is_log_enabled(CLIENT__NET_IN_TRACE)) { char buffer[64]; app->build_header_dump(buffer); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); } EmuOpcode opcode = app->GetOpcode(); @@ -416,7 +416,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) #ifdef SOLAR if(0 && opcode != OP_ClientUpdate) { - logger.LogDebug(EQEmuLogSys::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); + Log.LogDebug(EQEmuLogSys::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); std::cerr << "OPCODE: " << std::hex << std::setw(4) << std::setfill('0') << opcode << std::dec << ", size: " << app->size << std::endl; DumpPacket(app); } @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - logger.Log(EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + Log.Log(EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -460,8 +460,8 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); char buffer[64]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); - if (logger.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); + if (Log.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) DumpPacket(app, app->size); @@ -483,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); break; } @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - logger.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); - logger.Log(EQEmuLogSys::Error, "Error message: %s", error->message); + Log.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.Log(EQEmuLogSys::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); + Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1317,14 +1317,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - logger.Log(EQEmuLogSys::Error, "GetAuth() returned false kicking client"); + Log.Log(EQEmuLogSys::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - logger.Log(EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + Log.Log(EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - logger.Log(EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + Log.Log(EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1899,7 +1899,7 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -1908,7 +1908,7 @@ void Client::Handle_OP_AAAction(const EQApplicationPacket *app) AA_Action* action = (AA_Action*)app->pBuffer; if (action->action == aaActionActivate) {//AA Hotkey - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); ActivateAA((aaID)action->ability); } else if (action->action == aaActionBuy) { @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - logger.Log(EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + Log.Log(EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + Log.Log(EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -2971,7 +2971,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (!IsPoison) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3572,7 +3572,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3635,8 +3635,8 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - logger.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + Log.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,16 +3721,16 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - logger.Log(EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); + Log.Log(EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - logger.Log(EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + Log.Log(EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - logger.Log(EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + Log.Log(EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,14 +3859,14 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - logger.Log(EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*)app->pBuffer; uint32 spid = sbf->spellid; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - logger.Log(EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + Log.Log(EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - logger.Log(EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + Log.Log(EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - logger.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); - logger.Log(EQEmuLogSys::Error, "Error message:%s", error->message); + Log.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.Log(EQEmuLogSys::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - logger.Log(EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); + Log.Log(EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - logger.Log(EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + Log.Log(EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5136,7 +5136,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5311,7 +5311,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5363,7 +5363,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5445,7 +5445,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5536,7 +5536,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5591,7 +5591,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5832,7 +5832,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); SendGuildMOTD(true); @@ -5845,7 +5845,7 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); SendGuildList(); } @@ -5858,7 +5858,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5910,7 +5910,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5927,7 +5927,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -5943,7 +5943,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6058,7 +6058,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6125,7 +6125,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6135,7 +6135,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - logger.Log(EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + Log.Log(EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -6177,7 +6177,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6300,7 +6300,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6311,7 +6311,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6379,7 +6379,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6396,7 +6396,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6440,12 +6440,12 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6587,7 +6587,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - logger.Log(EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + Log.Log(EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6607,7 +6607,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6656,7 +6656,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6725,7 +6725,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6734,7 +6734,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6770,7 +6770,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6816,7 +6816,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6835,7 +6835,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6844,7 +6844,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -6864,7 +6864,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -6889,7 +6889,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - logger.Log(EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); + Log.Log(EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7050,7 +7050,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - logger.Log(EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); + Log.Log(EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7121,7 +7121,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - logger.Log(EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); + Log.Log(EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } @@ -7192,7 +7192,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) @@ -7214,12 +7214,12 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); if (!guild_mgr.DeleteGuild(GuildID())) Message(0, "Guild delete failed."); else { @@ -7230,10 +7230,10 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); if (app->size != sizeof(GuildDemoteStruct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); return; } @@ -7263,7 +7263,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) uint8 rank = gci.rank - 1; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", demote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7281,7 +7281,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7322,7 +7322,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) //we could send this to the member and prompt them to see if they want to //be demoted (I guess), but I dont see a point in that. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7341,7 +7341,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7353,7 +7353,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); client->QueuePacket(app); } @@ -7376,7 +7376,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7386,7 +7386,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7409,7 +7409,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); SetPendingGuildInvitation(false); @@ -7445,7 +7445,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", gj->guildeqid, gj->response, gj->inviter, gj->newmember); //we dont really care a lot about what this packet means, as long as @@ -7459,7 +7459,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) if (gj->guildeqid == GuildID()) { //only need to change rank. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), gj->response, guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7471,7 +7471,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", GetName(), CharacterID(), guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid, gj->response); @@ -7500,10 +7500,10 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); if (app->size < 2) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); return; } @@ -7522,7 +7522,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) Client* newleader = entity_list.GetClientByName(gml->target); if (newleader) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID(), newleader->GetName(), newleader->CharacterID()); @@ -7543,9 +7543,9 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); if (app->size != sizeof(GuildManageBanker_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; } GuildManageBanker_Struct* gmb = (GuildManageBanker_Struct*)app->pBuffer; @@ -7620,16 +7620,16 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); if (app->size != sizeof(GuildPromoteStruct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); return; } @@ -7658,7 +7658,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", promote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7675,7 +7675,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7694,7 +7694,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", gpn->target, gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID(), gpn->note); @@ -7711,7 +7711,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7741,7 +7741,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = client->CharacterID(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7757,7 +7757,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = gci.char_id; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", gci.char_name.c_str(), gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7782,7 +7782,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7839,7 +7839,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7867,7 +7867,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); return; } @@ -7943,7 +7943,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -7972,7 +7972,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8002,7 +8002,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8057,7 +8057,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8071,7 +8071,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8108,7 +8108,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - logger.Log(EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8223,7 +8223,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8421,7 +8421,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8449,7 +8449,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8492,7 +8492,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8530,7 +8530,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8603,7 +8603,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8646,7 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8787,7 +8787,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -8874,7 +8874,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9034,7 +9034,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9071,7 +9071,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - logger.Log(EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + Log.Log(EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9096,7 +9096,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9136,7 +9136,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); SendLogoutPackets(); @@ -9150,7 +9150,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9327,7 +9327,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9384,7 +9384,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9519,7 +9519,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9539,7 +9539,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9564,7 +9564,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9636,7 +9636,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9660,7 +9660,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9698,7 +9698,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - logger.Log(EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9714,7 +9714,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9797,7 +9797,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9829,7 +9829,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9856,7 +9856,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9869,7 +9869,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10332,7 +10332,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10376,7 +10376,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10446,7 +10446,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - logger.Log(EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); + Log.Log(EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10551,7 +10551,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10559,7 +10559,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10582,7 +10582,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10672,7 +10672,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10699,7 +10699,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -10720,7 +10720,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11305,7 +11305,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11334,7 +11334,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11350,7 +11350,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11364,7 +11364,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11378,14 +11378,14 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11437,7 +11437,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11446,7 +11446,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11506,7 +11506,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11669,7 +11669,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11697,7 +11697,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -11720,14 +11720,14 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - logger.Log(EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); + Log.Log(EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11765,13 +11765,13 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11848,7 +11848,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild @@ -11866,7 +11866,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) GuildMOTD_Struct* gmotd = (GuildMOTD_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", guild_mgr.GetGuildName(GuildID()), GuildID(), GetName(), gmotd->motd); if (!guild_mgr.SetGuildMOTD(GuildID(), gmotd->motd, GetName())) { @@ -11884,7 +11884,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.Log(EQEmuLogSys::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11918,7 +11918,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); + Log.Log(EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); return; } @@ -11969,7 +11969,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -11993,7 +11993,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12090,7 +12090,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12098,7 +12098,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12258,7 +12258,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - logger.Log(EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + Log.Log(EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12504,7 +12504,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12797,7 +12797,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12834,7 +12834,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -12924,7 +12924,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - logger.Log(EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + Log.Log(EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13149,7 +13149,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13202,7 +13202,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - logger.Log(EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); + Log.Log(EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13216,7 +13216,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13369,7 +13369,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13417,7 +13417,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13426,7 +13426,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13512,10 +13512,10 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - logger.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + Log.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13524,8 +13524,8 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); - logger.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); + Log.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13550,11 +13550,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13563,7 +13563,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13599,7 +13599,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13628,7 +13628,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13642,7 +13642,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } @@ -13670,7 +13670,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - logger.Log(EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + Log.Log(EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13691,7 +13691,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13739,7 +13739,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13758,7 +13758,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13768,7 +13768,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13787,7 +13787,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13797,7 +13797,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13805,11 +13805,11 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13819,12 +13819,12 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - logger.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); + Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); @@ -13836,7 +13836,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13876,7 +13876,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13927,7 +13927,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13939,7 +13939,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14162,7 +14162,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e66fbaaeb..fc52e5724 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -799,7 +799,7 @@ void Client::OnDisconnect(bool hard_disconnect) { Mob *Other = trade->With(); if(Other) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) @@ -836,7 +836,7 @@ void Client::BulkSendInventoryItems() { if(inst) { bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -1037,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - logger.Log(EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + Log.Log(EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } @@ -1723,12 +1723,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; if(!CanHaveSkill(skill)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); return; } if(MaxSkill(skill) == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); return; } @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/command.cpp b/zone/command.cpp index 66fc57106..2e8ecc8f8 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -443,13 +443,13 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; - logger.Log(EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); + Log.Log(EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - logger.Log(EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + Log.Log(EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -494,7 +494,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - logger.Log(EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + Log.Log(EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -568,12 +568,12 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - logger.Log(EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + Log.Log(EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif if(cur->function == nullptr) { - logger.Log(EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); + Log.Log(EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command @@ -1292,7 +1292,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - logger.Log(EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + Log.Log(EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1317,7 +1317,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - logger.Log(EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Log(EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1343,7 +1343,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - logger.Log(EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Log(EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1566,7 +1566,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Log(EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1588,7 +1588,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Log(EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1612,7 +1612,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Log(EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -1954,7 +1954,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - logger.Log(EQEmuLogSys::Normal, "Spawning database spawn"); + Log.Log(EQEmuLogSys::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2274,7 +2274,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - logger.Log(EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Log(EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2299,7 +2299,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - logger.Log(EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Log(EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2319,7 +2319,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - logger.Log(EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + Log.Log(EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -2409,7 +2409,7 @@ void command_spawn(Client *c, const Seperator *sep) } } #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General,"#spawn Spawning:"); + Log.LogDebug(EQEmuLogSys::General,"#spawn Spawning:"); #endif NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), c); @@ -3114,7 +3114,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - logger.Log(EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); + Log.Log(EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3771,7 +3771,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - logger.Log(EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); + Log.Log(EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4394,7 +4394,7 @@ void command_time(Client *c, const Seperator *sep) ); c->Message(13, "It is now %s.", timeMessage); #if EQDEBUG >= 11 - logger.LogDebug(EQEmuLogSys::General,"Recieved timeMessage:%s", timeMessage); + Log.LogDebug(EQEmuLogSys::General,"Recieved timeMessage:%s", timeMessage); #endif } } @@ -4545,10 +4545,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4597,7 +4597,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4639,7 +4639,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4678,7 +4678,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4712,7 +4712,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4763,7 +4763,7 @@ void command_guild(Client *c, const Seperator *sep) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) @@ -4869,7 +4869,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - logger.Log(EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + Log.Log(EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5221,7 +5221,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Log(EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5278,7 +5278,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Log(EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5325,7 +5325,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Log(EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -7862,7 +7862,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - logger.Log(EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Log(EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { @@ -10394,7 +10394,7 @@ void command_logtest(Client *c, const Seperator *sep){ if (sep->IsNumber(1)){ uint32 i = 0; for (i = 0; i < atoi(sep->arg[1]); i++){ - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } } \ No newline at end of file diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 8c2eebb68..761b38b51 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -842,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -872,10 +872,10 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); } else { - logger.Log(EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); + Log.Log(EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } @@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index 98784eb90..6e4640d23 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; @@ -303,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -560,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - logger.Log(EQEmuLogSys::Status, "Loading Doors from database..."); + Log.Log(EQEmuLogSys::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/effects.cpp b/zone/effects.cpp index 861d6bd14..aa21fb6b8 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - logger.Log(EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + Log.Log(EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 50df10905..2a9575f8c 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - logger.Log(EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); + Log.Log(EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index e44fcf6a0..e5cab5f75 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - logger.Log(EQEmuLogSys::Error, "boot_quest does not take any arguments."); + Log.Log(EQEmuLogSys::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 52fe31826..46a43246e 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -140,12 +140,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - logger.Log(EQEmuLogSys::Quest, "perl error: %s", err); + Log.Log(EQEmuLogSys::Quest, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - logger.Log(EQEmuLogSys::Quest, "Tying perl output to eqemu logs"); + Log.Log(EQEmuLogSys::Quest, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -170,14 +170,14 @@ void Embperl::DoInit() { ,FALSE ); - logger.Log(EQEmuLogSys::Quest, "Loading perlemb plugins."); + Log.Log(EQEmuLogSys::Quest, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - logger.Log(EQEmuLogSys::Quest, "Warning - plugin.pl: %s", err); + Log.Log(EQEmuLogSys::Quest, "Warning - plugin.pl: %s", err); } try { @@ -195,7 +195,7 @@ void Embperl::DoInit() { } catch(const char *err) { - logger.Log(EQEmuLogSys::Quest, "Perl warning: %s", err); + Log.Log(EQEmuLogSys::Quest, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/embxs.cpp b/zone/embxs.cpp index f8a948578..4075186e0 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - logger.Log(EQEmuLogSys::Error, "boot_qc does not take any arguments."); + Log.Log(EQEmuLogSys::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. @@ -100,7 +100,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); len = 0; pos = i+1; } else { @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index d3b95e7f5..d400d9cab 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - logger.Log(EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); + Log.Log(EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - logger.Log(EQEmuLogSys::Error, "About to delete a client still in a group."); + Log.Log(EQEmuLogSys::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - logger.Log(EQEmuLogSys::Error, "About to delete a client still in a raid."); + Log.Log(EQEmuLogSys::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - logger.Log(EQEmuLogSys::Error, + Log.Log(EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - logger.Log(EQEmuLogSys::Error, + Log.Log(EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - logger.Log(EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + Log.Log(EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/exp.cpp b/zone/exp.cpp index 47d864706..adf2ca363 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - logger.Log(EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + Log.Log(EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - logger.Log(EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); + Log.Log(EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 3a3fdcd58..3e0577212 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index e30dd7b0a..838122471 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - logger.Log(EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + Log.Log(EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - logger.Log(EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); + Log.Log(EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index df687c6db..f51ccf0e2 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1098,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1107,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1116,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 86a4c06dd..474f131a9 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -144,10 +144,10 @@ void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if(GetClientVersion() >= EQClientRoF) { @@ -171,11 +171,11 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size); if(outapp->pBuffer == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -192,7 +192,7 @@ void Client::SendGuildMembers() { outapp->pBuffer = data; data = nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); @@ -223,7 +223,7 @@ void Client::RefreshGuildInfo() CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } @@ -335,7 +335,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->rank = gj->rank; outgj->zoneid = gj->zoneid; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); FastQueuePacket(&outapp); @@ -409,7 +409,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -429,7 +429,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 4d58b1fb0..912a7f152 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + Log.Log(EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - logger.Log(EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.Log(EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - logger.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); + Log.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - logger.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); + Log.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - logger.Log(EQEmuLogSys::Error, "No space to add item to the guild bank."); + Log.Log(EQEmuLogSys::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/horse.cpp b/zone/horse.cpp index f5574f8ea..6fc5dce26 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); + Log.Log(EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - logger.Log(EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + Log.Log(EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 53eb3ae31..455757e85 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check to make sure we are augmenting an augmentable item else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -229,7 +229,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -269,7 +269,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -292,7 +292,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - logger.Log(EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Log(EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -559,7 +559,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; @@ -700,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. @@ -815,7 +815,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); if (client_update) { @@ -831,7 +831,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == MainCursor) return PushItemOnCursor(inst, client_update); @@ -858,7 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); m_inv.PutItem(slot_id, inst); SendLootItemInPacket(&inst, slot_id); @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); } @@ -1313,7 +1313,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1321,7 +1321,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1334,7 +1334,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->to_slot == (uint32)INVALID_INDEX) { if (move_in->from_slot == (uint32)MainCursor) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit ItemInst *inst = m_inv.GetItem(MainCursor); @@ -1348,7 +1348,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item destroyed by client } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); return true; // Item deletion @@ -1388,7 +1388,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ItemInst* src_inst = m_inv.GetItem(src_slot_id); ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) @@ -1398,7 +1398,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } if (dst_inst) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ @@ -1435,7 +1435,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { move_in->from_slot = dst_slot_check; move_in->to_slot = src_slot_check; move_in->number_in_stack = dst_inst->GetCharges(); - if(!SwapItem(move_in)) { logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } + if(!SwapItem(move_in)) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } } return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - logger.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + Log.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - logger.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + Log.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } @@ -1577,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } if (with) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor if (!m_inv[MainCursor]) { Message(13, "Error: Cursor item not located on server!"); @@ -1610,18 +1610,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->number_in_stack > 0) { // Determine if charged items can stack if(src_inst && !src_inst->IsStackable()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); return false; } if (dst_inst) { if(src_inst->GetID() != dst_inst->GetID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); return(false); } if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) { //we have a chance of stacking. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); // Charges can be emptied into dst uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges(); if (usedcharges > move_in->number_in_stack) @@ -1633,15 +1633,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Depleted all charges? if (src_inst->GetCharges() < 1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); all_to_stack = true; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); return false; } } @@ -1650,12 +1650,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) { // Move entire stack if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); } else { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); @@ -1680,7 +1680,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { SetMaterial(dst_slot_id,src_inst->GetItem()->ID); } if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) { if(src_inst) { @@ -1739,7 +1739,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { // resync the 'from' and 'to' slots on an as-needed basis // Not as effective as the full process, but less intrusive to gameplay -U - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { @@ -2071,7 +2071,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2080,7 +2080,7 @@ void Client::RemoveNoRent(bool client_update) { for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2089,7 +2089,7 @@ void Client::RemoveNoRent(bool client_update) { if (m_inv[MainPowerSource]) { const ItemInst* inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } @@ -2098,7 +2098,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2107,7 +2107,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } @@ -2116,7 +2116,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } @@ -2125,7 +2125,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } @@ -2134,7 +2134,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } @@ -2155,7 +2155,7 @@ void Client::RemoveNoRent(bool client_update) { inst = *iter; // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else m_inv.PushCursor(**iter); @@ -2178,7 +2178,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2193,7 +2193,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2208,7 +2208,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2223,7 +2223,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2238,7 +2238,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2253,7 +2253,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2281,7 +2281,7 @@ void Client::RemoveDuplicateLore(bool client_update) { inst = *iter; // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); iter = local.erase(iter); } @@ -2300,7 +2300,7 @@ void Client::RemoveDuplicateLore(bool client_update) { m_inv.PushCursor(**iter); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } safe_delete(*iter); @@ -2322,7 +2322,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2335,7 +2335,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s removing set", GetName(), bds->number); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,16 +2585,16 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2640,13 +2640,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - logger.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); @@ -2865,8 +2865,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - logger.Log(EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); + Log.Log(EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2881,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - logger.Log(EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + Log.Log(EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/loottables.cpp b/zone/loottables.cpp index fed8b2210..316019486 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index c25248e2f..106bbc10d 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -885,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -906,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1647,7 +1647,7 @@ void Merc::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -1766,7 +1766,7 @@ bool Merc::AI_EngagedCastCheck() { { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); int8 mercClass = GetClass(); @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - logger.Log(EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/mob.cpp b/zone/mob.cpp index 7cfc58bcc..873edfc58 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1576,7 +1576,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, entity_list.QueueClients(this, outapp); safe_delete(outapp); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } @@ -3043,7 +3043,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); } return; } @@ -4536,7 +4536,7 @@ void Mob::MeleeLifeTap(int32 damage) { if(lifetap_amt && damage > 0){ lifetap_amt = damage * lifetap_amt / 100; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 699bd1dea..ee6aa0913 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - logger.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -1404,7 +1404,7 @@ void Mob::AI_Process() { else if (AImovement_timer->Check()) { if(!IsRooted()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); if(!RuleB(Pathing, Aggro) || !zone->pathing) CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed()); else @@ -1639,7 +1639,7 @@ void NPC::AI_DoMovement() { roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) { @@ -1692,11 +1692,11 @@ void NPC::AI_DoMovement() { else { movetimercompleted=false; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); //if we were under quest control (with no grid), we are done now.. if(cur_wp == -2) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; } @@ -1727,7 +1727,7 @@ void NPC::AI_DoMovement() { { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) { // are we there yet? then stop - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1773,7 +1773,7 @@ void NPC::AI_DoMovement() { if (movetimercompleted==true) { // time to pause has ended SetGrid( 0 - GetGrid()); // revert to AI control - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1809,7 +1809,7 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); ClearFeignMemory(); moved=false; SetMoving(false); @@ -1934,7 +1934,7 @@ bool NPC::AI_EngagedCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); // try casting a heal or gate if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) { @@ -1957,7 +1957,7 @@ bool NPC::AI_PursueCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { //no spell cast, try again soon. AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false); diff --git a/zone/net.cpp b/zone/net.cpp index b630dadb2..c1b2e70ce 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -104,7 +104,7 @@ TitleManager title_manager; QueryServ *QServ = 0; TaskManager *taskmanager = 0; QuestParserCollection *parse = 0; -EQEmuLogSys logger; +EQEmuLogSys Log; const SPDat_Spell_Struct* spells; void LoadSpells(EQEmu::MemoryMappedFile **mmf); @@ -148,35 +148,35 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - logger.Log(EQEmuLogSys::Error, "Loading server configuration failed."); + Log.Log(EQEmuLogSys::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - logger.Log(EQEmuLogSys::Error, "Cannot continue without a database connection."); + Log.Log(EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } /* Register Log System and Settings */ - logger.LoadLogSettingsDefaults(); - logger.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); - database.LoadLogSysSettings(logger.log_settings); + Log.LoadLogSettingsDefaults(); + Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); + database.LoadLogSysSettings(Log.log_settings); /* Guilds */ guild_mgr.SetDatabase(&database); @@ -186,121 +186,121 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - logger.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #endif const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { - logger.Log(EQEmuLogSys::Error, "Loading items FAILED!"); - logger.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); + Log.Log(EQEmuLogSys::Error, "Loading items FAILED!"); + Log.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - logger.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); + Log.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { - logger.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); + Log.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { - logger.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); + Log.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { - logger.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); + Log.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) - logger.Log(EQEmuLogSys::Error, "Command loading FAILED"); + Log.Log(EQEmuLogSys::Error, "Command loading FAILED"); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - logger.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(TaskSystem, EnableTaskSystem)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } @@ -317,11 +317,11 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { - logger.Log(EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); + Log.Log(EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -332,9 +332,9 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - logger.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); + Log.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); @@ -365,13 +365,13 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - logger.Log(EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); + Log.Log(EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() @@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - logger.Log(EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); + Log.Log(EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 9f67afbd5..91f43da6c 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - logger.Log(EQEmuLogSys::Error, "Database error, invalid item"); + Log.Log(EQEmuLogSys::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - logger.Log(EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + Log.Log(EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/object.cpp b/zone/object.cpp index b2632bc2c..9319782f8 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - logger.Log(EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); + Log.Log(EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 07b145d34..343711a65 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,19 +61,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - logger.Log(EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); + Log.Log(EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); } else { - logger.Log(EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); + Log.Log(EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - logger.Log(EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); + Log.Log(EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,18 +103,18 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - logger.Log(EQEmuLogSys::Error, "Bad Magic String in .path file."); + Log.Log(EQEmuLogSys::Error, "Bad Magic String in .path file."); return false; } fread(&Head, sizeof(Head), 1, PathFile); - logger.Log(EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", + Log.Log(EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { - logger.Log(EQEmuLogSys::Error, "Unsupported path file version."); + Log.Log(EQEmuLogSys::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - logger.Log(EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + Log.Log(EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return noderoute; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); return noderoute; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); return To; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 59a865887..a60a5288a 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index deab5789d..37e1c9cab 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,12 +254,12 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); #endif } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 5cc236176..4dff5aa84 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - logger.Log(EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); + Log.Log(EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - logger.Log(EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + Log.Log(EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - logger.Log(EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - logger.Log(EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + Log.Log(EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 0494f7f67..c3188d66e 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - logger.Log(EQEmuLogSys::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - logger.Log(EQEmuLogSys::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - logger.Log(EQEmuLogSys::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - logger.Log(EQEmuLogSys::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Log(EQEmuLogSys::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - logger.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - logger.Log(EQEmuLogSys::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + Log.Log(EQEmuLogSys::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 9a87b539a..01685b352 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - logger.Log(EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 2aebb5339..288893a1e 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - logger.Log(EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + Log.Log(EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index abd93c84c..0b3201da3 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; @@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -195,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index cb4b77f78..a9c58cd5a 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -464,7 +464,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) break; } default: - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); return(1000); /* nice long delay for them, the caller depends on this! */ } @@ -683,7 +683,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -695,12 +695,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const ItemInst* Ammo = m_inv[MainAmmo]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(MainRange)); return; } if (!Ammo || !Ammo->IsType(ItemClassCommon)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(MainAmmo)); return; } @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const Item_Struct* AmmoItem = Ammo->GetItem(); if(RangeItem->ItemType != ItemTypeBow) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } if(AmmoItem->ItemType != ItemTypeArrow) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -746,7 +746,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Ammo = baginst; ammo_slot = m_inv.CalcSlotId(r, i); found = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); break; } } @@ -761,17 +761,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (aslot != INVALID_INDEX) { ammo_slot = aslot; Ammo = m_inv[aslot]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); } } } float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -799,9 +799,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); } CheckIncreaseSkill(SkillArchery, GetTarget(), -15); @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillArchery); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); @@ -882,7 +882,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); @@ -923,7 +923,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ @@ -944,7 +944,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); } } @@ -1192,7 +1192,7 @@ void NPC::RangedAttack(Mob* other) //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -1361,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -1371,19 +1371,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 const ItemInst* RangeWeapon = m_inv[MainRange]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(MainRange)); return; } const Item_Struct* item = RangeWeapon->GetItem(); if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(MainRange)); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1392,7 +1392,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //more in the ammo slot, use it RangeWeapon = AmmoItem; ammo_slot = MainAmmo; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal); @@ -1400,17 +1400,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //the item wont change, but the instance does, not that it matters ammo_slot = aslot; RangeWeapon = m_inv[aslot]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } } } float range = item->Range + GetRangeDistTargetSizeMod(other); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1489,7 +1489,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillThrowing); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; @@ -1497,7 +1497,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); int16 WDmg = 0; @@ -1533,7 +1533,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) other->AvoidDamage(this, TotalDmg, false); //CanRiposte=false - Can not riposte throw attacks. diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1e0f29e47..cfa9e55c4 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -476,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -485,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -711,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) stun_resist += aabonuses.StunResist; if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -721,7 +721,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); } } break; @@ -1649,7 +1649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - logger.Log(EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + Log.Log(EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int mod = caster->GetInstrumentMod(spell_id); mod = ApplySpellEffectiveness(caster, spell_id, mod, true); effect_value = effect_value * mod / 10; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); } effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); @@ -3127,7 +3127,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3326,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); } } @@ -3351,7 +3351,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3383,18 +3383,18 @@ void Mob::BuffProcess() IsMezSpell(buffs[buffs_i].spellid) || IsBlindSpell(buffs[buffs_i].spellid)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } } else if (buffs[buffs_i].ticsremaining < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if(IsClient() && !(CastToClient()->GetClientVersionBit() & BIT_SoFAndLater)) @@ -3759,7 +3759,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - logger.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index e3c826b97..1f6c514fe 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -147,7 +147,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -166,7 +166,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -204,7 +204,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, //cannot cast under divine aura if(DivineAura()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -234,7 +234,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -243,7 +243,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - logger.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -349,7 +349,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -363,7 +363,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this @@ -375,7 +375,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -392,7 +392,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // we checked for spells not requiring targets above if(target_id == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, SPELL_NEED_TAR); @@ -430,7 +430,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, { mana_cost = 0; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, INSUFFICIENT_MANA); @@ -451,7 +451,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_resist_adjust = resist_adjust; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", spell_id, cast_time, orgcasttime, mana_cost); // cast time is 0, just finish it right now and be done with it @@ -517,7 +517,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -756,7 +756,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -816,7 +816,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); if(!spellid) return; @@ -893,7 +893,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -907,7 +907,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { Message_StringID(13, SPELL_RECAST); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -916,7 +916,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!IsValidSpell(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -927,7 +927,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(delaytimer) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); Message(13, "You are unable to focus."); InterruptSpell(); return; @@ -937,7 +937,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); Message_StringID(13,ALREADY_CASTING); InterruptSpell(); return; @@ -952,7 +952,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); } else { bardsong = spell_id; bardsong_slot = slot; @@ -962,7 +962,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, else bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1041,10 +1041,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; } @@ -1060,10 +1060,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, break; default: // some non-instrument component. Let it go, but record it in the log - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); if(c->GetGM()) c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1143,12 +1143,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, const Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1169,7 +1169,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (component == -1) continue; component_count = spells[spell_id].component_counts[t_count]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1234,7 +1234,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { Message_StringID(13, SPELL_RECAST); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -1253,15 +1253,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); Message(13, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1280,7 +1280,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); InterruptSpell(); return; } @@ -1309,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, this->CastToClient()->CheckSongSkillIncrease(spell_id); this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); } else { @@ -1344,7 +1344,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, delaytimer = true; spellend_timer.Start(400,true); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); } @@ -1391,7 +1391,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce && (IsGrouped() // still self only if not grouped || IsRaidGrouped()) && (HasProjectIllusion())){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); targetType = ST_GroupClientAndPet; } @@ -1474,7 +1474,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1487,7 +1487,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3)) { //invalid target - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1501,7 +1501,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1526,7 +1526,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); if(!spell_target) Message_StringID(13,SPELL_NEED_TAR); else @@ -1544,7 +1544,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1552,14 +1552,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1568,7 +1568,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1580,7 +1580,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1596,7 +1596,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); Message_StringID(13,NO_PET); return false; // can't cast these unless we have a target } @@ -1666,7 +1666,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1703,7 +1703,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1800,14 +1800,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } @@ -1878,7 +1878,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -1957,7 +1957,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) return(false); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -1968,7 +1968,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -1977,7 +1977,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); Message_StringID(13,CANT_SEE_TARGET); return false; } @@ -2008,13 +2008,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); Message_StringID(13, TARGET_TOO_CLOSE); return(false); } @@ -2043,7 +2043,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 #endif //BOTS if(spell_target == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2067,11 +2067,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsPlayerIllusionSpell(spell_id) && IsClient() && (HasProjectIllusion())){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); SetProjectIllusion(false); } else{ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); } break; } @@ -2235,7 +2235,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // CastSpell already reduced the cost for it if we're a client with focus if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2247,7 +2247,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF) { CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2263,7 +2263,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(reduction) recast -= reduction; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2301,7 +2301,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(slot == USE_ITEM_SPELL_SLOT) { //bard songs should never come from items... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); return(false); } @@ -2309,12 +2309,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2323,18 +2323,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); return(false); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); Message_StringID(13, CANT_SEE_TARGET); return(false); } @@ -2349,7 +2349,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { float range2 = range * range; if(dist2 > range2) { //target is out of range. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } @@ -2365,10 +2365,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case SingleTarget: { if(spell_target == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); return(false); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2386,7 +2386,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2394,9 +2394,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2406,13 +2406,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case GroupSpell: { if(spell_target->IsGrouped()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2429,7 +2429,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2455,13 +2455,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2559,7 +2559,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2601,7 +2601,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", spell_id, castlevel, formula, duration, res); return(res); @@ -2673,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } @@ -2695,15 +2695,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); // Same Spells and dot exemption is set to 1 or spell is Manaburn if (spellid1 == spellid2) { if (sp1.dot_stacking_exempt == 1 && caster1 != caster2) { // same caster can refresh - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); return -1; } else if (spellid1 == 2751) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); return -1; } } @@ -2735,7 +2735,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2804,16 +2804,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2827,22 +2827,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -2905,13 +2905,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -2923,7 +2923,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(sp_det_mismatch) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); continue; } @@ -2932,7 +2932,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -2958,7 +2958,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -2967,7 +2967,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -2976,15 +2976,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); return(1); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); return 0; } @@ -3043,11 +3043,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); return -2; // no duration? this isn't a buff } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3077,12 +3077,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite) @@ -3106,7 +3106,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3114,11 +3114,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); return -1; } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); return -1; } } @@ -3169,7 +3169,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3207,7 +3207,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) { int i, ret, firstfree = -2; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) @@ -3231,19 +3231,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) if(ret == 1) { // should overwrite current slot if(iFailIfOverwrite) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return(-1); } if(firstfree == -2) firstfree = i; } if(ret == -1) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); return firstfree; } @@ -3270,7 +3270,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); Message(13, "SOT: You must have a target for this spell."); return false; } @@ -3298,7 +3298,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r uint16 caster_level = GetCasterLevel(spell_id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3378,7 +3378,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3386,7 +3386,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3395,7 +3395,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3406,17 +3406,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3525,9 +3525,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3537,7 +3537,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); spelltar->Message_StringID(MT_SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3551,7 +3551,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3644,7 +3644,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ Message_StringID(MT_SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3692,7 +3692,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, isproc); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); if(aggro_amount > 0) spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; @@ -3709,7 +3709,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_type != 1) // AA is handled differently Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3825,14 +3825,14 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); return true; } void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -4005,7 +4005,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4016,7 +4016,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); caster->Message_StringID(MT_Shout, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4034,7 +4034,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); return true; } @@ -4043,7 +4043,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4059,7 +4059,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4070,13 +4070,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); caster->Message_StringID(MT_Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id); if (aggro > 0) { @@ -4090,7 +4090,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (IsClient() && CastToClient()->CheckAAEffect(aaEffectWarcry)) { Message(13, "Your are immune to fear."); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } @@ -4100,7 +4100,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); caster->Message_StringID(MT_Shout, CANNOT_CHARM); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4113,7 +4113,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); caster->Message(MT_Shout, "You cannot charm yourself."); return true; } @@ -4126,7 +4126,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); return true; } @@ -4140,7 +4140,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4156,7 +4156,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); return true; } @@ -4166,13 +4166,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); return true; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); return false; } @@ -4209,7 +4209,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); return(0); } @@ -4230,7 +4230,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; } } @@ -4248,7 +4248,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; } } @@ -4256,7 +4256,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); return 100; } @@ -4822,7 +4822,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4837,7 +4837,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > MAX_PP_MEMSPELL || slot < 0) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4870,7 +4870,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); if(update_client) { @@ -4883,7 +4883,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= MAX_PP_SPELLBOOK || slot < 0) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -4914,7 +4914,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + Log.Log(EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + Log.Log(EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - logger.Log(EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + Log.Log(EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - logger.Log(EQEmuLogSys::Normal, + Log.Log(EQEmuLogSys::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) @@ -5089,23 +5089,23 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); } return false; } @@ -5116,7 +5116,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].spellID = SPELL_UNKNOWN; SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); } } return true; @@ -5133,7 +5133,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5148,7 +5148,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); } } return true; @@ -5165,7 +5165,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5180,7 +5180,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); } } return true; @@ -5211,7 +5211,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return(level); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 593926f38..3cae8a687 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -115,21 +115,21 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - logger.Log(EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + Log.Log(EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; taskActiveTasks[task].Updated) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,11 +358,11 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -459,14 +459,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - logger.Log(EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + Log.Log(EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - logger.Log(EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,12 +634,12 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - logger.Log(EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + Log.Log(EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - logger.Log(EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + Log.Log(EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,16 +1275,16 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown04 = 0x00000002; - logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks, "SendTasksComplete"); + Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks, "SendTasksComplete"); DumpPacket(outapp); fflush(stdout); QueuePacket(outapp); @@ -2275,7 +2275,7 @@ void Client::SendTaskComplete(int TaskIndex) { void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex); // We only sent the most recent 50 completed tasks, so we need to offset the Index the client sent to us. @@ -2406,7 +2406,7 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) { //tac->unknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,24 +2932,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3088,12 +3088,12 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } NumberOfLists = results.RowCount(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/titles.cpp b/zone/titles.cpp index d90c63f6e..4867db69f 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + Log.Log(EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 7ac9cbaf5..2021901ab 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - logger.Log(EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + Log.Log(EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - logger.Log(EQEmuLogSys::Error, "Player tried to augment an item without a container set."); + Log.Log(EQEmuLogSys::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - logger.Log(EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + Log.Log(EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - logger.Log(EQEmuLogSys::Error, "Replace container combine executed in a world container."); + Log.Log(EQEmuLogSys::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - logger.Log(EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + Log.Log(EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); + Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - logger.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - logger.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); + Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - logger.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - logger.Log(EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + Log.Log(EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - logger.Log(EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); + Log.Log(EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - logger.Log(EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + Log.Log(EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - logger.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); + Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,12 +1477,12 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if (results.RowCount() != 1) { - logger.Log(EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + Log.Log(EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index ff0fc6f5e..99a2d42ed 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -86,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -296,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -307,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -315,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -324,7 +324,7 @@ void Trade::DumpTrade() } } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -458,7 +458,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool qs_log = false; if(other) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); @@ -491,7 +491,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst && inst->IsType(ItemClassContainer)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -499,7 +499,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st inst->SetCharges(0); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); if (other->PutItemInInventory(partial_slot, *partial_inst, true)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges())); inst->SetCharges(old_charges); @@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -772,17 +772,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,12 +1534,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - logger.Log(EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." + Log.Log(EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); @@ -1836,11 +1836,11 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - logger.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/trap.cpp b/zone/trap.cpp index 6f8132c3c..51bf3b3ed 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index c9d5877c2..6ee71ee05 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - logger.Log(EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + Log.Log(EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + Log.Log(EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + Log.Log(EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 45f8db13f..bf7bdc143 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -88,7 +88,7 @@ void NPC::StopWandering() roamer=false; CastToNPC()->SetGrid(0); SendPosition(); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); return; } @@ -107,16 +107,16 @@ void NPC::ResumeWandering() cur_wp=save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); } else if (AIwalking_timer->Enabled()) { // we are at a waypoint paused normally - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); AIwalking_timer->Trigger(); // disable timer to end pause now } else { - logger.Log(EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Log(EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - logger.Log(EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Log(EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -143,7 +143,7 @@ void NPC::PauseWandering(int pausetime) if (GetGrid() != 0) { DistractedFromGrid = true; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); SendPosition(); if (pausetime<1) { // negative grid number stops him dead in his tracks until ResumeWandering() @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - logger.Log(EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Log(EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -166,7 +166,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if (GetGrid() < 0) { // currently stopped by a quest command SetGrid( 0 - GetGrid()); // get him moving again - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); } AIwalking_timer->Disable(); // disable timer in case he is paused at a wp if (cur_wp>=0) @@ -174,14 +174,14 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); } if (saveguardspot) { @@ -196,7 +196,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if(guard_heading == -1) guard_heading = this->CalculateHeadingToTarget(mtx, mty); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } cur_wp_x = mtx; @@ -212,7 +212,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) void NPC::UpdateWaypoint(int wp_index) { if(wp_index >= static_cast(Waypoints.size())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); return; } std::vector::iterator cur; @@ -224,7 +224,7 @@ void NPC::UpdateWaypoint(int wp_index) cur_wp_z = cur->z; cur_wp_pause = cur->pause; cur_wp_heading = cur->heading; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) @@ -430,7 +430,7 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); guard_x = 0; guard_y = 0; guard_z = 0; @@ -443,14 +443,14 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } } void NPC::NextGuardPosition() { if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { SetHeading(guard_heading); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); } else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) { @@ -516,15 +516,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if(z_pos-z != 0) { z_pos = z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); @@ -550,7 +550,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); uint8 NPCFlyMode = 0; @@ -569,7 +569,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -612,7 +612,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -647,7 +647,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b z_pos = new_z; tar_ndx=22-numsteps; heading = CalculateHeadingToTarget(x, y); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } else { @@ -659,7 +659,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = y; z_pos = z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); } } @@ -678,7 +678,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; heading = CalculateHeadingToTarget(x, y); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } uint8 NPCFlyMode = 0; @@ -698,7 +698,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -759,7 +759,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec moved=false; } SetRunAnimSpeed(0); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); return true; } @@ -773,7 +773,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -790,7 +790,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = x; y_pos = y; z_pos = z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); } else { float new_x = x_pos + tar_vx*tar_vector; @@ -803,7 +803,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = new_x; y_pos = new_y; z_pos = new_z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); } uint8 NPCFlyMode = 0; @@ -823,7 +823,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -951,7 +951,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { x_pos = new_x; y_pos = new_y; z_pos = new_z; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) return; @@ -967,7 +967,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -998,7 +998,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - logger.Log(EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - logger.Log(EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 7bbd5db5d..6bbe3d3ab 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,12 +155,12 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } case ServerOP_ZAAuthFailed: { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; @@ -386,12 +386,12 @@ void WorldServer::Process() { } } else { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); } } else - logger.Log(EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); + Log.Log(EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - logger.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); @@ -1381,7 +1381,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - logger.Log(EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + Log.Log(EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } @@ -2061,7 +2061,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - logger.Log(EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); + Log.Log(EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { diff --git a/zone/zone.cpp b/zone/zone.cpp index b79335ad0..677284a59 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - logger.Log(EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + Log.Log(EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - logger.Log(EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); + Log.Log(EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - logger.Log(EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); + Log.Log(EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - logger.Log(EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); + Log.Log(EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - logger.Log(EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); + Log.Log(EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -144,15 +144,15 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - logger.Log(EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - logger.Log(EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + Log.Log(EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + Log.Log(EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); /* Set Logging */ - logger.StartFileLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + Log.StartFileLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; } @@ -167,11 +167,11 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } - logger.Log(EQEmuLogSys::Status, "Loading Objects from DB..."); + Log.Log(EQEmuLogSys::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - logger.Log(EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); + Log.Log(EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - logger.Log(EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); + Log.Log(EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - logger.Log(EQEmuLogSys::Status, "Loading Merchant Lists..."); + Log.Log(EQEmuLogSys::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -707,11 +707,11 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - logger.Log(EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + Log.Log(EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - logger.Log(EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); + Log.Log(EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); @@ -720,24 +720,24 @@ void Zone::Shutdown(bool quite) parse->ReloadQuests(true); UpdateWindowTitle(); - logger.CloseFileLogs(); + Log.CloseFileLogs(); } void Zone::LoadZoneDoors(const char* zone, int16 version) { - logger.Log(EQEmuLogSys::Status, "Loading doors for %s ...", zone); + Log.Log(EQEmuLogSys::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - logger.Log(EQEmuLogSys::Status, "... No doors loaded."); + Log.Log(EQEmuLogSys::Status, "... No doors loaded."); return; } Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - logger.Log(EQEmuLogSys::Error, "... Failed to load doors."); + Log.Log(EQEmuLogSys::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -801,12 +801,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - logger.Log(EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + Log.Log(EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -899,56 +899,56 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - logger.Log(EQEmuLogSys::Status, "Loading spawn conditions..."); + Log.Log(EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - logger.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); + Log.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } - logger.Log(EQEmuLogSys::Status, "Loading static zone points..."); + Log.Log(EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); return false; } - logger.Log(EQEmuLogSys::Status, "Loading spawn groups..."); + Log.Log(EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - logger.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); + Log.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } - logger.Log(EQEmuLogSys::Status, "Loading spawn2 points..."); + Log.Log(EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); + Log.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } - logger.Log(EQEmuLogSys::Status, "Loading player corpses..."); + Log.Log(EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - logger.Log(EQEmuLogSys::Error, "Loading player corpses failed."); + Log.Log(EQEmuLogSys::Error, "Loading player corpses failed."); return false; } - logger.Log(EQEmuLogSys::Status, "Loading traps..."); + Log.Log(EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error, "Loading traps failed."); + Log.Log(EQEmuLogSys::Error, "Loading traps failed."); return false; } - logger.Log(EQEmuLogSys::Status, "Loading adventure flavor text..."); + Log.Log(EQEmuLogSys::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - logger.Log(EQEmuLogSys::Status, "Loading ground spawns..."); + Log.Log(EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - logger.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); + Log.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } - logger.Log(EQEmuLogSys::Status, "Loading World Objects from DB..."); + Log.Log(EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - logger.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); + Log.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - logger.Log(EQEmuLogSys::Status, "Loading timezone data..."); + Log.Log(EQEmuLogSys::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - logger.Log(EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + Log.Log(EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,32 +1019,32 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - logger.Log(EQEmuLogSys::Status, "Reloading Zone Static Data..."); + Log.Log(EQEmuLogSys::Status, "Reloading Zone Static Data..."); - logger.Log(EQEmuLogSys::Status, "Reloading static zone points..."); + Log.Log(EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); } - logger.Log(EQEmuLogSys::Status, "Reloading traps..."); + Log.Log(EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - logger.Log(EQEmuLogSys::Error, "Reloading traps failed."); + Log.Log(EQEmuLogSys::Error, "Reloading traps failed."); } - logger.Log(EQEmuLogSys::Status, "Reloading ground spawns..."); + Log.Log(EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - logger.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); + Log.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - logger.Log(EQEmuLogSys::Status, "Reloading World Objects from DB..."); + Log.Log(EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - logger.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); + Log.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - logger.Log(EQEmuLogSys::Status, "Zone Static Data Reloaded."); + Log.Log(EQEmuLogSys::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - logger.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - logger.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - logger.Log(EQEmuLogSys::Status, "Successfully loaded Zone Config."); + Log.Log(EQEmuLogSys::Status, "Successfully loaded Zone Config."); return true; } @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - logger.Log(EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - logger.Log(EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); + Log.Log(EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + Log.Log(EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - logger.Log(EQEmuLogSys::Error, "... Failed to load blocked spells."); + Log.Log(EQEmuLogSys::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 6e15155cf..8a8c82e59 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - logger.Log(EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + Log.Log(EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -619,25 +619,25 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,12 +645,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - logger.Log(EQEmuLogSys::Status, "Loading Blocked Spells from database..."); + Log.Log(EQEmuLogSys::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - logger.Log(EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + Log.Log(EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - logger.Log(EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); + Log.Log(EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 37ea17eb5..c883dc78d 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - logger.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - logger.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - logger.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - logger.Log(EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + Log.Log(EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - logger.Log(EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + Log.Log(EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - logger.Log(EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + Log.Log(EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - logger.Log(EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + Log.Log(EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -534,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -543,14 +543,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - logger.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; SetHeading(heading); break; default: - logger.Log(EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + Log.Log(EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - logger.Log(EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - logger.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 15bd08b365f799fefb9d1ea153085399515fd596 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:52:33 -0800 Subject: [PATCH 1045/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 4b18abb40..e1bfcb695 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1197,7 +1197,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ numMem += 1; } From 1496f148432d09e26501a2c83468b7d4df7d8ff3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 00:56:26 -0600 Subject: [PATCH 1046/1883] Remove old function code from consolidation --- common/eqemu_logsys.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 8e3448e5b..c10185570 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -190,18 +190,6 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); } -// void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) -// { -// va_list args; -// va_start(args, message); -// std::string output_message = vStringFormat(message.c_str(), args); -// va_end(args); -// -// EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, 0, output_message); -// EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, 0, output_message); -// EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, 0, output_message); -// } - void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) { if (log_type > EQEmuLogSys::MaxLogID){ From ef04c90d8e794ded51b6d57eb61c613ef66eda12 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:04:59 -0600 Subject: [PATCH 1047/1883] Remove new log prefix from console output --- common/eqemu_logsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index c10185570..d8c73adca 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -168,7 +168,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, co } #endif - std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; + std::cout << "[" << TypeNames[log_type] << "] " << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ From a9c5f80968a9e3a2cddba4324d2e4ddaf1b143a1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:07:04 -0800 Subject: [PATCH 1048/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index e1bfcb695..a3e948fc1 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1208,7 +1208,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ members[gi]->HealDamage(heal_amt, caster); members[gi]->SendHPUpdate(); @@ -1235,7 +1235,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ dmgtaken_tmp = members[gi]->GetMaxHP() - members[gi]->GetHP(); From dc2534e38c66bd2a7286e7ccbc644b58f2ef6636 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:08:48 -0800 Subject: [PATCH 1049/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index a3e948fc1..dadddbb65 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1253,7 +1253,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone members[gi]->SetHP(1); //but it will come darn close From fa50ab8a18e36518f9caaa7f66bca8fb84e63332 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:12:25 -0800 Subject: [PATCH 1050/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index dadddbb65..35812dd88 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1284,7 +1284,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi] && (members[gi]->GetMaxMana() > 0)){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ manataken_tmp = members[gi]->GetMaxMana() - members[gi]->GetMana(); From a9c0920bc611a2ce728cf6e5b70a4f1ae97fccd5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:15:06 -0800 Subject: [PATCH 1051/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 35812dd88..1b26d47b4 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1306,7 +1306,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ if((members[gi]->GetMaxMana() - manataken) < 1){ members[gi]->SetMana(1); From 80941d23bd61d40f61dea398b90b57dc827fbc3c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:16:11 -0800 Subject: [PATCH 1052/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/hate_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index b37b07f59..572781d06 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -592,7 +592,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent struct_HateList *h = (*iterator); if (range > 0) { - dist_targ = center->DistNoRoot(*h->entity_on_hatelist); + dist_targ = ComparativeDistance(center->GetPosition(), h->entity_on_hatelist->GetPosition()); if (dist_targ <= range && dist_targ >= min_range2) { id_list.push_back(h->entity_on_hatelist->GetID()); From 81f36675b397ef59807d532ae704e651ffa7b746 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:19:56 -0800 Subject: [PATCH 1053/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index e50cb04c5..abbb481e4 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1480,7 +1480,7 @@ void Merc::AI_Process() { if(IsMercCasterCombatRange(GetTarget())) atCombatRange = true; } - else if(DistNoRoot(*GetTarget()) <= meleeDistance) { + else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) { atCombatRange = true; } From 975c298c85db52c43a5b7cfdc7c1fc88b841d1b3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:24:35 -0600 Subject: [PATCH 1054/1883] Consolidate 'LogType' over to 'LogCategory' --- common/eqemu_logsys.h | 85 +++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 97cffc9dd..4a4a26f7a 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -48,45 +48,52 @@ public: Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; - /* If you add to this, make sure you update LogCategoryName */ + /* + If you add to this, make sure you update LogCategoryName + NOTE: Only add to the bottom of the enum because that is the type ID assignment + */ enum LogCategory { None = 0, - Zone_Server = 1, - World_Server, - UCS_Server, - QS_Server, - WebInterface_Server, AA, + AI, + Aggro, + Attack, + Client_Server_Packet, + Combat, + Commands, + Crash, + Debug, Doors, + Error, Guilds, Inventory, Launcher, Netcode, + Normal, Object, + Pathing, + QS_Server, + Quests, Rules, Skills, Spawns, Spells, - Tasks, - Trading, - Tradeskills, - Tribute, + Status, TCP_Connection, - Client_Server_Packet, - Aggro, - Attack, - Quests, - AI, - Combat, - Pathing, + Tasks, + Tradeskills, + Trading, + Tribute, + UCS_Server, + WebInterface_Server, + World_Server, + Zone_Server, MaxCategoryID /* Don't Remove this*/ }; void CloseFileLogs(); void LoadLogSettingsDefaults(); void Log(uint16 log_type, const std::string message, ...); - //void LogDebug(DebugLevel debug_level, std::string message, ...); - //void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); @@ -120,34 +127,40 @@ extern EQEmuLogSys Log; /* If you add to this, make sure you update LogCategory */ static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { "", - "Zone", - "World", - "UCS", - "QueryServer", - "WebInterface", "AA", + "AI", + "Aggro", + "Attack", + "Client_Server_Packet", + "Combat", + "Commands", + "Crash", + "Debug", "Doors", - "Guild", + "Error", + "Guilds", "Inventory", "Launcher", "Netcode", + "Normal", "Object", + "Pathing", + "QS_Server", + "Quests", "Rules", "Skills", "Spawns", "Spells", - "Tasks", - "Trading", - "Tradeskills", - "Tribute", + "Status", "TCP_Connection", - "Client_Server_Packet", - "Aggro", - "Attack", - "Quests", - "AI", - "Combat", - "Pathing" + "Tasks", + "Tradeskills", + "Trading", + "Tribute", + "UCS_Server", + "WebInterface_Server", + "World_Server", + "Zone_Server", }; #endif \ No newline at end of file From c5f38ee700803b459f8118c584d4ef0a91cd1097 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:26:22 -0800 Subject: [PATCH 1055/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index abbb481e4..21ee850dc 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1701,7 +1701,7 @@ void Merc::AI_Process() { if(follow) { - float dist = DistNoRoot(*follow); + float dist = ComparativeDistance(m_Position, follow->GetPosition()); float speed = GetRunspeed(); if(dist < GetFollowDistance() + 1000) From e9f8d5fa6d859083624ec25790c461aba4958566 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:27:52 -0600 Subject: [PATCH 1056/1883] Port Status messages from Type to Category --- client_files/export/main.cpp | 10 +++--- client_files/import/main.cpp | 14 ++++---- common/database.cpp | 2 +- queryserv/database.cpp | 2 +- shared_memory/main.cpp | 16 ++++----- ucs/database.cpp | 2 +- world/worlddb.cpp | 10 +++--- zone/aa.cpp | 6 ++-- zone/client_packet.cpp | 2 +- zone/command.cpp | 2 +- zone/doors.cpp | 2 +- zone/embparser.cpp | 2 +- zone/pathing.cpp | 4 +-- zone/zone.cpp | 66 ++++++++++++++++++------------------ zone/zonedb.cpp | 2 +- zone/zoning.cpp | 2 +- 16 files changed, 72 insertions(+), 72 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 1b129e552..5d421b50c 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Log(EQEmuLogSys::Status, "Client Files Export Utility"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; @@ -50,7 +50,7 @@ int main(int argc, char **argv) { } SharedDatabase database; - Log.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " @@ -66,7 +66,7 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Exporting Spells..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { @@ -140,7 +140,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Exporting Skill Caps..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { @@ -169,7 +169,7 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Exporting Base Data..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 6e65df96b..810309f36 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Log(EQEmuLogSys::Status, "Client Files Import Utility"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; @@ -48,7 +48,7 @@ int main(int argc, char **argv) { } SharedDatabase database; - Log.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " @@ -76,7 +76,7 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Importing Spells..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { Log.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); @@ -142,19 +142,19 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - Log.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - Log.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Importing Skill Caps..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { @@ -190,7 +190,7 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - Log.Log(EQEmuLogSys::Status, "Importing Base Data..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { diff --git a/common/database.cpp b/common/database.cpp index 5c506fd53..14b461a01 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -89,7 +89,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c return false; } else { - Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index c7c4ec8c9..55c26e47e 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -76,7 +76,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c } else { - Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 765d08c22..0797662eb 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Log(EQEmuLogSys::Status, "Shared Memory Loader Program"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); return 1; @@ -52,7 +52,7 @@ int main(int argc, char **argv) { } SharedDatabase database; - Log.Log(EQEmuLogSys::Status, "Connecting to database..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " @@ -114,7 +114,7 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - Log.Log(EQEmuLogSys::Status, "Loading items..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { @@ -124,7 +124,7 @@ int main(int argc, char **argv) { } if(load_all || load_factions) { - Log.Log(EQEmuLogSys::Status, "Loading factions..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { @@ -134,7 +134,7 @@ int main(int argc, char **argv) { } if(load_all || load_loot) { - Log.Log(EQEmuLogSys::Status, "Loading loot..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { @@ -144,7 +144,7 @@ int main(int argc, char **argv) { } if(load_all || load_skill_caps) { - Log.Log(EQEmuLogSys::Status, "Loading skill caps..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { @@ -154,7 +154,7 @@ int main(int argc, char **argv) { } if(load_all || load_spells) { - Log.Log(EQEmuLogSys::Status, "Loading spells..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { @@ -164,7 +164,7 @@ int main(int argc, char **argv) { } if(load_all || load_bd) { - Log.Log(EQEmuLogSys::Status, "Loading base data..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { diff --git a/ucs/database.cpp b/ucs/database.cpp index d437e3d64..f189e0639 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -81,7 +81,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c } else { - Log.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 72c90f494..19f3b831d 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -302,7 +302,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* return false; } - Log.Log(EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - Log.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.Log(EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - Log.Log(EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); diff --git a/zone/aa.cpp b/zone/aa.cpp index 13ab491d6..b7cb4e7d4 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1429,7 +1429,7 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - Log.Log(EQEmuLogSys::Status, "Loading AA information..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { Log.Log(EQEmuLogSys::Error, "Failed to load AAs!"); @@ -1447,9 +1447,9 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - Log.Log(EQEmuLogSys::Status, "Loading AA Effects..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - Log.Log(EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else Log.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a39ad8fa2..b85dbf1a7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6135,7 +6135,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - Log.Log(EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); diff --git a/zone/command.cpp b/zone/command.cpp index 2e8ecc8f8..f4aaca5e1 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -449,7 +449,7 @@ int command_init(void) { { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - Log.Log(EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } diff --git a/zone/doors.cpp b/zone/doors.cpp index 6e4640d23..8ac166ddc 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - Log.Log(EQEmuLogSys::Status, "Loading Doors from database..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 2a9575f8c..e015b14c8 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - Log.Log(EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 343711a65..06a99ade3 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,7 +61,7 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - Log.Log(EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); } else @@ -109,7 +109,7 @@ bool PathManager::loadPaths(FILE *PathFile) fread(&Head, sizeof(Head), 1, PathFile); - Log.Log(EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) diff --git a/zone/zone.cpp b/zone/zone.cpp index 677284a59..6a5f9a9bb 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - Log.Log(EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - Log.Log(EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - Log.Log(EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - Log.Log(EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - Log.Log(EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -145,7 +145,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { } Log.Log(EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - Log.Log(EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -171,7 +171,7 @@ bool Zone::LoadZoneObjects() { return false; } - Log.Log(EQEmuLogSys::Status, "Loading Objects from DB..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - Log.Log(EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - Log.Log(EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - Log.Log(EQEmuLogSys::Status, "Loading Merchant Lists..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -707,7 +707,7 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - Log.Log(EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) @@ -725,12 +725,12 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - Log.Log(EQEmuLogSys::Status, "Loading doors for %s ...", zone); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - Log.Log(EQEmuLogSys::Status, "... No doors loaded."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); return; } @@ -899,53 +899,53 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - Log.Log(EQEmuLogSys::Status, "Loading spawn conditions..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { Log.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } - Log.Log(EQEmuLogSys::Status, "Loading static zone points..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); return false; } - Log.Log(EQEmuLogSys::Status, "Loading spawn groups..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { Log.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } - Log.Log(EQEmuLogSys::Status, "Loading spawn2 points..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { Log.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } - Log.Log(EQEmuLogSys::Status, "Loading player corpses..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { Log.Log(EQEmuLogSys::Error, "Loading player corpses failed."); return false; } - Log.Log(EQEmuLogSys::Status, "Loading traps..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { Log.Log(EQEmuLogSys::Error, "Loading traps failed."); return false; } - Log.Log(EQEmuLogSys::Status, "Loading adventure flavor text..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - Log.Log(EQEmuLogSys::Status, "Loading ground spawns..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { Log.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } - Log.Log(EQEmuLogSys::Status, "Loading World Objects from DB..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { Log.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - Log.Log(EQEmuLogSys::Status, "Loading timezone data..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - Log.Log(EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,29 +1019,29 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - Log.Log(EQEmuLogSys::Status, "Reloading Zone Static Data..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); - Log.Log(EQEmuLogSys::Status, "Reloading static zone points..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); } - Log.Log(EQEmuLogSys::Status, "Reloading traps..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { Log.Log(EQEmuLogSys::Error, "Reloading traps failed."); } - Log.Log(EQEmuLogSys::Status, "Reloading ground spawns..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { Log.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - Log.Log(EQEmuLogSys::Status, "Reloading World Objects from DB..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { Log.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - Log.Log(EQEmuLogSys::Status, "Zone Static Data Reloaded."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - Log.Log(EQEmuLogSys::Status, "Successfully loaded Zone Config."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); return true; } @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - Log.Log(EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - Log.Log(EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8a8c82e59..69bae78dc 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - Log.Log(EQEmuLogSys::Status, "Loading Blocked Spells from database..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index c883dc78d..ec99be644 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - Log.Log(EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it From 9aa46a9af2367def529120905e4f6f34230a80a0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:27:57 -0800 Subject: [PATCH 1057/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 21ee850dc..df81db149 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1938,7 +1938,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon if (mercSpell.type & SpellType_Escape) { dist2 = 0; } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal) || spells[spellid].targettype==ST_AECaster From b3fc0ab06de36ef84c4e49574b7d3a58df8e04bf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:29:28 -0600 Subject: [PATCH 1058/1883] Consolidate 'LogType' Crash logs over to 'LogCategory' --- common/crash.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/common/crash.cpp b/common/crash.cpp index bbc9c3f49..e573ea1a5 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -25,7 +25,7 @@ public: } } - Log.Log(EQEmuLogSys::Crash, buffer); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - Log.Log(EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - Log.Log(EQEmuLogSys::Crash, "Unknown Exception"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); break; } From 1bb4ff2d6a90c86461ecfb3e4157286922fef80f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:30:18 -0800 Subject: [PATCH 1059/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index df81db149..3ea3ac542 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4201,7 +4201,7 @@ bool Merc::CheckConfidence() { AggroRange = AggroRange * AggroRange; - if(mob->DistNoRoot(*this) > AggroRange) continue; + if(ComparativeDistance(m_Position, mob->GetPosition()) > AggroRange) continue; CurrentCon = this->GetLevelCon(mob->GetLevel()); switch(CurrentCon) { From e691735a2d8d01ce4f7ca9519160b7f9f7dbdc1a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:30:25 -0600 Subject: [PATCH 1060/1883] Consolidate 'LogType' Error logs over to 'LogCategory' --- client_files/export/main.cpp | 20 ++-- client_files/import/main.cpp | 14 +-- common/database.cpp | 26 ++--- common/eqtime.cpp | 6 +- common/guild_base.cpp | 2 +- common/item.cpp | 2 +- common/ptimer.cpp | 14 +-- common/rulesys.cpp | 8 +- common/shareddb.cpp | 94 +++++++-------- queryserv/database.cpp | 2 +- shared_memory/main.cpp | 18 +-- ucs/database.cpp | 2 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/eql_config.cpp | 22 ++-- world/worlddb.cpp | 8 +- zone/aa.cpp | 32 +++--- zone/attack.cpp | 10 +- zone/bot.cpp | 20 ++-- zone/client.cpp | 18 +-- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 216 +++++++++++++++++------------------ zone/client_process.cpp | 2 +- zone/command.cpp | 4 +- zone/corpse.cpp | 2 +- zone/effects.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embxs.cpp | 2 +- zone/entity.cpp | 12 +- zone/exp.cpp | 2 +- zone/forage.cpp | 6 +- zone/groups.cpp | 24 ++-- zone/guild.cpp | 4 +- zone/guild_mgr.cpp | 28 ++--- zone/horse.cpp | 6 +- zone/inventory.cpp | 16 +-- zone/merc.cpp | 8 +- zone/mob_ai.cpp | 2 +- zone/net.cpp | 34 +++--- zone/npc.cpp | 18 +-- zone/object.cpp | 8 +- zone/pathing.cpp | 10 +- zone/petitions.cpp | 8 +- zone/pets.cpp | 16 +-- zone/questmgr.cpp | 4 +- zone/raids.cpp | 18 +-- zone/spawn2.cpp | 22 ++-- zone/spawngroup.cpp | 6 +- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 14 +-- zone/tasks.cpp | 66 +++++------ zone/titles.cpp | 12 +- zone/tradeskills.cpp | 64 +++++------ zone/trading.cpp | 14 +-- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 46 ++++---- zone/worldserver.cpp | 6 +- zone/zone.cpp | 62 +++++----- zone/zonedb.cpp | 54 ++++----- zone/zoning.cpp | 24 ++-- 61 files changed, 594 insertions(+), 594 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 5d421b50c..4dbe79f99 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -40,20 +40,20 @@ int main(int argc, char **argv) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -70,7 +70,7 @@ void ExportSpells(SharedDatabase *db) { FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Log(EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -144,7 +144,7 @@ void ExportSkillCaps(SharedDatabase *db) { FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -173,7 +173,7 @@ void ExportBaseData(SharedDatabase *db) { FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Log(EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 810309f36..c0d98bad5 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -38,20 +38,20 @@ int main(int argc, char **argv) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -79,7 +79,7 @@ void ImportSpells(SharedDatabase *db) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -158,7 +158,7 @@ void ImportSkillCaps(SharedDatabase *db) { FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -194,7 +194,7 @@ void ImportBaseData(SharedDatabase *db) { FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - Log.Log(EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/database.cpp b/common/database.cpp index 14b461a01..a11d05162 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,7 +84,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); return false; } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - Log.Log(EQEmuLogSys::Error, "StoreCharacter: no character id"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); return false; } @@ -736,7 +736,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - Log.Log(EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else Log.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,7 +3255,7 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/eqtime.cpp b/common/eqtime.cpp index c689b634c..8f80bed91 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - Log.Log(EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - Log.Log(EQEmuLogSys::Error, "Could not load EQTime file %s", filename); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - Log.Log(EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index b168d49fb..15a7851b8 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -337,7 +337,7 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } diff --git a/common/item.cpp b/common/item.cpp index c564edae7..ba90280a8 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - Log.Log(EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/ptimer.cpp b/common/ptimer.cpp index ea718fdd9..0a987a908 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - Log.Log(EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Log(EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index e0a1091e3..92a4993aa 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -282,7 +282,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d6d6916fd..d70fc6387 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - Log.Log(EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - Log.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.Log(EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - Log.Log(EQEmuLogSys::Error, "No book to send, (%s)", txtfile); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.Log(EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - Log.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - Log.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - Log.Log(EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - Log.Log(EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 55c26e47e..414f7a91f 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,7 +69,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 0797662eb..a6921624e 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -42,20 +42,20 @@ int main(int argc, char **argv) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - Log.Log(EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -118,7 +118,7 @@ int main(int argc, char **argv) { try { LoadItems(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } @@ -128,7 +128,7 @@ int main(int argc, char **argv) { try { LoadFactions(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } @@ -138,7 +138,7 @@ int main(int argc, char **argv) { try { LoadLoot(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } @@ -148,7 +148,7 @@ int main(int argc, char **argv) { try { LoadSkillCaps(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } @@ -158,7 +158,7 @@ int main(int argc, char **argv) { try { LoadSpells(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } @@ -168,7 +168,7 @@ int main(int argc, char **argv) { try { LoadBaseData(&database); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "%s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/database.cpp b/ucs/database.cpp index f189e0639..8fe5918e7 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,7 +74,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; diff --git a/world/adventure.cpp b/world/adventure.cpp index 0c0c3b18d..02ef42459 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 53a755bdb..edbed3776 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 80ec90f40..c23c82b06 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 19f3b831d..2955cd6d9 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,7 +298,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/zone/aa.cpp b/zone/aa.cpp index b7cb4e7d4..818a51e50 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - Log.Log(EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.Log(EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - Log.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - Log.Log(EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -1432,7 +1432,7 @@ void Zone::LoadAAs() { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - Log.Log(EQEmuLogSys::Error, "Failed to load AAs!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1451,7 +1451,7 @@ void Zone::LoadAAs() { if (database.LoadAAEffects2()) Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else - Log.Log(EQEmuLogSys::Error, "Failed to load AA Effects!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - Log.Log(EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/attack.cpp b/zone/attack.cpp index ec696990c..a4240fc60 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1128,7 +1128,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } @@ -1692,7 +1692,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -3887,7 +3887,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3918,7 +3918,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } @@ -4467,7 +4467,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 111d52675..b204fb419 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.Log(EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); return; } @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadStance()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in Bot::SaveStance()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - Log.Log(EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - Log.Log(EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -6017,7 +6017,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } @@ -15454,7 +15454,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/client.cpp b/zone/client.cpp index 7c993f337..ddfa3584a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5294,7 +5294,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5362,7 +5362,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5389,7 +5389,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5397,7 +5397,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6211,7 +6211,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.Log(EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6225,7 +6225,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - Log.Log(EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8289,11 +8289,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - Log.Log(EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - Log.Log(EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - Log.Log(EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 5d4221305..006529b66 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.Log(EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b85dbf1a7..09bae443d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - Log.Log(EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.Log(EQEmuLogSys::Error, "Error message: %s", error->message); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1324,7 +1324,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - Log.Log(EQEmuLogSys::Error, "GetAuth() returned false kicking client"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - Log.Log(EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - Log.Log(EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - Log.Log(EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3636,7 +3636,7 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) } else { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - Log.Log(EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,13 +3721,13 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - Log.Log(EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - Log.Log(EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - Log.Log(EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,7 +3859,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - Log.Log(EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - Log.Log(EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - Log.Log(EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.Log(EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.Log(EQEmuLogSys::Error, "Error message:%s", error->message); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - Log.Log(EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - Log.Log(EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5445,7 +5445,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5536,7 +5536,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5591,7 +5591,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5858,7 +5858,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5910,7 +5910,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5943,7 +5943,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6058,7 +6058,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6125,7 +6125,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6379,7 +6379,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6396,7 +6396,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6440,7 +6440,7 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6587,7 +6587,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - Log.Log(EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6607,7 +6607,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6656,7 +6656,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6734,7 +6734,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6770,7 +6770,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6864,7 +6864,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -6889,7 +6889,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - Log.Log(EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7050,7 +7050,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - Log.Log(EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7121,7 +7121,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - Log.Log(EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } @@ -7972,7 +7972,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8002,7 +8002,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8057,7 +8057,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8071,7 +8071,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8108,7 +8108,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - Log.Log(EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8223,7 +8223,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8421,7 +8421,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8874,7 +8874,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9034,7 +9034,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9071,7 +9071,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - Log.Log(EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9096,7 +9096,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9150,7 +9150,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9698,7 +9698,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - Log.Log(EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9714,7 +9714,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9856,7 +9856,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9869,7 +9869,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10332,7 +10332,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10376,7 +10376,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10446,7 +10446,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - Log.Log(EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10720,7 +10720,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11305,7 +11305,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11334,7 +11334,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11350,7 +11350,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11364,7 +11364,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11378,7 +11378,7 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } @@ -11437,7 +11437,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11727,7 +11727,7 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - Log.Log(EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11771,7 +11771,7 @@ void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11884,7 +11884,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received invalid sized " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11918,7 +11918,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); return; } @@ -11993,7 +11993,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12090,7 +12090,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12258,7 +12258,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - Log.Log(EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12504,7 +12504,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12797,7 +12797,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12924,7 +12924,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - Log.Log(EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13202,7 +13202,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - Log.Log(EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13216,7 +13216,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13369,7 +13369,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13515,7 +13515,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - Log.Log(EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13525,7 +13525,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } else { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); - Log.Log(EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13563,7 +13563,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13599,7 +13599,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13670,7 +13670,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - Log.Log(EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13809,7 +13809,7 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13824,7 +13824,7 @@ void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - Log.Log(EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index fc52e5724..c9a70d87b 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - Log.Log(EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } diff --git a/zone/command.cpp b/zone/command.cpp index f4aaca5e1..b23134617 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -494,7 +494,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - Log.Log(EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -573,7 +573,7 @@ int command_realdispatch(Client *c, const char *message) #endif if(cur->function == nullptr) { - Log.Log(EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 761b38b51..a16f6f240 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -875,7 +875,7 @@ bool Corpse::Process() { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); } else { - Log.Log(EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } diff --git a/zone/effects.cpp b/zone/effects.cpp index aa21fb6b8..457d11d65 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - Log.Log(EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index e5cab5f75..7b823154a 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - Log.Log(EQEmuLogSys::Error, "boot_quest does not take any arguments."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 4075186e0..29425351b 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - Log.Log(EQEmuLogSys::Error, "boot_qc does not take any arguments."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/entity.cpp b/zone/entity.cpp index d400d9cab..17bcf5e6c 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - Log.Log(EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - Log.Log(EQEmuLogSys::Error, "About to delete a client still in a group."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - Log.Log(EQEmuLogSys::Error, "About to delete a client still in a raid."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.Log(EQEmuLogSys::Error, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.Log(EQEmuLogSys::Error, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - Log.Log(EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); diff --git a/zone/exp.cpp b/zone/exp.cpp index adf2ca363..15a120bbe 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - Log.Log(EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } diff --git a/zone/forage.cpp b/zone/forage.cpp index 838122471..beb92eb43 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - Log.Log(EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - Log.Log(EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index f51ccf0e2..1c95c44fc 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - Log.Log(EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 474f131a9..9f2bfe48b 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -409,7 +409,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -429,7 +429,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 912a7f152..f8c7c9ffd 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -261,7 +261,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; @@ -295,7 +295,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,7 +364,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.Log(EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - Log.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - Log.Log(EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - Log.Log(EQEmuLogSys::Error, "No space to add item to the guild bank."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/horse.cpp b/zone/horse.cpp index 6fc5dce26..9926cbe8a 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.Log(EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - Log.Log(EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 455757e85..6a43b7059 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - Log.Log(EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - Log.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - Log.Log(EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } @@ -2594,7 +2594,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2646,7 +2646,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.Log(EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2865,7 +2865,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - Log.Log(EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - Log.Log(EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/merc.cpp b/zone/merc.cpp index 106bbc10d..2cfe647af 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - Log.Log(EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index ee6aa0913..7634f14c8 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Log(EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/net.cpp b/zone/net.cpp index c1b2e70ce..0e869c225 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -150,7 +150,7 @@ int main(int argc, char** argv) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - Log.Log(EQEmuLogSys::Error, "Loading server configuration failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); @@ -169,7 +169,7 @@ int main(int argc, char** argv) { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Log(EQEmuLogSys::Error, "Cannot continue without a database connection."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } @@ -192,16 +192,16 @@ int main(int argc, char** argv) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.Log(EQEmuLogSys::Error, "Could not set signal handler"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #endif @@ -223,25 +223,25 @@ int main(int argc, char** argv) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { - Log.Log(EQEmuLogSys::Error, "Loading items FAILED!"); - Log.Log(EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - Log.Log(EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { - Log.Log(EQEmuLogSys::Error, "Loading loot FAILED!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { - Log.Log(EQEmuLogSys::Error, "Loading skill caps FAILED!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } @@ -252,7 +252,7 @@ int main(int argc, char** argv) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { - Log.Log(EQEmuLogSys::Error, "Loading base data FAILED!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } @@ -278,7 +278,7 @@ int main(int argc, char** argv) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) - Log.Log(EQEmuLogSys::Error, "Command loading FAILED"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); else Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); @@ -288,7 +288,7 @@ int main(int argc, char** argv) { if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Log(EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { @@ -321,7 +321,7 @@ int main(int argc, char** argv) { parse->ReloadQuests(); if (!worldserver.Connect()) { - Log.Log(EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -334,7 +334,7 @@ int main(int argc, char** argv) { if (!strlen(zone_name) || !strcmp(zone_name,".")) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - Log.Log(EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } @@ -371,7 +371,7 @@ int main(int argc, char** argv) { // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - Log.Log(EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; @@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - Log.Log(EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 91f43da6c..241834a78 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - Log.Log(EQEmuLogSys::Error, "Database error, invalid item"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/object.cpp b/zone/object.cpp index 9319782f8..34d85a33c 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - Log.Log(EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 06a99ade3..425ea9e34 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -66,14 +66,14 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) } else { - Log.Log(EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - Log.Log(EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,7 +103,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - Log.Log(EQEmuLogSys::Error, "Bad Magic String in .path file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); return false; } @@ -114,7 +114,7 @@ bool PathManager::loadPaths(FILE *PathFile) if(Head.version != 2) { - Log.Log(EQEmuLogSys::Error, "Unsupported path file version."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - Log.Log(EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 37e1c9cab..373152c29 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,7 +254,7 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 4dff5aa84..690ae6434 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - Log.Log(EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - Log.Log(EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - Log.Log(EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - Log.Log(EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index c3188d66e..41c15bfc5 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - Log.Log(EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 01685b352..d638f07d5 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - Log.Log(EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - Log.Log(EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 288893a1e..709984976 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.Log(EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - Log.Log(EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 0b3201da3..e98c80209 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -195,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index cfa9e55c4..771eba717 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - Log.Log(EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 1f6c514fe..b13f8583d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - Log.Log(EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - Log.Log(EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - Log.Log(EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 3cae8a687..187c4a42f 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.Log(EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -323,7 +323,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -362,7 +362,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -466,7 +466,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - Log.Log(EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - Log.Log(EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,7 +634,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - Log.Log(EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - Log.Log(EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -725,7 +725,7 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -774,7 +774,7 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { @@ -1280,7 +1280,7 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2938,7 +2938,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); @@ -2947,7 +2947,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); @@ -3088,7 +3088,7 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/titles.cpp b/zone/titles.cpp index 4867db69f..38c344cc6 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 2021901ab..060ecc035 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - Log.Log(EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - Log.Log(EQEmuLogSys::Error, "Player tried to augment an item without a container set."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - Log.Log(EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - Log.Log(EQEmuLogSys::Error, "Replace container combine executed in a world container."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - Log.Log(EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - Log.Log(EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - Log.Log(EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - Log.Log(EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - Log.Log(EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - Log.Log(EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - Log.Log(EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - Log.Log(EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,7 +1477,7 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 99a2d42ed..d2873cc66 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1539,7 +1539,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - Log.Log(EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Log(EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; diff --git a/zone/trap.cpp b/zone/trap.cpp index 51bf3b3ed..3f0582c86 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 6ee71ee05..db3d7ce65 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - Log.Log(EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index bf7bdc143..a11de0bc8 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -116,7 +116,7 @@ void NPC::ResumeWandering() } else { - Log.Log(EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - Log.Log(EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - Log.Log(EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - Log.Log(EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - Log.Log(EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 6bbe3d3ab..1d83cb10c 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -391,7 +391,7 @@ void WorldServer::Process() { } } else - Log.Log(EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -1381,7 +1381,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - Log.Log(EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } @@ -2061,7 +2061,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - Log.Log(EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { diff --git a/zone/zone.cpp b/zone/zone.cpp index 6a5f9a9bb..0b1b584d0 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -167,7 +167,7 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -737,7 +737,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version) Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - Log.Log(EQEmuLogSys::Error, "... Failed to load doors."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -806,7 +806,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(GraveYardLoaded) Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - Log.Log(EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -901,38 +901,38 @@ bool Zone::Init(bool iStaticZone) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - Log.Log(EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); return false; } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - Log.Log(EQEmuLogSys::Error, "Loading spawn groups failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - Log.Log(EQEmuLogSys::Error, "Loading spawn2 points failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - Log.Log(EQEmuLogSys::Error, "Loading player corpses failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); return false; } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - Log.Log(EQEmuLogSys::Error, "Loading traps failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); return false; } @@ -942,13 +942,13 @@ bool Zone::Init(bool iStaticZone) { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - Log.Log(EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.Log(EQEmuLogSys::Error, "Loading World Objects failed. continuing."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1024,27 +1024,27 @@ void Zone::ReloadStaticData() { Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - Log.Log(EQEmuLogSys::Error, "Loading static zone points failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - Log.Log(EQEmuLogSys::Error, "Reloading traps failed."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); } Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - Log.Log(EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.Log(EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.Log(EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - Log.Log(EQEmuLogSys::Error, "... Failed to load blocked spells."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 69bae78dc..8a6393391 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - Log.Log(EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - Log.Log(EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - Log.Log(EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index ec99be644..052849943 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - Log.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - Log.Log(EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - Log.Log(EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - Log.Log(EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - Log.Log(EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - Log.Log(EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -550,7 +550,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; default: - Log.Log(EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } From 0088d353d35abedbdd7a82869120ebe779ca22e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:31:57 -0800 Subject: [PATCH 1061/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 3ea3ac542..29310b872 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5150,7 +5150,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { } //check for merchant too far away - if(DistNoRoot(*merchant) > USE_NPC_RANGE2) { + if(ComparativeDistance(m_Position, merchant->GetPosition()) > USE_NPC_RANGE2) { SendMercResponsePackets(18); return false; } From ec7fd9b4e7a8577598194ff7e019a8867bbca32e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:32:18 -0600 Subject: [PATCH 1062/1883] Consolidate 'LogType' Normal logs over to 'LogCategory' --- zone/bot.cpp | 2 +- zone/client.cpp | 4 ++-- zone/command.cpp | 34 +++++++++++++++++----------------- zone/exp.cpp | 2 +- zone/npc.cpp | 2 +- zone/spell_effects.cpp | 4 ++-- zone/spells.cpp | 2 +- zone/tradeskills.cpp | 2 +- zone/zone.cpp | 4 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index b204fb419..7ad758706 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; diff --git a/zone/client.cpp b/zone/client.cpp index ddfa3584a..e10b1bb93 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1911,7 +1911,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - Log.Log(EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2364,7 +2364,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - Log.Log(EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } diff --git a/zone/command.cpp b/zone/command.cpp index b23134617..0665f3385 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1292,7 +1292,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Log(EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1317,7 +1317,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Log(EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1343,7 +1343,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Log(EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1566,7 +1566,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1588,7 +1588,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1612,7 +1612,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -1954,7 +1954,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - Log.Log(EQEmuLogSys::Normal, "Spawning database spawn"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2274,7 +2274,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - Log.Log(EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2299,7 +2299,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - Log.Log(EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2319,7 +2319,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - Log.Log(EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -3114,7 +3114,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Log(EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3771,7 +3771,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - Log.Log(EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4869,7 +4869,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - Log.Log(EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5221,7 +5221,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5278,7 +5278,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5325,7 +5325,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -7862,7 +7862,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - Log.Log(EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { diff --git a/zone/exp.cpp b/zone/exp.cpp index 15a120bbe..074e86d2a 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - Log.Log(EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/npc.cpp b/zone/npc.cpp index 241834a78..2351afafa 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - Log.Log(EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 771eba717..ecffd1921 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.Log(EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index b13f8583d..0587d11ee 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - Log.Log(EQEmuLogSys::Normal, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 060ecc035..572c02521 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1482,7 +1482,7 @@ void Client::LearnRecipe(uint32 recipeID) } if (results.RowCount() != 1) { - Log.Log(EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } diff --git a/zone/zone.cpp b/zone/zone.cpp index 0b1b584d0..c901a65b9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -144,7 +144,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - Log.Log(EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); @@ -711,7 +711,7 @@ void Zone::Shutdown(bool quite) petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - Log.Log(EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); From 40d0fba63fe815f850e35c3fc83d292d8cdb95a5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:32:57 -0600 Subject: [PATCH 1063/1883] Consolidate 'LogType' Quest logs over to 'LogCategory' --- zone/embperl.cpp | 10 +++++----- zone/questmgr.cpp | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 46a43246e..7653b5cc4 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -140,12 +140,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - Log.Log(EQEmuLogSys::Quest, "perl error: %s", err); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - Log.Log(EQEmuLogSys::Quest, "Tying perl output to eqemu logs"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -170,14 +170,14 @@ void Embperl::DoInit() { ,FALSE ); - Log.Log(EQEmuLogSys::Quest, "Loading perlemb plugins."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - Log.Log(EQEmuLogSys::Quest, "Warning - plugin.pl: %s", err); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); } try { @@ -195,7 +195,7 @@ void Embperl::DoInit() { } catch(const char *err) { - Log.Log(EQEmuLogSys::Quest, "Perl warning: %s", err); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 41c15bfc5..068817178 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.Log(EQEmuLogSys::Quest, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - Log.Log(EQEmuLogSys::Quest, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - Log.Log(EQEmuLogSys::Quest, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - Log.Log(EQEmuLogSys::Quest, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Log(EQEmuLogSys::Quest, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - Log.Log(EQEmuLogSys::Quest, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } From f047ed232db2d24becc7087c5c923e9ddd89ae4d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:33:34 -0800 Subject: [PATCH 1064/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index f6310801d..00db178eb 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -67,7 +67,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { dist2 = 0; //DistNoRoot(*this); //WTF was up with this... } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once. From b51185733376110a737886b14d03ddc1e9c4c007 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:34:31 -0600 Subject: [PATCH 1065/1883] Consolidate 'LogType' Commands logs over to 'LogCategory' --- zone/command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 0665f3385..6408071b2 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -443,7 +443,7 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; - Log.Log(EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { @@ -568,7 +568,7 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - Log.Log(EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif From 375f4af946de5b03a59ae8a7d0935e9806e4f99a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:36:10 -0600 Subject: [PATCH 1066/1883] Consolidate 'LogType' Error (Straggler) logs over to 'LogCategory' --- common/shareddb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d70fc6387..3abca55d8 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.Log(EQEmuLogSys::Error, + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.Log(EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } From fccd767330b3350821b7829bbaa73803e63e9002 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:37:00 -0800 Subject: [PATCH 1067/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 00db178eb..8d518c95d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -401,7 +401,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float if (t1 > iRange || t2 > iRange || t3 > iRange - || mob->DistNoRoot(*caster) > iRange2 + || ComparativeDistance(mob->GetPosition(), caster->GetPosition()) > iRange2 //this call should seem backwards: || !mob->CheckLosFN(caster) || mob->GetReverseFactionCon(caster) >= FACTION_KINDLY From 063a9214ae6ddfe15f61106f9e2f037f77fbeb66 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:37:54 -0600 Subject: [PATCH 1068/1883] Consolidate 'LogType' Debug logs over to 'LogCategory' --- common/database.cpp | 6 +++--- common/timeoutmgr.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index a11d05162..2bf2786bb 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -739,7 +739,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - Log.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -3262,7 +3262,7 @@ uint32 Database::GetGroupID(const char* name){ if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //Log.Log(EQEmuLogSys::Debug, "Character not in a group: %s", name); + //Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - Log.Log(EQEmuLogSys::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 5cc77e750..f0908b558 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - Log.Log(EQEmuLogSys::Debug, "Checking timeout on 0x%x\n", it); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - Log.Log(EQEmuLogSys::Debug, "Adding timeoutable 0x%x\n", who); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - Log.Log(EQEmuLogSys::Debug, "Removing timeoutable 0x%x\n", who); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); From 57ac6c0e98dd55a6174fe72558c97d909f0c73aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:39:01 -0600 Subject: [PATCH 1069/1883] Remove EQEmuLogSys::Log from consolidation of types into categories --- common/debug.cpp | 2 +- common/eqemu_logsys.cpp | 16 ---------------- common/eqemu_logsys.h | 11 ----------- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 9b15bcbd9..7dbd28751 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -158,7 +158,7 @@ bool EQEmuLog::write(LogIDs id, const char *fmt, ...) va_list argptr, tmpargptr; va_start(argptr, fmt); - Log.Log(id, vStringFormat(fmt, argptr).c_str()); + // Log.Log(id, vStringFormat(fmt, argptr).c_str()); return true; } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d8c73adca..faa05083b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -190,22 +190,6 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); } -void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) -{ - if (log_type > EQEmuLogSys::MaxLogID){ - return; - } - - va_list args; - va_start(args, message); - std::string output_message = vStringFormat(message.c_str(), args); - va_end(args); - - EQEmuLogSys::ProcessConsoleMessage(log_type, 0, output_message); - EQEmuLogSys::ProcessGMSay(log_type, 0, output_message); - EQEmuLogSys::ProcessLogWrite(log_type, 0, output_message); -} - void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ time_t raw_time; struct tm * time_info; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 4a4a26f7a..de49967db 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -31,17 +31,6 @@ public: EQEmuLogSys(); ~EQEmuLogSys(); - enum LogType { - Status = 0, /* This must stay the first entry in this list */ - Normal, /* Normal Logs */ - Error, /* Error Logs */ - Debug, /* Debug Logs */ - Quest, /* Quest Logs */ - Commands, /* Issued Commands */ - Crash, /* Crash Logs */ - MaxLogID /* Max, used in functions to get the max log ID */ - }; - enum DebugLevel { General = 0, /* 0 - Low-Level general debugging, useful info on single line */ Moderate, /* 1 - Informational based, used in functions, when particular things load */ From 0926a5ded390870cdf3fe2ec52f8819c302ff084 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:41:11 -0600 Subject: [PATCH 1070/1883] Refactor ProcessGMSay to no longer use type --- common/eqemu_logsys.cpp | 32 +++++++++++--------------------- common/eqemu_logsys.h | 1 - 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index faa05083b..0b4b61d8c 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -61,25 +61,15 @@ namespace Console { }; } -static const char* TypeNames[EQEmuLogSys::MaxLogID] = { - "Status", - "Normal", - "Error", - "Debug", - "Quest", - "Command", - "Crash", -}; - -static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { - Console::Color::Yellow, // "Status", - Console::Color::Yellow, // "Normal", - Console::Color::LightRed, // "Error", - Console::Color::LightGreen, // "Debug", - Console::Color::LightCyan, // "Quest", - Console::Color::LightMagenta, // "Command", - Console::Color::LightRed // "Crash" -}; +// static Console::Color LogColors[MaxCategoryID] = { +// Console::Color::Yellow, // "Status", +// Console::Color::Yellow, // "Normal", +// Console::Color::LightRed, // "Error", +// Console::Color::LightGreen, // "Debug", +// Console::Color::LightCyan, // "Quest", +// Console::Color::LightMagenta, // "Command", +// Console::Color::LightRed // "Crash" +// }; EQEmuLogSys::EQEmuLogSys(){ @@ -109,7 +99,7 @@ std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, s return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); } -void EQEmuLogSys::ProcessGMSay(uint16 log_type, uint16 log_category, std::string message) +void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_gmsay == 0) @@ -186,7 +176,7 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, log_category, output_debug_message); - EQEmuLogSys::ProcessGMSay(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index de49967db..42b39af7e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -82,7 +82,6 @@ public: void CloseFileLogs(); void LoadLogSettingsDefaults(); - void Log(uint16 log_type, const std::string message, ...); void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); From 564bff07fe411a920adff8a2964390b20564cc4b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:42:23 -0600 Subject: [PATCH 1071/1883] Refactor ProcessLogWrite to no longer use type --- common/eqemu_logsys.cpp | 6 +++--- common/eqemu_logsys.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0b4b61d8c..0322f9c96 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -110,11 +110,11 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) return; if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - on_log_gmsay_hook(log_type, message); + on_log_gmsay_hook(log_category, message); } } -void EQEmuLogSys::ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message) +void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_file == 0) @@ -177,7 +177,7 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); - EQEmuLogSys::ProcessLogWrite(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 42b39af7e..11bf6d3c0 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -106,8 +106,8 @@ private: std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); void ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); - void ProcessGMSay(uint16 log_type, uint16 log_category, std::string message); - void ProcessLogWrite(uint16 log_type, uint16 log_category, std::string message); + void ProcessGMSay(uint16 log_category, std::string message); + void ProcessLogWrite(uint16 log_category, std::string message); }; extern EQEmuLogSys Log; From 40d12d952eeab6057b6c5f9aa9e2e04f66019686 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:45:58 -0600 Subject: [PATCH 1072/1883] Refactor ProcessConsoleMessage to no longer use type --- common/eqemu_logsys.cpp | 22 +++++++++------------- common/eqemu_logsys.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0322f9c96..a6425284f 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -124,23 +124,19 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) EQEmuLogSys::SetCurrentTimeStamp(time_stamp); if (process_log){ - process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << message << std::endl; + process_log << time_stamp << " " << StringFormat("[%s] ", LogCategoryName[log_category]).c_str() << message << std::endl; } else{ // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; } } -void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) +void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_console == 0) return; - if (log_type > EQEmuLogSys::MaxLogID){ - return; - } - #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -150,15 +146,15 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, co info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (LogColors[log_type]){ - SetConsoleTextAttribute(console_handle, LogColors[log_type]); - } - else{ + //if (LogColors[log_type]){ + // SetConsoleTextAttribute(console_handle, LogColors[log_type]); + //} + //else{ SetConsoleTextAttribute(console_handle, Console::Color::White); - } + //} #endif - std::cout << "[" << TypeNames[log_type] << "] " << message << "\n"; + std::cout << "[" << LogCategoryName[log_category] << "] " << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ @@ -175,7 +171,7 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message); } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 11bf6d3c0..9955a2f2e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -101,11 +101,11 @@ public: private: bool zone_general_init = false; - std::function on_log_gmsay_hook; + std::function on_log_gmsay_hook; std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); - void ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); + void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); void ProcessLogWrite(uint16 log_category, std::string message); }; From b15e5f791303735ed306fbacb92462e09ae901e2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:48:07 -0600 Subject: [PATCH 1073/1883] Refactor GMSayHookCallBackProcess to use category instead of type --- common/database.cpp | 2 +- zone/zone.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 2bf2786bb..5c4a4c1fc 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } diff --git a/zone/zone.h b/zone/zone.h index 6c437bed2..b99feb093 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -67,15 +67,15 @@ struct item_tick_struct { std::string qglobal; }; -static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { - 15, // "Status", - Yellow - 15, // "Normal", - Yellow - 3, // "Error", - Red - 14, // "Debug", - Light Green - 4, // "Quest", - 5, // "Command", - 3 // "Crash" -}; +// static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { +// 15, // "Status", - Yellow +// 15, // "Normal", - Yellow +// 3, // "Error", - Red +// 14, // "Debug", - Light Green +// 4, // "Quest", +// 5, // "Command", +// 3 // "Crash" +// }; class Client; class Map; @@ -271,7 +271,7 @@ public: // random object that provides random values for the zone EQEmu::Random random; - static void GMSayHookCallBackProcess(uint16 log_type, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } + static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_category], "%s", message.c_str()); } //MODDING HOOKS void mod_init(); From 864e9ba8efed8afa2fee73afa9a0f43f0d3fcccd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:48:44 -0800 Subject: [PATCH 1074/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 8d518c95d..17e1b5de6 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -997,7 +997,7 @@ void Client::AI_Process() if(owner == nullptr) return; - float dist = DistNoRoot(*owner); + float dist = ComparativeDistance(m_Position, owner->GetPosition()); if (dist >= 100) { float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed(); @@ -1492,7 +1492,7 @@ void Mob::AI_Process() { //if(owner->IsClient()) // printf("Pet start pos: (%f, %f, %f)\n", GetX(), GetY(), GetZ()); - float dist = DistNoRoot(*owner); + float dist = ComparativeDistance(m_Position, owner->GetPosition()); if (dist >= 400) { float speed = GetWalkspeed(); From af8ab89a36c20dd687a30748773139bd89ce9d13 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:50:05 -0600 Subject: [PATCH 1075/1883] Compile state --- zone/embxs.cpp | 2 +- zone/zone.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 29425351b..05c9d642e 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quest, str); + Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); } } diff --git a/zone/zone.h b/zone/zone.h index b99feb093..e022a870c 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -271,7 +271,7 @@ public: // random object that provides random values for the zone EQEmu::Random random; - static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_category], "%s", message.c_str()); } + static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, 15, "%s", message.c_str()); } //MODDING HOOKS void mod_init(); From 1c048cb1d15acea7ddc9018cfe406f93d08ea260 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:54:09 -0600 Subject: [PATCH 1076/1883] Renamed DebugCategory to DoLog as the aggregate logging function for simplicity of use and shortened syntax of Log.DoLog --- client_files/export/main.cpp | 30 +-- client_files/import/main.cpp | 28 +- common/crash.cpp | 44 +-- common/database.cpp | 34 +-- common/eq_stream.cpp | 242 ++++++++--------- common/eq_stream_factory.cpp | 8 +- common/eq_stream_ident.cpp | 20 +- common/eqemu_logsys.cpp | 6 +- common/eqemu_logsys.h | 4 +- common/eqtime.cpp | 6 +- common/guild_base.cpp | 132 ++++----- common/item.cpp | 2 +- common/misc_functions.h | 2 +- common/patches/rof.cpp | 34 +-- common/patches/rof2.cpp | 34 +-- common/patches/sod.cpp | 22 +- common/patches/sof.cpp | 22 +- common/patches/ss_define.h | 8 +- common/patches/titanium.cpp | 22 +- common/patches/underfoot.cpp | 22 +- common/ptimer.cpp | 14 +- common/rulesys.cpp | 36 +-- common/shareddb.cpp | 106 ++++---- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 4 +- common/tcp_connection.cpp | 4 +- common/tcp_server.cpp | 4 +- common/timeoutmgr.cpp | 6 +- common/worldconn.cpp | 4 +- eqlaunch/eqlaunch.cpp | 18 +- eqlaunch/worldserver.cpp | 18 +- eqlaunch/zone_launch.cpp | 46 ++-- queryserv/database.cpp | 60 ++--- queryserv/lfguild.cpp | 14 +- queryserv/queryserv.cpp | 16 +- queryserv/worldserver.cpp | 6 +- shared_memory/main.cpp | 34 +-- ucs/chatchannel.cpp | 32 +-- ucs/clientlist.cpp | 78 +++--- ucs/database.cpp | 90 +++---- ucs/ucs.cpp | 26 +- ucs/worldserver.cpp | 8 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/client.cpp | 168 ++++++------ world/cliententry.cpp | 2 +- world/clientlist.cpp | 12 +- world/console.cpp | 24 +- world/eql_config.cpp | 22 +- world/eqw.cpp | 2 +- world/eqw_http_handler.cpp | 14 +- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 +- world/launcher_list.cpp | 10 +- world/login_server.cpp | 32 +-- world/login_server_list.cpp | 2 +- world/net.cpp | 116 ++++---- world/queryserv.cpp | 12 +- world/ucs.cpp | 12 +- world/wguild_mgr.cpp | 26 +- world/worlddb.cpp | 18 +- world/zonelist.cpp | 8 +- world/zoneserver.cpp | 88 +++--- zone/aa.cpp | 46 ++-- zone/aggro.cpp | 22 +- zone/attack.cpp | 174 ++++++------ zone/bonuses.cpp | 6 +- zone/bot.cpp | 114 ++++---- zone/botspellsai.cpp | 4 +- zone/client.cpp | 70 ++--- zone/client_mods.cpp | 12 +- zone/client_packet.cpp | 506 +++++++++++++++++------------------ zone/client_process.cpp | 24 +- zone/command.cpp | 60 ++--- zone/corpse.cpp | 8 +- zone/doors.cpp | 16 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 10 +- zone/embxs.cpp | 6 +- zone/entity.cpp | 14 +- zone/exp.cpp | 8 +- zone/fearpath.cpp | 4 +- zone/forage.cpp | 6 +- zone/groups.cpp | 36 +-- zone/guild.cpp | 20 +- zone/guild_mgr.cpp | 48 ++-- zone/horse.cpp | 6 +- zone/inventory.cpp | 154 +++++------ zone/loottables.cpp | 4 +- zone/merc.cpp | 16 +- zone/mob.cpp | 6 +- zone/mob_ai.cpp | 20 +- zone/net.cpp | 108 ++++---- zone/npc.cpp | 20 +- zone/object.cpp | 8 +- zone/pathing.cpp | 146 +++++----- zone/perl_client.cpp | 16 +- zone/petitions.cpp | 10 +- zone/pets.cpp | 16 +- zone/questmgr.cpp | 30 +-- zone/raids.cpp | 22 +- zone/spawn2.cpp | 152 +++++------ zone/spawngroup.cpp | 8 +- zone/special_attacks.cpp | 58 ++-- zone/spell_effects.cpp | 32 +-- zone/spells.cpp | 352 ++++++++++++------------ zone/tasks.cpp | 250 ++++++++--------- zone/titles.cpp | 12 +- zone/tradeskills.cpp | 82 +++--- zone/trading.cpp | 122 ++++----- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 108 ++++---- zone/worldserver.cpp | 42 +-- zone/zone.cpp | 148 +++++----- zone/zonedb.cpp | 124 ++++----- zone/zoning.cpp | 46 ++-- 119 files changed, 2653 insertions(+), 2653 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 4dbe79f99..feec1f440 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -38,22 +38,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -66,11 +66,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -140,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -169,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index c0d98bad5..285398ec8 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -36,22 +36,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -76,10 +76,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -142,23 +142,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -190,11 +190,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index e573ea1a5..8b9b48339 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -25,7 +25,7 @@ public: } } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index 5c4a4c1fc..af21f2bd1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); + //Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 9ae9db4e3..99bff02f1 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if (emu_op == OP_Unknown) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if(emu_op == OP_Unknown) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1111,7 +1111,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1141,33 +1141,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1178,10 +1178,10 @@ Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } @@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } @@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index f0fb30929..ce09e380e 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index d267a013c..adba3dddf 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -109,7 +109,7 @@ void EQStreamIdentifier::Process() { case EQStream::MatchSuccessful: { //yay, a match. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index a6425284f..c2559a233 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -91,7 +91,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings_loaded = true; } -std::string EQEmuLogSys::FormatDebugCategoryMessageString(uint16 log_category, std::string in_message){ +std::string EQEmuLogSys::FormatDoLogMessageString(uint16 log_category, std::string in_message){ std::string category_string = ""; if (log_category > 0 && LogCategoryName[log_category]){ category_string = StringFormat("[%s] ", LogCategoryName[log_category]); @@ -162,14 +162,14 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m #endif } -void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...) +void EQEmuLogSys::DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); + std::string output_debug_message = EQEmuLogSys::FormatDoLogMessageString(log_category, output_message); EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 9955a2f2e..23e737720 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -82,7 +82,7 @@ public: void CloseFileLogs(); void LoadLogSettingsDefaults(); - void DebugCategory(DebugLevel debug_level, uint16 log_category, std::string message, ...); + void DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); @@ -103,7 +103,7 @@ private: bool zone_general_init = false; std::function on_log_gmsay_hook; - std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); + std::string FormatDoLogMessageString(uint16 log_category, std::string in_message); void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 8f80bed91..6d6ab3fb8 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 15a7851b8..acb275e55 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -337,18 +337,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); return index; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/common/item.cpp b/common/item.cpp index ba90280a8..60ddab14c 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/misc_functions.h b/common/misc_functions.h index 27e648511..53ede739a 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 9e952ca74..bf0ec395b 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -52,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -316,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -551,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -585,7 +585,7 @@ namespace RoF safe_delete_array(Serialized); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1386,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2556,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3321,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3654,7 +3654,7 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3902,7 +3902,7 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4498,7 +4498,7 @@ namespace RoF SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5455,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5496,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5601,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5636,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 0fa71bb36..4ed34e193 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -52,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF2 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -382,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -617,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -651,7 +651,7 @@ namespace RoF2 safe_delete_array(Serialized); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1452,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2640,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3387,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3721,7 +3721,7 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3973,7 +3973,7 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4569,7 +4569,7 @@ namespace RoF2 SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5546,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5587,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5696,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5731,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 5b9ea0aab..750cac18b 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -50,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoD - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -247,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -359,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -391,7 +391,7 @@ namespace SoD } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -967,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2108,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2363,7 +2363,7 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3091,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 0ab39d521..4b215813e 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -50,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoF - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -214,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -337,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -371,7 +371,7 @@ namespace SoF } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -766,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1707,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1887,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2429,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index de9237636..f96720713 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index f607941fd..c46cba392 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -48,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -74,7 +74,7 @@ namespace Titanium - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -89,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -187,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -268,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -285,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -635,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1157,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1274,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1623,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 2602a62c1..faa19af67 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -50,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace Underfoot - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -307,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -494,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -526,7 +526,7 @@ namespace Underfoot safe_delete_array(Serialized); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1190,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2374,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2624,7 +2624,7 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3406,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 0a987a908..c9fe7f4f6 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 92a4993aa..ef8e0fa4d 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -282,13 +282,13 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 3abca55d8..924e4cfe5 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/spdat.cpp b/common/spdat.cpp index c54dfd1de..a628c8fa7 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index a0890c1ec..eb8244d04 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index b7434b947..9bf1de258 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index f61418a50..8fdf64dd7 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index f0908b558..92bf6e32e 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index f1820186f..1947ec0e8 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -76,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index c145ed9a6..47ccbf6a9 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 4d537c40b..a63ac1022 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -74,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -90,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -101,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -111,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -127,7 +127,7 @@ void WorldServer::Process() { } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 66baf675b..2e40a94d1 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -72,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -84,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -102,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -164,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -187,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -197,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 414f7a91f..292fb7bf2 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index cb3143d7b..e2ef1dd6c 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -242,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -257,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -288,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -305,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -335,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -348,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 9011d94f5..76dfc7b5a 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -65,16 +65,16 @@ int main() { */ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -83,22 +83,22 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index b2a3d0605..f4aca7f06 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -53,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -148,7 +148,7 @@ void WorldServer::Process() break; } default: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index a6921624e..38c4640b5 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -40,22 +40,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -114,61 +114,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 06c05516f..c1d797f26 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -42,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -149,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -170,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -228,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -237,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -262,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -299,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -397,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -479,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -555,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -572,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -587,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -613,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -628,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -654,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -669,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index de18778c8..0ad2b6157 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -236,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -305,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -400,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -430,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -481,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -560,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -586,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -606,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -646,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -667,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -703,7 +703,7 @@ void Clientlist::Process() { default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -716,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -860,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -885,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -896,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -905,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -971,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1012,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1113,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1292,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1435,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1647,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1702,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1790,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1918,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1999,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2087,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2196,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); } } } @@ -2299,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2377,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index 8fe5918e7..0c1bdee65 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 196200a48..22f285f25 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -104,22 +104,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index c6e91d47c..dc327cb48 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -52,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -67,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -88,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -99,7 +99,7 @@ void WorldServer::Process() if(!c) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); break; } diff --git a/world/adventure.cpp b/world/adventure.cpp index 02ef42459..14a7a141b 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index edbed3776..3fbcf96bb 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/client.cpp b/world/client.cpp index 1606de8af..268c0153c 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -136,7 +136,7 @@ void Client::SendEnterWorld(std::string name) eqs->Close(); return; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); } } @@ -378,7 +378,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if (strlen(password) <= 1) { // TODO: Find out how to tell the client wrong username/password - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); return false; } @@ -408,31 +408,31 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password))) #else if (loginserverlist.Connected() == false && !pZoning) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); return false; } if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); return false; } cle->SetOnline(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); if(minilogin){ WorldConfig::DisableStats(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); } const WorldConfig *Config=WorldConfig::get(); @@ -465,7 +465,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else { // TODO: Find out how to tell the client wrong username/password - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); return false; } @@ -479,7 +479,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); return false; } @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -648,11 +648,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); return false; } else if (app->size != sizeof(CharCreate_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); DumpPacket(app); // the previous behavior was essentially returning true here // but that seems a bit odd to me. @@ -679,14 +679,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); eqs->Close(); return true; } if(GetAdmin() < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); eqs->Close(); return true; } @@ -702,14 +702,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { uint32 tmpaccid = 0; charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID); if (charid == 0 || tmpaccid != GetAccountID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); eqs->Close(); return true; } // Make sure this account owns this character if (tmpaccid != GetAccountID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); eqs->Close(); return true; } @@ -737,7 +737,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { zoneID = database.MoveCharacterToBind(charid,4); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go home before they're able...",char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -770,7 +770,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -780,7 +780,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (zoneID == 0 || !database.GetZoneName(zoneID)) { // This is to save people in an invalid zone, once it's removed from the DB database.MoveCharacterToZone(charid, "arena"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); } if(instanceID > 0) @@ -894,7 +894,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer); if(char_acct_id == GetAccountID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); database.DeleteCharacter((char *)app->pBuffer); SendCharInfo(); } @@ -915,25 +915,25 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); return false; } // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); eqs->Close(); } } if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) { // Got a packet other than OP_SendLoginInfo when not logged in - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); return false; } else if (opcode == OP_AckPacket) { @@ -1005,7 +1005,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); _pkt(WORLD__CLIENT_ERR,app); return true; } @@ -1024,7 +1024,7 @@ bool Client::Process() { to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); ZoneUnavail(); } if(connect.Check()){ @@ -1058,7 +1058,7 @@ bool Client::Process() { loginserverlist.SendPacket(pack); safe_delete(pack); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); return false; } @@ -1107,17 +1107,17 @@ void Client::EnterWorld(bool TryBootup) { } else { if (TryBootup) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); autobootup_timeout.Start(); pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID); if (pwaitingforbootup == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); ZoneUnavail(); } return; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); ZoneUnavail(); return; } @@ -1126,12 +1126,12 @@ void Client::EnterWorld(bool TryBootup) { cle->SetChar(charid, char_name); database.UpdateLiveChar(char_name, GetAccountID()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); // database.SetAuthentication(account_id, char_name, zone_name, ip); if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,9 +1169,9 @@ void Client::Clearance(int8 response) { if (zs == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); } ZoneUnavail(); @@ -1181,20 +1181,20 @@ void Client::Clearance(int8 response) EQApplicationPacket* outapp; if (zs->GetCAddress() == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); ZoneUnavail(); return; } if (zoneID == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } const char* zonename = database.GetZoneName(zoneID); if (zonename == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } @@ -1225,7 +1225,7 @@ void Client::Clearance(int8 response) } strcpy(zsi->ip, zs_addr); zsi->port =zs->GetCPort(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); QueuePacket(outapp); safe_delete(outapp); @@ -1256,7 +1256,7 @@ bool Client::GenPassKey(char* key) { } void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P @@ -1355,27 +1355,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); /* Validate the char creation struct */ if (ClientVersionBit & BIT_SoFAndLater) { if (!CheckCharCreateInfoSoF(cc)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { if (!CheckCharCreateInfoTitanium(cc)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } @@ -1437,21 +1437,21 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); pp.zone_id = RuleI(World, SoFStartZoneID); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); } else { /* if there's a startzone variable put them in there */ if (database.GetVariable("startzone", startzone, 50)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; if (ClientVersionBit & BIT_TitaniumAndEarlier) @@ -1490,11 +1490,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ @@ -1503,10 +1503,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // now we give the pp and the inv we made to StoreCharacter // to see if we can store it if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); return false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); return true; } @@ -1516,7 +1516,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1533,7 +1533,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1550,7 +1550,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1563,37 +1563,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); return false; } @@ -1606,7 +1606,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1687,7 +1687,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1700,16 +1700,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1737,43 +1737,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 1dc8f3eca..ceb147fa3 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 0d874b304..c3cbc7a7c 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index f1f4a7edf..6b51deb34 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eql_config.cpp b/world/eql_config.cpp index c23c82b06..c2088b56d 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/eqw.cpp b/world/eqw.cpp index 1c0b811ee..2cc6262df 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index 9737bca12..fbe6ea000 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index f3f5dd50f..4c80ac7e7 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 8e1c65afe..300d94b3f 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 56c9c38e1..4b2af8169 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index 10b6e36c8..688a50a4b 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index 1504badcc..305c79b23 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index d6ea3259d..1d96c6d54 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); database.LoadVariables(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); database.LoadZoneNames(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); database.ClearGroup(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); if (!database.LoadItems()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/queryserv.cpp b/world/queryserv.cpp index b206dc961..d15f7d48a 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -23,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -57,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -69,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -79,7 +79,7 @@ bool QueryServConnection::Process() } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -97,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -114,7 +114,7 @@ bool QueryServConnection::Process() } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index 91ac8afba..22a1ecdf6 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -18,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -52,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -64,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -74,7 +74,7 @@ bool UCSConnection::Process() } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -92,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index a4de9647d..e0621ef8d 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -34,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 2955cd6d9..6ec2df6a6 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index d1abf523a..38485fb59 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 4a09a7b98..3d4376aeb 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -77,7 +77,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { char* longname; if (iZoneID) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; @@ -188,7 +188,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -199,7 +199,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -541,10 +541,10 @@ bool ZoneServer::Process() { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } @@ -589,10 +589,10 @@ bool ZoneServer::Process() { ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } @@ -602,7 +602,7 @@ bool ZoneServer::Process() { const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { @@ -685,12 +685,12 @@ bool ZoneServer::Process() { if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); /* This is a request from the egress zone */ if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) { ztz->response = 0; @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } @@ -736,7 +736,7 @@ bool ZoneServer::Process() { /* Response from Ingress server, route back to egress */ else{ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = nullptr; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); @@ -754,7 +754,7 @@ bool ZoneServer::Process() { } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); @@ -763,7 +763,7 @@ bool ZoneServer::Process() { case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); @@ -868,7 +868,7 @@ bool ZoneServer::Process() { } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; @@ -888,7 +888,7 @@ bool ZoneServer::Process() { } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; @@ -913,7 +913,7 @@ bool ZoneServer::Process() { } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; @@ -924,7 +924,7 @@ bool ZoneServer::Process() { } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; @@ -943,7 +943,7 @@ bool ZoneServer::Process() { break; } case ServerOP_GetWorldTime: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; @@ -958,17 +958,17 @@ bool ZoneServer::Process() { break; } case ServerOP_SetWorldTime: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; @@ -980,7 +980,7 @@ bool ZoneServer::Process() { } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; @@ -1025,10 +1025,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; @@ -1047,10 +1047,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else @@ -1067,10 +1067,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } @@ -1079,10 +1079,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { @@ -1098,10 +1098,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } @@ -1119,10 +1119,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1138,10 +1138,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else @@ -1149,10 +1149,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1254,7 +1254,7 @@ bool ZoneServer::Process() { case ServerOP_LSAccountUpdate: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } @@ -1309,7 +1309,7 @@ bool ZoneServer::Process() { } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/zone/aa.cpp b/zone/aa.cpp index 818a51e50..207f944b4 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -951,7 +951,7 @@ void Client::SendAAStats() { void Client::BuyAA(AA_Action* action) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); //find the AA information from the database SendAA_Struct* aa2 = zone->FindAA(action->ability); @@ -963,7 +963,7 @@ void Client::BuyAA(AA_Action* action) a = action->ability - i; if(a <= 0) break; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); aa2 = zone->FindAA(a); if(aa2 != nullptr) break; @@ -980,7 +980,7 @@ void Client::BuyAA(AA_Action* action) uint32 cur_level = GetAA(aa2->id); if((aa2->id + cur_level) != action->ability) { //got invalid AA - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); return; } @@ -1011,7 +1011,7 @@ void Client::BuyAA(AA_Action* action) if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); m_pp.aapoints -= real_cost; @@ -1429,10 +1429,10 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1447,11 +1447,11 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index c1f3d4ce3..cbd051e1a 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,17 +342,17 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); return(false); } @@ -466,7 +466,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -693,7 +693,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -833,7 +833,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -945,7 +945,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index a4240fc60..81862872e 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -57,7 +57,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); switch (item->ItemType) { @@ -187,7 +187,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; if(IsClient() && other->IsClient()) @@ -208,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -236,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -308,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -327,7 +327,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); // @@ -336,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } @@ -370,7 +370,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && other->InFrontMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -517,7 +517,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -690,9 +690,9 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); } } @@ -1128,14 +1128,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } if(!GetTarget()) SetTarget(other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); //SetAttackTimer(); if ( @@ -1145,12 +1145,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b || (GetHP() < 0) || (!IsAttackAllowed(other)) ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); return false; // Only bards can attack while casting } if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable! return false; } @@ -1170,19 +1170,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -1200,7 +1200,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(IsBerserk() && GetClass() == BERSERKER){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -1268,7 +1268,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); int hit_chance_bonus = 0; @@ -1283,7 +1283,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it other->AvoidDamage(this, damage); @@ -1291,7 +1291,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -1430,7 +1430,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } int exploss = 0; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); /* #1: Send death packet to everyone @@ -1692,7 +1692,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -1710,7 +1710,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (other->IsClient()) other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); } return false; } @@ -1737,10 +1737,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); if(Hand == MainSecondary && weapon->ItemType == ItemTypeShield){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); return false; } @@ -1829,11 +1829,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } @@ -1846,7 +1846,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if(other->IsClient() && other->CastToClient()->IsSitting()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); damage = (max_dmg+eleBane); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); @@ -1857,7 +1857,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool hate += opts->hate_flat; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list other->AddToHateList(this, hate); @@ -1881,7 +1881,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(damage > 0) { CommonOutgoingHitSuccess(other, damage, skillinuse); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list if(damage > 0) other->AddToHateList(this, hate); @@ -1890,7 +1890,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); if(other->IsClient() && IsPet() && GetOwner()->IsClient()) { //pets do half damage to clients in pvp @@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //cant riposte a riposte if (bRiposte && damage == -3) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); return false; } @@ -1954,7 +1954,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -1991,7 +1991,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); Mob *oos = nullptr; if(killerMob) { @@ -2028,7 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); @@ -2580,7 +2580,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(DS == 0 && rev_ds == 0) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); //invert DS... spells yield negative values for a true damage shield if(DS < 0) { @@ -2625,7 +2625,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID; if(rev_ds < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } @@ -3137,7 +3137,7 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce >= buffs[slot].melee_rune) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3145,7 +3145,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3164,7 +3164,7 @@ int32 Mob::ReduceDamage(int32 damage) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3172,7 +3172,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) @@ -3290,7 +3290,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if(!TryFadeEffect(slot)) @@ -3298,7 +3298,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) @@ -3437,11 +3437,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == SkillAbjuration); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); if (GetInvul() || DivineAura()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } @@ -3493,7 +3493,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int healed = damage; healed = attacker->GetActSpellHealing(spell_id, healed); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); attacker->HealDamage(healed); //we used to do a message to the client, but its gone now. @@ -3506,7 +3506,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse()) { if (!pet->IsHeld()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); pet->AddToHateList(attacker, 1); pet->SetTarget(attacker); Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName()); @@ -3516,7 +3516,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if any runes want to reduce this damage if(spell_id == SPELL_UNKNOWN) { damage = ReduceDamage(damage); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); damage = ReduceAllDamage(damage); TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker); } else { @@ -3573,7 +3573,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //fade mez if we are mezzed if (IsMezzed() && attacker) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); @@ -3616,7 +3616,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); if (IsClient()) { stun_resist += aabonuses.StunResist; frontal_stun_resist += aabonuses.FrontalStunResist; @@ -3626,20 +3626,20 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (((GetBaseRace() == OGRE && IsClient()) || (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); } } @@ -3653,7 +3653,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //increment chances of interrupting if(IsCasting()) { //shouldnt interrupt on regular spell damage attacked_count++; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); } } @@ -3859,7 +3859,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) ProcChance += ProcChance * ProcBonus / 100.0f; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3878,7 +3878,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; ProcChance = ProcChance + (ProcChance * ProcBonus); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3887,7 +3887,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3918,17 +3918,17 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } if (!IsAttackAllowed(on)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); return; } if (DivineAura()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); return; } @@ -3975,7 +3975,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level); if (IsPet()) { @@ -3986,7 +3986,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on Message_StringID(13, PROC_TOOLOW); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100); ExecWeaponProc(inst, weapon->Proc.Effect, on); @@ -4065,12 +4065,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); ExecWeaponProc(nullptr, PermaProcs[i].spellID, on); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); } @@ -4080,13 +4080,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d failed to proc %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); } @@ -4096,13 +4096,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d failed to proc %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); } @@ -4352,7 +4352,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Mob::DoRiposte(Mob* defender) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -4370,7 +4370,7 @@ void Mob::DoRiposte(Mob* defender) { //Live AA - Double Riposte if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; } @@ -4381,7 +4381,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); @@ -4398,7 +4398,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ int dmgbonusmod = 0; dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3; dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); damage += (damage*dmgbonusmod/10000); } } @@ -4467,7 +4467,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } @@ -4692,13 +4692,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); return true; } } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); return false; } @@ -4770,19 +4770,19 @@ void Mob::CommonBreakInvisible() { //break invis when you attack if(invisible) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index fde1dacc8..4806c2241 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -634,7 +634,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7ad758706..ed9b9e1f3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); return; } @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); } @@ -2979,7 +2979,7 @@ void Bot::BotRangedAttack(Mob* other) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -2997,7 +2997,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!RangeWeapon || !Ammo) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); if(!IsAttackAllowed(other) || IsCasting() || @@ -3015,19 +3015,19 @@ void Bot::BotRangedAttack(Mob* other) { //break invis when you attack if(invisible) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -3362,7 +3362,7 @@ void Bot::AI_Process() { else if(!IsRooted()) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); return; @@ -3689,7 +3689,7 @@ void Bot::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -3972,7 +3972,7 @@ void Bot::PetAIProcess() { { botPet->SetRunAnimSpeed(0); if(!botPet->IsRooted()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed()); return; } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -5959,7 +5959,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); parse->EventNPC(EVENT_ATTACK, this, from, "", 0); } @@ -5972,7 +5972,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ // if spell is lifetap add hp to the caster if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { int healed = GetActSpellHealing(spell_id, damage); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); HealDamage(healed); entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() ); } @@ -6017,14 +6017,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } if(!GetTarget() || GetTarget() != other) SetTarget(other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || @@ -6036,13 +6036,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); if(other) { RemoveFromHateList(other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); } return false; } if(DivineAura()) {//cant attack while invulnerable - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); return false; } @@ -6068,19 +6068,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -6098,7 +6098,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(berserk && (GetClass() == BERSERKER)){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -6163,7 +6163,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b else damage = zone->random.Int(min_hit, max_hit); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); if(opts) { @@ -6175,7 +6175,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(other, skillinuse, Hand)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; other->AddToHateList(this, 0); } else { //we hit, try to avoid it @@ -6185,13 +6185,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b ApplyMeleeDamageBonus(skillinuse, damage); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); TryCriticalHit(other, skillinuse, damage, opts); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); // now add done damage to the hate list //other->AddToHateList(this, hate); } else other->AddToHateList(this, 0); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -6253,19 +6253,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //break invis when you attack if(invisible) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7335,7 +7335,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. @@ -7378,7 +7378,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { ProcChance += ProcChance*ProcBonus / 100.0f; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -7414,7 +7414,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && !other->BehindMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -7556,7 +7556,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -7609,14 +7609,14 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint16 levelreq = aabonuses.FinishingBlowLvl[0]; if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); return true; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -7624,7 +7624,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Bot::DoRiposte(Mob* defender) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -7637,7 +7637,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); } @@ -8207,7 +8207,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW //entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s has scored a leathal HEADSHOT!", GetName()); @@ -8215,7 +8215,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { Result = true; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); } } } @@ -8441,7 +8441,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { return; } - // Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); + // Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); @@ -8548,7 +8548,7 @@ int32 Bot::CalcMaxMana() { } default: { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -9076,7 +9076,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -9084,7 +9084,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -9105,7 +9105,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t //cannot cast under deivne aura if(DivineAura()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -9119,7 +9119,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -9127,7 +9127,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t } if (HasActiveSong()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client //_StopSong(); bardsong = 0; @@ -9256,7 +9256,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); return true; } } @@ -9266,13 +9266,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3) ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); return true; } } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); } } @@ -15454,7 +15454,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index cb2b2f4cd..0cf6d36a6 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -950,7 +950,7 @@ bool Bot::AI_PursueCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { @@ -1055,7 +1055,7 @@ bool Bot::AI_EngagedCastCheck() { BotStanceType botStance = GetBotStance(); bool mayGetAggro = HasOrMayGetAggro(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); if(botClass == CLERIC) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { diff --git a/zone/client.cpp b/zone/client.cpp index e10b1bb93..fe5c2758e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -340,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -438,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); break; }; } @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); - Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); + Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); } return true; } @@ -698,7 +698,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); @@ -1506,7 +1506,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); @@ -1911,7 +1911,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2105,7 +2105,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2145,7 +2145,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2235,13 +2235,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2262,10 +2262,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } @@ -2364,7 +2364,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } @@ -4544,14 +4544,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -5294,7 +5294,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5362,7 +5362,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5389,7 +5389,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5397,7 +5397,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6211,7 +6211,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6225,7 +6225,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8149,7 +8149,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); #endif } else @@ -8166,7 +8166,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); #endif } } @@ -8289,11 +8289,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 006529b66..aa12b2299 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; @@ -935,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -956,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1046,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 09bae443d..614b4257e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -401,7 +401,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) if(is_log_enabled(CLIENT__NET_IN_TRACE)) { char buffer[64]; app->build_header_dump(buffer); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); } EmuOpcode opcode = app->GetOpcode(); @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -460,7 +460,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); char buffer[64]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); if (Log.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) @@ -483,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); break; } @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1317,14 +1317,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1899,7 +1899,7 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -1908,7 +1908,7 @@ void Client::Handle_OP_AAAction(const EQApplicationPacket *app) AA_Action* action = (AA_Action*)app->pBuffer; if (action->action == aaActionActivate) {//AA Hotkey - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); ActivateAA((aaID)action->ability); } else if (action->action == aaActionBuy) { @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -2971,7 +2971,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (!IsPoison) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3572,7 +3572,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3635,8 +3635,8 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,16 +3721,16 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,14 +3859,14 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*)app->pBuffer; uint32 spid = sbf->spellid; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5136,7 +5136,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5311,7 +5311,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5363,7 +5363,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5445,7 +5445,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5536,7 +5536,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5591,7 +5591,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5832,7 +5832,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); SendGuildMOTD(true); @@ -5845,7 +5845,7 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); SendGuildList(); } @@ -5858,7 +5858,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5910,7 +5910,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5927,7 +5927,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -5943,7 +5943,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6058,7 +6058,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6125,7 +6125,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6135,7 +6135,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -6177,7 +6177,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6300,7 +6300,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6311,7 +6311,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6379,7 +6379,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6396,7 +6396,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6440,12 +6440,12 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6587,7 +6587,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6607,7 +6607,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6656,7 +6656,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6725,7 +6725,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6734,7 +6734,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6770,7 +6770,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6816,7 +6816,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6835,7 +6835,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6844,7 +6844,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -6864,7 +6864,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -6889,7 +6889,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7050,7 +7050,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7121,7 +7121,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } @@ -7192,7 +7192,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) @@ -7214,12 +7214,12 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); if (!guild_mgr.DeleteGuild(GuildID())) Message(0, "Guild delete failed."); else { @@ -7230,10 +7230,10 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); if (app->size != sizeof(GuildDemoteStruct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); return; } @@ -7263,7 +7263,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) uint8 rank = gci.rank - 1; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", demote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7281,7 +7281,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7322,7 +7322,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) //we could send this to the member and prompt them to see if they want to //be demoted (I guess), but I dont see a point in that. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7341,7 +7341,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7353,7 +7353,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); client->QueuePacket(app); } @@ -7376,7 +7376,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7386,7 +7386,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7409,7 +7409,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); SetPendingGuildInvitation(false); @@ -7445,7 +7445,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", gj->guildeqid, gj->response, gj->inviter, gj->newmember); //we dont really care a lot about what this packet means, as long as @@ -7459,7 +7459,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) if (gj->guildeqid == GuildID()) { //only need to change rank. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), gj->response, guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7471,7 +7471,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", GetName(), CharacterID(), guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid, gj->response); @@ -7500,10 +7500,10 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); if (app->size < 2) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); return; } @@ -7522,7 +7522,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) Client* newleader = entity_list.GetClientByName(gml->target); if (newleader) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID(), newleader->GetName(), newleader->CharacterID()); @@ -7543,9 +7543,9 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); if (app->size != sizeof(GuildManageBanker_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; } GuildManageBanker_Struct* gmb = (GuildManageBanker_Struct*)app->pBuffer; @@ -7620,16 +7620,16 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); if (app->size != sizeof(GuildPromoteStruct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); return; } @@ -7658,7 +7658,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", promote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7675,7 +7675,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7694,7 +7694,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", gpn->target, gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID(), gpn->note); @@ -7711,7 +7711,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7741,7 +7741,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = client->CharacterID(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7757,7 +7757,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = gci.char_id; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", gci.char_name.c_str(), gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7782,7 +7782,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7839,7 +7839,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7867,7 +7867,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); return; } @@ -7943,7 +7943,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -7972,7 +7972,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8002,7 +8002,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8057,7 +8057,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8071,7 +8071,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8108,7 +8108,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8223,7 +8223,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8421,7 +8421,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8449,7 +8449,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8492,7 +8492,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8530,7 +8530,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8603,7 +8603,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8646,7 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8787,7 +8787,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -8874,7 +8874,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9034,7 +9034,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9071,7 +9071,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9096,7 +9096,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9136,7 +9136,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); SendLogoutPackets(); @@ -9150,7 +9150,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9327,7 +9327,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9384,7 +9384,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9519,7 +9519,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9539,7 +9539,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9564,7 +9564,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9636,7 +9636,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9660,7 +9660,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9698,7 +9698,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9714,7 +9714,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9797,7 +9797,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9829,7 +9829,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9856,7 +9856,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9869,7 +9869,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10332,7 +10332,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10376,7 +10376,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10446,7 +10446,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10551,7 +10551,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10559,7 +10559,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10582,7 +10582,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10672,7 +10672,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10699,7 +10699,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -10720,7 +10720,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11305,7 +11305,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11334,7 +11334,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11350,7 +11350,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11364,7 +11364,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11378,14 +11378,14 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11437,7 +11437,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11446,7 +11446,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11506,7 +11506,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11669,7 +11669,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11697,7 +11697,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -11720,14 +11720,14 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11765,13 +11765,13 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11848,7 +11848,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild @@ -11866,7 +11866,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) GuildMOTD_Struct* gmotd = (GuildMOTD_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", guild_mgr.GetGuildName(GuildID()), GuildID(), GetName(), gmotd->motd); if (!guild_mgr.SetGuildMOTD(GuildID(), gmotd->motd, GetName())) { @@ -11884,7 +11884,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11918,7 +11918,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); return; } @@ -11969,7 +11969,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -11993,7 +11993,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12090,7 +12090,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12098,7 +12098,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12258,7 +12258,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12504,7 +12504,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12797,7 +12797,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12834,7 +12834,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -12924,7 +12924,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13149,7 +13149,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13202,7 +13202,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13216,7 +13216,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13369,7 +13369,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13417,7 +13417,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13426,7 +13426,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13512,10 +13512,10 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13524,8 +13524,8 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13550,11 +13550,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13563,7 +13563,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13599,7 +13599,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13628,7 +13628,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13642,7 +13642,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } @@ -13670,7 +13670,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13691,7 +13691,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13739,7 +13739,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13758,7 +13758,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13768,7 +13768,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13787,7 +13787,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13797,7 +13797,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13805,11 +13805,11 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13819,12 +13819,12 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); @@ -13836,7 +13836,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13876,7 +13876,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13927,7 +13927,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13939,7 +13939,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14162,7 +14162,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index c9a70d87b..834c4882d 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -799,7 +799,7 @@ void Client::OnDisconnect(bool hard_disconnect) { Mob *Other = trade->With(); if(Other) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) @@ -836,7 +836,7 @@ void Client::BulkSendInventoryItems() { if(inst) { bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -1037,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } @@ -1723,12 +1723,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; if(!CanHaveSkill(skill)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); return; } if(MaxSkill(skill) == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); return; } @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/command.cpp b/zone/command.cpp index 6408071b2..551da4d9e 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -443,13 +443,13 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -494,7 +494,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -568,12 +568,12 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif if(cur->function == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command @@ -1292,7 +1292,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1317,7 +1317,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1343,7 +1343,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1566,7 +1566,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1588,7 +1588,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1612,7 +1612,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -1954,7 +1954,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2274,7 +2274,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2299,7 +2299,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2319,7 +2319,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -3114,7 +3114,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3771,7 +3771,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4545,10 +4545,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4597,7 +4597,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4639,7 +4639,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4678,7 +4678,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4712,7 +4712,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4763,7 +4763,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) @@ -4869,7 +4869,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5221,7 +5221,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5278,7 +5278,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5325,7 +5325,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -7862,7 +7862,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { @@ -10394,7 +10394,7 @@ void command_logtest(Client *c, const Seperator *sep){ if (sep->IsNumber(1)){ uint32 i = 0; for (i = 0; i < atoi(sep->arg[1]); i++){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } } \ No newline at end of file diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a16f6f240..121feb2c1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -842,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -872,10 +872,10 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } @@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index 8ac166ddc..2d8e4daf6 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; @@ -303,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -560,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/effects.cpp b/zone/effects.cpp index 457d11d65..3c0b1ccfd 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index e015b14c8..4a9cb0716 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 7b823154a..88fa72121 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 7653b5cc4..b7ec2b6b2 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -140,12 +140,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -170,14 +170,14 @@ void Embperl::DoInit() { ,FALSE ); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); } try { @@ -195,7 +195,7 @@ void Embperl::DoInit() { } catch(const char *err) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 05c9d642e..8c35b7817 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. @@ -100,7 +100,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); len = 0; pos = i+1; } else { @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index 17bcf5e6c..068b91f3a 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/exp.cpp b/zone/exp.cpp index 074e86d2a..b0db67a40 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 3e0577212..cb007d574 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index beb92eb43..a0381f6a2 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index 1c95c44fc..9faf0d8b1 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1098,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1107,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1116,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 9f2bfe48b..6c4cdc4d2 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -144,10 +144,10 @@ void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if(GetClientVersion() >= EQClientRoF) { @@ -171,11 +171,11 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size); if(outapp->pBuffer == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -192,7 +192,7 @@ void Client::SendGuildMembers() { outapp->pBuffer = data; data = nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); @@ -223,7 +223,7 @@ void Client::RefreshGuildInfo() CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } @@ -335,7 +335,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->rank = gj->rank; outgj->zoneid = gj->zoneid; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); FastQueuePacket(&outapp); @@ -409,7 +409,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -429,7 +429,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index f8c7c9ffd..8a566cf43 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/horse.cpp b/zone/horse.cpp index 9926cbe8a..b5691ca00 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 6a43b7059..a2ccaaa58 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check to make sure we are augmenting an augmentable item else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -229,7 +229,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -269,7 +269,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -292,7 +292,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -559,7 +559,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; @@ -700,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. @@ -815,7 +815,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); if (client_update) { @@ -831,7 +831,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == MainCursor) return PushItemOnCursor(inst, client_update); @@ -858,7 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); m_inv.PutItem(slot_id, inst); SendLootItemInPacket(&inst, slot_id); @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); } @@ -1313,7 +1313,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1321,7 +1321,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1334,7 +1334,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->to_slot == (uint32)INVALID_INDEX) { if (move_in->from_slot == (uint32)MainCursor) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit ItemInst *inst = m_inv.GetItem(MainCursor); @@ -1348,7 +1348,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item destroyed by client } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); return true; // Item deletion @@ -1388,7 +1388,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ItemInst* src_inst = m_inv.GetItem(src_slot_id); ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) @@ -1398,7 +1398,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } if (dst_inst) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ @@ -1435,7 +1435,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { move_in->from_slot = dst_slot_check; move_in->to_slot = src_slot_check; move_in->number_in_stack = dst_inst->GetCharges(); - if(!SwapItem(move_in)) { Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } + if(!SwapItem(move_in)) { Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } } return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } @@ -1577,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } if (with) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor if (!m_inv[MainCursor]) { Message(13, "Error: Cursor item not located on server!"); @@ -1610,18 +1610,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->number_in_stack > 0) { // Determine if charged items can stack if(src_inst && !src_inst->IsStackable()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); return false; } if (dst_inst) { if(src_inst->GetID() != dst_inst->GetID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); return(false); } if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) { //we have a chance of stacking. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); // Charges can be emptied into dst uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges(); if (usedcharges > move_in->number_in_stack) @@ -1633,15 +1633,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Depleted all charges? if (src_inst->GetCharges() < 1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); all_to_stack = true; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); return false; } } @@ -1650,12 +1650,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) { // Move entire stack if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); } else { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); @@ -1680,7 +1680,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { SetMaterial(dst_slot_id,src_inst->GetItem()->ID); } if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) { if(src_inst) { @@ -1739,7 +1739,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { // resync the 'from' and 'to' slots on an as-needed basis // Not as effective as the full process, but less intrusive to gameplay -U - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { @@ -2071,7 +2071,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2080,7 +2080,7 @@ void Client::RemoveNoRent(bool client_update) { for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2089,7 +2089,7 @@ void Client::RemoveNoRent(bool client_update) { if (m_inv[MainPowerSource]) { const ItemInst* inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } @@ -2098,7 +2098,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2107,7 +2107,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } @@ -2116,7 +2116,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } @@ -2125,7 +2125,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } @@ -2134,7 +2134,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } @@ -2155,7 +2155,7 @@ void Client::RemoveNoRent(bool client_update) { inst = *iter; // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else m_inv.PushCursor(**iter); @@ -2178,7 +2178,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2193,7 +2193,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2208,7 +2208,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2223,7 +2223,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2238,7 +2238,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2253,7 +2253,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2281,7 +2281,7 @@ void Client::RemoveDuplicateLore(bool client_update) { inst = *iter; // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); iter = local.erase(iter); } @@ -2300,7 +2300,7 @@ void Client::RemoveDuplicateLore(bool client_update) { m_inv.PushCursor(**iter); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } safe_delete(*iter); @@ -2322,7 +2322,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2335,7 +2335,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s removing set", GetName(), bds->number); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,16 +2585,16 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2640,13 +2640,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); @@ -2865,8 +2865,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2881,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 316019486..ccff63bab 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index 2cfe647af..a9829677f 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -885,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -906,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1647,7 +1647,7 @@ void Merc::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -1766,7 +1766,7 @@ bool Merc::AI_EngagedCastCheck() { { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); int8 mercClass = GetClass(); @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/mob.cpp b/zone/mob.cpp index 873edfc58..6e33d79cd 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1576,7 +1576,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, entity_list.QueueClients(this, outapp); safe_delete(outapp); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } @@ -3043,7 +3043,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); } return; } @@ -4536,7 +4536,7 @@ void Mob::MeleeLifeTap(int32 damage) { if(lifetap_amt && damage > 0){ lifetap_amt = damage * lifetap_amt / 100; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 7634f14c8..ebd5f6182 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -1404,7 +1404,7 @@ void Mob::AI_Process() { else if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); if(!RuleB(Pathing, Aggro) || !zone->pathing) CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed()); else @@ -1639,7 +1639,7 @@ void NPC::AI_DoMovement() { roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) { @@ -1692,11 +1692,11 @@ void NPC::AI_DoMovement() { else { movetimercompleted=false; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); //if we were under quest control (with no grid), we are done now.. if(cur_wp == -2) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; } @@ -1727,7 +1727,7 @@ void NPC::AI_DoMovement() { { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) { // are we there yet? then stop - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1773,7 +1773,7 @@ void NPC::AI_DoMovement() { if (movetimercompleted==true) { // time to pause has ended SetGrid( 0 - GetGrid()); // revert to AI control - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1809,7 +1809,7 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); ClearFeignMemory(); moved=false; SetMoving(false); @@ -1934,7 +1934,7 @@ bool NPC::AI_EngagedCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); // try casting a heal or gate if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) { @@ -1957,7 +1957,7 @@ bool NPC::AI_PursueCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { //no spell cast, try again soon. AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false); diff --git a/zone/net.cpp b/zone/net.cpp index 0e869c225..4297641dc 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -148,28 +148,28 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } @@ -186,121 +186,121 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #endif const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(TaskSystem, EnableTaskSystem)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } @@ -317,11 +317,11 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -332,9 +332,9 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); @@ -365,13 +365,13 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() @@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 2351afafa..ea031a4ed 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/object.cpp b/zone/object.cpp index 34d85a33c..604234238 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 425ea9e34..c90e27b9b 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,19 +61,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,18 +103,18 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); return false; } fread(&Head, sizeof(Head), 1, PathFile); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return noderoute; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); return noderoute; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); return To; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index a60a5288a..881e94f66 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 373152c29..9e1025393 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,12 +254,12 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); #endif } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 690ae6434..cbb9cf2f2 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 068817178..d516d6fd1 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index d638f07d5..5ee380233 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 709984976..d3b0cfae8 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index e98c80209..98ecffa0f 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; @@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -195,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index a9c58cd5a..f801f7bc4 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -464,7 +464,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) break; } default: - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); return(1000); /* nice long delay for them, the caller depends on this! */ } @@ -683,7 +683,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -695,12 +695,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const ItemInst* Ammo = m_inv[MainAmmo]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(MainRange)); return; } if (!Ammo || !Ammo->IsType(ItemClassCommon)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(MainAmmo)); return; } @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const Item_Struct* AmmoItem = Ammo->GetItem(); if(RangeItem->ItemType != ItemTypeBow) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } if(AmmoItem->ItemType != ItemTypeArrow) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -746,7 +746,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Ammo = baginst; ammo_slot = m_inv.CalcSlotId(r, i); found = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); break; } } @@ -761,17 +761,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (aslot != INVALID_INDEX) { ammo_slot = aslot; Ammo = m_inv[aslot]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); } } } float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -799,9 +799,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); } CheckIncreaseSkill(SkillArchery, GetTarget(), -15); @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillArchery); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); @@ -882,7 +882,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); @@ -923,7 +923,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ @@ -944,7 +944,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); } } @@ -1192,7 +1192,7 @@ void NPC::RangedAttack(Mob* other) //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -1361,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -1371,19 +1371,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 const ItemInst* RangeWeapon = m_inv[MainRange]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(MainRange)); return; } const Item_Struct* item = RangeWeapon->GetItem(); if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(MainRange)); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1392,7 +1392,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //more in the ammo slot, use it RangeWeapon = AmmoItem; ammo_slot = MainAmmo; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal); @@ -1400,17 +1400,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //the item wont change, but the instance does, not that it matters ammo_slot = aslot; RangeWeapon = m_inv[aslot]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } } } float range = item->Range + GetRangeDistTargetSizeMod(other); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1489,7 +1489,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillThrowing); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; @@ -1497,7 +1497,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); int16 WDmg = 0; @@ -1533,7 +1533,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) other->AvoidDamage(this, TotalDmg, false); //CanRiposte=false - Can not riposte throw attacks. diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index ecffd1921..0f3770394 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -476,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -485,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -711,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) stun_resist += aabonuses.StunResist; if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -721,7 +721,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); } } break; @@ -1649,7 +1649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int mod = caster->GetInstrumentMod(spell_id); mod = ApplySpellEffectiveness(caster, spell_id, mod, true); effect_value = effect_value * mod / 10; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); } effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); @@ -3127,7 +3127,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3326,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); } } @@ -3351,7 +3351,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3383,18 +3383,18 @@ void Mob::BuffProcess() IsMezSpell(buffs[buffs_i].spellid) || IsBlindSpell(buffs[buffs_i].spellid)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } } else if (buffs[buffs_i].ticsremaining < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if(IsClient() && !(CastToClient()->GetClientVersionBit() & BIT_SoFAndLater)) @@ -3759,7 +3759,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index 0587d11ee..7d0718d34 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -147,7 +147,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -166,7 +166,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -204,7 +204,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, //cannot cast under divine aura if(DivineAura()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -234,7 +234,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -243,7 +243,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -349,7 +349,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -363,7 +363,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this @@ -375,7 +375,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -392,7 +392,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // we checked for spells not requiring targets above if(target_id == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, SPELL_NEED_TAR); @@ -430,7 +430,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, { mana_cost = 0; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, INSUFFICIENT_MANA); @@ -451,7 +451,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_resist_adjust = resist_adjust; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", spell_id, cast_time, orgcasttime, mana_cost); // cast time is 0, just finish it right now and be done with it @@ -517,7 +517,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -756,7 +756,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -816,7 +816,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); if(!spellid) return; @@ -893,7 +893,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -907,7 +907,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { Message_StringID(13, SPELL_RECAST); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -916,7 +916,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!IsValidSpell(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -927,7 +927,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(delaytimer) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); Message(13, "You are unable to focus."); InterruptSpell(); return; @@ -937,7 +937,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); Message_StringID(13,ALREADY_CASTING); InterruptSpell(); return; @@ -952,7 +952,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); } else { bardsong = spell_id; bardsong_slot = slot; @@ -962,7 +962,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, else bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1041,10 +1041,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; } @@ -1060,10 +1060,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, break; default: // some non-instrument component. Let it go, but record it in the log - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); if(c->GetGM()) c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1143,12 +1143,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, const Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1169,7 +1169,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (component == -1) continue; component_count = spells[spell_id].component_counts[t_count]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1234,7 +1234,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { Message_StringID(13, SPELL_RECAST); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -1253,15 +1253,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); Message(13, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1280,7 +1280,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); InterruptSpell(); return; } @@ -1309,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, this->CastToClient()->CheckSongSkillIncrease(spell_id); this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); } else { @@ -1344,7 +1344,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, delaytimer = true; spellend_timer.Start(400,true); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); } @@ -1391,7 +1391,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce && (IsGrouped() // still self only if not grouped || IsRaidGrouped()) && (HasProjectIllusion())){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); targetType = ST_GroupClientAndPet; } @@ -1474,7 +1474,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1487,7 +1487,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3)) { //invalid target - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1501,7 +1501,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1526,7 +1526,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); if(!spell_target) Message_StringID(13,SPELL_NEED_TAR); else @@ -1544,7 +1544,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1552,14 +1552,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1568,7 +1568,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1580,7 +1580,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1596,7 +1596,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); Message_StringID(13,NO_PET); return false; // can't cast these unless we have a target } @@ -1666,7 +1666,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1703,7 +1703,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1800,14 +1800,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } @@ -1878,7 +1878,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -1957,7 +1957,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) return(false); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -1968,7 +1968,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -1977,7 +1977,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); Message_StringID(13,CANT_SEE_TARGET); return false; } @@ -2008,13 +2008,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); Message_StringID(13, TARGET_TOO_CLOSE); return(false); } @@ -2043,7 +2043,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 #endif //BOTS if(spell_target == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2067,11 +2067,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsPlayerIllusionSpell(spell_id) && IsClient() && (HasProjectIllusion())){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); SetProjectIllusion(false); } else{ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); } break; } @@ -2235,7 +2235,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // CastSpell already reduced the cost for it if we're a client with focus if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2247,7 +2247,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF) { CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2263,7 +2263,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(reduction) recast -= reduction; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2301,7 +2301,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(slot == USE_ITEM_SPELL_SLOT) { //bard songs should never come from items... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); return(false); } @@ -2309,12 +2309,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2323,18 +2323,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); return(false); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); Message_StringID(13, CANT_SEE_TARGET); return(false); } @@ -2349,7 +2349,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { float range2 = range * range; if(dist2 > range2) { //target is out of range. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } @@ -2365,10 +2365,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case SingleTarget: { if(spell_target == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); return(false); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2386,7 +2386,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2394,9 +2394,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2406,13 +2406,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case GroupSpell: { if(spell_target->IsGrouped()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2429,7 +2429,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2455,13 +2455,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2559,7 +2559,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2601,7 +2601,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", spell_id, castlevel, formula, duration, res); return(res); @@ -2673,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } @@ -2695,15 +2695,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); // Same Spells and dot exemption is set to 1 or spell is Manaburn if (spellid1 == spellid2) { if (sp1.dot_stacking_exempt == 1 && caster1 != caster2) { // same caster can refresh - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); return -1; } else if (spellid1 == 2751) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); return -1; } } @@ -2735,7 +2735,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2804,16 +2804,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2827,22 +2827,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -2905,13 +2905,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -2923,7 +2923,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(sp_det_mismatch) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); continue; } @@ -2932,7 +2932,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -2958,7 +2958,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -2967,7 +2967,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -2976,15 +2976,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); return(1); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); return 0; } @@ -3043,11 +3043,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); return -2; // no duration? this isn't a buff } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3077,12 +3077,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite) @@ -3106,7 +3106,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3114,11 +3114,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); return -1; } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); return -1; } } @@ -3169,7 +3169,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3207,7 +3207,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) { int i, ret, firstfree = -2; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) @@ -3231,19 +3231,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) if(ret == 1) { // should overwrite current slot if(iFailIfOverwrite) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return(-1); } if(firstfree == -2) firstfree = i; } if(ret == -1) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); return firstfree; } @@ -3270,7 +3270,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); Message(13, "SOT: You must have a target for this spell."); return false; } @@ -3298,7 +3298,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r uint16 caster_level = GetCasterLevel(spell_id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3378,7 +3378,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3386,7 +3386,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3395,7 +3395,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3406,17 +3406,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3525,9 +3525,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3537,7 +3537,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); spelltar->Message_StringID(MT_SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3551,7 +3551,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3644,7 +3644,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ Message_StringID(MT_SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3692,7 +3692,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, isproc); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); if(aggro_amount > 0) spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; @@ -3709,7 +3709,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_type != 1) // AA is handled differently Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3825,14 +3825,14 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); return true; } void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -4005,7 +4005,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4016,7 +4016,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); caster->Message_StringID(MT_Shout, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4034,7 +4034,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); return true; } @@ -4043,7 +4043,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4059,7 +4059,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4070,13 +4070,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); caster->Message_StringID(MT_Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id); if (aggro > 0) { @@ -4090,7 +4090,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (IsClient() && CastToClient()->CheckAAEffect(aaEffectWarcry)) { Message(13, "Your are immune to fear."); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } @@ -4100,7 +4100,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); caster->Message_StringID(MT_Shout, CANNOT_CHARM); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4113,7 +4113,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); caster->Message(MT_Shout, "You cannot charm yourself."); return true; } @@ -4126,7 +4126,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); return true; } @@ -4140,7 +4140,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4156,7 +4156,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); return true; } @@ -4166,13 +4166,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); return true; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); return false; } @@ -4209,7 +4209,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); return(0); } @@ -4230,7 +4230,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; } } @@ -4248,7 +4248,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; } } @@ -4256,7 +4256,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); return 100; } @@ -4822,7 +4822,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4837,7 +4837,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > MAX_PP_MEMSPELL || slot < 0) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4870,7 +4870,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); if(update_client) { @@ -4883,7 +4883,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= MAX_PP_SPELLBOOK || slot < 0) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -4914,7 +4914,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) @@ -5089,23 +5089,23 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); } return false; } @@ -5116,7 +5116,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].spellID = SPELL_UNKNOWN; SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); } } return true; @@ -5133,7 +5133,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5148,7 +5148,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); } } return true; @@ -5165,7 +5165,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5180,7 +5180,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); } } return true; @@ -5211,7 +5211,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return(level); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 187c4a42f..56fd8f1e6 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -115,21 +115,21 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; taskActiveTasks[task].Updated) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,11 +358,11 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -459,14 +459,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,12 +634,12 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,16 +1275,16 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,24 +2932,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3088,12 +3088,12 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } NumberOfLists = results.RowCount(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/titles.cpp b/zone/titles.cpp index 38c344cc6..68ae958ae 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 572c02521..a83647a83 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,12 +1477,12 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if (results.RowCount() != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index d2873cc66..16c0d7e49 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -86,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -296,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -307,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -315,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -324,7 +324,7 @@ void Trade::DumpTrade() } } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -458,7 +458,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool qs_log = false; if(other) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); @@ -491,7 +491,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst && inst->IsType(ItemClassContainer)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -499,7 +499,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st inst->SetCharges(0); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); if (other->PutItemInInventory(partial_slot, *partial_inst, true)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges())); inst->SetCharges(old_charges); @@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -772,17 +772,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,12 +1534,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); @@ -1836,11 +1836,11 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/trap.cpp b/zone/trap.cpp index 3f0582c86..6efb00517 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index db3d7ce65..82b1bb4f7 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index a11de0bc8..f574802b6 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -88,7 +88,7 @@ void NPC::StopWandering() roamer=false; CastToNPC()->SetGrid(0); SendPosition(); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); return; } @@ -107,16 +107,16 @@ void NPC::ResumeWandering() cur_wp=save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); } else if (AIwalking_timer->Enabled()) { // we are at a waypoint paused normally - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); AIwalking_timer->Trigger(); // disable timer to end pause now } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -143,7 +143,7 @@ void NPC::PauseWandering(int pausetime) if (GetGrid() != 0) { DistractedFromGrid = true; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); SendPosition(); if (pausetime<1) { // negative grid number stops him dead in his tracks until ResumeWandering() @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -166,7 +166,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if (GetGrid() < 0) { // currently stopped by a quest command SetGrid( 0 - GetGrid()); // get him moving again - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); } AIwalking_timer->Disable(); // disable timer in case he is paused at a wp if (cur_wp>=0) @@ -174,14 +174,14 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); } if (saveguardspot) { @@ -196,7 +196,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if(guard_heading == -1) guard_heading = this->CalculateHeadingToTarget(mtx, mty); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } cur_wp_x = mtx; @@ -212,7 +212,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) void NPC::UpdateWaypoint(int wp_index) { if(wp_index >= static_cast(Waypoints.size())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); return; } std::vector::iterator cur; @@ -224,7 +224,7 @@ void NPC::UpdateWaypoint(int wp_index) cur_wp_z = cur->z; cur_wp_pause = cur->pause; cur_wp_heading = cur->heading; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) @@ -430,7 +430,7 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); guard_x = 0; guard_y = 0; guard_z = 0; @@ -443,14 +443,14 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } } void NPC::NextGuardPosition() { if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { SetHeading(guard_heading); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); } else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) { @@ -516,15 +516,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if(z_pos-z != 0) { z_pos = z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); @@ -550,7 +550,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); uint8 NPCFlyMode = 0; @@ -569,7 +569,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -612,7 +612,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -647,7 +647,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b z_pos = new_z; tar_ndx=22-numsteps; heading = CalculateHeadingToTarget(x, y); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } else { @@ -659,7 +659,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = y; z_pos = z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); } } @@ -678,7 +678,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; heading = CalculateHeadingToTarget(x, y); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } uint8 NPCFlyMode = 0; @@ -698,7 +698,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -759,7 +759,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec moved=false; } SetRunAnimSpeed(0); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); return true; } @@ -773,7 +773,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -790,7 +790,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = x; y_pos = y; z_pos = z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); } else { float new_x = x_pos + tar_vx*tar_vector; @@ -803,7 +803,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); } uint8 NPCFlyMode = 0; @@ -823,7 +823,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -951,7 +951,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) return; @@ -967,7 +967,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -998,7 +998,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 1d83cb10c..50dff0073 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,12 +155,12 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } case ServerOP_ZAAuthFailed: { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; @@ -386,12 +386,12 @@ void WorldServer::Process() { } } else { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); } } else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - Log.DebugCategory(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); @@ -1381,7 +1381,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } @@ -2061,7 +2061,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { diff --git a/zone/zone.cpp b/zone/zone.cpp index c901a65b9..f9276f8df 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -144,8 +144,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -167,11 +167,11 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -707,11 +707,11 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); @@ -725,19 +725,19 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); return; } Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -801,12 +801,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -899,56 +899,56 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); return false; } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,32 +1019,32 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); return true; } @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8a6393391..0f960d8c2 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -619,25 +619,25 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,12 +645,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 052849943..0c8e8de98 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -534,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -543,14 +543,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; SetHeading(heading); break; default: - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DebugCategory(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - Log.DebugCategory(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); + Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 37e4829ac4e00c1193e379e320aed00e88cb0454 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:55:16 -0800 Subject: [PATCH 1077/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 17e1b5de6..5f75fb81b 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1547,7 +1547,7 @@ void Mob::AI_Process() { if (!follow) SetFollowID(0); else { - float dist2 = DistNoRoot(*follow); + float dist2 = ComparativeDistance(m_Position, follow->GetPosition()); int followdist = GetFollowDistance(); if (dist2 >= followdist) // Default follow distance is 100 From c025765283fbdd1ff02484afc01de9969de2d553 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:00:15 -0600 Subject: [PATCH 1078/1883] Renamed DoLog to Out as the aggregate logging function for simplicity of use and shortened syntax of Log.Out --- client_files/export/main.cpp | 30 +-- client_files/import/main.cpp | 28 +- common/crash.cpp | 44 +-- common/database.cpp | 34 +-- common/eq_stream.cpp | 242 ++++++++--------- common/eq_stream_factory.cpp | 8 +- common/eq_stream_ident.cpp | 20 +- common/eqemu_logsys.cpp | 6 +- common/eqemu_logsys.h | 4 +- common/eqtime.cpp | 6 +- common/guild_base.cpp | 132 ++++----- common/item.cpp | 2 +- common/misc_functions.h | 2 +- common/patches/rof.cpp | 34 +-- common/patches/rof2.cpp | 34 +-- common/patches/sod.cpp | 22 +- common/patches/sof.cpp | 22 +- common/patches/ss_define.h | 8 +- common/patches/titanium.cpp | 22 +- common/patches/underfoot.cpp | 22 +- common/ptimer.cpp | 14 +- common/rulesys.cpp | 36 +-- common/shareddb.cpp | 106 ++++---- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 4 +- common/tcp_connection.cpp | 4 +- common/tcp_server.cpp | 4 +- common/timeoutmgr.cpp | 6 +- common/worldconn.cpp | 4 +- eqlaunch/eqlaunch.cpp | 18 +- eqlaunch/worldserver.cpp | 18 +- eqlaunch/zone_launch.cpp | 46 ++-- queryserv/database.cpp | 60 ++--- queryserv/lfguild.cpp | 14 +- queryserv/queryserv.cpp | 16 +- queryserv/worldserver.cpp | 6 +- shared_memory/main.cpp | 34 +-- ucs/chatchannel.cpp | 32 +-- ucs/clientlist.cpp | 78 +++--- ucs/database.cpp | 90 +++---- ucs/ucs.cpp | 26 +- ucs/worldserver.cpp | 8 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/client.cpp | 168 ++++++------ world/cliententry.cpp | 2 +- world/clientlist.cpp | 12 +- world/console.cpp | 24 +- world/eql_config.cpp | 22 +- world/eqw.cpp | 2 +- world/eqw_http_handler.cpp | 14 +- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 +- world/launcher_list.cpp | 10 +- world/login_server.cpp | 32 +-- world/login_server_list.cpp | 2 +- world/net.cpp | 116 ++++---- world/queryserv.cpp | 12 +- world/ucs.cpp | 12 +- world/wguild_mgr.cpp | 26 +- world/worlddb.cpp | 18 +- world/zonelist.cpp | 8 +- world/zoneserver.cpp | 88 +++--- zone/aa.cpp | 46 ++-- zone/aggro.cpp | 22 +- zone/attack.cpp | 174 ++++++------ zone/bonuses.cpp | 6 +- zone/bot.cpp | 114 ++++---- zone/botspellsai.cpp | 4 +- zone/client.cpp | 70 ++--- zone/client_mods.cpp | 12 +- zone/client_packet.cpp | 506 +++++++++++++++++------------------ zone/client_process.cpp | 24 +- zone/command.cpp | 60 ++--- zone/corpse.cpp | 8 +- zone/doors.cpp | 16 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 10 +- zone/embxs.cpp | 6 +- zone/entity.cpp | 14 +- zone/exp.cpp | 8 +- zone/fearpath.cpp | 4 +- zone/forage.cpp | 6 +- zone/groups.cpp | 36 +-- zone/guild.cpp | 20 +- zone/guild_mgr.cpp | 48 ++-- zone/horse.cpp | 6 +- zone/inventory.cpp | 154 +++++------ zone/loottables.cpp | 4 +- zone/merc.cpp | 16 +- zone/mob.cpp | 6 +- zone/mob_ai.cpp | 20 +- zone/net.cpp | 108 ++++---- zone/npc.cpp | 20 +- zone/object.cpp | 8 +- zone/pathing.cpp | 146 +++++----- zone/perl_client.cpp | 16 +- zone/petitions.cpp | 10 +- zone/pets.cpp | 16 +- zone/questmgr.cpp | 30 +-- zone/raids.cpp | 22 +- zone/spawn2.cpp | 152 +++++------ zone/spawngroup.cpp | 8 +- zone/special_attacks.cpp | 58 ++-- zone/spell_effects.cpp | 32 +-- zone/spells.cpp | 352 ++++++++++++------------ zone/tasks.cpp | 250 ++++++++--------- zone/titles.cpp | 12 +- zone/tradeskills.cpp | 82 +++--- zone/trading.cpp | 122 ++++----- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 108 ++++---- zone/worldserver.cpp | 42 +-- zone/zone.cpp | 148 +++++----- zone/zonedb.cpp | 124 ++++----- zone/zoning.cpp | 46 ++-- 119 files changed, 2653 insertions(+), 2653 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index feec1f440..2b3aa1e4e 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -38,22 +38,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -66,11 +66,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -140,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -169,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 285398ec8..e94eed0c9 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -36,22 +36,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -76,10 +76,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -142,23 +142,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -190,11 +190,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index 8b9b48339..283dba9c5 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -25,7 +25,7 @@ public: } } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index af21f2bd1..ff05ea6df 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); + //Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 99bff02f1..7d10917f4 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if (emu_op == OP_Unknown) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if(emu_op == OP_Unknown) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1111,7 +1111,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1141,33 +1141,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1178,10 +1178,10 @@ Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked pa SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } @@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } @@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index ce09e380e..114b61c68 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index adba3dddf..9ec7f2c92 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -109,7 +109,7 @@ void EQStreamIdentifier::Process() { case EQStream::MatchSuccessful: { //yay, a match. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index c2559a233..e61ea8a1b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -91,7 +91,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings_loaded = true; } -std::string EQEmuLogSys::FormatDoLogMessageString(uint16 log_category, std::string in_message){ +std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ std::string category_string = ""; if (log_category > 0 && LogCategoryName[log_category]){ category_string = StringFormat("[%s] ", LogCategoryName[log_category]); @@ -162,14 +162,14 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m #endif } -void EQEmuLogSys::DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...) +void EQEmuLogSys::Out(DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - std::string output_debug_message = EQEmuLogSys::FormatDoLogMessageString(log_category, output_message); + std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 23e737720..3370e704f 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -82,7 +82,7 @@ public: void CloseFileLogs(); void LoadLogSettingsDefaults(); - void DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...); + void Out(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); @@ -103,7 +103,7 @@ private: bool zone_general_init = false; std::function on_log_gmsay_hook; - std::string FormatDoLogMessageString(uint16 log_category, std::string in_message); + std::string FormatOutMessageString(uint16 log_category, std::string in_message); void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 6d6ab3fb8..a047029df 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index acb275e55..fb742d487 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -337,18 +337,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); return index; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/common/item.cpp b/common/item.cpp index 60ddab14c..42885fe5a 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/misc_functions.h b/common/misc_functions.h index 53ede739a..2fd5b2126 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index bf0ec395b..a56e9a82d 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -52,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -316,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -551,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -585,7 +585,7 @@ namespace RoF safe_delete_array(Serialized); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1386,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2556,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3321,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3654,7 +3654,7 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3902,7 +3902,7 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4498,7 +4498,7 @@ namespace RoF SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5455,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5496,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5601,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5636,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4ed34e193..4fba21144 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -52,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF2 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -382,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -617,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -651,7 +651,7 @@ namespace RoF2 safe_delete_array(Serialized); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1452,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2640,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3387,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3721,7 +3721,7 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3973,7 +3973,7 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); @@ -4569,7 +4569,7 @@ namespace RoF2 SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -5546,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5587,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5696,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5731,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 750cac18b..4881750d1 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -50,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoD - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -247,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -359,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -391,7 +391,7 @@ namespace SoD } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -967,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2108,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2363,7 +2363,7 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3091,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 4b215813e..464c40cb3 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -50,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoF - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -214,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -337,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -371,7 +371,7 @@ namespace SoF } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -766,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1707,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1887,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2429,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index f96720713..308e56191 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index c46cba392..11adc498d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -48,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -74,7 +74,7 @@ namespace Titanium - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -89,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -187,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -268,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -285,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -635,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1157,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1274,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1623,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index faa19af67..2d8feba20 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -50,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace Underfoot - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -307,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -494,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -526,7 +526,7 @@ namespace Underfoot safe_delete_array(Serialized); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -1190,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2374,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2624,7 +2624,7 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -3406,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); diff --git a/common/ptimer.cpp b/common/ptimer.cpp index c9fe7f4f6..d5b31e317 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index ef8e0fa4d..e3eac0611 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -282,13 +282,13 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 924e4cfe5..64b94657c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/spdat.cpp b/common/spdat.cpp index a628c8fa7..a6b17e449 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index eb8244d04..6e1eb038a 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 9bf1de258..924fef2f2 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index 8fdf64dd7..b85e78ae5 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 92bf6e32e..3bd4c9942 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index 1947ec0e8..33fc2f7d3 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -76,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 47ccbf6a9..4c2f3fdd9 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index a63ac1022..799cbd4ee 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -74,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -90,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -101,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -111,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -127,7 +127,7 @@ void WorldServer::Process() { } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 2e40a94d1..d9e92b8cd 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -72,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -84,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -102,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -164,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -187,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -197,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 292fb7bf2..5041eb410 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index e2ef1dd6c..e802f493f 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -242,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -257,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -288,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -305,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -335,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -348,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 76dfc7b5a..79003a2bd 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -65,16 +65,16 @@ int main() { */ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -83,22 +83,22 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index f4aca7f06..1e6013696 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -53,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -148,7 +148,7 @@ void WorldServer::Process() break; } default: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 38c4640b5..8fbd296e7 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -40,22 +40,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -114,61 +114,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index c1d797f26..0ee80510f 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -42,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -149,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -170,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -228,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -237,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -262,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -299,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -397,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -479,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -555,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -572,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -587,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -613,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -628,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -654,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -669,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 0ad2b6157..4aaa4c748 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -236,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -305,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -400,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -430,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -481,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -560,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -586,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -606,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -646,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -667,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -703,7 +703,7 @@ void Clientlist::Process() { default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -716,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -860,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -885,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -896,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -905,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -971,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1012,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1113,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1292,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1435,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1647,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1702,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1790,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1918,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1999,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2087,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2196,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); } } } @@ -2299,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2377,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index 0c1bdee65..ee09dc7c2 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 22f285f25..c51d1e0dd 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -104,22 +104,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index dc327cb48..2d05d753d 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -52,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -67,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -88,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -99,7 +99,7 @@ void WorldServer::Process() if(!c) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); break; } diff --git a/world/adventure.cpp b/world/adventure.cpp index 14a7a141b..fa41e3c09 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 3fbcf96bb..9c65620bf 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/client.cpp b/world/client.cpp index 268c0153c..2b3b8dde2 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -136,7 +136,7 @@ void Client::SendEnterWorld(std::string name) eqs->Close(); return; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); } } @@ -378,7 +378,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if (strlen(password) <= 1) { // TODO: Find out how to tell the client wrong username/password - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); return false; } @@ -408,31 +408,31 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password))) #else if (loginserverlist.Connected() == false && !pZoning) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); return false; } if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); return false; } cle->SetOnline(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); if(minilogin){ WorldConfig::DisableStats(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); } const WorldConfig *Config=WorldConfig::get(); @@ -465,7 +465,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else { // TODO: Find out how to tell the client wrong username/password - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); return false; } @@ -479,7 +479,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); return false; } @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -648,11 +648,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); return false; } else if (app->size != sizeof(CharCreate_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); DumpPacket(app); // the previous behavior was essentially returning true here // but that seems a bit odd to me. @@ -679,14 +679,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); eqs->Close(); return true; } if(GetAdmin() < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); eqs->Close(); return true; } @@ -702,14 +702,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { uint32 tmpaccid = 0; charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID); if (charid == 0 || tmpaccid != GetAccountID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); eqs->Close(); return true; } // Make sure this account owns this character if (tmpaccid != GetAccountID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); eqs->Close(); return true; } @@ -737,7 +737,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { zoneID = database.MoveCharacterToBind(charid,4); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go home before they're able...",char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -770,7 +770,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -780,7 +780,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (zoneID == 0 || !database.GetZoneName(zoneID)) { // This is to save people in an invalid zone, once it's removed from the DB database.MoveCharacterToZone(charid, "arena"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); } if(instanceID > 0) @@ -894,7 +894,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer); if(char_acct_id == GetAccountID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); database.DeleteCharacter((char *)app->pBuffer); SendCharInfo(); } @@ -915,25 +915,25 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); return false; } // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); eqs->Close(); } } if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) { // Got a packet other than OP_SendLoginInfo when not logged in - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); return false; } else if (opcode == OP_AckPacket) { @@ -1005,7 +1005,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); _pkt(WORLD__CLIENT_ERR,app); return true; } @@ -1024,7 +1024,7 @@ bool Client::Process() { to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); ZoneUnavail(); } if(connect.Check()){ @@ -1058,7 +1058,7 @@ bool Client::Process() { loginserverlist.SendPacket(pack); safe_delete(pack); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); return false; } @@ -1107,17 +1107,17 @@ void Client::EnterWorld(bool TryBootup) { } else { if (TryBootup) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); autobootup_timeout.Start(); pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID); if (pwaitingforbootup == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); ZoneUnavail(); } return; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); ZoneUnavail(); return; } @@ -1126,12 +1126,12 @@ void Client::EnterWorld(bool TryBootup) { cle->SetChar(charid, char_name); database.UpdateLiveChar(char_name, GetAccountID()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); // database.SetAuthentication(account_id, char_name, zone_name, ip); if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,9 +1169,9 @@ void Client::Clearance(int8 response) { if (zs == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); } ZoneUnavail(); @@ -1181,20 +1181,20 @@ void Client::Clearance(int8 response) EQApplicationPacket* outapp; if (zs->GetCAddress() == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); ZoneUnavail(); return; } if (zoneID == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } const char* zonename = database.GetZoneName(zoneID); if (zonename == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } @@ -1225,7 +1225,7 @@ void Client::Clearance(int8 response) } strcpy(zsi->ip, zs_addr); zsi->port =zs->GetCPort(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); QueuePacket(outapp); safe_delete(outapp); @@ -1256,7 +1256,7 @@ bool Client::GenPassKey(char* key) { } void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P @@ -1355,27 +1355,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); /* Validate the char creation struct */ if (ClientVersionBit & BIT_SoFAndLater) { if (!CheckCharCreateInfoSoF(cc)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { if (!CheckCharCreateInfoTitanium(cc)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } @@ -1437,21 +1437,21 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); pp.zone_id = RuleI(World, SoFStartZoneID); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); } else { /* if there's a startzone variable put them in there */ if (database.GetVariable("startzone", startzone, 50)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; if (ClientVersionBit & BIT_TitaniumAndEarlier) @@ -1490,11 +1490,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ @@ -1503,10 +1503,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // now we give the pp and the inv we made to StoreCharacter // to see if we can store it if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); return false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); return true; } @@ -1516,7 +1516,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1533,7 +1533,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1550,7 +1550,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1563,37 +1563,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); return false; } @@ -1606,7 +1606,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1687,7 +1687,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1700,16 +1700,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1737,43 +1737,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index ceb147fa3..976ab113c 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index c3cbc7a7c..6ab4f9d78 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index 6b51deb34..bb15f724b 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eql_config.cpp b/world/eql_config.cpp index c2088b56d..13f095575 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/eqw.cpp b/world/eqw.cpp index 2cc6262df..0137bfe8e 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index fbe6ea000..c1afc41e8 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 4c80ac7e7..f0970b1fe 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 300d94b3f..6ac7c6326 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 4b2af8169..0e258d78c 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index 688a50a4b..84a4b4ebb 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index 305c79b23..bcdd67aa3 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index 1d96c6d54..89544cca6 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); database.LoadVariables(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); database.LoadZoneNames(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); database.ClearGroup(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); if (!database.LoadItems()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/queryserv.cpp b/world/queryserv.cpp index d15f7d48a..3291933e8 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -23,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -57,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -69,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -79,7 +79,7 @@ bool QueryServConnection::Process() } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -97,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -114,7 +114,7 @@ bool QueryServConnection::Process() } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index 22a1ecdf6..178a97c1a 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -18,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -52,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -64,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -74,7 +74,7 @@ bool UCSConnection::Process() } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -92,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index e0621ef8d..a6ff8947b 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -34,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 6ec2df6a6..311ade1e7 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 38485fb59..3045e4c6e 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 3d4376aeb..bf46627d4 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -77,7 +77,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { char* longname; if (iZoneID) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; @@ -188,7 +188,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -199,7 +199,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -541,10 +541,10 @@ bool ZoneServer::Process() { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } @@ -589,10 +589,10 @@ bool ZoneServer::Process() { ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } @@ -602,7 +602,7 @@ bool ZoneServer::Process() { const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { @@ -685,12 +685,12 @@ bool ZoneServer::Process() { if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); /* This is a request from the egress zone */ if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) { ztz->response = 0; @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } @@ -736,7 +736,7 @@ bool ZoneServer::Process() { /* Response from Ingress server, route back to egress */ else{ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = nullptr; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); @@ -754,7 +754,7 @@ bool ZoneServer::Process() { } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); @@ -763,7 +763,7 @@ bool ZoneServer::Process() { case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); @@ -868,7 +868,7 @@ bool ZoneServer::Process() { } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; @@ -888,7 +888,7 @@ bool ZoneServer::Process() { } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; @@ -913,7 +913,7 @@ bool ZoneServer::Process() { } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; @@ -924,7 +924,7 @@ bool ZoneServer::Process() { } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; @@ -943,7 +943,7 @@ bool ZoneServer::Process() { break; } case ServerOP_GetWorldTime: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; @@ -958,17 +958,17 @@ bool ZoneServer::Process() { break; } case ServerOP_SetWorldTime: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; @@ -980,7 +980,7 @@ bool ZoneServer::Process() { } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; @@ -1025,10 +1025,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; @@ -1047,10 +1047,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else @@ -1067,10 +1067,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } @@ -1079,10 +1079,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { @@ -1098,10 +1098,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } @@ -1119,10 +1119,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1138,10 +1138,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else @@ -1149,10 +1149,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1254,7 +1254,7 @@ bool ZoneServer::Process() { case ServerOP_LSAccountUpdate: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } @@ -1309,7 +1309,7 @@ bool ZoneServer::Process() { } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/zone/aa.cpp b/zone/aa.cpp index 207f944b4..54d2831c3 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -951,7 +951,7 @@ void Client::SendAAStats() { void Client::BuyAA(AA_Action* action) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); //find the AA information from the database SendAA_Struct* aa2 = zone->FindAA(action->ability); @@ -963,7 +963,7 @@ void Client::BuyAA(AA_Action* action) a = action->ability - i; if(a <= 0) break; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); aa2 = zone->FindAA(a); if(aa2 != nullptr) break; @@ -980,7 +980,7 @@ void Client::BuyAA(AA_Action* action) uint32 cur_level = GetAA(aa2->id); if((aa2->id + cur_level) != action->ability) { //got invalid AA - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); return; } @@ -1011,7 +1011,7 @@ void Client::BuyAA(AA_Action* action) if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); m_pp.aapoints -= real_cost; @@ -1429,10 +1429,10 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1447,11 +1447,11 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index cbd051e1a..678cbd3a8 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,17 +342,17 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); return(false); } @@ -466,7 +466,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -693,7 +693,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -833,7 +833,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -945,7 +945,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 81862872e..5610a5f8f 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -57,7 +57,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); switch (item->ItemType) { @@ -187,7 +187,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; if(IsClient() && other->IsClient()) @@ -208,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -236,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -308,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -327,7 +327,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); // @@ -336,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } @@ -370,7 +370,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && other->InFrontMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -517,7 +517,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -690,9 +690,9 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); } } @@ -1128,14 +1128,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } if(!GetTarget()) SetTarget(other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); //SetAttackTimer(); if ( @@ -1145,12 +1145,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b || (GetHP() < 0) || (!IsAttackAllowed(other)) ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); return false; // Only bards can attack while casting } if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable! return false; } @@ -1170,19 +1170,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -1200,7 +1200,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(IsBerserk() && GetClass() == BERSERKER){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -1268,7 +1268,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); int hit_chance_bonus = 0; @@ -1283,7 +1283,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it other->AvoidDamage(this, damage); @@ -1291,7 +1291,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -1430,7 +1430,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } int exploss = 0; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); /* #1: Send death packet to everyone @@ -1692,7 +1692,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -1710,7 +1710,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (other->IsClient()) other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); } return false; } @@ -1737,10 +1737,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); if(Hand == MainSecondary && weapon->ItemType == ItemTypeShield){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); return false; } @@ -1829,11 +1829,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } @@ -1846,7 +1846,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if(other->IsClient() && other->CastToClient()->IsSitting()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); damage = (max_dmg+eleBane); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); @@ -1857,7 +1857,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool hate += opts->hate_flat; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list other->AddToHateList(this, hate); @@ -1881,7 +1881,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(damage > 0) { CommonOutgoingHitSuccess(other, damage, skillinuse); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list if(damage > 0) other->AddToHateList(this, hate); @@ -1890,7 +1890,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); if(other->IsClient() && IsPet() && GetOwner()->IsClient()) { //pets do half damage to clients in pvp @@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //cant riposte a riposte if (bRiposte && damage == -3) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); return false; } @@ -1954,7 +1954,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -1991,7 +1991,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); Mob *oos = nullptr; if(killerMob) { @@ -2028,7 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); @@ -2580,7 +2580,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(DS == 0 && rev_ds == 0) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); //invert DS... spells yield negative values for a true damage shield if(DS < 0) { @@ -2625,7 +2625,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID; if(rev_ds < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } @@ -3137,7 +3137,7 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce >= buffs[slot].melee_rune) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3145,7 +3145,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3164,7 +3164,7 @@ int32 Mob::ReduceDamage(int32 damage) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3172,7 +3172,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) @@ -3290,7 +3290,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if(!TryFadeEffect(slot)) @@ -3298,7 +3298,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) @@ -3437,11 +3437,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == SkillAbjuration); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); if (GetInvul() || DivineAura()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } @@ -3493,7 +3493,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int healed = damage; healed = attacker->GetActSpellHealing(spell_id, healed); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); attacker->HealDamage(healed); //we used to do a message to the client, but its gone now. @@ -3506,7 +3506,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse()) { if (!pet->IsHeld()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); pet->AddToHateList(attacker, 1); pet->SetTarget(attacker); Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName()); @@ -3516,7 +3516,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if any runes want to reduce this damage if(spell_id == SPELL_UNKNOWN) { damage = ReduceDamage(damage); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); damage = ReduceAllDamage(damage); TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker); } else { @@ -3573,7 +3573,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //fade mez if we are mezzed if (IsMezzed() && attacker) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); @@ -3616,7 +3616,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); if (IsClient()) { stun_resist += aabonuses.StunResist; frontal_stun_resist += aabonuses.FrontalStunResist; @@ -3626,20 +3626,20 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (((GetBaseRace() == OGRE && IsClient()) || (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); } } @@ -3653,7 +3653,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //increment chances of interrupting if(IsCasting()) { //shouldnt interrupt on regular spell damage attacked_count++; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); } } @@ -3859,7 +3859,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) ProcChance += ProcChance * ProcBonus / 100.0f; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3878,7 +3878,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; ProcChance = ProcChance + (ProcChance * ProcBonus); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3887,7 +3887,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3918,17 +3918,17 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } if (!IsAttackAllowed(on)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); return; } if (DivineAura()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); return; } @@ -3975,7 +3975,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level); if (IsPet()) { @@ -3986,7 +3986,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on Message_StringID(13, PROC_TOOLOW); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100); ExecWeaponProc(inst, weapon->Proc.Effect, on); @@ -4065,12 +4065,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); ExecWeaponProc(nullptr, PermaProcs[i].spellID, on); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); } @@ -4080,13 +4080,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell proc %d failed to proc %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); } @@ -4096,13 +4096,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged proc %d failed to proc %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); } @@ -4352,7 +4352,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Mob::DoRiposte(Mob* defender) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -4370,7 +4370,7 @@ void Mob::DoRiposte(Mob* defender) { //Live AA - Double Riposte if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; } @@ -4381,7 +4381,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); @@ -4398,7 +4398,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ int dmgbonusmod = 0; dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3; dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); damage += (damage*dmgbonusmod/10000); } } @@ -4467,7 +4467,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } @@ -4692,13 +4692,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); return true; } } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); return false; } @@ -4770,19 +4770,19 @@ void Mob::CommonBreakInvisible() { //break invis when you attack if(invisible) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 4806c2241..a9d077bcf 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -634,7 +634,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index ed9b9e1f3..7d77d8bc3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); return; } @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); } @@ -2979,7 +2979,7 @@ void Bot::BotRangedAttack(Mob* other) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -2997,7 +2997,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!RangeWeapon || !Ammo) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); if(!IsAttackAllowed(other) || IsCasting() || @@ -3015,19 +3015,19 @@ void Bot::BotRangedAttack(Mob* other) { //break invis when you attack if(invisible) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -3362,7 +3362,7 @@ void Bot::AI_Process() { else if(!IsRooted()) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); return; @@ -3689,7 +3689,7 @@ void Bot::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -3972,7 +3972,7 @@ void Bot::PetAIProcess() { { botPet->SetRunAnimSpeed(0); if(!botPet->IsRooted()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed()); return; } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -5959,7 +5959,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); parse->EventNPC(EVENT_ATTACK, this, from, "", 0); } @@ -5972,7 +5972,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ // if spell is lifetap add hp to the caster if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { int healed = GetActSpellHealing(spell_id, damage); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); HealDamage(healed); entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() ); } @@ -6017,14 +6017,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } if(!GetTarget() || GetTarget() != other) SetTarget(other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || @@ -6036,13 +6036,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); if(other) { RemoveFromHateList(other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); } return false; } if(DivineAura()) {//cant attack while invulnerable - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); return false; } @@ -6068,19 +6068,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -6098,7 +6098,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(berserk && (GetClass() == BERSERKER)){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -6163,7 +6163,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b else damage = zone->random.Int(min_hit, max_hit); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); if(opts) { @@ -6175,7 +6175,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(other, skillinuse, Hand)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); damage = 0; other->AddToHateList(this, 0); } else { //we hit, try to avoid it @@ -6185,13 +6185,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b ApplyMeleeDamageBonus(skillinuse, damage); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); TryCriticalHit(other, skillinuse, damage, opts); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); // now add done damage to the hate list //other->AddToHateList(this, hate); } else other->AddToHateList(this, 0); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -6253,19 +6253,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //break invis when you attack if(invisible) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7335,7 +7335,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. @@ -7378,7 +7378,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { ProcChance += ProcChance*ProcBonus / 100.0f; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -7414,7 +7414,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && !other->BehindMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -7556,7 +7556,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -7609,14 +7609,14 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint16 levelreq = aabonuses.FinishingBlowLvl[0]; if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); return true; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -7624,7 +7624,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Bot::DoRiposte(Mob* defender) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); if (!defender) return; @@ -7637,7 +7637,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); } @@ -8207,7 +8207,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW //entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s has scored a leathal HEADSHOT!", GetName()); @@ -8215,7 +8215,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { Result = true; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); } } } @@ -8441,7 +8441,7 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { return; } - // Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); + // Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); @@ -8548,7 +8548,7 @@ int32 Bot::CalcMaxMana() { } default: { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -9076,7 +9076,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -9084,7 +9084,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -9105,7 +9105,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t //cannot cast under deivne aura if(DivineAura()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -9119,7 +9119,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -9127,7 +9127,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t } if (HasActiveSong()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client //_StopSong(); bardsong = 0; @@ -9256,7 +9256,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); return true; } } @@ -9266,13 +9266,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3) ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); return true; } } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); } } @@ -15454,7 +15454,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 0cf6d36a6..8f8e977a2 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -950,7 +950,7 @@ bool Bot::AI_PursueCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { @@ -1055,7 +1055,7 @@ bool Bot::AI_EngagedCastCheck() { BotStanceType botStance = GetBotStance(); bool mayGetAggro = HasOrMayGetAggro(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); if(botClass == CLERIC) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { diff --git a/zone/client.cpp b/zone/client.cpp index fe5c2758e..8bf63010e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -340,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -438,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); break; }; } @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); - Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); + Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); } return true; } @@ -698,7 +698,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); @@ -1506,7 +1506,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); @@ -1911,7 +1911,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2105,7 +2105,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2145,7 +2145,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2235,13 +2235,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2262,10 +2262,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } @@ -2364,7 +2364,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } @@ -4544,14 +4544,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -5294,7 +5294,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5362,7 +5362,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5389,7 +5389,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5397,7 +5397,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6211,7 +6211,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6225,7 +6225,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8149,7 +8149,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); #endif } else @@ -8166,7 +8166,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); #endif } } @@ -8289,11 +8289,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index aa12b2299..ff7c44010 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; @@ -935,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -956,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1046,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 614b4257e..188ada287 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -401,7 +401,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) if(is_log_enabled(CLIENT__NET_IN_TRACE)) { char buffer[64]; app->build_header_dump(buffer); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); } EmuOpcode opcode = app->GetOpcode(); @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -460,7 +460,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); char buffer[64]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); if (Log.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) @@ -483,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); break; } @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1317,14 +1317,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1899,7 +1899,7 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -1908,7 +1908,7 @@ void Client::Handle_OP_AAAction(const EQApplicationPacket *app) AA_Action* action = (AA_Action*)app->pBuffer; if (action->action == aaActionActivate) {//AA Hotkey - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); ActivateAA((aaID)action->ability); } else if (action->action == aaActionBuy) { @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -2971,7 +2971,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (!IsPoison) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3572,7 +3572,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3635,8 +3635,8 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,16 +3721,16 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,14 +3859,14 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*)app->pBuffer; uint32 spid = sbf->spellid; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5136,7 +5136,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5311,7 +5311,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5363,7 +5363,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5445,7 +5445,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5536,7 +5536,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5591,7 +5591,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5832,7 +5832,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); SendGuildMOTD(true); @@ -5845,7 +5845,7 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); SendGuildList(); } @@ -5858,7 +5858,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5910,7 +5910,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5927,7 +5927,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -5943,7 +5943,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6058,7 +6058,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6125,7 +6125,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6135,7 +6135,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -6177,7 +6177,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6300,7 +6300,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6311,7 +6311,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6379,7 +6379,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6396,7 +6396,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6440,12 +6440,12 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6587,7 +6587,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6607,7 +6607,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6656,7 +6656,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6725,7 +6725,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6734,7 +6734,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6770,7 +6770,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6816,7 +6816,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6835,7 +6835,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6844,7 +6844,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -6864,7 +6864,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -6889,7 +6889,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7050,7 +7050,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7121,7 +7121,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } @@ -7192,7 +7192,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) @@ -7214,12 +7214,12 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); if (!guild_mgr.DeleteGuild(GuildID())) Message(0, "Guild delete failed."); else { @@ -7230,10 +7230,10 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); if (app->size != sizeof(GuildDemoteStruct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); return; } @@ -7263,7 +7263,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) uint8 rank = gci.rank - 1; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", demote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7281,7 +7281,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7322,7 +7322,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) //we could send this to the member and prompt them to see if they want to //be demoted (I guess), but I dont see a point in that. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7341,7 +7341,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7353,7 +7353,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); client->QueuePacket(app); } @@ -7376,7 +7376,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7386,7 +7386,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7409,7 +7409,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); SetPendingGuildInvitation(false); @@ -7445,7 +7445,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", gj->guildeqid, gj->response, gj->inviter, gj->newmember); //we dont really care a lot about what this packet means, as long as @@ -7459,7 +7459,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) if (gj->guildeqid == GuildID()) { //only need to change rank. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), gj->response, guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7471,7 +7471,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", GetName(), CharacterID(), guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid, gj->response); @@ -7500,10 +7500,10 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); if (app->size < 2) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); return; } @@ -7522,7 +7522,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) Client* newleader = entity_list.GetClientByName(gml->target); if (newleader) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID(), newleader->GetName(), newleader->CharacterID()); @@ -7543,9 +7543,9 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); if (app->size != sizeof(GuildManageBanker_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; } GuildManageBanker_Struct* gmb = (GuildManageBanker_Struct*)app->pBuffer; @@ -7620,16 +7620,16 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); if (app->size != sizeof(GuildPromoteStruct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); return; } @@ -7658,7 +7658,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", promote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7675,7 +7675,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7694,7 +7694,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", gpn->target, gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID(), gpn->note); @@ -7711,7 +7711,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7741,7 +7741,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = client->CharacterID(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7757,7 +7757,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = gci.char_id; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", gci.char_name.c_str(), gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7782,7 +7782,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7839,7 +7839,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7867,7 +7867,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); return; } @@ -7943,7 +7943,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -7972,7 +7972,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8002,7 +8002,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8057,7 +8057,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8071,7 +8071,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8108,7 +8108,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8223,7 +8223,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8421,7 +8421,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8449,7 +8449,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8492,7 +8492,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8530,7 +8530,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8603,7 +8603,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8646,7 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8787,7 +8787,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -8874,7 +8874,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9034,7 +9034,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9071,7 +9071,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9096,7 +9096,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9136,7 +9136,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); SendLogoutPackets(); @@ -9150,7 +9150,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9327,7 +9327,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9384,7 +9384,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9519,7 +9519,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9539,7 +9539,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9564,7 +9564,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9636,7 +9636,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9660,7 +9660,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9698,7 +9698,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9714,7 +9714,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9797,7 +9797,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9829,7 +9829,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9856,7 +9856,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9869,7 +9869,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10332,7 +10332,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10376,7 +10376,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10446,7 +10446,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10551,7 +10551,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10559,7 +10559,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10582,7 +10582,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10672,7 +10672,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10699,7 +10699,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -10720,7 +10720,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11305,7 +11305,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11334,7 +11334,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11350,7 +11350,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11364,7 +11364,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11378,14 +11378,14 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11437,7 +11437,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11446,7 +11446,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11506,7 +11506,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11669,7 +11669,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11697,7 +11697,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -11720,14 +11720,14 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11765,13 +11765,13 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11848,7 +11848,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild @@ -11866,7 +11866,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) GuildMOTD_Struct* gmotd = (GuildMOTD_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", guild_mgr.GetGuildName(GuildID()), GuildID(), GetName(), gmotd->motd); if (!guild_mgr.SetGuildMOTD(GuildID(), gmotd->motd, GetName())) { @@ -11884,7 +11884,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11918,7 +11918,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); return; } @@ -11969,7 +11969,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -11993,7 +11993,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12090,7 +12090,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12098,7 +12098,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12258,7 +12258,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12504,7 +12504,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12797,7 +12797,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12834,7 +12834,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -12924,7 +12924,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13149,7 +13149,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13202,7 +13202,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13216,7 +13216,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13369,7 +13369,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13417,7 +13417,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13426,7 +13426,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13512,10 +13512,10 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13524,8 +13524,8 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13550,11 +13550,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13563,7 +13563,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13599,7 +13599,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13628,7 +13628,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13642,7 +13642,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } @@ -13670,7 +13670,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13691,7 +13691,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13739,7 +13739,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13758,7 +13758,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13768,7 +13768,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13787,7 +13787,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13797,7 +13797,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13805,11 +13805,11 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13819,12 +13819,12 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); @@ -13836,7 +13836,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13876,7 +13876,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13927,7 +13927,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13939,7 +13939,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14162,7 +14162,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 834c4882d..27a8587c0 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -799,7 +799,7 @@ void Client::OnDisconnect(bool hard_disconnect) { Mob *Other = trade->With(); if(Other) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) @@ -836,7 +836,7 @@ void Client::BulkSendInventoryItems() { if(inst) { bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -1037,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } @@ -1723,12 +1723,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; if(!CanHaveSkill(skill)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); return; } if(MaxSkill(skill) == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); return; } @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/command.cpp b/zone/command.cpp index 551da4d9e..32a910842 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -443,13 +443,13 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -494,7 +494,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -568,12 +568,12 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif if(cur->function == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command @@ -1292,7 +1292,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1317,7 +1317,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1343,7 +1343,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1566,7 +1566,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1588,7 +1588,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1612,7 +1612,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -1954,7 +1954,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2274,7 +2274,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2299,7 +2299,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2319,7 +2319,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -3114,7 +3114,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3771,7 +3771,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4545,10 +4545,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4597,7 +4597,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4639,7 +4639,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4678,7 +4678,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4712,7 +4712,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4763,7 +4763,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) @@ -4869,7 +4869,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5221,7 +5221,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5278,7 +5278,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5325,7 +5325,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -7862,7 +7862,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { @@ -10394,7 +10394,7 @@ void command_logtest(Client *c, const Seperator *sep){ if (sep->IsNumber(1)){ uint32 i = 0; for (i = 0; i < atoi(sep->arg[1]); i++){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } } \ No newline at end of file diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 121feb2c1..a3e116ae2 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -842,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -872,10 +872,10 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } @@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index 2d8e4daf6..de2feed63 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; @@ -303,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -560,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/effects.cpp b/zone/effects.cpp index 3c0b1ccfd..5671460ec 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 4a9cb0716..7692151c2 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 88fa72121..35856db8b 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embperl.cpp b/zone/embperl.cpp index b7ec2b6b2..0a33a2d4a 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -140,12 +140,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -170,14 +170,14 @@ void Embperl::DoInit() { ,FALSE ); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); } try { @@ -195,7 +195,7 @@ void Embperl::DoInit() { } catch(const char *err) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 8c35b7817..e3ad58229 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. @@ -100,7 +100,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); len = 0; pos = i+1; } else { @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index 068b91f3a..86d2423e4 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/exp.cpp b/zone/exp.cpp index b0db67a40..66cb7855b 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index cb007d574..2729203ce 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index a0381f6a2..bb4e6643e 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index 9faf0d8b1..6e146f104 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1098,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1107,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1116,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index 6c4cdc4d2..e1ce7b654 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -144,10 +144,10 @@ void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if(GetClientVersion() >= EQClientRoF) { @@ -171,11 +171,11 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size); if(outapp->pBuffer == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -192,7 +192,7 @@ void Client::SendGuildMembers() { outapp->pBuffer = data; data = nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); @@ -223,7 +223,7 @@ void Client::RefreshGuildInfo() CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } @@ -335,7 +335,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->rank = gj->rank; outgj->zoneid = gj->zoneid; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); FastQueuePacket(&outapp); @@ -409,7 +409,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -429,7 +429,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 8a566cf43..76f2e3f8a 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/horse.cpp b/zone/horse.cpp index b5691ca00..e5241f528 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index a2ccaaa58..71a9da32a 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check to make sure we are augmenting an augmentable item else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -229,7 +229,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -269,7 +269,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -292,7 +292,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -559,7 +559,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; @@ -700,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. @@ -815,7 +815,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); if (client_update) { @@ -831,7 +831,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == MainCursor) return PushItemOnCursor(inst, client_update); @@ -858,7 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); m_inv.PutItem(slot_id, inst); SendLootItemInPacket(&inst, slot_id); @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); } @@ -1313,7 +1313,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1321,7 +1321,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1334,7 +1334,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->to_slot == (uint32)INVALID_INDEX) { if (move_in->from_slot == (uint32)MainCursor) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit ItemInst *inst = m_inv.GetItem(MainCursor); @@ -1348,7 +1348,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item destroyed by client } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); return true; // Item deletion @@ -1388,7 +1388,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ItemInst* src_inst = m_inv.GetItem(src_slot_id); ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) @@ -1398,7 +1398,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } if (dst_inst) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ @@ -1435,7 +1435,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { move_in->from_slot = dst_slot_check; move_in->to_slot = src_slot_check; move_in->number_in_stack = dst_inst->GetCharges(); - if(!SwapItem(move_in)) { Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } + if(!SwapItem(move_in)) { Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } } return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } @@ -1577,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } if (with) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor if (!m_inv[MainCursor]) { Message(13, "Error: Cursor item not located on server!"); @@ -1610,18 +1610,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->number_in_stack > 0) { // Determine if charged items can stack if(src_inst && !src_inst->IsStackable()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); return false; } if (dst_inst) { if(src_inst->GetID() != dst_inst->GetID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); return(false); } if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) { //we have a chance of stacking. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); // Charges can be emptied into dst uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges(); if (usedcharges > move_in->number_in_stack) @@ -1633,15 +1633,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Depleted all charges? if (src_inst->GetCharges() < 1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); all_to_stack = true; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); return false; } } @@ -1650,12 +1650,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) { // Move entire stack if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); } else { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); @@ -1680,7 +1680,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { SetMaterial(dst_slot_id,src_inst->GetItem()->ID); } if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) { if(src_inst) { @@ -1739,7 +1739,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { // resync the 'from' and 'to' slots on an as-needed basis // Not as effective as the full process, but less intrusive to gameplay -U - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { @@ -2071,7 +2071,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2080,7 +2080,7 @@ void Client::RemoveNoRent(bool client_update) { for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2089,7 +2089,7 @@ void Client::RemoveNoRent(bool client_update) { if (m_inv[MainPowerSource]) { const ItemInst* inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } @@ -2098,7 +2098,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2107,7 +2107,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } @@ -2116,7 +2116,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } @@ -2125,7 +2125,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } @@ -2134,7 +2134,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } @@ -2155,7 +2155,7 @@ void Client::RemoveNoRent(bool client_update) { inst = *iter; // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else m_inv.PushCursor(**iter); @@ -2178,7 +2178,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2193,7 +2193,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2208,7 +2208,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2223,7 +2223,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2238,7 +2238,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2253,7 +2253,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2281,7 +2281,7 @@ void Client::RemoveDuplicateLore(bool client_update) { inst = *iter; // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); iter = local.erase(iter); } @@ -2300,7 +2300,7 @@ void Client::RemoveDuplicateLore(bool client_update) { m_inv.PushCursor(**iter); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } safe_delete(*iter); @@ -2322,7 +2322,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2335,7 +2335,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s removing set", GetName(), bds->number); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,16 +2585,16 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2640,13 +2640,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); @@ -2865,8 +2865,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2881,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/loottables.cpp b/zone/loottables.cpp index ccff63bab..96ef83c88 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index a9829677f..ee846c49e 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -885,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -906,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1647,7 +1647,7 @@ void Merc::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -1766,7 +1766,7 @@ bool Merc::AI_EngagedCastCheck() { { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); int8 mercClass = GetClass(); @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/mob.cpp b/zone/mob.cpp index 6e33d79cd..8f594c80a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1576,7 +1576,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, entity_list.QueueClients(this, outapp); safe_delete(outapp); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } @@ -3043,7 +3043,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); } return; } @@ -4536,7 +4536,7 @@ void Mob::MeleeLifeTap(int32 damage) { if(lifetap_amt && damage > 0){ lifetap_amt = damage * lifetap_amt / 100; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index ebd5f6182..dd637525c 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -1404,7 +1404,7 @@ void Mob::AI_Process() { else if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); if(!RuleB(Pathing, Aggro) || !zone->pathing) CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed()); else @@ -1639,7 +1639,7 @@ void NPC::AI_DoMovement() { roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) { @@ -1692,11 +1692,11 @@ void NPC::AI_DoMovement() { else { movetimercompleted=false; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); //if we were under quest control (with no grid), we are done now.. if(cur_wp == -2) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; } @@ -1727,7 +1727,7 @@ void NPC::AI_DoMovement() { { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) { // are we there yet? then stop - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1773,7 +1773,7 @@ void NPC::AI_DoMovement() { if (movetimercompleted==true) { // time to pause has ended SetGrid( 0 - GetGrid()); // revert to AI control - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1809,7 +1809,7 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); ClearFeignMemory(); moved=false; SetMoving(false); @@ -1934,7 +1934,7 @@ bool NPC::AI_EngagedCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); // try casting a heal or gate if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) { @@ -1957,7 +1957,7 @@ bool NPC::AI_PursueCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { //no spell cast, try again soon. AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false); diff --git a/zone/net.cpp b/zone/net.cpp index 4297641dc..b1a372a8c 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -148,28 +148,28 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); return 1; } @@ -186,121 +186,121 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); return 1; } #endif const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); database.LoadVariables(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); if (!database.LoadItems()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); database.LoadFactionData(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); database.LoadTributes(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(TaskSystem, EnableTaskSystem)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } @@ -317,11 +317,11 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -332,9 +332,9 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); @@ -365,13 +365,13 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() @@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index ea031a4ed..013136a50 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/object.cpp b/zone/object.cpp index 604234238..5624ec24a 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index c90e27b9b..c8546279b 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,19 +61,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,18 +103,18 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); return false; } fread(&Head, sizeof(Head), 1, PathFile); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return noderoute; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); return noderoute; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); return To; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 881e94f66..621895c3b 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 9e1025393..9ee477de0 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,12 +254,12 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); #endif } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index cbb9cf2f2..b8d25c2b6 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index d516d6fd1..83f497352 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 5ee380233..804392ae1 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index d3b0cfae8..928414f2c 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 98ecffa0f..577e5b998 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; @@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -195,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index f801f7bc4..47ae29ec2 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -464,7 +464,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) break; } default: - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); return(1000); /* nice long delay for them, the caller depends on this! */ } @@ -683,7 +683,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -695,12 +695,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const ItemInst* Ammo = m_inv[MainAmmo]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(MainRange)); return; } if (!Ammo || !Ammo->IsType(ItemClassCommon)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(MainAmmo)); return; } @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const Item_Struct* AmmoItem = Ammo->GetItem(); if(RangeItem->ItemType != ItemTypeBow) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } if(AmmoItem->ItemType != ItemTypeArrow) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -746,7 +746,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Ammo = baginst; ammo_slot = m_inv.CalcSlotId(r, i); found = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); break; } } @@ -761,17 +761,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (aslot != INVALID_INDEX) { ammo_slot = aslot; Ammo = m_inv[aslot]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); } } } float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -799,9 +799,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); } CheckIncreaseSkill(SkillArchery, GetTarget(), -15); @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillArchery); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); @@ -882,7 +882,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); @@ -923,7 +923,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ @@ -944,7 +944,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); } } @@ -1192,7 +1192,7 @@ void NPC::RangedAttack(Mob* other) //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -1361,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -1371,19 +1371,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 const ItemInst* RangeWeapon = m_inv[MainRange]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(MainRange)); return; } const Item_Struct* item = RangeWeapon->GetItem(); if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(MainRange)); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1392,7 +1392,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //more in the ammo slot, use it RangeWeapon = AmmoItem; ammo_slot = MainAmmo; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal); @@ -1400,17 +1400,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //the item wont change, but the instance does, not that it matters ammo_slot = aslot; RangeWeapon = m_inv[aslot]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } } } float range = item->Range + GetRangeDistTargetSizeMod(other); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1489,7 +1489,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillThrowing); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; @@ -1497,7 +1497,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); int16 WDmg = 0; @@ -1533,7 +1533,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) other->AvoidDamage(this, TotalDmg, false); //CanRiposte=false - Can not riposte throw attacks. diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 0f3770394..1962ec416 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -476,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -485,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -711,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) stun_resist += aabonuses.StunResist; if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -721,7 +721,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); } } break; @@ -1649,7 +1649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int mod = caster->GetInstrumentMod(spell_id); mod = ApplySpellEffectiveness(caster, spell_id, mod, true); effect_value = effect_value * mod / 10; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); } effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); @@ -3127,7 +3127,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3326,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); } } @@ -3351,7 +3351,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3383,18 +3383,18 @@ void Mob::BuffProcess() IsMezSpell(buffs[buffs_i].spellid) || IsBlindSpell(buffs[buffs_i].spellid)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } } else if (buffs[buffs_i].ticsremaining < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if(IsClient() && !(CastToClient()->GetClientVersionBit() & BIT_SoFAndLater)) @@ -3759,7 +3759,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index 7d0718d34..570d6ea0e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -147,7 +147,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -166,7 +166,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -204,7 +204,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, //cannot cast under divine aura if(DivineAura()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -234,7 +234,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -243,7 +243,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -349,7 +349,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -363,7 +363,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this @@ -375,7 +375,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -392,7 +392,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // we checked for spells not requiring targets above if(target_id == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, SPELL_NEED_TAR); @@ -430,7 +430,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, { mana_cost = 0; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, INSUFFICIENT_MANA); @@ -451,7 +451,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_resist_adjust = resist_adjust; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", spell_id, cast_time, orgcasttime, mana_cost); // cast time is 0, just finish it right now and be done with it @@ -517,7 +517,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -756,7 +756,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -816,7 +816,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); if(!spellid) return; @@ -893,7 +893,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -907,7 +907,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { Message_StringID(13, SPELL_RECAST); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -916,7 +916,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!IsValidSpell(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -927,7 +927,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(delaytimer) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); Message(13, "You are unable to focus."); InterruptSpell(); return; @@ -937,7 +937,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); Message_StringID(13,ALREADY_CASTING); InterruptSpell(); return; @@ -952,7 +952,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); } else { bardsong = spell_id; bardsong_slot = slot; @@ -962,7 +962,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, else bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1041,10 +1041,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; } @@ -1060,10 +1060,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, break; default: // some non-instrument component. Let it go, but record it in the log - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); if(c->GetGM()) c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1143,12 +1143,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, const Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1169,7 +1169,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (component == -1) continue; component_count = spells[spell_id].component_counts[t_count]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1234,7 +1234,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { Message_StringID(13, SPELL_RECAST); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -1253,15 +1253,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); Message(13, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1280,7 +1280,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); InterruptSpell(); return; } @@ -1309,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, this->CastToClient()->CheckSongSkillIncrease(spell_id); this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); } else { @@ -1344,7 +1344,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, delaytimer = true; spellend_timer.Start(400,true); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); } @@ -1391,7 +1391,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce && (IsGrouped() // still self only if not grouped || IsRaidGrouped()) && (HasProjectIllusion())){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); targetType = ST_GroupClientAndPet; } @@ -1474,7 +1474,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1487,7 +1487,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3)) { //invalid target - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1501,7 +1501,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1526,7 +1526,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); if(!spell_target) Message_StringID(13,SPELL_NEED_TAR); else @@ -1544,7 +1544,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1552,14 +1552,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1568,7 +1568,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1580,7 +1580,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1596,7 +1596,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); Message_StringID(13,NO_PET); return false; // can't cast these unless we have a target } @@ -1666,7 +1666,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1703,7 +1703,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1800,14 +1800,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } @@ -1878,7 +1878,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -1957,7 +1957,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) return(false); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -1968,7 +1968,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -1977,7 +1977,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); Message_StringID(13,CANT_SEE_TARGET); return false; } @@ -2008,13 +2008,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); Message_StringID(13, TARGET_TOO_CLOSE); return(false); } @@ -2043,7 +2043,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 #endif //BOTS if(spell_target == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2067,11 +2067,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsPlayerIllusionSpell(spell_id) && IsClient() && (HasProjectIllusion())){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); SetProjectIllusion(false); } else{ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); } break; } @@ -2235,7 +2235,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // CastSpell already reduced the cost for it if we're a client with focus if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2247,7 +2247,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF) { CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2263,7 +2263,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(reduction) recast -= reduction; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2301,7 +2301,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(slot == USE_ITEM_SPELL_SLOT) { //bard songs should never come from items... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); return(false); } @@ -2309,12 +2309,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2323,18 +2323,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); return(false); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); Message_StringID(13, CANT_SEE_TARGET); return(false); } @@ -2349,7 +2349,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { float range2 = range * range; if(dist2 > range2) { //target is out of range. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } @@ -2365,10 +2365,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case SingleTarget: { if(spell_target == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); return(false); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2386,7 +2386,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2394,9 +2394,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2406,13 +2406,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case GroupSpell: { if(spell_target->IsGrouped()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2429,7 +2429,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2455,13 +2455,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2559,7 +2559,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2601,7 +2601,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", spell_id, castlevel, formula, duration, res); return(res); @@ -2673,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } @@ -2695,15 +2695,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); // Same Spells and dot exemption is set to 1 or spell is Manaburn if (spellid1 == spellid2) { if (sp1.dot_stacking_exempt == 1 && caster1 != caster2) { // same caster can refresh - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); return -1; } else if (spellid1 == 2751) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); return -1; } } @@ -2735,7 +2735,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2804,16 +2804,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2827,22 +2827,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -2905,13 +2905,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -2923,7 +2923,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(sp_det_mismatch) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); continue; } @@ -2932,7 +2932,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -2958,7 +2958,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -2967,7 +2967,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -2976,15 +2976,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); return(1); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); return 0; } @@ -3043,11 +3043,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); return -2; // no duration? this isn't a buff } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3077,12 +3077,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite) @@ -3106,7 +3106,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3114,11 +3114,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); return -1; } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); return -1; } } @@ -3169,7 +3169,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3207,7 +3207,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) { int i, ret, firstfree = -2; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) @@ -3231,19 +3231,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) if(ret == 1) { // should overwrite current slot if(iFailIfOverwrite) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return(-1); } if(firstfree == -2) firstfree = i; } if(ret == -1) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); return firstfree; } @@ -3270,7 +3270,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); Message(13, "SOT: You must have a target for this spell."); return false; } @@ -3298,7 +3298,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r uint16 caster_level = GetCasterLevel(spell_id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3378,7 +3378,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3386,7 +3386,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3395,7 +3395,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3406,17 +3406,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3525,9 +3525,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3537,7 +3537,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); spelltar->Message_StringID(MT_SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3551,7 +3551,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3644,7 +3644,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ Message_StringID(MT_SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3692,7 +3692,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, isproc); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); if(aggro_amount > 0) spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; @@ -3709,7 +3709,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_type != 1) // AA is handled differently Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3825,14 +3825,14 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); return true; } void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -4005,7 +4005,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4016,7 +4016,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); caster->Message_StringID(MT_Shout, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4034,7 +4034,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); return true; } @@ -4043,7 +4043,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4059,7 +4059,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4070,13 +4070,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); caster->Message_StringID(MT_Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id); if (aggro > 0) { @@ -4090,7 +4090,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (IsClient() && CastToClient()->CheckAAEffect(aaEffectWarcry)) { Message(13, "Your are immune to fear."); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } @@ -4100,7 +4100,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); caster->Message_StringID(MT_Shout, CANNOT_CHARM); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4113,7 +4113,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); caster->Message(MT_Shout, "You cannot charm yourself."); return true; } @@ -4126,7 +4126,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); return true; } @@ -4140,7 +4140,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4156,7 +4156,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); return true; } @@ -4166,13 +4166,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); return true; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); return false; } @@ -4209,7 +4209,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); return(0); } @@ -4230,7 +4230,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; } } @@ -4248,7 +4248,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; } } @@ -4256,7 +4256,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); return 100; } @@ -4822,7 +4822,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4837,7 +4837,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > MAX_PP_MEMSPELL || slot < 0) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4870,7 +4870,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); if(update_client) { @@ -4883,7 +4883,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= MAX_PP_SPELLBOOK || slot < 0) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -4914,7 +4914,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) @@ -5089,23 +5089,23 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); } return false; } @@ -5116,7 +5116,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].spellID = SPELL_UNKNOWN; SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); } } return true; @@ -5133,7 +5133,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5148,7 +5148,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); } } return true; @@ -5165,7 +5165,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5180,7 +5180,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); } } return true; @@ -5211,7 +5211,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return(level); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 56fd8f1e6..97000189b 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -115,21 +115,21 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; taskActiveTasks[task].Updated) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,11 +358,11 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -459,14 +459,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,12 +634,12 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,16 +1275,16 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,24 +2932,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3088,12 +3088,12 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } NumberOfLists = results.RowCount(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/titles.cpp b/zone/titles.cpp index 68ae958ae..e6a268607 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a83647a83..946d595fc 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,12 +1477,12 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if (results.RowCount() != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 16c0d7e49..c7e370ade 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -86,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -296,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -307,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -315,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -324,7 +324,7 @@ void Trade::DumpTrade() } } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -458,7 +458,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool qs_log = false; if(other) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); @@ -491,7 +491,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst && inst->IsType(ItemClassContainer)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -499,7 +499,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st inst->SetCharges(0); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); if (other->PutItemInInventory(partial_slot, *partial_inst, true)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges())); inst->SetCharges(old_charges); @@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -772,17 +772,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,12 +1534,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); @@ -1836,11 +1836,11 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/trap.cpp b/zone/trap.cpp index 6efb00517..ac4361fe0 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 82b1bb4f7..014fd8773 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index f574802b6..82cc2936a 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -88,7 +88,7 @@ void NPC::StopWandering() roamer=false; CastToNPC()->SetGrid(0); SendPosition(); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); return; } @@ -107,16 +107,16 @@ void NPC::ResumeWandering() cur_wp=save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); } else if (AIwalking_timer->Enabled()) { // we are at a waypoint paused normally - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); AIwalking_timer->Trigger(); // disable timer to end pause now } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -143,7 +143,7 @@ void NPC::PauseWandering(int pausetime) if (GetGrid() != 0) { DistractedFromGrid = true; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); SendPosition(); if (pausetime<1) { // negative grid number stops him dead in his tracks until ResumeWandering() @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -166,7 +166,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if (GetGrid() < 0) { // currently stopped by a quest command SetGrid( 0 - GetGrid()); // get him moving again - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); } AIwalking_timer->Disable(); // disable timer in case he is paused at a wp if (cur_wp>=0) @@ -174,14 +174,14 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); } if (saveguardspot) { @@ -196,7 +196,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if(guard_heading == -1) guard_heading = this->CalculateHeadingToTarget(mtx, mty); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } cur_wp_x = mtx; @@ -212,7 +212,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) void NPC::UpdateWaypoint(int wp_index) { if(wp_index >= static_cast(Waypoints.size())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); return; } std::vector::iterator cur; @@ -224,7 +224,7 @@ void NPC::UpdateWaypoint(int wp_index) cur_wp_z = cur->z; cur_wp_pause = cur->pause; cur_wp_heading = cur->heading; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) @@ -430,7 +430,7 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); guard_x = 0; guard_y = 0; guard_z = 0; @@ -443,14 +443,14 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } } void NPC::NextGuardPosition() { if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { SetHeading(guard_heading); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); } else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) { @@ -516,15 +516,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if(z_pos-z != 0) { z_pos = z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); @@ -550,7 +550,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); uint8 NPCFlyMode = 0; @@ -569,7 +569,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -612,7 +612,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -647,7 +647,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b z_pos = new_z; tar_ndx=22-numsteps; heading = CalculateHeadingToTarget(x, y); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } else { @@ -659,7 +659,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = y; z_pos = z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); } } @@ -678,7 +678,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; heading = CalculateHeadingToTarget(x, y); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } uint8 NPCFlyMode = 0; @@ -698,7 +698,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -759,7 +759,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec moved=false; } SetRunAnimSpeed(0); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); return true; } @@ -773,7 +773,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -790,7 +790,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = x; y_pos = y; z_pos = z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); } else { float new_x = x_pos + tar_vx*tar_vector; @@ -803,7 +803,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); } uint8 NPCFlyMode = 0; @@ -823,7 +823,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -951,7 +951,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) return; @@ -967,7 +967,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -998,7 +998,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 50dff0073..8043954fc 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,12 +155,12 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } case ServerOP_ZAAuthFailed: { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; @@ -386,12 +386,12 @@ void WorldServer::Process() { } } else { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); } } else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - Log.DoLog(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); @@ -1381,7 +1381,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } @@ -2061,7 +2061,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { diff --git a/zone/zone.cpp b/zone/zone.cpp index f9276f8df..1ae1d237b 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -144,8 +144,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -167,11 +167,11 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -707,11 +707,11 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); @@ -725,19 +725,19 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); return; } Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -801,12 +801,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -899,56 +899,56 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); return false; } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,32 +1019,32 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); return false; } } @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); return true; } @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 0f960d8c2..18c357bc2 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -619,25 +619,25 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,12 +645,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 0c8e8de98..8797ed7fa 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -534,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -543,14 +543,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; SetHeading(heading); break; default: - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); + Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 6535690a69dd0693cf4d3a8fd075cf605822c143 Mon Sep 17 00:00:00 2001 From: Kemmler Date: Sun, 18 Jan 2015 03:08:12 -0500 Subject: [PATCH 1079/1883] MS Visual Studio needs help finding std::min and std::max --- zone/position.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zone/position.cpp b/zone/position.cpp index ddbe429af..56e7da563 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -1,9 +1,12 @@ #include #include - #include "position.h" #include "../common/string_util.h" +#ifdef _MSC_VER + #include +#endif + xy_location::xy_location(float x, float y) : m_X(x), m_Y(y) { From 467b359d0cf02b48e7e4762a93f739bce1147ccb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:20:16 -0600 Subject: [PATCH 1080/1883] Moved all EQEmuLogSys:: enum references used in Log.Out to a namespace 'Logs' for shortening of syntax --- client_files/export/main.cpp | 30 +-- client_files/import/main.cpp | 28 +- common/crash.cpp | 44 +-- common/database.cpp | 34 +-- common/eq_stream.cpp | 242 ++++++++--------- common/eq_stream_factory.cpp | 8 +- common/eq_stream_ident.cpp | 22 +- common/eqemu_logsys.cpp | 14 +- common/eqemu_logsys.h | 100 +++---- common/eqtime.cpp | 6 +- common/guild_base.cpp | 132 ++++----- common/item.cpp | 2 +- common/misc_functions.h | 2 +- common/patches/rof.cpp | 88 +++--- common/patches/rof2.cpp | 88 +++--- common/patches/sod.cpp | 58 ++-- common/patches/sof.cpp | 28 +- common/patches/ss_define.h | 8 +- common/patches/titanium.cpp | 22 +- common/patches/underfoot.cpp | 58 ++-- common/ptimer.cpp | 14 +- common/rulesys.cpp | 36 +-- common/shareddb.cpp | 106 ++++---- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 4 +- common/tcp_connection.cpp | 4 +- common/tcp_server.cpp | 4 +- common/timeoutmgr.cpp | 6 +- common/worldconn.cpp | 4 +- eqlaunch/eqlaunch.cpp | 18 +- eqlaunch/worldserver.cpp | 18 +- eqlaunch/zone_launch.cpp | 46 ++-- queryserv/database.cpp | 60 ++--- queryserv/lfguild.cpp | 14 +- queryserv/queryserv.cpp | 16 +- queryserv/worldserver.cpp | 6 +- shared_memory/main.cpp | 34 +-- ucs/chatchannel.cpp | 32 +-- ucs/clientlist.cpp | 78 +++--- ucs/database.cpp | 90 +++---- ucs/ucs.cpp | 26 +- ucs/worldserver.cpp | 8 +- world/adventure.cpp | 4 +- world/adventure_manager.cpp | 6 +- world/client.cpp | 168 ++++++------ world/cliententry.cpp | 2 +- world/clientlist.cpp | 14 +- world/console.cpp | 24 +- world/eql_config.cpp | 22 +- world/eqw.cpp | 6 +- world/eqw_http_handler.cpp | 18 +- world/eqw_parser.cpp | 6 +- world/launcher_link.cpp | 24 +- world/launcher_list.cpp | 10 +- world/login_server.cpp | 32 +-- world/login_server_list.cpp | 2 +- world/net.cpp | 116 ++++---- world/queryserv.cpp | 12 +- world/ucs.cpp | 12 +- world/wguild_mgr.cpp | 26 +- world/worlddb.cpp | 18 +- world/zonelist.cpp | 8 +- world/zoneserver.cpp | 88 +++--- zone/aa.cpp | 46 ++-- zone/aggro.cpp | 22 +- zone/attack.cpp | 174 ++++++------ zone/bonuses.cpp | 6 +- zone/bot.cpp | 116 ++++---- zone/botspellsai.cpp | 4 +- zone/client.cpp | 70 ++--- zone/client_mods.cpp | 12 +- zone/client_packet.cpp | 510 +++++++++++++++++------------------ zone/client_process.cpp | 24 +- zone/command.cpp | 64 ++--- zone/corpse.cpp | 8 +- zone/doors.cpp | 16 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 10 +- zone/embxs.cpp | 6 +- zone/entity.cpp | 14 +- zone/exp.cpp | 8 +- zone/fearpath.cpp | 4 +- zone/forage.cpp | 6 +- zone/groups.cpp | 36 +-- zone/guild.cpp | 20 +- zone/guild_mgr.cpp | 48 ++-- zone/horse.cpp | 6 +- zone/inventory.cpp | 154 +++++------ zone/loottables.cpp | 4 +- zone/merc.cpp | 16 +- zone/mob.cpp | 6 +- zone/mob_ai.cpp | 20 +- zone/net.cpp | 108 ++++---- zone/npc.cpp | 20 +- zone/object.cpp | 8 +- zone/pathing.cpp | 146 +++++----- zone/perl_client.cpp | 16 +- zone/petitions.cpp | 10 +- zone/pets.cpp | 16 +- zone/questmgr.cpp | 30 +-- zone/raids.cpp | 22 +- zone/spawn2.cpp | 152 +++++------ zone/spawngroup.cpp | 8 +- zone/special_attacks.cpp | 58 ++-- zone/spell_effects.cpp | 32 +-- zone/spells.cpp | 352 ++++++++++++------------ zone/tasks.cpp | 252 ++++++++--------- zone/titles.cpp | 12 +- zone/tradeskills.cpp | 82 +++--- zone/trading.cpp | 122 ++++----- zone/trap.cpp | 2 +- zone/tribute.cpp | 10 +- zone/waypoints.cpp | 108 ++++---- zone/worldserver.cpp | 42 +-- zone/zone.cpp | 148 +++++----- zone/zonedb.cpp | 124 ++++----- zone/zoning.cpp | 46 ++-- 119 files changed, 2812 insertions(+), 2808 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 2b3aa1e4e..5152cf008 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -38,22 +38,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Export Utility"); + Log.Out(Logs::General, Logs::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(Logs::General, Logs::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -66,11 +66,11 @@ int main(int argc, char **argv) { } void ExportSpells(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Spells..."); + Log.Out(Logs::General, Logs::Status, "Exporting Spells..."); FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping."); return; } @@ -94,7 +94,7 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); @@ -108,7 +108,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -128,7 +128,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -140,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { } void ExportSkillCaps(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Skill Caps..."); + Log.Out(Logs::General, Logs::Status, "Exporting Skill Caps..."); FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -169,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) { } void ExportBaseData(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Exporting Base Data..."); + Log.Out(Logs::General, Logs::Status, "Exporting Base Data..."); FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping."); return; } @@ -195,7 +195,7 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index e94eed0c9..f390d2b0b 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -36,22 +36,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Client Files Import Utility"); + Log.Out(Logs::General, Logs::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(Logs::General, Logs::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -68,7 +68,7 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -76,10 +76,10 @@ int GetSpellColumns(SharedDatabase *db) { } void ImportSpells(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Spells..."); + Log.Out(Logs::General, Logs::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping."); return; } @@ -142,23 +142,23 @@ void ImportSpells(SharedDatabase *db) { spells_imported++; if(spells_imported % 1000 == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported); } } if(spells_imported % 1000 != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "%d spells imported.", spells_imported); + Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported); } fclose(f); } void ImportSkillCaps(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Skill Caps..."); + Log.Out(Logs::General, Logs::Status, "Importing Skill Caps..."); FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -190,11 +190,11 @@ void ImportSkillCaps(SharedDatabase *db) { } void ImportBaseData(SharedDatabase *db) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Importing Base Data..."); + Log.Out(Logs::General, Logs::Status, "Importing Base Data..."); FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping."); + Log.Out(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping."); return; } diff --git a/common/crash.cpp b/common/crash.cpp index 283dba9c5..fee4dcddf 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -25,7 +25,7 @@ public: } } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer); + Log.Out(Logs::General, Logs::Crash, buffer); StackWalker::OnOutput(szText); } }; @@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo) switch(ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION"); break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"); break; case EXCEPTION_BREAKPOINT: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT"); break; case EXCEPTION_DATATYPE_MISALIGNMENT: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT"); break; case EXCEPTION_FLT_DENORMAL_OPERAND: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND"); break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO"); break; case EXCEPTION_FLT_INEXACT_RESULT: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT"); break; case EXCEPTION_FLT_INVALID_OPERATION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION"); break; case EXCEPTION_FLT_OVERFLOW: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW"); break; case EXCEPTION_FLT_STACK_CHECK: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK"); break; case EXCEPTION_FLT_UNDERFLOW: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW"); break; case EXCEPTION_ILLEGAL_INSTRUCTION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION"); break; case EXCEPTION_IN_PAGE_ERROR: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR"); break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO"); break; case EXCEPTION_INT_OVERFLOW: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW"); break; case EXCEPTION_INVALID_DISPOSITION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION"); break; case EXCEPTION_PRIV_INSTRUCTION: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION"); break; case EXCEPTION_SINGLE_STEP: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP"); break; case EXCEPTION_STACK_OVERFLOW: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW"); + Log.Out(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW"); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception"); + Log.Out(Logs::General, Logs::Crash, "Unknown Exception"); break; } diff --git a/common/database.cpp b/common/database.cpp index ff05ea6df..6ef6c7485 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid = GetCharacterID(pp->name); if(!charid) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id"); + Log.Out(Logs::General, Logs::Error, "StoreCharacter: no character id"); return false; } @@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); + Log.Out(Logs::General, Logs::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); #endif } @@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); } void Database::AddReport(std::string who, std::string against, std::string lines) { @@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines safe_delete_array(escape_str); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { @@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); return; } @@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); } void Database::ClearAllGroups(void) @@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){ if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); return 0; } if (results.RowCount() == 0) { // Commenting this out until logging levels can prevent this from going to console - //Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name); + //Log.Out(Logs::General, Logs::None,, "Character not in a group: %s", name); return 0; } @@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) { result = QueryDatabase(query); if(!result.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str()); } } @@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 7d10917f4..c409e275b 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) { OpMgr = nullptr; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size); _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; @@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len) { EQRawApplicationPacket *ap=nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len); + Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len); _hex(NET__APP_CREATE_HEX, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; @@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Session not initialized, packet ignored" __L); _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processed < p->size) { subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); + Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) while(processedsize) { EQRawApplicationPacket *ap=nullptr; if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length); processed+=subpacket_length+1; } else { subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); + Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length); ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length); processed+=subpacket_length+3; } @@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Packet: { if(!p->pBuffer || (p->Size() < 4)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Packet that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); + Log.Out(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq); delete qp; } @@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) // Check for an embedded OP_AppCombinded (protocol level 0x19) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); @@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_Fragment: { if(!p->pBuffer || (p->Size() < 4)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Fragment that was of malformed size" __L); break; } uint16 seq=ntohs(*(uint16 *)(p->pBuffer)); SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); //SendOutOfOrderAck(seq); } else if (check == SeqPast) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. EQProtocolPacket *qp=RemoveQueue(seq); if (qp) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); + Log.Out(Logs::General, Logs::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq); delete qp; } SetNextAckToSend(seq); @@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (oversize_buffer) { memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2); oversize_offset+=p->size-2; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); + Log.Out(Logs::Detail, Logs::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length); if (oversize_offset==oversize_length) { if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); //_raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; } else { EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size); if (ap) { ap->copyInfo(p); InboundQueuePush(ap); @@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) oversize_buffer=new unsigned char[oversize_length]; memcpy(oversize_buffer,p->pBuffer+6,p->size-6); oversize_offset=p->size-6; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); + Log.Out(Logs::Detail, Logs::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length); } } } @@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_KeepAlive: { #ifndef COLLECTOR NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received and queued reply to keep alive" __L); #endif } break; case OP_Ack: { if(!p->pBuffer || (p->Size() < 4)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_Ack that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionRequest: { if(p->Size() < sizeof(SessionRequest)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L); break; } #ifndef COLLECTOR if (GetState()==ESTABLISHED) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts); // client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case // streamactive means we identified the opcode for the stream, we cannot re-establish this connection @@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SessionRequest *Request=(SessionRequest *)p->pBuffer; Session=ntohl(Request->Session); SetMaxLen(ntohl(Request->MaxLength)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen); SetState(ESTABLISHED); #ifndef COLLECTOR Key=0x11223344; @@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionResponse: { if(p->Size() < sizeof(SessionResponse)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L); break; } @@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) compressed=(Response->Format&FLAG_COMPRESSED); encoded=(Response->Format&FLAG_ENCODED); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no"); // Kinda kludgy, but trie for now if (StreamType==UnknownStream) { @@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) EQStreamState state = GetState(); if(state == ESTABLISHED) { //client initiated disconnect? - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L); _SendDisconnect(); SetState(CLOSED); } else if(state == CLOSING) { //we were waiting for this anyways, ignore pending messages, send the reply and be closed. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L); _SendDisconnect(); SetState(CLOSED); } else { //we are expecting this (or have already gotten it, but dont care either way) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L); SetState(CLOSED); } } @@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_OutOfOrderAck: { if(!p->pBuffer || (p->Size() < 4)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L); break; } #ifndef COLLECTOR @@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } //if the packet they got out of order is between our last acked packet and the last sent packet, then its valid. if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L, seq, SequencedBase, SequencedBase+NextSequencedSend); bool retransmit_acked_packets = false; @@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if(!retransmit_acked_packets) { uint16 sqsize = SequencedQueue.size(); uint16 index = seq - SequencedBase; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); + Log.Out(Logs::Detail, Logs::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize); if (index < sqsize) { std::deque::iterator sitr; sitr = SequencedQueue.begin(); @@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) NextSequencedSend = 0; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq); } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) case OP_SessionStatRequest: { if(p->Size() < sizeof(SessionStats)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L); break; } #ifndef COLLECTOR SessionStats *Stats=(SessionStats *)p->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L, (unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta), (unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta), (unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta)); @@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX) retransmittimeout = RETRANSMIT_TIMEOUT_MAX; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); + Log.Out(Logs::Detail, Logs::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout); } } #endif } break; case OP_SessionStatResponse: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L); } break; case OP_OutOfSession: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received OP_OutOfSession. Ignoring." __L); } break; default: @@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req) return; if(OpMgr == nullptr || *OpMgr == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L); delete pack; return; } @@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) // Convert the EQApplicationPacket to 1 or more EQProtocolPackets if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Making oversized packet, len %d" __L, p->size); unsigned char *tmpbuff=new unsigned char[p->size+3]; length=p->serialize(opcode, tmpbuff); @@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) *(uint32 *)(out->pBuffer+2)=htonl(p->Size()); used=MaxLen-10; memcpy(out->pBuffer+6,tmpbuff,used); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size()); SequencedPush(out); @@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p) out->size=chunksize+2; SequencedPush(out); used+=chunksize; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size); } delete p; delete[] tmpbuff; @@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p) #else MOutboundQueue.lock(); if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase); *(uint16 *)(p->pBuffer)=htons(NextOutSeq); SequencedQueue.push_back(p); NextOutSeq++; if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } MOutboundQueue.unlock(); #endif @@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) delete p; #else MOutboundQueue.lock(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size); NonSequencedQueue.push(p); MOutboundQueue.unlock(); #endif @@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p) void EQStream::SendAck(uint16 seq) { uint16 Seq=htons(seq); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Sending ack with sequence %d" __L, seq); SetLastAckSent(seq); NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16))); } void EQStream::SendOutOfOrderAck(uint16 seq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Sending out of order ack with sequence %d" __L, seq); uint16 Seq=htons(seq); NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16))); } @@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd) // if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend && (GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " + Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked " "buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend); NextSequencedSend = 0; retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet @@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // And remove it form the queue p = NonSequencedQueue.front(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size); NonSequencedQueue.pop(); } else if (!p->combine(NonSequencedQueue.front())) { // Tryint to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked, so just remove this packet and it's spot in the queue - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size); delete NonSequencedQueue.front(); NonSequencedQueue.pop(); } @@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd) if (sitr!=SequencedQueue.end()) { if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging... if(SequencedQueue.empty()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq); SeqEmpty=true; continue; } if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) { if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); + Log.Out(Logs::Detail, Logs::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send); sitr++; NextSequencedSend++; } else if (!p) { // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } @@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd) // If we don't have a packet to try to combine into, use this one as the base // Copy it first as it will still live until it is acked p=(*sitr)->Copy(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size); ++sitr; NextSequencedSend++; } else if (!p->combine(*sitr)) { // Trying to combine this packet with the base didn't work (too big maybe) // So just send the base packet (we'll try this packet again later) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size); ReadyToSend.push(p); BytesWritten+=p->size; p=nullptr; if (BytesWritten > threshold) { // Sent enough this round, lets stop to be fair - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); + Log.Out(Logs::Detail, Logs::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold); break; } } else { // Combine worked - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size); ++sitr; NextSequencedSend++; } } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } else { // No more sequenced packets @@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd) // We have a packet still, must have run out of both seq and non-seq, so send it if (p) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Final combined packet not full, len %d" __L, p->size); ReadyToSend.push(p); BytesWritten+=p->size; } @@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd) if(SeqEmpty && NonSeqEmpty) { //no more data to send if(CheckState(CLOSING)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L ); + Log.Out(Logs::Detail, Logs::Netcode, _L "All outgoing data flushed, closing stream." __L ); //we are waiting for the queues to empty, now we can do our disconnect. //this packet will not actually go out until the next call to Write(). _SendDisconnect(); @@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses out->size=sizeof(SessionResponse); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no"); NonSequencedPush(out); @@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess Request->Session=htonl(time(nullptr)); Request->MaxLength=htonl(512); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); + Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength)); NonSequencedPush(out); } @@ -932,7 +932,7 @@ void EQStream::_SendDisconnect() *(uint32 *)out->pBuffer=htonl(Session); NonSequencedPush(out); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); + Log.Out(Logs::Detail, Logs::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session); } void EQStream::InboundQueuePush(EQRawApplicationPacket *p) @@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if (emu_op == OP_Unknown) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr; if(OpMgr != nullptr && *OpMgr != nullptr) { EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode); if(emu_op == OP_Unknown) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); + Log.Out(Logs::General, Logs::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode); } p->SetOpcode(emu_op); @@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear() { EQApplicationPacket *p=nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing inbound queue" __L); MInboundQueue.lock(); if (!InboundQueue.empty()) { @@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear() { EQProtocolPacket *p=nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing outbound queue" __L); MOutboundQueue.lock(); while(!NonSequencedQueue.empty()) { @@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear() { EQProtocolPacket *p=nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Clearing future packet queue" __L); if(!PacketQueue.empty()) { std::map::iterator itr; @@ -1111,7 +1111,7 @@ uint32 newlength=0; delete p; ProcessQueue(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L); _hex(NET__NET_CREATE_HEX, buffer, length); } } @@ -1141,33 +1141,33 @@ std::deque::iterator itr, tmp; MOutboundQueue.lock(); //do a bit of sanity checking. if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } SeqOrder ord = CompareSequence(SequencedBase, seq); if(ord == SeqInOrder) { //they are not acking anything new... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq); } else if(ord == SeqPast) { //they are nacking blocks going back before our buffer, wtf? - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); + Log.Out(Logs::Detail, Logs::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase); //this is a good ack, we get to ack some blocks. seq++; //we stop at the block right after their ack, counting on the wrap of both numbers. while(SequencedBase != seq) { if(SequencedQueue.empty()) { -Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); +Log.Out(Logs::Detail, Logs::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); SequencedBase = NextOutSeq; NextSequencedSend = 0; break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); + Log.Out(Logs::Detail, Logs::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend); //clean out the acked packet delete SequencedQueue.front(); SequencedQueue.pop_front(); @@ -1178,10 +1178,10 @@ Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked pack SequencedBase++; } if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq); } if(NextSequencedSend > SequencedQueue.size()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size()); } } @@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) { void EQStream::SetNextAckToSend(uint32 seq) { MAcks.lock(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq); NextAckToSend=seq; MAcks.unlock(); } @@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq) void EQStream::SetLastAckSent(uint32 seq) { MAcks.lock(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq); LastAckSent=seq; MAcks.unlock(); } @@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue() EQProtocolPacket *qp=nullptr; while((qp=RemoveQueue(NextInSeq))!=nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); + Log.Out(Logs::Detail, Logs::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq); ProcessPacket(qp); delete qp; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } } @@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr; if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) { qp=itr->second; PacketQueue.erase(itr); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); + Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); } return qp; } void EQStream::SetStreamType(EQStreamType type) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); + Log.Out(Logs::Detail, Logs::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type)); StreamType=type; switch (StreamType) { case LoginStream: app_opcode_size=1; compressed=false; encoded=false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size); break; case ChatOrMailStream: case ChatStream: @@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=1; compressed=false; encoded=true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); + Log.Out(Logs::Detail, Logs::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size); break; case ZoneStream: case WorldStream: @@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type) app_opcode_size=2; compressed=true; encoded=false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); + Log.Out(Logs::Detail, Logs::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size); break; } } @@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq) void EQStream::SetState(EQStreamState state) { MState.lock(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state); + Log.Out(Logs::Detail, Logs::Netcode, _L "Changing state from %d to %d" __L, State, state); State=state; MState.unlock(); } @@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) { EQStreamState orig_state = GetState(); if (orig_state == CLOSING && !outgoing_data) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Out of data in closing state, disconnecting." __L); _SendDisconnect(); SetState(DISCONNECTING); } else if (LastPacket && (now-LastPacket) > timeout) { switch(orig_state) { case CLOSING: //if we time out in the closing state, they are not acking us, just give up - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L); _SendDisconnect(); SetState(CLOSED); break; case DISCONNECTING: //we timed out waiting for them to send us the disconnect reply, just give up. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L); SetState(CLOSED); break; case CLOSED: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in closed state??" __L); break; case ESTABLISHED: //we timed out during normal operation. Try to be nice about it. //we will almost certainly time out again waiting for the disconnect reply, but oh well. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Timeout expired in established state. Closing connection." __L); _SendDisconnect(); SetState(DISCONNECTING); break; @@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L, average_delta, AVERAGE_DELTA_MAX); } } else { @@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta) MRate.lock(); RateThreshold=RATEBASE/average_delta; DecayRate=DECAYBASE/average_delta; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, + Log.Out(Logs::Detail, Logs::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L, RateThreshold, DecayRate, average_delta); MRate.unlock(); } @@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta) void EQStream::Close() { if(HasOutgoingData()) { //there is pending data, wait for it to go out. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L); SetState(CLOSING); } else { //otherwise, we are done, we can drop immediately. _SendDisconnect(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L); + Log.Out(Logs::Detail, Logs::Netcode, _L "Stream closing immediate due to Close()" __L); SetState(DISCONNECTING); } } @@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) { } else if(p->opcode == sig->first_eq_opcode) { //opcode matches, check length.. if(p->size == sig->first_length) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else if(sig->first_length == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); + Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size); res = MatchSuccessful; } else { //opcode matched but length did not. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); + Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length); res = MatchFailed; } } else { //first opcode did not match.. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); + Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode); res = MatchFailed; } } diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 114b61c68..4a75068b6 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif fs->ReaderLoop(); #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); @@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs) EQStreamFactory *fs=(EQStreamFactory *)eqfs; #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif fs->WriterLoop(); #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index 9ec7f2c92..22b9f77b4 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() { //first see if this stream has expired if(r->expire.Check(false)) { //this stream has failed to match any pattern in our timeframe. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); delete r; cur = m_streams.erase(cur); @@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() { } if(r->stream->GetState() != ESTABLISHED) { //the stream closed before it was identified. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); switch(r->stream->GetState()) { case ESTABLISHED: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established"); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established"); break; case CLOSING: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing"); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing"); break; case DISCONNECTING: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting"); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting"); break; case CLOSED: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed"); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed"); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown"); break; } r->stream->ReleaseFromUse(); @@ -103,13 +103,13 @@ void EQStreamIdentifier::Process() { switch(res) { case EQStream::MatchNotReady: //the stream has not received enough packets to compare with this signature -// Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); +// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); all_ready = false; break; case EQStream::MatchSuccessful: { //yay, a match. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); // before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further r->stream->SetActive(true); @@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() { } case EQStream::MatchFailed: //do nothing... - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); + Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str()); break; } } @@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() { //if we checked all patches and did not find a match. if(all_ready && !found_one) { //the stream cannot be identified. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort())); r->stream->ReleaseFromUse(); } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index e61ea8a1b..6f9611012 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -83,7 +83,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults() { log_platform = GetExecutablePlatformInt(); /* Write defaults */ - for (int i = 0; i < EQEmuLogSys::LogCategory::MaxCategoryID; i++){ + for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ log_settings[i].log_to_console = 0; log_settings[i].log_to_file = 0; log_settings[i].log_to_gmsay = 0; @@ -93,8 +93,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults() std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ std::string category_string = ""; - if (log_category > 0 && LogCategoryName[log_category]){ - category_string = StringFormat("[%s] ", LogCategoryName[log_category]); + if (log_category > 0 && Logs::LogCategoryName[log_category]){ + category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]); } return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); } @@ -106,7 +106,7 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) return; /* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */ - if (log_category == EQEmuLogSys::LogCategory::Netcode) + if (log_category == Logs::LogCategory::Netcode) return; if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ @@ -124,7 +124,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) EQEmuLogSys::SetCurrentTimeStamp(time_stamp); if (process_log){ - process_log << time_stamp << " " << StringFormat("[%s] ", LogCategoryName[log_category]).c_str() << message << std::endl; + process_log << time_stamp << " " << StringFormat("[%s] ", Logs::LogCategoryName[log_category]).c_str() << message << std::endl; } else{ // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; @@ -154,7 +154,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m //} #endif - std::cout << "[" << LogCategoryName[log_category] << "] " << message << "\n"; + std::cout << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ @@ -162,7 +162,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m #endif } -void EQEmuLogSys::Out(DebugLevel debug_level, uint16 log_category, std::string message, ...) +void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; va_start(args, message); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 3370e704f..d77ee3b6b 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -26,21 +26,18 @@ #include "types.h" -class EQEmuLogSys { -public: - EQEmuLogSys(); - ~EQEmuLogSys(); - +namespace Logs{ enum DebugLevel { General = 0, /* 0 - Low-Level general debugging, useful info on single line */ Moderate, /* 1 - Informational based, used in functions, when particular things load */ Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; - /* - If you add to this, make sure you update LogCategoryName + /* + If you add to this, make sure you update LogCategoryName NOTE: Only add to the bottom of the enum because that is the type ID assignment */ + enum LogCategory { None = 0, AA, @@ -80,9 +77,55 @@ public: MaxCategoryID /* Don't Remove this*/ }; + /* If you add to this, make sure you update LogCategory */ + static const char* LogCategoryName[LogCategory::MaxCategoryID] = { + "", + "AA", + "AI", + "Aggro", + "Attack", + "Client_Server_Packet", + "Combat", + "Commands", + "Crash", + "Debug", + "Doors", + "Error", + "Guilds", + "Inventory", + "Launcher", + "Netcode", + "Normal", + "Object", + "Pathing", + "QS_Server", + "Quests", + "Rules", + "Skills", + "Spawns", + "Spells", + "Status", + "TCP_Connection", + "Tasks", + "Tradeskills", + "Trading", + "Tribute", + "UCS_Server", + "WebInterface_Server", + "World_Server", + "Zone_Server", + }; + +} + +class EQEmuLogSys { +public: + EQEmuLogSys(); + ~EQEmuLogSys(); + void CloseFileLogs(); void LoadLogSettingsDefaults(); - void Out(DebugLevel debug_level, uint16 log_category, std::string message, ...); + void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); @@ -93,7 +136,7 @@ public: uint8 log_to_gmsay; }; - LogSettings log_settings[EQEmuLogSys::LogCategory::MaxCategoryID]; + LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; bool log_settings_loaded = false; int log_platform = 0; @@ -112,43 +155,4 @@ private: extern EQEmuLogSys Log; -/* If you add to this, make sure you update LogCategory */ -static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { - "", - "AA", - "AI", - "Aggro", - "Attack", - "Client_Server_Packet", - "Combat", - "Commands", - "Crash", - "Debug", - "Doors", - "Error", - "Guilds", - "Inventory", - "Launcher", - "Netcode", - "Normal", - "Object", - "Pathing", - "QS_Server", - "Quests", - "Rules", - "Skills", - "Spawns", - "Spells", - "Status", - "TCP_Connection", - "Tasks", - "Tradeskills", - "Trading", - "Tribute", - "UCS_Server", - "WebInterface_Server", - "World_Server", - "Zone_Server", -}; - #endif \ No newline at end of file diff --git a/common/eqtime.cpp b/common/eqtime.cpp index a047029df..dcb3db359 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename) of.open(filename); if(!of) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); + Log.Out(Logs::General, Logs::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename); return false; } //Enable for debugging @@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename) in.open(filename); if(!in) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename); + Log.Out(Logs::General, Logs::Error, "Could not load EQTime file %s", filename); return false; } in >> version; in.ignore(80, '\n'); if(version != EQT_VERSION) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); + Log.Out(Logs::General, Logs::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION); return false; } //in >> eqTime.start_eqtime.day; diff --git a/common/guild_base.cpp b/common/guild_base.cpp index fb742d487..ae653e0eb 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() { ClearGuilds(); if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object."); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to load guilds when we have no database object."); return(false); } @@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id); continue; } @@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() { bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id); return(false); } @@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to find guild %d in the database.", guild_id); return false; } @@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { uint8 rankn = atoi(row[1]); if(rankn > GUILD_MAX_RANK) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id); continue; } @@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Successfully refreshed guild %d from the database.", guild_id); return true; } @@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to store guild %d when we have no database object.", guild_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to store non-existent guild %d", guild_id); return(false); } GuildInfo *info = res->second; @@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; @@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); @@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } safe_delete_array(title_esc); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Stored guild %d in the database", guild_id); return true; } uint32 BaseGuildManager::_GetFreeGuildID() { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object."); + Log.Out(Logs::Detail, Logs::Guilds, "Requested find a free guild ID when we have no database object."); return(GUILD_NONE); } @@ -337,18 +337,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index); + Log.Out(Logs::Detail, Logs::Guilds, "Located free guild ID %d in the database", index); return index; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested."); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to find a free guild ID when requested."); return GUILD_NONE; } @@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) { //now store the resulting guild setup into the DB. if(!_StoreGuildDB(new_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); + Log.Out(Logs::Detail, Logs::Guilds, "Error storing new guild. It may have been partially created which may need manual removal."); return(GUILD_NONE); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id); + Log.Out(Logs::Detail, Logs::Guilds, "Created guild %d in the database.", new_id); return(new_id); } @@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { } if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to delete guild %d when we have no database object.", guild_id); return(false); } @@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) { query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id); QueryWithLogging(query, "deleting guild bank"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Deleted guild %d from the database.", guild_id); return(true); } bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to rename guild %d when we have no database object.", guild_id); return false; } @@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); + Log.Out(Logs::Detail, Logs::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success()); safe_delete_array(esc); return false; } safe_delete_array(esc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); + Log.Out(Logs::Detail, Logs::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name); info->name = name; //update our local record. @@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) { bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id); return false; } @@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if(!DBSetGuildRank(leader, GUILD_LEADER)) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); + Log.Out(Logs::Detail, Logs::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader); info->leader_char_id = leader; //update our local record. @@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id); return(false); } @@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; @@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c safe_delete_array(esc); safe_delete_array(esc_set); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Set MOTD for guild %d in the database", guild_id); info->motd = motd; //update our local record. info->motd_setter = setter; //update our local record. @@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID); + Log.Out(Logs::Detail, Logs::Guilds, "Set URL for guild %d in the database", GuildID); info->url = URL; //update our local record. @@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } safe_delete_array(esc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID); + Log.Out(Logs::Detail, Logs::Guilds, "Set Channel for guild %d in the database", GuildID); info->channel = Channel; //update our local record. @@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id); return(false); } @@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); + Log.Out(Logs::Detail, Logs::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank); return true; } @@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid); + Log.Out(Logs::Detail, Logs::Guilds, "Set public not for char %d", charid); return true; } @@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } @@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name); + Log.Out(Logs::Detail, Logs::Guilds, "Retreived guild member info for char %s from the database", char_name); return true; @@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { if(m_db == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id); + Log.Out(Logs::Detail, Logs::Guilds, "Requested char info on %d when we have no database object.", char_id); return false; } @@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { auto row = results.begin(); ProcessGuildMember(row, into); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id); + Log.Out(Logs::Detail, Logs::Guilds, "Retreived guild member info for char %d", char_id); return true; @@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const { bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const { if(guild_id == GUILD_NONE) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id); + Log.Out(Logs::Detail, Logs::Guilds, "Check leader for char %d: not a guild.", char_id); return(false); } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id); + Log.Out(Logs::Detail, Logs::Guilds, "Check leader for char %d: invalid guild.", char_id); return(false); //invalid guild } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); + Log.Out(Logs::Detail, Logs::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id); return(char_id == res->second->leader_char_id); } @@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { if(status >= 250) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status); return(true); //250+ as allowed anything } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status); return(false); //invalid guild } bool granted = (res->second->minstatus <= status); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s", res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied"); return(granted); @@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const { bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const { if(rank > GUILD_MAX_RANK) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid rank } std::map::const_iterator res; res = m_guilds.find(guild_id); if(res == m_guilds.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.", guild_id, rank, GuildActionNames[act], act); return(false); //invalid guild } bool granted = res->second->ranks[rank].permissions[act]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", + Log.Out(Logs::Detail, Logs::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s", res->second->name.c_str(), guild_id, res->second->ranks[rank].name.c_str(), rank, GuildActionNames[act], act, @@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/common/item.cpp b/common/item.cpp index 42885fe5a..df078491e 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst) } if (result == INVALID_INDEX) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + Log.Out(Logs::General, Logs::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); Inventory::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/misc_functions.h b/common/misc_functions.h index 2fd5b2126..346f5a753 100644 --- a/common/misc_functions.h +++ b/common/misc_functions.h @@ -40,7 +40,7 @@ #define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \ if(Packet->size != sizeof(StructName)) \ { \ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ + Log.Out(Logs::Detail, Logs::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \ DumpPacket(Packet); \ return; \ } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index a56e9a82d..33eac8c24 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -52,7 +52,7 @@ namespace RoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -316,7 +316,7 @@ namespace RoF if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -551,7 +551,7 @@ namespace RoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -585,13 +585,13 @@ namespace RoF safe_delete_array(Serialized); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -952,16 +952,16 @@ namespace RoF ENCODE(OP_GroupUpdate) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -979,7 +979,7 @@ namespace RoF return; } //if(gjs->action == groupActLeave) - // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -996,19 +996,19 @@ namespace RoF if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1016,7 +1016,7 @@ namespace RoF } } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1078,7 +1078,7 @@ namespace RoF return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1386,7 +1386,7 @@ namespace RoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2556,7 +2556,7 @@ namespace RoF outapp->WriteUInt8(0); // Unknown - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3321,7 +3321,7 @@ namespace RoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3654,16 +3654,16 @@ namespace RoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3902,9 +3902,9 @@ namespace RoF Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4298,7 +4298,7 @@ namespace RoF DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4312,7 +4312,7 @@ namespace RoF DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4326,7 +4326,7 @@ namespace RoF DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4340,7 +4340,7 @@ namespace RoF DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4353,7 +4353,7 @@ namespace RoF DECODE(OP_GroupInvite2) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4497,8 +4497,8 @@ namespace RoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoFToServerSlot(eq->from_slot); emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4827,7 +4827,7 @@ namespace RoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF::structs::ItemSerializationHeader hdr; @@ -4936,7 +4936,7 @@ namespace RoF } ss.write((const char*)&null_term, sizeof(uint8)); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF::structs::ItemBodyStruct)); RoF::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF::structs::ItemBodyStruct)); @@ -5043,7 +5043,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF::structs::ItemSecondaryBodyStruct)); RoF::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF::structs::ItemSecondaryBodyStruct)); @@ -5084,7 +5084,7 @@ namespace RoF ss.write((const char*)&null_term, sizeof(uint8)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF::structs::ItemTertiaryBodyStruct)); RoF::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF::structs::ItemTertiaryBodyStruct)); @@ -5123,7 +5123,7 @@ namespace RoF // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF::structs::ClickEffectStruct)); RoF::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF::structs::ClickEffectStruct)); @@ -5150,7 +5150,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF::structs::ProcEffectStruct)); RoF::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF::structs::ProcEffectStruct)); @@ -5174,7 +5174,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF::structs::WornEffectStruct)); RoF::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF::structs::WornEffectStruct)); @@ -5265,7 +5265,7 @@ namespace RoF ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF::structs::ItemQuaternaryBodyStruct)); RoF::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF::structs::ItemQuaternaryBodyStruct)); @@ -5455,7 +5455,7 @@ namespace RoF RoFSlot.MainSlot = TempSlot; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5496,7 +5496,7 @@ namespace RoF RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01); return RoFSlot; } @@ -5601,7 +5601,7 @@ namespace RoF ServerSlot = INVALID_INDEX; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } @@ -5636,7 +5636,7 @@ namespace RoF ServerSlot = TempSlot; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 4fba21144..7421eefbd 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -52,7 +52,7 @@ namespace RoF2 //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -78,7 +78,7 @@ namespace RoF2 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -93,10 +93,10 @@ namespace RoF2 opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -382,7 +382,7 @@ namespace RoF2 if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -617,7 +617,7 @@ namespace RoF2 if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -651,13 +651,13 @@ namespace RoF2 safe_delete_array(Serialized); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -1018,16 +1018,16 @@ namespace RoF2 ENCODE(OP_GroupUpdate) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -1045,7 +1045,7 @@ namespace RoF2 return; } //if(gjs->action == groupActLeave) - // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -1062,19 +1062,19 @@ namespace RoF2 if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -1082,7 +1082,7 @@ namespace RoF2 } } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -1144,7 +1144,7 @@ namespace RoF2 return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1452,7 +1452,7 @@ namespace RoF2 char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2640,7 +2640,7 @@ namespace RoF2 // Think we need 1 byte of padding at the end outapp->WriteUInt8(0); // Unknown - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition()); unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()]; memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition()); @@ -3387,7 +3387,7 @@ namespace RoF2 if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -3721,16 +3721,16 @@ namespace RoF2 //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer, *BufferStart; @@ -3973,9 +3973,9 @@ namespace RoF2 Buffer += 29; if (Buffer != (BufferStart + PacketSize)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); //_hex(NET__ERROR, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4370,7 +4370,7 @@ namespace RoF2 DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4384,7 +4384,7 @@ namespace RoF2 DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4398,7 +4398,7 @@ namespace RoF2 DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4412,7 +4412,7 @@ namespace RoF2 DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4425,7 +4425,7 @@ namespace RoF2 DECODE(OP_GroupInvite2) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -4568,8 +4568,8 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); @@ -4898,7 +4898,7 @@ namespace RoF2 std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name); RoF2::structs::ItemSerializationHeader hdr; @@ -5006,7 +5006,7 @@ namespace RoF2 } ss.write((const char*)&null_term, sizeof(uint8)); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody struct is %i bytes", sizeof(RoF2::structs::ItemBodyStruct)); RoF2::structs::ItemBodyStruct ibs; memset(&ibs, 0, sizeof(RoF2::structs::ItemBodyStruct)); @@ -5113,7 +5113,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody secondary struct is %i bytes", sizeof(RoF2::structs::ItemSecondaryBodyStruct)); RoF2::structs::ItemSecondaryBodyStruct isbs; memset(&isbs, 0, sizeof(RoF2::structs::ItemSecondaryBodyStruct)); @@ -5154,7 +5154,7 @@ namespace RoF2 ss.write((const char*)&null_term, sizeof(uint8)); } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody tertiary struct is %i bytes", sizeof(RoF2::structs::ItemTertiaryBodyStruct)); RoF2::structs::ItemTertiaryBodyStruct itbs; memset(&itbs, 0, sizeof(RoF2::structs::ItemTertiaryBodyStruct)); @@ -5193,7 +5193,7 @@ namespace RoF2 // Effect Structures Broken down to allow variable length strings for effect names int32 effect_unknown = 0; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody Click effect struct is %i bytes", sizeof(RoF2::structs::ClickEffectStruct)); RoF2::structs::ClickEffectStruct ices; memset(&ices, 0, sizeof(RoF2::structs::ClickEffectStruct)); @@ -5220,7 +5220,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // clickunk7 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody proc effect struct is %i bytes", sizeof(RoF2::structs::ProcEffectStruct)); RoF2::structs::ProcEffectStruct ipes; memset(&ipes, 0, sizeof(RoF2::structs::ProcEffectStruct)); @@ -5244,7 +5244,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown5 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody worn effect struct is %i bytes", sizeof(RoF2::structs::WornEffectStruct)); RoF2::structs::WornEffectStruct iwes; memset(&iwes, 0, sizeof(RoF2::structs::WornEffectStruct)); @@ -5335,7 +5335,7 @@ namespace RoF2 ss.write((const char*)&effect_unknown, sizeof(int32)); // unknown6 // End of Effects - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] ItemBody Quaternary effect struct is %i bytes", sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); RoF2::structs::ItemQuaternaryBodyStruct iqbs; memset(&iqbs, 0, sizeof(RoF2::structs::ItemQuaternaryBodyStruct)); @@ -5546,7 +5546,7 @@ namespace RoF2 RoF2Slot.MainSlot = TempSlot; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5587,7 +5587,7 @@ namespace RoF2 RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01); return RoF2Slot; } @@ -5696,7 +5696,7 @@ namespace RoF2 ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } @@ -5731,7 +5731,7 @@ namespace RoF2 ServerSlot = TempSlot; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot); return ServerSlot; } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 4881750d1..a19c4c45d 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -50,7 +50,7 @@ namespace SoD //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoD - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoD opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -247,7 +247,7 @@ namespace SoD if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -359,7 +359,7 @@ namespace SoD if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -391,13 +391,13 @@ namespace SoD } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -683,16 +683,16 @@ namespace SoD ENCODE(OP_GroupUpdate) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -710,7 +710,7 @@ namespace SoD return; } //if(gjs->action == groupActLeave) - // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -727,19 +727,19 @@ namespace SoD if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -747,7 +747,7 @@ namespace SoD } } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); char *Buffer = (char *)outapp->pBuffer; @@ -807,7 +807,7 @@ namespace SoD return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -967,7 +967,7 @@ namespace SoD char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2108,7 +2108,7 @@ namespace SoD if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2363,16 +2363,16 @@ namespace SoD //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -2963,7 +2963,7 @@ namespace SoD DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -2977,7 +2977,7 @@ namespace SoD DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -2991,7 +2991,7 @@ namespace SoD DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3005,7 +3005,7 @@ namespace SoD DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3018,7 +3018,7 @@ namespace SoD DECODE(OP_GroupInvite2) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3091,7 +3091,7 @@ namespace SoD DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoDToServerSlot(eq->from_slot); emu->to_slot = SoDToServerSlot(eq->to_slot); @@ -3384,7 +3384,7 @@ namespace SoD std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoD::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 464c40cb3..e6f804c66 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -50,7 +50,7 @@ namespace SoF //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace SoF - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace SoF opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -214,7 +214,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -337,7 +337,7 @@ namespace SoF if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -371,13 +371,13 @@ namespace SoF } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -766,7 +766,7 @@ namespace SoF char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1707,7 +1707,7 @@ namespace SoF if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1887,7 +1887,7 @@ namespace SoF //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -2096,7 +2096,7 @@ namespace SoF //kill off the emu structure and send the eq packet. delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawns"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawns"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -2429,7 +2429,7 @@ namespace SoF DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = SoFToServerSlot(eq->from_slot); emu->to_slot = SoFToServerSlot(eq->to_slot); @@ -2708,7 +2708,7 @@ namespace SoF std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name); SoF::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index 308e56191..97f824983 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -64,7 +64,7 @@ //check length of packet before decoding. Call before setup. #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -72,7 +72,7 @@ } #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ + Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ @@ -127,14 +127,14 @@ #define DECODE_LENGTH_EXACT(struct_) \ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ + Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 11adc498d..a19872c14 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -48,7 +48,7 @@ namespace Titanium //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -74,7 +74,7 @@ namespace Titanium - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -89,10 +89,10 @@ namespace Titanium opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -187,7 +187,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(BazaarSearchResults_Struct); if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; @@ -268,7 +268,7 @@ namespace Titanium int itemcount = in->size / sizeof(InternalSerializedItem_Struct); if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; return; } @@ -285,7 +285,7 @@ namespace Titanium safe_delete_array(serialized); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } @@ -635,7 +635,7 @@ namespace Titanium char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -1157,7 +1157,7 @@ namespace Titanium if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -1274,7 +1274,7 @@ namespace Titanium //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } @@ -1623,7 +1623,7 @@ namespace Titanium DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = TitaniumToServerSlot(eq->from_slot); emu->to_slot = TitaniumToServerSlot(eq->to_slot); diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 2d8feba20..8ef3f8fb7 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -50,7 +50,7 @@ namespace Underfoot //TODO: figure out how to support shared memory with multiple patches... opcodes = new RegularOpcodeManager(); if (!opcodes->LoadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name); return; } } @@ -76,7 +76,7 @@ namespace Underfoot - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } void Reload() @@ -91,10 +91,10 @@ namespace Underfoot opfile += name; opfile += ".conf"; if (!opcodes->ReloadOpcodes(opfile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); + Log.Out(Logs::General, Logs::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name); } } @@ -307,7 +307,7 @@ namespace Underfoot if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct)); delete in; return; } @@ -494,7 +494,7 @@ namespace Underfoot if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct)); delete in; @@ -526,13 +526,13 @@ namespace Underfoot safe_delete_array(Serialized); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id); } } delete[] __emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending inventory to client"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); //_hex(NET__ERROR, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); @@ -839,16 +839,16 @@ namespace Underfoot ENCODE(OP_GroupUpdate) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] OP_GroupUpdate"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] OP_GroupUpdate"); EQApplicationPacket *in = *p; GroupJoin_Struct *gjs = (GroupJoin_Struct*)in->pBuffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received outgoing OP_GroupUpdate with action code %i", gjs->action); if ((gjs->action == groupActLeave) || (gjs->action == groupActDisband)) { if ((gjs->action == groupActDisband) || !strcmp(gjs->yourname, gjs->membername)) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandYou, sizeof(structs::GroupGeneric_Struct)); @@ -867,7 +867,7 @@ namespace Underfoot return; } //if(gjs->action == groupActLeave) - // Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + // Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Group Leave, yourname = %s, membername = %s", gjs->yourname, gjs->membername); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupDisbandOther, sizeof(structs::GroupGeneric_Struct)); @@ -884,19 +884,19 @@ namespace Underfoot if (in->size == sizeof(GroupUpdate2_Struct)) { // Group Update2 - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Struct is GroupUpdate2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Struct is GroupUpdate2"); unsigned char *__emu_buffer = in->pBuffer; GroupUpdate2_Struct *gu2 = (GroupUpdate2_Struct*)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Yourname is %s", gu2->yourname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Yourname is %s", gu2->yourname); int MemberCount = 1; int PacketLength = 8 + strlen(gu2->leadersname) + 1 + 22 + strlen(gu2->yourname) + 1; for (int i = 0; i < 5; ++i) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Membername[%i] is %s", i, gu2->membername[i]); if (gu2->membername[i][0] != '\0') { PacketLength += (22 + strlen(gu2->membername[i]) + 1); @@ -904,7 +904,7 @@ namespace Underfoot } } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Leadername is %s", gu2->leadersname); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GroupUpdateB, PacketLength); @@ -964,7 +964,7 @@ namespace Underfoot delete in; return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Generic GroupUpdate, yourname = %s, membername = %s", gjs->yourname, gjs->membername); ENCODE_LENGTH_EXACT(GroupJoin_Struct); SETUP_DIRECT_ENCODE(GroupJoin_Struct, structs::GroupJoin_Struct); @@ -1190,7 +1190,7 @@ namespace Underfoot char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0); if (!serialized) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id); delete in; return; } @@ -2374,7 +2374,7 @@ namespace Underfoot if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct)); delete in; return; } @@ -2624,16 +2624,16 @@ namespace Underfoot //determine and verify length int entrycount = in->size / sizeof(Spawn_Struct); if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct)); delete in; return; } - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn name is [%s]", emu->name); emu = (Spawn_Struct *)__emu_buffer; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[STRUCTS] Spawn packet size is %i, entries = %i", in->size, entrycount); char *Buffer = (char *)in->pBuffer; @@ -3276,7 +3276,7 @@ namespace Underfoot DECODE(OP_GroupDisband) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_Disband"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -3290,7 +3290,7 @@ namespace Underfoot DECODE(OP_GroupFollow) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3304,7 +3304,7 @@ namespace Underfoot DECODE(OP_GroupFollow2) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3318,7 +3318,7 @@ namespace Underfoot DECODE(OP_GroupInvite) { //EQApplicationPacket *in = __packet; - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); //_hex(NET__ERROR, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -3331,7 +3331,7 @@ namespace Underfoot DECODE(OP_GroupInvite2) { - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite2. Forwarding"); DECODE_FORWARD(OP_GroupInvite); } @@ -3406,7 +3406,7 @@ namespace Underfoot DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); + Log.Out(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot); emu->from_slot = UnderfootToServerSlot(eq->from_slot); emu->to_slot = UnderfootToServerSlot(eq->to_slot); @@ -3629,7 +3629,7 @@ namespace Underfoot std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary); const Item_Struct *item = inst->GetUnscaledItem(); - //Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialize called for: %s", item->Name); + //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Serialize called for: %s", item->Name); Underfoot::structs::ItemSerializationHeader hdr; hdr.stacksize = stackable ? charges : 1; hdr.unknown004 = 0; diff --git a/common/ptimer.cpp b/common/ptimer.cpp index d5b31e317..76bc41419 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n"); + Log.Out(Logs::General, Logs::Error, "Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); #endif return false; } @@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { auto results = db->QueryDatabase(query); if (!results.Success()) { #if EQDEBUG > 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); #endif return false; } diff --git a/common/rulesys.cpp b/common/rulesys.cpp index e3eac0611..aeca625da 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector &into if(catname != nullptr) { cat = FindCategory(catname); if(cat == InvalidCategory) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname); + Log.Out(Logs::Detail, Logs::Rules, "Unable to find category '%s'", catname); return(false); } } @@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas switch(type) { case IntRule: m_RuleIntValues [index] = atoi(rule_value); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); + Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]); break; case RealRule: m_RuleRealValues[index] = atof(rule_value); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); + Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]); break; case BoolRule: uint32 val = 0; if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1")) val = 1; m_RuleBoolValues[index] = val; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); + Log.Out(Logs::Detail, Logs::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false"); break; } @@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas } void RuleManager::ResetRules() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values"); + Log.Out(Logs::Detail, Logs::Rules, "Resetting running rules to default values"); #define RULE_INT(cat, rule, default_value) \ m_RuleIntValues[ Int__##rule ] = default_value; #define RULE_REAL(cat, rule, default_value) \ @@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 & return(true); } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name); + Log.Out(Logs::Detail, Logs::Rules, "Unable to find rule '%s'", rule_name); return(false); } @@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) { m_activeRuleset = _FindOrCreateRuleset(db, ruleset); if(m_activeRuleset == -1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset); + Log.Out(Logs::Detail, Logs::Rules, "Unable to find or create rule set %s", ruleset); return; } m_activeName = ruleset; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); + Log.Out(Logs::Detail, Logs::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); + Log.Out(Logs::Detail, Logs::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset); } int r; @@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { int rsid = GetRulesetID(db, ruleset); if(rsid < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); + Log.Out(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset); return(false); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); + Log.Out(Logs::Detail, Logs::Rules, "Loading rule set '%s' (%d)", ruleset, rsid); m_activeRuleset = rsid; m_activeName = ruleset; @@ -282,13 +282,13 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } for(auto row = results.begin(); row != results.end(); ++row) if(!SetRule(row[0], row[1], nullptr, false)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]); + Log.Out(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]); return true; } @@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } @@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 64b94657c..785888ff5 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } @@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { "FROM sharedbank WHERE acctid=%i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str()); return false; } @@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(Logs::General, Logs::Error, "Warning: %s %i has an invalid item_id %i in inventory slot %i", ((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id); continue; @@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { if (put_slot_id != INVALID_INDEX) continue; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", ((is_charid==true)? "charid": "acctid"), id, item_id, slot_id); if (is_charid) @@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Out(Logs::General, Logs::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { const Item_Struct* item = GetItem(item_id); if (!item) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); + Log.Out(Logs::General, Logs::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id); continue; } @@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); + Log.Out(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else @@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); + Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id); } } @@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); + Log.Out(Logs::General, Logs::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } @@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); + Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id); } @@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() { items_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what()); return false; } @@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Database::LoadItems: %s", ex.what()); break; } } @@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile) } if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile); + Log.Out(Logs::General, Logs::Error, "No book to send, (%s)", txtfile); txtout.assign(" ",1); return txtout; } @@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() { faction_hash = new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), size); mutex.Unlock(); } catch(std::exception& ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error Loading npc factions: %s", ex.what()); return false; } @@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()"); + Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges) inst = new ItemInst(item, charges); if (inst == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()"); + Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); return nullptr; } @@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() { mutex.Unlock(); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error loading skill caps: %s", ex.what()); return false; } @@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); return; } @@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + Log.Out(Logs::Detail, Logs::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); return; } @@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + Log.Out(Logs::Detail, Logs::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); continue; } @@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() { mutex.Unlock(); } catch(std::exception& ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error Loading Base Data: %s", ex.what()); return false; } @@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring."); + Log.Out(Logs::General, Logs::Error, "Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + Log.Out(Logs::General, Logs::Error, "Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + Log.Out(Logs::General, Logs::Error, "Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring."); + Log.Out(Logs::General, Logs::Error, "Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; @@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() { loot_drop_mmf->Size()); mutex.Unlock(); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error loading loot: %s", ex.what()); return false; } @@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Could not get loot table: %s", ex.what()); } return nullptr; } @@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Could not get loot drop: %s", ex.what()); } return nullptr; } diff --git a/common/spdat.cpp b/common/spdat.cpp index a6b17e449..3bbca4af2 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + Log.Out(Logs::Detail, Logs::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 6e1eb038a..8df723f6b 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo EQApplicationPacket *p = *in_p; *in_p = nullptr; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode())); delete p; } void StructStrategy::ErrorDecoder(EQApplicationPacket *p) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); + Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode())); p->SetOpcode(OP_Unknown); } diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 924fef2f2..58ea11822 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index b85e78ae5..cfde2f24e 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { BaseTCPServer* tcps = (BaseTCPServer*) tmp; #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Starting TCPServerLoop with thread ID %d", pthread_self()); #endif tcps->MLoopRunning.lock(); @@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) { tcps->MLoopRunning.unlock(); #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Ending TCPServerLoop with thread ID %d", pthread_self()); #endif THREAD_RETURN(nullptr); diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index 3bd4c9942..b7be6ee98 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() { Timeoutable *it = *cur; if(it->next_check.Check()) { #ifdef TIMEOUT_DEBUG - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it); + Log.Out(Logs::General, Logs::None,, "Checking timeout on 0x%x\n", it); #endif it->CheckTimeout(); } @@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) { DeleteMember(who); //just in case... prolly not needed. members.push_back(who); #ifdef TIMEOUT_DEBUG - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who); + Log.Out(Logs::General, Logs::None,, "Adding timeoutable 0x%x\n", who); #endif } void TimeoutManager::DeleteMember(Timeoutable *who) { #ifdef TIMEOUT_DEBUG - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who); + Log.Out(Logs::General, Logs::None,, "Removing timeoutable 0x%x\n", who); #endif std::vector::iterator cur,end; cur = members.begin(); diff --git a/common/worldconn.cpp b/common/worldconn.cpp index 33fc2f7d3..81b281174 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) { void WorldConnection::OnConnected() { const EQEmuConfig *Config=EQEmuConfig::get(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); + Log.Out(Logs::General, Logs::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16); MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer); @@ -76,7 +76,7 @@ bool WorldConnection::Connect() { if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) { return true; } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); + Log.Out(Logs::General, Logs::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf); } return false; } diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 4c2f3fdd9..6af623b5f 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -47,13 +47,13 @@ int main(int argc, char *argv[]) { launcher_name = argv[1]; } if(launcher_name.length() < 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "You must specfify a launcher name as the first argument to this program."); + Log.Out(Logs::Detail, Logs::Launcher, "You must specfify a launcher name as the first argument to this program."); return 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration.."); + Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration.."); if (!EQEmuConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Loading server configuration failed."); + Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration failed."); return 1; } const EQEmuConfig *Config = EQEmuConfig::get(); @@ -62,16 +62,16 @@ int main(int argc, char *argv[]) { * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::Launcher, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::Launcher, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::Launcher, "Could not set signal handler"); return 1; } @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { std::map zones; WorldServer world(zones, launcher_name.c_str(), Config); if (!world.Connect()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "worldserver.Connect() FAILED! Will retry."); + Log.Out(Logs::Detail, Logs::Launcher, "worldserver.Connect() FAILED! Will retry."); } std::map::iterator zone, zend; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting main loop..."); + Log.Out(Logs::Detail, Logs::Launcher, "Starting main loop..."); // zones["test"] = new ZoneLaunch(&world, "./zone", "dynamic_1"); @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { void CatchSignal(int sig_num) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Caught signal %d", sig_num); + Log.Out(Logs::Detail, Logs::Launcher, "Caught signal %d", sig_num); RunLoops = false; } diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index 799cbd4ee..b9c7d6b91 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -74,14 +74,14 @@ void WorldServer::Process() { break; } case ServerOP_ZAAuthFailed: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World server responded 'Not Authorized', disabling reconnect"); + Log.Out(Logs::Detail, Logs::Launcher, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; } case ServerOP_LauncherZoneRequest: { if(pack->size != sizeof(LauncherZoneRequest)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); + Log.Out(Logs::Detail, Logs::Launcher, "Invalid size of LauncherZoneRequest: %d", pack->size); break; } const LauncherZoneRequest *lzr = (const LauncherZoneRequest *) pack->pBuffer; @@ -90,9 +90,9 @@ void WorldServer::Process() { switch(ZoneRequestCommands(lzr->command)) { case ZR_Start: { if(m_zones.find(lzr->short_name) != m_zones.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s, but it is already running.", lzr->short_name); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to start zone %s.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to start zone %s.", lzr->short_name); ZoneLaunch *l = new ZoneLaunch(this, m_name, lzr->short_name, m_config); m_zones[lzr->short_name] = l; } @@ -101,9 +101,9 @@ void WorldServer::Process() { case ZR_Restart: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to restart zone %s, but it is not running.", lzr->short_name); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to restart zone %s.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to restart zone %s.", lzr->short_name); res->second->Restart(); } break; @@ -111,9 +111,9 @@ void WorldServer::Process() { case ZR_Stop: { std::map::iterator res = m_zones.find(lzr->short_name); if(res == m_zones.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to stop zone %s, but it is not running.", lzr->short_name); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "World told us to stop zone %s.", lzr->short_name); + Log.Out(Logs::Detail, Logs::Launcher, "World told us to stop zone %s.", lzr->short_name); res->second->Stop(); } break; @@ -127,7 +127,7 @@ void WorldServer::Process() { } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); + Log.Out(Logs::Detail, Logs::Launcher, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); break; } } diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index d9e92b8cd..7e211fb88 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -72,7 +72,7 @@ void ZoneLaunch::Start() { //spec is consumed, even on failure m_ref = ProcLauncher::get()->Launch(spec); if(m_ref == ProcLauncher::ProcError) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); + Log.Out(Logs::Detail, Logs::Launcher, "Failure to launch '%s %s %s'. ", m_config->ZoneExe.c_str(), m_zone.c_str(), m_launcherName); m_timer.Start(m_config->RestartWait); return; } @@ -84,17 +84,17 @@ void ZoneLaunch::Start() { SendStatus(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has been started.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s has been started.", m_zone.c_str()); } void ZoneLaunch::Restart() { switch(m_state) { case StateRestartPending: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Restart of zone %s requested when a restart is already pending.", m_zone.c_str()); break; case StateStartPending: //we havent started yet, do nothing - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Restart of %s before it has started. Ignoring.", m_zone.c_str()); break; case StateStarted: //process is running along, kill it off.. @@ -102,20 +102,20 @@ void ZoneLaunch::Restart() { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, true)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateRestartPending; break; case StateStopPending: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Restart of zone %s requested when a stop is pending. Ignoring.", m_zone.c_str()); break; case StateStopped: //process is already stopped... nothing to do.. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Restart requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -124,7 +124,7 @@ void ZoneLaunch::Stop(bool graceful) { switch(m_state) { case StateStartPending: //we havent started yet, transition directly to stopped. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Stopping zone %s before it has started.", m_zone.c_str()); m_state = StateStopped; break; case StateStarted: @@ -134,17 +134,17 @@ void ZoneLaunch::Stop(bool graceful) { break; //we have no proc ref... cannot stop.. if(!ProcLauncher::get()->Terminate(m_ref, graceful)) { //failed to terminate the process, its not likely that it will work if we try again, so give up. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Failed to terminate zone %s. Giving up and moving to stopped.", m_zone.c_str()); m_state = StateStopped; break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Termination signal sent to zone %s.", m_zone.c_str()); m_timer.Start(m_config->TerminateWait); m_state = StateStopPending; break; case StateStopped: //process is already stopped... nothing to do.. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Stop requested when zone %s is already stopped.", m_zone.c_str()); break; } } @@ -164,17 +164,17 @@ bool ZoneLaunch::Process() { m_timer.Disable(); //actually start up the program - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Starting zone %s", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Starting zone %s", m_zone.c_str()); Start(); //now update the shared timer to reflect the proper start interval. if(s_running == 1) { //we are the first zone started. wait that interval. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); + Log.Out(Logs::Detail, Logs::Launcher, "Waiting %d milliseconds before booting the second zone.", m_config->InitialBootWait); s_startTimer.Start(m_config->InitialBootWait); } else { //just some follow on zone, use that interval. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); + Log.Out(Logs::Detail, Logs::Launcher, "Waiting %d milliseconds before booting the next zone.", m_config->ZoneBootInterval); s_startTimer.Start(m_config->ZoneBootInterval); } @@ -187,7 +187,7 @@ bool ZoneLaunch::Process() { //waiting for notification that our child has died.. if(m_timer.Check()) { //we have timed out, try to kill the child again - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Restart(); } break; @@ -197,12 +197,12 @@ bool ZoneLaunch::Process() { //we have timed out, try to kill the child again m_killFails++; if(m_killFails > 5) { //should get this number from somewhere.. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s refused to die, giving up and acting like its dead.", m_zone.c_str()); m_state = StateStopped; s_running--; SendStatus(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s refused to die, killing again.", m_zone.c_str()); Stop(false); } } @@ -221,29 +221,29 @@ void ZoneLaunch::OnTerminate(const ProcLauncher::ProcRef &ref, const ProcLaunche switch(m_state) { case StateStartPending: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s has gone down before we started it..?? Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateStarted: //something happened to our happy process... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s has gone down. Restart timer started.", m_zone.c_str()); m_state = StateStartPending; m_timer.Start(m_config->RestartWait); break; case StateRestartPending: //it finally died, start it on up again - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s has terminated. Transitioning to starting state.", m_zone.c_str()); m_state = StateStartPending; break; case StateStopPending: //it finally died, transition to close. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Zone %s has terminated. Transitioning to stopped state.", m_zone.c_str()); m_state = StateStopped; break; case StateStopped: //we already thought it was stopped... dont care... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); + Log.Out(Logs::Detail, Logs::Launcher, "Notified of zone %s terminating when we thought it was stopped.", m_zone.c_str()); break; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 5041eb410..b6c44f573 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -116,8 +116,8 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, safe_delete_array(escapedMessage); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Speech Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } @@ -136,8 +136,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->char2_money.silver, QS->char2_money.copper, QS->char2_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Trade Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -156,8 +156,8 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Trade Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -179,8 +179,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->npc_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Handin Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(detailCount == 0) @@ -198,8 +198,8 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) QS->items[i].aug_2, QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Handin Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -213,8 +213,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ QS->s1.NPCID, QS->s1.Type, QS->s1.ZoneID); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed NPC Kill Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(members == 0) @@ -228,8 +228,8 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ lastIndex, QS->Chars[i].char_id); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed NPC Kill Log Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -243,8 +243,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->char_id, QS->stack_size, QS->char_count, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -261,8 +261,8 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Delete Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -279,8 +279,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->char_count, QS->postaction); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Move Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -297,8 +297,8 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { QS->items[i].aug_3, QS->items[i].aug_4, QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Move Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -320,8 +320,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->char_money.copper, QS->char_count); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Transaction Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } if(items == 0) @@ -338,8 +338,8 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 QS->items[i].aug_5); results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Transaction Log Record Entry Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } } @@ -356,8 +356,8 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { std::string query(queryBuffer); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "%s", query.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed Delete Log Record Insert: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "%s", query.c_str()); } safe_delete(pack); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index e802f493f..dbfb4e314 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,7 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -242,7 +242,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -257,7 +257,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -288,7 +288,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); @@ -305,7 +305,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -335,7 +335,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } @@ -348,7 +348,7 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 79003a2bd..f5233c29e 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -65,16 +65,16 @@ int main() { */ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Starting EQEmu QueryServ."); + Log.Out(Logs::Detail, Logs::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Loading server configuration failed."); + Log.Out(Logs::Detail, Logs::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connecting to MySQL..."); + Log.Out(Logs::Detail, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!database.Connect( @@ -83,22 +83,22 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); return 1; } /* Initialize Logging */ if (!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); return 1; } diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 1e6013696..32e8756ef 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -53,7 +53,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Connected to World."); + Log.Out(Logs::Detail, Logs::QS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -66,7 +66,7 @@ void WorldServer::Process() ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received Opcode: %4X", pack->opcode); + Log.Out(Logs::Detail, Logs::QS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { case 0: { break; @@ -148,7 +148,7 @@ void WorldServer::Process() break; } default: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); + Log.Out(Logs::Detail, Logs::QS_Server, "Received unhandled ServerOP_QueryServGeneric", Type); break; } break; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 8fbd296e7..dc2817f9a 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -40,22 +40,22 @@ int main(int argc, char **argv) { Log.LoadLogSettingsDefaults(); set_exception_handler(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Shared Memory Loader Program"); + Log.Out(Logs::General, Logs::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load configuration file."); + Log.Out(Logs::General, Logs::Error, "Unable to load configuration file."); return 1; } const EQEmuConfig *config = EQEmuConfig::get(); if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); + Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); } SharedDatabase database; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Connecting to database..."); + Log.Out(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(), config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a " + Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -114,61 +114,61 @@ int main(int argc, char **argv) { } if(load_all || load_items) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading items..."); + Log.Out(Logs::General, Logs::Status, "Loading items..."); try { LoadItems(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } if(load_all || load_factions) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading factions..."); + Log.Out(Logs::General, Logs::Status, "Loading factions..."); try { LoadFactions(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } if(load_all || load_loot) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading loot..."); + Log.Out(Logs::General, Logs::Status, "Loading loot..."); try { LoadLoot(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } if(load_all || load_skill_caps) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading skill caps..."); + Log.Out(Logs::General, Logs::Status, "Loading skill caps..."); try { LoadSkillCaps(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } if(load_all || load_spells) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spells..."); + Log.Out(Logs::General, Logs::Status, "Loading spells..."); try { LoadSpells(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } if(load_all || load_bd) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading base data..."); + Log.Out(Logs::General, Logs::Status, "Loading base data..."); try { LoadBaseData(&database); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s", ex.what()); + Log.Out(Logs::General, Logs::Error, "%s", ex.what()); return 1; } } diff --git a/ucs/chatchannel.cpp b/ucs/chatchannel.cpp index 0ee80510f..890d3d908 100644 --- a/ucs/chatchannel.cpp +++ b/ucs/chatchannel.cpp @@ -42,7 +42,7 @@ ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string in Moderated = false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", + Log.Out(Logs::Detail, Logs::UCS_Server, "New ChatChannel created: Name: [%s], Owner: [%s], Password: [%s], MinStatus: %i", Name.c_str(), Owner.c_str(), Password.c_str(), MinimumStatus); } @@ -149,7 +149,7 @@ void ChatChannelList::SendAllChannels(Client *c) { void ChatChannelList::RemoveChannel(ChatChannel *Channel) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveChannel(%s)", Channel->GetName().c_str()); LinkedListIterator iterator(ChatChannels); @@ -170,7 +170,7 @@ void ChatChannelList::RemoveChannel(ChatChannel *Channel) { void ChatChannelList::RemoveAllChannels() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveAllChannels"); + Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveAllChannels"); LinkedListIterator iterator(ChatChannels); @@ -228,7 +228,7 @@ void ChatChannel::AddClient(Client *c) { if(IsClientInChannel(c)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Client %s already in channel %s", c->GetName().c_str(), GetName().c_str()); return; } @@ -237,7 +237,7 @@ void ChatChannel::AddClient(Client *c) { int AccountStatus = c->GetAccountStatus(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Adding %s to channel %s", c->GetName().c_str(), Name.c_str()); LinkedListIterator iterator(ClientsInChannel); @@ -262,7 +262,7 @@ bool ChatChannel::RemoveClient(Client *c) { if(!c) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str()); bool HideMe = c->GetHideMe(); @@ -299,7 +299,7 @@ bool ChatChannel::RemoveClient(Client *c) { if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0)) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Starting delete timer for empty password protected channel %s", Name.c_str()); DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000); } @@ -397,7 +397,7 @@ void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) { if(ChannelClient) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sending message to %s from %s", + Log.Out(Logs::Detail, Logs::UCS_Server, "Sending message to %s from %s", ChannelClient->GetName().c_str(), Sender->GetName().c_str()); ChannelClient->SendChannelMessage(Name, Message, Sender); } @@ -479,7 +479,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client return nullptr; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str()); ChatChannel *RequiredChannel = FindChannel(NormalisedName); @@ -555,7 +555,7 @@ void ChatChannelList::Process() { if(CurrentChannel && CurrentChannel->ReadyToDelete()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Empty temporary password protected channel %s being destroyed.", + Log.Out(Logs::Detail, Logs::UCS_Server, "Empty temporary password protected channel %s being destroyed.", CurrentChannel->GetName().c_str()); RemoveChannel(CurrentChannel); @@ -572,7 +572,7 @@ void ChatChannel::AddInvitee(std::string Invitee) { Invitees.push_back(Invitee); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); } } @@ -587,7 +587,7 @@ void ChatChannel::RemoveInvitee(std::string Invitee) { Invitees.erase(Iterator); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as invitee to channel %s", Invitee.c_str(), Name.c_str()); return; } @@ -613,7 +613,7 @@ void ChatChannel::AddModerator(std::string Moderator) { Moderators.push_back(Moderator); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); } } @@ -628,7 +628,7 @@ void ChatChannel::RemoveModerator(std::string Moderator) { Moderators.erase(Iterator); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as moderator to channel %s", Moderator.c_str(), Name.c_str()); return; } @@ -654,7 +654,7 @@ void ChatChannel::AddVoice(std::string inVoiced) { Voiced.push_back(inVoiced); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); } } @@ -669,7 +669,7 @@ void ChatChannel::RemoveVoice(std::string inVoiced) { Voiced.erase(Iterator); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removed %s as voiced to channel %s", inVoiced.c_str(), Name.c_str()); return; } diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index 4aaa4c748..e665cc8fd 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -236,7 +236,7 @@ std::vector ParseRecipients(std::string RecipientString) { static void ProcessMailTo(Client *c, std::string MailMessage) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "MAILTO: From %s, %s", c->MailBoxName().c_str(), MailMessage.c_str()); std::vector Recipients; @@ -305,7 +305,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { if (!database.SendMail(Recipient, c->MailBoxName(), Subject, Body, RecipientsString)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), + Log.Out(Logs::Detail, Logs::UCS_Server, "Failed in SendMail(%s, %s, %s, %s)", Recipient.c_str(), c->MailBoxName().c_str(), Subject.c_str(), RecipientsString.c_str()); int PacketLength = 10 + Recipient.length() + Subject.length(); @@ -400,7 +400,7 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) { static void ProcessCommandBuddy(Client *c, std::string Buddy) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Received buddy command with parameters %s", Buddy.c_str()); c->GeneralChannelMessage("Buddy list modified"); uint8 SubAction = 1; @@ -430,7 +430,7 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { static void ProcessCommandIgnore(Client *c, std::string Ignoree) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Received ignore command with parameters %s", Ignoree.c_str()); c->GeneralChannelMessage("Ignore list modified"); uint8 SubAction = 0; @@ -481,9 +481,9 @@ Clientlist::Clientlist(int ChatPort) { exit(1); if (chatsf->Open()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); + Log.Out(Logs::Detail, Logs::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort); else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); + Log.Out(Logs::Detail, Logs::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort); exit(1); } @@ -560,13 +560,13 @@ void Clientlist::CheckForStaleConnections(Client *c) { if(((*Iterator) != c) && ((c->GetName() == (*Iterator)->GetName()) && (c->GetConnectionType() == (*Iterator)->GetConnectionType()))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removing old connection for %s", c->GetName().c_str()); struct in_addr in; in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.Out(Logs::Detail, Logs::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -586,7 +586,7 @@ void Clientlist::Process() { in.s_addr = eqs->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); + Log.Out(Logs::Detail, Logs::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in), ntohs(eqs->GetRemotePort())); eqs->SetOpcodeManager(&ChatOpMgr); @@ -606,7 +606,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), + Log.Out(Logs::Detail, Logs::UCS_Server, "Client connection from %s:%d closed.", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort())); safe_delete((*Iterator)); @@ -646,7 +646,7 @@ void Clientlist::Process() { if(strlen(PacketBuffer) != 9) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Mail key is the wrong size. Version of world incompatible with UCS."); KeyValid = false; break; } @@ -667,11 +667,11 @@ void Clientlist::Process() { else CharacterName = MailBoxString.substr(LastPeriod + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received login for user %s with key %s", MailBox, Key); + Log.Out(Logs::Detail, Logs::UCS_Server, "Received login for user %s with key %s", MailBox, Key); if(!database.VerifyMailKey(CharacterName, (*Iterator)->ClientStream->GetRemoteIP(), Key)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); + Log.Out(Logs::Detail, Logs::UCS_Server, "Chat Key for %s does not match, closing connection.", MailBox); KeyValid = false; @@ -703,7 +703,7 @@ void Clientlist::Process() { default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled chat opcode %8X", opcode); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unhandled chat opcode %8X", opcode); break; } } @@ -716,7 +716,7 @@ void Clientlist::Process() { in.s_addr = (*Iterator)->ClientStream->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", + Log.Out(Logs::Detail, Logs::UCS_Server, "Force disconnecting client: %s:%d, KeyValid=%i, GetForceDisconnect()=%i", inet_ntoa(in), ntohs((*Iterator)->ClientStream->GetRemotePort()), KeyValid, (*Iterator)->GetForceDisconnect()); @@ -860,7 +860,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) break; case CommandSetMessageStatus: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Set Message Status, Params: %s", Parameters.c_str()); ProcessSetMessageStatus(Parameters); break; @@ -885,7 +885,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string CommandString) default: c->SendHelp(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unhandled OP_Mail command: %s", CommandString.c_str()); } } @@ -896,7 +896,7 @@ void Clientlist::CloseAllConnections() { for(Iterator = ClientChatConnections.begin(); Iterator != ClientChatConnections.end(); ++Iterator) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removing client %s", (*Iterator)->GetName().c_str()); (*Iterator)->CloseConnection(); } @@ -905,7 +905,7 @@ void Clientlist::CloseAllConnections() { void Client::AddCharacter(int CharID, const char *CharacterName, int Level) { if(!CharacterName) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Adding character %s with ID %i for %s", CharacterName, CharID, GetName().c_str()); CharacterEntry NewCharacter; NewCharacter.CharID = CharID; NewCharacter.Name = CharacterName; @@ -971,7 +971,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) { for(int i = 0; i < MAX_JOINED_CHANNELS; i++) if(JoinedChannels[i] == nullptr) { JoinedChannels[i] = JoinedChannel; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str()); return; } } @@ -1012,7 +1012,7 @@ void Client::JoinChannels(std::string ChannelNameList) { } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Client: %s joining channels %s", GetName().c_str(), ChannelNameList.c_str()); int NumberOfChannels = ChannelCount(); @@ -1113,7 +1113,7 @@ void Client::JoinChannels(std::string ChannelNameList) { void Client::LeaveChannels(std::string ChannelNameList) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Client: %s leaving channels %s", GetName().c_str(), ChannelNameList.c_str()); std::string::size_type CurrentPos = 0; @@ -1292,7 +1292,7 @@ void Client::SendChannelMessage(std::string Message) std::string ChannelName = Message.substr(1, MessageStart-1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), ChannelName.c_str(), Message.substr(MessageStart + 1).c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1435,7 +1435,7 @@ void Client::SendChannelMessageByNumber(std::string Message) { } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), + Log.Out(Logs::Detail, Logs::UCS_Server, "%s tells %s, [%s]", GetName().c_str(), RequiredChannel->GetName().c_str(), Message.substr(MessageStart + 1).c_str()); if(RuleB(Chat, EnableAntiSpam)) @@ -1647,7 +1647,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) { else Message = "Password change on channel " + ChannelName; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Set password of channel [%s] to [%s] by %s", ChannelName.c_str(), Password.c_str(), GetName().c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1702,7 +1702,7 @@ void Client::SetChannelOwner(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Set owner of channel [%s] to [%s]", ChannelName.c_str(), NewOwner.c_str()); ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName); @@ -1790,7 +1790,7 @@ void Client::ChannelInvite(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "[%s] invites [%s] to channel [%s]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Invitee); @@ -1918,7 +1918,7 @@ void Client::ChannelGrantModerator(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "[%s] gives [%s] moderator rights to channel [%s]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Moderator); @@ -1999,7 +1999,7 @@ void Client::ChannelGrantVoice(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "[%s] gives [%s] voice to channel [%s]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Voicee); @@ -2087,7 +2087,7 @@ void Client::ChannelKick(std::string CommandString) { if((ChannelName.length() > 0) && isdigit(ChannelName[0])) ChannelName = ChannelSlotName(atoi(ChannelName.c_str())); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "[%s] kicks [%s] from channel [%s]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str()); Client *RequiredClient = CL->FindCharacter(Kickee); @@ -2196,32 +2196,32 @@ void Client::SetConnectionType(char c) { case 'S': { TypeOfConnection = ConnectionTypeCombined; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (SoF/SoD)"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connection type is Combined (SoF/SoD)"); break; } case 'U': { TypeOfConnection = ConnectionTypeCombined; UnderfootOrLater = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Combined (Underfoot+)"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connection type is Combined (Underfoot+)"); break; } case 'M': { TypeOfConnection = ConnectionTypeMail; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connection type is Mail (6.2 or Titanium client)"); break; } case 'C': { TypeOfConnection = ConnectionTypeChat; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connection type is Chat (6.2 or Titanium client)"); break; } default: { TypeOfConnection = ConnectionTypeUnknown; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connection type is unknown."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connection type is unknown."); } } } @@ -2299,11 +2299,11 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin void Client::ChangeMailBox(int NewMailBox) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); + Log.Out(Logs::Detail, Logs::UCS_Server, "%s Change to mailbox %i", MailBoxName().c_str(), NewMailBox); SetMailBox(NewMailBox); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "New mailbox is %s", MailBoxName().c_str()); auto outapp = new EQApplicationPacket(OP_MailboxChange, 2); @@ -2377,13 +2377,13 @@ std::string Client::MailBoxName() { if((Characters.size() == 0) || (CurrentMailBox > (Characters.size() - 1))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.Out(Logs::Detail, Logs::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return ""; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", + Log.Out(Logs::Detail, Logs::UCS_Server, "MailBoxName() called with CurrentMailBox set to %i and Characters.size() is %i", CurrentMailBox, Characters.size()); return Characters[CurrentMailBox].Name; diff --git a/ucs/database.cpp b/ucs/database.cpp index ee09dc7c2..cb7bd3d51 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf); + Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); HandleMysqlError(errnum); return false; } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port); return true; } } @@ -110,15 +110,15 @@ void Database::GetAccountStatus(Client *client) { client->GetAccountID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get account status for character %s, error %s", client->GetName().c_str(), results.ErrorMessage().c_str()); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "GetAccountStatus Query: %s", query.c_str()); if(results.RowCount() != 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error in GetAccountStatus"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error in GetAccountStatus"); return; } @@ -129,13 +129,13 @@ void Database::GetAccountStatus(Client *client) { client->SetKarma(atoi(row[2])); client->SetRevoked((atoi(row[3])==1?true:false)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Set account status to %i, hideme to %i and karma to %i for %s", client->GetAccountStatus(), client->GetHideMe(), client->GetKarma(), client->GetName().c_str()); } int Database::FindAccount(const char *characterName, Client *client) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount for character %s", characterName); + Log.Out(Logs::Detail, Logs::UCS_Server, "FindAccount for character %s", characterName); client->ClearCharacters(); @@ -144,12 +144,12 @@ int Database::FindAccount(const char *characterName, Client *client) { characterName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindAccount query failed: %s", query.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "FindAccount query failed: %s", query.c_str()); return -1; } if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from query"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Bad result from query"); return -1; } @@ -158,7 +158,7 @@ int Database::FindAccount(const char *characterName, Client *client) { int accountID = atoi(row[1]); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Account ID for %s is %i", characterName, accountID); + Log.Out(Logs::Detail, Logs::UCS_Server, "Account ID for %s is %i", characterName, accountID); query = StringFormat("SELECT `id`, `name`, `level` FROM `character_data` " "WHERE `account_id` = %i AND `name` != '%s'", @@ -179,7 +179,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri characterName.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str()); return false; } @@ -195,7 +195,7 @@ bool Database::VerifyMailKey(std::string characterName, int IPAddress, std::stri else sprintf(combinedKey, "%s", MailKey.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); + Log.Out(Logs::Detail, Logs::UCS_Server, "DB key is [%s], Client key is [%s]", row[0], combinedKey); return !strcmp(row[0], combinedKey); } @@ -206,14 +206,14 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } safe_delete(safeCharName); if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); + Log.Out(Logs::Detail, Logs::UCS_Server, "Bad result from FindCharacter query for character %s", characterName); return -1; } @@ -229,7 +229,7 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -245,12 +245,12 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ bool Database::LoadChatChannels() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading chat channels from the database."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Loading chat channels from the database."); const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -267,25 +267,25 @@ bool Database::LoadChatChannels() { void Database::SetChannelPassword(std::string channelName, std::string password) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Database::SetChannelPassword(%s, %s)", channelName.c_str(), password.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::SetChannelOwner(std::string channelName, std::string owner) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Database::SetChannelOwner(%s, %s)", channelName.c_str(), owner.c_str()); std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -295,7 +295,7 @@ void Database::SendHeaders(Client *client) { int unknownField3 = 1; int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); + Log.Out(Logs::Detail, Logs::UCS_Server, "Sendheaders for %s, CharID is %i", client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -382,7 +382,7 @@ void Database::SendBody(Client *client, int messageNumber) { int characterID = FindCharacter(client->MailBoxName().c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); + Log.Out(Logs::Detail, Logs::UCS_Server, "SendBody: MsgID %i, to %s, CharID is %i", messageNumber, client->MailBoxName().c_str(), characterID); if(characterID <= 0) return; @@ -399,7 +399,7 @@ void Database::SendBody(Client *client, int messageNumber) { auto row = results.begin(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); + Log.Out(Logs::Detail, Logs::UCS_Server, "Message: %i body (%i bytes)", messageNumber, strlen(row[1])); int packetLength = 12 + strlen(row[0]) + strlen(row[1]) + strlen(row[2]); @@ -445,7 +445,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub characterID = FindCharacter(characterName.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); + Log.Out(Logs::Detail, Logs::UCS_Server, "SendMail: CharacterID for recipient %s is %i", characterName.c_str(), characterID); if(characterID <= 0) return false; @@ -467,11 +467,11 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "MessageID %i generated, from %s, to %s", results.LastInsertedID(), from.c_str(), recipient.c_str()); Client *client = CL->IsCharacterOnline(characterName); @@ -488,7 +488,7 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub void Database::SetMessageStatus(int messageNumber, int status) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); + Log.Out(Logs::Detail, Logs::UCS_Server, "SetMessageStatus %i %i", messageNumber, status); if(status == 0) { std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber); @@ -499,24 +499,24 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } void Database::ExpireMail() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expiring mail..."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Expiring mail..."); std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } auto row = results.begin(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "There are %s messages in the database.", row[0]); + Log.Out(Logs::Detail, Logs::UCS_Server, "There are %s messages in the database.", row[0]); // Expire Trash if(RuleI(Mail, ExpireTrash) >= 0) { @@ -524,9 +524,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireTrash)); results = QueryDatabase(query); if(results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -536,9 +536,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireRead)); results = QueryDatabase(query); if(results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i read messages.", results.RowsAffected()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread @@ -547,9 +547,9 @@ void Database::ExpireMail() { time(nullptr) - RuleI(Mail, ExpireUnread)); results = QueryDatabase(query); if(results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } @@ -560,9 +560,9 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } @@ -573,9 +573,9 @@ void Database::RemoveFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Error removing friend/ignore, query was %s", query.c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Removed Friend/Ignore entry for charid %i, type %i, name %s from database.", charID, type, name.c_str()); } @@ -584,7 +584,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -595,12 +595,12 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends if(atoi(row[0]) == 0) { ignorees.push_back(name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Ignoree from DB %s", name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added Ignoree from DB %s", name.c_str()); continue; } friends.push_back(name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Added Friend from DB %s", name.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Added Friend from DB %s", name.c_str()); } } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index c51d1e0dd..241d50775 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,11 +78,11 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Starting EQEmu Universal Chat Server."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loading server configuration failed."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Loading server configuration failed."); return 1; } @@ -90,13 +90,13 @@ int main() { Config = ucsconfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); WorldShortName = Config->ShortName; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connecting to MySQL..."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -104,22 +104,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::Detail, Logs::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(Logs::Detail, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "No rule set configured, using default rules"); + Log.Out(Logs::Detail, Logs::UCS_Server, "No rule set configured, using default rules"); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::Detail, Logs::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -127,7 +127,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + Log.Out(Logs::Detail, Logs::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -138,11 +138,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::UCS_Server, "Could not set signal handler"); return 1; } diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 2d05d753d..67bc81987 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -52,7 +52,7 @@ WorldServer::~WorldServer() void WorldServer::OnConnected() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Connected to World."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Connected to World."); WorldConnection::OnConnected(); } @@ -67,7 +67,7 @@ void WorldServer::Process() while((pack = tcpc.PopPacket())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Received Opcode: %4X", pack->opcode); + Log.Out(Logs::Detail, Logs::UCS_Server, "Received Opcode: %4X", pack->opcode); switch(pack->opcode) { @@ -88,7 +88,7 @@ void WorldServer::Process() std::string Message = Buffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); + Log.Out(Logs::Detail, Logs::UCS_Server, "Player: %s, Sent Message: %s", From, Message.c_str()); Client *c = CL->FindCharacter(From); @@ -99,7 +99,7 @@ void WorldServer::Process() if(!c) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Client not found."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Client not found."); break; } diff --git a/world/adventure.cpp b/world/adventure.cpp index fa41e3c09..83b98813d 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); @@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 9c65620bf..3f671ee97 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/world/client.cpp b/world/client.cpp index 2b3b8dde2..bcf709373 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -136,7 +136,7 @@ void Client::SendEnterWorld(std::string name) eqs->Close(); return; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Telling client to continue session."); + Log.Out(Logs::Detail, Logs::World_Server,"Telling client to continue session."); } } @@ -378,7 +378,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if (strlen(password) <= 1) { // TODO: Find out how to tell the client wrong username/password - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login without a password"); + Log.Out(Logs::Detail, Logs::World_Server,"Login without a password"); return false; } @@ -408,31 +408,31 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { if ((cle = zoneserver_list.CheckAuth(inet_ntoa(tmpip), password))) #else if (loginserverlist.Connected() == false && !pZoning) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error: Login server login while not connected to login server."); + Log.Out(Logs::Detail, Logs::World_Server,"Error: Login server login while not connected to login server."); return false; } if (((cle = client_list.CheckAuth(name, password)) || (cle = client_list.CheckAuth(id, password)))) #endif { if (cle->AccountID() == 0 || (!minilogin && cle->LSID()==0)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ID is 0. Is this server connected to minilogin?"); + Log.Out(Logs::Detail, Logs::World_Server,"ID is 0. Is this server connected to minilogin?"); if(!minilogin) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"If so you forget the minilogin variable..."); + Log.Out(Logs::Detail, Logs::World_Server,"If so you forget the minilogin variable..."); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); + Log.Out(Logs::Detail, Logs::World_Server,"Could not find a minilogin account, verify ip address logging into minilogin is the same that is in your account table."); return false; } cle->SetOnline(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); + Log.Out(Logs::Detail, Logs::World_Server,"Logged in. Mode=%s",pZoning ? "(Zoning)" : "(CharSel)"); if(minilogin){ WorldConfig::DisableStats(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"MiniLogin Account #%d",cle->AccountID()); + Log.Out(Logs::Detail, Logs::World_Server,"MiniLogin Account #%d",cle->AccountID()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"LS Account #%d",cle->LSID()); + Log.Out(Logs::Detail, Logs::World_Server,"LS Account #%d",cle->LSID()); } const WorldConfig *Config=WorldConfig::get(); @@ -465,7 +465,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { } else { // TODO: Find out how to tell the client wrong username/password - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bad/Expired session key '%s'",name); + Log.Out(Logs::Detail, Logs::World_Server,"Bad/Expired session key '%s'",name); return false; } @@ -479,7 +479,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app) { bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Name approval request with no logged in account"); + Log.Out(Logs::Detail, Logs::World_Server,"Name approval request with no logged in account"); return false; } @@ -487,7 +487,7 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); + Log.Out(Logs::Detail, Logs::World_Server, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; @@ -648,11 +648,11 @@ bool Client::HandleCharacterCreateRequestPacket(const EQApplicationPacket *app) bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account ID not set; unable to create character."); + Log.Out(Logs::Detail, Logs::World_Server,"Account ID not set; unable to create character."); return false; } else if (app->size != sizeof(CharCreate_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on OP_CharacterCreate. Got: %d, Expected: %d",app->size,sizeof(CharCreate_Struct)); DumpPacket(app); // the previous behavior was essentially returning true here // but that seems a bit odd to me. @@ -679,14 +679,14 @@ bool Client::HandleCharacterCreatePacket(const EQApplicationPacket *app) { bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world with no logged in account"); + Log.Out(Logs::Detail, Logs::World_Server,"Enter world with no logged in account"); eqs->Close(); return true; } if(GetAdmin() < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Account banned or suspended."); + Log.Out(Logs::Detail, Logs::World_Server,"Account banned or suspended."); eqs->Close(); return true; } @@ -702,14 +702,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { uint32 tmpaccid = 0; charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID, &instanceID); if (charid == 0 || tmpaccid != GetAccountID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not get CharInfo for '%s'",char_name); + Log.Out(Logs::Detail, Logs::World_Server,"Could not get CharInfo for '%s'",char_name); eqs->Close(); return true; } // Make sure this account owns this character if (tmpaccid != GetAccountID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"This account does not own the character named '%s'",char_name); + Log.Out(Logs::Detail, Logs::World_Server,"This account does not own the character named '%s'",char_name); eqs->Close(); return true; } @@ -737,7 +737,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { zoneID = database.MoveCharacterToBind(charid,4); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go home before they're able...",char_name); + 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; @@ -770,7 +770,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"'%s' is trying to go to tutorial but are not allowed...",char_name); + 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; @@ -780,7 +780,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) { if (zoneID == 0 || !database.GetZoneName(zoneID)) { // This is to save people in an invalid zone, once it's removed from the DB database.MoveCharacterToZone(charid, "arena"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); + Log.Out(Logs::Detail, Logs::World_Server, "Zone not found in database zone_id=%i, moveing char to arena character:%s", zoneID, char_name); } if(instanceID > 0) @@ -894,7 +894,7 @@ bool Client::HandleDeleteCharacterPacket(const EQApplicationPacket *app) { uint32 char_acct_id = database.GetAccountIDByChar((char*)app->pBuffer); if(char_acct_id == GetAccountID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Delete character: %s",app->pBuffer); + Log.Out(Logs::Detail, Logs::World_Server,"Delete character: %s",app->pBuffer); database.DeleteCharacter((char *)app->pBuffer); SendCharInfo(); } @@ -915,25 +915,25 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied EQApplicationPacket"); + Log.Out(Logs::Detail, Logs::World_Server,"Recevied EQApplicationPacket"); _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (net inactive on send)"); + Log.Out(Logs::Detail, Logs::World_Server,"Client disconnected (net inactive on send)"); return false; } // Voidd: Anti-GM Account hack, Checks source ip against valid GM Account IP Addresses if (RuleB(World, GMAccountIPList) && this->GetAdmin() >= (RuleI(World, MinGMAntiHackStatus))) { if(!database.CheckGMIPs(long2ip(this->GetIP()).c_str(), this->GetAccountID())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); + Log.Out(Logs::Detail, Logs::World_Server,"GM Account not permited from source address %s and accountid %i", long2ip(this->GetIP()).c_str(), this->GetAccountID()); eqs->Close(); } } if (GetAccountID() == 0 && opcode != OP_SendLoginInfo) { // Got a packet other than OP_SendLoginInfo when not logged in - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); + Log.Out(Logs::Detail, Logs::World_Server,"Expecting OP_SendLoginInfo, got %s", OpcodeNames[opcode]); return false; } else if (opcode == OP_AckPacket) { @@ -1005,7 +1005,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received unknown EQApplicationPacket"); + Log.Out(Logs::Detail, Logs::World_Server,"Received unknown EQApplicationPacket"); _pkt(WORLD__CLIENT_ERR,app); return true; } @@ -1024,7 +1024,7 @@ bool Client::Process() { to.sin_addr.s_addr = ip; if (autobootup_timeout.Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone bootup timer expired, bootup failed or too slow."); + Log.Out(Logs::Detail, Logs::World_Server, "Zone bootup timer expired, bootup failed or too slow."); ZoneUnavail(); } if(connect.Check()){ @@ -1058,7 +1058,7 @@ bool Client::Process() { loginserverlist.SendPacket(pack); safe_delete(pack); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client disconnected (not active in process)"); + Log.Out(Logs::Detail, Logs::World_Server,"Client disconnected (not active in process)"); return false; } @@ -1107,17 +1107,17 @@ void Client::EnterWorld(bool TryBootup) { } else { if (TryBootup) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); + Log.Out(Logs::Detail, Logs::World_Server,"Attempting autobootup of %s (%d:%d)",zone_name,zoneID,instanceID); autobootup_timeout.Start(); pwaitingforbootup = zoneserver_list.TriggerBootup(zoneID, instanceID); if (pwaitingforbootup == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"No zoneserver available to boot up."); + Log.Out(Logs::Detail, Logs::World_Server,"No zoneserver available to boot up."); ZoneUnavail(); } return; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Requested zone %s is no running.",zone_name); + Log.Out(Logs::Detail, Logs::World_Server,"Requested zone %s is no running.",zone_name); ZoneUnavail(); return; } @@ -1126,12 +1126,12 @@ void Client::EnterWorld(bool TryBootup) { cle->SetChar(charid, char_name); database.UpdateLiveChar(char_name, GetAccountID()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); + Log.Out(Logs::Detail, Logs::World_Server,"%s %s (%d:%d)",seencharsel ? "Entering zone" : "Zoning to",zone_name,zoneID,instanceID); // database.SetAuthentication(account_id, char_name, zone_name, ip); if (seencharsel) { if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zoneID)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Enter world failed. Zone is locked."); + Log.Out(Logs::Detail, Logs::World_Server,"Enter world failed. Zone is locked."); ZoneUnavail(); return; } @@ -1169,9 +1169,9 @@ void Client::Clearance(int8 response) { if (zs == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unable to find zoneserver in Client::Clearance!!"); + Log.Out(Logs::Detail, Logs::World_Server,"Unable to find zoneserver in Client::Clearance!!"); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Invalid response %d in Client::Clearance", response); + Log.Out(Logs::Detail, Logs::World_Server, "Invalid response %d in Client::Clearance", response); } ZoneUnavail(); @@ -1181,20 +1181,20 @@ void Client::Clearance(int8 response) EQApplicationPacket* outapp; if (zs->GetCAddress() == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to do zs->GetCAddress() in Client::Clearance!!"); ZoneUnavail(); return; } if (zoneID == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zoneID is nullptr in Client::Clearance!!"); + Log.Out(Logs::Detail, Logs::World_Server, "zoneID is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } const char* zonename = database.GetZoneName(zoneID); if (zonename == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "zonename is nullptr in Client::Clearance!!"); + Log.Out(Logs::Detail, Logs::World_Server, "zonename is nullptr in Client::Clearance!!"); ZoneUnavail(); return; } @@ -1225,7 +1225,7 @@ void Client::Clearance(int8 response) } strcpy(zsi->ip, zs_addr); zsi->port =zs->GetCPort(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); + Log.Out(Logs::Detail, Logs::World_Server,"Sending client to zone %s (%d:%d) at %s:%d",zonename,zoneID,instanceID,zsi->ip,zsi->port); QueuePacket(outapp); safe_delete(outapp); @@ -1256,7 +1256,7 @@ bool Client::GenPassKey(char* key) { } void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); + Log.Out(Logs::Detail, Logs::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P @@ -1355,27 +1355,27 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Name: %s", name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", + Log.Out(Logs::Detail, Logs::World_Server, "Character creation request from %s LS#%d (%s:%d) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server, "Name: %s", name); + Log.Out(Logs::Detail, Logs::World_Server, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s", cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "STR STA AGI DEX WIS INT CHA Total"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", + Log.Out(Logs::Detail, Logs::World_Server, "STR STA AGI DEX WIS INT CHA Total"); + Log.Out(Logs::Detail, Logs::World_Server, "%3d %3d %3d %3d %3d %3d %3d %3d", cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA, stats_sum); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Beard: %d Beardcolor: %d", cc->beard, cc->beardcolor); + Log.Out(Logs::Detail, Logs::World_Server, "Face: %d Eye colors: %d %d", cc->face, cc->eyecolor1, cc->eyecolor2); + Log.Out(Logs::Detail, Logs::World_Server, "Hairstyle: %d Haircolor: %d", cc->hairstyle, cc->haircolor); + 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 (!CheckCharCreateInfoSoF(cc)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } else { if (!CheckCharCreateInfoTitanium(cc)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); + Log.Out(Logs::Detail, Logs::World_Server,"CheckCharCreateInfo did not validate the request (bad race/class/stats)"); return false; } } @@ -1437,21 +1437,21 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) /* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */ if (ClientVersionBit & BIT_SoFAndLater && RuleI(World, SoFStartZoneID) > 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); + Log.Out(Logs::Detail, Logs::World_Server,"Found 'SoFStartZoneID' rule setting: %i", RuleI(World, SoFStartZoneID)); pp.zone_id = RuleI(World, SoFStartZoneID); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); + Log.Out(Logs::Detail, Logs::World_Server,"Error getting zone id for Zone ID %i", RuleI(World, SoFStartZoneID)); } else { /* if there's a startzone variable put them in there */ if (database.GetVariable("startzone", startzone, 50)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found 'startzone' variable setting: %s", startzone); + Log.Out(Logs::Detail, Logs::World_Server,"Found 'startzone' variable setting: %s", startzone); pp.zone_id = database.GetZoneID(startzone); if (pp.zone_id) database.GetSafePoints(pp.zone_id, 0, &pp.x, &pp.y, &pp.z); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error getting zone id for '%s'", startzone); + Log.Out(Logs::Detail, Logs::World_Server,"Error getting zone id for '%s'", startzone); } else { /* otherwise use normal starting zone logic */ bool ValidStartZone = false; if (ClientVersionBit & BIT_TitaniumAndEarlier) @@ -1490,11 +1490,11 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) pp.binds[0].z = pp.z; pp.binds[0].heading = pp.heading; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", + Log.Out(Logs::Detail, Logs::World_Server,"Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.Out(Logs::Detail, Logs::World_Server,"Bind location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[0].zoneId), pp.binds[0].zoneId, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", + Log.Out(Logs::Detail, Logs::World_Server,"Home location: %s (%d) %0.2f, %0.2f, %0.2f", database.GetZoneName(pp.binds[4].zoneId), pp.binds[4].zoneId, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z); /* Starting Items inventory */ @@ -1503,10 +1503,10 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) // now we give the pp and the inv we made to StoreCharacter // to see if we can store it if (!database.StoreCharacter(GetAccountID(), &pp, &inv)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation failed: %s", pp.name); + Log.Out(Logs::Detail, Logs::World_Server,"Character creation failed: %s", pp.name); return false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Character creation successful: %s", pp.name); + Log.Out(Logs::Detail, Logs::World_Server,"Character creation successful: %s", pp.name); return true; } @@ -1516,7 +1516,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) if (!cc) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info..."); + Log.Out(Logs::Detail, Logs::World_Server, "Validating char creation info..."); RaceClassCombos class_combo; bool found = false; @@ -1533,7 +1533,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination"); + Log.Out(Logs::Detail, Logs::World_Server, "Could not find class/race/deity/start_zone combination"); return false; } @@ -1550,7 +1550,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) } if (!found) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); + Log.Out(Logs::Detail, Logs::World_Server, "Could not find starting stats for selected character combo, cannot verify stats"); return false; } @@ -1563,37 +1563,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) allocation.DefaultPointAllocation[6]; if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Strength out of range"); return false; } if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Dexterity out of range"); return false; } if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Agility out of range"); return false; } if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Stamina out of range"); return false; } if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Intelligence out of range"); return false; } if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Wisdom out of range"); return false; } if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range"); + Log.Out(Logs::Detail, Logs::World_Server, "Charisma out of range"); return false; } @@ -1606,7 +1606,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc) current_stats += cc->WIS - allocation.BaseStats[5]; current_stats += cc->CHA - allocation.BaseStats[6]; if (current_stats > max_stats) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats"); + Log.Out(Logs::Detail, Logs::World_Server, "Current Stats > Maximum Stats"); return false; } @@ -1687,7 +1687,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) if (!cc) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info..."); + Log.Out(Logs::Detail, Logs::World_Server,"Validating char creation info..."); classtemp = cc->class_ - 1; racetemp = cc->race - 1; @@ -1700,16 +1700,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // if out of range looking it up in the table would crash stuff // so we return from these if (classtemp >= PLAYER_CLASS_COUNT) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," class is out of range"); return false; } if (racetemp >= _TABLE_RACES) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," race is out of range"); return false; } if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs? - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination"); + Log.Out(Logs::Detail, Logs::World_Server," invalid race/class combination"); // we return from this one, since if it's an invalid combination our table // doesn't have meaningful values for the stats return false; @@ -1737,43 +1737,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) // that are messed up not just the first hit if (bTOTAL + stat_points != cTOTAL) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); + Log.Out(Logs::Detail, Logs::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL); Charerrors++; } if (cc->STR > bSTR + stat_points || cc->STR < bSTR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat STR is out of range"); Charerrors++; } if (cc->STA > bSTA + stat_points || cc->STA < bSTA) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat STA is out of range"); Charerrors++; } if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat AGI is out of range"); Charerrors++; } if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat DEX is out of range"); Charerrors++; } if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat WIS is out of range"); Charerrors++; } if (cc->INT > bINT + stat_points || cc->INT < bINT) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat INT is out of range"); Charerrors++; } if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range"); + Log.Out(Logs::Detail, Logs::World_Server," stat CHA is out of range"); Charerrors++; } /*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of) I am NOT writing those tables - kathgar*/ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors); + Log.Out(Logs::Detail, Logs::World_Server,"Found %d errors in character creation request", Charerrors); return Charerrors == 0; } diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 976ab113c..93adbc931 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) { int16 tmpStatus = WorldConfig::get()->DefaultStatus; paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID()); if (!paccountid) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); + Log.Out(Logs::Detail, Logs::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname); return false; } strn0cpy(paccountname, plsname, sizeof(paccountname)); diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 6ab4f9d78..53f989538 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -56,7 +56,7 @@ void ClientList::Process() { if (!iterator.GetData()->Process()) { struct in_addr in; in.s_addr = iterator.GetData()->GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort()); //the client destructor should take care of this. // iterator.GetData()->Free(); iterator.RemoveCurrent(); @@ -425,7 +425,7 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword) } int16 tmpadmin; - //Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login with '%s' and '%s'", iName, iPassword); + //Log.LogDebugType(Logs::Detail, Logs::World_Server,"Login with '%s' and '%s'", iName, iPassword); uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin); if (accid) { @@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID) if(!from) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); + Log.Out(Logs::Detail, Logs::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID); return; } @@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S safe_delete(output); } catch(...){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); + Log.Out(Logs::Detail, Logs::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring..."); return; } } @@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon safe_delete(pack2); } catch(...){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); + Log.Out(Logs::Detail, Logs::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring..."); return; } } @@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) { iterator.Reset(); while(iterator.MoreElements()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); + Log.Out(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData()); if (iterator.GetData()->GetAccountID() == account_id) { Client* tmp = iterator.GetData(); return tmp; @@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) { iterator.Reset(); while(iterator.MoreElements()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); + Log.Out(Logs::Detail, Logs::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData()); if (iterator.GetData()->GetCharName() == charname) { Client* tmp = iterator.GetData(); return tmp; diff --git a/world/console.cpp b/world/console.cpp index bb15f724b..fbf9415bd 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -88,7 +88,7 @@ void Console::Die() { state = CONSOLE_STATE_CLOSED; struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort()); tcpc->Disconnect(); } @@ -219,7 +219,7 @@ bool Console::Process() { if (!tcpc->Connected()) { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort()); return false; } //if we have not gotten the special markers after this timer, send login prompt @@ -234,7 +234,7 @@ bool Console::Process() { SendMessage(1, "Timeout, disconnecting..."); struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort()); return false; } @@ -243,29 +243,29 @@ bool Console::Process() { in.s_addr = GetIP(); if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) { auto zs = new ZoneServer(tcpc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort()); zoneserver_list.Add(zs); numzones++; tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort()); launcher_list.Add(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort()); UCSLink.SetConnection(tcpc); tcpc = 0; } else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort()); QSLink.SetConnection(tcpc); tcpc = 0; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); + Log.Out(Logs::Detail, Logs::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort()); } return false; } @@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) { state = CONSOLE_STATE_CLOSED; return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); + Log.Out(Logs::Detail, Logs::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin); SendMessage(1, 0); SendMessage(2, "Login accepted."); state = CONSOLE_STATE_CONNECTED; @@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) { break; } case CONSOLE_STATE_CONNECTED: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command); + Log.Out(Logs::Detail, Logs::World_Server,"TCP command: %s: \"%s\"",paccountname,command); Seperator sep(command); if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) { SendMessage(1, " whoami"); @@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) { tmpname[0] = '*'; strcpy(&tmpname[1], paccountname); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); + Log.Out(Logs::Detail, Logs::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]); zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0)); } } @@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) { #endif RunLoops = true; SendMessage(1, " Login Server Reconnect manually restarted by Console"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console"); + Log.Out(Logs::Detail, Logs::World_Server,"Login Server Reconnect manually restarted by Console"); } else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) { if (strcasecmp(sep.arg[1], "list") == 0) { diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 13f095575..85f98713d 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); else { auto row = results.begin(); m_dynamics = atoi(row[0]); @@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); return; } @@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } @@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } @@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); return false; } @@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update for unknown zone %s", short_name); + Log.Out(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); return false; } @@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } @@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/eqw.cpp b/world/eqw.cpp index 0137bfe8e..7ff709ec6 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -75,11 +75,11 @@ EQW::EQW() { void EQW::AppendOutput(const char *str) { m_outputBuffer += str; -// Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); +// Log.LogDebugType(Logs::Detail, Logs::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length()); } const std::string &EQW::GetOutput() const { -// Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Getting, length %d", m_outputBuffer.length()); +// Log.LogDebugType(Logs::Detail, Logs::World_Server, "Getting, length %d", m_outputBuffer.length()); return(m_outputBuffer); } @@ -269,7 +269,7 @@ void EQW::LSReconnect() { pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr); #endif RunLoops = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool"); + Log.Out(Logs::Detail, Logs::World_Server,"Login Server Reconnect manually restarted by Web Tool"); } /*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) { diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index c1afc41e8..ba2e5b21c 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const { int16 status = 0; uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status); if(acctid == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str()); return(false); } if(status < httpLoginStatus) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Login of %s failed: status too low.", m_username.c_str()); return(false); } @@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP } void EQWHTTPServer::Stop() { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop."); + Log.Out(Logs::Detail, Logs::World_Server, "Requesting that HTTP Service stop."); m_running = false; Close(); } bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { if(m_running) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port); + Log.Out(Logs::Detail, Logs::World_Server, "HTTP Service is already running on port %d", m_port); return(false); } //load up our nice mime types if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file); + Log.Out(Logs::Detail, Logs::World_Server, "Failed to load mime types from '%s'", mime_file); return(false); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file); + Log.Out(Logs::Detail, Logs::World_Server, "Loaded mime types from %s", mime_file); } //fire up the server thread char errbuf[TCPServer_ErrorBufferSize]; if(!Open(port, errbuf)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf); return(false); } @@ -320,12 +320,12 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) { /* void EQWHTTPServer::Run() { - Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread started on port %d", m_port); + Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread started on port %d", m_port); do { #warning DELETE THIS IF YOU DONT USE IT Sleep(10); } while(m_running); - Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread terminating on port %d", m_port); + Log.LogDebugType(Logs::Detail, Logs::World_Server, "HTTP Processing thread terminating on port %d", m_port); } ThreadReturnType EQWHTTPServer::ThreadProc(void *data) { diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index f0970b1fe..49c1317f5 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -65,7 +65,7 @@ EQWParser::EQWParser() { my_perl = perl_alloc(); _empty_sv = newSV(0); if(!my_perl) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!"); + Log.Out(Logs::Detail, Logs::World_Server, "Error: perl_alloc failed!"); else DoInit(); } @@ -182,10 +182,10 @@ void EQWParser::DoInit() { #ifdef EMBPERL_PLUGIN - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading worldui perl plugins."); std::string err; if(!eval_file("world", "worldui.pl", err)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Warning - world.pl: %s", err.c_str()); } eval_pv( diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 6ac7c6326..eac6a63f0 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -79,7 +79,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.Out(Logs::Detail, Logs::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -90,7 +90,7 @@ bool LauncherLink::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed."); + Log.Out(Logs::Detail, Logs::World_Server, "Launcher authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -100,7 +100,7 @@ bool LauncherLink::Process() { } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -114,25 +114,25 @@ bool LauncherLink::Process() { break; } case ServerOP_ZAAuth: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str()); break; } case ServerOP_LauncherConnectInfo: { const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer; if(HasName()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); + Log.Out(Logs::Detail, Logs::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name); break; } m_name = it->name; EQLConfig *config = launcher_list.GetConfig(m_name.c_str()); if(config == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); + Log.Out(Logs::Detail, Logs::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name); Disconnect(); break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); + Log.Out(Logs::Detail, Logs::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name); std::vector result; //database.GetLauncherZones(it->name, result); @@ -146,7 +146,7 @@ bool LauncherLink::Process() { zs.port = cur->port; zs.up = false; zs.starts = 0; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); + Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port); m_states[cur->name] = zs; } @@ -162,17 +162,17 @@ bool LauncherLink::Process() { std::map::iterator res; res = m_states.find(it->short_name); if(res == m_states.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); + Log.Out(Logs::Detail, Logs::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name); break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); + Log.Out(Logs::Detail, Logs::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count); res->second.up = it->running; res->second.starts = it->start_count; break; } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); + Log.Out(Logs::Detail, Logs::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) { zs.port = port; zs.up = false; zs.starts = 0; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); + Log.Out(Logs::Detail, Logs::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port); m_states[short_name] = zs; StartZone(short_name); diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 0e258d78c..b00da266d 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -60,7 +60,7 @@ void LauncherList::Process() { //printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID()); + Log.Out(Logs::Detail, Logs::World_Server, "Removing pending launcher %d", l->GetID()); cur = m_pendingLaunchers.erase(cur); delete l; } else if(l->HasName()) { @@ -72,10 +72,10 @@ void LauncherList::Process() { std::map::iterator res; res = m_launchers.find(name); if(res != m_launchers.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Ghosting launcher %s", name.c_str()); delete res->second; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str()); //put the launcher in the list. m_launchers[name] = l; } else { @@ -91,7 +91,7 @@ void LauncherList::Process() { //printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); + Log.Out(Logs::Detail, Logs::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); curl = m_launchers.erase(curl); delete l; } else { @@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) { void LauncherList::Add(EmuTCPConnection *conn) { auto it = new LauncherLink(nextID++, conn); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID()); + Log.Out(Logs::Detail, Logs::World_Server, "Adding pending launcher %d", it->GetID()); m_pendingLaunchers.push_back(it); } diff --git a/world/login_server.cpp b/world/login_server.cpp index 84a4b4ebb..0bec7cef3 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -96,7 +96,7 @@ bool LoginServer::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); + Log.Out(Logs::Detail, Logs::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { @@ -160,12 +160,12 @@ bool LoginServer::Process() { case ServerOP_LSFatalError: { #ifndef IGNORE_LS_FATAL_ERROR WorldConfig::DisableLoginserver(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect."); + Log.Out(Logs::Detail, Logs::World_Server, "Login server responded with FatalError. Disabling reconnect."); #else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError."); + Log.Out(Logs::Detail, Logs::World_Server, "Login server responded with FatalError."); #endif if (pack->size > 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer); + Log.Out(Logs::Detail, Logs::World_Server, " %s",pack->pBuffer); } break; } @@ -177,18 +177,18 @@ bool LoginServer::Process() { case ServerOP_LSRemoteAddr: { if (!Config->WorldAddress.length()) { WorldConfig::SetWorldAddress((char *)pack->pBuffer); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer); + Log.Out(Logs::Detail, Logs::World_Server, "Loginserver provided %s as world address",pack->pBuffer); } break; } case ServerOP_LSAccountUpdate: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); + Log.Out(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver"); CanAccountUpdate = true; break; } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); + Log.Out(Logs::Detail, Logs::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } @@ -202,10 +202,10 @@ bool LoginServer::Process() { bool LoginServer::InitLoginServer() { if(Connected() == false) { if(ConnectReady()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(Logs::Detail, Logs::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort); Connect(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", + Log.Out(Logs::Detail, Logs::World_Server, "Not connected but not ready to connect, this is bad: %s:%d", LoginServerAddress,LoginServerPort); } } @@ -216,29 +216,29 @@ bool LoginServer::Connect() { char tmp[25]; if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){ minilogin = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type"); + Log.Out(Logs::Detail, Logs::World_Server, "Setting World to MiniLogin Server type"); } else minilogin = false; if (minilogin && WorldConfig::get()->WorldAddress.length()==0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the
element in the section."); + Log.Out(Logs::Detail, Logs::World_Server, "**** For minilogin to work, you need to set the
element in the section."); return false; } char errbuf[TCPConnection_ErrorBufferSize]; if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress); return false; } if (LoginServerIP == 0 || LoginServerPort == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(Logs::Detail, Logs::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort); return false; } if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(Logs::Detail, Logs::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort); if (minilogin) SendInfo(); else @@ -248,7 +248,7 @@ bool LoginServer::Connect() { return true; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); + Log.Out(Logs::Detail, Logs::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf); return false; } } @@ -324,7 +324,7 @@ void LoginServer::SendStatus() { void LoginServer::SendAccountUpdate(ServerPacket* pack) { ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer; if(CanUpdate()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); + Log.Out(Logs::Detail, Logs::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort); strn0cpy(s->worldaccount, LoginAccount, 30); strn0cpy(s->worldpassword, LoginPassword, 30); SendPacket(pack); diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index bcdd67aa3..e76b38b71 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) { bool LoginServerList::SendAccountUpdate(ServerPacket* pack) { LinkedListIterator iterator(list); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); + Log.Out(Logs::Detail, Logs::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers"); iterator.Reset(); while(iterator.MoreElements()){ if(iterator.GetData()->CanUpdate()) { diff --git a/world/net.cpp b/world/net.cpp index 89544cca6..bab38026b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,36 +126,36 @@ int main(int argc, char** argv) { } // Load server configuration - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration.."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(Logs::Detail, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler"); + Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); return 1; } #endif @@ -164,7 +164,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -172,19 +172,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL..."); + Log.Out(Logs::Detail, Logs::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -280,56 +280,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service..."); + Log.Out(Logs::Detail, Logs::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled."); + Log.Out(Logs::Detail, Logs::World_Server, "HTTP world service disabled."); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions.."); + Log.Out(Logs::Detail, Logs::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables.."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading variables.."); database.LoadVariables(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones.."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading zones.."); database.LoadZoneNames(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups.."); + Log.Out(Logs::Detail, Logs::World_Server, "Clearing groups.."); database.ClearGroup(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids.."); + Log.Out(Logs::Detail, Logs::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items.."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading items.."); if (!database.LoadItems()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps.."); + Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load item data. But ignoring"); + Log.Out(Logs::Detail, Logs::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds.."); + Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load skill cap data. But ignoring"); + Log.Out(Logs::Detail, Logs::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::Detail, Logs::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(Logs::Detail, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules"); + Log.Out(Logs::Detail, Logs::World_Server, "No rule set configured, using default rules"); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::Detail, Logs::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists.."); + Log.Out(Logs::Detail, Logs::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day.."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list.."); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -338,45 +338,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + Log.Out(Logs::Detail, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + Log.Out(Logs::Detail, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures..."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates."); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances"); + Log.Out(Logs::Detail, Logs::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info..."); + Log.Out(Logs::Detail, Logs::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started."); + Log.Out(Logs::Detail, Logs::World_Server,"Zone (TCP) listener started."); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf); + Log.Out(Logs::Detail, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + Log.Out(Logs::Detail, Logs::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started."); + Log.Out(Logs::Detail, Logs::World_Server,"Client (UDP) listener started."); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)"); + Log.Out(Logs::Detail, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -404,7 +404,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -417,19 +417,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + Log.Out(Logs::Detail, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Log.Out(Logs::Detail, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + Log.Out(Logs::Detail, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -441,7 +441,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + Log.Out(Logs::Detail, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -492,16 +492,16 @@ int main(int argc, char** argv) { } Sleep(20); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any)."); + Log.Out(Logs::Detail, Logs::World_Server,"World main loop completed."); + Log.Out(Logs::Detail, Logs::World_Server,"Shutting down console connections (if any)."); console_list.KillAll(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any)."); + Log.Out(Logs::Detail, Logs::World_Server,"Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped."); + Log.Out(Logs::Detail, Logs::World_Server,"Zone (TCP) listener stopped."); tcps.Close(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped."); + Log.Out(Logs::Detail, Logs::World_Server,"Client (UDP) listener stopped."); eqsf.Close(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop..."); + Log.Out(Logs::Detail, Logs::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); CheckEQEMuErrorAndPause(); @@ -509,9 +509,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num); + Log.Out(Logs::Detail, Logs::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file."); + Log.Out(Logs::Detail, Logs::World_Server,"Failed to save time file."); RunLoops = false; } diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 3291933e8..6457d7e6c 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -23,7 +23,7 @@ void QueryServConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); + Log.Out(Logs::Detail, Logs::QS_Server, "Incoming QueryServ Connection while we were already connected to a QueryServ."); Stream->Disconnect(); } @@ -57,7 +57,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.Out(Logs::Detail, Logs::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -69,7 +69,7 @@ bool QueryServConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "QueryServ authorization failed."); + Log.Out(Logs::Detail, Logs::QS_Server, "QueryServ authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -79,7 +79,7 @@ bool QueryServConnection::Process() } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(Logs::Detail, Logs::QS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -97,7 +97,7 @@ bool QueryServConnection::Process() } case ServerOP_ZAAuth: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Got authentication from QueryServ when they are already authenticated."); + Log.Out(Logs::Detail, Logs::QS_Server, "Got authentication from QueryServ when they are already authenticated."); break; } case ServerOP_QueryServGeneric: @@ -114,7 +114,7 @@ bool QueryServConnection::Process() } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); + Log.Out(Logs::Detail, Logs::QS_Server, "Unknown ServerOPcode from QueryServ 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/ucs.cpp b/world/ucs.cpp index 178a97c1a..13032d091 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -18,7 +18,7 @@ void UCSConnection::SetConnection(EmuTCPConnection *inStream) { if(Stream) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Incoming UCS Connection while we were already connected to a UCS."); Stream->Disconnect(); } @@ -52,7 +52,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.Out(Logs::Detail, Logs::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -64,7 +64,7 @@ bool UCSConnection::Process() { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "UCS authorization failed."); + Log.Out(Logs::Detail, Logs::UCS_Server, "UCS authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -74,7 +74,7 @@ bool UCSConnection::Process() } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(Logs::Detail, Logs::UCS_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } delete pack; @@ -92,12 +92,12 @@ bool UCSConnection::Process() } case ServerOP_ZAAuth: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Got authentication from UCS when they are already authenticated."); + Log.Out(Logs::Detail, Logs::UCS_Server, "Got authentication from UCS when they are already authenticated."); break; } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); + Log.Out(Logs::Detail, Logs::UCS_Server, "Unknown ServerOPcode from UCS 0x%04x, size %d", pack->opcode, pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index a6ff8947b..1b7f8739e 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -34,7 +34,7 @@ WorldGuildManager guild_mgr; void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); auto pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -47,7 +47,7 @@ void WorldGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, } void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting char refresh for %d from guild %d to world", charid, guild_id); auto pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -58,7 +58,7 @@ void WorldGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, ui } void WorldGuildManager::SendGuildDelete(uint32 guild_id) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Broadcasting guild delete for guild %d to world", guild_id); auto pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -71,18 +71,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild refresh for %d, changes: name=%d, motd=%d, rank=d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!RefreshGuild(s->guild_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to preform local refresh on guild %d", s->guild_id); //can we do anything? } @@ -91,11 +91,11 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild member refresh for char %d to all zones with members of guild %d", s->char_id, s->guild_id); //preform the local update client_list.UpdateClientGuild(s->char_id, s->guild_id); @@ -110,18 +110,18 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Received and broadcasting guild delete for guild %d", s->guild_id); //broadcast this packet to all zones. zoneserver_list.SendPacket(pack); //preform a local refresh. if(!LocalDeleteGuild(s->guild_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to preform local delete on guild %d", s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to preform local delete on guild %d", s->guild_id); //can we do anything? } @@ -131,7 +131,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { case ServerOP_GuildMemberUpdate: { if(pack->size != sizeof(ServerGuildMemberUpdate_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); + Log.Out(Logs::Detail, Logs::Guilds, "Received ServerOP_GuildMemberUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildMemberUpdate_Struct)); return; } @@ -141,7 +141,7 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) { } default: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); + Log.Out(Logs::Detail, Logs::Guilds, "Unknown packet 0x%x received from zone??", pack->opcode); break; } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 311ade1e7..5fa4313da 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str()); + Log.Out(Logs::General, Logs::Status, "Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Out(Logs::General, Logs::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str()); + Log.Out(Logs::General, Logs::Status, "SoF Start zone query: %s\n", query.c_str()); if (results.RowCount() == 0) { printf("No start_zones entry in database, using defaults\n"); @@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Found starting location in start_zones"); + Log.Out(Logs::General, Logs::Status, "Found starting location in start_zones"); auto row = results.begin(); in_pp->x = atof(row[0]); in_pp->y = atof(row[1]); @@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); return; } @@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) { MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); return false; } diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 3045e4c6e..52879cafa 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -79,7 +79,7 @@ void ZSList::KillAll() { void ZSList::Process() { if(shutdowntimer && shutdowntimer->Check()){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); + Log.Out(Logs::Detail, Logs::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)"); auto pack2 = new ServerPacket; pack2->opcode = ServerOP_ShutdownAll; pack2->size=0; @@ -99,10 +99,10 @@ void ZSList::Process() { ZoneServer* zs = iterator.GetData(); struct in_addr in; in.s_addr = zs->GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); + Log.Out(Logs::Detail, Logs::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort()); zs->LSShutDownUpdate(zs->GetZoneID()); if (holdzones){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone"); + Log.Out(Logs::Detail, Logs::World_Server,"Hold Zones mode is ON - rebooting lost zone"); if(!zs->IsStaticZone()) RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID()); else @@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip s->port = port; s->zoneid = zoneid; if(zoneid != 0) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid); + Log.Out(Logs::Detail, Logs::World_Server,"Rebooting static zone with the ID of: %i",zoneid); tmp[z]->SendPacket(pack); delete pack; safe_delete_array(tmp); diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index bf46627d4..94b1e8853 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -77,7 +77,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { char* longname; if (iZoneID) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, + Log.Out(Logs::Detail, Logs::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; @@ -188,7 +188,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.Out(Logs::Detail, Logs::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -199,7 +199,7 @@ bool ZoneServer::Process() { else { struct in_addr in; in.s_addr = GetIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone authorization failed."); + Log.Out(Logs::Detail, Logs::World_Server,"Zone authorization failed."); auto pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; @@ -209,7 +209,7 @@ bool ZoneServer::Process() { } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); + Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a STRING element to your element to prevent unauthroized zone access."); authenticated = true; } } @@ -541,10 +541,10 @@ bool ZoneServer::Process() { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); + Log.Out(Logs::Detail, Logs::World_Server,"Sent Rez packet for %s",sRezz->rez.your_name); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); + Log.Out(Logs::Detail, Logs::World_Server,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } @@ -589,10 +589,10 @@ bool ZoneServer::Process() { ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); + Log.Out(Logs::Detail, Logs::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); + Log.Out(Logs::Detail, Logs::World_Server,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } @@ -602,7 +602,7 @@ bool ZoneServer::Process() { const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); + Log.Out(Logs::Detail, Logs::World_Server, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { @@ -685,12 +685,12 @@ bool ZoneServer::Process() { if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", + Log.Out(Logs::Detail, Logs::World_Server,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); /* This is a request from the egress zone */ if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); + Log.Out(Logs::Detail, Logs::World_Server,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if (ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id)) { ztz->response = 0; @@ -708,20 +708,20 @@ bool ZoneServer::Process() { /* Zone was already running*/ if(ingress_server) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name); + Log.Out(Logs::Detail, Logs::World_Server,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } /* Boot the Zone*/ else { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name); + Log.Out(Logs::Detail, Logs::World_Server,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name); + Log.Out(Logs::Detail, Logs::World_Server,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } @@ -736,7 +736,7 @@ bool ZoneServer::Process() { /* Response from Ingress server, route back to egress */ else{ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); + Log.Out(Logs::Detail, Logs::World_Server,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = nullptr; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); @@ -754,7 +754,7 @@ bool ZoneServer::Process() { } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); @@ -763,7 +763,7 @@ bool ZoneServer::Process() { case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); @@ -868,7 +868,7 @@ bool ZoneServer::Process() { } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; @@ -888,7 +888,7 @@ bool ZoneServer::Process() { } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; @@ -913,7 +913,7 @@ bool ZoneServer::Process() { } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; @@ -924,7 +924,7 @@ bool ZoneServer::Process() { } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; @@ -943,7 +943,7 @@ bool ZoneServer::Process() { break; } case ServerOP_GetWorldTime: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Broadcasting a world time update"); + Log.Out(Logs::Detail, Logs::World_Server,"Broadcasting a world time update"); auto pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; @@ -958,17 +958,17 @@ bool ZoneServer::Process() { break; } case ServerOP_SetWorldTime: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Received SetWorldTime"); + Log.Out(Logs::Detail, Logs::World_Server,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); + Log.Out(Logs::Detail, Logs::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; @@ -980,7 +980,7 @@ bool ZoneServer::Process() { } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); + Log.Out(Logs::Detail, Logs::World_Server,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; @@ -1025,10 +1025,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; @@ -1047,10 +1047,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); + Log.Out(Logs::Detail, Logs::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else @@ -1067,10 +1067,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } @@ -1079,10 +1079,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); + Log.Out(Logs::Detail, Logs::World_Server, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { @@ -1098,10 +1098,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } @@ -1119,10 +1119,10 @@ bool ZoneServer::Process() { zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1138,10 +1138,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else @@ -1149,10 +1149,10 @@ bool ZoneServer::Process() { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); + Log.Out(Logs::Detail, Logs::World_Server, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; @@ -1254,7 +1254,7 @@ bool ZoneServer::Process() { case ServerOP_LSAccountUpdate: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); + Log.Out(Logs::Detail, Logs::World_Server, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } @@ -1309,7 +1309,7 @@ bool ZoneServer::Process() { } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); + Log.Out(Logs::Detail, Logs::World_Server,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } diff --git a/zone/aa.cpp b/zone/aa.cpp index 54d2831c3..5b3b82732 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -445,7 +445,7 @@ void Client::HandleAAAction(aaID activate) { break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown AA nonspell action type %d", caa->action); + Log.Out(Logs::General, Logs::Error, "Unknown AA nonspell action type %d", caa->action); return; } @@ -501,7 +501,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + Log.Out(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -528,7 +528,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { //log write - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); + Log.Out(Logs::General, Logs::Error, "Unknown npc type for swarm pet spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -625,7 +625,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid const NPCType *npc_type = database.GetNPCType(typesid); if(npc_type == nullptr) { //log write - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for swarm pet type id: %d", typesid); + Log.Out(Logs::General, Logs::Error, "Unknown npc type for swarm pet type id: %d", typesid); Message(0,"Unable to find pet!"); return; } @@ -951,7 +951,7 @@ void Client::SendAAStats() { void Client::BuyAA(AA_Action* action) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Starting to buy AA %d", action->ability); + Log.Out(Logs::Detail, Logs::AA, "Starting to buy AA %d", action->ability); //find the AA information from the database SendAA_Struct* aa2 = zone->FindAA(action->ability); @@ -963,7 +963,7 @@ void Client::BuyAA(AA_Action* action) a = action->ability - i; if(a <= 0) break; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); + Log.Out(Logs::Detail, Logs::AA, "Could not find AA %d, trying potential parent %d", action->ability, a); aa2 = zone->FindAA(a); if(aa2 != nullptr) break; @@ -980,7 +980,7 @@ void Client::BuyAA(AA_Action* action) uint32 cur_level = GetAA(aa2->id); if((aa2->id + cur_level) != action->ability) { //got invalid AA - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); + Log.Out(Logs::Detail, Logs::AA, "Unable to find or match AA %d (found %d + lvl %d)", action->ability, aa2->id, cur_level); return; } @@ -1011,7 +1011,7 @@ void Client::BuyAA(AA_Action* action) if (m_pp.aapoints >= real_cost && cur_level < aa2->max_level) { SetAA(aa2->id, cur_level + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); + Log.Out(Logs::Detail, Logs::AA, "Set AA %d to level %d", aa2->id, cur_level + 1); m_pp.aapoints -= real_cost; @@ -1429,10 +1429,10 @@ SendAA_Struct* Zone::FindAA(uint32 id) { } void Zone::LoadAAs() { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA information..."); + Log.Out(Logs::General, Logs::Status, "Loading AA information..."); totalAAs = database.CountAAs(); if(totalAAs == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AAs!"); + Log.Out(Logs::General, Logs::Error, "Failed to load AAs!"); aas = nullptr; return; } @@ -1447,11 +1447,11 @@ void Zone::LoadAAs() { } //load AA Effects into aa_effects - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading AA Effects..."); + Log.Out(Logs::General, Logs::Status, "Loading AA Effects..."); if (database.LoadAAEffects2()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loaded %d AA Effects.", aa_effects.size()); + Log.Out(Logs::General, Logs::Status, "Loaded %d AA Effects.", aa_effects.size()); else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load AA Effects!"); + Log.Out(Logs::General, Logs::Error, "Failed to load AA Effects!"); } bool ZoneDatabase::LoadAAEffects2() { @@ -1460,12 +1460,12 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (!results.RowCount()) { //no results - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading AA Effects, none found in the database."); + Log.Out(Logs::General, Logs::Error, "Error loading AA Effects, none found in the database."); return false; } @@ -1802,7 +1802,7 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1841,7 +1841,7 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1895,7 +1895,7 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1912,7 +1912,7 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1945,14 +1945,14 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1970,7 +1970,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -1990,7 +1990,7 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 678cbd3a8..d0b688e29 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -342,17 +342,17 @@ bool Mob::CheckWillAggro(Mob *mob) { { //FatherNiwtit: make sure we can see them. last since it is very expensive if(CheckLosFN(mob)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); + Log.Out(Logs::Detail, Logs::Aggro, "Check aggro for %s target %s.", GetName(), mob->GetName()); return( mod_will_aggro(mob, this) ); } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Is In zone?:%d\n", mob->InZone()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Dist^2: %f\n", dist2); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Range^2: %f\n", iAggroRange2); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Faction: %d\n", fv); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Int: %d\n", GetINT()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); + Log.Out(Logs::Detail, Logs::Aggro, "Is In zone?:%d\n", mob->InZone()); + Log.Out(Logs::Detail, Logs::Aggro, "Dist^2: %f\n", dist2); + Log.Out(Logs::Detail, Logs::Aggro, "Range^2: %f\n", iAggroRange2); + Log.Out(Logs::Detail, Logs::Aggro, "Faction: %d\n", fv); + Log.Out(Logs::Detail, Logs::Aggro, "Int: %d\n", GetINT()); + Log.Out(Logs::Detail, Logs::Aggro, "Con: %d\n", GetLevelCon(mob->GetLevel())); return(false); } @@ -466,7 +466,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { //Father Nitwit: make sure we can see them. if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", + Log.Out(Logs::General, Logs::None, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); @@ -693,7 +693,7 @@ type', in which case, the answer is yes. } while( reverse++ == 0 ); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); + Log.Out(Logs::General, Logs::None, "Mob::IsAttackAllowed: don't have a rule for this - %s vs %s\n", this->GetName(), target->GetName()); return false; } @@ -833,7 +833,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) } while( reverse++ == 0 ); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); + Log.Out(Logs::General, Logs::None, "Mob::IsBeneficialAllowed: don't have a rule for this - %s to %s\n", this->GetName(), target->GetName()); return false; } @@ -945,7 +945,7 @@ bool Mob::CheckLosFN(float posX, float posY, float posZ, float mobSize) { oloc.z = posZ + (mobSize==0.0?LOS_DEFAULT_HEIGHT:mobSize)/2 * SEE_POSITION; #if LOSDEBUG>=5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); + Log.Out(Logs::General, Logs::None, "LOS from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) sizes: (%.2f, %.2f)", myloc.x, myloc.y, myloc.z, oloc.x, oloc.y, oloc.z, GetSize(), mobSize); #endif return zone->zonemap->CheckLoS(myloc, oloc); } diff --git a/zone/attack.cpp b/zone/attack.cpp index 5610a5f8f..ce97ae524 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -57,7 +57,7 @@ bool Mob::AttackAnimation(SkillUseTypes &skillinuse, int Hand, const ItemInst* w if (weapon && weapon->IsType(ItemClassCommon)) { const Item_Struct* item = weapon->GetItem(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Weapon skill : %i", item->ItemType); + Log.Out(Logs::Detail, Logs::Attack, "Weapon skill : %i", item->ItemType); switch (item->ItemType) { @@ -187,7 +187,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c if(attacker->IsNPC() && !attacker->IsPet()) chancetohit += RuleR(Combat, NPCBonusHitChance); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); + Log.Out(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName()); bool pvpmode = false; if(IsClient() && other->IsClient()) @@ -208,7 +208,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate the level difference - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit before level diff calc %.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit before level diff calc %.2f", chancetohit); double level_difference = attacker_level - defender_level; double range = defender->GetLevel(); @@ -236,32 +236,32 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c chancetohit += (RuleR(Combat,HitBonusPerLevel) * level_difference); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after level diff calc %.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit after level diff calc %.2f", chancetohit); chancetohit -= ((float)defender->GetAGI() * RuleR(Combat, AgiHitFactor)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after Agility calc %.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit after Agility calc %.2f", chancetohit); if(attacker->IsClient()) { chancetohit -= (RuleR(Combat,WeaponSkillFalloff) * (attacker->CastToClient()->MaxSkill(skillinuse) - attacker->GetSkill(skillinuse))); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit after agil calc %.2f", "Chance to hit after weapon falloff calc (attack) %.2f", chancetohit); } if(defender->IsClient()) { chancetohit += (RuleR(Combat,WeaponSkillFalloff) * (defender->CastToClient()->MaxSkill(SkillDefense) - defender->GetSkill(SkillDefense))); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit after weapon falloff calc (defense) %.2f", chancetohit); } //I dont think this is 100% correct, but at least it does something... if(attacker->spellbonuses.MeleeSkillCheckSkill == skillinuse || attacker->spellbonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->spellbonuses.MeleeSkillCheck; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Applied spell melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } if(attacker->itembonuses.MeleeSkillCheckSkill == skillinuse || attacker->itembonuses.MeleeSkillCheckSkill == 255) { chancetohit += attacker->itembonuses.MeleeSkillCheck; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "Applied item melee skill bonus %d, yeilding %.2f", attacker->spellbonuses.MeleeSkillCheck, chancetohit); } //Avoidance Bonuses on defender decreases baseline hit chance by percent. @@ -308,7 +308,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //Calculate final chance to hit chancetohit += ((chancetohit * (hitBonus - avoidanceBonus)) / 100.0f); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); + Log.Out(Logs::Detail, Logs::Attack, "Chance to hit %.2f after accuracy calc %.2f and avoidance calc %.2f", chancetohit, hitBonus, avoidanceBonus); chancetohit = mod_hit_chance(chancetohit, skillinuse, attacker); @@ -327,7 +327,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); + Log.Out(Logs::Detail, Logs::Attack, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); // @@ -336,7 +336,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c float tohit_roll = zone->random.Real(0, 100); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); + Log.Out(Logs::Detail, Logs::Attack, "Final hit chance: %.2f%%. Hit roll %.2f", chancetohit, tohit_roll); return(tohit_roll <= chancetohit); } @@ -370,7 +370,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && other->InFrontMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -517,7 +517,7 @@ bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.Out(Logs::Detail, Logs::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -690,9 +690,9 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac damage -= (myac * zone->random.Int(0, acrandom) / 10000); } if (damage<1) damage=1; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); + Log.Out(Logs::Detail, Logs::Combat, "AC Damage Reduction: fail chance %d%%. Failed. Reduction %.3f%%, random %d. Resulting damage %d.", acfail, acreduction, acrandom, damage); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); + Log.Out(Logs::Detail, Logs::Combat, "AC Damage Reduction: fail chance %d%%. Did not fail.", acfail); } } @@ -1128,14 +1128,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!"); return false; } if(!GetTarget()) SetTarget(other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); + Log.Out(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":""); //SetAttackTimer(); if ( @@ -1145,12 +1145,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b || (GetHP() < 0) || (!IsAttackAllowed(other)) ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, invalid circumstances."); + Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, invalid circumstances."); return false; // Only bards can attack while casting } if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect."); Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable! return false; } @@ -1170,19 +1170,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.Out(Logs::Detail, Logs::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -1200,7 +1200,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(IsBerserk() && GetClass() == BERSERKER){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.Out(Logs::Detail, Logs::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -1268,7 +1268,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b damage = mod_client_damage(damage, skillinuse, Hand, weapon, other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.Out(Logs::Detail, Logs::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, mylevel); int hit_chance_bonus = 0; @@ -1283,7 +1283,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(this, skillinuse, Hand, hit_chance_bonus)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.Out(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0."); damage = 0; } else { //we hit, try to avoid it other->AvoidDamage(this, damage); @@ -1291,7 +1291,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b if(damage > 0) CommonOutgoingHitSuccess(other, damage, skillinuse); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.Out(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -1430,7 +1430,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att } int exploss = 0; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); + Log.Out(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill); /* #1: Send death packet to everyone @@ -1692,7 +1692,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (!other) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!"); return false; } @@ -1710,7 +1710,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if (other->IsClient()) other->CastToClient()->RemoveXTarget(this, false); RemoveFromHateList(other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetName()); } return false; } @@ -1737,10 +1737,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //We dont factor much from the weapon into the attack. //Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons if(weapon) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); + Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID); if(Hand == MainSecondary && weapon->ItemType == ItemTypeShield){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack with shield canceled."); + Log.Out(Logs::Detail, Logs::Combat, "Attack with shield canceled."); return false; } @@ -1829,11 +1829,11 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //check if we're hitting above our max or below it. if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); + Log.Out(Logs::Detail, Logs::Combat, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); damage = (min_dmg+eleBane); } if((max_dmg+eleBane) != 0 && damage > (max_dmg+eleBane)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); + Log.Out(Logs::Detail, Logs::Combat, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); damage = (max_dmg+eleBane); } @@ -1846,7 +1846,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } if(other->IsClient() && other->CastToClient()->IsSitting()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); + Log.Out(Logs::Detail, Logs::Combat, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane)); damage = (max_dmg+eleBane); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); @@ -1857,7 +1857,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool hate += opts->hate_flat; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list other->AddToHateList(this, hate); @@ -1881,7 +1881,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool if(damage > 0) { CommonOutgoingHitSuccess(other, damage, skillinuse); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Generating hate %d towards %s", hate, GetName()); // now add done damage to the hate list if(damage > 0) other->AddToHateList(this, hate); @@ -1890,7 +1890,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage against %s: %d", other->GetName(), damage); + Log.Out(Logs::Detail, Logs::Combat, "Final damage against %s: %d", other->GetName(), damage); if(other->IsClient() && IsPet() && GetOwner()->IsClient()) { //pets do half damage to clients in pvp @@ -1902,7 +1902,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool //cant riposte a riposte if (bRiposte && damage == -3) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Riposte of riposte canceled."); + Log.Out(Logs::Detail, Logs::Combat, "Riposte of riposte canceled."); return false; } @@ -1954,7 +1954,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", other->GetName()); parse->EventNPC(EVENT_ATTACK, this, other, "", 0); } attacked_timer.Start(CombatEventTimer_expire); @@ -1991,7 +1991,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack } bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); + Log.Out(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); Mob *oos = nullptr; if(killerMob) { @@ -2028,7 +2028,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if (IsEngaged()) { zone->DelAggroMob(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); + Log.Out(Logs::Detail, Logs::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount()); } SetHP(0); SetPet(0); @@ -2580,7 +2580,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { if(DS == 0 && rev_ds == 0) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName()); //invert DS... spells yield negative values for a true damage shield if(DS < 0) { @@ -2625,7 +2625,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) { rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID; if(rev_ds < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName()); attacker->Damage(this, -rev_ds, rev_ds_spell_id, SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this //do we need to send a damage packet here also? } @@ -3137,7 +3137,7 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if(damage_to_reduce >= buffs[slot].melee_rune) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3145,7 +3145,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; @@ -3164,7 +3164,7 @@ int32 Mob::ReduceDamage(int32 damage) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if(!TryFadeEffect(slot)) @@ -3172,7 +3172,7 @@ int32 Mob::ReduceDamage(int32 damage) } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) @@ -3290,7 +3290,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if(!TryFadeEffect(slot)) @@ -3298,7 +3298,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" + Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) @@ -3437,11 +3437,11 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons // This method is called with skill_used=ABJURE for Damage Shield damage. bool FromDamageShield = (skill_used == SkillAbjuration); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", + Log.Out(Logs::Detail, Logs::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d", damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot); if (GetInvul() || DivineAura()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Avoiding %d damage due to invulnerability.", damage); + Log.Out(Logs::Detail, Logs::Combat, "Avoiding %d damage due to invulnerability.", damage); damage = -5; } @@ -3493,7 +3493,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int healed = damage; healed = attacker->GetActSpellHealing(spell_id, healed); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName()); attacker->HealDamage(healed); //we used to do a message to the client, but its gone now. @@ -3506,7 +3506,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse()) { if (!pet->IsHeld()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); + Log.Out(Logs::Detail, Logs::Aggro, "Sending pet %s into battle due to attack.", pet->GetName()); pet->AddToHateList(attacker, 1); pet->SetTarget(attacker); Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName()); @@ -3516,7 +3516,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //see if any runes want to reduce this damage if(spell_id == SPELL_UNKNOWN) { damage = ReduceDamage(damage); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee Damage reduced to %d", damage); + Log.Out(Logs::Detail, Logs::Combat, "Melee Damage reduced to %d", damage); damage = ReduceAllDamage(damage); TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker); } else { @@ -3573,7 +3573,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //fade mez if we are mezzed if (IsMezzed() && attacker) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Breaking mez due to attack."); + Log.Out(Logs::Detail, Logs::Combat, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); @@ -3616,7 +3616,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons int stun_resist = itembonuses.StunResist + spellbonuses.StunResist; int frontal_stun_resist = itembonuses.FrontalStunResist + spellbonuses.FrontalStunResist; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); + Log.Out(Logs::Detail, Logs::Combat, "Stun passed, checking resists. Was %d chance.", stun_chance); if (IsClient()) { stun_resist += aabonuses.StunResist; frontal_stun_resist += aabonuses.FrontalStunResist; @@ -3626,20 +3626,20 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons if (((GetBaseRace() == OGRE && IsClient()) || (frontal_stun_resist && zone->random.Roll(frontal_stun_resist))) && !attacker->BehindMob(this, attacker->GetX(), attacker->GetY())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); + Log.Out(Logs::Detail, Logs::Combat, "Frontal stun resisted. %d chance.", frontal_stun_resist); } else { // Normal stun resist check. if (stun_resist && zone->random.Roll(stun_resist)) { if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. %d chance.", stun_resist); + Log.Out(Logs::Detail, Logs::Combat, "Stun Resisted. %d chance.", stun_resist); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. %d resist chance.", stun_resist); + Log.Out(Logs::Detail, Logs::Combat, "Stunned. %d resist chance.", stun_resist); Stun(zone->random.Int(0, 2) * 1000); // 0-2 seconds } } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun failed. %d chance.", stun_chance); + Log.Out(Logs::Detail, Logs::Combat, "Stun failed. %d chance.", stun_chance); } } @@ -3653,7 +3653,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons //increment chances of interrupting if(IsCasting()) { //shouldnt interrupt on regular spell damage attacked_count++; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee attack while casting. Attack count %d", attacked_count); + Log.Out(Logs::Detail, Logs::Combat, "Melee attack while casting. Attack count %d", attacked_count); } } @@ -3859,7 +3859,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand) ProcChance += ProcChance * ProcBonus / 100.0f; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3878,7 +3878,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h ProcBonus += static_cast(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f; ProcChance = ProcChance + (ProcChance * ProcBonus); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(Logs::Detail, Logs::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -3887,7 +3887,7 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { if (!on) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!"); return; } @@ -3918,17 +3918,17 @@ void Mob::TryDefensiveProc(const ItemInst* weapon, Mob *on, uint16 hand) { void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) { if(!on) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); return; } if (!IsAttackAllowed(on)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preventing procing off of unattackable things."); + Log.Out(Logs::Detail, Logs::Combat, "Preventing procing off of unattackable things."); return; } if (DivineAura()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Procs canceled, Divine Aura is in effect."); + Log.Out(Logs::Detail, Logs::Combat, "Procs canceled, Divine Aura is in effect."); return; } @@ -3975,7 +3975,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on static_cast(weapon->ProcRate)) / 100.0f; if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really. if (weapon->Proc.Level > ourlevel) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Tried to proc (%s), but our level (%d) is lower than required (%d)", weapon->Name, ourlevel, weapon->Proc.Level); if (IsPet()) { @@ -3986,7 +3986,7 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on Message_StringID(13, PROC_TOOLOW); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)", weapon->Name, weapon->Proc.Effect, WPC * 100); ExecWeaponProc(inst, weapon->Proc.Effect, on); @@ -4065,12 +4065,12 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, // Perma procs (AAs) if (PermaProcs[i].spellID != SPELL_UNKNOWN) { if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus? - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Permanent proc %d procing spell %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); ExecWeaponProc(nullptr, PermaProcs[i].spellID, on); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Permanent proc %d failed to proc %d (%d percent chance)", i, PermaProcs[i].spellID, PermaProcs[i].chance); } @@ -4080,13 +4080,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (SpellProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(SpellProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Spell proc %d procing spell %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, SpellProcs[i].base_spellID); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Spell proc %d failed to proc %d (%.2f percent chance)", i, SpellProcs[i].spellID, chance); } @@ -4096,13 +4096,13 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, if (RangedProcs[i].spellID != SPELL_UNKNOWN) { float chance = ProcChance * (static_cast(RangedProcs[i].chance) / 100.0f); if (zone->random.Roll(chance)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Ranged proc %d procing spell %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); ExecWeaponProc(nullptr, RangedProcs[i].spellID, on); CheckNumHitsRemaining(NUMHIT_OffensiveSpellProcs, 0, RangedProcs[i].base_spellID); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, + Log.Out(Logs::Detail, Logs::Combat, "Ranged proc %d failed to proc %d (%.2f percent chance)", i, RangedProcs[i].spellID, chance); } @@ -4352,7 +4352,7 @@ bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Mob::DoRiposte(Mob* defender) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.Out(Logs::Detail, Logs::Combat, "Preforming a riposte"); if (!defender) return; @@ -4370,7 +4370,7 @@ void Mob::DoRiposte(Mob* defender) { //Live AA - Double Riposte if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); + Log.Out(Logs::Detail, Logs::Combat, "Preforming a double riposed (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); if (HasDied()) return; } @@ -4381,7 +4381,7 @@ void Mob::DoRiposte(Mob* defender) { DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1]; if(DoubleRipChance && zone->random.Roll(DoubleRipChance)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); + Log.Out(Logs::Detail, Logs::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)", DoubleRipChance); if (defender->GetClass() == MONK) defender->MonkSpecialAttack(this, defender->aabonuses.GiveDoubleRiposte[2]); @@ -4398,7 +4398,7 @@ void Mob::ApplyMeleeDamageBonus(uint16 skill, int32 &damage){ int dmgbonusmod = 0; dmgbonusmod += (100*(itembonuses.STR + spellbonuses.STR))/3; dmgbonusmod += (100*(spellbonuses.ATK + itembonuses.ATK))/5; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); + Log.Out(Logs::Detail, Logs::Combat, "Damage bonus: %d percent from ATK and STR bonuses.", (dmgbonusmod/100)); damage += (damage*dmgbonusmod/10000); } } @@ -4467,7 +4467,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui if (!on) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!"); return; } @@ -4692,13 +4692,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) { if (!TryFadeEffect(spellbonuses.Root[1])) { BuffFadeBySlot(spellbonuses.Root[1]); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell broke root! BreakChance percent chance"); + Log.Out(Logs::Detail, Logs::Combat, "Spell broke root! BreakChance percent chance"); return true; } } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Spell did not break root. BreakChance percent chance"); + Log.Out(Logs::Detail, Logs::Combat, "Spell did not break root. BreakChance percent chance"); return false; } @@ -4770,19 +4770,19 @@ void Mob::CommonBreakInvisible() { //break invis when you attack if(invisible) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a9d077bcf..fcb7f0ef9 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -77,9 +77,9 @@ void Client::CalcBonuses() CalcSpellBonuses(&spellbonuses); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); + Log.Out(Logs::Detail, Logs::AA, "Calculating AA Bonuses for %s.", this->GetCleanName()); CalcAABonuses(&aabonuses); //we're not quite ready for this - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); + Log.Out(Logs::Detail, Logs::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName()); RecalcWeight(); @@ -634,7 +634,7 @@ void Client::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.Out(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7d77d8bc3..1a6264306 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1225,7 +1225,7 @@ int32 Bot::acmod() return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); + Log.Out(Logs::General, Logs::Error, "Error in Bot::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; } @@ -1462,7 +1462,7 @@ void Bot::LoadAAs() { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadAAs()"); + Log.Out(Logs::General, Logs::Error, "Error in Bot::LoadAAs()"); return; } @@ -1564,7 +1564,7 @@ void Bot::ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon) if (effect == SE_Blank || (effect == SE_CHA && base1 == 0) || effect == SE_StackingCommand_Block || effect == SE_StackingCommand_Overwrite) continue; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); + Log.Out(Logs::Detail, Logs::AA, "Applying Effect %d from AA %u in slot %d (base1: %d, base2: %d) on %s", effect, aaid, slot, base1, base2, this->GetCleanName()); uint8 focus = IsFocusEffect(0, 0, true,effect); if (focus) @@ -2774,7 +2774,7 @@ void Bot::LoadStance() { std::string query = StringFormat("SELECT StanceID FROM botstances WHERE BotID = %u;", GetBotID()); auto results = database.QueryDatabase(query); if(!results.Success() || results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadStance()"); + Log.Out(Logs::General, Logs::Error, "Error in Bot::LoadStance()"); SetDefaultBotStance(); return; } @@ -2792,7 +2792,7 @@ void Bot::SaveStance() { "VALUES(%u, %u);", GetBotID(), GetBotStance()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveStance()"); + Log.Out(Logs::General, Logs::Error, "Error in Bot::SaveStance()"); } @@ -2807,7 +2807,7 @@ void Bot::LoadTimers() { GetBotID(), DisciplineReuseStart-1, DisciplineReuseStart-1, GetClass(), GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::LoadTimers()"); + Log.Out(Logs::General, Logs::Error, "Error in Bot::LoadTimers()"); return; } @@ -2847,7 +2847,7 @@ void Bot::SaveTimers() { } if(hadError) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Bot::SaveTimers()"); + Log.Out(Logs::General, Logs::Error, "Error in Bot::SaveTimers()"); } @@ -2979,7 +2979,7 @@ void Bot::BotRangedAttack(Mob* other) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Combat, "Bot Archery attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -2997,7 +2997,7 @@ void Bot::BotRangedAttack(Mob* other) { if(!RangeWeapon || !Ammo) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); + Log.Out(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetCleanName(), RangeWeapon->Name, RangeWeapon->ID, Ammo->Name, Ammo->ID); if(!IsAttackAllowed(other) || IsCasting() || @@ -3015,19 +3015,19 @@ void Bot::BotRangedAttack(Mob* other) { //break invis when you attack if(invisible) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -3362,7 +3362,7 @@ void Bot::AI_Process() { else if(!IsRooted()) { if(GetTarget() && GetTarget()->GetHateTop() && GetTarget()->GetHateTop() != this) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Returning to location prior to being summoned."); + Log.Out(Logs::Detail, Logs::AI, "Returning to location prior to being summoned."); CalculateNewPosition2(GetPreSummonX(), GetPreSummonY(), GetPreSummonZ(), GetRunspeed()); SetHeading(CalculateHeadingToTarget(GetPreSummonX(), GetPreSummonY())); return; @@ -3689,7 +3689,7 @@ void Bot::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -3972,7 +3972,7 @@ void Bot::PetAIProcess() { { botPet->SetRunAnimSpeed(0); if(!botPet->IsRooted()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); + Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetOwner()->GetRunspeed()); return; } @@ -4211,7 +4211,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { ItemInst* inst = database.CreateItem(item_id, charges, aug[0], aug[1], aug[2], aug[3], aug[4]); if (!inst) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); + Log.Out(Logs::General, Logs::Error, "Warning: botid %i has an invalid item_id %i in inventory slot %i", this->GetBotID(), item_id, slot_id); continue; } @@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) { // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); + Log.Out(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: botid=%i, item_id=%i, slot_id=%i",this->GetBotID(), item_id, slot_id); } @@ -5959,7 +5959,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ //handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds if(attacked_timer.Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", from->GetName()); parse->EventNPC(EVENT_ATTACK, this, from, "", 0); } @@ -5972,7 +5972,7 @@ void Bot::Damage(Mob *from, int32 damage, uint16 spell_id, SkillUseTypes attack_ // if spell is lifetap add hp to the caster if (spell_id != SPELL_UNKNOWN && IsLifetapSpell(spell_id)) { int healed = GetActSpellHealing(spell_id, damage); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); + Log.Out(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, GetCleanName()); HealDamage(healed); entity_list.MessageClose(this, true, 300, MT_Spells, "%s beams a smile at %s", GetCleanName(), from->GetCleanName() ); } @@ -6017,14 +6017,14 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b { if (!other) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Bot::Attack for evaluation!"); return false; } if(!GetTarget() || GetTarget() != other) SetTarget(other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); + Log.Out(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other?other->GetCleanName():"(nullptr)", Hand, FromRiposte?"(this is a riposte)":""); if ((IsCasting() && (GetClass() != BARD) && !IsFromSpell) || other == nullptr || @@ -6036,13 +6036,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b entity_list.MessageClose(this, 1, 200, 10, "%s says, '%s is not a legal target master.'", this->GetCleanName(), this->GetTarget()->GetCleanName()); if(other) { RemoveFromHateList(other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am not allowed to attack %s", other->GetCleanName()); + Log.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetCleanName()); } return false; } if(DivineAura()) {//cant attack while invulnerable - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Divine Aura is in effect."); + Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect."); return false; } @@ -6068,19 +6068,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(weapon != nullptr) { if (!weapon->IsWeapon()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID()); return(false); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); + Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking without a weapon."); + Log.Out(Logs::Detail, Logs::Combat, "Attacking without a weapon."); } // calculate attack_skill and skillinuse depending on hand and weapon // also send Packet to near clients SkillUseTypes skillinuse; AttackAnimation(skillinuse, Hand, weapon); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); + Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, skillinuse); /// Now figure out damage int damage = 0; @@ -6098,7 +6098,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b if(berserk && (GetClass() == BERSERKER)){ int bonus = 3 + GetLevel()/10; //unverified weapon_damage = weapon_damage * (100+bonus) / 100; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); + Log.Out(Logs::Detail, Logs::Combat, "Berserker damage bonus increases DMG to %d", weapon_damage); } //try a finishing blow.. if successful end the attack @@ -6163,7 +6163,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b else damage = zone->random.Int(min_hit, max_hit); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", + Log.Out(Logs::Detail, Logs::Combat, "Damage calculated to %d (min %d, max %d, str %d, skill %d, DMG %d, lv %d)", damage, min_hit, max_hit, GetSTR(), GetSkill(skillinuse), weapon_damage, GetLevel()); if(opts) { @@ -6175,7 +6175,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //check to see if we hit.. if(!other->CheckHitChance(other, skillinuse, Hand)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Attack missed. Damage set to 0."); + Log.Out(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0."); damage = 0; other->AddToHateList(this, 0); } else { //we hit, try to avoid it @@ -6185,13 +6185,13 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b ApplyMeleeDamageBonus(skillinuse, damage); damage += (itembonuses.HeroicSTR / 10) + (damage * other->GetSkillDmgTaken(skillinuse) / 100) + GetSkillDmgAmt(skillinuse); TryCriticalHit(other, skillinuse, damage, opts); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Generating hate %d towards %s", hate, GetCleanName()); + Log.Out(Logs::Detail, Logs::Combat, "Generating hate %d towards %s", hate, GetCleanName()); // now add done damage to the hate list //other->AddToHateList(this, hate); } else other->AddToHateList(this, 0); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all reductions: %d", damage); + Log.Out(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", damage); } //riposte @@ -6253,19 +6253,19 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b //break invis when you attack if(invisible) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack."); BuffFadeByEffect(SE_Invisibility); BuffFadeByEffect(SE_Invisibility2); invisible = false; } if(invisible_undead) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. undead due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack."); BuffFadeByEffect(SE_InvisVsUndead); BuffFadeByEffect(SE_InvisVsUndead2); invisible_undead = false; } if(invisible_animals){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Removing invisibility vs. animals due to melee attack."); + Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack."); BuffFadeByEffect(SE_InvisVsAnimals); invisible_animals = false; } @@ -7028,7 +7028,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel return 0; break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -7335,7 +7335,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.Out(Logs::General, Logs::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); } } //Check for spell skill limits. @@ -7378,7 +7378,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { ProcChance += ProcChance*ProcBonus / 100.0f; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); + Log.Out(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus); return ProcChance; } @@ -7414,7 +7414,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) ///////////////////////////////////////////////////////// if (IsEnraged() && !other->BehindMob(this, other->GetX(), other->GetY())) { damage = -3; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "I am enraged, riposting frontal attack."); + Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack."); } ///////////////////////////////////////////////////////// @@ -7556,7 +7556,7 @@ bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Final damage after all avoidances: %d", damage); + Log.Out(Logs::Detail, Logs::Combat, "Final damage after all avoidances: %d", damage); if (damage < 0) return true; @@ -7609,14 +7609,14 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) uint16 levelreq = aabonuses.FinishingBlowLvl[0]; if(defender->GetLevel() <= levelreq && (chance >= zone->random.Int(0, 1000))){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.Out(Logs::Detail, Logs::Combat, "Landed a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); defender->Damage(this, damage, SPELL_UNKNOWN, skillinuse); return true; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); + Log.Out(Logs::Detail, Logs::Combat, "FAILED a finishing blow: levelreq at %d, other level %d", levelreq , defender->GetLevel()); return false; } } @@ -7624,7 +7624,7 @@ bool Bot::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) } void Bot::DoRiposte(Mob* defender) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a riposte"); + Log.Out(Logs::Detail, Logs::Combat, "Preforming a riposte"); if (!defender) return; @@ -7637,7 +7637,7 @@ void Bot::DoRiposte(Mob* defender) { defender->GetItemBonuses().GiveDoubleRiposte[0]; if(DoubleRipChance && (DoubleRipChance >= zone->random.Int(0, 100))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); + Log.Out(Logs::Detail, Logs::Combat, "Preforming a double riposte (%d percent chance)", DoubleRipChance); defender->Attack(this, MainPrimary, true); } @@ -8207,7 +8207,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { float AttackerChance = 0.20f + ((float)(rangerLevel - 51) * 0.005f); float DefenderChance = (float)zone->random.Real(0.00f, 1.00f); if(AttackerChance > DefenderChance) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.Out(Logs::Detail, Logs::Combat, "Landed a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); // WildcardX: At the time I wrote this, there wasnt a string id for something like HEADSHOT_BLOW //entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, FINISHING_BLOW, GetName()); entity_list.MessageClose(this, false, 200, MT_CritMelee, "%s has scored a leathal HEADSHOT!", GetName()); @@ -8215,7 +8215,7 @@ bool Bot::TryHeadShot(Mob* defender, SkillUseTypes skillInUse) { Result = true; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); + Log.Out(Logs::Detail, Logs::Combat, "FAILED a headshot: Attacker chance was %f and Defender chance was %f.", AttackerChance, DefenderChance); } } } @@ -8441,11 +8441,11 @@ void Bot::ProcessGuildInvite(Client* guildOfficer, Bot* botToGuild) { return; } - // Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); + // Log.Out(Logs::Detail, Logs::Guilds, "Inviting %s (%d) into guild %s (%d)", botToGuild->GetName(), botToGuild->GetBotID(), guild_mgr.GetGuildName(client->GuildID()), client->GuildID()); SetBotGuildMembership(botToGuild->GetBotID(), guildOfficer->GuildID(), GUILD_MEMBER); - //Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); + //Log.LogDebugType(Logs::Detail, Logs::Guilds, "Sending char refresh for BOT %s from guild %d to world", botToGuild->GetName(), guildOfficer->GuildID(); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -8548,7 +8548,7 @@ int32 Bot::CalcMaxMana() { } default: { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -9076,7 +9076,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(zone && !zone->IsSpellBlocked(spell_id, GetX(), GetY(), GetZ())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.Out(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -9084,7 +9084,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -9105,7 +9105,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t //cannot cast under deivne aura if(DivineAura()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -9119,7 +9119,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -9127,7 +9127,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_t } if (HasActiveSong()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + Log.Out(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client //_StopSong(); bardsong = 0; @@ -9256,7 +9256,7 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not an undead."); + Log.Out(Logs::Detail, Logs::Spells, "Bot's target is not an undead."); return true; } } @@ -9266,13 +9266,13 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3) ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bot's target is not a summoned creature."); + Log.Out(Logs::Detail, Logs::Spells, "Bot's target is not a summoned creature."); return true; } } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No bot immunities to spell %d found.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "No bot immunities to spell %d found.", spell_id); } } @@ -15454,7 +15454,7 @@ bool EntityList::Bot_AICheckCloseBeneficialSpells(Bot* caster, uint8 iChance, fl // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 8f8e977a2..4c8609b6b 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -950,7 +950,7 @@ bool Bot::AI_PursueCastCheck() { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.Out(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { @@ -1055,7 +1055,7 @@ bool Bot::AI_EngagedCastCheck() { BotStanceType botStance = GetBotStance(); bool mayGetAggro = HasOrMayGetAggro(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); + Log.Out(Logs::Detail, Logs::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); if(botClass == CLERIC) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { diff --git a/zone/client.cpp b/zone/client.cpp index 8bf63010e..d7b34f2b9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -340,7 +340,7 @@ Client::~Client() { ToggleBuyerMode(false); if(conn_state != ClientConnectFinished) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); + Log.Out(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName()); ReportConnectingState(); } @@ -438,31 +438,31 @@ void Client::SendLogoutPackets() { void Client::ReportConnectingState() { switch(conn_state) { case NoPacketsReceived: //havent gotten anything - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client has not sent us an initial zone entry packet."); + Log.Out(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet."); break; case ReceivedZoneEntry: //got the first packet, loading up PP - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client sent initial zone packet, but we never got their player info from the database."); + Log.Out(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database."); break; case PlayerProfileLoaded: //our DB work is done, sending it - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); + Log.Out(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished."); break; case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We successfully sent player info and spawns, waiting for client to request new zone."); + Log.Out(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone."); break; case NewZoneRequested: //received and sent new zone request - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received client's new zone request, waiting for client spawn request."); + Log.Out(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request."); break; case ClientSpawnRequested: //client sent ReqClientSpawn - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); + Log.Out(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished."); break; case ZoneContentsSent: //objects, doors, zone points - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); + Log.Out(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification."); break; case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "We received client ready notification, but never finished Client::CompleteConnect"); + Log.Out(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect"); break; case ClientConnectFinished: //client finally moved to finished state, were done here - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client is successfully connected."); + Log.Out(Logs::General, Logs::None, "Client is successfully connected."); break; }; } @@ -650,7 +650,7 @@ bool Client::SendAllPackets() { if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req); iterator.RemoveCurrent(); - Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Client_Server_Packet, "Transmitting a packet"); + Log.Out(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet"); } return true; } @@ -698,7 +698,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char message[4096]; strn0cpy(message, orig_message, sizeof(message)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); + Log.Out(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message); if (targetname == nullptr) { targetname = (!GetTarget()) ? "" : GetTarget()->GetName(); @@ -1506,7 +1506,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + Log.Out(Logs::Moderate, Logs::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); @@ -1911,7 +1911,7 @@ void Client::ReadBook(BookRequest_Struct *book) { if (booktxt2[0] != '\0') { #if EQDEBUG >= 6 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); + Log.Out(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str()); #endif EQApplicationPacket* outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct)); @@ -2105,7 +2105,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ SaveCurrency(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); + Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); } void Client::EVENT_ITEM_ScriptStopReturn(){ @@ -2145,7 +2145,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat SaveCurrency(); #if (EQDEBUG>=5) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", + Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper); #endif } @@ -2235,13 +2235,13 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); + Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); } return false; } @@ -2262,10 +2262,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); } } @@ -2364,7 +2364,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 Save(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Reset %s's caster specialization skills to 1. " + Log.Out(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. " "Too many specializations skills were above 50.", GetCleanName()); } @@ -4544,14 +4544,14 @@ void Client::HandleLDoNOpen(NPC *target) { if(target->GetClass() != LDON_TREASURE) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was not a treasure chest.", + Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.", GetName(), target->GetName(), target->GetName()); return; } if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s tried to open %s but %s was out of range", + Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); Message(13, "Treasure chest out of range."); return; @@ -5294,7 +5294,7 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -5362,7 +5362,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -5389,7 +5389,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " @@ -5397,7 +5397,7 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); @@ -6211,7 +6211,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid PetRecord record; if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); + Log.Out(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id); Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } @@ -6225,7 +6225,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid const NPCType *npc_type = database.GetNPCType(pet.npc_id); if(npc_type == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); + Log.Out(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id); Message(0,"Unable to find pet!"); return; } @@ -8149,7 +8149,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Eating from slot:%i", (int)slot); + Log.Out(Logs::General, Logs::None, "Eating from slot:%i", (int)slot); #endif } else @@ -8166,7 +8166,7 @@ void Client::Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_ entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name); #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking from slot:%i", (int)slot); + Log.Out(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot); #endif } } @@ -8289,11 +8289,11 @@ std::string Client::TextLink::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > 250)) { m_Error = true; m_Link = ""; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", + Log.Out(Logs::General, Logs::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})", m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length()); #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ">> LinkText: %s", m_LinkText.c_str()); + Log.Out(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str()); + Log.Out(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str()); #endif } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index ff7c44010..f3c17a4d2 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -826,7 +826,7 @@ int32 Client::acmod() { return (65 + ((agility-300) / 21)); } #if EQDEBUG >= 11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); + Log.Out(Logs::General, Logs::Error, "Error in Client::acmod(): Agility: %i, Level: %i",agility,level); #endif return 0; }; @@ -935,7 +935,7 @@ int32 Client::CalcMaxMana() break; } default: { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -956,7 +956,7 @@ int32 Client::CalcMaxMana() } #if EQDEBUG >= 11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.Out(Logs::General, Logs::None, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1046,14 +1046,14 @@ int32 Client::CalcBaseMana() break; } default: { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); + Log.Out(Logs::General, Logs::None, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; } @@ -1896,7 +1896,7 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const if (effectmod > effectmodcap) effectmod = effectmodcap; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", + Log.Out(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, effectmod, effectmodcap); return effectmod; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 188ada287..1347fa2d5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -401,7 +401,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) if(is_log_enabled(CLIENT__NET_IN_TRACE)) { char buffer[64]; app->build_header_dump(buffer); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Dispatch opcode: %s", buffer); + Log.Out(Logs::Detail, Logs::Client_Server_Packet, "Dispatch opcode: %s", buffer); } EmuOpcode opcode = app->GetOpcode(); @@ -416,7 +416,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) #ifdef SOLAR if(0 && opcode != OP_ClientUpdate) { - Log.LogDebug(EQEmuLogSys::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); + Log.LogDebug(Logs::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); std::cerr << "OPCODE: " << std::hex << std::setw(4) << std::setfill('0') << opcode << std::dec << ", size: " << app->size << std::endl; DumpPacket(app); } @@ -431,7 +431,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); #if EQDEBUG >= 10 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" + Log.Out(Logs::General, Logs::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); DumpPacket(app); #endif @@ -460,8 +460,8 @@ int Client::HandlePacket(const EQApplicationPacket *app) parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 0, &args); char buffer[64]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); - if (Log.log_settings[EQEmuLogSys::Client_Server_Packet].log_to_console > 0){ + Log.Out(Logs::Detail, Logs::Client_Server_Packet, "Unhandled incoming opcode: %s - 0x%04x", OpcodeManager::EmuToName(app->GetOpcode()), app->GetOpcode()); + if (Log.log_settings[Logs::Client_Server_Packet].log_to_console > 0){ app->build_header_dump(buffer); if (app->size < 1000) DumpPacket(app, app->size); @@ -483,7 +483,7 @@ int Client::HandlePacket(const EQApplicationPacket *app) case CLIENT_LINKDEAD: break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown client_state: %d\n", client_state); + Log.Out(Logs::General, Logs::None, "Unknown client_state: %d\n", client_state); break; } @@ -759,7 +759,7 @@ void Client::CompleteConnect() //enforce some rules.. if (!CanBeInZone()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Kicking char from zone, not allowed here"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Kicking char from zone, not allowed here"); GoToSafeCoords(database.GetZoneID("arena"), 0); return; } @@ -966,7 +966,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", sizeof(ApproveZone_Struct), app->size); return; } @@ -979,14 +979,14 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", sizeof(ClientError_Struct), app->size); return; } // Client reporting error to server ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message: %s", error->message); + Log.Out(Logs::General, Logs::Error, "Client error: %s", error->character_name); + Log.Out(Logs::General, Logs::Error, "Error message: %s", error->message); Message(13, error->message); #if (EQDEBUG>=5) DumpPacket(app); @@ -1180,7 +1180,7 @@ void Client::Handle_Connect_OP_SendTributes(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_SetServerFilter"); + Log.Out(Logs::General, Logs::Error, "Received invalid sized OP_SetServerFilter"); DumpPacket(app); return; } @@ -1197,7 +1197,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_TGB: Expected %i, Got %i", sizeof(uint32), app->size); return; } @@ -1317,14 +1317,14 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) ClientVersionBit = 0; bool siv = m_inv.SetInventoryVersion(ClientVersion); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + Log.Out(Logs::General, Logs::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object */ Client* client = entity_list.GetClientByName(cze->char_name); if (!zone->GetAuth(ip, cze->char_name, &WID, &account_id, &character_id, &admin, lskey, &tellsoff)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetAuth() returned false kicking client"); + Log.Out(Logs::General, Logs::Error, "GetAuth() returned false kicking client"); if (client != 0) { client->Save(); client->Kick(); @@ -1340,7 +1340,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + Log.Out(Logs::General, Logs::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -1729,7 +1729,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) p_timers.SetCharID(CharacterID()); if (!p_timers.Load(&database)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); + Log.Out(Logs::General, Logs::Error, "Unable to load ability timers from the database for %s (%i)!", GetCleanName(), CharacterID()); } /* Load Spell Slot Refresh from Currently Memoried Spells */ @@ -1899,7 +1899,7 @@ void Client::Handle_0x0193(const EQApplicationPacket *app) void Client::Handle_OP_AAAction(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Received OP_AAAction"); + Log.Out(Logs::Detail, Logs::AA, "Received OP_AAAction"); if (app->size != sizeof(AA_Action)){ printf("Error! OP_AAAction size didnt match!\n"); @@ -1908,7 +1908,7 @@ void Client::Handle_OP_AAAction(const EQApplicationPacket *app) AA_Action* action = (AA_Action*)app->pBuffer; if (action->action == aaActionActivate) {//AA Hotkey - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Activating AA %d", action->ability); + Log.Out(Logs::Detail, Logs::AA, "Activating AA %d", action->ability); ActivateAA((aaID)action->ability); } else if (action->action == aaActionBuy) { @@ -1940,7 +1940,7 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app) { if (app->size != sizeof(AcceptNewTask_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_AcceptNewTask expected %i got %i", sizeof(AcceptNewTask_Struct), app->size); DumpPacket(app); return; @@ -1955,7 +1955,7 @@ void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app) { if (app->size < sizeof(EntityId_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); + Log.Out(Logs::General, Logs::Error, "Handle_OP_AdventureInfoRequest had a packet that was too small."); return; } EntityId_Struct* ent = (EntityId_Struct*)app->pBuffer; @@ -2010,7 +2010,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Purchase_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_AdventureMerchantPurchase expected:%i got:%i", sizeof(Adventure_Purchase_Struct), app->size); return; } @@ -2190,7 +2190,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) { if (app->size != sizeof(AdventureMerchant_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_AdventureMerchantRequest expected:%i got:%i", sizeof(AdventureMerchant_Struct), app->size); return; } std::stringstream ss(std::stringstream::in | std::stringstream::out); @@ -2280,7 +2280,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) { if (app->size != sizeof(Adventure_Sell_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", + Log.Out(Logs::General, Logs::None, "Size mismatch on OP_AdventureMerchantSell: got %u expected %u", app->size, sizeof(Adventure_Sell_Struct)); DumpPacket(app); return; @@ -2412,7 +2412,7 @@ void Client::Handle_OP_AdventureRequest(const EQApplicationPacket *app) { if (app->size < sizeof(AdventureRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Handle_OP_AdventureRequest had a packet that was too small."); + Log.Out(Logs::General, Logs::Error, "Handle_OP_AdventureRequest had a packet that was too small."); return; } @@ -2938,7 +2938,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(Logs::General, Logs::Error, "Received invalid sized " "OP_Animation: got %d, expected %d", app->size, sizeof(Animation_Struct)); DumpPacket(app); @@ -2957,7 +2957,7 @@ void Client::Handle_OP_Animation(const EQApplicationPacket *app) void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) { if (app->size != sizeof(ApplyPoison_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_ApplyPoison, size=%i, expected %i", app->size, sizeof(ApplyPoison_Struct)); DumpPacket(app); return; } @@ -2971,7 +2971,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) if (!IsPoison) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " + Log.Out(Logs::Detail, Logs::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); @@ -2994,7 +2994,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); + Log.Out(Logs::General, Logs::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } } @@ -3009,7 +3009,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) void Client::Handle_OP_Assist(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_Assist expected %i got %i", sizeof(EntityId_Struct), app->size); return; } @@ -3039,7 +3039,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) void Client::Handle_OP_AssistGroup(const EQApplicationPacket *app) { if (app->size != sizeof(EntityId_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_AssistGroup expected %i got %i", sizeof(EntityId_Struct), app->size); return; } QueuePacket(app); @@ -3052,7 +3052,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) // Some clients this seems to nuke the charm text (ex. Adventurer's Stone) if (app->size != sizeof(AugmentInfo_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AugmentInfo expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_AugmentInfo expected %i got %i", sizeof(AugmentInfo_Struct), app->size); DumpPacket(app); return; @@ -3071,7 +3071,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", sizeof(AugmentItem_Struct), app->size); return; } @@ -3228,7 +3228,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app) { if (app->size != 4) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_AutoAttack expected:4 got:%i", app->size); return; } @@ -3295,7 +3295,7 @@ void Client::Handle_OP_AutoAttack2(const EQApplicationPacket *app) void Client::Handle_OP_AutoFire(const EQApplicationPacket *app) { if (app->size != sizeof(bool)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_AutoFire expected %i got %i", sizeof(bool), app->size); DumpPacket(app); return; } @@ -3311,7 +3311,7 @@ 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)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Bandolier expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_Bandolier expected %i got %i", sizeof(BandolierCreate_Struct), app->size); DumpPacket(app); return; @@ -3330,7 +3330,7 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app) SetBandolier(app); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Uknown Bandolier action %i", bs->action); + Log.Out(Logs::General, Logs::None, "Uknown Bandolier action %i", bs->action); } } @@ -3339,7 +3339,7 @@ void Client::Handle_OP_BankerChange(const EQApplicationPacket *app) { if (app->size != sizeof(BankerChange_Struct) && app->size != 4) //Titanium only sends 4 Bytes for this { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_BankerChange expected %i got %i", sizeof(BankerChange_Struct), app->size); DumpPacket(app); return; } @@ -3424,7 +3424,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) if (app->size < 4) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); + Log.Out(Logs::General, Logs::None, "OP_Barter packet below minimum expected size. The packet was %i bytes.", app->size); DumpPacket(app); return; } @@ -3572,7 +3572,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) default: Message(13, "Unrecognised Barter action."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unrecognised Barter Action %i", Action); + Log.Out(Logs::Detail, Logs::Trading, "Unrecognised Barter Action %i", Action); } } @@ -3580,7 +3580,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", sizeof(BazaarInspect_Struct), app->size); return; } @@ -3635,8 +3635,8 @@ void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) return; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); + Log.Out(Logs::Detail, Logs::Trading, "Malformed BazaarSearch_Struct packe, Action %it received, ignoring..."); + Log.Out(Logs::General, Logs::Error, "Malformed BazaarSearch_Struct packet received, ignoring...\n"); } return; @@ -3721,16 +3721,16 @@ void Client::Handle_OP_Begging(const EQApplicationPacket *app) void Client::Handle_OP_Bind_Wound(const EQApplicationPacket *app) { if (app->size != sizeof(BindWound_Struct)){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Bind wound packet"); + Log.Out(Logs::General, Logs::Error, "Size mismatch for Bind wound packet"); DumpPacket(app); } BindWound_Struct* bind_in = (BindWound_Struct*)app->pBuffer; Mob* bindmob = entity_list.GetMob(bind_in->to); if (!bindmob){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); + Log.Out(Logs::General, Logs::Error, "Bindwound on non-exsistant mob from %s", this->GetName()); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); + Log.Out(Logs::General, Logs::None, "BindWound in: to:\'%s\' from=\'%s\'", bindmob->GetName(), GetName()); BindWound(bindmob, true); } return; @@ -3743,7 +3743,7 @@ void Client::Handle_OP_BlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_BlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -3838,7 +3838,7 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app) // this sends unclean mob name, so capped at 64 // a_boat006 if (app->size <= 5 || app->size > 64) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); + Log.Out(Logs::General, Logs::Error, "Size mismatch in OP_BoardBoad. Expected greater than 5 less than 64, got %i", app->size); DumpPacket(app); return; } @@ -3859,14 +3859,14 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) { if (app->size != sizeof(SpellBuffFade_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "Size mismatch in OP_Buff. expected %i got %i", sizeof(SpellBuffFade_Struct), app->size); DumpPacket(app); return; } SpellBuffFade_Struct* sbf = (SpellBuffFade_Struct*)app->pBuffer; uint32 spid = sbf->spellid; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Client requested that buff with spell id %d be canceled.", spid); + Log.Out(Logs::Detail, Logs::Spells, "Client requested that buff with spell id %d be canceled.", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and @@ -3941,7 +3941,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTask_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_CancelTask expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_CancelTask expected %i got %i", sizeof(CancelTask_Struct), app->size); DumpPacket(app); return; @@ -3955,7 +3955,7 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app) void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app) { if (app->size != sizeof(CancelTrade_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_CancelTrade, size=%i, expected %i", app->size, sizeof(CancelTrade_Struct)); return; } Mob* with = trade->With(); @@ -4006,16 +4006,16 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) targetring_z = castspell->z_pos; #ifdef _EQDEBUG - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.Out(Logs::General, Logs::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[0], castspell->cs_unknown[0]); + Log.Out(Logs::General, Logs::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[1], castspell->cs_unknown[1]); + Log.Out(Logs::General, Logs::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[2], castspell->cs_unknown[2]); + Log.Out(Logs::General, Logs::None, "cs_unknown2: %u %i", (uint8)castspell->cs_unknown[3], castspell->cs_unknown[3]); + Log.Out(Logs::General, Logs::None, "cs_unknown2: 32 %p %u", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.Out(Logs::General, Logs::None, "cs_unknown2: 32 %p %i", &castspell->cs_unknown, *(uint32*)castspell->cs_unknown); + Log.Out(Logs::General, Logs::None, "cs_unknown2: 16 %p %u %u", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); + Log.Out(Logs::General, Logs::None, "cs_unknown2: 16 %p %i %i", &castspell->cs_unknown, *(uint16*)castspell->cs_unknown, *(uint16*)castspell->cs_unknown + sizeof(uint16)); #endif - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + Log.Out(Logs::General, Logs::None, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); std::cout << "OP_CastSpell " << castspell->slot << " spell " << castspell->spell_id << " inventory slot " << castspell->inventoryslot << "\n" << std::endl; @@ -4047,7 +4047,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) //discipline, using the item spell slot if (castspell->inventoryslot == INVALID_INDEX) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + Log.Out(Logs::General, Logs::None, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); } return; @@ -4190,7 +4190,7 @@ void Client::Handle_OP_ClearBlockedBuffs(const EQApplicationPacket *app) if (app->size != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_ClearBlockedBuffs expected 1 got %i", app->size); DumpPacket(app); @@ -4212,7 +4212,7 @@ void Client::Handle_OP_ClearNPCMarks(const EQApplicationPacket *app) if (app->size != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_ClearNPCMarks expected 0 got %i", app->size); DumpPacket(app); @@ -4234,7 +4234,7 @@ void Client::Handle_OP_ClearSurname(const EQApplicationPacket *app) void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) { if (app->size != sizeof(ClickDoor_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_ClickDoor, size=%i, expected %i", app->size, sizeof(ClickDoor_Struct)); return; } ClickDoor_Struct* cd = (ClickDoor_Struct*)app->pBuffer; @@ -4259,7 +4259,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", sizeof(ClickObject_Struct), app->size); return; } @@ -4310,7 +4310,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4323,11 +4323,11 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) object->Close(); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); + Log.Out(Logs::General, Logs::Error, "Unsupported action %d in OP_ClickObjectAction", oos->open); } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); + Log.Out(Logs::General, Logs::Error, "Invalid object %d in OP_ClickObjectAction", oos->drop_id); } } @@ -4344,8 +4344,8 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) void Client::Handle_OP_ClientError(const EQApplicationPacket *app) { ClientError_Struct* error = (ClientError_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client error: %s", error->character_name); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error message:%s", error->message); + Log.Out(Logs::General, Logs::Error, "Client error: %s", error->character_name); + Log.Out(Logs::General, Logs::Error, "Error message:%s", error->message); return; } @@ -4366,7 +4366,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct)+1) ) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer; @@ -4718,7 +4718,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in Consider expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4812,7 +4812,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app) { if (app->size != sizeof(Consider_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in Consider corpse expected %i got %i", sizeof(Consider_Struct), app->size); return; } Consider_Struct* conin = (Consider_Struct*)app->pBuffer; @@ -4872,7 +4872,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) { if (app->size != sizeof(Consume_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_Consume expected:%i got:%i", sizeof(Consume_Struct), app->size); return; } Consume_Struct* pcs = (Consume_Struct*)app->pBuffer; @@ -4909,7 +4909,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) ItemInst *myitem = GetInv().GetItem(pcs->slot); if (myitem == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Consuming from empty slot %d", pcs->slot); + Log.Out(Logs::General, Logs::Error, "Consuming from empty slot %d", pcs->slot); return; } @@ -4921,7 +4921,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) Consume(eat_item, ItemTypeDrink, pcs->slot, (pcs->auto_consumed == 0xffffffff)); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); + Log.Out(Logs::General, Logs::Error, "OP_Consume: unknown type, type:%i", (int)pcs->type); return; } if (m_pp.hunger_level > 50000) @@ -4942,7 +4942,7 @@ void Client::Handle_OP_Consume(const EQApplicationPacket *app) void Client::Handle_OP_ControlBoat(const EQApplicationPacket *app) { if (app->size != sizeof(ControlBoat_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_ControlBoat, size=%i, expected %i", app->size, sizeof(ControlBoat_Struct)); return; } ControlBoat_Struct* cbs = (ControlBoat_Struct*)app->pBuffer; @@ -5098,7 +5098,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, + Log.Out(Logs::General, Logs::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; @@ -5136,7 +5136,7 @@ void Client::Handle_OP_DelegateAbility(const EQApplicationPacket *app) if (app->size != sizeof(DelegateAbility_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DelegateAbility expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_DelegateAbility expected %i got %i", sizeof(DelegateAbility_Struct), app->size); DumpPacket(app); @@ -5311,7 +5311,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) if (app->size != sizeof(DoGroupLeadershipAbility_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_DoGroupLeadershipAbility expected %i got %i", sizeof(DoGroupLeadershipAbility_Struct), app->size); DumpPacket(app); @@ -5363,7 +5363,7 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app) } default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", + Log.Out(Logs::General, Logs::None, "Got unhandled OP_DoGroupLeadershipAbility Ability: %d Parameter: %d", dglas->Ability, dglas->Parameter); break; } @@ -5445,7 +5445,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(Logs::General, Logs::Error, "Received invalid sized " "OP_Emote: got %d, expected %d", app->size, sizeof(Emote_Struct)); DumpPacket(app); @@ -5536,7 +5536,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, + Log.Out(Logs::General, Logs::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; @@ -5591,7 +5591,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", sizeof(FaceChange_Struct), app->size); return; } @@ -5832,7 +5832,7 @@ void Client::Handle_OP_FriendsWho(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildMOTD"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GetGuildMOTD"); SendGuildMOTD(true); @@ -5845,7 +5845,7 @@ void Client::Handle_OP_GetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GetGuildsList"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GetGuildsList"); SendGuildList(); } @@ -5858,7 +5858,7 @@ void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app) return; } if (app->size != sizeof(BecomeNPC_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMBecomeNPC, size=%i, expected %i", app->size, sizeof(BecomeNPC_Struct)); return; } //entity_list.QueueClients(this, app, false); @@ -5910,7 +5910,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMEmoteZone_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMEmoteZone, size=%i, expected %i", app->size, sizeof(GMEmoteZone_Struct)); return; } GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer; @@ -5927,7 +5927,7 @@ void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app) void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainEnd_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_GMEndTraining expected %i got %i", sizeof(GMTrainEnd_Struct), app->size); DumpPacket(app); return; } @@ -5943,7 +5943,7 @@ void Client::Handle_OP_GMFind(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMSummon_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMFind, size=%i, expected %i", app->size, sizeof(GMSummon_Struct)); return; } //Break down incoming @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app) return; } if (app->size != sizeof(SpawnAppearance_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMHideMe, size=%i, expected %i", app->size, sizeof(SpawnAppearance_Struct)); return; } SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer; @@ -6058,7 +6058,7 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app) return; } if (app->size != sizeof(GMKill_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMKill, size=%i, expected %i", app->size, sizeof(GMKill_Struct)); return; } GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer; @@ -6125,7 +6125,7 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app) void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) { if (app->size != sizeof(GMName_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GMNameChange, size=%i, expected %i", app->size, sizeof(GMName_Struct)); return; } const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer; @@ -6135,7 +6135,7 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app) return; } Client* client = entity_list.GetClientByName(gmn->oldname); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); + Log.Out(Logs::General, Logs::Status, "GM(%s) changeing players name. Old:%s New:%s", GetName(), gmn->oldname, gmn->newname); bool usedname = database.CheckUsedName((const char*)gmn->newname); if (client == 0) { Message(13, "%s not found for name change. Operation failed!", gmn->oldname); @@ -6177,7 +6177,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) if (app->size < sizeof(GMSearchCorpse_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", + Log.Out(Logs::General, Logs::None, "OP_GMSearchCorpse size lower than expected: got %u expected at least %u", app->size, sizeof(GMSearchCorpse_Struct)); DumpPacket(app); return; @@ -6300,7 +6300,7 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app) void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) { if (app->size != sizeof(GMTrainee_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_GMTraining expected %i got %i", sizeof(GMTrainee_Struct), app->size); DumpPacket(app); return; } @@ -6311,7 +6311,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app) void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app) { if (app->size != sizeof(GMSkillChange_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_GMTrainSkill expected %i got %i", sizeof(GMSkillChange_Struct), app->size); DumpPacket(app); return; } @@ -6379,7 +6379,7 @@ void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app) return; } if (app->size < sizeof(uint32)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_GMZoneRequest2 expected:%i got:%i", sizeof(uint32), app->size); return; } @@ -6396,7 +6396,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", sizeof(GroupCancel_Struct), app->size); return; } @@ -6440,12 +6440,12 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member Disband Request from %s\n", GetName()); + Log.Out(Logs::General, Logs::None, "Member Disband Request from %s\n", GetName()); GroupGeneric_Struct* gd = (GroupGeneric_Struct*)app->pBuffer; @@ -6587,7 +6587,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); + Log.Out(Logs::General, Logs::Error, "Failed to remove player from group. Unable to find player named %s in player group", gd->name2); } } if (LFP) @@ -6607,7 +6607,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6656,7 +6656,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", sizeof(GroupInvite_Struct), app->size); return; } @@ -6725,7 +6725,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) if (g->IsLeader(this)) g->ChangeLeader(NewLeader); else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.Out(Logs::General, Logs::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6734,7 +6734,7 @@ void Client::Handle_OP_GroupMakeLeader(const EQApplicationPacket *app) void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) { if (app->size != sizeof(GroupMentor_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GroupMentor, size=%i, expected %i", app->size, sizeof(GroupMentor_Struct)); DumpPacket(app); return; } @@ -6770,7 +6770,7 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app) void Client::Handle_OP_GroupRoles(const EQApplicationPacket *app) { if (app->size != sizeof(GroupRole_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GroupRoles, size=%i, expected %i", app->size, sizeof(GroupRole_Struct)); DumpPacket(app); return; } @@ -6816,7 +6816,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(GroupUpdate_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", + Log.Out(Logs::General, Logs::None, "Size mismatch on OP_GroupUpdate: got %u expected %u", app->size, sizeof(GroupUpdate_Struct)); DumpPacket(app); return; @@ -6835,7 +6835,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) if (group->IsLeader(this)) group->ChangeLeader(newleader); else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group /makeleader request originated from non-leader member: %s", GetName()); + Log.Out(Logs::General, Logs::None, "Group /makeleader request originated from non-leader member: %s", GetName()); DumpPacket(app); } } @@ -6844,7 +6844,7 @@ void Client::Handle_OP_GroupUpdate(const EQApplicationPacket *app) default: { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); + Log.Out(Logs::General, Logs::None, "Received unhandled OP_GroupUpdate requesting action %u", gu->action); DumpPacket(app); return; } @@ -6864,7 +6864,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) } if (app->size < sizeof(uint32)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_GuildBank, size=%i, expected %i", app->size, sizeof(uint32)); DumpPacket(app); return; } @@ -6889,7 +6889,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { if ((Action != GuildBankDeposit) && (Action != GuildBankViewItem) && (Action != GuildBankWithdraw)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected hacking attempt on guild bank from %s", GetName()); + Log.Out(Logs::General, Logs::Error, "Suspected hacking attempt on guild bank from %s", GetName()); GuildBankAck(); @@ -7050,7 +7050,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!IsGuildBanker() && !GuildBanks->AllowedToWithdraw(GuildID(), gbwis->Area, gbwis->SlotID, GetName())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Suspected attempted hack on the guild bank from %s", GetName()); + Log.Out(Logs::General, Logs::Error, "Suspected attempted hack on the guild bank from %s", GetName()); GuildBankAck(); @@ -7121,7 +7121,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "Unexpected GuildBank action."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); + Log.Out(Logs::General, Logs::Error, "Received unexpected guild bank action code %i from %s", Action, GetName()); } } } @@ -7192,7 +7192,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) uint32 NewGuildID = guild_mgr.CreateGuild(GuildName, CharacterID()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d via UF+ GUI. It was given id %lu.", GetName(), GuildName, CharacterID(), (unsigned long)NewGuildID); if (NewGuildID == GUILD_NONE) @@ -7214,12 +7214,12 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDelete"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildDelete"); if (!IsInAGuild() || !guild_mgr.IsGuildLeader(GuildID(), CharacterID())) Message(0, "You are not a guild leader or not in a guild."); else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); + Log.Out(Logs::Detail, Logs::Guilds, "Deleting guild %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID()); if (!guild_mgr.DeleteGuild(GuildID())) Message(0, "Guild delete failed."); else { @@ -7230,10 +7230,10 @@ void Client::Handle_OP_GuildDelete(const EQApplicationPacket *app) void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildDemote"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildDemote"); if (app->size != sizeof(GuildDemoteStruct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); + Log.Out(Logs::Detail, Logs::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildDemoteStruct)); return; } @@ -7263,7 +7263,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) uint8 rank = gci.rank - 1; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Demoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", demote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7281,7 +7281,7 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app) void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInvite"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildInvite"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildInvite, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7322,7 +7322,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) //we could send this to the member and prompt them to see if they want to //be demoted (I guess), but I dont see a point in that. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "%s (%d) is demoting %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7341,7 +7341,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "%s (%d) is asking to promote %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), client->GetName(), client->CharacterID(), gc->officer, @@ -7353,7 +7353,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildInvite for promotion to %s, length %d", client->GetName(), app->size); client->QueuePacket(app); } @@ -7376,7 +7376,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Inviting %s (%d) into guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Inviting %s (%d) into guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7386,7 +7386,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) if (gc->guildeqid == 0) gc->guildeqid = GuildID(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildInvite for invite to %s, length %d", client->GetName(), app->size); client->SetPendingGuildInvitation(true); client->QueuePacket(app); @@ -7409,7 +7409,7 @@ void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app) void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildInviteAccept"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildInviteAccept"); SetPendingGuildInvitation(false); @@ -7445,7 +7445,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) else if (!worldserver.Connected()) Message(0, "Error: World server disconnected"); else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", + Log.Out(Logs::Detail, Logs::Guilds, "Guild Invite Accept: guild %d, response %d, inviter %s, person %s", gj->guildeqid, gj->response, gj->inviter, gj->newmember); //we dont really care a lot about what this packet means, as long as @@ -7459,7 +7459,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) if (gj->guildeqid == GuildID()) { //only need to change rank. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Changing guild rank of %s (%d) to rank %d in guild %s (%d)", GetName(), CharacterID(), gj->response, guild_mgr.GetGuildName(GuildID()), GuildID()); @@ -7471,7 +7471,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", + Log.Out(Logs::Detail, Logs::Guilds, "Adding %s (%d) to guild %s (%d) at rank %d", GetName(), CharacterID(), guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid, gj->response); @@ -7500,10 +7500,10 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildLeader"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildLeader"); if (app->size < 2) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Invalid length %d on OP_GuildLeader", app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Invalid length %d on OP_GuildLeader", app->size); return; } @@ -7522,7 +7522,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) Client* newleader = entity_list.GetClientByName(gml->target); if (newleader) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Transfering leadership of %s (%d) to %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Transfering leadership of %s (%d) to %s (%d)", guild_mgr.GetGuildName(GuildID()), GuildID(), newleader->GetName(), newleader->CharacterID()); @@ -7543,9 +7543,9 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app) void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildManageBanker of len %d", app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Got OP_GuildManageBanker of len %d", app->size); if (app->size != sizeof(GuildManageBanker_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); + Log.Out(Logs::Detail, Logs::Guilds, "Error: app size of %i != size of OP_GuildManageBanker of %i\n", app->size, sizeof(GuildManageBanker_Struct)); return; } GuildManageBanker_Struct* gmb = (GuildManageBanker_Struct*)app->pBuffer; @@ -7620,16 +7620,16 @@ void Client::Handle_OP_GuildManageBanker(const EQApplicationPacket *app) void Client::Handle_OP_GuildPeace(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildPeace of len %d", app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Got OP_GuildPeace of len %d", app->size); return; } void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPromote"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildPromote"); if (app->size != sizeof(GuildPromoteStruct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); + Log.Out(Logs::Detail, Logs::Guilds, "Error: app size of %i != size of GuildDemoteStruct of %i\n", app->size, sizeof(GuildPromoteStruct)); return; } @@ -7658,7 +7658,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)", promote->target, gci.char_id, guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank, guild_mgr.GetRankName(GuildID(), rank), rank, @@ -7675,7 +7675,7 @@ void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app) void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildPublicNote"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildPublicNote"); if (app->size < sizeof(GuildUpdate_PublicNote)) { // client calls for a motd on login even if they arent in a guild @@ -7694,7 +7694,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", + Log.Out(Logs::Detail, Logs::Guilds, "Setting public note on %s (%d) in guild %s (%d) to: %s", gpn->target, gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID(), gpn->note); @@ -7711,7 +7711,7 @@ void Client::Handle_OP_GuildPublicNote(const EQApplicationPacket *app) void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_GuildRemove"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_GuildRemove"); if (app->size != sizeof(GuildCommand_Struct)) { std::cout << "Wrong size: OP_GuildRemove, size=" << app->size << ", expected " << sizeof(GuildCommand_Struct) << std::endl; @@ -7741,7 +7741,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = client->CharacterID(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing %s (%d) from guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Removing %s (%d) from guild %s (%d)", client->GetName(), client->CharacterID(), guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7757,7 +7757,7 @@ void Client::Handle_OP_GuildRemove(const EQApplicationPacket *app) } char_id = gci.char_id; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", + Log.Out(Logs::Detail, Logs::Guilds, "Removing remote/offline %s (%d) into guild %s (%d)", gci.char_name.c_str(), gci.char_id, guild_mgr.GetGuildName(GuildID()), GuildID()); } @@ -7782,7 +7782,7 @@ void Client::Handle_OP_GuildStatus(const EQApplicationPacket *app) { if (app->size != sizeof(GuildStatus_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildStatus expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_GuildStatus expected %i got %i", sizeof(GuildStatus_Struct), app->size); DumpPacket(app); @@ -7839,7 +7839,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) { if (app->size != sizeof(GuildUpdateURLAndChannel_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_GuildUpdateURLAndChannel expected %i got %i", sizeof(GuildUpdateURLAndChannel_Struct), app->size); DumpPacket(app); @@ -7867,7 +7867,7 @@ void Client::Handle_OP_GuildUpdateURLAndChannel(const EQApplicationPacket *app) void Client::Handle_OP_GuildWar(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Got OP_GuildWar of len %d", app->size); + Log.Out(Logs::Detail, Logs::Guilds, "Got OP_GuildWar of len %d", app->size); return; } @@ -7943,7 +7943,7 @@ void Client::Handle_OP_HideCorpse(const EQApplicationPacket *app) // if (app->size != sizeof(HideCorpse_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_HideCorpse expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_HideCorpse expected %i got %i", sizeof(HideCorpse_Struct), app->size); DumpPacket(app); @@ -7972,7 +7972,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, + Log.Out(Logs::General, Logs::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; @@ -8002,7 +8002,7 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) { if (app->size != sizeof(InspectResponse_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_InspectAnswer, size=%i, expected %i", app->size, sizeof(InspectResponse_Struct)); return; } @@ -8057,7 +8057,7 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(InspectMessage_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_InspectMessageUpdate, size=%i, expected %i", app->size, sizeof(InspectMessage_Struct)); return; } @@ -8071,7 +8071,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Inspect_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_InspectRequest, size=%i, expected %i", app->size, sizeof(Inspect_Struct)); return; } @@ -8108,7 +8108,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; } @@ -8208,7 +8208,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) { if (app->size != sizeof(LDONItemViewRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_ItemLinkResponse expected:%i got:%i", sizeof(LDONItemViewRequest_Struct), app->size); return; } LDONItemViewRequest_Struct* item = (LDONItemViewRequest_Struct*)app->pBuffer; @@ -8223,7 +8223,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -8421,7 +8421,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (app->size != sizeof(ItemVerifyRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_ItemVerifyRequest expected:%i got:%i", sizeof(ItemVerifyRequest_Struct), app->size); return; } @@ -8449,7 +8449,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (slot_id < 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); + Log.Out(Logs::General, Logs::None, "Unknown slot being used by %s, slot being used is: %i", GetName(), request->slot); return; } @@ -8492,7 +8492,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); + Log.Out(Logs::General, Logs::None, "OP ItemVerifyRequest: spell=%i, target=%i, inv=%i", spell_id, target_id, slot_id); if (m_inv.SupportsClickCasting(slot_id) || ((item->ItemType == ItemTypePotion || item->PotionBelt) && m_inv.SupportsPotionBeltCasting(slot_id))) // sanity check { @@ -8530,7 +8530,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if ((spell_id <= 0) && (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol && item->ItemType != ItemTypeSpell)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Item with no effect right clicked by %s", GetName()); + Log.Out(Logs::General, Logs::None, "Item with no effect right clicked by %s", GetName()); } else if (inst->IsType(ItemClassCommon)) { @@ -8603,7 +8603,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.Out(Logs::General, Logs::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } else { @@ -8619,7 +8619,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) else if (item->ItemType == ItemTypeAlcohol) { #if EQDEBUG >= 1 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drinking Alcohol from slot:%i", slot_id); + Log.Out(Logs::General, Logs::None, "Drinking Alcohol from slot:%i", slot_id); #endif // This Seems to be handled in OP_DeleteItem handling //DeleteItemInInventory(slot_id, 1, false); @@ -8646,7 +8646,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); + Log.Out(Logs::General, Logs::None, "Error: unknown item->Click.Type (%i)", item->Click.Type); } } } @@ -8787,7 +8787,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_LeadershipExpToggle(const EQApplicationPacket *app) { if (app->size != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -8874,7 +8874,7 @@ void Client::Handle_OP_LFGGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFGGetMatchesRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_LFGGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFGGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9034,7 +9034,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) { if (app->size != sizeof(LFP_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_LFPCommand, size=%i, expected %i", app->size, sizeof(LFP_Struct)); DumpPacket(app); return; } @@ -9071,7 +9071,7 @@ void Client::Handle_OP_LFPCommand(const EQApplicationPacket *app) // This should not happen. The client checks if you are in a group and will not let you put LFP on if // you are not the leader. if (!g->IsLeader(this)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); + Log.Out(Logs::General, Logs::Error, "Client sent LFP on for character %s who is grouped but not leader.", GetName()); return; } // Fill the LFPMembers array with the rest of the group members, excluding ourself @@ -9096,7 +9096,7 @@ void Client::Handle_OP_LFPGetMatchesRequest(const EQApplicationPacket *app) { if (app->size != sizeof(LFPGetMatchesRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_LFPGetMatchesRequest, size=%i, expected %i", app->size, sizeof(LFPGetMatchesRequest_Struct)); DumpPacket(app); return; } @@ -9136,7 +9136,7 @@ void Client::Handle_OP_LoadSpellSet(const EQApplicationPacket *app) void Client::Handle_OP_Logout(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "%s sent a logout packet.", GetName()); + Log.Out(Logs::Detail, Logs::None, "%s sent a logout packet.", GetName()); SendLogoutPackets(); @@ -9150,7 +9150,7 @@ void Client::Handle_OP_Logout(const EQApplicationPacket *app) void Client::Handle_OP_LootItem(const EQApplicationPacket *app) { if (app->size != sizeof(LootingItem_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_LootItem, size=%i, expected %i", app->size, sizeof(LootingItem_Struct)); return; } @@ -9327,7 +9327,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) if (app->size != sizeof(MercenaryCommand_Struct)) { Message(13, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryCommand expected %i got %i", sizeof(MercenaryCommand_Struct), app->size); DumpPacket(app); return; } @@ -9384,7 +9384,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) // The payload is 4 bytes. The EntityID of the Mercenary Liason which are of class 71. if (app->size != sizeof(MercenaryMerchantShopRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryDataRequest expected 4 got %i", app->size); DumpPacket(app); @@ -9519,7 +9519,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app if (app->size != 0) { Message(13, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryDataUpdateRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9539,7 +9539,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryDismiss expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9564,7 +9564,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) // The payload is 16 bytes. First four bytes are the Merc ID (Template ID) if (app->size != sizeof(MercenaryMerchantRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryHire expected %i got %i", sizeof(MercenaryMerchantRequest_Struct), app->size); DumpPacket(app); @@ -9636,7 +9636,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) if (app->size != sizeof(SuspendMercenary_Struct)) { Message(13, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenarySuspendRequest expected %i got %i", sizeof(SuspendMercenary_Struct), app->size); DumpPacket(app); return; } @@ -9660,7 +9660,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) if (app->size > 1) { Message(13, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_MercenaryTimerRequest expected 0 got %i", app->size); DumpPacket(app); return; } @@ -9698,7 +9698,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) void Client::Handle_OP_MoveCoin(const EQApplicationPacket *app) { if (app->size != sizeof(MoveCoin_Struct)){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size on OP_MoveCoin. Got: %i, Expected: %i", app->size, sizeof(MoveCoin_Struct)); DumpPacket(app); return; } @@ -9714,7 +9714,7 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app) } if (app->size != sizeof(MoveItem_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_MoveItem, size=%i, expected %i", app->size, sizeof(MoveItem_Struct)); return; } @@ -9797,7 +9797,7 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9829,7 +9829,7 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) @@ -9856,7 +9856,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) { if (app->size < 2) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_PDeletePetition, size=%i, expected %i", app->size, 2); return; } if (petition_list.DeletePetitionByCharName((char*)app->pBuffer)) @@ -9869,7 +9869,7 @@ void Client::Handle_OP_PDeletePetition(const EQApplicationPacket *app) void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) { if (app->size != sizeof(PetCommand_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_PetCommands, size=%i, expected %i", app->size, sizeof(PetCommand_Struct)); return; } char val1[20] = { 0 }; @@ -10332,7 +10332,7 @@ void Client::Handle_OP_PetitionBug(const EQApplicationPacket *app) void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app) { if (app->size != sizeof(Petition_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_PetitionCheckIn, size=%i, expected %i", app->size, sizeof(Petition_Struct)); return; } Petition_Struct* inpet = (Petition_Struct*)app->pBuffer; @@ -10376,7 +10376,7 @@ void Client::Handle_OP_PetitionCheckout(const EQApplicationPacket *app) void Client::Handle_OP_PetitionDelete(const EQApplicationPacket *app) { if (app->size != sizeof(PetitionUpdate_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_PetitionDelete, size=%i, expected %i", app->size, sizeof(PetitionUpdate_Struct)); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_PetitionUpdate, sizeof(PetitionUpdate_Struct)); @@ -10446,7 +10446,7 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app) { if (app->size != sizeof(PickPocket_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Size mismatch for Pick Pocket packet"); + Log.Out(Logs::General, Logs::Error, "Size mismatch for Pick Pocket packet"); DumpPacket(app); } @@ -10516,7 +10516,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) { if (app->size != sizeof(PopupResponse_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PopupResponse expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_PopupResponse expected %i got %i", sizeof(PopupResponse_Struct), app->size); DumpPacket(app); return; @@ -10551,7 +10551,7 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) { if (app->size != sizeof(MovePotionToBelt_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PotionBelt expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_PotionBelt expected %i got %i", sizeof(MovePotionToBelt_Struct), app->size); DumpPacket(app); return; @@ -10559,7 +10559,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) MovePotionToBelt_Struct *mptbs = (MovePotionToBelt_Struct*)app->pBuffer; if(!EQEmu::ValueWithin(mptbs->SlotNumber, 0U, 3U)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); + Log.Out(Logs::General, Logs::None, "Client::Handle_OP_PotionBelt mptbs->SlotNumber out of range."); return; } @@ -10582,7 +10582,7 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app) void Client::Handle_OP_PurchaseLeadershipAA(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_LeadershipExpToggle expected %i got %i", 1, app->size); DumpPacket(app); return; } @@ -10672,7 +10672,7 @@ void Client::Handle_OP_PVPLeaderBoardDetailsRequest(const EQApplicationPacket *a // if (app->size != sizeof(PVPLeaderBoardDetailsRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_PVPLeaderBoardDetailsRequest expected %i got %i", sizeof(PVPLeaderBoardDetailsRequest_Struct), app->size); DumpPacket(app); @@ -10699,7 +10699,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) // if (app->size != sizeof(PVPLeaderBoardRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_PVPLeaderBoardRequest expected %i got %i", sizeof(PVPLeaderBoardRequest_Struct), app->size); DumpPacket(app); @@ -10720,7 +10720,7 @@ void Client::Handle_OP_PVPLeaderBoardRequest(const EQApplicationPacket *app) void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) { if (app->size < sizeof(RaidGeneral_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_RaidCommand, size=%i, expected at least %i", app->size, sizeof(RaidGeneral_Struct)); DumpPacket(app); return; } @@ -11305,7 +11305,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket *app) void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) { if (app->size != sizeof(RandomReq_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_RandomReq, size=%i, expected %i", app->size, sizeof(RandomReq_Struct)); return; } const RandomReq_Struct* rndq = (const RandomReq_Struct*)app->pBuffer; @@ -11334,7 +11334,7 @@ void Client::Handle_OP_RandomReq(const EQApplicationPacket *app) void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) { if (app->size != sizeof(BookRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_ReadBook, size=%i, expected %i", app->size, sizeof(BookRequest_Struct)); return; } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; @@ -11350,7 +11350,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11364,7 +11364,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", sizeof(uint32), app->size); return; } @@ -11378,14 +11378,14 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", sizeof(TradeskillFavorites_Struct), app->size); return; } TradeskillFavorites_Struct* tsf = (TradeskillFavorites_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); + Log.Out(Logs::General, Logs::None, "Requested Favorites for: %d - %d\n", tsf->object_type, tsf->some_id); // results show that object_type is combiner type // some_id = 0 if world combiner, item number otherwise @@ -11437,7 +11437,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", sizeof(RecipesSearch_Struct), app->size); return; } @@ -11446,7 +11446,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) rss->query[55] = '\0'; //just to be sure. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); + Log.Out(Logs::General, Logs::None, "Requested search recipes for: %d - %d\n", rss->object_type, rss->some_id); // make where clause segment for container(s) char containers[30]; @@ -11506,7 +11506,7 @@ void Client::Handle_OP_RemoveBlockedBuffs(const EQApplicationPacket *app) if (app->size != sizeof(BlockedBuffs_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_RemoveBlockedBuffs expected %i got %i", sizeof(BlockedBuffs_Struct), app->size); DumpPacket(app); @@ -11669,7 +11669,7 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app) // if (app->size != 4) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_RespawnWindow expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_RespawnWindow expected %i got %i", 4, app->size); DumpPacket(app); return; @@ -11697,7 +11697,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + Log.Out(Logs::Detail, Logs::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); _pkt(SPELLS__REZ, app); @@ -11720,14 +11720,14 @@ void Client::Handle_OP_Sacrifice(const EQApplicationPacket *app) { if (app->size != sizeof(Sacrifice_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_Sacrifice expected %i got %i", sizeof(Sacrifice_Struct), app->size); DumpPacket(app); return; } Sacrifice_Struct *ss = (Sacrifice_Struct*)app->pBuffer; if (!PendingSacrifice) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected OP_Sacrifice reply"); + Log.Out(Logs::General, Logs::Error, "Unexpected OP_Sacrifice reply"); DumpPacket(app); return; } @@ -11765,13 +11765,13 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_SelectTribute of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_SelectTribute of length %d", app->size); _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. if (app->size != sizeof(SelectTributeReq_Struct)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_SelectTribute packet"); + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_SelectTribute packet"); else { SelectTributeReq_Struct *t = (SelectTributeReq_Struct *)app->pBuffer; SendTributeDetails(t->client_id, t->tribute_id); @@ -11848,7 +11848,7 @@ void Client::Handle_OP_SenseTraps(const EQApplicationPacket *app) void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received OP_SetGuildMOTD"); + Log.Out(Logs::Detail, Logs::Guilds, "Received OP_SetGuildMOTD"); if (app->size != sizeof(GuildMOTD_Struct)) { // client calls for a motd on login even if they arent in a guild @@ -11866,7 +11866,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) GuildMOTD_Struct* gmotd = (GuildMOTD_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Setting MOTD for %s (%d) to: %s - %s", + Log.Out(Logs::Detail, Logs::Guilds, "Setting MOTD for %s (%d) to: %s - %s", guild_mgr.GetGuildName(GuildID()), GuildID(), GetName(), gmotd->motd); if (!guild_mgr.SetGuildMOTD(GuildID(), gmotd->motd, GetName())) { @@ -11884,7 +11884,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received invalid sized " + Log.Out(Logs::General, Logs::Error, "Received invalid sized " "OP_SetServerFilter: got %d, expected %d", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); @@ -11904,7 +11904,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) } if (app->size < 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_SetStartCity, size=%i, expected %i", app->size, 1); DumpPacket(app); return; } @@ -11918,7 +11918,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) m_pp.class_, m_pp.deity, m_pp.race); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No valid start zones found for /setstartcity"); + Log.Out(Logs::General, Logs::Error, "No valid start zones found for /setstartcity"); return; } @@ -11969,7 +11969,7 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app) void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) { if (app->size != sizeof(SetTitle_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_SetTitle expected %i got %i", sizeof(SetTitle_Struct), app->size); DumpPacket(app); return; } @@ -11993,7 +11993,7 @@ void Client::Handle_OP_SetTitle(const EQApplicationPacket *app) void Client::Handle_OP_Shielding(const EQApplicationPacket *app) { if (app->size != sizeof(Shielding_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_Shielding expected:%i got:%i", sizeof(Shielding_Struct), app->size); return; } if (GetClass() != WARRIOR) @@ -12090,7 +12090,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12098,7 +12098,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) t1.start(); Merchant_Sell_Struct* mp = (Merchant_Sell_Struct*)app->pBuffer; #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s, purchase item..", GetName()); + Log.Out(Logs::General, Logs::None, "%s, purchase item..", GetName()); DumpPacket(app); #endif @@ -12258,7 +12258,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) SendItemPacket(freeslotid, inst, ItemPacketTrade); } else if (!stacked){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); + Log.Out(Logs::General, Logs::Error, "OP_ShopPlayerBuy: item->ItemClass Unknown! Type: %i", item->ItemClass); } QueuePacket(outapp); if (inst && tmpmer_used){ @@ -12348,7 +12348,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -12504,7 +12504,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Click_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_ShopRequest, size=%i, expected %i", app->size, sizeof(Merchant_Click_Struct)); return; } @@ -12797,7 +12797,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_OP_Split(const EQApplicationPacket *app) { if (app->size != sizeof(Split_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_Split, size=%i, expected %i", app->size, sizeof(Split_Struct)); return; } // The client removes the money on its own, but we have to @@ -12834,7 +12834,7 @@ void Client::Handle_OP_Surname(const EQApplicationPacket *app) { if (app->size != sizeof(Surname_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in Surname expected %i got %i", sizeof(Surname_Struct), app->size); return; } @@ -12924,7 +12924,7 @@ void Client::Handle_OP_SwapSpell(const EQApplicationPacket *app) void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (app->size != sizeof(ClientTarget_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); + Log.Out(Logs::General, Logs::Error, "OP size error: OP_TargetMouse expected:%i got:%i", sizeof(ClientTarget_Struct), app->size); return; } @@ -13149,7 +13149,7 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TaskHistoryRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_TaskHistoryRequest expected %i got %i", sizeof(TaskHistoryRequest_Struct), app->size); DumpPacket(app); return; @@ -13202,7 +13202,7 @@ void Client::Handle_OP_Track(const EQApplicationPacket *app) CheckIncreaseSkill(SkillTracking, nullptr, 15); if (!entity_list.MakeTrackPacket(this)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to generate OP_Track packet requested by client."); + Log.Out(Logs::General, Logs::Error, "Unable to generate OP_Track packet requested by client."); return; } @@ -13216,7 +13216,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", sizeof(TrackTarget_Struct), app->size); return; } @@ -13369,7 +13369,7 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app) void Client::Handle_OP_TradeBusy(const EQApplicationPacket *app) { if (app->size != sizeof(TradeBusy_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_TradeBusy, size=%i, expected %i", app->size, sizeof(TradeBusy_Struct)); return; } // Trade request recipient is cancelling the trade due to being busy @@ -13417,7 +13417,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (c) c->WithCustomer(0); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); break; } @@ -13426,7 +13426,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) break; } default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); + Log.Out(Logs::Detail, Logs::Trading, "Unhandled action code in OP_Trader ShowItems_Struct"); break; } } @@ -13512,10 +13512,10 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_Trader: Unknown TraderStruct code of: %i\n", ints->Code); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown TraderStruct code of: %i\n", ints->Code); + Log.Out(Logs::General, Logs::Error, "Unknown TraderStruct code of: %i\n", ints->Code); } } @@ -13524,8 +13524,8 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) HandleTraderPriceUpdate(app); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unknown size for OP_Trader: %i\n", app->size); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown size for OP_Trader: %i\n", app->size); + Log.Out(Logs::Detail, Logs::Trading, "Unknown size for OP_Trader: %i\n", app->size); + Log.Out(Logs::General, Logs::Error, "Unknown size for OP_Trader: %i\n", app->size); DumpPacket(app); return; } @@ -13550,11 +13550,11 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) BuyTraderItem(tbs, Trader, app); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderBuy: Null Client Pointer"); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderBuy: Struct size mismatch"); } return; @@ -13563,7 +13563,7 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_TradeRequest, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Client requesting a trade session from an npc/client @@ -13599,7 +13599,7 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app) { if (app->size != sizeof(TradeRequest_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size: OP_TradeRequestAck, size=%i, expected %i", app->size, sizeof(TradeRequest_Struct)); return; } // Trade request recipient is acknowledging they are able to trade @@ -13628,7 +13628,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (app->size != sizeof(TraderClick_Struct)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Returning due to struct size mismatch"); return; } @@ -13642,7 +13642,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) if (Customer) outtcs->Approval = Customer->WithCustomer(GetID()); else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" + Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)" " returned a nullptr pointer"); return; } @@ -13670,7 +13670,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + Log.Out(Logs::General, Logs::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", sizeof(NewCombine_Struct), app->size); return; } @@ -13691,7 +13691,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) { if (app->size != sizeof(Translocate_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_Translocate expected %i got %i", sizeof(Translocate_Struct), app->size); DumpPacket(app); return; } @@ -13739,7 +13739,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeItem of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeItem of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates an item... @@ -13758,7 +13758,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute item reply with %d points", t->tribute_points); + Log.Out(Logs::Detail, Logs::Tribute, "Sending tribute item reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13768,7 +13768,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeMoney of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeMoney of length %d", app->size); _pkt(TRIBUTE__IN, app); //player donates money @@ -13787,7 +13787,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Sending tribute money reply with %d points", t->tribute_points); + Log.Out(Logs::Detail, Logs::Tribute, "Sending tribute money reply with %d points", t->tribute_points); _pkt(TRIBUTE__OUT, app); QueuePacket(app); @@ -13797,7 +13797,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeNPC of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeNPC of length %d", app->size); _pkt(TRIBUTE__IN, app); return; @@ -13805,11 +13805,11 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeToggle of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeToggle of length %d", app->size); _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeToggle packet"); + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_TributeToggle packet"); else { uint32 *val = (uint32 *)app->pBuffer; ToggleTribute(*val ? true : false); @@ -13819,12 +13819,12 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tribute, "Received OP_TributeUpdate of length %d", app->size); + Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeUpdate of length %d", app->size); _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Invalid size on OP_TributeUpdate packet"); + Log.Out(Logs::General, Logs::Error, "Invalid size on OP_TributeUpdate packet"); else { TributeInfo_Struct *t = (TributeInfo_Struct *)app->pBuffer; ChangeTributeSettings(t); @@ -13836,7 +13836,7 @@ void Client::Handle_OP_VetClaimRequest(const EQApplicationPacket *app) { if (app->size < sizeof(VeteranClaimRequest)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); + Log.Out(Logs::General, Logs::None, "OP_VetClaimRequest size lower than expected: got %u expected at least %u", app->size, sizeof(VeteranClaimRequest)); DumpPacket(app); return; } @@ -13876,7 +13876,7 @@ void Client::Handle_OP_VoiceMacroIn(const EQApplicationPacket *app) if (app->size != sizeof(VoiceMacroIn_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_VoiceMacroIn expected %i got %i", sizeof(VoiceMacroIn_Struct), app->size); DumpPacket(app); @@ -13927,7 +13927,7 @@ void Client::Handle_OP_XTargetAutoAddHaters(const EQApplicationPacket *app) { if (app->size != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_XTargetAutoAddHaters, expected 1, got %i", app->size); DumpPacket(app); return; } @@ -13939,7 +13939,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) { if (app->size < 12) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); + Log.Out(Logs::General, Logs::None, "Size mismatch in OP_XTargetRequest, expected at least 12, got %i", app->size); DumpPacket(app); return; } @@ -14162,7 +14162,7 @@ void Client::Handle_OP_XTargetRequest(const EQApplicationPacket *app) } default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unhandled XTarget Type %i", Type); + Log.Out(Logs::General, Logs::None, "Unhandled XTarget Type %i", Type); break; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 27a8587c0..52d1c900c 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -799,7 +799,7 @@ void Client::OnDisconnect(bool hard_disconnect) { Mob *Other = trade->With(); if(Other) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client disconnected during a trade. Returning their items."); + Log.Out(Logs::Detail, Logs::Trading, "Client disconnected during a trade. Returning their items."); FinishTrade(this); if(Other->IsClient()) @@ -836,7 +836,7 @@ void Client::BulkSendInventoryItems() { if(inst) { bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Incomplete Trade Transaction: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -1037,7 +1037,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { // Account for merchant lists with gaps. if (ml.slot >= i) { if (ml.slot > i) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); + Log.Out(Logs::General, Logs::None, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid); i = ml.slot + 1; } } @@ -1129,7 +1129,7 @@ uint8 Client::WithCustomer(uint16 NewCustomer){ Client* c = entity_list.GetClientByID(CustomerID); if(!c) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Previous customer has gone away."); + Log.Out(Logs::Detail, Logs::Trading, "Previous customer has gone away."); CustomerID = NewCustomer; return 1; } @@ -1141,7 +1141,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + Log.Out(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); Message(13, "You have already been resurrected.\n"); return; } @@ -1151,7 +1151,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + Log.Out(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -1201,7 +1201,7 @@ void Client::OPMemorizeSpell(const EQApplicationPacket* app) { if(app->size != sizeof(MemorizeSpell_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); + Log.Out(Logs::General, Logs::Error, "Wrong size on OP_MemorizeSpell. Got: %i, Expected: %i", app->size, sizeof(MemorizeSpell_Struct)); DumpPacket(app); return; } @@ -1723,12 +1723,12 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) SkillUseTypes skill = (SkillUseTypes) gmskill->skill_id; if(!CanHaveSkill(skill)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, which is not allowed.", skill); + Log.Out(Logs::Detail, Logs::Skills, "Tried to train skill %d, which is not allowed.", skill); return; } if(MaxSkill(skill) == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); + Log.Out(Logs::Detail, Logs::Skills, "Tried to train skill %d, but training is not allowed at this level.", skill); return; } @@ -2122,7 +2122,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unexpected Rezz from hover request."); + Log.Out(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request."); return; } SetHP(GetMaxHP() / 5); @@ -2155,10 +2155,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Hover Rez in zone %s for corpse %s", + Log.Out(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s", zone->GetShortName(), PendingRezzCorpseName.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.Out(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed."); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/command.cpp b/zone/command.cpp index 32a910842..d0882a687 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -443,13 +443,13 @@ int command_init(void) { if ((itr=command_settings.find(cur->first))!=command_settings.end()) { cur->second->access = itr->second; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); + Log.Out(Logs::General, Logs::Commands, "command_init(): - Command '%s' set to access level %d.", cur->first.c_str(), itr->second); } else { #ifdef COMMANDS_WARNINGS if(cur->second->access == 0) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); + Log.Out(Logs::General, Logs::Status, "command_init(): Warning: Command '%s' defaulting to access level 0!" , cur->first.c_str()); #endif } } @@ -494,7 +494,7 @@ int command_add(const char *command_string, const char *desc, int access, CmdFun std::string cstr(command_string); if(commandlist.count(cstr) != 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); + Log.Out(Logs::General, Logs::Error, "command_add() - Command '%s' is a duplicate - check command.cpp." , command_string); return(-1); } @@ -568,12 +568,12 @@ int command_realdispatch(Client *c, const char *message) #ifdef COMMANDS_LOGGING if(cur->access >= COMMANDS_LOGGING_MIN_STATUS) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); + Log.Out(Logs::General, Logs::Commands, "%s (%s) used command: %s (target=%s)", c->GetName(), c->AccountName(), message, c->GetTarget()?c->GetTarget()->GetName():"NONE"); } #endif if(cur->function == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Command '%s' has a null function\n", cstr.c_str()); + Log.Out(Logs::General, Logs::Error, "Command '%s' has a null function\n", cstr.c_str()); return(-1); } else { //dispatch C++ command @@ -1292,7 +1292,7 @@ void command_viewpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(Logs::General, Logs::Normal, "View petition request from %s, petition number: %i", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1317,7 +1317,7 @@ void command_petitioninfo(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(Logs::General, Logs::Normal, "Petition information request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); if (results.RowCount() == 0) { c->Message(13,"There was an error in your request: ID not found! Please check the Id and try again."); @@ -1343,7 +1343,7 @@ void command_delpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); + Log.Out(Logs::General, Logs::Normal, "Delete petition request from %s, petition number:", c->GetName(), atoi(sep->argplus[1]) ); } @@ -1566,7 +1566,7 @@ void command_permaclass(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's class...Sending to char select.", t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(Logs::General, Logs::Normal, "Class change request from %s for %s, requested class:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseClass(atoi(sep->arg[1])); t->Save(); t->Kick(); @@ -1588,7 +1588,7 @@ void command_permarace(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's race - zone to take effect",t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(Logs::General, Logs::Normal, "Permanant race change request from %s for %s, requested race:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); uint32 tmp = Mob::GetDefaultGender(atoi(sep->arg[1]), t->GetBaseGender()); t->SetBaseRace(atoi(sep->arg[1])); t->SetBaseGender(tmp); @@ -1612,7 +1612,7 @@ void command_permagender(Client *c, const Seperator *sep) c->Message(0,"Target is not a client."); else { c->Message(0, "Setting %s's gender - zone to take effect",t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); + Log.Out(Logs::General, Logs::Normal, "Permanant gender change request from %s for %s, requested gender:%i", c->GetName(), t->GetName(), atoi(sep->arg[1]) ); t->SetBaseGender(atoi(sep->arg[1])); t->Save(); t->SendIllusionPacket(atoi(sep->arg[1])); @@ -1954,7 +1954,7 @@ void command_dbspawn2(Client *c, const Seperator *sep) { if (sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Spawning database spawn"); + Log.Out(Logs::General, Logs::Normal, "Spawning database spawn"); uint16 cond = 0; int16 cond_min = 0; if(sep->IsNumber(4)) { @@ -2274,7 +2274,7 @@ void command_setlanguage(Client *c, const Seperator *sep) } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Out(Logs::General, Logs::Normal, "Set language request from %s, target:%s lang_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); uint8 langid = (uint8)atoi(sep->arg[1]); uint8 value = (uint8)atoi(sep->arg[2]); c->GetTarget()->CastToClient()->SetLanguageSkill( langid, value ); @@ -2299,7 +2299,7 @@ void command_setskill(Client *c, const Seperator *sep) c->Message(0, " x = 0 to %d", HIGHEST_CAN_SET_SKILL); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); + Log.Out(Logs::General, Logs::Normal, "Set skill request from %s, target:%s skill_id:%i value:%i", c->GetName(), c->GetTarget()->GetName(), atoi(sep->arg[1]), atoi(sep->arg[2]) ); int skill_num = atoi(sep->arg[1]); uint16 skill_value = atoi(sep->arg[2]); if(skill_num < HIGHEST_SKILL) @@ -2319,7 +2319,7 @@ void command_setskillall(Client *c, const Seperator *sep) } else { if (c->Admin() >= commandSetSkillsOther || c->GetTarget()==c || c->GetTarget()==0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); + Log.Out(Logs::General, Logs::Normal, "Set ALL skill request from %s, target:%s", c->GetName(), c->GetTarget()->GetName()); uint16 level = atoi(sep->arg[1]); for(SkillUseTypes skill_num=Skill1HBlunt;skill_num <= HIGHEST_SKILL;skill_num=(SkillUseTypes)(skill_num+1)) { c->GetTarget()->CastToClient()->SetSkill(skill_num, level); @@ -2409,7 +2409,7 @@ void command_spawn(Client *c, const Seperator *sep) } } #if EQDEBUG >= 11 - Log.LogDebug(EQEmuLogSys::General,"#spawn Spawning:"); + Log.LogDebug(Logs::General,"#spawn Spawning:"); #endif NPC* npc = NPC::SpawnNPC(sep->argplus[1], c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(), c); @@ -3114,7 +3114,7 @@ void command_listpetition(Client *c, const Seperator *sep) if (!results.Success()) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Petition list requested by %s", c->GetName()); + Log.Out(Logs::General, Logs::Normal, "Petition list requested by %s", c->GetName()); if (results.RowCount() == 0) return; @@ -3771,7 +3771,7 @@ void command_lastname(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsClient()) t=c->GetTarget()->CastToClient(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); + Log.Out(Logs::General, Logs::Normal, "#lastname request from %s for %s", c->GetName(), t->GetName()); if(strlen(sep->arg[1]) <= 70) t->ChangeLastName(sep->arg[1]); @@ -4394,7 +4394,7 @@ void command_time(Client *c, const Seperator *sep) ); c->Message(13, "It is now %s.", timeMessage); #if EQDEBUG >= 11 - Log.LogDebug(EQEmuLogSys::General,"Recieved timeMessage:%s", timeMessage); + Log.LogDebug(Logs::General,"Recieved timeMessage:%s", timeMessage); #endif } } @@ -4545,10 +4545,10 @@ void command_guild(Client *c, const Seperator *sep) } if(guild_id == GUILD_NONE) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Removing %s (%d) from guild with GM command.", c->GetName(), sep->arg[2], charid); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Putting %s (%d) into guild %s (%d) with GM command.", c->GetName(), sep->arg[2], charid, guild_mgr.GetGuildName(guild_id), guild_id); } @@ -4597,7 +4597,7 @@ void command_guild(Client *c, const Seperator *sep) return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting %s (%d)'s guild rank to %d with GM command.", c->GetName(), sep->arg[2], charid, rank); if(!guild_mgr.SetGuildRank(charid, rank)) @@ -4639,7 +4639,7 @@ void command_guild(Client *c, const Seperator *sep) uint32 id = guild_mgr.CreateGuild(sep->argplus[3], leader); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Creating guild %s with leader %d with GM command. It was given id %lu.", c->GetName(), sep->argplus[3], leader, (unsigned long)id); if (id == GUILD_NONE) @@ -4678,7 +4678,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Deleting guild %s (%d) with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id); if (!guild_mgr.DeleteGuild(id)) @@ -4712,7 +4712,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Renaming guild %s (%d) to '%s' with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, sep->argplus[3]); if (!guild_mgr.RenameGuild(id, sep->argplus[3])) @@ -4763,7 +4763,7 @@ void command_guild(Client *c, const Seperator *sep) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), + Log.Out(Logs::Detail, Logs::Guilds, "%s: Setting leader of guild %s (%d) to %d with GM command.", c->GetName(), guild_mgr.GetGuildName(id), id, leader); if(!guild_mgr.SetGuildLeader(id, leader)) @@ -4869,7 +4869,7 @@ void command_manaburn(Client *c, const Seperator *sep) target->Damage(c, nukedmg, 2751, SkillAbjuration/*hackish*/); c->Message(4,"You unleash an enormous blast of magical energies."); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); + Log.Out(Logs::General, Logs::Normal, "Manaburn request from %s, damage: %d", c->GetName(), nukedmg); } } else @@ -5221,7 +5221,7 @@ void command_scribespells(Client *c, const Seperator *sep) t->Message(0, "Scribing spells to spellbook."); if(t != c) c->Message(0, "Scribing spells for %s.", t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Out(Logs::General, Logs::Normal, "Scribe spells request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, book_slot = t->GetNextAvailableSpellBookSlot(), count = 0; curspell < SPDAT_RECORDS && book_slot < MAX_PP_SPELLBOOK; curspell++, book_slot = t->GetNextAvailableSpellBookSlot(book_slot)) { @@ -5278,7 +5278,7 @@ void command_scribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Scribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Out(Logs::General, Logs::Normal, "Scribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); if (spells[spell_id].classes[WARRIOR] != 0 && spells[spell_id].skill != 52 && spells[spell_id].classes[t->GetPP().class_ - 1] > 0 && !IsDiscipline(spell_id)) { book_slot = t->GetNextAvailableSpellBookSlot(); @@ -5325,7 +5325,7 @@ void command_unscribespell(Client *c, const Seperator *sep) { if(t != c) c->Message(0, "Unscribing spell: %s (%i) for %s.", spells[spell_id].name, spell_id, t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); + Log.Out(Logs::General, Logs::Normal, "Unscribe spell: %s (%i) request for %s from %s.", spells[spell_id].name, spell_id, t->GetName(), c->GetName()); } else { t->Message(13, "Unable to unscribe spell: %s (%i) from your spellbook. This spell is not scribed.", spells[spell_id].name, spell_id); @@ -7862,7 +7862,7 @@ void command_traindisc(Client *c, const Seperator *sep) t->Message(0, "Training disciplines"); if(t != c) c->Message(0, "Training disciplines for %s.", t->GetName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); + Log.Out(Logs::General, Logs::Normal, "Train disciplines request for %s from %s, levels: %u -> %u", t->GetName(), c->GetName(), min_level, max_level); for(curspell = 0, count = 0; curspell < SPDAT_RECORDS; curspell++) { @@ -10394,7 +10394,7 @@ void command_logtest(Client *c, const Seperator *sep){ if (sep->IsNumber(1)){ uint32 i = 0; for (i = 0; i < atoi(sep->arg[1]); i++){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.Out(Logs::General, Logs::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } } \ No newline at end of file diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a3e116ae2..81d77651f 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -842,7 +842,7 @@ bool Corpse::Process() { spc->zone_id = zone->graveyard_zoneid(); worldserver.SendPacket(pack); safe_delete(pack); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); + Log.Out(Logs::General, Logs::None, "Moved %s player corpse to the designated graveyard in zone %s.", this->GetName(), database.GetZoneName(zone->graveyard_zoneid())); corpse_db_id = 0; } @@ -872,10 +872,10 @@ bool Corpse::Process() { Save(); player_corpse_depop = true; corpse_db_id = 0; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Tagged %s player corpse has burried.", this->GetName()); + Log.Out(Logs::General, Logs::None, "Tagged %s player corpse has burried.", this->GetName()); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to bury %s player corpse.", this->GetName()); + Log.Out(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName()); return true; } } @@ -1083,7 +1083,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a for(; cur != end; ++cur) { ServerLootItem_Struct* item_data = *cur; item = database.GetItem(item_data->item_id); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); + Log.Out(Logs::General, Logs::None, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner"); client->Message(0, "Inaccessable Corpse Item: %s", item->Name); } } diff --git a/zone/doors.cpp b/zone/doors.cpp index de2feed63..227c8c7af 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -145,9 +145,9 @@ bool Doors::Process() void Doors::HandleClick(Client* sender, uint8 trigger) { //door debugging info dump - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); + Log.Out(Logs::Detail, Logs::Doors, "%s clicked door %s (dbid %d, eqid %d) at (%.4f,%.4f,%.4f @%.4f)", sender->GetName(), door_name, db_id, door_id, pos_x, pos_y, pos_z, heading); + Log.Out(Logs::Detail, Logs::Doors, " incline %d, opentype %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d", incline, opentype, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param); + Log.Out(Logs::Detail, Logs::Doors, " size %d, invert %d, dest: %s (%.4f,%.4f,%.4f @%.4f)", size, invert_state, dest_zone, dest_x, dest_y, dest_z, dest_heading); EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; @@ -303,7 +303,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) sender->CheckIncreaseSkill(SkillPickLock, nullptr, 1); #if EQDEBUG>=5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Client has lockpicks: skill=%f", modskill); + Log.Out(Logs::General, Logs::None, "Client has lockpicks: skill=%f", modskill); #endif if(GetLockpick() <= modskill) @@ -560,13 +560,13 @@ void Doors::ToggleState(Mob *sender) } void Doors::DumpDoor(){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(Logs::General, Logs::None, "db_id:%i door_id:%i zone_name:%s door_name:%s pos_x:%f pos_y:%f pos_z:%f heading:%f", db_id, door_id, zone_name, door_name, pos_x, pos_y, pos_z, heading); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(Logs::General, Logs::None, "opentype:%i guild_id:%i lockpick:%i keyitem:%i nokeyring:%i trigger_door:%i trigger_type:%i door_param:%i open:%s", opentype, guild_id, lockpick, keyitem, nokeyring, trigger_door, trigger_type, door_param, (isopen) ? "open":"closed"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, + Log.Out(Logs::General, Logs::None, "dest_zone:%s dest_x:%f dest_y:%f dest_z:%f dest_heading:%f", dest_zone, dest_x, dest_y, dest_z, dest_heading); } @@ -645,7 +645,7 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) } bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Doors from database..."); + Log.Out(Logs::General, Logs::Status, "Loading Doors from database..."); // Door tmpDoor; diff --git a/zone/effects.cpp b/zone/effects.cpp index 5671460ec..8ec921ae3 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -461,7 +461,7 @@ bool Client::TrainDiscipline(uint32 itemid) { const Item_Struct *item = database.GetItem(itemid); if(item == nullptr) { Message(13, "Unable to find the tome you turned in!"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); + Log.Out(Logs::General, Logs::Error, "Unable to find turned in tome id %lu\n", (unsigned long)itemid); return(false); } diff --git a/zone/embparser.cpp b/zone/embparser.cpp index 7692151c2..e18dcfd39 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -140,7 +140,7 @@ void PerlembParser::ReloadQuests() { perl = nullptr; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Error re-initializing perlembed: %s", e.what()); + Log.Out(Logs::General, Logs::Status, "Error re-initializing perlembed: %s", e.what()); throw e.what(); } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 35856db8b..99698fe72 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3519,7 +3519,7 @@ EXTERN_C XS(boot_quest) file[255] = '\0'; if(items != 1) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_quest does not take any arguments."); + Log.Out(Logs::General, Logs::Error, "boot_quest does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 0a33a2d4a..167e92711 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -140,12 +140,12 @@ void Embperl::DoInit() { catch(const char *err) { //remember... lasterr() is no good if we crap out here, in construction - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "perl error: %s", err); + Log.Out(Logs::General, Logs::Quests, "perl error: %s", err); throw "failed to install eval_file hook"; } #ifdef EMBPERL_IO_CAPTURE - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Tying perl output to eqemu logs"); + Log.Out(Logs::General, Logs::Quests, "Tying perl output to eqemu logs"); //make a tieable class to capture IO and pass it into EQEMuLog eval_pv( "package EQEmuIO; " @@ -170,14 +170,14 @@ void Embperl::DoInit() { ,FALSE ); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Loading perlemb plugins."); + Log.Out(Logs::General, Logs::Quests, "Loading perlemb plugins."); try { eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE); } catch(const char *err) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Warning - plugin.pl: %s", err); + Log.Out(Logs::General, Logs::Quests, "Warning - plugin.pl: %s", err); } try { @@ -195,7 +195,7 @@ void Embperl::DoInit() { } catch(const char *err) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Perl warning: %s", err); + Log.Out(Logs::General, Logs::Quests, "Perl warning: %s", err); } #endif //EMBPERL_PLUGIN in_use = false; diff --git a/zone/embxs.cpp b/zone/embxs.cpp index e3ad58229..5e387022e 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -64,7 +64,7 @@ EXTERN_C XS(boot_qc) file[255] = '\0'; if(items != 1) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "boot_qc does not take any arguments."); + Log.Out(Logs::General, Logs::Error, "boot_qc does not take any arguments."); char buf[128]; //shouldent have any function names longer than this. @@ -100,7 +100,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.Out(Logs::Detail, Logs::Quests, str); len = 0; pos = i+1; } else { @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Quests, str); + Log.Out(Logs::Detail, Logs::Quests, str); } } diff --git a/zone/entity.cpp b/zone/entity.cpp index 86d2423e4..8fb5e541c 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -371,7 +371,7 @@ void EntityList::CheckGroupList (const char *fname, const int fline) { if (*it == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr group, %s:%i", fname, fline); + Log.Out(Logs::General, Logs::Error, "nullptr group, %s:%i", fname, fline); } } } @@ -520,12 +520,12 @@ void EntityList::MobProcess() zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); if(g) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a group."); + Log.Out(Logs::General, Logs::Error, "About to delete a client still in a group."); g->DelMember(mob); } Raid *r = entity_list.GetRaidByClient(mob->CastToClient()); if(r) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "About to delete a client still in a raid."); + Log.Out(Logs::General, Logs::Error, "About to delete a client still in a raid."); r->MemberZoned(mob->CastToClient()); } entity_list.RemoveClient(id); @@ -557,7 +557,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(Logs::General, Logs::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -586,7 +586,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, + Log.Out(Logs::General, Logs::Error, "Unable to get new group ID from world server. group is going to be broken."); return; } @@ -2509,7 +2509,7 @@ char *EntityList::MakeNameUnique(char *name) return name; } } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); + Log.Out(Logs::General, Logs::Error, "Fatal error in EntityList::MakeNameUnique: Unable to find unique name for '%s'", name); char tmp[64] = "!"; strn0cpy(&tmp[1], name, sizeof(tmp) - 1); strcpy(name, tmp); @@ -3397,7 +3397,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID) // If we have been passed a TaskID, only reload the client state if they have // that Task active. if ((!TaskID) || (TaskID && client->IsTaskActive(TaskID))) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName()); client->RemoveClientTaskState(); client->LoadClientTaskState(); taskmanager->SendActiveTasksToClient(client); diff --git a/zone/exp.cpp b/zone/exp.cpp index 66cb7855b..53f015b8a 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -240,7 +240,7 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); + Log.Out(Logs::Detail, Logs::None, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false"); //max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51); //GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients max_AAXP = RuleI(AA, ExpPerPoint); //this may be redundant since we're doing this in Client::FinishConnState2() if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) { @@ -308,7 +308,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //figure out how many AA points we get from the exp were setting m_pp.aapoints = set_aaxp / max_AAXP; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); + Log.Out(Logs::Detail, Logs::None, "Calculating additional AA Points from AAXP for %s: %u / %u = %.1f points", this->GetCleanName(), set_aaxp, max_AAXP, (float)set_aaxp / (float)max_AAXP); //get remainder exp points, set in PP below set_aaxp = set_aaxp - (max_AAXP * m_pp.aapoints); @@ -430,7 +430,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); + Log.Out(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } @@ -488,7 +488,7 @@ void Client::SetLevel(uint8 set_level, bool command) safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Setting Level for %s to %i", GetName(), set_level); + Log.Out(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 2729203ce..f531941be 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -167,11 +167,11 @@ void Mob::CalculateNewFearpoint() fear_walkto_z = Loc.z; curfp = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); + Log.Out(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No path found to selected node. Falling through to old fear point selection."); + Log.Out(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection."); } int loop = 0; diff --git a/zone/forage.cpp b/zone/forage.cpp index bb4e6643e..427f28b10 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -70,7 +70,7 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { item[index] = atoi(row[0]); chance[index] = atoi(row[1]) + chancepool; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); + Log.Out(Logs::General, Logs::Error, "Possible Forage: %d with a %d chance", item[index], chance[index]); chancepool = chance[index]; } @@ -389,7 +389,7 @@ void Client::ForageItem(bool guarantee) { const Item_Struct* food_item = database.GetItem(foragedfood); if(!food_item) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "nullptr returned from database.GetItem in ClientForageItem"); + Log.Out(Logs::General, Logs::Error, "nullptr returned from database.GetItem in ClientForageItem"); return; } diff --git a/zone/groups.cpp b/zone/groups.cpp index 6e146f104..d1a310c92 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -768,7 +768,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -807,7 +807,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); } } } @@ -1069,7 +1069,7 @@ bool Group::LearnMembers() { return false; if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting group members for group %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return false; } @@ -1098,7 +1098,7 @@ void Group::VerifyGroup() { for (i = 0; i < MAX_GROUP_MEMBERS; i++) { if (membername[i][0] == '\0') { #if EQDEBUG >= 7 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); + Log.Out(Logs::General, Logs::None, "Group %lu: Verify %d: Empty.\n", (unsigned long)GetID(), i); #endif members[i] = nullptr; continue; @@ -1107,7 +1107,7 @@ void Group::VerifyGroup() { Mob *them = entity_list.GetMob(membername[i]); if(them == nullptr && members[i] != nullptr) { //they aren't in zone #if EQDEBUG >= 6 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); + Log.Out(Logs::General, Logs::None, "Member of group %lu named '%s' has disappeared!!", (unsigned long)GetID(), membername[i]); #endif membername[i][0] = '\0'; members[i] = nullptr; @@ -1116,13 +1116,13 @@ void Group::VerifyGroup() { if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); + Log.Out(Logs::General, Logs::None, "Member of group %lu named '%s' had an out of date pointer!!", (unsigned long)GetID(), membername[i]); #endif members[i] = them; continue; } #if EQDEBUG >= 8 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); + Log.Out(Logs::General, Logs::None, "Member of group %lu named '%s' is valid.", (unsigned long)GetID(), membername[i]); #endif } } @@ -1457,7 +1457,7 @@ void Group::DelegateMainTank(const char *NewMainTankName, uint8 toggle) MainTankName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set group main tank: %s\n", results.ErrorMessage().c_str()); } } @@ -1503,7 +1503,7 @@ void Group::DelegateMainAssist(const char *NewMainAssistName, uint8 toggle) MainAssistName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set group main assist: %s\n", results.ErrorMessage().c_str()); } } @@ -1550,7 +1550,7 @@ void Group::DelegatePuller(const char *NewPullerName, uint8 toggle) PullerName.c_str(), GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set group main puller: %s\n", results.ErrorMessage().c_str()); } @@ -1701,7 +1701,7 @@ void Group::UnDelegateMainTank(const char *OldMainTankName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET maintank = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear group main tank: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1750,7 +1750,7 @@ void Group::UnDelegateMainAssist(const char *OldMainAssistName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET assist = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear group main assist: %s\n", results.ErrorMessage().c_str()); if(!toggle) { @@ -1778,7 +1778,7 @@ void Group::UnDelegatePuller(const char *OldPullerName, uint8 toggle) std::string query = StringFormat("UPDATE group_leaders SET puller = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear group main puller: %s\n", results.ErrorMessage().c_str()); if(!toggle) { for(uint32 i = 0; i < MAX_GROUP_MEMBERS; ++i) { @@ -1861,7 +1861,7 @@ void Group::SetGroupMentor(int percent, char *name) mentoree_name.c_str(), mentor_percent, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::ClearGroupMentor() @@ -1872,7 +1872,7 @@ void Group::ClearGroupMentor() std::string query = StringFormat("UPDATE group_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear group mentor: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyAssistTarget(Client *c) @@ -1942,7 +1942,7 @@ void Group::DelegateMarkNPC(const char *NewNPCMarkerName) NewNPCMarkerName, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set group mark npc: %s\n", results.ErrorMessage().c_str()); } void Group::NotifyMarkNPC(Client *c) @@ -2023,7 +2023,7 @@ void Group::UnDelegateMarkNPC(const char *OldNPCMarkerName) std::string query = StringFormat("UPDATE group_leaders SET marknpc = '' WHERE gid = %i LIMIT 1", GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear group marknpc: %s\n", results.ErrorMessage().c_str()); } @@ -2040,7 +2040,7 @@ void Group::SaveGroupLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } diff --git a/zone/guild.cpp b/zone/guild.cpp index e1ce7b654..271d835a0 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -56,7 +56,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildMOTD of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -144,10 +144,10 @@ void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag SendAppearancePacket(AT_GuildID, GUILD_NONE); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for no guild tag."); + Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for no guild tag."); } else { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); + Log.Out(Logs::Detail, Logs::Guilds, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); if(GetClientVersion() >= EQClientRoF) { @@ -171,11 +171,11 @@ void Client::SendGuildList() { //ask the guild manager to build us a nice guild list packet outapp->pBuffer = guild_mgr.MakeGuildList(/*GetName()*/"", outapp->size); if(outapp->pBuffer == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to make guild list!"); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to make guild list!"); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_ZoneGuildList of length %d", outapp->size); FastQueuePacket(&outapp); } @@ -192,7 +192,7 @@ void Client::SendGuildMembers() { outapp->pBuffer = data; data = nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildMemberList of length %d", outapp->size); FastQueuePacket(&outapp); @@ -223,7 +223,7 @@ void Client::RefreshGuildInfo() CharGuildInfo info; if(!guild_mgr.GetCharInfo(CharacterID(), info)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); + Log.Out(Logs::Detail, Logs::Guilds, "Unable to obtain guild char info for %s (%d)", GetName(), CharacterID()); return; } @@ -335,7 +335,7 @@ void Client::SendGuildJoin(GuildJoin_Struct* gj){ outgj->rank = gj->rank; outgj->zoneid = gj->zoneid; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); + Log.Out(Logs::Detail, Logs::Guilds, "Sending OP_GuildManageAdd for join of length %d", outapp->size); FastQueuePacket(&outapp); @@ -409,7 +409,7 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -429,7 +429,7 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 76f2e3f8a..0df3fe929 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -32,7 +32,7 @@ extern WorldServer worldserver; extern volatile bool ZoneLoaded; void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); + Log.Out(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation); ServerPacket* pack = new ServerPacket(ServerOP_RefreshGuild, sizeof(ServerGuildRefresh_Struct)); ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -46,7 +46,7 @@ void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, b void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uint32 charid) { if(guild_id == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Guild lookup for char %d when sending char refresh.", charid); + Log.Out(Logs::Detail, Logs::Guilds, "Guild lookup for char %d when sending char refresh.", charid); CharGuildInfo gci; if(!GetCharInfo(charid, gci)) { @@ -56,7 +56,7 @@ void ZoneGuildManager::SendCharRefresh(uint32 old_guild_id, uint32 guild_id, uin } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Sending char refresh for %d from guild %d to world", charid, guild_id); ServerPacket* pack = new ServerPacket(ServerOP_GuildCharRefresh, sizeof(ServerGuildCharRefresh_Struct)); ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; @@ -89,7 +89,7 @@ void ZoneGuildManager::SendRankUpdate(uint32 CharID) } void ZoneGuildManager::SendGuildDelete(uint32 guild_id) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Sending guild delete for guild %d to world", guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Sending guild delete for guild %d to world", guild_id); ServerPacket* pack = new ServerPacket(ServerOP_DeleteGuild, sizeof(ServerGuildID_Struct)); ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; s->guild_id = guild_id; @@ -261,12 +261,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { switch(pack->opcode) { case ServerOP_RefreshGuild: { if(pack->size != sizeof(ServerGuildRefresh_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); + Log.Out(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRefresh_Struct)); return; } ServerGuildRefresh_Struct *s = (ServerGuildRefresh_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); + Log.Out(Logs::Detail, Logs::Guilds, "Received guild refresh from world for %d, changes: name=%d, motd=%d, rank=%d, relation=%d", s->guild_id, s->name_change, s->motd_change, s->rank_change, s->relation_change); //reload all the guild details from the database. RefreshGuild(s->guild_id); @@ -295,12 +295,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_GuildCharRefresh: { if(pack->size != sizeof(ServerGuildCharRefresh_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); + Log.Out(Logs::General, Logs::Error, "Received ServerOP_RefreshGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildCharRefresh_Struct)); return; } ServerGuildCharRefresh_Struct *s = (ServerGuildCharRefresh_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Received guild member refresh from world for char %d from guild %d", s->char_id, s->guild_id); Client *c = entity_list.GetClientByCharID(s->char_id); @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + Log.Out(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; @@ -364,12 +364,12 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { case ServerOP_DeleteGuild: { if(pack->size != sizeof(ServerGuildID_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); + Log.Out(Logs::General, Logs::Error, "Received ServerOP_DeleteGuild of incorrect size %d, expected %d", pack->size, sizeof(ServerGuildID_Struct)); return; } ServerGuildID_Struct *s = (ServerGuildID_Struct *) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Received guild delete from world for guild %d", s->guild_id); + Log.Out(Logs::Detail, Logs::Guilds, "Received guild delete from world for guild %d", s->guild_id); //clear all the guild tags. entity_list.RefreshAllGuildInfo(s->guild_id); @@ -417,10 +417,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { if (!c || !c->IsInAGuild()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Invalid Client or not in guild. ID=%i", FromID); + Log.Out(Logs::Detail, Logs::Guilds,"Invalid Client or not in guild. ID=%i", FromID); break; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); + Log.Out(Logs::Detail, Logs::Guilds,"Processing ServerOP_OnlineGuildMembersResponse"); EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct)); GuildMemberUpdate_Struct *gmus = (GuildMemberUpdate_Struct*)outapp->pBuffer; char Name[64]; @@ -433,7 +433,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { VARSTRUCT_DECODE_STRING(Name, Buffer); strn0cpy(gmus->MemberName, Name, sizeof(gmus->MemberName)); gmus->ZoneID = VARSTRUCT_DECODE_TYPE(uint32, Buffer); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); + Log.Out(Logs::Detail, Logs::Guilds,"Sending OP_GuildMemberUpdate to %i. Name=%s ZoneID=%i",FromID,Name,gmus->ZoneID); c->QueuePacket(outapp); } safe_delete(outapp); @@ -603,7 +603,7 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -684,7 +684,7 @@ void GuildBankManager::SendGuildBank(Client *c) if(Iterator == Banks.end()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); + Log.Out(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", c->GuildID()); return; } @@ -800,7 +800,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Iterator == Banks.end()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find guild bank for guild ID %i", GuildID); + Log.Out(Logs::General, Logs::Error, "Unable to find guild bank for guild ID %i", GuildID); return false; } @@ -846,7 +846,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 if(Slot < 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No space to add item to the guild bank."); + Log.Out(Logs::General, Logs::Error, "No space to add item to the guild bank."); return false; } @@ -857,7 +857,7 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -922,7 +922,7 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } @@ -974,7 +974,7 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1124,7 +1124,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1136,7 +1136,7 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1299,7 +1299,7 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/horse.cpp b/zone/horse.cpp index e5241f528..cfc0174d2 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,12 +73,12 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "No Database entry for mount: %s, check the horses table", fileName); + Log.Out(Logs::General, Logs::Error, "No Database entry for mount: %s, check the horses table", fileName); return nullptr; } @@ -121,7 +121,7 @@ void Client::SummonHorse(uint16 spell_id) { return; } if(!Horse::IsHorseSpell(spell_id)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); + Log.Out(Logs::General, Logs::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id); return; } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 71a9da32a..d498e22f9 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,7 +200,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // make sure the item exists if(item == nullptr) { Message(13, "Item %u does not exist.", item_id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -215,7 +215,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check to make sure we are augmenting an augmentable item else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) { Message(13, "You can not augment an augment or a non-common class item."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -229,7 +229,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this item."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n", GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -252,7 +252,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(augtest == nullptr) { if(augments[iter]) { Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -269,7 +269,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check that augment is an actual augment else if(augtest->AugType == 0) { Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, /* else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) { Message(13, "You are not a GM or do not have the status to summon this augment."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n", GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus); return false; @@ -292,7 +292,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(enforcewear) { if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) { Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -300,7 +300,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(item->AugSlotVisible[iter] == 0) { Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -477,7 +477,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(restrictfail) { Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -488,7 +488,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for class usability if(item->Classes && !(classes &= augtest->Classes)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -497,7 +497,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for race usability if(item->Races && !(races &= augtest->Races)) { Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -506,7 +506,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, // check for slot usability if(item->Slots && !(slots &= augtest->Slots)) { Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -533,7 +533,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(13, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::General, Logs::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -559,7 +559,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(!(slots & ((uint32)1 << slottest))) { Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + Log.Out(Logs::Detail, Logs::Inventory, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); to_slot = MainCursor; @@ -700,7 +700,7 @@ void Client::SendCursorBuffer() { // Remove item from inventory void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_update, bool update_db) { #if (EQDEBUG >= 5) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); + Log.Out(Logs::General, Logs::None, "DeleteItemInInventory(%i, %i, %s)", slot_id, quantity, (client_update) ? "true":"false"); #endif // Added 'IsSlotValid(slot_id)' check to both segments of client packet processing. @@ -815,7 +815,7 @@ void Client::DeleteItemInInventory(int16 slot_id, int8 quantity, bool client_upd bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); + Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) on the cursor", inst.GetItem()->Name, inst.GetItem()->ID); m_inv.PushCursor(inst); if (client_update) { @@ -831,7 +831,7 @@ bool Client::PushItemOnCursor(const ItemInst& inst, bool client_update) // (Also saves changes back to the database: this may be optimized in the future) // client_update: Sends packet to client bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Putting item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); if (slot_id == MainCursor) return PushItemOnCursor(inst, client_update); @@ -858,7 +858,7 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Putting loot item %s (%d) into slot %d", inst.GetItem()->Name, inst.GetItem()->ID, slot_id); m_inv.PutItem(slot_id, inst); SendLootItemInPacket(&inst, slot_id); @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI continue; const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned); interior_slot = Inventory::CalcSlotId(slot_id, i); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); + Log.Out(Logs::Detail, Logs::Inventory, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i); PutLootInInventory(interior_slot, *bagitem); safe_delete(bagitem); } @@ -1313,7 +1313,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.Out(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1321,7 +1321,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // SoF+ sends a Unix timestamp (should be int32) for src and dst slots every 10 minutes for some reason. if(src_slot_check < 2147483647) Message(13, "Warning: Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); + Log.Out(Logs::Detail, Logs::Inventory, "Invalid slot move from slot %u to slot %u with %u charges!", src_slot_check, dst_slot_check, stack_count_check); return false; } @@ -1334,7 +1334,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->to_slot == (uint32)INVALID_INDEX) { if (move_in->from_slot == (uint32)MainCursor) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); + Log.Out(Logs::Detail, Logs::Inventory, "Client destroyed item from cursor slot %d", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit ItemInst *inst = m_inv.GetItem(MainCursor); @@ -1348,7 +1348,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return true; // Item destroyed by client } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); + Log.Out(Logs::Detail, Logs::Inventory, "Deleted item from slot %d as a result of an inventory container tradeskill combine.", move_in->from_slot); if(RuleB(QueryServ, PlayerLogMoves)) { QSSwapItemAuditor(move_in); } // QS Audit DeleteItemInInventory(move_in->from_slot); return true; // Item deletion @@ -1388,7 +1388,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ItemInst* src_inst = m_inv.GetItem(src_slot_id); ItemInst* dst_inst = m_inv.GetItem(dst_slot_id); if (src_inst){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); + Log.Out(Logs::Detail, Logs::Inventory, "Src slot %d has item %s (%d) with %d charges in it.", src_slot_id, src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_inst->GetCharges()); srcitemid = src_inst->GetItem()->ID; //SetTint(dst_slot_id,src_inst->GetColor()); if (src_inst->GetCharges() > 0 && (src_inst->GetCharges() < (int16)move_in->number_in_stack || move_in->number_in_stack > src_inst->GetItem()->StackSize)) @@ -1398,7 +1398,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } } if (dst_inst) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); + Log.Out(Logs::Detail, Logs::Inventory, "Dest slot %d has item %s (%d) with %d charges in it.", dst_slot_id, dst_inst->GetItem()->Name, dst_inst->GetItem()->ID, dst_inst->GetCharges()); dstitemid = dst_inst->GetItem()->ID; } if (Trader && srcitemid>0){ @@ -1435,7 +1435,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { move_in->from_slot = dst_slot_check; move_in->to_slot = src_slot_check; move_in->number_in_stack = dst_inst->GetCharges(); - if(!SwapItem(move_in)) { Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } + if(!SwapItem(move_in)) { Log.Out(Logs::Detail, Logs::Inventory, "Recursive SwapItem call failed due to non-existent destination item (charid: %i, fromslot: %i, toslot: %i)", CharacterID(), src_slot_id, dst_slot_id); } } return false; @@ -1443,7 +1443,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { //verify shared bank transactions in the database if(src_inst && src_slot_id >= EmuConstants::SHARED_BANK_BEGIN && src_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); + Log.Out(Logs::General, Logs::Error, "Player %s on account %s was found exploiting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(dst_slot_id,0,true); return(false); } @@ -1458,7 +1458,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { } if(dst_inst && dst_slot_id >= EmuConstants::SHARED_BANK_BEGIN && dst_slot_id <= EmuConstants::SHARED_BANK_BAGS_END) { if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); + Log.Out(Logs::General, Logs::Error, "Player %s on account %s was found exploting the shared bank.\n", GetName(), account_name); DeleteItemInInventory(src_slot_id,0,true); return(false); } @@ -1577,7 +1577,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { return false; } if (with) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); + Log.Out(Logs::Detail, Logs::Inventory, "Trade item move from slot %d to slot %d (trade with %s)", src_slot_id, dst_slot_id, with->GetName()); // Fill Trade list with items from cursor if (!m_inv[MainCursor]) { Message(13, "Error: Cursor item not located on server!"); @@ -1610,18 +1610,18 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if (move_in->number_in_stack > 0) { // Determine if charged items can stack if(src_inst && !src_inst->IsStackable()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); + Log.Out(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. %s is not a stackable item. (charname: %s)", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetItem()->Name, GetName()); return false; } if (dst_inst) { if(src_inst->GetID() != dst_inst->GetID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); + Log.Out(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Incompatible item types: %d != %d", src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetID(), dst_inst->GetID()); return(false); } if(dst_inst->GetCharges() < dst_inst->GetItem()->StackSize) { //we have a chance of stacking. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); + Log.Out(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. dest has %d/%d charges", src_slot_id, dst_slot_id, move_in->number_in_stack, dst_inst->GetCharges(), dst_inst->GetItem()->StackSize); // Charges can be emptied into dst uint16 usedcharges = dst_inst->GetItem()->StackSize - dst_inst->GetCharges(); if (usedcharges > move_in->number_in_stack) @@ -1633,15 +1633,15 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { // Depleted all charges? if (src_inst->GetCharges() < 1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); + Log.Out(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) was entirely consumed. (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, usedcharges); database.SaveInventory(CharacterID(),nullptr,src_slot_id); m_inv.DeleteItem(src_slot_id); all_to_stack = true; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); + Log.Out(Logs::Detail, Logs::Inventory, "Dest (%d) now has %d charges, source (%d) has %d (%d moved)", dst_slot_id, dst_inst->GetCharges(), src_slot_id, src_inst->GetCharges(), usedcharges); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); + Log.Out(Logs::Detail, Logs::Inventory, "Move from %d to %d with stack size %d. Exceeds dest maximum stack size: %d/%d", src_slot_id, dst_slot_id, move_in->number_in_stack, (src_inst->GetCharges()+dst_inst->GetCharges()), dst_inst->GetItem()->StackSize); return false; } } @@ -1650,12 +1650,12 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { if ((int16)move_in->number_in_stack >= src_inst->GetCharges()) { // Move entire stack if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); + Log.Out(Logs::Detail, Logs::Inventory, "Move entire stack from %d to %d with stack size %d. Dest empty.", src_slot_id, dst_slot_id, move_in->number_in_stack); } else { // Split into two src_inst->SetCharges(src_inst->GetCharges() - move_in->number_in_stack); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); + Log.Out(Logs::Detail, Logs::Inventory, "Split stack of %s (%d) from slot %d to %d with stack size %d. Src keeps %d.", src_inst->GetItem()->Name, src_inst->GetItem()->ID, src_slot_id, dst_slot_id, move_in->number_in_stack, src_inst->GetCharges()); ItemInst* inst = database.CreateItem(src_inst->GetItem(), move_in->number_in_stack); m_inv.PutItem(dst_slot_id, *inst); safe_delete(inst); @@ -1680,7 +1680,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { SetMaterial(dst_slot_id,src_inst->GetItem()->ID); } if(!m_inv.SwapItem(src_slot_id, dst_slot_id)) { return false; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Moving entire item from slot %d to slot %d", src_slot_id, dst_slot_id); if(src_slot_id <= EmuConstants::EQUIPMENT_END || src_slot_id == MainPowerSource) { if(src_inst) { @@ -1739,7 +1739,7 @@ void Client::SwapItemResync(MoveItem_Struct* move_slots) { // resync the 'from' and 'to' slots on an as-needed basis // Not as effective as the full process, but less intrusive to gameplay -U - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); + Log.Out(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot); Message(15, "Inventory Desyncronization detected: Resending slot data..."); if((move_slots->from_slot >= EmuConstants::EQUIPMENT_BEGIN && move_slots->from_slot <= EmuConstants::CURSOR_BAG_END) || move_slots->from_slot == MainPowerSource) { @@ -2071,7 +2071,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::EQUIPMENT_BEGIN; slot_id <= EmuConstants::EQUIPMENT_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2080,7 +2080,7 @@ void Client::RemoveNoRent(bool client_update) { for (slot_id = EmuConstants::GENERAL_BEGIN; slot_id <= EmuConstants::GENERAL_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if (inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2089,7 +2089,7 @@ void Client::RemoveNoRent(bool client_update) { if (m_inv[MainPowerSource]) { const ItemInst* inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent } } @@ -2098,7 +2098,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::GENERAL_BAGS_BEGIN; slot_id <= EmuConstants::CURSOR_BAG_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, client_update); } } @@ -2107,7 +2107,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BEGIN; slot_id <= EmuConstants::BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank slots } } @@ -2116,7 +2116,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::BANK_BAGS_BEGIN; slot_id <= EmuConstants::BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Bank Container slots } } @@ -2125,7 +2125,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BEGIN; slot_id <= EmuConstants::SHARED_BANK_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank slots } } @@ -2134,7 +2134,7 @@ void Client::RemoveNoRent(bool client_update) { for(slot_id = EmuConstants::SHARED_BANK_BAGS_BEGIN; slot_id <= EmuConstants::SHARED_BANK_BAGS_END; slot_id++) { const ItemInst* inst = m_inv[slot_id]; if(inst && !inst->GetItem()->NoRent) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); DeleteItemInInventory(slot_id, 0, false); // Can't delete from client Shared Bank Container slots } } @@ -2155,7 +2155,7 @@ void Client::RemoveNoRent(bool client_update) { inst = *iter; // should probably put a check here for valid pointer..but, that was checked when the item was put into inventory -U if (!inst->GetItem()->NoRent) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(Logs::Detail, Logs::Inventory, "NoRent Timer Lapse: Deleting %s from `Limbo`", inst->GetItem()->Name); else m_inv.PushCursor(**iter); @@ -2178,7 +2178,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2193,7 +2193,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2208,7 +2208,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2223,7 +2223,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2238,7 +2238,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2253,7 +2253,7 @@ void Client::RemoveDuplicateLore(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); if(inst) { if(CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); database.SaveInventory(character_id, nullptr, slot_id); } else { @@ -2281,7 +2281,7 @@ void Client::RemoveDuplicateLore(bool client_update) { inst = *iter; // probably needs a valid pointer check -U if (CheckLoreConflict(inst->GetItem())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); safe_delete(*iter); iter = local.erase(iter); } @@ -2300,7 +2300,7 @@ void Client::RemoveDuplicateLore(bool client_update) { m_inv.PushCursor(**iter); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from `Limbo`", inst->GetItem()->Name); } safe_delete(*iter); @@ -2322,7 +2322,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, client_update); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2335,7 +2335,7 @@ void Client::MoveSlotNotAllowed(bool client_update) { ItemInst* inst = m_inv.PopItem(slot_id); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, slot_id); safe_delete(inst); @@ -2479,7 +2479,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, 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; @@ -2491,13 +2491,13 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { InvItem = GetInv()[WeaponSlot]; if(InvItem) { BaseItem = InvItem->GetItem(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot); + 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); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot); + 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; } @@ -2506,7 +2506,7 @@ void Client::CreateBandolier(const EQApplicationPacket *app) { void Client::RemoveBandolier(const EQApplicationPacket *app) { BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s removing set", GetName(), bds->number); + 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; @@ -2521,7 +2521,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // any items currently in the weapon slots to inventory. BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s activating set %i", GetName(), bss->number); + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->number); int16 slot; int16 WeaponSlot; ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory @@ -2585,16 +2585,16 @@ void Client::SetBandolier(const EQApplicationPacket *app) { else { // The player doesn't have the required weapon with them. BandolierItems[BandolierSlot] = 0; if (slot == INVALID_INDEX) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); + Log.Out(Logs::Detail, Logs::Inventory, "Character does not have required bandolier item for slot %i", WeaponSlot); ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { // If there was an item in that weapon slot, put it in the inventory - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "returning item %s in weapon slot %i to inventory", + Log.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2629,7 +2629,7 @@ void Client::SetBandolier(const EQApplicationPacket *app) { if(InvItem) { // If there was already an item in that weapon slot that we replaced, find a place to put it if(!MoveItemToInventory(InvItem)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2640,13 +2640,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // put it in the player's inventory. ItemInst *InvItem = m_inv.PopItem(WeaponSlot); if(InvItem) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", + Log.Out(Logs::Detail, Logs::Inventory, "Bandolier has no item for slot %i, returning item %s to inventory", WeaponSlot, InvItem->GetItem()->Name); // If there was an item in that weapon slot, put it in the inventory if(MoveItemToInventory(InvItem)) database.SaveInventory(character_id, 0, WeaponSlot); else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); safe_delete(InvItem); } @@ -2677,7 +2677,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { if(!ItemToReturn) return false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); + Log.Out(Logs::Detail, Logs::Inventory,"Char: %s Returning %s to inventory", GetName(), ItemToReturn->GetItem()->Name); uint32 ItemID = ItemToReturn->GetItem()->ID; @@ -2761,7 +2761,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(i), i); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Storing in main inventory slot %i", GetName(), i); return true; } @@ -2784,7 +2784,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { database.SaveInventory(character_id, m_inv.GetItem(BaseSlotID + BagSlot), BaseSlotID + BagSlot); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Storing in bag slot %i", GetName(), BaseSlotID + BagSlot); return true; } @@ -2794,7 +2794,7 @@ bool Client::MoveItemToInventory(ItemInst *ItemToReturn, bool UpdateClient) { // Store on the cursor // - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Inventory, "Char: %s No space, putting on the cursor", GetName()); + Log.Out(Logs::Detail, Logs::Inventory, "Char: %s No space, putting on the cursor", GetName()); PushItemOnCursor(*ItemToReturn, UpdateClient); @@ -2865,8 +2865,8 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool } if (log) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory() -- End"); + Log.Out(Logs::General, Logs::Error, "Target interrogate inventory flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory() -- End"); } if (!silent) { requester->Message(1, "Target interrogation flag: %s", (GetInterrogateInvState() ? "TRUE" : "FALSE")); @@ -2881,7 +2881,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 head, int16 index, const ItemInst* inst, const ItemInst* parent, bool log, bool silent, bool &error, int depth) { if (depth >= 10) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::InterrogateInventory_() - Recursion count has exceeded the maximum allowable (You have a REALLY BIG PROBLEM!!)"); return; } @@ -2910,7 +2910,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + Log.Out(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", head, depth, i.c_str(), p.c_str(), e.c_str()); if (!silent) requester->Message(1, "%i:%i - inst: %s - parent: %s%s", diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 96ef83c88..16f5af7b0 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -145,7 +145,7 @@ void ZoneDatabase::AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* iteml drop_chance = zone->random.Real(0.0, 100.0); #if EQDEBUG>=11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); + Log.Out(Logs::General, Logs::None, "Drop chance for npc: %s, this chance:%f, drop roll:%f", npc->GetName(), thischance, drop_chance); #endif if (thischance == 100.0 || drop_chance < thischance) { @@ -187,7 +187,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge ServerLootItem_Struct* item = new ServerLootItem_Struct; #if EQDEBUG>=11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); + Log.Out(Logs::General, Logs::None, "Adding drop to npc: %s, Item: %i", GetName(), item2->ID); #endif EQApplicationPacket* outapp = nullptr; diff --git a/zone/merc.cpp b/zone/merc.cpp index ee846c49e..73990f139 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -885,7 +885,7 @@ int32 Merc::CalcMaxMana() break; } default: { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + Log.Out(Logs::General, Logs::None, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -906,7 +906,7 @@ int32 Merc::CalcMaxMana() } #if EQDEBUG >= 11 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + Log.Out(Logs::General, Logs::None, "Merc::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; } @@ -1647,7 +1647,7 @@ void Merc::AI_Process() { if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); + Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); CalculateNewPosition2(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ(), GetRunspeed()); return; } @@ -1766,7 +1766,7 @@ bool Merc::AI_EngagedCastCheck() { { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered (MERCS)."); + Log.Out(Logs::Detail, Logs::AI, "Engaged autocast check triggered (MERCS)."); int8 mercClass = GetClass(); @@ -1873,7 +1873,7 @@ bool EntityList::Merc_AICheckCloseBeneficialSpells(Merc* caster, uint8 iChance, // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -4451,7 +4451,7 @@ bool Merc::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, boo { if (!other) { SetTarget(nullptr); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); + Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Merc::Attack() for evaluation!"); return false; } @@ -5986,7 +5986,7 @@ void NPC::LoadMercTypes() { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Out(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()"); return; } @@ -6019,7 +6019,7 @@ void NPC::LoadMercs() { if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in NPC::LoadMercTypes()"); + Log.Out(Logs::General, Logs::Error, "Error in NPC::LoadMercTypes()"); return; } diff --git a/zone/mob.cpp b/zone/mob.cpp index 8f594c80a..ab2d83152 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1576,7 +1576,7 @@ void Mob::SendIllusionPacket(uint16 in_race, uint8 in_gender, uint8 in_texture, entity_list.QueueClients(this, outapp); safe_delete(outapp); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + Log.Out(Logs::Detail, Logs::Spells, "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface, drakkin_heritage, drakkin_tattoo, drakkin_details, size); } @@ -3043,7 +3043,7 @@ void Mob::ExecWeaponProc(const ItemInst *inst, uint16 spell_id, Mob *on) { if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); } return; } @@ -4536,7 +4536,7 @@ void Mob::MeleeLifeTap(int32 damage) { if(lifetap_amt && damage > 0){ lifetap_amt = damage * lifetap_amt / 100; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Melee lifetap healing for %d damage.", damage); + Log.Out(Logs::Detail, Logs::Combat, "Melee lifetap healing for %d damage.", damage); if (lifetap_amt > 0) HealDamage(lifetap_amt); //Heal self for modified damage amount. diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index dd637525c..a77335016 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -355,7 +355,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float // according to Rogean, Live NPCs will just cast through walls/floors, no problem.. // // This check was put in to address an idle-mob CPU issue - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); + Log.Out(Logs::General, Logs::Error, "Error: detrimental spells requested from AICheckCloseBeneficialSpells!!"); return(false); } @@ -1404,7 +1404,7 @@ void Mob::AI_Process() { else if (AImovement_timer->Check()) { if(!IsRooted()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Pursuing %s while engaged.", target->GetName()); + Log.Out(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName()); if(!RuleB(Pathing, Aggro) || !zone->pathing) CalculateNewPosition2(target->GetX(), target->GetY(), target->GetZ(), GetRunspeed()); else @@ -1639,7 +1639,7 @@ void NPC::AI_DoMovement() { roambox_movingto_y = zone->random.Real(roambox_min_y+1,roambox_max_y-1); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", + Log.Out(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) { @@ -1692,11 +1692,11 @@ void NPC::AI_DoMovement() { else { movetimercompleted=false; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "We are departing waypoint %d.", cur_wp); + Log.Out(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp); //if we were under quest control (with no grid), we are done now.. if(cur_wp == -2) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); + Log.Out(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode."); roamer = false; cur_wp = 0; } @@ -1727,7 +1727,7 @@ void NPC::AI_DoMovement() { { // currently moving if (cur_wp_x == GetX() && cur_wp_y == GetY()) { // are we there yet? then stop - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); + Log.Out(Logs::Detail, Logs::AI, "We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d", cur_wp, GetX(), GetY(), GetZ(), GetGrid()); SetWaypointPause(); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1773,7 +1773,7 @@ void NPC::AI_DoMovement() { if (movetimercompleted==true) { // time to pause has ended SetGrid( 0 - GetGrid()); // revert to AI control - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); + Log.Out(Logs::Detail, Logs::Pathing, "Quest pathing is finished. Resuming on grid %d", GetGrid()); if(GetAppearance() != eaStanding) SetAppearance(eaStanding, false); @@ -1809,7 +1809,7 @@ void NPC::AI_DoMovement() { if (!CP2Moved) { if(moved) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); + Log.Out(Logs::Detail, Logs::AI, "Reached guard point (%.3f,%.3f,%.3f)", guard_x, guard_y, guard_z); ClearFeignMemory(); moved=false; SetMoving(false); @@ -1934,7 +1934,7 @@ bool NPC::AI_EngagedCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); + Log.Out(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); // try casting a heal or gate if (!AICastSpell(this, AISpellVar.engaged_beneficial_self_chance, SpellType_Heal | SpellType_Escape | SpellType_InCombatBuff)) { @@ -1957,7 +1957,7 @@ bool NPC::AI_PursueCastCheck() { if (AIautocastspell_timer->Check(false)) { AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); + Log.Out(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { //no spell cast, try again soon. AIautocastspell_timer->Start(RandomTimer(AISpellVar.pursue_no_sp_recast_min, AISpellVar.pursue_no_sp_recast_max), false); diff --git a/zone/net.cpp b/zone/net.cpp index b1a372a8c..987124ea1 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -148,28 +148,28 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading server configuration.."); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading server configuration failed."); + Log.Out(Logs::General, Logs::Error, "Loading server configuration failed."); return 1; } const ZoneConfig *Config=ZoneConfig::get(); if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); + Log.Out(Logs::Detail, Logs::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); worldserver.SetPassword(Config->SharedKey.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Connecting to MySQL..."); + Log.Out(Logs::Detail, Logs::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Cannot continue without a database connection."); + Log.Out(Logs::General, Logs::Error, "Cannot continue without a database connection."); return 1; } @@ -186,121 +186,121 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(Logs::Detail, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers */ if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(Logs::General, Logs::Error, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(Logs::General, Logs::Error, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not set signal handler"); + Log.Out(Logs::General, Logs::Error, "Could not set signal handler"); return 1; } #endif const char *log_ini_file = "./log.ini"; if(!load_log_settings(log_ini_file)) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Warning: Unable to read %s", log_ini_file); + Log.Out(Logs::Detail, Logs::Zone_Server, "Warning: Unable to read %s", log_ini_file); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Log settings loaded from %s", log_ini_file); + Log.Out(Logs::Detail, Logs::Zone_Server, "Log settings loaded from %s", log_ini_file); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Mapping Incoming Opcodes"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading Variables"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading Variables"); database.LoadVariables(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading zone names"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading items"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading items"); if (!database.LoadItems()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading items FAILED!"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed. But ignoring error and going on..."); + Log.Out(Logs::General, Logs::Error, "Loading items FAILED!"); + Log.Out(Logs::General, Logs::Error, "Failed. But ignoring error and going on..."); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading npc faction lists"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading npcs faction lists FAILED!"); + Log.Out(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading loot tables"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading loot FAILED!"); + Log.Out(Logs::General, Logs::Error, "Loading loot FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading skill caps"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading skill caps FAILED!"); + Log.Out(Logs::General, Logs::Error, "Loading skill caps FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading spells"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading base data"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading base data FAILED!"); + Log.Out(Logs::General, Logs::Error, "Loading base data FAILED!"); CheckEQEMuErrorAndPause(); return 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading guilds"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading factions"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading factions"); database.LoadFactionData(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading titles"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading AA effects"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading tributes"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading tributes"); database.LoadTributes(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading corpse timers"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading commands"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Command loading FAILED"); + Log.Out(Logs::General, Logs::Error, "Command loading FAILED"); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "%d commands loaded", retval); + Log.Out(Logs::Detail, Logs::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "No rule set configured, using default rules"); + Log.Out(Logs::Detail, Logs::Zone_Server, "No rule set configured, using default rules"); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(TaskSystem, EnableTaskSystem)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[INIT] Loading Tasks"); + Log.Out(Logs::General, Logs::Tasks, "[INIT] Loading Tasks"); taskmanager = new TaskManager; taskmanager->LoadTasks(); } @@ -317,11 +317,11 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Loading quests"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Worldserver Connection Failed :: worldserver.Connect()"); + Log.Out(Logs::General, Logs::Error, "Worldserver Connection Failed :: worldserver.Connect()"); } Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect @@ -332,9 +332,9 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Entering sleep mode"); + Log.Out(Logs::Detail, Logs::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone Bootup failed :: Zone::Bootup"); + Log.Out(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; } @@ -343,7 +343,7 @@ int main(int argc, char** argv) { RegisterAllPatches(stream_identifier); #ifndef WIN32 - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Main thread running with thread id %d", pthread_self()); + Log.Out(Logs::Detail, Logs::None, "Main thread running with thread id %d", pthread_self()); #endif Timer quest_timers(100); @@ -365,13 +365,13 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + Log.Out(Logs::Detail, Logs::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); // log_sys.CloseZoneLogs(); // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); if (!eqsf.Open(Config->ZonePort)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to open port %d",Config->ZonePort); + Log.Out(Logs::General, Logs::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); worldserver.Disconnect(); worldwasconnected = false; @@ -385,7 +385,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqss->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); + Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort())); stream_identifier.AddStream(eqss); //takes the stream } @@ -397,7 +397,7 @@ int main(int argc, char** argv) { //now that we know what patch they are running, start up their client object struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.Out(Logs::Detail, Logs::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); Client* client = new Client(eqsi); entity_list.AddClient(client); } @@ -522,13 +522,13 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); CheckEQEMuErrorAndPause(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Proper zone shutdown complete."); + Log.Out(Logs::Detail, Logs::Zone_Server, "Proper zone shutdown complete."); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Recieved signal: %i", sig_num); + Log.Out(Logs::Detail, Logs::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -539,7 +539,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); // safe_delete(worldserver); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Shutting down..."); + Log.Out(Logs::Detail, Logs::Zone_Server, "Shutting down..."); } uint32 NetConnection::GetIP() @@ -628,7 +628,7 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) { spells = reinterpret_cast((*mmf)->Get()); mutex.Unlock(); } catch(std::exception &ex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading spells: %s", ex.what()); + Log.Out(Logs::General, Logs::Error, "Error loading spells: %s", ex.what()); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 013136a50..4700159ec 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -508,7 +508,7 @@ void NPC::QueryLoot(Client* to) for(ItemList::iterator cur = itemlist.begin(); cur != itemlist.end(); ++cur, ++x) { const Item_Struct* item = database.GetItem((*cur)->item_id); if (item == nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database error, invalid item"); + Log.Out(Logs::General, Logs::Error, "Database error, invalid item"); continue; } @@ -1004,7 +1004,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1021,7 +1021,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); @@ -1033,7 +1033,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); @@ -1047,7 +1047,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1058,7 +1058,7 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1075,7 +1075,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); @@ -1098,7 +1098,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); @@ -1110,7 +1110,7 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1672,7 +1672,7 @@ void Mob::NPCSpecialAttacks(const char* parse, int permtag, bool reset, bool rem { if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); + Log.Out(Logs::General, Logs::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse); } } } diff --git a/zone/object.cpp b/zone/object.cpp index 5624ec24a..baa084699 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -336,7 +336,7 @@ const ItemInst* Object::GetItem(uint8 index) { void Object::PutItem(uint8 index, const ItemInst* inst) { if (index > 9) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Object::PutItem: Invalid index specified (%i)", index); + Log.Out(Logs::General, Logs::Error, "Object::PutItem: Invalid index specified (%i)", index); return; } @@ -598,7 +598,7 @@ uint32 ZoneDatabase::AddObject(uint32 type, uint32 icon, const Object_Struct& ob safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to insert object: %s", results.ErrorMessage().c_str()); return 0; } @@ -635,7 +635,7 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec safe_delete_array(object_name); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to update object: %s", results.ErrorMessage().c_str()); return; } @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteObject(uint32 id) std::string query = StringFormat("DELETE FROM object WHERE id = %i", id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to delete object: %s", results.ErrorMessage().c_str()); } } diff --git a/zone/pathing.cpp b/zone/pathing.cpp index c8546279b..6afa63546 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -61,19 +61,19 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName) if(Ret->loadPaths(PathFile)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File %s loaded.", ZonePathFileName); + Log.Out(Logs::General, Logs::Status, "Path File %s loaded.", ZonePathFileName); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s failed to load.", ZonePathFileName); + Log.Out(Logs::General, Logs::Error, "Path File %s failed to load.", ZonePathFileName); safe_delete(Ret); } fclose(PathFile); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path File %s not found.", ZonePathFileName); + Log.Out(Logs::General, Logs::Error, "Path File %s not found.", ZonePathFileName); } return Ret; @@ -103,18 +103,18 @@ bool PathManager::loadPaths(FILE *PathFile) if(strncmp(Magic, "EQEMUPATH", 9)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bad Magic String in .path file."); + Log.Out(Logs::General, Logs::Error, "Bad Magic String in .path file."); return false; } fread(&Head, sizeof(Head), 1, PathFile); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Path File Header: Version %ld, PathNodes %ld", + Log.Out(Logs::General, Logs::Status, "Path File Header: Version %ld, PathNodes %ld", (long)Head.version, (long)Head.PathNodeCount); if(Head.version != 2) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unsupported path file version."); + Log.Out(Logs::General, Logs::Error, "Unsupported path file version."); return false; } @@ -138,7 +138,7 @@ bool PathManager::loadPaths(FILE *PathFile) { if(PathNodes[i].Neighbours[j].id > MaxNodeID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); + Log.Out(Logs::General, Logs::Error, "Path Node %i, Neighbour %i (%i) out of range.", i, j, PathNodes[i].Neighbours[j].id); PathFileValid = false; } @@ -207,7 +207,7 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) std::deque PathManager::FindRoute(int startID, int endID) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute from node %i to %i", startID, endID); + Log.Out(Logs::Detail, Logs::None, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); @@ -330,7 +330,7 @@ std::deque PathManager::FindRoute(int startID, int endID) } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Unable to find a route."); + Log.Out(Logs::Detail, Logs::None, "Unable to find a route."); return Route; } @@ -352,7 +352,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b) std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); + Log.Out(Logs::Detail, Logs::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); std::deque noderoute; @@ -386,7 +386,7 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -396,11 +396,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToStart <0 ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.Out(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range."); return noderoute; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); + Log.Out(Logs::Detail, Logs::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); // Find the nearest PathNode the end point has LOS to @@ -424,8 +424,8 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", + Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); + Log.Out(Logs::Detail, Logs::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", End.x, End.y, End.z, PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); @@ -437,11 +437,11 @@ std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) } if(ClosestPathNodeToEnd < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any end Path Node within range."); + Log.Out(Logs::Detail, Logs::None, "No LOS to any end Path Node within range."); return noderoute; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); + Log.Out(Logs::Detail, Logs::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); if(ClosestPathNodeToStart == ClosestPathNodeToEnd) { @@ -673,7 +673,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(To == From) return To; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); + Log.Out(Logs::Detail, Logs::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); if(From == PathingLastPosition) { @@ -681,7 +681,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((PathingLoopCount > 5) && !IsRooted()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "appears to be stuck. Teleporting them to next position.", GetName()); + Log.Out(Logs::Detail, Logs::None, "appears to be stuck. Teleporting them to next position.", GetName()); if(Route.size() == 0) { @@ -721,7 +721,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // If we are already pathing, and the destination is the same as before ... if(SameDestination) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Still pathing to the same destination."); + Log.Out(Logs::Detail, Logs::None, " Still pathing to the same destination."); // Get the coordinates of the first path node we are going to. NextNode = Route.front(); @@ -732,7 +732,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // We have reached the path node. if(NodeLoc == From) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i", NextNode); + Log.Out(Logs::Detail, Logs::None, " Arrived at node %i", NextNode); NodeReached = true; @@ -746,17 +746,17 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // target, and we may run past the target if we don't check LOS at this point. int RouteSize = Route.size(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Route size is %i", RouteSize); + Log.Out(Logs::Detail, Logs::None, "Route size is %i", RouteSize); if((RouteSize == 2) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.Out(Logs::Detail, Logs::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.Out(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -765,18 +765,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(Logs::Detail, Logs::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(Logs::Detail, Logs::None, " Continuing on node path."); } } else @@ -802,7 +802,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.Out(Logs::Detail, Logs::None, "Missing node after teleport."); return To; } @@ -812,7 +812,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.Out(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -823,7 +823,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.Out(Logs::Detail, Logs::None, " Now moving to node %i", NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode); } @@ -831,7 +831,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // we have run all the nodes, all that is left is the direct path from the last node // to the destination - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of node path, running direct to target."); + Log.Out(Logs::Detail, Logs::None, " Reached end of node path, running direct to target."); return To; } @@ -845,11 +845,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && PathingLOSCheckTimer->Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking distance to target."); + Log.Out(Logs::Detail, Logs::None, " Checking distance to target."); float Distance = VertexDistanceNoRoot(From, To); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Distance between From and To (NoRoot) is %8.3f", Distance); + Log.Out(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance); if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) @@ -858,18 +858,18 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(Logs::Detail, Logs::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(Logs::Detail, Logs::None, " Continuing on node path."); } } else @@ -881,7 +881,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { // We get here if we were already pathing, but our destination has now changed. // - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target has changed position."); + Log.Out(Logs::Detail, Logs::None, " Target has changed position."); // Update our record of where we are going to. PathingDestination = To; // Check if we now have LOS etc to the new destination. @@ -892,23 +892,23 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for short LOS at distance %8.3f.", Distance); + Log.Out(Logs::Detail, Logs::None, " Checking for short LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(Logs::Detail, Logs::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No hazards. Running directly to target."); + Log.Out(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Route.clear(); return To; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Continuing on node path."); + Log.Out(Logs::Detail, Logs::None, " Continuing on node path."); } } } @@ -919,19 +919,19 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & { if(!PathingRouteUpdateTimerShort->Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer not yet expired."); + Log.Out(Logs::Detail, Logs::None, "Short route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Short route update timer expired."); + Log.Out(Logs::Detail, Logs::None, "Short route update timer expired."); } else { if(!PathingRouteUpdateTimerLong->Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer not yet expired."); + Log.Out(Logs::Detail, Logs::None, "Long route update timer not yet expired."); return zone->pathing->GetPathNodeCoordinates(Route.front()); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Long route update timer expired."); + Log.Out(Logs::Detail, Logs::None, "Long route update timer expired."); } // We are already pathing, destination changed, no LOS. Find the nearest node to our destination. @@ -940,7 +940,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Destination unreachable via pathing, return direct route. if(DestinationPathNode == -1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Unable to find path node for new destination. Running straight to target."); + Log.Out(Logs::Detail, Logs::None, " Unable to find path node for new destination. Running straight to target."); Route.clear(); return To; } @@ -948,7 +948,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // one, we will carry on on our path. if(DestinationPathNode == Route.back()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); + Log.Out(Logs::Detail, Logs::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); @@ -956,7 +956,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & // Check if we have reached a path node. if(NodeLoc == From) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Arrived at node %i, moving to next one.\n", Route.front()); + Log.Out(Logs::Detail, Logs::None, " Arrived at node %i, moving to next one.\n", Route.front()); NodeReached = true; @@ -979,7 +979,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Missing node after teleport."); + Log.Out(Logs::Detail, Logs::None, "Missing node after teleport."); return To; } @@ -989,7 +989,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & Teleport(NodeLoc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); + Log.Out(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Route.pop_front(); @@ -999,7 +999,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & NextNode = Route.front(); } // Return the coords of our next path node on the route. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Now moving to node %i", NextNode); + Log.Out(Logs::Detail, Logs::None, " Now moving to node %i", NextNode); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); @@ -1007,7 +1007,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Reached end of path grid. Running direct to target."); + Log.Out(Logs::Detail, Logs::None, " Reached end of path grid. Running direct to target."); return To; } } @@ -1015,7 +1015,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Target moved. End node is different. Clearing route."); + Log.Out(Logs::Detail, Logs::None, " Target moved. End node is different. Clearing route."); Route.clear(); // We will now fall through to get a new route. @@ -1025,11 +1025,11 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Our route list is empty."); + Log.Out(Logs::Detail, Logs::None, " Our route list is empty."); if((SameDestination) && !PathingLOSCheckTimer->Check()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Destination same as before, LOS check timer not reached. Returning To."); + Log.Out(Logs::Detail, Logs::None, " Destination same as before, LOS check timer not reached. Returning To."); return To; } @@ -1044,22 +1044,22 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && (ABS(From.z - To.z) <= RuleR(Pathing, ZDiffThreshold))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Checking for long LOS at distance %8.3f.", Distance); + Log.Out(Logs::Detail, Logs::None, " Checking for long LOS at distance %8.3f.", Distance); if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) PathingLOSState = HaveLOS; else PathingLOSState = NoLOS; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "NoLOS"); + Log.Out(Logs::Detail, Logs::None, "NoLOS"); if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Target is reachable. Running directly there."); + Log.Out(Logs::Detail, Logs::None, "Target is reachable. Running directly there."); return To; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Calculating new route to target."); + Log.Out(Logs::Detail, Logs::None, " Calculating new route to target."); Route = zone->pathing->FindRoute(From, To); @@ -1067,14 +1067,14 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(Route.size() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " No route available, running direct."); + Log.Out(Logs::Detail, Logs::None, " No route available, running direct."); return To; } if(SameDestination && (Route.front() == PathingLastNodeVisited)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); + Log.Out(Logs::Detail, Logs::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Route.clear(); @@ -1082,7 +1082,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " New route determined, heading for node %i", Route.front()); + Log.Out(Logs::Detail, Logs::None, " New route determined, heading for node %i", Route.front()); PathingLoopCount = 0; @@ -1124,7 +1124,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); + Log.Out(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) { @@ -1134,7 +1134,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) } if(ClosestPathNodeToStart <0 ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No LOS to any starting Path Node within range."); + Log.Out(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range."); return -1; } return ClosestPathNodeToStart; @@ -1150,14 +1150,14 @@ bool PathManager::NoHazards(Map::Vertex From, Map::Vertex To) if(ABS(NewZ - From.z) > RuleR(Pathing, ZDiffThreshold)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); return false; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", + Log.Out(Logs::Detail, Logs::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); } @@ -1189,7 +1189,7 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); if (ABS(NewZ - last_z) > 5.0f) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", + Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); return false; } @@ -1215,30 +1215,30 @@ bool PathManager::NoHazardsAccurate(Map::Vertex From, Map::Vertex To) } if (best_z2 == -999990) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, really deep water/lava!"); + Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED, really deep water/lava!"); return false; } else { if (ABS(NewZ - best_z2) > RuleR(Pathing, ZDiffThreshold)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); + Log.Out(Logs::Detail, Logs::None, " HAZARD DETECTED, water is fairly deep at %8.3f units deep", ABS(NewZ - best_z2)); return false; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); + Log.Out(Logs::Detail, Logs::None, " HAZARD NOT DETECTED, water is shallow at %8.3f units deep", ABS(NewZ - best_z2)); } } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Hazard point not in water or lava!"); + Log.Out(Logs::Detail, Logs::None, "Hazard point not in water or lava!"); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "No water map loaded for hazards!"); + Log.Out(Logs::Detail, Logs::None, "No water map loaded for hazards!"); } curx += stepx; @@ -1290,7 +1290,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho) if(d && !d->IsDoorOpen() ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); + Log.Out(Logs::Detail, Logs::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); d->ForceOpen(ForWho); } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 621895c3b..685a39091 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1271,15 +1271,15 @@ XS(XS_Client_MovePC) } else { if (THIS->IsMerc()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); #endif else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); } @@ -1317,15 +1317,15 @@ XS(XS_Client_MovePCInstance) } else { if (THIS->IsMerc()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); else if (THIS->IsNPC()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); #ifdef BOTS else if (THIS->IsBot()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); #endif else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference"); Perl_croak(aTHX_ "THIS is not of type Client"); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 9ee477de0..2d2173e26 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,7 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -227,7 +227,7 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -254,12 +254,12 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "New petition created"); + Log.Out(Logs::General, Logs::None, "New petition created"); #endif } @@ -273,7 +273,7 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/pets.cpp b/zone/pets.cpp index b8d25c2b6..1171194e3 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -243,7 +243,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, PetRecord record; if(!database.GetPoweredPetEntry(pettype, act_power, &record)) { Message(13, "Unable to find data for pet %s", pettype); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to find data for pet %s, check pets table.", pettype); + Log.Out(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype); return; } @@ -251,7 +251,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, const NPCType *base = database.GetNPCType(record.npc_type); if(base == nullptr) { Message(13, "Unable to load NPC data for pet %s", pettype); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); + Log.Out(Logs::General, Logs::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type); return; } @@ -372,7 +372,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { @@ -395,7 +395,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, npc_type->helmtexture = monster->helmtexture; npc_type->herosforgemodel = monster->herosforgemodel; } else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); + Log.Out(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid); } @@ -456,7 +456,7 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -656,13 +656,13 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if (results.RowCount() != 1) { // invalid set reference, it doesn't exist - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); + Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems equipment set '%d' does not exist", curset); return false; } @@ -672,7 +672,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 83f497352..d9eb291dc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -154,7 +154,7 @@ void QuestManager::echo(int colour, const char *str) { void QuestManager::say(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -170,7 +170,7 @@ void QuestManager::say(const char *str) { void QuestManager::say(const char *str, uint8 language) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::say called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -548,7 +548,7 @@ void QuestManager::stopalltimers(Mob *mob) { void QuestManager::emote(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::emote called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -559,7 +559,7 @@ void QuestManager::emote(const char *str) { void QuestManager::shout(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::shout called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -570,7 +570,7 @@ void QuestManager::shout(const char *str) { void QuestManager::shout2(const char *str) { QuestManagerCurrentQuestVars(); if (!owner) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::shout2 called with nullptr owner. Probably syntax error in quest file."); return; } else { @@ -589,7 +589,7 @@ void QuestManager::gmsay(const char *str, uint32 color, bool send_to_world, uint void QuestManager::depop(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::depop called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -619,7 +619,7 @@ void QuestManager::depop(int npc_type) { void QuestManager::depop_withtimer(int npc_type) { QuestManagerCurrentQuestVars(); if (!owner || !owner->IsNPC()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::depop_withtimer called with nullptr owner or non-NPC owner. Probably syntax error in quest file."); return; } else { @@ -646,7 +646,7 @@ void QuestManager::depopall(int npc_type) { entity_list.DepopAll(npc_type); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::depopall called with nullptr owner, non-NPC owner, or invalid NPC Type ID. Probably syntax error in quest file."); } } @@ -655,7 +655,7 @@ void QuestManager::depopzone(bool StartSpawnTimer) { zone->Depop(StartSpawnTimer); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::depopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -664,7 +664,7 @@ void QuestManager::repopzone() { zone->Repop(); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); + Log.Out(Logs::General, Logs::Quests, "QuestManager::repopzone called with nullptr zone. Probably syntax error in quest file."); } } @@ -1652,7 +1652,7 @@ void QuestManager::showgrid(int grid) { "ORDER BY `number`", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Quests, "Error loading grid %d for showgrid(): %s", grid, results.ErrorMessage().c_str()); return; } @@ -2074,7 +2074,7 @@ bool QuestManager::istaskenabled(int taskid) { void QuestManager::tasksetselector(int tasksetid) { QuestManagerCurrentQuestVars(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid); if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager) initiator->TaskSetSelector(owner, tasksetid); } @@ -2641,7 +2641,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam std::string insert_query = StringFormat("INSERT INTO `saylink` (`phrase`) VALUES ('%s')", escaped_string); results = database.QueryDatabase(insert_query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } else { results = database.QueryDatabase(query); if (results.Success()) { @@ -2649,7 +2649,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam for(auto row = results.begin(); row != results.end(); ++row) sayid = atoi(row[0]); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in saylink phrase queries", results.ErrorMessage().c_str()); } } } @@ -2809,7 +2809,7 @@ void QuestManager::voicetell(const char *str, int macronum, int racenum, int gen safe_delete(outapp); } else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); + Log.Out(Logs::General, Logs::Quests, "QuestManager::voicetell from %s. Client %s not found.", owner->GetName(), str); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 804392ae1..bbb51a384 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -99,7 +99,7 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error inserting into raid members: %s", results.ErrorMessage().c_str()); } LearnMembers(); @@ -233,12 +233,12 @@ void Raid::SetRaidLeader(const char *wasLead, const char *name) std::string query = StringFormat("UPDATE raid_members SET israidleader = 0 WHERE name = '%s'", wasLead); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); query = StringFormat("UPDATE raid_members SET israidleader = 1 WHERE name = '%s'", name); results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Set Raid Leader error: %s\n", results.ErrorMessage().c_str()); strn0cpy(leadername, name, 64); @@ -271,7 +271,7 @@ void Raid::SaveGroupLeaderAA(uint32 gid) safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::SaveRaidLeaderAA() @@ -285,7 +285,7 @@ void Raid::SaveRaidLeaderAA() safe_delete_array(queryBuffer); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to store LeadershipAA: %s\n", results.ErrorMessage().c_str()); } void Raid::UpdateGroupAAs(uint32 gid) @@ -498,7 +498,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -799,7 +799,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); } } } @@ -1407,7 +1407,7 @@ void Raid::GetRaidDetails() return; if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting raid details for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); return; } @@ -1439,7 +1439,7 @@ bool Raid::LearnMembers() return false; if(results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting raid members for raid %lu: %s", (unsigned long)GetID(), results.ErrorMessage().c_str()); disbandCheck = true; return false; } @@ -1643,7 +1643,7 @@ void Raid::SetGroupMentor(uint32 group_id, int percent, char *name) name, percent, group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str()); } void Raid::ClearGroupMentor(uint32 group_id) @@ -1658,7 +1658,7 @@ void Raid::ClearGroupMentor(uint32 group_id) group_id, GetID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str()); } // there isn't a nice place to add this in another function, unlike groups diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 928414f2c..0f8b3330d 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -364,7 +364,7 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -392,12 +392,12 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } @@ -424,7 +424,7 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + Log.Out(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + Log.Out(Logs::Detail, Logs::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + Log.Out(Logs::Detail, Logs::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); + Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -674,7 +674,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -686,7 +686,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } @@ -699,7 +699,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + Log.Out(Logs::Detail, Logs::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -742,7 +742,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + Log.Out(Logs::Detail, Logs::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -764,7 +764,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } @@ -782,7 +782,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -794,7 +794,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in event.period = atoi(row[2]); if(event.period == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); + Log.Out(Logs::General, Logs::Error, "Refusing to load spawn event #%d because it has a period of 0\n", event.id); continue; } @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + Log.Out(Logs::Detail, Logs::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); + Log.Out(Logs::Detail, Logs::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); + Log.Out(Logs::Detail, Logs::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); + Log.Out(Logs::Detail, Logs::Spawns, "No spawn events enabled. Disabling next event."); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); + Log.Out(Logs::Detail, Logs::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + Log.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + Log.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + Log.Out(Logs::Detail, Logs::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + Log.Out(Logs::Detail, Logs::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); + Log.Out(Logs::Detail, Logs::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.Out(Logs::Detail, Logs::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + Log.Out(Logs::Detail, Logs::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index 577e5b998..bae4832c0 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -51,7 +51,7 @@ SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, floa uint32 SpawnGroup::GetNPCType() { #if EQDEBUG >= 10 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); + Log.Out(Logs::General, Logs::None, "SpawnGroup[%08x]::GetNPCType()", (uint32) this); #endif int npcType = 0; int totalchance = 0; @@ -167,7 +167,7 @@ bool ZoneDatabase::LoadSpawnGroups(const char* zone_name, uint16 version, SpawnG "AND zone = '%s'", zone_name); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query '%'", query.c_str()); return false; } @@ -195,7 +195,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "FROM spawngroup WHERE spawngroup.ID = '%i'", spawngroupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error2 in PopulateZoneLists query %s", query.c_str()); return false; } @@ -210,7 +210,7 @@ bool ZoneDatabase::LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_g "ORDER BY chance", spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error3 in PopulateZoneLists query '%s'", query.c_str()); return false; } diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 47ae29ec2..27734777f 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -464,7 +464,7 @@ int Mob::MonkSpecialAttack(Mob* other, uint8 unchecked_type) break; } default: - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Attack, "Invalid special attack type %d attempted", unchecked_type); + Log.Out(Logs::Detail, Logs::Attack, "Invalid special attack type %d attempted", unchecked_type); return(1000); /* nice long delay for them, the caller depends on this! */ } @@ -683,7 +683,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -695,12 +695,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const ItemInst* Ammo = m_inv[MainAmmo]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(MainRange)); return; } if (!Ammo || !Ammo->IsType(ItemClassCommon)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(MainAmmo), MainAmmo); Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(MainAmmo)); return; } @@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { const Item_Struct* AmmoItem = Ammo->GetItem(); if(RangeItem->ItemType != ItemTypeBow) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType); Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID()); return; } if(AmmoItem->ItemType != ItemTypeArrow) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType); Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, ItemTypeArrow); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); + Log.Out(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID); //look for ammo in inventory if we only have 1 left... if(Ammo->GetCharges() == 1) { @@ -746,7 +746,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { Ammo = baginst; ammo_slot = m_inv.CalcSlotId(r, i); found = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.Out(Logs::Detail, Logs::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); break; } } @@ -761,17 +761,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (aslot != INVALID_INDEX) { ammo_slot = aslot; Ammo = m_inv[aslot]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); + Log.Out(Logs::Detail, Logs::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges()); } } } float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.Out(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -799,9 +799,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { if (!ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){ DeleteItemInInventory(ammo_slot, 1, true); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Consumed one arrow from slot %d", ammo_slot); + Log.Out(Logs::Detail, Logs::Combat, "Consumed one arrow from slot %d", ammo_slot); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Endless Quiver prevented ammo consumption."); + Log.Out(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption."); } CheckIncreaseSkill(SkillArchery, GetTarget(), -15); @@ -873,7 +873,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillArchery); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillArchery, 0, RangeWeapon, Ammo, AmmoSlot, speed); @@ -882,7 +882,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillArchery); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack hit %s.", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName()); bool HeadShot = false; uint32 HeadShot_Dmg = TryHeadShot(other, SkillArchery); @@ -923,7 +923,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite MaxDmg += MaxDmg*bonusArcheryDamageModifier / 100; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); + Log.Out(Logs::Detail, Logs::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg, ADmg, MaxDmg); bool dobonus = false; if(GetClass() == RANGER && GetLevel() > 50){ @@ -944,7 +944,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite hate *= 2; MaxDmg = mod_archery_bonus_damage(MaxDmg, RangeWeapon); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); + Log.Out(Logs::Detail, Logs::Combat, "Ranger. Double damage success roll, doubling damage to %d", MaxDmg); Message_StringID(MT_CritMelee, BOW_DOUBLE_DAMAGE); } } @@ -1192,7 +1192,7 @@ void NPC::RangedAttack(Mob* other) //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; } @@ -1361,7 +1361,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //make sure the attack and ranged timers are up //if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); + Log.Out(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); // The server and client timers are not exact matches currently, so this would spam too often if enabled //Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime()); return; @@ -1371,19 +1371,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 const ItemInst* RangeWeapon = m_inv[MainRange]; if (!RangeWeapon || !RangeWeapon->IsType(ItemClassCommon)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(MainRange), MainRange); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(MainRange)); return; } const Item_Struct* item = RangeWeapon->GetItem(); if(item->ItemType != ItemTypeLargeThrowing && item->ItemType != ItemTypeSmallThrowing) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType); Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(MainRange)); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName()); if(RangeWeapon->GetCharges() == 1) { //first check ammo @@ -1392,7 +1392,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //more in the ammo slot, use it RangeWeapon = AmmoItem; ammo_slot = MainAmmo; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.Out(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } else { //look through our inventory for more int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal); @@ -1400,17 +1400,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 //the item wont change, but the instance does, not that it matters ammo_slot = aslot; RangeWeapon = m_inv[aslot]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); + Log.Out(Logs::Detail, Logs::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges()); } } } float range = item->Range + GetRangeDistTargetSizeMod(other); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Calculated bow range to be %.1f", range); + Log.Out(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range); range *= range; float dist = DistNoRoot(*other); if(dist > range) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); + Log.Out(Logs::Detail, Logs::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. return; } @@ -1489,7 +1489,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite SendItemAnimation(other, AmmoItem, SkillThrowing); if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Ranged attack missed %s.", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed); return; @@ -1497,7 +1497,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else other->Damage(this, 0, SPELL_UNKNOWN, SkillThrowing); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Throwing attack hit %s.", other->GetName()); + Log.Out(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName()); int16 WDmg = 0; @@ -1533,7 +1533,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite entity_list.MessageClose_StringID(this, false, 200, MT_CritMelee, ASSASSINATES, GetName()); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); + Log.Out(Logs::Detail, Logs::Combat, "Item DMG %d. Max Damage %d. Hit for damage %d", WDmg, MaxDmg, TotalDmg); if (!Assassinate_Dmg) other->AvoidDamage(this, TotalDmg, false); //CanRiposte=false - Can not riposte throw attacks. diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 1962ec416..b45f7da70 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -476,7 +476,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if(!target_zone) { #ifdef SPELL_EFFECT_SPAM - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell In Same Zone."); + Log.Out(Logs::General, Logs::None, "Succor/Evacuation Spell In Same Zone."); #endif if(IsClient()) CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), x, y, z, heading, 0, EvacToSafeCoords); @@ -485,7 +485,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { #ifdef SPELL_EFFECT_SPAM - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Succor/Evacuation Spell To Another Zone."); + Log.Out(Logs::General, Logs::None, "Succor/Evacuation Spell To Another Zone."); #endif if(IsClient()) CastToClient()->MovePC(target_zone, x, y, z, heading); @@ -711,7 +711,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) stun_resist += aabonuses.StunResist; if (stun_resist <= 0 || zone->random.Int(0,99) >= stun_resist) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stunned. We had %d percent resist chance.", stun_resist); + Log.Out(Logs::Detail, Logs::Combat, "Stunned. We had %d percent resist chance.", stun_resist); if (caster->IsClient()) effect_value += effect_value*caster->GetFocusEffect(focusFcStunTimeMod, spell_id)/100; @@ -721,7 +721,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsClient()) Message_StringID(MT_Stun, SHAKE_OFF_STUN); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); + Log.Out(Logs::Detail, Logs::Combat, "Stun Resisted. We had %d percent resist chance.", stun_resist); } } break; @@ -1649,7 +1649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, " corpse being rezzed using spell %i by %s", + Log.Out(Logs::Detail, Logs::Spells, " corpse being rezzed using spell %i by %s", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -1772,7 +1772,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) } else { Message_StringID(4, TARGET_NOT_FOUND); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); + Log.Out(Logs::General, Logs::Error, "%s attempted to cast spell id %u with spell effect SE_SummonCorpse, but could not cast target into a Client object.", GetCleanName(), spell_id); } } @@ -3065,7 +3065,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int mod = caster->GetInstrumentMod(spell_id); mod = ApplySpellEffectiveness(caster, spell_id, mod, true); effect_value = effect_value * mod / 10; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); + Log.Out(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", oval, mod, effect_value); } effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); @@ -3127,7 +3127,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + Log.Out(Logs::Detail, Logs::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3326,7 +3326,7 @@ snare has both of them negative, yet their range should work the same: result = ubase * (caster_level * (formula - 2000) + 1); } else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Unknown spell effect value forumula %d", formula); + Log.Out(Logs::General, Logs::None, "Unknown spell effect value forumula %d", formula); } } @@ -3351,7 +3351,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + Log.Out(Logs::Detail, Logs::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3383,18 +3383,18 @@ void Mob::BuffProcess() IsMezSpell(buffs[buffs_i].spellid) || IsBlindSpell(buffs[buffs_i].spellid)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.Out(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } } else if (buffs[buffs_i].ticsremaining < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + Log.Out(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + Log.Out(Logs::Detail, Logs::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if(IsClient() && !(CastToClient()->GetClientVersionBit() & BIT_SoFAndLater)) @@ -3759,7 +3759,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + Log.Out(Logs::Detail, Logs::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; @@ -4817,7 +4817,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo return 0; break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); + Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown limit spelltype %d", focus_spell.base[i]); } break; @@ -5156,7 +5156,7 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo //this spits up a lot of garbage when calculating spell focuses //since they have all kinds of extra effects on them. default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + Log.Out(Logs::General, Logs::Normal, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); #endif } diff --git a/zone/spells.cpp b/zone/spells.cpp index 570d6ea0e..ddee8f965 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -147,7 +147,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + Log.Out(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -166,7 +166,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) Message_StringID(13, SILENCED_STRING); @@ -204,7 +204,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, //cannot cast under divine aura if(DivineAura()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); InterruptSpell(173, 0x121, false); return(false); } @@ -234,7 +234,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + Log.Out(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); // fizzle 1/4 the mana away SetMana(GetMana() - use_mana); @@ -243,7 +243,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); + Log.Out(Logs::Detail, Logs::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -258,7 +258,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -270,7 +270,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } @@ -291,7 +291,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ if (CastToClient()->GetClientVersion() < EQClientSoF) { // They are attempting to cast a must equip clicky without having it equipped - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); + Log.Out(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); } else { @@ -349,7 +349,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + Log.Out(Logs::Detail, Logs::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", spell.name, spell_id, target_id, slot, cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -363,7 +363,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_type = type; SaveSpellLoc(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); + Log.Out(Logs::Detail, Logs::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, spell_x, spell_y, spell_z); // if this spell doesn't require a target, or if it's an optional target // and a target wasn't provided, then it's us; unless TGB is on and this @@ -375,7 +375,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -392,7 +392,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, // we checked for spells not requiring targets above if(target_id == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell Error: no target. spell=%d\n", GetName(), spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, SPELL_NEED_TAR); @@ -430,7 +430,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, { mana_cost = 0; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); + Log.Out(Logs::Detail, Logs::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", GetName(), spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case Message_StringID(13, INSUFFICIENT_MANA); @@ -451,7 +451,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot, casting_spell_resist_adjust = resist_adjust; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", spell_id, cast_time, orgcasttime, mana_cost); // cast time is 0, just finish it right now and be done with it @@ -517,7 +517,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -756,7 +756,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + Log.Out(Logs::Detail, Logs::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -816,7 +816,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d has been interrupted.", spellid); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d has been interrupted.", spellid); if(!spellid) return; @@ -893,7 +893,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? Message_StringID(13, SPELL_RECAST); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -907,7 +907,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { Message_StringID(13, SPELL_RECAST); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -916,7 +916,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(!IsValidSpell(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: invalid spell id", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -927,7 +927,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(delaytimer) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: recast too quickly", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: recast too quickly", spell_id); Message(13, "You are unable to focus."); InterruptSpell(); return; @@ -937,7 +937,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: already casting", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: already casting", spell_id); Message_StringID(13,ALREADY_CASTING); InterruptSpell(); return; @@ -952,7 +952,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF || spells[spell_id].recast_time != 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); + Log.Out(Logs::Detail, Logs::Spells, "Bard song %d not applying bard logic because duration or recast is wrong: dur=%d, recast=%d", spells[spell_id].buffduration, spells[spell_id].recast_time); } else { bardsong = spell_id; bardsong_slot = slot; @@ -962,7 +962,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, else bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1041,10 +1041,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); + Log.Out(Logs::Detail, Logs::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: interrupted.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: interrupted.", spell_id); InterruptSpell(); return; } @@ -1060,10 +1060,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, break; default: // some non-instrument component. Let it go, but record it in the log - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Something odd happened: Song %d required component %s", spell_id, component); + Log.Out(Logs::Detail, Logs::Spells, "Something odd happened: Song %d required component %s", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); + Log.Out(Logs::Detail, Logs::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component); if(c->GetGM()) c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1143,12 +1143,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, const Item_Struct *item = database.GetItem(component); if(item) { c->Message_StringID(13, MISSING_SPELL_COMP_ITEM, item->Name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1169,7 +1169,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if (component == -1) continue; component_count = spells[spell_id].component_counts[t_count]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component, component_count); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1234,7 +1234,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { Message_StringID(13, SPELL_RECAST); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); InterruptSpell(); return; } @@ -1253,15 +1253,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + Log.Out(Logs::Detail, Logs::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); Message(13, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1280,7 +1280,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); InterruptSpell(); return; } @@ -1309,7 +1309,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, this->CastToClient()->CheckSongSkillIncrease(spell_id); this->CastToClient()->MemorizeSpell(slot, spell_id, memSpellSpellbar); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard song %d should be started", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard song %d should be started", spell_id); } else { @@ -1344,7 +1344,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, delaytimer = true; spellend_timer.Start(400,true); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell casting of %d is finished.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell casting of %d is finished.", spell_id); } @@ -1391,7 +1391,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce && (IsGrouped() // still self only if not grouped || IsRaidGrouped()) && (HasProjectIllusion())){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); + Log.Out(Logs::Detail, Logs::AA, "Project Illusion overwrote target caster: %s spell id: %d was ON", GetName(), spell_id); targetType = ST_GroupClientAndPet; } @@ -1474,7 +1474,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, spell_target->GetBodyType()); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1487,7 +1487,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3)) { //invalid target - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, body_type); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1501,7 +1501,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (body_type != BT_Summoned && body_type != BT_Summoned2 && body_type != BT_Summoned3 && body_type != BT_Animal)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", spell_id, body_type); Message_StringID(13, SPELL_NEED_TAR); @@ -1526,7 +1526,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, spell_target->GetBodyType(), target_bt); if(!spell_target) Message_StringID(13,SPELL_NEED_TAR); else @@ -1544,7 +1544,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1552,14 +1552,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1568,7 +1568,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1580,7 +1580,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1596,7 +1596,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); Message_StringID(13,NO_PET); return false; // can't cast these unless we have a target } @@ -1666,7 +1666,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1703,7 +1703,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); Message_StringID(13,SPELL_NEED_TAR); return false; } @@ -1800,14 +1800,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); Message_StringID(13, TARGET_GROUP_MEMBER); return false; } @@ -1878,7 +1878,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + Log.Out(Logs::Detail, Logs::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -1957,7 +1957,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) return(false); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -1968,7 +1968,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 Mob *beacon_loc = spell_target ? spell_target : this; Beacon *beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -1977,7 +1977,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: cannot see target %s", spell_target->GetName()); Message_StringID(13,CANT_SEE_TARGET); return false; } @@ -2008,13 +2008,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); Message_StringID(13, TARGET_TOO_CLOSE); return(false); } @@ -2043,7 +2043,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 #endif //BOTS if(spell_target == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2067,11 +2067,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(IsPlayerIllusionSpell(spell_id) && IsClient() && (HasProjectIllusion())){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); + Log.Out(Logs::Detail, Logs::AA, "Effect Project Illusion for %s on spell id: %d was ON", GetName(), spell_id); SetProjectIllusion(false); } else{ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); + Log.Out(Logs::Detail, Logs::AA, "Effect Project Illusion for %s on spell id: %d was OFF", GetName(), spell_id); } break; } @@ -2235,7 +2235,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 // CastSpell already reduced the cost for it if we're a client with focus if(slot != USE_ITEM_SPELL_SLOT && slot != POTION_BELT_SPELL_SLOT && slot != TARGET_RING_SPELL_SLOT && mana_used > 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2247,7 +2247,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF) { CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2263,7 +2263,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if(reduction) recast -= reduction; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2301,7 +2301,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(slot == USE_ITEM_SPELL_SLOT) { //bard songs should never come from items... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); return(false); } @@ -2309,12 +2309,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2323,18 +2323,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Ran out of mana while singing song %d", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Ran out of mana while singing song %d", spell_id); return(false); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); Message_StringID(13, CANT_SEE_TARGET); return(false); } @@ -2349,7 +2349,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { float range2 = range * range; if(dist2 > range2) { //target is out of range. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); Message_StringID(13, TARGET_OUT_OF_RANGE); return(false); } @@ -2365,10 +2365,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case SingleTarget: { if(spell_target == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); return(false); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2386,7 +2386,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2394,9 +2394,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2406,13 +2406,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { case GroupSpell: { if(spell_target->IsGrouped()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2429,7 +2429,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2455,13 +2455,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + Log.Out(Logs::Detail, Logs::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2559,7 +2559,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2601,7 +2601,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", spell_id, castlevel, formula, duration, res); return(res); @@ -2673,7 +2673,7 @@ int CalcBuffDuration_formula(int level, int formula, int duration) return duration ? duration : 3600; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "CalcBuffDuration_formula: unknown formula %d", formula); + Log.Out(Logs::General, Logs::None, "CalcBuffDuration_formula: unknown formula %d", formula); return 0; } } @@ -2695,15 +2695,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); // Same Spells and dot exemption is set to 1 or spell is Manaburn if (spellid1 == spellid2) { if (sp1.dot_stacking_exempt == 1 && caster1 != caster2) { // same caster can refresh - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell due to dot stacking exemption."); + Log.Out(Logs::Detail, Logs::Spells, "Blocking spell due to dot stacking exemption."); return -1; } else if (spellid1 == 2751) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because manaburn does not stack with itself."); + Log.Out(Logs::Detail, Logs::Spells, "Blocking spell because manaburn does not stack with itself."); return -1; } } @@ -2735,7 +2735,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + Log.Out(Logs::Detail, Logs::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2804,16 +2804,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); + Log.Out(Logs::Detail, Logs::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2827,22 +2827,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because sp2_Value < blocked_below_value"); + Log.Out(Logs::Detail, Logs::Spells, "Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -2905,13 +2905,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + Log.Out(Logs::Detail, Logs::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Blocking spell because complete heal never stacks or overwries"); + Log.Out(Logs::Detail, Logs::Spells, "Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -2923,7 +2923,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(sp_det_mismatch) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The effects are the same but the spell types are not, passing the effect"); + Log.Out(Logs::Detail, Logs::Spells, "The effects are the same but the spell types are not, passing the effect"); continue; } @@ -2932,7 +2932,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "The spells are not the same and it is a detrimental dot, passing"); + Log.Out(Logs::Detail, Logs::Spells, "The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -2958,7 +2958,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + Log.Out(Logs::Detail, Logs::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -2967,7 +2967,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + Log.Out(Logs::Detail, Logs::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -2976,15 +2976,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", + Log.Out(Logs::Detail, Logs::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + Log.Out(Logs::Detail, Logs::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); return(1); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + Log.Out(Logs::Detail, Logs::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); return 0; } @@ -3043,11 +3043,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); return -2; // no duration? this isn't a buff } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + Log.Out(Logs::Detail, Logs::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3077,12 +3077,12 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + Log.Out(Logs::Detail, Logs::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + Log.Out(Logs::Detail, Logs::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite) @@ -3106,7 +3106,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + Log.Out(Logs::Detail, Logs::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3114,11 +3114,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); return -1; } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); return -1; } } @@ -3169,7 +3169,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + Log.Out(Logs::Detail, Logs::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3207,7 +3207,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) { int i, ret, firstfree = -2; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); + Log.Out(Logs::Detail, Logs::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); int buff_count = GetMaxTotalSlots(); for (i=0; i < buff_count; i++) @@ -3231,19 +3231,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) if(ret == 1) { // should overwrite current slot if(iFailIfOverwrite) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.Out(Logs::Detail, Logs::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return(-1); } if(firstfree == -2) firstfree = i; } if(ret == -1) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); + Log.Out(Logs::Detail, Logs::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); return -1; // stop the spell, can't stack it } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); + Log.Out(Logs::Detail, Logs::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); return firstfree; } @@ -3270,7 +3270,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Unable to apply spell %d without a target", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Unable to apply spell %d without a target", spell_id); Message(13, "SOT: You must have a target for this spell."); return false; } @@ -3298,7 +3298,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r uint16 caster_level = GetCasterLevel(spell_id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + Log.Out(Logs::Detail, Logs::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3378,7 +3378,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", + Log.Out(Logs::Detail, Logs::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3386,7 +3386,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + Log.Out(Logs::Detail, Logs::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3395,7 +3395,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3406,17 +3406,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3525,9 +3525,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.Out(Logs::Detail, Logs::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + Log.Out(Logs::Detail, Logs::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3537,7 +3537,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); spelltar->Message_StringID(MT_SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3551,7 +3551,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3644,7 +3644,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ Message_StringID(MT_SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3692,7 +3692,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, isproc); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount); if(aggro_amount > 0) spelltar->AddToHateList(this, aggro_amount); else{ int32 newhate = spelltar->GetHateAmount(this) + aggro_amount; @@ -3709,7 +3709,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_type != 1) // AA is handled differently Message_StringID(MT_SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3825,14 +3825,14 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); return true; } void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + Log.Out(Logs::Detail, Logs::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -4005,7 +4005,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4016,7 +4016,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Mez spells."); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to Mez spells."); caster->Message_StringID(MT_Shout, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4034,7 +4034,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.Out(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_MEZ_WITH_SPELL); return true; } @@ -4043,7 +4043,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Slow spells."); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to Slow spells."); caster->Message_StringID(MT_Shout, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4059,7 +4059,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Fear spells."); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to Fear spells."); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4070,13 +4070,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients cannot fear eachother!"); + Log.Out(Logs::Detail, Logs::Spells, "Clients cannot fear eachother!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); + Log.Out(Logs::Detail, Logs::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); caster->Message_StringID(MT_Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id); if (aggro > 0) { @@ -4090,7 +4090,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (IsClient() && CastToClient()->CheckAAEffect(aaEffectWarcry)) { Message(13, "Your are immune to fear."); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Clients has WarCry effect, immune to fear!"); + Log.Out(Logs::Detail, Logs::Spells, "Clients has WarCry effect, immune to fear!"); caster->Message_StringID(MT_Shout, IMMUNE_FEAR); return true; } @@ -4100,7 +4100,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Charm spells."); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to Charm spells."); caster->Message_StringID(MT_Shout, CANNOT_CHARM); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4113,7 +4113,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You are immune to your own charms."); + Log.Out(Logs::Detail, Logs::Spells, "You are immune to your own charms."); caster->Message(MT_Shout, "You cannot charm yourself."); return true; } @@ -4126,7 +4126,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + Log.Out(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); caster->Message_StringID(MT_Shout, CANNOT_CHARM_YET); return true; } @@ -4140,7 +4140,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to Snare spells."); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to Snare spells."); caster->Message_StringID(MT_Shout, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id); if(aggro > 0) { @@ -4156,7 +4156,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot lifetap yourself."); + Log.Out(Logs::Detail, Logs::Spells, "You cannot lifetap yourself."); caster->Message_StringID(MT_Shout, CANT_DRAIN_SELF); return true; } @@ -4166,13 +4166,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "You cannot sacrifice yourself."); + Log.Out(Logs::Detail, Logs::Spells, "You cannot sacrifice yourself."); caster->Message_StringID(MT_Shout, CANNOT_SAC_SELF); return true; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "No immunities to spell %d found.", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "No immunities to spell %d found.", spell_id); return false; } @@ -4209,7 +4209,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); + Log.Out(Logs::Detail, Logs::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); return(0); } @@ -4230,7 +4230,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + Log.Out(Logs::Detail, Logs::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); return 0; } } @@ -4248,7 +4248,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + Log.Out(Logs::Detail, Logs::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); return 0; } } @@ -4256,7 +4256,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell was unresistable"); + Log.Out(Logs::Detail, Logs::Spells, "Spell was unresistable"); return 100; } @@ -4822,7 +4822,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d memorized into slot %d", spell_id, slot); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d memorized into slot %d", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4837,7 +4837,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > MAX_PP_MEMSPELL || slot < 0) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -4870,7 +4870,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); if(update_client) { @@ -4883,7 +4883,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= MAX_PP_SPELLBOOK || slot < 0) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + Log.Out(Logs::Detail, Logs::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -4914,7 +4914,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + Log.Out(Logs::Detail, Logs::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -4963,7 +4963,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } @@ -4982,12 +4982,12 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { char_ID, spell_Global_Name.c_str()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); + Log.Out(Logs::General, Logs::Error, "Spell ID %i query of spell_globals with Name: '%s' Value: '%i' failed", spell_ID, spell_Global_Name.c_str(), spell_Global_Value); return false; } if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); + Log.Out(Logs::General, Logs::Error, "Char ID: %i does not have the Qglobal Name: '%s' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_ID); return false; } @@ -5001,7 +5001,7 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { return true; // Check if the qglobal value is greater than the require spellglobal value // If no matching result found in qglobals, don't scribe this spell - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); + Log.Out(Logs::General, Logs::Error, "Char ID: %i Spell_globals Name: '%s' Value: '%i' did not match QGlobal Value: '%i' for Spell ID %i", char_ID, spell_Global_Name.c_str(), spell_Global_Value, global_Value, spell_ID); return false; } @@ -5040,7 +5040,7 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) { spells[buffs[i].spellid].base[j], spells[buffs[i].spellid].max[j], buffs[i].casterlevel, buffs[i].spellid); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, + Log.Out(Logs::General, Logs::Normal, "FindType: type = %d; value = %d; threshold = %d", type, value, threshold); if (value < threshold) @@ -5089,23 +5089,23 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].spellID = spell_id; PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(Logs::Detail, Logs::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many perma procs for %s", GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Too many perma procs for %s", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { SpellProcs[i].spellID = spell_id; SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(Logs::Detail, Logs::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Too many procs for %s", GetName()); + Log.Out(Logs::Detail, Logs::Spells, "Too many procs for %s", GetName()); } return false; } @@ -5116,7 +5116,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].spellID = SPELL_UNKNOWN; SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed proc %d from slot %d", spell_id, i); + Log.Out(Logs::Detail, Logs::Spells, "Removed proc %d from slot %d", spell_id, i); } } return true; @@ -5133,7 +5133,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(Logs::Detail, Logs::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5148,7 +5148,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed defensive proc %d from slot %d", spell_id, i); + Log.Out(Logs::Detail, Logs::Spells, "Removed defensive proc %d from slot %d", spell_id, i); } } return true; @@ -5165,7 +5165,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + Log.Out(Logs::Detail, Logs::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); return true; } } @@ -5180,7 +5180,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Removed ranged proc %d from slot %d", spell_id, i); + Log.Out(Logs::Detail, Logs::Spells, "Removed ranged proc %d from slot %d", spell_id, i); } } return true; @@ -5211,7 +5211,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + Log.Out(Logs::Detail, Logs::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return(level); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 97000189b..47155d62f 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -74,7 +74,7 @@ bool TaskManager::LoadTaskSets() { MAXTASKSETS, MAXTASKS); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadTaskSets: %s", results.ErrorMessage().c_str()); return false; } @@ -83,7 +83,7 @@ bool TaskManager::LoadTaskSets() { int taskID = atoi(row[1]); TaskSets[taskSet].push_back(taskID); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Adding TaskID %4i to TaskSet %4i", taskID, taskSet); } return true; @@ -91,7 +91,7 @@ bool TaskManager::LoadTaskSets() { bool TaskManager::LoadSingleTask(int TaskID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadSingleTask(%i)", TaskID); if((TaskID <= 0) || (TaskID >= MAXTASKS)) return false; @@ -115,21 +115,21 @@ bool TaskManager::LoadSingleTask(int TaskID) { void TaskManager::ReloadGoalLists() { if(!GoalListManager.LoadLists()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed"); } bool TaskManager::LoadTasks(int singleTask) { // If TaskID !=0, then just load the task specified. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskManager::LoadTasks Called"); std::string query; if(singleTask == 0) { if(!GoalListManager.LoadLists()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadLists failed"); + Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadLists failed"); if(!LoadTaskSets()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); + Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::LoadTasks LoadTaskSets failed"); query = StringFormat("SELECT `id`, `duration`, `title`, `description`, `reward`, " "`rewardid`, `cashreward`, `xpreward`, `rewardmethod`, " @@ -146,7 +146,7 @@ bool TaskManager::LoadTasks(int singleTask) { auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -155,7 +155,7 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading tasks from database", taskID); continue; } @@ -179,11 +179,11 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->SequenceMode = ActivitiesSequential; Tasks[taskID]->LastStep = 0; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskID: %5i, Duration: %8i, StartZone: %3i Reward: %s MinLevel %i MaxLevel %i Repeatable: %s", taskID, Tasks[taskID]->Duration, Tasks[taskID]->StartZone, Tasks[taskID]->Reward, Tasks[taskID]->MinLevel, Tasks[taskID]->MaxLevel, Tasks[taskID]->Repeatable ? "Yes" : "No"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Title: %s", Tasks[taskID]->Title); } @@ -203,7 +203,7 @@ bool TaskManager::LoadTasks(int singleTask) { "ORDER BY taskid, activityid ASC", singleTask, MAXACTIVITIESPERTASK); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); return false; } @@ -215,13 +215,13 @@ bool TaskManager::LoadTasks(int singleTask) { if((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " + Log.Out(Logs::General, Logs::Error, "[TASKS]Task or Activity ID (%i, %i) out of range while loading " "activities from database", taskID, activityID); continue; } if(Tasks[taskID]==nullptr) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", taskID, activityID); continue; } @@ -238,7 +238,7 @@ bool TaskManager::LoadTasks(int singleTask) { // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if(activityID != Tasks[taskID]->ActivityCount) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, activityID); Tasks[taskID] = nullptr; continue; } @@ -273,7 +273,7 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID = atoi(row[11]); Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Optional = atoi(row[12]); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Activity Slot %2i: ID %i for Task %5i. Type: %3i, GoalID: %8i, " "GoalMethod: %i, GoalCount: %3i, ZoneID:%3i", Tasks[taskID]->ActivityCount, activityID, taskID, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Type, @@ -282,9 +282,9 @@ bool TaskManager::LoadTasks(int singleTask) { Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].GoalCount, Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].ZoneID); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text1: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text1); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text2: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text2); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Text3: %s", Tasks[taskID]->Activity[Tasks[taskID]->ActivityCount].Text3); Tasks[taskID]->ActivityCount++; } @@ -306,7 +306,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { int characterID = c->CharacterID(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); + Log.Out(Logs::Detail, Logs::Tasks,"TaskManager::SaveClientState for character ID %d", characterID); if(state->ActiveTaskCount > 0) { for(int task=0; taskActiveTasks[task].Updated) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState for character ID %d, Updating TaskIndex %i TaskID %i", characterID, task, taskID); std::string query = StringFormat("REPLACE INTO character_tasks (charid, taskid, slot, acceptedtime) " "VALUES (%i, %i, %i, %i)", characterID, taskID, task, state->ActiveTasks[task].AcceptedTime); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); else state->ActiveTasks[task].Updated = false; @@ -338,7 +338,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(!state->ActiveTasks[task].Activity[activityIndex].Updated) continue; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", + Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientSate for character ID %d, Updating Activity %i, %i", characterID, task, activityIndex); if(updatedActivityCount==0) @@ -358,11 +358,11 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { if(updatedActivityCount == 0) continue; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -383,7 +383,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { for(unsigned int i=state->LastCompletedTaskLoaded; iCompletedTasks.size(); i++) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTSAVE] TaskManager::SaveClientState Saving Completed Task at slot %i", i); int taskID = state->CompletedTasks[i].TaskID; if((taskID <= 0) || (taskID >= MAXTASKS) || (Tasks[taskID] == nullptr)) @@ -396,7 +396,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { std::string query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, -1); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); continue; } @@ -413,7 +413,7 @@ bool TaskManager::SaveClientState(Client *c, ClientTaskState *state) { query = StringFormat(completedTaskQuery, characterID, state->CompletedTasks[i].CompletedTime, taskID, j); results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, results.ErrorMessage().c_str()); } @@ -459,14 +459,14 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTaskCount = 0; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState for character ID %d", characterID); std::string query = StringFormat("SELECT `taskid`, `slot`, `acceptedtime` " "FROM `character_tasks` " "WHERE `charid` = %i ORDER BY acceptedtime", characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -475,17 +475,17 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int slot = atoi(row[1]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); continue; } if((slot<0) || (slot>=MAXACTIVETASKS)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); + Log.Out(Logs::General, Logs::Error, "[TASKS] Slot %i out of range while loading character tasks from database", slot); continue; } if(state->ActiveTasks[slot].TaskID != TASKSLOTEMPTY) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, taskID); continue; } @@ -501,11 +501,11 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { ++state->ActiveTaskCount; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, Accepted Time: %8X", characterID, taskID, acceptedtime); } // Load Activities - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState. Loading activities for character ID %d", characterID); query = StringFormat("SELECT `taskid`, `activityid`, `donecount`, `completed` " "FROM `character_activities` " @@ -513,20 +513,20 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "ORDER BY `taskid` ASC, `activityid` ASC", characterID); results = database.QueryDatabase(query); if (!results.Success()){ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", results.ErrorMessage().c_str()); return false; } for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if((taskID<0) || (taskID>=MAXTASKS)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if((activityID<0) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading character activities from database", activityID); continue; } @@ -540,7 +540,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { } if(activeTaskIndex == -1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); continue; } @@ -555,7 +555,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { state->ActiveTasks[activeTaskIndex].Activity[activityID].Updated = false; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] TaskManager::LoadClientState. Char: %i Task ID %i, ActivityID: %i, DoneCount: %i, Completed: %i", characterID, taskID, activityID, doneCount, completed); } @@ -566,7 +566,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", results.ErrorMessage().c_str()); return false; } @@ -582,7 +582,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { int taskID = atoi(row[0]); if((taskID <= 0) || (taskID >=MAXTASKS)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Task ID %i out of range while loading completed tasks from database", taskID); continue; } @@ -592,7 +592,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { // completed. int activityID = atoi(row[1]); if((activityID<-1) || (activityID>=MAXACTIVITIESPERTASK)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Activity ID %i out of range while loading completed tasks from database", activityID); continue; } @@ -634,12 +634,12 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", results.ErrorMessage().c_str()); else for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); state->EnabledTasks.push_back(taskID); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] Adding TaskID %i to enabled tasks", taskID); } // Check that there is an entry in the client task state for every activity in each task @@ -652,7 +652,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { c->Message(13, "Active Task Slot %i, references a task (%i), that does not exist. " "Removing from memory. Contact a GM to resolve this.",i, taskID); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); + Log.Out(Logs::General, Logs::Error, "[TASKS]Character %i has task %i which does not exist.", characterID, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; continue; @@ -664,7 +664,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " + Log.Out(Logs::General, Logs::Error, "[TASKS]Fatal error in character %i task state. Activity %i for " "Task %i either missing from client state or from task.", characterID, j, taskID); state->ActiveTasks[i].TaskID=TASKSLOTEMPTY; break; @@ -676,7 +676,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) { if(state->ActiveTasks[i].TaskID != TASKSLOTEMPTY) state->UnlockActivities(characterID, i); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); + Log.Out(Logs::General, Logs::Tasks, "[CLIENTLOAD] LoadClientState for Character ID %d DONE!", characterID); return true; } @@ -710,9 +710,9 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { } } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] New enabled task list "); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] New enabled task list "); for(unsigned int i=0; iGetLevel(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for taskset %i. EnableTaskSize is %i", TaskSetID, state->EnabledTasks.size()); if((TaskSetID<=0) || (TaskSetID>=MAXTASKSETS)) return; @@ -918,7 +918,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i if(TaskSets[TaskSetID][0] == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSets[%i][0] == 0. All Tasks in Set enabled.", TaskSetID); std::vector::iterator Iterator = TaskSets[TaskSetID].begin(); while((Iterator != TaskSets[TaskSetID].end()) && (TaskListIndex < MAXCHOOSERENTRIES)) { @@ -941,7 +941,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i while((EnabledTaskIndex < state->EnabledTasks.size()) && (TaskSetIndex < TaskSets[TaskSetID].size()) && (TaskListIndex < MAXCHOOSERENTRIES)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Comparing EnabledTasks[%i] (%i) with TaskSets[%i][%i] (%i)", EnabledTaskIndex, state->EnabledTasks[EnabledTaskIndex], TaskSetID, TaskSetIndex, TaskSets[TaskSetID][TaskSetIndex]); @@ -981,7 +981,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task return; } // Titanium OpCode: 0x5e7c - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); char *Ptr; int PlayerLevel = c->GetLevel(); @@ -1106,7 +1106,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskSelector for %i Tasks", TaskCount); int PlayerLevel = c->GetLevel(); @@ -1275,16 +1275,16 @@ int ClientTaskState::GetActiveTaskID(int index) { static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] DeleteCompletedTasksFromDatabase. CharID = %i, TaskID = %i", charID, taskID); const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Delete query %s", query.c_str()); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Delete query %s", query.c_str()); } bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { @@ -1298,7 +1298,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // On loading the client state, all activities that are not completed, are // marked as hidden. For Sequential (non-stepped) mode, we mark the first // activity as active if not complete. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CharID: %i Task: %i Sequence mode is %i", CharID, ActiveTasks[TaskIndex].TaskID, Task->SequenceMode); if(Task->SequenceMode == ActivitiesSequential) { @@ -1320,7 +1320,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { } if(AllActivitiesComplete && RuleB(TaskSystem, RecordCompletedTasks)) { if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1332,7 +1332,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1349,7 +1349,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { CompletedTasks.push_back(cti); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Returning sequential task, AllActivitiesComplete is %i", AllActivitiesComplete); return AllActivitiesComplete; } @@ -1358,7 +1358,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { bool CurrentStepComplete = true; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Current Step is %i, Last Step is %i", ActiveTasks[TaskIndex].CurrentStep, Task->LastStep); // If CurrentStep is -1, this is the first call to this method since loading the // client state. Unlock all activities with a step number of 0 if(ActiveTasks[TaskIndex].CurrentStep == -1) { @@ -1393,7 +1393,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { // If we are only keeping one completed record per task, and the player has done // the same task again, erase the previous completed entry for this task. if(RuleB(TasksSystem, KeepOneRecordPerCompletedTask)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] KeepOneRecord enabled"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] KeepOneRecord enabled"); std::vector::iterator Iterator = CompletedTasks.begin(); int ErasedElements = 0; while(Iterator != CompletedTasks.end()) { @@ -1405,7 +1405,7 @@ bool ClientTaskState::UnlockActivities(int CharID, int TaskIndex) { else ++Iterator; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Erased Element count is %i", ErasedElements); if(ErasedElements) { LastCompletedTaskLoaded -= ErasedElements; DeleteCompletedTaskFromDatabase(CharID, ActiveTasks[TaskIndex].TaskID); @@ -1455,7 +1455,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI int Ret = false; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasks for NPCTypeID: %d", NPCTypeID); // If the client has no tasks, there is nothing further to check. @@ -1477,7 +1477,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI if(Task->Activity[j].Type != ActivityType) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Task: %i, Activity %i, Activity type %i for NPC %i failed zone check", c->GetName(), ActiveTasks[i].TaskID, j, ActivityType, NPCTypeID); continue; } @@ -1498,7 +1498,7 @@ bool ClientTaskState::UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeI continue; } // We found an active task to kill this type of NPC, so increment the done count - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ByNPC"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ByNPC"); IncrementDoneCount(c, Task, i, j); Ret = true; } @@ -1577,7 +1577,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI // If the client has no tasks, there is nothing further to check. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForItem(%d,%d)", Type, ItemID); if(ActiveTaskCount == 0) return; @@ -1597,7 +1597,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI if(Task->Activity[j].Type != (int)Type) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Activity type %i for Item %i failed zone check", c->GetName(), Type, ItemID); continue; } @@ -1618,7 +1618,7 @@ void ClientTaskState::UpdateTasksForItem(Client *c, ActivityType Type, int ItemI continue; } // We found an active task related to this item, so increment the done count - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Calling increment done count ForItem"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Calling increment done count ForItem"); IncrementDoneCount(c, Task, i, j, Count); } } @@ -1630,7 +1630,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { // If the client has no tasks, there is nothing further to check. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnExplore(%i)", ExploreID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityExplore) continue; if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Explore exploreid %i failed zone check", c->GetName(), ExploreID); continue; } @@ -1670,7 +1670,7 @@ void ClientTaskState::UpdateTasksOnExplore(Client *c, int ExploreID) { } // We found an active task to explore this area, so set done count to goal count // (Only a goal count of 1 makes sense for explore activities?) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on explore"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on explore"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); @@ -1684,7 +1684,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i bool Ret = false; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksForOnDeliver(%d)", NPCTypeID); if(ActiveTaskCount == 0) return false; @@ -1705,7 +1705,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i (Task->Activity[j].Type != ActivityGiveCash)) continue; // Is there a zone restriction on the activity ? if((Task->Activity[j].ZoneID >0) && (Task->Activity[j].ZoneID != (int)zone->GetZoneID())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Deliver activity failed zone check (current zone %i, need zone %i", c->GetName(), zone->GetZoneID(), Task->Activity[j].ZoneID); continue; } @@ -1714,7 +1714,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i // Is the activity related to these items ? // if((Task->Activity[j].Type == ActivityGiveCash) && Cash) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveCash"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveCash"); IncrementDoneCount(c, Task, i, j, Cash); Ret = true; } @@ -1738,7 +1738,7 @@ bool ClientTaskState::UpdateTasksOnDeliver(Client *c, uint32 *Items, int Cash, i continue; } // We found an active task related to this item, so increment the done count - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on GiveItem"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on GiveItem"); IncrementDoneCount(c, Task, i, j, 1); Ret = true; } @@ -1753,7 +1753,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { // If the client has no tasks, there is nothing further to check. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState::UpdateTasksOnTouch(%i)", ZoneID); if(ActiveTaskCount == 0) return; for(int i=0; iActivity[j].Type != ActivityTouch) continue; if(Task->Activity[j].GoalMethod != METHODSINGLEID) continue; if(Task->Activity[j].ZoneID != ZoneID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Char: %s Touch activity failed zone check", c->GetName()); continue; } // We found an active task to zone into this zone, so set done count to goal count // (Only a goal count of 1 makes sense for touch activities?) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment on Touch"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment on Touch"); IncrementDoneCount(c, Task, i, j, Task->Activity[j].GoalCount - ActiveTasks[i].Activity[j].DoneCount); } @@ -1788,7 +1788,7 @@ void ClientTaskState::UpdateTasksOnTouch(Client *c, int ZoneID) { } void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int TaskIndex, int ActivityID, int Count, bool ignore_quest_update) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] IncrementDoneCount"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] IncrementDoneCount"); ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount += Count; @@ -1805,7 +1805,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].Updated=true; // Have we reached the goal count for this activity ? if(ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount >= Task->Activity[ActivityID].GoalCount) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Done (%i) = Goal (%i) for Activity %i", ActiveTasks[TaskIndex].Activity[ActivityID].DoneCount, Task->Activity[ActivityID].GoalCount, ActivityID); @@ -1814,7 +1814,7 @@ void ClientTaskState::IncrementDoneCount(Client *c, TaskInformation* Task, int T ActiveTasks[TaskIndex].Activity[ActivityID].State = ActivityCompleted; // Unlock subsequent activities for this task bool TaskComplete = UnlockActivities(c->CharacterID(), TaskIndex); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskCompleted is %i", TaskComplete); // and by the 'Task Stage Completed' message c->SendTaskActivityComplete(ActiveTasks[TaskIndex].TaskID, ActivityID, TaskIndex); // Send the updated task/activity list to the client @@ -1991,7 +1991,7 @@ bool ClientTaskState::IsTaskActive(int TaskID) { void ClientTaskState::FailTask(Client *c, int TaskID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] FailTask %i, ActiveTaskCount is %i", TaskID, ActiveTaskCount); if(ActiveTaskCount == 0) return; for(int i=0; i= Task->ActivityCount) return false; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState IsTaskActivityActive(%i, %i). State is %i ", TaskID, ActivityID, ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State); @@ -2045,7 +2045,7 @@ bool ClientTaskState::IsTaskActivityActive(int TaskID, int ActivityID) { void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, int Count, bool ignore_quest_update /*= false*/) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, %i).", TaskID, ActivityID, Count); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2072,14 +2072,14 @@ void ClientTaskState::UpdateTaskActivity(Client *c, int TaskID, int ActivityID, // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Increment done count on UpdateTaskActivity"); IncrementDoneCount(c, Task, ActiveTaskIndex, ActivityID, Count, ignore_quest_update); } void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState UpdateTaskActivity(%i, %i, 0).", TaskID, ActivityID); // Quick sanity check if((ActivityID<0) || (ActiveTaskCount==0)) return; @@ -2107,7 +2107,7 @@ void ClientTaskState::ResetTaskActivity(Client *c, int TaskID, int ActivityID) { // The Activity is not currently active if(ActiveTasks[ActiveTaskIndex].Activity[ActivityID].State != ActivityActive) return; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ResetTaskActivityCount"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ResetTaskActivityCount"); ActiveTasks[ActiveTaskIndex].Activity[ActivityID].DoneCount = 0; @@ -2173,7 +2173,7 @@ int ClientTaskState::IsTaskCompleted(int TaskID) { if(!(RuleB(TaskSystem, RecordCompletedTasks))) return -1; for(unsigned int i=0; iunknown04 = 0x00000002; - Log.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Tasks, "SendTasksComplete"); + Log.LogDebugType(Logs::Detail, Logs::Tasks, "SendTasksComplete"); DumpPacket(outapp); fflush(stdout); QueuePacket(outapp); @@ -2275,7 +2275,7 @@ void Client::SendTaskComplete(int TaskIndex) { void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Task History Requested for Completed Task Index %i", TaskIndex); // We only sent the most recent 50 completed tasks, so we need to offset the Index the client sent to us. @@ -2406,7 +2406,7 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) { //tac->unknown5 = 0x00000001; tac->unknown5 = 0; // 0 for task complete or failed. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskFailed"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskFailed"); _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); @@ -2428,7 +2428,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) if(State->CompletedTasks.size() > 50) FirstTaskToSend = State->CompletedTasks.size() - 50; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Completed Task Count: %i, First Task to send is %i, Last is %i", State->CompletedTasks.size(), FirstTaskToSend, LastTaskToSend); /* for(iterator=State->CompletedTasks.begin(); iterator!=State->CompletedTasks.end(); iterator++) { @@ -2689,12 +2689,12 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, false); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] SendActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, @@ -2704,7 +2704,7 @@ void TaskManager::SendActiveTasksToClient(Client *c, bool TaskComplete) { Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2725,13 +2725,13 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta int StartTime = c->GetTaskStartTime(TaskIndex); SendActiveTaskDescription(c, TaskID, TaskIndex, StartTime, Tasks[TaskID]->Duration, BringUpTaskJournal); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] SendSingleActiveTasksToClient: Task %i, Activities: %i", TaskID, GetActivityCount(TaskID)); int Sequence = 0; for(int Activity=0; ActivityGetTaskActivityState(TaskIndex, Activity) != ActivityHidden) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Long: %i, %i, %i Complete=%i", TaskID, Activity, TaskIndex, TaskComplete); if(Activity==GetActivityCount(TaskID)-1) SendTaskActivityLong(c, TaskID, Activity, TaskIndex, Tasks[TaskID]->Activity[Activity].Optional, TaskComplete); @@ -2740,7 +2740,7 @@ void TaskManager::SendSingleActiveTaskToClient(Client *c, int TaskIndex, bool Ta Tasks[TaskID]->Activity[Activity].Optional, 0); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Short: %i, %i, %i", TaskID, Activity, TaskIndex); SendTaskActivityShort(c, TaskID, Activity, TaskIndex); } Sequence++; @@ -2919,7 +2919,7 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->SequenceNumber = SequenceNumber; cts->unknown4 = 0x00000002; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask"); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask"); _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); @@ -2932,24 +2932,24 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD void ClientTaskState::RemoveTask(Client *c, int sequenceNumber) { int characterID = c->CharacterID(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] ClientTaskState Cancel Task %i ", sequenceNumber); std::string query = StringFormat("DELETE FROM character_activities WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); return; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); query = StringFormat("DELETE FROM character_tasks WHERE charid=%i AND taskid = %i", characterID, ActiveTasks[sequenceNumber].TaskID); results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", results.ErrorMessage().c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); ActiveTasks[sequenceNumber].TaskID = TASKSLOTEMPTY; ActiveTaskCount--; @@ -2990,7 +2990,7 @@ void ClientTaskState::AcceptNewTask(Client *c, int TaskID, int NPCID) { // int FreeSlot = -1; for(int i=0; iProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } @@ -3073,7 +3073,7 @@ TaskGoalListManager::~TaskGoalListManager() { bool TaskGoalListManager::LoadLists() { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskGoalListManager::LoadLists Called"); for(int i=0; i< NumberOfLists; i++) safe_delete_array(TaskGoalLists[i].GoalItemEntries); @@ -3088,12 +3088,12 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } NumberOfLists = results.RowCount(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Database returned a count of %i lists", NumberOfLists); TaskGoalLists = new TaskGoalList_Struct[NumberOfLists]; @@ -3122,7 +3122,7 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } @@ -3207,7 +3207,7 @@ std::vector TaskGoalListManager::GetListContents(int ListID) { bool TaskGoalListManager::IsInList(int ListID, int Entry) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i)", ListID, Entry); int ListIndex = GetListByID(ListID); @@ -3227,7 +3227,7 @@ bool TaskGoalListManager::IsInList(int ListID, int Entry) { else if(Entry < TaskGoalLists[ListIndex].GoalItemEntries[MiddleEntry]) LastEntry = MiddleEntry - 1; else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); + Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskGoalListManager::IsInList(%i, %i) returning true", ListIndex, Entry); return true; } @@ -3250,7 +3250,7 @@ TaskProximityManager::~TaskProximityManager() { bool TaskProximityManager::LoadProximities(int zoneID) { TaskProximity proximity; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] TaskProximityManager::LoadProximities Called for zone %i", zoneID); TaskProximities.clear(); std::string query = StringFormat("SELECT `exploreid`, `minx`, `maxx`, " @@ -3259,7 +3259,7 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -3285,7 +3285,7 @@ int TaskProximityManager::CheckProximities(float X, float Y, float Z) { TaskProximity* P = &TaskProximities[i]; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", + Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking %8.3f, %8.3f, %8.3f against %8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f", X, Y, Z, P->MinX, P->MaxX, P->MinY, P->MaxY, P->MinZ, P->MaxZ); if(X < P->MinX || X > P->MaxX || Y < P->MinY || Y > P->MaxY || diff --git a/zone/titles.cpp b/zone/titles.cpp index e6a268607..0f2e59368 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,7 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -263,7 +263,7 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -296,7 +296,7 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -351,7 +351,7 @@ void Client::EnableTitle(int titleSet) { CharacterID(), titleSet); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); + Log.Out(Logs::General, Logs::Error, "Error in EnableTitle query for titleset %i and charid %i", titleSet, CharacterID()); } @@ -362,7 +362,7 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -382,7 +382,7 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 946d595fc..d923af5c6 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -42,7 +42,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme { if (!user || !in_augment) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); + Log.Out(Logs::General, Logs::Error, "Client or AugmentItem_Struct not set in Object::HandleAugmentation"); return; } @@ -89,7 +89,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme if(!container) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Player tried to augment an item without a container set."); + Log.Out(Logs::General, Logs::Error, "Player tried to augment an item without a container set."); user->Message(13, "Error: This item is not a container!"); return; } @@ -243,7 +243,7 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Object *worldo) { if (!user || !in_combine) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); + Log.Out(Logs::General, Logs::Error, "Client or NewCombine_Struct not set in Object::HandleCombine"); return; } @@ -418,7 +418,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob if(success && spec.replace_container) { if(worldcontainer){ //should report this error, but we dont have the recipe ID, so its not very useful - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Replace container combine executed in a world container."); + Log.Out(Logs::General, Logs::Error, "Replace container combine executed in a world container."); } else user->DeleteItemInInventory(in_combine->container_slot, 0, true); @@ -444,7 +444,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac //ask the database for the recipe to make sure it exists... DBTradeskillRecipe_Struct spec; if (!database.GetTradeRecipe(rac->recipe_id, rac->object_type, rac->some_id, user->CharacterID(), &spec)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); + Log.Out(Logs::General, Logs::Error, "Unknown recipe for HandleAutoCombine: %u\n", rac->recipe_id); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -467,21 +467,21 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() < 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: no components returned"); + Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine: no components returned"); user->QueuePacket(outapp); safe_delete(outapp); return; } if(results.RowCount() > 10) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); + Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine: too many components returned (%u)", results.RowCount()); user->QueuePacket(outapp); safe_delete(outapp); return; @@ -676,7 +676,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -684,7 +684,7 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt return; //search gave no results... not an error if(results.ColumnCount() != 6) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query.c_str()); return; } @@ -730,17 +730,17 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if(results.RowCount() < 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: no components returned"); + Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails: no components returned"); return; } if(results.RowCount() > 10) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); + Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails: too many components returned (%u)", results.RowCount()); return; } @@ -901,7 +901,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...This combine cannot fail."); + Log.Out(Logs::Detail, Logs::Tradeskills, "...This combine cannot fail."); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -921,8 +921,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + Log.Out(Logs::Detail, Logs::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); + Log.Out(Logs::Detail, Logs::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -1066,7 +1066,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(4, TRADESKILL_SUCCEED, spec->name.c_str()); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill success"); + Log.Out(Logs::Detail, Logs::Tradeskills, "Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1098,7 +1098,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { Message_StringID(MT_Emote,TRADESKILL_FAILED); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "Tradeskill failed"); + Log.Out(Logs::Detail, Logs::Tradeskills, "Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this,true,MT_Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1177,9 +1177,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + Log.Out(Logs::Detail, Logs::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); + Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); + Log.Out(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, @@ -1232,8 +1232,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 buf2.c_str(), containers.c_str(), count, sum); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe search, query: %s", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe search, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1254,7 +1254,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 //length limit on buf2 if(index == 214) { //Maximum number of recipe matches (19 * 215 = 4096) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); + Log.Out(Logs::General, Logs::Error, "GetTradeRecipe warning: Too many matches. Unable to search all recipe entries. Searched %u of %u possible entries.", index + 1, results.RowCount()); break; } } @@ -1266,8 +1266,8 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND sum(tre.item_id * tre.componentcount) = %u", buf2.c_str(), count, sum); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } } @@ -1292,18 +1292,18 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 "AND tre.item_id = %u;", buf2.c_str(), containerId); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, re-query: %s", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } if(results.RowCount() == 0) { //Recipe contents matched more than 1 recipe, but not in this container - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Incorrect container is being used!"); + Log.Out(Logs::General, Logs::Error, "Combine error: Incorrect container is being used!"); return false; } if (results.RowCount() > 1) //Recipe contents matched more than 1 recipe in this container - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); + Log.Out(Logs::General, Logs::Error, "Combine error: Recipe is not unique! %u matches found for container %u. Continuing with first recipe match.", results.RowCount(), containerId); } @@ -1320,7 +1320,7 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } @@ -1375,8 +1375,8 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id char_id, (unsigned long)recipe_id, containers.c_str()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, query: %s", query.c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecipe, error: %s", results.ErrorMessage().c_str()); return false; } @@ -1407,12 +1407,12 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } if(results.RowCount() < 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetTradeRecept success: no success items returned"); + Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecept success: no success items returned"); return false; } @@ -1464,7 +1464,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) @@ -1477,12 +1477,12 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } if (results.RowCount() != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); + Log.Out(Logs::General, Logs::Normal, "Client::LearnRecipe - RecipeID: %d had %d occurences.", recipeID, results.RowCount()); return; } @@ -1503,7 +1503,7 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1553,7 +1553,7 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } @@ -1564,7 +1564,7 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } diff --git a/zone/trading.cpp b/zone/trading.cpp index c7e370ade..d87483199 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -86,7 +86,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { if (!owner || !owner->IsClient()) { // This should never happen - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Programming error: NPC's should not call Trade::AddEntity()"); + Log.Out(Logs::General, Logs::None, "Programming error: NPC's should not call Trade::AddEntity()"); return; } @@ -126,7 +126,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { inst2->SetCharges(stack_size + inst2->GetCharges()); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); + Log.Out(Logs::Detail, Logs::Trading, "%s added partial item '%s' stack (qty: %i) to trade slot %i", owner->GetName(), inst->GetItem()->Name, stack_size, trade_slot_id); if (_stack_size > 0) inst->SetCharges(_stack_size); @@ -143,7 +143,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) { SendItemData(inst, trade_slot_id); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); + Log.Out(Logs::Detail, Logs::Trading, "%s added item '%s' to trade slot %i", owner->GetName(), inst->GetItem()->Name, trade_slot_id); client->PutItemInInventory(trade_slot_id, *inst); client->DeleteItemInInventory(MainCursor); @@ -296,7 +296,7 @@ void Trade::LogTrade() void Trade::DumpTrade() { Mob* with = With(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Dumping trade data: '%s' in TradeState %i with '%s'", + Log.Out(Logs::General, Logs::None, "Dumping trade data: '%s' in TradeState %i with '%s'", this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName())); if (!owner->IsClient()) @@ -307,7 +307,7 @@ void Trade::DumpTrade() const ItemInst* inst = trader->GetInv().GetItem(i); if (inst) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", + Log.Out(Logs::General, Logs::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)", inst->GetItem()->ID, inst->GetCharges(), i, ((inst->IsType(ItemClassContainer)) ? "True" : "False")); @@ -315,7 +315,7 @@ void Trade::DumpTrade() for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) { inst = trader->GetInv().GetItem(i, j); if (inst) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "\tBagItem %i (Charges=%i, Slot=%i)", + Log.Out(Logs::General, Logs::None, "\tBagItem %i (Charges=%i, Slot=%i)", inst->GetItem()->ID, inst->GetCharges(), Inventory::CalcSlotId(i, j)); } @@ -324,7 +324,7 @@ void Trade::DumpTrade() } } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); + Log.Out(Logs::General, Logs::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp); } #endif @@ -368,7 +368,7 @@ void Client::ResetTrade() { break; if (partial_inst->GetID() != inst->GetID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -458,7 +458,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool qs_log = false; if(other) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Finishing trade with client %s", other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Finishing trade with client %s", other->GetName()); this->AddMoneyToPP(other->trade->cp, other->trade->sp, other->trade->gp, other->trade->pp, true); @@ -491,7 +491,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst && inst->IsType(ItemClassContainer)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Giving container %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -499,7 +499,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "Container %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -552,17 +552,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Transfer of container %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "%s's inventory is full, returning container %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "Container %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st break; if (partial_inst->GetID() != inst->GetID()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()"); break; } @@ -606,10 +606,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st inst->SetCharges(0); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Transferring partial stack %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); if (other->PutItemInInventory(partial_slot, *partial_inst, true)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", + Log.Out(Logs::Detail, Logs::Trading, "Partial stack %s (%d) successfully transferred, deleting %i charges from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, (old_charges - inst->GetCharges())); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -635,7 +635,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", + Log.Out(Logs::Detail, Logs::Trading, "Transfer of partial stack %s (%d) to %s failed, returning %i charges to trade slot.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName(), (old_charges - inst->GetCharges())); inst->SetCharges(old_charges); @@ -710,7 +710,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st const ItemInst* inst = m_inv[trade_slot]; if (inst) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Giving item %s (%d) in slot %d to %s", inst->GetItem()->Name, inst->GetItem()->ID, trade_slot, other->GetName()); // TODO: need to check bag items/augments for no drop..everything for attuned... if (inst->GetItem()->NoDrop != 0 || Admin() >= RuleI(Character, MinStatusForNoDropExemptions) || RuleI(World, FVNoDropFlag) == 1 || other == this) { @@ -718,7 +718,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st if (free_slot != INVALID_INDEX) { if (other->PutItemInInventory(free_slot, *inst, true)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "Item %s (%d) successfully transferred, deleting from trade slot.", inst->GetItem()->Name, inst->GetItem()->ID); if (qs_log) { QSTradeItems_Struct* detail = new QSTradeItems_Struct; @@ -772,17 +772,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Transfer of Item %s (%d) to %s failed, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID, other->GetName()); PushItemOnCursor(*inst, true); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "%s's inventory is full, returning item %s (%d) to giver.", other->GetName(), inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); + Log.Out(Logs::Detail, Logs::Trading, "Item %s (%d) is NoDrop, returning to giver.", inst->GetItem()->Name, inst->GetItem()->ID); PushItemOnCursor(*inst, true); } @@ -1160,7 +1160,7 @@ void Client::SendTraderItem(uint32 ItemID, uint16 Quantity) { const Item_Struct* item = database.GetItem(ItemID); if(!item){ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); + Log.Out(Logs::Detail, Logs::Trading, "Bogus item deleted in Client::SendTraderItem!\n"); return; } @@ -1219,10 +1219,10 @@ void Client::BulkSendTraderInventory(uint32 char_id) { safe_delete(inst); } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); + Log.Out(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr inst pointer"); } else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); + Log.Out(Logs::Detail, Logs::Trading, "Client::BulkSendTraderInventory nullptr item pointer or item is NODROP %8X",item); } safe_delete(TraderItems); } @@ -1245,7 +1245,7 @@ ItemInst* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ } } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); + Log.Out(Logs::Detail, Logs::Trading, "Client::FindTraderItemBySerialNumber Couldn't find item! Serial No. was %i", SerialNumber); return nullptr; } @@ -1302,7 +1302,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ } } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", + Log.Out(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n", SerialNumber , Quantity, this->GetName()); return 0; @@ -1311,7 +1311,7 @@ uint16 Client::FindTraderItem(int32 SerialNumber, uint16 Quantity){ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Customer,uint16 TraderSlot, int SerialNumber) { if(!Customer) return; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); + Log.Out(Logs::Detail, Logs::Trading, "NukeTraderItem(Slot %i, Charges %i, Quantity %i", Slot, Charges, Quantity); if(Quantity < Charges) { Customer->SendSingleTraderItem(this->CharacterID(), SerialNumber); m_inv.DeleteItem(Slot, Quantity); @@ -1395,7 +1395,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* if(!Stackable) Quantity = (Charges > 0) ? Charges : 1; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); + Log.Out(Logs::Detail, Logs::Trading, "FindAndNuke %s, Charges %i, Quantity %i", item->GetItem()->Name, Charges, Quantity); } if(item && (Charges <= Quantity || (Charges <= 0 && Quantity==1) || !Stackable)){ this->DeleteItemInInventory(SlotID, Quantity); @@ -1431,7 +1431,7 @@ void Client::FindAndNukeTraderItem(int32 SerialNumber, uint16 Quantity, Client* } } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, + Log.Out(Logs::Detail, Logs::Trading, "Could NOT find a match for Item: %i with a quantity of: %i on Trader: %s\n",SerialNumber, Quantity,this->GetName()); } @@ -1486,7 +1486,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -1510,13 +1510,13 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat const ItemInst* BuyItem = Trader->FindTraderItemBySerialNumber(tbs->ItemID); if(!BuyItem) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item on trader."); + Log.Out(Logs::Detail, Logs::Trading, "Unable to find item on trader."); TradeRequestFailed(app); safe_delete(outapp); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", + Log.Out(Logs::Detail, Logs::Trading, "Buyitem: Name: %s, IsStackable: %i, Requested Quantity: %i, Charges on Item %i", BuyItem->GetItem()->Name, BuyItem->IsStackable(), tbs->Quantity, BuyItem->GetCharges()); // If the item is not stackable, then we can only be buying one of them. if(!BuyItem->IsStackable()) @@ -1534,12 +1534,12 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat outtbs->Quantity = tbs->Quantity; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); + Log.Out(Logs::Detail, Logs::Trading, "Actual quantity that will be traded is %i", outtbs->Quantity); if((tbs->Price * outtbs->Quantity) <= 0) { Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(13, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Bazaar: Zero price transaction between %s and %s aborted." + Log.Out(Logs::General, Logs::Error, "Bazaar: Zero price transaction between %s and %s aborted." "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); @@ -1836,11 +1836,11 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "SRCH: %s", query.c_str()); + Log.Out(Logs::Detail, Logs::Trading, "SRCH: %s", query.c_str()); int Size = 0; uint32 ID = 0; @@ -1887,7 +1887,7 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint VARSTRUCT_ENCODE_TYPE(uint32, bufptr, ID); } else{ - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find trader: %i\n",atoi(row[1])); + Log.Out(Logs::Detail, Logs::Trading, "Unable to find trader: %i\n",atoi(row[1])); VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0); } Cost = atoi(row[5]); @@ -1981,7 +1981,7 @@ static void UpdateTraderCustomerItemsAdded(uint32 CustomerID, TraderCharges_Stru if(inst->IsStackable()) inst->SetMerchantCount(gis->Charges[i]); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.Out(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor? @@ -2018,7 +2018,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St if(gis->ItemID[i] == ItemID) { tdis->ItemID = gis->SerialNumber[i]; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Telling customer to remove item %i with %i charges and S/N %i", + Log.Out(Logs::Detail, Logs::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); _pkt(TRADING__PACKETS, outapp); @@ -2031,7 +2031,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St return; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price updates to customer %s", Customer->GetName()); + Log.Out(Logs::Detail, Logs::Trading, "Sending price updates to customer %s", Customer->GetName()); ItemInst* inst = database.CreateItem(item); @@ -2057,7 +2057,7 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St inst->SetMerchantSlot(gis->SerialNumber[i]); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Sending price update for %s, Serial No. %i with %i charges", + Log.Out(Logs::Detail, Logs::Trading, "Sending price update for %s, Serial No. %i with %i charges", item->Name, gis->SerialNumber[i], gis->Charges[i]); Customer->SendItemPacket(30, inst, ItemPacketMerchant); // MainCursor?? @@ -2073,7 +2073,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { // TraderPriceUpdate_Struct* tpus = (TraderPriceUpdate_Struct*)app->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", + Log.Out(Logs::Detail, Logs::Trading, "Received Price Update for %s, Item Serial No. %i, New Price %i", GetName(), tpus->SerialNumber, tpus->NewPrice); // Pull the items this Trader currently has for sale from the trader table. @@ -2081,7 +2081,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { TraderCharges_Struct* gis = database.LoadTraderItemWithCharges(CharacterID()); if(!gis) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Error retrieving Trader items details to update price."); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Error retrieving Trader items details to update price."); return; } @@ -2101,7 +2101,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((gis->ItemID[i] > 0) && (gis->SerialNumber[i] == tpus->SerialNumber)) { // We found the item that the Trader wants to change the price of (or add back up for sale). // - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); + Log.Out(Logs::Detail, Logs::Trading, "ItemID is %i, Charges is %i", gis->ItemID[i], gis->Charges[i]); IDOfItemToUpdate = gis->ItemID[i]; @@ -2127,7 +2127,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { return ; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to find item to update price for. Rechecking trader satchels"); + Log.Out(Logs::Detail, Logs::Trading, "Unable to find item to update price for. Rechecking trader satchels"); // Find what is in their Trader Satchels GetItems_Struct* newgis=GetTraderItems(); @@ -2140,7 +2140,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if((newgis->Items[i] > 0) && (newgis->SerialNumber[i] == tpus->SerialNumber)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], + Log.Out(Logs::Detail, Logs::Trading, "Found new Item to Add, ItemID is %i, Charges is %i", newgis->Items[i], newgis->Charges[i]); IDOfItemToAdd = newgis->Items[i]; @@ -2158,7 +2158,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { if(!IDOfItemToAdd || !item) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Item not found in Trader Satchels either."); + Log.Out(Logs::Detail, Logs::Trading, "Item not found in Trader Satchels either."); tpus->SubAction = BazaarPriceChange_Fail; QueuePacket(app); Trader_EndTrader(); @@ -2203,7 +2203,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { gis->SerialNumber[i] = newgis->SerialNumber[i]; gis->ItemCost[i] = tpus->NewPrice; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", + Log.Out(Logs::Detail, Logs::Trading, "Adding new item for %s. ItemID %i, SerialNumber %i, Charges %i, Price: %i, Slot %i", GetName(), newgis->Items[i], newgis->SerialNumber[i], newgis->Charges[i], tpus->NewPrice, i); } @@ -2249,7 +2249,7 @@ void Client::HandleTraderPriceUpdate(const EQApplicationPacket *app) { QueuePacket(app); if(OldPrice == tpus->NewPrice) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "The new price is the same as the old one."); + Log.Out(Logs::Detail, Logs::Trading, "The new price is the same as the old one."); safe_delete(gis); return; } @@ -2270,7 +2270,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { // This method is called when a potential seller in the /barter window searches for matching buyers // - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::SendBuyerResults %s\n", searchString); char* escSearchString = new char[strlen(searchString) * 2 + 1]; database.DoEscapeString(escSearchString, searchString, strlen(searchString)); @@ -2280,7 +2280,7 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2515,7 +2515,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { Quantity = i; break; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2523,7 +2523,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer || !Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); if(ItemToTransfer) @@ -2561,7 +2561,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { int16 SellerSlot = m_inv.HasItem(ItemID, 1, invWhereWorn|invWherePersonal|invWhereCursor); if (SellerSlot == INVALID_INDEX) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2569,7 +2569,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemInst* ItemToTransfer = m_inv.PopItem(SellerSlot); if(!ItemToTransfer) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); return; } @@ -2581,7 +2581,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { QuantityMoved += ItemToTransfer->GetCharges(); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2616,7 +2616,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { ItemToTransfer->SetCharges(QuantityToRemoveFromStack); if(!Buyer->MoveItemToInventory(ItemToTransfer, true)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unexpected error while moving item from seller to buyer."); + Log.Out(Logs::General, Logs::Error, "Unexpected error while moving item from seller to buyer."); Message(13, "Internal error while processing transaction."); safe_delete(ItemToTransfer); return; @@ -2855,11 +2855,11 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { bool LoreConflict = CheckLoreConflict(item); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", + Log.Out(Logs::Detail, Logs::Trading, "UpdateBuyLine: Char: %s BuySlot: %i ItemID %i %s Quantity %i Toggle: %i Price %i ItemCount %i LoreConflict %i", GetName(), BuySlot, ItemID, item->Name, Quantity, ToggleOnOff, Price, ItemCount, LoreConflict); if((item->NoDrop != 0) && !LoreConflict && (Quantity > 0) && HasMoney(Quantity * Price) && ToggleOnOff && (ItemCount == 0)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Adding to database"); + Log.Out(Logs::Detail, Logs::Trading, "Adding to database"); database.AddBuyLine(CharacterID(), BuySlot, ItemID, ItemName, Quantity, Price); QueuePacket(app); } diff --git a/zone/trap.cpp b/zone/trap.cpp index ac4361fe0..d973a800b 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,7 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 014fd8773..7fbd52e1d 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -220,7 +220,7 @@ void Client::ChangeTributeSettings(TributeInfo_Struct *t) { void Client::SendTributeDetails(uint32 client_id, uint32 tribute_id) { if(tribute_list.count(tribute_id) != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); + Log.Out(Logs::General, Logs::Error, "Details request for invalid tribute %lu", (unsigned long)tribute_id); return; } TributeData &td = tribute_list[tribute_id]; @@ -390,7 +390,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -407,7 +407,7 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -415,14 +415,14 @@ bool ZoneDatabase::LoadTributes() { uint32 id = atoul(row[0]); if(tribute_list.count(id) != 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); + Log.Out(Logs::General, Logs::Error, "Error in LoadTributes: unknown tribute %lu in tribute_levels", (unsigned long)id); continue; } TributeData &cur = tribute_list[id]; if(cur.tier_count >= MAX_TRIBUTE_TIERS) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); + Log.Out(Logs::General, Logs::Error, "Error in LoadTributes: on tribute %lu: more tiers defined than permitted", (unsigned long)id); continue; } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 82cc2936a..95f655cbb 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -88,7 +88,7 @@ void NPC::StopWandering() roamer=false; CastToNPC()->SetGrid(0); SendPosition(); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Stop Wandering requested."); + Log.Out(Logs::Detail, Logs::Pathing, "Stop Wandering requested."); return; } @@ -107,16 +107,16 @@ void NPC::ResumeWandering() cur_wp=save_wp; UpdateWaypoint(cur_wp); // have him head to last destination from here } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); + Log.Out(Logs::Detail, Logs::Pathing, "Resume Wandering requested. Grid %d, wp %d", GetGrid(), cur_wp); } else if (AIwalking_timer->Enabled()) { // we are at a waypoint paused normally - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); + Log.Out(Logs::Detail, Logs::Pathing, "Resume Wandering on timed pause. Grid %d, wp %d", GetGrid(), cur_wp); AIwalking_timer->Trigger(); // disable timer to end pause now } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(Logs::General, Logs::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); return; } @@ -131,7 +131,7 @@ void NPC::ResumeWandering() } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(Logs::General, Logs::Error, "NPC not on grid - can't resume wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -143,7 +143,7 @@ void NPC::PauseWandering(int pausetime) if (GetGrid() != 0) { DistractedFromGrid = true; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); + Log.Out(Logs::Detail, Logs::Pathing, "Paused Wandering requested. Grid %d. Resuming in %d ms (0=not until told)", GetGrid(), pausetime); SendPosition(); if (pausetime<1) { // negative grid number stops him dead in his tracks until ResumeWandering() @@ -154,7 +154,7 @@ void NPC::PauseWandering(int pausetime) AIwalking_timer->Start(pausetime*1000); // set the timer } } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); + Log.Out(Logs::General, Logs::Error, "NPC not on grid - can't pause wandering: %lu", (unsigned long)GetNPCTypeID()); } return; } @@ -166,7 +166,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if (GetGrid() < 0) { // currently stopped by a quest command SetGrid( 0 - GetGrid()); // get him moving again - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); + Log.Out(Logs::Detail, Logs::AI, "MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.", GetGrid()); } AIwalking_timer->Disable(); // disable timer in case he is paused at a wp if (cur_wp>=0) @@ -174,14 +174,14 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) save_wp=cur_wp; // save the current waypoint cur_wp=-1; // flag this move as quest controlled } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); + Log.Out(Logs::Detail, Logs::AI, "MoveTo (%.3f, %.3f, %.3f), pausing regular grid wandering. Grid %d, save_wp %d", mtx, mty, mtz, -GetGrid(), save_wp); } else { // not on a grid roamer=true; save_wp=0; cur_wp=-2; // flag as quest controlled w/no grid - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); + Log.Out(Logs::Detail, Logs::AI, "MoveTo (%.3f, %.3f, %.3f) without a grid.", mtx, mty, mtz); } if (saveguardspot) { @@ -196,7 +196,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) if(guard_heading == -1) guard_heading = this->CalculateHeadingToTarget(mtx, mty); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.Out(Logs::Detail, Logs::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } cur_wp_x = mtx; @@ -212,7 +212,7 @@ void NPC::MoveTo(float mtx, float mty, float mtz, float mth, bool saveguardspot) void NPC::UpdateWaypoint(int wp_index) { if(wp_index >= static_cast(Waypoints.size())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Update to waypoint %d failed. Not found.", wp_index); + Log.Out(Logs::Detail, Logs::AI, "Update to waypoint %d failed. Not found.", wp_index); return; } std::vector::iterator cur; @@ -224,7 +224,7 @@ void NPC::UpdateWaypoint(int wp_index) cur_wp_z = cur->z; cur_wp_pause = cur->pause; cur_wp_heading = cur->heading; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); + Log.Out(Logs::Detail, Logs::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading); //fix up pathing Z if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints)) @@ -430,7 +430,7 @@ void NPC::SetWaypointPause() void NPC::SaveGuardSpot(bool iClearGuardSpot) { if (iClearGuardSpot) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Clearing guard order."); + Log.Out(Logs::Detail, Logs::AI, "Clearing guard order."); guard_x = 0; guard_y = 0; guard_z = 0; @@ -443,14 +443,14 @@ void NPC::SaveGuardSpot(bool iClearGuardSpot) { guard_heading = heading; if(guard_heading == 0) guard_heading = 0.0001; //hack to make IsGuarding simpler - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); + Log.Out(Logs::Detail, Logs::AI, "Setting guard position to (%.3f, %.3f, %.3f)", guard_x, guard_y, guard_z); } } void NPC::NextGuardPosition() { if (!CalculateNewPosition2(guard_x, guard_y, guard_z, GetMovespeed())) { SetHeading(guard_heading); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Unable to move to next guard position. Probably rooted."); + Log.Out(Logs::Detail, Logs::AI, "Unable to move to next guard position. Probably rooted."); } else if((x_pos == guard_x) && (y_pos == guard_y) && (z_pos == guard_z)) { @@ -516,15 +516,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords if(z_pos-z != 0) { z_pos = z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); + Log.Out(Logs::Detail, Logs::AI, "Calc Position2 (%.3f, %.3f, %.3f): Jumping pure Z.", x, y, z); return true; } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); + Log.Out(Logs::Detail, Logs::AI, "Calc Position2 (%.3f, %.3f, %.3f) inWater=%d: We are there.", x, y, z, inWater); return false; } else if ((ABS(x_pos - x) < 0.1) && (ABS(y_pos - y) < 0.1)) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); + Log.Out(Logs::Detail, Logs::AI, "Calc Position2 (%.3f, %.3f, %.3f): X/Y difference <0.1, Jumping to target.", x, y, z); if(IsNPC()) { entity_list.ProcessMove(CastToNPC(), x, y, z); @@ -550,7 +550,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); + Log.Out(Logs::Detail, Logs::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz); uint8 NPCFlyMode = 0; @@ -569,7 +569,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -612,7 +612,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b //pRunAnimSpeed = (int8)(speed*NPC_RUNANIM_RATIO); //speed *= NPC_SPEED_MULTIPLIER; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.Out(Logs::Detail, Logs::AI, "Calculating new position2 to (%.3f, %.3f, %.3f), new vector (%.3f, %.3f, %.3f) rate %.3f, RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -647,7 +647,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b z_pos = new_z; tar_ndx=22-numsteps; heading = CalculateHeadingToTarget(x, y); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.Out(Logs::Detail, Logs::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } else { @@ -659,7 +659,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = y; z_pos = z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Only a single step to get there... jumping."); + Log.Out(Logs::Detail, Logs::AI, "Only a single step to get there... jumping."); } } @@ -678,7 +678,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b y_pos = new_y; z_pos = new_z; heading = CalculateHeadingToTarget(x, y); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); + Log.Out(Logs::Detail, Logs::AI, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps); } uint8 NPCFlyMode = 0; @@ -698,7 +698,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -759,7 +759,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec moved=false; } SetRunAnimSpeed(0); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); + Log.Out(Logs::Detail, Logs::AI, "Rooted while calculating new position to (%.3f, %.3f, %.3f)", x, y, z); return true; } @@ -773,7 +773,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO); speed *= NPC_SPEED_MULTIPLIER; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); + Log.Out(Logs::Detail, Logs::AI, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed); // -------------------------------------------------------------------------- // 2: get unit vector @@ -790,7 +790,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = x; y_pos = y; z_pos = z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Close enough, jumping to waypoint"); + Log.Out(Logs::Detail, Logs::AI, "Close enough, jumping to waypoint"); } else { float new_x = x_pos + tar_vx*tar_vector; @@ -803,7 +803,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); + Log.Out(Logs::Detail, Logs::AI, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos); } uint8 NPCFlyMode = 0; @@ -823,7 +823,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check. { @@ -876,7 +876,7 @@ void NPC::AssignWaypoints(int32 grid) { std::string query = StringFormat("SELECT `type`, `type2` FROM `grid` WHERE `id` = %i AND `zoneid` = %i", grid, zone->GetZoneID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "MySQL Error while trying to assign grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -897,7 +897,7 @@ void NPC::AssignWaypoints(int32 grid) { "ORDER BY `number`", grid, zone->GetZoneID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "MySQL Error while trying to assign waypoints from grid %u to mob %s: %s", grid, name, results.ErrorMessage().c_str()); return; } @@ -951,7 +951,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { x_pos = new_x; y_pos = new_y; z_pos = new_z; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); + Log.Out(Logs::Detail, Logs::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); if(flymode == FlyMode1) return; @@ -967,7 +967,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -998,7 +998,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) { float newz = zone->zonemap->FindBestZ(dest, nullptr); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); + Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos); if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. z_pos = newz + 1; @@ -1011,7 +1011,7 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1028,7 +1028,7 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1049,7 +1049,7 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -1078,7 +1078,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1092,7 +1092,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1122,7 +1122,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1160,7 +1160,7 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1173,14 +1173,14 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1196,7 +1196,7 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1222,7 +1222,7 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -1249,7 +1249,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1270,14 +1270,14 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } @@ -1289,7 +1289,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1304,7 +1304,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); @@ -1316,7 +1316,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -1336,7 +1336,7 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 8043954fc..225063ec1 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -140,7 +140,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "Got 0x%04x from world:", pack->opcode); + Log.Out(Logs::Detail, Logs::Zone_Server, "Got 0x%04x from world:", pack->opcode); _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); switch(pack->opcode) { case 0: { @@ -155,12 +155,12 @@ void WorldServer::Process() { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World assigned Port: %d for this zone.", sci->port); + Log.Out(Logs::Detail, Logs::Zone_Server, "World assigned Port: %d for this zone.", sci->port); ZoneConfig::SetZonePort(sci->port); break; } case ServerOP_ZAAuthFailed: { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); + Log.Out(Logs::Detail, Logs::Zone_Server, "World server responded 'Not Authorized', disabling reconnect"); pTryReconnect = false; Disconnect(); break; @@ -386,12 +386,12 @@ void WorldServer::Process() { } } else { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", + Log.Out(Logs::Detail, Logs::None, "[CLIENT] id=%i, playerineqstring=%i, playersinzonestring=%i. Dumping WhoAllReturnStruct:", wars->id, wars->playerineqstring, wars->playersinzonestring); } } else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "WhoAllReturnStruct: Could not get return struct!"); + Log.Out(Logs::General, Logs::Error, "WhoAllReturnStruct: Could not get return struct!"); break; } case ServerOP_EmoteMessage: { @@ -678,7 +678,7 @@ void WorldServer::Process() { //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + Log.Out(Logs::Detail, Logs::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", zone->GetShortName(), client->GetName(), srs->rez.spellid); EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -694,10 +694,10 @@ void WorldServer::Process() { // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "OP_RezzComplete received in zone %s for corpse %s", + Log.Out(Logs::Detail, Logs::Spells, "OP_RezzComplete received in zone %s for corpse %s", zone->GetShortName(), srs->rez.corpse_name); - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Found corpse. Marking corpse as rezzed."); + Log.Out(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed."); // I don't know why Rezzed is not set to true in CompleteRezz(). corpse->IsRezzed(true); corpse->CompleteResurrection(); @@ -748,7 +748,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - Log.Out(EQEmuLogSys::Moderate, EQEmuLogSys::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + Log.Out(Logs::Moderate, Logs::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); @@ -1381,7 +1381,7 @@ void WorldServer::Process() { if(NewCorpse) NewCorpse->Spawn(); else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); + Log.Out(Logs::General, Logs::Error, "Unable to load player corpse id %u for zone %s.", s->player_corpse_id, zone->GetShortName()); break; } @@ -1974,7 +1974,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + Log.Out(Logs::Detail, Logs::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*) pack->pBuffer; sem->rezzopcode = opcode; @@ -1983,9 +1983,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + Log.Out(Logs::Detail, Logs::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); else - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "NOT Sending player rezz packet to world"); + Log.Out(Logs::Detail, Logs::Spells, "NOT Sending player rezz packet to world"); safe_delete(pack); return ret; @@ -2005,14 +2005,14 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) { ReloadTasks_Struct* rts = (ReloadTasks_Struct*) pack->pBuffer; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Zone received ServerOP_ReloadTasks from World, Command %i", rts->Command); switch(rts->Command) { case RELOADTASKS: entity_list.SaveAllClientsTaskState(); if(rts->Parameter == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload ALL tasks"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload ALL tasks"); safe_delete(taskmanager); taskmanager = new TaskManager; taskmanager->LoadTasks(); @@ -2021,7 +2021,7 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) entity_list.ReloadAllClientsTaskState(); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter); taskmanager->LoadTasks(rts->Parameter); entity_list.ReloadAllClientsTaskState(rts->Parameter); } @@ -2030,23 +2030,23 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack) case RELOADTASKPROXIMITIES: if(zone) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task proximities"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task proximities"); taskmanager->LoadProximities(zone->GetZoneID()); } break; case RELOADTASKGOALLISTS: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task goal lists"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task goal lists"); taskmanager->ReloadGoalLists(); break; case RELOADTASKSETS: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Reload task sets"); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task sets"); taskmanager->LoadTaskSets(); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); + Log.Out(Logs::General, Logs::Tasks, "[GLOBALLOAD] Unhandled ServerOP_ReloadTasks command %i", rts->Command); } @@ -2061,7 +2061,7 @@ uint32 WorldServer::NextGroupID() { if(cur_groupid >= last_groupid) { //this is an error... This means that 50 groups were created before //1 packet could make the zone->world->zone trip... so let it error. - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Ran out of group IDs before the server sent us more."); + Log.Out(Logs::General, Logs::Error, "Ran out of group IDs before the server sent us more."); return(0); } if(cur_groupid > (last_groupid - /*50*/995)) { diff --git a/zone/zone.cpp b/zone/zone.cpp index 1ae1d237b..b4394377f 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -90,7 +90,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); + Log.Out(Logs::General, Logs::Status, "Booting %s (%d:%d)", zonename, iZoneID, iInstanceID); numclients = 0; zone = new Zone(iZoneID, iInstanceID, zonename); @@ -117,13 +117,13 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { log_levels[i]=0; //set to zero on a bogue char } zone->loglevelvar = log_levels[0]; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "General logging level: %i", zone->loglevelvar); + Log.Out(Logs::General, Logs::Status, "General logging level: %i", zone->loglevelvar); zone->merchantvar = log_levels[1]; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Merchant logging level: %i", zone->merchantvar); + Log.Out(Logs::General, Logs::Status, "Merchant logging level: %i", zone->merchantvar); zone->tradevar = log_levels[2]; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Trade logging level: %i", zone->tradevar); + Log.Out(Logs::General, Logs::Status, "Trade logging level: %i", zone->tradevar); zone->lootvar = log_levels[3]; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loot logging level: %i", zone->lootvar); + Log.Out(Logs::General, Logs::Status, "Loot logging level: %i", zone->lootvar); } else { zone->loglevelvar = uint8(atoi(tmp)); //continue supporting only command logging (for now) @@ -144,8 +144,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { delete pack; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); + Log.Out(Logs::General, Logs::Normal, "---- Zone server %s, listening on port:%i ----", zonename, ZoneConfig::get()->ZonePort); + Log.Out(Logs::General, Logs::Status, "Zone Bootup: %s (%i: %i)", zonename, iZoneID, iInstanceID); parse->Init(); UpdateWindowTitle(); zone->GetTimeSync(); @@ -167,11 +167,11 @@ bool Zone::LoadZoneObjects() { zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",results.ErrorMessage().c_str()); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Objects from DB..."); + Log.Out(Logs::General, Logs::Status, "Loading Objects from DB..."); for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[9]) == 0) { @@ -288,7 +288,7 @@ bool Zone::LoadGroundSpawns() { memset(&groundspawn, 0, sizeof(groundspawn)); int gsindex=0; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Ground Spawns from DB..."); + Log.Out(Logs::General, Logs::Status, "Loading Ground Spawns from DB..."); database.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn); uint32 ix=0; char* name=0; @@ -402,7 +402,7 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) { } void Zone::LoadTempMerchantData() { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Temporary Merchant Lists..."); + Log.Out(Logs::General, Logs::Status, "Loading Temporary Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.npcid, " @@ -420,7 +420,7 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; @@ -453,7 +453,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -474,7 +474,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { } void Zone::GetMerchantDataForZoneLoad() { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Merchant Lists..."); + Log.Out(Logs::General, Logs::Status, "Loading Merchant Lists..."); std::string query = StringFormat( "SELECT " "DISTINCT ml.merchantid, " @@ -497,7 +497,7 @@ void Zone::GetMerchantDataForZoneLoad() { std::map >::iterator cur; uint32 npcid = 0; if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "No Merchant Data found for %s.", GetShortName()); + Log.Out(Logs::General, Logs::None, "No Merchant Data found for %s.", GetShortName()); return; } for (auto row = results.begin(); row != results.end(); ++row) { @@ -547,7 +547,7 @@ void Zone::LoadMercTemplates(){ "`merc_stance_entries` ORDER BY `class_id`, `proficiency_id`, `stance_id`"; auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()"); else { for (auto row = results.begin(); row != results.end(); ++row) { MercStanceInfo tempMercStanceInfo; @@ -570,7 +570,7 @@ void Zone::LoadMercTemplates(){ "ORDER BY MTyp.race_id, MS.class_id, MTyp.proficiency_id;"; results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadMercTemplates()"); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadMercTemplates()"); return; } @@ -614,7 +614,7 @@ void Zone::LoadLevelEXPMods(){ const std::string query = "SELECT level, exp_mod, aa_exp_mod FROM level_exp_mods"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadEXPLevelMods()"); return; } @@ -638,7 +638,7 @@ void Zone::LoadMercSpells(){ "ORDER BY msl.class_id, msl.proficiency_id, msle.spell_type, msle.minlevel, msle.slot;"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadMercSpells()"); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadMercSpells()"); return; } @@ -660,7 +660,7 @@ void Zone::LoadMercSpells(){ } if(MERC_DEBUG > 0) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + Log.Out(Logs::General, Logs::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } @@ -707,11 +707,11 @@ void Zone::Shutdown(bool quite) } zone->ldon_trap_entry_list.clear(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); + Log.Out(Logs::General, Logs::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID()); petition_list.ClearPetitions(); zone->GotCurTime(false); if (!quite) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Normal, "Zone shutdown: going to sleep"); + Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep"); ZoneLoaded = false; zone->ResetAuth(); @@ -725,19 +725,19 @@ void Zone::Shutdown(bool quite) void Zone::LoadZoneDoors(const char* zone, int16 version) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading doors for %s ...", zone); + Log.Out(Logs::General, Logs::Status, "Loading doors for %s ...", zone); uint32 maxid; int32 count = database.GetDoorsCount(&maxid, zone, version); if(count < 1) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "... No doors loaded."); + Log.Out(Logs::General, Logs::Status, "... No doors loaded."); return; } Door *dlist = new Door[count]; if(!database.LoadDoors(count, dlist, zone, version)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load doors."); + Log.Out(Logs::General, Logs::Error, "... Failed to load doors."); delete[] dlist; return; } @@ -801,12 +801,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) database.GetZoneLongName(short_name, &long_name, file_name, &psafe_x, &psafe_y, &psafe_z, &pgraveyard_id, &pMaxClients); if(graveyard_id() > 0) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Graveyard ID is %i.", graveyard_id()); + Log.Out(Logs::General, Logs::None, "Graveyard ID is %i.", graveyard_id()); bool GraveYardLoaded = database.GetZoneGraveyard(graveyard_id(), &pgraveyard_zoneid, &pgraveyard_x, &pgraveyard_y, &pgraveyard_z, &pgraveyard_heading); if(GraveYardLoaded) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); + Log.Out(Logs::General, Logs::None, "Loaded a graveyard for zone %s: graveyard zoneid is %u x is %f y is %f z is %f heading is %f.", short_name, graveyard_zoneid(), graveyard_x(), graveyard_y(), graveyard_z(), graveyard_heading()); else - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); + Log.Out(Logs::General, Logs::Error, "Unable to load the graveyard id %i for zone %s.", graveyard_id(), short_name); } if (long_name == 0) { long_name = strcpy(new char[18], "Long zone missing"); @@ -814,7 +814,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) autoshutdown_timer.Start(AUTHENTICATION_TIMEOUT * 1000, false); Weather_Timer = new Timer(60000); Weather_Timer->Start(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); + Log.Out(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", short_name, Weather_Timer->GetRemainingTime()/1000); zone_weather = 0; weather_intensity = 0; blocked_spells = nullptr; @@ -899,56 +899,56 @@ Zone::~Zone() { bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn conditions..."); + Log.Out(Logs::General, Logs::Status, "Loading spawn conditions..."); if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn conditions failed, continuing without them."); + Log.Out(Logs::General, Logs::Error, "Loading spawn conditions failed, continuing without them."); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading static zone points..."); + Log.Out(Logs::General, Logs::Status, "Loading static zone points..."); if (!database.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Out(Logs::General, Logs::Error, "Loading static zone points failed."); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn groups..."); + Log.Out(Logs::General, Logs::Status, "Loading spawn groups..."); if (!database.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn groups failed."); + Log.Out(Logs::General, Logs::Error, "Loading spawn groups failed."); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading spawn2 points..."); + Log.Out(Logs::General, Logs::Status, "Loading spawn2 points..."); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading spawn2 points failed."); + Log.Out(Logs::General, Logs::Error, "Loading spawn2 points failed."); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading player corpses..."); + Log.Out(Logs::General, Logs::Status, "Loading player corpses..."); if (!database.LoadCharacterCorpses(zoneid, instanceid)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading player corpses failed."); + Log.Out(Logs::General, Logs::Error, "Loading player corpses failed."); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading traps..."); + Log.Out(Logs::General, Logs::Status, "Loading traps..."); if (!database.LoadTraps(short_name, GetInstanceVersion())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading traps failed."); + Log.Out(Logs::General, Logs::Error, "Loading traps failed."); return false; } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading adventure flavor text..."); + Log.Out(Logs::General, Logs::Status, "Loading adventure flavor text..."); LoadAdventureFlavor(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading ground spawns..."); + Log.Out(Logs::General, Logs::Status, "Loading ground spawns..."); if (!LoadGroundSpawns()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading ground spawns failed. continuing."); + Log.Out(Logs::General, Logs::Error, "Loading ground spawns failed. continuing."); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading World Objects from DB..."); + Log.Out(Logs::General, Logs::Status, "Loading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading World Objects failed. continuing."); + Log.Out(Logs::General, Logs::Error, "Loading World Objects failed. continuing."); } //load up the zone's doors (prints inside) @@ -1005,10 +1005,10 @@ bool Zone::Init(bool iStaticZone) { } } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading timezone data..."); + Log.Out(Logs::General, Logs::Status, "Loading timezone data..."); zone->zone_time.setEQTimeZone(database.GetZoneTZ(zoneid, GetInstanceVersion())); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); + Log.Out(Logs::General, Logs::Status, "Init Finished: ZoneID = %d, Time Offset = %d", zoneid, zone->zone_time.getEQTimeZone()); LoadTickItems(); @@ -1019,32 +1019,32 @@ bool Zone::Init(bool iStaticZone) { } void Zone::ReloadStaticData() { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading Zone Static Data..."); + Log.Out(Logs::General, Logs::Status, "Reloading Zone Static Data..."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading static zone points..."); + Log.Out(Logs::General, Logs::Status, "Reloading static zone points..."); zone_point_list.Clear(); if (!database.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Loading static zone points failed."); + Log.Out(Logs::General, Logs::Error, "Loading static zone points failed."); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading traps..."); + Log.Out(Logs::General, Logs::Status, "Reloading traps..."); entity_list.RemoveAllTraps(); if (!database.LoadTraps(GetShortName(), GetInstanceVersion())) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading traps failed."); + Log.Out(Logs::General, Logs::Error, "Reloading traps failed."); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading ground spawns..."); + Log.Out(Logs::General, Logs::Status, "Reloading ground spawns..."); if (!LoadGroundSpawns()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading ground spawns failed. continuing."); + Log.Out(Logs::General, Logs::Error, "Reloading ground spawns failed. continuing."); } entity_list.RemoveAllObjects(); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Reloading World Objects from DB..."); + Log.Out(Logs::General, Logs::Status, "Reloading World Objects from DB..."); if (!LoadZoneObjects()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Reloading World Objects failed. continuing."); + Log.Out(Logs::General, Logs::Error, "Reloading World Objects failed. continuing."); } entity_list.RemoveAllDoors(); @@ -1060,7 +1060,7 @@ void Zone::ReloadStaticData() { if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zone Static Data Reloaded."); + Log.Out(Logs::General, Logs::Status, "Zone Static Data Reloaded."); } bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) @@ -1072,7 +1072,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Out(Logs::General, Logs::Error, "Error loading the Zone Config."); return false; } } @@ -1087,7 +1087,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading the Zone Config."); + Log.Out(Logs::General, Logs::Error, "Error loading the Zone Config."); return false; } } @@ -1098,7 +1098,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDe strcpy(newzone_data.zone_long_name, GetLongName()); strcpy(newzone_data.zone_short_name2, GetShortName()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Successfully loaded Zone Config."); + Log.Out(Logs::General, Logs::Status, "Successfully loaded Zone Config."); return true; } @@ -1403,11 +1403,11 @@ void Zone::ChangeWeather() weathertimer = weatherTimerRule*1000; Weather_Timer->Start(weathertimer); } - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); + Log.Out(Logs::General, Logs::None, "The next weather check for zone: %s will be in %i seconds.", zone->GetShortName(), Weather_Timer->GetRemainingTime()/1000); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); + Log.Out(Logs::General, Logs::None, "The weather for zone: %s has changed. Old weather was = %i. New weather is = %i The next check will be in %i seconds. Rain chance: %i, Rain duration: %i, Snow chance %i, Snow duration: %i", zone->GetShortName(), tmpOldWeather, zone_weather,Weather_Timer->GetRemainingTime()/1000,rainchance,rainduration,snowchance,snowduration); this->weatherSend(); } } @@ -1492,7 +1492,7 @@ void Zone::Repop(uint32 delay) { quest_manager.ClearAllTimers(); if (!database.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); + Log.Out(Logs::General, Logs::None, "Error in Zone::Repop: database.PopulateZoneSpawnList failed"); initgrids_timer.Start(); @@ -1580,8 +1580,8 @@ ZonePoint* Zone::GetClosestZonePoint(float x, float y, float z, uint32 to, Clien { if(client) client->CheatDetected(MQZoneUnknownDest, x, y, z); // Someone is trying to use /zone - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, ". %f x %f y %f z ", x, y, z); + Log.Out(Logs::General, Logs::Status, "WARNING: Closest zone point for zone id %d is %f, you might need to update your zone_points table if you dont arrive at the right spot.", to, closest_dist); + Log.Out(Logs::General, Logs::Status, ". %f x %f y %f z ", x, y, z); } if(closest_dist > max_distance2) @@ -1861,7 +1861,7 @@ void Zone::LoadBlockedSpells(uint32 zoneid) blocked_spells = new ZoneSpellsBlocked[totalBS]; if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "... Failed to load blocked spells."); + Log.Out(Logs::General, Logs::Error, "... Failed to load blocked spells."); ClearBlockedSpells(); } } @@ -1996,7 +1996,7 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2017,7 +2017,7 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2059,7 +2059,7 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2105,7 +2105,7 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2153,7 +2153,7 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2228,7 +2228,7 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -2262,7 +2262,7 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 18c357bc2..58df1a7fb 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,7 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } @@ -112,7 +112,7 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } @@ -201,7 +201,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -212,7 +212,7 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -225,7 +225,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -255,7 +255,7 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } @@ -426,7 +426,7 @@ void ZoneDatabase::GetEventLogs(const char* name,char* target,uint32 account_id, void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) { if (!container) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); + Log.Out(Logs::General, Logs::Error, "Programming error: LoadWorldContainer passed nullptr pointer"); return; } @@ -434,7 +434,7 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, ItemInst* container) "FROM object_contents WHERE parentid = %i", parentid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in DB::LoadWorldContainer: %s", results.ErrorMessage().c_str()); return; } @@ -499,7 +499,7 @@ void ZoneDatabase::SaveWorldContainer(uint32 zone_id, uint32 parent_id, const It augslot[0], augslot[1], augslot[2], augslot[3], augslot[4], augslot[5]); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::SaveWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -511,7 +511,7 @@ void ZoneDatabase::DeleteWorldContainer(uint32 parent_id, uint32 zone_id) std::string query = StringFormat("DELETE FROM object_contents WHERE parentid = %i AND zoneid = %i", parent_id, zone_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::DeleteWorldContainer: %s", results.ErrorMessage().c_str()); } @@ -523,14 +523,14 @@ Trader_Struct* ZoneDatabase::LoadTraderItem(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id = %i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.Out(Logs::Detail, Logs::Trading, "Failed to load trader information!\n"); return loadti; } loadti->Code = BazaarTrader_ShowItems; for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[4]) < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.Out(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -548,13 +548,13 @@ TraderCharges_Struct* ZoneDatabase::LoadTraderItemWithCharges(uint32 char_id) std::string query = StringFormat("SELECT * FROM trader WHERE char_id=%i ORDER BY slot_id LIMIT 80", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Failed to load trader information!\n"); + Log.Out(Logs::Detail, Logs::Trading, "Failed to load trader information!\n"); return loadti; } for (auto row = results.begin(); row != results.end(); ++row) { if (atoi(row[5]) >= 80 || atoi(row[5]) < 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad Slot number when trying to load trader information!\n"); + Log.Out(Logs::Detail, Logs::Trading, "Bad Slot number when trying to load trader information!\n"); continue; } @@ -574,7 +574,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { return nullptr; if (results.RowCount() == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Bad result from query\n"); fflush(stdout); + Log.Out(Logs::Detail, Logs::Trading, "Bad result from query\n"); fflush(stdout); return nullptr; } @@ -587,7 +587,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { const Item_Struct *item = database.GetItem(ItemID); if(!item) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item\n"); + Log.Out(Logs::Detail, Logs::Trading, "Unable to create item\n"); fflush(stdout); return nullptr; } @@ -597,7 +597,7 @@ ItemInst* ZoneDatabase::LoadSingleTraderItem(uint32 CharID, int SerialNumber) { ItemInst* inst = database.CreateItem(item); if(!inst) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Unable to create item instance\n"); + Log.Out(Logs::Detail, Logs::Trading, "Unable to create item instance\n"); fflush(stdout); return nullptr; } @@ -619,25 +619,25 @@ void ZoneDatabase::SaveTraderItem(uint32 CharID, uint32 ItemID, uint32 SerialNum CharID, ItemID, SerialNumber, Charges, ItemCost, Slot); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to save trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemCharges(int CharID, uint32 SerialNumber, int32 Charges) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); + Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderItemCharges(%i, %i, %i)", CharID, SerialNumber, Charges); std::string query = StringFormat("UPDATE trader SET charges = %i WHERE char_id = %i AND serialnumber = %i", Charges, CharID, SerialNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to update charges for trader item: %i for char_id: %i, the error was: %s\n", SerialNumber, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); + Log.Out(Logs::Detail, Logs::Trading, "ZoneDatabase::UpdateTraderPrice(%i, %i, %i, %i)", CharID, ItemID, Charges, NewPrice); const Item_Struct *item = database.GetItem(ItemID); @@ -645,12 +645,12 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg return; if(NewPrice == 0) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); + Log.Out(Logs::Detail, Logs::Trading, "Removing Trader items from the DB for CharID %i, ItemID %i", CharID, ItemID); std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i AND item_id = %i",CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to remove trader item(s): %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -661,7 +661,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID, Charges); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); return; } @@ -671,7 +671,7 @@ void ZoneDatabase::UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charg NewPrice, CharID, ItemID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to update price for trader item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 char_id){ @@ -680,7 +680,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ const std::string query = "DELETE FROM trader"; auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all trader items data, the error was: %s\n", results.ErrorMessage().c_str()); return; } @@ -688,7 +688,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 char_id){ std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i", char_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n", char_id, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { @@ -696,7 +696,7 @@ void ZoneDatabase::DeleteTraderItem(uint32 CharID,uint16 SlotID) { std::string query = StringFormat("DELETE FROM trader WHERE char_id = %i And slot_id = %i", CharID, SlotID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete trader item data for char_id: %i, the error was: %s\n",CharID, results.ErrorMessage().c_str()); } void ZoneDatabase::DeleteBuyLines(uint32 CharID) { @@ -705,7 +705,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { const std::string query = "DELETE FROM buyer"; auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete all buyer items data, the error was: %s\n",results.ErrorMessage().c_str()); return; } @@ -713,7 +713,7 @@ void ZoneDatabase::DeleteBuyLines(uint32 CharID) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i", CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyer item data for charid: %i, the error was: %s\n",CharID,results.ErrorMessage().c_str()); } @@ -722,7 +722,7 @@ void ZoneDatabase::AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, cons CharID, BuySlot, ItemID, ItemName, Quantity, Price); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to save buline item: %i for char_id: %i, the error was: %s\n", ItemID, CharID, results.ErrorMessage().c_str()); } @@ -730,7 +730,7 @@ void ZoneDatabase::RemoveBuyLine(uint32 CharID, uint32 BuySlot) { std::string query = StringFormat("DELETE FROM buyer WHERE charid = %i AND buyslot = %i", CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to delete buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -743,7 +743,7 @@ void ZoneDatabase::UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity) std::string query = StringFormat("UPDATE buyer SET quantity = %i WHERE charid = %i AND buyslot = %i", Quantity, CharID, BuySlot); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to update quantity in buyslot %i for charid: %i, the error was: %s\n", BuySlot, CharID, results.ErrorMessage().c_str()); } @@ -1219,7 +1219,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_languages` (id, lang_id, value) VALUES (%u, %u, %u)", character_id, lang_id, value); QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterLanguage for character ID: %i, lang_id:%u value:%u done", character_id, lang_id, value); return true; } @@ -1231,10 +1231,10 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u /* Save Home Bind Point */ 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, zone_id, instance_id, x, y, z, heading, is_home); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + Log.Out(Logs::General, Logs::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } @@ -1245,20 +1245,20 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i uint8 blue = (color & 0x000000FF); std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color); return true; } bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){ std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value); return true; } bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id){ std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id); auto results = QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id); return true; } @@ -1270,7 +1270,7 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != TRIBUTE_NONE){ std::string query = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterTribute for character ID: %i, tier:%u tribute:%u done", character_id, pp->tributes[i].tier, pp->tributes[i].tribute); } } return true; @@ -1281,7 +1281,7 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } @@ -1596,7 +1596,7 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla m_epp->expended_aa ); auto results = database.QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); return true; } @@ -1637,7 +1637,7 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru pp->currentEbonCrystals, pp->careerEbonCrystals); auto results = database.QueryDatabase(query); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Saving Currency for character ID: %i, done", character_id); + Log.Out(Logs::General, Logs::None, "Saving Currency for character ID: %i, done", character_id); return true; } @@ -1646,7 +1646,7 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur " VALUES (%u, %u, %u)", character_id, aa_id, current_level); auto results = QueryDatabase(rquery); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); + Log.Out(Logs::General, Logs::None, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level); return true; } @@ -2341,7 +2341,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { std::string query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error While Deleting Merc Buffs before save: %s", results.ErrorMessage().c_str()); return; } @@ -2367,7 +2367,7 @@ void ZoneDatabase::SaveMercBuffs(Merc *merc) { buffs[buffCount].caston_z, buffs[buffCount].ExtraDIChance); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Saving Merc Buffs: %s", results.ErrorMessage().c_str()); break; } } @@ -2386,7 +2386,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { merc->GetMercID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); return; } @@ -2431,7 +2431,7 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { query = StringFormat("DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()); results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Loading Merc Buffs: %s", results.ErrorMessage().c_str()); } @@ -2447,14 +2447,14 @@ bool ZoneDatabase::DeleteMerc(uint32 merc_id) { auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Deleting Merc Buffs: %s", results.ErrorMessage().c_str()); } query = StringFormat("DELETE FROM mercs WHERE MercID = '%u'", merc_id); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Deleting Merc: %s", results.ErrorMessage().c_str()); return false; } @@ -2472,7 +2472,7 @@ void ZoneDatabase::LoadMercEquipment(Merc *merc) { merc->GetLevel(), merc->GetLevel()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error Loading Merc Inventory: %s", results.ErrorMessage().c_str()); return; } @@ -2646,7 +2646,7 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2665,7 +2665,7 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } @@ -2696,7 +2696,7 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Loading Blocked Spells from database..."); + Log.Out(Logs::General, Logs::Status, "Loading Blocked Spells from database..."); std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message " "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); @@ -2825,7 +2825,7 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::mapCharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3059,7 +3059,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3087,7 +3087,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3128,7 +3128,7 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } @@ -3860,7 +3860,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS)); NewCorpse->Spawn(); if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading)) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); + Log.Out(Logs::General, Logs::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id); } } @@ -3903,7 +3903,7 @@ bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id ++CorpseCount; } else{ - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Unable to construct a player corpse for character id %u.", char_id); + Log.Out(Logs::General, Logs::Error, "Unable to construct a player corpse for character id %u.", char_id); } } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 8797ed7fa..53235176b 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -44,12 +44,12 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { zoning = true; if (app->size != sizeof(ZoneChange_Struct)) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); + Log.Out(Logs::General, Logs::None, "Wrong size: OP_ZoneChange, size=%d, expected %d", app->size, sizeof(ZoneChange_Struct)); return; } #if EQDEBUG >= 5 - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Zone request from %s", GetName()); + Log.Out(Logs::General, Logs::None, "Zone request from %s", GetName()); DumpPacket(app); #endif ZoneChange_Struct* zc=(ZoneChange_Struct*)app->pBuffer; @@ -97,7 +97,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { CheatDetected(MQZone, zc->x, zc->y, zc->z); Message(13, "Invalid unsolicited zone request."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -129,7 +129,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //if we didnt get a zone point, or its to a different zone, //then we assume this is invalid. if(!zone_point || zone_point->target_zone_id != target_zone_id) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%d'.", GetName(), target_zone_id); CheatDetected(MQGate, zc->x, zc->y, zc->z); SendZoneCancel(zc); return; @@ -160,7 +160,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(target_zone_name == nullptr) { //invalid zone... Message(13, "Invalid target zone ID."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Unable to get zone name for zone id '%d'.", GetName(), target_zone_id); SendZoneCancel(zc); return; } @@ -173,7 +173,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //invalid zone... Message(13, "Invalid target zone while getting safe points."); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name); SendZoneCancel(zc); return; } @@ -193,7 +193,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { switch(zone_mode) { case EvacToSafeCoords: case ZoneToSafeCoords: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); + Log.Out(Logs::General, Logs::None, "Zoning %s to safe coords (%f,%f,%f) in %s (%d)", GetName(), safe_x, safe_y, safe_z, target_zone_name, target_zone_id); dest_x = safe_x; dest_y = safe_y; dest_z = safe_z; @@ -253,7 +253,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //could not find a valid reason for them to be zoning, stop it. CheatDetected(MQZoneUnknownDest, 0.0, 0.0, 0.0); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Invalid unsolicited zone request to zone id '%s'. Not near a zone point.", GetName(), target_zone_name); SendZoneCancel(zc); return; default: @@ -288,7 +288,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //we have successfully zoned DoZoneSuccess(zc, target_zone_id, target_instance_id, dest_x, dest_y, dest_z, dest_h, ignorerestrictions); } else { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); + Log.Out(Logs::General, Logs::Error, "Zoning %s: Rules prevent this char from zoning into '%s'", GetName(), target_zone_name); SendZoneError(zc, myerror); } } @@ -312,7 +312,7 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); + Log.Out(Logs::General, Logs::Error, "Zone %i is not available because target wasn't found or character insufficent level", zc->zoneID); SetPortExemption(true); @@ -347,7 +347,7 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc if(this->GetPet()) entity_list.RemoveFromHateLists(this->GetPet()); - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); + Log.Out(Logs::General, Logs::Status, "Zoning '%s' to: %s (%i) - (%i) x=%f, y=%f, z=%f", m_pp.name, database.GetZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z); //set the player's coordinates in the new zone so they have them //when they zone into it @@ -472,7 +472,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); + Log.Out(Logs::General, Logs::Error, "Client::ProcessMovePC received a reguest to perform an unsupported client zone operation."); break; } } @@ -534,7 +534,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z heading = m_pp.binds[0].heading; zonesummon_ignorerestrictions = 1; - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); + Log.Out(Logs::General, Logs::None, "Player %s has died and will be zoned to bind point in zone: %s at LOC x=%f, y=%f, z=%f, heading=%f", GetName(), pZoneName, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, m_pp.binds[0].heading); break; case SummonPC: zonesummon_x = x_pos = x; @@ -543,14 +543,14 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z SetHeading(heading); break; case Rewind: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); + Log.Out(Logs::General, Logs::None, "%s has requested a /rewind from %f, %f, %f, to %f, %f, %f in %s", GetName(), x_pos, y_pos, z_pos, rewind_x, rewind_y, rewind_z, zone->GetShortName()); zonesummon_x = x_pos = x; zonesummon_y = y_pos = y; zonesummon_z = z_pos = z; SetHeading(heading); break; default: - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); + Log.Out(Logs::General, Logs::Error, "Client::ZonePC() received a reguest to perform an unsupported client zone operation."); ReadyToZone = false; break; } @@ -680,7 +680,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z safe_delete(outapp); } - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); + Log.Out(Logs::Detail, Logs::None, "Player %s has requested a zoning to LOC x=%f, y=%f, z=%f, heading=%f in zoneid=%i", GetName(), x, y, z, heading, zoneID); //Clear zonesummon variables if we're zoning to our own zone //Client wont generate a zone change packet to the server in this case so //They aren't needed and it keeps behavior on next zone attempt from being undefined. @@ -768,7 +768,7 @@ void Client::SetZoneFlag(uint32 zone_id) { std::string query = StringFormat("INSERT INTO zone_flags (charID,zoneID) VALUES(%d,%d)", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "MySQL Error while trying to set zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } void Client::ClearZoneFlag(uint32 zone_id) { @@ -781,7 +781,7 @@ void Client::ClearZoneFlag(uint32 zone_id) { std::string query = StringFormat("DELETE FROM zone_flags WHERE charID=%d AND zoneID=%d", CharacterID(), zone_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "MySQL Error while trying to clear zone flag for %s: %s", GetName(), results.ErrorMessage().c_str()); } @@ -791,7 +791,7 @@ void Client::LoadZoneFlags() { std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + Log.Out(Logs::General, Logs::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); return; } @@ -854,23 +854,23 @@ bool Client::CanBeInZone() { char flag_needed[128]; if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, flag_needed)) { //this should not happen... - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName()); return(false); } if(GetLevel() < minlevel) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min level requirement (%d < %d)!", GetLevel(), minlevel); return(false); } if(Admin() < minstatus) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus); return(false); } if(flag_needed[0] != '\0') { //the flag needed string is not empty, meaning a flag is required. if(Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(zone->GetZoneID())) { - Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); + Log.Out(Logs::Detail, Logs::None, "[CLIENT] Character does not have the flag to be in this zone (%s)!", flag_needed); return(false); } } From 1ae69aa18019dc0935bd42e9e7bd53c99c4c7eda Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:35:15 -0600 Subject: [PATCH 1081/1883] Update debug levels --- common/eqemu_logsys.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d77ee3b6b..d92fc25aa 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -28,9 +28,9 @@ namespace Logs{ enum DebugLevel { - General = 0, /* 0 - Low-Level general debugging, useful info on single line */ - Moderate, /* 1 - Informational based, used in functions, when particular things load */ - Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ + General = 1, /* 1 - Low-Level general debugging, useful info on single line */ + Moderate, /* 2 - Informational based, used in functions, when particular things load */ + Detail, /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; /* From 3320867b108bd4b45d0eb54dd6c270bee82b2760 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:40:58 -0600 Subject: [PATCH 1082/1883] delete world/world_logsys.cpp --- world/CMakeLists.txt | 1 - world/world_logsys.cpp | 59 ------------------------------------------ 2 files changed, 60 deletions(-) delete mode 100644 world/world_logsys.cpp diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index a9dd63478..fa13aef5d 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -25,7 +25,6 @@ SET(world_sources queryserv.cpp ucs.cpp wguild_mgr.cpp - world_logsys.cpp world_config.cpp worlddb.cpp zonelist.cpp diff --git a/world/world_logsys.cpp b/world/world_logsys.cpp deleted file mode 100644 index 3cfada073..000000000 --- a/world/world_logsys.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -#include "../common/debug.h" -#include "../common/logsys.h" -#include "../common/string_util.h" - -#include "zoneserver.h" -#include "client.h" - -#include -#include - - -void log_message_clientVA(LogType type, Client *who, const char *fmt, va_list args) { - - std::string prefix_buffer = StringFormat("[%s] %s: ", log_type_info[type].name, who->GetAccountName()); - - LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); -} - -void log_message_client(LogType type, Client *who, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - log_message_clientVA(type, who, fmt, args); - va_end(args); -} - -void log_message_zoneVA(LogType type, ZoneServer *who, const char *fmt, va_list args) { - - std::string prefix_buffer, zone_tag; - const char *zone_name=who->GetZoneName(); - - if (zone_name == nullptr) - zone_tag = StringFormat("[%d]", who->GetID()); - else - zone_tag = StringFormat("[%d] [%s]",who->GetID(),zone_name); - - prefix_buffer = StringFormat("[%s] %s ", log_type_info[type].name, zone_tag.c_str()); - - LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); -} - -void log_message_zone(LogType type, ZoneServer *who, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - log_message_zoneVA(type, who, fmt, args); - va_end(args); -} - - - - - - - - - - - - From b71f808cb87dc3f8518ee1c436b582485ed8480c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:43:11 -0600 Subject: [PATCH 1083/1883] Gut some more debug functions --- common/debug.cpp | 191 +---------------------------------------------- common/debug.h | 5 +- 2 files changed, 2 insertions(+), 194 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 7dbd28751..6f5426927 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -80,193 +80,4 @@ EQEmuLog::~EQEmuLog() fclose(fp[i]); } } -} - -bool EQEmuLog::open(LogIDs id) -{ - if (!logFileValid) { - return false; - } - if (id >= MaxLogID) { - return false; - } - LockMutex lock(&MOpen); - if (pLogStatus[id] & 4) { - return false; - } - if (fp[id]) { - //cerr<<"Warning: LogFile already open"<= MaxLogID) { - return false; - } - - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - - va_list argptr, tmpargptr; - va_start(argptr, fmt); - - // Log.Log(id, vStringFormat(fmt, argptr).c_str()); - - return true; -} - -//write with Prefix and a VA_list -bool EQEmuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) -{ - if (!logFileValid) { - return false; - } - if (id >= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - time_t aclock; - struct tm *newtime; - time( &aclock ); /* Get time in seconds */ - newtime = localtime( &aclock ); /* Convert time to struct */ - va_list tmpargptr; - if (dofile) { - #ifndef NO_PIDLOG - fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); - #else - fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix); - #endif - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "[%s] %s", LogNames[id], prefix); - vfprintf( stderr, fmt, argptr ); - } - /* Console Output */ - else { - - -#ifdef _WINDOWS - HANDLE console_handle; - console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_FONT_INFOEX info = { 0 }; - info.cbSize = sizeof(info); - info.dwFontSize.Y = 12; // leave X as zero - info.FontWeight = FW_NORMAL; - wcscpy(info.FaceName, L"Lucida Console"); - SetCurrentConsoleFontEx(console_handle, NULL, &info); - - if (id == EQEmuLog::LogIDs::Status){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Error){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } - if (id == EQEmuLog::LogIDs::Normal){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightGreen); } - if (id == EQEmuLog::LogIDs::Debug){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::Yellow); } - if (id == EQEmuLog::LogIDs::Quest){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightCyan); } - if (id == EQEmuLog::LogIDs::Commands){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightMagenta); } - if (id == EQEmuLog::LogIDs::Crash){ SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::LightRed); } -#endif - - fprintf(stdout, "[%s] %s", LogNames[id], prefix); - vfprintf(stdout, fmt, argptr); - -#ifdef _WINDOWS - /* Always set back to white*/ - SetConsoleTextAttribute(console_handle, ConsoleColor::Colors::White); -#endif - } - } - va_end(argptr); - if (dofile) { - fprintf(fp[id], "\n"); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - fprintf(stderr, "\n"); - } else { - fprintf(stdout, "\n"); - } - } - if (dofile) { - fflush(fp[id]); - } - return true; -} - -bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) -{ - va_list argptr, tmpargptr; - va_start(argptr, fmt); - if (dofile) { - va_copy(tmpargptr, argptr); - vfprintf( fp[id], fmt, tmpargptr ); - } - if (pLogStatus[id] & 2) { - if (pLogStatus[id] & 8) { - vfprintf( stderr, fmt, argptr ); - } else { - vfprintf( stdout, fmt, argptr ); - } - } - va_end(argptr); - return true; -}; \ No newline at end of file +} \ No newline at end of file diff --git a/common/debug.h b/common/debug.h index 5c32eadce..0a1ab0fc3 100644 --- a/common/debug.h +++ b/common/debug.h @@ -91,11 +91,8 @@ public: MaxLogID /* Max, used in functions to get the max log ID */ }; - bool write(LogIDs id, const char *fmt, ...); - bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); + private: - bool open(LogIDs id); - bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline Mutex MOpen; Mutex MLog[MaxLogID]; From e5f641d6b22ca11175c5b9c682d2b0b35e31bb6c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:45:18 -0600 Subject: [PATCH 1084/1883] Delete logsys_eqemu.cpp --- common/CMakeLists.txt | 1 - common/logsys_eqemu.cpp | 40 ---------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 common/logsys_eqemu.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 2a98f5cfb..f42288aae 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -33,7 +33,6 @@ SET(common_sources ipc_mutex.cpp item.cpp logsys.cpp - logsys_eqemu.cpp md5.cpp memory_mapped_file.cpp misc.cpp diff --git a/common/logsys_eqemu.cpp b/common/logsys_eqemu.cpp deleted file mode 100644 index f91de2cea..000000000 --- a/common/logsys_eqemu.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 -*/ - -#include "debug.h" -#include "logsys.h" -#include "string_util.h" - -#include -#include - -#include - -void log_message(LogType type, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - log_messageVA(type, fmt, args); - va_end(args); -} - -void log_messageVA(LogType type, const char *fmt, va_list args) { - std::string prefix_buffer = StringFormat("[%s] ", log_type_info[type].name); - - LogFile->writePVA(EQEmuLog::Debug, prefix_buffer.c_str(), fmt, args); -} - From 9eb05ff9991a3db1f60d5d084def61847d260ffa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:46:34 -0600 Subject: [PATCH 1085/1883] Delete zone/zone_logsys.cpp --- zone/CMakeLists.txt | 1 - zone/zone_logsys.cpp | 68 -------------------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 zone/zone_logsys.cpp diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 8cd086405..5da25e64f 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -116,7 +116,6 @@ SET(zone_sources waypoints.cpp worldserver.cpp zone.cpp - zone_logsys.cpp zone_config.cpp zonedb.cpp zoning.cpp diff --git a/zone/zone_logsys.cpp b/zone/zone_logsys.cpp deleted file mode 100644 index 10d563de7..000000000 --- a/zone/zone_logsys.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 -*/ - -#include "../common/debug.h" -#include "../common/logsys.h" -#include "../common/base_packet.h" - -#include "mob.h" - -#include - -void log_message_mob(LogType type, Mob *who, const char *fmt, ...) { - // if(!who->IsLoggingEnabled()) - // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common - - char prefix_buffer[256]; - snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetName()); - prefix_buffer[255] = '\0'; - - va_list args; - va_start(args, fmt); - LogFile->writePVA(EQEmuLog::Debug, prefix_buffer, fmt, args); - va_end(args); -} - -void log_message_mobVA(LogType type, Mob *who, const char *fmt, va_list args) { - // if(!who->IsLoggingEnabled()) - // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common - - char prefix_buffer[256]; - snprintf(prefix_buffer, 255, "[%s] %s: ", log_type_info[type].name, who->GetName()); - prefix_buffer[255] = '\0'; - - LogFile->writePVA(EQEmuLog::Debug, prefix_buffer, fmt, args); -} - -void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length, uint8 padding) { - // if(!who->IsLoggingEnabled()) - // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common - - log_hex(type,data,length,padding); -} - -void log_packet_mob(LogType type, Mob *who, const BasePacket *p) { - // if(!who->IsLoggingEnabled()) - // return; //could prolly put this in the macro, but it feels even dirtier than prototyping this in common - - char buffer[80]; - p->build_header_dump(buffer); - log_message(type,"[%s] %s: %s", log_type_info[type].name, who->GetName(), buffer); - log_hex(type,(const char *)p->pBuffer,p->size); -} - From a0d012a6d64226a58ec9323c16fc45e2e6c731ee Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:48:51 -0800 Subject: [PATCH 1086/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 5f75fb81b..66cf41b21 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1812,7 +1812,7 @@ void NPC::AI_DoMovement() { ClearFeignMemory(); moved=false; SetMoving(false); - if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 ) + if (GetTarget() == nullptr || ComparativeDistance(m_Position, GetTarget()->GetPosition()) >= 5*5 ) { SetHeading(m_GuardPoint.m_Heading); } else { From 9dcdd9354988c74c649419ba77fba70c2cb507e4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:51:25 -0800 Subject: [PATCH 1087/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index b01d169fd..efd312bbf 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -489,7 +489,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) else if(members[x].member != nullptr) { if(members[x].GroupNumber == gid){ - distance = caster->DistNoRoot(*members[x].member); + distance = ComparativeDistance(caster->GetPosition(), members[x].member->GetPosition()); if(distance <= range2){ caster->SpellOnTarget(spellid, members[x].member); #ifdef GROUP_BUFF_PETS From f81a8b716b532597272d8ee7a26f00e53ba8b6cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:52:32 -0600 Subject: [PATCH 1088/1883] Rip out load_log_settings in all projects --- client_files/export/main.cpp | 3 --- client_files/import/main.cpp | 3 --- common/logsys.cpp | 13 +++++++++---- common/logsys.h | 4 +--- queryserv/queryserv.cpp | 6 ------ shared_memory/main.cpp | 3 --- ucs/ucs.cpp | 5 ----- world/net.cpp | 6 ------ zone/net.cpp | 9 --------- 9 files changed, 10 insertions(+), 42 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 5152cf008..45dd34cec 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -45,9 +45,6 @@ int main(int argc, char **argv) { } const EQEmuConfig *config = EQEmuConfig::get(); - if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); - } SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index f390d2b0b..8567723ce 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -43,9 +43,6 @@ int main(int argc, char **argv) { } const EQEmuConfig *config = EQEmuConfig::get(); - if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); - } SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/common/logsys.cpp b/common/logsys.cpp index c01baf04e..f1fa6ed53 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -16,6 +16,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + #include "debug.h" #include "eq_packet.h" #include "logsys.h" @@ -37,8 +39,9 @@ const char *log_category_names[NUMBER_OF_LOG_CATEGORIES] = { static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = { #include "logtypes.h" - { false, NUMBER_OF_LOG_CATEGORIES, "BAD TYPE" } /* dummy trailing record */ + { false, NUMBER_OF_LOG_CATEGORIES, "BAD TYPE" } /* dummy trailing record }; + const LogTypeStatus *log_type_info = real_log_type_info; @@ -50,7 +53,7 @@ void log_hex(LogType type, const void *data, unsigned long length, unsigned char uint32 offset; for(offset=0;offsetbuild_header_dump(buffer); - log_message(type,"%s", buffer); + //log_message(type,"%s", buffer); log_hex(type,(const char *)p->pBuffer,p->size); } @@ -68,7 +71,7 @@ void log_raw_packet(LogType type, uint16 seq, const BasePacket *p) { return; char buffer[196]; p->build_raw_header_dump(buffer, seq); - log_message(type,buffer); + //log_message(type,buffer); log_hex(type,(const char *)p->pBuffer,p->size); } @@ -156,3 +159,5 @@ bool load_log_settings(const char *filename) { return(true); } + +*/ \ No newline at end of file diff --git a/common/logsys.h b/common/logsys.h index d65ecb928..8c2d7bd9f 100644 --- a/common/logsys.h +++ b/common/logsys.h @@ -65,8 +65,6 @@ extern const LogTypeStatus *log_type_info; // For log_packet, et all. class BasePacket; -extern void log_message(LogType type, const char *fmt, ...); -extern void log_messageVA(LogType type, const char *fmt, va_list args); extern void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding=4); extern void log_packet(LogType type, const BasePacket *p); extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); @@ -116,7 +114,7 @@ extern void log_toggle(LogType t); #define is_log_enabled( type ) \ log_type_info[ type ].enabled -extern bool load_log_settings(const char *filename); +// extern bool load_log_settings(const char *filename); #endif /*LOGSYS_H_*/ diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index f5233c29e..b67d8ad4f 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -87,12 +87,6 @@ int main() { return 1; } - /* Initialize Logging */ - if (!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(Logs::Detail, Logs::QS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); - else - Log.Out(Logs::Detail, Logs::QS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - if (signal(SIGINT, CatchSignal) == SIG_ERR) { Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); return 1; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index dc2817f9a..ddc42cbc3 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -47,9 +47,6 @@ int main(int argc, char **argv) { } const EQEmuConfig *config = EQEmuConfig::get(); - if(!load_log_settings(config->LogSettingsFile.c_str())) { - Log.Out(Logs::General, Logs::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str()); - } SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 241d50775..1bbb66c16 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -89,11 +89,6 @@ int main() { Config = ucsconfig::get(); - if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(Logs::Detail, Logs::UCS_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); - else - Log.Out(Logs::Detail, Logs::UCS_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - WorldShortName = Config->ShortName; Log.Out(Logs::Detail, Logs::UCS_Server, "Connecting to MySQL..."); diff --git a/world/net.cpp b/world/net.cpp index bab38026b..8914415a4 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -133,12 +133,6 @@ int main(int argc, char** argv) { } const WorldConfig *Config=WorldConfig::get(); - if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(Logs::Detail, Logs::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); - else - Log.Out(Logs::Detail, Logs::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - - Log.Out(Logs::Detail, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG diff --git a/zone/net.cpp b/zone/net.cpp index 987124ea1..a299da25a 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -155,11 +155,6 @@ int main(int argc, char** argv) { } const ZoneConfig *Config=ZoneConfig::get(); - if(!load_log_settings(Config->LogSettingsFile.c_str())) - Log.Out(Logs::Detail, Logs::Zone_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str()); - else - Log.Out(Logs::Detail, Logs::Zone_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str()); - worldserver.SetPassword(Config->SharedKey.c_str()); Log.Out(Logs::Detail, Logs::Zone_Server, "Connecting to MySQL..."); @@ -207,10 +202,6 @@ int main(int argc, char** argv) { #endif const char *log_ini_file = "./log.ini"; - if(!load_log_settings(log_ini_file)) - Log.Out(Logs::Detail, Logs::Zone_Server, "Warning: Unable to read %s", log_ini_file); - else - Log.Out(Logs::Detail, Logs::Zone_Server, "Log settings loaded from %s", log_ini_file); Log.Out(Logs::Detail, Logs::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); From 263c9b6d3f8621e09dd581ee4333f7260e2476ee Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:53:24 -0800 Subject: [PATCH 1089/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index efd312bbf..e0ee94e1f 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -537,7 +537,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ numMem += 1; } From 7fac4d5f524e16b67c12a093ffbb1da2d440b0f7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 02:56:51 -0600 Subject: [PATCH 1090/1883] More gutting of logsys.cpp/h --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1347fa2d5..785b464cd 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -398,7 +398,7 @@ void ClearMappedOpcode(EmuOpcode op) // client methods int Client::HandlePacket(const EQApplicationPacket *app) { - if(is_log_enabled(CLIENT__NET_IN_TRACE)) { + if(Log.log_settings[Logs::LogCategory::Netcode].log_to_console > 0) { char buffer[64]; app->build_header_dump(buffer); Log.Out(Logs::Detail, Logs::Client_Server_Packet, "Dispatch opcode: %s", buffer); From 469b27890b93f526cbcd5d1a33dddb975ed277a2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:57:34 -0800 Subject: [PATCH 1091/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index e0ee94e1f..4f197861a 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -551,7 +551,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ members[gi].member->SetHP(members[gi].member->GetHP() + heal_amt); members[gi].member->SendHPUpdate(); From 9bd4007fd61950a29545b56e3b77d76b2eead70b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:58:53 -0800 Subject: [PATCH 1092/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 4f197861a..eabb1876d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -581,7 +581,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ dmgtaken_tmp = members[gi].member->GetMaxHP() - members[gi].member->GetHP(); From dd52259dcf2284eb9480f62cedae888e3b98ccbe Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:00:00 -0800 Subject: [PATCH 1093/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index eabb1876d..df544520f 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -602,7 +602,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ if((members[gi].member->GetMaxHP() - dmgtaken) < 1){//this way the ability will never kill someone members[gi].member->SetHP(1); //but it will come darn close From a6ba08c5984ea470129bc54d29ac52098ca479f2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:01:44 -0800 Subject: [PATCH 1094/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index df544520f..a4769e775 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -637,7 +637,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3 if(members[gi].GroupNumber == gid) { if (members[gi].member->GetMaxMana() > 0) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ manataken_tmp = members[gi].member->GetMaxMana() - members[gi].member->GetMana(); From dd70ee13a3aeb7aa5754583da8752325c330ccf8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:04:37 -0800 Subject: [PATCH 1095/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index a4769e775..b81d1a3c6 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -660,7 +660,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ if((members[gi].member->GetMaxMana() - manataken) < 1){ members[gi].member->SetMana(1); From 3c1ee5970e9345e15460cecb9307bee18dd41923 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:07:35 -0800 Subject: [PATCH 1096/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index b81d1a3c6..3bed5af2e 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -791,7 +791,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ else if(members[z].member != nullptr) { if(members[z].GroupNumber == gid){ - distance = caster->DistNoRoot(*members[z].member); + distance = ComparativeDistance(caster->GetPosition(), members[z].member->GetPosition()); if(distance <= range2) { members[z].member->BardPulse(spellid, caster); #ifdef GROUP_BUFF_PETS From 5926c993be87175ad4095b87cd96bec9fc29d9d7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:09:21 -0800 Subject: [PATCH 1097/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 5255ff1f6..3c7bf8875 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -769,7 +769,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - float dist = DistNoRoot(*other); + float dist = ComparativeDistance(m_Position, other->GetPosition()); if(dist > range) { mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. From 72bad478d6fb2656e50ad2da9489040b487ab246 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:12:15 -0800 Subject: [PATCH 1098/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 3c7bf8875..8c03d5dbc 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1219,7 +1219,7 @@ void NPC::RangedAttack(Mob* other) min_range = static_cast(sa_min_range); max_range *= max_range; - if(DistNoRoot(*other) > max_range) + if(ComparativeDistance(m_Position, other->GetPosition()) > max_range) return; else if(DistNoRoot(*other) < (min_range * min_range)) return; From eac35f802aa111adcc4890450e034aeff99d681a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:17:17 -0800 Subject: [PATCH 1099/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 8c03d5dbc..0414ce493 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1221,7 +1221,7 @@ void NPC::RangedAttack(Mob* other) max_range *= max_range; if(ComparativeDistance(m_Position, other->GetPosition()) > max_range) return; - else if(DistNoRoot(*other) < (min_range * min_range)) + else if(ComparativeDistance(m_Position, other->GetPosition()) < (min_range * min_range)) return; if(!other || !IsAttackAllowed(other) || From 309240de43a1cd69b72e3c0cd9cc7662ee6b38fc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:18:20 -0800 Subject: [PATCH 1100/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 0414ce493..b3014c7d9 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1408,7 +1408,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 float range = item->Range + GetRangeDistTargetSizeMod(other); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - float dist = DistNoRoot(*other); + float dist = ComparativeDistance(m_Position, other->GetPosition()); if(dist > range) { mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. From 53ad34b0604df7bbdbbb51f0cc1f3e46eece44b7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:19:45 -0800 Subject: [PATCH 1101/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/spells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index a794d58a4..df3b286b3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2002,7 +2002,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } if(spell_target != nullptr && spell_target != this) { //casting a spell on somebody but ourself, make sure they are in range - float dist2 = DistNoRoot(*spell_target); + float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition()); float range2 = range * range; float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { From 94261700d96b0705f15854af59897aa2b05b686b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:21:19 -0800 Subject: [PATCH 1102/1883] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/spells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index df3b286b3..96a1f87dd 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2344,7 +2344,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { range = GetActSpellRange(spell_id, spells[spell_id].range, true); if(spell_target != nullptr && spell_target != this) { //casting a spell on somebody but ourself, make sure they are in range - float dist2 = DistNoRoot(*spell_target); + float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition()); float range2 = range * range; if(dist2 > range2) { //target is out of range. From 3ed365cd43ba1c318122c2ce64d8085e22ab0f65 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:22:59 -0800 Subject: [PATCH 1103/1883] Removed mob:DistNoRoot --- zone/mob.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 8b8a23747..91f1647b9 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,16 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRoot(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - float zDiff = other.m_Position.m_Z - m_Position.m_Z; - - return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoRootNoZ(float x, float y) const { float xDiff = x - m_Position.m_X; float yDiff = y - m_Position.m_Y; From b3bedef7af1cfc1c2a0995c9770019c537406647 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 03:23:36 -0600 Subject: [PATCH 1104/1883] Bunch of crazy changes to remove logsys --- common/eq_stream.cpp | 20 ++++++++++---------- common/eqemu_logsys.cpp | 20 ++++++++++++++++++++ common/eqemu_logsys.h | 2 ++ common/logsys.cpp | 11 +---------- common/logsys.h | 8 +++++--- common/patches/rof.cpp | 26 +++++++++++++------------- common/patches/rof2.cpp | 26 +++++++++++++------------- common/patches/sod.cpp | 18 +++++++++--------- common/patches/sof.cpp | 4 ++-- common/patches/ss_define.h | 8 ++++---- common/patches/underfoot.cpp | 18 +++++++++--------- 11 files changed, 88 insertions(+), 73 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index c409e275b..aa08070bb 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -93,7 +93,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p) { EQRawApplicationPacket *ap=nullptr; Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, p->size); - _raw(NET__APP_CREATE_HEX, 0xFFFF, p); + // _raw(NET__APP_CREATE_HEX, 0xFFFF, p); ap = p->MakeAppPacket(); return ap; } @@ -102,7 +102,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf { EQRawApplicationPacket *ap=nullptr; Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len); - _hex(NET__APP_CREATE_HEX, buf, len); + Log.Hex(Logs::Netcode, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; } @@ -133,7 +133,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { Log.Out(Logs::Detail, Logs::Netcode, _L "Session not initialized, packet ignored" __L); - _raw(NET__DEBUG, 0xFFFF, p); + // _raw(NET__DEBUG, 0xFFFF, p); return; } @@ -144,7 +144,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) subpacket_length=*(p->pBuffer+processed); EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length); Log.Out(Logs::Detail, Logs::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length); - _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); + // _raw(NET__NET_CREATE_HEX, 0xFFFF, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; @@ -185,7 +185,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); - _raw(NET__DEBUG, seq, p); + // _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size()); @@ -194,7 +194,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } else if (check == SeqPast) { Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); - _raw(NET__DEBUG, seq, p); + // _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); //we already got this packet but it was out of order } else { // In case we did queue one before as well. @@ -210,7 +210,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2); Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size); - _raw(NET__NET_CREATE_HEX, seq, subp); + // _raw(NET__NET_CREATE_HEX, seq, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; @@ -235,7 +235,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) SeqOrder check=CompareSequence(NextInSeq,seq); if (check == SeqFuture) { Log.Out(Logs::Detail, Logs::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); - _raw(NET__DEBUG, seq, p); + // _raw(NET__DEBUG, seq, p); PacketQueue[seq]=p->Copy(); Log.Out(Logs::Detail, Logs::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size()); @@ -244,7 +244,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } else if (check == SeqPast) { Log.Out(Logs::Detail, Logs::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq); - _raw(NET__DEBUG, seq, p); + // _raw(NET__DEBUG, seq, p); SendOutOfOrderAck(seq); } else { // In case we did queue one before as well. @@ -263,7 +263,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) { EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset); Log.Out(Logs::Detail, Logs::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size); - //_raw(NET__NET_CREATE_HEX, subp); + //// _raw(NET__NET_CREATE_HEX, subp); subp->copyInfo(p); ProcessPacket(subp); delete subp; diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 6f9611012..b8302fe20 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -18,9 +18,11 @@ #include "eqemu_logsys.h" +// #include "base_packet.h" #include "platform.h" #include "string_util.h" #include "database.h" +#include "misc.h" #include #include @@ -162,6 +164,24 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m #endif } +void EQEmuLogSys::Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding) { + return; + char buffer[80]; + uint32 offset; + for (offset = 0; offset < length; offset += 16) { + build_hex_line((const char *)data, length, offset, buffer, padding); + // log_message(type, "%s", buffer); //%s is to prevent % escapes in the ascii + } +} + +void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) { + return; + char buffer[196]; + p->build_raw_header_dump(buffer, seq); + //log_message(type,buffer); + EQEmuLogSys::Hex(log_category, (const char *)p->pBuffer, p->size); +} + void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d92fc25aa..5288128fc 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -129,6 +129,8 @@ public: void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); + void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding); + void Raw(uint16 log_category, uint16 seq, const BasePacket *p); struct LogSettings{ uint8 log_to_file; diff --git a/common/logsys.cpp b/common/logsys.cpp index f1fa6ed53..8e56ea9d7 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -46,16 +46,7 @@ const LogTypeStatus *log_type_info = real_log_type_info; -void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding) { - if(!is_log_enabled(type)) - return; - char buffer[80]; - uint32 offset; - for(offset=0;offset #include "types.h" @@ -70,7 +71,6 @@ extern void log_packet(LogType type, const BasePacket *p); extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); #ifndef DISABLE_LOGSYS -/* these are macros which do not use ..., and work for anybody */ #define _hex( type, data, len) \ do { \ if(log_type_info[ type ].enabled) { \ @@ -83,7 +83,7 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); log_packet(type, packet); \ } \ } while(false) - #define _raw( type, seq, packet) \ + #define // _raw( type, seq, packet) \ do { \ if(log_type_info[ type ].enabled) { \ log_raw_packet(type, seq, packet); \ @@ -93,7 +93,7 @@ extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); #else #define _hex( type, data, len) {} #define _pkt( type, packet) {} - #define _raw( type, seq, packet) {} + #define // _raw( type, seq, packet) {} #endif //!DISABLE_LOGSYS #ifdef ZONE class Mob; @@ -114,6 +114,8 @@ extern void log_toggle(LogType t); #define is_log_enabled( type ) \ log_type_info[ type ].enabled +*/ + // extern bool load_log_settings(const char *filename); #endif /*LOGSYS_H_*/ diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 33eac8c24..53b0e9fed 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -592,7 +592,7 @@ namespace RoF delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } @@ -986,7 +986,7 @@ namespace RoF structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); memcpy(ggs->name2, gjs->membername, sizeof(ggs->name2)); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; @@ -1062,7 +1062,7 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); @@ -1090,7 +1090,7 @@ namespace RoF GLAAus->NPCMarkerID = emu->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &emu->leader_aas, sizeof(GLAAus->LeaderAAs)); - //_hex(NET__ERROR, __packet->pBuffer, __packet->size); + //Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); FINISH_ENCODE(); @@ -2567,7 +2567,7 @@ namespace RoF outapp->WriteUInt32(outapp->size - 9); CRC32::SetEQChecksum(outapp->pBuffer, outapp->size - 1, 8); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); delete in; @@ -2809,7 +2809,7 @@ namespace RoF } } - _hex(NET__ERROR, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); + Log.Hex(Logs::Netcode, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); FINISH_ENCODE(); } @@ -3567,7 +3567,7 @@ namespace RoF VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; } @@ -3905,7 +3905,7 @@ namespace RoF Log.Out(Logs::General, Logs::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4299,7 +4299,7 @@ namespace RoF { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4313,7 +4313,7 @@ namespace RoF { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4327,7 +4327,7 @@ namespace RoF { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4341,7 +4341,7 @@ namespace RoF { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4503,7 +4503,7 @@ namespace RoF emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); - _hex(NET__ERROR, eq, sizeof(structs::MoveItem_Struct)); + Log.Hex(Logs::Netcode, eq, sizeof(structs::MoveItem_Struct)); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 7421eefbd..d376bfb5e 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -658,7 +658,7 @@ namespace RoF2 delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } @@ -1052,7 +1052,7 @@ namespace RoF2 structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); memcpy(ggs->name2, gjs->membername, sizeof(ggs->name2)); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; @@ -1128,7 +1128,7 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); @@ -1156,7 +1156,7 @@ namespace RoF2 GLAAus->NPCMarkerID = emu->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &emu->leader_aas, sizeof(GLAAus->LeaderAAs)); - //_hex(NET__ERROR, __packet->pBuffer, __packet->size); + //Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); FINISH_ENCODE(); @@ -2651,7 +2651,7 @@ namespace RoF2 outapp->WriteUInt32(outapp->size - 9); CRC32::SetEQChecksum(outapp->pBuffer, outapp->size - 1, 8); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); delete in; @@ -2893,7 +2893,7 @@ namespace RoF2 } } - _hex(NET__ERROR, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); + Log.Hex(Logs::Netcode, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); FINISH_ENCODE(); } @@ -3634,7 +3634,7 @@ namespace RoF2 VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; } @@ -3976,7 +3976,7 @@ namespace RoF2 Log.Out(Logs::General, Logs::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize)); } //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp, ack_req); } @@ -4371,7 +4371,7 @@ namespace RoF2 { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -4385,7 +4385,7 @@ namespace RoF2 { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4399,7 +4399,7 @@ namespace RoF2 { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -4413,7 +4413,7 @@ namespace RoF2 { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); @@ -4574,7 +4574,7 @@ namespace RoF2 emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); - _hex(NET__ERROR, eq, sizeof(structs::MoveItem_Struct)); + Log.Hex(Logs::Netcode, eq, sizeof(structs::MoveItem_Struct)); FINISH_DIRECT_DECODE(); } diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index a19c4c45d..1639e57ed 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -398,7 +398,7 @@ namespace SoD delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } @@ -717,7 +717,7 @@ namespace SoD structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); memcpy(ggs->name2, gjs->membername, sizeof(ggs->name2)); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; @@ -792,7 +792,7 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); @@ -819,7 +819,7 @@ namespace SoD GLAAus->NPCMarkerID = emu->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &emu->leader_aas, sizeof(GLAAus->LeaderAAs)); - //_hex(NET__ERROR, __packet->pBuffer, __packet->size); + //Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); FINISH_ENCODE(); @@ -2288,7 +2288,7 @@ namespace SoD VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; } @@ -2964,7 +2964,7 @@ namespace SoD { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -2978,7 +2978,7 @@ namespace SoD { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -2992,7 +2992,7 @@ namespace SoD { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3006,7 +3006,7 @@ namespace SoD { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index e6f804c66..2e5776a5d 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -378,7 +378,7 @@ namespace SoF delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } @@ -2097,7 +2097,7 @@ namespace SoF delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending zone spawns"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index 97f824983..1d59287ad 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -65,7 +65,7 @@ #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ - _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ + Log.Hex(Logs::Netcode, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ return; \ @@ -73,7 +73,7 @@ #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ - _hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \ + Log.Hex(Logs::Netcode, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ return; \ @@ -128,14 +128,14 @@ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ - _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ + Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ - _hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \ + Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); \ return; \ } diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 8ef3f8fb7..66b379840 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -533,7 +533,7 @@ namespace Underfoot delete[] __emu_buffer; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Sending inventory to client"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); dest->FastQueuePacket(&in, ack_req); } @@ -874,7 +874,7 @@ namespace Underfoot structs::GroupGeneric_Struct *ggs = (structs::GroupGeneric_Struct*)outapp->pBuffer; memcpy(ggs->name1, gjs->yourname, sizeof(ggs->name1)); memcpy(ggs->name2, gjs->membername, sizeof(ggs->name2)); - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; @@ -950,7 +950,7 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint16, Buffer, 0); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); outapp = new EQApplicationPacket(OP_GroupLeadershipAAUpdate, sizeof(GroupLeadershipAAUpdate_Struct)); @@ -976,7 +976,7 @@ namespace Underfoot GLAAus->NPCMarkerID = emu->NPCMarkerID; memcpy(&GLAAus->LeaderAAs, &emu->leader_aas, sizeof(GLAAus->LeaderAAs)); - //_hex(NET__ERROR, __packet->pBuffer, __packet->size); + //Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); FINISH_ENCODE(); @@ -2554,7 +2554,7 @@ namespace Underfoot VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, x); } - //_hex(NET__ERROR, outapp->pBuffer, outapp->size); + //Log.Hex(Logs::Netcode, outapp->pBuffer, outapp->size); dest->FastQueuePacket(&outapp); delete in; } @@ -3277,7 +3277,7 @@ namespace Underfoot { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_Disband"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupGeneric_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupGeneric_Struct); @@ -3291,7 +3291,7 @@ namespace Underfoot { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3305,7 +3305,7 @@ namespace Underfoot { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupFollow2"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupFollow_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupFollow_Struct); @@ -3319,7 +3319,7 @@ namespace Underfoot { //EQApplicationPacket *in = __packet; //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Received incoming OP_GroupInvite"); - //_hex(NET__ERROR, in->pBuffer, in->size); + //Log.Hex(Logs::Netcode, in->pBuffer, in->size); DECODE_LENGTH_EXACT(structs::GroupInvite_Struct); SETUP_DIRECT_DECODE(GroupGeneric_Struct, structs::GroupInvite_Struct); From 14bac9f8c03437a60687ea164270ee25145994c3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 03:25:52 -0600 Subject: [PATCH 1105/1883] Remove occurrences of _pkt --- ucs/clientlist.cpp | 19 ------------------- ucs/database.cpp | 3 --- world/client.cpp | 3 --- zone/client_packet.cpp | 18 ------------------ zone/spells.cpp | 1 - zone/tasks.cpp | 11 ----------- zone/trading.cpp | 22 ---------------------- zone/worldserver.cpp | 1 - 8 files changed, 78 deletions(-) diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index e665cc8fd..a518aa1a8 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -323,7 +323,6 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { VARSTRUCT_ENCODE_TYPE(uint16, PacketBuffer, 0x3237); VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x0); - _pkt(UCS__PACKETS, outapp); c->QueuePacket(outapp); @@ -344,7 +343,6 @@ static void ProcessMailTo(Client *c, std::string MailMessage) { VARSTRUCT_ENCODE_STRING(PacketBuffer, "test"); // Doesn't matter what we send in this text field. VARSTRUCT_ENCODE_STRING(PacketBuffer, "1"); - _pkt(UCS__PACKETS, outapp); c->QueuePacket(outapp); @@ -421,7 +419,6 @@ static void ProcessCommandBuddy(Client *c, std::string Buddy) { database.RemoveFriendOrIgnore(c->GetCharID(), 1, Buddy.substr(1)); } - _pkt(UCS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -465,7 +462,6 @@ static void ProcessCommandIgnore(Client *c, std::string Ignoree) { VARSTRUCT_ENCODE_STRING(PacketBuffer, Ignoree.c_str()); - _pkt(UCS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -626,7 +622,6 @@ void Clientlist::Process() { while( KeyValid && !(*Iterator)->GetForceDisconnect() && (app = (EQApplicationPacket *)(*Iterator)->ClientStream->PopPacket())) { - _pkt(UCS__PACKETS, app); EmuOpcode opcode = app->GetOpcode(); @@ -943,7 +938,6 @@ void Client::SendMailBoxes() { VARSTRUCT_ENCODE_STRING(PacketBuffer, s.c_str()); VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1087,7 +1081,6 @@ void Client::JoinChannels(std::string ChannelNameList) { sprintf(PacketBuffer, "%s", JoinedChannelsList.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1104,7 +1097,6 @@ void Client::JoinChannels(std::string ChannelNameList) { VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); VARSTRUCT_ENCODE_STRING(PacketBuffer, ChannelMessage.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1174,7 +1166,6 @@ void Client::LeaveChannels(std::string ChannelNameList) { sprintf(PacketBuffer, "%s", JoinedChannelsList.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1191,7 +1182,6 @@ void Client::LeaveChannels(std::string ChannelNameList) { VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); VARSTRUCT_ENCODE_STRING(PacketBuffer, ChannelMessage.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1275,7 +1265,6 @@ void Client::SendChannelList() { VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); VARSTRUCT_ENCODE_STRING(PacketBuffer, ChannelMessage.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1516,7 +1505,6 @@ void Client::SendChannelMessage(std::string ChannelName, std::string Message, Cl if(UnderfootOrLater) VARSTRUCT_ENCODE_STRING(PacketBuffer, "SPAM:0:"); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); safe_delete(outapp); @@ -1554,7 +1542,6 @@ void Client::AnnounceJoin(ChatChannel *Channel, Client *c) { VARSTRUCT_ENCODE_STRING(PacketBuffer, Channel->GetName().c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, c->GetName().c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1574,7 +1561,6 @@ void Client::AnnounceLeave(ChatChannel *Channel, Client *c) { VARSTRUCT_ENCODE_STRING(PacketBuffer, Channel->GetName().c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, c->GetName().c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -1599,7 +1585,6 @@ void Client::GeneralChannelMessage(std::string Message) { VARSTRUCT_ENCODE_TYPE(uint8, PacketBuffer, 0x00); VARSTRUCT_ENCODE_STRING(PacketBuffer, Message.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); safe_delete(outapp); @@ -2290,7 +2275,6 @@ void Client::SendNotification(int MailBoxNumber, std::string Subject, std::strin VARSTRUCT_ENCODE_STRING(PacketBuffer, From.c_str()); VARSTRUCT_ENCODE_STRING(PacketBuffer, Subject.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -2311,7 +2295,6 @@ void Client::ChangeMailBox(int NewMailBox) { VARSTRUCT_ENCODE_INTSTRING(buf, NewMailBox); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -2340,7 +2323,6 @@ void Client::SendFriends() { VARSTRUCT_ENCODE_STRING(PacketBuffer, (*Iterator).c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); @@ -2363,7 +2345,6 @@ void Client::SendFriends() { VARSTRUCT_ENCODE_STRING(PacketBuffer, Ignoree.c_str()); - _pkt(UCS__PACKETS, outapp); QueuePacket(outapp); diff --git a/ucs/database.cpp b/ucs/database.cpp index cb7bd3d51..dee5072fb 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -331,7 +331,6 @@ void Database::SendHeaders(Client *client) { VARSTRUCT_ENCODE_INTSTRING(packetBuffer, unknownField3); VARSTRUCT_ENCODE_INTSTRING(packetBuffer, results.RowCount()); - _pkt(UCS__PACKETS, outapp); client->QueuePacket(outapp); @@ -369,7 +368,6 @@ void Database::SendHeaders(Client *client) { VARSTRUCT_ENCODE_STRING(packetBuffer, row[2]); VARSTRUCT_ENCODE_STRING(packetBuffer, row[3]); - _pkt(UCS__PACKETS, outapp); client->QueuePacket(outapp); @@ -419,7 +417,6 @@ void Database::SendBody(Client *client, int messageNumber) { packetBuffer--; // Overwrite the null terminator VARSTRUCT_ENCODE_TYPE(uint8, packetBuffer, 0x0a); - _pkt(UCS__PACKETS, outapp); client->QueuePacket(outapp); diff --git a/world/client.cpp b/world/client.cpp index bcf709373..9b92b668e 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -916,7 +916,6 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { EmuOpcode opcode = app->GetOpcode(); Log.Out(Logs::Detail, Logs::World_Server,"Recevied EQApplicationPacket"); - _pkt(WORLD__CLIENT_TRACE,app); if (!eqs->CheckState(ESTABLISHED)) { Log.Out(Logs::Detail, Logs::World_Server,"Client disconnected (net inactive on send)"); @@ -1006,7 +1005,6 @@ bool Client::HandlePacket(const EQApplicationPacket *app) { default: { Log.Out(Logs::Detail, Logs::World_Server,"Received unknown EQApplicationPacket"); - _pkt(WORLD__CLIENT_ERR,app); return true; } } @@ -1257,7 +1255,6 @@ bool Client::GenPassKey(char* key) { void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req) { Log.Out(Logs::Detail, Logs::World_Server, "Sending EQApplicationPacket OpCode 0x%04x",app->GetOpcode()); - _pkt(WORLD__CLIENT_TRACE, app); ack_req = true; // It's broke right now, dont delete this line till fix it. =P eqs->QueuePacket(app, ack_req); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 785b464cd..20f58cc12 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3436,7 +3436,6 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) // uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buf); - _pkt(TRADING__BARTER, app); switch (Action) { @@ -3606,7 +3605,6 @@ void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) void Client::Handle_OP_BazaarSearch(const EQApplicationPacket *app) { - _pkt(TRADING__PACKETS, app); if (app->size == sizeof(BazaarSearch_Struct)) { @@ -9798,7 +9796,6 @@ void Client::Handle_OP_OpenContainer(const EQApplicationPacket *app) void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_OpenGuildTributeMaster of length %d", app->size); - _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) printf("Error in OP_OpenGuildTributeMaster. Expected size of: %zu, but got: %i\n", sizeof(StartTribute_Struct), app->size); @@ -9830,7 +9827,6 @@ void Client::Handle_OP_OpenInventory(const EQApplicationPacket *app) void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_OpenTributeMaster of length %d", app->size); - _pkt(TRIBUTE__IN, app); if (app->size != sizeof(StartTribute_Struct)) printf("Error in OP_OpenTributeMaster. Expected size of: %zu, but got: %i\n", sizeof(StartTribute_Struct), app->size); @@ -11700,7 +11696,6 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) Log.Out(Logs::Detail, Logs::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); - _pkt(SPELLS__REZ, app); OPRezzAnswer(ra->action, ra->spellid, ra->zone_id, ra->instance_id, ra->x, ra->y, ra->z); @@ -11766,7 +11761,6 @@ void Client::Handle_OP_SaveOnZoneReq(const EQApplicationPacket *app) void Client::Handle_OP_SelectTribute(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_SelectTribute of length %d", app->size); - _pkt(TRIBUTE__IN, app); //we should enforce being near a real tribute master to change this //but im not sure how I wanna do that right now. @@ -13391,7 +13385,6 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) // SoF sends 1 or more unhandled OP_Trader packets of size 96 when a trade has completed. // I don't know what they are for (yet), but it doesn't seem to matter that we ignore them. - _pkt(TRADING__PACKETS, app); uint32 max_items = 80; @@ -13498,7 +13491,6 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) TraderStatus_Struct* tss = (TraderStatus_Struct*)outapp->pBuffer; tss->Code = BazaarTrader_StartTraderMode2; QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); } } @@ -13539,7 +13531,6 @@ void Client::Handle_OP_TraderBuy(const EQApplicationPacket *app) // // Client has elected to buy an item from a Trader // - _pkt(TRADING__PACKETS, app); if (app->size == sizeof(TraderBuy_Struct)){ @@ -13622,7 +13613,6 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) // This is when a potential purchaser right clicks on this client who is in Trader mode to // browse their goods. // - _pkt(TRADING__PACKETS, app); TraderClick_Struct* tcs = (TraderClick_Struct*)app->pBuffer; @@ -13653,7 +13643,6 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); if (outtcs->Approval) { this->BulkSendTraderInventory(Customer->CharacterID()); @@ -13740,7 +13729,6 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeItem of length %d", app->size); - _pkt(TRIBUTE__IN, app); //player donates an item... if (app->size != sizeof(TributeItem_Struct)) @@ -13759,7 +13747,6 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) t->tribute_points = TributeItem(t->slot, t->quantity); Log.Out(Logs::Detail, Logs::Tribute, "Sending tribute item reply with %d points", t->tribute_points); - _pkt(TRIBUTE__OUT, app); QueuePacket(app); } @@ -13769,7 +13756,6 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeMoney of length %d", app->size); - _pkt(TRIBUTE__IN, app); //player donates money if (app->size != sizeof(TributeMoney_Struct)) @@ -13788,7 +13774,6 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) t->tribute_points = TributeMoney(t->platinum); Log.Out(Logs::Detail, Logs::Tribute, "Sending tribute money reply with %d points", t->tribute_points); - _pkt(TRIBUTE__OUT, app); QueuePacket(app); } @@ -13798,7 +13783,6 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeNPC of length %d", app->size); - _pkt(TRIBUTE__IN, app); return; } @@ -13806,7 +13790,6 @@ void Client::Handle_OP_TributeNPC(const EQApplicationPacket *app) void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeToggle of length %d", app->size); - _pkt(TRIBUTE__IN, app); if (app->size != sizeof(uint32)) Log.Out(Logs::General, Logs::Error, "Invalid size on OP_TributeToggle packet"); @@ -13820,7 +13803,6 @@ void Client::Handle_OP_TributeToggle(const EQApplicationPacket *app) void Client::Handle_OP_TributeUpdate(const EQApplicationPacket *app) { Log.Out(Logs::Detail, Logs::Tribute, "Received OP_TributeUpdate of length %d", app->size); - _pkt(TRIBUTE__IN, app); //sent when the client changes their tribute settings... if (app->size != sizeof(TributeInfo_Struct)) diff --git a/zone/spells.cpp b/zone/spells.cpp index ddee8f965..a9bc59f15 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3865,7 +3865,6 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster) rezz->unknown088 = 0x00000000; // We send this to world, because it needs to go to the player who may not be in this zone. worldserver.RezzPlayer(outapp, rez_experience, corpse_db_id, OP_RezzRequest); - _pkt(SPELLS__REZ, outapp); safe_delete(outapp); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 47155d62f..e20e71f4c 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1097,7 +1097,6 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task Ptr = Ptr + strlen(Ptr) + 1; } - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -1197,7 +1196,6 @@ void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *T outapp->WriteString("Text3 Test"); outapp->WriteString(StartZone); // Zone number in ascii } - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2346,7 +2344,6 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) { } } - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2375,7 +2372,6 @@ void Client::SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, //tac->unknown5 = 0x00000001; tac->unknown5 = TaskIncomplete; - _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); safe_delete(outapp); @@ -2407,7 +2403,6 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) { tac->unknown5 = 0; // 0 for task complete or failed. Log.Out(Logs::General, Logs::Tasks, "[UPDATE] TaskFailed"); - _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); safe_delete(outapp); @@ -2464,7 +2459,6 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State) buf = buf + 4; } - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2506,7 +2500,6 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i tass->ActivityType = 0xffffffff; tass->unknown4 = 0x00000000; - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2594,7 +2587,6 @@ void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, in tat->unknown1 = 0x00000001; - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2673,7 +2665,6 @@ void TaskManager::SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int outapp->WriteString(itoa(Tasks[TaskID]->Activity[ActivityID].ZoneID)); - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2856,7 +2847,6 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN tdt = (TaskDescriptionTrailer_Struct*)Ptr; tdt->Points = 0x00000000; // Points Count - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); @@ -2920,7 +2910,6 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, bool RemoveFromD cts->unknown4 = 0x00000002; Log.Out(Logs::General, Logs::Tasks, "[UPDATE] CancelTask"); - _pkt(TASKS__PACKETS, outapp); c->QueuePacket(outapp); safe_delete(outapp); diff --git a/zone/trading.cpp b/zone/trading.cpp index d87483199..0fd36ad37 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1002,7 +1002,6 @@ void Client::Trader_ShowItems(){ outints->Code = BazaarTrader_ShowItems; QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); safe_delete(TraderItems); } @@ -1026,7 +1025,6 @@ void Client::SendTraderPacket(Client* Trader, uint32 Unknown72) QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); } @@ -1059,7 +1057,6 @@ void Client::Trader_StartTrader() { QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); @@ -1077,7 +1074,6 @@ void Client::Trader_StartTrader() { entity_list.QueueClients(this, outapp, false); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); } @@ -1129,7 +1125,6 @@ void Client::Trader_EndTrader() { entity_list.QueueClients(this, outapp, false); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); @@ -1143,7 +1138,6 @@ void Client::Trader_EndTrader() { QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); @@ -1325,7 +1319,6 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu tdis->ItemID = SerialNumber; tdis->Unknown012 = 0; - _pkt(TRADING__PACKETS, outapp); Customer->QueuePacket(outapp); safe_delete(outapp); @@ -1355,7 +1348,6 @@ void Client::NukeTraderItem(uint16 Slot,int16 Charges,uint16 Quantity,Client* Cu Quantity = 1; for(int i = 0; i < Quantity; i++) { - _pkt(TRADING__PACKETS, outapp2); this->QueuePacket(outapp2); } @@ -1609,7 +1601,6 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat Trader->QueuePacket(outapp2); - _pkt(TRADING__PACKETS, outapp2); if(RuleB(Bazaar, AuditTrail)) BazaarAuditTrail(Trader->GetName(), GetName(), BuyItem->GetItem()->Name, outtbs->Quantity, outtbs->Price, 0); @@ -1618,7 +1609,6 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs,Client* Trader,const EQApplicat Trader->QueuePacket(outapp); - _pkt(TRADING__PACKETS, outapp); safe_delete(outapp); safe_delete(outapp2); @@ -1858,7 +1848,6 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint brds->Unknown012 = 0xFFFFFFFF; brds->Unknown016 = 0xFFFFFFFF; this->QueuePacket(outapp2); - _pkt(TRADING__PACKETS,outapp2); safe_delete(outapp2); return; } @@ -1926,7 +1915,6 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint this->QueuePacket(outapp); - _pkt(TRADING__PACKETS,outapp); safe_delete(outapp); safe_delete_array(buffer); @@ -1943,7 +1931,6 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint this->QueuePacket(outapp2); - _pkt(TRADING__PACKETS,outapp2); safe_delete(outapp2); } @@ -2021,7 +2008,6 @@ static void UpdateTraderCustomerPriceChanged(uint32 CustomerID, TraderCharges_St Log.Out(Logs::Detail, Logs::Trading, "Telling customer to remove item %i with %i charges and S/N %i", ItemID, Charges, gis->SerialNumber[i]); - _pkt(TRADING__PACKETS, outapp); Customer->QueuePacket(outapp); } @@ -2346,7 +2332,6 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { VARSTRUCT_ENCODE_TYPE(uint32, buf, 0); // Flag for + Items , probably ItemCount VARSTRUCT_ENCODE_STRING(buf, buyer->GetName()); // Seller Name - _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); safe_delete(outapp); @@ -2429,7 +2414,6 @@ void Client::ShowBuyLines(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); - _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); } } @@ -2679,7 +2663,6 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { sprintf(Buf, "%s", ItemName); Buf += 64; - _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); // This next packet goes to the Buyer and produces the 'You've bought from for ' @@ -2742,7 +2725,6 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); - _pkt(TRADING__BARTER, outapp3); QueuePacket(outapp3); safe_delete(outapp3); @@ -2774,7 +2756,6 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); VARSTRUCT_ENCODE_STRING(Buf, Buyer->GetName()); - _pkt(TRADING__BARTER, outapp4); Buyer->QueuePacket(outapp4); safe_delete(outapp4); @@ -2820,7 +2801,6 @@ void Client::ToggleBuyerMode(bool TurnOn) { entity_list.QueueClients(this, outapp, false); - _pkt(TRADING__BARTER, outapp); safe_delete(outapp); Buyer = TurnOn; @@ -2899,7 +2879,6 @@ void Client::UpdateBuyLine(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); VARSTRUCT_ENCODE_STRING(Buf, GetName()); - _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); safe_delete(outapp); } @@ -2954,7 +2933,6 @@ void Client::BuyerItemSearch(const EQApplicationPacket *app) { bisr->Action = Barter_BuyerSearch; bisr->ResultCount = Count; - _pkt(TRADING__BARTER, outapp); QueuePacket(outapp); safe_delete(outapp); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 225063ec1..468dc88c0 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -684,7 +684,6 @@ void WorldServer::Process() { sizeof(Resurrect_Struct)); memcpy(outapp->pBuffer, &srs->rez, sizeof(Resurrect_Struct)); client->QueuePacket(outapp); - _pkt(SPELLS__REZ, outapp); safe_delete(outapp); break; } From 121328b188a05d8b82fc8b1041e1e77cf7c618b9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:27:47 -0800 Subject: [PATCH 1106/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7326a9e42..8b632f43d 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3354,7 +3354,7 @@ void Bot::AI_Process() { if(GetHasBeenSummoned()) { if(IsBotCaster() || IsBotArcher()) { if (AImovement_timer->Check()) { - if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistNoRootNoZ(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y) < 10)) { + if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (ComparativeDistanceNoZ(static_cast(m_Position), m_PreSummonLocation) < 10)) { if(GetTarget()) FaceTarget(GetTarget()); SetHasBeenSummoned(false); From baf53890b91f1be5a9aac12f96846ee40a3b9250 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:31:24 -0800 Subject: [PATCH 1107/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 8bd986225..2436c28fe 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9182,7 +9182,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) { SetLooting(ent->GetID()); //store the entity we are looting Corpse *ent_corpse = ent->CastToCorpse(); - if (DistNoRootNoZ(ent_corpse->GetX(), ent_corpse->GetY()) > 625) + if (ComparativeDistanceNoZ(m_Position, ent_corpse->GetPosition()) > 625) { Message(13, "Corpse too far away."); Corpse::SendLootReqErrorPacket(this); From d9b3d5972997457a6535ba39a72c3841135136f5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:33:54 -0800 Subject: [PATCH 1108/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 66cf41b21..d552a89ea 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1129,7 +1129,7 @@ void Mob::AI_Process() { float tether_range = static_cast(GetSpecialAbilityParam(TETHER, 0)); tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > tether_range) { + if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > tether_range) { GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); } } else if(GetSpecialAbility(LEASH)) { From 8619a0b518ddb28e3b2af61d90341de3d42ff987 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:38:30 -0800 Subject: [PATCH 1109/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d552a89ea..9123b2f05 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1136,7 +1136,7 @@ void Mob::AI_Process() { float leash_range = static_cast(GetSpecialAbilityParam(LEASH, 0)); leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > leash_range) { + if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > leash_range) { GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); SetHP(GetMaxHP()); BuffFadeAll(); From 4431aa019742fa5d1910a7ed138ff91f75d1db36 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:39:17 -0800 Subject: [PATCH 1110/1883] Removed Mob::DistNoRootNoZ --- zone/mob.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 91f1647b9..57be8212b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,13 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRootNoZ(float x, float y) const { - float xDiff = x - m_Position.m_X; - float yDiff = y - m_Position.m_Y; - - return ( (xDiff * xDiff) + (yDiff * yDiff) ); -} - float Mob::DistNoRootNoZ(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; From 3290ddaffa7678d2518b5f91b7e4fc278f1ecfb9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:43:33 -0800 Subject: [PATCH 1111/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 8b632f43d..7a4d4d5ab 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3533,7 +3533,7 @@ void Bot::AI_Process() { return; } } - else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) { + else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize())) { // If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up float newX = 0; float newY = 0; From 4ced8833732a258b3cf4f07553a993987f492a3e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:51:36 -0800 Subject: [PATCH 1112/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7a4d4d5ab..14a808d1a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3865,7 +3865,7 @@ void Bot::PetAIProcess() { return; } } - else if(botPet->DistNoRootNoZ(*botPet->GetTarget()) < botPet->GetTarget()->GetSize()) { + else if(ComparativeDistanceNoZ(botPet->GetPosition(), botPet->GetTarget()->GetPosition()) < botPet->GetTarget()->GetSize()) { // Let's try to adjust our melee range so we don't appear to be bunched up bool isBehindMob = false; bool moveBehindMob = false; From 83906af9b68eeb2383caa06768ec8e8a059ea6fe Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 03:53:35 -0600 Subject: [PATCH 1113/1883] Buildable state with converting hex packet dumps --- common/eq_stream.cpp | 2 +- common/eqemu_logsys.cpp | 5 +++-- common/eqemu_logsys.h | 3 +-- common/logsys.cpp | 11 ++++++++++- world/launcher_link.cpp | 2 +- world/login_server.cpp | 2 +- world/zoneserver.cpp | 2 +- zone/worldserver.cpp | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index aa08070bb..cdb2e9d26 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -1112,7 +1112,7 @@ uint32 newlength=0; ProcessQueue(); } else { Log.Out(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L); - _hex(NET__NET_CREATE_HEX, buffer, length); + Log.Hex(Logs::Netcode, buffer, length); } } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index b8302fe20..e790e3830 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -24,6 +24,7 @@ #include "database.h" #include "misc.h" + #include #include #include @@ -173,7 +174,7 @@ void EQEmuLogSys::Hex(uint16 log_category, const void *data, unsigned long lengt // log_message(type, "%s", buffer); //%s is to prevent % escapes in the ascii } } - +/* void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) { return; char buffer[196]; @@ -181,7 +182,7 @@ void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) { //log_message(type,buffer); EQEmuLogSys::Hex(log_category, (const char *)p->pBuffer, p->size); } - +*/ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 5288128fc..57562b904 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -129,8 +129,7 @@ public: void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); - void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding); - void Raw(uint16 log_category, uint16 seq, const BasePacket *p); + void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding = 4); struct LogSettings{ uint8 log_to_file; diff --git a/common/logsys.cpp b/common/logsys.cpp index 8e56ea9d7..f1fa6ed53 100644 --- a/common/logsys.cpp +++ b/common/logsys.cpp @@ -46,7 +46,16 @@ const LogTypeStatus *log_type_info = real_log_type_info; -z +void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding) { + if(!is_log_enabled(type)) + return; + char buffer[80]; + uint32 offset; + for(offset=0;offsetPopPacket())) { - _hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size); + Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); if (!authenticated) { if (WorldConfig::get()->SharedKey.length() > 0) { if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) { diff --git a/world/login_server.cpp b/world/login_server.cpp index 0bec7cef3..20ca570c0 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -97,7 +97,7 @@ bool LoginServer::Process() { while((pack = tcpc->PopPacket())) { Log.Out(Logs::Detail, Logs::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); - _hex(WORLD__LS_TRACE,pack->pBuffer,pack->size); + Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); switch(pack->opcode) { case 0: diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 94b1e8853..85840cba4 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -177,7 +177,7 @@ bool ZoneServer::Process() { } ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - _hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size); + Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); if (!authenticated) { if (WorldConfig::get()->SharedKey.length() > 0) { if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) { diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 468dc88c0..2efaa5a98 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -141,7 +141,7 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { Log.Out(Logs::Detail, Logs::Zone_Server, "Got 0x%04x from world:", pack->opcode); - _hex(ZONE__WORLD_TRACE,pack->pBuffer,pack->size); + Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); switch(pack->opcode) { case 0: { break; From 0f1be1ecbf7b000b7abe58d65bd2a4925cd9c47b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:54:54 -0800 Subject: [PATCH 1114/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 14a808d1a..a1cf363d2 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10387,7 +10387,7 @@ bool Bot::IsArcheryRange(Mob *target) { range *= range; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); float minRuleDistance = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist); From a4e96b46ca3613d4880b039bee82030177c354ec Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 03:59:51 -0600 Subject: [PATCH 1115/1883] Delete logsys.cpp and logsys.h --- common/CMakeLists.txt | 2 - common/logsys.cpp | 163 ------------------------------------------ common/logsys.h | 122 ------------------------------- 3 files changed, 287 deletions(-) delete mode 100644 common/logsys.cpp delete mode 100644 common/logsys.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f42288aae..934a4b7b9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -32,7 +32,6 @@ SET(common_sources guilds.cpp ipc_mutex.cpp item.cpp - logsys.cpp md5.cpp memory_mapped_file.cpp misc.cpp @@ -145,7 +144,6 @@ SET(common_headers item_struct.h languages.h linked_list.h - logsys.h logtypes.h loottable.h mail_oplist.h diff --git a/common/logsys.cpp b/common/logsys.cpp deleted file mode 100644 index f1fa6ed53..000000000 --- a/common/logsys.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 -*/ - -/* - -#include "debug.h" -#include "eq_packet.h" -#include "logsys.h" -#include "misc.h" - -#include -#include -#include - - -#define LOG_CATEGORY(category) #category , -const char *log_category_names[NUMBER_OF_LOG_CATEGORIES] = { - #include "logtypes.h" -}; - - -//this array is private to this file, only a const version of it is exposed -#define LOG_TYPE(category, type, enabled) { enabled, LOG_ ##category, #category "__" #type }, -static LogTypeStatus real_log_type_info[NUMBER_OF_LOG_TYPES+1] = -{ - #include "logtypes.h" - { false, NUMBER_OF_LOG_CATEGORIES, "BAD TYPE" } /* dummy trailing record -}; - -const LogTypeStatus *log_type_info = real_log_type_info; - - - -void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding) { - if(!is_log_enabled(type)) - return; - char buffer[80]; - uint32 offset; - for(offset=0;offsetbuild_header_dump(buffer); - //log_message(type,"%s", buffer); - log_hex(type,(const char *)p->pBuffer,p->size); -} - -void log_raw_packet(LogType type, uint16 seq, const BasePacket *p) { - if(!is_log_enabled(type)) - return; - char buffer[196]; - p->build_raw_header_dump(buffer, seq); - //log_message(type,buffer); - log_hex(type,(const char *)p->pBuffer,p->size); -} - - -void log_enable(LogType t) { - real_log_type_info[t].enabled = true; -} - -void log_disable(LogType t) { - real_log_type_info[t].enabled = false; -} - -void log_toggle(LogType t) { - real_log_type_info[t].enabled = !real_log_type_info[t].enabled; -} - - -bool load_log_settings(const char *filename) { - //this is a terrible algorithm, but im lazy today - FILE *f = fopen(filename, "r"); - if(f == nullptr) - return(false); - char linebuf[512], type_name[256], value[256]; - while(!feof(f)) { - if(fgets(linebuf, 512, f) == nullptr) - continue; -#ifdef _WINDOWS - if (sscanf(linebuf, "%[^=]=%[^\n]\n", type_name, value) != 2) - continue; -#else - if (sscanf(linebuf, "%[^=]=%[^\r\n]\n", type_name, value) != 2) - continue; -#endif - - if(type_name[0] == '\0' || type_name[0] == '#') - continue; - - //first make sure we understand the value - bool enabled; - if(!strcasecmp(value, "on") || !strcasecmp(value, "true") || !strcasecmp(value, "yes") || !strcasecmp(value, "enabled") || !strcmp(value, "1")) - enabled = true; - else if(!strcasecmp(value, "off") || !strcasecmp(value, "false") || !strcasecmp(value, "no") || !strcasecmp(value, "disabled") || !strcmp(value, "0")) - enabled = false; - else { - printf("Unable to parse value '%s' from %s. Skipping line.", value, filename); - continue; - } - - int r; - //first see if it is a category name - for(r = 0; r < NUMBER_OF_LOG_CATEGORIES; r++) { - if(!strcasecmp(log_category_names[r], type_name)) - break; - } - if(r != NUMBER_OF_LOG_CATEGORIES) { - //matched a category. - int k; - for(k = 0; k < NUMBER_OF_LOG_TYPES; k++) { - if(log_type_info[k].category != r) - continue; //does not match this category. - if(enabled) - log_enable(LogType(k)); - else - log_disable(LogType(k)); - } - continue; - } - - for(r = 0; r < NUMBER_OF_LOG_TYPES; r++) { - if(!strcasecmp(log_type_info[r].name, type_name)) - break; - } - if(r == NUMBER_OF_LOG_TYPES) { - printf("Unable to locate log type %s from file %s. Skipping line.", type_name, filename); - continue; - } - - //got it all figured out, do something now... - if(enabled) - log_enable(LogType(r)); - else - log_disable(LogType(r)); - } - fclose(f); - return(true); -} - - -*/ \ No newline at end of file diff --git a/common/logsys.h b/common/logsys.h deleted file mode 100644 index ea6c06f08..000000000 --- a/common/logsys.h +++ /dev/null @@ -1,122 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 LOGSYS_H_ -#define LOGSYS_H_ - -/* -* -* Usage: -* -* These are the main functions provided by logsys: -* - _log(TYPE, fmt, ...) - Log a message in any context -* - mlog(TYPE, fmt, ...) - Zone only. Log a message from a Mob:: context, prefixing it with the mob's name. -* - clog(TYPE, fmt, ...) - World only. Log a message from a Client:: context, prefixing it with the client's account name. -* - zlog(TYPE, fmt, ...) - World only. Log a message from a ZoneServer:: context, prefixing it with the zones id/name or ip/port. -* - _hex(TYPE, data, length) - Log hex dump in any context. -* - mhex(TYPE, data, length) - Zone only. Log a hex dump from a Mob:: context, prefixing it with the mob's name -* - _pkt(TYPE, BasePacket *) - Log a packet hex dump with header in any context. -* - mhex(TYPE, data, length) - Zone only. Log a packet hex dump from a Mob:: context, prefixing it with the mob's name -* Types are defined in logtypes.h -* -* this is very C-ish, not C++ish, but thats how I felt like writting it -*/ - -/* -#include -#include "types.h" - -#define LOG_CATEGORY(category) LOG_ ##category , -typedef enum { - #include "logtypes.h" - NUMBER_OF_LOG_CATEGORIES -} LogCategory; - -#define LOG_TYPE(category, type, enabled) category##__##type , -typedef enum { - #include "logtypes.h" - NUMBER_OF_LOG_TYPES -} LogType; - -extern const char *log_category_names[NUMBER_OF_LOG_CATEGORIES]; - -typedef struct { - bool enabled; - LogCategory category; - const char *name; -} LogTypeStatus; - -//expose a read-only pointer -extern const LogTypeStatus *log_type_info; - -// For log_packet, et all. -class BasePacket; - -extern void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding=4); -extern void log_packet(LogType type, const BasePacket *p); -extern void log_raw_packet(LogType type, uint16 seq, const BasePacket *p); - -#ifndef DISABLE_LOGSYS - #define _hex( type, data, len) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_hex(type, (const char *)data, len); \ - } \ - } while(false) - #define _pkt( type, packet) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_packet(type, packet); \ - } \ - } while(false) - #define // _raw( type, seq, packet) \ - do { \ - if(log_type_info[ type ].enabled) { \ - log_raw_packet(type, seq, packet); \ - } \ - } while(false) - -#else - #define _hex( type, data, len) {} - #define _pkt( type, packet) {} - #define // _raw( type, seq, packet) {} -#endif //!DISABLE_LOGSYS -#ifdef ZONE - class Mob; - extern void log_hex_mob(LogType type, Mob *who, const char *data, uint32 length); - #define mhex( type, data, len) \ - do { \ - if(IsLoggingEnabled()) \ - if(log_type_info[ type ].enabled) { \ - log_hex_mob(type, this, data, len); \ - } \ - } while(false) -#endif - -extern void log_enable(LogType t); -extern void log_disable(LogType t); -extern void log_toggle(LogType t); - -#define is_log_enabled( type ) \ - log_type_info[ type ].enabled - -*/ - -// extern bool load_log_settings(const char *filename); - -#endif /*LOGSYS_H_*/ - From c6b306068796bdd183ee7fb580a941e9e619b6ce Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:01:20 -0800 Subject: [PATCH 1116/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index a1cf363d2..6e6201ee3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10411,7 +10411,7 @@ bool Bot::IsBotCasterCombatRange(Mob *target) { // half the max so the bot doesn't always stop at max range to allow combat movement range *= .5; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); if(targetDistance > range) result = false; From 4abe2fc6ffc4d965ea876b4a0ea20705f8a58151 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:03:44 -0800 Subject: [PATCH 1117/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/botspellsai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 68da92cae..c6c5e920c 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -1755,7 +1755,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - if(npc->DistNoRootNoZ(*botCaster) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) { + if(ComparativeDistanceNoZ(npc->GetPosition(), botCaster->GetPosition()) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) { if(!npc->IsMezzed()) { if(botCaster->HasGroup()) { Group* g = botCaster->GetGroup(); From b6587cc9e2a0f9f9d698eb602c76c5a842413e39 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 04:03:45 -0600 Subject: [PATCH 1118/1883] Removal of logsys.h from #include(s) --- common/debug.h | 2 +- common/eq_stream_ident.cpp | 2 +- common/guild_base.cpp | 2 +- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/titanium.cpp | 2 +- common/patches/underfoot.cpp | 2 +- common/rulesys.cpp | 2 +- common/spdat.cpp | 2 +- common/struct_strategy.cpp | 2 +- world/client.h | 2 +- world/eqw_http_handler.cpp | 2 +- world/eqw_parser.cpp | 2 +- world/launcher_link.cpp | 2 +- world/launcher_list.cpp | 2 +- world/lfplist.cpp | 2 +- world/queryserv.cpp | 2 +- world/ucs.cpp | 2 +- zone/client_mods.cpp | 2 +- zone/inventory.cpp | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/common/debug.h b/common/debug.h index 0a1ab0fc3..4fc28a8ad 100644 --- a/common/debug.h +++ b/common/debug.h @@ -67,7 +67,7 @@ #include #endif -#include "logsys.h" + #include "../common/mutex.h" #include diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index 22b9f77b4..b42bd4037 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -2,7 +2,7 @@ #include "eqemu_logsys.h" #include "eq_stream_ident.h" #include "eq_stream_proxy.h" -#include "logsys.h" + EQStreamIdentifier::~EQStreamIdentifier() { while(!m_identified.empty()) { diff --git a/common/guild_base.cpp b/common/guild_base.cpp index ae653e0eb..a9ad6cce0 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -18,7 +18,7 @@ #include "guild_base.h" #include "database.h" -#include "logsys.h" + //#include "misc_functions.h" #include "string_util.h" #include diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 53b0e9fed..d04954d44 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "rof.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index d376bfb5e..cfb582c29 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "rof2.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 1639e57ed..9f318674b 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "sod.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 2e5776a5d..4337d712e 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "sof.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index a19872c14..852baa089 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "titanium.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" #include "../races.h" diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 66b379840..12f7a3354 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -2,7 +2,7 @@ #include "../eqemu_logsys.h" #include "underfoot.h" #include "../opcodemgr.h" -#include "../logsys.h" + #include "../eq_stream_ident.h" #include "../crc32.h" diff --git a/common/rulesys.cpp b/common/rulesys.cpp index aeca625da..8f0c908a1 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -17,7 +17,7 @@ */ #include "rulesys.h" -#include "logsys.h" + #include "database.h" #include "string_util.h" #include diff --git a/common/spdat.cpp b/common/spdat.cpp index 3bbca4af2..6359d51dd 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -70,7 +70,7 @@ */ -#include "../common/logsys.h" + #include "../common/logtypes.h" #include "../common/eqemu_logsys.h" diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 8df723f6b..7c57b0d4d 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -2,7 +2,7 @@ #include "debug.h" #include "eqemu_logsys.h" #include "struct_strategy.h" -#include "logsys.h" + #include "eq_stream.h" #include diff --git a/world/client.h b/world/client.h index 9014051ed..7c460fe9a 100644 --- a/world/client.h +++ b/world/client.h @@ -24,7 +24,7 @@ #include "../common/linked_list.h" #include "../common/timer.h" //#include "zoneserver.h" -#include "../common/logsys.h" + #include "../common/eq_packet_structs.h" #include "cliententry.h" diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index ba2e5b21c..36fdf714c 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -21,7 +21,7 @@ #include "eqw_parser.h" #include "eqw.h" #include "http_request.h" -#include "../common/logsys.h" + #include "worlddb.h" #include "console.h" diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index 49c1317f5..e7b72bf38 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -24,7 +24,7 @@ #include "eqw_parser.h" #include "eqw.h" #include "../common/eqdb.h" -#include "../common/logsys.h" + #include "worlddb.h" #ifndef GvCV_set diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index b748f7c23..3e7059969 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -20,7 +20,7 @@ #include "launcher_link.h" #include "launcher_list.h" #include "world_config.h" -#include "../common/logsys.h" + #include "../common/md5.h" #include "../common/packet_dump.h" #include "../common/servertalk.h" diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index b00da266d..01f64bfec 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -20,7 +20,7 @@ #include "../common/debug.h" #include "launcher_list.h" #include "launcher_link.h" -#include "../common/logsys.h" + #include "eql_config.h" LauncherList::LauncherList() diff --git a/world/lfplist.cpp b/world/lfplist.cpp index f04a833dd..2dccc4a3c 100644 --- a/world/lfplist.cpp +++ b/world/lfplist.cpp @@ -21,7 +21,7 @@ #include "clientlist.h" #include "zoneserver.h" #include "zonelist.h" -#include "../common/logsys.h" + #include "../common/misc_functions.h" extern ClientList client_list; diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 6457d7e6c..370fae5fc 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -4,7 +4,7 @@ #include "world_config.h" #include "clientlist.h" #include "zonelist.h" -#include "../common/logsys.h" + #include "../common/logtypes.h" #include "../common/md5.h" #include "../common/emu_tcp_connection.h" diff --git a/world/ucs.cpp b/world/ucs.cpp index 13032d091..11cff6a69 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -2,7 +2,7 @@ #include "../common/eqemu_logsys.h" #include "ucs.h" #include "world_config.h" -#include "../common/logsys.h" + #include "../common/logtypes.h" #include "../common/md5.h" #include "../common/emu_tcp_connection.h" diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index f3c17a4d2..fc49e1526 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -18,7 +18,7 @@ #include "../common/debug.h" #include "../common/eqemu_logsys.h" -#include "../common/logsys.h" + #include "../common/rulesys.h" #include "../common/spdat.h" diff --git a/zone/inventory.cpp b/zone/inventory.cpp index d498e22f9..56ad5e904 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -18,7 +18,7 @@ #include "../common/debug.h" #include "../common/eqemu_logsys.h" -#include "../common/logsys.h" + #include "../common/string_util.h" #include "quest_parser_collection.h" #include "worldserver.h" From 952459a31324b38ebf1122e91fafd006d9489955 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:05:09 -0800 Subject: [PATCH 1119/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index cee43648e..f10fb2a5d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -994,7 +994,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s CheckEmoteHail(GetTarget(), message); - if(DistNoRootNoZ(*GetTarget()) <= 200) { + if(ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { NPC *tar = GetTarget()->CastToNPC(); parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language); From 7c7250ee5309374e4c72f7475f8fae95bc0185c0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:07:01 -0800 Subject: [PATCH 1120/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index f10fb2a5d..bf0f21645 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1006,7 +1006,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } } else { - if (DistNoRootNoZ(*GetTarget()) <= 200) { + if (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); } } From 095f5d25874e01470fe2e4145edbac4fe9bfc9e3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:08:18 -0800 Subject: [PATCH 1121/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index bf0f21645..c6ef7eb7f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4553,7 +4553,7 @@ void Client::HandleLDoNOpen(NPC *target) return; } - if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); From c340fc9c39165a627dfeb10993fe7a0975c18fb9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:10:42 -0800 Subject: [PATCH 1122/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index c6ef7eb7f..f640fa77b 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6187,7 +6187,7 @@ void Client::DragCorpses() Mob *corpse = entity_list.GetMob(It->second); if (corpse && corpse->IsPlayerCorpse() && - (DistNoRootNoZ(*corpse) <= RuleR(Character, DragCorpseDistance))) + (ComparativeDistanceNoZ(m_Position, corpse->GetPosition()) <= RuleR(Character, DragCorpseDistance))) continue; if (!corpse || !corpse->IsPlayerCorpse() || From 261feabb7d776da52a4cb192251bc65a031cf120 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:14:59 -0800 Subject: [PATCH 1123/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2436c28fe..65134cbb1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8707,7 +8707,7 @@ void Client::Handle_OP_LDoNDisarmTraps(const EQApplicationPacket *app) { if (HasSkill(SkillDisarmTraps)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From d1572790b16361c43a9962d9bda18d084bc866f1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 04:15:26 -0600 Subject: [PATCH 1124/1883] Remove eqemu_error.cpp/.h as they are useless --- common/CMakeLists.txt | 2 - common/eqemu_error.cpp | 135 ----------------------------------------- common/eqemu_error.h | 36 ----------- world/net.cpp | 3 +- zone/net.cpp | 7 +-- 5 files changed, 2 insertions(+), 181 deletions(-) delete mode 100644 common/eqemu_error.cpp delete mode 100644 common/eqemu_error.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 934a4b7b9..4e5791330 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -18,7 +18,6 @@ SET(common_sources eqdb_res.cpp eqemu_exception.cpp eqemu_config.cpp - eqemu_error.cpp eqemu_logsys.cpp eq_packet.cpp eq_stream.cpp @@ -119,7 +118,6 @@ SET(common_headers eqemu_exception.h eqemu_config.h eqemu_config_elements.h - eqemu_error.h eqemu_logsys.h eq_packet.h eq_stream.h diff --git a/common/eqemu_error.cpp b/common/eqemu_error.cpp deleted file mode 100644 index ff9a7bbd6..000000000 --- a/common/eqemu_error.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 -*/ -#ifdef _WINDOWS -#include -#endif -#include "eqemu_error.h" -#include "linked_list.h" -#include "mutex.h" -#include "misc_functions.h" -#include -#include -#ifdef _WINDOWS - #include -#endif - -void UpdateWindowTitle(char* iNewTitle = 0); -void CatchSignal(int sig_num); - -const char* EQEMuErrorText[EQEMuError_MaxErrorID] = { "ErrorID# 0, No Error", - "MySQL Error #1405 or #2001 means your mysql server rejected the username and password you presented it.", - "MySQL Error #2003 means you were unable to connect to the mysql server.", - "MySQL Error #2005 means you there are too many connections on the mysql server. The server is overloaded.", - "MySQL Error #2007 means you the server is out of memory. The server is overloaded.", - }; - -LinkedList* EQEMuErrorList; -Mutex* MEQEMuErrorList; -AutoDelete< LinkedList > ADEQEMuErrorList(&EQEMuErrorList); -AutoDelete ADMEQEMuErrorList(&MEQEMuErrorList); - -const char* GetErrorText(uint32 iError) { - if (iError >= EQEMuError_MaxErrorID) - return "ErrorID# out of range"; - else - return EQEMuErrorText[iError]; -} - -void AddEQEMuError(eEQEMuError iError, bool iExitNow) { - if (!iError) - return; - if (!EQEMuErrorList) { - EQEMuErrorList = new LinkedList; - MEQEMuErrorList = new Mutex; - } - LockMutex lock(MEQEMuErrorList); - - LinkedListIterator iterator(*EQEMuErrorList); - iterator.Reset(); - while (iterator.MoreElements()) { - if (iterator.GetData()[0] == 1) { -//Umm... this gets a big WTF... -// if (*((uint32*) iterator.GetData()[1]) == iError) -//not sure whats going on, using a character as a pointer.... - if (*((eEQEMuError*) &(iterator.GetData()[1])) == iError) - return; - } - iterator.Advance(); - } - - char* tmp = new char[6]; - tmp[0] = 1; - tmp[5] = 0; - *((uint32*) &tmp[1]) = iError; - EQEMuErrorList->Append(tmp); - - if (iExitNow) - CatchSignal(2); -} - -void AddEQEMuError(char* iError, bool iExitNow) { - if (!iError) - return; - if (!EQEMuErrorList) { - EQEMuErrorList = new LinkedList; - MEQEMuErrorList = new Mutex; - } - LockMutex lock(MEQEMuErrorList); - char* tmp = strcpy(new char[strlen(iError) + 1], iError); - EQEMuErrorList->Append(tmp); - - if (iExitNow) - CatchSignal(2); -} - -uint32 CheckEQEMuError() { - if (!EQEMuErrorList) - return 0; - uint32 ret = 0; - char* tmp = 0; - bool HeaderPrinted = false; - LockMutex lock(MEQEMuErrorList); - - while ((tmp = EQEMuErrorList->Pop() )) { - if (!HeaderPrinted) { - fprintf(stdout, "===============================\nRuntime errors:\n\n"); - HeaderPrinted = true; - } - if (tmp[0] == 1) { - fprintf(stdout, "%s\n", GetErrorText(*((uint32*) &tmp[1]))); - fprintf(stdout, "For more information on this error, visit http://www.eqemu.net/eqemuerror.php?id=%u\n\n", *((uint32*) &tmp[1])); - } - else { - fprintf(stdout, "%s\n\n", tmp); - } - safe_delete(tmp); - ret++; - } - return ret; -} - -void CheckEQEMuErrorAndPause() { -#ifdef _WINDOWS - if (CheckEQEMuError()) { - fprintf(stdout, "Hit any key to exit\n"); - UpdateWindowTitle("Error"); - getch(); - } -#endif -} - diff --git a/common/eqemu_error.h b/common/eqemu_error.h deleted file mode 100644 index ffc5d69ed..000000000 --- a/common/eqemu_error.h +++ /dev/null @@ -1,36 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 EQEMuError_H -#define EQEMuError_H - -#include "../common/types.h" - -enum eEQEMuError { EQEMuError_NoError, - EQEMuError_Mysql_1405, - EQEMuError_Mysql_2003, - EQEMuError_Mysql_2005, - EQEMuError_Mysql_2007, - EQEMuError_MaxErrorID }; - -void AddEQEMuError(eEQEMuError iError, bool iExitNow = false); -void AddEQEMuError(char* iError, bool iExitNow = false); -uint32 CheckEQEMuError(); -void CheckEQEMuErrorAndPause(); - -#endif - diff --git a/world/net.cpp b/world/net.cpp index 8914415a4..529643d08 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -34,7 +34,7 @@ #include "../common/version.h" #include "../common/eqtime.h" #include "../common/timeoutmgr.h" -#include "../common/eqemu_error.h" + #include "../common/opcodemgr.h" #include "../common/guilds.h" #include "../common/eq_stream_ident.h" @@ -498,7 +498,6 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); - CheckEQEMuErrorAndPause(); return 0; } diff --git a/zone/net.cpp b/zone/net.cpp index a299da25a..ab2e06871 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -28,7 +28,7 @@ #include "../common/eq_packet_structs.h" #include "../common/mutex.h" #include "../common/version.h" -#include "../common/eqemu_error.h" + #include "../common/packet_dump_file.h" #include "../common/opcodemgr.h" #include "../common/guilds.h" @@ -221,19 +221,16 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { Log.Out(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } Log.Out(Logs::Detail, Logs::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { Log.Out(Logs::General, Logs::Error, "Loading loot FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } Log.Out(Logs::Detail, Logs::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { Log.Out(Logs::General, Logs::Error, "Loading skill caps FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } @@ -244,7 +241,6 @@ int main(int argc, char** argv) { Log.Out(Logs::Detail, Logs::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { Log.Out(Logs::General, Logs::Error, "Loading base data FAILED!"); - CheckEQEMuErrorAndPause(); return 1; } @@ -512,7 +508,6 @@ int main(int argc, char** argv) { safe_delete(taskmanager); command_deinit(); safe_delete(parse); - CheckEQEMuErrorAndPause(); Log.Out(Logs::Detail, Logs::Zone_Server, "Proper zone shutdown complete."); return 0; } From 46eab011f195e595b63c530721628464e56566d6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:16:56 -0800 Subject: [PATCH 1125/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 65134cbb1..63b0f028c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8740,7 +8740,7 @@ void Client::Handle_OP_LDoNPickLock(const EQApplicationPacket *app) { if (HasSkill(SkillPickLock)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From 39e059e256663c9b5a79038cc102a2f12f4a4de0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:21:13 -0800 Subject: [PATCH 1126/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 63b0f028c..54b935b46 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8759,7 +8759,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) { if (HasSkill(SkillSenseTraps)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From 9dc24735a498b3d818413cfed16ef0a338a9420e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:25:09 -0800 Subject: [PATCH 1127/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 54b935b46..ebd0dbe80 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9923,7 +9923,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { - if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { if (mypet->IsHeld()) { if (!mypet->IsFocused()) { mypet->SetHeld(false); //break the hold and guard if we explicitly tell the pet to attack. From bc4aa08adfe9814173fbf8c4a65aef946d9efa7c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 04:33:04 -0600 Subject: [PATCH 1128/1883] Add crashtest command back in for crash log testing --- zone/command.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zone/command.cpp b/zone/command.cpp index d0882a687..06e4114d0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -426,6 +426,7 @@ int command_init(void) { command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) || command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || + command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || command_add("logtest", "Performs log performance testing.", 250, command_logtest) ) { @@ -10397,4 +10398,11 @@ void command_logtest(Client *c, const Seperator *sep){ Log.Out(Logs::General, Logs::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } +} + +void command_crashtest(Client *c, const Seperator *sep) +{ + c->Message(0, "Alright, now we get an GPF ;) "); + char* gpf = 0; + memcpy(gpf, "Ready to crash", 30); } \ No newline at end of file From 3f83bc77717fb5624338bfeba9c8e87361a435f3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:41:11 -0800 Subject: [PATCH 1129/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ebd0dbe80..88fb64e6d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9958,7 +9958,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { - if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { zone->AddAggroMob(); mypet->AddToHateList(GetTarget(), 1); Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName()); From e5ee13bde044b11ab85c654a425d7cfee31a66e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:43:16 -0800 Subject: [PATCH 1130/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 3c42d00fb..63b649448 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4908,7 +4908,7 @@ void command_manaburn(Client *c, const Seperator *sep) c->Message(0, "#Manaburn needs a target."); else { int cur_level=c->GetAA(MANA_BURN);//ManaBurn ID - if (c->DistNoRootNoZ(*target) > 200) + if (ComparativeDistance(c->GetPosition(), target->GetPosition()) > 200) c->Message(0,"You are too far away from your target."); else { if(cur_level == 1) { From 83413178c2d87cb58d7264d7ea68ce66e35887b4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:44:49 -0800 Subject: [PATCH 1131/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 63b649448..82daf4e12 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10305,7 +10305,7 @@ void command_disarmtrap(Client *c, const Seperator *sep) { if(c->HasSkill(SkillDisarmTraps)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From 9c3b66df934b77b119b2ac46b81ec6a4c94a3c6c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:46:30 -0800 Subject: [PATCH 1132/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 82daf4e12..6bfe124ba 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10330,7 +10330,7 @@ void command_sensetrap(Client *c, const Seperator *sep) { if(c->HasSkill(SkillSenseTraps)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From e728280c5838ca4cd3733fcd16ea2f646f62bf0d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:49:44 -0800 Subject: [PATCH 1133/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 6bfe124ba..fe479848f 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10355,7 +10355,7 @@ void command_picklock(Client *c, const Seperator *sep) { if(c->HasSkill(SkillPickLock)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From 013518cdb5d5c07d8814abfe1ef1f07546ec2acf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:59:27 -0800 Subject: [PATCH 1134/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/corpse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index e1c519e89..a09b8513b 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1328,7 +1328,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { client->Message(13, "That corpse is locked by a GM."); return false; } - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { + if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); is_corpse_changed = true; } From 8e112aac03cf35e25c830494220a465c949a10ff Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:03:46 -0800 Subject: [PATCH 1135/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/corpse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a09b8513b..b860f02fe 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1343,7 +1343,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { std::list::iterator itr; for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) { if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) { - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { + if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); is_corpse_changed = true; } From e58a022e25d94f1a5a88f7368799b25bb4aeb78b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:05:35 -0800 Subject: [PATCH 1136/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 1a988d500..c43b91168 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -674,7 +674,7 @@ void EntityList::AETaunt(Client* taunter, float range) zdiff *= -1; if (zdiff < 10 && taunter->IsAttackAllowed(them) - && taunter->DistNoRootNoZ(*them) <= range) { + && ComparativeDistanceNoZ(taunter->GetPosition(), them->GetPosition()) <= range) { if (taunter->CheckLosFN(them)) { taunter->Taunt(them, true); } From f33eb9f8f329bb25db744fa39ba6023245c324e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:09:08 -0800 Subject: [PATCH 1137/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2b0551a26..6ec20832e 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1584,7 +1584,7 @@ Corpse *EntityList::GetCorpseByOwnerWithinRange(Client *client, Mob *center, int auto it = corpse_list.begin(); while (it != corpse_list.end()) { if (it->second->IsPlayerCorpse()) - if (center->DistNoRootNoZ(*it->second) < range && + if (ComparativeDistanceNoZ(center->GetPosition(), it->second->GetPosition()) < range && strcasecmp(it->second->GetOwnerName(), client->GetName()) == 0) return it->second; ++it; From f54c698ffe6b5782d389c4e2aa09e6e8d55ffc84 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:12:08 -0800 Subject: [PATCH 1138/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/hate_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 572781d06..ad49b00fd 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -158,7 +158,7 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) { auto iterator = list.begin(); while (iterator != list.end()) { - this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); + this_distance = ComparativeDistanceNoZ((*iterator)->entity_on_hatelist->GetPosition(), hater->GetPosition()); if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { close_distance = this_distance; close_entity = (*iterator)->entity_on_hatelist; From 90e011ad997edba06e8065a653f925165974aaff Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:24:40 -0800 Subject: [PATCH 1139/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 29310b872..25d0aec76 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1318,7 +1318,7 @@ bool Merc::IsMercCasterCombatRange(Mob *target) { // half the max so the merc doesn't always stop at max range to allow combat movement range *= .5; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); if(targetDistance > range) result = false; From 69a6a6f3f83e3843f33daf33125e47b3a4461730 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:25:54 -0800 Subject: [PATCH 1140/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 25d0aec76..a19021082 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1513,7 +1513,7 @@ void Merc::AI_Process() { return; } } - else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) + else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize())) { // If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up float newX = 0; From 99783fd871004f1dae945d2412ee88687ac75f64 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:31:07 -0800 Subject: [PATCH 1141/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index a19021082..bb549f830 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2435,7 +2435,7 @@ void Merc::CheckHateList() { if(MercOwner && MercOwner->GetTarget() && MercOwner->GetTarget()->IsNPC() && (MercOwner->GetTarget()->GetHateAmount(MercOwner) || MercOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(MercOwner->GetTarget())) { float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); range = range * range; - if(MercOwner->GetTarget()->DistNoRootNoZ(*this) < range) { + if(ComparativeDistanceNoZ(m_Position, MercOwner->GetTarget()->GetPosition()) < range) { AddToHateList(MercOwner->GetTarget(), 1); } } From 517c0846578b5208a1e40e4160b1f6e5982ea172 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:32:28 -0800 Subject: [PATCH 1142/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index bb549f830..ffc3075ff 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2445,7 +2445,7 @@ void Merc::CheckHateList() { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - float dist = npc->DistNoRootNoZ(*this); + float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition()); int radius = RuleI(Mercs, AggroRadius); radius *= radius; if(dist <= radius) { From dc275b3b1e2225f62207c3dd975918a1a7a71ab8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:35:20 -0800 Subject: [PATCH 1143/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index ffc3075ff..9031f2322 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2499,7 +2499,7 @@ bool Merc::CheckAENuke(Merc* caster, Mob* tar, uint16 spell_id, uint8 &numTarget for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - if(npc->DistNoRootNoZ(*tar) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { + if(ComparativeDistanceNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { if(!npc->IsMezzed()) { numTargets++; } From 8a1e03ced46ff7a7e0909a1bfdc33f88e105526e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:37:26 -0800 Subject: [PATCH 1144/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 9031f2322..4776c353a 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2457,7 +2457,7 @@ void Merc::CheckHateList() { if(!hate_list.IsEntOnHateList(npc)) { float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); range *= range; - if(npc->DistNoRootNoZ(*this) < range) { + if(ComparativeDistanceNoZ(m_Position, npc->GetPosition()) < range) { hate_list.AddEntToHateList(npc, 1); } } From ae4e1ef0d00bbebc8f61f2ed6e74905f6ca97170 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:44:08 -0800 Subject: [PATCH 1145/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 4776c353a..700287ffe 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4098,7 +4098,7 @@ bool Merc::CheckAETaunt() { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - float dist = npc->DistNoRootNoZ(*this); + float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition()); int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range); range *= range; From 97d7d69623c83f7de30d18066cf2c9f443528e2b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:49:40 -0800 Subject: [PATCH 1146/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 9123b2f05..3902ee072 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -622,7 +622,7 @@ void Client::AI_SpellCast() if(!targ) return; - float dist = DistNoRootNoZ(*targ); + float dist = ComparativeDistanceNoZ(m_Position, targ->GetPosition()); std::vector valid_spells; std::vector slots; From 2ccac250045430e474aea8215ac76b4fa39eafc5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:52:17 -0800 Subject: [PATCH 1147/1883] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/perl_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index df0a48e69..46b3b761a 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5963,7 +5963,7 @@ XS(XS_Client_SilentMessage) Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); if(THIS->GetTarget() != NULL){ if(THIS->GetTarget()->IsNPC()){ - if (THIS->DistNoRootNoZ(*THIS->GetTarget()) <= 200) { + if (ComparativeDistanceNoZ(THIS->GetPosition(), THIS->GetTarget()->GetPosition()) <= 200) { if(THIS->GetTarget()->CastToNPC()->IsMoving() && !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget())) THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1))); From 0aefc0453db4a3db271dc8d2d66b00ba6ce25fa6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:54:49 -0800 Subject: [PATCH 1148/1883] Removed Mob::DistNoRootNoZ --- zone/mob.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 57be8212b..238859062 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,13 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRootNoZ(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - - return ( (xDiff * xDiff) + (yDiff * yDiff) ); -} - float Mob::GetReciprocalHeading(Mob* target) { float Result = 0; From 7374313fd9d26d16408a3bbd1a22e0b3e15ea40b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 18 Jan 2015 14:40:50 -0500 Subject: [PATCH 1149/1883] Fix overflow error in lua_create_npc --- zone/lua_general.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index b0127137f..3182ac967 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1356,7 +1356,7 @@ void lua_create_npc(luabind::adl::object table, float x, float y, float z, float LuaCreateNPCParseString(special_abilities, 512, ""); LuaCreateNPCParse(d_melee_texture1, uint16, 0); LuaCreateNPCParse(d_melee_texture2, uint16, 0); - LuaCreateNPCParseString(ammo_idfile, 32, ""); + LuaCreateNPCParseString(ammo_idfile, 30, ""); LuaCreateNPCParse(prim_melee_type, uint8, 0); LuaCreateNPCParse(sec_melee_type, uint8, 0); LuaCreateNPCParse(ranged_type, uint8, 0); From cc802f2e74ece6f6cbc5ef52bdc4d60ed364e25b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 12:22:37 -0800 Subject: [PATCH 1150/1883] Added 'GetReciprocalHeading' to position.cpp/h --- zone/position.cpp | 30 ++++++++++++++++++++++++++++++ zone/position.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/zone/position.cpp b/zone/position.cpp index 63c5b034f..38b92c77e 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -222,3 +222,33 @@ bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &mini return xcheck && ycheck; } + +/** +* Gives the heading directly 180 degrees from the +* current heading. +* Takes the EQfloat from the xyz_heading and returns +* an EQFloat. +*/ +float GetReciprocalHeading(const xyz_heading& point1) { + return GetReciprocalHeading(point1.m_Heading); +} + +/** +* Gives the heading directly 180 degrees from the +* current heading. +* Takes an EQfloat and returns an EQFloat. +*/ +float GetReciprocalHeading(const float heading) { + float result = 0; + + // Convert to radians + float h = (heading / 256.0f) * 6.283184f; + + // Calculate the reciprocal heading in radians + result = h + 3.141592f; + + // Convert back to eq heading from radians + result = (result / 6.283184f) * 256.0f; + + return result; +} \ No newline at end of file diff --git a/zone/position.h b/zone/position.h index 30f8fcb1c..f422a5247 100644 --- a/zone/position.h +++ b/zone/position.h @@ -99,4 +99,7 @@ float Distance(const xyz_heading& point1, const xyz_heading& point2); float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); +float GetReciprocalHeading(const xyz_heading& point1); +float GetReciprocalHeading(const float heading); + #endif From 53862713f9e3cbef55391412006ad769a9f38d15 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 12:38:27 -0800 Subject: [PATCH 1151/1883] Switched to position based GetReciprocalHeading instead of Mob::GetReciprocalHeading --- zone/mob.cpp | 6 +++--- zone/mob.h | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 238859062..b9fe82ea1 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2273,7 +2273,7 @@ bool Mob::CanThisClassBlock(void) const return(CastToClient()->HasSkill(SkillBlock)); } } - +/* float Mob::GetReciprocalHeading(Mob* target) { float Result = 0; @@ -2290,7 +2290,7 @@ float Mob::GetReciprocalHeading(Mob* target) { return Result; } - +*/ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc) { bool Result = false; @@ -2298,7 +2298,7 @@ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, fl float look_heading = 0; if(lookForAftArc) - look_heading = GetReciprocalHeading(target); + look_heading = GetReciprocalHeading(target->GetPosition()); else look_heading = target->GetHeading(); diff --git a/zone/mob.h b/zone/mob.h index c78eee65c..09c9bf56f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,10 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float DistNoRoot(const Mob &) const; - float DistNoRootNoZ(float x, float y) const; - float DistNoRootNoZ(const Mob &) const; - static float GetReciprocalHeading(Mob* target); bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc = true); From f4224b296ad8196878d3ecef43a5eae5a4e3c4a5 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 18 Jan 2015 18:29:37 -0500 Subject: [PATCH 1152/1883] We don't need to cast these anymore --- zone/embparser.cpp | 2 +- zone/lua_general.cpp | 4 ++-- zone/lua_parser.cpp | 34 ++++++++++++++++---------------- zone/lua_parser_events.cpp | 2 +- zone/quest_parser_collection.cpp | 8 ++++---- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/zone/embparser.cpp b/zone/embparser.cpp index c39426953..12fd3effb 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -1143,7 +1143,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID ItemInst *inst = EQEmu::any_cast(extra_pointers->at(i)); std::string var_name = "item"; - var_name += std::to_string(static_cast(i + 1)); + var_name += std::to_string(i + 1); if(inst) { ExportVar(package_name.c_str(), var_name.c_str(), inst->GetItem()->ID); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 3182ac967..034895172 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -200,7 +200,7 @@ void unregister_player_event(int evt) { void register_item_event(std::string name, int evt, int item_id, luabind::adl::object func) { std::string package_name = "item_"; - package_name += std::to_string(static_cast(item_id)); + package_name += std::to_string(item_id); if(luabind::type(func) == LUA_TFUNCTION) { register_event(package_name, name, evt, func); @@ -214,7 +214,7 @@ void register_item_event(int evt, int item_id, luabind::adl::object func) { void unregister_item_event(std::string name, int evt, int item_id) { std::string package_name = "item_"; - package_name += std::to_string(static_cast(item_id)); + package_name += std::to_string(item_id); unregister_event(package_name, name, evt); } diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 1b1bfb8e8..2051b31c7 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -235,7 +235,7 @@ int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, return 0; } - std::string package_name = "npc_" + std::to_string(static_cast(npc->GetNPCTypeID())); + std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID()); return _EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers); } @@ -425,7 +425,7 @@ int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob * } std::string package_name = "item_"; - package_name += std::to_string(static_cast(item->GetID())); + package_name += std::to_string(item->GetID()); return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers); } @@ -499,12 +499,12 @@ int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spe return 0; } - std::string package_name = "spell_" + std::to_string(static_cast(spell_id)); + std::string package_name = "spell_" + std::to_string(spell_id); if(!SpellHasQuestSub(spell_id, evt)) { return 0; } - + return _EventSpell(package_name, evt, npc, client, spell_id, extra_data, extra_pointers); } @@ -646,7 +646,7 @@ bool LuaParser::HasQuestSub(uint32 npc_id, QuestEventID evt) { return false; } - std::string package_name = "npc_" + std::to_string(static_cast(npc_id)); + std::string package_name = "npc_" + std::to_string(npc_id); const char *subname = LuaEvents[evt]; return HasFunction(subname, package_name); @@ -688,7 +688,7 @@ bool LuaParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) { return false; } - std::string package_name = "spell_" + std::to_string(static_cast(spell_id)); + std::string package_name = "spell_" + std::to_string(spell_id); const char *subname = LuaEvents[evt]; return HasFunction(subname, package_name); @@ -704,7 +704,7 @@ bool LuaParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { } std::string package_name = "item_"; - package_name += std::to_string(static_cast(itm->GetID())); + package_name += std::to_string(itm->GetID()); const char *subname = LuaEvents[evt]; return HasFunction(subname, package_name); @@ -723,7 +723,7 @@ bool LuaParser::EncounterHasQuestSub(std::string encounter_name, QuestEventID ev } void LuaParser::LoadNPCScript(std::string filename, int npc_id) { - std::string package_name = "npc_" + std::to_string(static_cast(npc_id)); + std::string package_name = "npc_" + std::to_string(npc_id); LoadScript(filename, package_name); } @@ -744,13 +744,13 @@ void LuaParser::LoadItemScript(std::string filename, ItemInst *item) { if (item == nullptr) return; std::string package_name = "item_"; - package_name += std::to_string(static_cast(item->GetID())); + package_name += std::to_string(item->GetID()); LoadScript(filename, package_name); } void LuaParser::LoadSpellScript(std::string filename, uint32 spell_id) { - std::string package_name = "spell_" + std::to_string(static_cast(spell_id)); + std::string package_name = "spell_" + std::to_string(spell_id); LoadScript(filename, package_name); } @@ -1011,8 +1011,8 @@ int LuaParser::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::stri if(!npc) return 0; - std::string package_name = "npc_" + std::to_string(static_cast(npc->GetNPCTypeID())); - int ret = 0; + std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID()); + int ret = 0; auto iter = lua_encounter_events_registered.find(package_name); if(iter != lua_encounter_events_registered.end()) { @@ -1085,11 +1085,11 @@ int LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *ite if(!item) return 0; - + std::string package_name = "item_"; - package_name += std::to_string(static_cast(item->GetID())); - int ret = 0; - + package_name += std::to_string(item->GetID()); + int ret = 0; + auto iter = lua_encounter_events_registered.find(package_name); if(iter != lua_encounter_events_registered.end()) { auto riter = iter->second.begin(); @@ -1129,7 +1129,7 @@ int LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, ui return 0; } - std::string package_name = "spell_" + std::to_string(static_cast(spell_id)); + std::string package_name = "spell_" + std::to_string(spell_id); int ret = 0; auto iter = lua_encounter_events_registered.find(package_name); diff --git a/zone/lua_parser_events.cpp b/zone/lua_parser_events.cpp index 89f08a81f..dbcf86d74 100644 --- a/zone/lua_parser_events.cpp +++ b/zone/lua_parser_events.cpp @@ -56,7 +56,7 @@ void handle_npc_event_trade(QuestInterface *parse, lua_State* L, NPC* npc, Mob * if(extra_pointers) { size_t sz = extra_pointers->size(); for(size_t i = 0; i < sz; ++i) { - std::string prefix = "item" + std::to_string(static_cast(i + 1)); + std::string prefix = "item" + std::to_string(i + 1); ItemInst *inst = EQEmu::any_cast(extra_pointers->at(i)); Lua_ItemInst l_inst = inst; diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index d3bde0d5b..42af5efe0 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -206,11 +206,11 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) { std::string item_script; if(itm->GetItem()->ScriptFileID != 0) { item_script = "script_"; - item_script += std::to_string(static_cast(itm->GetItem()->ScriptFileID)); + item_script += std::to_string(itm->GetItem()->ScriptFileID); } else if(strlen(itm->GetItem()->CharmFile) > 0) { item_script = itm->GetItem()->CharmFile; } else { - item_script = std::to_string(static_cast(itm->GetID())); + item_script = std::to_string(itm->GetID()); } uint32 item_id = itm->GetID(); @@ -358,11 +358,11 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst std::string item_script; if(item->GetItem()->ScriptFileID != 0) { item_script = "script_"; - item_script += std::to_string(static_cast(item->GetItem()->ScriptFileID)); + item_script += std::to_string(item->GetItem()->ScriptFileID); } else if(strlen(item->GetItem()->CharmFile) > 0) { item_script = item->GetItem()->CharmFile; } else { - item_script = std::to_string(static_cast(item->GetID())); + item_script = std::to_string(item->GetID()); } uint32 item_id = item->GetID(); From 5465d76d20f0310d5e59e3a6b94331d72e2a264d Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 18 Jan 2015 19:48:32 -0500 Subject: [PATCH 1153/1883] VS would like us to return values. --- zone/position.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/position.cpp b/zone/position.cpp index a7b32cb62..afa2b45cf 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -152,7 +152,7 @@ float ComparativeDistance(const xyz_location& point1, const xyz_location& point2 * Produces the non square root'ed distance between the two points. */ float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2) { - ComparativeDistance(static_cast(point1), static_cast(point2)); + return ComparativeDistance(static_cast(point1), static_cast(point2)); } /** @@ -166,7 +166,7 @@ float Distance(const xyz_location& point1, const xyz_location& point2) { * Produces the distance between the two points. */ float Distance(const xyz_heading& point1, const xyz_heading& point2) { - Distance(static_cast(point1), static_cast(point2)); + return Distance(static_cast(point1), static_cast(point2)); } /** From 96820c4a310637c86341db4379ac055dbdb6ca84 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 18 Jan 2015 23:04:21 -0600 Subject: [PATCH 1154/1883] Some work on RoF Guild Banks (still not functional). --- zone/client.cpp | 4 ++-- zone/client.h | 2 +- zone/client_packet.cpp | 27 +++++++++++++++++++++------ zone/merc.cpp | 4 ++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index f640fa77b..dbf9508d4 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5741,14 +5741,14 @@ void Client::GuildBankAck() FastQueuePacket(&outapp); } -void Client::GuildBankDepositAck(bool Fail) +void Client::GuildBankDepositAck(bool Fail, int8 action) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildBank, sizeof(GuildBankDepositAck_Struct)); GuildBankDepositAck_Struct *gbdas = (GuildBankDepositAck_Struct*) outapp->pBuffer; - gbdas->Action = GuildBankDeposit; + gbdas->Action = action; gbdas->Fail = Fail ? 1 : 0; diff --git a/zone/client.h b/zone/client.h index 8dd343c80..c89dc017c 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1097,7 +1097,7 @@ public: QGlobalCache *GetQGlobals() { return qGlobals; } QGlobalCache *CreateQGlobals() { qGlobals = new QGlobalCache(); return qGlobals; } void GuildBankAck(); - void GuildBankDepositAck(bool Fail); + void GuildBankDepositAck(bool Fail, int8 action); inline bool IsGuildBanker() { return GuildBanker; } void ClearGuildBank(); void SendGroupCreatePacket(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 88fb64e6d..2ba7c1b82 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6843,13 +6843,28 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) char *Buffer = (char *)app->pBuffer; uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buffer); + uint32 sentAction = Action; + + if (GetClientVersion() >= EQClientRoF) + { + Action += 1; + /* + // Need to find all of the action types for RoF and switch case here + switch(Action) + { + case 4: + Action = 5; + break; + } + */ + } if (!IsInAGuild()) { Message(13, "You must be in a Guild to use the Guild Bank."); if (Action == GuildBankDeposit) - GuildBankDepositAck(true); + GuildBankDepositAck(true, sentAction); else GuildBankAck(); @@ -6876,7 +6891,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message_StringID(13, GUILD_BANK_FULL); - GuildBankDepositAck(true); + GuildBankDepositAck(true, sentAction); return; } @@ -6925,7 +6940,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message_StringID(13, GUILD_BANK_FULL); - GuildBankDepositAck(true); + GuildBankDepositAck(true, sentAction); return; } @@ -6938,7 +6953,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) { Message(13, "No Item on the cursor."); - GuildBankDepositAck(true); + GuildBankDepositAck(true, sentAction); return; } @@ -6969,14 +6984,14 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) if (!Allowed) { Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT); - GuildBankDepositAck(true); + GuildBankDepositAck(true, sentAction); return; } if (GuildBanks->AddItem(GuildID(), GuildBankDepositArea, CursorItem->ID, CursorItemInst->GetCharges(), GetName(), GuildBankBankerOnly, "")) { - GuildBankDepositAck(false); + GuildBankDepositAck(false, sentAction); DeleteItemInInventory(MainCursor, 0, false); } diff --git a/zone/merc.cpp b/zone/merc.cpp index 700287ffe..2f17d7ca3 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1336,7 +1336,7 @@ void Merc::AI_Process() { if(IsCasting()) return; - // A bot wont start its AI if not grouped + // A merc wont start its AI if not grouped if(!HasGroup()) { return; } @@ -5474,7 +5474,7 @@ bool Client::MercOnlyOrNoGroup() { } if (GetMerc()) { - if (GetMerc()->HasGroup() && GetMerc()->GetGroup() == GetGroup()) + if (GetMerc()->GetGroup() == GetGroup()) { if (GetGroup()->GroupCount() < 3) { From 55d73f0b0707eea2ab251449bdfc5acb293f716e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:30:36 -0600 Subject: [PATCH 1155/1883] Remove Log.Hex references because we're not going to use them anyways per KLS --- common/patches/rof2.cpp | 3 --- common/patches/ss_define.h | 4 ---- 2 files changed, 7 deletions(-) diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index cfb582c29..cb49c8d53 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4568,14 +4568,11 @@ namespace RoF2 DECODE_LENGTH_EXACT(structs::MoveItem_Struct); SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct); - //Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot); Log.Out(Logs::General, Logs::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack); emu->from_slot = RoF2ToServerSlot(eq->from_slot); emu->to_slot = RoF2ToServerSlot(eq->to_slot); IN(number_in_stack); - Log.Hex(Logs::Netcode, eq, sizeof(structs::MoveItem_Struct)); - FINISH_DIRECT_DECODE(); } diff --git a/common/patches/ss_define.h b/common/patches/ss_define.h index 1d59287ad..aaa41db23 100644 --- a/common/patches/ss_define.h +++ b/common/patches/ss_define.h @@ -65,7 +65,6 @@ #define ENCODE_LENGTH_EXACT(struct_) \ if((*p)->size != sizeof(struct_)) { \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ - Log.Hex(Logs::Netcode, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ return; \ @@ -73,7 +72,6 @@ #define ENCODE_LENGTH_ATLEAST(struct_) \ if((*p)->size < sizeof(struct_)) { \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \ - Log.Hex(Logs::Netcode, (*p)->pBuffer, (*p)->size); \ delete *p; \ *p = nullptr; \ return; \ @@ -128,14 +126,12 @@ if(__packet->size != sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ - Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); \ return; \ } #define DECODE_LENGTH_ATLEAST(struct_) \ if(__packet->size < sizeof(struct_)) { \ __packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \ Log.Out(Logs::Detail, Logs::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \ - Log.Hex(Logs::Netcode, __packet->pBuffer, __packet->size); \ return; \ } From ee1c55a8135dcf7f246f88ca5f5b0150576ebd88 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:32:09 -0600 Subject: [PATCH 1156/1883] Remove Log.Hex remaining entries --- common/eq_stream.cpp | 1 - common/eqemu_logsys.cpp | 10 ---------- common/patches/rof.cpp | 4 ---- common/patches/rof2.cpp | 2 -- 4 files changed, 17 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index cdb2e9d26..1fef68a8e 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -1112,7 +1112,6 @@ uint32 newlength=0; ProcessQueue(); } else { Log.Out(Logs::Detail, Logs::Netcode, _L "Incoming packet failed checksum" __L); - Log.Hex(Logs::Netcode, buffer, length); } } diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index e790e3830..e7e7a00b8 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -164,16 +164,6 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m SetConsoleTextAttribute(console_handle, Console::Color::White); #endif } - -void EQEmuLogSys::Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding) { - return; - char buffer[80]; - uint32 offset; - for (offset = 0; offset < length; offset += 16) { - build_hex_line((const char *)data, length, offset, buffer, padding); - // log_message(type, "%s", buffer); //%s is to prevent % escapes in the ascii - } -} /* void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) { return; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index d04954d44..c0d6b4ddf 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -2809,8 +2809,6 @@ namespace RoF } } - Log.Hex(Logs::Netcode, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - FINISH_ENCODE(); } @@ -4503,8 +4501,6 @@ namespace RoF emu->to_slot = RoFToServerSlot(eq->to_slot); IN(number_in_stack); - Log.Hex(Logs::Netcode, eq, sizeof(structs::MoveItem_Struct)); - FINISH_DIRECT_DECODE(); } diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index cb49c8d53..bd2245dc3 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -2893,8 +2893,6 @@ namespace RoF2 } } - Log.Hex(Logs::Netcode, eq, sizeof(structs::SendAA_Struct) + emu->total_abilities*sizeof(structs::AA_Ability)); - FINISH_ENCODE(); } From e5542788111eaadabc230b1bf1b1022cfebb8cf0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:32:24 -0600 Subject: [PATCH 1157/1883] Remove Log.Raw function --- common/eqemu_logsys.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index e7e7a00b8..48703fb7c 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -164,15 +164,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m SetConsoleTextAttribute(console_handle, Console::Color::White); #endif } -/* -void EQEmuLogSys::Raw(uint16 log_category, uint16 seq, const BasePacket *p) { - return; - char buffer[196]; - p->build_raw_header_dump(buffer, seq); - //log_message(type,buffer); - EQEmuLogSys::Hex(log_category, (const char *)p->pBuffer, p->size); -} -*/ + void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { va_list args; From bf62d1fd2663106e5fe8c7cff8e0debe45578b99 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:32:46 -0600 Subject: [PATCH 1158/1883] Sort header functions --- common/eqemu_logsys.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 57562b904..fb1ae3c51 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -125,11 +125,10 @@ public: void CloseFileLogs(); void LoadLogSettingsDefaults(); - void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); + void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); - void Hex(uint16 log_category, const void *data, unsigned long length, unsigned char padding = 4); struct LogSettings{ uint8 log_to_file; From 87e212046f93071d29da603f1b20f290801c6332 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:33:52 -0600 Subject: [PATCH 1159/1883] Remove another Log.Hex straggler --- common/eq_stream.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 1fef68a8e..4d3fa5d46 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -102,7 +102,6 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf { EQRawApplicationPacket *ap=nullptr; Log.Out(Logs::Detail, Logs::Netcode, _L "Creating new application packet, length %d" __L, len); - Log.Hex(Logs::Netcode, buf, len); ap = new EQRawApplicationPacket(buf, len); return ap; } From 2ecb91d0757d874699ec8a0963379d4508dc54fa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:35:28 -0600 Subject: [PATCH 1160/1883] Remove Log.Hex completely for real --- world/launcher_link.cpp | 1 - world/login_server.cpp | 1 - world/zoneserver.cpp | 1 - zone/worldserver.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 3e7059969..9e8db6ea1 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -68,7 +68,6 @@ bool LauncherLink::Process() { ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); if (!authenticated) { if (WorldConfig::get()->SharedKey.length() > 0) { if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) { diff --git a/world/login_server.cpp b/world/login_server.cpp index 20ca570c0..f411e7a72 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -97,7 +97,6 @@ bool LoginServer::Process() { while((pack = tcpc->PopPacket())) { Log.Out(Logs::Detail, Logs::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode); - Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); switch(pack->opcode) { case 0: diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 85840cba4..de3f34435 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -177,7 +177,6 @@ bool ZoneServer::Process() { } ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { - Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); if (!authenticated) { if (WorldConfig::get()->SharedKey.length() > 0) { if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) { diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 2efaa5a98..a3967c051 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -141,7 +141,6 @@ void WorldServer::Process() { ServerPacket *pack = 0; while((pack = tcpc.PopPacket())) { Log.Out(Logs::Detail, Logs::Zone_Server, "Got 0x%04x from world:", pack->opcode); - Log.Hex(Logs::Netcode, pack->pBuffer, pack->size); switch(pack->opcode) { case 0: { break; From 2f74f07be7e79bbe8ff96bdb379bfe77f5cb7085 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:47:51 -0600 Subject: [PATCH 1161/1883] Add EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category) to replace the static map --- common/eqemu_logsys.cpp | 32 +++++++++++++++++++++----------- common/eqemu_logsys.h | 1 + 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 48703fb7c..9762f0315 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -64,17 +64,6 @@ namespace Console { }; } -// static Console::Color LogColors[MaxCategoryID] = { -// Console::Color::Yellow, // "Status", -// Console::Color::Yellow, // "Normal", -// Console::Color::LightRed, // "Error", -// Console::Color::LightGreen, // "Debug", -// Console::Color::LightCyan, // "Quest", -// Console::Color::LightMagenta, // "Command", -// Console::Color::LightRed // "Crash" -// }; - - EQEmuLogSys::EQEmuLogSys(){ on_log_gmsay_hook = [](uint16 log_type, std::string&) {}; } @@ -134,6 +123,27 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) } } +uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ + switch (log_category) { + case Logs::Status: + return Console::Color::Yellow; + case Logs::Normal: + return Console::Color::Yellow; + case Logs::Error: + return Console::Color::LightRed; + case Logs::Debug: + return Console::Color::LightGreen; + case Logs::Quests: + return Console::Color::LightCyan; + case Logs::Commands: + return Console::Color::LightMagenta; + case Logs::Crash: + return Console::Color::LightRed; + default: + return Console::Color::White; + } +} + void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string message) { /* Check if category enabled for process */ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index fb1ae3c51..fe960c8d0 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -129,6 +129,7 @@ public: void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); + uint16 GetConsoleColorFromCategory(uint16 log_category); struct LogSettings{ uint8 log_to_file; From b546848313f5877e3f80d6294a63e3cd3d24a7ac Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:54:01 -0600 Subject: [PATCH 1162/1883] Implement EQEmuLogSys::GetConsoleColorFromCategory in ProcessConsoleMessage --- common/eqemu_logsys.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 9762f0315..ad4cb13ae 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -159,12 +159,7 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - //if (LogColors[log_type]){ - // SetConsoleTextAttribute(console_handle, LogColors[log_type]); - //} - //else{ - SetConsoleTextAttribute(console_handle, Console::Color::White); - //} + SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetConsoleColorFromCategory(log_category)); #endif std::cout << message << "\n"; From af53666fed3b0e862eed40381405bbd64c869962 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:54:28 -0600 Subject: [PATCH 1163/1883] Convert TimeBroadcast debug message to zone_server category --- zone/worldserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index a3967c051..f3211b7e1 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -767,7 +767,7 @@ void WorldServer::Process() { eqTime.minute, (eqTime.hour >= 13) ? "pm" : "am" ); - std::cout << "Time Broadcast Packet: " << timeMessage << std::endl; + Log.Out(Logs::General, Logs::Zone_Server, "Time Broadcast Packet: %s", timeMessage); zone->GotCurTime(true); //} //Test From 1c47e6b90d564c65172f1f4d3d4ea067f54e9158 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:56:52 -0600 Subject: [PATCH 1164/1883] Convert 'Unable to get raid id, char not found!' to Error Category --- common/database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 6ef6c7485..8beb3336b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3488,7 +3488,7 @@ uint32 Database::GetRaidID(const char* name){ if (row == results.end()) { - std::cout << "Unable to get raid id, char not found!" << std::endl; + Log.Out(Logs::General, Logs::Error, "Unable to get raid id, char not found!"); return 0; } From b3eadea4737c232b0b007804413af4b6d3b36596 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 02:59:02 -0600 Subject: [PATCH 1165/1883] Convert 'Client linkdead' to Zone Status --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 52d1c900c..483dceac1 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -670,7 +670,7 @@ bool Client::Process() { if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) { OnDisconnect(true); - std::cout << "Client linkdead: " << name << std::endl; + Log.Out(Logs::General, Logs::Zone_Server, "Client linkdead: %s", name); if (GetGM()) { if (GetMerc()) From abc2f9cace47b9c0a5a7ea7e5c95567d778e9247 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:00:32 -0600 Subject: [PATCH 1166/1883] Convert 'Dropping client:' to Zone Status --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 8fb5e541c..ec2be21f5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -515,7 +515,7 @@ void EntityList::MobProcess() #ifdef _WINDOWS struct in_addr in; in.s_addr = mob->CastToClient()->GetIP(); - std::cout << "Dropping client: Process=false, ip=" << inet_ntoa(in) << ", port=" << mob->CastToClient()->GetPort() << std::endl; + Log.Out(Logs::General, Logs::Zone_Server, "Dropping client: Process=false, ip=%s port=%u", inet_ntoa(in), mob->CastToClient()->GetPort()); #endif zone->StartShutdownTimer(); Group *g = GetGroupByMob(mob); From e428b373ac4a485ffe436389338ac3f106c8c5a0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:02:00 -0600 Subject: [PATCH 1167/1883] Adjust category names --- common/eqemu_logsys.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index fe960c8d0..2ac824624 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -84,7 +84,7 @@ namespace Logs{ "AI", "Aggro", "Attack", - "Client_Server_Packet", + "Client Server Packet", "Combat", "Commands", "Crash", @@ -98,22 +98,22 @@ namespace Logs{ "Normal", "Object", "Pathing", - "QS_Server", + "QS Server", "Quests", "Rules", "Skills", "Spawns", "Spells", "Status", - "TCP_Connection", + "TCP Connection", "Tasks", "Tradeskills", "Trading", "Tribute", - "UCS_Server", - "WebInterface_Server", - "World_Server", - "Zone_Server", + "UCS Server", + "WebInterface Server", + "World Server", + "Zone Server", }; } From ab4595f56d3a7fbe55342f1ca035661d7384cbbd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:22:23 -0600 Subject: [PATCH 1168/1883] Remove QueryPerformanceCounter code --- common/debug.cpp | 2 ++ common/debug.h | 16 ---------------- common/eqemu_logsys.cpp | 5 +---- zone/net.cpp | 19 ------------------- 4 files changed, 3 insertions(+), 39 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 6f5426927..08d8ee8e2 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -1,3 +1,5 @@ + + #include #include diff --git a/common/debug.h b/common/debug.h index 4fc28a8ad..889903a88 100644 --- a/common/debug.h +++ b/common/debug.h @@ -110,20 +110,4 @@ private: extern EQEmuLog* LogFile; -#ifdef _EQDEBUG -class PerformanceMonitor { -public: - PerformanceMonitor(int64* ip) { - p = ip; - QueryPerformanceCounter(&tmp); - } - ~PerformanceMonitor() { - LARGE_INTEGER tmp2; - QueryPerformanceCounter(&tmp2); - *p += tmp2.QuadPart - tmp.QuadPart; - } - LARGE_INTEGER tmp; - int64* p; -}; -#endif #endif diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index ad4cb13ae..468529cda 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -118,9 +118,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) if (process_log){ process_log << time_stamp << " " << StringFormat("[%s] ", Logs::LogCategoryName[log_category]).c_str() << message << std::endl; } - else{ - // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; - } } uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ @@ -140,7 +137,7 @@ uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ case Logs::Crash: return Console::Color::LightRed; default: - return Console::Color::White; + return Console::Color::Yellow; } } diff --git a/zone/net.cpp b/zone/net.cpp index ab2e06871..c2ec1b629 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -455,25 +455,6 @@ int main(int argc, char** argv) { worldserver.AsyncConnect(); } -#if defined(_EQDEBUG) && defined(DEBUG_PC) - QueryPerformanceCounter(&tmp3); - mainloop_time += tmp3.QuadPart - tmp2.QuadPart; - if (!--tmp0) { - tmp0 = 200; - printf("Elapsed Tics : %9.0f (%1.4f sec)\n", (double)mainloop_time, ((double)mainloop_time/tmp.QuadPart)); - printf("NPCAI Tics : %9.0f (%1.2f%%)\n", (double)npcai_time, ((double)npcai_time/mainloop_time)*100); - printf("FindSpell Tics: %9.0f (%1.2f%%)\n", (double)findspell_time, ((double)findspell_time/mainloop_time)*100); - printf("AtkAllowd Tics: %9.0f (%1.2f%%)\n", (double)IsAttackAllowed_time, ((double)IsAttackAllowed_time/mainloop_time)*100); - printf("ClientPro Tics: %9.0f (%1.2f%%)\n", (double)clientprocess_time, ((double)clientprocess_time/mainloop_time)*100); - printf("ClientAtk Tics: %9.0f (%1.2f%%)\n", (double)clientattack_time, ((double)clientattack_time/mainloop_time)*100); - mainloop_time = 0; - npcai_time = 0; - findspell_time = 0; - IsAttackAllowed_time = 0; - clientprocess_time = 0; - clientattack_time = 0; - } -#endif #ifdef EQPROFILE #ifdef PROFILE_DUMP_TIME if(profile_dump_timer.Check()) { From d45bc6d26a4ff9fd102ad6829c4100bc331cf2c6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:25:46 -0600 Subject: [PATCH 1169/1883] General cleanup --- zone/net.cpp | 16 ++++------------ zone/worldserver.cpp | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index c2ec1b629..40ad52616 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -348,15 +348,10 @@ int main(int argc, char** argv) { //Advance the timer to our current point in time Timer::SetCurrentTime(); - //process stuff from world worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { Log.Out(Logs::Detail, Logs::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); - - // log_sys.CloseZoneLogs(); - // log_sys.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); - if (!eqsf.Open(Config->ZonePort)) { Log.Out(Logs::General, Logs::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); @@ -429,10 +424,8 @@ int main(int argc, char** argv) { if(net.raid_timer.Enabled() && net.raid_timer.Check()) entity_list.RaidProcess(); - entity_list.Process(); - - entity_list.MobProcess(); - + entity_list.Process(); + entity_list.MobProcess(); entity_list.BeaconProcess(); if (zone) { @@ -462,7 +455,7 @@ int main(int argc, char** argv) { } #endif #endif - } //end extra profiler block + } //end extra profiler block Sleep(ZoneTimerResolution); } @@ -504,8 +497,7 @@ void Shutdown() { Zone::Shutdown(true); RunLoops = false; - worldserver.Disconnect(); - // safe_delete(worldserver); + worldserver.Disconnect(); Log.Out(Logs::Detail, Logs::Zone_Server, "Shutting down..."); } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index f3211b7e1..d08384515 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -131,7 +131,7 @@ void WorldServer::OnConnected() { SendPacket(pack); safe_delete(pack); } - +/* Zone Process Packets from World */ void WorldServer::Process() { WorldConnection::Process(); From 7503e292110e6e4d70980f5a873e5671bd3e3b3e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:28:00 -0600 Subject: [PATCH 1170/1883] Remove LogSettingsFile from config parsers which removes log.ini completely --- common/eqemu_config.cpp | 8 -------- common/eqemu_config.h | 2 -- zone/net.cpp | 2 -- 3 files changed, 12 deletions(-) diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp index 2fe10ee9d..a2483c9b8 100644 --- a/common/eqemu_config.cpp +++ b/common/eqemu_config.cpp @@ -254,10 +254,6 @@ void EQEmuConfig::do_files(TiXmlElement *ele) if (text) { OpCodesFile = text; } - text = ParseTextBlock(ele, "logsettings", true); - if (text) { - LogSettingsFile = text; - } text = ParseTextBlock(ele, "eqtime", true); if (text) { EQTimeFile = text; @@ -415,9 +411,6 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const if (var_name == "EQTimeFile") { return (EQTimeFile); } - if (var_name == "LogSettingsFile") { - return (LogSettingsFile); - } if (var_name == "MapDir") { return (MapDir); } @@ -483,7 +476,6 @@ void EQEmuConfig::Dump() const std::cout << "SpellsFile = " << SpellsFile << std::endl; std::cout << "OpCodesFile = " << OpCodesFile << std::endl; std::cout << "EQTimeFile = " << EQTimeFile << std::endl; - std::cout << "LogSettingsFile = " << LogSettingsFile << std::endl; std::cout << "MapDir = " << MapDir << std::endl; std::cout << "QuestDir = " << QuestDir << std::endl; std::cout << "PluginDir = " << PluginDir << std::endl; diff --git a/common/eqemu_config.h b/common/eqemu_config.h index 908d66aa1..1ad2174dc 100644 --- a/common/eqemu_config.h +++ b/common/eqemu_config.h @@ -80,7 +80,6 @@ class EQEmuConfig : public XMLParser std::string SpellsFile; std::string OpCodesFile; std::string EQTimeFile; - std::string LogSettingsFile; // From std::string MapDir; @@ -156,7 +155,6 @@ class EQEmuConfig : public XMLParser SpellsFile = "spells_us.txt"; OpCodesFile = "opcodes.conf"; EQTimeFile = "eqtime.cfg"; - LogSettingsFile = "log.ini"; // Dirs MapDir = "Maps"; QuestDir = "quests"; diff --git a/zone/net.cpp b/zone/net.cpp index 40ad52616..bbf0855cc 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -201,8 +201,6 @@ int main(int argc, char** argv) { } #endif - const char *log_ini_file = "./log.ini"; - Log.Out(Logs::Detail, Logs::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); From 2a6a3e419c61086a3bff7838b8685519ea06ab16 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:33:15 -0600 Subject: [PATCH 1171/1883] Remove logtypes.h from header includes and the file itself --- common/CMakeLists.txt | 1 - common/logtypes.h | 266 ------------------------------------------ common/spdat.cpp | 2 +- world/queryserv.cpp | 2 +- world/ucs.cpp | 2 +- zone/net.cpp | 9 +- 6 files changed, 6 insertions(+), 276 deletions(-) delete mode 100644 common/logtypes.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 4e5791330..1ddbeb94a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -142,7 +142,6 @@ SET(common_headers item_struct.h languages.h linked_list.h - logtypes.h loottable.h mail_oplist.h md5.h diff --git a/common/logtypes.h b/common/logtypes.h deleted file mode 100644 index 8ebd48f9a..000000000 --- a/common/logtypes.h +++ /dev/null @@ -1,266 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2006 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 LOG_CATEGORY -#define LOG_CATEGORY(name) -#endif -#ifndef LOG_TYPE -#define LOG_TYPE(cat, type, default_value) -#endif -#ifndef ENABLED -#define ENABLED true -#endif -#ifndef DISABLED -#define DISABLED false -#endif - - -LOG_CATEGORY( CHAT ) -LOG_TYPE( CHAT, SAY, DISABLED ) -LOG_TYPE( CHAT, EMOTE, DISABLED ) -LOG_TYPE( CHAT, OOC, DISABLED ) -LOG_TYPE( CHAT, GROUP, DISABLED ) -LOG_TYPE( CHAT, GUILD, DISABLED ) - -LOG_CATEGORY( MAIL ) -LOG_TYPE( MAIL, INIT, ENABLED ) -LOG_TYPE( MAIL, ERROR, ENABLED ) -LOG_TYPE( MAIL, CLIENT, DISABLED ) -LOG_TYPE( MAIL, TRACE, DISABLED ) -LOG_TYPE( MAIL, PACKETS, DISABLED) - -LOG_CATEGORY( CHANNELS ) -LOG_TYPE( CHANNELS, INIT, ENABLED ) -LOG_TYPE( CHANNELS, ERROR, ENABLED ) -LOG_TYPE( CHANNELS, CLIENT, DISABLED ) -LOG_TYPE( CHANNELS, TRACE, DISABLED ) -LOG_TYPE( CHANNELS, PACKETS, DISABLED) - -LOG_CATEGORY( UCS ) -LOG_TYPE( UCS, INIT, ENABLED ) -LOG_TYPE( UCS, ERROR, ENABLED ) -LOG_TYPE( UCS, CLIENT, DISABLED ) -LOG_TYPE( UCS, TRACE, DISABLED ) -LOG_TYPE( UCS, PACKETS, DISABLED) - -LOG_CATEGORY( QUERYSERV ) -LOG_TYPE( QUERYSERV, INIT, ENABLED ) -LOG_TYPE( QUERYSERV, ERROR, ENABLED ) -LOG_TYPE( QUERYSERV, CLIENT, DISABLED ) -LOG_TYPE( QUERYSERV, TRACE, DISABLED ) -LOG_TYPE( QUERYSERV, PACKETS, DISABLED) - -LOG_CATEGORY( SOCKET_SERVER) -LOG_TYPE( SOCKET_SERVER, INIT, ENABLED) -LOG_TYPE( SOCKET_SERVER, ERROR, ENABLED) -LOG_TYPE( SOCKET_SERVER, CLIENT, DISABLED) -LOG_TYPE( SOCKET_SERVER, TRACE, DISABLED) -LOG_TYPE( SOCKET_SERVER, PACKETS, DISABLED) - -LOG_CATEGORY( SPAWNS ) -LOG_TYPE( SPAWNS, MAIN, DISABLED ) -LOG_TYPE( SPAWNS, CONDITIONS, DISABLED ) -LOG_TYPE( SPAWNS, LIMITS, DISABLED ) - -LOG_CATEGORY( AI ) -LOG_TYPE( AI, ERROR, ENABLED ) -LOG_TYPE( AI, WAYPOINTS, DISABLED ) -LOG_TYPE( AI, BUFFS, DISABLED ) -LOG_TYPE( AI, SPELLS, DISABLED ) - -LOG_CATEGORY( PATHING) -LOG_TYPE( PATHING, DEBUG, DISABLED ) - -LOG_CATEGORY( QUESTS ) -LOG_TYPE( QUESTS, PATHING, DISABLED ) - -LOG_CATEGORY( SPELLS ) -LOG_TYPE( SPELLS, LOAD, DISABLED ) -LOG_TYPE( SPELLS, LOAD_ERR, DISABLED ) -LOG_TYPE( SPELLS, CASTING_ERR, DISABLED ) -LOG_TYPE( SPELLS, CASTING, DISABLED ) -LOG_TYPE( SPELLS, EFFECT_VALUES, DISABLED ) -LOG_TYPE( SPELLS, RESISTS, DISABLED ) -LOG_TYPE( SPELLS, STACKING, DISABLED ) -LOG_TYPE( SPELLS, BARDS, DISABLED ) -LOG_TYPE( SPELLS, BUFFS, DISABLED ) -LOG_TYPE( SPELLS, PROCS, DISABLED ) -LOG_TYPE( SPELLS, MODIFIERS, DISABLED ) -LOG_TYPE( SPELLS, CRITS, DISABLED ) -LOG_TYPE( SPELLS, REZ, DISABLED ) - -LOG_CATEGORY( FACTION ) - -LOG_CATEGORY( ZONE ) -LOG_TYPE( ZONE, GROUND_SPAWNS, DISABLED ) -LOG_TYPE( ZONE, SPAWNS, ENABLED) -LOG_TYPE( ZONE, INIT, ENABLED ) -LOG_TYPE( ZONE, INIT_ERR, ENABLED ) -LOG_TYPE( ZONE, WORLD, ENABLED ) -LOG_TYPE( ZONE, WORLD_ERR, ENABLED ) -LOG_TYPE( ZONE, WORLD_TRACE, DISABLED ) - -LOG_CATEGORY( TASKS ) -LOG_TYPE( TASKS, GLOBALLOAD, DISABLED ) -LOG_TYPE( TASKS, CLIENTLOAD, DISABLED ) -LOG_TYPE( TASKS, UPDATE, DISABLED ) -LOG_TYPE( TASKS, CLIENTSAVE, DISABLED ) -LOG_TYPE( TASKS, PACKETS, DISABLED ) -LOG_TYPE( TASKS, PROXIMITY, DISABLED ) - - -LOG_CATEGORY( TRADING ) -LOG_TYPE( TRADING, ERROR, ENABLED ) -LOG_TYPE( TRADING, CLIENT, DISABLED ) -LOG_TYPE( TRADING, NPC, DISABLED ) -LOG_TYPE( TRADING, HOLDER, DISABLED ) -LOG_TYPE( TRADING, BARTER, DISABLED ) -LOG_TYPE( TRADING, PACKETS, DISABLED ) - -LOG_CATEGORY( INVENTORY ) -LOG_TYPE( INVENTORY, ERROR, ENABLED ) -LOG_TYPE( INVENTORY, SLOTS, ENABLED ) -LOG_TYPE( INVENTORY, BANDOLIER, ENABLED ) - -LOG_CATEGORY( TRADESKILLS ) -LOG_TYPE( TRADESKILLS, IN, DISABLED ) -LOG_TYPE( TRADESKILLS, OUT, DISABLED ) -LOG_TYPE( TRADESKILLS, SQL, DISABLED ) -LOG_TYPE( TRADESKILLS, TRACE, DISABLED ) - -LOG_CATEGORY( TRIBUTE ) -LOG_TYPE( TRIBUTE, ERROR, DISABLED ) -LOG_TYPE( TRIBUTE, IN, DISABLED ) -LOG_TYPE( TRIBUTE, OUT, DISABLED ) - -LOG_CATEGORY( AA ) -LOG_TYPE( AA, ERROR, ENABLED ) -LOG_TYPE( AA, MESSAGE, DISABLED ) -LOG_TYPE( AA, IN, DISABLED ) -LOG_TYPE( AA, OUT, DISABLED ) -LOG_TYPE( AA, BONUSES, DISABLED ) - - -LOG_CATEGORY( DOORS ) -LOG_TYPE( DOORS, INFO, DISABLED ) - -LOG_CATEGORY( PETS ) -LOG_TYPE( PETS, AGGRO, DISABLED ) - -LOG_CATEGORY( COMBAT ) -LOG_TYPE( COMBAT, ATTACKS, DISABLED ) -LOG_TYPE( COMBAT, TOHIT, DISABLED ) -LOG_TYPE( COMBAT, MISSES, DISABLED ) -LOG_TYPE( COMBAT, DAMAGE, DISABLED ) -LOG_TYPE( COMBAT, HITS, DISABLED ) -LOG_TYPE( COMBAT, RANGED, DISABLED ) -LOG_TYPE( COMBAT, SPECIAL_ATTACKS, DISABLED ) -LOG_TYPE( COMBAT, PROCS, DISABLED ) - -LOG_CATEGORY( GUILDS ) -LOG_TYPE( GUILDS, ERROR, ENABLED ) -LOG_TYPE( GUILDS, ACTIONS, ENABLED ) -LOG_TYPE( GUILDS, DB, DISABLED ) -LOG_TYPE( GUILDS, PERMISSIONS, DISABLED ) -LOG_TYPE( GUILDS, REFRESH, DISABLED ) //inter-zone refresh comm -LOG_TYPE( GUILDS, IN_PACKETS, DISABLED ) -LOG_TYPE( GUILDS, OUT_PACKETS, DISABLED ) -LOG_TYPE( GUILDS, IN_PACKET_TRACE, DISABLED ) //hex dumps -LOG_TYPE( GUILDS, OUT_PACKET_TRACE, DISABLED ) //hex dumps -LOG_TYPE( GUILDS, BANK_ERROR, ENABLED ) - -LOG_CATEGORY( CLIENT ) -LOG_TYPE( CLIENT, ERROR, ENABLED ) -LOG_TYPE( CLIENT, DUELING, DISABLED ) -LOG_TYPE( CLIENT, SPELLS, DISABLED ) -LOG_TYPE( CLIENT, NET_ERR, ENABLED ) -LOG_TYPE( CLIENT, NET_IN_TRACE, DISABLED ) -LOG_TYPE( CLIENT, EXP, DISABLED ) - -LOG_CATEGORY( SKILLS ) -LOG_TYPE( SKILLS, GAIN, DISABLED ) - -LOG_CATEGORY( RULES ) -LOG_TYPE( RULES, ERROR, DISABLED ) -LOG_TYPE( RULES, CHANGE, DISABLED ) - -LOG_CATEGORY( NET ) -LOG_TYPE( NET, WORLD, ENABLED ) -LOG_TYPE( NET, OPCODES, ENABLED ) -LOG_TYPE( NET, IDENTIFY, ENABLED ) -LOG_TYPE( NET, IDENT_TRACE, ENABLED ) -LOG_TYPE( NET, STRUCTS, ENABLED ) -LOG_TYPE( NET, STRUCT_HEX, ENABLED ) -LOG_TYPE( NET, ERROR, ENABLED ) -LOG_TYPE( NET, DEBUG, DISABLED ) -LOG_TYPE( NET, APP_TRACE, DISABLED ) -LOG_TYPE( NET, APP_CREATE, DISABLED ) -LOG_TYPE( NET, APP_CREATE_HEX, DISABLED ) -LOG_TYPE( NET, NET_TRACE, DISABLED ) -LOG_TYPE( NET, NET_COMBINE, DISABLED ) -LOG_TYPE( NET, FRAGMENT, DISABLED ) -LOG_TYPE( NET, FRAGMENT_HEX, DISABLED ) -LOG_TYPE( NET, NET_CREATE, DISABLED ) -LOG_TYPE( NET, NET_CREATE_HEX, DISABLED ) -LOG_TYPE( NET, NET_ACKS, DISABLED ) -LOG_TYPE( NET, RATES, DISABLED ) - -LOG_CATEGORY( DATABASE ) - -LOG_CATEGORY( COMMON ) -LOG_TYPE( COMMON, ERROR, ENABLED ) -LOG_TYPE( COMMON, THREADS, ENABLED ) - -LOG_CATEGORY( LAUNCHER ) -LOG_TYPE( LAUNCHER, ERROR, ENABLED ) -LOG_TYPE( LAUNCHER, INIT, ENABLED ) -LOG_TYPE( LAUNCHER, STATUS, ENABLED ) -LOG_TYPE( LAUNCHER, NET, ENABLED ) -LOG_TYPE( LAUNCHER, WORLD, ENABLED ) - -LOG_CATEGORY( WORLD ) -LOG_TYPE( WORLD, CONFIG, ENABLED ) -LOG_TYPE( WORLD, INIT, ENABLED ) -LOG_TYPE( WORLD, INIT_ERR, ENABLED ) -LOG_TYPE( WORLD, CLIENT, ENABLED ) -LOG_TYPE( WORLD, ZONE, ENABLED ) -LOG_TYPE( WORLD, LS, ENABLED ) -LOG_TYPE( WORLD, CLIENT_ERR, ENABLED ) -LOG_TYPE( WORLD, ZONE_ERR, ENABLED ) -LOG_TYPE( WORLD, LS_ERR, ENABLED ) -LOG_TYPE( WORLD, SHUTDOWN, ENABLED ) -LOG_TYPE( WORLD, CLIENTLIST, DISABLED ) -LOG_TYPE( WORLD, CLIENTLIST_ERR, ENABLED ) -LOG_TYPE( WORLD, ZONELIST, ENABLED ) -LOG_TYPE( WORLD, ZONELIST_ERR, ENABLED ) -LOG_TYPE( WORLD, CLIENT_TRACE, DISABLED ) -LOG_TYPE( WORLD, ZONE_TRACE, DISABLED ) -LOG_TYPE( WORLD, LS_TRACE, DISABLED ) -LOG_TYPE( WORLD, CONSOLE, ENABLED ) -LOG_TYPE( WORLD, HTTP, ENABLED ) -LOG_TYPE( WORLD, HTTP_ERR, ENABLED ) -LOG_TYPE( WORLD, PERL, ENABLED ) -LOG_TYPE( WORLD, PERL_ERR, ENABLED ) -LOG_TYPE( WORLD, EQW, ENABLED ) -LOG_TYPE( WORLD, LAUNCH, ENABLED ) -LOG_TYPE( WORLD, LAUNCH_ERR, ENABLED ) -LOG_TYPE( WORLD, LAUNCH_TRACE, ENABLED ) - -#undef LOG_TYPE -#undef LOG_CATEGORY - diff --git a/common/spdat.cpp b/common/spdat.cpp index 6359d51dd..4b847b75e 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -71,7 +71,7 @@ */ -#include "../common/logtypes.h" + #include "../common/eqemu_logsys.h" #include "classes.h" diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 370fae5fc..171dcaa13 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -5,7 +5,7 @@ #include "clientlist.h" #include "zonelist.h" -#include "../common/logtypes.h" + #include "../common/md5.h" #include "../common/emu_tcp_connection.h" #include "../common/packet_dump.h" diff --git a/world/ucs.cpp b/world/ucs.cpp index 11cff6a69..4f9827a36 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -3,7 +3,7 @@ #include "ucs.h" #include "world_config.h" -#include "../common/logtypes.h" + #include "../common/md5.h" #include "../common/emu_tcp_connection.h" #include "../common/packet_dump.h" diff --git a/zone/net.cpp b/zone/net.cpp index bbf0855cc..18669cb8e 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -114,12 +114,9 @@ void Shutdown(); extern void MapOpcodes(); int main(int argc, char** argv) { - RegisterExecutablePlatform(ExePlatformZone); - - set_exception_handler(); - - const char *zone_name; - + RegisterExecutablePlatform(ExePlatformZone); + set_exception_handler(); + const char *zone_name; QServ = new QueryServ; if(argc == 3) { From 4d6c2be191de53df80bfbd165d61584a7f90120e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:36:50 -0600 Subject: [PATCH 1172/1883] Gut more of debug.cpp/.h --- common/debug.cpp | 18 ------------------ common/debug.h | 27 --------------------------- 2 files changed, 45 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 08d8ee8e2..6c47705bd 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -58,28 +58,10 @@ static volatile bool logFileValid = false; static EQEmuLog realLogFile; EQEmuLog *LogFile = &realLogFile; -static const char* FileNames[EQEmuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" }; -static const char* LogNames[EQEmuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" }; - EQEmuLog::EQEmuLog() { - pLogStatus[EQEmuLog::LogIDs::Status] = LOG_LEVEL_STATUS; - pLogStatus[EQEmuLog::LogIDs::Normal] = LOG_LEVEL_NORMAL; - pLogStatus[EQEmuLog::LogIDs::Error] = LOG_LEVEL_ERROR; - pLogStatus[EQEmuLog::LogIDs::Debug] = LOG_LEVEL_DEBUG; - pLogStatus[EQEmuLog::LogIDs::Quest] = LOG_LEVEL_QUEST; - pLogStatus[EQEmuLog::LogIDs::Commands] = LOG_LEVEL_COMMANDS; - pLogStatus[EQEmuLog::LogIDs::Crash] = LOG_LEVEL_CRASH; - logFileValid = true; } EQEmuLog::~EQEmuLog() { - logFileValid = false; - for (int i = 0; i < MaxLogID; i++) { - LockMutex lock(&MLog[i]); //to prevent termination race - if (fp[i]) { - fclose(fp[i]); - } - } } \ No newline at end of file diff --git a/common/debug.h b/common/debug.h index 889903a88..50567e0e8 100644 --- a/common/debug.h +++ b/common/debug.h @@ -78,34 +78,7 @@ class EQEmuLog { public: EQEmuLog(); ~EQEmuLog(); - - enum LogIDs { - Status = 0, /* This must stay the first entry in this list */ - Normal, /* Normal Logs */ - Error, /* Error Logs */ - Debug, /* Debug Logs */ - Quest, /* Quest Logs */ - Commands, /* Issued Comamnds */ - Crash, /* Crash Logs */ - Save, /* Client Saves */ - MaxLogID /* Max, used in functions to get the max log ID */ - }; - - private: - - Mutex MOpen; - Mutex MLog[MaxLogID]; - FILE* fp[MaxLogID]; - -/* LogStatus: bitwise variable - 1 = output to file - 2 = output to stdout - 4 = fopen error, dont retry - 8 = use stderr instead (2 must be set) -*/ - uint8 pLogStatus[MaxLogID]; - }; extern EQEmuLog* LogFile; From d7d1f9757b4a70659818d027ca4f9b53a3176aca Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:37:12 -0600 Subject: [PATCH 1173/1883] Removal of client_logs.cpp/.h --- zone/client.cpp | 4 -- zone/client_logs.cpp | 113 ------------------------------------------- zone/client_logs.h | 58 ---------------------- zone/zone.cpp | 3 -- 4 files changed, 178 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index d7b34f2b9..ac8646a9a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -349,10 +349,6 @@ Client::~Client() { m_tradeskill_object = nullptr; } -#ifdef CLIENT_LOGS - client_logs.unsubscribeAll(this); -#endif - ChangeSQLLog(nullptr); if(IsDueling() && GetDuelTarget() != 0) { Entity* entity = entity_list.GetID(GetDuelTarget()); diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index de6278dcd..e69de29bb 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -1,113 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 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 -*/ -#include "../common/debug.h" -#include "../common/features.h" -#include "../common/eqemu_logsys.h" - -#ifdef CLIENT_LOGS -#include "client_logs.h" -#include "client.h" -#include "entity.h" -#include - -ClientLogs client_logs; - -char ClientLogs::_buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1]; - -void ClientLogs::subscribe(EQEmuLog::LogIDs id, Client *c) { - if(id >= EQEmuLog::MaxLogID) - return; - if(c == nullptr) - return; - - std::vector::iterator cur,end; - cur = entries[id].begin(); - end = entries[id].end(); - for(; cur != end; ++cur) { - if(*cur == c) { - printf("%s was already subscribed to %d\n", c->GetName(), id); - return; - } - } - - printf("%s has been subscribed to %d\n", c->GetName(), id); - entries[id].push_back(c); -} - -void ClientLogs::unsubscribe(EQEmuLog::LogIDs id, Client *c) { - if(id >= EQEmuLog::MaxLogID) - return; - if(c == nullptr) - return; - - std::vector::iterator cur,end; - cur = entries[id].begin(); - end = entries[id].end(); - for(; cur != end; ++cur) { - if(*cur == c) { - entries[id].erase(cur); - return; - } - } -} - -void ClientLogs::subscribeAll(Client *c) { - if(c == nullptr) - return; - int r; - for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { - subscribe((EQEmuLog::LogIDs)r, c); - } -} - -void ClientLogs::unsubscribeAll(Client *c) { - if(c == nullptr) - return; - int r; - for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { - unsubscribe((EQEmuLog::LogIDs)r, c); - } -} - -void ClientLogs::clear() { - int r; - for(r = EQEmuLog::Status; r < EQEmuLog::MaxLogID; r++) { - entries[r].clear(); - } -} - -void ClientLogs::msg(EQEmuLog::LogIDs id, const char *buf) { - if(id >= EQEmuLog::MaxLogID) - return; - std::vector::iterator cur,end; - cur = entries[id].begin(); - end = entries[id].end(); - for(; cur != end; ++cur) { - if(!(*cur)->InZone()) - continue; - - (*cur)->Message(CLIENT_LOG_CHANNEL, buf); - } -} - - - -#endif //CLIENT_LOGS - - - diff --git a/zone/client_logs.h b/zone/client_logs.h index aacefdba9..e69de29bb 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -1,58 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2004 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 CLIENT_LOGS_H -#define CLIENT_LOGS_H - -#include "../common/debug.h" -#include "../common/features.h" - -#ifdef CLIENT_LOGS - -#define CLIENT_LOG_CHANNEL MT_Chat10Echo - -//trim messages to this length before sending to any clients -#define MAX_CLIENT_LOG_MESSAGE_LENGTH 512 - -#include - -class Client; - -class ClientLogs { -public: - - void subscribe(EQEmuLog::LogIDs id, Client *c); - void unsubscribe(EQEmuLog::LogIDs id, Client *c); - void subscribeAll(Client *c); - void unsubscribeAll(Client *c); - void clear(); //unsubscribes everybody - - void msg(EQEmuLog::LogIDs id, const char *buf); - -protected: - - std::vector entries[EQEmuLog::MaxLogID]; - - static char _buffer[MAX_CLIENT_LOG_MESSAGE_LENGTH+1]; -}; - -extern ClientLogs client_logs; - -#endif //CLIENT_LOGS -#endif - diff --git a/zone/zone.cpp b/zone/zone.cpp index b4394377f..3a81475a9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -888,9 +888,6 @@ Zone::~Zone() { } safe_delete_array(aas); } -#ifdef CLIENT_LOGS - client_logs.clear(); -#endif safe_delete(GuildBanks); } From dda1806dfbd4851b062091054c0a24bac6028aab Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:38:07 -0600 Subject: [PATCH 1174/1883] File deletion of client_logs and CMakeLists.txt update --- zone/CMakeLists.txt | 2 -- zone/client_logs.cpp | 0 zone/client_logs.h | 0 3 files changed, 2 deletions(-) delete mode 100644 zone/client_logs.cpp delete mode 100644 zone/client_logs.h diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 5da25e64f..d6c18bae0 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -9,7 +9,6 @@ SET(zone_sources bot.cpp botspellsai.cpp client.cpp - client_logs.cpp client_mods.cpp client_packet.cpp client_process.cpp @@ -128,7 +127,6 @@ SET(zone_headers bot.h bot_structs.h client.h - client_logs.h client_packet.h command.h common.h diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/zone/client_logs.h b/zone/client_logs.h deleted file mode 100644 index e69de29bb..000000000 From fa83809130493376ba33acc1f7db37353f953f63 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:40:09 -0600 Subject: [PATCH 1175/1883] Removal of client_logs.h from #includes --- zone/client.cpp | 2 +- zone/command.cpp | 2 +- zone/net.cpp | 4 ++-- zone/zone.cpp | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index ac8646a9a..c0f9ff64b 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -47,7 +47,7 @@ extern volatile bool RunLoops; #include "petitions.h" #include "command.h" #include "string_ids.h" -#include "client_logs.h" + #include "guild_mgr.h" #include "quest_parser_collection.h" #include "queryserv.h" diff --git a/zone/command.cpp b/zone/command.cpp index 06e4114d0..fe8d3d9fd 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -53,7 +53,7 @@ #include "../common/string_util.h" #include "../common/eqemu_logsys.h" -#include "client_logs.h" + #include "command.h" #include "guild_mgr.h" #include "map.h" diff --git a/zone/net.cpp b/zone/net.cpp index 18669cb8e..078f9cdd7 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -45,7 +45,7 @@ #include "../common/spdat.h" #include "../common/eqemu_logsys.h" -#include "client_logs.h" + #include "zone_config.h" #include "masterentity.h" #include "worldserver.h" @@ -61,7 +61,7 @@ #include "quest_parser_collection.h" #include "embparser.h" #include "lua_parser.h" -#include "client_logs.h" + #include "questmgr.h" #include diff --git a/zone/zone.cpp b/zone/zone.cpp index 3a81475a9..ecfdb4cef 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -37,7 +37,6 @@ #include "../common/string_util.h" #include "../common/eqemu_logsys.h" -#include "client_logs.h" #include "guild_mgr.h" #include "map.h" #include "net.h" From 62ff6453ef876d71906b2ba44e5aaf6e3fcb5e1e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:43:30 -0600 Subject: [PATCH 1176/1883] Remove EQDEBUG preprocessor from debug --- common/debug.cpp | 4 ---- common/debug.h | 27 --------------------------- 2 files changed, 31 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 6c47705bd..1dfe0ad85 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -54,10 +54,6 @@ namespace ConsoleColor { #define va_copy(d,s) ((d) = (s)) #endif -static volatile bool logFileValid = false; -static EQEmuLog realLogFile; -EQEmuLog *LogFile = &realLogFile; - EQEmuLog::EQEmuLog() { } diff --git a/common/debug.h b/common/debug.h index 50567e0e8..42c0f8e76 100644 --- a/common/debug.h +++ b/common/debug.h @@ -16,31 +16,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Debug Levels -#ifndef EQDEBUG -#define EQDEBUG 1 -#else -////// File/Console options -// 0 <= Quiet mode Errors to file Status and Normal ignored -// 1 >= Status and Normal to console, Errors to file -// 2 >= Status, Normal, and Error to console and logfile -// 3 >= Lite debug -// 4 >= Medium debug -// 5 >= Debug release (Anything higher is not recommended for regular use) -// 6 == (Reserved for special builds) Login opcode debug All packets dumped -// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped -// 8 == (Reserved for special builds) World opcode debug All packets dumped -// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped -// 10 >= More than you ever wanted to know -// -///// -// Add more below to reserve for file's functions ect. -///// -// Any setup code based on defines should go here -// -#endif - - #if defined(_DEBUG) && defined(WIN32) #ifndef _CRTDBG_MAP_ALLOC #include @@ -81,6 +56,4 @@ public: private: }; -extern EQEmuLog* LogFile; - #endif From 89b16512d5e000932d947104b6a02d09c8ced82b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 03:49:25 -0600 Subject: [PATCH 1177/1883] Delete debug.cpp file and from cmake --- common/CMakeLists.txt | 1 - common/debug.cpp | 63 ------------------------------------------- common/debug.h | 13 --------- 3 files changed, 77 deletions(-) delete mode 100644 common/debug.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 1ddbeb94a..fe57eab59 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,7 +9,6 @@ SET(common_sources crc32.cpp database.cpp dbcore.cpp - debug.cpp emu_opcodes.cpp emu_tcp_connection.cpp emu_tcp_server.cpp diff --git a/common/debug.cpp b/common/debug.cpp deleted file mode 100644 index 1dfe0ad85..000000000 --- a/common/debug.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -#include -#include - -#ifdef _WINDOWS - #include - - #define snprintf _snprintf - #define vsnprintf _vsnprintf - #define strncasecmp _strnicmp - #define strcasecmp _stricmp - - #include - #include - #include - -namespace ConsoleColor { - enum Colors { - Black = 0, - Blue = 1, - Green = 2, - Cyan = 3, - Red = 4, - Magenta = 5, - Brown = 6, - LightGray = 7, - DarkGray = 8, - LightBlue = 9, - LightGreen = 10, - LightCyan = 11, - LightRed = 12, - LightMagenta = 13, - Yellow = 14, - White = 15, - }; -} - -#else - - #include - #include - -#endif - -#include "eqemu_logsys.h" -#include "debug.h" -#include "misc_functions.h" -#include "platform.h" -#include "eqemu_logsys.h" -#include "string_util.h" - -#ifndef va_copy - #define va_copy(d,s) ((d) = (s)) -#endif - -EQEmuLog::EQEmuLog() -{ -} - -EQEmuLog::~EQEmuLog() -{ -} \ No newline at end of file diff --git a/common/debug.h b/common/debug.h index 42c0f8e76..d6fbf3694 100644 --- a/common/debug.h +++ b/common/debug.h @@ -26,10 +26,6 @@ #ifndef EQDEBUG_H #define EQDEBUG_H -#ifndef _WINDOWS - #define DebugBreak() if(0) {} -#endif - #define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues #if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) ) // Packet Collector on win32 requires winsock.h due to latest pcap.h @@ -42,18 +38,9 @@ #include #endif - - #include "../common/mutex.h" #include #include -class EQEmuLog { -public: - EQEmuLog(); - ~EQEmuLog(); -private: -}; - #endif From 045125d328c14cf308ca9a6832ff7b807c709f59 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:02:45 -0600 Subject: [PATCH 1178/1883] Add types.h to a bunch of files --- common/clientversions.h | 2 ++ common/condition.h | 1 + common/debug.h | 6 +++--- common/eq_constants.h | 1 + common/moremath.cpp | 3 ++- common/moremath.h | 2 ++ common/proc_launcher.cpp | 1 + common/seperator.h | 3 ++- common/tcp_server.h | 2 +- 9 files changed, 15 insertions(+), 6 deletions(-) diff --git a/common/clientversions.h b/common/clientversions.h index ee70d481c..32108a633 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -1,6 +1,8 @@ #ifndef CLIENTVERSIONS_H #define CLIENTVERSIONS_H +#include "types.h" + static const uint32 BIT_Client62 = 1; static const uint32 BIT_Titanium = 2; static const uint32 BIT_SoF = 4; diff --git a/common/condition.h b/common/condition.h index bfbffe760..dde51cb6d 100644 --- a/common/condition.h +++ b/common/condition.h @@ -19,6 +19,7 @@ #define __CONDITION_H #include "debug.h" +#include "mutex.h" #ifndef WIN32 #include #endif diff --git a/common/debug.h b/common/debug.h index d6fbf3694..d21e49a7c 100644 --- a/common/debug.h +++ b/common/debug.h @@ -38,9 +38,9 @@ #include #endif -#include "../common/mutex.h" -#include -#include + + + #endif diff --git a/common/eq_constants.h b/common/eq_constants.h index 426d4a9e5..3ff7abd6b 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -19,6 +19,7 @@ #define EQ_CONSTANTS_H #include "skills.h" +#include "types.h" /* ** Item attributes diff --git a/common/moremath.cpp b/common/moremath.cpp index 84f0b8900..bd8412458 100644 --- a/common/moremath.cpp +++ b/common/moremath.cpp @@ -15,7 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" + +#include "types.h" // Quagmire - i was really surprised, but i couldnt find the equivilent standard library function signed char sign(signed int tmp) { diff --git a/common/moremath.h b/common/moremath.h index d000a54b8..8f03bcea3 100644 --- a/common/moremath.h +++ b/common/moremath.h @@ -18,6 +18,8 @@ #ifndef MOREMATH_H #define MOREMATH_H +#include "types.h" + signed char sign(signed int tmp); signed char sign(double tmp); uint32 pow32(uint32 base, uint32 exponet); diff --git a/common/proc_launcher.cpp b/common/proc_launcher.cpp index 0ea0d9636..36f58de86 100644 --- a/common/proc_launcher.cpp +++ b/common/proc_launcher.cpp @@ -20,6 +20,7 @@ #include #include "debug.h" +#include "types.h" #include "proc_launcher.h" #ifdef _WINDOWS #include diff --git a/common/seperator.h b/common/seperator.h index 62054d137..7e81f8164 100644 --- a/common/seperator.h +++ b/common/seperator.h @@ -23,8 +23,9 @@ #ifndef SEPERATOR_H #define SEPERATOR_H -#include +#include "types.h" #include +#include class Seperator { diff --git a/common/tcp_server.h b/common/tcp_server.h index 3e28a7ac7..0bc1966c0 100644 --- a/common/tcp_server.h +++ b/common/tcp_server.h @@ -2,7 +2,7 @@ #define TCPSERVER_H_ #include "types.h" - +#include "mutex.h" #include #include From d41ba853cf4dd52a47e7f668ae47968dc6992ba3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:04:50 -0600 Subject: [PATCH 1179/1883] Added types.h to more files that relied on mutex.h to get to debug.h to get to types.h --- common/loottable.h | 1 + zone/perl_perlpacket.cpp | 1 + zone/perlpacket.h | 1 + 3 files changed, 3 insertions(+) diff --git a/common/loottable.h b/common/loottable.h index 8ad2f1e72..d046c0c08 100644 --- a/common/loottable.h +++ b/common/loottable.h @@ -19,6 +19,7 @@ #ifndef _EQEMU_LOOTTABLE_H #define _EQEMU_LOOTTABLE_H +#include "types.h" #pragma pack(1) struct LootTableEntries_Struct { diff --git a/zone/perl_perlpacket.cpp b/zone/perl_perlpacket.cpp index 05bbf01f6..4a9c70464 100644 --- a/zone/perl_perlpacket.cpp +++ b/zone/perl_perlpacket.cpp @@ -28,6 +28,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES #include "../common/debug.h" +#include "../common/types.h" #include "embperl.h" #ifdef seed diff --git a/zone/perlpacket.h b/zone/perlpacket.h index a81e84ad0..4f8e39f0e 100644 --- a/zone/perlpacket.h +++ b/zone/perlpacket.h @@ -21,6 +21,7 @@ #include #include +#include "../common/types.h" #include "../common/emu_opcodes.h" class Client; From 0b70706a6447532fb3f2c69be72deb3c9156f5a9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:09:02 -0600 Subject: [PATCH 1180/1883] Stuff --- common/debug.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/debug.h b/common/debug.h index d21e49a7c..0c5d32ee9 100644 --- a/common/debug.h +++ b/common/debug.h @@ -1,5 +1,5 @@ /* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) + Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,9 +38,4 @@ #include #endif - - - - - #endif From 0d9b6703a61e6d0ea6073980b6d3a00d8212a8e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:12:09 -0600 Subject: [PATCH 1181/1883] Rename debug.h to global_define.h, update cmakelists and such --- client_files/export/main.cpp | 2 +- client_files/import/main.cpp | 2 +- common/CMakeLists.txt | 2 +- common/SocketLib/HTTPSocket.cpp | 2 +- common/SocketLib/HttpdCookies.cpp | 2 +- common/SocketLib/HttpdSocket.cpp | 2 +- common/base_packet.cpp | 2 +- common/classes.cpp | 2 +- common/condition.h | 2 +- common/crash.cpp | 2 +- common/database.cpp | 2 +- common/database.h | 2 +- common/debug.h | 41 ------------------------------- common/emu_opcodes.cpp | 2 +- common/emu_tcp_connection.cpp | 2 +- common/emu_tcp_server.cpp | 2 +- common/eq_packet.cpp | 2 +- common/eq_stream.cpp | 2 +- common/eq_stream_factory.cpp | 2 +- common/eq_stream_ident.cpp | 2 +- common/eq_stream_proxy.cpp | 2 +- common/eqdb.cpp | 2 +- common/eqdb_res.cpp | 2 +- common/eqemu_config.cpp | 2 +- common/eqtime.cpp | 2 +- common/extprofile.cpp | 2 +- common/guilds.cpp | 2 +- common/item.cpp | 2 +- common/misc.cpp | 2 +- common/misc_functions.cpp | 2 +- common/mutex.cpp | 2 +- common/opcode_map.cpp | 2 +- common/packet_dump_file.cpp | 2 +- common/packet_functions.cpp | 2 +- common/patches/patches.cpp | 2 +- common/patches/rof.cpp | 2 +- common/patches/rof2.cpp | 2 +- common/patches/sod.cpp | 2 +- common/patches/sof.cpp | 2 +- common/patches/titanium.cpp | 2 +- common/patches/underfoot.cpp | 2 +- common/perl_eqdb.cpp | 2 +- common/perl_eqdb_res.cpp | 2 +- common/proc_launcher.cpp | 2 +- common/proc_launcher.h | 2 +- common/ptimer.cpp | 2 +- common/struct_strategy.cpp | 2 +- common/tcp_connection.cpp | 2 +- common/tcp_server.cpp | 2 +- common/timeoutmgr.cpp | 2 +- common/timer.h | 2 +- common/worldconn.cpp | 2 +- common/xml_parser.cpp | 2 +- common/xml_parser.h | 2 +- eqlaunch/eqlaunch.cpp | 2 +- eqlaunch/worldserver.cpp | 2 +- eqlaunch/zone_launch.cpp | 2 +- queryserv/database.cpp | 2 +- queryserv/database.h | 2 +- queryserv/queryserv.cpp | 2 +- queryserv/queryservconfig.cpp | 2 +- queryserv/worldserver.cpp | 2 +- shared_memory/base_data.cpp | 2 +- shared_memory/items.cpp | 2 +- shared_memory/loot.cpp | 2 +- shared_memory/main.cpp | 2 +- shared_memory/npc_faction.cpp | 2 +- shared_memory/skill_caps.cpp | 2 +- shared_memory/spells.cpp | 2 +- ucs/clientlist.cpp | 2 +- ucs/database.cpp | 2 +- ucs/database.h | 2 +- ucs/ucs.cpp | 2 +- ucs/ucsconfig.cpp | 2 +- ucs/worldserver.cpp | 2 +- world/adventure.cpp | 2 +- world/adventure.h | 2 +- world/adventure_manager.cpp | 2 +- world/adventure_manager.h | 2 +- world/adventure_template.h | 2 +- world/client.cpp | 2 +- world/cliententry.cpp | 2 +- world/clientlist.cpp | 2 +- world/console.cpp | 2 +- world/eql_config.cpp | 2 +- world/eqw.cpp | 2 +- world/eqw_http_handler.cpp | 2 +- world/eqw_parser.cpp | 2 +- world/http_request.cpp | 2 +- world/launcher_link.cpp | 2 +- world/launcher_list.cpp | 2 +- world/login_server.cpp | 2 +- world/login_server_list.cpp | 2 +- world/net.cpp | 4 +-- world/perl_eql_config.cpp | 2 +- world/perl_eqw.cpp | 2 +- world/perl_http_request.cpp | 2 +- world/queryserv.cpp | 2 +- world/ucs.cpp | 2 +- world/wguild_mgr.cpp | 2 +- world/world_config.cpp | 2 +- world/zonelist.cpp | 2 +- world/zoneserver.cpp | 2 +- zone/aa.cpp | 2 +- zone/aggro.cpp | 2 +- zone/attack.cpp | 2 +- zone/bonuses.cpp | 2 +- zone/bot.h | 2 +- zone/client.cpp | 2 +- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 2 +- zone/client_process.cpp | 2 +- zone/command.cpp | 2 +- zone/corpse.cpp | 2 +- zone/doors.cpp | 2 +- zone/effects.cpp | 2 +- zone/embparser.cpp | 2 +- zone/embparser_api.cpp | 2 +- zone/embperl.cpp | 2 +- zone/embxs.cpp | 2 +- zone/entity.cpp | 2 +- zone/exp.cpp | 2 +- zone/forage.cpp | 2 +- zone/groups.cpp | 2 +- zone/horse.cpp | 2 +- zone/inventory.cpp | 2 +- zone/loottables.cpp | 2 +- zone/map.cpp | 2 +- zone/mob_ai.cpp | 2 +- zone/net.cpp | 2 +- zone/npc.cpp | 2 +- zone/object.cpp | 2 +- zone/pathing.cpp | 2 +- zone/perl_client.cpp | 2 +- zone/perl_doors.cpp | 2 +- zone/perl_entity.cpp | 2 +- zone/perl_groups.cpp | 2 +- zone/perl_hateentry.cpp | 2 +- zone/perl_mob.cpp | 2 +- zone/perl_npc.cpp | 2 +- zone/perl_object.cpp | 2 +- zone/perl_perlpacket.cpp | 2 +- zone/perl_player_corpse.cpp | 2 +- zone/perl_questitem.cpp | 2 +- zone/perl_raids.cpp | 2 +- zone/perlpacket.cpp | 2 +- zone/petitions.cpp | 2 +- zone/pets.cpp | 2 +- zone/queryserv.cpp | 2 +- zone/quest_parser_collection.cpp | 2 +- zone/questmgr.cpp | 2 +- zone/spawn2.cpp | 2 +- zone/spawngroup.cpp | 2 +- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 2 +- zone/tasks.cpp | 2 +- zone/tradeskills.cpp | 2 +- zone/trading.cpp | 2 +- zone/tribute.cpp | 2 +- zone/waypoints.cpp | 2 +- zone/worldserver.cpp | 2 +- zone/zone.cpp | 2 +- zone/zoning.cpp | 2 +- 163 files changed, 163 insertions(+), 204 deletions(-) delete mode 100644 common/debug.h diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 45dd34cec..c60b7266c 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -19,7 +19,7 @@ #include #include "../../common/eqemu_logsys.h" -#include "../../common/debug.h" +#include "../../common/global_define.h" #include "../../common/shareddb.h" #include "../../common/eqemu_config.h" #include "../../common/platform.h" diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 8567723ce..3d6511d8f 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -17,7 +17,7 @@ */ #include "../../common/eqemu_logsys.h" -#include "../../common/debug.h" +#include "../../common/global_define.h" #include "../../common/shareddb.h" #include "../../common/eqemu_config.h" #include "../../common/platform.h" diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index fe57eab59..cc5949d44 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -103,7 +103,6 @@ SET(common_headers data_verification.h database.h dbcore.h - debug.h deity.h emu_opcodes.h emu_oplist.h @@ -133,6 +132,7 @@ SET(common_headers features.h fixed_memory_hash_set.h fixed_memory_variable_hash_set.h + global_define.h guild_base.h guilds.h ipc_mutex.h diff --git a/common/SocketLib/HTTPSocket.cpp b/common/SocketLib/HTTPSocket.cpp index ecde78403..da4f2264c 100644 --- a/common/SocketLib/HTTPSocket.cpp +++ b/common/SocketLib/HTTPSocket.cpp @@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef _WIN32 #pragma warning(disable:4786) #endif -#include "../debug.h" +#include "../global_define.h" #include #include #include diff --git a/common/SocketLib/HttpdCookies.cpp b/common/SocketLib/HttpdCookies.cpp index 4d9fccb1b..a40200aab 100644 --- a/common/SocketLib/HttpdCookies.cpp +++ b/common/SocketLib/HttpdCookies.cpp @@ -26,7 +26,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "../debug.h" +#include "../global_define.h" #ifdef _WIN32 #pragma warning(disable:4786) #endif diff --git a/common/SocketLib/HttpdSocket.cpp b/common/SocketLib/HttpdSocket.cpp index bd803877a..8ed3041e4 100644 --- a/common/SocketLib/HttpdSocket.cpp +++ b/common/SocketLib/HttpdSocket.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef _WIN32 #pragma warning(disable:4786) #endif -#include "../debug.h" +#include "../global_define.h" #include "Utility.h" #include "HttpdCookies.h" #include "HttpdForm.h" diff --git a/common/base_packet.cpp b/common/base_packet.cpp index e871ea71f..ce6afe978 100644 --- a/common/base_packet.cpp +++ b/common/base_packet.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "base_packet.h" #include "misc.h" #include "packet_dump.h" diff --git a/common/classes.cpp b/common/classes.cpp index 6270656f4..1f54c9234 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/classes.h" const char* GetEQClassName(uint8 class_, uint8 level) { diff --git a/common/condition.h b/common/condition.h index dde51cb6d..9c4cd9f7b 100644 --- a/common/condition.h +++ b/common/condition.h @@ -18,7 +18,7 @@ #ifndef __CONDITION_H #define __CONDITION_H -#include "debug.h" +#include "global_define.h" #include "mutex.h" #ifndef WIN32 #include diff --git a/common/crash.cpp b/common/crash.cpp index fee4dcddf..1f700f151 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "crash.h" diff --git a/common/database.cpp b/common/database.cpp index 8beb3336b..91edc8b4a 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/rulesys.h" #include diff --git a/common/database.h b/common/database.h index 424a0dfa9..e6515c5f6 100644 --- a/common/database.h +++ b/common/database.h @@ -21,7 +21,7 @@ #define AUTHENTICATION_TIMEOUT 60 #define INVALID_ID 0xFFFFFFFF -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "types.h" #include "dbcore.h" diff --git a/common/debug.h b/common/debug.h deleted file mode 100644 index 0c5d32ee9..000000000 --- a/common/debug.h +++ /dev/null @@ -1,41 +0,0 @@ -/* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#if defined(_DEBUG) && defined(WIN32) - #ifndef _CRTDBG_MAP_ALLOC - #include - #include - #endif -#endif - -#ifndef EQDEBUG_H -#define EQDEBUG_H - -#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues -#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) ) - // Packet Collector on win32 requires winsock.h due to latest pcap.h - // winsock.h must come before windows.h - #include -#endif - -#ifdef _WINDOWS - #include - #include -#endif - -#endif diff --git a/common/emu_opcodes.cpp b/common/emu_opcodes.cpp index 49da5e140..00f45fa25 100644 --- a/common/emu_opcodes.cpp +++ b/common/emu_opcodes.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "emu_opcodes.h" const char *OpcodeNames[_maxEmuOpcode+1] = { diff --git a/common/emu_tcp_connection.cpp b/common/emu_tcp_connection.cpp index 805b4b333..2ca55b975 100644 --- a/common/emu_tcp_connection.cpp +++ b/common/emu_tcp_connection.cpp @@ -23,7 +23,7 @@ crap into its own subclass of this object, it will clean things up tremendously. */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include diff --git a/common/emu_tcp_server.cpp b/common/emu_tcp_server.cpp index 985be6edd..4509c399f 100644 --- a/common/emu_tcp_server.cpp +++ b/common/emu_tcp_server.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include "emu_tcp_server.h" #include "emu_tcp_connection.h" diff --git a/common/eq_packet.cpp b/common/eq_packet.cpp index 60d892c23..ffc3666cb 100644 --- a/common/eq_packet.cpp +++ b/common/eq_packet.cpp @@ -17,7 +17,7 @@ */ #include "crc16.h" -#include "debug.h" +#include "global_define.h" #include "eq_packet.h" #include "misc.h" #include "op_codes.h" diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 4d3fa5d46..0c5c6cacf 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "eq_packet.h" #include "eq_stream.h" diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 4a75068b6..a6a1d800a 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "eq_stream_factory.h" diff --git a/common/eq_stream_ident.cpp b/common/eq_stream_ident.cpp index b42bd4037..6fef4275e 100644 --- a/common/eq_stream_ident.cpp +++ b/common/eq_stream_ident.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "eq_stream_ident.h" #include "eq_stream_proxy.h" diff --git a/common/eq_stream_proxy.cpp b/common/eq_stream_proxy.cpp index 20fc4ea06..6de6941ed 100644 --- a/common/eq_stream_proxy.cpp +++ b/common/eq_stream_proxy.cpp @@ -1,5 +1,5 @@ -#include "debug.h" +#include "global_define.h" #include "eq_stream_proxy.h" #include "eq_stream.h" #include "struct_strategy.h" diff --git a/common/eqdb.cpp b/common/eqdb.cpp index 03746b0d4..2c912afba 100644 --- a/common/eqdb.cpp +++ b/common/eqdb.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "eqdb.h" #include "database.h" #include diff --git a/common/eqdb_res.cpp b/common/eqdb_res.cpp index f34229a1f..11d90459d 100644 --- a/common/eqdb_res.cpp +++ b/common/eqdb_res.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "eqdb_res.h" #include diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp index a2483c9b8..6e1400904 100644 --- a/common/eqemu_config.cpp +++ b/common/eqemu_config.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqemu_config.h" #include "misc_functions.h" diff --git a/common/eqtime.cpp b/common/eqtime.cpp index dcb3db359..adfd86923 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -17,7 +17,7 @@ */ #include -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/eqtime.h" #include "../common/eq_packet_structs.h" diff --git a/common/extprofile.cpp b/common/extprofile.cpp index 0ea3fb7a1..f29ec1e6e 100644 --- a/common/extprofile.cpp +++ b/common/extprofile.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "extprofile.h" //Set defaults in the extended profile... diff --git a/common/guilds.cpp b/common/guilds.cpp index 6098c2e1b..408f28714 100644 --- a/common/guilds.cpp +++ b/common/guilds.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "misc_functions.h" #include "guilds.h" #include "database.h" diff --git a/common/item.cpp b/common/item.cpp index df078491e..af0921ce0 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -17,7 +17,7 @@ */ #include "classes.h" -#include "debug.h" +#include "global_define.h" #include "item.h" #include "races.h" #include "rulesys.h" diff --git a/common/misc.cpp b/common/misc.cpp index 61ac556f5..792dfcbab 100644 --- a/common/misc.cpp +++ b/common/misc.cpp @@ -2,7 +2,7 @@ // VS6 doesn't like the length of STL generated names: disabling #pragma warning(disable:4786) #endif -#include "debug.h" +#include "global_define.h" #include #include #include diff --git a/common/misc_functions.cpp b/common/misc_functions.cpp index 18171c0a8..dcdbad561 100644 --- a/common/misc_functions.cpp +++ b/common/misc_functions.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "misc_functions.h" #include #include diff --git a/common/mutex.cpp b/common/mutex.cpp index 7bea92b0d..1dfacb5bb 100644 --- a/common/mutex.cpp +++ b/common/mutex.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/mutex.h" #include diff --git a/common/opcode_map.cpp b/common/opcode_map.cpp index fdaaf3fa1..7c8fed281 100644 --- a/common/opcode_map.cpp +++ b/common/opcode_map.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include #include diff --git a/common/packet_dump_file.cpp b/common/packet_dump_file.cpp index 95a72bb60..514ea610b 100644 --- a/common/packet_dump_file.cpp +++ b/common/packet_dump_file.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include diff --git a/common/packet_functions.cpp b/common/packet_functions.cpp index 5860f9cc8..dbd10f14f 100644 --- a/common/packet_functions.cpp +++ b/common/packet_functions.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/common/patches/patches.cpp b/common/patches/patches.cpp index b993b57dd..55c0d4e8b 100644 --- a/common/patches/patches.cpp +++ b/common/patches/patches.cpp @@ -1,5 +1,5 @@ -#include "../debug.h" +#include "../global_define.h" #include "patches.h" #include "titanium.h" diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index c0d6b4ddf..6a575ca13 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "rof.h" #include "../opcodemgr.h" diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index bd2245dc3..0c61145d0 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "rof2.h" #include "../opcodemgr.h" diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 9f318674b..eb53b333d 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "sod.h" #include "../opcodemgr.h" diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 4337d712e..4d3c61da7 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "sof.h" #include "../opcodemgr.h" diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 852baa089..21701de7e 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "titanium.h" #include "../opcodemgr.h" diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index 12f7a3354..d0ae81fb5 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -1,4 +1,4 @@ -#include "../debug.h" +#include "../global_define.h" #include "../eqemu_logsys.h" #include "underfoot.h" #include "../opcodemgr.h" diff --git a/common/perl_eqdb.cpp b/common/perl_eqdb.cpp index 8e7fb1138..2cd9fa38d 100644 --- a/common/perl_eqdb.cpp +++ b/common/perl_eqdb.cpp @@ -28,7 +28,7 @@ typedef const char Const_char; #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/useperl.h" #include "eqdb.h" diff --git a/common/perl_eqdb_res.cpp b/common/perl_eqdb_res.cpp index b4f22affb..2782a6f05 100644 --- a/common/perl_eqdb_res.cpp +++ b/common/perl_eqdb_res.cpp @@ -28,7 +28,7 @@ typedef const char Const_char; #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/useperl.h" #include "eqdb_res.h" diff --git a/common/proc_launcher.cpp b/common/proc_launcher.cpp index 36f58de86..d44cc9c46 100644 --- a/common/proc_launcher.cpp +++ b/common/proc_launcher.cpp @@ -19,7 +19,7 @@ #include #include -#include "debug.h" +#include "global_define.h" #include "types.h" #include "proc_launcher.h" #ifdef _WINDOWS diff --git a/common/proc_launcher.h b/common/proc_launcher.h index 64133481e..6289579cd 100644 --- a/common/proc_launcher.h +++ b/common/proc_launcher.h @@ -18,7 +18,7 @@ #ifndef PROCLAUNCHER_H_ #define PROCLAUNCHER_H_ -#include "debug.h" +#include "global_define.h" #include #include diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 76bc41419..b41a45677 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "timer.h" #include "ptimer.h" diff --git a/common/struct_strategy.cpp b/common/struct_strategy.cpp index 7c57b0d4d..49f422177 100644 --- a/common/struct_strategy.cpp +++ b/common/struct_strategy.cpp @@ -1,5 +1,5 @@ -#include "debug.h" +#include "global_define.h" #include "eqemu_logsys.h" #include "struct_strategy.h" diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 58ea11822..f558d0596 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include diff --git a/common/tcp_server.cpp b/common/tcp_server.cpp index cfde2f24e..0f9b0445c 100644 --- a/common/tcp_server.cpp +++ b/common/tcp_server.cpp @@ -1,4 +1,4 @@ -#include "debug.h" +#include "global_define.h" #include "tcp_server.h" #include "../common/eqemu_logsys.h" diff --git a/common/timeoutmgr.cpp b/common/timeoutmgr.cpp index b7be6ee98..998195cb3 100644 --- a/common/timeoutmgr.cpp +++ b/common/timeoutmgr.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" //#define TIMEOUT_DEBUG diff --git a/common/timer.h b/common/timer.h index c4d89fe11..4b2719dc6 100644 --- a/common/timer.h +++ b/common/timer.h @@ -22,7 +22,7 @@ // Disgrace: for windows compile #ifdef _WINDOWS - #include "debug.h" + #include "global_define.h" int gettimeofday (timeval *tp, ...); #endif diff --git a/common/worldconn.cpp b/common/worldconn.cpp index 81b281174..e85d24a75 100644 --- a/common/worldconn.cpp +++ b/common/worldconn.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include diff --git a/common/xml_parser.cpp b/common/xml_parser.cpp index 7f84e0d47..f252ce177 100644 --- a/common/xml_parser.cpp +++ b/common/xml_parser.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "debug.h" +#include "global_define.h" #include "xml_parser.h" XMLParser::XMLParser() { diff --git a/common/xml_parser.h b/common/xml_parser.h index f96cbb044..38ed6d254 100644 --- a/common/xml_parser.h +++ b/common/xml_parser.h @@ -18,7 +18,7 @@ #ifndef XMLParser_H #define XMLParser_H -#include "debug.h" +#include "global_define.h" #include "tinyxml/tinyxml.h" #include "../common/types.h" diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index 6af623b5f..db737e9a5 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/proc_launcher.h" #include "../common/eqemu_config.h" diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index b9c7d6b91..a4b27a983 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/servertalk.h" #include "../common/eqemu_config.h" diff --git a/eqlaunch/zone_launch.cpp b/eqlaunch/zone_launch.cpp index 7e211fb88..8c1e62223 100644 --- a/eqlaunch/zone_launch.cpp +++ b/eqlaunch/zone_launch.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/eqemu_config.h" #include "zone_launch.h" diff --git a/queryserv/database.cpp b/queryserv/database.cpp index b6c44f573..585417e37 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -18,7 +18,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include #include diff --git a/queryserv/database.h b/queryserv/database.h index a25d91611..adcb8c811 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -23,7 +23,7 @@ #define AUTHENTICATION_TIMEOUT 60 #define INVALID_ID 0xFFFFFFFF -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "../common/dbcore.h" #include "../common/linked_list.h" diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index b67d8ad4f..e227f515f 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_factory.h" diff --git a/queryserv/queryservconfig.cpp b/queryserv/queryservconfig.cpp index 0c44a7c87..716ae0618 100644 --- a/queryserv/queryservconfig.cpp +++ b/queryserv/queryservconfig.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "queryservconfig.h" queryservconfig *queryservconfig::_chat_config = nullptr; diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 32e8756ef..2d2f288a4 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/md5.h" #include "../common/packet_dump.h" diff --git a/shared_memory/base_data.cpp b/shared_memory/base_data.cpp index c473101da..086256cda 100644 --- a/shared_memory/base_data.cpp +++ b/shared_memory/base_data.cpp @@ -17,7 +17,7 @@ */ #include "base_data.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp index 432458701..48b81b6fc 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -17,7 +17,7 @@ */ #include "items.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/shared_memory/loot.cpp b/shared_memory/loot.cpp index 81c0ef5a5..66982c05a 100644 --- a/shared_memory/loot.cpp +++ b/shared_memory/loot.cpp @@ -17,7 +17,7 @@ */ #include "loot.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index ddc42cbc3..345616e8f 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -19,7 +19,7 @@ #include #include "../common/eqemu_logsys.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/eqemu_config.h" #include "../common/platform.h" diff --git a/shared_memory/npc_faction.cpp b/shared_memory/npc_faction.cpp index 8a9575497..df33b7368 100644 --- a/shared_memory/npc_faction.cpp +++ b/shared_memory/npc_faction.cpp @@ -17,7 +17,7 @@ */ #include "npc_faction.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp index c8cc0838b..94205ce72 100644 --- a/shared_memory/skill_caps.cpp +++ b/shared_memory/skill_caps.cpp @@ -17,7 +17,7 @@ */ #include "skill_caps.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/shared_memory/spells.cpp b/shared_memory/spells.cpp index eb8f34777..444f3b466 100644 --- a/shared_memory/spells.cpp +++ b/shared_memory/spells.cpp @@ -17,7 +17,7 @@ */ #include "spells.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/shareddb.h" #include "../common/ipc_mutex.h" #include "../common/memory_mapped_file.h" diff --git a/ucs/clientlist.cpp b/ucs/clientlist.cpp index a518aa1a8..a643cdfa9 100644 --- a/ucs/clientlist.cpp +++ b/ucs/clientlist.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/string_util.h" #include "../common/eqemu_logsys.h" diff --git a/ucs/database.cpp b/ucs/database.cpp index dee5072fb..8b9d3f687 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -18,7 +18,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include #include diff --git a/ucs/database.h b/ucs/database.h index 382f71a43..fc9b96d19 100644 --- a/ucs/database.h +++ b/ucs/database.h @@ -23,7 +23,7 @@ #define AUTHENTICATION_TIMEOUT 60 #define INVALID_ID 0xFFFFFFFF -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "../common/dbcore.h" #include "../common/linked_list.h" diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 1bbb66c16..fd9688def 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -18,7 +18,7 @@ */ #include "../common/eqemu_logsys.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "clientlist.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_factory.h" diff --git a/ucs/ucsconfig.cpp b/ucs/ucsconfig.cpp index 4f055a6af..dd8c73ab8 100644 --- a/ucs/ucsconfig.cpp +++ b/ucs/ucsconfig.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "ucsconfig.h" ucsconfig *ucsconfig::_chat_config = nullptr; diff --git a/ucs/worldserver.cpp b/ucs/worldserver.cpp index 67bc81987..395d72e59 100644 --- a/ucs/worldserver.cpp +++ b/ucs/worldserver.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include #include diff --git a/world/adventure.cpp b/world/adventure.cpp index 83b98813d..6c08204a7 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/servertalk.h" #include "../common/extprofile.h" #include "../common/rulesys.h" diff --git a/world/adventure.h b/world/adventure.h index dec691eda..23255a5b5 100644 --- a/world/adventure.h +++ b/world/adventure.h @@ -1,7 +1,7 @@ #ifndef ADVENTURE_H #define ADVENTURE_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "../common/timer.h" #include "adventure_template.h" diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 3f671ee97..47522ccec 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/misc_functions.h" #include "../common/string_util.h" #include "../common/servertalk.h" diff --git a/world/adventure_manager.h b/world/adventure_manager.h index ce6d7331a..5c9a4e560 100644 --- a/world/adventure_manager.h +++ b/world/adventure_manager.h @@ -1,7 +1,7 @@ #ifndef ADVENTURE_MANAGER_H #define ADVENTURE_MANAGER_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "../common/timer.h" #include "adventure.h" diff --git a/world/adventure_template.h b/world/adventure_template.h index 86fc3d0f5..89f8b9915 100644 --- a/world/adventure_template.h +++ b/world/adventure_template.h @@ -1,7 +1,7 @@ #ifndef ADVENTURE_TEMPLATE_H #define ADVENTURE_TEMPLATE_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #pragma pack(1) diff --git a/world/client.cpp b/world/client.cpp index 9b92b668e..b6f3e3153 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_packet.h" #include "../common/eq_stream_intf.h" #include "../common/misc.h" diff --git a/world/cliententry.cpp b/world/cliententry.cpp index 93adbc931..034b7ef9a 100644 --- a/world/cliententry.cpp +++ b/world/cliententry.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "cliententry.h" #include "clientlist.h" #include "login_server.h" diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 53f989538..b6b22a6d4 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "clientlist.h" #include "zoneserver.h" #include "zonelist.h" diff --git a/world/console.cpp b/world/console.cpp index fbf9415bd..2194bfed4 100644 --- a/world/console.cpp +++ b/world/console.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 85f98713d..d8b60d209 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "eql_config.h" #include "worlddb.h" #include "launcher_link.h" diff --git a/world/eqw.cpp b/world/eqw.cpp index 7ff709ec6..04d5d4c8b 100644 --- a/world/eqw.cpp +++ b/world/eqw.cpp @@ -18,7 +18,7 @@ #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw.h" #include "eqw_parser.h" #include "world_config.h" diff --git a/world/eqw_http_handler.cpp b/world/eqw_http_handler.cpp index 36fdf714c..c30620747 100644 --- a/world/eqw_http_handler.cpp +++ b/world/eqw_http_handler.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw_http_handler.h" #include "../common/SocketLib/Base64.h" #include "eqw_parser.h" diff --git a/world/eqw_parser.cpp b/world/eqw_parser.cpp index e7b72bf38..79e73ac22 100644 --- a/world/eqw_parser.cpp +++ b/world/eqw_parser.cpp @@ -20,7 +20,7 @@ #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw_parser.h" #include "eqw.h" #include "../common/eqdb.h" diff --git a/world/http_request.cpp b/world/http_request.cpp index fa7bc78f1..af4b6c9b2 100644 --- a/world/http_request.cpp +++ b/world/http_request.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "http_request.h" #include "eqw_http_handler.h" #include "../common/eqdb.h" diff --git a/world/launcher_link.cpp b/world/launcher_link.cpp index 9e8db6ea1..bd8bfdc4b 100644 --- a/world/launcher_link.cpp +++ b/world/launcher_link.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "launcher_link.h" #include "launcher_list.h" #include "world_config.h" diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 01f64bfec..62657175a 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -17,7 +17,7 @@ */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "launcher_list.h" #include "launcher_link.h" diff --git a/world/login_server.cpp b/world/login_server.cpp index f411e7a72..450ecb0a3 100644 --- a/world/login_server.cpp +++ b/world/login_server.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/world/login_server_list.cpp b/world/login_server_list.cpp index e76b38b71..6104f4f0a 100644 --- a/world/login_server_list.cpp +++ b/world/login_server_list.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/world/net.cpp b/world/net.cpp index 529643d08..a4e560477 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include @@ -24,7 +24,7 @@ #include -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/queue.h" #include "../common/timer.h" diff --git a/world/perl_eql_config.cpp b/world/perl_eql_config.cpp index 19ea7c9f6..7cd7d0e2a 100644 --- a/world/perl_eql_config.cpp +++ b/world/perl_eql_config.cpp @@ -28,7 +28,7 @@ typedef const char Const_char; #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw_parser.h" #include "eql_config.h" diff --git a/world/perl_eqw.cpp b/world/perl_eqw.cpp index 0a564164d..675eac26c 100644 --- a/world/perl_eqw.cpp +++ b/world/perl_eqw.cpp @@ -28,7 +28,7 @@ typedef const char Const_char; #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw_parser.h" #include "eqw.h" diff --git a/world/perl_http_request.cpp b/world/perl_http_request.cpp index 12d70002c..cdd7e60f1 100644 --- a/world/perl_http_request.cpp +++ b/world/perl_http_request.cpp @@ -28,7 +28,7 @@ typedef const char Const_char; #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "eqw_parser.h" #include "http_request.h" diff --git a/world/queryserv.cpp b/world/queryserv.cpp index 171dcaa13..bf1af1e2e 100644 --- a/world/queryserv.cpp +++ b/world/queryserv.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "queryserv.h" #include "world_config.h" diff --git a/world/ucs.cpp b/world/ucs.cpp index 4f9827a36..e15007959 100644 --- a/world/ucs.cpp +++ b/world/ucs.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "ucs.h" #include "world_config.h" diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index 1b7f8739e..b2750ded2 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -17,7 +17,7 @@ */ #include "../common/eqemu_logsys.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "wguild_mgr.h" #include "../common/servertalk.h" #include "clientlist.h" diff --git a/world/world_config.cpp b/world/world_config.cpp index 2f9464e13..f57368a10 100644 --- a/world/world_config.cpp +++ b/world/world_config.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "world_config.h" WorldConfig *WorldConfig::_world_config = nullptr; diff --git a/world/zonelist.cpp b/world/zonelist.cpp index 52879cafa..22d783f5d 100644 --- a/world/zonelist.cpp +++ b/world/zonelist.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "zonelist.h" #include "zoneserver.h" #include "world_tcp_connection.h" diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index de3f34435..d8909dbd8 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "zoneserver.h" #include "clientlist.h" #include "login_server.h" diff --git a/zone/aa.cpp b/zone/aa.cpp index 5b3b82732..b6a1917b9 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -17,7 +17,7 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net) */ #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/eq_packet_structs.h" #include "../common/races.h" diff --git a/zone/aggro.cpp b/zone/aggro.cpp index d0b688e29..d49702146 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/faction.h" #include "../common/rulesys.h" diff --git a/zone/attack.cpp b/zone/attack.cpp index ce97ae524..d304bf7b3 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_constants.h" #include "../common/eq_packet_structs.h" #include "../common/rulesys.h" diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index fcb7f0ef9..9af1d623d 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/item.h" #include "../common/rulesys.h" #include "../common/skills.h" diff --git a/zone/bot.h b/zone/bot.h index 40b505c84..42e041861 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -12,7 +12,7 @@ #include "zonedb.h" #include "string_ids.h" #include "../common/misc_functions.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "guild_mgr.h" #include "worldserver.h" diff --git a/zone/client.cpp b/zone/client.cpp index c0f9ff64b..50ac4655c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index fc49e1526..0bd54308f 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/rulesys.h" diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 20f58cc12..6ecfae636 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/opcodemgr.h" #include diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 483dceac1..c60c17298 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -20,7 +20,7 @@ */ #include "../common/eqemu_logsys.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/zone/command.cpp b/zone/command.cpp index fe8d3d9fd..47f5517ab 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -42,7 +42,7 @@ #define strcasecmp _stricmp #endif -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_packet.h" #include "../common/features.h" #include "../common/guilds.h" diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 81d77651f..b42906d20 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -28,7 +28,7 @@ Child of the Mob class. #define strcasecmp _stricmp #endif -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" diff --git a/zone/doors.cpp b/zone/doors.cpp index 227c8c7af..76ecb53fc 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/string_util.h" diff --git a/zone/effects.cpp b/zone/effects.cpp index 8ec921ae3..ba5b42f1c 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/spdat.h" diff --git a/zone/embparser.cpp b/zone/embparser.cpp index e18dcfd39..72b15e118 100644 --- a/zone/embparser.cpp +++ b/zone/embparser.cpp @@ -18,7 +18,7 @@ #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/seperator.h" #include "../common/misc_functions.h" #include "../common/string_util.h" diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 99698fe72..e5188eae3 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -21,7 +21,7 @@ #ifdef EMBPERL #ifdef EMBPERL_XS -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/misc_functions.h" #include "embparser.h" diff --git a/zone/embperl.cpp b/zone/embperl.cpp index 167e92711..4d27d1269 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -10,7 +10,7 @@ Eglin #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include #include diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 5e387022e..4c0e8211c 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -17,7 +17,7 @@ */ #ifdef EMBPERL -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "masterentity.h" #include "command.h" diff --git a/zone/entity.cpp b/zone/entity.cpp index ec2be21f5..2ded575c0 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/zone/exp.cpp b/zone/exp.cpp index 53f015b8a..7eb2189df 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/features.h" #include "../common/rulesys.h" #include "../common/string_util.h" diff --git a/zone/forage.cpp b/zone/forage.cpp index 427f28b10..db348cf8c 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/misc_functions.h" #include "../common/rulesys.h" diff --git a/zone/groups.cpp b/zone/groups.cpp index d1a310c92..6fbd08c15 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "masterentity.h" #include "npc_ai.h" diff --git a/zone/horse.cpp b/zone/horse.cpp index cfc0174d2..91e452dc2 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/linked_list.h" #include "../common/string_util.h" diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 56ad5e904..ab753f1e4 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/string_util.h" diff --git a/zone/loottables.cpp b/zone/loottables.cpp index 16f5af7b0..39caafcea 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/loottable.h" #include "../common/misc_functions.h" diff --git a/zone/map.cpp b/zone/map.cpp index 5c917b955..941292acd 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/misc_functions.h" #include "map.h" diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index a77335016..67b8d4480 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/features.h" #include "../common/rulesys.h" #include "../common/string_util.h" diff --git a/zone/net.cpp b/zone/net.cpp index 078f9cdd7..579f9d342 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -19,7 +19,7 @@ #define DONT_SHARED_OPCODES #define PLATFORM_ZONE 1 -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/features.h" #include "../common/queue.h" #include "../common/timer.h" diff --git a/zone/npc.cpp b/zone/npc.cpp index 4700159ec..4b749adba 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -18,7 +18,7 @@ #include "../common/bodytypes.h" #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/seperator.h" diff --git a/zone/object.cpp b/zone/object.cpp index baa084699..09988481e 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/string_util.h" #include "client.h" diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 6afa63546..86d1e23a2 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -1,4 +1,4 @@ -#include "../common/debug.h" +#include "../common/global_define.h" #include "client.h" #include "doors.h" diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 685a39091..e47e17cfd 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_doors.cpp b/zone/perl_doors.cpp index 77ad1902b..c8f6ad221 100644 --- a/zone/perl_doors.cpp +++ b/zone/perl_doors.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_entity.cpp b/zone/perl_entity.cpp index 3d685e011..9b8718086 100644 --- a/zone/perl_entity.cpp +++ b/zone/perl_entity.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include #include "embperl.h" diff --git a/zone/perl_groups.cpp b/zone/perl_groups.cpp index 9db01353b..6960d14df 100644 --- a/zone/perl_groups.cpp +++ b/zone/perl_groups.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_hateentry.cpp b/zone/perl_hateentry.cpp index 6e8b2de9e..7c346a748 100644 --- a/zone/perl_hateentry.cpp +++ b/zone/perl_hateentry.cpp @@ -19,7 +19,7 @@ #include "../common/features.h" #include "client.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index af07cfcdf..ac76beafe 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_npc.cpp b/zone/perl_npc.cpp index 279b64330..c334ddb1b 100644 --- a/zone/perl_npc.cpp +++ b/zone/perl_npc.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_object.cpp b/zone/perl_object.cpp index 036d555a1..be52fef1d 100644 --- a/zone/perl_object.cpp +++ b/zone/perl_object.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_perlpacket.cpp b/zone/perl_perlpacket.cpp index 4a9c70464..f23cf36d7 100644 --- a/zone/perl_perlpacket.cpp +++ b/zone/perl_perlpacket.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "embperl.h" diff --git a/zone/perl_player_corpse.cpp b/zone/perl_player_corpse.cpp index 675ee9697..a417284c8 100644 --- a/zone/perl_player_corpse.cpp +++ b/zone/perl_player_corpse.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_questitem.cpp b/zone/perl_questitem.cpp index 4c93d8839..158ee64a4 100644 --- a/zone/perl_questitem.cpp +++ b/zone/perl_questitem.cpp @@ -19,7 +19,7 @@ #include "../common/features.h" #include "client.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perl_raids.cpp b/zone/perl_raids.cpp index be3aea356..60d94600a 100644 --- a/zone/perl_raids.cpp +++ b/zone/perl_raids.cpp @@ -27,7 +27,7 @@ #include "../common/features.h" #ifdef EMBPERL_XS_CLASSES -#include "../common/debug.h" +#include "../common/global_define.h" #include "embperl.h" #ifdef seed diff --git a/zone/perlpacket.cpp b/zone/perlpacket.cpp index 1475ff448..ed0dd9cd3 100644 --- a/zone/perlpacket.cpp +++ b/zone/perlpacket.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include "perlpacket.h" #include "client.h" diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 2d2173e26..4af99a946 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -15,7 +15,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include #ifdef _WINDOWS diff --git a/zone/pets.cpp b/zone/pets.cpp index 1171194e3..829f8b020 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/spdat.h" #include "../common/string_util.h" #include "../common/types.h" diff --git a/zone/queryserv.cpp b/zone/queryserv.cpp index 1186aa241..d67ca46c7 100644 --- a/zone/queryserv.cpp +++ b/zone/queryserv.cpp @@ -16,7 +16,7 @@ Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net) Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/servertalk.h" #include "../common/string_util.h" #include "queryserv.h" diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index d3bde0d5b..bb3c55f3f 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/misc_functions.h" #include "../common/features.h" diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index d9eb291dc..f99aff8bc 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -17,7 +17,7 @@ */ #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/rulesys.h" #include "../common/skills.h" #include "../common/spdat.h" diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 0f8b3330d..dfaa90278 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/string_util.h" #include "client.h" diff --git a/zone/spawngroup.cpp b/zone/spawngroup.cpp index bae4832c0..1661e0fe8 100644 --- a/zone/spawngroup.cpp +++ b/zone/spawngroup.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/string_util.h" #include "../common/types.h" diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index b45f7da70..65f318c46 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -19,7 +19,7 @@ #include "../common/eqemu_logsys.h" #include "../common/bodytypes.h" #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/item.h" #include "../common/rulesys.h" #include "../common/skills.h" diff --git a/zone/spells.cpp b/zone/spells.cpp index a9bc59f15..c9d21201e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -68,7 +68,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org) #include "../common/bodytypes.h" #include "../common/classes.h" -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/item.h" #include "../common/rulesys.h" diff --git a/zone/tasks.cpp b/zone/tasks.cpp index e20e71f4c..37255179b 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -17,7 +17,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "tasks.h" #include diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index d923af5c6..0e012d087 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include diff --git a/zone/trading.cpp b/zone/trading.cpp index 0fd36ad37..e2824cb62 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 7fbd52e1d..6b104c5f2 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_packet_structs.h" #include "../common/features.h" diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 95f655cbb..95c76d66b 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #ifdef _EQDEBUG #include #endif diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d08384515..f305133dd 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include #include #include diff --git a/zone/zone.cpp b/zone/zone.cpp index ecfdb4cef..49595914f 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -30,7 +30,7 @@ #include "../common/unix.h" #endif -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/features.h" #include "../common/rulesys.h" #include "../common/seperator.h" diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 53235176b..18eca56cb 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/rulesys.h" #include "../common/string_util.h" From f9ba4739f5f0062cefaf16736f4da4eab254ca82 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:12:30 -0600 Subject: [PATCH 1182/1883] add global_define.h --- common/global_define.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 common/global_define.h diff --git a/common/global_define.h b/common/global_define.h new file mode 100644 index 000000000..0c5d32ee9 --- /dev/null +++ b/common/global_define.h @@ -0,0 +1,41 @@ +/* EQEMu: Everquest Server Emulator + Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY except by those people which sell it, which + are required to give you total support for your newly bought product; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#if defined(_DEBUG) && defined(WIN32) + #ifndef _CRTDBG_MAP_ALLOC + #include + #include + #endif +#endif + +#ifndef EQDEBUG_H +#define EQDEBUG_H + +#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues +#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) ) + // Packet Collector on win32 requires winsock.h due to latest pcap.h + // winsock.h must come before windows.h + #include +#endif + +#ifdef _WINDOWS + #include + #include +#endif + +#endif From 56a4459aa8aae6fe4f401e5f3b2d9f31686c843c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 04:27:22 -0600 Subject: [PATCH 1183/1883] More stuff --- common/eqemu_logsys.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 2ac824624..26a80392f 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -114,8 +114,7 @@ namespace Logs{ "WebInterface Server", "World Server", "Zone Server", - }; - + }; } class EQEmuLogSys { @@ -129,7 +128,6 @@ public: void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void SetCurrentTimeStamp(char* time_stamp); void StartFileLogs(const std::string log_name); - uint16 GetConsoleColorFromCategory(uint16 log_category); struct LogSettings{ uint8 log_to_file; @@ -145,9 +143,11 @@ public: private: bool zone_general_init = false; + std::function on_log_gmsay_hook; - std::string FormatOutMessageString(uint16 log_category, std::string in_message); + + uint16 GetConsoleColorFromCategory(uint16 log_category); void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); From 53dce15822df32877a8d4b109b8f1836c98020c9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:24:38 -0600 Subject: [PATCH 1184/1883] Remove Duplicative MySQL Error: Error in ExportSpells query '%s' %s --- client_files/export/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index c60b7266c..b4bf14e75 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -91,7 +91,6 @@ void ExportSpells(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Out(Logs::General, Logs::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); From ed09893a0e1befd1fb63ac328dfedae8f892125e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:24:48 -0600 Subject: [PATCH 1185/1883] Remove Duplicative MySQL Error: Error in skill_usable query '%s' %s --- client_files/export/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index b4bf14e75..1758db707 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -104,7 +104,6 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) { class_id, skill_id); auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 792cf68a1c25d97a2e2951c63ff5201dea01e46e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:24:54 -0600 Subject: [PATCH 1186/1883] Remove Duplicative MySQL Error: Error in get_skill query '%s' %s --- client_files/export/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 1758db707..db2163d87 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -123,7 +123,6 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) { class_id, skill_id, level); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 5604230b5559fbeba51d73f218c15212d169a1bc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:24:59 -0600 Subject: [PATCH 1187/1883] Remove Duplicative MySQL Error: Error in ExportBaseData query '%s' %s --- client_files/export/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index db2163d87..14fe0fc60 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -189,7 +189,6 @@ void ExportBaseData(SharedDatabase *db) { fprintf(f, "%s\n", line.c_str()); } } else { - Log.Out(Logs::General, Logs::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); } fclose(f); From 2e8d9ed6a12a54adceb527e710aaf419ad9f7beb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:05 -0600 Subject: [PATCH 1188/1883] Remove Duplicative MySQL Error: Error in GetSpellColumns query '%s' %s --- client_files/import/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 3d6511d8f..67cc28373 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -65,7 +65,6 @@ int GetSpellColumns(SharedDatabase *db) { const std::string query = "DESCRIBE spells_new"; auto results = db->QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 32901297e108d42ecb1253713392d7450892b563 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:05 -0600 Subject: [PATCH 1189/1883] Remove Duplicative MySQL Error: StoreCharacter inventory failed. Query '%s' %s --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 91edc8b4a..0ce40425c 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -736,7 +736,6 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven auto results = QueryDatabase(invquery); if (!results.RowsAffected()) - Log.Out(Logs::General, Logs::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str()); #if EQDEBUG >= 9 else Log.Out(Logs::General, Logs::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); From 3c02cc454df7df5bf86909f1684779b6b07f6bf2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:05 -0600 Subject: [PATCH 1190/1883] Remove Duplicative MySQL Error: Error loading guilds '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index a9ad6cce0..48d40d369 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -57,7 +57,6 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 3f8926d3166c623cb50eb8f965e4d222029dd142 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:05 -0600 Subject: [PATCH 1191/1883] Remove Duplicative MySQL Error: Error in LoadRules query %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 8f0c908a1..fb6d94dcc 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -282,7 +282,6 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 34c60221019bfab49550786daa86b85b84c868a1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:05 -0600 Subject: [PATCH 1192/1883] Remove Duplicative MySQL Error: Error runing inventory verification query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 785888ff5..5f77094a2 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -124,7 +124,6 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); //returning true is less harmful in the face of a query error return true; } From 84945431644d81bf18702f00761a3c2bbc1e0d21 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1193/1883] Remove Duplicative MySQL Error: Failed to load LFGuild info from database. %s %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index dbfb4e314..68e9235d9 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -40,7 +40,6 @@ bool LFGuildManager::LoadDatabase() "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::QS_Server, "Failed to load LFGuild info from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 408baba7aa166ababe29b040cd96cf16f12979a8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1194/1883] Remove Duplicative MySQL Error: FindCharacter failed. %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 8b9d3f687..5a3a7267c 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -206,7 +206,6 @@ int Database::FindCharacter(const char *characterName) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name`='%s' LIMIT 1", safeCharName); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "FindCharacter failed. %s %s", query.c_str(), results.ErrorMessage().c_str()); safe_delete(safeCharName); return -1; } From 5bf3d40570ed8b445b3d39a40849a7128ca41276 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1195/1883] Remove Duplicative MySQL Error: Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s) --- world/adventure.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index 6c08204a7..b2554c1f2 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -386,7 +386,6 @@ void Adventure::MoveCorpsesToGraveyard() std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); for(auto row = results.begin(); row != results.end(); ++row) { dbid_list.push_back(atoi(row[0])); From b6b9e388b38b112d41d627518778989d90cabcc8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1196/1883] Remove Duplicative MySQL Error: Error in AdventureManager:::LoadAdventures: %s (%s) --- world/adventure_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 47522ccec..cb3930bf6 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -652,7 +652,6 @@ bool AdventureManager::LoadAdventureTemplates() "graveyard_radius FROM adventure_template"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } From 083236172997bebb3f0e63354084698064780af6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1197/1883] Remove Duplicative MySQL Error: Start zone query failed: %s : %s\n --- world/worlddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 5fa4313da..b1e98b408 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -298,7 +298,6 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } From 209adc28280d72040388d9d31e347711b2676fe9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1198/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index b6a1917b9..3d3fde5c5 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1460,7 +1460,6 @@ bool ZoneDatabase::LoadAAEffects2() { const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 381749933adca1c9954eed760511e6318c3bf482 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1199/1883] Remove Duplicative MySQL Error: Error in Client::SendRewards(): %s (%s) --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 50ac4655c..dc267469b 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5290,7 +5290,6 @@ void Client::SendRewards() "ORDER BY reward_id", AccountID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Client::SendRewards(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 43da95e784f01711015748b363cd8069cee0e514 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:06 -0600 Subject: [PATCH 1200/1883] Remove Duplicative MySQL Error: Error in Forage query '%s': %s --- zone/forage.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/forage.cpp b/zone/forage.cpp index db348cf8c..3fe61f9d1 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -59,7 +59,6 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) { "LIMIT %i", ZoneID, skill, FORAGE_ITEM_LIMIT); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Forage query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 0491f22e2bb5cb0b08e6d13cd1d9c612fac12098 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1201/1883] Remove Duplicative MySQL Error: Error in CheckGuildDoor query '%s': %s --- zone/guild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild.cpp b/zone/guild.cpp index 271d835a0..33e783030 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -409,7 +409,6 @@ bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zon doorid-128, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in CheckGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From de0de39e080fbf1c070062a6ca550f21d37df014 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1202/1883] Remove Duplicative MySQL Error: Error Loading guild bank: %s, %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 0df3fe929..a44cd09e1 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -603,7 +603,6 @@ bool GuildBankManager::Load(uint32 guildID) "FROM `guild_bank` WHERE `guildid` = %i", guildID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error Loading guild bank: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From be37525414e77b2f8d1ec377799e5b09af2fec18 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1203/1883] Remove Duplicative MySQL Error: Error in Mount query '%s': %s --- zone/horse.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/horse.cpp b/zone/horse.cpp index 91e452dc2..c41465a16 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -73,7 +73,6 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { std::string query = StringFormat("SELECT race, gender, texture, mountspeed FROM horses WHERE filename = '%s'", fileName); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Mount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } From 6cd08b8f27f96823341568c40a484d069d4c70b6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1204/1883] Remove Duplicative MySQL Error: NPCSpawnDB Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 4b749adba..c9ab76d02 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1004,7 +1004,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); From 8df0ec05e1a2e0615b80550c5ff85bd09f87b44f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1205/1883] Remove Duplicative MySQL Error: Error in DeletePetitionFromDB query '%s': %s --- zone/petitions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 4af99a946..a85f65f30 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -213,7 +213,6 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in DeletePetitionFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } From 41fc0f7f02a407903ae9193819dc5fe59fcff42c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:07 -0600 Subject: [PATCH 1206/1883] Remove Duplicative MySQL Error: Error in GetPoweredPetEntry query '%s': %s --- zone/pets.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/pets.cpp b/zone/pets.cpp index 829f8b020..6d920d64f 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -456,7 +456,6 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR pet_type, petpower); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetPoweredPetEntry query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 9837e172acefb6ffc599be5758214bfd3d60bc3d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1207/1883] Remove Duplicative MySQL Error: Error in PopulateZoneLists query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index dfaa90278..1ed1ae4c1 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -364,7 +364,6 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in PopulateZoneLists query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From ac2b53c94b67c3f0ad1de565cb8b5105936ab805 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1208/1883] Remove Duplicative MySQL Error: Error while querying Spell ID %i spell_globals table query '%s': %s --- zone/spells.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index c9d21201e..3e89e9e8e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -4962,7 +4962,6 @@ bool Client::SpellGlobalCheck(uint16 spell_ID, uint32 char_ID) { "WHERE spellid = %i", spell_ID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error while querying Spell ID %i spell_globals table query '%s': %s", spell_ID, query.c_str(), results.ErrorMessage().c_str()); return false; // Query failed, so prevent spell from scribing just in case } From 346a1b2bb771f843fd06a31247dc6a3bc7e6530a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1209/1883] Remove Duplicative MySQL Error: --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 37255179b..3ec11ab84 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -725,7 +725,6 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "[TASKS]Error in ClientTaskState::EnableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } From 82af0550df8f5f571d4635f455ef5869a90f6266 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1210/1883] Remove Duplicative MySQL Error: Unable to load titles: %s : %s --- zone/titles.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 0f2e59368..17c699fc9 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -40,7 +40,6 @@ bool TitleManager::LoadTitles() "`status`, `item_id`, `prefix`, `suffix`, `title_set` FROM titles"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Unable to load titles: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 0c5a90203210116c2addcc2e77d4943c1a313841 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1211/1883] Remove Duplicative MySQL Error: Error in HandleAutoCombine query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 0e012d087..7b98354d5 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -467,7 +467,6 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac rac->recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in HandleAutoCombine query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); user->QueuePacket(outapp); safe_delete(outapp); return; From 9fdc22f78b3a09ea68be84d0fb5896c6ba6e77d7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1212/1883] Remove Duplicative MySQL Error: --- zone/trading.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/trading.cpp b/zone/trading.cpp index e2824cb62..2ecf17115 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1478,7 +1478,6 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * seller, buyer, itemName, quantity, totalCost, tranType); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::None, "[CLIENT] Audit write error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); } From e81b03917ab126de5f63991719c56349f11e52f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:08 -0600 Subject: [PATCH 1213/1883] Remove Duplicative MySQL Error: Error in LoadTraps query '%s': %s --- zone/trap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/trap.cpp b/zone/trap.cpp index d973a800b..34e653973 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -270,7 +270,6 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) { "FROM traps WHERE zone='%s' AND version=%u", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadTraps query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From df9f031536dd196f522aea8c558ed20ae9dea52a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:09 -0600 Subject: [PATCH 1214/1883] Remove Duplicative MySQL Error: Error in LoadTributes first query '%s': %s --- zone/tribute.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 6b104c5f2..2a4ef78b8 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -390,7 +390,6 @@ bool ZoneDatabase::LoadTributes() { const std::string query = "SELECT id, name, descr, unknown, isguild FROM tributes"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadTributes first query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From fa4fb72263040d3434e11c344c7708cdae392e69 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:09 -0600 Subject: [PATCH 1215/1883] Remove Duplicative MySQL Error: Error in GetHighestGrid query '%s': %s --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 95c76d66b..06b9712b3 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1011,7 +1011,6 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) { std::string query = StringFormat("SELECT COALESCE(MAX(id), 0) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetHighestGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From c81eb674bbdf27be9b91ee4dbf6c2f0df2749659 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:09 -0600 Subject: [PATCH 1216/1883] Remove Duplicative MySQL Error: Error in LoadTempMerchantData query '%s' %s --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 49595914f..48c1deceb 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -419,7 +419,6 @@ void Zone::LoadTempMerchantData() { "ORDER BY ml.slot ", GetShortName(), GetInstanceVersion()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } std::map >::iterator cur; From 3f0fcefdb44dbd5d4bd2bcc86d3c2c9c0e3414e9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:09 -0600 Subject: [PATCH 1217/1883] Remove Duplicative MySQL Error: Error in SaveZoneCFG query %s: %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 58df1a7fb..c9cb69291 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -86,7 +86,6 @@ bool ZoneDatabase::SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in SaveZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 9749d7c3af662e0f98a847825615f434571a8427 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:14 -0600 Subject: [PATCH 1218/1883] Remove Duplicative MySQL Error: Error in GetAccountIDByChar query '%s': %s --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 0ce40425c..59f5592d6 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -804,7 +804,6 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) { std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 382fdc5d18a284a01450d56485d0cbb3c38cff17 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:14 -0600 Subject: [PATCH 1219/1883] Remove Duplicative MySQL Error: Error loading guild ranks '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 48d40d369..c3929965a 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -68,7 +68,6 @@ bool BaseGuildManager::LoadGuilds() { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From d8510e787670b34df8bf6786745b259aa91f8aaf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1220/1883] Remove Duplicative MySQL Error: Fauled to set rule in the database: %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index fb6d94dcc..f4b513b9f 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -313,7 +313,6 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::Detail, Logs::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); } From 4d15ddfc8acc241f4c9c93b4e5b8042ae5f88fc5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1221/1883] Remove Duplicative MySQL Error: UpdateInventorySlot query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 5f77094a2..ac94de59b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -213,7 +213,6 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i } if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 384d9a47488f89a74763d2c1a9488f8224d5681a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1222/1883] Remove Duplicative MySQL Error: Error removing player from LFGuild table, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 68e9235d9..c80c23c4f 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -241,7 +241,6 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error removing player from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); From 61a6edc1d0feb5f158f02d0c34b615c6b93b051b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1223/1883] Remove Duplicative MySQL Error: Unable to get message count from database. %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 5a3a7267c..6eb4407d0 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -228,7 +228,6 @@ bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_ std::string query = StringFormat("SELECT `value` FROM `variables` WHERE `varname` = '%s'", varname); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 50d0bb0d039a357a7c58ef1fe69b0ef340c7d003 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1224/1883] Remove Duplicative MySQL Error: Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s) --- world/adventure.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index b2554c1f2..e0a5aae18 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -404,7 +404,6 @@ void Adventure::MoveCorpsesToGraveyard() x, y, z, GetInstanceID()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } auto c_iter = charid_list.begin(); From 03b0fac83886f559f14be64becbe19369e76e56d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1225/1883] Remove Duplicative MySQL Error: Error in AdventureManager:::LoadAdventureEntries: %s (%s) --- world/adventure_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index cb3930bf6..1314a344b 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -701,7 +701,6 @@ bool AdventureManager::LoadAdventureEntries() auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } From 2b3d14f0baf4793163e45003d33134dba1a2c0e3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1226/1883] Remove Duplicative MySQL Error: SoF Start zone query failed: %s : %s\n --- world/worlddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/worlddb.cpp b/world/worlddb.cpp index b1e98b408..8b81233a0 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -433,7 +433,6 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str()); return false; } From ee0a68fed2f59e80e8efb33ab6f110c7ceb84b57 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:15 -0600 Subject: [PATCH 1227/1883] Remove Duplicative MySQL Error: Error in LoadAAEffects query '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 3d3fde5c5..4273e18ab 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1801,7 +1801,6 @@ bool ZoneDatabase::LoadAAEffects() { "redux_aa, redux_rate, redux_aa2, redux_rate2 FROM aa_actions"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadAAEffects query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 19dfc9e92dfe699b486d7381ad51d755f98d4b3f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1228/1883] Remove Duplicative MySQL Error: Error in Client::TryReward(): %s (%s) --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index dc267469b..8cd9a3ebb 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5357,7 +5357,6 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return false; } From 0b330b731267f1059797d9f4c8ca4dfd57a397fe Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1229/1883] Remove Duplicative MySQL Error: Error in SetGuildDoor query '%s': %s --- zone/guild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild.cpp b/zone/guild.cpp index 33e783030..54d406039 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -428,7 +428,6 @@ bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) guild_id, doorid, zone); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in SetGuildDoor query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 1f8d483badaf5a7da3f9a7c3f7270a614b4e02e8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1230/1883] Remove Duplicative MySQL Error: Insert Error: %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index a44cd09e1..6435951cc 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -856,7 +856,6 @@ bool GuildBankManager::AddItem(uint32 GuildID, uint8 Area, uint32 ItemID, int32 GuildID, Area, Slot, ItemID, QtyOrCharges, Donator, Permissions, WhoFor); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Insert Error: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 525a51387148ac3509730800f4592917e36f2452 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1231/1883] Remove Duplicative MySQL Error: NPCSpawnDB Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index c9ab76d02..a3052b741 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1020,7 +1020,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } npc_type_id = results.LastInsertedID(); From 8cb8aed9b4fd839a77d9e7dcd975983393fef165 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1232/1883] Remove Duplicative MySQL Error: Error in UpdatePetitionToDB query '%s': %s --- zone/petitions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index a85f65f30..a713dfdf7 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -226,7 +226,6 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in UpdatePetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } From 52553e507f2dc665bd2c3db112802055ba2ae7e0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:16 -0600 Subject: [PATCH 1233/1883] Remove Duplicative MySQL Error: Error in GetBasePetItems query '%s': %s --- zone/pets.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/pets.cpp b/zone/pets.cpp index 6d920d64f..4b2287a98 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -655,7 +655,6 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { std::string query = StringFormat("SELECT nested_set FROM pets_equipmentset WHERE set_id = '%s'", curset); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 0917eb00b17cbdede9f678c80f11df73be8b56ab Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1234/1883] Remove Duplicative MySQL Error: Error in LoadSpawn2 query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 1ed1ae4c1..cb9197ec5 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -391,7 +391,6 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 "WHERE id = %i", spawn2id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } From 380510ff44a08e5a1746b1c1a4acf8774718daa0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1235/1883] Remove Duplicative MySQL Error: --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 3ec11ab84..ad48c7cb6 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -773,7 +773,6 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "[TASKS]Error in ClientTaskState::DisableTask %s %s", query.c_str(), results.ErrorMessage().c_str()); } bool ClientTaskState::IsTaskEnabled(int TaskID) { From d3b00c142dfa62da76f59f01a0803428ce5012c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1236/1883] Remove Duplicative MySQL Error: Error adding title: %s %s --- zone/titles.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 17c699fc9..6234ac674 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -262,7 +262,6 @@ void TitleManager::CreateNewPlayerTitle(Client *client, const char *title) safe_delete_array(escTitle); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error adding title: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 0133dd56889982d444fa44e99e13c98a85f342dc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1237/1883] Remove Duplicative MySQL Error: Error in TradeskillSearchResults query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 7b98354d5..c7345a7d6 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -675,7 +675,6 @@ void Client::TradeskillSearchResults(const std::string query, unsigned long objt auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in TradeskillSearchResults query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 8ccb1ca3e732486831d35ef613cd8c80921566bb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1238/1883] Remove Duplicative MySQL Error: --- zone/trading.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/trading.cpp b/zone/trading.cpp index 2ecf17115..e1731e065 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1825,7 +1825,6 @@ void Client::SendBazaarResults(uint32 TraderID, uint32 Class_, uint32 Race, uint searchValues.c_str(), searchCriteria.c_str(), RuleI(Bazaar, MaxSearchResults)); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to retrieve Bazaar Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } From f57509113b67a813820f8a30852adcb62ffc6838 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1239/1883] Remove Duplicative MySQL Error: Error in LoadTributes level query '%s': %s --- zone/tribute.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tribute.cpp b/zone/tribute.cpp index 2a4ef78b8..df01f843e 100644 --- a/zone/tribute.cpp +++ b/zone/tribute.cpp @@ -406,7 +406,6 @@ bool ZoneDatabase::LoadTributes() { const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level"; results = QueryDatabase(query2); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadTributes level query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 8ac846e32e4cbf2d0e0e77e30bf0fdc21c189b9c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:17 -0600 Subject: [PATCH 1240/1883] Remove Duplicative MySQL Error: Error in GetGridType2 query '%s': %s --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 06b9712b3..357d2c598 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1027,7 +1027,6 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) { std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetGridType2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From ca27159223ba24a03df159f512083b863be7a781 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:18 -0600 Subject: [PATCH 1241/1883] Remove Duplicative MySQL Error: Error in LoadNewMerchantData query '%s' %s --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 48c1deceb..efbb92774 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -451,7 +451,6 @@ void Zone::LoadNewMerchantData(uint32 merchantid) { "classes_required, probability FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } From cf655a29075c39c0525c90c55d0d3e3fa7bffc2d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:18 -0600 Subject: [PATCH 1242/1883] Remove Duplicative MySQL Error: Error in GetZoneCFG query %s: %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index c9cb69291..4426b8993 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -111,7 +111,6 @@ bool ZoneDatabase::GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct "FROM zone WHERE zoneidnumber = %i AND version = %i", zoneid, instance_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetZoneCFG query %s: %s", query.c_str(), results.ErrorMessage().c_str()); strcpy(*map_filename, "default"); return false; } From 34269c5b69b985816e4bbb8999bab26a7b57b3ed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1243/1883] Remove Duplicative MySQL Error: Error in GetCharactersInInstace query '%s': %s --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 59f5592d6..c0f578f2a 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4047,7 +4047,6 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list &ch if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 5443e879a57a4e1a4e26d565c6de65ecf2b74fa6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1244/1883] Remove Duplicative MySQL Error: Error reloading guilds '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index c3929965a..2102d77d9 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -118,7 +118,6 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 220daed2c82d8f24fa47a1a3a03c9239cd8f1bba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1245/1883] Remove Duplicative MySQL Error: Error in LoadRules query %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index f4b513b9f..1b0461a9c 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -327,7 +327,6 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) { safe_delete_array(rst); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From 807dd5198ce30ede17390eb34ac349a7e64e7689 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1246/1883] Remove Duplicative MySQL Error: UpdateSharedBankSlot query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index ac94de59b..549b1ad72 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -256,7 +256,6 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, } if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 72359b54f0b6163c0716fff04db9b70708a522d7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1247/1883] Remove Duplicative MySQL Error: Error inserting player into LFGuild table, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index c80c23c4f..abb8c3f64 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -255,7 +255,6 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error inserting player into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); From 8b5a623c75b0f53f8d415e637bd948bb7204be62 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1248/1883] Remove Duplicative MySQL Error: Failed to load channels. %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 6eb4407d0..12ea39bc2 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -248,7 +248,6 @@ bool Database::LoadChatChannels() { const std::string query = "SELECT `name`, `owner`, `password`, `minstatus` FROM `chatchannels`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Failed to load channels. %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 7878755831c35fef0646ada2b8d480cdd909bcbf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:20 -0600 Subject: [PATCH 1249/1883] Remove Duplicative MySQL Error: Error in AdventureManager:::GetLeaderboardInfo: %s (%s) --- world/adventure_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/adventure_manager.cpp b/world/adventure_manager.cpp index 1314a344b..c49cf17c4 100644 --- a/world/adventure_manager.cpp +++ b/world/adventure_manager.cpp @@ -1077,7 +1077,6 @@ void AdventureManager::LoadLeaderboardInfo() "AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;"; auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From d6ba9d7108fa212cc8e69777c0ea3558b1ab02c1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1250/1883] Remove Duplicative MySQL Error: Error in GetTotalAALevels '%s: %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 4273e18ab..6ce2dd544 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1839,7 +1839,6 @@ uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 71842c62de7e617701b2ad48fa9aa50160d54f74 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1251/1883] Remove Duplicative MySQL Error: Error in Client::TryReward(): %s (%s) --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 8cd9a3ebb..ea991881f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5383,7 +5383,6 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " From e8824e5d140c25904546bcac8c040205756a693c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1252/1883] Remove Duplicative MySQL Error: error promoting item: %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 6435951cc..f98ba5c44 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -920,7 +920,6 @@ int GuildBankManager::Promote(uint32 guildID, int slotID) "LIMIT 1", mainSlot, guildID, slotID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "error promoting item: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From 47752634c0d4d2819224508baf6909b1c301d295 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1253/1883] Remove Duplicative MySQL Error: NPCSpawnDB Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index a3052b741..2c8733266 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1031,7 +1031,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } uint32 spawngroupid = results.LastInsertedID(); From cdc449eb7ce3a8fe2ce61f87030ffbe4035885d7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1254/1883] Remove Duplicative MySQL Error: Error in InsertPetitionToDB query '%s': %s --- zone/petitions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index a713dfdf7..964b8beae 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -252,7 +252,6 @@ void ZoneDatabase::InsertPetitionToDB(Petition* wpet) safe_delete_array(petitiontext); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in InsertPetitionToDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 2ae6050a77c79ab0ab44bc411fe3de5285c33509 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1255/1883] Remove Duplicative MySQL Error: Error in GetBasePetItems query '%s': %s --- zone/pets.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/pets.cpp b/zone/pets.cpp index 4b2287a98..8415dbe9d 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -670,7 +670,6 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in GetBasePetItems query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); else { for (row = results.begin(); row != results.end(); ++row) { From d4b35740be1f4b49efb3bb5024642c4495860f2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:21 -0600 Subject: [PATCH 1256/1883] Remove Duplicative MySQL Error: Error in LoadSpawn2 query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index cb9197ec5..d78558752 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -395,7 +395,6 @@ Spawn2* ZoneDatabase::LoadSpawn2(LinkedList &spawn2_list, uint32 spawn2 } if (results.RowCount() != 1) { - Log.Out(Logs::General, Logs::Error, "Error in LoadSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } From 8756b976bb6f5de7c99f5cbad2e034705fcafa73 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:22 -0600 Subject: [PATCH 1257/1883] Remove Duplicative MySQL Error: --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index ad48c7cb6..37f54570b 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -1276,7 +1276,6 @@ static void DeleteCompletedTaskFromDatabase(int charID, int taskID) { const std::string query = StringFormat("DELETE FROM completed_tasks WHERE charid=%i AND taskid = %i", charID, taskID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "[TASKS]Error in CientTaskState::CancelTask %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 4bcfe5444bc84a758ba221b83eb67de0749f2f2a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:22 -0600 Subject: [PATCH 1258/1883] Remove Duplicative MySQL Error: Error adding title suffix: %s %s --- zone/titles.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 6234ac674..639a7e2ba 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -294,7 +294,6 @@ void TitleManager::CreateNewPlayerSuffix(Client *client, const char *suffix) safe_delete_array(escSuffix); results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error adding title suffix: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 71497f06744900f21797ec5052d5dde52ab9c6c9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:22 -0600 Subject: [PATCH 1259/1883] Remove Duplicative MySQL Error: Error in SendTradeskillDetails query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index c7345a7d6..44ee3826a 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -728,7 +728,6 @@ void Client::SendTradeskillDetails(uint32 recipe_id) { recipe_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in SendTradeskillDetails query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 6d3b9ae40b1a58af6fc782680292e31b376c4829 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:22 -0600 Subject: [PATCH 1260/1883] Remove Duplicative MySQL Error: --- zone/trading.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/trading.cpp b/zone/trading.cpp index e1731e065..d06cf2f9d 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -2264,7 +2264,6 @@ void Client::SendBuyerResults(char* searchString, uint32 searchID) { safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::None, "[CLIENT] Failed to retrieve Barter Search!! %s %s\n", query.c_str(), results.ErrorMessage().c_str()); return; } From cec0b5760d858333729f801e04500d8872d27cee Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:22 -0600 Subject: [PATCH 1261/1883] Remove Duplicative MySQL Error: Error in GetWaypoints query '%s': %s --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 357d2c598..30fc7bbf3 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1047,7 +1047,6 @@ bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* "WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 5645d210824bb81bd03acbfe1f978181ab5271c1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:23 -0600 Subject: [PATCH 1262/1883] Remove Duplicative MySQL Error: Error in Zone::LoadLDoNTraps: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index efbb92774..61f08c7fa 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1990,7 +1990,6 @@ void Zone::LoadLDoNTraps() const std::string query = "SELECT id, type, spell_id, skill, locked FROM ldon_trap_templates"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadLDoNTraps: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 09d32d92af4776ae7c522b45c2093382116c865b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:23 -0600 Subject: [PATCH 1263/1883] Remove Duplicative MySQL Error: Error in UpdateTimeLeft query %s: %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 4426b8993..af4664b5b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -199,7 +199,6 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti "AND instance_id = %lu",(unsigned long)id, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } From adf3a7ea0e2d05f9e407afa25d04d60ded70ace1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:24 -0600 Subject: [PATCH 1264/1883] Remove Duplicative MySQL Error: Error reloading guild ranks '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 2102d77d9..70b87a869 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -137,7 +137,6 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 65e9f571afd0c2ce5e4eb29b89ed9706f18b5a2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:24 -0600 Subject: [PATCH 1265/1883] Remove Duplicative MySQL Error: Fauled to create rule set in the database: %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 1b0461a9c..ba4527d86 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -353,7 +353,6 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From 3040a8b1a12efb107d0d4c1e61ef6777786a3470 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1266/1883] Remove Duplicative MySQL Error: DeleteInventorySlot query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 549b1ad72..4ec224b0a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -268,7 +268,6 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 48202886339cd8d4d69f8a17ea744e7a9d85f9ce Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1267/1883] Remove Duplicative MySQL Error: Error removing guild from LFGuild table, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index abb8c3f64..dbcc1e555 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -285,7 +285,6 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error removing guild from LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); uint32 Now = time(nullptr); From 7d27d1ccb1a00c0718597d45d02323e01770f294 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1268/1883] Remove Duplicative MySQL Error: Error updating password in database: %s, %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 12ea39bc2..d7ebffbdb 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -270,7 +270,6 @@ void Database::SetChannelPassword(std::string channelName, std::string password) password.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating password in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } From b312663fd12804244190b25c2469a3780742c19e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1269/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::CountAAs query '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 6ce2dd544..eda4f3b03 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1892,7 +1892,6 @@ uint32 ZoneDatabase::CountAAs(){ const std::string query = "SELECT count(title_sid) FROM altadv_vars"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::CountAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From bd6f6579efbec764b0a0817c7141b1a9dd2570ac Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1270/1883] Remove Duplicative MySQL Error: Error in Client::TryReward(): %s (%s) --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index ea991881f..3aaa23621 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5390,7 +5390,6 @@ bool Client::TryReward(uint32 claim_id) { AccountID(), claim_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in Client::TryReward(): %s (%s)", query.c_str(), results.ErrorMessage().c_str()); } InternalVeteranReward ivr = (*iter); From 6e5b8170c5ae9a0712cc05807f81db9d4ca566cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1271/1883] Remove Duplicative MySQL Error: error changing permissions: %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index f98ba5c44..66fe8828a 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -971,7 +971,6 @@ void GuildBankManager::SetPermissions(uint32 guildID, uint16 slotID, uint32 perm auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "error changing permissions: %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 7bf57fca876e45bce62ba63b1c02db2ab25484e3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:25 -0600 Subject: [PATCH 1272/1883] Remove Duplicative MySQL Error: NPCSpawnDB Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 2c8733266..9e4340e80 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1044,7 +1044,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawn->GetHeading(), spawngroupid); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 2ef9e342f7f8980fa6c1ea5f6d31f7c4af2011a1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1273/1883] Remove Duplicative MySQL Error: Error in RefreshPetitionsFromDB query '%s': %s --- zone/petitions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 964b8beae..2d810564d 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -270,7 +270,6 @@ void ZoneDatabase::RefreshPetitionsFromDB() "FROM petitions ORDER BY petid"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in RefreshPetitionsFromDB query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 9d23f69a1062de8201307fe8b45c0bce557dfe51 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1274/1883] Remove Duplicative MySQL Error: Error in CreateSpawn2 query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index d78558752..abc416124 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -421,7 +421,6 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z respawn, variance, condition, cond_value); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in CreateSpawn2 query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 9cb3762102aba68e58f85fc87a046b9ee60beb05 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1275/1883] Remove Duplicative MySQL Error: --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 37f54570b..4bee8454f 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3074,7 +3074,6 @@ bool TaskGoalListManager::LoadLists() { "ORDER BY `listid`"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); return false; } From d9f492f4e2b98bb5b2cb4bf461abff2ff0488cab Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1276/1883] Remove Duplicative MySQL Error: Error in CheckTitle query '%s': %s --- zone/titles.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 639a7e2ba..7df8f86d1 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -359,7 +359,6 @@ bool Client::CheckTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in CheckTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 636f090ce3f7537adedcc4e151f18bba10d84360 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1277/1883] Remove Duplicative MySQL Error: Error in tradeskill verify query: '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 44ee3826a..ed92e6fb6 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1317,7 +1317,6 @@ bool ZoneDatabase::GetTradeRecipe(const ItemInst* container, uint8 c_type, uint3 recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in tradeskill verify query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return GetTradeRecipe(recipe_id, c_type, some_id, char_id, spec); } From 1b99e3e4d1ac3ad9accea1378d4517076527adb2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1278/1883] Remove Duplicative MySQL Error: Error querying spawn2 '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 30fc7bbf3..0e750b31e 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1075,7 +1075,6 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), (int)x, (int)y); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error querying spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From 8e5541acce52da370cb7c15653bac7a91c43fb5f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:26 -0600 Subject: [PATCH 1279/1883] Remove Duplicative MySQL Error: Error in Zone::LoadLDoNTrapEntries: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 61f08c7fa..dfb63d5e9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2010,7 +2010,6 @@ void Zone::LoadLDoNTrapEntries() const std::string query = "SELECT id, trap_id FROM ldon_trap_entries"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadLDoNTrapEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 22fa5b6ce9fe42149ad8fa444fcfdafc56713a1d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:27 -0600 Subject: [PATCH 1280/1883] Remove Duplicative MySQL Error: Error in UpdateTimeLeft query %s: %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index af4664b5b..da5b817be 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -209,7 +209,6 @@ void ZoneDatabase::UpdateSpawn2Timeleft(uint32 id, uint16 instance_id, uint32 ti (unsigned long)timeleft, (unsigned long)instance_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in UpdateTimeLeft query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 48a43b05559cf0656c6fd005ad897f1e3583083e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:31 -0600 Subject: [PATCH 1281/1883] Remove Duplicative MySQL Error: Error clearing old guild record when storing %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 70b87a869..f236f2fac 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -232,7 +232,6 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { auto results = m_db->QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::Detail, Logs::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); From 154bd186b13db708cecb46ac8b7922cdcd0d8d29 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:31 -0600 Subject: [PATCH 1282/1883] Remove Duplicative MySQL Error: Error in LoadRules query %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index ba4527d86..7a1b30b60 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -365,7 +365,6 @@ std::string RuleManager::GetRulesetName(Database *db, int id) { auto results = db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return ""; } From 4c804e85151b4bafa23d3e8e5aee00fd3f851a4f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:31 -0600 Subject: [PATCH 1283/1883] Remove Duplicative MySQL Error: DeleteInventorySlot, bags query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 4ec224b0a..04b032925 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -280,7 +280,6 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) { char_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From aae4691a6e913e93c6cb5f02b4ceae35a569a68d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1284/1883] Remove Duplicative MySQL Error: Error inserting guild into LFGuild table, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index dbcc1e555..2d66e7586 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -301,7 +301,6 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error inserting guild into LFGuild table, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); } From 86c82718eca5233d032c4b6c9583dc3747baad1e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1285/1883] Remove Duplicative MySQL Error: Error updating Owner in database: %s, %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index d7ebffbdb..ca9f0f0e8 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -281,7 +281,6 @@ void Database::SetChannelOwner(std::string channelName, std::string owner) { owner.c_str(), channelName.c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating Owner in database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } From 9d7b3d0c081736697643b6bf81d207ec60920b94 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1286/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::CountAALevels query '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index eda4f3b03..cfe80f10b 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1908,7 +1908,6 @@ uint32 ZoneDatabase::CountAAEffects() { const std::string query = "SELECT count(id) FROM aa_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::CountAALevels query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 4fadff785cf32a5b2e1d1bb74e3b2c05c8f0649f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1287/1883] Remove Duplicative MySQL Error: Delete item failed. %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 66fe8828a..71312b460 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -1120,7 +1120,6 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Delete item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 69bb54fd9cf6c49aab07f74dd5dc843170a5114d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1288/1883] Remove Duplicative MySQL Error: NPCSpawnDB Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 9e4340e80..6132be712 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1054,7 +1054,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C spawngroupid, npc_type_id, 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "NPCSpawnDB Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 650f7366abf386010428e94d25a78fee220b9fee Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1289/1883] Remove Duplicative MySQL Error: Unable to update spawn event '%s': %s\n --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index abc416124..d28b8fc00 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -670,7 +670,6 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.strict? 1: 0, event.id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Unable to update spawn event '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } From 2196053f8a2060d9db499bf14fc2b055f1dee9bf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:32 -0600 Subject: [PATCH 1290/1883] Remove Duplicative MySQL Error: --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 4bee8454f..a1758ae4c 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3107,7 +3107,6 @@ bool TaskGoalListManager::LoadLists() { listID, size); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, ERR_MYSQLERROR, query.c_str(), results.ErrorMessage().c_str()); TaskGoalLists[listIndex].Size = 0; continue; } From be3acf583ff33225c97568db355cbf2a87c1db78 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:33 -0600 Subject: [PATCH 1291/1883] Remove Duplicative MySQL Error: Error in RemoveTitle query '%s': %s --- zone/titles.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 7df8f86d1..3c28e2417 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -378,7 +378,6 @@ void Client::RemoveTitle(int titleSet) { titleSet, CharacterID()); auto results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in RemoveTitle query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } From 21ad8e1e7cfb3335df9f02e03038bae68adc4ec6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:33 -0600 Subject: [PATCH 1292/1883] Remove Duplicative MySQL Error: Error in GetTradeRecept success query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index ed92e6fb6..f2502ccae 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1403,7 +1403,6 @@ bool ZoneDatabase::GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id "WHERE successcount > 0 AND recipe_id = %u", recipe_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetTradeRecept success query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 598848f4fc88af6366fe6a99df7defee071f4089 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:33 -0600 Subject: [PATCH 1293/1883] Remove Duplicative MySQL Error: Error querying fuzzy spawn2 '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 0e750b31e..9dd115d8e 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1088,7 +1088,6 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) zone->GetShortName(), x, _GASSIGN_TOLERANCE, y, _GASSIGN_TOLERANCE); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error querying fuzzy spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From 6bf5b5a7fb93e6e733cc21c2906537180475a4d2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:33 -0600 Subject: [PATCH 1294/1883] Remove Duplicative MySQL Error: Error in Zone::LoadVeteranRewards: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index dfb63d5e9..f8f353c3e 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2051,7 +2051,6 @@ void Zone::LoadVeteranRewards() "ORDER by claim_id, reward_slot"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadVeteranRewards: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 63b2f706e465da729153500be4130e43ad2242db Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:33 -0600 Subject: [PATCH 1295/1883] Remove Duplicative MySQL Error: Error in GetSpawnTimeLeft query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index da5b817be..ab68de708 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -221,7 +221,6 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) (unsigned long)id, (unsigned long)zone->GetInstanceID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetSpawnTimeLeft query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 7e4eedbebc93040314751dc3b69011b024d3acbc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:35 -0600 Subject: [PATCH 1296/1883] Remove Duplicative MySQL Error: Error clearing old guild_ranks records when storing %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index f236f2fac..50ab3815a 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -238,7 +238,6 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { results = m_db->QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::Detail, Logs::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); //escape our strings. char *name_esc = new char[info->name.length()*2+1]; From 30a351a3b828347c2bbac6f6c80eee7db4843cba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1297/1883] Remove Duplicative MySQL Error: Error in ListRulesets query %s: %s --- common/rulesys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 7a1b30b60..97d5a96ad 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -385,7 +385,6 @@ bool RuleManager::ListRulesets(Database *db, std::map &into) { auto results = db->QueryDatabase(query); if (results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 51fc8d61cc27bcd213a75293e5e672db7648acb4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1298/1883] Remove Duplicative MySQL Error: DeleteSharedBankSlot query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 04b032925..b2a0b43ab 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -294,7 +294,6 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 7cceee14a1b8b125ff8fa36400a7299a1199c782 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1299/1883] Remove Duplicative MySQL Error: Error expiring player LFGuild entry, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 2d66e7586..c791aceba 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -330,7 +330,6 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error expiring player LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it = Players.erase(it); } From 3a91ae92abc15a79e55432ec54e68ef45327d877 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1300/1883] Remove Duplicative MySQL Error: SendMail: Query %s failed with error %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index ca9f0f0e8..56ad0dce8 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -459,7 +459,6 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub safe_delete_array(escBody); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "SendMail: Query %s failed with error %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From e88d0a8a2de54ba89203993ae2318c1af900c8ca Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1301/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::LoadAAs query '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index cfe80f10b..34c29b336 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1940,7 +1940,6 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ load[index]->seq = index+1; } } else { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } AARequiredLevelAndCost.clear(); From e406d1e20c2cfda259296bff0d3ca1057deff6fa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1302/1883] Remove Duplicative MySQL Error: Update item failed. %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 71312b460..c3ecbe9d7 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -1131,7 +1131,6 @@ bool GuildBankManager::DeleteItem(uint32 guildID, uint16 area, uint16 slotID, ui BankArea[slotID].Quantity - quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Update item failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 9561634ed8bc89dda158ff4738e73dc00f51cb45 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:36 -0600 Subject: [PATCH 1303/1883] Remove Duplicative MySQL Error: CreateNewNPCSpawnGroupCommand Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 6132be712..a61a795ea 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1070,7 +1070,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve zone, spawn->GetName(), Timer::GetCurrentTime()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } last_insert_id = results.LastInsertedID(); From db65661a10eec355abbdcae2352f02f6bfd25295 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1304/1883] Remove Duplicative MySQL Error: Unable to update spawn condition '%s': %s\n --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index d28b8fc00..1e12f1383 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -681,7 +681,6 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst cond_id, value, zone_name, instance_id); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Unable to update spawn condition '%s': %s\n", query.c_str(), results.ErrorMessage().c_str()); } From 1661691bc9dc991bcccfbd0fcba52fdd7587541e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1305/1883] Remove Duplicative MySQL Error: Error in TaskProximityManager::LoadProximities %s %s --- zone/tasks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tasks.cpp b/zone/tasks.cpp index a1758ae4c..0673e51c8 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3243,7 +3243,6 @@ bool TaskProximityManager::LoadProximities(int zoneID) { "ORDER BY `zoneid` ASC", zoneID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in TaskProximityManager::LoadProximities %s %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 590634ebef72a635588e046376b298f45763d04e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1306/1883] Remove Duplicative MySQL Error: Error in UpdateRecipeMadecount query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index f2502ccae..745fe8b8b 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1459,7 +1459,6 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 recipe_id, char_id, madeCount, madeCount); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in UpdateRecipeMadecount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } void Client::LearnRecipe(uint32 recipeID) From 526075a767f5570a74ae6d52f4eb886757319fda Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1307/1883] Remove Duplicative MySQL Error: Error updating spawn2 '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 9dd115d8e..29f39e287 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1117,7 +1117,6 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid) results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error updating spawn2 '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From 17d51b3ff4362bd754966b091796794c971eaa3b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1308/1883] Remove Duplicative MySQL Error: Error in Zone::LoadAlternateCurrencies: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index f8f353c3e..55a818a01 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2096,7 +2096,6 @@ void Zone::LoadAlternateCurrencies() const std::string query = "SELECT id, item_id FROM alternate_currency"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadAlternateCurrencies: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From a992ece3234190fbe3a0a9d83c8f8d2b9629269e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:37 -0600 Subject: [PATCH 1309/1883] Remove Duplicative MySQL Error: Error in UpdateSpawn2Status query %s: %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ab68de708..6b99d722c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -250,7 +250,6 @@ void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in UpdateSpawn2Status query %s: %s", query.c_str(), results.ErrorMessage().c_str()); } From 233320330f89a90192ea493a279154933b816835 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:43 -0600 Subject: [PATCH 1310/1883] Remove Duplicative MySQL Error: Error inserting new guild record when storing %d. Giving up. '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 50ab3815a..0232914da 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -254,7 +254,6 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(name_esc); safe_delete_array(motd_esc); safe_delete_array(motd_set_esc); From 912de7704d030cde96799054c51ad49e8990e644 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:43 -0600 Subject: [PATCH 1311/1883] Remove Duplicative MySQL Error: DeleteSharedBankSlot, bags query '%s': %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index b2a0b43ab..d49b1983c 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -307,7 +307,6 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) { account_id, base_slot_id, (base_slot_id+10)); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 633b953fd3bd6c0d213248b445f80cc58bb2a828 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:43 -0600 Subject: [PATCH 1312/1883] Remove Duplicative MySQL Error: Error removing guild LFGuild entry, query was %s, %s --- queryserv/lfguild.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index c791aceba..2f395c97a 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -342,7 +342,6 @@ void LFGuildManager::ExpireEntries() std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::QS_Server, "Error removing guild LFGuild entry, query was %s, %s", query.c_str(), results.ErrorMessage().c_str()); it2 = Guilds.erase(it2); } From d800bd87c486e3e1df75bad306be7991101c3c73 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:43 -0600 Subject: [PATCH 1313/1883] Remove Duplicative MySQL Error: Error updating status %s, %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 56ad0dce8..cd4bcd0a7 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -490,7 +490,6 @@ void Database::SetMessageStatus(int messageNumber, int status) { std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::Detail, Logs::UCS_Server, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str()); } From 882e7a98021e920dce1a8456a9ee3f6937f7b376 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:43 -0600 Subject: [PATCH 1314/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::LoadAAs query '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 34c29b336..4f76517fc 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1946,7 +1946,6 @@ void ZoneDatabase::LoadAAs(SendAA_Struct **load){ query = "SELECT skill_id, level, cost from aa_required_level_cost order by skill_id"; results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::LoadAAs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 39c7d30e465f77212f0789830bf764478200ed4b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1315/1883] Remove Duplicative MySQL Error: Update item quantity failed. %s : %s --- zone/guild_mgr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index c3ecbe9d7..8df4c794e 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -1293,7 +1293,6 @@ void GuildBankManager::UpdateItemQuantity(uint32 guildID, uint16 area, uint16 sl quantity, guildID, area, slotID); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Update item quantity failed. %s : %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 405d025322eba2d8b19e1417d82a4a952c5df42e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1316/1883] Remove Duplicative MySQL Error: CreateNewNPCSpawnGroupCommand Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index a61a795ea..fafd9fc96 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1092,7 +1092,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve spawn->GetHeading(), last_insert_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } spawnid = results.LastInsertedID(); From 04ae8b1707ee22ab6a09858cf95be32411dbe220 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1317/1883] Remove Duplicative MySQL Error: Error in LoadDBEvent query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 1e12f1383..290af91f3 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -693,7 +693,6 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: "FROM spawn_events WHERE id = %d", event_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadDBEvent query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 50fd74a2d220e354928ab57699281b0ff4d99ed1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1318/1883] Remove Duplicative MySQL Error: Error in Client::LearnRecipe query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 745fe8b8b..a7230d457 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1471,7 +1471,6 @@ void Client::LearnRecipe(uint32 recipeID) "WHERE tr.id = %u ;", CharacterID(), recipeID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Client::LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From e549ae11f207d3049ab8fd6d28fab6ea24f10723 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1319/1883] Remove Duplicative MySQL Error: Error creating grid entry '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 29f39e287..53910190c 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1154,7 +1154,6 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type "VALUES (%i, %i, %i, %i)", id, zoneid, type, type2); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error creating grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From e74666fa3b1f5e87387957f8673bc402a353cbf7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1320/1883] Remove Duplicative MySQL Error: Error in Zone::LoadAdventureFlavor: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 55a818a01..e4cc18eb5 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2143,7 +2143,6 @@ void Zone::LoadAdventureFlavor() const std::string query = "SELECT id, text FROM adventure_template_entry_flavor"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadAdventureFlavor: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 2ad99b8c239916dadacdbaf0ba5f8c3c1386c5a4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:44 -0600 Subject: [PATCH 1321/1883] Remove Duplicative MySQL Error: ERROR Bind Home Save: %s. %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 6b99d722c..732b766bf 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1228,7 +1228,6 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); auto results = QueryDatabase(query); if (!results.RowsAffected()) { - Log.Out(Logs::General, Logs::None, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); } return true; } From ddae2f3d165736df9cc309506b34d483781c5774 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:52 -0600 Subject: [PATCH 1322/1883] Remove Duplicative MySQL Error: Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 0232914da..fcf227d05 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -287,7 +287,6 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(title_esc); return false; } From 756e90b6832a03be2e6a34e39b50a7b4e332cfc7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:52 -0600 Subject: [PATCH 1323/1883] Remove Duplicative MySQL Error: GetInventory query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d49b1983c..cb2ca2d2b 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -485,7 +485,6 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { "FROM inventory WHERE charid = %i ORDER BY slotid", char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } From 5faeecd82bbd8d4dc7a733a7fad2bf04ebb3cdb1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1324/1883] Remove Duplicative MySQL Error: Unable to get message count from database. %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index cd4bcd0a7..e17606558 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -500,7 +500,6 @@ void Database::ExpireMail() { std::string query = "SELECT COUNT(*) FROM `mail`"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Unable to get message count from database. %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 4ecbc5d2dbe895da95236f8796e572b115c66c25 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1325/1883] Remove Duplicative MySQL Error: Error in GetAASkillVars '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 4f76517fc..bad09e266 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1963,7 +1963,6 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) std::string query = "SET @row = 0"; //initialize "row" variable in database for next query auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } From 5bce113bd75b574db6d616409cc3f5f35686626c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1326/1883] Remove Duplicative MySQL Error: CreateNewNPCSpawnGroupCommand Error: %s %s --- zone/npc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index fafd9fc96..56bbdae69 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1103,7 +1103,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve last_insert_id, spawn->GetNPCTypeID(), 100); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "CreateNewNPCSpawnGroupCommand Error: %s %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 82951fb82d2afebe729828f4b77539a3a7a524a1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1327/1883] Remove Duplicative MySQL Error: Error in LoadSpawnConditions query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 290af91f3..395bcafc6 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -735,7 +735,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "WHERE zone = '%s'", zone_name); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From c4ebfa889083e46a476975c723fe5ee69b1934b6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1328/1883] Remove Duplicative MySQL Error: Error in LearnRecipe query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a7230d457..445065e70 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1496,7 +1496,6 @@ void Client::LearnRecipe(uint32 recipeID) recipeID, CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in LearnRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } From 430263de9c3b2d06deb804768202a1352ffcc832 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1329/1883] Remove Duplicative MySQL Error: Error deleting grid '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 53910190c..0330692da 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1166,7 +1166,6 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error deleting grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); From 800378d9445069056dd0885afc25039994dbc4cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:53 -0600 Subject: [PATCH 1330/1883] Remove Duplicative MySQL Error: Error in Zone::LoadNPCEmotes: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index e4cc18eb5..6ef7ec8fd 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2217,7 +2217,6 @@ void Zone::LoadNPCEmotes(LinkedList* NPCEmoteList) const std::string query = "SELECT emoteid, event_, type, text FROM npc_emotes"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadNPCEmotes: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 102c0416f8b1014152d286331a69788d87f1daa3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:54 -0600 Subject: [PATCH 1331/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::GroupCount query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 732b766bf..79ae28b3d 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2639,7 +2639,6 @@ uint8 ZoneDatabase::GroupCount(uint32 groupid) { std::string query = StringFormat("SELECT count(charid) FROM group_id WHERE groupid = %d", groupid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::GroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From fa1e73fa035ff8c40e1d3889e6f8af693bde2f22 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:55 -0600 Subject: [PATCH 1332/1883] Remove Duplicative MySQL Error: Error in _GetFreeGuildID query '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index fcf227d05..f70caf1d8 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -329,7 +329,6 @@ uint32 BaseGuildManager::_GetFreeGuildID() { if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); continue; } From a128c7409052299b44d12c0257b2f6506194b917 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:55 -0600 Subject: [PATCH 1333/1883] Remove Duplicative MySQL Error: GetInventory query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index cb2ca2d2b..da95cabef 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -609,7 +609,6 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) name, account_id); auto results = QueryDatabase(query); if (!results.Success()){ - Log.Out(Logs::General, Logs::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); Log.Out(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n"); return false; } From b866b989898da6122efb86c6bc0147988e76585c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:55 -0600 Subject: [PATCH 1334/1883] Remove Duplicative MySQL Error: Error expiring trash messages, %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index e17606558..8dc44e2d4 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -515,7 +515,6 @@ void Database::ExpireMail() { if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); else - Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring trash messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } From 8c629529d7c1c02ae1261a80c4646b832158df63 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1335/1883] Remove Duplicative MySQL Error: Error in GetAASkillVars '%s': %s --- zone/aa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index bad09e266..96f08e328 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1982,7 +1982,6 @@ SendAA_Struct* ZoneDatabase::GetAASkillVars(uint32 skill_id) "FROM altadv_vars a WHERE skill_id=%i", skill_id); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetAASkillVars '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return nullptr; } From 2a3b9b65fc7f0857debc321bc6bd29bd885ef53b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1336/1883] Remove Duplicative MySQL Error: Error in LoadSpawnConditions query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 395bcafc6..4d4ac8538 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -756,7 +756,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in zone_name, instance_id); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); spawn_conditions.clear(); return false; } From dfec624b8d109d394183b98555431c67669b85ba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1337/1883] Remove Duplicative MySQL Error: Error in EnableRecipe query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 445065e70..04ec6dac5 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1545,7 +1545,6 @@ bool ZoneDatabase::EnableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in EnableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } From 99dd77cff0fd32784bf3ca648575324a32acadfc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1338/1883] Remove Duplicative MySQL Error: Error deleting grid entries '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 0330692da..0f40765ae 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1172,7 +1172,6 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error deleting grid entries '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); From a04aecae0e2e744117e46207829e38685d156e80 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1339/1883] Remove Duplicative MySQL Error: Error in Zone::LoadTickItems: %s (%s) --- zone/zone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 6ef7ec8fd..a89c0b96c 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2250,7 +2250,6 @@ void Zone::LoadTickItems() const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"; auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str()); return; } From 06bef2fc6d7bfa96ccc18095201ec04d22959363 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:56 -0600 Subject: [PATCH 1340/1883] Remove Duplicative MySQL Error: Error in ZoneDatabase::RaidGroupCount query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 79ae28b3d..ca7cdd7be 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2657,7 +2657,6 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) { auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ZoneDatabase::RaidGroupCount query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From ad70e4f051ee0731fd9bd959279a48f04f552704 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:58 -0600 Subject: [PATCH 1341/1883] Remove Duplicative MySQL Error: Error changing leader on guild %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index f70caf1d8..14235999b 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -608,7 +608,6 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } From 9d1da53d979cead9343ca2c7bcf351b16d2cd422 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:58 -0600 Subject: [PATCH 1342/1883] Remove Duplicative MySQL Error: Error in GetItemsCount '%s': '%s' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index da95cabef..287dd88a9 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -711,7 +711,6 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) { const std::string query = "SELECT MAX(id), count(*) FROM items"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From af0e80fbf3d47fa655b98e1a88ac04907c83fea0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:58 -0600 Subject: [PATCH 1343/1883] Remove Duplicative MySQL Error: Error expiring read messages, %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 8dc44e2d4..b216c19ab 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -526,7 +526,6 @@ void Database::ExpireMail() { if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i read messages.", results.RowsAffected()); else - Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring read messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } // Expire Unread From 363a4b95c1ca4f074d8531a35648a04056a2accf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:58 -0600 Subject: [PATCH 1344/1883] Remove Duplicative MySQL Error: Error in LoadSpawnConditions events query '%s': %s --- zone/spawn2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 4d4ac8538..77adcddb2 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -773,7 +773,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in "FROM spawn_events WHERE zone = '%s'", zone_name); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadSpawnConditions events query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 75ea162c2bdcf959d8120fb0cd1014fc2b693243 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:59 -0600 Subject: [PATCH 1345/1883] Remove Duplicative MySQL Error: Error in DisableRecipe query '%s': %s --- zone/tradeskills.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 04ec6dac5..ec3dd46d3 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1555,7 +1555,6 @@ bool ZoneDatabase::DisableRecipe(uint32 recipe_id) "WHERE id = %u;", recipe_id); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in DisableRecipe query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return results.RowsAffected() > 0; } From 3f75eba5e0dae0dec35d2d0e169b1a8f0e89ca4c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:59 -0600 Subject: [PATCH 1346/1883] Remove Duplicative MySQL Error: Error adding waypoint '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 0f40765ae..d5052c221 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1187,7 +1187,6 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, float xpos gridid, zoneid, wpnum, xpos, ypos, zpos, pause, heading); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error adding waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From e15b551164c9fb8a1b06d12e2aa36bae27659938 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:25:59 -0600 Subject: [PATCH 1347/1883] Remove Duplicative MySQL Error: Error in LoadAltCurrencyValues query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ca7cdd7be..873aacbb4 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2816,7 +2816,6 @@ void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map Date: Mon, 19 Jan 2015 05:26:00 -0600 Subject: [PATCH 1348/1883] Remove Duplicative MySQL Error: Error setting MOTD for guild %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 14235999b..63ffb0b48 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -651,7 +651,6 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); safe_delete_array(esc_set); return false; From d4c09472804477ded7597582f5d7522f493ec21f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:00 -0600 Subject: [PATCH 1349/1883] Remove Duplicative MySQL Error: LoadItems '%s', %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 287dd88a9..a500278f4 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -795,7 +795,6 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ "updated FROM items ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 729283ad01a7ba06dec9756ce337198344c2632b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:00 -0600 Subject: [PATCH 1350/1883] Remove Duplicative MySQL Error: Error expiring unread messages, %s %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index b216c19ab..1e23c41da 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -536,7 +536,6 @@ void Database::ExpireMail() { if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); else - Log.Out(Logs::Detail, Logs::UCS_Server, "Error expiring unread messages, %s %s", query.c_str(), results.ErrorMessage().c_str()); } } From 1595395f69a44148c718553f25ab317b80a8d757 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:01 -0600 Subject: [PATCH 1351/1883] Remove Duplicative MySQL Error: Error deleting waypoint '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index d5052c221..896841ba5 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1212,7 +1212,6 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num grid_num, zoneid, wp_num); auto results = QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error deleting waypoint '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return; } From fac715012bf6e82bde3ab96386602ac25258ae1d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:01 -0600 Subject: [PATCH 1352/1883] Remove Duplicative MySQL Error: Error in SaveBuffs query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 873aacbb4..13b49b442 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2856,7 +2856,6 @@ void ZoneDatabase::SaveBuffs(Client *client) { buffs[index].ExtraDIChance); auto results = QueryDatabase(query); if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error in SaveBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); } } From e726c7356aae2096a96689d2bfefeb3bca56f1dd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:02 -0600 Subject: [PATCH 1353/1883] Remove Duplicative MySQL Error: Error setting URL for guild %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 63ffb0b48..ccb84c342 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -687,7 +687,6 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL) if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } From beeba6c8be14f9a81880f7ca7fe16979eb1a077f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:02 -0600 Subject: [PATCH 1354/1883] Remove Duplicative MySQL Error: Error getting npc faction info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a500278f4..c8a0281cd 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1086,7 +1086,6 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) { const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 6f48d84b82762c6e2c01e86b82f0b0a99f17e522 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:02 -0600 Subject: [PATCH 1355/1883] Remove Duplicative MySQL Error: Error adding friend/ignore, query was %s : %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 1e23c41da..3afad470c 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -546,7 +546,6 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::Detail, Logs::UCS_Server, "Error adding friend/ignore, query was %s : %s", query.c_str(), results.ErrorMessage().c_str()); else Log.Out(Logs::Detail, Logs::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); From e5dd2634f9032397b30cdfa2596d12c6c50d9bd5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:02 -0600 Subject: [PATCH 1356/1883] Remove Duplicative MySQL Error: Error setting pathgrid '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 896841ba5..8a8f1bb9d 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1238,7 +1238,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, auto results = QueryDatabase(query); if (!results.Success()) { // Query error - Log.Out(Logs::General, Logs::Error, "Error setting pathgrid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 4de2c0e99bbccd44a9dd29b111910ae5d8c87b2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:02 -0600 Subject: [PATCH 1357/1883] Remove Duplicative MySQL Error: Error in LoadBuffs query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 13b49b442..620a6eab9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2874,7 +2874,6 @@ void ZoneDatabase::LoadBuffs(Client *client) { "FROM `character_buffs` WHERE `character_id` = '%u'", client->CharacterID()); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadBuffs query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 6753517bb133bb817563fb866b3594bdb81c7433 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:03 -0600 Subject: [PATCH 1358/1883] Remove Duplicative MySQL Error: Error setting Channel for guild %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index ccb84c342..2888dec37 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -721,7 +721,6 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel) if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str()); safe_delete_array(esc); return(false); } From f43211afad9fb6b63e466f2c131cc00e7f4285ad Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:03 -0600 Subject: [PATCH 1359/1883] Remove Duplicative MySQL Error: Error getting npc faction info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c8a0281cd..9a3395e89 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1120,7 +1120,6 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co "ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 056b172d7dc8311f97adf00a257d98b4e93cd3db Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:03 -0600 Subject: [PATCH 1360/1883] Remove Duplicative MySQL Error: GetFriendsAndIgnore query error %s, %s --- ucs/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 3afad470c..507e8ad30 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -569,7 +569,6 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends std::string query = StringFormat("select `type`, `name` FROM `friends` WHERE `charid`=%i", charID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "GetFriendsAndIgnore query error %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 9003276f23edee6218aaa0d5d39ed41a7d8b306c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:04 -0600 Subject: [PATCH 1361/1883] Remove Duplicative MySQL Error: Error adding grid '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 8a8f1bb9d..ede727c68 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1258,7 +1258,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, type1, type2); results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error adding grid '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); From 02d034b046b247fdfedc5a7e821f254e995be2cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:04 -0600 Subject: [PATCH 1362/1883] Remove Duplicative MySQL Error: Error in LoadPetInfo query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 620a6eab9..a496ea636 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3047,7 +3047,6 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); auto results = database.QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 5df58973a83b8c28ba609d7fd14a284990bb12f1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:05 -0600 Subject: [PATCH 1363/1883] Remove Duplicative MySQL Error: Error Changing char %d to guild %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 2888dec37..c69966a38 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -746,7 +746,6 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } From b8f7d88219bd2bdf3f90a93891a75b7c3c352a33 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:05 -0600 Subject: [PATCH 1364/1883] Remove Duplicative MySQL Error: Error in LoadDamageShieldTypes: %s %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 9a3395e89..a8e83f2f2 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1449,7 +1449,6 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe "AND `spellid` <= %i", iMaxSpellID); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 05aba517c2f4bfce1cfc118b266dd6a095c90885 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:05 -0600 Subject: [PATCH 1365/1883] Remove Duplicative MySQL Error: Error updating spawn2 pathing '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index ede727c68..99c46e959 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1264,7 +1264,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error updating spawn2 pathing '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); } From f7f34d8d30957ac500386edfa22033c5d0f6b4f2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:05 -0600 Subject: [PATCH 1366/1883] Remove Duplicative MySQL Error: Error in LoadPetInfo query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index a496ea636..be8406061 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3074,7 +3074,6 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id` = %u", client->CharacterID()); results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 6ae05eef383e6c3145bb79be8eb07417ec14874c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:06 -0600 Subject: [PATCH 1367/1883] Remove Duplicative MySQL Error: Error removing char %d from guild '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index c69966a38..48f061188 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -754,7 +754,6 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) { auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str()); return false; } } From 626aa140da0dec0ca8e4e7f3a10fc616bc6e01e8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:06 -0600 Subject: [PATCH 1368/1883] Remove Duplicative MySQL Error: Error in GetMaxSpellID query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a8e83f2f2..afbeca18f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1468,7 +1468,6 @@ int SharedDatabase::GetMaxSpellID() { std::string query = "SELECT MAX(id) FROM spells_new"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From ca53c408991b90e86db9533ff4bc6ea878fd22c6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:06 -0600 Subject: [PATCH 1369/1883] Remove Duplicative MySQL Error: Error getting next waypoint id '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 99c46e959..6fe4aa82a 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1275,7 +1275,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, results = QueryDatabase(query); if(!results.Success()) { // Query error - Log.Out(Logs::General, Logs::Error, "Error getting next waypoint id '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 6cde9697800136ba0530461d5292c2b48d261b18 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:06 -0600 Subject: [PATCH 1370/1883] Remove Duplicative MySQL Error: Error in LoadPetInfo query '%s': %s --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index be8406061..248f6a55b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3114,7 +3114,6 @@ void ZoneDatabase::LoadPetInfo(Client *client) { "WHERE `char_id`=%u",client->CharacterID()); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadPetInfo query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return; } From bf7c40d7a58821735f9fd13ae26b9026a7eedf24 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:07 -0600 Subject: [PATCH 1371/1883] Remove Duplicative MySQL Error: Error retrieving banker flag '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 48f061188..253d60f0f 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -781,7 +781,6 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 27d16a0a3e07bcf837cee6f71091aca3f16fffa8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:07 -0600 Subject: [PATCH 1372/1883] Remove Duplicative MySQL Error: Error in LoadSpells query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index afbeca18f..adc6da7c4 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1482,7 +1482,6 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { const std::string query = "SELECT * FROM spells_new ORDER BY id ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 2ef8f793388aa6a488d33a2d99b51c15f8904366 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:08 -0600 Subject: [PATCH 1373/1883] Remove Duplicative MySQL Error: Error adding grid entry '%s': '%s' --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 6fe4aa82a..dde7aebb1 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1289,7 +1289,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); if(!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error adding grid entry '%s': '%s'", query.c_str(), results.ErrorMessage().c_str()); else if(client) client->LogSQL(query.c_str()); From 3f3368e60c1a6b31fe88d9fb7970b6324b7339b3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:08 -0600 Subject: [PATCH 1374/1883] Remove Duplicative MySQL Error: Error retrieving alt flag '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 253d60f0f..6d9c92c3d 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -811,7 +811,6 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID) auto results = m_db->QueryDatabase(query); if(!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From b603344ecd5f27ec3fe9dbb3c6cfd51f5ca37a50 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:09 -0600 Subject: [PATCH 1375/1883] Remove Duplicative MySQL Error: Error in GetMaxBaseDataLevel query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index adc6da7c4..c54e5edcf 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1642,7 +1642,6 @@ int SharedDatabase::GetMaxBaseDataLevel() { const std::string query = "SELECT MAX(level) FROM base_data"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return -1; } From 499364e9fe457d6666f57b2305280492f82538c7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:09 -0600 Subject: [PATCH 1376/1883] Remove Duplicative MySQL Error: Error in GetFreeGrid query '%s': %s --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index dde7aebb1..b659c8d64 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1300,7 +1300,6 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) { std::string query = StringFormat("SELECT max(id) FROM grid WHERE zoneid = %i", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetFreeGrid query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 85659dd200ab4e1a46baa97d413ca2ce2b269cfd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:10 -0600 Subject: [PATCH 1377/1883] Remove Duplicative MySQL Error: Error setting public note for char %d '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 6d9c92c3d..43b597cad 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -846,7 +846,6 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str()); return false; } From 1e30a75cdccf8406dcc585c92ba9583ff2ca2486 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:10 -0600 Subject: [PATCH 1378/1883] Remove Duplicative MySQL Error: Error in LoadBaseData query '%s' %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c54e5edcf..a817af146 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1687,7 +1687,6 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str()); return; } From cacf9df26910b4f10371e6c0c2ceff5f671d1696 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:10 -0600 Subject: [PATCH 1379/1883] Remove Duplicative MySQL Error: Error in GetHighestWaypoint query '%s': %s --- zone/waypoints.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index b659c8d64..e2c72c1bf 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1319,7 +1319,6 @@ int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) { "WHERE zoneid = %i AND gridid = %i", zoneid, gridid); auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From 315f5e0ca492f979f406f3cf6604a48c77ddd15b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:13 -0600 Subject: [PATCH 1380/1883] Remove Duplicative MySQL Error: Error %s: '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 43b597cad..80c5ca755 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -862,7 +862,6 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) { if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str()); return(false); } From 9ad299fa68d11392e74a63a94f0a60f509184660 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:13 -0600 Subject: [PATCH 1381/1883] Remove Duplicative MySQL Error: Error getting loot table info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a817af146..2695251c0 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1766,7 +1766,6 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 417777a6f1eec6b030eac036508a2db5af456bf9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:15 -0600 Subject: [PATCH 1382/1883] Remove Duplicative MySQL Error: Error loading guild member list '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 80c5ca755..97241d693 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -919,7 +919,6 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vectorQueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From f4e74705cfdf2f9d61bd249f93e42cbeabef9195 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:15 -0600 Subject: [PATCH 1383/1883] Remove Duplicative MySQL Error: Error getting loot table info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 2695251c0..701579857 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1787,7 +1787,6 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 28285d6c595db27ecff41a07f270e34964c982ef Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:16 -0600 Subject: [PATCH 1384/1883] Remove Duplicative MySQL Error: Error loading guild member '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 97241d693..08b0af1d2 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -949,7 +949,6 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) { safe_delete_array(esc); auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From 5930510274fe22560c950b7f89abadf9b4782659 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:17 -0600 Subject: [PATCH 1385/1883] Remove Duplicative MySQL Error: Error getting loot table info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 701579857..880b8f42a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1812,7 +1812,6 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) { "ON loottable.id = loottable_entries.loottable_id ORDER BY id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); return; } From 7c52755eac37b216d03bf55769357c73f86a0b3c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:18 -0600 Subject: [PATCH 1386/1883] Remove Duplicative MySQL Error: Error loading guild member '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 08b0af1d2..006996e27 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -979,7 +979,6 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) { #endif auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return false; } From d608b5afd6dede1a66e4921973e8eccff6f02711 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:18 -0600 Subject: [PATCH 1387/1883] Remove Duplicative MySQL Error: Error getting loot drop info from database: %s, %s --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 880b8f42a..eec7dc0f5 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1865,7 +1865,6 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) { "ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id"; auto results = QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str()); } uint32 current_id = 0; From e4200abc4f43fd5b205dc485eae9af81a1f271b3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:26:19 -0600 Subject: [PATCH 1388/1883] Remove Duplicative MySQL Error: Error executing query '%s': %s --- common/guild_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 006996e27..64020971a 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -1223,7 +1223,6 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID) auto results = m_db->QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::Detail, Logs::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str()); return 0; } From f20ff5c6e3f6c8ada4adbc60ea854c1f3eeff014 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:32:34 -0600 Subject: [PATCH 1389/1883] Cleanup of some QueryDatabase references that no longer need auto results --- common/database.cpp | 6 ------ common/guild_base.cpp | 4 ---- common/rulesys.cpp | 1 - queryserv/lfguild.cpp | 4 ---- ucs/database.cpp | 12 +++--------- 5 files changed, 3 insertions(+), 24 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index c0f578f2a..f3122d458 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -734,12 +734,6 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor()); auto results = QueryDatabase(invquery); - - if (!results.RowsAffected()) -#if EQDEBUG >= 9 - else - Log.Out(Logs::General, Logs::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str()); -#endif } if (i == MainCursor) { diff --git a/common/guild_base.cpp b/common/guild_base.cpp index 64020971a..1416dedf1 100644 --- a/common/guild_base.cpp +++ b/common/guild_base.cpp @@ -231,14 +231,10 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) { //clear out old `guilds` entry auto results = m_db->QueryDatabase(query); - if (!results.Success()) - //clear out old `guild_ranks` entries query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id); results = m_db->QueryDatabase(query); - if (!results.Success()) - //escape our strings. char *name_esc = new char[info->name.length()*2+1]; char *motd_esc = new char[info->motd.length()*2+1]; diff --git a/common/rulesys.cpp b/common/rulesys.cpp index 97d5a96ad..a53dbcabe 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -312,7 +312,6 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { " VALUES(%d, '%s', '%s')", m_activeRuleset, _GetRuleName(type, index), vstr); auto results = db->QueryDatabase(query); - if (!results.Success()) } diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 2f395c97a..340321f06 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -240,7 +240,6 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); auto results = database.QueryDatabase(query); - if(!results.Success()) uint32 Now = time(nullptr); @@ -254,7 +253,6 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char "VALUES (0, '%s', '%s', %u, 0, %u, %u, %u, %u)", From, Comments, Level, Class, AAPoints, TimeZone, Now); auto results = database.QueryDatabase(query); - if(!results.Success()) } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -284,7 +282,6 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); auto results = database.QueryDatabase(query); - if(!results.Success()) uint32 Now = time(nullptr); @@ -300,7 +297,6 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char GuildName, Comments, FromLevel, ToLevel, Classes, AACount, TimeZone, Now); auto results = database.QueryDatabase(query); - if(!results.Success()) } diff --git a/ucs/database.cpp b/ucs/database.cpp index 507e8ad30..fbbfdeac6 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -268,9 +268,7 @@ void Database::SetChannelPassword(std::string channelName, std::string password) std::string query = StringFormat("UPDATE `chatchannels` SET `password` = '%s' WHERE `name` = '%s'", password.c_str(), channelName.c_str()); - auto results = QueryDatabase(query); - if(!results.Success()) - + QueryDatabase(query); } void Database::SetChannelOwner(std::string channelName, std::string owner) { @@ -279,9 +277,7 @@ void Database::SetChannelOwner(std::string channelName, std::string owner) { std::string query = StringFormat("UPDATE `chatchannels` SET `owner` = '%s' WHERE `name` = '%s'", owner.c_str(), channelName.c_str()); - auto results = QueryDatabase(query); - if(!results.Success()) - + QueryDatabase(query); } void Database::SendHeaders(Client *client) { @@ -488,9 +484,7 @@ void Database::SetMessageStatus(int messageNumber, int status) { } std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } void Database::ExpireMail() { From 5ab131dcd675c1504caf51b2559f97310e08760c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:35:28 -0600 Subject: [PATCH 1390/1883] More cleanup of some QueryDatabase references that no longer need auto results --- ucs/database.cpp | 7 +------ world/adventure.cpp | 3 +-- zone/petitions.cpp | 2 -- zone/spawn2.cpp | 8 ++------ zone/tasks.cpp | 4 +--- zone/tradeskills.cpp | 3 +-- 6 files changed, 6 insertions(+), 21 deletions(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index fbbfdeac6..7cd5b7d09 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -508,8 +508,6 @@ void Database::ExpireMail() { results = QueryDatabase(query); if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i trash messages.", results.RowsAffected()); - else - } // Expire Read @@ -519,7 +517,6 @@ void Database::ExpireMail() { results = QueryDatabase(query); if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i read messages.", results.RowsAffected()); - else } // Expire Unread @@ -529,7 +526,6 @@ void Database::ExpireMail() { results = QueryDatabase(query); if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Expired %i unread messages.", results.RowsAffected()); - else } } @@ -539,8 +535,7 @@ void Database::AddFriendOrIgnore(int charID, int type, std::string name) { "VALUES('%i', %i, '%s')", charID, type, CapitaliseName(name).c_str()); auto results = QueryDatabase(query); - if(!results.Success()) - else + if(results.Success()) Log.Out(Logs::Detail, Logs::UCS_Server, "Wrote Friend/Ignore entry for charid %i, type %i, name %s to database.", charID, type, name.c_str()); } diff --git a/world/adventure.cpp b/world/adventure.cpp index e0a5aae18..40becd855 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -402,8 +402,7 @@ void Adventure::MoveCorpsesToGraveyard() "x = %f, y = %f, z = %f WHERE instanceid = %d", GetTemplate()->graveyard_zone_id, x, y, z, GetInstanceID()); - auto results = database.QueryDatabase(query); - if(!results.Success()) + database.QueryDatabase(query); } auto c_iter = charid_list.begin(); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 2d810564d..bcca6aabf 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -212,8 +212,6 @@ void ZoneDatabase::DeletePetitionFromDB(Petition* wpet) { std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", wpet->GetID()); auto results = QueryDatabase(query); - if (!results.Success()) - } void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 77adcddb2..6fc314a11 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -668,9 +668,7 @@ void SpawnConditionManager::UpdateDBEvent(SpawnEvent &event) { event.next.day, event.next.month, event.next.year, event.enabled? 1: 0, event.strict? 1: 0, event.id); - auto results = database.QueryDatabase(query); - if(!results.Success()) - + database.QueryDatabase(query); } void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 instance_id, uint16 cond_id, int16 value) { @@ -679,9 +677,7 @@ void SpawnConditionManager::UpdateDBCondition(const char* zone_name, uint32 inst "(id, value, zone, instance_id) " "VALUES( %u, %u, '%s', %u)", cond_id, value, zone_name, instance_id); - auto results = database.QueryDatabase(query); - if(!results.Success()) - + database.QueryDatabase(query); } bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std::string &zone_name) { diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 0673e51c8..fbc5ae3b5 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -723,9 +723,7 @@ void ClientTaskState::EnableTask(int characterID, int taskCount, int *tasks) { std::string query = queryStream.str(); Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str()); - auto results = database.QueryDatabase(query); - if(!results.Success()) - + database.QueryDatabase(query); } void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index ec3dd46d3..a973f9a97 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1457,8 +1457,7 @@ void ZoneDatabase::UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint3 "SET recipe_id = %u, char_id = %u, madecount = %u " "ON DUPLICATE KEY UPDATE madecount = %u;", recipe_id, char_id, madeCount, madeCount); - auto results = QueryDatabase(query); - if (!results.Success()) + QueryDatabase(query); } void Client::LearnRecipe(uint32 recipeID) From 99baba47620ceddd3f6f3b26c01cee87f34030c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:38:23 -0600 Subject: [PATCH 1391/1883] More cleanup of some QueryDatabase references that no longer need auto results --- zone/petitions.cpp | 2 -- zone/pets.cpp | 3 +-- zone/tasks.cpp | 3 +-- zone/tradeskills.cpp | 2 -- zone/trading.cpp | 4 +--- zone/waypoints.cpp | 6 ------ 6 files changed, 3 insertions(+), 17 deletions(-) diff --git a/zone/petitions.cpp b/zone/petitions.cpp index bcca6aabf..3e8a836e2 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -223,8 +223,6 @@ void ZoneDatabase::UpdatePetitionToDB(Petition* wpet) { wpet->GetCheckouts(), wpet->GetUnavails(), wpet->CheckedOut() ? 1: 0, wpet->GetID()); auto results = QueryDatabase(query); - if (!results.Success()) - } void ZoneDatabase::InsertPetitionToDB(Petition* wpet) diff --git a/zone/pets.cpp b/zone/pets.cpp index 8415dbe9d..22fa379ce 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -669,8 +669,7 @@ bool ZoneDatabase::GetBasePetItems(int32 equipmentset, uint32 *items) { query = StringFormat("SELECT slot, item_id FROM pets_equipmentset_entries WHERE set_id='%s'", curset); results = QueryDatabase(query); - if (!results.Success()) - else { + if (results.Success()){ for (row = results.begin(); row != results.end(); ++row) { slot = atoi(row[0]); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index fbc5ae3b5..203950104 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -769,8 +769,7 @@ void ClientTaskState::DisableTask(int charID, int taskCount, int *taskList) { queryStream << ")"; std::string query = queryStream.str(); Log.Out(Logs::General, Logs::Tasks, "[UPDATE] Executing query %s", query.c_str()); - auto results = database.QueryDatabase(query); - if(!results.Success()) + database.QueryDatabase(query); } bool ClientTaskState::IsTaskEnabled(int TaskID) { diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index a973f9a97..07ae6d2a5 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -1494,8 +1494,6 @@ void Client::LearnRecipe(uint32 recipeID) "ON DUPLICATE KEY UPDATE madecount = madecount;", recipeID, CharacterID()); results = database.QueryDatabase(query); - if (!results.Success()) - } bool Client::CanIncreaseTradeskill(SkillUseTypes tradeskill) { diff --git a/zone/trading.cpp b/zone/trading.cpp index d06cf2f9d..24215248e 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1476,9 +1476,7 @@ static void BazaarAuditTrail(const char *seller, const char *buyer, const char * "(`time`, `seller`, `buyer`, `itemname`, `quantity`, `totalcost`, `trantype`) " "VALUES (NOW(), '%s', '%s', '%s', %i, %i, %i)", seller, buyer, itemName, quantity, totalCost, tranType); - auto results = database.QueryDatabase(query); - if(!results.Success()) - + database.QueryDatabase(query); } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index e2c72c1bf..1214fa243 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1165,15 +1165,9 @@ void ZoneDatabase::ModifyGrid(Client *client, bool remove, uint32 id, uint8 type std::string query = StringFormat("DELETE FROM grid where id=%i", id); auto results = QueryDatabase(query); - if (!results.Success()) - else if(client) - client->LogSQL(query.c_str()); query = StringFormat("DELETE FROM grid_entries WHERE zoneid = %i AND gridid = %i", zoneid, id); results = QueryDatabase(query); - if(!results.Success()) - else if(client) - client->LogSQL(query.c_str()); } From 98a49ad0867f8f39ce9198c43611e072aadb2c1f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:39:51 -0600 Subject: [PATCH 1392/1883] More cleanup of some QueryDatabase references that no longer need auto results --- zone/titles.cpp | 4 +--- zone/waypoints.cpp | 14 +++----------- zone/zonedb.cpp | 4 +--- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/zone/titles.cpp b/zone/titles.cpp index 3c28e2417..3a4162060 100644 --- a/zone/titles.cpp +++ b/zone/titles.cpp @@ -376,8 +376,6 @@ void Client::RemoveTitle(int titleSet) { std::string query = StringFormat("DELETE FROM player_titlesets " "WHERE `title_set` = %i AND `char_id` = %i", titleSet, CharacterID()); - auto results = database.QueryDatabase(query); - if (!results.Success()) - + database.QueryDatabase(query); } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 1214fa243..20662c394 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -1250,16 +1250,11 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, query = StringFormat("INSERT INTO grid SET id = '%i', zoneid = %i, type ='%i', type2 = '%i'", grid_num, zoneid, type1, type2); - results = QueryDatabase(query); - if(!results.Success()) - else if(client) - client->LogSQL(query.c_str()); + QueryDatabase(query); query = StringFormat("UPDATE spawn2 SET pathgrid = '%i' WHERE id = '%i'", grid_num, spawn2id); - results = QueryDatabase(query); - if(!results.Success()) - else if(client) - client->LogSQL(query.c_str()); + QueryDatabase(query); + } else // NPC had a grid assigned to it createdNewGrid = false; @@ -1282,9 +1277,6 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *client, uint32 spawn2id, float xpos, "VALUES (%i, %i, %i, %f, %f, %f, %i, %f)", grid_num, zoneid, next_wp_num, xpos, ypos, zpos, pause, heading); results = QueryDatabase(query); - if(!results.Success()) - else if(client) - client->LogSQL(query.c_str()); return createdNewGrid? grid_num: 0; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 248f6a55b..613732275 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -248,9 +248,7 @@ uint32 ZoneDatabase::GetSpawnTimeLeft(uint32 id, uint16 instance_id) void ZoneDatabase::UpdateSpawn2Status(uint32 id, uint8 new_status) { std::string query = StringFormat("UPDATE spawn2 SET enabled = %i WHERE id = %lu", new_status, (unsigned long)id); - auto results = QueryDatabase(query); - if(!results.Success()) - + QueryDatabase(query); } bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 status,const char* charname, const char* target,const char* descriptiontype, const char* description,int event_nid){ From acb677a4ba4005715e86855496d6a03087c8b344 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:40:27 -0600 Subject: [PATCH 1393/1883] More cleanup of some QueryDatabase references that no longer need auto results --- zone/client.cpp | 2 -- zone/zonedb.cpp | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 3aaa23621..3190f7657 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5382,14 +5382,12 @@ bool Client::TryReward(uint32 claim_id) { "WHERE account_id = %i AND reward_id = %i", AccountID(), claim_id); auto results = database.QueryDatabase(query); - if(!results.Success()) } else { query = StringFormat("UPDATE account_rewards SET amount = (amount-1) " "WHERE account_id = %i AND reward_id = %i", AccountID(), claim_id); auto results = database.QueryDatabase(query); - if(!results.Success()) } InternalVeteranReward ivr = (*iter); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 613732275..e2e6689b0 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2852,9 +2852,7 @@ void ZoneDatabase::SaveBuffs(Client *client) { buffs[index].magic_rune, buffs[index].persistant_buff, buffs[index].dot_rune, buffs[index].caston_x, buffs[index].caston_y, buffs[index].caston_z, buffs[index].ExtraDIChance); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } } From 99dc83a9fd22affaab378dde2194585a75049ee4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:58:03 -0600 Subject: [PATCH 1394/1883] Convert MySQL Error logging to EQEmuLogSys and create MySQL Error category --- common/dbcore.cpp | 7 ++----- common/eqemu_logsys.h | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 7570fd01e..d1ae89d32 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -3,6 +3,7 @@ #endif #include "../common/misc_functions.h" +#include "../common/eqemu_logsys.h" #include "dbcore.h" @@ -115,11 +116,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo /* Implement Logging at the Root */ if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ - std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl; - /* Write to log file */ - std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out); - log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n"; - log.close(); + Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query); } return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 26a80392f..737c42f38 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,6 +74,7 @@ namespace Logs{ WebInterface_Server, World_Server, Zone_Server, + MySQLError, MaxCategoryID /* Don't Remove this*/ }; @@ -114,6 +115,7 @@ namespace Logs{ "WebInterface Server", "World Server", "Zone Server", + "MySQL Error", }; } From 954602310158df2e6f4316db65c45870a4ebff19 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 05:58:59 -0600 Subject: [PATCH 1395/1883] Add console color for MySQL Error logging --- common/eqemu_logsys.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 468529cda..99daae831 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -126,6 +126,7 @@ uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ return Console::Color::Yellow; case Logs::Normal: return Console::Color::Yellow; + case Logs::MySQLError: case Logs::Error: return Console::Color::LightRed; case Logs::Debug: From 52eb287082218e272ec4c79918fdac6a4da9235c Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 19 Jan 2015 11:00:05 -0500 Subject: [PATCH 1396/1883] Update to 6535690a69dd0693cf4d3a8fd075cf605822c143 to make explicit #include rather than implicit. --- zone/position.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zone/position.cpp b/zone/position.cpp index afa2b45cf..e6996797f 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -2,10 +2,7 @@ #include #include "position.h" #include "../common/string_util.h" - -#ifdef _MSC_VER - #include -#endif +#include xy_location::xy_location(float x, float y) : m_X(x), From b96be9d5b8265c8c4e5d58522cbc66e712c1694c Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Mon, 19 Jan 2015 13:07:37 -0500 Subject: [PATCH 1397/1883] Made familiars persistent. --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index dbf9508d4..5094328b0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -549,7 +549,7 @@ bool Client::Save(uint8 iCommitNow) { m_pp.lastlogin = time(nullptr); - if (GetPet() && !GetPet()->IsFamiliar() && GetPet()->CastToNPC()->GetPetSpellID() && !dead) { + if (GetPet() && GetPet()->CastToNPC()->GetPetSpellID() && !dead) { NPC *pet = GetPet()->CastToNPC(); m_petinfo.SpellID = pet->CastToNPC()->GetPetSpellID(); m_petinfo.HP = pet->GetHP(); From e70e443950b943652ff93bb92723b45e0325d65e Mon Sep 17 00:00:00 2001 From: Uleat Date: Mon, 19 Jan 2015 23:32:57 -0500 Subject: [PATCH 1398/1883] Implemented 'enum class ClientVersion' -- added 'RoF2' to lua client version enumeration --- changelog.txt | 3 + common/clientversions.h | 87 ++++----- common/eq_dictionary.cpp | 366 ++++++++--------------------------- common/eq_dictionary.h | 55 +++--- common/eq_stream_intf.h | 2 +- common/eq_stream_proxy.cpp | 4 +- common/eq_stream_proxy.h | 2 +- common/item.h | 8 +- common/patches/rof.cpp | 4 +- common/patches/rof.h | 2 +- common/patches/rof2.cpp | 4 +- common/patches/rof2.h | 2 +- common/patches/sod.cpp | 4 +- common/patches/sod.h | 2 +- common/patches/sof.cpp | 4 +- common/patches/sof.h | 2 +- common/patches/titanium.cpp | 4 +- common/patches/titanium.h | 2 +- common/patches/underfoot.cpp | 4 +- common/patches/underfoot.h | 2 +- common/struct_strategy.h | 2 +- loginserver/client.cpp | 2 +- loginserver/client.h | 10 +- world/client.cpp | 3 +- zone/bonuses.cpp | 6 +- zone/bot.cpp | 10 +- zone/client.cpp | 26 +-- zone/client.h | 4 +- zone/client_mods.cpp | 10 +- zone/client_packet.cpp | 50 +++-- zone/client_process.cpp | 6 +- zone/command.cpp | 2 +- zone/corpse.cpp | 6 +- zone/entity.cpp | 2 +- zone/groups.cpp | 16 +- zone/guild.cpp | 8 +- zone/guild_mgr.cpp | 2 +- zone/inventory.cpp | 10 +- zone/lua_client.cpp | 2 +- zone/lua_general.cpp | 15 +- zone/merc.cpp | 42 ++-- zone/object.cpp | 2 +- zone/perl_client.cpp | 2 +- zone/raids.cpp | 4 +- zone/spell_effects.cpp | 2 +- zone/spells.cpp | 10 +- zone/tasks.cpp | 4 +- zone/trading.cpp | 4 +- zone/worldserver.cpp | 2 +- zone/zonedb.cpp | 2 +- zone/zoning.cpp | 2 +- 51 files changed, 311 insertions(+), 520 deletions(-) diff --git a/changelog.txt b/changelog.txt index 79b156c0b..6cdfa59ee 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/19/2015 == +Uleat: Changed 'enum EQClientVersion' to 'enum class ClientVersion.' Other light modifications were made to accomodate this namespace. Added 'RoF2' to the lua client version enumeration. + == 01/15/2015 == Uleat: Attempted fix for elusive inventory bug: - Removed 'iter_queue' typedef and converted lcast to explicit or auto defines diff --git a/common/clientversions.h b/common/clientversions.h index ee70d481c..7ec13644e 100644 --- a/common/clientversions.h +++ b/common/clientversions.h @@ -17,59 +17,58 @@ static const uint32 BIT_RoFAndLater = 0xFFFFFFE0; static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0; static const uint32 BIT_AllClients = 0xFFFFFFFF; -typedef enum +enum class ClientVersion { - EQClientUnknown = 0, - EQClient62, // Build: 'Aug 4 2005 15:40:59' - EQClientTitanium, // Build: 'Oct 31 2005 10:33:37' - EQClientSoF, // Build: 'Sep 7 2007 09:11:49' - EQClientSoD, // Build: 'Dec 19 2008 15:22:49' - EQClientUnderfoot, // Build: 'Jun 8 2010 16:44:32' - EQClientRoF, // Build: 'Dec 10 2012 17:35:44' - EQClientRoF2, // Build: 'May 10 2013 23:30:08' + Unknown = 0, + Client62, // Build: 'Aug 4 2005 15:40:59' + Tit, // Build: 'Oct 31 2005 10:33:37' + SoF, // Build: 'Sep 7 2007 09:11:49' + SoD, // Build: 'Dec 19 2008 15:22:49' + Und, // Build: 'Jun 8 2010 16:44:32' + RoF, // Build: 'Dec 10 2012 17:35:44' + RoF2, // Build: 'May 10 2013 23:30:08' - _EQClientCount, // place new clients before this point (preferably, in release/attribute order) + MobNPC, + MobMerc, + MobBot, + MobPet, +}; - // Values below are not implemented, as yet... +#define CLIENT_VERSION_COUNT 12 +#define LAST_PC_CLIENT ClientVersion::RoF2 +#define LAST_NPC_CLIENT ClientVersion::MobPet - EmuNPC = _EQClientCount, - EmuMerc, - EmuBot, - EmuPet, - _EmuClientCount // array size for EQLimits -} EQClientVersion; - -static const char* EQClientVersionName(EQClientVersion version) +static const char* ClientVersionName(ClientVersion version) { switch (version) { - case EQClientUnknown: - return "EQClientUnknown"; - case EQClient62: - return "EQClient62"; - case EQClientTitanium: - return "EQClientTitanium"; - case EQClientSoF: - return "EQClientSoF"; - case EQClientSoD: - return "EQClientSoD"; - case EQClientUnderfoot: - return "EQClientUnderfoot"; - case EQClientRoF: - return "EQClientRoF"; - case EQClientRoF2: - return "EQClientRoF2"; - case EmuNPC: - return "EmuNPC"; - case EmuMerc: - return "EmuMerc"; - case EmuBot: - return "EmuBot"; - case EmuPet: - return "EmuPet"; + case ClientVersion::Unknown: + return "ClientVersion::Unknown"; + case ClientVersion::Client62: + return "ClientVersion::Client62"; + case ClientVersion::Tit: + return "ClientVersion::Tit"; + case ClientVersion::SoF: + return "ClientVersion::SoF"; + case ClientVersion::SoD: + return "ClientVersion::SoD"; + case ClientVersion::Und: + return "ClientVersion::Und"; + case ClientVersion::RoF: + return "ClientVersion::RoF"; + case ClientVersion::RoF2: + return "ClientVersion::RoF2"; + case ClientVersion::MobNPC: + return "ClientVersion::MobNPC"; + case ClientVersion::MobMerc: + return "ClientVersion::MobMerc"; + case ClientVersion::MobBot: + return "ClientVersion::MobBot"; + case ClientVersion::MobPet: + return "ClientVersion::MobPet"; default: - return "ERROR: Invalid EQClientVersion"; + return " Invalid ClientVersion"; }; } diff --git a/common/eq_dictionary.cpp b/common/eq_dictionary.cpp index 46c8f4ff1..986f17848 100644 --- a/common/eq_dictionary.cpp +++ b/common/eq_dictionary.cpp @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // class EmuConstants // -uint16 EmuConstants::InventoryMapSize(int16 map) { - switch (map) { +uint16 EmuConstants::InventoryMapSize(int16 indexMap) { + switch (indexMap) { case MapPossessions: return MAP_POSSESSIONS_SIZE; case MapBank: @@ -91,8 +91,8 @@ std::string EmuConstants::InventoryLocationName(Location_Struct location) { } */ -std::string EmuConstants::InventoryMapName(int16 map) { - switch (map) { +std::string EmuConstants::InventoryMapName(int16 indexMap) { + switch (indexMap) { case INVALID_INDEX: return "Invalid Map"; case MapPossessions: @@ -150,8 +150,8 @@ std::string EmuConstants::InventoryMapName(int16 map) { } } -std::string EmuConstants::InventoryMainName(int16 main) { - switch (main) { +std::string EmuConstants::InventoryMainName(int16 indexMain) { + switch (indexMain) { case INVALID_INDEX: return "Invalid Main"; case MainCharm: @@ -229,293 +229,83 @@ std::string EmuConstants::InventoryMainName(int16 main) { } } -std::string EmuConstants::InventorySubName(int16 sub) { - if (sub == INVALID_INDEX) +std::string EmuConstants::InventorySubName(int16 indexSub) { + if (indexSub == INVALID_INDEX) return "Invalid Sub"; - if ((uint16)sub >= ITEM_CONTAINER_SIZE) + if ((uint16)indexSub >= ITEM_CONTAINER_SIZE) return "Unknown Sub"; std::string ret_str; - ret_str = StringFormat("Container %i", (sub + 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 aug) { - if (aug == INVALID_INDEX) +std::string EmuConstants::InventoryAugName(int16 indexAug) { + if (indexAug == INVALID_INDEX) return "Invalid Aug"; - if ((uint16)aug >= ITEM_COMMON_SIZE) + if ((uint16)indexAug >= ITEM_COMMON_SIZE) return "Unknown Aug"; std::string ret_str; - ret_str = StringFormat("Augment %i", (aug + 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; } -// legacy-related functions -// -// these should work for the first-stage coversions..but, once the new system is up and going..conversions will be incompatible -// without limiting server functions and other aspects, such as augment control, bag size, etc. A complete remapping will be -// required when bag sizes over 10 and direct manipulation of augments are implemented, due to the massive increase in range usage. -// -// (current personal/cursor bag range {251..340}, or 90 slots ... conversion translated range would be {10000..12804}, or 2805 slots... -// these would have to be hard-coded into all perl code to allow access to full range of the new system - actual limits would be -// less, based on bag size..but, the range must be full and consistent to avoid translation issues -- similar changes to other ranges -// (240 versus 6120 slots for bank bags, for example...)) -/* -int EmuConstants::ServerToPerlSlot(int server_slot) { // set r/s - switch (server_slot) { - case legacy::SLOT_CURSOR_END: - return legacy::SLOT_CURSOR_END; - case INVALID_INDEX: - return legacy::SLOT_INVALID; - case MainPowerSource: - return legacy::SLOT_POWER_SOURCE; - case MainAmmo: - return legacy::SLOT_AMMO; - case MainCursor: - return legacy::SLOT_CURSOR; - case legacy::SLOT_TRADESKILL: - return legacy::SLOT_TRADESKILL; - case legacy::SLOT_AUGMENT: - return legacy::SLOT_AUGMENT; - default: - int perl_slot = legacy::SLOT_INVALID; - - // activate the internal checks as needed - if (server_slot >= EmuConstants::EQUIPMENT_BEGIN && server_slot <= MainWaist) { - perl_slot = server_slot; - } - else if (server_slot >= EmuConstants::GENERAL_BEGIN && server_slot <= EmuConstants::GENERAL_END) { - perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BEGIN - EmuConstants::GENERAL_BEGIN; - //if (perl_slot < legacy::SLOT_PERSONAL_BEGIN || perl_slot > legacy::SLOT_PERSONAL_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::GENERAL_BAGS_BEGIN && server_slot <= EmuConstants::GENERAL_BAGS_END) { - perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BAGS_BEGIN - EmuConstants::GENERAL_BAGS_BEGIN; - //if (perl_slot < legacy::SLOT_PERSONAL_BAGS_BEGIN || perl_slot > legacy::SLOT_PERSONAL_BAGS_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) { - perl_slot = server_slot;// + legacy::SLOT_CURSOR_BAG_BEGIN - EmuConstants::CURSOR_BAG_BEGIN; - //if (perl_slot < legacy::SLOT_CURSOR_BAG_BEGIN || perl_slot > legacy::SLOT_CURSOR_BAG_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::TRIBUTE_BEGIN && server_slot <= EmuConstants::TRIBUTE_END) { - perl_slot = server_slot;// + legacy::SLOT_TRIBUTE_BEGIN - EmuConstants::TRADE_BEGIN; - //if (perl_slot < legacy::SLOT_TRIBUTE_BEGIN || perl_slot > legacy::SLOT_TRIBUTE_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::BANK_BEGIN && server_slot <= EmuConstants::BANK_END) { - perl_slot = server_slot;// + legacy::SLOT_BANK_BEGIN - EmuConstants::BANK_BEGIN; - //if (perl_slot < legacy::SLOT_BANK_BEGIN || perl_slot > legacy::SLOT_BANK_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::BANK_BAGS_BEGIN && server_slot <= EmuConstants::BANK_BAGS_END) { - perl_slot = server_slot;// + legacy::SLOT_BANK_BAGS_BEGIN - EmuConstants::BANK_BAGS_BEGIN; - //if (perl_slot < legacy::SLOT_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_BANK_BAGS_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::SHARED_BANK_BEGIN && server_slot <= EmuConstants::SHARED_BANK_END) { - perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BEGIN - EmuConstants::SHARED_BANK_BEGIN; - //if (perl_slot < legacy::SLOT_SHARED_BANK_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && server_slot <= EmuConstants::SHARED_BANK_BAGS_END) { - perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BAGS_BEGIN - EmuConstants::SHARED_BANK_BAGS_BEGIN; - //if (perl_slot < legacy::SLOT_SHARED_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_BAGS_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::TRADE_BEGIN && server_slot <= EmuConstants::TRADE_END) { - perl_slot = server_slot;// + legacy::SLOT_TRADE_BEGIN - EmuConstants::TRADE_BEGIN; - //if (perl_slot < legacy::SLOT_TRADE_BEGIN || perl_slot > legacy::SLOT_TRADE_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::TRADE_BAGS_BEGIN && server_slot <= EmuConstants::TRADE_BAGS_END) { - perl_slot = server_slot;// + legacy::SLOT_TRADE_BAGS_BEGIN - EmuConstants::TRADE_BAGS_BEGIN; - //if (perl_slot < legacy::SLOT_TRADE_BAGS_BEGIN || perl_slot > legacy::SLOT_TRADE_BAGS_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= EmuConstants::WORLD_BEGIN && server_slot <= EmuConstants::WORLD_END) { - perl_slot = server_slot;// + legacy::SLOT_WORLD_BEGIN - EmuConstants::WORLD_BEGIN; - //if (perl_slot < legacy::SLOT_WORLD_BEGIN || perl_slot > legacy::SLOT_WORLD_END) - // perl_slot = legacy::SLOT_INVALID; - } - else if (server_slot >= 8000 && server_slot <= 8999) { // this range may be limited to 36 in the future (client size) - perl_slot = server_slot; - } - - return perl_slot; - } -} -*/ -/* -int EmuConstants::PerlToServerSlot(int perl_slot) { // set r/s - switch (perl_slot) { - case legacy::SLOT_CURSOR_END: - return legacy::SLOT_CURSOR_END; - case legacy::SLOT_INVALID: - return INVALID_INDEX; - case legacy::SLOT_POWER_SOURCE: - return MainPowerSource; - case legacy::SLOT_AMMO: - return MainAmmo; - case legacy::SLOT_CURSOR: - return MainCursor; - case legacy::SLOT_TRADESKILL: - return legacy::SLOT_TRADESKILL; - case legacy::SLOT_AUGMENT: - return legacy::SLOT_AUGMENT; - default: - int server_slot = INVALID_INDEX; - - // activate the internal checks as needed - if (perl_slot >= legacy::SLOT_EQUIPMENT_BEGIN && perl_slot <= legacy::SLOT_WAIST) { - server_slot = perl_slot; - } - else if (perl_slot >= legacy::SLOT_PERSONAL_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_END) { - server_slot = perl_slot;// + EmuConstants::GENERAL_BEGIN - legacy::SLOT_PERSONAL_BEGIN; - //if (server_slot < EmuConstants::GENERAL_BEGIN || server_slot > EmuConstants::GENERAL_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_PERSONAL_BAGS_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_BAGS_END) { - server_slot = perl_slot;// + EmuConstants::GENERAL_BAGS_BEGIN - legacy::SLOT_PERSONAL_BAGS_BEGIN; - //if (server_slot < EmuConstants::GENERAL_BAGS_BEGIN || server_slot > EmuConstants::GENERAL_BAGS_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_CURSOR_BAG_BEGIN && perl_slot <= legacy::SLOT_CURSOR_BAG_END) { - server_slot = perl_slot;// + EmuConstants::CURSOR_BAG_BEGIN - legacy::SLOT_CURSOR_BAG_BEGIN; - //if (server_slot < EmuConstants::CURSOR_BAG_BEGIN || server_slot > EmuConstants::CURSOR_BAG_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_TRIBUTE_BEGIN && perl_slot <= legacy::SLOT_TRIBUTE_END) { - server_slot = perl_slot;// + EmuConstants::TRIBUTE_BEGIN - legacy::SLOT_TRIBUTE_BEGIN; - //if (server_slot < EmuConstants::TRIBUTE_BEGIN || server_slot > EmuConstants::TRIBUTE_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_BANK_BEGIN && perl_slot <= legacy::SLOT_BANK_END) { - server_slot = perl_slot;// + EmuConstants::BANK_BEGIN - legacy::SLOT_BANK_BEGIN; - //if (server_slot < EmuConstants::BANK_BEGIN || server_slot > EmuConstants::BANK_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_BANK_BAGS_END) { - server_slot = perl_slot;// + EmuConstants::BANK_BAGS_BEGIN - legacy::SLOT_BANK_BAGS_BEGIN; - //if (server_slot < EmuConstants::BANK_BAGS_BEGIN || server_slot > EmuConstants::BANK_BAGS_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_SHARED_BANK_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_END) { - server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BEGIN - legacy::SLOT_SHARED_BANK_BEGIN; - //if (server_slot < EmuConstants::SHARED_BANK_BEGIN || server_slot > EmuConstants::SHARED_BANK_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_SHARED_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_BAGS_END) { - server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BAGS_BEGIN - legacy::SLOT_SHARED_BANK_BAGS_END; - //if (server_slot < EmuConstants::SHARED_BANK_BAGS_BEGIN || server_slot > EmuConstants::SHARED_BANK_BAGS_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_TRADE_BEGIN && perl_slot <= legacy::SLOT_TRADE_END) { - server_slot = perl_slot;// + EmuConstants::TRADE_BEGIN - legacy::SLOT_TRADE_BEGIN; - //if (server_slot < EmuConstants::TRADE_BEGIN || server_slot > EmuConstants::TRADE_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_TRADE_BAGS_BEGIN && perl_slot <= legacy::SLOT_TRADE_BAGS_END) { - server_slot = perl_slot;// + EmuConstants::TRADE_BAGS_BEGIN - legacy::SLOT_TRADE_BAGS_BEGIN; - //if (server_slot < EmuConstants::TRADE_BAGS_BEGIN || server_slot > EmuConstants::TRADE_BAGS_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= legacy::SLOT_WORLD_BEGIN && perl_slot <= legacy::SLOT_WORLD_END) { - server_slot = perl_slot;// + EmuConstants::WORLD_BEGIN - legacy::SLOT_WORLD_BEGIN; - //if (server_slot < EmuConstants::WORLD_BEGIN || server_slot > EmuConstants::WORLD_END) - // server_slot = INVALID_INDEX; - } - else if (perl_slot >= 8000 && perl_slot <= 8999) { // this range may be limited to 36 in the future (client size) - server_slot = perl_slot; - } - - return server_slot; - } -} -*/ // // class EQLimits // // client validation -bool EQLimits::IsValidClientVersion(uint32 version) { - if (version < _EQClientCount) +bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion) { + if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT) return true; return false; } -uint32 EQLimits::ValidateClientVersion(uint32 version) { - if (version < _EQClientCount) - return version; +ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) { + if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT) + return clientVersion; - return EQClientUnknown; -} - -EQClientVersion EQLimits::ValidateClientVersion(EQClientVersion version) { - if (version >= EQClientUnknown) - if (version < _EQClientCount) - return version; - - return EQClientUnknown; + return ClientVersion::Unknown; } // npc validation -bool EQLimits::IsValidNPCVersion(uint32 version) { - if (version >= _EQClientCount) - if (version < _EmuClientCount) - return true; - - return false; -} - -uint32 EQLimits::ValidateNPCVersion(uint32 version) { - if (version >= _EQClientCount) - if (version < _EmuClientCount) - return version; - - return EQClientUnknown; -} - -EQClientVersion EQLimits::ValidateNPCVersion(EQClientVersion version) { - if (version >= _EQClientCount) - if (version < _EmuClientCount) - return version; - - return EQClientUnknown; -} - -// mob validation -bool EQLimits::IsValidMobVersion(uint32 version) { - if (version < _EmuClientCount) +bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion) { + if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT) return true; return false; } -uint32 EQLimits::ValidateMobVersion(uint32 version) { - if (version < _EmuClientCount) - return version; +ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) { + if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT) + return clientVersion; - return EQClientUnknown; + return ClientVersion::Unknown; } -EQClientVersion EQLimits::ValidateMobVersion(EQClientVersion version) { - if (version >= EQClientUnknown) - if (version < _EmuClientCount) - return version; +// mob validation +bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion) { + if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT) + return true; - return EQClientUnknown; + return false; +} + +ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) { + if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT) + return clientVersion; + + return ClientVersion::Unknown; } // inventory -uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { +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 @@ -527,7 +317,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { // // when setting NPC-based values, try to adhere to an EmuConstants:: or NOT_USED value to avoid unnecessary issues - static const uint16 local[_MapCount][_EmuClientCount] = { + static const uint16 local[_MapCount][CLIENT_VERSION_COUNT] = { // server and database are sync'd to current MapPossessions's client as set in 'using namespace RoF::slots;' and // 'EmuConstants::MAP_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask() // for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations @@ -908,19 +698,19 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) { } }; - if ((uint16)map < _MapCount) - return local[map][ValidateMobVersion(version)]; + if ((uint16)indexMap < _MapCount) + return local[indexMap][static_cast(ValidateMobClientVersion(clientVersion))]; return NOT_USED; } -uint64 EQLimits::PossessionsBitmask(uint32 version) { +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+) // 0x0000000100000000 is SlotGeneral10 (RoF+) - static const uint64 local[_EmuClientCount] = { + static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x000000027FDFFFFF, /*Titanium*/ 0x000000027FDFFFFF, @@ -937,11 +727,11 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) { }; return NOT_USED; - //return local[ValidateMobVersion(version)]; + //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::EquipmentBitmask(uint32 version) { - static const uint64 local[_EmuClientCount] = { +uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) { + static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x00000000005FFFFF, /*Titanium*/ 0x00000000005FFFFF, @@ -958,11 +748,11 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) { }; return NOT_USED; - //return local[ValidateMobVersion(version)]; + //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::GeneralBitmask(uint32 version) { - static const uint64 local[_EmuClientCount] = { +uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) { + static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x000000007F800000, /*Titanium*/ 0x000000007F800000, @@ -979,11 +769,11 @@ uint64 EQLimits::GeneralBitmask(uint32 version) { }; return NOT_USED; - //return local[ValidateMobVersion(version)]; + //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint64 EQLimits::CursorBitmask(uint32 version) { - static const uint64 local[_EmuClientCount] = { +uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) { + static const uint64 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ 0x0000000200000000, /*Titanium*/ 0x0000000200000000, @@ -1000,11 +790,11 @@ uint64 EQLimits::CursorBitmask(uint32 version) { }; return NOT_USED; - //return local[ValidateMobVersion(version)]; + //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::AllowsEmptyBagInBag(uint32 version) { - static const bool local[_EmuClientCount] = { +bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) { + static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ false, /*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG, @@ -1021,11 +811,11 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) { }; return false; // not implemented - //return local[ValidateMobVersion(version)]; + //return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::AllowsClickCastFromBag(uint32 version) { - static const bool local[_EmuClientCount] = { +bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) { + static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ false, /*62*/ false, /*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG, @@ -1041,12 +831,12 @@ bool EQLimits::AllowsClickCastFromBag(uint32 version) { /*Pet*/ false }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } // items -uint16 EQLimits::ItemCommonSize(uint32 version) { - static const uint16 local[_EmuClientCount] = { +uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) { + static const uint16 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::ITEM_COMMON_SIZE, /*Titanium*/ EmuConstants::ITEM_COMMON_SIZE, @@ -1062,11 +852,11 @@ uint16 EQLimits::ItemCommonSize(uint32 version) { /*Pet*/ EmuConstants::ITEM_COMMON_SIZE }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint16 EQLimits::ItemContainerSize(uint32 version) { - static const uint16 local[_EmuClientCount] = { +uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) { + static const uint16 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::ITEM_CONTAINER_SIZE, /*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE, @@ -1082,11 +872,11 @@ uint16 EQLimits::ItemContainerSize(uint32 version) { /*Pet*/ EmuConstants::ITEM_CONTAINER_SIZE }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -bool EQLimits::CoinHasWeight(uint32 version) { - static const bool local[_EmuClientCount] = { +bool EQLimits::CoinHasWeight(ClientVersion clientVersion) { + static const bool local[CLIENT_VERSION_COUNT] = { /*Unknown*/ true, /*62*/ true, /*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT, @@ -1102,11 +892,11 @@ bool EQLimits::CoinHasWeight(uint32 version) { /*Pet*/ true }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::BandoliersCount(uint32 version) { - static const uint32 local[_EmuClientCount] = { +uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) { + static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::BANDOLIERS_COUNT, /*Titanium*/ EmuConstants::BANDOLIERS_COUNT, @@ -1122,11 +912,11 @@ uint32 EQLimits::BandoliersCount(uint32 version) { /*Pet*/ NOT_USED }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::BandolierSize(uint32 version) { - static const uint32 local[_EmuClientCount] = { +uint32 EQLimits::BandolierSize(ClientVersion clientVersion) { + static const uint32 local[CLIENT_VERSION_COUNT] = { /*Unknown*/ NOT_USED, /*62*/ EmuConstants::BANDOLIER_SIZE, /*Titanium*/ EmuConstants::BANDOLIER_SIZE, @@ -1142,11 +932,11 @@ uint32 EQLimits::BandolierSize(uint32 version) { /*Pet*/ NOT_USED }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } -uint32 EQLimits::PotionBeltSize(uint32 version) { - static const uint32 local[_EmuClientCount] = { +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, @@ -1162,5 +952,5 @@ uint32 EQLimits::PotionBeltSize(uint32 version) { /*Pet*/ NOT_USED }; - return local[ValidateMobVersion(version)]; + return local[static_cast(ValidateMobClientVersion(clientVersion))]; } diff --git a/common/eq_dictionary.h b/common/eq_dictionary.h index 3438f133b..a61eb7bfd 100644 --- a/common/eq_dictionary.h +++ b/common/eq_dictionary.h @@ -46,15 +46,15 @@ class EmuConstants { // an immutable value is required to initialize arrays, etc... use this class as a repository for those public: // database - static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client + static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client // inventory - static uint16 InventoryMapSize(int16 map); + static uint16 InventoryMapSize(int16 indexMap); //static std::string InventoryLocationName(Location_Struct location); - static std::string InventoryMapName(int16 map); - static std::string InventoryMainName(int16 main); - static std::string InventorySubName(int16 sub); - static std::string InventoryAugName(int16 aug); + static std::string InventoryMapName(int16 indexMap); + static std::string InventoryMainName(int16 indexMain); + static std::string InventorySubName(int16 indexSub); + static std::string InventoryAugName(int16 indexAug); // these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready static const uint16 MAP_POSSESSIONS_SIZE = _MainCount; @@ -163,44 +163,41 @@ class EQLimits { public: // client version validation (checks to avoid crashing zone server when accessing reference arrays) // use this inside of class Client (limits to actual clients) - static bool IsValidClientVersion(uint32 version); - static uint32 ValidateClientVersion(uint32 version); - static EQClientVersion ValidateClientVersion(EQClientVersion version); + static bool IsValidPCClientVersion(ClientVersion clientVersion); + static ClientVersion ValidatePCClientVersion(ClientVersion clientVersion); // basically..any non-client classes - do not when setting a valid client - static bool IsValidNPCVersion(uint32 version); - static uint32 ValidateNPCVersion(uint32 version); - static EQClientVersion ValidateNPCVersion(EQClientVersion version); + static bool IsValidNPCClientVersion(ClientVersion clientVersion); + static ClientVersion ValidateNPCClientVersion(ClientVersion clientVersion); // these are 'universal' - do not when setting a valid client - static bool IsValidMobVersion(uint32 version); - static uint32 ValidateMobVersion(uint32 version); - static EQClientVersion ValidateMobVersion(EQClientVersion version); + static bool IsValidMobClientVersion(ClientVersion clientVersion); + static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion); // inventory - static uint16 InventoryMapSize(int16 map, uint32 version); - static uint64 PossessionsBitmask(uint32 version); - static uint64 EquipmentBitmask(uint32 version); - static uint64 GeneralBitmask(uint32 version); - static uint64 CursorBitmask(uint32 version); + static uint16 InventoryMapSize(int16 indexMap, ClientVersion clientVersion); + static uint64 PossessionsBitmask(ClientVersion clientVersion); + static uint64 EquipmentBitmask(ClientVersion clientVersion); + static uint64 GeneralBitmask(ClientVersion clientVersion); + static uint64 CursorBitmask(ClientVersion clientVersion); - static bool AllowsEmptyBagInBag(uint32 version); - static bool AllowsClickCastFromBag(uint32 version); + static bool AllowsEmptyBagInBag(ClientVersion clientVersion); + static bool AllowsClickCastFromBag(ClientVersion clientVersion); // items - static uint16 ItemCommonSize(uint32 version); - static uint16 ItemContainerSize(uint32 version); + static uint16 ItemCommonSize(ClientVersion clientVersion); + static uint16 ItemContainerSize(ClientVersion clientVersion); // player profile - static bool CoinHasWeight(uint32 version); + static bool CoinHasWeight(ClientVersion clientVersion); - static uint32 BandoliersCount(uint32 version); - static uint32 BandolierSize(uint32 version); + static uint32 BandoliersCount(ClientVersion clientVersion); + static uint32 BandolierSize(ClientVersion clientVersion); - static uint32 PotionBeltSize(uint32 version); + static uint32 PotionBeltSize(ClientVersion clientVersion); }; -#endif /* EQ_LIMITS_H */ +#endif /* EQ_DICTIONARY_H */ /* Working Notes: diff --git a/common/eq_stream_intf.h b/common/eq_stream_intf.h index 9373f2262..68b8ffc96 100644 --- a/common/eq_stream_intf.h +++ b/common/eq_stream_intf.h @@ -35,7 +35,7 @@ public: virtual const uint32 GetBytesRecieved() const { return 0; } virtual const uint32 GetBytesSentPerSecond() const { return 0; } virtual const uint32 GetBytesRecvPerSecond() const { return 0; } - virtual const EQClientVersion ClientVersion() const { return EQClientUnknown; } + virtual const ClientVersion GetClientVersion() const { return ClientVersion::Unknown; } }; #endif /*EQSTREAMINTF_H_*/ diff --git a/common/eq_stream_proxy.cpp b/common/eq_stream_proxy.cpp index 20fc4ea06..802afe7f2 100644 --- a/common/eq_stream_proxy.cpp +++ b/common/eq_stream_proxy.cpp @@ -22,9 +22,9 @@ std::string EQStreamProxy::Describe() const { return(m_structs->Describe()); } -const EQClientVersion EQStreamProxy::ClientVersion() const +const ClientVersion EQStreamProxy::GetClientVersion() const { - return m_structs->ClientVersion(); + return m_structs->GetClientVersion(); } void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) { diff --git a/common/eq_stream_proxy.h b/common/eq_stream_proxy.h index 34ea3a9fc..f82dd790f 100644 --- a/common/eq_stream_proxy.h +++ b/common/eq_stream_proxy.h @@ -27,7 +27,7 @@ public: virtual void RemoveData(); virtual bool CheckState(EQStreamState state); virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; virtual const uint32 GetBytesSent() const; virtual const uint32 GetBytesRecieved() const; diff --git a/common/item.h b/common/item.h index 888d47d2b..975650e46 100644 --- a/common/item.h +++ b/common/item.h @@ -117,11 +117,11 @@ public: // Public Methods /////////////////////////////// - Inventory() { m_version = EQClientUnknown; m_versionset = false; } + Inventory() { m_version = ClientVersion::Unknown; m_versionset = false; } ~Inventory(); // Inventory v2 creep - bool SetInventoryVersion(EQClientVersion version) { + bool SetInventoryVersion(ClientVersion version) { if (!m_versionset) { m_version = version; return (m_versionset = true); @@ -131,7 +131,7 @@ public: } } - EQClientVersion GetInventoryVersion() { return m_version; } + ClientVersion GetInventoryVersion() { return m_version; } static void CleanDirty(); static void MarkDirty(ItemInst *inst); @@ -252,7 +252,7 @@ protected: private: // Active inventory version - EQClientVersion m_version; + ClientVersion m_version; bool m_versionset; }; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 3ec0565bb..e6dfad3c3 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -114,9 +114,9 @@ namespace RoF return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientRoF; + return ClientVersion::RoF; } #include "ss_define.h" diff --git a/common/patches/rof.h b/common/patches/rof.h index 220341970..328e5f7f1 100644 --- a/common/patches/rof.h +++ b/common/patches/rof.h @@ -23,7 +23,7 @@ namespace RoF { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index c586fe260..59761c2b9 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -114,9 +114,9 @@ namespace RoF2 return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientRoF2; + return ClientVersion::RoF2; } #include "ss_define.h" diff --git a/common/patches/rof2.h b/common/patches/rof2.h index b39849048..888fb3308 100644 --- a/common/patches/rof2.h +++ b/common/patches/rof2.h @@ -23,7 +23,7 @@ namespace RoF2 { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index 09e219672..050701d3a 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -112,9 +112,9 @@ namespace SoD return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientSoD; + return ClientVersion::SoD; } #include "ss_define.h" diff --git a/common/patches/sod.h b/common/patches/sod.h index 0377573c2..9935cbf2f 100644 --- a/common/patches/sod.h +++ b/common/patches/sod.h @@ -23,7 +23,7 @@ namespace SoD { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 07885944a..1aa0a05bb 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -112,9 +112,9 @@ namespace SoF return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientSoF; + return ClientVersion::SoF; } #include "ss_define.h" diff --git a/common/patches/sof.h b/common/patches/sof.h index fc68ba334..15b9aa90c 100644 --- a/common/patches/sof.h +++ b/common/patches/sof.h @@ -23,7 +23,7 @@ namespace SoF { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 9aa8afad8..31579e91b 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -110,9 +110,9 @@ namespace Titanium return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientTitanium; + return ClientVersion::Tit; } #include "ss_define.h" diff --git a/common/patches/titanium.h b/common/patches/titanium.h index 421ef319a..de8131545 100644 --- a/common/patches/titanium.h +++ b/common/patches/titanium.h @@ -23,7 +23,7 @@ namespace Titanium { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/patches/underfoot.cpp b/common/patches/underfoot.cpp index ba04ea9a7..33ea71653 100644 --- a/common/patches/underfoot.cpp +++ b/common/patches/underfoot.cpp @@ -112,9 +112,9 @@ namespace Underfoot return(r); } - const EQClientVersion Strategy::ClientVersion() const + const ClientVersion Strategy::GetClientVersion() const { - return EQClientUnderfoot; + return ClientVersion::Und; } #include "ss_define.h" diff --git a/common/patches/underfoot.h b/common/patches/underfoot.h index b14d4a420..4bf00b0e8 100644 --- a/common/patches/underfoot.h +++ b/common/patches/underfoot.h @@ -23,7 +23,7 @@ namespace Underfoot { protected: virtual std::string Describe() const; - virtual const EQClientVersion ClientVersion() const; + virtual const ClientVersion GetClientVersion() const; //magic macro to declare our opcode processors #include "ss_declare.h" diff --git a/common/struct_strategy.h b/common/struct_strategy.h index 224c1e31d..a6219a214 100644 --- a/common/struct_strategy.h +++ b/common/struct_strategy.h @@ -24,7 +24,7 @@ public: void Decode(EQApplicationPacket *p) const; virtual std::string Describe() const = 0; - virtual const EQClientVersion ClientVersion() const = 0; + virtual const ClientVersion GetClientVersion() const = 0; protected: //some common coders: diff --git a/loginserver/client.cpp b/loginserver/client.cpp index bc0a86fa8..bd1f282a5 100644 --- a/loginserver/client.cpp +++ b/loginserver/client.cpp @@ -24,7 +24,7 @@ extern ErrorLog *server_log; extern LoginServer server; -Client::Client(EQStream *c, ClientVersion v) +Client::Client(EQStream *c, LSClientVersion v) { connection = c; version = v; diff --git a/loginserver/client.h b/loginserver/client.h index c1b44dc6f..784b0ba4f 100644 --- a/loginserver/client.h +++ b/loginserver/client.h @@ -30,13 +30,13 @@ using namespace std; -enum ClientVersion +enum LSClientVersion { cv_titanium, cv_sod }; -enum ClientStatus +enum LSClientStatus { cs_not_sent_session_ready, cs_waiting_for_login, @@ -59,7 +59,7 @@ public: /** * Constructor, sets our connection to c and version to v */ - Client(EQStream *c, ClientVersion v); + Client(EQStream *c, LSClientVersion v); /** * Destructor. @@ -134,8 +134,8 @@ public: EQEmu::Random random; private: EQStream *connection; - ClientVersion version; - ClientStatus status; + LSClientVersion version; + LSClientStatus status; string account_name; unsigned int account_id; diff --git a/world/client.cpp b/world/client.cpp index 1ceca8284..e8f83f06b 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -89,7 +89,8 @@ Client::Client(EQStreamInterface* ieqs) ClientVersionBit = 0; numclients++; - ClientVersionBit = 1 << (eqs->ClientVersion() - 1); + if (eqs->GetClientVersion() != ClientVersion::Unknown) + ClientVersionBit = 1 << (static_cast(eqs->GetClientVersion()) - 1); } Client::~Client() { diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index a47c1f38b..5c62c5860 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -155,7 +155,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) { } //Power Source Slot - if (GetClientVersion() >= EQClientSoF) + if (GetClientVersion() >= ClientVersion::SoF) { const ItemInst* inst = m_inv[MainPowerSource]; if(inst) @@ -3086,7 +3086,7 @@ void Client::CalcItemScale() { changed = true; //Power Source Slot - if (GetClientVersion() >= EQClientSoF) + if (GetClientVersion() >= ClientVersion::SoF) { if(CalcItemScale(MainPowerSource, MainPowerSource)) changed = true; @@ -3180,7 +3180,7 @@ void Client::DoItemEnterZone() { changed = true; //Power Source Slot - if (GetClientVersion() >= EQClientSoF) + if (GetClientVersion() >= ClientVersion::SoF) { if(DoItemEnterZone(MainPowerSource, MainPowerSource)) changed = true; diff --git a/zone/bot.cpp b/zone/bot.cpp index 6e6201ee3..b6b464b07 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1375,7 +1375,7 @@ int32 Bot::GenerateBaseHitPoints() uint32 Post255; uint32 NormalSTA = GetSTA(); - if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) + if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { float SoDPost255; @@ -9332,7 +9332,7 @@ int32 Bot::GenerateBaseManaPoints() { case 'I': WisInt = INT; - if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if(WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); if(WisInt > 201) { @@ -9375,7 +9375,7 @@ int32 Bot::GenerateBaseManaPoints() case 'W': WisInt = WIS; - if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if(WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); if(WisInt > 201) { @@ -9614,7 +9614,7 @@ int32 Bot::GetMaxStat() { if (level < 61) { base = 255; } - else if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoF) { + else if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoF) { base = 255 + 5 * (level - 60); } else if (level < 71) { @@ -10234,7 +10234,7 @@ int32 Bot::CalcBaseEndurance() int32 sta_end = 0; int Stats = 0; - if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { int HeroicStats = 0; Stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4); diff --git a/zone/client.cpp b/zone/client.cpp index dbf9508d4..cda1669e0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -246,7 +246,7 @@ Client::Client(EQStreamInterface* ieqs) GlobalChatLimiterTimer = new Timer(RuleI(Chat, IntervalDurationMS)); AttemptedMessages = 0; TotalKarma = 0; - ClientVersion = EQClientUnknown; + ClientVersion = ClientVersion::Unknown; ClientVersionBit = 0; AggroCount = 0; RestRegenHP = 0; @@ -1440,7 +1440,7 @@ void Client::UpdateWho(uint8 remove) { else if (m_pp.anon >= 2) scl->anon = 2; - scl->ClientVersion = GetClientVersion(); + scl->ClientVersion = static_cast(GetClientVersion()); scl->tellsoff = tellsoff; scl->guild_id = guild_id; scl->LFG = LFG; @@ -1698,7 +1698,7 @@ void Client::SendManaUpdatePacket() { if (!Connected() || IsCasting()) return; - if (GetClientVersion() >= EQClientSoD) { + if (GetClientVersion() >= ClientVersion::SoD) { SendManaUpdate(); SendEnduranceUpdate(); } @@ -1734,7 +1734,7 @@ void Client::SendManaUpdatePacket() { for(int i = 0; i < MAX_GROUP_MEMBERS; ++i) - if(g->members[i] && g->members[i]->IsClient() && (g->members[i] != this) && (g->members[i]->CastToClient()->GetClientVersion() >= EQClientSoD)) + if(g->members[i] && g->members[i]->IsClient() && (g->members[i] != this) && (g->members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD)) { g->members[i]->CastToClient()->QueuePacket(outapp); g->members[i]->CastToClient()->QueuePacket(outapp2); @@ -1914,7 +1914,7 @@ void Client::ReadBook(BookRequest_Struct *book) { BookText_Struct *out = (BookText_Struct *) outapp->pBuffer; out->window = book->window; - if(GetClientVersion() >= EQClientSoF) + if(GetClientVersion() >= ClientVersion::SoF) { const ItemInst *inst = m_inv[book->invslot]; if(inst) @@ -4065,7 +4065,7 @@ bool Client::GroupFollow(Client* inviter) { group->UpdateGroupAAs(); //Invite the inviter into the group first.....dont ask - if (inviter->GetClientVersion() < EQClientSoD) + if (inviter->GetClientVersion() < ClientVersion::SoD) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct)); GroupJoin_Struct* outgj = (GroupJoin_Struct*)outapp->pBuffer; @@ -4111,13 +4111,13 @@ bool Client::GroupFollow(Client* inviter) { return false; } - if (GetClientVersion() >= EQClientSoD) + if (GetClientVersion() >= ClientVersion::SoD) { SendGroupJoinAcknowledge(); } // Temporary hack for SoD, as things seem to work quite differently - if (inviter->IsClient() && inviter->GetClientVersion() >= EQClientSoD) + if (inviter->IsClient() && inviter->GetClientVersion() >= ClientVersion::SoD) { database.RefreshGroupFromDB(inviter); } @@ -4351,7 +4351,7 @@ void Client::IncrementAggroCount() { if (AggroCount == 1) SavedRaidRestTimer = rest_timer.GetRemainingTime(); - if(GetClientVersion() >= EQClientSoF) { + if(GetClientVersion() >= ClientVersion::SoF) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 1); char *Buffer = (char *)outapp->pBuffer; @@ -4396,7 +4396,7 @@ void Client::DecrementAggroCount() { rest_timer.Start(time_until_rest); - if(GetClientVersion() >= EQClientSoF) { + if(GetClientVersion() >= ClientVersion::SoF) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5); char *Buffer = (char *)outapp->pBuffer; @@ -6805,7 +6805,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) if(use_window) { if(final_stats.size() < 4096) { - uint32 Buttons = (client->GetClientVersion() < EQClientSoD) ? 0 : 1; + uint32 Buttons = (client->GetClientVersion() < ClientVersion::SoD) ? 0 : 1; client->SendWindow(0, POPUPID_UPDATE_SHOWSTATSWINDOW, Buttons, "Cancel", "Update", 0, 1, this, "", "%s", final_stats.c_str()); goto Extra_Info; } @@ -6841,7 +6841,7 @@ void Client::SendStatsWindow(Client* client, bool use_window) } void Client::SendAltCurrencies() { - if(GetClientVersion() >= EQClientSoF) { + if(GetClientVersion() >= ClientVersion::SoF) { uint32 count = zone->AlternateCurrencies.size(); if(count == 0) { return; @@ -7332,7 +7332,7 @@ void Client::SendMercPersonalInfo() if(mercData) { - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { if (mercCount > 0) { diff --git a/zone/client.h b/zone/client.h index c89dc017c..8f596d52a 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1019,7 +1019,7 @@ public: inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } - inline const EQClientVersion GetClientVersion() const { return ClientVersion; } + inline const ClientVersion GetClientVersion() const { return ClientVersion; } inline const uint32 GetClientVersionBit() const { return ClientVersionBit; } /** Adventure Stuff **/ @@ -1506,7 +1506,7 @@ private: Timer *GlobalChatLimiterTimer; //60 seconds uint32 AttemptedMessages; - EQClientVersion ClientVersion; + ClientVersion ClientVersion; uint32 ClientVersionBit; int XPRate; diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 1a05052ad..bc639b371 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -43,7 +43,7 @@ int32 Client::GetMaxStat() const { if (level < 61) { base = 255; } - else if (GetClientVersion() >= EQClientSoF) { + else if (GetClientVersion() >= ClientVersion::SoF) { base = 255 + 5 * (level - 60); } else if (level < 71) { @@ -367,7 +367,7 @@ uint32 Mob::GetClassLevelFactor(){ int32 Client::CalcBaseHP() { - if(GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { int stats = GetSTA(); if(stats > 255) { stats = (stats - 255) / 2; @@ -973,7 +973,7 @@ int32 Client::CalcBaseMana() case 'I': WisInt = GetINT(); - if (GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if (GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if (WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); @@ -1008,7 +1008,7 @@ int32 Client::CalcBaseMana() case 'W': WisInt = GetWIS(); - if (GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if (GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if (WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); @@ -1925,7 +1925,7 @@ int32 Client::CalcBaseEndurance() { int32 base_end = 0; - if(GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) { double heroic_stats = (GetHeroicSTR() + GetHeroicSTA() + GetHeroicDEX() + GetHeroicAGI()) / 4.0f; double stats = (GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4.0f; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2ba7c1b82..f09e9ecf4 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -509,7 +509,7 @@ void Client::CompleteConnect() if (IsInAGuild()){ uint8 rank = GuildRank(); - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { switch (rank) { case 0: { rank = 5; break; } // GUILD_MEMBER 0 @@ -823,7 +823,7 @@ void Client::CompleteConnect() if (zone->GetZoneID() == RuleI(World, GuildBankZoneID) && GuildBanks) GuildBanks->SendGuildBank(this); - if (GetClientVersion() >= EQClientSoD) + if (GetClientVersion() >= ClientVersion::SoD) entity_list.SendFindableNPCList(this); if (IsInAGuild()) { @@ -1035,7 +1035,7 @@ void Client::Handle_Connect_OP_ReqClientSpawn(const EQApplicationPacket *app) outapp = new EQApplicationPacket(OP_SendExpZonein, 0); FastQueuePacket(&outapp); - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { outapp = new EQApplicationPacket(OP_ClientReady, 0); FastQueuePacket(&outapp); @@ -1309,14 +1309,12 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) conn_state = ReceivedZoneEntry; - ClientVersion = Connection()->ClientVersion(); - if (ClientVersion != EQClientUnknown) - ClientVersionBit = 1 << (ClientVersion - 1); - else - ClientVersionBit = 0; + ClientVersion = Connection()->GetClientVersion(); + if (ClientVersion != ClientVersion::Unknown) + ClientVersionBit = 1 << (static_cast(ClientVersion) - 1); bool siv = m_inv.SetInventoryVersion(ClientVersion); - LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion); + LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(ClientVersion), ClientVersion); /* Antighost code tmp var is so the search doesnt find this object @@ -1499,7 +1497,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) m_pp.guild_id = GuildID(); uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); // FIXME: RoF guild rank - if (GetClientVersion() >= EQClientRoF) { + if (GetClientVersion() >= ClientVersion::RoF) { switch (rank) { case 0: rank = 5; @@ -1850,7 +1848,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) /* Task Packets */ LoadClientTaskState(); - if (GetClientVersion() >= EQClientRoF) { + if (GetClientVersion() >= ClientVersion::RoF) { outapp = new EQApplicationPacket(OP_ReqNewZone, 0); Handle_Connect_OP_ReqNewZone(outapp); safe_delete(outapp); @@ -3079,7 +3077,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) // Delegate to tradeskill object to perform combine AugmentItem_Struct* in_augment = (AugmentItem_Struct*)app->pBuffer; bool deleteItems = false; - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { ItemInst *itemOneToPush = nullptr, *itemTwoToPush = nullptr; @@ -5162,7 +5160,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app) int16 AlcoholTolerance = GetSkill(SkillAlcoholTolerance); int16 IntoxicationIncrease; - if (GetClientVersion() < EQClientSoD) + if (GetClientVersion() < ClientVersion::SoD) IntoxicationIncrease = (200 - AlcoholTolerance) * 30 / 200 + 10; else IntoxicationIncrease = (270 - AlcoholTolerance) * 0.111111108 + 10; @@ -5479,7 +5477,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app) Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer)); if (entity == 0) { Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)"); - if (GetClientVersion() >= EQClientSoD) + if (GetClientVersion() >= ClientVersion::SoD) Corpse::SendEndLootErrorPacket(this); else Corpse::SendLootReqErrorPacket(this); @@ -6845,7 +6843,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app) uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buffer); uint32 sentAction = Action; - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { Action += 1; /* @@ -7412,7 +7410,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) GuildInviteAccept_Struct* gj = (GuildInviteAccept_Struct*)app->pBuffer; - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { if (gj->response > 9) { @@ -7472,7 +7470,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) uint32 guildrank = gj->response; - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { if (gj->response == 8) { @@ -8081,7 +8079,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app) Mob* tmp = entity_list.GetMob(ins->TargetID); if (tmp != 0 && tmp->IsClient()) { - if (tmp->CastToClient()->GetClientVersion() < EQClientSoF) { tmp->CastToClient()->QueuePacket(app); } // Send request to target + if (tmp->CastToClient()->GetClientVersion() < ClientVersion::SoF) { tmp->CastToClient()->QueuePacket(app); } // Send request to target // Inspecting an SoF or later client will make the server handle the request else { ProcessInspectRequest(tmp->CastToClient(), this); } } @@ -8601,7 +8599,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } else { - if (GetClientVersion() >= EQClientSoD && !inst->IsEquipable(GetBaseRace(), GetClass())) + if (GetClientVersion() >= ClientVersion::SoD && !inst->IsEquipable(GetBaseRace(), GetClass())) { if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol) { @@ -9436,14 +9434,14 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) return; } - mercTypeCount = tar->GetNumMercTypes(GetClientVersion()); - mercCount = tar->GetNumMercs(GetClientVersion()); + mercTypeCount = tar->GetNumMercTypes(static_cast(GetClientVersion())); + mercCount = tar->GetNumMercs(static_cast(GetClientVersion())); if (mercCount > MAX_MERC) return; - std::list mercTypeList = tar->GetMercTypesList(GetClientVersion()); - std::list mercDataList = tar->GetMercsList(GetClientVersion()); + std::list mercTypeList = tar->GetMercTypesList(static_cast(GetClientVersion())); + std::list mercDataList = tar->GetMercsList(static_cast(GetClientVersion())); int i = 0; int StanceCount = 0; @@ -11343,7 +11341,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) } BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer; ReadBook(book); - if (GetClientVersion() >= EQClientSoF) + if (GetClientVersion() >= ClientVersion::SoF) { EQApplicationPacket EndOfBook(OP_FinishWindow, 0); QueuePacket(&EndOfBook); @@ -12660,7 +12658,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app) { if (!HasSkill(SkillHide) && GetSkill(SkillHide) == 0) { - if (GetClientVersion() < EQClientSoF) + if (GetClientVersion() < ClientVersion::SoF) { char *hack_str = nullptr; MakeAnyLenString(&hack_str, "Player sent OP_SpawnAppearance with AT_Invis: %i", sa->parameter); @@ -13497,7 +13495,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) this->Trader_StartTrader(); - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderStatus_Struct)); TraderStatus_Struct* tss = (TraderStatus_Struct*)outapp->pBuffer; diff --git a/zone/client_process.cpp b/zone/client_process.cpp index fc94fd415..03714d5e5 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -124,7 +124,7 @@ bool Client::Process() { HandleRespawnFromHover(0); } - if(IsTracking() && (GetClientVersion() >= EQClientSoD) && TrackingTimer.Check()) + if(IsTracking() && (GetClientVersion() >= ClientVersion::SoD) && TrackingTimer.Check()) DoTracking(); if(hpupdate_timer.Check()) @@ -871,7 +871,7 @@ void Client::BulkSendInventoryItems() { } // Power Source - if(GetClientVersion() >= EQClientSoF) { + if(GetClientVersion() >= ClientVersion::SoF) { const ItemInst* inst = m_inv[MainPowerSource]; if(inst) { std::string packet = inst->Serialize(MainPowerSource); @@ -1792,7 +1792,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) } } - if(GetClientVersion() >= EQClientSoF) { + if(GetClientVersion() >= ClientVersion::SoF) { // The following packet decreases the skill points left in the Training Window and // produces the 'You have increased your skill / learned the basics of' message. // diff --git a/zone/command.cpp b/zone/command.cpp index fe479848f..8d9b55b4c 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2632,7 +2632,7 @@ void command_peekinv(Client *c, const Seperator *sep) indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges())); } - if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= EQClientSoF)) { + if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= ClientVersion::SoF)) { inst_main = targetClient->GetInv().GetItem(MainPowerSource); item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem(); linker.SetItemInst(inst_main); diff --git a/zone/corpse.cpp b/zone/corpse.cpp index b860f02fe..12e1e4ba8 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -298,7 +298,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // cash // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. // (change to first client that supports 'death hover' mode, if not SoF.) - if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) { + if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < ClientVersion::SoF) { SetCash(pp->copper, pp->silver, pp->gold, pp->platinum); pp->copper = 0; pp->silver = 0; @@ -317,7 +317,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( std::list removed_list; //bool cursor = false; for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) { - if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) { + if(i == MainAmmo && client->GetClientVersion() >= ClientVersion::SoF) { item = client->GetInv().GetItem(MainPowerSource); if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { std::list slot_list = MoveItemToCorpse(client, item, MainPowerSource); @@ -1041,7 +1041,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a // This is required for the 'Loot All' feature to work for SoD clients. I expect it is to tell the client that the // server has now sent all the items on the corpse. - if(client->GetClientVersion() >= EQClientSoD) { SendLootReqErrorPacket(client, 6); } + if(client->GetClientVersion() >= ClientVersion::SoD) { SendLootReqErrorPacket(client, 6); } } void Corpse::LootItem(Client* client, const EQApplicationPacket* app) { diff --git a/zone/entity.cpp b/zone/entity.cpp index 6ec20832e..5b426f776 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4378,7 +4378,7 @@ void EntityList::UpdateFindableNPCState(NPC *n, bool Remove) auto it = client_list.begin(); while (it != client_list.end()) { Client *c = it->second; - if (c && (c->GetClientVersion() >= EQClientSoD)) + if (c && (c->GetClientVersion() >= ClientVersion::SoD)) c->QueuePacket(outapp); ++it; diff --git a/zone/groups.cpp b/zone/groups.cpp index 1b26d47b4..27ff3b758 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -393,7 +393,7 @@ void Group::SendHPPacketsTo(Mob *member) { members[i]->CreateHPPacket(&hpapp); member->CastToClient()->QueuePacket(&hpapp, false); - if(member->CastToClient()->GetClientVersion() >= EQClientSoD) + if(member->CastToClient()->GetClientVersion() >= ClientVersion::SoD) { outapp.SetOpcode(OP_MobManaUpdate); MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; @@ -424,7 +424,7 @@ void Group::SendHPPacketsFrom(Mob *member) if(members[i] && members[i] != member && members[i]->IsClient()) { members[i]->CastToClient()->QueuePacket(&hp_app); - if(members[i]->CastToClient()->GetClientVersion() >= EQClientSoD) + if(members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD) { outapp.SetOpcode(OP_MobManaUpdate); MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; @@ -564,7 +564,7 @@ bool Group::DelMemberOOZ(const char *Name) { if(GroupCount() < 3) { UnDelegateMarkNPC(NPCMarkerName.c_str()); - if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < EQClientSoD) { + if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < ClientVersion::SoD) { UnDelegateMainAssist(MainAssistName.c_str()); } ClearAllNPCMarks(); @@ -722,7 +722,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) if(GroupCount() < 3) { UnDelegateMarkNPC(NPCMarkerName.c_str()); - if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < EQClientSoD) { + if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < ClientVersion::SoD) { UnDelegateMainAssist(MainAssistName.c_str()); } ClearAllNPCMarks(); @@ -1567,7 +1567,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle) if(!MainTankName.size()) return; - if(c->GetClientVersion() < EQClientSoD) + if(c->GetClientVersion() < ClientVersion::SoD) { if(toggle) c->Message(0, "%s is now Main Tank.", MainTankName.c_str()); @@ -1607,7 +1607,7 @@ void Group::NotifyMainAssist(Client *c, uint8 toggle) if(!MainAssistName.size()) return; - if(c->GetClientVersion() < EQClientSoD) + if(c->GetClientVersion() < ClientVersion::SoD) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct)); @@ -1662,7 +1662,7 @@ void Group::NotifyPuller(Client *c, uint8 toggle) if(!PullerName.size()) return; - if(c->GetClientVersion() < EQClientSoD) + if(c->GetClientVersion() < ClientVersion::SoD) { if(toggle) c->Message(0, "%s is now Puller.", PullerName.c_str()); @@ -2228,7 +2228,7 @@ void Group::ChangeLeader(Mob* newleader) for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i] && members[i]->IsClient()) { - if(members[i]->CastToClient()->GetClientVersion() >= EQClientSoD) + if(members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD) members[i]->CastToClient()->SendGroupLeaderChangePacket(newleader->GetName()); members[i]->CastToClient()->QueuePacket(outapp); diff --git a/zone/guild.cpp b/zone/guild.cpp index 39785f3dd..05713f66f 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -64,7 +64,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) { void Client::SendGuildURL() { - if(GetClientVersion() < EQClientSoF) + if(GetClientVersion() < ClientVersion::SoF) return; if(IsInAGuild()) @@ -85,7 +85,7 @@ void Client::SendGuildURL() void Client::SendGuildChannel() { - if(GetClientVersion() < EQClientSoF) + if(GetClientVersion() < ClientVersion::SoF) return; if(IsInAGuild()) @@ -107,7 +107,7 @@ void Client::SendGuildChannel() void Client::SendGuildRanks() { - if(GetClientVersion() < EQClientRoF) + if(GetClientVersion() < ClientVersion::RoF) return; int permissions = 30 + 1; //Static number of permissions in all EQ clients as of May 2014 @@ -150,7 +150,7 @@ void Client::SendGuildSpawnAppearance() { uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID()); mlog(GUILDS__OUT_PACKETS, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank); SendAppearancePacket(AT_GuildID, GuildID()); - if(GetClientVersion() >= EQClientRoF) + if(GetClientVersion() >= ClientVersion::RoF) { switch (rank) { case 0: { rank = 5; break; } // GUILD_MEMBER 0 diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 5d42846e4..5f75ec801 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -322,7 +322,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { else if(c != nullptr && s->guild_id != GUILD_NONE) { //char is in zone, and has changed into a new guild, send MOTD. c->SendGuildMOTD(); - if(c->GetClientVersion() >= EQClientRoF) + if(c->GetClientVersion() >= ClientVersion::RoF) { c->SendGuildRanks(); } diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 20781b749..ff64a53bd 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -55,7 +55,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) { x++; } - if (GetClientVersion() >= EQClientSoF) + if (GetClientVersion() >= ClientVersion::SoF) DeleteItemInInventory(MainPowerSource, 0, true); else DeleteItemInInventory(MainPowerSource, 0, false); // Prevents Titanium crash @@ -683,7 +683,7 @@ void Client::SendCursorBuffer() { // Temporary work-around for the RoF+ Client Buffer // Instead of dealing with client moving items in cursor buffer, // we can just send the next item in the cursor buffer to the cursor. - if (GetClientVersion() >= EQClientRoF) + if (GetClientVersion() >= ClientVersion::RoF) { if (!GetInv().CursorEmpty()) { @@ -937,7 +937,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) { // originally (i < 22) if (i == EmuConstants::GENERAL_BEGIN) { // added power source check for SoF+ clients - if (this->GetClientVersion() >= EQClientSoF) + if (this->GetClientVersion() >= ClientVersion::SoF) i = MainPowerSource; else break; @@ -2083,7 +2083,7 @@ void Client::RemoveNoRent(bool client_update) auto inst = m_inv[MainPowerSource]; if (inst && !inst->GetItem()->NoRent) { mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); - DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent + DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= ClientVersion::SoF) ? client_update : false); // Ti slot non-existent } } @@ -2301,7 +2301,7 @@ void Client::MoveSlotNotAllowed(bool client_update) bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, MainPowerSource, free_slot_id); - PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); + PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= ClientVersion::SoF) ? client_update : false); database.SaveInventory(character_id, nullptr, MainPowerSource); safe_delete(inst); } diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 5678bd24a..d931f0e36 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -834,7 +834,7 @@ void Lua_Client::SetAATitle(const char *title) { int Lua_Client::GetClientVersion() { Lua_Safe_Call_Int(); - return self->GetClientVersion(); + return static_cast(self->GetClientVersion()); } uint32 Lua_Client::GetClientVersionBit() { diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 034895172..b8c88422f 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1758,12 +1758,15 @@ luabind::scope lua_register_client_version() { return luabind::class_("ClientVersion") .enum_("constants") [ - luabind::value("Unknown", static_cast(EQClientUnknown)), - luabind::value("Titanium", static_cast(EQClientTitanium)), - luabind::value("SoF", static_cast(EQClientSoF)), - luabind::value("SoD", static_cast(EQClientSoD)), - luabind::value("Underfoot", static_cast(EQClientUnderfoot)), - luabind::value("RoF", static_cast(EQClientRoF)) + luabind::value("Unknown", static_cast(ClientVersion::Unknown)), + luabind::value("Titanium", static_cast(ClientVersion::Tit)), // deprecated + luabind::value("Tit", static_cast(ClientVersion::Tit)), + luabind::value("SoF", static_cast(ClientVersion::SoF)), + luabind::value("SoD", static_cast(ClientVersion::SoD)), + luabind::value("Underfoot", static_cast(ClientVersion::Und)), // deprecated + luabind::value("Und", static_cast(ClientVersion::Und)), + luabind::value("RoF", static_cast(ClientVersion::RoF)), + luabind::value("RoF2", static_cast(ClientVersion::RoF2)) ]; } diff --git a/zone/merc.cpp b/zone/merc.cpp index 2f17d7ca3..187a23370 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -41,7 +41,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) _baseFR = d->FR; _basePR = d->PR; _baseCorrup = d->Corrup; - _OwnerClientVersion = EQClientTitanium; + _OwnerClientVersion = static_cast(ClientVersion::Tit); RestRegenHP = 0; RestRegenMana = 0; RestRegenEndurance = 0; @@ -1008,7 +1008,7 @@ int32 Merc::CalcBaseEndurance() int32 sta_end = 0; int Stats = 0; - if(GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { + if(GetClientVersion() >= static_cast(ClientVersion::SoD) && RuleB(Character, SoDClientUseSoDHPManaEnd)) { int HeroicStats = 0; Stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4); @@ -4956,109 +4956,109 @@ void Client::SendMercResponsePackets(uint32 ResponseType) SendMercMerchantResponsePacket(6); break; case 7: //You must dismiss your suspended mercenary before purchasing a new one! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(7); else //You have the maximum number of mercenaries. You must dismiss one before purchasing a new one! SendMercMerchantResponsePacket(6); break; case 8: //You can not purchase a mercenary because your group is full! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(8); else SendMercMerchantResponsePacket(7); break; case 9: //You can not purchase a mercenary because you are in combat! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //Mercenary failed to spawn! SendMercMerchantResponsePacket(3); else SendMercMerchantResponsePacket(8); break; case 10: //You have recently dismissed a mercenary and must wait a few more seconds before you can purchase a new one! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //Mercenary failed to spawn! SendMercMerchantResponsePacket(3); else SendMercMerchantResponsePacket(9); break; case 11: //An error occurred created your mercenary! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(9); else SendMercMerchantResponsePacket(10); break; case 12: //Upkeep Charge Message - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(10); else SendMercMerchantResponsePacket(11); break; case 13: // ??? - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(11); else SendMercMerchantResponsePacket(12); break; case 14: //You ran out of funds to pay for your mercenary! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(12); else SendMercMerchantResponsePacket(13); break; case 15: // ??? - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(13); else SendMercMerchantResponsePacket(14); break; case 16: //Your mercenary is about to be suspended due to insufficient funds! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(14); else SendMercMerchantResponsePacket(15); break; case 17: //There is no mercenary liaison nearby! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(15); else SendMercMerchantResponsePacket(16); break; case 18: //You are too far from the liaison! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(16); else SendMercMerchantResponsePacket(17); break; case 19: //You do not meet the requirements for that mercenary! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) SendMercMerchantResponsePacket(17); else SendMercMerchantResponsePacket(18); break; case 20: //You are unable to interact with the liaison! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //You are too far from the liaison! SendMercMerchantResponsePacket(16); else SendMercMerchantResponsePacket(19); break; case 21: //You do not have a high enough membership level to purchase this mercenary! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //You do not meet the requirements for that mercenary! SendMercMerchantResponsePacket(17); else SendMercMerchantResponsePacket(20); break; case 22: //Your purchase has failed because this mercenary requires a Gold membership! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //You do not meet the requirements for that mercenary! SendMercMerchantResponsePacket(17); else SendMercMerchantResponsePacket(21); break; case 23: //Your purchase has failed because this mercenary requires at least a Silver membership! - if (GetClientVersion() < EQClientRoF) + if (GetClientVersion() < ClientVersion::RoF) //You do not meet the requirements for that mercenary! SendMercMerchantResponsePacket(17); else @@ -5211,7 +5211,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) { } // Check client version - if(GetClientVersion() < mercTemplate->ClientVersion) + if(static_cast(GetClientVersion()) < mercTemplate->ClientVersion) { SendMercResponsePackets(3); return false; @@ -5904,7 +5904,7 @@ void Client::UpdateMercLevel() { void Client::SendMercMerchantResponsePacket(int32 response_type) { // This response packet brings up the Mercenary Manager window - if(GetClientVersion() >= EQClientSoD) + if(GetClientVersion() >= ClientVersion::SoD) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct)); MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; diff --git a/zone/object.cpp b/zone/object.cpp index c8bde8f1f..215707037 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -118,7 +118,7 @@ Object::Object(Client* client, const ItemInst* inst) m_data.heading = client->GetHeading(); m_data.x = client->GetX(); m_data.y = client->GetY(); - if (client->GetClientVersion() >= EQClientRoF2) + if (client->GetClientVersion() >= ClientVersion::RoF2) { // RoF2 places items at player's Z, which is 0.625 of their height. m_data.z = client->GetZ() - (client->GetSize() * 0.625f); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 46b3b761a..537c62399 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -3899,7 +3899,7 @@ XS(XS_Client_GetClientVersion) if(THIS == nullptr) Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); - RETVAL = THIS->GetClientVersion(); + RETVAL = static_cast(THIS->GetClientVersion()); XSprePUSH; PUSHu((UV)RETVAL); } XSRETURN(1); diff --git a/zone/raids.cpp b/zone/raids.cpp index 3bed5af2e..2a5c94bdd 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -1529,7 +1529,7 @@ void Raid::SendHPPacketsTo(Client *c) { members[x].member->CreateHPPacket(&hpapp); c->QueuePacket(&hpapp, false); - if(c->GetClientVersion() >= EQClientSoD) + if(c->GetClientVersion() >= ClientVersion::SoD) { outapp.SetOpcode(OP_MobManaUpdate); MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; @@ -1565,7 +1565,7 @@ void Raid::SendHPPacketsFrom(Mob *m) if(!m->IsClient() || ((members[x].member != m->CastToClient()) && (members[x].GroupNumber == gid))) { members[x].member->QueuePacket(&hpapp, false); - if(members[x].member->GetClientVersion() >= EQClientSoD) + if(members[x].member->GetClientVersion() >= ClientVersion::SoD) { outapp.SetOpcode(OP_MobManaUpdate); MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 507c361dd..bab750edf 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3408,7 +3408,7 @@ void Mob::BuffProcess() { CastToClient()->SendBuffDurationPacket(buffs[buffs_i]); // Hack to get UF to play nicer, RoF seems fine without it - if (CastToClient()->GetClientVersion() == EQClientUnderfoot && buffs[buffs_i].numhits > 0) + if (CastToClient()->GetClientVersion() == ClientVersion::Und && buffs[buffs_i].numhits > 0) CastToClient()->SendBuffNumHitPacket(buffs[buffs_i], buffs_i); buffs[buffs_i].UpdateClient = false; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 96a1f87dd..ac111a006 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -255,7 +255,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, bitmask = bitmask << (CastToClient()->GetClass() - 1); if( itm && itm->GetItem()->Classes != 65535 ) { if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) { - if (CastToClient()->GetClientVersion() < EQClientSoF) { + if (CastToClient()->GetClientVersion() < ClientVersion::SoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); @@ -267,14 +267,14 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, return(false); } if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) { - if (CastToClient()->GetClientVersion() < EQClientSoF) { + if (CastToClient()->GetClientVersion() < ClientVersion::SoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } else { - if (CastToClient()->GetClientVersion() >= EQClientRoF) + if (CastToClient()->GetClientVersion() >= ClientVersion::RoF) { // Line 181 in eqstr_us.txt was changed in RoF+ Message(15, "Your race, class, or deity cannot use this item."); @@ -288,7 +288,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot, } } if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){ - if (CastToClient()->GetClientVersion() < EQClientSoF) { + if (CastToClient()->GetClientVersion() < ClientVersion::SoF) { // They are attempting to cast a must equip clicky without having it equipped LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it"); @@ -5251,7 +5251,7 @@ void Client::SendBuffDurationPacket(Buffs_Struct &buff) void Client::SendBuffNumHitPacket(Buffs_Struct &buff, int slot) { // UF+ use this packet - if (GetClientVersion() < EQClientUnderfoot) + if (GetClientVersion() < ClientVersion::Und) return; EQApplicationPacket *outapp; outapp = new EQApplicationPacket(OP_BuffCreate, sizeof(BuffIcon_Struct) + sizeof(BuffIconEntry_Struct)); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 431a7554c..452773970 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -975,7 +975,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *TaskList) { - if (c->GetClientVersion() >= EQClientRoF) + if (c->GetClientVersion() >= ClientVersion::RoF) { SendTaskSelectorNew(c, mob, TaskCount, TaskList); return; @@ -2516,7 +2516,7 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, int ClientTaskIndex, bool Optional, bool TaskComplete) { - if (c->GetClientVersion() >= EQClientRoF) + if (c->GetClientVersion() >= ClientVersion::RoF) { SendTaskActivityNew(c, TaskID, ActivityID, ClientTaskIndex, Optional, TaskComplete); return; diff --git a/zone/trading.cpp b/zone/trading.cpp index d8c67588f..a31d45f89 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -2665,7 +2665,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); - if(GetClientVersion() >= EQClientSoD) + if(GetClientVersion() >= ClientVersion::SoD) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price } @@ -2690,7 +2690,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity); VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price); - if(Buyer->GetClientVersion() >= EQClientSoD) + if(Buyer->GetClientVersion() >= ClientVersion::SoD) { VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price } diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d76fec5c0..834f56a0c 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -874,7 +874,7 @@ void WorldServer::Process() { database.SetGroupLeaderName(group->GetID(), Inviter->GetName()); group->UpdateGroupAAs(); - if(Inviter->CastToClient()->GetClientVersion() < EQClientSoD) + if(Inviter->CastToClient()->GetClientVersion() < ClientVersion::SoD) { EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct)); GroupJoin_Struct* outgj=(GroupJoin_Struct*)outapp->pBuffer; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 0007b9e74..b9c66b11f 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2631,7 +2631,7 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){ client->QueuePacket(outapp); safe_delete(outapp); - if(client->GetClientVersion() >= EQClientSoD) { + if(client->GetClientVersion() >= ClientVersion::SoD) { group->NotifyMainTank(client, 1); group->NotifyPuller(client, 1); } diff --git a/zone/zoning.cpp b/zone/zoning.cpp index f50c6b798..b5d6d5d25 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -555,7 +555,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z if (entity == 0) { Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)"); - if (GetClientVersion() >= EQClientSoD) + if (GetClientVersion() >= ClientVersion::SoD) Corpse::SendEndLootErrorPacket(this); else Corpse::SendLootReqErrorPacket(this); From 5c56929a23303c0c63844ad8eda1b55b61c73a1d Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 20 Jan 2015 00:04:22 -0500 Subject: [PATCH 1399/1883] Fix compile error with GCC --- zone/client.cpp | 2 +- zone/client.h | 5 +++-- zone/client_mods.cpp | 2 +- zone/client_packet.cpp | 10 +++++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index cda1669e0..b7d52e82d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -246,7 +246,7 @@ Client::Client(EQStreamInterface* ieqs) GlobalChatLimiterTimer = new Timer(RuleI(Chat, IntervalDurationMS)); AttemptedMessages = 0; TotalKarma = 0; - ClientVersion = ClientVersion::Unknown; + m_ClientVersion = ClientVersion::Unknown; ClientVersionBit = 0; AggroCount = 0; RestRegenHP = 0; diff --git a/zone/client.h b/zone/client.h index 8f596d52a..cc9eb7f77 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1019,8 +1019,9 @@ public: inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } - inline const ClientVersion GetClientVersion() const { return ClientVersion; } + inline const ClientVersion GetClientVersion() const { return m_ClientVersion; } inline const uint32 GetClientVersionBit() const { return ClientVersionBit; } + inline void SetClientVersion(ClientVersion in) { m_ClientVersion = in; } /** Adventure Stuff **/ void SendAdventureError(const char *error); @@ -1506,7 +1507,7 @@ private: Timer *GlobalChatLimiterTimer; //60 seconds uint32 AttemptedMessages; - ClientVersion ClientVersion; + ClientVersion m_ClientVersion; uint32 ClientVersionBit; int XPRate; diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index bc639b371..1d64cd2c0 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -1172,7 +1172,7 @@ uint32 Client::CalcCurrentWeight() { */ // SoD+ client has no weight for coin - if (EQLimits::CoinHasWeight(ClientVersion)) + if (EQLimits::CoinHasWeight(GetClientVersion())) Total += (m_pp.platinum + m_pp.gold + m_pp.silver + m_pp.copper) / 4; float Packrat = (float)spellbonuses.Packrat + (float)aabonuses.Packrat + (float)itembonuses.Packrat; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f09e9ecf4..46c00bf3f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1309,12 +1309,12 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) conn_state = ReceivedZoneEntry; - ClientVersion = Connection()->GetClientVersion(); - if (ClientVersion != ClientVersion::Unknown) - ClientVersionBit = 1 << (static_cast(ClientVersion) - 1); + SetClientVersion(Connection()->GetClientVersion()); + if (m_ClientVersion != ClientVersion::Unknown) + ClientVersionBit = 1 << (static_cast(m_ClientVersion) - 1); - bool siv = m_inv.SetInventoryVersion(ClientVersion); - LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(ClientVersion), ClientVersion); + bool siv = m_inv.SetInventoryVersion(m_ClientVersion); + LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(m_ClientVersion), m_ClientVersion); /* Antighost code tmp var is so the search doesnt find this object From 45560f6654b147703ba4e90e293e6ce292c0b709 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 23:48:30 -0600 Subject: [PATCH 1400/1883] Remove some old MySQL logging for errors --- common/dbcore.cpp | 4 ---- world/net.cpp | 14 ++++---------- zone/net.cpp | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index d1ae89d32..948490c7c 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -110,10 +110,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo char *errorBuffer = new char[MYSQL_ERRMSG_SIZE]; snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); -#ifdef _EQDEBUG - std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; -#endif - /* Implement Logging at the Root */ if (mysql_errno(&mysql) > 0 && strlen(query) > 0){ Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query); diff --git a/world/net.cpp b/world/net.cpp index a4e560477..d78aeecf7 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -113,7 +113,6 @@ void CatchSignal(int sig_num); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); - Log.LoadLogSettingsDefaults(); set_exception_handler(); /* Database Version Check */ @@ -183,6 +182,9 @@ int main(int argc, char** argv) { } guild_mgr.SetDatabase(&database); + Log.LoadLogSettingsDefaults(); + database.LoadLogSysSettings(Log.log_settings); + if (argc >= 2) { char tmp[2]; if (strcasecmp(argv[1], "help") == 0 || strcasecmp(argv[1], "?") == 0 || strcasecmp(argv[1], "/?") == 0 || strcasecmp(argv[1], "-?") == 0 || strcasecmp(argv[1], "-h") == 0 || strcasecmp(argv[1], "-help") == 0) { @@ -446,21 +448,13 @@ int main(int argc, char** argv) { //check for timeouts in other threads timeout_manager.CheckTimeouts(); - loginserverlist.Process(); - console_list.Process(); - zoneserver_list.Process(); - launcher_list.Process(); - UCSLink.Process(); - QSLink.Process(); - - LFPGroupList.Process(); - + LFPGroupList.Process(); adventure_manager.Process(); if (InterserverTimer.Check()) { diff --git a/zone/net.cpp b/zone/net.cpp index 579f9d342..8fe7f2a74 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -168,7 +168,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ Log.LoadLogSettingsDefaults(); Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSysSettings(Log.log_settings); /* Guilds */ guild_mgr.SetDatabase(&database); From f239b113b932a99d141deb0110c1781f83efe07b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 23:52:11 -0600 Subject: [PATCH 1401/1883] Add MySQL query category --- common/eqemu_logsys.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 737c42f38..0a8cd324b 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -75,6 +75,7 @@ namespace Logs{ World_Server, Zone_Server, MySQLError, + MySQLQuery, MaxCategoryID /* Don't Remove this*/ }; @@ -116,6 +117,7 @@ namespace Logs{ "World Server", "Zone Server", "MySQL Error", + "MySQL Query", }; } From 1928be9dd3067410632206181c4d154976a6bce8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 19 Jan 2015 23:59:59 -0600 Subject: [PATCH 1402/1883] Remove some old MySQL logging for errors --- common/dbcore.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 948490c7c..506a9efb7 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -102,8 +102,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql)); - std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl; - return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer); } From 1ad210ff29faa36b6f6e650b4a43516cab673cce Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 00:14:18 -0600 Subject: [PATCH 1403/1883] Add MySQL Query logging at root --- common/dbcore.cpp | 2 ++ common/eqemu_logsys.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 506a9efb7..85cb768ce 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -126,6 +126,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); + Log.Out(Logs::General, Logs::MySQLQuery, "%s", query); + #if DEBUG_MYSQL_QUERIES >= 1 if (requestResult.Success()) { diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 99daae831..91a0d7304 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -123,12 +123,12 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ switch (log_category) { case Logs::Status: - return Console::Color::Yellow; case Logs::Normal: return Console::Color::Yellow; case Logs::MySQLError: case Logs::Error: return Console::Color::LightRed; + case Logs::MySQLQuery: case Logs::Debug: return Console::Color::LightGreen; case Logs::Quests: From 4b0f5064f6e51871bfeb6ff2276956b04dbf0587 Mon Sep 17 00:00:00 2001 From: Uleat Date: Tue, 20 Jan 2015 01:19:08 -0500 Subject: [PATCH 1404/1883] Fix for Inventory::_HasItemByUse(bucket) using the parent container when searching for bag container items --- changelog.txt | 5 ++++- common/item.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6cdfa59ee..4f9aea4d3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/20/2015 == +Uleat: Fix for Inventory::_HasItemByUse(bucket) using the parent container when searching for bag container items. + == 01/19/2015 == -Uleat: Changed 'enum EQClientVersion' to 'enum class ClientVersion.' Other light modifications were made to accomodate this namespace. Added 'RoF2' to the lua client version enumeration. +Uleat: Changed 'enum EQClientVersion' to 'enum class ClientVersion.' Other light modifications were made to accommodate this namespace. Added 'RoF2' to the lua client version enumeration. == 01/15/2015 == Uleat: Attempted fix for elusive inventory bug: diff --git a/common/item.cpp b/common/item.cpp index 533a0817b..ce1690aaf 100644 --- a/common/item.cpp +++ b/common/item.cpp @@ -1259,7 +1259,7 @@ int16 Inventory::_HasItemByUse(std::map& bucket, uint8 use, ui if (!inst->IsType(ItemClassContainer)) { continue; } - for (auto bag_iter = bucket.begin(); bag_iter != bucket.end(); ++bag_iter) { + for (auto bag_iter = inst->_begin(); bag_iter != inst->_end(); ++bag_iter) { auto bag_inst = bag_iter->second; if (bag_inst == nullptr) { continue; } From 4a6305f8cb48f89afd55b67f3ff30f149faa8784 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 00:21:00 -0600 Subject: [PATCH 1405/1883] MySQL Query Logging add rows returned --- common/dbcore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index 85cb768ce..ab26e5b8b 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -126,7 +126,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); - Log.Out(Logs::General, Logs::MySQLQuery, "%s", query); + Log.Out(Logs::General, Logs::MySQLQuery, "(%u rows returned) %s", rowCount, query); #if DEBUG_MYSQL_QUERIES >= 1 if (requestResult.Success()) From 4c18b96aa5258049201641199a1f8de8f0da607b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 00:25:14 -0600 Subject: [PATCH 1406/1883] Remove some old MySQL debugging --- common/dbcore.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index ab26e5b8b..4f95fba3f 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -126,22 +126,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql)); - Log.Out(Logs::General, Logs::MySQLQuery, "(%u rows returned) %s", rowCount, query); - -#if DEBUG_MYSQL_QUERIES >= 1 - if (requestResult.Success()) - { - std::cout << "query successful"; - if (requestResult.Result()) - std::cout << ", " << (int) mysql_num_rows(requestResult.Result()) << " rows returned"; - - std::cout << ", " << requestResult.RowCount() << " rows affected"; - std::cout<< std::endl; - } - else { - std::cout << "QUERY: query FAILED" << std::endl; - } -#endif + Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u rows returned)", query, rowCount, requestResult.RowCount()); return requestResult; } From 951f98a63eb7ba1eced169ea4b82a35ae84b1ca8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 00:53:52 -0600 Subject: [PATCH 1407/1883] Re-Implement GMSay colors: http://i.imgur.com/tQbuKUM.jpg --- common/eqemu_logsys.cpp | 22 ++++++++++++++++++++++ common/eqemu_logsys.h | 2 ++ zone/zone.cpp | 1 + zone/zone.h | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 91a0d7304..739507350 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -142,6 +142,28 @@ uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ } } +uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ + switch (log_category) { + case Logs::Status: + case Logs::Normal: + return 15; /* Yellow */ + case Logs::MySQLError: + case Logs::Error: + return 13; /* Red */ + case Logs::MySQLQuery: + case Logs::Debug: + return 14; /* Light Green */ + case Logs::Quests: + return 258; /* Light Cyan */ + case Logs::Commands: + return 5; /* Light Purple */ + case Logs::Crash: + return 13; /* Red */ + default: + return 15; /* Yellow */ + } +} + void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string message) { /* Check if category enabled for process */ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 0a8cd324b..7b83ab996 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -143,6 +143,8 @@ public: bool log_settings_loaded = false; int log_platform = 0; + uint16 GetGMSayColorFromCategory(uint16 log_category); + void OnLogHookCallBackZone(std::function f) { on_log_gmsay_hook = f; } private: diff --git a/zone/zone.cpp b/zone/zone.cpp index a89c0b96c..8d42c2ad6 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2299,3 +2299,4 @@ void Zone::UpdateHotzone() is_hotzone = atoi(row[0]) == 0 ? false: true; } + diff --git a/zone/zone.h b/zone/zone.h index e022a870c..11c3e6235 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -271,7 +271,7 @@ public: // random object that provides random values for the zone EQEmu::Random random; - static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, 15, "%s", message.c_str()); } + static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message.c_str()); } //MODDING HOOKS void mod_init(); From 35fcc69639e14ead14e60021f7363388d261fdbd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:53 -0600 Subject: [PATCH 1408/1883] Remove commented std::cout : Got OP_SessionRequest --- common/eq_stream.cpp | 1 - common/eqtime.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 0c5c6cacf..195c688bb 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -331,7 +331,6 @@ void EQStream::ProcessPacket(EQProtocolPacket *p) } } #endif - //std::cout << "Got OP_SessionRequest" << std::endl; sessionAttempts++; // we set established below, so statistics will not be reset for session attempts/stream active. init(GetState()!=ESTABLISHED); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index adfd86923..6f2ef5233 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -145,7 +145,6 @@ bool EQTime::saveFile(const char *filename) return false; } //Enable for debugging - //std::cout << "SAVE: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl; of << EQT_VERSION << std::endl; of << (long)eqTime.start_eqtime.day << std::endl; of << (long)eqTime.start_eqtime.hour << std::endl; From 716b377378819aa757bbd78e7b349dac3061d2cd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:53 -0600 Subject: [PATCH 1409/1883] Remove commented std::cout : Starting factory Reader --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index a6a1d800a..14181e997 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -106,7 +106,6 @@ struct sockaddr_in address; fcntl(sock, F_SETFL, O_NONBLOCK); #endif //moved these because on windows the output was delayed and causing the console window to look bad - //std::cout << "Starting factory Reader" << std::endl; //std::cout << "Starting factory Writer" << std::endl; #ifdef _WINDOWS _beginthread(EQStreamFactoryReaderLoop,0, this); From b2e4c98848e4729b69a3bfe9889939444eb18092 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:53 -0600 Subject: [PATCH 1410/1883] Remove commented std::cout : Sending mana update: --- common/tcp_connection.cpp | 1 - zone/client.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index f558d0596..6a8493f2e 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -541,7 +541,6 @@ bool TCPConnection::Process() { if (!RecvData(errbuf)) { struct in_addr in; in.s_addr = GetrIP(); - //std::cout << inet_ntoa(in) << ":" << GetrPort() << ": " << errbuf << std::endl; return false; } /* we break to do the send */ diff --git a/zone/client.cpp b/zone/client.cpp index 3190f7657..59e7f25ee 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1702,7 +1702,6 @@ void Client::SendManaUpdatePacket() { SendEnduranceUpdate(); } - //std::cout << "Sending mana update: " << (cur_mana - last_reported_mana) << std::endl; if (last_reported_mana != cur_mana || last_reported_endur != cur_end) { From 849ec2850f5e98ae7ab695a98d1ddde41c30aa51 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:53 -0600 Subject: [PATCH 1411/1883] Remove commented std::cout : CastToTrap error --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2ded575c0..544e0485d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -129,7 +129,6 @@ Trap *Entity::CastToTrap() { #ifdef DEBUG if (!IsTrap()) { - //std::cout << "CastToTrap error" << std::endl; return 0; } #endif From 47b0f6ca9ef5bb1c742c67e495eb0acc4f266551 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:53 -0600 Subject: [PATCH 1412/1883] Remove commented std::cout : Gender in: --- zone/mob.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index ab2d83152..7f2a0f5a2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1795,7 +1795,6 @@ bool Mob::IsPlayerRace(uint16 in_race) { uint8 Mob::GetDefaultGender(uint16 in_race, uint8 in_gender) { -//std::cout << "Gender in: " << (int)in_gender << std::endl; // undefined cout [CODEBUG] if (Mob::IsPlayerRace(in_race) || in_race == 15 || in_race == 50 || in_race == 57 || in_race == 70 || in_race == 98 || in_race == 118) { if (in_gender >= 2) { // Male default for PC Races From 4ffc09b3065c35319190caf531348cf0b4a32f1f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:56 -0600 Subject: [PATCH 1413/1883] Remove commented std::cout : Starting factory Writer --- common/eq_stream.cpp | 1 - common/eq_stream_factory.cpp | 1 - common/eqtime.cpp | 1 - zone/npc.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/common/eq_stream.cpp b/common/eq_stream.cpp index 195c688bb..15a494471 100644 --- a/common/eq_stream.cpp +++ b/common/eq_stream.cpp @@ -663,7 +663,6 @@ void EQStream::Write(int eq_fd) int32 threshold=RateThreshold; MRate.unlock(); if (BytesWritten > threshold) { - //std::cout << "Over threshold: " << BytesWritten << " > " << threshold << std::endl; return; } diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 14181e997..33b290736 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -106,7 +106,6 @@ struct sockaddr_in address; fcntl(sock, F_SETFL, O_NONBLOCK); #endif //moved these because on windows the output was delayed and causing the console window to look bad - //std::cout << "Starting factory Writer" << std::endl; #ifdef _WINDOWS _beginthread(EQStreamFactoryReaderLoop,0, this); _beginthread(EQStreamFactoryWriterLoop,0, this); diff --git a/common/eqtime.cpp b/common/eqtime.cpp index 6f2ef5233..79301a28f 100644 --- a/common/eqtime.cpp +++ b/common/eqtime.cpp @@ -194,7 +194,6 @@ bool EQTime::loadFile(const char *filename) in.ignore(80, '\n'); in >> eqTime.start_realtime; //Enable for debugging... - //std::cout << "LOAD: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl; in.close(); return true; } diff --git a/zone/npc.cpp b/zone/npc.cpp index 56bbdae69..b0a9ce8a4 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -451,7 +451,6 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) { return; } else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) { - //std::cout<<"NPC::RemoveItem"<<" equipSlot:"<equipSlot<<" quantity:"<< quantity<charges <= quantity) itemlist.erase(cur); else From b5fe23a4c3542b43a70439ef0cea2f9998f8daa1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:56 -0600 Subject: [PATCH 1414/1883] Remove commented std::cout : CastToTrap error --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 544e0485d..266850411 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -237,7 +237,6 @@ const Trap *Entity::CastToTrap() const { #ifdef DEBUG if (!IsTrap()) { - //std::cout << "CastToTrap error" << std::endl; return 0; } #endif From fb5e988ed81abf3646b940825958fe8824459ce3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:30:56 -0600 Subject: [PATCH 1415/1883] Remove commented std::cout : Tlevel: --- zone/mob.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 7f2a0f5a2..5c798500a 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2977,7 +2977,6 @@ int16 Mob::GetResist(uint8 type) const uint32 Mob::GetLevelHP(uint8 tlevel) { - //std::cout<<"Tlevel: "<<(int)tlevel< Date: Tue, 20 Jan 2015 01:30:58 -0600 Subject: [PATCH 1416/1883] Remove commented std::cout : Pop():Locking MNewStreams --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 33b290736..630b733fe 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -119,7 +119,6 @@ struct sockaddr_in address; EQStream *EQStreamFactory::Pop() { EQStream *s=nullptr; - //std::cout << "Pop():Locking MNewStreams" << std::endl; MNewStreams.lock(); if (NewStreams.size()) { s=NewStreams.front(); From f6e28298928de2a4a871593199cf43ea97c734d8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:00 -0600 Subject: [PATCH 1417/1883] Remove commented std::cout : Pop(): Unlocking MNewStreams --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 630b733fe..1f3a90958 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -126,7 +126,6 @@ EQStream *s=nullptr; s->PutInUse(); } MNewStreams.unlock(); - //std::cout << "Pop(): Unlocking MNewStreams" << std::endl; return s; } From 2c191fce7cd71ca7ff6a6c360c2373a67a377494 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:02 -0600 Subject: [PATCH 1418/1883] Remove commented std::cout : Push():Locking MNewStreams --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 1f3a90958..8db87e452 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -132,7 +132,6 @@ EQStream *s=nullptr; void EQStreamFactory::Push(EQStream *s) { - //std::cout << "Push():Locking MNewStreams" << std::endl; MNewStreams.lock(); NewStreams.push(s); MNewStreams.unlock(); From 91e9163602d39b09f2d7b5392223878976436013 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:03 -0600 Subject: [PATCH 1419/1883] Remove commented std::cout : Push(): Unlocking MNewStreams --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 8db87e452..7d8a08e04 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -135,7 +135,6 @@ void EQStreamFactory::Push(EQStream *s) MNewStreams.lock(); NewStreams.push(s); MNewStreams.unlock(); - //std::cout << "Push(): Unlocking MNewStreams" << std::endl; } void EQStreamFactory::ReaderLoop() From 421ecf6fce1a52da5397571b083a14a1d523a8e7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:04 -0600 Subject: [PATCH 1420/1883] Remove commented std::cout : Removing connection --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 7d8a08e04..97a4b8617 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -235,7 +235,6 @@ void EQStreamFactory::CheckTimeout() //give it a little time for everybody to finish with it } else { //everybody is done, we can delete it now - //std::cout << "Removing connection" << std::endl; std::map,EQStream *>::iterator temp=stream_itr; ++stream_itr; //let whoever has the stream outside delete it From 1a2b3b50ce69cc621f94f1b2983cf4eed4790933 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:05 -0600 Subject: [PATCH 1421/1883] Remove commented std::cout : No streams, waiting on condition --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 97a4b8617..70a6c76ad 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -312,7 +312,6 @@ Timer DecayTimer(20); stream_count=Streams.size(); MStreams.unlock(); if (!stream_count) { - //std::cout << "No streams, waiting on condition" << std::endl; WriterWork.Wait(); //std::cout << "Awake from condition, must have a stream now" << std::endl; } From 96a06f1cee9d34f0dc19f224eaf7668cfd9fa1a2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:31:06 -0600 Subject: [PATCH 1422/1883] Remove commented std::cout : Awake from condition, must have a stream now --- common/eq_stream_factory.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/eq_stream_factory.cpp b/common/eq_stream_factory.cpp index 70a6c76ad..7563c9b57 100644 --- a/common/eq_stream_factory.cpp +++ b/common/eq_stream_factory.cpp @@ -313,7 +313,6 @@ Timer DecayTimer(20); MStreams.unlock(); if (!stream_count) { WriterWork.Wait(); - //std::cout << "Awake from condition, must have a stream now" << std::endl; } } } From c33ac2981b14aedc22db9d460d668902e5666a94 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:32:27 -0600 Subject: [PATCH 1423/1883] Remove commented std::cout : \n --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index f3122d458..5ae19e3ca 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1809,7 +1809,6 @@ bool Database::CheckDatabaseConvertPPDeblob(){ rquery = rquery + StringFormat(", (%u, %u, %u)", character_id, i, pp->spell_book[i]); } } - // std::cout << rquery << "\n"; if (rquery != ""){ results = QueryDatabase(rquery); } /* Run Max Memmed Spell Convert */ first_entry = 0; rquery = ""; From f29ca568df291c56c68d9a2f67744f6ca50bbcf2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:17 -0600 Subject: [PATCH 1424/1883] Remove commented printf : %s ID: %i profile mismatch, not converting. PP %u - Profile Length %u \n --- common/database.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 5ae19e3ca..e300bf586 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1380,7 +1380,6 @@ bool Database::CheckDatabaseConvertPPDeblob(){ } /* Continue of PP Size does not match (Usually a created character never logged in) */ else { - // printf("%s ID: %i profile mismatch, not converting. PP %u - Profile Length %u \n", row2[2] ? row2[2] : "Unknown", character_id, sizeof(PlayerProfile_Struct), lengths); std::cout << (row2[2] ? row2[2] : "Unknown") << " ID: " << character_id << " size mismatch. Expected Size: " << sizeof(Convert::PlayerProfile_Struct) << " Seen: " << lengths << std::endl; continue; } @@ -2182,7 +2181,6 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){ c_type = "Legacy"; } if (in_datasize != esize2 && in_datasize != esize1) { - // std::cout << "[Error] in Corpse Size - OLD SIZE: " << esize1 << " SOF SIZE: " << esize2 << " db_blob_datasize: " << in_datasize << std::endl; is_sof = false; c_type = "NULL"; continue; From 3138f0f9bcdbea4ad7c15cc14e1794c28efe5dfc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:17 -0600 Subject: [PATCH 1425/1883] Remove commented printf : %s %s\n --- utils/deprecated/azone/ter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/ter.cpp b/utils/deprecated/azone/ter.cpp index 11212c570..a599e6be2 100644 --- a/utils/deprecated/azone/ter.cpp +++ b/utils/deprecated/azone/ter.cpp @@ -151,7 +151,6 @@ int line_count = 0; var = (char *) buffer; line_count++; - // printf("%s %s\n", val, var); if(strlen(var) == 0 || strlen(val) == 0) { ++buffer; From 76586b5dbb9de29f9918b5734e7f1e40a5960d73 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:19 -0600 Subject: [PATCH 1426/1883] Remove commented printf : %i: Basetex: %s\n --- utils/deprecated/azone/ter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/ter.cpp b/utils/deprecated/azone/ter.cpp index a599e6be2..b64a72ff0 100644 --- a/utils/deprecated/azone/ter.cpp +++ b/utils/deprecated/azone/ter.cpp @@ -165,7 +165,6 @@ int line_count = 0; mlist[j].basetex = new char[val_len + 1]; memcpy(mlist[j].basetex, val, val_len + 1); ++mat_count; - // printf("%i: Basetex: %s\n", j + 1, mlist[j].basetex); ++j; } else if(val[0] != 'e' && val[1] != '_' && ((var[0] != 'e' && var[1] != '_') || !strcmp(val, "e_fShininess0"))) { From 84be3458b18790f82c2a0bf776343dbc9da9d6cc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:21 -0600 Subject: [PATCH 1427/1883] Remove commented printf : Named: %s\n --- utils/deprecated/azone/ter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/ter.cpp b/utils/deprecated/azone/ter.cpp index b64a72ff0..6900471dd 100644 --- a/utils/deprecated/azone/ter.cpp +++ b/utils/deprecated/azone/ter.cpp @@ -177,7 +177,6 @@ int line_count = 0; memcpy(mlist[j].name, val, val_len + 1); continue; } - // printf("Named: %s\n", mlist[j].name); } buffer += var_len + 1; From 82c898f6bf7ee78593a75e3f3ec8dfa983ce06bc Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1428/1883] Remove commented printf : Opening packet file: %s\n --- common/packetfile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/packetfile.cpp b/common/packetfile.cpp index 699e26357..e1ee8fa3a 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -221,7 +221,6 @@ OldPacketFileReader::~OldPacketFileReader() { bool OldPacketFileReader::OpenFile(const char *name) { CloseFile(); - //printf("Opening packet file: %s\n", name); in = fopen(name, "rb"); if(in == NULL) { From 4e19cf0b5de61c32ae64c72ddbe38ef22df1b5f6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1429/1883] Remove commented printf : Got %d bytes: %.*s\n --- common/SocketLib/HttpdSocket.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/SocketLib/HttpdSocket.cpp b/common/SocketLib/HttpdSocket.cpp index 8ed3041e4..21c2938d4 100644 --- a/common/SocketLib/HttpdSocket.cpp +++ b/common/SocketLib/HttpdSocket.cpp @@ -194,7 +194,6 @@ void HttpdSocket::OnHeaderComplete() void HttpdSocket::OnData(const char *p,size_t l) { -//printf("Got %d bytes: %.*s\n", l, l, p); if (m_file) { m_file -> fwrite(p,1,l); From b15656b32bd0fc502fca397d45a0813f19ebbe4f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1430/1883] Remove commented printf : Read @ %d(%d). %d bytes. (%c)\n --- common/SocketLib/MemFile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/SocketLib/MemFile.cpp b/common/SocketLib/MemFile.cpp index 7c50356f8..5dee6717d 100644 --- a/common/SocketLib/MemFile.cpp +++ b/common/SocketLib/MemFile.cpp @@ -110,7 +110,6 @@ size_t MemFile::fread(char *ptr, size_t size, size_t nmemb) size_t sz = size * nmemb; if (p + sz < BLOCKSIZE) { -//printf("Read @ %d(%d). %d bytes. (%c)\n", m_read_ptr, p, sz, *(m_current_read -> data + p)); memcpy(ptr, m_current_read -> data + p, sz); m_read_ptr += sz; } From cfe4aeb2898c0c2baffafe0c0a504a64113279d5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1431/1883] Remove commented printf : ReadMemory: hProcess: %p, baseAddr: %p, buffer: %p, size: %d, read: %d, result: %d\n --- common/StackWalker/StackWalker.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/StackWalker/StackWalker.cpp b/common/StackWalker/StackWalker.cpp index 6931c30f5..d457a2231 100644 --- a/common/StackWalker/StackWalker.cpp +++ b/common/StackWalker/StackWalker.cpp @@ -1128,7 +1128,6 @@ BOOL __stdcall StackWalker::myReadProcMem( SIZE_T st; BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st); *lpNumberOfBytesRead = (DWORD) st; - //printf("ReadMemory: hProcess: %p, baseAddr: %p, buffer: %p, size: %d, read: %d, result: %d\n", hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, (DWORD) st, (DWORD) bRet); return bRet; } else From db5778916e4d6e320cfeacdfc8b7f2c4e517a3c5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1432/1883] Remove commented printf : Missed: (%.3f, %.3f, %.3f)\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index 387f1062e..28d023e2b 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -97,7 +97,6 @@ void repair_a_high_waypoint(Map *map, PathNode *it) { } } else { z_no_map_count++; - //printf("Missed: (%.3f, %.3f, %.3f)\n", it->x, it->y, it->z); } } From afdaba60fee1a350e2616fd3a8e6c47c7cf1c635 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1433/1883] Remove commented printf : New Color at: (%.3f,%.3f,%.3f)\n --- utils/deprecated/apathing/boostcrap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/boostcrap.cpp b/utils/deprecated/apathing/boostcrap.cpp index 230c1bfb3..2df78b934 100644 --- a/utils/deprecated/apathing/boostcrap.cpp +++ b/utils/deprecated/apathing/boostcrap.cpp @@ -297,7 +297,6 @@ void color_disjoint_graphs( if(n->color != 0) continue; //allready visited -//printf("New Color at: (%.3f,%.3f,%.3f)\n", n->x, n->y, n->z); cc = 1; djc = 0; From cc9b0ff089dc37b8461886ba5590502e55e6d1aa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1434/1883] Remove commented printf : Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n --- utils/deprecated/apathing/quadtree.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/quadtree.cpp b/utils/deprecated/apathing/quadtree.cpp index fad704505..829c5e638 100644 --- a/utils/deprecated/apathing/quadtree.cpp +++ b/utils/deprecated/apathing/quadtree.cpp @@ -86,7 +86,6 @@ void QTNode::fillBlocks(PathTree_Struct *heads, PathPointRef *flist, unsigned lo head->miny = miny; head->maxy = maxy; head->flags = 0; -//printf("Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n", hindex-1, head->minx, head->maxx, head->miny, head->maxy); //rearranged to give all QT nodes a node list head->nodelist.count = nodes.size(); From 467272c334f7b0584c96bcf921145a9b4724318d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:29 -0600 Subject: [PATCH 1435/1883] Remove commented printf : Find Region %ld in node %ld\n --- utils/deprecated/azone/awater.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/awater.cpp b/utils/deprecated/azone/awater.cpp index cffdfdb8b..1e25fc155 100644 --- a/utils/deprecated/azone/awater.cpp +++ b/utils/deprecated/azone/awater.cpp @@ -257,7 +257,6 @@ long BSPCountNodes(BSP_Node *tree, long node_number) { long BSPFindRegion(BSP_Node *tree, long node_number, long region) { - //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { printf("Something went wrong\n"); exit(1); From 36dda4ee0a0b33b0ef62b17763d8d1bc4c352b1c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1436/1883] Remove commented printf : Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n --- utils/deprecated/azone/azone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/azone.cpp b/utils/deprecated/azone/azone.cpp index 9fc9f2466..2c384482d 100644 --- a/utils/deprecated/azone/azone.cpp +++ b/utils/deprecated/azone/azone.cpp @@ -584,7 +584,6 @@ void QTNode::fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long & head->miny = miny; head->maxy = maxy; head->flags = 0; -//printf("Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n", hindex-1, head->minx, head->maxx, head->miny, head->maxy); if(final) { head->flags |= nodeFinal; head->faces.count = faces.size(); From 63ab54bf1f48a5fad591384bb8c77fded4a14943 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1437/1883] Remove commented printf : Look for %s: got %s\n --- utils/deprecated/azone/pfs.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/pfs.cpp b/utils/deprecated/azone/pfs.cpp index 9002ae977..5ce56ae3b 100644 --- a/utils/deprecated/azone/pfs.cpp +++ b/utils/deprecated/azone/pfs.cpp @@ -178,7 +178,6 @@ const char *PFSLoader::FindExtension(const char *ext) { int elen = strlen(ext); for(i = 0; i < this->count; ++i) { -//printf("Look for %s: got %s\n", ext, this->filenames[i]); int flen = strlen(this->filenames[i]); if(flen <= elen) continue; From c1dca8f6a9e13bcea13f2d121d3ee1717b927076 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1438/1883] Remove commented printf : v1=%d, v2=%d, v3=%d, g=%d, unk=%d\n --- utils/deprecated/azone/ter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/ter.cpp b/utils/deprecated/azone/ter.cpp index 6900471dd..e9453ec8d 100644 --- a/utils/deprecated/azone/ter.cpp +++ b/utils/deprecated/azone/ter.cpp @@ -318,7 +318,6 @@ printf("%d tris start at %d (0x%x)\n", zm->poly_count, (buffer-ter_orig), (buffe } zm->polys[j] = new Polygon; - //printf(" v1=%d, v2=%d, v3=%d, g=%d, unk=%d\n", ttri->v1, ttri->v2, ttri->v3, ttri->group, ttri->unk); if(ttri->v1 >= zm->vert_count && errored < 10) { printf("Tri %d/%d (s %d) @0x%x: invalid v1: %d >= %d\n", i, zm->poly_count, skipped, (buffer-ter_orig), ttri->v1, zm->vert_count); From 9c6ba3164d01c0da9f72c22ef695eb3a10fa6ee7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1439/1883] Remove commented printf : Find Region %ld in node %ld\n --- utils/deprecated/azone2/awater.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/awater.cpp b/utils/deprecated/azone2/awater.cpp index 940c27596..f064c3782 100644 --- a/utils/deprecated/azone2/awater.cpp +++ b/utils/deprecated/azone2/awater.cpp @@ -271,7 +271,6 @@ long BSPCountNodes(BSP_Node *tree, long node_number) { long BSPFindRegion(BSP_Node *tree, long node_number, long region) { - //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { printf("Something went wrong\n"); exit(1); From 55cb66762c77f8f45934779e46e5d9806cfa5a01 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1440/1883] Remove commented printf : Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n --- utils/deprecated/azone2/azone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/azone.cpp b/utils/deprecated/azone2/azone.cpp index c49b89e26..6167a7352 100644 --- a/utils/deprecated/azone2/azone.cpp +++ b/utils/deprecated/azone2/azone.cpp @@ -447,7 +447,6 @@ void QTNode::fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long & head->miny = miny; head->maxy = maxy; head->flags = 0; -//printf("Node %u: (%.2f -> %.2f, %.2f -> %.2f)\n", hindex-1, head->minx, head->maxx, head->miny, head->maxy); if(final) { head->flags |= nodeFinal; head->faces.count = faces.size(); From 2e4fd5f983ee2d2bdff6ad2b1b70b1bc6f4705fd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1441/1883] Remove commented printf : Returning %s\n --- utils/deprecated/azone2/dat.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/dat.cpp b/utils/deprecated/azone2/dat.cpp index c89bd4d11..7fec482be 100644 --- a/utils/deprecated/azone2/dat.cpp +++ b/utils/deprecated/azone2/dat.cpp @@ -98,7 +98,6 @@ string GetToken(uchar *&Buffer, int &Position) ++Position; } ++Position; - //printf("Returning %s\n", Token.c_str()); return Token; } From 0fc5247279a1c125eda6429850745b2d45376b56 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:30 -0600 Subject: [PATCH 1442/1883] Remove commented printf : fnlen is %d, %s\n --- utils/deprecated/azone2/wld.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/wld.cpp b/utils/deprecated/azone2/wld.cpp index 45471738c..0c011ec17 100644 --- a/utils/deprecated/azone2/wld.cpp +++ b/utils/deprecated/azone2/wld.cpp @@ -34,7 +34,6 @@ FRAG_CONSTRUCTOR(Data03) { memcpy(tex->filenames[i], buf, fnlen); decode((uchar *) tex->filenames[i], fnlen); - //printf("fnlen is %d, %s\n", fnlen, tex->filenames[i]); // Derision: Not sure why this check is here, but need to check fnlen is >=18 if(fnlen>=18) { if(tex->filenames[i][fnlen - 8] == '.') From 072339d24c1e4354b2a95c7a4d7918c3ceea93a6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1443/1883] Remove commented printf : Opening %s.mod\n --- utils/deprecated/azone2/zonv4.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/zonv4.cpp b/utils/deprecated/azone2/zonv4.cpp index c2e0b32af..08964dd65 100644 --- a/utils/deprecated/azone2/zonv4.cpp +++ b/utils/deprecated/azone2/zonv4.cpp @@ -107,7 +107,6 @@ int Zonv4Loader::Open(char *base_path, char *zone_name, Archive *archive) for(unsigned int i = 0; i < this->datloader.model_data.ModelNames.size(); ++i) { char tmp[200]; - //printf("Opening %s.mod\n", this->datloader.model_data.ModelNames[i].c_str()); sprintf(tmp, "%s.mod", this->datloader.model_data.ModelNames[i].c_str()); char *str = tmp; From 6bf8c217ad2245001a5b12f702b5c51dab5ec1b3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1444/1883] Remove commented printf : --- utils/deprecated/ppconvert/ppconvert.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/ppconvert/ppconvert.cpp b/utils/deprecated/ppconvert/ppconvert.cpp index e8d2a85b9..f6250ab75 100644 --- a/utils/deprecated/ppconvert/ppconvert.cpp +++ b/utils/deprecated/ppconvert/ppconvert.cpp @@ -119,7 +119,6 @@ int main() { snprintf(bptr, 128, "' WHERE id=%lu", id); // printf("Query: '%s'\n", outbuffer); -//printf(outbuffer); //printf(";\n"); /* if(mysql_query(&out, outbuffer) != 0) { failed_count++; From 7c3502d5f202db1bc0f496b5526d4aa32df0c4ff Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1445/1883] Remove commented printf : --- utils/deprecated/ppskillfix/ppskillfix.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/ppskillfix/ppskillfix.cpp b/utils/deprecated/ppskillfix/ppskillfix.cpp index 758073c61..659877910 100644 --- a/utils/deprecated/ppskillfix/ppskillfix.cpp +++ b/utils/deprecated/ppskillfix/ppskillfix.cpp @@ -113,7 +113,6 @@ fprintf(stderr, "Char '%s' skill %d = %d\n", row[1], r, in_pp->skills[r]); snprintf(bptr, 128, "' WHERE id=%lu", id); // printf("Query: '%s'\n", outbuffer); -//printf(outbuffer); //printf(";\n"); /* if(mysql_query(&out, outbuffer) != 0) { failed_count++; From 2e763a77f7b3854a51beb826ed4e622293ccc5a2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1446/1883] Remove commented printf : ProcP %d: %p\n --- world/launcher_list.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 62657175a..6bd396f2c 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -57,7 +57,6 @@ void LauncherList::Process() { cur = m_pendingLaunchers.begin(); while(cur != m_pendingLaunchers.end()) { LauncherLink *l = *cur; -//printf("ProcP %d: %p\n", l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. Log.Out(Logs::Detail, Logs::World_Server, "Removing pending launcher %d", l->GetID()); From ce517f3bdcbb9d7f8b8602c441ab3cc545c5eb4e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1447/1883] Remove commented printf : Spawned Merc with ID %i\n --- zone/merc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 73990f139..5f85cde35 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4926,7 +4926,6 @@ bool Merc::Spawn(Client *owner) { //UpdateMercAppearance(); - //printf("Spawned Merc with ID %i\n", npc->GetID()); fflush(stdout); return true; } From afbc8b07652443c34d0c09a47bc0fceb605e2c34 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1448/1883] Remove commented printf : Spawning object %s at %f,%f,%f\n --- zone/object.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/object.cpp b/zone/object.cpp index 09988481e..07ff5858b 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -86,7 +86,6 @@ Object::Object(const ItemInst* inst, char* name,float max_x,float min_x,float ma // Set as much struct data as we can memset(&m_data, 0, sizeof(Object_Struct)); m_data.heading = heading; - //printf("Spawning object %s at %f,%f,%f\n",name,m_data.x,m_data.y,m_data.z); m_data.z = z; m_data.zone_id = zone->GetZoneID(); respawn_timer.Disable(); From ff9bc4e953109d9754d3d758a3c3a4ea2aac5127 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:33:31 -0600 Subject: [PATCH 1449/1883] Remove commented printf : NPC Spell casted on %s\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 30adb7f2f..14b959621 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1589,7 +1589,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] #endif // Npc if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard) { - //printf("NPC Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if (mob->IsAIControlled() && spells[spell_id].targettype == ST_AEBard) { From f73f764f2a0ad07bdf6aa748fd6aba7656bec997 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:36 -0600 Subject: [PATCH 1450/1883] Remove commented printf : Closed packet file.\n --- common/packetfile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/packetfile.cpp b/common/packetfile.cpp index e1ee8fa3a..5909afb57 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -262,7 +262,6 @@ void OldPacketFileReader::CloseFile() { if(in != NULL) { fclose(in); in = NULL; - //printf("Closed packet file.\n"); } } From 4c1227165c02ba6f26c068ae7f3069b18fd72863 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:36 -0600 Subject: [PATCH 1451/1883] Remove commented printf : Write @ %d(%d). %d bytes.\n --- common/SocketLib/MemFile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/SocketLib/MemFile.cpp b/common/SocketLib/MemFile.cpp index 5dee6717d..c621666e5 100644 --- a/common/SocketLib/MemFile.cpp +++ b/common/SocketLib/MemFile.cpp @@ -141,7 +141,6 @@ size_t MemFile::fwrite(const char *ptr, size_t size, size_t nmemb) size_t sz = size * nmemb; if (p + sz < BLOCKSIZE) { -//printf("Write @ %d(%d). %d bytes.\n", m_write_ptr, p, sz); memcpy(m_current_write -> data + p, ptr, sz); m_write_ptr += sz; } From b1497cac56acf5bfa1dd94083b1b7944831b8e8b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:36 -0600 Subject: [PATCH 1452/1883] Remove commented printf : pos=%d/%d\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index 28d023e2b..d0db74062 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -198,7 +198,6 @@ RESTART_WP_REDUCE: //we are removing the second one wp_reduce_count++; - //printf("pos=%d/%d\n", pos, g->nodes.size()); //printf("trail = 0x%x(0x%x) (%.3f, %.3f, %.3f)\n", // *trail, second, (*trail)->x, (*trail)->y, (*trail)->z); //trail = cur2; From 880b1e7a0d97be3f14ee4d782cb44773f266e8fe Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:36 -0600 Subject: [PATCH 1453/1883] Remove commented printf : Node %d's longest path is %d\n --- utils/deprecated/apathing/boostcrap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/boostcrap.cpp b/utils/deprecated/apathing/boostcrap.cpp index 2df78b934..4e15dcdd6 100644 --- a/utils/deprecated/apathing/boostcrap.cpp +++ b/utils/deprecated/apathing/boostcrap.cpp @@ -456,7 +456,6 @@ void calc_path_lengths(Map *map, MyGraph &vg, PathGraph *big, mapnode_id]; //n->longest_path = longest; -//printf("Node %d's longest path is %d\n", n->node_id, longest); if(longest < shortest) { shortest = longest; From 34f1df11635c5c7f2dd23b9f141f5055f015489c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1454/1883] Remove commented printf : Final node with %u nodes, list offset %lu.\n --- utils/deprecated/apathing/quadtree.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/quadtree.cpp b/utils/deprecated/apathing/quadtree.cpp index 829c5e638..d3ac5968c 100644 --- a/utils/deprecated/apathing/quadtree.cpp +++ b/utils/deprecated/apathing/quadtree.cpp @@ -90,7 +90,6 @@ void QTNode::fillBlocks(PathTree_Struct *heads, PathPointRef *flist, unsigned lo //rearranged to give all QT nodes a node list head->nodelist.count = nodes.size(); head->nodelist.offset = findex; -//printf(" Final node with %u nodes, list offset %lu.\n", head->nodes.count, head->nodes.offset); list::iterator curs,end; curs = nodes.begin(); end = nodes.end(); From 8594d3d550da3342d55584af059fa448f4f25c01 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1455/1883] Remove commented printf : Find Region %ld in node %ld\n --- utils/deprecated/azone/awater.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/awater.cpp b/utils/deprecated/azone/awater.cpp index 1e25fc155..55f05a352 100644 --- a/utils/deprecated/azone/awater.cpp +++ b/utils/deprecated/azone/awater.cpp @@ -328,7 +328,6 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type) { - //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { printf("Something went wrong\n"); exit(1); From 562f7c136058593e6d64fa97d016384a227a500b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1456/1883] Remove commented printf : Final node with %u faces, list offset %lu.\n --- utils/deprecated/azone/azone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/azone.cpp b/utils/deprecated/azone/azone.cpp index 2c384482d..14176b4dc 100644 --- a/utils/deprecated/azone/azone.cpp +++ b/utils/deprecated/azone/azone.cpp @@ -588,7 +588,6 @@ void QTNode::fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long & head->flags |= nodeFinal; head->faces.count = faces.size(); head->faces.offset = findex; -//printf(" Final node with %u faces, list offset %lu.\n", head->faces.count, head->faces.offset); unsigned long r; for(r = 0; r < head->faces.count; r++) { flist[findex] = faces[r].index; From 6ba30c3fb2c2dc1341b246e90dfe8d5eb3851d68 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1457/1883] Remove commented printf : Look for %s: got %s\n --- utils/deprecated/azone/pfs.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone/pfs.cpp b/utils/deprecated/azone/pfs.cpp index 5ce56ae3b..a04cb90a5 100644 --- a/utils/deprecated/azone/pfs.cpp +++ b/utils/deprecated/azone/pfs.cpp @@ -196,7 +196,6 @@ int PFSLoader::GetFile(char *name, uchar **buf, int *len) { Lower(name); for(i = 0; i < this->count; ++i) { -//printf("Look for %s: got %s\n", name, this->filenames[i]); if(!strcmp(this->filenames[i], name)) { fseek(this->fp, this->files[i], SEEK_SET); fread(&s3d_dir, sizeof(struct_directory), 1, this->fp); From db4426c435a99c5cdf888e54a721132b0c4aea6d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1458/1883] Remove commented printf : Find Region %ld in node %ld\n --- utils/deprecated/azone2/awater.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/awater.cpp b/utils/deprecated/azone2/awater.cpp index f064c3782..8573e5b72 100644 --- a/utils/deprecated/azone2/awater.cpp +++ b/utils/deprecated/azone2/awater.cpp @@ -342,7 +342,6 @@ long BSPFindNode(BSP_Node *tree, long node_number, float x, float y, float z) { long BSPMarkRegion(BSP_Node *tree, long node_number, long region, int region_type) { - //printf("Find Region %ld in node %ld\n", region, node_number); if(node_number<1) { printf("Something went wrong\n"); exit(1); From 965f8bbbbaa2c7d40b1b90d7d469007e07dffd27 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1459/1883] Remove commented printf : Final node with %u faces, list offset %lu.\n --- utils/deprecated/azone2/azone.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/azone.cpp b/utils/deprecated/azone2/azone.cpp index 6167a7352..81a143ba2 100644 --- a/utils/deprecated/azone2/azone.cpp +++ b/utils/deprecated/azone2/azone.cpp @@ -451,7 +451,6 @@ void QTNode::fillBlocks(nodeHeader *heads, unsigned long *flist, unsigned long & head->flags |= nodeFinal; head->faces.count = faces.size(); head->faces.offset = findex; -//printf(" Final node with %u faces, list offset %lu.\n", head->faces.count, head->faces.offset); unsigned long r; for(r = 0; r < head->faces.count; r++) { flist[findex] = faces[r].index; From 53b866d35c9d8eb50e03bd2e565cc2ebe607edc5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1460/1883] Remove commented printf : Frag 36 reference?: %ld\n --- utils/deprecated/azone2/wld.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/azone2/wld.cpp b/utils/deprecated/azone2/wld.cpp index 0c011ec17..d4dbcf25b 100644 --- a/utils/deprecated/azone2/wld.cpp +++ b/utils/deprecated/azone2/wld.cpp @@ -187,7 +187,6 @@ FRAG_CONSTRUCTOR(Data22) { long Frag36Ref; if(data->flags==0x181) { Frag36Ref = *((long *) (data6area+20)); - //printf("Frag 36 reference?: %ld\n", *((long *) (data6area+20))); } From 5553c874ecbb503fdc4a9da113898d86e5a99e34 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:37 -0600 Subject: [PATCH 1461/1883] Remove commented printf : ;\n --- utils/deprecated/ppconvert/ppconvert.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/ppconvert/ppconvert.cpp b/utils/deprecated/ppconvert/ppconvert.cpp index f6250ab75..716ddd753 100644 --- a/utils/deprecated/ppconvert/ppconvert.cpp +++ b/utils/deprecated/ppconvert/ppconvert.cpp @@ -119,7 +119,6 @@ int main() { snprintf(bptr, 128, "' WHERE id=%lu", id); // printf("Query: '%s'\n", outbuffer); -//printf(";\n"); /* if(mysql_query(&out, outbuffer) != 0) { failed_count++; printf(" Error updating char id %lu: %s\n", id, mysql_error(&m)); From 63496fd33c3cfb9da8a3c39b37086e82a5243ace Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:38 -0600 Subject: [PATCH 1462/1883] Remove commented printf : ;\n --- utils/deprecated/ppskillfix/ppskillfix.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/ppskillfix/ppskillfix.cpp b/utils/deprecated/ppskillfix/ppskillfix.cpp index 659877910..f2c7c1474 100644 --- a/utils/deprecated/ppskillfix/ppskillfix.cpp +++ b/utils/deprecated/ppskillfix/ppskillfix.cpp @@ -113,7 +113,6 @@ fprintf(stderr, "Char '%s' skill %d = %d\n", row[1], r, in_pp->skills[r]); snprintf(bptr, 128, "' WHERE id=%lu", id); // printf("Query: '%s'\n", outbuffer); -//printf(";\n"); /* if(mysql_query(&out, outbuffer) != 0) { failed_count++; printf(" Error updating char id %lu: %s\n", id, mysql_error(&m)); From b31c8c7a8fe5e39b51e12789051871b2df53424a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:38 -0600 Subject: [PATCH 1463/1883] Remove commented printf : Proc %s(%d): %p\n --- world/launcher_list.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/launcher_list.cpp b/world/launcher_list.cpp index 6bd396f2c..b66f7a600 100644 --- a/world/launcher_list.cpp +++ b/world/launcher_list.cpp @@ -87,7 +87,6 @@ void LauncherList::Process() { curl = m_launchers.begin(); while(curl != m_launchers.end()) { LauncherLink *l = curl->second; -//printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l); if(!l->Process()) { //launcher has died before it identified itself. Log.Out(Logs::Detail, Logs::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID()); From 245351e3515d715057a062678882c7655060ec81 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:38 -0600 Subject: [PATCH 1464/1883] Remove commented printf : NPC mgb/aebard spell casted on %s\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 14b959621..7385c3bc1 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1592,7 +1592,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] caster->SpellOnTarget(spell_id, mob); } else if (mob->IsAIControlled() && spells[spell_id].targettype == ST_AEBard) { - //printf("NPC mgb/aebard spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else { From b746385e4575e9a5a80dae5fbea818a7efa391f9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:40 -0600 Subject: [PATCH 1465/1883] Remove commented printf : Opening packet file: %s\n --- common/packetfile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/packetfile.cpp b/common/packetfile.cpp index 5909afb57..d8900c26e 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -332,7 +332,6 @@ NewPacketFileReader::~NewPacketFileReader() { bool NewPacketFileReader::OpenFile(const char *name) { CloseFile(); - //printf("Opening packet file: %s\n", name); in = fopen(name, "rb"); if(in == NULL) { From 767781bd0a45ba47d514f1098e45c7acefedd81a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:40 -0600 Subject: [PATCH 1466/1883] Remove commented printf : trail = 0x%x(0x%x) (%.3f, %.3f, %.3f)\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index d0db74062..da17a84bf 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -198,7 +198,6 @@ RESTART_WP_REDUCE: //we are removing the second one wp_reduce_count++; - //printf("trail = 0x%x(0x%x) (%.3f, %.3f, %.3f)\n", // *trail, second, (*trail)->x, (*trail)->y, (*trail)->z); //trail = cur2; From 236e3e0d7297536e90db957c3d1bbe21aa35ef96 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:40 -0600 Subject: [PATCH 1467/1883] Remove commented printf : Node %d's distance from root is %d\n --- utils/deprecated/apathing/boostcrap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/boostcrap.cpp b/utils/deprecated/apathing/boostcrap.cpp index 4e15dcdd6..24b18e5d4 100644 --- a/utils/deprecated/apathing/boostcrap.cpp +++ b/utils/deprecated/apathing/boostcrap.cpp @@ -474,7 +474,6 @@ printf("The tree's root is %d\n", shortest_node); n->longest_path = 0; else n->longest_path = root_dists[n->node_id]; -//printf("Node %d's distance from root is %d\n", n->node_id, root_dists[n->node_id]); } From 04bd05162cc35fb5c433f8e913e61481111790b9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:40 -0600 Subject: [PATCH 1468/1883] Remove commented printf : Got to node index %d (0x%x)\n --- utils/deprecated/apathing/quadtree.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/quadtree.cpp b/utils/deprecated/apathing/quadtree.cpp index d3ac5968c..9dff015eb 100644 --- a/utils/deprecated/apathing/quadtree.cpp +++ b/utils/deprecated/apathing/quadtree.cpp @@ -94,7 +94,6 @@ void QTNode::fillBlocks(PathTree_Struct *heads, PathPointRef *flist, unsigned lo curs = nodes.begin(); end = nodes.end(); for(; curs != end; curs++) { -//printf("Got to node index %d (0x%x)\n", findex, *curs); PathNode *cur = *curs; flist[findex] = cur->node_id; findex++; From 138436f46d72f704da5576ff1982e56fc0b03aef Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:40 -0600 Subject: [PATCH 1469/1883] Remove commented printf : NPC AE, fall thru. spell_id:%i, Target type:%x\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 7385c3bc1..7f9d6634d 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1595,7 +1595,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] caster->SpellOnTarget(spell_id, mob); } else { - //printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); } } #ifdef IPC From 29a19b8f9e99a4980065380355feb27426c4967b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:42 -0600 Subject: [PATCH 1470/1883] Remove commented printf : Closed packet file.\n --- common/packetfile.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/packetfile.cpp b/common/packetfile.cpp index d8900c26e..5885382ff 100644 --- a/common/packetfile.cpp +++ b/common/packetfile.cpp @@ -373,7 +373,6 @@ void NewPacketFileReader::CloseFile() { if(in != NULL) { fclose(in); in = NULL; - //printf("Closed packet file.\n"); } } From d5401b41deb57a9a105c22413c2ebc9645c348dd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:42 -0600 Subject: [PATCH 1471/1883] Remove commented printf : Cut (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) d2=%.3f\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index da17a84bf..c7ab07404 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -274,7 +274,6 @@ void break_long_lines(list &db_paths) { if(len2 < cutlen2) continue; -//printf("Cut (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) d2=%.3f\n", e->from->x, e->from->y, e->from->z, e->to->x, e->to->y, e->to->z, len2); float len = sqrt(len2); v1.x = (e->to->x - e->from->x)/len; From e7cfaf8baec8fc589ce1a18e319c0043dc6f59e3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:42 -0600 Subject: [PATCH 1472/1883] Remove commented printf : IIN: (%.3f,%.3f) in (%.3f -> %.3f, %.3f -> %.3f)\n --- utils/deprecated/apathing/quadtree.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/quadtree.cpp b/utils/deprecated/apathing/quadtree.cpp index 9dff015eb..0729e1713 100644 --- a/utils/deprecated/apathing/quadtree.cpp +++ b/utils/deprecated/apathing/quadtree.cpp @@ -280,7 +280,6 @@ void QTNode::buildVertexes() { } bool QTNode::IsInNode(const QTNode *n, const PathNode *o) { -//printf("IIN: (%.3f,%.3f) in (%.3f -> %.3f, %.3f -> %.3f)\n", o->x, o->y, n->minx, n->maxx, n->miny, n->maxy); if( o->x >= n->minx && o->x < n->maxx && o->y >= n->miny && o->y < n->maxy ) return(true); From bbbb63ecf5eff40e50bbf8928ff731719c053354 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:43 -0600 Subject: [PATCH 1473/1883] Remove commented printf : IPC Spell casted on %s\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 7f9d6634d..676321442 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1601,7 +1601,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else if(caster->IsNPC() && caster->CastToNPC()->IsInteractive()) { // Interactive npc if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard && spells[spell_id].targettype != ST_GroupTeleport) { - //printf("IPC Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if (!mob->IsAIControlled() && (spells[spell_id].targettype == ST_AEBard||group) && mob->CastToClient()->GetPVP() == caster->CastToClient()->GetPVP()) { From 40453f605dcffb274a26fefc74353382fd6d8abb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:44 -0600 Subject: [PATCH 1474/1883] Remove commented printf : (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) d2=%.3f\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index c7ab07404..a65026332 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -293,7 +293,6 @@ void break_long_lines(list &db_paths) { ee = new PathEdge(last_node, n); last_node = n; -//printf(" (%.3f,%.3f,%.3f) -> (%.3f,%.3f,%.3f) d2=%.3f\n", ee->from->x, ee->from->y, ee->from->z, ee->to->x, ee->to->y, ee->to->z, e->from->Dist2(e->to)); g->edges.push_back(ee); g->nodes.push_back(n); From d5cdfdc33c8553d66897821f74daadd4c5609e8d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:44 -0600 Subject: [PATCH 1475/1883] Remove commented printf : IPC mgb/aebard spell casted on %s\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 676321442..a0366e95c 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1608,7 +1608,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] iterator.Advance(); continue; } - //printf("IPC mgb/aebard spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else { From 725a2d29a27c697bd6ebe4efeff2126cb7dcc6c6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:46 -0600 Subject: [PATCH 1476/1883] Remove commented printf : Starting clean at pos %d with %d nodes\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index a65026332..f9f0ed589 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -962,7 +962,6 @@ run an algorithm to remove redundancy: RESTART_GRID_CLEAN: cur = big->nodes.begin(); end = big->nodes.end(); -//printf("Starting clean at pos %d with %d nodes\n", cur_pos, big->nodes.size()); for(r = 0; r < cur_pos; r++) cur++; for(; cur != end; cur++, cur_pos++, stat++) { From 146d7d46a9a9ef5062a79d8a1ecde79293d4c3cf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:46 -0600 Subject: [PATCH 1477/1883] Remove commented printf : NPC AE, fall thru. spell_id:%i, Target type:%x\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index a0366e95c..1c351c145 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1611,7 +1611,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] caster->SpellOnTarget(spell_id, mob); } else { - //printf("NPC AE, fall thru. spell_id:%i, Target type:%x\n", spell_id, spells[spell_id].targettype); } } #endif From bc84e4e80e10ea1b665f5c25435fffa0be1559f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:48 -0600 Subject: [PATCH 1478/1883] Remove commented printf : Dist %f, ce2 %f\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index f9f0ed589..de344870b 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -983,7 +983,6 @@ RESTART_GRID_CLEAN: if(n == f) continue; if(n->Dist2(f) > ce2) { -//printf("Dist %f, ce2 %f\n", n->Dist2(f), ce2); continue; } //printf("Distbbb %f, ce2 %f, (%f,%f), (%f,%f)\n", n->Dist2(f), ce2, n->x, n->y, f->x, f->y); From 69c4bc0dbd70235f9330c03178afaf4401a0a579 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:48 -0600 Subject: [PATCH 1479/1883] Remove commented printf : Client Spell casted on %s\n --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index 1c351c145..f6b434cc9 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1617,7 +1617,6 @@ Message(0, "Disc packet id=%d, %x,%x,%x", disc_in->disc_id, disc_in->unknown3[0] else if (caster->IsClient() && !(caster->CastToClient()->IsBecomeNPC())) { // Client if (caster->IsAttackAllowed(mob) && spells[spell_id].targettype != ST_AEBard){ - //printf("Client Spell casted on %s\n", mob->GetName()); caster->SpellOnTarget(spell_id, mob); } else if(spells[spell_id].targettype == ST_GroupTeleport && mob->IsClient() && mob->isgrouped && caster->isgrouped && entity_list.GetGroupByMob(caster)) From ed4f2c7e147f013b2427d2578c3817703ecf61e1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:49 -0600 Subject: [PATCH 1480/1883] Remove commented printf : Distbbb %f, ce2 %f, (%f,%f), (%f,%f)\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index de344870b..f363c4a4b 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -985,7 +985,6 @@ RESTART_GRID_CLEAN: if(n->Dist2(f) > ce2) { continue; } -//printf("Distbbb %f, ce2 %f, (%f,%f), (%f,%f)\n", n->Dist2(f), ce2, n->x, n->y, f->x, f->y); #ifdef COMBINE_CHECK_ALL_LOS //we should merge these. Now we wanna check to make sure combining From f8300693b446efa1d190d27114a18fd0f9a620f4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:50 -0600 Subject: [PATCH 1481/1883] Remove commented printf : Adding item2: %i --- zone/oldcode.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/oldcode.cpp b/zone/oldcode.cpp index f6b434cc9..075923360 100644 --- a/zone/oldcode.cpp +++ b/zone/oldcode.cpp @@ -1798,7 +1798,6 @@ void ZoneDatabase::AddLootDropToNPC(uint32 lootdrop_id, ItemList* itemlist) { } else { - //printf("Adding item2: %i",item->item_id); //cout << "Adding item to Mob" << endl; ServerLootItem_Struct* item = new ServerLootItem_Struct; item->item_id = dbitem->ItemNumber; From e4025545fe1fe01104a48b87c70a7fac95202e20 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:51 -0600 Subject: [PATCH 1482/1883] Remove commented printf : Checking combine LOS on %d, with %d edges.\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index f363c4a4b..1bfeab406 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -990,7 +990,6 @@ RESTART_GRID_CLEAN: //we should merge these. Now we wanna check to make sure combining //them will not cause the old node's edges to become invalid. -//printf("Checking combine LOS on %d, with %d edges.\n", r, big->edges.size()); badlos = false; if(node_edges.count(f) == 1) { From 6243a53e5c1111dc1172367f0b268a45886e54e5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:53 -0600 Subject: [PATCH 1483/1883] Remove commented printf : Edge crosses %d edges.\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index 1bfeab406..f865ff147 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1609,7 +1609,6 @@ void count_crossing_lines(list &edges, PathGraph *out, PathGraph *ex if(count >= CROSS_REDUCE_COUNT) { -//printf("Edge crosses %d edges.\n", count); out->edges.push_back(e); cross_edge_count++; cross_list[e] = hits; From 33a840a0e71a46b1ac588dc5cf5f1c4c1b15bb72 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:58 -0600 Subject: [PATCH 1484/1883] Remove commented printf : Started With node index %d (0x%x)\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index f865ff147..fdf56048e 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1837,7 +1837,6 @@ QTNode *build_quadtree(Map *map, PathGraph *big) { end = _root->nodes.end(); //int findex = 0; for(; curs != end; curs++) { -//printf("Started With node index %d (0x%x)\n", findex++, *curs); } _root->divideYourself(0); From 2ccfc5b52df221c998059db83e33ca1d9c096348 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:34:59 -0600 Subject: [PATCH 1485/1883] Remove commented printf : Filling node %d/%d n=0x%x, lb=0x%x, curl=0x%x/0x%x\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index fdf56048e..d3d904a95 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1904,7 +1904,6 @@ bool write_path_file(QTNode *_root, PathGraph *big, const char *file, vector< ve end = big->nodes.end(); int nn = 0; for(; cur != end; cur++, curn++, nn++) { -//printf("Filling node %d/%d n=0x%x, lb=0x%x, curl=0x%x/0x%x\n", nn, index, *cur, linkBlock, curl, &linkBlock[eoffset]); n = *cur; if(n == NULL) { printf("Got NULL node building quadtree, WTF."); From dc44c1c361411774fb7ef655d9174a33d68e2d5a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:35:01 -0600 Subject: [PATCH 1486/1883] Remove commented printf : Node %d: (%.2f,%.2f,%.2f) LO %d, D %d\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index d3d904a95..c25185318 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1914,7 +1914,6 @@ int nn = 0; curn->z = n->z; curn->link_offset = eoffset; curn->distance = n->longest_path; -//printf("Node %d: (%.2f,%.2f,%.2f) LO %d, D %d\n", nn, curn->x, curn->y, curn->z, curn->link_offset, curn->distance); int ecount = 0; cur4 = big->edges.begin(); From 5dfb66bd6337836a407d0a40d84e1b3243503f48 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:35:02 -0600 Subject: [PATCH 1487/1883] Remove commented printf : \tLinkFrom %d: dest %d, reach %d\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index c25185318..b7963274e 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1926,7 +1926,6 @@ int nn = 0; curl = &linkBlock[eoffset]; curl->dest_node = e->to->node_id; curl->reach = e->normal_reach; -//printf("\tLinkFrom %d: dest %d, reach %d\n", eoffset, curl->dest_node, curl->reach); from_edges[e] = ecount; ecount++; eoffset++; From 9ed412e0569a0f12b5301768032ebf6c80779ba1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:35:03 -0600 Subject: [PATCH 1488/1883] Remove commented printf : \tLinkTo %d: dest %d, reach %d\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index b7963274e..fc4dc0175 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1934,7 +1934,6 @@ int nn = 0; curl = &linkBlock[eoffset]; curl->dest_node = e->from->node_id; curl->reach = e->reverse_reach; -//printf("\tLinkTo %d: dest %d, reach %d\n", eoffset, curl->dest_node, curl->reach); to_edges[e] = ecount; ecount++; eoffset++; From d566bb472842c5ae1ea1e8594aec308c728623ae Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:35:04 -0600 Subject: [PATCH 1489/1883] Remove commented printf : Used up to slot %d of %d in links\n --- utils/deprecated/apathing/actions.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/deprecated/apathing/actions.cpp b/utils/deprecated/apathing/actions.cpp index fc4dc0175..d48fc6e88 100644 --- a/utils/deprecated/apathing/actions.cpp +++ b/utils/deprecated/apathing/actions.cpp @@ -1944,7 +1944,6 @@ int nn = 0; printf("ERROR: a node has more than %d links, number will be truncated!", PATH_LINK_OFFSET_NONE-1); } curn->link_count = ecount; -//printf("Used up to slot %d of %d in links\n", eoffset, head.link_count); } //write vertexBlock From e271049fada5b05a52911871ddf823133d718a90 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:37:57 -0600 Subject: [PATCH 1490/1883] Remove Duplicative MySQL Error: Error in CreateLauncher query: %s --- common/database.cpp | 1 - common/shareddb.cpp | 1 - world/eql_config.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index e300bf586..52850658e 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -137,7 +137,6 @@ uint32 Database::CheckLogin(const char* name, const char* password, int16* oStat if (!results.Success()) { - std::cerr << "Error in CheckLogin query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index eec7dc0f5..14e43c6de 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -46,7 +46,6 @@ bool SharedDatabase::SetHideMe(uint32 account_id, uint8 hideme) std::string query = StringFormat("UPDATE account SET hideme = %i WHERE id = %i", hideme, account_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } diff --git a/world/eql_config.cpp b/world/eql_config.cpp index d8b60d209..b8ce0dddb 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -73,7 +73,6 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) { std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str()); return nullptr; } From 8ecbf7c4dc1f0b52d822883f3bcc8a5b39bf88f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:37:58 -0600 Subject: [PATCH 1491/1883] Remove Duplicative MySQL Error: Query failed: %s. --- zone/client.cpp | 1 - zone/client_packet.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 59e7f25ee..a0860e1c7 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3833,7 +3833,6 @@ void Client::KeyRingLoad() "WHERE char_id = '%i' ORDER BY item_id", character_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in Client::KeyRingLoad query '" << query << "' " << results.ErrorMessage() << std::endl; return; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6ecfae636..5a7d78fc1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6193,7 +6193,6 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) safe_delete_array(escSearchString); auto results = database.QueryDatabase(query); if (!results.Success()) { - Message(0, "Query failed: %s.", results.ErrorMessage().c_str()); return; } From 60d7b59ac8b6affe657ae1879b29709d2fbae330 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:37:58 -0600 Subject: [PATCH 1492/1883] Remove Duplicative MySQL Error: Unable to query zone flags: %s --- zone/command.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 47f5517ab..df07b69f0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -7384,7 +7384,6 @@ void command_flagedit(Client *c, const Seperator *sep) { "FROM zone WHERE flag_needed != ''"; auto results = database.QueryDatabase(query); if (!results.Success()) { - c->Message(13, "Unable to query zone flags: %s", results.ErrorMessage().c_str()); return; } From fb03e8c67d5166dc30d157affa5c8674991fb54d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:37:58 -0600 Subject: [PATCH 1493/1883] Remove Duplicative MySQL Error: Error querying database for monster summoning pet in zone %s (%s) --- zone/doors.cpp | 1 - zone/forage.cpp | 1 - zone/mob_ai.cpp | 1 - zone/object.cpp | 1 - zone/pets.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 76ecb53fc..66ac4bf16 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -578,7 +578,6 @@ int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 v zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetDoorsCount query '" << query << "' " << results.ErrorMessage() << std::endl; return -1; } diff --git a/zone/forage.cpp b/zone/forage.cpp index 3fe61f9d1..5b407c0f5 100644 --- a/zone/forage.cpp +++ b/zone/forage.cpp @@ -114,7 +114,6 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, ZoneID, skill); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in Fishing query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 67b8d4480..e46f10ff6 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2680,7 +2680,6 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) { "idle_b_chance FROM npc_spells WHERE id=%d", iDBSpellsID); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << results.ErrorMessage() << std::endl; return nullptr; } diff --git a/zone/object.cpp b/zone/object.cpp index 07ff5858b..f1fd818aa 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -653,7 +653,6 @@ Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Gro "LIMIT 50", zone_id, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in LoadGroundSpawns query '" << query << "' " << results.ErrorMessage() << std::endl; return gs; } diff --git a/zone/pets.cpp b/zone/pets.cpp index 22fa379ce..04878bfd6 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -372,7 +372,6 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, auto results = database.QueryDatabase(query); if (!results.Success()) { // if the database query failed - Log.Out(Logs::General, Logs::Error, "Error querying database for monster summoning pet in zone %s (%s)", zone->GetShortName(), results.ErrorMessage().c_str()); } if (results.RowCount() != 0) { From ef312b7b48cd4383a369a6721943fb72b257b4bb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:38:43 -0600 Subject: [PATCH 1494/1883] Remove Duplicative MySQL Error: --- common/database.cpp | 1 - common/shareddb.cpp | 1 - world/eql_config.cpp | 1 - zone/zone.cpp | 1 - zone/zonedb.cpp | 1 - 5 files changed, 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 52850658e..d933e3ee4 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -162,7 +162,6 @@ bool Database::CheckBannedIPs(const char* loginIP) if (!results.Success()) { - std::cerr << "Error in CheckBannedIPs query '" << query << "' " << results.ErrorMessage() << std::endl; return true; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 14e43c6de..53e6d2306 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -57,7 +57,6 @@ uint8 SharedDatabase::GetGMSpeed(uint32 account_id) std::string query = StringFormat("SELECT gmspeed FROM account WHERE id = '%i'", account_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } diff --git a/world/eql_config.cpp b/world/eql_config.cpp index b8ce0dddb..0d9858908 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -117,7 +117,6 @@ void EQLConfig::DeleteLauncher() { std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str()); return; } diff --git a/zone/zone.cpp b/zone/zone.cpp index 8d42c2ad6..2f7e00522 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1643,7 +1643,6 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList* zone_point_list, "ORDER BY number", zonename, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error1 in LoadStaticZonePoints query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index e2e6689b0..845e5333c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -271,7 +271,6 @@ bool ZoneDatabase::logevents(const char* accountname,uint32 accountid,uint8 stat safe_delete_array(targetarr); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in logevents" << query << "' " << results.ErrorMessage() << std::endl; return false; } From c82ada6dc403f32b855360d5e9540c5f4afde442 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:38:43 -0600 Subject: [PATCH 1495/1883] Remove Duplicative MySQL Error: --- zone/client.cpp | 1 - zone/command.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index a0860e1c7..0456bc36c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3853,7 +3853,6 @@ void Client::KeyRingAdd(uint32 item_id) std::string query = StringFormat("INSERT INTO keyring(char_id, item_id) VALUES(%i, %i)", character_id, item_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in Doors::HandleClick query '" << query << "' " << results.ErrorMessage() << std::endl; return; } diff --git a/zone/command.cpp b/zone/command.cpp index df07b69f0..59c738e49 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10130,7 +10130,6 @@ void command_mysql(Client *c, const Seperator *sep) std::replace(query.begin(), query.end(), '#', '%'); auto results = database.QueryDatabase(query); if (!results.Success()) { - c->Message(0, "Invalid query: '%s', '%s'", sep->arg[2], results.ErrorMessage().c_str()); return; } From 611e6e7d4e7c35715139bc9461e83dc821d7ae81 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:34 -0600 Subject: [PATCH 1496/1883] Remove Duplicative MySQL Error: Error in Database::AddBannedIP query ' --- common/database.cpp | 1 - zone/doors.cpp | 1 - zone/mob_ai.cpp | 1 - zone/zonedb.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index d933e3ee4..be4812881 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -175,7 +175,6 @@ bool Database::AddBannedIP(char* bannedIP, const char* notes) { std::string query = StringFormat("INSERT into Banned_IPs SET ip_address='%s', notes='%s'", bannedIP, notes); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in Database::AddBannedIP query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } return true; diff --git a/zone/doors.cpp b/zone/doors.cpp index 66ac4bf16..2f195da55 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -604,7 +604,6 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) { "WHERE zone = '%s' AND version = %u", zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << results.ErrorMessage() << std::endl; return -1; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e46f10ff6..5f83d3ecb 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2715,7 +2715,6 @@ DBnpcspells_Struct* ZoneDatabase::GetNPCSpells(uint32 iDBSpellsID) { if (!results.Success()) { - std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << results.ErrorMessage() << std::endl; return nullptr; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 845e5333c..2678b2ec4 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -318,7 +318,6 @@ void ZoneDatabase::UpdateBug(BugStruct* bug) { safe_delete_array(targettext); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in UpdateBug '" << query << "' " << results.ErrorMessage() << std::endl; } From 7a90d52e627feb6c71eebd034d700dd776063582 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:34 -0600 Subject: [PATCH 1497/1883] Remove Duplicative MySQL Error: Error in SetGMSpeed query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 53e6d2306..fb1f48345 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -73,7 +73,6 @@ bool SharedDatabase::SetGMSpeed(uint32 account_id, uint8 gmspeed) std::string query = StringFormat("UPDATE account SET gmspeed = %i WHERE id = %i", gmspeed, account_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetGMSpeed query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From cb78ee6ccd84141ceb83834ef0d842e8bae2a636 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:34 -0600 Subject: [PATCH 1498/1883] Remove Duplicative MySQL Error: Error in DeleteLauncher 2nd query: %s --- world/eql_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 0d9858908..1e499037c 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -123,7 +123,6 @@ void EQLConfig::DeleteLauncher() { query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str()); return; } } From 6decdb67883f54e6a106d4c8f161b9e2cb46b898 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:35 -0600 Subject: [PATCH 1499/1883] Remove Duplicative MySQL Error: Error in IsDiscovered query ' --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 0456bc36c..677c45b5a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3892,7 +3892,6 @@ bool Client::IsDiscovered(uint32 itemid) { std::string query = StringFormat("SELECT count(*) FROM discovered_items WHERE item_id = '%lu'", itemid); auto results = database.QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in IsDiscovered query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 71fee1ddb65512ff81a8712e34fc00bab7017d8d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:35 -0600 Subject: [PATCH 1500/1883] Remove Duplicative MySQL Error: Error in GetDoorsCountPlusOne query ' --- zone/doors.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 2f195da55..88c390e7d 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -627,7 +627,6 @@ int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) zone_name, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetDoorsCountPlusOne query '" << query << "' " << results.ErrorMessage() << std::endl; return -1; } From 0e229895ecdfb05ebd021d3dca939f6cb46606d9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:35 -0600 Subject: [PATCH 1501/1883] Remove Duplicative MySQL Error: Error in GetMaxNPCSpellsID query ' --- zone/mob_ai.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 5f83d3ecb..d16662e4c 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2771,7 +2771,6 @@ uint32 ZoneDatabase::GetMaxNPCSpellsID() { std::string query = "SELECT max(id) from npc_spells"; auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetMaxNPCSpellsID query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 38723fc4bfa1689f1abb0dfe6e9b898884970f1a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:35 -0600 Subject: [PATCH 1502/1883] Remove Duplicative MySQL Error: Error in UpdateBug ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 2678b2ec4..83335109c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -334,7 +334,6 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ safe_delete_array(bugtext); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in UpdateBug '" << query << "' " << results.ErrorMessage() << std::endl; } From f0197219ab74ad30022cf4ab861a068fe845e00d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:44 -0600 Subject: [PATCH 1503/1883] Remove Duplicative MySQL Error: Error in Log IP query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index be4812881..1a852f292 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -203,7 +203,6 @@ void Database::LoginIP(uint32 AccountID, const char* LoginIP) { std::string query = StringFormat("INSERT INTO account_ip SET accid=%i, ip='%s' ON DUPLICATE KEY UPDATE count=count+1, lastused=now()", AccountID, LoginIP); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in Log IP query '" << query << "' " << results.ErrorMessage() << std::endl; } int16 Database::CheckStatus(uint32 account_id) { From 487c53794c97f9eaee98af48381206eb80d966f1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:44 -0600 Subject: [PATCH 1504/1883] Remove Duplicative MySQL Error: Error in GetSharedPlatinum query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index fb1f48345..02a5da943 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -317,7 +317,6 @@ int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) std::string query = StringFormat("SELECT sharedplat FROM account WHERE id = '%i'", account_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetSharedPlatinum query '" << query << "' " << results.ErrorMessage().c_str() << std::endl; return false; } From bdc3834f5aeb57da7ec777f0eb3e9ac01df27b71 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:44 -0600 Subject: [PATCH 1505/1883] Remove Duplicative MySQL Error: Error in BootStaticZone query: %s --- world/eql_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 1e499037c..4ef8b25c7 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -170,7 +170,6 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) { "VALUES('%s', '%s', %d)", namebuf, zonebuf, port); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str()); return false; } From 7f76ee04b0629e1b647547bf3922749d872d1eb7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:44 -0600 Subject: [PATCH 1506/1883] Remove Duplicative MySQL Error: Error in LoadAccountFlags query ' --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 677c45b5a..e7dbc1aca 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7759,7 +7759,6 @@ void Client::LoadAccountFlags() account_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in LoadAccountFlags query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From be4f8196c673bfe3a8664991567ac7894b8b0cad Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:45 -0600 Subject: [PATCH 1507/1883] Remove Duplicative MySQL Error: Error in DBLoadDoors query ' --- zone/doors.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/doors.cpp b/zone/doors.cpp index 88c390e7d..6f218711e 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -654,7 +654,6 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name "ORDER BY doorid asc", zone_name, version); auto results = QueryDatabase(query); if (!results.Success()){ - std::cerr << "Error in DBLoadDoors query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 0313ab2ac216737289c5ee83d58fb754d884f680 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:45 -0600 Subject: [PATCH 1508/1883] Remove Duplicative MySQL Error: Error in AddNPCSpells query1 ' --- zone/mob_ai.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d16662e4c..d750e5d93 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2813,7 +2813,6 @@ DBnpcspellseffects_Struct* ZoneDatabase::GetNPCSpellsEffects(uint32 iDBSpellsEff std::string query = StringFormat("SELECT id, parent_list FROM npc_spells_effects WHERE id=%d", iDBSpellsEffectsID); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in AddNPCSpells query1 '" << query << "' " << results.ErrorMessage() << std::endl; return nullptr; } From 6dcbccc0b6f17645117240901f1812d69ec7346e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:45 -0600 Subject: [PATCH 1509/1883] Remove Duplicative MySQL Error: ERROR Bandolier Save: --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 83335109c..7d1951595 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1270,7 +1270,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); auto results = QueryDatabase(query); Log.Out(Logs::General, Logs::None, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name); - if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } From 3a3cc8a8f6d53b78842ede6202544d1cda71bb37 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:46 -0600 Subject: [PATCH 1510/1883] Remove Duplicative MySQL Error: Error in CheckStatus query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 1a852f292..a40e7c4af 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -211,7 +211,6 @@ int16 Database::CheckStatus(uint32 account_id) { auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in CheckStatus query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From f15221784ca917ebeef9f42e4cdd805f39147343 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:47 -0600 Subject: [PATCH 1511/1883] Remove Duplicative MySQL Error: Error in SetSharedPlatinum query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 02a5da943..ba22da768 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -332,7 +332,6 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { std::string query = StringFormat("UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetSharedPlatinum query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 9d89ad53deb4919e11ea45e91c7aa9dd692cc65e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:47 -0600 Subject: [PATCH 1512/1883] Remove Duplicative MySQL Error: Error in ChangeStaticZone query: %s --- world/eql_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 4ef8b25c7..dec569cf4 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -213,7 +213,6 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { "launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str()); return false; } From 04ed14f42495b321d5c4bd77fe4e850ef61d59f8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:47 -0600 Subject: [PATCH 1513/1883] Remove Duplicative MySQL Error: Error in SetAccountFlags query ' --- zone/client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index e7dbc1aca..cd58cfa7c 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7773,7 +7773,6 @@ void Client::SetAccountFlag(std::string flag, std::string val) { account_id, flag.c_str(), val.c_str()); auto results = database.QueryDatabase(query); if(!results.Success()) { - std::cerr << "Error in SetAccountFlags query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From 22feb20def60dbf1ea081f7693994f72c8825cbe Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:47 -0600 Subject: [PATCH 1514/1883] Remove Duplicative MySQL Error: Error in GetMaxNPCSpellsEffectsID query ' --- zone/mob_ai.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d750e5d93..146b33e41 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2856,7 +2856,6 @@ uint32 ZoneDatabase::GetMaxNPCSpellsEffectsID() { std::string query = "SELECT max(id) FROM npc_spells_effects"; auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetMaxNPCSpellsEffectsID query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From f1fd957e902c6e44fa347c4b6f063c6892cdbb13 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:47 -0600 Subject: [PATCH 1515/1883] Remove Duplicative MySQL Error: ERROR Potionbelt Save: --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7d1951595..2a923346e 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1276,7 +1276,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i 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); - if (!results.RowsAffected()){ std::cout << "ERROR Potionbelt Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } return true; } From 9dd35679e5c3304df0c552667592577ae4bb801a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:54 -0600 Subject: [PATCH 1516/1883] Remove Duplicative MySQL Error: Error in CreateAccount query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index a40e7c4af..0ddc5b41f 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -246,7 +246,6 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in CreateAccount query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 5f34f7e1a2318165f4b145a30691e3f35b1e02c8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:54 -0600 Subject: [PATCH 1517/1883] Remove Duplicative MySQL Error: Error in GetBook query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index ba22da768..8bdb97034 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1057,7 +1057,6 @@ std::string SharedDatabase::GetBook(const char *txtfile) std::string query = StringFormat("SELECT txtfile FROM books WHERE name = '%s'", txtfile2); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetBook query '" << query << "' " << results.ErrorMessage() << std::endl; txtout.assign(" ",1); return txtout; } From 00cfd77c2651f7e5ee8cedf25438e244d1eca3b6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:54 -0600 Subject: [PATCH 1518/1883] Remove Duplicative MySQL Error: Error in DeleteStaticZone query: %s --- world/eql_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/eql_config.cpp b/world/eql_config.cpp index dec569cf4..6d6e7e674 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -249,7 +249,6 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { "launcher = '%s' AND zone = '%s'", namebuf, zonebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str()); return false; } From c765003ef2266bec9884a1a75d2c3267c14551ca Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:54 -0600 Subject: [PATCH 1519/1883] Remove Duplicative MySQL Error: Error loading NPCs from database. Bad query: --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 2a923346e..8e69ba266 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1753,7 +1753,6 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error loading NPCs from database. Bad query: " << results.ErrorMessage() << std::endl; return nullptr; } From e2bc4ec647900957339c1e4f4b5b0bb978d5ed87 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:58 -0600 Subject: [PATCH 1520/1883] Remove Duplicative MySQL Error: Error in CreateAccount query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 0ddc5b41f..8085d28f7 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -251,7 +251,6 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta if (results.LastInsertedID() == 0) { - std::cerr << "Error in CreateAccount query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From a2514c9d6424dfeb533f9e7320e4ba60ecab0ab9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:58 -0600 Subject: [PATCH 1521/1883] Remove Duplicative MySQL Error: Error in GetCommands query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 8bdb97034..d30ad0754 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1294,7 +1294,6 @@ bool SharedDatabase::GetCommandSettings(std::map &commands) { const std::string query = "SELECT command, access FROM commands"; auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetCommands query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 8697b9a630f90fc2f599bce82fa796b52fd1e8c0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:58 -0600 Subject: [PATCH 1522/1883] Remove Duplicative MySQL Error: Error in SetDynamicCount query: %s --- world/eql_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 6d6e7e674..255f6d3a0 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -273,7 +273,6 @@ bool EQLConfig::SetDynamicCount(int count) { std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log.Out(Logs::General, Logs::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str()); return false; } From ca21aa70cfeb1ea5ffda78a6bef88028838a50db Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:41:58 -0600 Subject: [PATCH 1523/1883] Remove Duplicative MySQL Error: Error loading Mercenaries from database. Bad query: --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8e69ba266..8f607b438 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2015,7 +2015,6 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error loading Mercenaries from database. Bad query: " << results.ErrorMessage() << std::endl; return nullptr; } From 539f216ca62f794b2e16195e1e33bc19861ac765 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:02 -0600 Subject: [PATCH 1524/1883] Remove Duplicative MySQL Error: Error in DeleteAccount query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 8085d28f7..99b124e4b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -265,7 +265,6 @@ bool Database::DeleteAccount(const char* name) { if (!results.Success()) { - std::cerr << "Error in DeleteAccount query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From abab487d7e7482f80aa0b034f2e1d77b00053e1d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:02 -0600 Subject: [PATCH 1525/1883] Remove Duplicative MySQL Error: Error in GetBotInspectMessage query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index d30ad0754..bef8010e4 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1966,7 +1966,6 @@ void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* m std::string query = StringFormat("SELECT BotInspectMessage FROM bots WHERE BotID = %i", botid); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetBotInspectMessage query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From 396621e32e5f33637ec8142cbf768e922b6fe3db Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:02 -0600 Subject: [PATCH 1526/1883] Remove Duplicative MySQL Error: Error in GetGridType query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8f607b438..366a948ef 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2478,7 +2478,6 @@ uint8 ZoneDatabase::GetGridType(uint32 grid, uint32 zoneid ) { std::string query = StringFormat("SELECT type FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetGridType query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From efaff32153144b792704c790f322299ec9ddb189 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:04 -0600 Subject: [PATCH 1527/1883] Remove Duplicative MySQL Error: Error in SetLocalPassword query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 99b124e4b..be0ab477c 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -277,7 +277,6 @@ bool Database::SetLocalPassword(uint32 accid, const char* password) { auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetLocalPassword query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 590fa78539043b53b068fdd4ad8329ca18da757a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:04 -0600 Subject: [PATCH 1528/1883] Remove Duplicative MySQL Error: Error in SetBotInspectMessage query ' --- common/shareddb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index bef8010e4..3cdca5a23 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1983,6 +1983,5 @@ void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Str std::string query = StringFormat("UPDATE bots SET BotInspectMessage = '%s' WHERE BotID = %i", msg.c_str(), botid); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in SetBotInspectMessage query '" << query << "' " << results.ErrorMessage() << std::endl; } From 04754c67a79c2cb97f0e7ab0986505cd10c15c3c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:04 -0600 Subject: [PATCH 1529/1883] Remove Duplicative MySQL Error: Error in SaveMerchantTemp query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 366a948ef..ddaf9155d 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2495,7 +2495,6 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint "VALUES(%d, %d, %d, %d)", npcid, slot, item, charges); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in SaveMerchantTemp query '" << query << "' " << results.ErrorMessage() << std::endl; } void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ From 28506839c013a7b130c8e0e6bfdc4820d0dd7d5e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:05 -0600 Subject: [PATCH 1530/1883] Remove Duplicative MySQL Error: Error in GetAccountIDByChar query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index be0ab477c..6bc3f6445 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -767,7 +767,6 @@ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) { if (!results.Success()) { - std::cerr << "Error in GetAccountIDByChar query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From ffed0514d201d6c15624d00f8d9afde65e5296b2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:06 -0600 Subject: [PATCH 1531/1883] Remove Duplicative MySQL Error: Error in DeleteMerchantTemp query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ddaf9155d..85dcd52ca 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2502,7 +2502,6 @@ void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ std::string query = StringFormat("DELETE FROM merchantlist_temp WHERE npcid=%d AND slot=%d", npcid, slot); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in DeleteMerchantTemp query '" << query << "' " << results.ErrorMessage() << std::endl; } From 9f9253220c0d48ea568279919a3636fdd9e4e5a8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:07 -0600 Subject: [PATCH 1532/1883] Remove Duplicative MySQL Error: Error in GetAccountIDByAcc query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 6bc3f6445..b2a462be2 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -806,7 +806,6 @@ uint32 Database::GetAccountIDByName(const char* accname, int16* status, uint32* auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetAccountIDByAcc query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From d46ede8db11c3aee80818d567998a8f34b01bcd4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:07 -0600 Subject: [PATCH 1533/1883] Remove Duplicative MySQL Error: Error in GetUseCFGSafeCoords query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 85dcd52ca..66bcf8810 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2521,7 +2521,6 @@ uint8 ZoneDatabase::GetUseCFGSafeCoords() const std::string query = "SELECT value FROM variables WHERE varname='UseCFGSafeCoords'"; auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetUseCFGSafeCoords query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From c3233c02dbe2d3acf2ba6530c338649f2622ba9a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:08 -0600 Subject: [PATCH 1534/1883] Remove Duplicative MySQL Error: Error in GetAccountName query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index b2a462be2..a84d1b871 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -834,7 +834,6 @@ void Database::GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetAccountName query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From 9574e916698c6637a6a5e758b0cc7e0079c6a16e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:08 -0600 Subject: [PATCH 1535/1883] Remove Duplicative MySQL Error: Error in GetZoneTZ query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 66bcf8810..272ae54f3 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2540,7 +2540,6 @@ uint32 ZoneDatabase::GetZoneTZ(uint32 zoneid, uint32 version) { zoneid, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetZoneTZ query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 63682510a80e150105ec34a89e8e0be9ba5251f8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:09 -0600 Subject: [PATCH 1536/1883] Remove Duplicative MySQL Error: Error in GetCharName query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index a84d1b871..5106ffaef 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -854,7 +854,6 @@ void Database::GetCharName(uint32 char_id, char* name) { auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetCharName query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From 992f99303e3c396502e4c4c9f2bb0372b237cb3f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:09 -0600 Subject: [PATCH 1537/1883] Remove Duplicative MySQL Error: Error in SetZoneTZ query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 272ae54f3..7b07eef43 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2557,7 +2557,6 @@ bool ZoneDatabase::SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz) { tz, zoneid, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetZoneTZ query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 8160768fccc7451156ce0776a7b9d43cf17eb5f7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:11 -0600 Subject: [PATCH 1538/1883] Remove Duplicative MySQL Error: Error in LoadVariables query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 5106ffaef..b3ca2e475 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2410,7 +2410,6 @@ bool Database::LoadVariables() { if (!results.Success()) { - std::cerr << "Error in LoadVariables query '" << query << "' " << results.ErrorMessage() << std::endl; safe_delete_array(query); return false; } From 77a2737ad01cd8e989e8c75dfed52aa4e7722fac Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:11 -0600 Subject: [PATCH 1539/1883] Remove Duplicative MySQL Error: Error in group update query: %s\n --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7b07eef43..710fcffb9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2586,7 +2586,6 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){ auto results = QueryDatabase(query); if (!results.Success()) { - printf("Error in group update query: %s\n", results.ErrorMessage().c_str()); } else { From edbed7184f04fb8d41dfbcdf9d8419c43b06c851 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:12 -0600 Subject: [PATCH 1540/1883] Remove Duplicative MySQL Error: Error in SetVariable query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index b3ca2e475..a2929c240 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2521,7 +2521,6 @@ bool Database::SetVariable(const char* varname_in, const char* varvalue_in) { if (!results.Success()) { - std::cerr << "Error in SetVariable query '" << query << "' " << results.ErrorMessage() << std::endl; free(varname); free(varvalue); return false; From 94e63885fb4c8779ddcde79883f8d530d9312f39 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:12 -0600 Subject: [PATCH 1541/1883] Remove Duplicative MySQL Error: Error in GetBlockedSpellsCount query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 710fcffb9..8425e6772 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2657,7 +2657,6 @@ int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid) std::string query = StringFormat("SELECT count(*) FROM blocked_spells WHERE zoneid = %d", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetBlockedSpellsCount query '" << query << "' " << results.ErrorMessage() << std::endl; return -1; } From 4c3058b0d9b2555d4c2447d7c84299e3577a1d0b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:14 -0600 Subject: [PATCH 1542/1883] Remove Duplicative MySQL Error: Error in GetMiniLoginAccount query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index a2929c240..27b883091 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2553,7 +2553,6 @@ uint32 Database::GetMiniLoginAccount(char* ip){ if (!results.Success()) { - std::cerr << "Error in GetMiniLoginAccount query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 5aba5c84735b065be54d7ad1ab1c173d24767824 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:14 -0600 Subject: [PATCH 1543/1883] Remove Duplicative MySQL Error: Error in LoadBlockedSpells query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8425e6772..5f6ec3465 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2676,7 +2676,6 @@ bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked "FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in LoadBlockedSpells query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From d3f265116eb8180eeb7279c504b2d588ca8a2f77 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:15 -0600 Subject: [PATCH 1544/1883] Remove Duplicative MySQL Error: Error in GetSafePoint query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 27b883091..b8818ff5e 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2570,7 +2570,6 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe if (!results.Success()) { - std::cerr << "Error in GetSafePoint query '" << query << "' " << results.ErrorMessage() << std::endl; std::cerr << "If it errors, run the following querys:\n"; std::cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; std::cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; From 56dfc97517f0121a2a540b1eb7ef9ad9fd3e599c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:16 -0600 Subject: [PATCH 1545/1883] Remove Duplicative MySQL Error: Error in getZoneShutDownDelay query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 5f6ec3465..78e18ebdf 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2711,7 +2711,6 @@ int ZoneDatabase::getZoneShutDownDelay(uint32 zoneID, uint32 version) "ORDER BY version DESC", zoneID, version); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in getZoneShutDownDelay query '" << query << "' " << results.ErrorMessage().c_str() << std::endl; return (RuleI(Zone, AutoShutdownDelay)); } From 245db04c4cad08bb6165ea4b5f092a411e801522 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:18 -0600 Subject: [PATCH 1546/1883] Remove Duplicative MySQL Error: Error in GetZoneLongName query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index b8818ff5e..d64cc6d8d 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2604,7 +2604,6 @@ bool Database::GetZoneLongName(const char* short_name, char** long_name, char* f auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetZoneLongName query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 8f96f52c047b45f14e152c04feb5cc3e68f68673 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:18 -0600 Subject: [PATCH 1547/1883] Remove Duplicative MySQL Error: Error in UpdateKarma query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 78e18ebdf..7a39c7b95 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2741,7 +2741,6 @@ void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount) std::string query = StringFormat("UPDATE account SET karma = %i WHERE id = %i", amount, acct_id); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in UpdateKarma query '" << query << "' " << results.ErrorMessage().c_str() << std::endl; } From cb18d3d1b54ed0e0d070bdd57465c6c8610b4e70 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:19 -0600 Subject: [PATCH 1548/1883] Remove Duplicative MySQL Error: Error in GetZoneGraveyardID query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index d64cc6d8d..16b8f82e1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2643,7 +2643,6 @@ uint32 Database::GetZoneGraveyardID(uint32 zone_id, uint32 version) { if (!results.Success()) { - std::cerr << "Error in GetZoneGraveyardID query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From dbeef12a4f3374047d11cd211c28503703179fe5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:19 -0600 Subject: [PATCH 1549/1883] Remove Duplicative MySQL Error: Error in InsertDoor --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7a39c7b95..485a28c2a 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2786,7 +2786,6 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in InsertDoor" << query << "' " << results.ErrorMessage() << std::endl; } void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map ¤cy) { From 8e64a8b1c59606747121eccdb5d567744cf1e959 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:20 -0600 Subject: [PATCH 1550/1883] Remove Duplicative MySQL Error: Error in GetZoneGraveyard query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 16b8f82e1..edd27d0b3 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2659,7 +2659,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon auto results = QueryDatabase(query); if (!results.Success()){ - std::cerr << "Error in GetZoneGraveyard query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 2c36b9070eeacdd0326ce314f085d60fcc843154 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:20 -0600 Subject: [PATCH 1551/1883] Remove Duplicative MySQL Error: Error in RemoveTempFactions query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 485a28c2a..4a0ccc83c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3006,7 +3006,6 @@ void ZoneDatabase::RemoveTempFactions(Client *client) { client->CharacterID()); auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in RemoveTempFactions query '" << query << "' " << results.ErrorMessage() << std::endl; } From e127b01640bc6e41ade810136200a1543d44800c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:21 -0600 Subject: [PATCH 1552/1883] Remove Duplicative MySQL Error: Error in LoadZoneNames query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index edd27d0b3..4d2164e9a 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2688,7 +2688,6 @@ bool Database::LoadZoneNames() { if (!results.Success()) { - std::cerr << "Error in LoadZoneNames query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From f4fad223d084c1872c08bf3e64cef6e7ee07eead Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:22 -0600 Subject: [PATCH 1553/1883] Remove Duplicative MySQL Error: Error in SetCharacterFactionLevel query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 4a0ccc83c..185329e8b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3219,7 +3219,6 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in char_id, faction_id); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 78bbb9b03d2abd3934ccbaab252655aa9ed51bb9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:22 -0600 Subject: [PATCH 1554/1883] Remove Duplicative MySQL Error: Error in GetPEQZone query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 4d2164e9a..b2c67c14e 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2732,7 +2732,6 @@ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ if (!results.Success()) { - std::cerr << "Error in GetPEQZone query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From b4a6184c887a2b198b9c7d88591dc184f4a26f7b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:23 -0600 Subject: [PATCH 1555/1883] Remove Duplicative MySQL Error: Error in SetCharacterFactionLevel query ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 185329e8b..503ecdfc9 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3235,7 +3235,6 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in "VALUES (%i, %i, %i, %i)", char_id, faction_id, value, temp); results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetCharacterFactionLevel query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From a3dc49c50456045ffd983529cce99d0baaeeb23e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:24 -0600 Subject: [PATCH 1556/1883] Remove Duplicative MySQL Error: Error in CheckNameFilter query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index b2c67c14e..1760e5f78 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2802,7 +2802,6 @@ bool Database::CheckNameFilter(const char* name, bool surname) if (!results.Success()) { - std::cerr << "Error in CheckNameFilter query '" << query << "' " << results.ErrorMessage() << std::endl; // false through to true? shouldn't it be falls through to false? return true; } From c9ece3480c71aaba9d8e053a6a6a2d54d54b4a6a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:24 -0600 Subject: [PATCH 1557/1883] Remove Duplicative MySQL Error: Error in LoadFactionData ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 503ecdfc9..cc5ae2abc 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3250,7 +3250,6 @@ bool ZoneDatabase::LoadFactionData() std::string query = "SELECT MAX(id) FROM faction_list"; auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in LoadFactionData '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 8d7de051c54f2881419e144b0fe1a0146bead2b7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:25 -0600 Subject: [PATCH 1558/1883] Remove Duplicative MySQL Error: Error in AddToNameFilter query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 1760e5f78..fd75bfc48 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2827,7 +2827,6 @@ bool Database::AddToNameFilter(const char* name) { if (!results.Success()) { - std::cerr << "Error in AddToNameFilter query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 8186d43cad7e2c3f1679845399b25e0d5bf63036 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:25 -0600 Subject: [PATCH 1559/1883] Remove Duplicative MySQL Error: Error in LoadFactionData ' --- zone/zonedb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index cc5ae2abc..603194696 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3266,7 +3266,6 @@ bool ZoneDatabase::LoadFactionData() query = "SELECT id, name, base FROM faction_list"; results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in LoadFactionData '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From a269aa44090b26c8376104749d437ca0533e1f4c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:26 -0600 Subject: [PATCH 1560/1883] Remove Duplicative MySQL Error: Error in GetAccountIDFromLSID query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index fd75bfc48..03cba68fb 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2843,7 +2843,6 @@ uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* o if (!results.Success()) { - std::cerr << "Error in GetAccountIDFromLSID query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From a1895b9cb32477d56d3e2099b76ee3056e7e9528 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:28 -0600 Subject: [PATCH 1561/1883] Remove Duplicative MySQL Error: Error in GetAccountFromID query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 03cba68fb..bba2ab12b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2868,7 +2868,6 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { if (!results.Success()) { - std::cerr << "Error in GetAccountFromID query '" << query << "' " << results.ErrorMessage() << std::endl; return; } From 7b7ddb25fafd069c6e525a71a0567f1d17575c08 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:30 -0600 Subject: [PATCH 1562/1883] Remove Duplicative MySQL Error: Error in ClearMerchantTemp query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index bba2ab12b..4fa746ca3 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2888,7 +2888,6 @@ void Database::ClearMerchantTemp(){ auto results = QueryDatabase(query); if (!results.Success()) - std::cerr << "Error in ClearMerchantTemp query '" << query << "' " << results.ErrorMessage() << std::endl; } bool Database::UpdateName(const char* oldname, const char* newname) { From 11357f7e913da9df7178db964edf8bd2b40e6d0e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:31 -0600 Subject: [PATCH 1563/1883] Remove Duplicative MySQL Error: Error in CheckUsedName query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 4fa746ca3..a3453d224 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2909,7 +2909,6 @@ bool Database::CheckUsedName(const char* name) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in CheckUsedName query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 835c7d0fcea3cb2d7f8163e5f47c9989741067f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:32 -0600 Subject: [PATCH 1564/1883] Remove Duplicative MySQL Error: Error in GetServerType query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index a3453d224..43deacfb0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2922,7 +2922,6 @@ uint8 Database::GetServerType() { std::string query("SELECT `value` FROM `variables` WHERE `varname` = 'ServerType' LIMIT 1"); auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetServerType query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From c892bc4e2b0d079967e385b4cfa5e1f010022b23 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:33 -0600 Subject: [PATCH 1565/1883] Remove Duplicative MySQL Error: Error in MoveCharacterToZone(name) query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 43deacfb0..afe868ee2 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2940,7 +2940,6 @@ bool Database::MoveCharacterToZone(const char* charname, const char* zonename, u auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in MoveCharacterToZone(name) query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From de531af35417ed6e6071debc51c279bcb81fe9b4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:34 -0600 Subject: [PATCH 1566/1883] Remove Duplicative MySQL Error: Error in MoveCharacterToZone(id) query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index afe868ee2..fc4d64014 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2958,7 +2958,6 @@ bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) { auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in MoveCharacterToZone(id) query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 032de7f6ce06ec8d2f90e3227bb469d3a7c14979 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:35 -0600 Subject: [PATCH 1567/1883] Remove Duplicative MySQL Error: Error in SetHackerFlag query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index fc4d64014..572643715 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2969,7 +2969,6 @@ bool Database::SetHackerFlag(const char* accountname, const char* charactername, auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in SetHackerFlag query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 9cbe0d4b34020fb019ec453ececf876beea24678 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:36 -0600 Subject: [PATCH 1568/1883] Remove Duplicative MySQL Error: Error in SetMQDetectionFlag query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 572643715..a6ef4a1e9 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2982,7 +2982,6 @@ bool Database::SetMQDetectionFlag(const char* accountname, const char* character if (!results.Success()) { - std::cerr << "Error in SetMQDetectionFlag query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 78746a40facc2fa0bfc73ad8f69fbe8d651e22bf Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:39 -0600 Subject: [PATCH 1569/1883] Remove Duplicative MySQL Error: Error in GetCharacterInfo query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index a6ef4a1e9..26dcc75ea 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3061,7 +3061,6 @@ uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZo auto results = QueryDatabase(query); if (!results.Success()) { - std::cerr << "Error in GetCharacterInfo query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 3473e11376f4ad5b837772a172100cece667af8b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:40 -0600 Subject: [PATCH 1570/1883] Remove Duplicative MySQL Error: Error in UpdateLiveChar query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 26dcc75ea..e1dc19290 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3086,7 +3086,6 @@ bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) { if (!results.Success()) { - std::cerr << "Error in UpdateLiveChar query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 3156efae63c1f1843d48acddf34fdc11fc327d9a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:42 -0600 Subject: [PATCH 1571/1883] Remove Duplicative MySQL Error: Error in GetLiveChar query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index e1dc19290..461f158e6 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3099,7 +3099,6 @@ bool Database::GetLiveChar(uint32 account_id, char* cname) { if (!results.Success()) { - std::cerr << "Error in GetLiveChar query '" << query << "' " << results.ErrorMessage() << std::endl; return false; } From 48caf1e41398e3d3202e5b7e5a795f0aa6626dab Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:42:43 -0600 Subject: [PATCH 1572/1883] Remove Duplicative MySQL Error: Error in GetGuildIDByChar query ' --- common/database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/database.cpp b/common/database.cpp index 461f158e6..48a0377b3 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4199,7 +4199,6 @@ uint32 Database::GetGuildIDByCharID(uint32 char_id) if (!results.Success()) { - std::cerr << "Error in GetGuildIDByChar query '" << query << "' " << results.ErrorMessage() << std::endl; return 0; } From 5fa42ce90f1933e4dcf732e24485320fb78de389 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:46:06 -0600 Subject: [PATCH 1573/1883] Fix LoginIP from erorr message removal --- common/database.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 48a0377b3..f3dacc9f1 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -201,8 +201,7 @@ bool Database::AddGMIP(char* ip_address, char* name) { void Database::LoginIP(uint32 AccountID, const char* LoginIP) { std::string query = StringFormat("INSERT INTO account_ip SET accid=%i, ip='%s' ON DUPLICATE KEY UPDATE count=count+1, lastused=now()", AccountID, LoginIP); - auto results = QueryDatabase(query); - if (!results.Success()) + QueryDatabase(query); } int16 Database::CheckStatus(uint32 account_id) { From c86fc62132590fa22e10f4664ed4f5142d26c432 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:46:50 -0600 Subject: [PATCH 1574/1883] Fix SetBotInspectMesssage from error message removal --- common/shareddb.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 3cdca5a23..ddd792e6a 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1978,10 +1978,7 @@ void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* m } void SharedDatabase::SetBotInspectMessage(uint32 botid, const InspectMessage_Struct* message) { - std::string msg = EscapeString(message->text); std::string query = StringFormat("UPDATE bots SET BotInspectMessage = '%s' WHERE BotID = %i", msg.c_str(), botid); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } From 1c6a0f054a42c811c70000069a478c936c0889d1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:47:24 -0600 Subject: [PATCH 1575/1883] Fix UpdateBug from error message removal --- zone/zonedb.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 603194696..f613b4173 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -316,9 +316,7 @@ void ZoneDatabase::UpdateBug(BugStruct* bug) { safe_delete_array(bugtext); safe_delete_array(uitext); safe_delete_array(targettext); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ From b800dd04c67ce72aa04943c173fd236b7671e935 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:47:41 -0600 Subject: [PATCH 1576/1883] Fix UpdateBug from error message removal --- zone/zonedb.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index f613b4173..579d80bac 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -330,9 +330,7 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ "VALUES('%s', '%s', '%s', %i)", "Petition", bug->name, bugtext, 25); safe_delete_array(bugtext); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } bool ZoneDatabase::SetSpecialAttkFlag(uint8 id, const char* flag) { From 4efa8a18eb19ec4e7c97858df52b89e402d3ffaa Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:48:06 -0600 Subject: [PATCH 1577/1883] Fix SaveMerchantTemp from error message removal --- zone/zonedb.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 579d80bac..ccb0b0446 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2489,8 +2489,7 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint std::string query = StringFormat("REPLACE INTO merchantlist_temp (npcid, slot, itemid, charges) " "VALUES(%d, %d, %d, %d)", npcid, slot, item, charges); - auto results = QueryDatabase(query); - if (!results.Success()) + QueryDatabase(query); } void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ From 00db3d270c6baf48bdc3d6f11950b547a60ebec2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:48:39 -0600 Subject: [PATCH 1578/1883] Fix DeleteMerchantTemp from error message removal --- zone/zonedb.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ccb0b0446..91870f68f 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2493,11 +2493,8 @@ void ZoneDatabase::SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint } void ZoneDatabase::DeleteMerchantTemp(uint32 npcid, uint32 slot){ - std::string query = StringFormat("DELETE FROM merchantlist_temp WHERE npcid=%d AND slot=%d", npcid, slot); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } bool ZoneDatabase::UpdateZoneSafeCoords(const char* zonename, float x=0, float y=0, float z=0) { From 54868922ef4506a014292430c6c92f58aef09689 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:49:03 -0600 Subject: [PATCH 1579/1883] Fix UpdateKarma from error message removal --- zone/zonedb.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 91870f68f..812d647a6 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2731,9 +2731,7 @@ uint32 ZoneDatabase::GetKarma(uint32 acct_id) void ZoneDatabase::UpdateKarma(uint32 acct_id, uint32 amount) { std::string query = StringFormat("UPDATE account SET karma = %i WHERE id = %i", amount, acct_id); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } void ZoneDatabase::ListAllInstances(Client* client, uint32 charid) From 1530bd7937c01f52a54c218fbc4a0c2139828765 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:49:20 -0600 Subject: [PATCH 1580/1883] Fix InsertDoor from error message removal --- zone/zonedb.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 812d647a6..ed315da07 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2774,8 +2774,7 @@ void ZoneDatabase::InsertDoor(uint32 ddoordbid, uint16 ddoorid, const char* ddoo ddoordbid, ddoorid, zone->GetShortName(), zone->GetInstanceVersion(), ddoor_name, dxpos, dypos, dzpos, dheading, dopentype, dguildid, dlockpick, dkeyitem, ddoor_param, dinvert, dincline, dsize); - auto results = QueryDatabase(query); - if (!results.Success()) + QueryDatabase(query); } void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map ¤cy) { From b77a586d1416449cf3a998c1f1c3c6a3df37fc5c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:49:38 -0600 Subject: [PATCH 1581/1883] Fix RemoveTempFactions from error message removal --- zone/zonedb.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index ed315da07..7e04f58ba 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2993,9 +2993,7 @@ void ZoneDatabase::RemoveTempFactions(Client *client) { std::string query = StringFormat("DELETE FROM faction_values " "WHERE temp = 1 AND char_id = %u", client->CharacterID()); - auto results = QueryDatabase(query); - if (!results.Success()) - + QueryDatabase(query); } void ZoneDatabase::LoadPetInfo(Client *client) { From 0092d0c8947b9acb361d304d7c90a38df1a3e2e4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 01:50:35 -0600 Subject: [PATCH 1582/1883] Fix ClearMerchantTemp from error message removal --- common/database.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index f3dacc9f1..09d829922 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2882,11 +2882,8 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { } void Database::ClearMerchantTemp(){ - std::string query("delete from merchantlist_temp"); - auto results = QueryDatabase(query); - - if (!results.Success()) + QueryDatabase(query); } bool Database::UpdateName(const char* oldname, const char* newname) { From c9fd7e45e8d473216a65154a08ebaac5f6085f18 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:03:45 -0600 Subject: [PATCH 1583/1883] Remove excess MySQL error message in GetSafePoints --- common/database.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 09d829922..8642c362f 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2568,13 +2568,7 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe auto results = QueryDatabase(query); if (!results.Success()) - { - std::cerr << "If it errors, run the following querys:\n"; - std::cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; - std::cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n"; - std::cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT NULL DEFAULT '';\n"; return false; - } if (results.RowCount() == 0) return false; From 2b091206bdfe8d5a70d9f3157b3afe001a8790fd Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:07:39 -0600 Subject: [PATCH 1584/1883] Remove Duplicative MySQL Error: Unable to clear groups: --- common/database.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 8642c362f..acb1eafcb 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3185,10 +3185,7 @@ void Database::ClearGroup(uint32 gid) { //clear a specific group std::string query = StringFormat("delete from group_id where groupid = %lu", (unsigned long)gid); - auto results = QueryDatabase(query); - - if (!results.Success()) - std::cout << "Unable to clear groups: " << results.ErrorMessage() << std::endl; + QueryDatabase(query); } uint32 Database::GetGroupID(const char* name){ From b14c3c8674b9584f7326dcdf1c668ad082a6c442 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:08:25 -0600 Subject: [PATCH 1585/1883] Remove Duplicative MySQL Error: Log.Out(Logs::General, Logs::Error, Error --- common/database.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index acb1eafcb..9a0065b94 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3188,14 +3188,11 @@ void Database::ClearGroup(uint32 gid) { QueryDatabase(query); } -uint32 Database::GetGroupID(const char* name){ - +uint32 Database::GetGroupID(const char* name){ std::string query = StringFormat("SELECT groupid from group_id where name='%s'", name); auto results = QueryDatabase(query); - if (!results.Success()) - { - Log.Out(Logs::General, Logs::Error, "Error getting group id: %s", results.ErrorMessage().c_str()); + if (!results.Success()) { return 0; } From 5a8e45faab73e6caf65ba582f50e94891fb53ae4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:09:23 -0600 Subject: [PATCH 1586/1883] Remove Duplicative MySQL Error: Unable to clear groups: --- common/database.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 9a0065b94..eb7c408a5 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3164,8 +3164,8 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism void Database::ClearAllGroups(void) { - std::string query("delete from group_id"); - auto results = QueryDatabase(query); + std::string query("DELETE FROM `group_id`"); + QueryDatabase(query); if (!results.Success()) std::cout << "Unable to clear groups: " << results.ErrorMessage() << std::endl; From f4c8eb6d885b54c822ee7ed9f0447d37c416c72b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:09:36 -0600 Subject: [PATCH 1587/1883] Remove Duplicative MySQL Error: Unable to clear groups: --- common/database.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index eb7c408a5..0aeeca9db 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3166,10 +3166,6 @@ void Database::ClearAllGroups(void) { std::string query("DELETE FROM `group_id`"); QueryDatabase(query); - - if (!results.Success()) - std::cout << "Unable to clear groups: " << results.ErrorMessage() << std::endl; - return; } From 40d23ab35a0c1ba96f27feecd8ed51347fabfd82 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:10:16 -0600 Subject: [PATCH 1588/1883] Remove Duplicative MySQL Error: Error adding character to group id: %s --- common/database.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 0aeeca9db..663bcb0fe 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3156,10 +3156,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism /* Add to the Group */ query = StringFormat("REPLACE INTO `group_id` SET `charid` = %i, `groupid` = %i, `name` = '%s', `ismerc` = '%i'", charid, id, name, ismerc); - auto results = QueryDatabase(query); - - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str()); + QueryDatabase(query); } void Database::ClearAllGroups(void) From e626bb527f61c13fb43f59dcd2aa1630a2fcc715 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:10:54 -0600 Subject: [PATCH 1589/1883] Remove Duplicative MySQL Error: Error adding a report for %s: %s --- common/database.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 663bcb0fe..e95aa4984 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3134,11 +3134,8 @@ void Database::AddReport(std::string who, std::string against, std::string lines DoEscapeString(escape_str, lines.c_str(), lines.size()); std::string query = StringFormat("INSERT INTO reports (name, reported, reported_text) VALUES('%s', '%s', '%s')", who.c_str(), against.c_str(), escape_str); - auto results = QueryDatabase(query); + QueryDatabase(query); safe_delete_array(escape_str); - - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str()); } void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) { From d3fdacf54810f599bcb497fa7ae11b3b360fa222 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:11:31 -0600 Subject: [PATCH 1590/1883] Remove Duplicative MySQL Error: Error updating firstlogon for character %i : %s --- common/database.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index e95aa4984..3ea215e00 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3124,9 +3124,7 @@ void Database::SetLFG(uint32 CharID, bool LFG) { void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID); - auto results = QueryDatabase(query); - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str()); + QueryDatabase(query); } void Database::AddReport(std::string who, std::string against, std::string lines) { From 8ede80b69d8b7551503a2d040f0961708c49a3c3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:12:01 -0600 Subject: [PATCH 1591/1883] Remove Duplicative MySQL Error: Error updating LFP for character %i : %s --- common/database.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 3ea215e00..0e8d91610 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3117,9 +3117,7 @@ void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon void Database::SetLFG(uint32 CharID, bool LFG) { std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID); - auto results = QueryDatabase(query); - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + QueryDatabase(query); } void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) { From c5dbbd1f07c5bddaa94f4fa10b076bfb95c910f9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:12:59 -0600 Subject: [PATCH 1592/1883] Remove Duplicative MySQL Error: Error updating LFP for character %i : %s --- common/database.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 0e8d91610..b954421b9 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3110,9 +3110,7 @@ void Database::SetLFP(uint32 CharID, bool LFP) { void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID); - auto results = QueryDatabase(query); - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + QueryDatabase(query); } void Database::SetLFG(uint32 CharID, bool LFG) { From 5ec3d58e32f23782253e560e8e9a74f304a95b5a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:13:25 -0600 Subject: [PATCH 1593/1883] Remove Duplicative MySQL Error: Error updating LFP for character %i : %s --- common/database.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index b954421b9..0432e4e2b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3103,9 +3103,7 @@ bool Database::GetLiveChar(uint32 account_id, char* cname) { void Database::SetLFP(uint32 CharID, bool LFP) { std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID); - auto results = QueryDatabase(query); - if (!results.Success()) - Log.Out(Logs::General, Logs::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str()); + QueryDatabase(query); } void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) { From 3fbac46ee65aeb4b4593463a03cc96b4471654b4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:14:36 -0600 Subject: [PATCH 1594/1883] Remove Duplicative MySQL Error: --- common/database.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 0432e4e2b..dd1d3850c 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -3074,8 +3074,7 @@ bool Database::UpdateLiveChar(char* charname,uint32 lsaccount_id) { std::string query = StringFormat("UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id); auto results = QueryDatabase(query); - if (!results.Success()) - { + if (!results.Success()){ return false; } From 29774d97650273ad00fc2aae1df56b06c4511e50 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:16:53 -0600 Subject: [PATCH 1595/1883] Database:;ClearMerchantTemp cleanup --- common/database.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index dd1d3850c..b35cbea10 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2876,8 +2876,7 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { } void Database::ClearMerchantTemp(){ - std::string query("delete from merchantlist_temp"); - QueryDatabase(query); + QueryDatabase("DELETE FROM merchantlist_temp"); } bool Database::UpdateName(const char* oldname, const char* newname) { From ec2a8c4a1b773e21b30f498f33d5db99e9134de8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:33:15 -0600 Subject: [PATCH 1596/1883] Convert CreateAccount to Log.Out --- common/database.cpp | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index b35cbea10..40c90a89b 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1,5 +1,5 @@ /* EQEMu: Everquest Server Emulator - Copyright (C) 2001-2003 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 @@ -58,15 +58,7 @@ extern Client client; # define _ISNAN_(a) std::isnan(a) #endif -/* -Establish a connection to a mysql database with the supplied parameters - - Added a very simple .ini file parser - Bounce - - Modify to use for win32 & linux - misanthropicfiend -*/ -Database::Database () -{ +Database::Database () { DBInitVars(); } @@ -84,12 +76,11 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); - + Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); return false; } else { - Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d",database,host,port); + Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port); return true; } } @@ -241,7 +232,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta else query = StringFormat("INSERT INTO account SET name='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name, status, lsaccount_id); - std::cerr << "Account Attempting to be created:" << name << " " << (int16) status << std::endl; + Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status); auto results = QueryDatabase(query); if (!results.Success()) { @@ -2723,8 +2714,7 @@ uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){ std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version); auto results = QueryDatabase(query); - if (!results.Success()) - { + if (!results.Success()) { return 0; } @@ -2834,8 +2824,7 @@ uint32 Database::GetAccountIDFromLSID(uint32 iLSID, char* oAccountName, int16* o std::string query = StringFormat("SELECT id, name, status FROM account WHERE lsaccount_id=%i", iLSID); auto results = QueryDatabase(query); - if (!results.Success()) - { + if (!results.Success()) { return 0; } @@ -2859,8 +2848,7 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) { std::string query = StringFormat("SELECT name, status FROM account WHERE id=%i", id); auto results = QueryDatabase(query); - if (!results.Success()) - { + if (!results.Success()){ return; } From fc0e760b02da094682499dc68d104ac957048659 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:33:55 -0600 Subject: [PATCH 1597/1883] Convert DeleteAccount to Log.Out --- common/database.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 40c90a89b..243a99911 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -249,12 +249,10 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta bool Database::DeleteAccount(const char* name) { std::string query = StringFormat("DELETE FROM account WHERE name='%s';",name); - std::cout << "Account Attempting to be deleted:" << name << std::endl; + Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name); - auto results = QueryDatabase(query); - - if (!results.Success()) - { + auto results = QueryDatabase(query); + if (!results.Success()) { return false; } From 0bb013bafbdcf351195194253bf0e4c34d79fd0f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:36:47 -0600 Subject: [PATCH 1598/1883] Convert DeleteCharacter to Log.Out --- common/database.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index 243a99911..712957f33 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -304,11 +304,11 @@ bool Database::ReserveName(uint32 account_id, char* name) { */ bool Database::DeleteCharacter(char *name) { uint32 charid = 0; - printf("Database::DeleteCharacter name : %s \n", name); if(!name || !strlen(name)) { - std::cerr << "DeleteCharacter: request to delete without a name (empty char slot)" << std::endl; + Log.Out(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)"); return false; } + Log.Out(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name); /* Get id from character_data before deleting record so we can clean up the rest of the tables */ std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", name); From 32437a21ebda1dca18e4f98ed46a1138a19838b0 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:45:38 -0600 Subject: [PATCH 1599/1883] Add ANSI color defines for Linux --- common/eqemu_logsys.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 739507350..5b7fc2a1b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -18,13 +18,11 @@ #include "eqemu_logsys.h" -// #include "base_packet.h" #include "platform.h" #include "string_util.h" #include "database.h" #include "misc.h" - #include #include #include @@ -34,13 +32,22 @@ std::ofstream process_log; #ifdef _WINDOWS -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include #else -#include + #include + #define RESET "\033[0m" + #define BLACK "\033[30m" /* Black */ + #define RED "\033[31m" /* Red */ + #define GREEN "\033[32m" /* Green */ + #define YELLOW "\033[33m" /* Yellow */ + #define BLUE "\033[34m" /* Blue */ + #define MAGENTA "\033[35m" /* Magenta */ + #define CYAN "\033[36m" /* Cyan */ + #define WHITE "\033[37m" /* White */ #endif namespace Console { From 39626159a5bc674d6c8ca3e3040fc281f61d60d3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:53:10 -0600 Subject: [PATCH 1600/1883] Implement Linux ANSI colors --- common/eqemu_logsys.cpp | 55 ++++++++++++++++++++++++++++------------- common/eqemu_logsys.h | 3 ++- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 5b7fc2a1b..ed55c8a3e 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -39,17 +39,19 @@ std::ofstream process_log; #include #else #include - #define RESET "\033[0m" - #define BLACK "\033[30m" /* Black */ - #define RED "\033[31m" /* Red */ - #define GREEN "\033[32m" /* Green */ - #define YELLOW "\033[33m" /* Yellow */ - #define BLUE "\033[34m" /* Blue */ - #define MAGENTA "\033[35m" /* Magenta */ - #define CYAN "\033[36m" /* Cyan */ - #define WHITE "\033[37m" /* White */ #endif +/* Linux ANSI console color defines */ +#define LC_RESET "\033[0m" +#define LC_BLACK "\033[30m" /* Black */ +#define LC_RED "\033[31m" /* Red */ +#define LC_GREEN "\033[32m" /* Green */ +#define LC_YELLOW "\033[33m" /* Yellow */ +#define LC_BLUE "\033[34m" /* Blue */ +#define LC_MAGENTA "\033[35m" /* Magenta */ +#define LC_CYAN "\033[36m" /* Cyan */ +#define LC_WHITE "\033[37m" /* White */ + namespace Console { enum Color { Black = 0, @@ -127,7 +129,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) } } -uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ +uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){ switch (log_category) { case Logs::Status: case Logs::Normal: @@ -149,6 +151,28 @@ uint16 EQEmuLogSys::GetConsoleColorFromCategory(uint16 log_category){ } } +std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){ + switch (log_category) { + case Logs::Status: + case Logs::Normal: + return LC_YELLOW; + case Logs::MySQLError: + case Logs::Error: + return LC_RED; + case Logs::MySQLQuery: + case Logs::Debug: + return LC_GREEN; + case Logs::Quests: + return LC_CYAN; + case Logs::Commands: + return LC_MAGENTA; + case Logs::Crash: + return LC_RED; + default: + return LC_YELLOW; + } +} + uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ switch (log_category) { case Logs::Status: @@ -186,14 +210,11 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetConsoleColorFromCategory(log_category)); - #endif - - std::cout << message << "\n"; - - #ifdef _WINDOWS - /* Always set back to white*/ + SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetWindowsConsoleColorFromCategory(log_category)); + std::cout << message << "\n"; SetConsoleTextAttribute(console_handle, Console::Color::White); + #else + std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl; #endif } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 7b83ab996..17ebdeaea 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -153,7 +153,8 @@ private: std::function on_log_gmsay_hook; std::string FormatOutMessageString(uint16 log_category, std::string in_message); - uint16 GetConsoleColorFromCategory(uint16 log_category); + uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); + std::string GetLinuxConsoleColorFromCategory(uint16 log_category); void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); From ff5e82c50f534f0dde4bb6145c8c580b1e7b2228 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:57:31 -0600 Subject: [PATCH 1601/1883] Fix some indents --- common/eqemu_logsys.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index ed55c8a3e..b412e02fe 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -110,6 +110,7 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) if (log_category == Logs::LogCategory::Netcode) return; + /* Check to see if the process that actually ran this is zone */ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ on_log_gmsay_hook(log_category, message); } @@ -153,23 +154,23 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){ switch (log_category) { - case Logs::Status: - case Logs::Normal: - return LC_YELLOW; - case Logs::MySQLError: - case Logs::Error: - return LC_RED; - case Logs::MySQLQuery: - case Logs::Debug: - return LC_GREEN; - case Logs::Quests: - return LC_CYAN; - case Logs::Commands: - return LC_MAGENTA; - case Logs::Crash: - return LC_RED; - default: - return LC_YELLOW; + case Logs::Status: + case Logs::Normal: + return LC_YELLOW; + case Logs::MySQLError: + case Logs::Error: + return LC_RED; + case Logs::MySQLQuery: + case Logs::Debug: + return LC_GREEN; + case Logs::Quests: + return LC_CYAN; + case Logs::Commands: + return LC_MAGENTA; + case Logs::Crash: + return LC_RED; + default: + return LC_YELLOW; } } From e48234b2af3c4d13c6061c6ad63d817d4b1d3cb8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:58:33 -0600 Subject: [PATCH 1602/1883] Add uint16 debug_level to ProcessConsoleMessage --- common/eqemu_logsys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index b412e02fe..0ddaa9061 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -196,7 +196,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ } } -void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string message) +void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_console == 0) @@ -228,7 +228,7 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(0, log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message); } From 9faa2117d5854e6b97ac3066de1b18360539ce67 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:59:06 -0600 Subject: [PATCH 1603/1883] Add uint16 debug_level to ProcessLogWrite --- common/eqemu_logsys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0ddaa9061..4ac5a359d 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -116,7 +116,7 @@ void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) } } -void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) +void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_file == 0) @@ -230,7 +230,7 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st EQEmuLogSys::ProcessConsoleMessage(0, log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); - EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message); + EQEmuLogSys::ProcessLogWrite(0, log_category, output_debug_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ From cc1735bc3962c48fdce1a66eeea59e10ade24e31 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 02:59:32 -0600 Subject: [PATCH 1604/1883] Add uint16 debug_level to ProcessGMSay --- common/eqemu_logsys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 4ac5a359d..1d985bbb9 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -100,7 +100,7 @@ std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string return StringFormat("%s%s", category_string.c_str(), in_message.c_str()); } -void EQEmuLogSys::ProcessGMSay(uint16 log_category, std::string message) +void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_gmsay == 0) @@ -229,7 +229,7 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); EQEmuLogSys::ProcessConsoleMessage(0, log_category, output_debug_message); - EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); + EQEmuLogSys::ProcessGMSay(0, log_category, output_debug_message); EQEmuLogSys::ProcessLogWrite(0, log_category, output_debug_message); } From f5b1f678a19b1089dd2e3d9445d662c7f536b558 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:00:00 -0600 Subject: [PATCH 1605/1883] Pass debug_level to subprocess commands --- common/eqemu_logsys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 1d985bbb9..d7c3fbf47 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -228,9 +228,9 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(0, log_category, output_debug_message); - EQEmuLogSys::ProcessGMSay(0, log_category, output_debug_message); - EQEmuLogSys::ProcessLogWrite(0, log_category, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message); + EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message); + EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ From f09e1d037fb4945be6df5f8f6852c80fa619fe2c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:01:41 -0600 Subject: [PATCH 1606/1883] Implement debug_level checking for ProcessConsoleMessage --- common/eqemu_logsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d7c3fbf47..0ee066466 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -202,6 +202,10 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, if (log_settings[log_category].log_to_console == 0) return; + /* Make sure the message inbound is at a debug level we're set at */ + if (log_settings[log_category].log_to_console < debug_level) + return; + #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); From aeff65064980b5269bf97a9accc66801819bc5f5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:02:15 -0600 Subject: [PATCH 1607/1883] Implement debug_level checking for ProcessLogWrite --- common/eqemu_logsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0ee066466..035f0c09d 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -122,6 +122,10 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std:: if (log_settings[log_category].log_to_file == 0) return; + /* Make sure the message inbound is at a debug level we're set at */ + if (log_settings[log_category].log_to_file < debug_level) + return; + char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); From b2ffcf1cf6ab1dbe8abbf09aa705b47718ca0309 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:02:41 -0600 Subject: [PATCH 1608/1883] Implement debug_level checking for ProcessGMSay --- common/eqemu_logsys.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 035f0c09d..470ccf9c7 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -110,6 +110,10 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, std::str if (log_category == Logs::LogCategory::Netcode) return; + /* Make sure the message inbound is at a debug level we're set at */ + if (log_settings[log_category].log_to_gmsay < debug_level) + return; + /* Check to see if the process that actually ran this is zone */ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ on_log_gmsay_hook(log_category, message); From e79c1c1a5abc05879d97a5bebb927c48849c2997 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:07:33 -0600 Subject: [PATCH 1609/1883] Fix Linux compiles --- common/eqemu_logsys.h | 6 +++--- common/tcp_connection.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 17ebdeaea..c388b4a37 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -156,9 +156,9 @@ private: uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); std::string GetLinuxConsoleColorFromCategory(uint16 log_category); - void ProcessConsoleMessage(uint16 log_category, const std::string message); - void ProcessGMSay(uint16 log_category, std::string message); - void ProcessLogWrite(uint16 log_category, std::string message); + void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string message); + void ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message); + void ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message); }; extern EQEmuLogSys Log; diff --git a/common/tcp_connection.cpp b/common/tcp_connection.cpp index 6a8493f2e..7a393c8f5 100644 --- a/common/tcp_connection.cpp +++ b/common/tcp_connection.cpp @@ -899,7 +899,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { } TCPConnection* tcpc = (TCPConnection*) tmp; #ifndef WIN32 - Log.Out(Logs::Detail, Logs::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::TCP_Connection, "%s Starting TCPConnectionLoop with thread ID %d", __FUNCTION__, pthread_self()); #endif tcpc->MLoopRunning.lock(); while (tcpc->RunLoop()) { @@ -926,7 +926,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) { tcpc->MLoopRunning.unlock(); #ifndef WIN32 - Log.Out(Logs::Detail, Logs::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self()); + Log.Out(Logs::Detail, Logs::TCP_Connection, "%s Ending TCPConnectionLoop with thread ID %d", __FUNCTION__, pthread_self()); #endif THREAD_RETURN(nullptr); From 42dffec4ae2b489e54e64d3507065ff6b2571bed Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:20:40 -0600 Subject: [PATCH 1610/1883] Various logging adjustments --- common/eqemu_logsys.cpp | 2 +- common/eqemu_logsys.h | 4 +++- zone/embxs.cpp | 4 ++-- zone/tasks.cpp | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 470ccf9c7..a37fc0850 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -134,7 +134,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std:: EQEmuLogSys::SetCurrentTimeStamp(time_stamp); if (process_log){ - process_log << time_stamp << " " << StringFormat("[%s] ", Logs::LogCategoryName[log_category]).c_str() << message << std::endl; + process_log << time_stamp << " " << message << std::endl; } } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index c388b4a37..d3a81e5c8 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -140,7 +140,9 @@ public: }; LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; + bool log_settings_loaded = false; + int log_platform = 0; uint16 GetGMSayColorFromCategory(uint16 log_category); @@ -152,9 +154,9 @@ private: std::function on_log_gmsay_hook; std::string FormatOutMessageString(uint16 log_category, std::string in_message); + std::string GetLinuxConsoleColorFromCategory(uint16 log_category); uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); - std::string GetLinuxConsoleColorFromCategory(uint16 log_category); void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string message); void ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message); diff --git a/zone/embxs.cpp b/zone/embxs.cpp index 4c0e8211c..664416587 100644 --- a/zone/embxs.cpp +++ b/zone/embxs.cpp @@ -100,7 +100,7 @@ XS(XS_EQEmuIO_PRINT) int len = 0; for(i = 0; *cur != '\0'; i++, cur++) { if(*cur == '\n') { - Log.Out(Logs::Detail, Logs::Quests, str); + Log.Out(Logs::General, Logs::Quests, str); len = 0; pos = i+1; } else { @@ -108,7 +108,7 @@ XS(XS_EQEmuIO_PRINT) } } if(len > 0) { - Log.Out(Logs::Detail, Logs::Quests, str); + Log.Out(Logs::General, Logs::Quests, str); } } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 203950104..500e57ae6 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3028,11 +3028,11 @@ void ClientTaskState::ProcessTaskProximities(Client *c, float X, float Y, float if((LastX==X) && (LastY==Y) && (LastZ==Z)) return; - Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking proximities for Position %8.3f, %8.3f, %8.3f\n", X, Y, Z); + Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking proximities for Position %8.3f, %8.3f, %8.3f", X, Y, Z); int ExploreID = taskmanager->ProximityManager.CheckProximities(X, Y, Z); if(ExploreID>0) { - Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i\n", X, Y, Z, ExploreID); + Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } } From 8b096e65afc3f029b623154c217f4c0c3592d833 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 03:46:27 -0600 Subject: [PATCH 1611/1883] logtest adjustments --- zone/command.cpp | 15 +++++++++++++-- zone/tasks.cpp | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 59c738e49..3902242c6 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10392,9 +10392,20 @@ void command_logtest(Client *c, const Seperator *sep){ clock_t t = std::clock(); /* Function timer start */ if (sep->IsNumber(1)){ uint32 i = 0; - for (i = 0; i < atoi(sep->arg[1]); i++){ - Log.Out(Logs::General, Logs::None, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + std::ofstream log_test; + for (i = 0; i < atoi(sep->arg[1]); i++){ + log_test.open("logs/log_test.txt", std::ios_base::app | std::ios_base::out); + log_test << "this is a test\n"; + log_test.close(); } + Log.Out(Logs::General, Logs::Zone_Server, "[%u] Test #1... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + t = std::clock(); + log_test.open("logs/log_test.txt", std::ios_base::app | std::ios_base::out); + for (i = 0; i < atoi(sep->arg[1]); i++){ + log_test << "this is a test\n"; + } + log_test.close(); + Log.Out(Logs::General, Logs::Zone_Server, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 500e57ae6..cb8e34696 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -3031,7 +3031,7 @@ void ClientTaskState::ProcessTaskProximities(Client *c, float X, float Y, float Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Checking proximities for Position %8.3f, %8.3f, %8.3f", X, Y, Z); int ExploreID = taskmanager->ProximityManager.CheckProximities(X, Y, Z); - if(ExploreID>0) { + if(ExploreID > 0) { Log.Out(Logs::General, Logs::Tasks, "[PROXIMITY] Position %8.3f, %8.3f, %8.3f is within proximity %i", X, Y, Z, ExploreID); UpdateTasksOnExplore(c, ExploreID); } From cdde408602552e0f6ed1f3bc9b5f505ce70ff092 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 04:10:39 -0600 Subject: [PATCH 1612/1883] Some adjustments to file writing routines --- common/database.cpp | 11 +++++++++++ common/eqemu_logsys.h | 1 + 2 files changed, 12 insertions(+) diff --git a/common/database.cpp b/common/database.cpp index 712957f33..c0679cc48 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4171,11 +4171,22 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ "logsys_categories " "ORDER BY log_category_id"; auto results = QueryDatabase(query); + int log_category = 0; + log_settings.file_logs_enabled = false; + for (auto row = results.begin(); row != results.end(); ++row) { log_category = atoi(row[0]); log_settings[log_category].log_to_console = atoi(row[2]); log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); + + /* + This determines whether or not the process needs to actually file log anything. + If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open + */ + if (log_settings[log_category].log_to_file > 0){ + log_settings.file_logs_enabled = true; + } } } \ No newline at end of file diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index d3a81e5c8..66124df74 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -142,6 +142,7 @@ public: LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; bool log_settings_loaded = false; + bool file_logs_enabled = false; int log_platform = 0; From 1bbbb2821880e1f082b6ac00aa6fb7a472179c25 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 04:30:27 -0600 Subject: [PATCH 1613/1883] Refactor some of the database stuff for QueryServ for uniformity, should probably be done right later --- common/database.cpp | 4 ++-- common/eqemu_logsys.cpp | 5 ++++- queryserv/database.cpp | 28 ++++++++++++++-------------- queryserv/database.h | 8 ++++---- queryserv/lfguild.cpp | 16 ++++++++-------- queryserv/queryserv.cpp | 8 ++++++-- queryserv/worldserver.cpp | 18 +++++++++--------- 7 files changed, 47 insertions(+), 40 deletions(-) diff --git a/common/database.cpp b/common/database.cpp index c0679cc48..129fa2859 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4173,7 +4173,7 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ auto results = QueryDatabase(query); int log_category = 0; - log_settings.file_logs_enabled = false; + Log.file_logs_enabled = false; for (auto row = results.begin(); row != results.end(); ++row) { log_category = atoi(row[0]); @@ -4186,7 +4186,7 @@ void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open */ if (log_settings[log_category].log_to_file > 0){ - log_settings.file_logs_enabled = true; + Log.file_logs_enabled = true; } } } \ No newline at end of file diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index a37fc0850..0aadf0cdf 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -265,8 +265,8 @@ void EQEmuLogSys::CloseFileLogs() { if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ std::cout << "Closing down zone logs..." << std::endl; - process_log.close(); } + process_log.close(); } void EQEmuLogSys::StartFileLogs(const std::string log_name) @@ -276,4 +276,7 @@ void EQEmuLogSys::StartFileLogs(const std::string log_name) EQEmuLogSys::MakeDirectory("logs/zone"); process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); } + else{ + + } } \ No newline at end of file diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 585417e37..4b517016d 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -48,7 +48,7 @@ #include "../common/string_util.h" #include "../common/servertalk.h" -Database::Database () +QSDatabase::QSDatabase () { DBInitVars(); } @@ -57,13 +57,13 @@ Database::Database () Establish a connection to a mysql database with the supplied parameters */ -Database::Database(const char* host, const char* user, const char* passwd, const char* database, uint32 port) +QSDatabase::QSDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port) { DBInitVars(); Connect(host, user, passwd, database, port); } -bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) +bool QSDatabase::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) { uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -81,24 +81,24 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c } } -void Database::DBInitVars() { +void QSDatabase::DBInitVars() { } -void Database::HandleMysqlError(uint32 errnum) { +void QSDatabase::HandleMysqlError(uint32 errnum) { } /* Close the connection to the database */ -Database::~Database() +QSDatabase::~QSDatabase() { } -void Database::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) { +void QSDatabase::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) { char *escapedFrom = new char[strlen(from) * 2 + 1]; char *escapedTo = new char[strlen(to) * 2 + 1]; @@ -123,7 +123,7 @@ void Database::AddSpeech(const char* from, const char* to, const char* message, } -void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { +void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { std::string query = StringFormat("INSERT INTO `qs_player_trade_record` SET `time` = NOW(), " "`char1_id` = '%i', `char1_pp` = '%i', `char1_gp` = '%i', " @@ -164,7 +164,7 @@ void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { } -void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) { +void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) { std::string query = StringFormat("INSERT INTO `qs_player_handin_record` SET `time` = NOW(), " "`quest_id` = '%i', `char_id` = '%i', `char_pp` = '%i', " @@ -205,7 +205,7 @@ void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) } -void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ +void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ std::string query = StringFormat("INSERT INTO `qs_player_npc_kill_record` " "SET `npc_id` = '%i', `type` = '%i', " @@ -236,7 +236,7 @@ void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ } -void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { +void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { std::string query = StringFormat("INSERT INTO `qs_player_delete_record` SET `time` = NOW(), " "`char_id` = '%i', `stack_size` = '%i', `char_items` = '%i'", @@ -269,7 +269,7 @@ void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { } -void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { +void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { /* These are item moves */ std::string query = StringFormat("INSERT INTO `qs_player_move_record` SET `time` = NOW(), " @@ -305,7 +305,7 @@ void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { } -void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 items) { +void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 items) { /* Merchant transactions are from the perspective of the merchant, not the player -U */ std::string query = StringFormat("INSERT INTO `qs_merchant_transaction_record` SET `time` = NOW(), " "`zone_id` = '%i', `merchant_id` = '%i', `merchant_pp` = '%i', " @@ -346,7 +346,7 @@ void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint3 } -void Database::GeneralQueryReceive(ServerPacket *pack) { +void QSDatabase::GeneralQueryReceive(ServerPacket *pack) { /* These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again */ diff --git a/queryserv/database.h b/queryserv/database.h index adcb8c811..fe99a866d 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -35,12 +35,12 @@ //atoi is not uint32 or uint32 safe!!!! #define atoul(str) strtoul(str, nullptr, 10) -class Database : public DBcore { +class QSDatabase : public DBcore { public: - Database(); - Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); + QSDatabase(); + QSDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port); - ~Database(); + ~QSDatabase(); void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type); void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount); diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 340321f06..2684f4541 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -8,7 +8,7 @@ #include "../common/rulesys.h" extern WorldServer *worldserver; -extern Database database; +extern QSDatabase qs_database; PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted) { @@ -38,7 +38,7 @@ bool LFGuildManager::LoadDatabase() std::string query = "SELECT `type`,`name`,`comment`, " "`fromlevel`, `tolevel`, `classes`, " "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); if (!results.Success()) { return false; } @@ -239,7 +239,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char } std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); uint32 Now = time(nullptr); @@ -252,7 +252,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char "`classes`, `aacount`, `timezone`, `timeposted`) " "VALUES (0, '%s', '%s', %u, 0, %u, %u, %u, %u)", From, Comments, Level, Class, AAPoints, TimeZone, Now); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -281,7 +281,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char } std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); uint32 Now = time(nullptr); @@ -296,7 +296,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char "VALUES (1, '%s', '%s', %u, %u, %u, %u, %u, %u)", GuildName, Comments, FromLevel, ToLevel, Classes, AACount, TimeZone, Now); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); } @@ -324,7 +324,7 @@ void LFGuildManager::ExpireEntries() continue; std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); if(!results.Success()) it = Players.erase(it); @@ -336,7 +336,7 @@ void LFGuildManager::ExpireEntries() continue; std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); - auto results = database.QueryDatabase(query); + auto results = qs_database.QueryDatabase(query); if(!results.Success()) it2 = Guilds.erase(it2); diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index e227f515f..fe333e4a4 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -17,6 +17,7 @@ */ +#include "../common/database.h" #include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/opcodemgr.h" @@ -36,6 +37,7 @@ volatile bool RunLoops = true; TimeoutManager timeout_manager; Database database; +QSDatabase qs_database; LFGuildManager lfguildmanager; std::string WorldShortName; const queryservconfig *Config; @@ -50,7 +52,6 @@ void CatchSignal(int sig_num) { int main() { RegisterExecutablePlatform(ExePlatformQueryServ); - Log.LoadLogSettingsDefaults(); set_exception_handler(); Timer LFGuildExpireTimer(60000); Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect @@ -77,7 +78,7 @@ int main() { Log.Out(Logs::Detail, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ - if (!database.Connect( + if (!qs_database.Connect( Config->QSDatabaseHost.c_str(), Config->QSDatabaseUsername.c_str(), Config->QSDatabasePassword.c_str(), @@ -87,6 +88,9 @@ int main() { return 1; } + Log.LoadLogSettingsDefaults(); + database.LoadLogSysSettings(Log.log_settings); + if (signal(SIGINT, CatchSignal) == SIG_ERR) { Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); return 1; diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index 2d2f288a4..e043facf9 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -38,7 +38,7 @@ extern WorldServer worldserver; extern const queryservconfig *Config; -extern Database database; +extern QSDatabase qs_database; extern LFGuildManager lfguildmanager; WorldServer::WorldServer() @@ -78,42 +78,42 @@ void WorldServer::Process() Server_Speech_Struct *SSS = (Server_Speech_Struct*)pack->pBuffer; std::string tmp1 = SSS->from; std::string tmp2 = SSS->to; - database.AddSpeech(tmp1.c_str(), tmp2.c_str(), SSS->message, SSS->minstatus, SSS->guilddbid, SSS->type); + qs_database.AddSpeech(tmp1.c_str(), tmp2.c_str(), SSS->message, SSS->minstatus, SSS->guilddbid, SSS->type); break; } case ServerOP_QSPlayerLogTrades: { QSPlayerLogTrade_Struct *QS = (QSPlayerLogTrade_Struct*)pack->pBuffer; - database.LogPlayerTrade(QS, QS->_detail_count); + qs_database.LogPlayerTrade(QS, QS->_detail_count); break; } case ServerOP_QSPlayerLogHandins: { QSPlayerLogHandin_Struct *QS = (QSPlayerLogHandin_Struct*)pack->pBuffer; - database.LogPlayerHandin(QS, QS->_detail_count); + qs_database.LogPlayerHandin(QS, QS->_detail_count); break; } case ServerOP_QSPlayerLogNPCKills: { QSPlayerLogNPCKill_Struct *QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; uint32 Members = pack->size - sizeof(QSPlayerLogNPCKill_Struct); if (Members > 0) Members = Members / sizeof(QSPlayerLogNPCKillsPlayers_Struct); - database.LogPlayerNPCKill(QS, Members); + qs_database.LogPlayerNPCKill(QS, Members); break; } case ServerOP_QSPlayerLogDeletes: { QSPlayerLogDelete_Struct *QS = (QSPlayerLogDelete_Struct*)pack->pBuffer; uint32 Items = QS->char_count; - database.LogPlayerDelete(QS, Items); + qs_database.LogPlayerDelete(QS, Items); break; } case ServerOP_QSPlayerLogMoves: { QSPlayerLogMove_Struct *QS = (QSPlayerLogMove_Struct*)pack->pBuffer; uint32 Items = QS->char_count; - database.LogPlayerMove(QS, Items); + qs_database.LogPlayerMove(QS, Items); break; } case ServerOP_QSPlayerLogMerchantTransactions: { QSMerchantLogTransaction_Struct *QS = (QSMerchantLogTransaction_Struct*)pack->pBuffer; uint32 Items = QS->char_count + QS->merchant_count; - database.LogMerchantTransaction(QS, Items); + qs_database.LogMerchantTransaction(QS, Items); break; } case ServerOP_QueryServGeneric: { @@ -155,7 +155,7 @@ void WorldServer::Process() } case ServerOP_QSSendQuery: { /* Process all packets here */ - database.GeneralQueryReceive(pack); + qs_database.GeneralQueryReceive(pack); break; } } From d191086d3e15eafbb83e8564911723a7e5c10e65 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 04:45:14 -0600 Subject: [PATCH 1614/1883] Add LoadLogSysSettings to other processes --- queryserv/queryserv.cpp | 1 + shared_memory/main.cpp | 4 ++++ world/net.cpp | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index fe333e4a4..48825a67a 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -88,6 +88,7 @@ int main() { return 1; } + /* Register Log System and Settings */ Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 345616e8f..da385e6ba 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -57,6 +57,10 @@ int main(int argc, char **argv) { return 1; } + /* Register Log System and Settings */ + Log.LoadLogSettingsDefaults(); + database.LoadLogSysSettings(Log.log_settings); + bool load_all = true; bool load_items = false; bool load_factions = false; diff --git a/world/net.cpp b/world/net.cpp index d78aeecf7..c83b2db01 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -182,7 +182,8 @@ int main(int argc, char** argv) { } guild_mgr.SetDatabase(&database); - Log.LoadLogSettingsDefaults(); + /* Register Log System and Settings */ + Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); if (argc >= 2) { From d5018029a4f834056f05aed75dfe409fa276e24f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 04:45:44 -0600 Subject: [PATCH 1615/1883] Add LoadLogSysSettings to client export utility --- client_files/export/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 14fe0fc60..42d72b38b 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -55,6 +55,10 @@ int main(int argc, char **argv) { return 1; } + /* Register Log System and Settings */ + Log.LoadLogSettingsDefaults(); + database.LoadLogSysSettings(Log.log_settings); + ExportSpells(&database); ExportSkillCaps(&database); ExportBaseData(&database); From 0110755c474deeae8431496bd2254d3da3feac8e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 04:56:13 -0600 Subject: [PATCH 1616/1883] Adjust defaults for LoadLogSettingsDefault --- common/eqemu_logsys.cpp | 6 ++++++ ucs/ucs.cpp | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0aadf0cdf..ace8692f5 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -89,6 +89,12 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[i].log_to_file = 0; log_settings[i].log_to_gmsay = 0; } + + log_settings[Logs::World_Server].log_to_console = 1; + log_settings[Logs::Zone_Server].log_to_console = 1; + log_settings[Logs::QS_Server].log_to_console = 1; + log_settings[Logs::UCS_Server].log_to_console = 1; + log_settings_loaded = true; } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index fd9688def..86462aefe 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -78,20 +78,20 @@ int main() { Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect - Log.Out(Logs::Detail, Logs::UCS_Server, "Starting EQEmu Universal Chat Server."); + Log.Out(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server."); if (!ucsconfig::LoadConfig()) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Loading server configuration failed."); + Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed."); return 1; } - Config = ucsconfig::get(); + Config = ucsconfig::get(); WorldShortName = Config->ShortName; - Log.Out(Logs::Detail, Logs::UCS_Server, "Connecting to MySQL..."); + Log.Out(Logs::General, Logs::UCS_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), @@ -99,22 +99,22 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::General, Logs::World_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(Logs::Detail, Logs::World_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(Logs::General, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(Logs::Detail, Logs::UCS_Server, "No rule set configured, using default rules"); + Log.Out(Logs::General, Logs::UCS_Server, "No rule set configured, using default rules"); } else { - Log.Out(Logs::Detail, Logs::UCS_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::General, Logs::UCS_Server, "Loaded default rule set 'default'", tmp); } } @@ -122,7 +122,7 @@ int main() { if(Config->ChatPort != Config->MailPort) { - Log.Out(Logs::Detail, Logs::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); + Log.Out(Logs::General, Logs::UCS_Server, "MailPort and CharPort must be the same in eqemu_config.xml for UCS."); exit(1); } @@ -133,11 +133,11 @@ int main() { database.LoadChatChannels(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::UCS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::UCS_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::UCS_Server, "Could not set signal handler"); return 1; } From 9bfe45ddbdf8a53778a2a455b19a5aca0fd0a87f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:04:16 -0600 Subject: [PATCH 1617/1883] QueryServ adjustments --- queryserv/queryserv.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 48825a67a..b48e72c25 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -66,16 +66,16 @@ int main() { */ - Log.Out(Logs::Detail, Logs::QS_Server, "Starting EQEmu QueryServ."); + Log.Out(Logs::General, Logs::QS_Server, "Starting EQEmu QueryServ."); if (!queryservconfig::LoadConfig()) { - Log.Out(Logs::Detail, Logs::QS_Server, "Loading server configuration failed."); + Log.Out(Logs::General, Logs::QS_Server, "Loading server configuration failed."); return 1; } Config = queryservconfig::get(); WorldShortName = Config->ShortName; - Log.Out(Logs::Detail, Logs::QS_Server, "Connecting to MySQL..."); + Log.Out(Logs::General, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ if (!qs_database.Connect( @@ -84,7 +84,7 @@ int main() { Config->QSDatabasePassword.c_str(), Config->QSDatabaseDB.c_str(), Config->QSDatabasePort)) { - Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::General, Logs::QS_Server, "Cannot continue without a database connection."); return 1; } @@ -93,11 +93,11 @@ int main() { database.LoadLogSysSettings(Log.log_settings); if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::QS_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::QS_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::QS_Server, "Could not set signal handler"); return 1; } From c730519e277e301589109ffe604f44b2b274af60 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:07:22 -0600 Subject: [PATCH 1618/1883] Fix some categories from before convert --- ucs/ucs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 86462aefe..8ff86f9eb 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -99,14 +99,14 @@ int main() { Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(Logs::General, Logs::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::General, Logs::UCS_Server, "Cannot continue without a database connection."); return 1; } char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::General, Logs::UCS_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { Log.Out(Logs::General, Logs::UCS_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } From e4797d04f094897a310db97b8bf9130600907eec Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:18:21 -0600 Subject: [PATCH 1619/1883] Change some defaults for logs --- common/eqemu_logsys.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index ace8692f5..9f5a94d7a 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -94,6 +94,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[Logs::Zone_Server].log_to_console = 1; log_settings[Logs::QS_Server].log_to_console = 1; log_settings[Logs::UCS_Server].log_to_console = 1; + log_settings[Logs::Crash].log_to_console = 1; + log_settings[Logs::MySQLError].log_to_console = 1; log_settings_loaded = true; } From 931134688a0dbaacfec3f1503b50e2e7e9fa3596 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:18:44 -0600 Subject: [PATCH 1620/1883] Add a copy of load log settings to UCS because of how split Database classes are laid out --- ucs/database.cpp | 31 +++++++++++++++++++++++++++++++ ucs/database.h | 3 ++- ucs/ucs.cpp | 33 +++++++++++++++------------------ 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/ucs/database.cpp b/ucs/database.cpp index 7cd5b7d09..a295880f2 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -578,3 +578,34 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends } +void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ + std::string query = + "SELECT " + "log_category_id, " + "log_category_description, " + "log_to_console, " + "log_to_file, " + "log_to_gmsay " + "FROM " + "logsys_categories " + "ORDER BY log_category_id"; + auto results = QueryDatabase(query); + + int log_category = 0; + Log.file_logs_enabled = false; + + for (auto row = results.begin(); row != results.end(); ++row) { + log_category = atoi(row[0]); + log_settings[log_category].log_to_console = atoi(row[2]); + log_settings[log_category].log_to_file = atoi(row[3]); + log_settings[log_category].log_to_gmsay = atoi(row[4]); + + /* + This determines whether or not the process needs to actually file log anything. + If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open + */ + if (log_settings[log_category].log_to_file > 0){ + Log.file_logs_enabled = true; + } + } +} \ No newline at end of file diff --git a/ucs/database.h b/ucs/database.h index fc9b96d19..a8c382982 100644 --- a/ucs/database.h +++ b/ucs/database.h @@ -57,7 +57,8 @@ public: void ExpireMail(); void AddFriendOrIgnore(int CharID, int Type, std::string Name); void RemoveFriendOrIgnore(int CharID, int Type, std::string Name); - void GetFriendsAndIgnore(int CharID, std::vector &Friends, std::vector &Ignorees); + void GetFriendsAndIgnore(int CharID, std::vector &Friends, std::vector &Ignorees); + void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); protected: diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 8ff86f9eb..e67c9e445 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -33,25 +33,21 @@ #include #include -volatile bool RunLoops = true; - -uint32 MailMessagesSent = 0; -uint32 ChatMessagesSent = 0; - -TimeoutManager timeout_manager; - -Clientlist *CL; - ChatChannelList *ChannelList; - +Clientlist *CL; +EQEmuLogSys Log; +TimeoutManager timeout_manager; Database database; - -std::string WorldShortName; +WorldServer *worldserver = nullptr; const ucsconfig *Config; -WorldServer *worldserver = nullptr; -EQEmuLogSys Log; +std::string WorldShortName; + +uint32 ChatMessagesSent = 0; +uint32 MailMessagesSent = 0; + +volatile bool RunLoops = true; void CatchSignal(int sig_num) { @@ -80,10 +76,8 @@ int main() { Log.Out(Logs::General, Logs::UCS_Server, "Starting EQEmu Universal Chat Server."); - if (!ucsconfig::LoadConfig()) { - - Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed."); - + if (!ucsconfig::LoadConfig()) { + Log.Out(Logs::General, Logs::UCS_Server, "Loading server configuration failed."); return 1; } @@ -103,6 +97,9 @@ int main() { return 1; } + /* Register Log System and Settings */ + database.LoadLogSysSettings(Log.log_settings); + char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { From 7f2f6a8612b0dfb44af970f7e56928acb2287083 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:22:15 -0600 Subject: [PATCH 1621/1883] Placing Log defaults after RegisterExecutablePlatform and installing database log setting loads right after database connection for all processes --- client_files/export/main.cpp | 1 - client_files/import/main.cpp | 2 ++ queryserv/queryserv.cpp | 2 +- world/net.cpp | 2 +- zone/net.cpp | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 42d72b38b..633fecc79 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -56,7 +56,6 @@ int main(int argc, char **argv) { } /* Register Log System and Settings */ - Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); ExportSpells(&database); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 67cc28373..8522227a7 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -53,6 +53,8 @@ int main(int argc, char **argv) { return 1; } + database.LoadLogSysSettings(Log.log_settings); + ImportSpells(&database); ImportSkillCaps(&database); ImportBaseData(&database); diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index b48e72c25..c01d10265 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -52,6 +52,7 @@ void CatchSignal(int sig_num) { int main() { RegisterExecutablePlatform(ExePlatformQueryServ); + Log.LoadLogSettingsDefaults(); set_exception_handler(); Timer LFGuildExpireTimer(60000); Timer InterserverTimer(INTERSERVER_TIMER); // does auto-reconnect @@ -89,7 +90,6 @@ int main() { } /* Register Log System and Settings */ - Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); if (signal(SIGINT, CatchSignal) == SIG_ERR) { diff --git a/world/net.cpp b/world/net.cpp index c83b2db01..97ac46353 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -113,6 +113,7 @@ void CatchSignal(int sig_num); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); + Log.LoadLogSettingsDefaults(); set_exception_handler(); /* Database Version Check */ @@ -183,7 +184,6 @@ int main(int argc, char** argv) { guild_mgr.SetDatabase(&database); /* Register Log System and Settings */ - Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); if (argc >= 2) { diff --git a/zone/net.cpp b/zone/net.cpp index 8fe7f2a74..55591c1c2 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -115,6 +115,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); + Log.LoadLogSettingsDefaults(); set_exception_handler(); const char *zone_name; QServ = new QueryServ; @@ -166,7 +167,6 @@ int main(int argc, char** argv) { } /* Register Log System and Settings */ - Log.LoadLogSettingsDefaults(); Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); database.LoadLogSysSettings(Log.log_settings); From a64c21eb96cc9edd44c4c9d7d8b6d86387b3b3cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:30:19 -0600 Subject: [PATCH 1622/1883] Undo Queryserv refactoring because our database class stuff is stupid --- queryserv/database.cpp | 60 ++++++++++++++++++++++++++++++--------- queryserv/database.h | 12 +++++--- queryserv/lfguild.cpp | 16 +++++------ queryserv/queryserv.cpp | 4 +-- queryserv/worldserver.cpp | 18 ++++++------ 5 files changed, 72 insertions(+), 38 deletions(-) diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 4b517016d..1a97ecfc2 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -48,7 +48,7 @@ #include "../common/string_util.h" #include "../common/servertalk.h" -QSDatabase::QSDatabase () +Database::Database () { DBInitVars(); } @@ -57,13 +57,13 @@ QSDatabase::QSDatabase () Establish a connection to a mysql database with the supplied parameters */ -QSDatabase::QSDatabase(const char* host, const char* user, const char* passwd, const char* database, uint32 port) +Database::Database(const char* host, const char* user, const char* passwd, const char* database, uint32 port) { DBInitVars(); Connect(host, user, passwd, database, port); } -bool QSDatabase::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) +bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) { uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; @@ -81,24 +81,24 @@ bool QSDatabase::Connect(const char* host, const char* user, const char* passwd, } } -void QSDatabase::DBInitVars() { +void Database::DBInitVars() { } -void QSDatabase::HandleMysqlError(uint32 errnum) { +void Database::HandleMysqlError(uint32 errnum) { } /* Close the connection to the database */ -QSDatabase::~QSDatabase() +Database::~Database() { } -void QSDatabase::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) { +void Database::AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type) { char *escapedFrom = new char[strlen(from) * 2 + 1]; char *escapedTo = new char[strlen(to) * 2 + 1]; @@ -123,7 +123,7 @@ void QSDatabase::AddSpeech(const char* from, const char* to, const char* message } -void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { +void Database::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) { std::string query = StringFormat("INSERT INTO `qs_player_trade_record` SET `time` = NOW(), " "`char1_id` = '%i', `char1_pp` = '%i', `char1_gp` = '%i', " @@ -164,7 +164,7 @@ void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 detailCount) } -void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) { +void Database::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCount) { std::string query = StringFormat("INSERT INTO `qs_player_handin_record` SET `time` = NOW(), " "`quest_id` = '%i', `char_id` = '%i', `char_pp` = '%i', " @@ -205,7 +205,7 @@ void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct* QS, uint32 detailCoun } -void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ +void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members){ std::string query = StringFormat("INSERT INTO `qs_player_npc_kill_record` " "SET `npc_id` = '%i', `type` = '%i', " @@ -236,7 +236,7 @@ void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct* QS, uint32 members) } -void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { +void Database::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { std::string query = StringFormat("INSERT INTO `qs_player_delete_record` SET `time` = NOW(), " "`char_id` = '%i', `stack_size` = '%i', `char_items` = '%i'", @@ -269,7 +269,7 @@ void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct* QS, uint32 items) { } -void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { +void Database::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { /* These are item moves */ std::string query = StringFormat("INSERT INTO `qs_player_move_record` SET `time` = NOW(), " @@ -305,7 +305,7 @@ void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 items) { } -void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 items) { +void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 items) { /* Merchant transactions are from the perspective of the merchant, not the player -U */ std::string query = StringFormat("INSERT INTO `qs_merchant_transaction_record` SET `time` = NOW(), " "`zone_id` = '%i', `merchant_id` = '%i', `merchant_pp` = '%i', " @@ -346,7 +346,7 @@ void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uin } -void QSDatabase::GeneralQueryReceive(ServerPacket *pack) { +void Database::GeneralQueryReceive(ServerPacket *pack) { /* These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again */ @@ -363,3 +363,35 @@ void QSDatabase::GeneralQueryReceive(ServerPacket *pack) { safe_delete(pack); safe_delete(queryBuffer); } + +void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ + std::string query = + "SELECT " + "log_category_id, " + "log_category_description, " + "log_to_console, " + "log_to_file, " + "log_to_gmsay " + "FROM " + "logsys_categories " + "ORDER BY log_category_id"; + auto results = QueryDatabase(query); + + int log_category = 0; + Log.file_logs_enabled = false; + + for (auto row = results.begin(); row != results.end(); ++row) { + log_category = atoi(row[0]); + log_settings[log_category].log_to_console = atoi(row[2]); + log_settings[log_category].log_to_file = atoi(row[3]); + log_settings[log_category].log_to_gmsay = atoi(row[4]); + + /* + This determines whether or not the process needs to actually file log anything. + If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open + */ + if (log_settings[log_category].log_to_file > 0){ + Log.file_logs_enabled = true; + } + } +} \ No newline at end of file diff --git a/queryserv/database.h b/queryserv/database.h index fe99a866d..898e300c4 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -23,6 +23,7 @@ #define AUTHENTICATION_TIMEOUT 60 #define INVALID_ID 0xFFFFFFFF +#include "../common/eqemu_logsys.h" #include "../common/global_define.h" #include "../common/types.h" #include "../common/dbcore.h" @@ -35,12 +36,12 @@ //atoi is not uint32 or uint32 safe!!!! #define atoul(str) strtoul(str, nullptr, 10) -class QSDatabase : public DBcore { +class Database : public DBcore { public: - QSDatabase(); - QSDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port); + Database(); + Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port); bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port); - ~QSDatabase(); + ~Database(); void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type); void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount); @@ -50,6 +51,9 @@ public: void LogPlayerMove(QSPlayerLogMove_Struct* QS, uint32 Items); void LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 Items); void GeneralQueryReceive(ServerPacket *pack); + + void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + protected: void HandleMysqlError(uint32 errnum); private: diff --git a/queryserv/lfguild.cpp b/queryserv/lfguild.cpp index 2684f4541..340321f06 100644 --- a/queryserv/lfguild.cpp +++ b/queryserv/lfguild.cpp @@ -8,7 +8,7 @@ #include "../common/rulesys.h" extern WorldServer *worldserver; -extern QSDatabase qs_database; +extern Database database; PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted) { @@ -38,7 +38,7 @@ bool LFGuildManager::LoadDatabase() std::string query = "SELECT `type`,`name`,`comment`, " "`fromlevel`, `tolevel`, `classes`, " "`aacount`, `timezone`, `timeposted` FROM `lfguild`"; - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); if (!results.Success()) { return false; } @@ -239,7 +239,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char } std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 0 AND `name` = '%s'", From); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); uint32 Now = time(nullptr); @@ -252,7 +252,7 @@ void LFGuildManager::TogglePlayer(uint32 FromZoneID, uint32 FromInstanceID, char "`classes`, `aacount`, `timezone`, `timeposted`) " "VALUES (0, '%s', '%s', %u, 0, %u, %u, %u, %u)", From, Comments, Level, Class, AAPoints, TimeZone, Now); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); } ServerPacket *pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(From) + strlen(Comments) + 30); @@ -281,7 +281,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char } std::string query = StringFormat("DELETE FROM `lfguild` WHERE `type` = 1 AND `name` = '%s'", GuildName); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); uint32 Now = time(nullptr); @@ -296,7 +296,7 @@ void LFGuildManager::ToggleGuild(uint32 FromZoneID, uint32 FromInstanceID, char "VALUES (1, '%s', '%s', %u, %u, %u, %u, %u, %u)", GuildName, Comments, FromLevel, ToLevel, Classes, AACount, TimeZone, Now); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); } @@ -324,7 +324,7 @@ void LFGuildManager::ExpireEntries() continue; std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 0 AND `name` = '%s'", (*it).Name.c_str()); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); if(!results.Success()) it = Players.erase(it); @@ -336,7 +336,7 @@ void LFGuildManager::ExpireEntries() continue; std::string query = StringFormat("DELETE from `lfguild` WHERE `type` = 1 AND `name` = '%s'", (*it2).Name.c_str()); - auto results = qs_database.QueryDatabase(query); + auto results = database.QueryDatabase(query); if(!results.Success()) it2 = Guilds.erase(it2); diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index c01d10265..f285f8410 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -17,7 +17,6 @@ */ -#include "../common/database.h" #include "../common/global_define.h" #include "../common/eqemu_logsys.h" #include "../common/opcodemgr.h" @@ -37,7 +36,6 @@ volatile bool RunLoops = true; TimeoutManager timeout_manager; Database database; -QSDatabase qs_database; LFGuildManager lfguildmanager; std::string WorldShortName; const queryservconfig *Config; @@ -79,7 +77,7 @@ int main() { Log.Out(Logs::General, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ - if (!qs_database.Connect( + if (!database.Connect( Config->QSDatabaseHost.c_str(), Config->QSDatabaseUsername.c_str(), Config->QSDatabasePassword.c_str(), diff --git a/queryserv/worldserver.cpp b/queryserv/worldserver.cpp index e043facf9..2d2f288a4 100644 --- a/queryserv/worldserver.cpp +++ b/queryserv/worldserver.cpp @@ -38,7 +38,7 @@ extern WorldServer worldserver; extern const queryservconfig *Config; -extern QSDatabase qs_database; +extern Database database; extern LFGuildManager lfguildmanager; WorldServer::WorldServer() @@ -78,42 +78,42 @@ void WorldServer::Process() Server_Speech_Struct *SSS = (Server_Speech_Struct*)pack->pBuffer; std::string tmp1 = SSS->from; std::string tmp2 = SSS->to; - qs_database.AddSpeech(tmp1.c_str(), tmp2.c_str(), SSS->message, SSS->minstatus, SSS->guilddbid, SSS->type); + database.AddSpeech(tmp1.c_str(), tmp2.c_str(), SSS->message, SSS->minstatus, SSS->guilddbid, SSS->type); break; } case ServerOP_QSPlayerLogTrades: { QSPlayerLogTrade_Struct *QS = (QSPlayerLogTrade_Struct*)pack->pBuffer; - qs_database.LogPlayerTrade(QS, QS->_detail_count); + database.LogPlayerTrade(QS, QS->_detail_count); break; } case ServerOP_QSPlayerLogHandins: { QSPlayerLogHandin_Struct *QS = (QSPlayerLogHandin_Struct*)pack->pBuffer; - qs_database.LogPlayerHandin(QS, QS->_detail_count); + database.LogPlayerHandin(QS, QS->_detail_count); break; } case ServerOP_QSPlayerLogNPCKills: { QSPlayerLogNPCKill_Struct *QS = (QSPlayerLogNPCKill_Struct*)pack->pBuffer; uint32 Members = pack->size - sizeof(QSPlayerLogNPCKill_Struct); if (Members > 0) Members = Members / sizeof(QSPlayerLogNPCKillsPlayers_Struct); - qs_database.LogPlayerNPCKill(QS, Members); + database.LogPlayerNPCKill(QS, Members); break; } case ServerOP_QSPlayerLogDeletes: { QSPlayerLogDelete_Struct *QS = (QSPlayerLogDelete_Struct*)pack->pBuffer; uint32 Items = QS->char_count; - qs_database.LogPlayerDelete(QS, Items); + database.LogPlayerDelete(QS, Items); break; } case ServerOP_QSPlayerLogMoves: { QSPlayerLogMove_Struct *QS = (QSPlayerLogMove_Struct*)pack->pBuffer; uint32 Items = QS->char_count; - qs_database.LogPlayerMove(QS, Items); + database.LogPlayerMove(QS, Items); break; } case ServerOP_QSPlayerLogMerchantTransactions: { QSMerchantLogTransaction_Struct *QS = (QSMerchantLogTransaction_Struct*)pack->pBuffer; uint32 Items = QS->char_count + QS->merchant_count; - qs_database.LogMerchantTransaction(QS, Items); + database.LogMerchantTransaction(QS, Items); break; } case ServerOP_QueryServGeneric: { @@ -155,7 +155,7 @@ void WorldServer::Process() } case ServerOP_QSSendQuery: { /* Process all packets here */ - qs_database.GeneralQueryReceive(pack); + database.GeneralQueryReceive(pack); break; } } From ad5d1e4814df05b1aaec898ef00d4cd999beb016 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:36:15 -0600 Subject: [PATCH 1623/1883] Some EQEmuLogSys changes regarding class variables --- common/eqemu_logsys.cpp | 5 ++--- common/eqemu_logsys.h | 7 ++++--- queryserv/queryserv.cpp | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 9f5a94d7a..6354d7a19 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -82,8 +82,9 @@ EQEmuLogSys::~EQEmuLogSys(){ void EQEmuLogSys::LoadLogSettingsDefaults() { + /* Get Executable platform currently running this code (Zone/World/etc) */ log_platform = GetExecutablePlatformInt(); - /* Write defaults */ + /* Zero out Array */ for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ log_settings[i].log_to_console = 0; log_settings[i].log_to_file = 0; @@ -96,8 +97,6 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[Logs::UCS_Server].log_to_console = 1; log_settings[Logs::Crash].log_to_console = 1; log_settings[Logs::MySQLError].log_to_console = 1; - - log_settings_loaded = true; } std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 66124df74..26cffdc57 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -141,10 +141,11 @@ public: LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; - bool log_settings_loaded = false; - bool file_logs_enabled = false; + bool file_logs_enabled = false; /* Set when log settings are loaded to determine if keeping a file open is necessary */ - int log_platform = 0; + int log_platform = 0; /* Sets Executable platform (Zone/World/UCS) etc. */ + + std::string process_file_name; /* File name used in writing logs */ uint16 GetGMSayColorFromCategory(uint16 log_category); diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index f285f8410..1f9aa5b1d 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -77,15 +77,15 @@ int main() { Log.Out(Logs::General, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ - if (!database.Connect( - Config->QSDatabaseHost.c_str(), - Config->QSDatabaseUsername.c_str(), - Config->QSDatabasePassword.c_str(), - Config->QSDatabaseDB.c_str(), - Config->QSDatabasePort)) { - Log.Out(Logs::General, Logs::QS_Server, "Cannot continue without a database connection."); - return 1; - } + // if (!database.Connect( + // Config->QSDatabaseHost.c_str(), + // Config->QSDatabaseUsername.c_str(), + // Config->QSDatabasePassword.c_str(), + // Config->QSDatabaseDB.c_str(), + // Config->QSDatabasePort)) { + // Log.Out(Logs::General, Logs::QS_Server, "Cannot continue without a database connection."); + // return 1; + // } /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); From 01940ee5ed37601d58b1b2d357cb140418741ade Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 05:52:50 -0600 Subject: [PATCH 1624/1883] Implement crash logging, 'crash_processname_pid.log' at the root of logs/ --- common/eqemu_logsys.cpp | 19 ++++++++++++++++++- queryserv/queryserv.cpp | 18 +++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 6354d7a19..5b473c7ae 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -28,6 +28,7 @@ #include #include #include +#include std::ofstream process_log; @@ -84,6 +85,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults() { /* Get Executable platform currently running this code (Zone/World/etc) */ log_platform = GetExecutablePlatformInt(); + /* Zero out Array */ for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ log_settings[i].log_to_console = 0; @@ -91,12 +93,18 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[i].log_to_gmsay = 0; } + /* Set Defaults */ log_settings[Logs::World_Server].log_to_console = 1; log_settings[Logs::Zone_Server].log_to_console = 1; log_settings[Logs::QS_Server].log_to_console = 1; log_settings[Logs::UCS_Server].log_to_console = 1; log_settings[Logs::Crash].log_to_console = 1; log_settings[Logs::MySQLError].log_to_console = 1; + + /* Declare process file names for log writing */ + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ process_file_name = "world"; } + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){ process_file_name = "query_server"; } + } std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ @@ -129,6 +137,15 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, std::str void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message) { + if (log_category == Logs::Crash){ + char time_stamp[80]; + EQEmuLogSys::SetCurrentTimeStamp(time_stamp); + std::ofstream crash_log; + crash_log.open(StringFormat("logs/crash_%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + crash_log << time_stamp << " " << message << "\n"; + crash_log.close(); + } + /* Check if category enabled for process */ if (log_settings[log_category].log_to_file == 0) return; @@ -249,7 +266,7 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message); - EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message); + EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 1f9aa5b1d..f285f8410 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -77,15 +77,15 @@ int main() { Log.Out(Logs::General, Logs::QS_Server, "Connecting to MySQL..."); /* MySQL Connection */ - // if (!database.Connect( - // Config->QSDatabaseHost.c_str(), - // Config->QSDatabaseUsername.c_str(), - // Config->QSDatabasePassword.c_str(), - // Config->QSDatabaseDB.c_str(), - // Config->QSDatabasePort)) { - // Log.Out(Logs::General, Logs::QS_Server, "Cannot continue without a database connection."); - // return 1; - // } + if (!database.Connect( + Config->QSDatabaseHost.c_str(), + Config->QSDatabaseUsername.c_str(), + Config->QSDatabasePassword.c_str(), + Config->QSDatabaseDB.c_str(), + Config->QSDatabasePort)) { + Log.Out(Logs::General, Logs::QS_Server, "Cannot continue without a database connection."); + return 1; + } /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); From 9ae28d7619d743c66687b2278b8055f6f765a884 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 06:13:12 -0600 Subject: [PATCH 1625/1883] More process based logging work --- common/eqemu_logsys.cpp | 30 ++++++++++++++++++++++-------- zone/net.cpp | 1 + 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 5b473c7ae..e8bf940e4 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -102,9 +102,16 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[Logs::MySQLError].log_to_console = 1; /* Declare process file names for log writing */ - if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ process_file_name = "world"; } - if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){ process_file_name = "query_server"; } - + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ + process_file_name = "world"; + } + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){ + process_file_name = "query_server"; + } + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + process_file_name = "zone"; + } + } std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ @@ -274,7 +281,7 @@ void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){ struct tm * time_info; time(&raw_time); time_info = localtime(&raw_time); - strftime(time_stamp, 80, "[%d-%m-%Y :: %H:%M:%S]", time_info); + strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info); } void EQEmuLogSys::MakeDirectory(std::string directory_name){ @@ -288,19 +295,26 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ void EQEmuLogSys::CloseFileLogs() { if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - std::cout << "Closing down zone logs..." << std::endl; + //std::cout << "Closing down zone logs..." << std::endl; + } + if (process_log.is_open()){ + process_log.close(); } - process_log.close(); } void EQEmuLogSys::StartFileLogs(const std::string log_name) { + EQEmuLogSys::CloseFileLogs(); if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + if (log_name != "") + process_file_name = log_name; + std::cout << "Starting Zone Logs..." << std::endl; EQEmuLogSys::MakeDirectory("logs/zone"); - process_log.open(StringFormat("logs/zone/%s.txt", log_name.c_str()), std::ios_base::app | std::ios_base::out); + process_log.open(StringFormat("logs/zone/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } else{ - + std::cout << "Starting Process Log..." << std::endl; + process_log.open(StringFormat("logs/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } } \ No newline at end of file diff --git a/zone/net.cpp b/zone/net.cpp index 55591c1c2..9f46bd384 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -169,6 +169,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(""); /* Guilds */ guild_mgr.SetDatabase(&database); From e4829225f6dcb6829e32002ce9cd49bfa0da3005 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 06:15:56 -0600 Subject: [PATCH 1626/1883] Add file log handling in every process --- client_files/export/main.cpp | 1 + client_files/import/main.cpp | 1 + common/eqemu_logsys.h | 2 +- queryserv/queryserv.cpp | 1 + shared_memory/main.cpp | 2 +- ucs/ucs.cpp | 1 + world/net.cpp | 1 + zone/net.cpp | 2 +- 8 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 633fecc79..f950907ac 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -57,6 +57,7 @@ int main(int argc, char **argv) { /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); ExportSpells(&database); ExportSkillCaps(&database); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 8522227a7..67b0c7140 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -54,6 +54,7 @@ int main(int argc, char **argv) { } database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); ImportSpells(&database); ImportSkillCaps(&database); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 26cffdc57..223b87610 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -131,7 +131,7 @@ public: void MakeDirectory(std::string directory_name); void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); void SetCurrentTimeStamp(char* time_stamp); - void StartFileLogs(const std::string log_name); + void StartFileLogs(const std::string log_name = ""); struct LogSettings{ uint8 log_to_file; diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index f285f8410..b724276e6 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -89,6 +89,7 @@ int main() { /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { Log.Out(Logs::General, Logs::QS_Server, "Could not set signal handler"); diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index da385e6ba..bddf03b06 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -58,8 +58,8 @@ int main(int argc, char **argv) { } /* Register Log System and Settings */ - Log.LoadLogSettingsDefaults(); database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); bool load_all = true; bool load_items = false; diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index e67c9e445..e00754370 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -99,6 +99,7 @@ int main() { /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); char tmp[64]; diff --git a/world/net.cpp b/world/net.cpp index 97ac46353..fae6efd1b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -185,6 +185,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ database.LoadLogSysSettings(Log.log_settings); + Log.StartFileLogs(); if (argc >= 2) { char tmp[2]; diff --git a/zone/net.cpp b/zone/net.cpp index 9f46bd384..7d25c1ff7 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -169,7 +169,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); database.LoadLogSysSettings(Log.log_settings); - Log.StartFileLogs(""); + Log.StartFileLogs(); /* Guilds */ guild_mgr.SetDatabase(&database); From f4847607fdcd18ce51bd845ec88bf994a07ca60f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 06:26:12 -0600 Subject: [PATCH 1627/1883] More work on process logging --- common/eqemu_logsys.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index e8bf940e4..826d4955e 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -101,7 +101,9 @@ void EQEmuLogSys::LoadLogSettingsDefaults() log_settings[Logs::Crash].log_to_console = 1; log_settings[Logs::MySQLError].log_to_console = 1; - /* Declare process file names for log writing */ + /* Declare process file names for log writing + If there is no process_file_name declared, no log file will be written, simply + */ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ process_file_name = "world"; } @@ -111,7 +113,15 @@ void EQEmuLogSys::LoadLogSettingsDefaults() if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ process_file_name = "zone"; } - + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS){ + process_file_name = "ucs"; + } + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){ + process_file_name = "login"; + } + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){ + process_file_name = "launcher"; + } } std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){ @@ -305,16 +315,28 @@ void EQEmuLogSys::CloseFileLogs() void EQEmuLogSys::StartFileLogs(const std::string log_name) { EQEmuLogSys::CloseFileLogs(); + + /* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one... */ + if (file_logs_enabled == false) + return; + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ if (log_name != "") process_file_name = log_name; + if (process_file_name == ""){ + return; + } + std::cout << "Starting Zone Logs..." << std::endl; EQEmuLogSys::MakeDirectory("logs/zone"); process_log.open(StringFormat("logs/zone/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } else{ - std::cout << "Starting Process Log..." << std::endl; + if (process_file_name == ""){ + return; + } + std::cout << "Starting Process Log (" << process_file_name << ")..." << std::endl; process_log.open(StringFormat("logs/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } } \ No newline at end of file From 8ae2d86962d0090226b3a04c437ab6175457851a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 06:49:31 -0600 Subject: [PATCH 1628/1883] rename process_file_name to platform_file_name for consistency --- common/eqemu_logsys.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 826d4955e..962d4e4a1 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -105,22 +105,22 @@ void EQEmuLogSys::LoadLogSettingsDefaults() If there is no process_file_name declared, no log file will be written, simply */ if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){ - process_file_name = "world"; + platform_file_name = "world"; } if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){ - process_file_name = "query_server"; + platform_file_name = "query_server"; } if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - process_file_name = "zone"; + platform_file_name = "zone"; } if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS){ - process_file_name = "ucs"; + platform_file_name = "ucs"; } if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){ - process_file_name = "login"; + platform_file_name = "login"; } if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){ - process_file_name = "launcher"; + platform_file_name = "launcher"; } } @@ -158,7 +158,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std:: char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); std::ofstream crash_log; - crash_log.open(StringFormat("logs/crash_%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + crash_log.open(StringFormat("logs/crash_%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); crash_log << time_stamp << " " << message << "\n"; crash_log.close(); } @@ -322,21 +322,21 @@ void EQEmuLogSys::StartFileLogs(const std::string log_name) if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ if (log_name != "") - process_file_name = log_name; + platform_file_name = log_name; - if (process_file_name == ""){ + if (platform_file_name == ""){ return; } std::cout << "Starting Zone Logs..." << std::endl; EQEmuLogSys::MakeDirectory("logs/zone"); - process_log.open(StringFormat("logs/zone/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + process_log.open(StringFormat("logs/zone/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } else{ - if (process_file_name == ""){ + if (platform_file_name == ""){ return; } - std::cout << "Starting Process Log (" << process_file_name << ")..." << std::endl; - process_log.open(StringFormat("logs/%s_%i.txt", process_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + std::cout << "Starting Process Log (" << platform_file_name << ")..." << std::endl; + process_log.open(StringFormat("logs/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } } \ No newline at end of file From ee108b5b74f9811b144ad4e0edec401a3042e650 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 20 Jan 2015 15:33:26 -0500 Subject: [PATCH 1629/1883] Skill gain logging fix. (iluvseq) --- zone/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index b7d52e82d..a1bea2a96 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2232,10 +2232,10 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + _log(SKILLS__GAIN, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - _log(SKILLS__GAIN, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + _log(SKILLS__GAIN, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { _log(SKILLS__GAIN, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); From a84f480ffc32f811f7a7d94373e846f7ab6f4d25 Mon Sep 17 00:00:00 2001 From: JJ Date: Tue, 20 Jan 2015 15:51:00 -0500 Subject: [PATCH 1630/1883] ... and lang. --- zone/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index a1bea2a96..f6b96aa46 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2259,10 +2259,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) { if(zone->random.Real(0,100) < Chance) { // if they make the roll IncreaseLanguageSkill(langid); // increase the language skill by 1 - _log(SKILLS__GAIN, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance); + _log(SKILLS__GAIN, "Language %d at value %d successfully gain with %d%%chance", langid, LangSkill, Chance); } else - _log(SKILLS__GAIN, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance); + _log(SKILLS__GAIN, "Language %d at value %d failed to gain with %d%%chance", langid, LangSkill, Chance); } } From ad711b0b5aba01927c5e01242b72b2a3f250def8 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 20 Jan 2015 17:35:39 -0500 Subject: [PATCH 1631/1883] Fix for compile issue with vs2012 --- zone/aa.cpp | 16 ++++++++-------- zone/client.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 0f94b8c72..b1c561c9e 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -547,9 +547,9 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u summon_count = MAX_SWARM_PETS; static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { - {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, - {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, - {8, 8}, {-8, 8}, {8, -8}, {-8, -8} + xy_location(5, 5), xy_location(-5, 5), xy_location(5, -5), xy_location(-5, -5), + xy_location(10, 10), xy_location(-10, 10), xy_location(10, -10), xy_location(-10, -10), + xy_location(8, 8), xy_location(-8, 8), xy_location(8, -8), xy_location(-8, -8) }; while(summon_count > 0) { @@ -643,11 +643,11 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid if(summon_count > MAX_SWARM_PETS) summon_count = MAX_SWARM_PETS; - static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { - {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, - {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, - {8, 8}, {-8, 8}, {8, -8}, {-8, -8} - }; + static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { + xy_location(5, 5), xy_location(-5, 5), xy_location(5, -5), xy_location(-5, -5), + xy_location(10, 10), xy_location(-10, 10), xy_location(10, -10), xy_location(-10, -10), + xy_location(8, 8), xy_location(-8, 8), xy_location(8, -8), xy_location(-8, -8) + };; while(summon_count > 0) { int pet_duration = pet.duration; diff --git a/zone/client.cpp b/zone/client.cpp index f6b96aa46..feb47dc6f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6275,9 +6275,9 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid summon_count = MAX_SWARM_PETS; static const xy_location swarmPetLocations[MAX_SWARM_PETS] = { - {5, 5}, {-5, 5}, {5, -5}, {-5, -5}, - {10, 10}, {-10, 10}, {10, -10}, {-10, -10}, - {8, 8}, {-8, 8}, {8, -8}, {-8, -8} + xy_location(5, 5), xy_location(-5, 5), xy_location(5, -5), xy_location(-5, -5), + xy_location(10, 10), xy_location(-10, 10), xy_location(10, -10), xy_location(-10, -10), + xy_location(8, 8), xy_location(-8, 8), xy_location(8, -8), xy_location(-8, -8) }; while(summon_count > 0) { From f7ca12f7cc9bb6c004d1667019c11e6f7159067f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 18:47:20 -0600 Subject: [PATCH 1632/1883] Changed defaults to use enum --- common/eqemu_logsys.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 962d4e4a1..03c690ec5 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -94,12 +94,12 @@ void EQEmuLogSys::LoadLogSettingsDefaults() } /* Set Defaults */ - log_settings[Logs::World_Server].log_to_console = 1; - log_settings[Logs::Zone_Server].log_to_console = 1; - log_settings[Logs::QS_Server].log_to_console = 1; - log_settings[Logs::UCS_Server].log_to_console = 1; - log_settings[Logs::Crash].log_to_console = 1; - log_settings[Logs::MySQLError].log_to_console = 1; + log_settings[Logs::World_Server].log_to_console = Logs::General; + log_settings[Logs::Zone_Server].log_to_console = Logs::General; + log_settings[Logs::QS_Server].log_to_console = Logs::General; + log_settings[Logs::UCS_Server].log_to_console = Logs::General; + log_settings[Logs::Crash].log_to_console = Logs::General; + log_settings[Logs::MySQLError].log_to_console = Logs::General; /* Declare process file names for log writing If there is no process_file_name declared, no log file will be written, simply From bd757417d5fb621047315856f78203aeebf26ad4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:05:11 -0600 Subject: [PATCH 1633/1883] Platform changes for getpid() --- common/eqemu_logsys.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 03c690ec5..6224d287d 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -28,7 +28,6 @@ #include #include #include -#include std::ofstream process_log; @@ -38,7 +37,9 @@ std::ofstream process_log; #include #include #include + #include #else + #include #include #endif From ce3d4e678f4f5fa9c3c491fa84a4dd53b3698ce7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:19:57 -0600 Subject: [PATCH 1634/1883] Push something that apparently didn't make its way through before --- common/eqemu_logsys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 223b87610..3578aad0c 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -145,7 +145,7 @@ public: int log_platform = 0; /* Sets Executable platform (Zone/World/UCS) etc. */ - std::string process_file_name; /* File name used in writing logs */ + std::string platform_file_name; /* File name used in writing logs */ uint16 GetGMSayColorFromCategory(uint16 log_category); From 98f0d4df4928869bc7b50f99220b9b830fe66b1a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:22:28 -0600 Subject: [PATCH 1635/1883] UpdateAdmin Linux build fix --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index cd58cfa7c..85d4b61dd 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1502,7 +1502,7 @@ void Client::UpdateAdmin(bool iFromDB) { if(m_pp.gm) { - Log.Out(Logs::Moderate, Logs::Zone_Server, __FUNCTION__ " - %s is a GM", GetName()); + Log.Out(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName()); // no need for this, having it set in pp you already start as gm // and it's also set in your spawn packet so other people see it too // SendAppearancePacket(AT_GM, 1, false); From 440ca97a795458b4a98b3bf2bf6ed2e699031261 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:40:55 -0600 Subject: [PATCH 1636/1883] Remove Unneeded DebugBreak: --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 266850411..841fac506 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -75,7 +75,6 @@ Client *Entity::CastToClient() { if (this == 0x00) { std::cout << "CastToClient error (nullptr)" << std::endl; - DebugBreak(); return 0; } #ifdef _EQDEBUG From 7fef8de50a4d1563f7c14859d3f6379564f82931 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:14 -0600 Subject: [PATCH 1637/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 841fac506..4936a1f69 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -80,7 +80,6 @@ Client *Entity::CastToClient() #ifdef _EQDEBUG if (!IsClient()) { std::cout << "CastToClient error (not client?)" << std::endl; - DebugBreak(); return 0; } #endif From f44155a31772a156e949e1b7790c115203e0fdb4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:17 -0600 Subject: [PATCH 1638/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 4936a1f69..60a2a87ac 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -91,7 +91,6 @@ NPC *Entity::CastToNPC() #ifdef _EQDEBUG if (!IsNPC()) { std::cout << "CastToNPC error" << std::endl; - DebugBreak(); return 0; } #endif From a19f7f702ca4c4b4eea0a3a724567497ad28af11 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:18 -0600 Subject: [PATCH 1639/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 60a2a87ac..55d88f1be 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -102,7 +102,6 @@ Mob *Entity::CastToMob() #ifdef _EQDEBUG if (!IsMob()) { std::cout << "CastToMob error" << std::endl; - DebugBreak(); return 0; } #endif From 6e582fb68f4e3c02dac225875d7b91455ad6561f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:19 -0600 Subject: [PATCH 1640/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 55d88f1be..b727a2e81 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -113,7 +113,6 @@ Merc *Entity::CastToMerc() #ifdef _EQDEBUG if (!IsMerc()) { std::cout << "CastToMerc error" << std::endl; - DebugBreak(); return 0; } #endif From 6c545a144cd89f64db175f02a2607d241b923f6f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:20 -0600 Subject: [PATCH 1641/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index b727a2e81..805f5f4ec 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -135,7 +135,6 @@ Corpse *Entity::CastToCorpse() #ifdef _EQDEBUG if (!IsCorpse()) { std::cout << "CastToCorpse error" << std::endl; - DebugBreak(); return 0; } #endif From 29fe791ad0753b4db344b1bad77708eac79e9569 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:21 -0600 Subject: [PATCH 1642/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 805f5f4ec..176f1af8e 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -146,7 +146,6 @@ Object *Entity::CastToObject() #ifdef _EQDEBUG if (!IsObject()) { std::cout << "CastToObject error" << std::endl; - DebugBreak(); return 0; } #endif From 456356d6260a9134c08f6ec829895595893f7671 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:22 -0600 Subject: [PATCH 1643/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 176f1af8e..34f630b59 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -156,7 +156,6 @@ Object *Entity::CastToObject() #ifdef _EQDEBUG if(!IsGroup()) { std::cout << "CastToGroup error" << std::endl; - DebugBreak(); return 0; } #endif From 0db638c8c01618b0691c41e19db5f781d9df876c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:23 -0600 Subject: [PATCH 1644/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 34f630b59..eb387d403 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -176,7 +176,6 @@ const Client *Entity::CastToClient() const { if (this == 0x00) { std::cout << "CastToClient error (nullptr)" << std::endl; - DebugBreak(); return 0; } #ifdef _EQDEBUG From 26b65a05a91399869ffe9d9405acdc6b479fe48f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:24 -0600 Subject: [PATCH 1645/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index eb387d403..1229362b3 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -181,7 +181,6 @@ const Client *Entity::CastToClient() const #ifdef _EQDEBUG if (!IsClient()) { std::cout << "CastToClient error (not client?)" << std::endl; - DebugBreak(); return 0; } #endif From 32cba9083cf52bfba04dd5dd6d1c72ce4ddf90e2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:25 -0600 Subject: [PATCH 1646/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 1229362b3..9f797d94c 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -192,7 +192,6 @@ const NPC *Entity::CastToNPC() const #ifdef _EQDEBUG if (!IsNPC()) { std::cout << "CastToNPC error" << std::endl; - DebugBreak(); return 0; } #endif From 90dd9f8aeb1ca4d7bb6a4c042fffc85a9a9c626b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:26 -0600 Subject: [PATCH 1647/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9f797d94c..d272f62e4 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -203,7 +203,6 @@ const Mob *Entity::CastToMob() const #ifdef _EQDEBUG if (!IsMob()) { std::cout << "CastToMob error" << std::endl; - DebugBreak(); return 0; } #endif From 07d2eab1831c88127e88f4aac85acc358d2691ac Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:27 -0600 Subject: [PATCH 1648/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index d272f62e4..b922b6e2d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -214,7 +214,6 @@ const Merc *Entity::CastToMerc() const #ifdef _EQDEBUG if (!IsMerc()) { std::cout << "CastToMerc error" << std::endl; - DebugBreak(); return 0; } #endif From 56b0a2aa4f463de0324bc3c81df59a3fcad75634 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:28 -0600 Subject: [PATCH 1649/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index b922b6e2d..3eec3d0fc 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -235,7 +235,6 @@ const Corpse *Entity::CastToCorpse() const #ifdef _EQDEBUG if (!IsCorpse()) { std::cout << "CastToCorpse error" << std::endl; - DebugBreak(); return 0; } #endif From a6a86f030c85fa8e739132c89c29a8311eeccefe Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:29 -0600 Subject: [PATCH 1650/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 3eec3d0fc..924e95f11 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -246,7 +246,6 @@ const Object *Entity::CastToObject() const #ifdef _EQDEBUG if (!IsObject()) { std::cout << "CastToObject error" << std::endl; - DebugBreak(); return 0; } #endif From 013216ff2b878401b13b1a334649c186fba04e28 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:41:30 -0600 Subject: [PATCH 1651/1883] Remove Unneeded DebugBreak --- zone/entity.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 924e95f11..717986bd6 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -268,7 +268,6 @@ Bot *Entity::CastToBot() #ifdef _EQDEBUG if (!IsBot()) { std::cout << "CastToBot error" << std::endl; - DebugBreak(); return 0; } #endif From c202b9e7b6247923da41b468405244e5c0e1b645 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 19:54:08 -0600 Subject: [PATCH 1652/1883] Linux fix in worldserver.cpp with __FUNCTION__ --- zone/worldserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index f305133dd..dc3b23339 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -746,7 +746,7 @@ void WorldServer::Process() { } case ServerOP_SyncWorldTime: { if(zone!=0) { - Log.Out(Logs::Moderate, Logs::Zone_Server, __FUNCTION__ "Received Message SyncWorldTime"); + Log.Out(Logs::Moderate, Logs::Zone_Server, "%s Received Message SyncWorldTime", __FUNCTION__); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); From 38c94f6dda5e041d391460c3e1f7dcfaa8a873da Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 20:00:48 -0600 Subject: [PATCH 1653/1883] Push table update --- .../2015_1_15_logsys_categories_table.sql | 70 +++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql index 6e6847416..fee695604 100644 --- a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql +++ b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql @@ -1,3 +1,17 @@ +/* +Navicat MySQL Data Transfer + +Source Server : localhost +Source Server Version : 50505 +Source Host : localhost:3306 +Source Database : ez + +Target Server Type : MYSQL +Target Server Version : 50505 +File Encoding : 65001 + +Date: 2015-01-20 20:00:17 +*/ SET FOREIGN_KEY_CHECKS=0; @@ -17,23 +31,39 @@ CREATE TABLE `logsys_categories` ( -- ---------------------------- -- Records of logsys_categories -- ---------------------------- -INSERT INTO `logsys_categories` VALUES ('1', 'Zone_Server', '1', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('2', 'World_Server', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('3', 'UCS_Server', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('4', 'QS_Server', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('5', 'WebInterface_Server', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('6', 'AA', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('7', 'Doors', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('8', 'Guilds', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('9', 'Inventory', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('10', 'Launcher', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('11', 'Netcode - Does not log to gmsay for loop reasons', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('12', 'Object', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('13', 'Rules', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('14', 'Skills', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('15', 'Spawns', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('16', 'Spells', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('17', 'Tasks', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('18', 'Trading', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('19', 'Tradeskills', '0', '0', '1'); -INSERT INTO `logsys_categories` VALUES ('20', 'Tribute', '0', '0', '1'); +INSERT INTO `logsys_categories` VALUES ('1', 'AA', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('2', 'AI', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('3', 'Aggro', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('4', 'Attack', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('5', 'Client_Server_Packet', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('6', 'Combat', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('7', 'Commands', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('8', 'Crash', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('9', 'Debug', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('10', 'Doors', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('11', 'Error', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('12', 'Guilds', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('13', 'Inventory', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('14', 'Launcher', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('15', 'Netcode', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('16', 'Normal', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('17', 'Object', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('18', 'Pathing', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('19', 'QS_Server', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('20', 'Quests', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('21', 'Rules', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('22', 'Skills', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('23', 'Spawns', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('24', 'Spells', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('25', 'Status', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('26', 'TCP_Connection', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('27', 'Tasks', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('28', 'Tradeskills', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('29', 'Trading', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('30', 'Tribute', '0', '1', '0'); +INSERT INTO `logsys_categories` VALUES ('31', 'UCS_Server', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('32', 'WebInterface_Server', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('33', 'World_Server', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('34', 'Zone Server', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('35', 'MySQL Error', '1', '1', '1'); +INSERT INTO `logsys_categories` VALUES ('36', 'MySQL Queries', '0', '1', '0'); From 7101d84b275194173cae8763e43d78b588d3b3d1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 20:01:44 -0600 Subject: [PATCH 1654/1883] Remove garbage in commit --- .../2015_1_15_logsys_categories_table.sql | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql index fee695604..45d9cde3b 100644 --- a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql +++ b/utils/sql/git/required/2015_1_15_logsys_categories_table.sql @@ -1,20 +1,3 @@ -/* -Navicat MySQL Data Transfer - -Source Server : localhost -Source Server Version : 50505 -Source Host : localhost:3306 -Source Database : ez - -Target Server Type : MYSQL -Target Server Version : 50505 -File Encoding : 65001 - -Date: 2015-01-20 20:00:17 -*/ - -SET FOREIGN_KEY_CHECKS=0; - -- ---------------------------- -- Table structure for logsys_categories -- ---------------------------- From 1871c3f24f6edf6d51374c3670f4394c89fccee4 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 23:18:23 -0600 Subject: [PATCH 1655/1883] Implement first pieces of #log --- zone/command.cpp | 28 +++++++++++++++++++++++++++- zone/command.h | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 3902242c6..33ceca542 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -427,7 +427,8 @@ int command_init(void) { command_add("close_shop", nullptr, 100, command_merchantcloseshop) || command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || - command_add("logtest", "Performs log performance testing.", 250, command_logtest) + command_add("logtest", "Performs log performance testing.", 250, command_logtest) || + command_add("log", "Manage anything to do with logs", 250, command_log) ) { command_deinit(); @@ -10414,4 +10415,29 @@ void command_crashtest(Client *c, const Seperator *sep) c->Message(0, "Alright, now we get an GPF ;) "); char* gpf = 0; memcpy(gpf, "Ready to crash", 30); +} + +void command_log(Client *c, const Seperator *sep){ + if (sep->argnum > 0) { + if(strcasecmp(sep->arg[1], "reload_all") == 0){ + c->Message(0, "Yes this is working"); + } + if (strcasecmp(sep->arg[1], "list_settings") == 0){ + c->Message(0, "[Category ID | log_to_console | log_to_file | log_to_gmsay | Category Description]"); + int redisplay_columns = 0; + for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ + if (redisplay_columns == 10){ + c->Message(0, "[Category ID | log_to_console | log_to_file | log_to_gmsay | Category Description]"); + redisplay_columns = 0; + } + c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, Log.log_settings[i].log_to_console, Log.log_settings[i].log_to_file, Log.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str()); + redisplay_columns++; + } + } + } + else { + c->Message(0, "#log usage:"); + c->Message(0, "--- #log reload_all - Reloads all rules defined in database in world and all zone processes"); + c->Message(0, "--- #log list_settings - Shows current log settings and categories"); + } } \ No newline at end of file diff --git a/zone/command.h b/zone/command.h index ab32bfd5e..2e15788cd 100644 --- a/zone/command.h +++ b/zone/command.h @@ -323,6 +323,7 @@ void command_merchantopenshop(Client *c, const Seperator *sep); void command_merchantcloseshop(Client *c, const Seperator *sep); void command_shownumhits(Client *c, const Seperator *sep); void command_logtest(Client *c, const Seperator *sep); +void command_log(Client *c, const Seperator *sep); #ifdef EQPROFILE void command_profiledump(Client *c, const Seperator *sep); From d4460b94be8d2128294795464e73609b2ebd84e3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 20 Jan 2015 23:21:32 -0600 Subject: [PATCH 1656/1883] Rename #log to #logs after thinking deeply about it --- zone/command.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 33ceca542..67d8a1f38 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -428,7 +428,7 @@ int command_init(void) { command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || command_add("logtest", "Performs log performance testing.", 250, command_logtest) || - command_add("log", "Manage anything to do with logs", 250, command_log) + command_add("logs", "Manage anything to do with logs", 250, command_logs) ) { command_deinit(); @@ -10417,7 +10417,7 @@ void command_crashtest(Client *c, const Seperator *sep) memcpy(gpf, "Ready to crash", 30); } -void command_log(Client *c, const Seperator *sep){ +void command_logs(Client *c, const Seperator *sep){ if (sep->argnum > 0) { if(strcasecmp(sep->arg[1], "reload_all") == 0){ c->Message(0, "Yes this is working"); @@ -10436,8 +10436,9 @@ void command_log(Client *c, const Seperator *sep){ } } else { - c->Message(0, "#log usage:"); - c->Message(0, "--- #log reload_all - Reloads all rules defined in database in world and all zone processes"); - c->Message(0, "--- #log list_settings - Shows current log settings and categories"); + c->Message(0, "#logs usage:"); + c->Message(0, "--- #logs reload_all - Reloads all rules defined in database in world and all zone processes"); + c->Message(0, "--- #logs list_settings - Shows current log settings and categories"); + c->Message(0, "--- #logs set - Sets in memory the log settings, if you want settings to be permanent, edit your 'logsys_categories' table"); } } \ No newline at end of file From 6cfe9e301bbe8e2eb2d269e608129b4c42d7fc25 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 00:01:28 -0600 Subject: [PATCH 1657/1883] Preliminary log setting commands --- zone/command.cpp | 23 +++++++++++++++++++++++ zone/command.h | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 67d8a1f38..7b33b46c0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10418,10 +10418,33 @@ void command_crashtest(Client *c, const Seperator *sep) } void command_logs(Client *c, const Seperator *sep){ + int logs_set = 0; if (sep->argnum > 0) { if(strcasecmp(sep->arg[1], "reload_all") == 0){ c->Message(0, "Yes this is working"); } + if (strcasecmp(sep->arg[1], "set") == 0){ + if (strcasecmp(sep->arg[4], "log_to_console") == 0){ + Log.log_settings[atoi(sep->arg[2])].log_to_console = atoi(sep->arg[3]); + logs_set = 1; + } + else if (strcasecmp(sep->arg[4], "log_to_file") == 0){ + Log.log_settings[atoi(sep->arg[2])].log_to_file = atoi(sep->arg[3]); + logs_set = 1; + } + else if (strcasecmp(sep->arg[4], "log_to_gmsay") == 0){ + Log.log_settings[atoi(sep->arg[2])].log_to_gmsay = atoi(sep->arg[3]); + logs_set = 1; + } + else{ + c->Message(0, "--- #logs set - Sets in memory the log settings, if you want settings to be permanent, edit your 'logsys_categories' table"); + c->Message(0, "--- #logs set 20 1 log_to_gmsay - Would output Quest errors to gmsay"); + } + if (logs_set == 1){ + c->Message(15, "Your Log Settings have been applied"); + c->Message(15, "%s :: Debug Level: %i - Category: %s", sep->arg[4], atoi(sep->arg[3]), Logs::LogCategoryName[atoi(sep->arg[2])]); + } + } if (strcasecmp(sep->arg[1], "list_settings") == 0){ c->Message(0, "[Category ID | log_to_console | log_to_file | log_to_gmsay | Category Description]"); int redisplay_columns = 0; diff --git a/zone/command.h b/zone/command.h index 2e15788cd..dbbd7e770 100644 --- a/zone/command.h +++ b/zone/command.h @@ -323,7 +323,7 @@ void command_merchantopenshop(Client *c, const Seperator *sep); void command_merchantcloseshop(Client *c, const Seperator *sep); void command_shownumhits(Client *c, const Seperator *sep); void command_logtest(Client *c, const Seperator *sep); -void command_log(Client *c, const Seperator *sep); +void command_logs(Client *c, const Seperator *sep); #ifdef EQPROFILE void command_profiledump(Client *c, const Seperator *sep); From 47bb4c0b2b1a1999adcd7f4aa1a90eaaa7ef7ec1 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 01:26:33 -0600 Subject: [PATCH 1658/1883] Implement #logs set [console|file|gmsay] --- zone/command.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 7b33b46c0..1f1bd7fc4 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10424,33 +10424,33 @@ void command_logs(Client *c, const Seperator *sep){ c->Message(0, "Yes this is working"); } if (strcasecmp(sep->arg[1], "set") == 0){ - if (strcasecmp(sep->arg[4], "log_to_console") == 0){ - Log.log_settings[atoi(sep->arg[2])].log_to_console = atoi(sep->arg[3]); + if (strcasecmp(sep->arg[2], "console") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]); logs_set = 1; } - else if (strcasecmp(sep->arg[4], "log_to_file") == 0){ - Log.log_settings[atoi(sep->arg[2])].log_to_file = atoi(sep->arg[3]); + else if (strcasecmp(sep->arg[2], "file") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]); logs_set = 1; } - else if (strcasecmp(sep->arg[4], "log_to_gmsay") == 0){ - Log.log_settings[atoi(sep->arg[2])].log_to_gmsay = atoi(sep->arg[3]); + else if (strcasecmp(sep->arg[2], "gmsay") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]); logs_set = 1; } else{ - c->Message(0, "--- #logs set - Sets in memory the log settings, if you want settings to be permanent, edit your 'logsys_categories' table"); - c->Message(0, "--- #logs set 20 1 log_to_gmsay - Would output Quest errors to gmsay"); + c->Message(0, "--- #logs set [console|file|gmsay] - Sets log settings during the lifetime of the zone"); + c->Message(0, "--- #logs set gmsay 20 1 - Would output Quest errors to gmsay"); } - if (logs_set == 1){ + if (logs_set == 1){ c->Message(15, "Your Log Settings have been applied"); - c->Message(15, "%s :: Debug Level: %i - Category: %s", sep->arg[4], atoi(sep->arg[3]), Logs::LogCategoryName[atoi(sep->arg[2])]); + c->Message(15, "Output Method: %s :: Debug Level: %i - Category: %s", sep->arg[2], atoi(sep->arg[4]), Logs::LogCategoryName[atoi(sep->arg[3])]); } } if (strcasecmp(sep->arg[1], "list_settings") == 0){ - c->Message(0, "[Category ID | log_to_console | log_to_file | log_to_gmsay | Category Description]"); + c->Message(0, "[Category ID | console | file | gmsay | Category Description]"); int redisplay_columns = 0; for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ if (redisplay_columns == 10){ - c->Message(0, "[Category ID | log_to_console | log_to_file | log_to_gmsay | Category Description]"); + c->Message(0, "[Category ID | console | file | gmsay | Category Description]"); redisplay_columns = 0; } c->Message(0, StringFormat("--- %i | %u | %u | %u | %s", i, Log.log_settings[i].log_to_console, Log.log_settings[i].log_to_file, Log.log_settings[i].log_to_gmsay, Logs::LogCategoryName[i]).c_str()); @@ -10462,6 +10462,6 @@ void command_logs(Client *c, const Seperator *sep){ c->Message(0, "#logs usage:"); c->Message(0, "--- #logs reload_all - Reloads all rules defined in database in world and all zone processes"); c->Message(0, "--- #logs list_settings - Shows current log settings and categories"); - c->Message(0, "--- #logs set - Sets in memory the log settings, if you want settings to be permanent, edit your 'logsys_categories' table"); + c->Message(0, "--- #logs set [console|file|gmsay] - Sets log settings during the lifetime of the zone"); } } \ No newline at end of file From ef0d383de96f5fa6e62509a4d107527a665ce3d5 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 02:12:22 -0600 Subject: [PATCH 1659/1883] Adjust #logs set --- zone/command.cpp | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 1f1bd7fc4..a91eae5eb 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10420,32 +10420,12 @@ void command_crashtest(Client *c, const Seperator *sep) void command_logs(Client *c, const Seperator *sep){ int logs_set = 0; if (sep->argnum > 0) { + /* #logs reload_all */ if(strcasecmp(sep->arg[1], "reload_all") == 0){ c->Message(0, "Yes this is working"); } - if (strcasecmp(sep->arg[1], "set") == 0){ - if (strcasecmp(sep->arg[2], "console") == 0){ - Log.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]); - logs_set = 1; - } - else if (strcasecmp(sep->arg[2], "file") == 0){ - Log.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]); - logs_set = 1; - } - else if (strcasecmp(sep->arg[2], "gmsay") == 0){ - Log.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]); - logs_set = 1; - } - else{ - c->Message(0, "--- #logs set [console|file|gmsay] - Sets log settings during the lifetime of the zone"); - c->Message(0, "--- #logs set gmsay 20 1 - Would output Quest errors to gmsay"); - } - if (logs_set == 1){ - c->Message(15, "Your Log Settings have been applied"); - c->Message(15, "Output Method: %s :: Debug Level: %i - Category: %s", sep->arg[2], atoi(sep->arg[4]), Logs::LogCategoryName[atoi(sep->arg[3])]); - } - } - if (strcasecmp(sep->arg[1], "list_settings") == 0){ + /* #logs list_settings */ + if (strcasecmp(sep->arg[1], "list_settings") == 0 || (strcasecmp(sep->arg[1], "set") == 0 && strcasecmp(sep->arg[3], "") == 0)){ c->Message(0, "[Category ID | console | file | gmsay | Category Description]"); int redisplay_columns = 0; for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){ @@ -10457,6 +10437,29 @@ void command_logs(Client *c, const Seperator *sep){ redisplay_columns++; } } + /* #logs set */ + if (strcasecmp(sep->arg[1], "set") == 0){ + if (strcasecmp(sep->arg[2], "console") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_console = atoi(sep->arg[4]); + logs_set = 1; + } + else if (strcasecmp(sep->arg[2], "file") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_file = atoi(sep->arg[4]); + logs_set = 1; + } + else if (strcasecmp(sep->arg[2], "gmsay") == 0){ + Log.log_settings[atoi(sep->arg[3])].log_to_gmsay = atoi(sep->arg[4]); + logs_set = 1; + } + else{ + c->Message(0, "--- #logs set [console|file|gmsay] - Sets log settings during the lifetime of the zone"); + c->Message(0, "--- #logs set gmsay 20 1 - Would output Quest errors to gmsay"); + } + if (logs_set == 1){ + c->Message(15, "Your Log Settings have been applied"); + c->Message(15, "Output Method: %s :: Debug Level: %i - Category: %s", sep->arg[2], atoi(sep->arg[4]), Logs::LogCategoryName[atoi(sep->arg[3])]); + } + } } else { c->Message(0, "#logs usage:"); From a59138d2d910ca75fefb33f80ee41079473c5f82 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 03:01:21 -0600 Subject: [PATCH 1660/1883] Implement #logs reload_all - To reload world and zone their log settings from the database --- common/servertalk.h | 21 +++++++++++---------- world/zoneserver.cpp | 5 +++++ zone/command.cpp | 7 +++++-- zone/worldserver.cpp | 4 ++++ 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/common/servertalk.h b/common/servertalk.h index f458c758e..547dda9b1 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -180,16 +180,17 @@ #define ServerOP_CZSignalClientByName 0x4007 #define ServerOP_CZMessagePlayer 0x4008 #define ServerOP_ReloadWorld 0x4009 - -#define ServerOP_QSPlayerLogTrades 0x4010 -#define ServerOP_QSPlayerLogHandins 0x4011 -#define ServerOP_QSPlayerLogNPCKills 0x4012 -#define ServerOP_QSPlayerLogDeletes 0x4013 -#define ServerOP_QSPlayerLogMoves 0x4014 -#define ServerOP_QSPlayerLogMerchantTransactions 0x4015 -#define ServerOP_QSSendQuery 0x4016 -#define ServerOP_CZSignalNPC 0x4017 -#define ServerOP_CZSetEntityVariableByNPCTypeID 0x4018 +#define ServerOP_ReloadLogs 0x4010 +/* Query Server OP Codes */ +#define ServerOP_QSPlayerLogTrades 0x5010 +#define ServerOP_QSPlayerLogHandins 0x5011 +#define ServerOP_QSPlayerLogNPCKills 0x5012 +#define ServerOP_QSPlayerLogDeletes 0x5013 +#define ServerOP_QSPlayerLogMoves 0x5014 +#define ServerOP_QSPlayerLogMerchantTransactions 0x5015 +#define ServerOP_QSSendQuery 0x5016 +#define ServerOP_CZSignalNPC 0x5017 +#define ServerOP_CZSetEntityVariableByNPCTypeID 0x5018 /* Query Serv Generic Packet Flag/Type Enumeration */ enum { QSG_LFGuild = 0 }; diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index d8909dbd8..51c07954e 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -792,6 +792,11 @@ bool ZoneServer::Process() { client_list.SendClientVersionSummary(srcvss->Name); break; } + case ServerOP_ReloadLogs: { + zoneserver_list.SendPacket(pack); + database.LoadLogSysSettings(Log.log_settings); + break; + } case ServerOP_ReloadRules: { zoneserver_list.SendPacket(pack); RuleManager::Instance()->LoadRules(&database, "default"); diff --git a/zone/command.cpp b/zone/command.cpp index a91eae5eb..65144d8f1 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10421,8 +10421,11 @@ void command_logs(Client *c, const Seperator *sep){ int logs_set = 0; if (sep->argnum > 0) { /* #logs reload_all */ - if(strcasecmp(sep->arg[1], "reload_all") == 0){ - c->Message(0, "Yes this is working"); + if (strcasecmp(sep->arg[1], "reload_all") == 0){ + ServerPacket *pack = new ServerPacket(ServerOP_ReloadLogs, 0); + worldserver.SendPacket(pack); + c->Message(13, "Successfully sent the packet to world to reload log settings from the database for all zones"); + safe_delete(pack); } /* #logs list_settings */ if (strcasecmp(sep->arg[1], "list_settings") == 0 || (strcasecmp(sep->arg[1], "set") == 0 && strcasecmp(sep->arg[3], "") == 0)){ diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index dc3b23339..b35894d04 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1748,6 +1748,10 @@ void WorldServer::Process() { RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset()); break; } + case ServerOP_ReloadLogs: { + database.LoadLogSysSettings(Log.log_settings); + break; + } case ServerOP_CameraShake: { if(zone) From 1e59416f331f3a7530d61e2896c78163e17cd5ba Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 16:49:25 -0600 Subject: [PATCH 1661/1883] Post merge manual fixes --- zone/command.cpp | 2 +- zone/inventory.cpp | 12 ++++++------ zone/tune.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 3c5d3c3a7..18b0892a0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -425,7 +425,7 @@ int command_init(void) { command_add("open_shop", nullptr, 100, command_merchantopenshop) || command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) || - command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) + command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) || command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || command_add("logtest", "Performs log performance testing.", 250, command_logtest) || command_add("logs", "Manage anything to do with logs", 250, command_logs) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 35b6aec8f..c108dfb10 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -2188,7 +2188,7 @@ void Client::RemoveDuplicateLore(bool client_update) auto inst = m_inv.PopItem(MainPowerSource); if (inst) { if (CheckLoreConflict(inst->GetItem())) { - Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Lore Duplication Error: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource); database.SaveInventory(character_id, nullptr, MainPowerSource); } else { @@ -2301,7 +2301,7 @@ void Client::MoveSlotNotAllowed(bool client_update) auto inst = m_inv.PopItem(MainPowerSource); bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false; int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow); - Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, slot_id, free_slot_id); + Log.Out(Logs::Detail, Logs::Inventory, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, MainPowerSource, free_slot_id); PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false); database.SaveInventory(character_id, nullptr, MainPowerSource); safe_delete(inst); @@ -2552,13 +2552,13 @@ void Client::SetBandolier(const EQApplicationPacket *app) { // If there was an item in that weapon slot, put it in the inventory Log.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); - _log(INVENTORY__BANDOLIER, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); + Log.Out(Logs::Detail, Logs::Inventory, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); if (MoveItemToInventory(InvItem)) { database.SaveInventory(character_id, 0, WeaponSlot); - Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), + Log.Out(Logs::General, Logs::Error, "returning item %s in weapon slot %i to inventory", InvItem->GetItem()->Name, WeaponSlot); } else { - _log(INVENTORY__BANDOLIER, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); + Log.Out(Logs::General, Logs::Error, "Char: %s, ERROR returning %s to inventory", GetName(), InvItem->GetItem()->Name); } safe_delete(InvItem); } @@ -2826,7 +2826,7 @@ bool Client::InterrogateInventory(Client* requester, bool log, bool silent, bool log = true; if (log) { - _Log.Out(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); + Log.Out(Logs::General, Logs::Error, "Client::InterrogateInventory() called for %s by %s with an error state of %s", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); } if (!silent) { requester->Message(1, "--- Inventory Interrogation Report for %s (requested by: %s, error state: %s) ---", GetName(), requester->GetName(), (error ? "TRUE" : "FALSE")); diff --git a/zone/tune.cpp b/zone/tune.cpp index 2f071e458..4153d5b84 100644 --- a/zone/tune.cpp +++ b/zone/tune.cpp @@ -20,7 +20,7 @@ //#define TUNE_DEBUG 20 #endif -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_constants.h" #include "../common/eq_packet_structs.h" #include "../common/rulesys.h" From 51b3ae9e0a4bd148c09a0656d1c87f74da05f592 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 16:55:56 -0600 Subject: [PATCH 1662/1883] Add shownumhits command back in from merge --- zone/command.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/command.cpp b/zone/command.cpp index 18b0892a0..4ee902696 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -426,6 +426,7 @@ int command_init(void) { command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) || command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) || + command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) || command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || command_add("logtest", "Performs log performance testing.", 250, command_logtest) || command_add("logs", "Manage anything to do with logs", 250, command_logs) From 683a81a6c8d52b877794c3b8519cca559b460953 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:39:36 -0600 Subject: [PATCH 1663/1883] Post merge fixes --- world/client.cpp | 2 +- zone/entity.cpp | 26 -------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/world/client.cpp b/world/client.cpp index cd10b8228..50b56cb0d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1442,7 +1442,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc) } } else { - clog(WORLD__CLIENT, "Found 'TitaniumStartZoneID' rule setting: %i", RuleI(World, TitaniumStartZoneID)); + Log.Out(Logs::General, Logs::World_Server, "Found 'TitaniumStartZoneID' rule setting: %i", RuleI(World, TitaniumStartZoneID)); if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */ pp.zone_id = RuleI(World, TitaniumStartZoneID); diff --git a/zone/entity.cpp b/zone/entity.cpp index 54a2b7aee..5600ccc83 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3509,32 +3509,6 @@ bool EntityList::LimitCheckName(const char *npc_name) return true; } -void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients, - bool non_clients, float range) -{ - float range2 = range * range; - - auto it = mob_list.begin(); - while (it != mob_list.end()) { - Mob *mob = it->second; - - ++it; - - if (mob->IsClient()) { - if (!clients) - continue; - } else { - if (!non_clients) - continue; - } - - if (ComparativeDistance(around->GetPosition(), mob->GetPosition()) > range2) - continue; - - - } -} - void EntityList::UpdateHoTT(Mob *target) { auto it = client_list.begin(); From 7ce5acf7013443393b85ff5e6204138e653f776f Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:43:47 -0600 Subject: [PATCH 1664/1883] Cleanup CloseFileLogs() --- common/eqemu_logsys.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 6224d287d..d31744cd1 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -305,9 +305,6 @@ void EQEmuLogSys::MakeDirectory(std::string directory_name){ void EQEmuLogSys::CloseFileLogs() { - if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ - //std::cout << "Closing down zone logs..." << std::endl; - } if (process_log.is_open()){ process_log.close(); } From 92737339b318e489072d5f18c88239537e9c7b1a Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:46:56 -0600 Subject: [PATCH 1665/1883] Properly close process files in zone and world --- world/net.cpp | 1 + zone/net.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/world/net.cpp b/world/net.cpp index fae6efd1b..da77b387c 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -493,6 +493,7 @@ int main(int argc, char** argv) { eqsf.Close(); Log.Out(Logs::Detail, Logs::World_Server,"Signaling HTTP service to stop..."); http_server.Stop(); + Log.CloseFileLogs(); return 0; } diff --git a/zone/net.cpp b/zone/net.cpp index 7d25c1ff7..5c74d209d 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -479,6 +479,7 @@ int main(int argc, char** argv) { command_deinit(); safe_delete(parse); Log.Out(Logs::Detail, Logs::Zone_Server, "Proper zone shutdown complete."); + Log.CloseFileLogs(); return 0; } @@ -495,6 +496,7 @@ void Shutdown() RunLoops = false; worldserver.Disconnect(); Log.Out(Logs::Detail, Logs::Zone_Server, "Shutting down..."); + Log.CloseFileLogs(); } uint32 NetConnection::GetIP() From 37b544202801898b6dffe30438728920ce9af36b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:47:36 -0600 Subject: [PATCH 1666/1883] Cleanup some log entries in world --- world/net.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/world/net.cpp b/world/net.cpp index da77b387c..ade37759e 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -482,16 +482,16 @@ int main(int argc, char** argv) { } Sleep(20); } - Log.Out(Logs::Detail, Logs::World_Server,"World main loop completed."); - Log.Out(Logs::Detail, Logs::World_Server,"Shutting down console connections (if any)."); + Log.Out(Logs::Detail, Logs::World_Server, "World main loop completed."); + Log.Out(Logs::Detail, Logs::World_Server, "Shutting down console connections (if any)."); console_list.KillAll(); - Log.Out(Logs::Detail, Logs::World_Server,"Shutting down zone connections (if any)."); + Log.Out(Logs::Detail, Logs::World_Server, "Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - Log.Out(Logs::Detail, Logs::World_Server,"Zone (TCP) listener stopped."); + Log.Out(Logs::Detail, Logs::World_Server, "Zone (TCP) listener stopped."); tcps.Close(); - Log.Out(Logs::Detail, Logs::World_Server,"Client (UDP) listener stopped."); + Log.Out(Logs::Detail, Logs::World_Server, "Client (UDP) listener stopped."); eqsf.Close(); - Log.Out(Logs::Detail, Logs::World_Server,"Signaling HTTP service to stop..."); + Log.Out(Logs::Detail, Logs::World_Server, "Signaling HTTP service to stop..."); http_server.Stop(); Log.CloseFileLogs(); From ab82fc17025c761b8d13b057cbfd0461696b38b8 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:51:26 -0600 Subject: [PATCH 1667/1883] Add properl file log closing to queryserv --- queryserv/queryserv.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index b724276e6..485417a0f 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -120,6 +120,7 @@ int main() { timeout_manager.CheckTimeouts(); Sleep(100); } + Log.CloseFileLogs(); } void UpdateWindowTitle(char* iNewTitle) { From cb99f92287a82293cbb15c841676a4eb9f7d5a89 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:52:59 -0600 Subject: [PATCH 1668/1883] Add properl file log closing to import and UCS --- client_files/import/main.cpp | 2 ++ ucs/ucs.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 67b0c7140..7e12b2fa2 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -60,6 +60,8 @@ int main(int argc, char **argv) { ImportSkillCaps(&database); ImportBaseData(&database); + Log.CloseFileLogs(); + return 0; } diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index e00754370..69a03c84e 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -167,6 +167,8 @@ int main() { CL->CloseAllConnections(); + Log.CloseFileLogs(); + } void UpdateWindowTitle(char* iNewTitle) { From 0cab51b68bd1a8a5f6347be04d3ebef26cf9e1f7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:53:39 -0600 Subject: [PATCH 1669/1883] Add proper file log closing to eq_launch --- eqlaunch/eqlaunch.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index db737e9a5..76c9b48d1 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -177,6 +177,8 @@ int main(int argc, char *argv[]) { delete zone->second; } + Log.CloseFileLogs(); + return 0; } From ae5887b915ce5096f94ab159a9ae335aa7be57a3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:54:12 -0600 Subject: [PATCH 1670/1883] Add proper file log closing to shared_memory --- shared_memory/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index bddf03b06..3ea29c47b 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -174,5 +174,7 @@ int main(int argc, char **argv) { } } + Log.CloseFileLogs(); + return 0; } From 43a9a4742c5d0d74a12d7a32bf92bad766115110 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 18:54:40 -0600 Subject: [PATCH 1671/1883] Add proper file log closing to export --- client_files/export/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index f950907ac..10c4e0ca9 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -63,6 +63,8 @@ int main(int argc, char **argv) { ExportSkillCaps(&database); ExportBaseData(&database); + Log.CloseFileLogs(); + return 0; } From b186b0538a498930588ae6c471255e8360e6afef Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 21 Jan 2015 20:01:59 -0500 Subject: [PATCH 1672/1883] Activated `light` field load from `npctypes` table --- changelog.txt | 5 +++++ .../2015_01_21_NPC_Types_Light_Field_Primer.sql | 5 +++++ zone/zonedb.cpp | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql diff --git a/changelog.txt b/changelog.txt index 4f9aea4d3..fc1912bbe 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/21/2015 == +Uleat: Added `light` field to npctypes load query (all six clients tested positive for functionality.) +Note: This only affects 'innate' light. Equipment (other) light is still in-work. +Optional SQL: utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql + == 01/20/2015 == Uleat: Fix for Inventory::_HasItemByUse(bucket) using the parent container when searching for bag container items. diff --git a/utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql b/utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql new file mode 100644 index 000000000..f66c3583f --- /dev/null +++ b/utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql @@ -0,0 +1,5 @@ +-- 'greater lightstone' light level on 'wisp' race +UPDATE `npc_types` SET `light` = 11 WHERE `race` = 69; + +-- 'fire beetle eye' light level on 'beetle' race with name criteria +UPDATE `npc_types` SET `light` = 12 WHERE `race` = 22 AND (`name` LIKE '%fire%' OR `name` LIKE '%lava%'); \ No newline at end of file diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index b9c66b11f..606b049ef 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1752,11 +1752,11 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.adventure_template_id, npc_types.trap_template, npc_types.attack_speed, " "npc_types.STR, npc_types.STA, npc_types.DEX, npc_types.AGI, npc_types._INT, " "npc_types.WIS, npc_types.CHA, npc_types.MR, npc_types.CR, npc_types.DR, " - "npc_types.FR, npc_types.PR, npc_types.Corrup, npc_types.PhR," - "npc_types.mindmg, npc_types.maxdmg, npc_types.attack_count, npc_types.special_abilities," - "npc_types.npc_spells_id, npc_types.npc_spells_effects_id, npc_types.d_melee_texture1," - "npc_types.d_melee_texture2, npc_types.ammo_idfile, npc_types.prim_melee_type," - "npc_types.sec_melee_type, npc_types.ranged_type, npc_types.runspeed, npc_types.findable," + "npc_types.FR, npc_types.PR, npc_types.Corrup, npc_types.PhR, " + "npc_types.mindmg, npc_types.maxdmg, npc_types.attack_count, npc_types.special_abilities, " + "npc_types.npc_spells_id, npc_types.npc_spells_effects_id, npc_types.d_melee_texture1, " + "npc_types.d_melee_texture2, npc_types.ammo_idfile, npc_types.prim_melee_type, " + "npc_types.sec_melee_type, npc_types.ranged_type, npc_types.runspeed, npc_types.findable, " "npc_types.trackable, npc_types.hp_regen_rate, npc_types.mana_regen_rate, " "npc_types.aggroradius, npc_types.assistradius, npc_types.bodytype, npc_types.npc_faction_id, " "npc_types.face, npc_types.luclin_hairstyle, npc_types.luclin_haircolor, " @@ -1769,8 +1769,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { "npc_types.see_hide, npc_types.see_improved_hide, npc_types.ATK, npc_types.Accuracy, " "npc_types.Avoidance, npc_types.slow_mitigation, npc_types.maxlevel, npc_types.scalerate, " "npc_types.private_corpse, npc_types.unique_spawn_by_name, npc_types.underwater, " - "npc_types.emoteid, npc_types.spellscale, npc_types.healscale, npc_types.no_target_hotkey," - "npc_types.raid_target, npc_types.attack_delay FROM npc_types WHERE id = %d", id); + "npc_types.emoteid, npc_types.spellscale, npc_types.healscale, npc_types.no_target_hotkey, " + "npc_types.raid_target, npc_types.attack_delay, npc_types.light FROM npc_types WHERE id = %d", id); auto results = QueryDatabase(query); if (!results.Success()) { @@ -1938,6 +1938,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->no_target_hotkey = atoi(row[88]) == 1 ? true: false; tmpNPCType->raid_target = atoi(row[89]) == 0 ? false: true; tmpNPCType->attack_delay = atoi(row[90]); + tmpNPCType->light = atoi(row[91]); // If NPC with duplicate NPC id already in table, // free item we attempted to add. From 46010fbfdf4bead4715b72fad19e0f8ea27f5927 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 19:04:13 -0600 Subject: [PATCH 1673/1883] Rename LoadLogSysSettings to LoadLogSettings --- client_files/export/main.cpp | 2 +- client_files/import/main.cpp | 2 +- common/database.cpp | 2 +- common/database.h | 2 +- queryserv/database.cpp | 2 +- queryserv/database.h | 2 +- queryserv/queryserv.cpp | 2 +- shared_memory/main.cpp | 2 +- ucs/database.cpp | 2 +- ucs/database.h | 2 +- ucs/ucs.cpp | 2 +- world/net.cpp | 2 +- world/zoneserver.cpp | 2 +- zone/net.cpp | 2 +- zone/worldserver.cpp | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 10c4e0ca9..865fbd6d8 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) { } /* Register Log System and Settings */ - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); ExportSpells(&database); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 7e12b2fa2..a8477f77a 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char **argv) { return 1; } - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); ImportSpells(&database); diff --git a/common/database.cpp b/common/database.cpp index 129fa2859..e336de437 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4159,7 +4159,7 @@ uint32 Database::GetGuildIDByCharID(uint32 char_id) return atoi(row[0]); } -void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ +void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){ std::string query = "SELECT " "log_category_id, " diff --git a/common/database.h b/common/database.h index e6515c5f6..8bea5b83c 100644 --- a/common/database.h +++ b/common/database.h @@ -646,7 +646,7 @@ public: void AddReport(std::string who, std::string against, std::string lines); /* EQEmuLogSys */ - void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings); private: void DBInitVars(); diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 1a97ecfc2..e788c801c 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -364,7 +364,7 @@ void Database::GeneralQueryReceive(ServerPacket *pack) { safe_delete(queryBuffer); } -void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ +void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){ std::string query = "SELECT " "log_category_id, " diff --git a/queryserv/database.h b/queryserv/database.h index 898e300c4..b2d32341b 100644 --- a/queryserv/database.h +++ b/queryserv/database.h @@ -52,7 +52,7 @@ public: void LogMerchantTransaction(QSMerchantLogTransaction_Struct* QS, uint32 Items); void GeneralQueryReceive(ServerPacket *pack); - void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings); protected: void HandleMysqlError(uint32 errnum); diff --git a/queryserv/queryserv.cpp b/queryserv/queryserv.cpp index 485417a0f..4ce00ed4b 100644 --- a/queryserv/queryserv.cpp +++ b/queryserv/queryserv.cpp @@ -88,7 +88,7 @@ int main() { } /* Register Log System and Settings */ - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); if (signal(SIGINT, CatchSignal) == SIG_ERR) { diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 3ea29c47b..2623ccd26 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char **argv) { } /* Register Log System and Settings */ - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); bool load_all = true; diff --git a/ucs/database.cpp b/ucs/database.cpp index a295880f2..75be71377 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -578,7 +578,7 @@ void Database::GetFriendsAndIgnore(int charID, std::vector &friends } -void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ +void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){ std::string query = "SELECT " "log_category_id, " diff --git a/ucs/database.h b/ucs/database.h index a8c382982..ade93ef42 100644 --- a/ucs/database.h +++ b/ucs/database.h @@ -58,7 +58,7 @@ public: void AddFriendOrIgnore(int CharID, int Type, std::string Name); void RemoveFriendOrIgnore(int CharID, int Type, std::string Name); void GetFriendsAndIgnore(int CharID, std::vector &Friends, std::vector &Ignorees); - void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings); protected: diff --git a/ucs/ucs.cpp b/ucs/ucs.cpp index 69a03c84e..b6beeb268 100644 --- a/ucs/ucs.cpp +++ b/ucs/ucs.cpp @@ -98,7 +98,7 @@ int main() { } /* Register Log System and Settings */ - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); char tmp[64]; diff --git a/world/net.cpp b/world/net.cpp index ade37759e..12e3c4a3b 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -184,7 +184,7 @@ int main(int argc, char** argv) { guild_mgr.SetDatabase(&database); /* Register Log System and Settings */ - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); if (argc >= 2) { diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 51c07954e..65c80cac7 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -794,7 +794,7 @@ bool ZoneServer::Process() { } case ServerOP_ReloadLogs: { zoneserver_list.SendPacket(pack); - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); break; } case ServerOP_ReloadRules: { diff --git a/zone/net.cpp b/zone/net.cpp index 5c74d209d..826db4ab8 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -168,7 +168,7 @@ int main(int argc, char** argv) { /* Register Log System and Settings */ Log.OnLogHookCallBackZone(&Zone::GMSayHookCallBackProcess); - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); Log.StartFileLogs(); /* Guilds */ diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index ac5899638..e3cee409b 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1749,7 +1749,7 @@ void WorldServer::Process() { break; } case ServerOP_ReloadLogs: { - database.LoadLogSysSettings(Log.log_settings); + database.LoadLogSettings(Log.log_settings); break; } case ServerOP_CameraShake: From 9f25b52f9ac4d9f87a0d70ec9002ae12d61861c2 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 19:08:43 -0600 Subject: [PATCH 1674/1883] Change some zone server Logging to General (Level 1) debugging --- zone/net.cpp | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/zone/net.cpp b/zone/net.cpp index 826db4ab8..dd96f0e17 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -146,7 +146,7 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading server configuration.."); + Log.Out(Logs::General, Logs::Zone_Server, "Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { Log.Out(Logs::General, Logs::Error, "Loading server configuration failed."); return 1; @@ -155,7 +155,7 @@ int main(int argc, char** argv) { worldserver.SetPassword(Config->SharedKey.c_str()); - Log.Out(Logs::Detail, Logs::Zone_Server, "Connecting to MySQL..."); + Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), @@ -179,7 +179,7 @@ int main(int argc, char** argv) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - Log.Out(Logs::Detail, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(Logs::General, Logs::Zone_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); /* * Setup nice signal handlers @@ -199,85 +199,85 @@ int main(int argc, char** argv) { } #endif - Log.Out(Logs::Detail, Logs::Zone_Server, "Mapping Incoming Opcodes"); + Log.Out(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes"); MapOpcodes(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading Variables"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading Variables"); database.LoadVariables(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading zone names"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading zone names"); database.LoadZoneNames(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading items"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading items"); if (!database.LoadItems()) { Log.Out(Logs::General, Logs::Error, "Loading items FAILED!"); Log.Out(Logs::General, Logs::Error, "Failed. But ignoring error and going on..."); } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading npc faction lists"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading npc faction lists"); if (!database.LoadNPCFactionLists()) { Log.Out(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); return 1; } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading loot tables"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading loot tables"); if (!database.LoadLoot()) { Log.Out(Logs::General, Logs::Error, "Loading loot FAILED!"); return 1; } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading skill caps"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading skill caps"); if (!database.LoadSkillCaps()) { Log.Out(Logs::General, Logs::Error, "Loading skill caps FAILED!"); return 1; } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading spells"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading spells"); EQEmu::MemoryMappedFile *mmf = nullptr; LoadSpells(&mmf); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading base data"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading base data"); if (!database.LoadBaseData()) { Log.Out(Logs::General, Logs::Error, "Loading base data FAILED!"); return 1; } - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading guilds"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading guilds"); guild_mgr.LoadGuilds(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading factions"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading factions"); database.LoadFactionData(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading titles"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading titles"); title_manager.LoadTitles(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading AA effects"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading AA effects"); database.LoadAAEffects(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading tributes"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading tributes"); database.LoadTributes(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading corpse timers"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading commands"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading commands"); int retval=command_init(); if(retval<0) Log.Out(Logs::General, Logs::Error, "Command loading FAILED"); else - Log.Out(Logs::Detail, Logs::Zone_Server, "%d commands loaded", retval); + Log.Out(Logs::General, Logs::Zone_Server, "%d commands loaded", retval); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { Log.Out(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(Logs::Detail, Logs::Zone_Server, "No rule set configured, using default rules"); + Log.Out(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules"); } else { - Log.Out(Logs::Detail, Logs::Zone_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp); } } } @@ -300,7 +300,7 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - Log.Out(Logs::Detail, Logs::Zone_Server, "Loading quests"); + Log.Out(Logs::General, Logs::Zone_Server, "Loading quests"); parse->ReloadQuests(); if (!worldserver.Connect()) { @@ -315,7 +315,7 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name,".")) { - Log.Out(Logs::Detail, Logs::Zone_Server, "Entering sleep mode"); + Log.Out(Logs::General, Logs::Zone_Server, "Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), 0, true)) { //todo: go above and fix this to allow cmd line instance Log.Out(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup"); zone = 0; @@ -347,7 +347,7 @@ int main(int argc, char** argv) { worldserver.Process(); if (!eqsf.IsOpen() && Config->ZonePort!=0) { - Log.Out(Logs::Detail, Logs::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); + Log.Out(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d",Config->ZonePort); if (!eqsf.Open(Config->ZonePort)) { Log.Out(Logs::General, Logs::Error, "Failed to open port %d",Config->ZonePort); ZoneConfig::SetZonePort(0); @@ -478,14 +478,14 @@ int main(int argc, char** argv) { safe_delete(taskmanager); command_deinit(); safe_delete(parse); - Log.Out(Logs::Detail, Logs::Zone_Server, "Proper zone shutdown complete."); + Log.Out(Logs::General, Logs::Zone_Server, "Proper zone shutdown complete."); Log.CloseFileLogs(); return 0; } void CatchSignal(int sig_num) { #ifdef _WINDOWS - Log.Out(Logs::Detail, Logs::Zone_Server, "Recieved signal: %i", sig_num); + Log.Out(Logs::General, Logs::Zone_Server, "Recieved signal: %i", sig_num); #endif RunLoops = false; } @@ -495,7 +495,7 @@ void Shutdown() Zone::Shutdown(true); RunLoops = false; worldserver.Disconnect(); - Log.Out(Logs::Detail, Logs::Zone_Server, "Shutting down..."); + Log.Out(Logs::General, Logs::Zone_Server, "Shutting down..."); Log.CloseFileLogs(); } From e1bfbfa30c486f452e2e6f1610ff65637654fbcb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 19:15:36 -0600 Subject: [PATCH 1675/1883] Change some world server Logging to General (Level 1) debugging --- world/net.cpp | 112 +++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/world/net.cpp b/world/net.cpp index 12e3c4a3b..b775685f5 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -126,30 +126,30 @@ int main(int argc, char** argv) { } // Load server configuration - Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration.."); + Log.Out(Logs::General, Logs::World_Server, "Loading server configuration.."); if (!WorldConfig::LoadConfig()) { - Log.Out(Logs::Detail, Logs::World_Server, "Loading server configuration failed."); + Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed."); return 1; } const WorldConfig *Config=WorldConfig::get(); - Log.Out(Logs::Detail, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); + Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION); #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif if (signal(SIGINT, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler"); return 1; } if (signal(SIGTERM, CatchSignal) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler"); return 1; } #ifndef WIN32 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - Log.Out(Logs::Detail, Logs::World_Server, "Could not set signal handler"); + Log.Out(Logs::General, Logs::World_Server, "Could not set signal handler"); return 1; } #endif @@ -158,7 +158,7 @@ int main(int argc, char** argv) { if (Config->LoginCount == 0) { if (Config->LoginHost.length()) { loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str()); - Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); + Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort); } } else { LinkedList loginlist=Config->loginlist; @@ -166,19 +166,19 @@ int main(int argc, char** argv) { iterator.Reset(); while(iterator.MoreElements()) { loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str()); - Log.Out(Logs::Detail, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); + Log.Out(Logs::General, Logs::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort); iterator.Advance(); } } - Log.Out(Logs::Detail, Logs::World_Server, "Connecting to MySQL..."); + Log.Out(Logs::General, Logs::World_Server, "Connecting to MySQL..."); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log.Out(Logs::Detail, Logs::World_Server, "Cannot continue without a database connection."); + Log.Out(Logs::General, Logs::World_Server, "Cannot continue without a database connection."); return 1; } guild_mgr.SetDatabase(&database); @@ -278,56 +278,56 @@ int main(int argc, char** argv) { } if(Config->WorldHTTPEnabled) { - Log.Out(Logs::Detail, Logs::World_Server, "Starting HTTP world service..."); + Log.Out(Logs::General, Logs::World_Server, "Starting HTTP world service..."); http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str()); } else { - Log.Out(Logs::Detail, Logs::World_Server, "HTTP world service disabled."); + Log.Out(Logs::General, Logs::World_Server, "HTTP world service disabled."); } - Log.Out(Logs::Detail, Logs::World_Server, "Checking Database Conversions.."); + Log.Out(Logs::General, Logs::World_Server, "Checking Database Conversions.."); database.CheckDatabaseConversions(); - Log.Out(Logs::Detail, Logs::World_Server, "Loading variables.."); + Log.Out(Logs::General, Logs::World_Server, "Loading variables.."); database.LoadVariables(); - Log.Out(Logs::Detail, Logs::World_Server, "Loading zones.."); + Log.Out(Logs::General, Logs::World_Server, "Loading zones.."); database.LoadZoneNames(); - Log.Out(Logs::Detail, Logs::World_Server, "Clearing groups.."); + Log.Out(Logs::General, Logs::World_Server, "Clearing groups.."); database.ClearGroup(); - Log.Out(Logs::Detail, Logs::World_Server, "Clearing raids.."); + Log.Out(Logs::General, Logs::World_Server, "Clearing raids.."); database.ClearRaid(); database.ClearRaidDetails(); database.ClearRaidLeader(); - Log.Out(Logs::Detail, Logs::World_Server, "Loading items.."); + Log.Out(Logs::General, Logs::World_Server, "Loading items.."); if (!database.LoadItems()) - Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load item data. But ignoring"); - Log.Out(Logs::Detail, Logs::World_Server, "Loading skill caps.."); + Log.Out(Logs::General, Logs::World_Server, "Error: Could not load item data. But ignoring"); + Log.Out(Logs::General, Logs::World_Server, "Loading skill caps.."); if (!database.LoadSkillCaps()) - Log.Out(Logs::Detail, Logs::World_Server, "Error: Could not load skill cap data. But ignoring"); - Log.Out(Logs::Detail, Logs::World_Server, "Loading guilds.."); + Log.Out(Logs::General, Logs::World_Server, "Error: Could not load skill cap data. But ignoring"); + Log.Out(Logs::General, Logs::World_Server, "Loading guilds.."); guild_mgr.LoadGuilds(); //rules: { char tmp[64]; if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) { - Log.Out(Logs::Detail, Logs::World_Server, "Loading rule set '%s'", tmp); + Log.Out(Logs::General, Logs::World_Server, "Loading rule set '%s'", tmp); if(!RuleManager::Instance()->LoadRules(&database, tmp)) { - Log.Out(Logs::Detail, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); + Log.Out(Logs::General, Logs::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp); } } else { if(!RuleManager::Instance()->LoadRules(&database, "default")) { - Log.Out(Logs::Detail, Logs::World_Server, "No rule set configured, using default rules"); + Log.Out(Logs::General, Logs::World_Server, "No rule set configured, using default rules"); } else { - Log.Out(Logs::Detail, Logs::World_Server, "Loaded default rule set 'default'", tmp); + Log.Out(Logs::General, Logs::World_Server, "Loaded default rule set 'default'", tmp); } } } if(RuleB(World, ClearTempMerchantlist)){ - Log.Out(Logs::Detail, Logs::World_Server, "Clearing temporary merchant lists.."); + Log.Out(Logs::General, Logs::World_Server, "Clearing temporary merchant lists.."); database.ClearMerchantTemp(); } - Log.Out(Logs::Detail, Logs::World_Server, "Loading EQ time of day.."); + Log.Out(Logs::General, Logs::World_Server, "Loading EQ time of day.."); if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str())) - Log.Out(Logs::Detail, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); - Log.Out(Logs::Detail, Logs::World_Server, "Loading launcher list.."); + Log.Out(Logs::General, Logs::World_Server, "Unable to load %s", Config->EQTimeFile.c_str()); + Log.Out(Logs::General, Logs::World_Server, "Loading launcher list.."); launcher_list.LoadList(); char tmp[20]; @@ -336,45 +336,45 @@ int main(int argc, char** argv) { if ((strcasecmp(tmp, "1") == 0)) { holdzones = true; } - Log.Out(Logs::Detail, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); + Log.Out(Logs::General, Logs::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF"); - Log.Out(Logs::Detail, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); + Log.Out(Logs::General, Logs::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses()); - Log.Out(Logs::Detail, Logs::World_Server, "Loading adventures..."); + Log.Out(Logs::General, Logs::World_Server, "Loading adventures..."); if(!adventure_manager.LoadAdventureTemplates()) { - Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); + Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates."); } if(!adventure_manager.LoadAdventureEntries()) { - Log.Out(Logs::Detail, Logs::World_Server, "Unable to load adventure templates."); + Log.Out(Logs::General, Logs::World_Server, "Unable to load adventure templates."); } adventure_manager.Load(); adventure_manager.LoadLeaderboardInfo(); - Log.Out(Logs::Detail, Logs::World_Server, "Purging expired instances"); + Log.Out(Logs::General, Logs::World_Server, "Purging expired instances"); database.PurgeExpiredInstances(); Timer PurgeInstanceTimer(450000); PurgeInstanceTimer.Start(450000); - Log.Out(Logs::Detail, Logs::World_Server, "Loading char create info..."); + Log.Out(Logs::General, Logs::World_Server, "Loading char create info..."); database.LoadCharacterCreateAllocations(); database.LoadCharacterCreateCombos(); char errbuf[TCPConnection_ErrorBufferSize]; if (tcps.Open(Config->WorldTCPPort, errbuf)) { - Log.Out(Logs::Detail, Logs::World_Server,"Zone (TCP) listener started."); + Log.Out(Logs::General, Logs::World_Server,"Zone (TCP) listener started."); } else { - Log.Out(Logs::Detail, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); - Log.Out(Logs::Detail, Logs::World_Server," %s",errbuf); + Log.Out(Logs::General, Logs::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort); + Log.Out(Logs::General, Logs::World_Server," %s",errbuf); return 1; } if (eqsf.Open()) { - Log.Out(Logs::Detail, Logs::World_Server,"Client (UDP) listener started."); + Log.Out(Logs::General, Logs::World_Server,"Client (UDP) listener started."); } else { - Log.Out(Logs::Detail, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)"); + Log.Out(Logs::General, Logs::World_Server,"Failed to start client (UDP) listener (port 9000)"); return 1; } @@ -402,7 +402,7 @@ int main(int argc, char** argv) { //structures and opcodes for that patch. struct in_addr in; in.s_addr = eqs->GetRemoteIP(); - Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); + Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort())); stream_identifier.AddStream(eqs); //takes the stream } @@ -415,19 +415,19 @@ int main(int argc, char** argv) { struct in_addr in; in.s_addr = eqsi->GetRemoteIP(); if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs. - Log.Out(Logs::Detail, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); + Log.Out(Logs::General, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in)); if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table. - Log.Out(Logs::Detail, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); + Log.Out(Logs::General, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in)); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); } else { - Log.Out(Logs::Detail, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); + Log.Out(Logs::General, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in)); eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream. } } if (!RuleB(World, UseBannedIPsTable)){ - Log.Out(Logs::Detail, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); + Log.Out(Logs::General, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort())); auto client = new Client(eqsi); // @merth: client->zoneattempt=0; client_list.Add(client); @@ -439,7 +439,7 @@ int main(int argc, char** argv) { while ((tcpc = tcps.NewQueuePop())) { struct in_addr in; in.s_addr = tcpc->GetrIP(); - Log.Out(Logs::Detail, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); + Log.Out(Logs::General, Logs::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort()); console_list.Add(new Console(tcpc)); } @@ -482,16 +482,16 @@ int main(int argc, char** argv) { } Sleep(20); } - Log.Out(Logs::Detail, Logs::World_Server, "World main loop completed."); - Log.Out(Logs::Detail, Logs::World_Server, "Shutting down console connections (if any)."); + Log.Out(Logs::General, Logs::World_Server, "World main loop completed."); + Log.Out(Logs::General, Logs::World_Server, "Shutting down console connections (if any)."); console_list.KillAll(); - Log.Out(Logs::Detail, Logs::World_Server, "Shutting down zone connections (if any)."); + Log.Out(Logs::General, Logs::World_Server, "Shutting down zone connections (if any)."); zoneserver_list.KillAll(); - Log.Out(Logs::Detail, Logs::World_Server, "Zone (TCP) listener stopped."); + Log.Out(Logs::General, Logs::World_Server, "Zone (TCP) listener stopped."); tcps.Close(); - Log.Out(Logs::Detail, Logs::World_Server, "Client (UDP) listener stopped."); + Log.Out(Logs::General, Logs::World_Server, "Client (UDP) listener stopped."); eqsf.Close(); - Log.Out(Logs::Detail, Logs::World_Server, "Signaling HTTP service to stop..."); + Log.Out(Logs::General, Logs::World_Server, "Signaling HTTP service to stop..."); http_server.Stop(); Log.CloseFileLogs(); @@ -499,9 +499,9 @@ int main(int argc, char** argv) { } void CatchSignal(int sig_num) { - Log.Out(Logs::Detail, Logs::World_Server,"Caught signal %d",sig_num); + Log.Out(Logs::General, Logs::World_Server,"Caught signal %d",sig_num); if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false) - Log.Out(Logs::Detail, Logs::World_Server,"Failed to save time file."); + Log.Out(Logs::General, Logs::World_Server,"Failed to save time file."); RunLoops = false; } From 376bba5156946318d6a5cf1c684c2e704a6d82a9 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 19:37:54 -0600 Subject: [PATCH 1676/1883] Some log changes --- common/eqemu_logsys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d31744cd1..2613cbe5b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -326,7 +326,7 @@ void EQEmuLogSys::StartFileLogs(const std::string log_name) return; } - std::cout << "Starting Zone Logs..." << std::endl; + EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.txt'", platform_file_name.c_str(), getpid()); EQEmuLogSys::MakeDirectory("logs/zone"); process_log.open(StringFormat("logs/zone/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } @@ -334,7 +334,7 @@ void EQEmuLogSys::StartFileLogs(const std::string log_name) if (platform_file_name == ""){ return; } - std::cout << "Starting Process Log (" << platform_file_name << ")..." << std::endl; + EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.txt'", platform_file_name.c_str(), getpid()); process_log.open(StringFormat("logs/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } } \ No newline at end of file From b4ff915cbbd0c77cd7a95ca103e486dc417e6cf7 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Wed, 21 Jan 2015 19:39:51 -0600 Subject: [PATCH 1677/1883] Change zone file log name format once it boots up --- zone/zone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zone.cpp b/zone/zone.cpp index 9c92b63f0..2cb78b302 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -151,7 +151,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { /* Set Logging */ - Log.StartFileLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + Log.StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; } From d25b750c2cc041f3cf6ee2c7d373f6afa0c520c6 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 21 Jan 2015 22:02:05 -0500 Subject: [PATCH 1678/1883] removed extra semi colon.. --- zone/aa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index b1c561c9e..af25985cc 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -647,7 +647,7 @@ void Mob::TypesTemporaryPets(uint32 typesid, Mob *targ, const char *name_overrid xy_location(5, 5), xy_location(-5, 5), xy_location(5, -5), xy_location(-5, -5), xy_location(10, 10), xy_location(-10, 10), xy_location(10, -10), xy_location(-10, -10), xy_location(8, 8), xy_location(-8, 8), xy_location(8, -8), xy_location(-8, -8) - };; + }; while(summon_count > 0) { int pet_duration = pet.duration; From ca3502758e4c33a72ac36f8c8d9a3cd03caa2302 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 21 Jan 2015 23:07:29 -0500 Subject: [PATCH 1679/1883] Added script for non-existent `light` column --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + utils/sql/git/required/2015_01_21_NPC_Types_Update.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 utils/sql/git/required/2015_01_21_NPC_Types_Update.sql diff --git a/common/version.h b/common/version.h index 48a600be1..9fb9f69e4 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9066 +#define CURRENT_BINARY_DATABASE_VERSION 9067 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 1ba3048b8..bad6798f4 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -320,6 +320,7 @@ 9064|2014_12_24_npc_types_table_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'herosforgemodel'|empty| 9065|2014_12_26_merc_weaponinfo_table_update.sql|SHOW COLUMNS FROM `vwMercNpcTypes` LIKE 'd_melee_texture1'|empty| 9066|2014_12_31_npc_types_default_values_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'bodytype'|contains|YES +9067|2015_01_21_NPC_Types_Update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql b/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql new file mode 100644 index 000000000..a73df42c8 --- /dev/null +++ b/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_types` ADD `light` tinyint( 2 ) NOT NULL DEFAULT '0'; \ No newline at end of file From 49409810df85640452b25a470e57189880239a15 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 00:15:14 -0600 Subject: [PATCH 1680/1883] Update manifest, delete SQL File --- utils/sql/db_update_manifest.txt | 2 +- utils/sql/git/required/2015_01_21_NPC_Types_Update.sql | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 utils/sql/git/required/2015_01_21_NPC_Types_Update.sql diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index bad6798f4..f97ec3a65 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -320,7 +320,7 @@ 9064|2014_12_24_npc_types_table_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'herosforgemodel'|empty| 9065|2014_12_26_merc_weaponinfo_table_update.sql|SHOW COLUMNS FROM `vwMercNpcTypes` LIKE 'd_melee_texture1'|empty| 9066|2014_12_31_npc_types_default_values_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'bodytype'|contains|YES -9067|2015_01_21_NPC_Types_Update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty| +9067|2015_01_21_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql b/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql deleted file mode 100644 index a73df42c8..000000000 --- a/utils/sql/git/required/2015_01_21_NPC_Types_Update.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `npc_types` ADD `light` tinyint( 2 ) NOT NULL DEFAULT '0'; \ No newline at end of file From 50b3c2e39fc45a265e50167eafc7cb7ba055d755 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 00:15:47 -0600 Subject: [PATCH 1681/1883] Re-add 2015_01_21_npc_types_update.sql because Git was being weird --- utils/sql/git/required/2015_01_21_npc_types_update.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/required/2015_01_21_npc_types_update.sql diff --git a/utils/sql/git/required/2015_01_21_npc_types_update.sql b/utils/sql/git/required/2015_01_21_npc_types_update.sql new file mode 100644 index 000000000..a73df42c8 --- /dev/null +++ b/utils/sql/git/required/2015_01_21_npc_types_update.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_types` ADD `light` tinyint( 2 ) NOT NULL DEFAULT '0'; \ No newline at end of file From d8926861b6e2f04ef79c86c73ef8a1507c2c0a2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 00:46:45 -0600 Subject: [PATCH 1682/1883] My GCC built fine, but lets make Travis happy --- common/eqemu_logsys.cpp | 2 ++ common/eqemu_logsys.h | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 2613cbe5b..860d8fb8a 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -77,6 +77,8 @@ namespace Console { EQEmuLogSys::EQEmuLogSys(){ on_log_gmsay_hook = [](uint16 log_type, std::string&) {}; + bool file_logs_enabled = false; + int log_platform = 0; } EQEmuLogSys::~EQEmuLogSys(){ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 3578aad0c..54e9c4809 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -141,9 +141,9 @@ public: LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; - bool file_logs_enabled = false; /* Set when log settings are loaded to determine if keeping a file open is necessary */ + bool file_logs_enabled; /* Set when log settings are loaded to determine if keeping a file open is necessary */ - int log_platform = 0; /* Sets Executable platform (Zone/World/UCS) etc. */ + int log_platform; /* Sets Executable platform (Zone/World/UCS) etc. */ std::string platform_file_name; /* File name used in writing logs */ @@ -152,7 +152,6 @@ public: void OnLogHookCallBackZone(std::function f) { on_log_gmsay_hook = f; } private: - bool zone_general_init = false; std::function on_log_gmsay_hook; std::string FormatOutMessageString(uint16 log_category, std::string in_message); From 90653a9d1756ee4f079de4e6b0c1d55b1c18db4b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 01:44:52 -0600 Subject: [PATCH 1683/1883] Comment up EQEmuLogSys class header. Change some string copys to rather pass by reference because its not necessary --- common/eqemu_logsys.cpp | 4 ++-- common/eqemu_logsys.h | 53 +++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 860d8fb8a..4979bd4b0 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -248,7 +248,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ } } -void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string message) +void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_console == 0) @@ -312,7 +312,7 @@ void EQEmuLogSys::CloseFileLogs() } } -void EQEmuLogSys::StartFileLogs(const std::string log_name) +void EQEmuLogSys::StartFileLogs(std::string log_name) { EQEmuLogSys::CloseFileLogs(); diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 54e9c4809..a30f22ef6 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -126,12 +126,31 @@ public: EQEmuLogSys(); ~EQEmuLogSys(); - void CloseFileLogs(); - void LoadLogSettingsDefaults(); - void MakeDirectory(std::string directory_name); - void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); - void SetCurrentTimeStamp(char* time_stamp); - void StartFileLogs(const std::string log_name = ""); + void CloseFileLogs(); /* Close File Logs wherever necessary, either at zone shutdown or entire process shutdown for everything else. This should be handled on deconstructor but to be safe we use it anyways. */ + void LoadLogSettingsDefaults(); /* Initializes log_settings and sets some defaults if DB is not present */ + void MakeDirectory(std::string directory_name); /* Platform independent way of performing a MakeDirectory based on name */ + /* + The one and only Logging function that uses a debug level as a parameter, as well as a log_category + log_category - defined in Logs::LogCategory::[] + log_category name resolution works by passing the enum int ID to Logs::LogCategoryName[category_id] + + Example: EQEmuLogSys::Out(Logs::General, Logs::Guilds, "This guild has no leader present"); + - This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would + be checked against to see if that piped output is set to actually process it for the category and debug level + */ + void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...); + void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */ + void StartFileLogs(std::string log_name = ""); /* Used to declare the processes file log and to keep it open for later use */ + + /* + LogSettings Struct + + This struct is the master reference for all settings for each category, and for each output + + log_to_file[category_id] = [1-3] - Sets debug level for category to output to file + log_to_console[category_id] = [1-3] - Sets debug level for category to output to console + log_to_gmsay[category_id] = [1-3] - Sets debug level for category to output to gmsay + */ struct LogSettings{ uint8 log_to_file; @@ -139,7 +158,11 @@ public: uint8 log_to_gmsay; }; - LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; + /* Internally used memory reference for all log settings per category. + These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults. + Database loaded via Database::LoadLogSettings(log_settings) + */ + LogSettings log_settings[Logs::LogCategory::MaxCategoryID]; bool file_logs_enabled; /* Set when log settings are loaded to determine if keeping a file open is necessary */ @@ -147,21 +170,21 @@ public: std::string platform_file_name; /* File name used in writing logs */ - uint16 GetGMSayColorFromCategory(uint16 log_category); + uint16 GetGMSayColorFromCategory(uint16 log_category); /* GMSay Client Message colors mapped by category */ void OnLogHookCallBackZone(std::function f) { on_log_gmsay_hook = f; } private: - std::function on_log_gmsay_hook; - std::string FormatOutMessageString(uint16 log_category, std::string in_message); - std::string GetLinuxConsoleColorFromCategory(uint16 log_category); + std::function on_log_gmsay_hook; /* Callback pointer to zone process for hooking logs to zone using GMSay */ + std::string FormatOutMessageString(uint16 log_category, std::string in_message); /* Formats log messages like '[Category] This is a log message' */ + std::string GetLinuxConsoleColorFromCategory(uint16 log_category); /* Linux console color messages mapped by category */ - uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); + uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */ - void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string message); - void ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message); - void ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message); + void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, std::string message); /* ProcessConsoleMessage called via Log.Out */ + void ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message); /* ProcessGMSay called via Log.Out */ + void ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message); /* ProcessLogWrite called via Log.Out */ }; extern EQEmuLogSys Log; From 4f931c45fb47988a93e53e971483b021944a530b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 02:21:41 -0600 Subject: [PATCH 1684/1883] Adjusting #logs verbiage --- zone/command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/command.cpp b/zone/command.cpp index 7226b57cf..5f615bb51 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10673,8 +10673,8 @@ void command_logs(Client *c, const Seperator *sep){ } else { c->Message(0, "#logs usage:"); - c->Message(0, "--- #logs reload_all - Reloads all rules defined in database in world and all zone processes"); - c->Message(0, "--- #logs list_settings - Shows current log settings and categories"); + c->Message(0, "--- #logs reload_all - Reload all settings in world and all zone processes with what is defined in the database"); + c->Message(0, "--- #logs list_settings - Shows current log settings and categories loaded into the current process' memory"); c->Message(0, "--- #logs set [console|file|gmsay] - Sets log settings during the lifetime of the zone"); } } From 7d70afd4c987bc71e10d8d9de3f36a9fe0fe88cb Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 02:36:55 -0600 Subject: [PATCH 1685/1883] Change crash location to logs/crashes/<> --- common/eqemu_logsys.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 4979bd4b0..9d5042106 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -160,8 +160,9 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std:: if (log_category == Logs::Crash){ char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); - std::ofstream crash_log; - crash_log.open(StringFormat("logs/crash_%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + std::ofstream crash_log; + EQEmuLogSys::MakeDirectory("logs/crashes"); + crash_log.open(StringFormat("logs/crashes/crash_%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); crash_log << time_stamp << " " << message << "\n"; crash_log.close(); } From 570bd1bd00055590f298c994e32645d8ec40406c Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 02:40:35 -0600 Subject: [PATCH 1686/1883] Change .txt file write extension to .log more appropriately --- common/eqemu_logsys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 9d5042106..16ad4497d 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -162,7 +162,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std:: EQEmuLogSys::SetCurrentTimeStamp(time_stamp); std::ofstream crash_log; EQEmuLogSys::MakeDirectory("logs/crashes"); - crash_log.open(StringFormat("logs/crashes/crash_%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + crash_log.open(StringFormat("logs/crashes/crash_%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); crash_log << time_stamp << " " << message << "\n"; crash_log.close(); } @@ -329,9 +329,9 @@ void EQEmuLogSys::StartFileLogs(std::string log_name) return; } - EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.txt'", platform_file_name.c_str(), getpid()); + EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid()); EQEmuLogSys::MakeDirectory("logs/zone"); - process_log.open(StringFormat("logs/zone/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); + process_log.open(StringFormat("logs/zone/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out); } else{ if (platform_file_name == ""){ From 82fb69eed49ef90e8a3f10229211ec8efca4e73b Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 02:54:53 -0600 Subject: [PATCH 1687/1883] Changelog entry --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index fc1912bbe..438d026c9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/22/2015 == +Akkadius: Massive Log System overhaul, see: http://wiki.eqemulator.org/p?Logging_System_Overhaul&frm=Main + == 01/21/2015 == Uleat: Added `light` field to npctypes load query (all six clients tested positive for functionality.) Note: This only affects 'innate' light. Equipment (other) light is still in-work. From 78a1926d72c437b5d8107e70eee9911e17debe2e Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 15:47:47 -0600 Subject: [PATCH 1688/1883] Fix .SQL file for logsys categories so that the manifest does not have issues (Again) --- ...ategories_table.sql => 2015_01_15_logsys_categories_table.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename utils/sql/git/required/{2015_1_15_logsys_categories_table.sql => 2015_01_15_logsys_categories_table.sql} (100%) diff --git a/utils/sql/git/required/2015_1_15_logsys_categories_table.sql b/utils/sql/git/required/2015_01_15_logsys_categories_table.sql similarity index 100% rename from utils/sql/git/required/2015_1_15_logsys_categories_table.sql rename to utils/sql/git/required/2015_01_15_logsys_categories_table.sql From ec121e5ec89b56d459dc1264c0f74c9b4e7bb947 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 15:53:30 -0600 Subject: [PATCH 1689/1883] Re-Fix db_update_manifest.txt and Binary Database Version --- common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/version.h b/common/version.h index 9fb9f69e4..5d09e7f7e 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9067 +#define CURRENT_BINARY_DATABASE_VERSION 9068 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index f97ec3a65..b6ce65332 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -321,6 +321,7 @@ 9065|2014_12_26_merc_weaponinfo_table_update.sql|SHOW COLUMNS FROM `vwMercNpcTypes` LIKE 'd_melee_texture1'|empty| 9066|2014_12_31_npc_types_default_values_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'bodytype'|contains|YES 9067|2015_01_21_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty| +9068|2015_01_15_logsys_categories_table.sql|SHOW TABLES LIKE 'logsys_categories'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not From 908c7b14640bd7eafc528a1cab65554d5ae33585 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 15:56:03 -0600 Subject: [PATCH 1690/1883] Re-Fix Skills log message print types --- zone/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client.cpp b/zone/client.cpp index 51ac636e6..e123e7260 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2221,10 +2221,10 @@ bool Client::CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int cha if(zone->random.Real(0, 99) < Chance) { SetSkill(skillid, GetRawSkill(skillid) + 1); - Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi); return true; } else { - Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %.4f%%chance (mod %d)", skillid, skillval, Chance, chancemodi); + Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi); } } else { Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill); From 65397cf03e41176ec8ae50f86248d93d6824fa46 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 22 Jan 2015 16:48:10 -0600 Subject: [PATCH 1691/1883] Compile fix for Loginserver --- loginserver/client.h | 2 +- loginserver/client_manager.h | 2 +- loginserver/config.cpp | 2 +- loginserver/database_mysql.cpp | 2 +- loginserver/database_postgresql.cpp | 2 +- loginserver/encryption.cpp | 2 +- loginserver/main.cpp | 4 ++-- loginserver/server_manager.h | 2 +- loginserver/world_server.h | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/loginserver/client.h b/loginserver/client.h index 784b0ba4f..b20e5ae91 100644 --- a/loginserver/client.h +++ b/loginserver/client.h @@ -18,7 +18,7 @@ #ifndef EQEMU_CLIENT_H #define EQEMU_CLIENT_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_type.h" #include "../common/eq_stream_factory.h" diff --git a/loginserver/client_manager.h b/loginserver/client_manager.h index 4c3920f04..dc7637776 100644 --- a/loginserver/client_manager.h +++ b/loginserver/client_manager.h @@ -18,7 +18,7 @@ #ifndef EQEMU_CLIENTMANAGER_H #define EQEMU_CLIENTMANAGER_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_type.h" #include "../common/eq_stream_factory.h" diff --git a/loginserver/config.cpp b/loginserver/config.cpp index 8815622d2..96a4c8568 100644 --- a/loginserver/config.cpp +++ b/loginserver/config.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "config.h" #include "error_log.h" diff --git a/loginserver/database_mysql.cpp b/loginserver/database_mysql.cpp index 924538f38..9cf08563b 100644 --- a/loginserver/database_mysql.cpp +++ b/loginserver/database_mysql.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "database.h" #ifdef EQEMU_MYSQL_ENABLED diff --git a/loginserver/database_postgresql.cpp b/loginserver/database_postgresql.cpp index e57679f64..3dc20d3f3 100644 --- a/loginserver/database_postgresql.cpp +++ b/loginserver/database_postgresql.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "database.h" #ifdef EQEMU_POSTGRESQL_ENABLED diff --git a/loginserver/encryption.cpp b/loginserver/encryption.cpp index 5585487b1..b00f5e88b 100644 --- a/loginserver/encryption.cpp +++ b/loginserver/encryption.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "encryption.h" #include "error_log.h" #include diff --git a/loginserver/main.cpp b/loginserver/main.cpp index 31941b800..0d51a69ff 100644 --- a/loginserver/main.cpp +++ b/loginserver/main.cpp @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/types.h" #include "../common/opcodemgr.h" #include "../common/eq_stream_factory.h" @@ -31,7 +31,7 @@ TimeoutManager timeout_manager; LoginServer server; -EQEmuLogSys logger; +EQEmuLogSys Log; ErrorLog *server_log; bool run_server = true; diff --git a/loginserver/server_manager.h b/loginserver/server_manager.h index e2453701d..6f9db9afa 100644 --- a/loginserver/server_manager.h +++ b/loginserver/server_manager.h @@ -18,7 +18,7 @@ #ifndef EQEMU_SERVERMANAGER_H #define EQEMU_SERVERMANAGER_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_stream_factory.h" #include "../common/emu_tcp_connection.h" #include "../common/emu_tcp_server.h" diff --git a/loginserver/world_server.h b/loginserver/world_server.h index ff790e103..0d8ed4251 100644 --- a/loginserver/world_server.h +++ b/loginserver/world_server.h @@ -18,7 +18,7 @@ #ifndef EQEMU_WORLDSERVER_H #define EQEMU_WORLDSERVER_H -#include "../common/debug.h" +#include "../common/global_define.h" #include "../common/eq_stream_factory.h" #include "../common/emu_tcp_connection.h" #include "../common/emu_tcp_server.h" From 03286f540a59e5f98f5a5c7cf6f57cf52cd448dd Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 22 Jan 2015 16:52:50 -0800 Subject: [PATCH 1692/1883] Updated version of glm --- CMakeLists.txt | 2 +- common/glm/glm/CMakeLists.txt | 12 +- common/glm/glm/common.hpp | 9 +- common/glm/glm/detail/_features.hpp | 15 +- common/glm/glm/detail/_fixes.hpp | 6 +- common/glm/glm/detail/_noise.hpp | 26 +- common/glm/glm/detail/_swizzle.hpp | 991 +++++++------- common/glm/glm/detail/_swizzle_func.hpp | 11 +- common/glm/glm/detail/_vectorize.hpp | 283 ++-- common/glm/glm/detail/dummy.cpp | 34 +- common/glm/glm/detail/func_common.hpp | 168 +-- common/glm/glm/detail/func_common.inl | 932 +++++-------- common/glm/glm/detail/func_exponential.hpp | 62 +- common/glm/glm/detail/func_exponential.inl | 188 +-- common/glm/glm/detail/func_geometric.hpp | 51 +- common/glm/glm/detail/func_geometric.inl | 237 +--- common/glm/glm/detail/func_integer.hpp | 141 +- common/glm/glm/detail/func_integer.inl | 763 ++++------- common/glm/glm/detail/func_matrix.hpp | 15 +- common/glm/glm/detail/func_matrix.inl | 244 +--- common/glm/glm/detail/func_noise.hpp | 17 +- common/glm/glm/detail/func_noise.inl | 294 ++-- common/glm/glm/detail/func_packing.hpp | 12 +- common/glm/glm/detail/func_packing.inl | 14 +- common/glm/glm/detail/func_trigonometric.hpp | 76 +- common/glm/glm/detail/func_trigonometric.inl | 264 ++-- .../glm/glm/detail/func_vector_relational.hpp | 33 +- .../glm/glm/detail/func_vector_relational.inl | 94 +- common/glm/glm/detail/glm.cpp | 14 +- common/glm/glm/detail/intrinsic_common.hpp | 6 +- common/glm/glm/detail/intrinsic_common.inl | 2 +- .../glm/glm/detail/intrinsic_exponential.hpp | 6 +- .../glm/glm/detail/intrinsic_exponential.inl | 2 +- common/glm/glm/detail/intrinsic_geometric.hpp | 6 +- common/glm/glm/detail/intrinsic_geometric.inl | 31 +- common/glm/glm/detail/intrinsic_integer.hpp | 6 +- common/glm/glm/detail/intrinsic_integer.inl | 2 +- common/glm/glm/detail/intrinsic_matrix.hpp | 6 +- common/glm/glm/detail/intrinsic_matrix.inl | 10 +- .../glm/detail/intrinsic_trigonometric.hpp | 6 +- .../glm/detail/intrinsic_trigonometric.inl | 2 +- .../detail/intrinsic_vector_relational.hpp | 6 +- .../detail/intrinsic_vector_relational.inl | 176 +-- common/glm/glm/detail/precision.hpp | 11 +- common/glm/glm/detail/precision.inl | 0 common/glm/glm/detail/setup.hpp | 757 +++++----- common/glm/glm/detail/type_float.hpp | 11 +- common/glm/glm/detail/type_gentype.hpp | 11 +- common/glm/glm/detail/type_gentype.inl | 6 +- common/glm/glm/detail/type_half.hpp | 15 +- common/glm/glm/detail/type_half.inl | 9 +- common/glm/glm/detail/type_int.hpp | 155 ++- common/glm/glm/detail/type_mat.hpp | 166 ++- common/glm/glm/detail/type_mat.inl | 7 +- common/glm/glm/detail/type_mat2x2.hpp | 141 +- common/glm/glm/detail/type_mat2x2.inl | 353 ++--- common/glm/glm/detail/type_mat2x3.hpp | 70 +- common/glm/glm/detail/type_mat2x3.inl | 323 ++--- common/glm/glm/detail/type_mat2x4.hpp | 73 +- common/glm/glm/detail/type_mat2x4.inl | 319 ++--- common/glm/glm/detail/type_mat3x2.hpp | 71 +- common/glm/glm/detail/type_mat3x2.inl | 292 ++-- common/glm/glm/detail/type_mat3x3.hpp | 71 +- common/glm/glm/detail/type_mat3x3.inl | 440 ++---- common/glm/glm/detail/type_mat3x4.hpp | 141 +- common/glm/glm/detail/type_mat3x4.inl | 315 ++--- common/glm/glm/detail/type_mat4x2.hpp | 139 +- common/glm/glm/detail/type_mat4x2.inl | 312 ++--- common/glm/glm/detail/type_mat4x3.hpp | 140 +- common/glm/glm/detail/type_mat4x3.inl | 326 ++--- common/glm/glm/detail/type_mat4x4.hpp | 173 +-- common/glm/glm/detail/type_mat4x4.inl | 507 +++---- common/glm/glm/detail/type_vec.hpp | 246 ++-- common/glm/glm/detail/type_vec.inl | 6 +- common/glm/glm/detail/type_vec1.hpp | 104 +- common/glm/glm/detail/type_vec1.inl | 455 ++---- common/glm/glm/detail/type_vec2.hpp | 231 +++- common/glm/glm/detail/type_vec2.inl | 695 +++++----- common/glm/glm/detail/type_vec3.hpp | 273 ++-- common/glm/glm/detail/type_vec3.inl | 819 ++++++----- common/glm/glm/detail/type_vec4.hpp | 411 ++++-- common/glm/glm/detail/type_vec4.inl | 981 +++++++------ .../detail/{hint.hpp => type_vec4_avx.inl} | 25 +- .../type_vec4_avx2.inl} | 21 +- common/glm/glm/detail/type_vec4_sse2.inl | 120 ++ common/glm/glm/exponential.hpp | 9 +- common/glm/glm/ext.hpp | 35 +- common/glm/glm/fwd.hpp | 1217 +++++++++-------- common/glm/glm/geometric.hpp | 9 +- common/glm/glm/glm.hpp | 16 +- common/glm/glm/gtc/bitfield.hpp | 236 ++++ common/glm/glm/gtc/bitfield.inl | 542 ++++++++ common/glm/glm/gtc/constants.hpp | 30 +- common/glm/glm/gtc/constants.inl | 34 +- common/glm/glm/gtc/epsilon.hpp | 9 +- common/glm/glm/gtc/epsilon.inl | 24 +- common/glm/glm/gtc/integer.hpp | 105 ++ common/glm/glm/gtc/integer.inl | 74 + common/glm/glm/gtc/matrix_access.hpp | 19 +- common/glm/glm/gtc/matrix_access.inl | 24 +- common/glm/glm/gtc/matrix_integer.hpp | 153 ++- common/glm/glm/gtc/matrix_inverse.hpp | 18 +- common/glm/glm/gtc/matrix_inverse.inl | 51 +- common/glm/glm/gtc/matrix_transform.hpp | 218 +-- common/glm/glm/gtc/matrix_transform.inl | 379 +++-- common/glm/glm/gtc/noise.hpp | 16 +- common/glm/glm/gtc/noise.inl | 861 ++++++------ common/glm/glm/gtc/packing.hpp | 48 +- common/glm/glm/gtc/packing.inl | 97 +- common/glm/glm/gtc/quaternion.hpp | 244 ++-- common/glm/glm/gtc/quaternion.inl | 593 +++----- common/glm/glm/gtc/random.hpp | 42 +- common/glm/glm/gtc/random.inl | 328 ++++- common/glm/glm/gtc/reciprocal.hpp | 9 +- common/glm/glm/gtc/reciprocal.inl | 165 ++- common/glm/glm/gtc/round.hpp | 203 +++ common/glm/glm/gtc/round.inl | 378 +++++ common/glm/glm/gtc/type_precision.hpp | 188 +-- common/glm/glm/gtc/type_precision.inl | 4 + common/glm/glm/gtc/type_ptr.hpp | 43 +- common/glm/glm/gtc/type_ptr.inl | 140 +- common/glm/glm/gtc/ulp.hpp | 10 +- common/glm/glm/gtc/ulp.inl | 40 +- common/glm/glm/{gtx => gtc}/vec1.hpp | 129 +- common/glm/glm/{gtx => gtc}/vec1.inl | 8 +- common/glm/glm/gtx/associated_min_max.hpp | 207 ++- common/glm/glm/gtx/associated_min_max.inl | 812 ++--------- common/glm/glm/gtx/bit.hpp | 216 +-- common/glm/glm/gtx/bit.inl | 803 +---------- common/glm/glm/gtx/closest_point.hpp | 28 +- common/glm/glm/gtx/closest_point.inl | 75 +- common/glm/glm/gtx/color_space.hpp | 31 +- common/glm/glm/gtx/color_space.inl | 67 +- common/glm/glm/gtx/color_space_YCoCg.hpp | 25 +- common/glm/glm/gtx/color_space_YCoCg.inl | 61 +- common/glm/glm/gtx/common.hpp | 74 + common/glm/glm/gtx/common.inl | 102 ++ common/glm/glm/gtx/compatibility.hpp | 140 +- common/glm/glm/gtx/compatibility.inl | 65 +- common/glm/glm/gtx/component_wise.hpp | 10 +- common/glm/glm/gtx/component_wise.inl | 45 +- common/glm/glm/gtx/constants.hpp | 33 - common/glm/glm/gtx/dual_quaternion.hpp | 227 +-- common/glm/glm/gtx/dual_quaternion.inl | 324 ++--- common/glm/glm/gtx/epsilon.hpp | 29 - common/glm/glm/gtx/euler_angles.hpp | 39 +- common/glm/glm/gtx/euler_angles.inl | 91 +- common/glm/glm/gtx/extend.hpp | 9 +- common/glm/glm/gtx/extend.inl | 55 +- common/glm/glm/gtx/extented_min_max.hpp | 9 +- common/glm/glm/gtx/extented_min_max.inl | 37 +- common/glm/glm/gtx/fast_exponential.hpp | 74 +- common/glm/glm/gtx/fast_exponential.inl | 116 +- common/glm/glm/gtx/fast_square_root.hpp | 73 +- common/glm/glm/gtx/fast_square_root.inl | 160 +-- common/glm/glm/gtx/fast_trigonometry.hpp | 72 +- common/glm/glm/gtx/fast_trigonometry.inl | 141 +- common/glm/glm/gtx/gradient_paint.hpp | 21 +- common/glm/glm/gtx/gradient_paint.inl | 55 +- .../glm/glm/gtx/handed_coordinate_space.hpp | 21 +- .../glm/glm/gtx/handed_coordinate_space.inl | 49 +- common/glm/glm/gtx/inertia.hpp | 116 -- common/glm/glm/gtx/inertia.inl | 116 -- common/glm/glm/gtx/int_10_10_10_2.hpp | 44 - common/glm/glm/gtx/integer.hpp | 15 +- common/glm/glm/gtx/integer.inl | 71 +- common/glm/glm/gtx/intersect.hpp | 9 +- common/glm/glm/gtx/io.hpp | 242 ++-- common/glm/glm/gtx/io.inl | 822 +++++++---- common/glm/glm/gtx/log_base.hpp | 22 +- common/glm/glm/gtx/log_base.inl | 51 +- common/glm/glm/gtx/matrix_cross_product.hpp | 17 +- common/glm/glm/gtx/matrix_cross_product.inl | 51 +- .../matrix_decompose.hpp} | 57 +- common/glm/glm/gtx/matrix_decompose.inl | 230 ++++ common/glm/glm/gtx/matrix_interpolation.hpp | 27 +- common/glm/glm/gtx/matrix_interpolation.inl | 71 +- common/glm/glm/gtx/matrix_major_storage.hpp | 81 +- common/glm/glm/gtx/matrix_major_storage.inl | 135 +- common/glm/glm/gtx/matrix_operation.hpp | 45 +- common/glm/glm/gtx/matrix_operation.inl | 93 +- common/glm/glm/gtx/matrix_query.hpp | 21 +- common/glm/glm/gtx/matrix_query.inl | 98 +- common/glm/glm/gtx/matrix_transform_2d.hpp | 39 +- common/glm/glm/gtx/matrix_transform_2d.inl | 54 +- common/glm/glm/gtx/mixed_product.hpp | 15 +- common/glm/glm/gtx/mixed_product.inl | 45 +- common/glm/glm/gtx/multiple.hpp | 51 +- common/glm/glm/gtx/multiple.inl | 172 +-- common/glm/glm/gtx/noise.hpp | 29 - common/glm/glm/gtx/norm.hpp | 27 +- common/glm/glm/gtx/norm.inl | 75 +- common/glm/glm/gtx/normal.hpp | 17 +- common/glm/glm/gtx/normal.inl | 47 +- common/glm/glm/gtx/normalize_dot.hpp | 36 +- common/glm/glm/gtx/normalize_dot.inl | 141 +- common/glm/glm/gtx/number_precision.hpp | 9 +- common/glm/glm/gtx/number_precision.inl | 39 +- common/glm/glm/gtx/optimum_pow.hpp | 49 +- common/glm/glm/gtx/optimum_pow.inl | 71 +- common/glm/glm/gtx/orthonormalize.hpp | 30 +- common/glm/glm/gtx/orthonormalize.inl | 56 +- common/glm/glm/gtx/perpendicular.hpp | 9 +- common/glm/glm/gtx/perpendicular.inl | 39 +- common/glm/glm/gtx/polar_coordinates.hpp | 17 +- common/glm/glm/gtx/polar_coordinates.inl | 67 +- common/glm/glm/gtx/projection.hpp | 22 +- common/glm/glm/gtx/projection.inl | 47 +- common/glm/glm/gtx/quaternion.hpp | 105 +- common/glm/glm/gtx/quaternion.inl | 199 +-- common/glm/glm/gtx/random.hpp | 29 - common/glm/glm/gtx/range.hpp | 102 ++ common/glm/glm/gtx/raw_data.hpp | 9 +- common/glm/glm/gtx/raw_data.inl | 42 +- common/glm/glm/gtx/reciprocal.hpp | 26 - common/glm/glm/gtx/rotate_normalized_axis.hpp | 27 +- common/glm/glm/gtx/rotate_normalized_axis.inl | 46 +- common/glm/glm/gtx/rotate_vector.hpp | 68 +- common/glm/glm/gtx/rotate_vector.inl | 190 ++- common/glm/glm/gtx/scalar_multiplication.hpp | 98 ++ common/glm/glm/gtx/scalar_relational.hpp | 11 +- common/glm/glm/gtx/scalar_relational.inl | 39 +- common/glm/glm/gtx/simd_mat4.hpp | 14 +- common/glm/glm/gtx/simd_mat4.inl | 51 +- common/glm/glm/gtx/simd_quat.hpp | 164 ++- common/glm/glm/gtx/simd_quat.inl | 82 +- common/glm/glm/gtx/simd_vec4.hpp | 10 +- common/glm/glm/gtx/simd_vec4.inl | 12 +- common/glm/glm/gtx/spline.hpp | 16 +- common/glm/glm/gtx/spline.inl | 142 +- common/glm/glm/gtx/std_based_type.hpp | 47 +- common/glm/glm/gtx/std_based_type.inl | 39 +- common/glm/glm/gtx/string_cast.hpp | 20 +- common/glm/glm/gtx/string_cast.inl | 835 +++++------ common/glm/glm/gtx/transform.hpp | 35 +- common/glm/glm/gtx/transform.inl | 57 +- common/glm/glm/gtx/transform2.hpp | 53 +- common/glm/glm/gtx/transform2.inl | 111 +- common/glm/glm/gtx/type_aligned.hpp | 995 ++++++++++++++ .../{int_10_10_10_2.inl => type_aligned.inl} | 19 +- common/glm/glm/gtx/ulp.hpp | 29 - common/glm/glm/gtx/unsigned_int.inl | 13 - common/glm/glm/gtx/vector_angle.hpp | 19 +- common/glm/glm/gtx/vector_angle.inl | 96 +- common/glm/glm/gtx/vector_query.hpp | 9 +- common/glm/glm/gtx/vector_query.inl | 82 +- common/glm/glm/gtx/wrap.hpp | 9 +- common/glm/glm/gtx/wrap.inl | 114 +- common/glm/glm/integer.hpp | 9 +- common/glm/glm/mat2x2.hpp | 21 +- common/glm/glm/mat2x3.hpp | 14 +- common/glm/glm/mat2x4.hpp | 15 +- common/glm/glm/mat3x2.hpp | 15 +- common/glm/glm/mat3x3.hpp | 21 +- common/glm/glm/mat3x4.hpp | 15 +- common/glm/glm/mat4x2.hpp | 15 +- common/glm/glm/mat4x3.hpp | 15 +- common/glm/glm/mat4x4.hpp | 21 +- common/glm/glm/matrix.hpp | 9 +- common/glm/glm/packing.hpp | 9 +- common/glm/glm/trigonometric.hpp | 9 +- common/glm/glm/vec2.hpp | 9 +- common/glm/glm/vec3.hpp | 9 +- common/glm/glm/vec4.hpp | 9 +- common/glm/glm/vector_relational.hpp | 9 +- common/glm/glm/virtrev/xstream.hpp | 166 --- zone/lua_general.cpp | 4 +- zone/oriented_bounding_box.cpp | 4 +- zone/oriented_bounding_box.h | 3 +- zone/position.h | 4 + 270 files changed, 17903 insertions(+), 16363 deletions(-) delete mode 100644 common/glm/glm/detail/precision.inl rename common/glm/glm/detail/{hint.hpp => type_vec4_avx.inl} (84%) rename common/glm/glm/{gtx/unsigned_int.hpp => detail/type_vec4_avx2.inl} (80%) create mode 100644 common/glm/glm/detail/type_vec4_sse2.inl create mode 100644 common/glm/glm/gtc/bitfield.hpp create mode 100644 common/glm/glm/gtc/bitfield.inl create mode 100644 common/glm/glm/gtc/integer.hpp create mode 100644 common/glm/glm/gtc/integer.inl create mode 100644 common/glm/glm/gtc/round.hpp create mode 100644 common/glm/glm/gtc/round.inl rename common/glm/glm/{gtx => gtc}/vec1.hpp (53%) rename common/glm/glm/{gtx => gtc}/vec1.inl (89%) create mode 100644 common/glm/glm/gtx/common.hpp create mode 100644 common/glm/glm/gtx/common.inl delete mode 100644 common/glm/glm/gtx/constants.hpp delete mode 100644 common/glm/glm/gtx/epsilon.hpp delete mode 100644 common/glm/glm/gtx/inertia.hpp delete mode 100644 common/glm/glm/gtx/inertia.inl delete mode 100644 common/glm/glm/gtx/int_10_10_10_2.hpp rename common/glm/glm/{detail/_literals.hpp => gtx/matrix_decompose.hpp} (53%) create mode 100644 common/glm/glm/gtx/matrix_decompose.inl delete mode 100644 common/glm/glm/gtx/noise.hpp delete mode 100644 common/glm/glm/gtx/random.hpp create mode 100644 common/glm/glm/gtx/range.hpp delete mode 100644 common/glm/glm/gtx/reciprocal.hpp create mode 100644 common/glm/glm/gtx/scalar_multiplication.hpp create mode 100644 common/glm/glm/gtx/type_aligned.hpp rename common/glm/glm/gtx/{int_10_10_10_2.inl => type_aligned.inl} (84%) delete mode 100644 common/glm/glm/gtx/ulp.hpp delete mode 100644 common/glm/glm/gtx/unsigned_int.inl delete mode 100644 common/glm/glm/virtrev/xstream.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b7569ed5..494959cbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,7 +325,7 @@ IF(EQEMU_BUILD_LUA) ENDIF(EQEMU_SANITIZE_LUA_LIBS) ENDIF(EQEMU_BUILD_LUA) -INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm") +INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm") IF(EQEMU_BUILD_LUA) ADD_SUBDIRECTORY(luabind) diff --git a/common/glm/glm/CMakeLists.txt b/common/glm/glm/CMakeLists.txt index 79a46074a..9dbe11cab 100644 --- a/common/glm/glm/CMakeLists.txt +++ b/common/glm/glm/CMakeLists.txt @@ -30,11 +30,13 @@ source_group("GTX Files" FILES ${GTX_HEADER}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) -add_executable(${NAME} ${ROOT_TEXT} - ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} - ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} - ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +if(GLM_TEST_ENABLE) + add_executable(${NAME} ${ROOT_TEXT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_TEST_ENABLE) #add_library(glm STATIC glm.cpp) #add_library(glm_shared SHARED glm.cpp) diff --git a/common/glm/glm/common.hpp b/common/glm/glm/common.hpp index 2d787dde0..8f1c3171e 100644 --- a/common/glm/glm/common.hpp +++ b/common/glm/glm/common.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -26,9 +30,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_COMMON_INCLUDED -#define GLM_COMMON_INCLUDED +#pragma once #include "detail/func_common.hpp" - -#endif//GLM_COMMON_INCLUDED diff --git a/common/glm/glm/detail/_features.hpp b/common/glm/glm/detail/_features.hpp index 1c7fe8c96..51eda577c 100644 --- a/common/glm/glm/detail/_features.hpp +++ b/common/glm/glm/detail/_features.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,13 +25,12 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/_features.hpp +/// @file glm/detail/_features.hpp /// @date 2013-02-20 / 2013-02-20 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_features -#define glm_core_features +#pragma once // #define GLM_CXX98_EXCEPTIONS // #define GLM_CXX98_RTTI @@ -281,7 +284,7 @@ # define GLM_CXX11_STATIC_ASSERT # endif -#elif(GLM_COMPILER & GLM_COMPILER_CLANG) +#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) # if(__has_feature(cxx_exceptions)) # define GLM_CXX98_EXCEPTIONS # endif @@ -422,6 +425,4 @@ # define GLM_CXX11_VARIADIC_TEMPLATES # endif -#endif//(GLM_COMPILER & GLM_COMPILER_CLANG) - -#endif//glm_core_features +#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) diff --git a/common/glm/glm/detail/_fixes.hpp b/common/glm/glm/detail/_fixes.hpp index ce13bb1be..6185dcbb7 100644 --- a/common/glm/glm/detail/_fixes.hpp +++ b/common/glm/glm/detail/_fixes.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,7 +25,7 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/_fixes.hpp +/// @file glm/detail/_fixes.hpp /// @date 2011-02-21 / 2011-11-22 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// diff --git a/common/glm/glm/detail/_noise.hpp b/common/glm/glm/detail/_noise.hpp index e366e7c38..94c835d54 100644 --- a/common/glm/glm/detail/_noise.hpp +++ b/common/glm/glm/detail/_noise.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -26,8 +30,12 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_DETAIL_NOISE_INCLUDED -#define GLM_DETAIL_NOISE_INCLUDED +#pragma once + +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../common.hpp" namespace glm{ namespace detail @@ -75,19 +83,19 @@ namespace detail } template - GLM_FUNC_QUALIFIER detail::tvec2 taylorInvSqrt(detail::tvec2 const & r) + GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) { return T(1.79284291400159) - T(0.85373472095314) * r; } template - GLM_FUNC_QUALIFIER detail::tvec3 taylorInvSqrt(detail::tvec3 const & r) + GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) { return T(1.79284291400159) - T(0.85373472095314) * r; } template - GLM_FUNC_QUALIFIER detail::tvec4 taylorInvSqrt(detail::tvec4 const & r) + GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) { return T(1.79284291400159) - T(0.85373472095314) * r; } @@ -100,19 +108,19 @@ namespace detail */ template - GLM_FUNC_QUALIFIER detail::tvec2 fade(detail::tvec2 const & t) + GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) { return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); } template - GLM_FUNC_QUALIFIER detail::tvec3 fade(detail::tvec3 const & t) + GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) { return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); } template - GLM_FUNC_QUALIFIER detail::tvec4 fade(detail::tvec4 const & t) + GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) { return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); } @@ -126,5 +134,3 @@ namespace detail }//namespace detail }//namespace glm -#endif//GLM_DETAIL_NOISE_INCLUDED - diff --git a/common/glm/glm/detail/_swizzle.hpp b/common/glm/glm/detail/_swizzle.hpp index 407ffb49c..3edf6cb23 100644 --- a/common/glm/glm/detail/_swizzle.hpp +++ b/common/glm/glm/detail/_swizzle.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,13 +25,12 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/_swizzle.hpp +/// @file glm/detail/_swizzle.hpp /// @date 2006-04-20 / 2011-02-16 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_swizzle -#define glm_core_swizzle +#pragma once namespace glm{ namespace detail @@ -139,20 +142,15 @@ namespace detail GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) { -#ifndef __CUDA_ARCH__ - static -#endif - const int offset_dst[4] = { E0, E1, E2, E3 }; + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { -#ifndef __CUDA_ARCH__ - static -#endif - const int offset_dst[4] = { E0, E1, E2, E3 }; + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } + protected: template GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) @@ -180,16 +178,13 @@ namespace detail GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { -#ifndef __CUDA_ARCH__ - static -#endif - const int offset_dst[4] = { E0, E1, E2, E3 }; + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } }; template - struct _swizzle : public _swizzle_base2 + struct _swizzle : public _swizzle_base2 { typedef _swizzle_base2 base_type; @@ -339,502 +334,500 @@ namespace glm } #define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0,E1) \ - struct { _swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { _swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { _swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { _swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; + struct { detail::_swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; #define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0,E1) \ - struct { _swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { _swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { _swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { _swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { _swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { _swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { _swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { _swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; + struct { detail::_swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; #define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0,E1) \ - struct { _swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; #define _GLM_SWIZZLE3_2_MEMBERS(T, P, V, E0,E1,E2) \ - struct { _swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { _swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { _swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { _swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { _swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { _swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { _swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { _swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { _swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; #define _GLM_SWIZZLE3_3_MEMBERS(T, P, V ,E0,E1,E2) \ - struct { _swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; #define _GLM_SWIZZLE3_4_MEMBERS(T, P, V, E0,E1,E2) \ - struct { _swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; #define _GLM_SWIZZLE4_2_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { _swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { _swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { _swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { _swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ - struct { _swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { _swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { _swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { _swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ - struct { _swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { _swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { _swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ - struct { _swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ - struct { _swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ - struct { _swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ - struct { _swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ - struct { _swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; #define _GLM_SWIZZLE4_3_MEMBERS(T,P, V, E0,E1,E2,E3) \ - struct { _swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ - struct { _swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ - struct { _swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ - struct { _swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ - struct { _swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ - struct { _swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ - struct { _swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ - struct { _swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ - struct { _swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ - struct { _swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ - struct { _swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ - struct { _swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ - struct { _swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ - struct { _swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ - struct { _swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ - struct { _swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ - struct { _swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ - struct { _swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ - struct { _swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ - struct { _swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ - struct { _swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ - struct { _swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ - struct { _swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ - struct { _swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ - struct { _swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ - struct { _swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ - struct { _swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ - struct { _swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ - struct { _swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ - struct { _swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ - struct { _swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ - struct { _swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ - struct { _swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ - struct { _swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ - struct { _swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ - struct { _swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ - struct { _swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; #define _GLM_SWIZZLE4_4_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { _swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ - struct { _swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ - struct { _swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ - struct { _swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ - struct { _swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; - -#endif//glm_core_swizzle + struct { detail::_swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; diff --git a/common/glm/glm/detail/_swizzle_func.hpp b/common/glm/glm/detail/_swizzle_func.hpp index c287bbf5b..7d725e10a 100644 --- a/common/glm/glm/detail/_swizzle_func.hpp +++ b/common/glm/glm/detail/_swizzle_func.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,13 +25,12 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/_swizzle_func.hpp +/// @file glm/detail/_swizzle_func.hpp /// @date 2011-10-16 / 2011-10-16 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_swizzle_func -#define glm_core_swizzle_func +#pragma once #define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ SWIZZLED_TYPE A ## B() CONST \ @@ -720,5 +723,3 @@ GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) //GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) - -#endif//glm_core_swizzle_func diff --git a/common/glm/glm/detail/_vectorize.hpp b/common/glm/glm/detail/_vectorize.hpp index b653fa9f3..8eea6b871 100644 --- a/common/glm/glm/detail/_vectorize.hpp +++ b/common/glm/glm/detail/_vectorize.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,197 +25,136 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/_vectorize.hpp +/// @file glm/detail/_vectorize.hpp /// @date 2011-10-14 / 2011-10-14 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_CORE_DETAIL_INCLUDED -#define GLM_CORE_DETAIL_INCLUDED +#pragma once #include "type_vec1.hpp" #include "type_vec2.hpp" #include "type_vec3.hpp" #include "type_vec4.hpp" -#define VECTORIZE1_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec1 func( \ - detail::tvec1 const & v) \ - { \ - return detail::tvec1( \ - func(v.x)); \ - } - -#define VECTORIZE2_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func( \ - detail::tvec2 const & v) \ - { \ - return detail::tvec2( \ - func(v.x), \ - func(v.y)); \ - } - -#define VECTORIZE3_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func( \ - detail::tvec3 const & v) \ - { \ - return detail::tvec3( \ - func(v.x), \ - func(v.y), \ - func(v.z)); \ - } - -#define VECTORIZE4_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func( \ - detail::tvec4 const & v) \ - { \ - return detail::tvec4( \ - func(v.x), \ - func(v.y), \ - func(v.z), \ - func(v.w)); \ - } - -#define VECTORIZE_VEC(func) \ - VECTORIZE1_VEC(func) \ - VECTORIZE2_VEC(func) \ - VECTORIZE3_VEC(func) \ - VECTORIZE4_VEC(func) - -#define VECTORIZE1_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec1 func \ - ( \ - detail::tvec1 const & x, \ - T const & y \ - ) \ - { \ - return detail::tvec1( \ - func(x.x, y)); \ - } - -#define VECTORIZE2_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func \ - ( \ - detail::tvec2 const & x, \ - T const & y \ - ) \ - { \ - return detail::tvec2( \ - func(x.x, y), \ - func(x.y, y)); \ - } - -#define VECTORIZE3_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func \ - ( \ - detail::tvec3 const & x, \ - T const & y \ - ) \ - { \ - return detail::tvec3( \ - func(x.x, y), \ - func(x.y, y), \ - func(x.z, y)); \ - } - -#define VECTORIZE4_VEC_SCA(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func \ - ( \ - detail::tvec4 const & x, \ - T const & y \ - ) \ - { \ - return detail::tvec4( \ - func(x.x, y), \ - func(x.y, y), \ - func(x.z, y), \ - func(x.w, y)); \ - } - -#define VECTORIZE_VEC_SCA(func) \ - VECTORIZE1_VEC_SCA(func) \ - VECTORIZE2_VEC_SCA(func) \ - VECTORIZE3_VEC_SCA(func) \ - VECTORIZE4_VEC_SCA(func) - -#define VECTORIZE2_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 func \ - ( \ - detail::tvec2 const & x, \ - detail::tvec2 const & y \ - ) \ - { \ - return detail::tvec2( \ - func(x.x, y.x), \ - func(x.y, y.y)); \ - } - -#define VECTORIZE3_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 func \ - ( \ - detail::tvec3 const & x, \ - detail::tvec3 const & y \ - ) \ - { \ - return detail::tvec3( \ - func(x.x, y.x), \ - func(x.y, y.y), \ - func(x.z, y.z)); \ - } - -#define VECTORIZE4_VEC_VEC(func) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 func \ - ( \ - detail::tvec4 const & x, \ - detail::tvec4 const & y \ - ) \ - { \ - return detail::tvec4( \ - func(x.x, y.x), \ - func(x.y, y.y), \ - func(x.z, y.z), \ - func(x.w, y.w)); \ - } - -#define VECTORIZE_VEC_VEC(func) \ - VECTORIZE2_VEC_VEC(func) \ - VECTORIZE3_VEC_VEC(func) \ - VECTORIZE4_VEC_VEC(func) - namespace glm{ namespace detail { - template - struct If + template class vecType> + struct functor1{}; + + template + struct functor1 { - template - static GLM_FUNC_QUALIFIER T apply(F functor, const T& val) + GLM_FUNC_QUALIFIER static tvec1 call(R (*Func) (T x), tvec1 const & v) { - return functor(val); + return tvec1(Func(v.x)); } }; - template<> - struct If + template + struct functor1 { - template - static GLM_FUNC_QUALIFIER T apply(F, const T& val) + GLM_FUNC_QUALIFIER static tvec2 call(R (*Func) (T x), tvec2 const & v) { - return val; + return tvec2(Func(v.x), Func(v.y)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec3 call(R (*Func) (T x), tvec3 const & v) + { + return tvec3(Func(v.x), Func(v.y), Func(v.z)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec4 call(R (*Func) (T x), tvec4 const & v) + { + return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); + } + }; + + template class vecType> + struct functor2{}; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, tvec1 const & b) + { + return tvec1(Func(a.x, b.x)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, tvec2 const & b) + { + return tvec2(Func(a.x, b.x), Func(a.y, b.y)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, tvec3 const & b) + { + return tvec3(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, tvec4 const & b) + { + return tvec4(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); + } + }; + + template class vecType> + struct functor2_vec_sca{}; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, T b) + { + return tvec1(Func(a.x, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, T b) + { + return tvec2(Func(a.x, b), Func(a.y, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, T b) + { + return tvec3(Func(a.x, b), Func(a.y, b), Func(a.z, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, T b) + { + return tvec4(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); } }; }//namespace detail }//namespace glm - -#endif//GLM_CORE_DETAIL_INCLUDED diff --git a/common/glm/glm/detail/dummy.cpp b/common/glm/glm/detail/dummy.cpp index 26160a51a..c7ef99edb 100644 --- a/common/glm/glm/detail/dummy.cpp +++ b/common/glm/glm/detail/dummy.cpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -29,7 +33,6 @@ /// dummy.cpp exist only a wordaround for CMake file. /////////////////////////////////////////////////////////////////////////////////// -#define GLM_FORCE_RADIANS #define GLM_MESSAGES #include "../glm.hpp" #include @@ -42,6 +45,7 @@ struct material glm::vec4 specular; // Scm float shininess; // Srm }; + struct light { glm::vec4 ambient; // Acli @@ -60,6 +64,7 @@ struct light float quadraticAttenuation;// K2 }; + // Sample 1 #include // glm::vec3 #include // glm::cross, glm::normalize @@ -184,7 +189,34 @@ glm::vec3 lighting return Color; } */ + + +template class vecType> +T normalizeDotA(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class + +template +T normalizeDotB(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +template +typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) +{ + return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); +} + int main() { + glm::vec4 v(1); + float a = normalizeDotA(v, v); + float b = normalizeDotB(v, v); + float c = normalizeDotC(v, v); + return 0; } diff --git a/common/glm/glm/detail/func_common.hpp b/common/glm/glm/detail/func_common.hpp index a3e5d6338..0cea49426 100644 --- a/common/glm/glm/detail/func_common.hpp +++ b/common/glm/glm/detail/func_common.hpp @@ -12,6 +12,10 @@ /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -21,7 +25,7 @@ /// THE SOFTWARE. /// /// @ref core -/// @file glm/core/func_common.hpp +/// @file glm/detail/func_common.hpp /// @date 2008-03-08 / 2010-01-26 /// @author Christophe Riccio /// @@ -33,8 +37,7 @@ /// These all operate component-wise. The description is per component. /////////////////////////////////////////////////////////////////////////////////// -#ifndef GLM_FUNC_COMMON_INCLUDED -#define GLM_FUNC_COMMON_INCLUDED +#pragma once #include "setup.hpp" #include "precision.hpp" @@ -53,7 +56,10 @@ namespace glm /// @see GLSL abs man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType abs(genType const & x); + GLM_FUNC_DECL genType abs(genType x); + + template class vecType> + GLM_FUNC_DECL vecType abs(vecType const & x); /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. /// @@ -61,17 +67,17 @@ namespace glm /// /// @see GLSL sign man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType sign(genType const & x); - + template class vecType> + GLM_FUNC_DECL vecType sign(vecType const & x); + /// Returns a value equal to the nearest integer that is less then or equal to x. /// /// @tparam genType Floating-point scalar or vector types. /// /// @see GLSL floor man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType floor(genType const & x); + template class vecType> + GLM_FUNC_DECL vecType floor(vecType const & x); /// Returns a value equal to the nearest integer to x /// whose absolute value is not larger than the absolute value of x. @@ -80,8 +86,8 @@ namespace glm /// /// @see GLSL trunc man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType trunc(genType const & x); + template class vecType> + GLM_FUNC_DECL vecType trunc(vecType const & x); /// Returns a value equal to the nearest integer to x. /// The fraction 0.5 will round in a direction chosen by the @@ -93,9 +99,9 @@ namespace glm /// /// @see GLSL round man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType round(genType const & x); - + template class vecType> + GLM_FUNC_DECL vecType round(vecType const & x); + /// Returns a value equal to the nearest integer to x. /// A fractional part of 0.5 will round toward the nearest even /// integer. (Both 3.5 and 4.5 for x will return 4.0.) @@ -105,8 +111,8 @@ namespace glm /// @see GLSL roundEven man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions /// @see New round to even technique - template - GLM_FUNC_DECL genType roundEven(genType const & x); + template class vecType> + GLM_FUNC_DECL vecType roundEven(vecType const & x); /// Returns a value equal to the nearest integer /// that is greater than or equal to x. @@ -115,8 +121,8 @@ namespace glm /// /// @see GLSL ceil man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType ceil(genType const & x); + template class vecType> + GLM_FUNC_DECL vecType ceil(vecType const & x); /// Return x - floor(x). /// @@ -125,7 +131,10 @@ namespace glm /// @see GLSL fract man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType fract(genType const & x); + GLM_FUNC_DECL genType fract(genType x); + + template class vecType> + GLM_FUNC_DECL vecType fract(vecType const & x); /// Modulus. Returns x - y * floor(x / y) /// for each component in x using the floating point value y. @@ -135,21 +144,13 @@ namespace glm /// @see GLSL mod man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType mod( - genType const & x, - genType const & y); + GLM_FUNC_DECL genType mod(genType x, genType y); - /// Modulus. Returns x - y * floor(x / y) - /// for each component in x using the floating point value y. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL mod man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType mod( - genType const & x, - typename genType::value_type const & y); + template class vecType> + GLM_FUNC_DECL vecType mod(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType mod(vecType const & x, vecType const & y); /// Returns the fractional part of x and sets i to the integer /// part (as a whole number floating point value). Both the @@ -161,25 +162,22 @@ namespace glm /// @see GLSL modf man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType modf( - genType const & x, - genType & i); + GLM_FUNC_DECL genType modf(genType x, genType & i); /// Returns y if y < x; otherwise, it returns x. /// /// @tparam genType Floating-point or integer; scalar or vector types. /// /// @see GLSL min man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions<<<<<<< HEAD + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType min( - genType const & x, - genType const & y); + GLM_FUNC_DECL genType min(genType x, genType y); - template - GLM_FUNC_DECL genType min( - genType const & x, - typename genType::value_type const & y); + template class vecType> + GLM_FUNC_DECL vecType min(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType min(vecType const & x, vecType const & y); /// Returns y if x < y; otherwise, it returns x. /// @@ -188,14 +186,13 @@ namespace glm /// @see GLSL max man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType max( - genType const & x, - genType const & y); + GLM_FUNC_DECL genType max(genType x, genType y); - template - GLM_FUNC_DECL genType max( - genType const & x, - typename genType::value_type const & y); + template class vecType> + GLM_FUNC_DECL vecType max(vecType const & x, T y); + + template class vecType> + GLM_FUNC_DECL vecType max(vecType const & x, vecType const & y); /// Returns min(max(x, minVal), maxVal) for each component in x /// using the floating-point values minVal and maxVal. @@ -205,16 +202,13 @@ namespace glm /// @see GLSL clamp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType clamp( - genType const & x, - genType const & minVal, - genType const & maxVal); + GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal); - template - GLM_FUNC_DECL genType clamp( - genType const & x, - typename genType::value_type const & minVal, - typename genType::value_type const & maxVal); + template class vecType> + GLM_FUNC_DECL vecType clamp(vecType const & x, T minVal, T maxVal); + + template class vecType> + GLM_FUNC_DECL vecType clamp(vecType const & x, vecType const & minVal, vecType const & maxVal); /// If genTypeU is a floating scalar or vector: /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of @@ -259,40 +253,34 @@ namespace glm /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. /// @endcode template class vecType> - GLM_FUNC_DECL vecType mix( - vecType const & x, - vecType const & y, - vecType const & a); + GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, vecType const & a); template class vecType> - GLM_FUNC_DECL vecType mix( - vecType const & x, - vecType const & y, - U const & a); + GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, U a); template - GLM_FUNC_DECL genTypeT mix( - genTypeT const & x, - genTypeT const & y, - genTypeU const & a); + GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. /// /// @see GLSL step man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - GLM_FUNC_DECL genType step( - genType const & edge, - genType const & x); + GLM_FUNC_DECL genType step(genType edge, genType x); /// Returns 0.0 if x < edge, otherwise it returns 1.0. /// /// @see GLSL step man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template
NameZoneXYZDate" "RezzedBuried
 " @@ -6208,13 +6208,13 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) float CorpseY = atof(row[3]); float CorpseZ = atof(row[4]); - strn0cpy(timeOfDeath, row[5], sizeof(timeOfDeath)); + strn0cpy(time_of_death, row[5], sizeof(time_of_death)); bool corpseRezzed = atoi(row[6]); bool corpseBuried = atoi(row[7]); popupText += StringFormat("
%s%s%8.0f%8.0f%8.0f%s%s%s